-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsubmit.php
143 lines (137 loc) · 5.85 KB
/
submit.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
<?php
include( 'config/config.php' );
global $map, $fork, $noSubmit;
if ( $noSubmit === true ) {
http_response_code( 401 );
die();
}
$useragent = isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : '';
if (preg_match("/curl|libcurl/", $useragent)) {
http_response_code(400);
die();
}
$action = ! empty( $_POST['action'] ) ? $_POST['action'] : '';
$lat = ! empty( $_POST['lat'] ) ? $_POST['lat'] : '';
$lon = ! empty( $_POST['lon'] ) ? $_POST['lon'] : '';
$pokemonId = ! empty( $_POST['pokemonId'] ) ? $_POST['pokemonId'] : 0;
$gymId = ! empty( $_POST['gymId'] ) ? $_POST['gymId'] : 0;
$eggTime = ! empty( $_POST['eggTime'] ) ? $_POST['eggTime'] : 0;
$monTime = ! empty( $_POST['monTime'] ) ? $_POST['monTime'] : 0;
$loggedUser = ! empty( $_SESSION['user']->user ) ? $_SESSION['user']->user : 'NOLOGIN';
$gymName = ! empty( $_POST['gymName'] ) ? $_POST['gymName'] : '';
$pokestopId = ! empty( $_POST['pokestopId'] ) ? $_POST['pokestopId'] : '';
$pokestopName = ! empty( $_POST['pokestopName'] ) ? $_POST['pokestopName'] : '';
$questType = ! empty( $_POST['questType'] ) ? $_POST['questType'] : '';
$questTarget = ! empty( $_POST['questTarget'] ) ? $_POST['questTarget'] : '';
$conditionType = ! empty( $_POST['conditionType'] ) ? $_POST['conditionType'] : '';
$catchPokemon = ! empty( $_POST['catchPokemon'] ) ? $_POST['catchPokemon'] : '';
$catchPokemonCategory = ! empty( $_POST['catchPokemonCategory'] ) ? $_POST['catchPokemonCategory'] : '';
$raidLevel = ! empty( $_POST['raidLevel'] ) ? $_POST['raidLevel'] : '';
$throwType = ! empty( $_POST['throwType'] ) ? $_POST['throwType'] : '';
$curveThrow = ! empty( $_POST['curveThrow'] ) ? $_POST['curveThrow'] : '';
$rewardType = ! empty( $_POST['rewardType'] ) ? $_POST['rewardType'] : '';
$encounter = ! empty( $_POST['encounter'] ) ? $_POST['encounter'] : '';
$item = ! empty( $_POST['item'] ) ? $_POST['item'] : '';
$itemAmount = ! empty( $_POST['itemamount'] ) ? $_POST['itemamount'] : '1';
$dust = ! empty( $_POST['dust'] ) ? $_POST['dust'] : '';
$nestId = ! empty( $_POST['nestId'] ) ? $_POST['nestId'] : '';
$portalId = ! empty( $_POST['portalId'] ) ? $_POST['portalId'] : '';
$communityId = ! empty( $_POST['communityId'] ) ? $_POST['communityId'] : '';
$communityName = ! empty( $_POST['communityName'] ) ? $_POST['communityName'] : '';
$communityDescription = ! empty( $_POST['communityDescription'] ) ? $_POST['communityDescription'] : '';
$communityInvite = ! empty( $_POST['communityInvite'] ) ? $_POST['communityInvite'] : '';
$poiName = ! empty( $_POST['poiName'] ) ? $_POST['poiName'] : '';
$poiDescription = ! empty( $_POST['poiDescription'] ) ? $_POST['poiDescription'] : '';
$poiId = ! empty( $_POST['poiId'] ) ? $_POST['poiId'] : '';
// set content type
header( 'Content-Type: application/json' );
$now = new DateTime();
$now->sub( new DateInterval( 'PT20S' ) );
$d = array();
$d['status'] = "ok";
$d["timestamp"] = $now->getTimestamp();
if (strtolower($map) === "rdm") {
if (strtolower($fork) === "beta") {
$submit = new \Submit\RDM();
}
} else if (strtolower($map) === "monocle") {
if (strtolower($fork) === "pmsf") {
$submit = new \Submit\Monocle_PMSF();
} elseif (strtolower($fork) === "mad") {
$submit = new \Submit\Monocle_MAD();
}
}
if ( $action === "raid" ) {
$submit->submit_raid($pokemonId, $gymId, $eggTime, $monTime, $loggedUser);
}
if ( $action === "pokemon" ) {
$submit->submit_pokemon($lat, $lon, $pokemonId);
}
if ( $action === "gym" ) {
$submit->submit_gym($lat, $lon, $gymName, $loggedUser);
}
if ( $action === "toggle-ex-gym" ) {
$submit->toggle_ex($gymId, $loggedUser);
}
if ( $action === "delete-gym" ) {
$submit->delete_gym($gymId, $loggedUser);
}
if ( $action === "pokestop" ) {
$submit->submit_pokestop($lat, $lon, $pokestopName, $loggedUser);
}
if ( $action === "renamepokestop" ) {
$submit->modify_pokestop($pokestopId, $pokestopName, $loggedUser);
}
if ( $action === "delete-pokestop" ) {
$submit->delete_pokestop($pokestopId, $loggedUser);
}
if ( $action === "convertpokestop" ) {
$submit->convert_pokestop($pokestopId, $loggedUser);
}
if ( $action === "quest" ) {
$submit->submit_quest($pokestopId, $questType, $questTarget, $conditionType, $catchPokemonCategory, $catchPokemon, $raidLevel, $throwType, $curveThrow, $rewardType, $encounter, $item, $itemAmount, $dust, $loggedUser);
}
if ( $action === "convertportalpokestop" ) {
$submit->convert_portal_pokestop($portalId, $loggedUser);
}
if ( $action === "convertportalgym" ) {
$submit->convert_portal_gym($portalId, $loggedUser);
}
if ( $action === "markportal" ) {
$submit->mark_portal($portalId, $loggedUser);
}
if ( $action === "delete-portal" ) {
$submit->delete_portal($portalId, $loggedUser);
}
if ( $action === "nest" ) {
$submit->modify_nest($nestId, $pokemonId, $loggedUser);
}
if ( $action === "new-nest" ) {
$submit->submit_nest($lat, $lon, $pokemonId, $loggedUser);
}
if ( $action === "delete-nest" ) {
$submit->delete_nest($nestId);
}
if ( $action === "community-add" ) {
$submit->submit_community($lat, $lon, $communityName, $communityDescription, $communityInvite, $loggedUser);
}
if ( $action === "editcommunity" ) {
$submit->modify_community($communityId, $communityName, $communityDescription, $communityInvite, $loggedUser);
}
if ( $action === "delete-community" ) {
$submit->delete_community($communityId, $loggedUser);
}
if ( $action === "poi-add" ) {
$submit->submit_poi($lat, $lon, $poiName, $poiDescription, $loggedUser);
}
if ( $action === "delete-poi" ) {
$submit->delete_poi($poiId, $loggedUser);
}
if ( $action === "markpoisubmitted" ) {
$submit->mark_poi_submitted($poiId, $loggedUser);
}
if ( $action === "markpoideclined" ) {
$submit->mark_poi_declined($poiId, $loggedUser);
}
$jaysson = json_encode($d);
echo $jaysson;