@@ -58,150 +58,150 @@ discard block |
||
| 58 | 58 | // |
| 59 | 59 | ############################ |
| 60 | 60 | |
| 61 | - case 'home_update': |
|
| 62 | - // Right now |
|
| 63 | - // --------- |
|
| 61 | + case 'home_update': |
|
| 62 | + // Right now |
|
| 63 | + // --------- |
|
| 64 | 64 | |
| 65 | - $req = "SELECT COUNT(*) as total FROM pokemon WHERE disappear_time >= UTC_TIMESTAMP()"; |
|
| 66 | - $result = $mysqli->query($req); |
|
| 67 | - $data = $result->fetch_object(); |
|
| 65 | + $req = "SELECT COUNT(*) as total FROM pokemon WHERE disappear_time >= UTC_TIMESTAMP()"; |
|
| 66 | + $result = $mysqli->query($req); |
|
| 67 | + $data = $result->fetch_object(); |
|
| 68 | 68 | |
| 69 | - $values[] = $data->total; |
|
| 69 | + $values[] = $data->total; |
|
| 70 | 70 | |
| 71 | 71 | |
| 72 | - // Lured stops |
|
| 73 | - // ----------- |
|
| 72 | + // Lured stops |
|
| 73 | + // ----------- |
|
| 74 | 74 | |
| 75 | - $req = "SELECT COUNT(*) as total FROM pokestop WHERE lure_expiration >= UTC_TIMESTAMP()"; |
|
| 76 | - $result = $mysqli->query($req); |
|
| 77 | - $data = $result->fetch_object(); |
|
| 75 | + $req = "SELECT COUNT(*) as total FROM pokestop WHERE lure_expiration >= UTC_TIMESTAMP()"; |
|
| 76 | + $result = $mysqli->query($req); |
|
| 77 | + $data = $result->fetch_object(); |
|
| 78 | 78 | |
| 79 | - $values[] = $data->total; |
|
| 79 | + $values[] = $data->total; |
|
| 80 | 80 | |
| 81 | 81 | |
| 82 | 82 | |
| 83 | - // Team battle |
|
| 84 | - // ----------- |
|
| 83 | + // Team battle |
|
| 84 | + // ----------- |
|
| 85 | 85 | |
| 86 | - $req = "SELECT count( DISTINCT(gym_id) ) as total FROM gym"; |
|
| 87 | - $result = $mysqli->query($req); |
|
| 88 | - $data = $result->fetch_object(); |
|
| 86 | + $req = "SELECT count( DISTINCT(gym_id) ) as total FROM gym"; |
|
| 87 | + $result = $mysqli->query($req); |
|
| 88 | + $data = $result->fetch_object(); |
|
| 89 | 89 | |
| 90 | - $values[] = $data->total; |
|
| 90 | + $values[] = $data->total; |
|
| 91 | 91 | |
| 92 | - // Team |
|
| 93 | - // 1 = bleu |
|
| 94 | - // 2 = rouge |
|
| 95 | - // 3 = jaune |
|
| 92 | + // Team |
|
| 93 | + // 1 = bleu |
|
| 94 | + // 2 = rouge |
|
| 95 | + // 3 = jaune |
|
| 96 | 96 | |
| 97 | - $req = "SELECT count( DISTINCT(gym_id) ) as total FROM gym WHERE team_id = '2' "; |
|
| 98 | - $result = $mysqli->query($req); |
|
| 99 | - $data = $result->fetch_object(); |
|
| 97 | + $req = "SELECT count( DISTINCT(gym_id) ) as total FROM gym WHERE team_id = '2' "; |
|
| 98 | + $result = $mysqli->query($req); |
|
| 99 | + $data = $result->fetch_object(); |
|
| 100 | 100 | |
| 101 | - // Red |
|
| 102 | - $values[] = $data->total; |
|
| 101 | + // Red |
|
| 102 | + $values[] = $data->total; |
|
| 103 | 103 | |
| 104 | 104 | |
| 105 | - $req = "SELECT count( DISTINCT(gym_id) ) as total FROM gym WHERE team_id = '1' "; |
|
| 106 | - $result = $mysqli->query($req); |
|
| 107 | - $data = $result->fetch_object(); |
|
| 105 | + $req = "SELECT count( DISTINCT(gym_id) ) as total FROM gym WHERE team_id = '1' "; |
|
| 106 | + $result = $mysqli->query($req); |
|
| 107 | + $data = $result->fetch_object(); |
|
| 108 | 108 | |
| 109 | - // Blue |
|
| 110 | - $values[] = $data->total; |
|
| 109 | + // Blue |
|
| 110 | + $values[] = $data->total; |
|
| 111 | 111 | |
| 112 | 112 | |
| 113 | - $req = "SELECT count( DISTINCT(gym_id) ) as total FROM gym WHERE team_id = '3' "; |
|
| 114 | - $result = $mysqli->query($req); |
|
| 115 | - $data = $result->fetch_object(); |
|
| 113 | + $req = "SELECT count( DISTINCT(gym_id) ) as total FROM gym WHERE team_id = '3' "; |
|
| 114 | + $result = $mysqli->query($req); |
|
| 115 | + $data = $result->fetch_object(); |
|
| 116 | 116 | |
| 117 | - // Yellow |
|
| 118 | - $values[] = $data->total; |
|
| 117 | + // Yellow |
|
| 118 | + $values[] = $data->total; |
|
| 119 | 119 | |
| 120 | - $req = "SELECT count( DISTINCT(gym_id) ) as total FROM gym WHERE team_id = '0' "; |
|
| 121 | - $result = $mysqli->query($req); |
|
| 122 | - $data = $result->fetch_object(); |
|
| 120 | + $req = "SELECT count( DISTINCT(gym_id) ) as total FROM gym WHERE team_id = '0' "; |
|
| 121 | + $result = $mysqli->query($req); |
|
| 122 | + $data = $result->fetch_object(); |
|
| 123 | 123 | |
| 124 | - // Neutral |
|
| 125 | - $values[] = $data->total; |
|
| 124 | + // Neutral |
|
| 125 | + $values[] = $data->total; |
|
| 126 | 126 | |
| 127 | 127 | |
| 128 | - header('Content-Type: application/json'); |
|
| 129 | - $json = json_encode($values); |
|
| 128 | + header('Content-Type: application/json'); |
|
| 129 | + $json = json_encode($values); |
|
| 130 | 130 | |
| 131 | - echo $json; |
|
| 131 | + echo $json; |
|
| 132 | 132 | |
| 133 | 133 | |
| 134 | - break; |
|
| 134 | + break; |
|
| 135 | 135 | |
| 136 | 136 | |
| 137 | 137 | |
| 138 | - #################################### |
|
| 139 | - // |
|
| 140 | - // Update latests spawn on homepage |
|
| 141 | - // |
|
| 142 | - #################################### |
|
| 138 | + #################################### |
|
| 139 | + // |
|
| 140 | + // Update latests spawn on homepage |
|
| 141 | + // |
|
| 142 | + #################################### |
|
| 143 | 143 | |
| 144 | - case 'spawnlist_update': |
|
| 145 | - // Recent spawn |
|
| 146 | - // ------------ |
|
| 147 | - $total_spawns = array(); |
|
| 148 | - $last_uid_param = ""; |
|
| 149 | - if (isset($_GET['last_uid'])) { |
|
| 150 | - $last_uid_param = $_GET['last_uid']; |
|
| 151 | - } |
|
| 152 | - if ($config->system->recents_filter) { |
|
| 153 | - // get all mythic pokemon ids |
|
| 154 | - $mythic_pokemons = array(); |
|
| 155 | - foreach ($pokemons->pokemon as $id => $pokemon) { |
|
| 156 | - if ($pokemon->spawn_rate < $config->system->recents_filter_rarity && $pokemon->rating >= $config->system->recents_filter_rating) { |
|
| 157 | - $mythic_pokemons[] = $id; |
|
| 158 | - } |
|
| 144 | + case 'spawnlist_update': |
|
| 145 | + // Recent spawn |
|
| 146 | + // ------------ |
|
| 147 | + $total_spawns = array(); |
|
| 148 | + $last_uid_param = ""; |
|
| 149 | + if (isset($_GET['last_uid'])) { |
|
| 150 | + $last_uid_param = $_GET['last_uid']; |
|
| 159 | 151 | } |
| 152 | + if ($config->system->recents_filter) { |
|
| 153 | + // get all mythic pokemon ids |
|
| 154 | + $mythic_pokemons = array(); |
|
| 155 | + foreach ($pokemons->pokemon as $id => $pokemon) { |
|
| 156 | + if ($pokemon->spawn_rate < $config->system->recents_filter_rarity && $pokemon->rating >= $config->system->recents_filter_rating) { |
|
| 157 | + $mythic_pokemons[] = $id; |
|
| 158 | + } |
|
| 159 | + } |
|
| 160 | 160 | |
| 161 | - // get last mythic pokemon |
|
| 162 | - $req = "SELECT pokemon_id, encounter_id, disappear_time, last_modified, (CONVERT_TZ(disappear_time, '+00:00', '".$time_offset."')) as disappear_time_real, latitude, longitude, individual_attack, individual_defense, individual_stamina FROM pokemon |
|
| 161 | + // get last mythic pokemon |
|
| 162 | + $req = "SELECT pokemon_id, encounter_id, disappear_time, last_modified, (CONVERT_TZ(disappear_time, '+00:00', '".$time_offset."')) as disappear_time_real, latitude, longitude, individual_attack, individual_defense, individual_stamina FROM pokemon |
|
| 163 | 163 | WHERE pokemon_id IN (".implode(",", $mythic_pokemons).") |
| 164 | 164 | ORDER BY last_modified DESC LIMIT 0,12"; |
| 165 | - } else { |
|
| 166 | - // get last pokemon |
|
| 167 | - $req = "SELECT pokemon_id, encounter_id, disappear_time, last_modified, (CONVERT_TZ(disappear_time, '+00:00', '".$time_offset."')) as disappear_time_real, latitude, longitude, individual_attack, individual_defense, individual_stamina FROM pokemon ORDER BY last_modified DESC LIMIT 0,12"; |
|
| 168 | - } |
|
| 169 | - $result = $mysqli->query($req); |
|
| 170 | - while ($data = $result->fetch_object()) { |
|
| 171 | - $new_spawn = array(); |
|
| 172 | - $pokeid = $data->pokemon_id; |
|
| 173 | - $pokeuid = $data->encounter_id; |
|
| 174 | - |
|
| 175 | - if ($last_uid_param != $pokeuid) { |
|
| 176 | - $last_seen = strtotime($data->disappear_time_real); |
|
| 177 | - |
|
| 178 | - $last_location = new stdClass(); |
|
| 179 | - $last_location->latitude = $data->latitude; |
|
| 180 | - $last_location->longitude = $data->longitude; |
|
| 181 | - |
|
| 182 | - if ($config->system->recents_show_iv) { |
|
| 183 | - $iv = new stdClass(); |
|
| 184 | - $iv->attack = $data->individual_attack; |
|
| 185 | - $iv->defense = $data->individual_defense; |
|
| 186 | - $iv->stamina = $data->individual_stamina; |
|
| 187 | - if (isset($iv->attack) && isset($iv->defense) && isset($iv->stamina)) { |
|
| 188 | - $iv->available = true; |
|
| 189 | - } else { |
|
| 190 | - $iv->available = false; |
|
| 165 | + } else { |
|
| 166 | + // get last pokemon |
|
| 167 | + $req = "SELECT pokemon_id, encounter_id, disappear_time, last_modified, (CONVERT_TZ(disappear_time, '+00:00', '".$time_offset."')) as disappear_time_real, latitude, longitude, individual_attack, individual_defense, individual_stamina FROM pokemon ORDER BY last_modified DESC LIMIT 0,12"; |
|
| 168 | + } |
|
| 169 | + $result = $mysqli->query($req); |
|
| 170 | + while ($data = $result->fetch_object()) { |
|
| 171 | + $new_spawn = array(); |
|
| 172 | + $pokeid = $data->pokemon_id; |
|
| 173 | + $pokeuid = $data->encounter_id; |
|
| 174 | + |
|
| 175 | + if ($last_uid_param != $pokeuid) { |
|
| 176 | + $last_seen = strtotime($data->disappear_time_real); |
|
| 177 | + |
|
| 178 | + $last_location = new stdClass(); |
|
| 179 | + $last_location->latitude = $data->latitude; |
|
| 180 | + $last_location->longitude = $data->longitude; |
|
| 181 | + |
|
| 182 | + if ($config->system->recents_show_iv) { |
|
| 183 | + $iv = new stdClass(); |
|
| 184 | + $iv->attack = $data->individual_attack; |
|
| 185 | + $iv->defense = $data->individual_defense; |
|
| 186 | + $iv->stamina = $data->individual_stamina; |
|
| 187 | + if (isset($iv->attack) && isset($iv->defense) && isset($iv->stamina)) { |
|
| 188 | + $iv->available = true; |
|
| 189 | + } else { |
|
| 190 | + $iv->available = false; |
|
| 191 | + } |
|
| 191 | 192 | } |
| 192 | - } |
|
| 193 | 193 | |
| 194 | - $html = ' |
|
| 194 | + $html = ' |
|
| 195 | 195 | <div class="col-md-1 col-xs-4 pokemon-single" data-pokeid="'.$pokeid.'" data-pokeuid="'.$pokeuid.'" style="display: none;"> |
| 196 | 196 | <a href="pokemon/'.$pokeid.'"><img src="core/pokemons/'.$pokeid.$config->system->pokeimg_suffix.'" alt="'.$pokemons->pokemon->$pokeid->name.'" class="img-responsive"></a> |
| 197 | 197 | <a href="pokemon/'.$pokeid.'"><p class="pkmn-name">'.$pokemons->pokemon->$pokeid->name.'</p></a> |
| 198 | 198 | <a href="https://maps.google.com/?q='.$last_location->latitude.','.$last_location->longitude.'&ll='.$last_location->latitude.','.$last_location->longitude.'&z=16" target="_blank"> |
| 199 | 199 | <small class="pokemon-timer">00:00:00</small> |
| 200 | 200 | </a>'; |
| 201 | - if ($config->system->recents_show_iv) { |
|
| 202 | - if ($iv->available) { |
|
| 203 | - if ($config->system->iv_numbers) { |
|
| 204 | - $html .= ' |
|
| 201 | + if ($config->system->recents_show_iv) { |
|
| 202 | + if ($iv->available) { |
|
| 203 | + if ($config->system->iv_numbers) { |
|
| 204 | + $html .= ' |
|
| 205 | 205 | <div class="progress" style="height: 15px; margin-bottom: 0"> |
| 206 | 206 | <div title="Attack IV: '. $iv->attack .'" class="progress-bar progress-bar-danger" role="progressbar" aria-valuenow="'. $iv->attack .'" aria-valuemin="0" aria-valuemax="45" style="width: '. (100/3) .'%; line-height: 16px";> |
| 207 | 207 | <span class="sr-only">Attack IV: '. $iv->attack .'</span>'. $iv->attack .' |
@@ -213,8 +213,8 @@ discard block |
||
| 213 | 213 | <span class="sr-only">Stamina IV: '. $iv->stamina .'</span>'. $iv->stamina .' |
| 214 | 214 | </div> |
| 215 | 215 | </div>'; |
| 216 | - } else { |
|
| 217 | - $html .= ' |
|
| 216 | + } else { |
|
| 217 | + $html .= ' |
|
| 218 | 218 | <div class="progress" style="height: 6px; width: 80%; margin: 5px auto 0 auto;"> |
| 219 | 219 | <div title="Attack IV: '. $iv->attack .'" class="progress-bar progress-bar-danger" role="progressbar" aria-valuenow="'. $iv->attack .'" aria-valuemin="0" aria-valuemax="45" style="width: '. ((100/15)*$iv->attack)/3 .'%"> |
| 220 | 220 | <span class="sr-only">Attack IV: '. $iv->attack .'</span> |
@@ -226,10 +226,10 @@ discard block |
||
| 226 | 226 | <span class="sr-only">Stamina IV: '. $iv->stamina .'</span> |
| 227 | 227 | </div> |
| 228 | 228 | </div>'; |
| 229 | - } |
|
| 230 | - } else { |
|
| 231 | - if ($config->system->iv_numbers) { |
|
| 232 | - $html .= ' |
|
| 229 | + } |
|
| 230 | + } else { |
|
| 231 | + if ($config->system->iv_numbers) { |
|
| 232 | + $html .= ' |
|
| 233 | 233 | <div class="progress" style="height: 15px; margin-bottom: 0"> |
| 234 | 234 | <div title="Attack IV: not available" class="progress-bar progress-bar-danger" role="progressbar" aria-valuenow="'. $iv->attack .'" aria-valuemin="0" aria-valuemax="45" style="width: '. (100/3) .'%; line-height: 16px";> |
| 235 | 235 | <span class="sr-only">Attack IV: not available</span>? |
@@ -241,125 +241,125 @@ discard block |
||
| 241 | 241 | <span class="sr-only">Stamina IV: not available</span>? |
| 242 | 242 | </div> |
| 243 | 243 | </div>'; |
| 244 | - } else { |
|
| 245 | - $html .= ' |
|
| 244 | + } else { |
|
| 245 | + $html .= ' |
|
| 246 | 246 | <div class="progress" style="height: 6px; width: 80%; margin: 5px auto 15px auto;"> |
| 247 | 247 | <div title="IV not available" class="progress-bar" role="progressbar" style="width: 100%; background-color: rgb(210,210,210);" aria-valuenow="1" aria-valuemin="0" aria-valuemax="1"> |
| 248 | 248 | <span class="sr-only">IV not available</span> |
| 249 | 249 | </div> |
| 250 | 250 | </div>'; |
| 251 | + } |
|
| 251 | 252 | } |
| 252 | 253 | } |
| 253 | - } |
|
| 254 | - $html .= ' |
|
| 254 | + $html .= ' |
|
| 255 | 255 | </div>'; |
| 256 | - $new_spawn['html'] = $html; |
|
| 257 | - $countdown = $last_seen - time(); |
|
| 258 | - $new_spawn['countdown'] = $countdown; |
|
| 259 | - $new_spawn['pokemon_uid'] = $pokeuid; |
|
| 260 | - $total_spawns[] = $new_spawn; |
|
| 261 | - } else { |
|
| 262 | - break; |
|
| 256 | + $new_spawn['html'] = $html; |
|
| 257 | + $countdown = $last_seen - time(); |
|
| 258 | + $new_spawn['countdown'] = $countdown; |
|
| 259 | + $new_spawn['pokemon_uid'] = $pokeuid; |
|
| 260 | + $total_spawns[] = $new_spawn; |
|
| 261 | + } else { |
|
| 262 | + break; |
|
| 263 | + } |
|
| 263 | 264 | } |
| 264 | - } |
|
| 265 | - header('Content-Type: application/json'); |
|
| 266 | - echo json_encode($total_spawns); |
|
| 267 | - break; |
|
| 265 | + header('Content-Type: application/json'); |
|
| 266 | + echo json_encode($total_spawns); |
|
| 267 | + break; |
|
| 268 | 268 | |
| 269 | 269 | |
| 270 | 270 | |
| 271 | - #################################### |
|
| 272 | - // |
|
| 273 | - // List Pokestop |
|
| 274 | - // |
|
| 275 | - #################################### |
|
| 271 | + #################################### |
|
| 272 | + // |
|
| 273 | + // List Pokestop |
|
| 274 | + // |
|
| 275 | + #################################### |
|
| 276 | 276 | |
| 277 | - case 'pokestop': |
|
| 278 | - $req = "SELECT latitude, longitude, lure_expiration, UTC_TIMESTAMP() as now, (CONVERT_TZ(lure_expiration, '+00:00', '".$time_offset."')) as lure_expiration_real FROM pokestop"; |
|
| 279 | - $result = $mysqli->query($req); |
|
| 277 | + case 'pokestop': |
|
| 278 | + $req = "SELECT latitude, longitude, lure_expiration, UTC_TIMESTAMP() as now, (CONVERT_TZ(lure_expiration, '+00:00', '".$time_offset."')) as lure_expiration_real FROM pokestop"; |
|
| 279 | + $result = $mysqli->query($req); |
|
| 280 | 280 | |
| 281 | - $i=0; |
|
| 281 | + $i=0; |
|
| 282 | 282 | |
| 283 | - while ($data = $result->fetch_object()) { |
|
| 284 | - if ($data->lure_expiration >= $data->now) { |
|
| 285 | - $icon = 'pokestap_lured.png'; |
|
| 286 | - $text = 'Lured expire @ '.date('H:i:s', strtotime($data->lure_expiration_real)) ; |
|
| 287 | - } else { |
|
| 288 | - $icon = 'pokestap.png'; |
|
| 289 | - $text = 'Normal stop'; |
|
| 290 | - } |
|
| 283 | + while ($data = $result->fetch_object()) { |
|
| 284 | + if ($data->lure_expiration >= $data->now) { |
|
| 285 | + $icon = 'pokestap_lured.png'; |
|
| 286 | + $text = 'Lured expire @ '.date('H:i:s', strtotime($data->lure_expiration_real)) ; |
|
| 287 | + } else { |
|
| 288 | + $icon = 'pokestap.png'; |
|
| 289 | + $text = 'Normal stop'; |
|
| 290 | + } |
|
| 291 | 291 | |
| 292 | - $temp[$i][] = $text; |
|
| 293 | - $temp[$i][] = $icon; |
|
| 294 | - $temp[$i][] = $data->latitude; |
|
| 295 | - $temp[$i][] = $data->longitude; |
|
| 296 | - $temp[$i][] = $i; |
|
| 292 | + $temp[$i][] = $text; |
|
| 293 | + $temp[$i][] = $icon; |
|
| 294 | + $temp[$i][] = $data->latitude; |
|
| 295 | + $temp[$i][] = $data->longitude; |
|
| 296 | + $temp[$i][] = $i; |
|
| 297 | 297 | |
| 298 | - $temp_json[] = json_encode($temp[$i]); |
|
| 298 | + $temp_json[] = json_encode($temp[$i]); |
|
| 299 | 299 | |
| 300 | 300 | |
| 301 | - $i++; |
|
| 302 | - } |
|
| 301 | + $i++; |
|
| 302 | + } |
|
| 303 | 303 | |
| 304 | - $return = json_encode($temp_json); |
|
| 304 | + $return = json_encode($temp_json); |
|
| 305 | 305 | |
| 306 | - echo $return; |
|
| 306 | + echo $return; |
|
| 307 | 307 | |
| 308 | - break; |
|
| 308 | + break; |
|
| 309 | 309 | |
| 310 | 310 | |
| 311 | 311 | |
| 312 | - #################################### |
|
| 313 | - // |
|
| 314 | - // Update data for the gym battle |
|
| 315 | - // |
|
| 316 | - #################################### |
|
| 312 | + #################################### |
|
| 313 | + // |
|
| 314 | + // Update data for the gym battle |
|
| 315 | + // |
|
| 316 | + #################################### |
|
| 317 | 317 | |
| 318 | - case 'update_gym': |
|
| 319 | - $teams = new stdClass(); |
|
| 320 | - $teams->mystic = 1; |
|
| 321 | - $teams->valor = 2; |
|
| 322 | - $teams->instinct = 3; |
|
| 318 | + case 'update_gym': |
|
| 319 | + $teams = new stdClass(); |
|
| 320 | + $teams->mystic = 1; |
|
| 321 | + $teams->valor = 2; |
|
| 322 | + $teams->instinct = 3; |
|
| 323 | 323 | |
| 324 | 324 | |
| 325 | - foreach ($teams as $team_name => $team_id) { |
|
| 326 | - $req = "SELECT COUNT(DISTINCT(gym_id)) as total, ROUND(AVG(gym_points),0) as average_points FROM gym WHERE team_id = '".$team_id."' "; |
|
| 327 | - $result = $mysqli->query($req); |
|
| 328 | - $data = $result->fetch_object(); |
|
| 325 | + foreach ($teams as $team_name => $team_id) { |
|
| 326 | + $req = "SELECT COUNT(DISTINCT(gym_id)) as total, ROUND(AVG(gym_points),0) as average_points FROM gym WHERE team_id = '".$team_id."' "; |
|
| 327 | + $result = $mysqli->query($req); |
|
| 328 | + $data = $result->fetch_object(); |
|
| 329 | 329 | |
| 330 | - $return[] = $data->total; |
|
| 331 | - $return[] = $data->average_points; |
|
| 332 | - } |
|
| 330 | + $return[] = $data->total; |
|
| 331 | + $return[] = $data->average_points; |
|
| 332 | + } |
|
| 333 | 333 | |
| 334 | - $json = json_encode($return); |
|
| 334 | + $json = json_encode($return); |
|
| 335 | 335 | |
| 336 | - header('Content-Type: application/json'); |
|
| 337 | - echo $json; |
|
| 336 | + header('Content-Type: application/json'); |
|
| 337 | + echo $json; |
|
| 338 | 338 | |
| 339 | 339 | |
| 340 | - break; |
|
| 340 | + break; |
|
| 341 | 341 | |
| 342 | - #################################### |
|
| 343 | - // |
|
| 344 | - // Get datas for the gym map |
|
| 345 | - // |
|
| 346 | - #################################### |
|
| 342 | + #################################### |
|
| 343 | + // |
|
| 344 | + // Get datas for the gym map |
|
| 345 | + // |
|
| 346 | + #################################### |
|
| 347 | 347 | |
| 348 | 348 | |
| 349 | - case 'gym_map': |
|
| 350 | - $req = "SELECT gym_id, team_id, guard_pokemon_id, gym_points, latitude, longitude, (CONVERT_TZ(last_scanned, '+00:00', '".$time_offset."')) as last_scanned FROM gym"; |
|
| 351 | - $result = $mysqli->query($req); |
|
| 349 | + case 'gym_map': |
|
| 350 | + $req = "SELECT gym_id, team_id, guard_pokemon_id, gym_points, latitude, longitude, (CONVERT_TZ(last_scanned, '+00:00', '".$time_offset."')) as last_scanned FROM gym"; |
|
| 351 | + $result = $mysqli->query($req); |
|
| 352 | 352 | |
| 353 | 353 | |
| 354 | - $i=0; |
|
| 354 | + $i=0; |
|
| 355 | 355 | |
| 356 | - while ($data = $result->fetch_object()) { |
|
| 357 | - // Team |
|
| 358 | - // 1 = bleu |
|
| 359 | - // 2 = rouge |
|
| 360 | - // 3 = jaune |
|
| 356 | + while ($data = $result->fetch_object()) { |
|
| 357 | + // Team |
|
| 358 | + // 1 = bleu |
|
| 359 | + // 2 = rouge |
|
| 360 | + // 3 = jaune |
|
| 361 | 361 | |
| 362 | - switch ($data->team_id) { |
|
| 362 | + switch ($data->team_id) { |
|
| 363 | 363 | case 0: |
| 364 | 364 | $icon = 'map_white.png'; |
| 365 | 365 | $team = 'No Team (yet)'; |
@@ -383,7 +383,7 @@ discard block |
||
| 383 | 383 | $team = 'Team Instinct'; |
| 384 | 384 | $color = 'rgba(254, 217, 40, .6)'; |
| 385 | 385 | break; |
| 386 | - } |
|
| 386 | + } |
|
| 387 | 387 | |
| 388 | 388 | // Set gym level |
| 389 | 389 | $data->gym_level=0; |
@@ -455,65 +455,65 @@ discard block |
||
| 455 | 455 | // |
| 456 | 456 | #################################### |
| 457 | 457 | |
| 458 | - case 'gym_defenders': |
|
| 459 | - $gym_id = $mysqli->real_escape_string($_GET['gym_id']); |
|
| 460 | - $req = "SELECT gymdetails.name as name, gymdetails.description as description, gym.gym_points as points, gymdetails.url as url, gym.team_id as team, (CONVERT_TZ(gym.last_scanned, '+00:00', '".$time_offset."')) as last_scanned, gym.guard_pokemon_id as guard_pokemon_id FROM gymdetails LEFT JOIN gym on gym.gym_id = gymdetails.gym_id WHERE gym.gym_id='".$gym_id."'"; |
|
| 461 | - $result = $mysqli->query($req); |
|
| 462 | - $gymData['gymDetails']['gymInfos'] = false; |
|
| 463 | - while ($data = $result->fetch_object()) { |
|
| 464 | - $gymData['gymDetails']['gymInfos']['name'] = $data->name; |
|
| 465 | - $gymData['gymDetails']['gymInfos']['description'] = $data->description; |
|
| 466 | - if ($data->url == null) { |
|
| 467 | - $gymData['gymDetails']['gymInfos']['url'] = ''; |
|
| 468 | - } else { |
|
| 469 | - $gymData['gymDetails']['gymInfos']['url'] = $data->url; |
|
| 470 | - } |
|
| 471 | - $gymData['gymDetails']['gymInfos']['points'] = $data->points; |
|
| 472 | - $gymData['gymDetails']['gymInfos']['level'] = 0; |
|
| 473 | - $gymData['gymDetails']['gymInfos']['last_scanned'] = $data->last_scanned; |
|
| 474 | - $gymData['gymDetails']['gymInfos']['team'] = $data->team; |
|
| 475 | - $gymData['gymDetails']['gymInfos']['guardPokemonId'] = $data->guard_pokemon_id; |
|
| 476 | - if ($data->points < 2000) { |
|
| 477 | - $gymData['gymDetails']['gymInfos']['level']=1; |
|
| 478 | - } elseif ($data->points < 4000) { |
|
| 479 | - $gymData['gymDetails']['gymInfos']['level']=2; |
|
| 480 | - } elseif ($data->points < 8000) { |
|
| 481 | - $gymData['gymDetails']['gymInfos']['level']=3; |
|
| 482 | - } elseif ($data->points < 12000) { |
|
| 483 | - $gymData['gymDetails']['gymInfos']['level']=4; |
|
| 484 | - } elseif ($data->points < 16000) { |
|
| 485 | - $gymData['gymDetails']['gymInfos']['level']=5; |
|
| 486 | - } elseif ($data->points < 20000) { |
|
| 487 | - $gymData['gymDetails']['gymInfos']['level']=6; |
|
| 488 | - } elseif ($data->points < 30000) { |
|
| 489 | - $gymData['gymDetails']['gymInfos']['level']=7; |
|
| 490 | - } elseif ($data->points < 40000) { |
|
| 491 | - $gymData['gymDetails']['gymInfos']['level']=8; |
|
| 492 | - } elseif ($data->points < 50000) { |
|
| 493 | - $gymData['gymDetails']['gymInfos']['level']=9; |
|
| 494 | - } else { |
|
| 495 | - $gymData['gymDetails']['gymInfos']['level']=10; |
|
| 458 | + case 'gym_defenders': |
|
| 459 | + $gym_id = $mysqli->real_escape_string($_GET['gym_id']); |
|
| 460 | + $req = "SELECT gymdetails.name as name, gymdetails.description as description, gym.gym_points as points, gymdetails.url as url, gym.team_id as team, (CONVERT_TZ(gym.last_scanned, '+00:00', '".$time_offset."')) as last_scanned, gym.guard_pokemon_id as guard_pokemon_id FROM gymdetails LEFT JOIN gym on gym.gym_id = gymdetails.gym_id WHERE gym.gym_id='".$gym_id."'"; |
|
| 461 | + $result = $mysqli->query($req); |
|
| 462 | + $gymData['gymDetails']['gymInfos'] = false; |
|
| 463 | + while ($data = $result->fetch_object()) { |
|
| 464 | + $gymData['gymDetails']['gymInfos']['name'] = $data->name; |
|
| 465 | + $gymData['gymDetails']['gymInfos']['description'] = $data->description; |
|
| 466 | + if ($data->url == null) { |
|
| 467 | + $gymData['gymDetails']['gymInfos']['url'] = ''; |
|
| 468 | + } else { |
|
| 469 | + $gymData['gymDetails']['gymInfos']['url'] = $data->url; |
|
| 470 | + } |
|
| 471 | + $gymData['gymDetails']['gymInfos']['points'] = $data->points; |
|
| 472 | + $gymData['gymDetails']['gymInfos']['level'] = 0; |
|
| 473 | + $gymData['gymDetails']['gymInfos']['last_scanned'] = $data->last_scanned; |
|
| 474 | + $gymData['gymDetails']['gymInfos']['team'] = $data->team; |
|
| 475 | + $gymData['gymDetails']['gymInfos']['guardPokemonId'] = $data->guard_pokemon_id; |
|
| 476 | + if ($data->points < 2000) { |
|
| 477 | + $gymData['gymDetails']['gymInfos']['level']=1; |
|
| 478 | + } elseif ($data->points < 4000) { |
|
| 479 | + $gymData['gymDetails']['gymInfos']['level']=2; |
|
| 480 | + } elseif ($data->points < 8000) { |
|
| 481 | + $gymData['gymDetails']['gymInfos']['level']=3; |
|
| 482 | + } elseif ($data->points < 12000) { |
|
| 483 | + $gymData['gymDetails']['gymInfos']['level']=4; |
|
| 484 | + } elseif ($data->points < 16000) { |
|
| 485 | + $gymData['gymDetails']['gymInfos']['level']=5; |
|
| 486 | + } elseif ($data->points < 20000) { |
|
| 487 | + $gymData['gymDetails']['gymInfos']['level']=6; |
|
| 488 | + } elseif ($data->points < 30000) { |
|
| 489 | + $gymData['gymDetails']['gymInfos']['level']=7; |
|
| 490 | + } elseif ($data->points < 40000) { |
|
| 491 | + $gymData['gymDetails']['gymInfos']['level']=8; |
|
| 492 | + } elseif ($data->points < 50000) { |
|
| 493 | + $gymData['gymDetails']['gymInfos']['level']=9; |
|
| 494 | + } else { |
|
| 495 | + $gymData['gymDetails']['gymInfos']['level']=10; |
|
| 496 | + } |
|
| 496 | 497 | } |
| 497 | - } |
|
| 498 | - //print_r($gymData); |
|
| 499 | - $req = "SELECT DISTINCT gympokemon.pokemon_uid, " |
|
| 500 | - . "pokemon_id, iv_attack, iv_defense, iv_stamina, MAX(cp) as cp, gymmember.gym_id " |
|
| 501 | - . "FROM gympokemon inner join gymmember on gympokemon.pokemon_uid=gymmember.pokemon_uid " |
|
| 502 | - . "GROUP BY gympokemon.pokemon_uid, pokemon_id, iv_attack, iv_defense, iv_stamina, gym_id" |
|
| 503 | - . " HAVING gymmember.gym_id='".$gym_id."' ORDER BY cp DESC"; |
|
| 504 | - $result = $mysqli->query($req); |
|
| 505 | - $i=0; |
|
| 498 | + //print_r($gymData); |
|
| 499 | + $req = "SELECT DISTINCT gympokemon.pokemon_uid, " |
|
| 500 | + . "pokemon_id, iv_attack, iv_defense, iv_stamina, MAX(cp) as cp, gymmember.gym_id " |
|
| 501 | + . "FROM gympokemon inner join gymmember on gympokemon.pokemon_uid=gymmember.pokemon_uid " |
|
| 502 | + . "GROUP BY gympokemon.pokemon_uid, pokemon_id, iv_attack, iv_defense, iv_stamina, gym_id" |
|
| 503 | + . " HAVING gymmember.gym_id='".$gym_id."' ORDER BY cp DESC"; |
|
| 504 | + $result = $mysqli->query($req); |
|
| 505 | + $i=0; |
|
| 506 | 506 | |
| 507 | 507 | |
| 508 | 508 | |
| 509 | - $gymData['infoWindow'] = ' |
|
| 509 | + $gymData['infoWindow'] = ' |
|
| 510 | 510 | <div class="gym_defenders"> |
| 511 | 511 | '; |
| 512 | - while ($data = $result->fetch_object()) { |
|
| 513 | - $gymData['gymDetails']['pokemons'][] = $data; |
|
| 514 | - if ($data != false) { |
|
| 515 | - if ($config->system->iv_numbers) { |
|
| 516 | - $gymData['infoWindow'] .= ' |
|
| 512 | + while ($data = $result->fetch_object()) { |
|
| 513 | + $gymData['gymDetails']['pokemons'][] = $data; |
|
| 514 | + if ($data != false) { |
|
| 515 | + if ($config->system->iv_numbers) { |
|
| 516 | + $gymData['infoWindow'] .= ' |
|
| 517 | 517 | <div style="text-align: center; width: 50px; display: inline-block; margin-right: 3px"> |
| 518 | 518 | <a href="pokemon/'.$data->pokemon_id.'"> |
| 519 | 519 | <img src="core/pokemons/'.$data->pokemon_id.$config->system->pokeimg_suffix.'" height="50" style="display:inline-block" > |
@@ -531,9 +531,9 @@ discard block |
||
| 531 | 531 | </div> |
| 532 | 532 | </div> |
| 533 | 533 | </div>'; |
| 534 | - } |
|
| 535 | - else { |
|
| 536 | - $gymData['infoWindow'] .= ' |
|
| 534 | + } |
|
| 535 | + else { |
|
| 536 | + $gymData['infoWindow'] .= ' |
|
| 537 | 537 | <div style="text-align: center; width: 50px; display: inline-block; margin-right: 3px"> |
| 538 | 538 | <a href="pokemon/'.$data->pokemon_id.'"> |
| 539 | 539 | <img src="core/pokemons/'.$data->pokemon_id.$config->system->pokeimg_suffix.'" height="50" style="display:inline-block" > |
@@ -551,50 +551,50 @@ discard block |
||
| 551 | 551 | </div> |
| 552 | 552 | </div> |
| 553 | 553 | </div>' |
| 554 | - ; } |
|
| 555 | - } else { |
|
| 556 | - $gymData['infoWindow'] .= ' |
|
| 554 | + ; } |
|
| 555 | + } else { |
|
| 556 | + $gymData['infoWindow'] .= ' |
|
| 557 | 557 | <div style="text-align: center; width: 50px; display: inline-block; margin-right: 3px"> |
| 558 | 558 | <a href="pokemon/'.$gymData['gymDetails']['gymInfos']['guardPokemonId'].'"> |
| 559 | 559 | <img src="core/pokemons/'.$gymData['gymDetails']['gymInfos']['guardPokemonId'].$config->system->pokeimg_suffix.'" height="50" style="display:inline-block" > |
| 560 | 560 | </a> |
| 561 | 561 | <p class="pkmn-name">???</p> |
| 562 | 562 | </div>' |
| 563 | - ; |
|
| 563 | + ; |
|
| 564 | + } |
|
| 565 | + $i++; |
|
| 564 | 566 | } |
| 565 | - $i++; |
|
| 566 | - } |
|
| 567 | - $gymData['infoWindow'] = $gymData['infoWindow'].'</div>'; |
|
| 568 | - $return = json_encode($gymData); |
|
| 567 | + $gymData['infoWindow'] = $gymData['infoWindow'].'</div>'; |
|
| 568 | + $return = json_encode($gymData); |
|
| 569 | 569 | |
| 570 | - echo $return; |
|
| 570 | + echo $return; |
|
| 571 | 571 | |
| 572 | 572 | |
| 573 | - break; |
|
| 573 | + break; |
|
| 574 | 574 | |
| 575 | - case 'trainer': |
|
| 576 | - $name = ""; |
|
| 577 | - $page = "0"; |
|
| 578 | - $where = ""; |
|
| 579 | - $order=""; |
|
| 580 | - $team=0; |
|
| 581 | - $ranking=0; |
|
| 582 | - if (isset($_GET['name'])) { |
|
| 583 | - $trainer_name = mysqli_real_escape_string($mysqli, $_GET['name']); |
|
| 584 | - $where = " HAVING name LIKE '%".$trainer_name."%'"; |
|
| 585 | - } |
|
| 586 | - if (isset($_GET['team']) && $_GET['team']!=0) { |
|
| 587 | - $team = mysqli_real_escape_string($mysqli, $_GET['team']); |
|
| 588 | - $where .= ($where==""?" HAVING":"AND ")." team = ".$team; |
|
| 589 | - } |
|
| 590 | - if (isset($_GET['page'])) { |
|
| 591 | - $page = mysqli_real_escape_string($mysqli, $_GET['page']); |
|
| 592 | - } |
|
| 593 | - if (isset($_GET['ranking'])) { |
|
| 594 | - $ranking = mysqli_real_escape_string($mysqli, $_GET['ranking']); |
|
| 595 | - } |
|
| 575 | + case 'trainer': |
|
| 576 | + $name = ""; |
|
| 577 | + $page = "0"; |
|
| 578 | + $where = ""; |
|
| 579 | + $order=""; |
|
| 580 | + $team=0; |
|
| 581 | + $ranking=0; |
|
| 582 | + if (isset($_GET['name'])) { |
|
| 583 | + $trainer_name = mysqli_real_escape_string($mysqli, $_GET['name']); |
|
| 584 | + $where = " HAVING name LIKE '%".$trainer_name."%'"; |
|
| 585 | + } |
|
| 586 | + if (isset($_GET['team']) && $_GET['team']!=0) { |
|
| 587 | + $team = mysqli_real_escape_string($mysqli, $_GET['team']); |
|
| 588 | + $where .= ($where==""?" HAVING":"AND ")." team = ".$team; |
|
| 589 | + } |
|
| 590 | + if (isset($_GET['page'])) { |
|
| 591 | + $page = mysqli_real_escape_string($mysqli, $_GET['page']); |
|
| 592 | + } |
|
| 593 | + if (isset($_GET['ranking'])) { |
|
| 594 | + $ranking = mysqli_real_escape_string($mysqli, $_GET['ranking']); |
|
| 595 | + } |
|
| 596 | 596 | |
| 597 | - switch ($ranking) { |
|
| 597 | + switch ($ranking) { |
|
| 598 | 598 | case 1: |
| 599 | 599 | $order=" ORDER BY active DESC "; |
| 600 | 600 | break; |
@@ -603,7 +603,7 @@ discard block |
||
| 603 | 603 | break; |
| 604 | 604 | default: |
| 605 | 605 | $order=" ORDER BY level DESC, active DESC "; |
| 606 | - } |
|
| 606 | + } |
|
| 607 | 607 | |
| 608 | 608 | $limit = " LIMIT ".($page*10).",10 "; |
| 609 | 609 | |
@@ -660,100 +660,100 @@ discard block |
||
| 660 | 660 | |
| 661 | 661 | break; |
| 662 | 662 | |
| 663 | - case 'pokemon_slider_init': |
|
| 664 | - $req = "SELECT MIN(pokemon.disappear_time) as min, MAX(pokemon.disappear_time) as max from pokemon"; |
|
| 665 | - $result = $mysqli->query($req); |
|
| 666 | - $data = $result->fetch_object(); |
|
| 667 | - $bounds = $data; |
|
| 663 | + case 'pokemon_slider_init': |
|
| 664 | + $req = "SELECT MIN(pokemon.disappear_time) as min, MAX(pokemon.disappear_time) as max from pokemon"; |
|
| 665 | + $result = $mysqli->query($req); |
|
| 666 | + $data = $result->fetch_object(); |
|
| 667 | + $bounds = $data; |
|
| 668 | 668 | |
| 669 | - header('Content-Type: application/json'); |
|
| 670 | - $json = json_encode($bounds); |
|
| 669 | + header('Content-Type: application/json'); |
|
| 670 | + $json = json_encode($bounds); |
|
| 671 | 671 | |
| 672 | - echo $json; |
|
| 673 | - break; |
|
| 672 | + echo $json; |
|
| 673 | + break; |
|
| 674 | 674 | |
| 675 | - case 'pokemon_heatmap_points': |
|
| 676 | - $json=""; |
|
| 677 | - if (isset($_GET['start'])&&isset($_GET['end']) && isset($_GET['pokemon_id'])) { |
|
| 678 | - $start = Date("Y-m-d H:i",(int)$_GET['start']); |
|
| 679 | - $end = Date("Y-m-d H:i",(int)$_GET['end']); |
|
| 680 | - $pokemon_id = mysqli_real_escape_string($mysqli, $_GET['pokemon_id']); |
|
| 681 | - $where = " WHERE pokemon.pokemon_id = ".$pokemon_id." " |
|
| 682 | - . "AND pokemon.disappear_time BETWEEN '".$start."' AND '".$end."'"; |
|
| 683 | - $req = "SELECT latitude, longitude FROM pokemon".$where." ORDER BY disappear_time DESC LIMIT 10000"; |
|
| 684 | - $result = $mysqli->query($req); |
|
| 685 | - $points = array(); |
|
| 686 | - while ($result && $data = $result->fetch_object()) { |
|
| 687 | - $points[] = $data; |
|
| 675 | + case 'pokemon_heatmap_points': |
|
| 676 | + $json=""; |
|
| 677 | + if (isset($_GET['start'])&&isset($_GET['end']) && isset($_GET['pokemon_id'])) { |
|
| 678 | + $start = Date("Y-m-d H:i",(int)$_GET['start']); |
|
| 679 | + $end = Date("Y-m-d H:i",(int)$_GET['end']); |
|
| 680 | + $pokemon_id = mysqli_real_escape_string($mysqli, $_GET['pokemon_id']); |
|
| 681 | + $where = " WHERE pokemon.pokemon_id = ".$pokemon_id." " |
|
| 682 | + . "AND pokemon.disappear_time BETWEEN '".$start."' AND '".$end."'"; |
|
| 683 | + $req = "SELECT latitude, longitude FROM pokemon".$where." ORDER BY disappear_time DESC LIMIT 10000"; |
|
| 684 | + $result = $mysqli->query($req); |
|
| 685 | + $points = array(); |
|
| 686 | + while ($result && $data = $result->fetch_object()) { |
|
| 687 | + $points[] = $data; |
|
| 688 | + } |
|
| 689 | + |
|
| 690 | + $json = json_encode($points); |
|
| 688 | 691 | } |
| 689 | 692 | |
| 690 | - $json = json_encode($points); |
|
| 691 | - } |
|
| 693 | + header('Content-Type: application/json'); |
|
| 692 | 694 | |
| 693 | - header('Content-Type: application/json'); |
|
| 695 | + echo $json; |
|
| 694 | 696 | |
| 695 | - echo $json; |
|
| 697 | + break; |
|
| 696 | 698 | |
| 697 | - break; |
|
| 699 | + case 'pokedex': |
|
| 700 | + $json=""; |
|
| 701 | + if (isset($_GET['pokemon_id'])) { |
|
| 702 | + $pokemon_id = mysqli_real_escape_string($mysqli, $_GET['pokemon_id']); |
|
| 703 | + $where = " WHERE pokemon.pokemon_id = ".$pokemon_id; |
|
| 704 | + $req = "SELECT COUNT(encounter_id) as total FROM pokemon".$where; |
|
| 705 | + $result = $mysqli->query($req); |
|
| 706 | + $total = 0; |
|
| 707 | + while ($result && $data = $result->fetch_object()) { |
|
| 708 | + $total = $data; |
|
| 709 | + } |
|
| 698 | 710 | |
| 699 | - case 'pokedex': |
|
| 700 | - $json=""; |
|
| 701 | - if (isset($_GET['pokemon_id'])) { |
|
| 702 | - $pokemon_id = mysqli_real_escape_string($mysqli, $_GET['pokemon_id']); |
|
| 703 | - $where = " WHERE pokemon.pokemon_id = ".$pokemon_id; |
|
| 704 | - $req = "SELECT COUNT(encounter_id) as total FROM pokemon".$where; |
|
| 705 | - $result = $mysqli->query($req); |
|
| 706 | - $total = 0; |
|
| 707 | - while ($result && $data = $result->fetch_object()) { |
|
| 708 | - $total = $data; |
|
| 711 | + $json = json_encode($total); |
|
| 709 | 712 | } |
| 710 | 713 | |
| 711 | - $json = json_encode($total); |
|
| 712 | - } |
|
| 713 | - |
|
| 714 | - header('Content-Type: application/json'); |
|
| 714 | + header('Content-Type: application/json'); |
|
| 715 | 715 | |
| 716 | - echo $json; |
|
| 716 | + echo $json; |
|
| 717 | 717 | |
| 718 | - break; |
|
| 718 | + break; |
|
| 719 | 719 | |
| 720 | 720 | case 'postRequest': |
| 721 | 721 | break; |
| 722 | 722 | |
| 723 | - case 'pokemon_graph_data': |
|
| 724 | - $json=""; |
|
| 725 | - if (isset($_GET['pokemon_id'])) { |
|
| 726 | - $pokemon_id = mysqli_real_escape_string($mysqli, $_GET['pokemon_id']); |
|
| 727 | - $where = " WHERE pokemonFiltered.pokemon_id = ".$pokemon_id; |
|
| 728 | - $req = "SELECT COUNT(*) as total, " |
|
| 729 | - . "HOUR(CONVERT_TZ(disappear_time, '+00:00', '".$time_offset."')) as disappear_hour |
|
| 723 | + case 'pokemon_graph_data': |
|
| 724 | + $json=""; |
|
| 725 | + if (isset($_GET['pokemon_id'])) { |
|
| 726 | + $pokemon_id = mysqli_real_escape_string($mysqli, $_GET['pokemon_id']); |
|
| 727 | + $where = " WHERE pokemonFiltered.pokemon_id = ".$pokemon_id; |
|
| 728 | + $req = "SELECT COUNT(*) as total, " |
|
| 729 | + . "HOUR(CONVERT_TZ(disappear_time, '+00:00', '".$time_offset."')) as disappear_hour |
|
| 730 | 730 | FROM (SELECT * FROM pokemon WHERE pokemon_id = '".$pokemon_id."' LIMIT 10000) as pokemonFiltered |
| 731 | 731 | GROUP BY disappear_hour |
| 732 | 732 | ORDER BY disappear_hour"; |
| 733 | - $result = $mysqli->query($req); |
|
| 734 | - $array = array(); |
|
| 735 | - while ($result && $data = $result->fetch_object()) { |
|
| 736 | - $array[] = $data->total; |
|
| 733 | + $result = $mysqli->query($req); |
|
| 734 | + $array = array(); |
|
| 735 | + while ($result && $data = $result->fetch_object()) { |
|
| 736 | + $array[] = $data->total; |
|
| 737 | + } |
|
| 738 | + $array[] = array_shift($array); |
|
| 739 | + $json = json_encode($array); |
|
| 737 | 740 | } |
| 738 | - $array[] = array_shift($array); |
|
| 739 | - $json = json_encode($array); |
|
| 740 | - } |
|
| 741 | 741 | |
| 742 | - header('Content-Type: application/json'); |
|
| 742 | + header('Content-Type: application/json'); |
|
| 743 | 743 | |
| 744 | - echo $json; |
|
| 744 | + echo $json; |
|
| 745 | 745 | |
| 746 | - break; |
|
| 746 | + break; |
|
| 747 | 747 | |
| 748 | 748 | case 'postRequest': |
| 749 | 749 | break; |
| 750 | 750 | |
| 751 | 751 | |
| 752 | - default: |
|
| 753 | - echo "What do you mean?"; |
|
| 754 | - exit(); |
|
| 752 | + default: |
|
| 753 | + echo "What do you mean?"; |
|
| 754 | + exit(); |
|
| 755 | 755 | |
| 756 | - break; |
|
| 756 | + break; |
|
| 757 | 757 | } |
| 758 | 758 | if ($postRequest!=""){ |
| 759 | 759 | switch ($postRequest) { |
@@ -6,7 +6,7 @@ discard block |
||
| 6 | 6 | |
| 7 | 7 | $pos = !empty($_SERVER['HTTP_REFERER']) && strpos($_SERVER['HTTP_REFERER'], getenv('HTTP_HOST')); |
| 8 | 8 | |
| 9 | -if ($pos===false) { |
|
| 9 | +if ($pos === false) { |
|
| 10 | 10 | http_response_code(401); |
| 11 | 11 | die('Restricted access'); |
| 12 | 12 | } |
@@ -19,8 +19,8 @@ discard block |
||
| 19 | 19 | // Include & load the variables |
| 20 | 20 | // ############################ |
| 21 | 21 | |
| 22 | -$variables = SYS_PATH.'/core/json/variables.json'; |
|
| 23 | -$config = json_decode(file_get_contents($variables)); |
|
| 22 | +$variables = SYS_PATH.'/core/json/variables.json'; |
|
| 23 | +$config = json_decode(file_get_contents($variables)); |
|
| 24 | 24 | |
| 25 | 25 | |
| 26 | 26 | |
@@ -37,19 +37,19 @@ discard block |
||
| 37 | 37 | |
| 38 | 38 | |
| 39 | 39 | # MySQL |
| 40 | -$mysqli = new mysqli(SYS_DB_HOST, SYS_DB_USER, SYS_DB_PSWD, SYS_DB_NAME, SYS_DB_PORT); |
|
| 40 | +$mysqli = new mysqli(SYS_DB_HOST, SYS_DB_USER, SYS_DB_PSWD, SYS_DB_NAME, SYS_DB_PORT); |
|
| 41 | 41 | if ($mysqli->connect_error != '') { |
| 42 | 42 | exit('Error MySQL Connect'); |
| 43 | 43 | } |
| 44 | 44 | $mysqli->set_charset('utf8'); |
| 45 | 45 | $request = ""; |
| 46 | -if (isset($_GET['type'])){ |
|
| 47 | -$request = $_GET['type']; |
|
| 46 | +if (isset($_GET['type'])) { |
|
| 47 | +$request = $_GET['type']; |
|
| 48 | 48 | } |
| 49 | 49 | $postRequest = ""; |
| 50 | -if (isset($_POST['type'])){ |
|
| 50 | +if (isset($_POST['type'])) { |
|
| 51 | 51 | $postRequest = $_POST['type']; |
| 52 | - $request= "postRequest"; |
|
| 52 | + $request = "postRequest"; |
|
| 53 | 53 | } |
| 54 | 54 | switch ($request) { |
| 55 | 55 | ############################ |
@@ -62,64 +62,64 @@ discard block |
||
| 62 | 62 | // Right now |
| 63 | 63 | // --------- |
| 64 | 64 | |
| 65 | - $req = "SELECT COUNT(*) as total FROM pokemon WHERE disappear_time >= UTC_TIMESTAMP()"; |
|
| 66 | - $result = $mysqli->query($req); |
|
| 67 | - $data = $result->fetch_object(); |
|
| 65 | + $req = "SELECT COUNT(*) as total FROM pokemon WHERE disappear_time >= UTC_TIMESTAMP()"; |
|
| 66 | + $result = $mysqli->query($req); |
|
| 67 | + $data = $result->fetch_object(); |
|
| 68 | 68 | |
| 69 | - $values[] = $data->total; |
|
| 69 | + $values[] = $data->total; |
|
| 70 | 70 | |
| 71 | 71 | |
| 72 | 72 | // Lured stops |
| 73 | 73 | // ----------- |
| 74 | 74 | |
| 75 | - $req = "SELECT COUNT(*) as total FROM pokestop WHERE lure_expiration >= UTC_TIMESTAMP()"; |
|
| 76 | - $result = $mysqli->query($req); |
|
| 77 | - $data = $result->fetch_object(); |
|
| 75 | + $req = "SELECT COUNT(*) as total FROM pokestop WHERE lure_expiration >= UTC_TIMESTAMP()"; |
|
| 76 | + $result = $mysqli->query($req); |
|
| 77 | + $data = $result->fetch_object(); |
|
| 78 | 78 | |
| 79 | - $values[] = $data->total; |
|
| 79 | + $values[] = $data->total; |
|
| 80 | 80 | |
| 81 | 81 | |
| 82 | 82 | |
| 83 | 83 | // Team battle |
| 84 | 84 | // ----------- |
| 85 | 85 | |
| 86 | - $req = "SELECT count( DISTINCT(gym_id) ) as total FROM gym"; |
|
| 87 | - $result = $mysqli->query($req); |
|
| 88 | - $data = $result->fetch_object(); |
|
| 86 | + $req = "SELECT count( DISTINCT(gym_id) ) as total FROM gym"; |
|
| 87 | + $result = $mysqli->query($req); |
|
| 88 | + $data = $result->fetch_object(); |
|
| 89 | 89 | |
| 90 | - $values[] = $data->total; |
|
| 90 | + $values[] = $data->total; |
|
| 91 | 91 | |
| 92 | 92 | // Team |
| 93 | 93 | // 1 = bleu |
| 94 | 94 | // 2 = rouge |
| 95 | 95 | // 3 = jaune |
| 96 | 96 | |
| 97 | - $req = "SELECT count( DISTINCT(gym_id) ) as total FROM gym WHERE team_id = '2' "; |
|
| 98 | - $result = $mysqli->query($req); |
|
| 99 | - $data = $result->fetch_object(); |
|
| 97 | + $req = "SELECT count( DISTINCT(gym_id) ) as total FROM gym WHERE team_id = '2' "; |
|
| 98 | + $result = $mysqli->query($req); |
|
| 99 | + $data = $result->fetch_object(); |
|
| 100 | 100 | |
| 101 | 101 | // Red |
| 102 | 102 | $values[] = $data->total; |
| 103 | 103 | |
| 104 | 104 | |
| 105 | - $req = "SELECT count( DISTINCT(gym_id) ) as total FROM gym WHERE team_id = '1' "; |
|
| 106 | - $result = $mysqli->query($req); |
|
| 107 | - $data = $result->fetch_object(); |
|
| 105 | + $req = "SELECT count( DISTINCT(gym_id) ) as total FROM gym WHERE team_id = '1' "; |
|
| 106 | + $result = $mysqli->query($req); |
|
| 107 | + $data = $result->fetch_object(); |
|
| 108 | 108 | |
| 109 | 109 | // Blue |
| 110 | 110 | $values[] = $data->total; |
| 111 | 111 | |
| 112 | 112 | |
| 113 | - $req = "SELECT count( DISTINCT(gym_id) ) as total FROM gym WHERE team_id = '3' "; |
|
| 114 | - $result = $mysqli->query($req); |
|
| 115 | - $data = $result->fetch_object(); |
|
| 113 | + $req = "SELECT count( DISTINCT(gym_id) ) as total FROM gym WHERE team_id = '3' "; |
|
| 114 | + $result = $mysqli->query($req); |
|
| 115 | + $data = $result->fetch_object(); |
|
| 116 | 116 | |
| 117 | 117 | // Yellow |
| 118 | 118 | $values[] = $data->total; |
| 119 | 119 | |
| 120 | - $req = "SELECT count( DISTINCT(gym_id) ) as total FROM gym WHERE team_id = '0' "; |
|
| 121 | - $result = $mysqli->query($req); |
|
| 122 | - $data = $result->fetch_object(); |
|
| 120 | + $req = "SELECT count( DISTINCT(gym_id) ) as total FROM gym WHERE team_id = '0' "; |
|
| 121 | + $result = $mysqli->query($req); |
|
| 122 | + $data = $result->fetch_object(); |
|
| 123 | 123 | |
| 124 | 124 | // Neutral |
| 125 | 125 | $values[] = $data->total; |
@@ -159,12 +159,12 @@ discard block |
||
| 159 | 159 | } |
| 160 | 160 | |
| 161 | 161 | // get last mythic pokemon |
| 162 | - $req = "SELECT pokemon_id, encounter_id, disappear_time, last_modified, (CONVERT_TZ(disappear_time, '+00:00', '".$time_offset."')) as disappear_time_real, latitude, longitude, individual_attack, individual_defense, individual_stamina FROM pokemon |
|
| 162 | + $req = "SELECT pokemon_id, encounter_id, disappear_time, last_modified, (CONVERT_TZ(disappear_time, '+00:00', '".$time_offset."')) as disappear_time_real, latitude, longitude, individual_attack, individual_defense, individual_stamina FROM pokemon |
|
| 163 | 163 | WHERE pokemon_id IN (".implode(",", $mythic_pokemons).") |
| 164 | 164 | ORDER BY last_modified DESC LIMIT 0,12"; |
| 165 | 165 | } else { |
| 166 | 166 | // get last pokemon |
| 167 | - $req = "SELECT pokemon_id, encounter_id, disappear_time, last_modified, (CONVERT_TZ(disappear_time, '+00:00', '".$time_offset."')) as disappear_time_real, latitude, longitude, individual_attack, individual_defense, individual_stamina FROM pokemon ORDER BY last_modified DESC LIMIT 0,12"; |
|
| 167 | + $req = "SELECT pokemon_id, encounter_id, disappear_time, last_modified, (CONVERT_TZ(disappear_time, '+00:00', '".$time_offset."')) as disappear_time_real, latitude, longitude, individual_attack, individual_defense, individual_stamina FROM pokemon ORDER BY last_modified DESC LIMIT 0,12"; |
|
| 168 | 168 | } |
| 169 | 169 | $result = $mysqli->query($req); |
| 170 | 170 | while ($data = $result->fetch_object()) { |
@@ -203,27 +203,27 @@ discard block |
||
| 203 | 203 | if ($config->system->iv_numbers) { |
| 204 | 204 | $html .= ' |
| 205 | 205 | <div class="progress" style="height: 15px; margin-bottom: 0"> |
| 206 | - <div title="Attack IV: '. $iv->attack .'" class="progress-bar progress-bar-danger" role="progressbar" aria-valuenow="'. $iv->attack .'" aria-valuemin="0" aria-valuemax="45" style="width: '. (100/3) .'%; line-height: 16px";> |
|
| 207 | - <span class="sr-only">Attack IV: '. $iv->attack .'</span>'. $iv->attack .' |
|
| 206 | + <div title="Attack IV: '. $iv->attack.'" class="progress-bar progress-bar-danger" role="progressbar" aria-valuenow="'.$iv->attack.'" aria-valuemin="0" aria-valuemax="45" style="width: '.(100 / 3).'%; line-height: 16px";> |
|
| 207 | + <span class="sr-only">Attack IV: '. $iv->attack.'</span>'.$iv->attack.' |
|
| 208 | 208 | </div> |
| 209 | - <div title="Defense IV: '. $iv->defense .'" class="progress-bar progress-bar-info" role="progressbar" aria-valuenow="'. $iv->defense .'" aria-valuemin="0" aria-valuemax="45" style="width: '. (100/3) .'%; line-height: 16px";> |
|
| 210 | - <span class="sr-only">Defense IV: '. $iv->defense .'</span>'. $iv->defense .' |
|
| 209 | + <div title="Defense IV: '. $iv->defense.'" class="progress-bar progress-bar-info" role="progressbar" aria-valuenow="'.$iv->defense.'" aria-valuemin="0" aria-valuemax="45" style="width: '.(100 / 3).'%; line-height: 16px";> |
|
| 210 | + <span class="sr-only">Defense IV: '. $iv->defense.'</span>'.$iv->defense.' |
|
| 211 | 211 | </div> |
| 212 | - <div title="Stamina IV: '. $iv->stamina .'" class="progress-bar progress-bar-success" role="progressbar" aria-valuenow="'. $iv->stamina .'" aria-valuemin="0" aria-valuemax="45" style="width: '. (100/3) .'%; line-height: 16px";> |
|
| 213 | - <span class="sr-only">Stamina IV: '. $iv->stamina .'</span>'. $iv->stamina .' |
|
| 212 | + <div title="Stamina IV: '. $iv->stamina.'" class="progress-bar progress-bar-success" role="progressbar" aria-valuenow="'.$iv->stamina.'" aria-valuemin="0" aria-valuemax="45" style="width: '.(100 / 3).'%; line-height: 16px";> |
|
| 213 | + <span class="sr-only">Stamina IV: '. $iv->stamina.'</span>'.$iv->stamina.' |
|
| 214 | 214 | </div> |
| 215 | 215 | </div>'; |
| 216 | 216 | } else { |
| 217 | 217 | $html .= ' |
| 218 | 218 | <div class="progress" style="height: 6px; width: 80%; margin: 5px auto 0 auto;"> |
| 219 | - <div title="Attack IV: '. $iv->attack .'" class="progress-bar progress-bar-danger" role="progressbar" aria-valuenow="'. $iv->attack .'" aria-valuemin="0" aria-valuemax="45" style="width: '. ((100/15)*$iv->attack)/3 .'%"> |
|
| 220 | - <span class="sr-only">Attack IV: '. $iv->attack .'</span> |
|
| 219 | + <div title="Attack IV: '. $iv->attack.'" class="progress-bar progress-bar-danger" role="progressbar" aria-valuenow="'.$iv->attack.'" aria-valuemin="0" aria-valuemax="45" style="width: '.((100 / 15) * $iv->attack) / 3.'%"> |
|
| 220 | + <span class="sr-only">Attack IV: '. $iv->attack.'</span> |
|
| 221 | 221 | </div> |
| 222 | - <div title="Defense IV: '. $iv->defense .'" class="progress-bar progress-bar-info" role="progressbar" aria-valuenow="'. $iv->defense .'" aria-valuemin="0" aria-valuemax="45" style="width: '. ((100/15)*$iv->defense)/3 .'%"> |
|
| 223 | - <span class="sr-only">Defense IV: '. $iv->defense .'</span> |
|
| 222 | + <div title="Defense IV: '. $iv->defense.'" class="progress-bar progress-bar-info" role="progressbar" aria-valuenow="'.$iv->defense.'" aria-valuemin="0" aria-valuemax="45" style="width: '.((100 / 15) * $iv->defense) / 3.'%"> |
|
| 223 | + <span class="sr-only">Defense IV: '. $iv->defense.'</span> |
|
| 224 | 224 | </div> |
| 225 | - <div title="Stamina IV: '. $iv->stamina .'" class="progress-bar progress-bar-success" role="progressbar" aria-valuenow="'. $iv->stamina .'" aria-valuemin="0" aria-valuemax="45" style="width: '. ((100/15)*$iv->stamina)/3 .'%"> |
|
| 226 | - <span class="sr-only">Stamina IV: '. $iv->stamina .'</span> |
|
| 225 | + <div title="Stamina IV: '. $iv->stamina.'" class="progress-bar progress-bar-success" role="progressbar" aria-valuenow="'.$iv->stamina.'" aria-valuemin="0" aria-valuemax="45" style="width: '.((100 / 15) * $iv->stamina) / 3.'%"> |
|
| 226 | + <span class="sr-only">Stamina IV: '. $iv->stamina.'</span> |
|
| 227 | 227 | </div> |
| 228 | 228 | </div>'; |
| 229 | 229 | } |
@@ -231,13 +231,13 @@ discard block |
||
| 231 | 231 | if ($config->system->iv_numbers) { |
| 232 | 232 | $html .= ' |
| 233 | 233 | <div class="progress" style="height: 15px; margin-bottom: 0"> |
| 234 | - <div title="Attack IV: not available" class="progress-bar progress-bar-danger" role="progressbar" aria-valuenow="'. $iv->attack .'" aria-valuemin="0" aria-valuemax="45" style="width: '. (100/3) .'%; line-height: 16px";> |
|
| 234 | + <div title="Attack IV: not available" class="progress-bar progress-bar-danger" role="progressbar" aria-valuenow="'. $iv->attack.'" aria-valuemin="0" aria-valuemax="45" style="width: '.(100 / 3).'%; line-height: 16px";> |
|
| 235 | 235 | <span class="sr-only">Attack IV: not available</span>? |
| 236 | 236 | </div> |
| 237 | - <div title="Defense IV: not available" class="progress-bar progress-bar-info" role="progressbar" aria-valuenow="'. $iv->defense .'" aria-valuemin="0" aria-valuemax="45" style="width: '. (100/3) .'%; line-height: 16px";> |
|
| 237 | + <div title="Defense IV: not available" class="progress-bar progress-bar-info" role="progressbar" aria-valuenow="'. $iv->defense.'" aria-valuemin="0" aria-valuemax="45" style="width: '.(100 / 3).'%; line-height: 16px";> |
|
| 238 | 238 | <span class="sr-only">Defense IV: not available</span>? |
| 239 | 239 | </div> |
| 240 | - <div title="Stamina IV: not available" class="progress-bar progress-bar-success" role="progressbar" aria-valuenow="'. $iv->stamina .'" aria-valuemin="0" aria-valuemax="45" style="width: '. (100/3) .'%; line-height: 16px";> |
|
| 240 | + <div title="Stamina IV: not available" class="progress-bar progress-bar-success" role="progressbar" aria-valuenow="'. $iv->stamina.'" aria-valuemin="0" aria-valuemax="45" style="width: '.(100 / 3).'%; line-height: 16px";> |
|
| 241 | 241 | <span class="sr-only">Stamina IV: not available</span>? |
| 242 | 242 | </div> |
| 243 | 243 | </div>'; |
@@ -275,15 +275,15 @@ discard block |
||
| 275 | 275 | #################################### |
| 276 | 276 | |
| 277 | 277 | case 'pokestop': |
| 278 | - $req = "SELECT latitude, longitude, lure_expiration, UTC_TIMESTAMP() as now, (CONVERT_TZ(lure_expiration, '+00:00', '".$time_offset."')) as lure_expiration_real FROM pokestop"; |
|
| 279 | - $result = $mysqli->query($req); |
|
| 278 | + $req = "SELECT latitude, longitude, lure_expiration, UTC_TIMESTAMP() as now, (CONVERT_TZ(lure_expiration, '+00:00', '".$time_offset."')) as lure_expiration_real FROM pokestop"; |
|
| 279 | + $result = $mysqli->query($req); |
|
| 280 | 280 | |
| 281 | - $i=0; |
|
| 281 | + $i = 0; |
|
| 282 | 282 | |
| 283 | 283 | while ($data = $result->fetch_object()) { |
| 284 | 284 | if ($data->lure_expiration >= $data->now) { |
| 285 | 285 | $icon = 'pokestap_lured.png'; |
| 286 | - $text = 'Lured expire @ '.date('H:i:s', strtotime($data->lure_expiration_real)) ; |
|
| 286 | + $text = 'Lured expire @ '.date('H:i:s', strtotime($data->lure_expiration_real)); |
|
| 287 | 287 | } else { |
| 288 | 288 | $icon = 'pokestap.png'; |
| 289 | 289 | $text = 'Normal stop'; |
@@ -316,19 +316,19 @@ discard block |
||
| 316 | 316 | #################################### |
| 317 | 317 | |
| 318 | 318 | case 'update_gym': |
| 319 | - $teams = new stdClass(); |
|
| 320 | - $teams->mystic = 1; |
|
| 321 | - $teams->valor = 2; |
|
| 322 | - $teams->instinct = 3; |
|
| 319 | + $teams = new stdClass(); |
|
| 320 | + $teams->mystic = 1; |
|
| 321 | + $teams->valor = 2; |
|
| 322 | + $teams->instinct = 3; |
|
| 323 | 323 | |
| 324 | 324 | |
| 325 | 325 | foreach ($teams as $team_name => $team_id) { |
| 326 | - $req = "SELECT COUNT(DISTINCT(gym_id)) as total, ROUND(AVG(gym_points),0) as average_points FROM gym WHERE team_id = '".$team_id."' "; |
|
| 327 | - $result = $mysqli->query($req); |
|
| 328 | - $data = $result->fetch_object(); |
|
| 326 | + $req = "SELECT COUNT(DISTINCT(gym_id)) as total, ROUND(AVG(gym_points),0) as average_points FROM gym WHERE team_id = '".$team_id."' "; |
|
| 327 | + $result = $mysqli->query($req); |
|
| 328 | + $data = $result->fetch_object(); |
|
| 329 | 329 | |
| 330 | - $return[] = $data->total; |
|
| 331 | - $return[] = $data->average_points; |
|
| 330 | + $return[] = $data->total; |
|
| 331 | + $return[] = $data->average_points; |
|
| 332 | 332 | } |
| 333 | 333 | |
| 334 | 334 | $json = json_encode($return); |
@@ -347,11 +347,11 @@ discard block |
||
| 347 | 347 | |
| 348 | 348 | |
| 349 | 349 | case 'gym_map': |
| 350 | - $req = "SELECT gym_id, team_id, guard_pokemon_id, gym_points, latitude, longitude, (CONVERT_TZ(last_scanned, '+00:00', '".$time_offset."')) as last_scanned FROM gym"; |
|
| 351 | - $result = $mysqli->query($req); |
|
| 350 | + $req = "SELECT gym_id, team_id, guard_pokemon_id, gym_points, latitude, longitude, (CONVERT_TZ(last_scanned, '+00:00', '".$time_offset."')) as last_scanned FROM gym"; |
|
| 351 | + $result = $mysqli->query($req); |
|
| 352 | 352 | |
| 353 | 353 | |
| 354 | - $i=0; |
|
| 354 | + $i = 0; |
|
| 355 | 355 | |
| 356 | 356 | while ($data = $result->fetch_object()) { |
| 357 | 357 | // Team |
@@ -363,50 +363,50 @@ discard block |
||
| 363 | 363 | case 0: |
| 364 | 364 | $icon = 'map_white.png'; |
| 365 | 365 | $team = 'No Team (yet)'; |
| 366 | - $color = 'rgba(0, 0, 0, .6)'; |
|
| 366 | + $color = 'rgba(0, 0, 0, .6)'; |
|
| 367 | 367 | break; |
| 368 | 368 | |
| 369 | 369 | case 1: |
| 370 | 370 | $icon = 'map_blue_'; |
| 371 | 371 | $team = 'Team Mystic'; |
| 372 | - $color = 'rgba(74, 138, 202, .6)'; |
|
| 372 | + $color = 'rgba(74, 138, 202, .6)'; |
|
| 373 | 373 | break; |
| 374 | 374 | |
| 375 | 375 | case 2: |
| 376 | 376 | $icon = 'map_red_'; |
| 377 | 377 | $team = 'Team Valor'; |
| 378 | - $color = 'rgba(240, 68, 58, .6)'; |
|
| 378 | + $color = 'rgba(240, 68, 58, .6)'; |
|
| 379 | 379 | break; |
| 380 | 380 | |
| 381 | 381 | case 3: |
| 382 | 382 | $icon = 'map_yellow_'; |
| 383 | 383 | $team = 'Team Instinct'; |
| 384 | - $color = 'rgba(254, 217, 40, .6)'; |
|
| 384 | + $color = 'rgba(254, 217, 40, .6)'; |
|
| 385 | 385 | break; |
| 386 | 386 | } |
| 387 | 387 | |
| 388 | 388 | // Set gym level |
| 389 | - $data->gym_level=0; |
|
| 389 | + $data->gym_level = 0; |
|
| 390 | 390 | if ($data->gym_points < 2000) { |
| 391 | - $data->gym_level=1; |
|
| 391 | + $data->gym_level = 1; |
|
| 392 | 392 | } elseif ($data->gym_points < 4000) { |
| 393 | - $data->gym_level=2; |
|
| 393 | + $data->gym_level = 2; |
|
| 394 | 394 | } elseif ($data->gym_points < 8000) { |
| 395 | - $data->gym_level=3; |
|
| 395 | + $data->gym_level = 3; |
|
| 396 | 396 | } elseif ($data->gym_points < 12000) { |
| 397 | - $data->gym_level=4; |
|
| 397 | + $data->gym_level = 4; |
|
| 398 | 398 | } elseif ($data->gym_points < 16000) { |
| 399 | - $data->gym_level=5; |
|
| 399 | + $data->gym_level = 5; |
|
| 400 | 400 | } elseif ($data->gym_points < 20000) { |
| 401 | - $data->gym_level=6; |
|
| 401 | + $data->gym_level = 6; |
|
| 402 | 402 | } elseif ($data->gym_points < 30000) { |
| 403 | - $data->gym_level=7; |
|
| 403 | + $data->gym_level = 7; |
|
| 404 | 404 | } elseif ($data->gym_points < 40000) { |
| 405 | - $data->gym_level=8; |
|
| 405 | + $data->gym_level = 8; |
|
| 406 | 406 | } elseif ($data->gym_points < 50000) { |
| 407 | - $data->gym_level=9; |
|
| 407 | + $data->gym_level = 9; |
|
| 408 | 408 | } else { |
| 409 | - $data->gym_level=10; |
|
| 409 | + $data->gym_level = 10; |
|
| 410 | 410 | } |
| 411 | 411 | |
| 412 | 412 | ## I know, I revert commit 6e8d2e7 from @kiralydavid but the way it was done broke the page. |
@@ -457,8 +457,8 @@ discard block |
||
| 457 | 457 | |
| 458 | 458 | case 'gym_defenders': |
| 459 | 459 | $gym_id = $mysqli->real_escape_string($_GET['gym_id']); |
| 460 | - $req = "SELECT gymdetails.name as name, gymdetails.description as description, gym.gym_points as points, gymdetails.url as url, gym.team_id as team, (CONVERT_TZ(gym.last_scanned, '+00:00', '".$time_offset."')) as last_scanned, gym.guard_pokemon_id as guard_pokemon_id FROM gymdetails LEFT JOIN gym on gym.gym_id = gymdetails.gym_id WHERE gym.gym_id='".$gym_id."'"; |
|
| 461 | - $result = $mysqli->query($req); |
|
| 460 | + $req = "SELECT gymdetails.name as name, gymdetails.description as description, gym.gym_points as points, gymdetails.url as url, gym.team_id as team, (CONVERT_TZ(gym.last_scanned, '+00:00', '".$time_offset."')) as last_scanned, gym.guard_pokemon_id as guard_pokemon_id FROM gymdetails LEFT JOIN gym on gym.gym_id = gymdetails.gym_id WHERE gym.gym_id='".$gym_id."'"; |
|
| 461 | + $result = $mysqli->query($req); |
|
| 462 | 462 | $gymData['gymDetails']['gymInfos'] = false; |
| 463 | 463 | while ($data = $result->fetch_object()) { |
| 464 | 464 | $gymData['gymDetails']['gymInfos']['name'] = $data->name; |
@@ -474,35 +474,35 @@ discard block |
||
| 474 | 474 | $gymData['gymDetails']['gymInfos']['team'] = $data->team; |
| 475 | 475 | $gymData['gymDetails']['gymInfos']['guardPokemonId'] = $data->guard_pokemon_id; |
| 476 | 476 | if ($data->points < 2000) { |
| 477 | - $gymData['gymDetails']['gymInfos']['level']=1; |
|
| 477 | + $gymData['gymDetails']['gymInfos']['level'] = 1; |
|
| 478 | 478 | } elseif ($data->points < 4000) { |
| 479 | - $gymData['gymDetails']['gymInfos']['level']=2; |
|
| 479 | + $gymData['gymDetails']['gymInfos']['level'] = 2; |
|
| 480 | 480 | } elseif ($data->points < 8000) { |
| 481 | - $gymData['gymDetails']['gymInfos']['level']=3; |
|
| 481 | + $gymData['gymDetails']['gymInfos']['level'] = 3; |
|
| 482 | 482 | } elseif ($data->points < 12000) { |
| 483 | - $gymData['gymDetails']['gymInfos']['level']=4; |
|
| 483 | + $gymData['gymDetails']['gymInfos']['level'] = 4; |
|
| 484 | 484 | } elseif ($data->points < 16000) { |
| 485 | - $gymData['gymDetails']['gymInfos']['level']=5; |
|
| 485 | + $gymData['gymDetails']['gymInfos']['level'] = 5; |
|
| 486 | 486 | } elseif ($data->points < 20000) { |
| 487 | - $gymData['gymDetails']['gymInfos']['level']=6; |
|
| 487 | + $gymData['gymDetails']['gymInfos']['level'] = 6; |
|
| 488 | 488 | } elseif ($data->points < 30000) { |
| 489 | - $gymData['gymDetails']['gymInfos']['level']=7; |
|
| 489 | + $gymData['gymDetails']['gymInfos']['level'] = 7; |
|
| 490 | 490 | } elseif ($data->points < 40000) { |
| 491 | - $gymData['gymDetails']['gymInfos']['level']=8; |
|
| 491 | + $gymData['gymDetails']['gymInfos']['level'] = 8; |
|
| 492 | 492 | } elseif ($data->points < 50000) { |
| 493 | - $gymData['gymDetails']['gymInfos']['level']=9; |
|
| 493 | + $gymData['gymDetails']['gymInfos']['level'] = 9; |
|
| 494 | 494 | } else { |
| 495 | - $gymData['gymDetails']['gymInfos']['level']=10; |
|
| 495 | + $gymData['gymDetails']['gymInfos']['level'] = 10; |
|
| 496 | 496 | } |
| 497 | 497 | } |
| 498 | 498 | //print_r($gymData); |
| 499 | - $req = "SELECT DISTINCT gympokemon.pokemon_uid, " |
|
| 499 | + $req = "SELECT DISTINCT gympokemon.pokemon_uid, " |
|
| 500 | 500 | . "pokemon_id, iv_attack, iv_defense, iv_stamina, MAX(cp) as cp, gymmember.gym_id " |
| 501 | 501 | . "FROM gympokemon inner join gymmember on gympokemon.pokemon_uid=gymmember.pokemon_uid " |
| 502 | 502 | . "GROUP BY gympokemon.pokemon_uid, pokemon_id, iv_attack, iv_defense, iv_stamina, gym_id" |
| 503 | 503 | . " HAVING gymmember.gym_id='".$gym_id."' ORDER BY cp DESC"; |
| 504 | - $result = $mysqli->query($req); |
|
| 505 | - $i=0; |
|
| 504 | + $result = $mysqli->query($req); |
|
| 505 | + $i = 0; |
|
| 506 | 506 | |
| 507 | 507 | |
| 508 | 508 | |
@@ -520,14 +520,14 @@ discard block |
||
| 520 | 520 | </a> |
| 521 | 521 | <p class="pkmn-name">'.$data->cp.'</p> |
| 522 | 522 | <div class="progress" style="height: 12px; margin-bottom: 0"> |
| 523 | - <div title="Attack IV: '. $data->iv_attack .'" class="progress-bar progress-bar-danger" role="progressbar" aria-valuenow="'. $data->iv_attack .'" aria-valuemin="0" aria-valuemax="45" style="width: '. (100/3) .'%; line-height: 13px; font-size: 11px"> |
|
| 524 | - <span class="sr-only">Angriff IV : '. $data->iv_attack .'</span>'.$data->iv_attack.' |
|
| 523 | + <div title="Attack IV: '. $data->iv_attack.'" class="progress-bar progress-bar-danger" role="progressbar" aria-valuenow="'.$data->iv_attack.'" aria-valuemin="0" aria-valuemax="45" style="width: '.(100 / 3).'%; line-height: 13px; font-size: 11px"> |
|
| 524 | + <span class="sr-only">Angriff IV : '. $data->iv_attack.'</span>'.$data->iv_attack.' |
|
| 525 | 525 | </div> |
| 526 | - <div title="Defense IV: '. $data->iv_defense .'" class="progress-bar progress-bar-info" role="progressbar" aria-valuenow="'. $data->iv_defense .'" aria-valuemin="0" aria-valuemax="45" style="width: '. (100/3) .'%; line-height: 13px; font-size: 11px"> |
|
| 527 | - <span class="sr-only">Verteidigung IV : '. $data->iv_defense .'</span>'. $data->iv_defense .' |
|
| 526 | + <div title="Defense IV: '. $data->iv_defense.'" class="progress-bar progress-bar-info" role="progressbar" aria-valuenow="'.$data->iv_defense.'" aria-valuemin="0" aria-valuemax="45" style="width: '.(100 / 3).'%; line-height: 13px; font-size: 11px"> |
|
| 527 | + <span class="sr-only">Verteidigung IV : '. $data->iv_defense.'</span>'.$data->iv_defense.' |
|
| 528 | 528 | </div> |
| 529 | - <div title="Stamina IV: '. $data->iv_stamina .'" class="progress-bar progress-bar-success" role="progressbar" aria-valuenow="'. $data->iv_stamina .'" aria-valuemin="0" aria-valuemax="45" style="width: '. (100/3) .'%; line-height: 13px; font-size: 11px"> |
|
| 530 | - <span class="sr-only">KP IV : '. $data->iv_stamina .'</span>'. $data->iv_stamina .' |
|
| 529 | + <div title="Stamina IV: '. $data->iv_stamina.'" class="progress-bar progress-bar-success" role="progressbar" aria-valuenow="'.$data->iv_stamina.'" aria-valuemin="0" aria-valuemax="45" style="width: '.(100 / 3).'%; line-height: 13px; font-size: 11px"> |
|
| 530 | + <span class="sr-only">KP IV : '. $data->iv_stamina.'</span>'.$data->iv_stamina.' |
|
| 531 | 531 | </div> |
| 532 | 532 | </div> |
| 533 | 533 | </div>'; |
@@ -540,13 +540,13 @@ discard block |
||
| 540 | 540 | </a> |
| 541 | 541 | <p class="pkmn-name">'.$data->cp.'</p> |
| 542 | 542 | <div class="progress" style="height: 4px; width: 40px; margin-bottom: 10px; margin-top: 2px; margin-left: auto; margin-right: auto"> |
| 543 | - <div title="Attack IV: '.$data->iv_attack.'" class="progress-bar progress-bar-danger" role="progressbar" aria-valuenow="'.$data->iv_attack.'" aria-valuemin="0" aria-valuemax="45" style="width: '.(((100/15)*$data->iv_attack)/3).'%"> |
|
| 543 | + <div title="Attack IV: '.$data->iv_attack.'" class="progress-bar progress-bar-danger" role="progressbar" aria-valuenow="'.$data->iv_attack.'" aria-valuemin="0" aria-valuemax="45" style="width: '.(((100 / 15) * $data->iv_attack) / 3).'%"> |
|
| 544 | 544 | <span class="sr-only">Attack IV: '.$data->iv_attack.'</span> |
| 545 | 545 | </div> |
| 546 | - <div title="Defense IV: '.$data->iv_defense.'" class="progress-bar progress-bar-info" role="progressbar" aria-valuenow="'.$data->iv_defense.'" aria-valuemin="0" aria-valuemax="45" style="width: '.(((100/15)*$data->iv_defense)/3).'%"> |
|
| 546 | + <div title="Defense IV: '.$data->iv_defense.'" class="progress-bar progress-bar-info" role="progressbar" aria-valuenow="'.$data->iv_defense.'" aria-valuemin="0" aria-valuemax="45" style="width: '.(((100 / 15) * $data->iv_defense) / 3).'%"> |
|
| 547 | 547 | <span class="sr-only">Defense IV: '.$data->iv_defense.'</span> |
| 548 | 548 | </div> |
| 549 | - <div title="Stamina IV: '.$data->iv_stamina.'" class="progress-bar progress-bar-success" role="progressbar" aria-valuenow="'.$data->iv_stamina.'" aria-valuemin="0" aria-valuemax="45" style="width: '.(((100/15)*$data->iv_stamina)/3).'%"> |
|
| 549 | + <div title="Stamina IV: '.$data->iv_stamina.'" class="progress-bar progress-bar-success" role="progressbar" aria-valuenow="'.$data->iv_stamina.'" aria-valuemin="0" aria-valuemax="45" style="width: '.(((100 / 15) * $data->iv_stamina) / 3).'%"> |
|
| 550 | 550 | <span class="sr-only">Stamina IV: '.$data->iv_stamina.'</span> |
| 551 | 551 | </div> |
| 552 | 552 | </div> |
@@ -576,16 +576,16 @@ discard block |
||
| 576 | 576 | $name = ""; |
| 577 | 577 | $page = "0"; |
| 578 | 578 | $where = ""; |
| 579 | - $order=""; |
|
| 580 | - $team=0; |
|
| 581 | - $ranking=0; |
|
| 579 | + $order = ""; |
|
| 580 | + $team = 0; |
|
| 581 | + $ranking = 0; |
|
| 582 | 582 | if (isset($_GET['name'])) { |
| 583 | 583 | $trainer_name = mysqli_real_escape_string($mysqli, $_GET['name']); |
| 584 | 584 | $where = " HAVING name LIKE '%".$trainer_name."%'"; |
| 585 | 585 | } |
| 586 | - if (isset($_GET['team']) && $_GET['team']!=0) { |
|
| 586 | + if (isset($_GET['team']) && $_GET['team'] != 0) { |
|
| 587 | 587 | $team = mysqli_real_escape_string($mysqli, $_GET['team']); |
| 588 | - $where .= ($where==""?" HAVING":"AND ")." team = ".$team; |
|
| 588 | + $where .= ($where == "" ? " HAVING" : "AND ")." team = ".$team; |
|
| 589 | 589 | } |
| 590 | 590 | if (isset($_GET['page'])) { |
| 591 | 591 | $page = mysqli_real_escape_string($mysqli, $_GET['page']); |
@@ -596,16 +596,16 @@ discard block |
||
| 596 | 596 | |
| 597 | 597 | switch ($ranking) { |
| 598 | 598 | case 1: |
| 599 | - $order=" ORDER BY active DESC "; |
|
| 599 | + $order = " ORDER BY active DESC "; |
|
| 600 | 600 | break; |
| 601 | 601 | case 2: |
| 602 | - $order=" ORDER BY maxCp DESC "; |
|
| 602 | + $order = " ORDER BY maxCp DESC "; |
|
| 603 | 603 | break; |
| 604 | 604 | default: |
| 605 | - $order=" ORDER BY level DESC, active DESC "; |
|
| 605 | + $order = " ORDER BY level DESC, active DESC "; |
|
| 606 | 606 | } |
| 607 | 607 | |
| 608 | - $limit = " LIMIT ".($page*10).",10 "; |
|
| 608 | + $limit = " LIMIT ".($page * 10).",10 "; |
|
| 609 | 609 | |
| 610 | 610 | |
| 611 | 611 | $req = "SELECT trainer.*, count(actives_pokemons.trainer_name) as active, max(actives_pokemons.cp) as maxCp ". |
@@ -624,7 +624,7 @@ discard block |
||
| 624 | 624 | $reqRanking = "SELECT count(1) as rank FROM trainer where trainer.level >= ".$trainer->level; |
| 625 | 625 | $resultRanking = $mysqli->query($reqRanking); |
| 626 | 626 | while ($data = $resultRanking->fetch_object()) { |
| 627 | - $trainer->rank = $data->rank ; |
|
| 627 | + $trainer->rank = $data->rank; |
|
| 628 | 628 | } |
| 629 | 629 | $req = "(SELECT DISTINCT gympokemon.pokemon_id, gympokemon.pokemon_uid, gympokemon.cp, DATEDIFF(UTC_TIMESTAMP(), gympokemon.last_seen) AS last_scanned, gympokemon.trainer_name, gympokemon.iv_defense, gympokemon.iv_stamina, gympokemon.iv_attack, filtered_gymmember.gym_id, '1' as active ". |
| 630 | 630 | "FROM gympokemon INNER JOIN ". |
@@ -634,7 +634,7 @@ discard block |
||
| 634 | 634 | |
| 635 | 635 | $resultPkms = $mysqli->query($req); |
| 636 | 636 | $trainer->pokemons = array(); |
| 637 | - $active_gyms=0; |
|
| 637 | + $active_gyms = 0; |
|
| 638 | 638 | $pkmCount = 0; |
| 639 | 639 | while ($resultPkms && $dataPkm = $resultPkms->fetch_object()) { |
| 640 | 640 | $active_gyms++; |
@@ -661,9 +661,9 @@ discard block |
||
| 661 | 661 | break; |
| 662 | 662 | |
| 663 | 663 | case 'pokemon_slider_init': |
| 664 | - $req = "SELECT MIN(pokemon.disappear_time) as min, MAX(pokemon.disappear_time) as max from pokemon"; |
|
| 664 | + $req = "SELECT MIN(pokemon.disappear_time) as min, MAX(pokemon.disappear_time) as max from pokemon"; |
|
| 665 | 665 | $result = $mysqli->query($req); |
| 666 | - $data = $result->fetch_object(); |
|
| 666 | + $data = $result->fetch_object(); |
|
| 667 | 667 | $bounds = $data; |
| 668 | 668 | |
| 669 | 669 | header('Content-Type: application/json'); |
@@ -673,18 +673,18 @@ discard block |
||
| 673 | 673 | break; |
| 674 | 674 | |
| 675 | 675 | case 'pokemon_heatmap_points': |
| 676 | - $json=""; |
|
| 677 | - if (isset($_GET['start'])&&isset($_GET['end']) && isset($_GET['pokemon_id'])) { |
|
| 678 | - $start = Date("Y-m-d H:i",(int)$_GET['start']); |
|
| 679 | - $end = Date("Y-m-d H:i",(int)$_GET['end']); |
|
| 676 | + $json = ""; |
|
| 677 | + if (isset($_GET['start']) && isset($_GET['end']) && isset($_GET['pokemon_id'])) { |
|
| 678 | + $start = Date("Y-m-d H:i", (int) $_GET['start']); |
|
| 679 | + $end = Date("Y-m-d H:i", (int) $_GET['end']); |
|
| 680 | 680 | $pokemon_id = mysqli_real_escape_string($mysqli, $_GET['pokemon_id']); |
| 681 | 681 | $where = " WHERE pokemon.pokemon_id = ".$pokemon_id." " |
| 682 | 682 | . "AND pokemon.disappear_time BETWEEN '".$start."' AND '".$end."'"; |
| 683 | 683 | $req = "SELECT latitude, longitude FROM pokemon".$where." ORDER BY disappear_time DESC LIMIT 10000"; |
| 684 | - $result = $mysqli->query($req); |
|
| 684 | + $result = $mysqli->query($req); |
|
| 685 | 685 | $points = array(); |
| 686 | 686 | while ($result && $data = $result->fetch_object()) { |
| 687 | - $points[] = $data; |
|
| 687 | + $points[] = $data; |
|
| 688 | 688 | } |
| 689 | 689 | |
| 690 | 690 | $json = json_encode($points); |
@@ -697,7 +697,7 @@ discard block |
||
| 697 | 697 | break; |
| 698 | 698 | |
| 699 | 699 | case 'pokedex': |
| 700 | - $json=""; |
|
| 700 | + $json = ""; |
|
| 701 | 701 | if (isset($_GET['pokemon_id'])) { |
| 702 | 702 | $pokemon_id = mysqli_real_escape_string($mysqli, $_GET['pokemon_id']); |
| 703 | 703 | $where = " WHERE pokemon.pokemon_id = ".$pokemon_id; |
@@ -721,7 +721,7 @@ discard block |
||
| 721 | 721 | break; |
| 722 | 722 | |
| 723 | 723 | case 'pokemon_graph_data': |
| 724 | - $json=""; |
|
| 724 | + $json = ""; |
|
| 725 | 725 | if (isset($_GET['pokemon_id'])) { |
| 726 | 726 | $pokemon_id = mysqli_real_escape_string($mysqli, $_GET['pokemon_id']); |
| 727 | 727 | $where = " WHERE pokemonFiltered.pokemon_id = ".$pokemon_id; |
@@ -730,7 +730,7 @@ discard block |
||
| 730 | 730 | FROM (SELECT * FROM pokemon WHERE pokemon_id = '".$pokemon_id."' LIMIT 10000) as pokemonFiltered |
| 731 | 731 | GROUP BY disappear_hour |
| 732 | 732 | ORDER BY disappear_hour"; |
| 733 | - $result = $mysqli->query($req); |
|
| 733 | + $result = $mysqli->query($req); |
|
| 734 | 734 | $array = array(); |
| 735 | 735 | while ($result && $data = $result->fetch_object()) { |
| 736 | 736 | $array[] = $data->total; |
@@ -755,30 +755,30 @@ discard block |
||
| 755 | 755 | |
| 756 | 756 | break; |
| 757 | 757 | } |
| 758 | -if ($postRequest!=""){ |
|
| 758 | +if ($postRequest != "") { |
|
| 759 | 759 | switch ($postRequest) { |
| 760 | 760 | case 'pokemon_live': |
| 761 | - $json=""; |
|
| 762 | - if (isset( $_POST['pokemon_id'])) { |
|
| 761 | + $json = ""; |
|
| 762 | + if (isset($_POST['pokemon_id'])) { |
|
| 763 | 763 | $pokemon_id = mysqli_real_escape_string($mysqli, $_POST['pokemon_id']); |
| 764 | - $inmap_pkms_filter=""; |
|
| 764 | + $inmap_pkms_filter = ""; |
|
| 765 | 765 | $where = " WHERE disappear_time >= UTC_TIMESTAMP() AND pokemon.pokemon_id = ".$pokemon_id; |
| 766 | 766 | |
| 767 | 767 | $reqTestIv = "SELECT MAX(individual_attack) as iv FROM pokemon ".$where; |
| 768 | - $resultTestIv = $mysqli->query($reqTestIv); |
|
| 768 | + $resultTestIv = $mysqli->query($reqTestIv); |
|
| 769 | 769 | $testIv = $resultTestIv->fetch_object(); |
| 770 | - if (isset( $_POST['inmap_pokemons'])&&( $_POST['inmap_pokemons']!="")) { |
|
| 770 | + if (isset($_POST['inmap_pokemons']) && ($_POST['inmap_pokemons'] != "")) { |
|
| 771 | 771 | foreach ($_POST['inmap_pokemons'] as $inmap) { |
| 772 | 772 | $inmap_pkms_filter .= "'".$inmap."',"; |
| 773 | 773 | } |
| 774 | 774 | $inmap_pkms_filter = rtrim($inmap_pkms_filter, ","); |
| 775 | 775 | $where .= " AND pokemon.encounter_id NOT IN (".$inmap_pkms_filter.") "; |
| 776 | 776 | } |
| 777 | - if ($testIv->iv!=null && isset( $_POST['ivMin'])&&( $_POST['ivMin']!="")) { |
|
| 777 | + if ($testIv->iv != null && isset($_POST['ivMin']) && ($_POST['ivMin'] != "")) { |
|
| 778 | 778 | $ivMin = mysqli_real_escape_string($mysqli, $_POST['ivMin']); |
| 779 | 779 | $where .= " AND ((100/45)*(individual_attack+individual_defense+individual_stamina)) >= (".$ivMin.") "; |
| 780 | 780 | } |
| 781 | - if ($testIv->iv!=null && isset( $_POST['ivMax'])&&( $_POST['ivMax']!="")) { |
|
| 781 | + if ($testIv->iv != null && isset($_POST['ivMax']) && ($_POST['ivMax'] != "")) { |
|
| 782 | 782 | $ivMax = mysqli_real_escape_string($mysqli, $_POST['ivMax']); |
| 783 | 783 | $where .= " AND ((100/45)*(individual_attack+individual_defense+individual_stamina)) <=(".$ivMax.") "; |
| 784 | 784 | } |
@@ -786,12 +786,12 @@ discard block |
||
| 786 | 786 | . " (CONVERT_TZ(disappear_time, '+00:00', '".$time_offset."')) as disappear_time_real, " |
| 787 | 787 | . " individual_attack, individual_defense, individual_stamina " |
| 788 | 788 | . "FROM pokemon".$where." ORDER BY disappear_time DESC LIMIT 5000"; |
| 789 | - $result = $mysqli->query($req); |
|
| 789 | + $result = $mysqli->query($req); |
|
| 790 | 790 | $points = array(); |
| 791 | 791 | while ($result && $data = $result->fetch_object()) { |
| 792 | - $pokeid=$data->pokemon_id; |
|
| 792 | + $pokeid = $data->pokemon_id; |
|
| 793 | 793 | $data->name = $pokemons->pokemon->$pokeid->name; |
| 794 | - $points[] = $data; |
|
| 794 | + $points[] = $data; |
|
| 795 | 795 | } |
| 796 | 796 | |
| 797 | 797 | $json = json_encode($points); |
@@ -43,11 +43,11 @@ discard block |
||
| 43 | 43 | } |
| 44 | 44 | $mysqli->set_charset('utf8'); |
| 45 | 45 | $request = ""; |
| 46 | -if (isset($_GET['type'])){ |
|
| 46 | +if (isset($_GET['type'])) { |
|
| 47 | 47 | $request = $_GET['type']; |
| 48 | 48 | } |
| 49 | 49 | $postRequest = ""; |
| 50 | -if (isset($_POST['type'])){ |
|
| 50 | +if (isset($_POST['type'])) { |
|
| 51 | 51 | $postRequest = $_POST['type']; |
| 52 | 52 | $request= "postRequest"; |
| 53 | 53 | } |
@@ -531,8 +531,7 @@ discard block |
||
| 531 | 531 | </div> |
| 532 | 532 | </div> |
| 533 | 533 | </div>'; |
| 534 | - } |
|
| 535 | - else { |
|
| 534 | + } else { |
|
| 536 | 535 | $gymData['infoWindow'] .= ' |
| 537 | 536 | <div style="text-align: center; width: 50px; display: inline-block; margin-right: 3px"> |
| 538 | 537 | <a href="pokemon/'.$data->pokemon_id.'"> |
@@ -755,7 +754,7 @@ discard block |
||
| 755 | 754 | |
| 756 | 755 | break; |
| 757 | 756 | } |
| 758 | -if ($postRequest!=""){ |
|
| 757 | +if ($postRequest!="") { |
|
| 759 | 758 | switch ($postRequest) { |
| 760 | 759 | case 'pokemon_live': |
| 761 | 760 | $json=""; |