@@ -5,7 +5,7 @@ discard block |
||
| 5 | 5 | // Total lured |
| 6 | 6 | // ----------------------------------------------------------------------------------------------------------- |
| 7 | 7 | |
| 8 | -$captcha_file = SYS_PATH.'/core/json/captcha.stats.json'; |
|
| 8 | +$captcha_file = SYS_PATH.'/core/json/captcha.stats.json'; |
|
| 9 | 9 | if (is_file($captcha_file)) { |
| 10 | 10 | $capdatas = json_decode(file_get_contents($captcha_file), true); |
| 11 | 11 | // Trim json stats files to last 7 days of data |
@@ -16,37 +16,37 @@ discard block |
||
| 16 | 16 | $variables_secret = SYS_PATH.'/core/json/variables.secret.json'; |
| 17 | 17 | $config_secret = json_decode(file_get_contents($variables_secret)); |
| 18 | 18 | |
| 19 | -if ($config_secret->captcha_key=="") { |
|
| 19 | +if ($config_secret->captcha_key == "") { |
|
| 20 | 20 | $captcha['timestamp'] = $timestamp; |
| 21 | 21 | // get amount of accounts requiring a captcha |
| 22 | 22 | $req = "SELECT COUNT(*) AS total |
| 23 | 23 | FROM workerstatus |
| 24 | 24 | WHERE `captcha` > '0' |
| 25 | 25 | AND last_modified >= UTC_TIMESTAMP() - INTERVAL 60 SECOND"; |
| 26 | - $result = $mysqli->query($req); |
|
| 27 | - $data = $result->fetch_object(); |
|
| 26 | + $result = $mysqli->query($req); |
|
| 27 | + $data = $result->fetch_object(); |
|
| 28 | 28 | $captcha['captcha_accs'] = $data->total; |
| 29 | 29 | // Add the datas in file |
| 30 | - $capdatas[] = $captcha; |
|
| 30 | + $capdatas[] = $captcha; |
|
| 31 | 31 | } else { |
| 32 | 32 | if (!empty($capdatas)) { |
| 33 | 33 | $lastCaptcha = array_pop($capdatas); |
| 34 | 34 | } else { |
| 35 | - $lastCaptcha["timestamp"]=strtotime("-7 days", strtotime(date("Y-m-d"))); |
|
| 35 | + $lastCaptcha["timestamp"] = strtotime("-7 days", strtotime(date("Y-m-d"))); |
|
| 36 | 36 | } |
| 37 | 37 | $lastCaptchaDate = date("Y-m-d", $lastCaptcha["timestamp"]); |
| 38 | 38 | $startTime = strtotime($lastCaptchaDate); |
| 39 | - $endTime = strtotime(date("Y-m-d"))+date("Z"); |
|
| 39 | + $endTime = strtotime(date("Y-m-d")) + date("Z"); |
|
| 40 | 40 | $timeDiff = abs($endTime - $startTime); |
| 41 | - $numberDays = intval($timeDiff/86400) ; // 86400 seconds in one day |
|
| 42 | - if ($numberDays>7) { |
|
| 43 | - $numberDays=7; |
|
| 41 | + $numberDays = intval($timeDiff / 86400); // 86400 seconds in one day |
|
| 42 | + if ($numberDays > 7) { |
|
| 43 | + $numberDays = 7; |
|
| 44 | 44 | } |
| 45 | - while ($numberDays>=0) { |
|
| 46 | - $day = $endTime-($numberDays*86400); |
|
| 45 | + while ($numberDays >= 0) { |
|
| 46 | + $day = $endTime - ($numberDays * 86400); |
|
| 47 | 47 | $captchaUrl = |
| 48 | - "http://2captcha.com/res.php?key=" . |
|
| 49 | - $config_secret->captcha_key . "&action=getstats&date=" . date("Y-m-d", $day); |
|
| 48 | + "http://2captcha.com/res.php?key=". |
|
| 49 | + $config_secret->captcha_key."&action=getstats&date=".date("Y-m-d", $day); |
|
| 50 | 50 | |
| 51 | 51 | $ch = curl_init(); |
| 52 | 52 | curl_setopt($ch, CURLOPT_URL, $captchaUrl); |
@@ -68,14 +68,14 @@ discard block |
||
| 68 | 68 | $capXml = simplexml_load_string($fileContents); |
| 69 | 69 | |
| 70 | 70 | foreach ($capXml as $key => $value) { |
| 71 | - if ( ($numberDays==0 |
|
| 72 | - && ((int)$value->Attributes()->hour >= (int)date("H", $lastCaptcha["timestamp"]) |
|
| 73 | - && ((int)$value->Attributes()->hour <= (int)date("H"))) |
|
| 74 | - ) || $numberDays>0) { |
|
| 71 | + if (($numberDays == 0 |
|
| 72 | + && ((int) $value->Attributes()->hour >= (int) date("H", $lastCaptcha["timestamp"]) |
|
| 73 | + && ((int) $value->Attributes()->hour <= (int) date("H"))) |
|
| 74 | + ) || $numberDays > 0) { |
|
| 75 | 75 | $captcha['timestamp'] = |
| 76 | - strtotime(date("Y-m-d", $day) . " " . $value->Attributes()->hour . ":00")+date("Z"); |
|
| 77 | - $captcha['captcha_accs'] = (string)$value->volume; |
|
| 78 | - $capdatas[] = $captcha; |
|
| 76 | + strtotime(date("Y-m-d", $day)." ".$value->Attributes()->hour.":00") + date("Z"); |
|
| 77 | + $captcha['captcha_accs'] = (string) $value->volume; |
|
| 78 | + $capdatas[] = $captcha; |
|
| 79 | 79 | } |
| 80 | 80 | } |
| 81 | 81 | --$numberDays; |
@@ -9,20 +9,20 @@ |
||
| 9 | 9 | |
| 10 | 10 | $pokestop['timestamp'] = $timestamp; |
| 11 | 11 | |
| 12 | -$req = "SELECT COUNT(*) AS total FROM pokestop"; |
|
| 13 | -$result = $mysqli->query($req); |
|
| 14 | -$data = $result->fetch_object(); |
|
| 12 | +$req = "SELECT COUNT(*) AS total FROM pokestop"; |
|
| 13 | +$result = $mysqli->query($req); |
|
| 14 | +$data = $result->fetch_object(); |
|
| 15 | 15 | |
| 16 | 16 | $pokestop['total'] = $data->total; |
| 17 | 17 | |
| 18 | -$req = "SELECT COUNT(*) AS total FROM pokestop WHERE lure_expiration >= UTC_TIMESTAMP()"; |
|
| 19 | -$result = $mysqli->query($req); |
|
| 20 | -$data = $result->fetch_object(); |
|
| 18 | +$req = "SELECT COUNT(*) AS total FROM pokestop WHERE lure_expiration >= UTC_TIMESTAMP()"; |
|
| 19 | +$result = $mysqli->query($req); |
|
| 20 | +$data = $result->fetch_object(); |
|
| 21 | 21 | |
| 22 | 22 | $pokestop['lured'] = $data->total; |
| 23 | 23 | |
| 24 | 24 | |
| 25 | 25 | |
| 26 | 26 | // Add the datas in file |
| 27 | -$stopdatas[] = $pokestop; |
|
| 27 | +$stopdatas[] = $pokestop; |
|
| 28 | 28 | file_put_contents($pokestop_file, json_encode($stopdatas)); |
@@ -16,19 +16,19 @@ discard block |
||
| 16 | 16 | $pokemon_stats['timestamp'] = $timestamp; |
| 17 | 17 | |
| 18 | 18 | |
| 19 | -$req = "SELECT COUNT(*) AS total FROM pokemon WHERE disappear_time >= UTC_TIMESTAMP()"; |
|
| 20 | -$result = $mysqli->query($req); |
|
| 21 | -$data = $result->fetch_object(); |
|
| 19 | +$req = "SELECT COUNT(*) AS total FROM pokemon WHERE disappear_time >= UTC_TIMESTAMP()"; |
|
| 20 | +$result = $mysqli->query($req); |
|
| 21 | +$data = $result->fetch_object(); |
|
| 22 | 22 | |
| 23 | -$pokemon_stats['pokemon_now'] = $data->total; |
|
| 23 | +$pokemon_stats['pokemon_now'] = $data->total; |
|
| 24 | 24 | |
| 25 | -$req = "SELECT pokemon_id FROM pokemon WHERE disappear_time >= UTC_TIMESTAMP()"; |
|
| 26 | -$result = $mysqli->query($req); |
|
| 25 | +$req = "SELECT pokemon_id FROM pokemon WHERE disappear_time >= UTC_TIMESTAMP()"; |
|
| 26 | +$result = $mysqli->query($req); |
|
| 27 | 27 | |
| 28 | 28 | $rarityarray = array(); |
| 29 | 29 | while ($data = $result->fetch_object()) { |
| 30 | - $poke_id = $data->pokemon_id; |
|
| 31 | - $rarity = $pokemons->pokemon->$poke_id->rarity; |
|
| 30 | + $poke_id = $data->pokemon_id; |
|
| 31 | + $rarity = $pokemons->pokemon->$poke_id->rarity; |
|
| 32 | 32 | |
| 33 | 33 | isset($rarityarray[$rarity]) ? $rarityarray[$rarity]++ : $rarityarray[$rarity] = 1; |
| 34 | 34 | } |
@@ -43,5 +43,5 @@ discard block |
||
| 43 | 43 | |
| 44 | 44 | |
| 45 | 45 | // Write to file |
| 46 | -$pokedatas[] = $pokemon_stats; |
|
| 46 | +$pokedatas[] = $pokemon_stats; |
|
| 47 | 47 | file_put_contents($pokemonstats_file, json_encode($pokedatas)); |
@@ -3,8 +3,8 @@ discard block |
||
| 3 | 3 | // Include & load the variables |
| 4 | 4 | // ############################ |
| 5 | 5 | |
| 6 | -$variables = SYS_PATH.'/core/json/variables.json'; |
|
| 7 | -$config = json_decode(file_get_contents($variables)); |
|
| 6 | +$variables = SYS_PATH.'/core/json/variables.json'; |
|
| 7 | +$config = json_decode(file_get_contents($variables)); |
|
| 8 | 8 | |
| 9 | 9 | if (!defined('SYS_PATH')) { |
| 10 | 10 | echo 'Error: config.php does not exist or failed to load.<br>'; |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | ################# |
| 39 | 39 | |
| 40 | 40 | |
| 41 | -$mysqli = new mysqli(SYS_DB_HOST, SYS_DB_USER, SYS_DB_PSWD, SYS_DB_NAME, SYS_DB_PORT); |
|
| 41 | +$mysqli = new mysqli(SYS_DB_HOST, SYS_DB_USER, SYS_DB_PSWD, SYS_DB_NAME, SYS_DB_PORT); |
|
| 42 | 42 | |
| 43 | 43 | |
| 44 | 44 | if ($mysqli->connect_error != '') { |
@@ -98,7 +98,7 @@ discard block |
||
| 98 | 98 | // Current Pokemon datas |
| 99 | 99 | // --------------------- |
| 100 | 100 | |
| 101 | - $pokemon_id = mysqli_real_escape_string($mysqli, $_GET['id']); |
|
| 101 | + $pokemon_id = mysqli_real_escape_string($mysqli, $_GET['id']); |
|
| 102 | 102 | |
| 103 | 103 | if (!is_object($pokemons->pokemon->$pokemon_id)) { |
| 104 | 104 | header('Location:/404'); |
@@ -108,7 +108,7 @@ discard block |
||
| 108 | 108 | |
| 109 | 109 | $pokemon = new stdClass(); |
| 110 | 110 | $pokemon = $pokemons->pokemon->$pokemon_id; |
| 111 | - $pokemon->id = $pokemon_id; |
|
| 111 | + $pokemon->id = $pokemon_id; |
|
| 112 | 112 | |
| 113 | 113 | |
| 114 | 114 | // Some math |
@@ -124,9 +124,9 @@ discard block |
||
| 124 | 124 | |
| 125 | 125 | // Total gym protected |
| 126 | 126 | |
| 127 | - $req = "SELECT COUNT(DISTINCT(gym_id)) AS total FROM gym WHERE guard_pokemon_id = '".$pokemon_id."'"; |
|
| 128 | - $result = $mysqli->query($req); |
|
| 129 | - $data = $result->fetch_object(); |
|
| 127 | + $req = "SELECT COUNT(DISTINCT(gym_id)) AS total FROM gym WHERE guard_pokemon_id = '".$pokemon_id."'"; |
|
| 128 | + $result = $mysqli->query($req); |
|
| 129 | + $data = $result->fetch_object(); |
|
| 130 | 130 | |
| 131 | 131 | $pokemon->protected_gyms = $data->total; |
| 132 | 132 | |
@@ -140,21 +140,21 @@ discard block |
||
| 140 | 140 | |
| 141 | 141 | // Last seen |
| 142 | 142 | |
| 143 | - $req = "SELECT disappear_time, (CONVERT_TZ(disappear_time, '+00:00', '".$time_offset."')) AS disappear_time_real, latitude, longitude |
|
| 143 | + $req = "SELECT disappear_time, (CONVERT_TZ(disappear_time, '+00:00', '".$time_offset."')) AS disappear_time_real, latitude, longitude |
|
| 144 | 144 | FROM pokemon |
| 145 | 145 | WHERE pokemon_id = '".$pokemon_id."' |
| 146 | 146 | ORDER BY disappear_time DESC |
| 147 | 147 | LIMIT 0,1"; |
| 148 | - $result = $mysqli->query($req); |
|
| 149 | - $data = $result->fetch_object(); |
|
| 148 | + $result = $mysqli->query($req); |
|
| 149 | + $data = $result->fetch_object(); |
|
| 150 | 150 | |
| 151 | 151 | if (isset($data)) { |
| 152 | - $last_spawn = $data; |
|
| 152 | + $last_spawn = $data; |
|
| 153 | 153 | |
| 154 | - $pokemon->last_seen = strtotime($data->disappear_time_real); |
|
| 155 | - $pokemon->last_position = new stdClass(); |
|
| 156 | - $pokemon->last_position->latitude = $data->latitude; |
|
| 157 | - $pokemon->last_position->longitude = $data->longitude; |
|
| 154 | + $pokemon->last_seen = strtotime($data->disappear_time_real); |
|
| 155 | + $pokemon->last_position = new stdClass(); |
|
| 156 | + $pokemon->last_position->latitude = $data->latitude; |
|
| 157 | + $pokemon->last_position->longitude = $data->longitude; |
|
| 158 | 158 | } |
| 159 | 159 | |
| 160 | 160 | // Related Pokemons |
@@ -238,16 +238,16 @@ discard block |
||
| 238 | 238 | // -------------------------------- |
| 239 | 239 | |
| 240 | 240 | $max = $config->system->max_pokemon; |
| 241 | - $pokedex = new stdClass(); |
|
| 241 | + $pokedex = new stdClass(); |
|
| 242 | 242 | |
| 243 | - for ($i= 1; $i <= $max; $i++) { |
|
| 244 | - $pokedex->$i = new stdClass(); |
|
| 243 | + for ($i = 1; $i <= $max; $i++) { |
|
| 244 | + $pokedex->$i = new stdClass(); |
|
| 245 | 245 | $pokedex->$i->id = $i; |
| 246 | - $pokedex->$i->permalink = 'pokemon/'.$i; |
|
| 246 | + $pokedex->$i->permalink = 'pokemon/'.$i; |
|
| 247 | 247 | $pokedex->$i->img = 'core/pokemons/'.$i.$config->system->pokeimg_suffix; |
| 248 | - $pokedex->$i->name = $pokemons->pokemon->$i->name; |
|
| 249 | - $pokedex->$i->spawn = ($pokemons->pokemon->$i->spawn_count > 0) ? 1 : 0; |
|
| 250 | - $pokedex->$i->spawn_count = $pokemons->pokemon->$i->spawn_count; |
|
| 248 | + $pokedex->$i->name = $pokemons->pokemon->$i->name; |
|
| 249 | + $pokedex->$i->spawn = ($pokemons->pokemon->$i->spawn_count > 0) ? 1 : 0; |
|
| 250 | + $pokedex->$i->spawn_count = $pokemons->pokemon->$i->spawn_count; |
|
| 251 | 251 | } |
| 252 | 252 | |
| 253 | 253 | |
@@ -258,17 +258,17 @@ discard block |
||
| 258 | 258 | ############ |
| 259 | 259 | |
| 260 | 260 | case 'pokestops': |
| 261 | - $pokestop = new stdClass(); |
|
| 261 | + $pokestop = new stdClass(); |
|
| 262 | 262 | |
| 263 | - $req = "SELECT COUNT(*) AS total FROM pokestop"; |
|
| 264 | - $result = $mysqli->query($req); |
|
| 265 | - $data = $result->fetch_object(); |
|
| 263 | + $req = "SELECT COUNT(*) AS total FROM pokestop"; |
|
| 264 | + $result = $mysqli->query($req); |
|
| 265 | + $data = $result->fetch_object(); |
|
| 266 | 266 | |
| 267 | 267 | $pokestop->total = $data->total; |
| 268 | 268 | |
| 269 | - $req = "SELECT COUNT(*) AS total FROM pokestop WHERE lure_expiration >= UTC_TIMESTAMP()"; |
|
| 270 | - $result = $mysqli->query($req); |
|
| 271 | - $data = $result->fetch_object(); |
|
| 269 | + $req = "SELECT COUNT(*) AS total FROM pokestop WHERE lure_expiration >= UTC_TIMESTAMP()"; |
|
| 270 | + $result = $mysqli->query($req); |
|
| 271 | + $data = $result->fetch_object(); |
|
| 272 | 272 | |
| 273 | 273 | $pokestop->lured = $data->total; |
| 274 | 274 | |
@@ -285,36 +285,36 @@ discard block |
||
| 285 | 285 | // 3 Teams (teamm rocket is neutral) |
| 286 | 286 | // 1 Fight |
| 287 | 287 | |
| 288 | - $teams = new stdClass(); |
|
| 288 | + $teams = new stdClass(); |
|
| 289 | 289 | |
| 290 | - $teams->mystic = new stdClass(); |
|
| 291 | - $teams->mystic->guardians = new stdClass(); |
|
| 292 | - $teams->mystic->id = 1; |
|
| 290 | + $teams->mystic = new stdClass(); |
|
| 291 | + $teams->mystic->guardians = new stdClass(); |
|
| 292 | + $teams->mystic->id = 1; |
|
| 293 | 293 | |
| 294 | - $teams->valor = new stdClass(); |
|
| 295 | - $teams->valor->guardians = new stdClass(); |
|
| 296 | - $teams->valor->id = 2; |
|
| 294 | + $teams->valor = new stdClass(); |
|
| 295 | + $teams->valor->guardians = new stdClass(); |
|
| 296 | + $teams->valor->id = 2; |
|
| 297 | 297 | |
| 298 | - $teams->instinct = new stdClass(); |
|
| 299 | - $teams->instinct->guardians = new stdClass(); |
|
| 300 | - $teams->instinct->id = 3; |
|
| 298 | + $teams->instinct = new stdClass(); |
|
| 299 | + $teams->instinct->guardians = new stdClass(); |
|
| 300 | + $teams->instinct->id = 3; |
|
| 301 | 301 | |
| 302 | - $teams->rocket = new stdClass(); |
|
| 303 | - $teams->rocket->guardians = new stdClass(); |
|
| 304 | - $teams->rocket->id = 0; |
|
| 302 | + $teams->rocket = new stdClass(); |
|
| 303 | + $teams->rocket->guardians = new stdClass(); |
|
| 304 | + $teams->rocket->id = 0; |
|
| 305 | 305 | |
| 306 | 306 | |
| 307 | 307 | |
| 308 | 308 | foreach ($teams as $team_key => $team_values) { |
| 309 | 309 | // Team Guardians |
| 310 | 310 | |
| 311 | - $req = "SELECT COUNT(*) AS total, guard_pokemon_id FROM gym WHERE team_id = '".$team_values->id."' GROUP BY guard_pokemon_id ORDER BY total DESC LIMIT 0,3"; |
|
| 311 | + $req = "SELECT COUNT(*) AS total, guard_pokemon_id FROM gym WHERE team_id = '".$team_values->id."' GROUP BY guard_pokemon_id ORDER BY total DESC LIMIT 0,3"; |
|
| 312 | 312 | $result = $mysqli->query($req); |
| 313 | 313 | |
| 314 | - $i=0; |
|
| 314 | + $i = 0; |
|
| 315 | 315 | |
| 316 | 316 | while ($data = $result->fetch_object()) { |
| 317 | - $teams->$team_key->guardians->$i = $data->guard_pokemon_id; |
|
| 317 | + $teams->$team_key->guardians->$i = $data->guard_pokemon_id; |
|
| 318 | 318 | |
| 319 | 319 | $i++; |
| 320 | 320 | } |
@@ -326,8 +326,8 @@ discard block |
||
| 326 | 326 | $result = $mysqli->query($req); |
| 327 | 327 | $data = $result->fetch_object(); |
| 328 | 328 | |
| 329 | - $teams->$team_key->gym_owned = $data->total; |
|
| 330 | - $teams->$team_key->average = $data->average_points; |
|
| 329 | + $teams->$team_key->gym_owned = $data->total; |
|
| 330 | + $teams->$team_key->average = $data->average_points; |
|
| 331 | 331 | } |
| 332 | 332 | |
| 333 | 333 | |
@@ -340,7 +340,7 @@ discard block |
||
| 340 | 340 | case 'dashboard': |
| 341 | 341 | // This case is only used for test purpose. |
| 342 | 342 | |
| 343 | - $stats_file = SYS_PATH.'/core/json/gym.stats.json'; |
|
| 343 | + $stats_file = SYS_PATH.'/core/json/gym.stats.json'; |
|
| 344 | 344 | |
| 345 | 345 | if (!is_file($stats_file)) { |
| 346 | 346 | echo "Sorry, no Gym stats file was found. <br> Did you enable cron? "; |
@@ -348,7 +348,7 @@ discard block |
||
| 348 | 348 | } |
| 349 | 349 | |
| 350 | 350 | |
| 351 | - $stats_file = SYS_PATH.'/core/json/pokemon.stats.json'; |
|
| 351 | + $stats_file = SYS_PATH.'/core/json/pokemon.stats.json'; |
|
| 352 | 352 | |
| 353 | 353 | if (!is_file($stats_file)) { |
| 354 | 354 | echo "Sorry, no Pokémon stats file was found. <br> Did you enabled cron?"; |
@@ -356,7 +356,7 @@ discard block |
||
| 356 | 356 | } |
| 357 | 357 | |
| 358 | 358 | |
| 359 | - $stats_file = SYS_PATH.'/core/json/pokestop.stats.json'; |
|
| 359 | + $stats_file = SYS_PATH.'/core/json/pokestop.stats.json'; |
|
| 360 | 360 | |
| 361 | 361 | if (!is_file($stats_file)) { |
| 362 | 362 | echo "Sorry, no Pokéstop stats file was found. <br> Did you enabled cron?"; |
@@ -364,7 +364,7 @@ discard block |
||
| 364 | 364 | } |
| 365 | 365 | |
| 366 | 366 | if ($config->system->captcha_support) { |
| 367 | - $stats_file = SYS_PATH.'/core/json/captcha.stats.json'; |
|
| 367 | + $stats_file = SYS_PATH.'/core/json/captcha.stats.json'; |
|
| 368 | 368 | |
| 369 | 369 | if (!is_file($stats_file)) { |
| 370 | 370 | echo "Sorry, no Captcha stats file were found <br> Have you enable cron?"; |
@@ -384,9 +384,9 @@ discard block |
||
| 384 | 384 | // Right now |
| 385 | 385 | // --------- |
| 386 | 386 | |
| 387 | - $req = "SELECT COUNT(*) AS total FROM pokemon WHERE disappear_time >= UTC_TIMESTAMP()"; |
|
| 388 | - $result = $mysqli->query($req); |
|
| 389 | - $data = $result->fetch_object(); |
|
| 387 | + $req = "SELECT COUNT(*) AS total FROM pokemon WHERE disappear_time >= UTC_TIMESTAMP()"; |
|
| 388 | + $result = $mysqli->query($req); |
|
| 389 | + $data = $result->fetch_object(); |
|
| 390 | 390 | |
| 391 | 391 | |
| 392 | 392 | $home->pokemon_now = $data->total; |
@@ -395,9 +395,9 @@ discard block |
||
| 395 | 395 | // Lured stops |
| 396 | 396 | // ----------- |
| 397 | 397 | |
| 398 | - $req = "SELECT COUNT(*) AS total FROM pokestop WHERE lure_expiration >= UTC_TIMESTAMP()"; |
|
| 399 | - $result = $mysqli->query($req); |
|
| 400 | - $data = $result->fetch_object(); |
|
| 398 | + $req = "SELECT COUNT(*) AS total FROM pokestop WHERE lure_expiration >= UTC_TIMESTAMP()"; |
|
| 399 | + $result = $mysqli->query($req); |
|
| 400 | + $data = $result->fetch_object(); |
|
| 401 | 401 | |
| 402 | 402 | $home->pokestop_lured = $data->total; |
| 403 | 403 | |
@@ -405,9 +405,9 @@ discard block |
||
| 405 | 405 | // Gyms |
| 406 | 406 | // ---- |
| 407 | 407 | |
| 408 | - $req = "SELECT COUNT(DISTINCT(gym_id)) AS total FROM gym"; |
|
| 409 | - $result = $mysqli->query($req); |
|
| 410 | - $data = $result->fetch_object(); |
|
| 408 | + $req = "SELECT COUNT(DISTINCT(gym_id)) AS total FROM gym"; |
|
| 409 | + $result = $mysqli->query($req); |
|
| 410 | + $data = $result->fetch_object(); |
|
| 411 | 411 | |
| 412 | 412 | $home->gyms = $data->total; |
| 413 | 413 | |
@@ -417,7 +417,7 @@ discard block |
||
| 417 | 417 | |
| 418 | 418 | if ($config->system->recents_filter) { |
| 419 | 419 | // get all mythic pokemon ids |
| 420 | - $mythic_pokemons = array(); |
|
| 420 | + $mythic_pokemons = array(); |
|
| 421 | 421 | foreach ($pokemons->pokemon as $id => $pokemon) { |
| 422 | 422 | if ($pokemon->spawn_rate < $config->system->recents_filter_rarity && $pokemon->rating >= $config->system->recents_filter_rating) { |
| 423 | 423 | $mythic_pokemons[] = $id; |
@@ -481,28 +481,28 @@ discard block |
||
| 481 | 481 | |
| 482 | 482 | $req = "SELECT COUNT(DISTINCT(gym_id)) AS total FROM gym WHERE team_id = '1'"; |
| 483 | 483 | $result = $mysqli->query($req); |
| 484 | - $data = $result->fetch_object(); |
|
| 484 | + $data = $result->fetch_object(); |
|
| 485 | 485 | |
| 486 | - $home->teams->mystic = $data->total; |
|
| 486 | + $home->teams->mystic = $data->total; |
|
| 487 | 487 | |
| 488 | 488 | |
| 489 | 489 | $req = "SELECT COUNT(DISTINCT(gym_id)) AS total FROM gym WHERE team_id = '2'"; |
| 490 | 490 | $result = $mysqli->query($req); |
| 491 | - $data = $result->fetch_object(); |
|
| 491 | + $data = $result->fetch_object(); |
|
| 492 | 492 | |
| 493 | - $home->teams->valor = $data->total; |
|
| 493 | + $home->teams->valor = $data->total; |
|
| 494 | 494 | |
| 495 | 495 | |
| 496 | 496 | $req = "SELECT COUNT(DISTINCT(gym_id)) AS total FROM gym WHERE team_id = '3'"; |
| 497 | 497 | $result = $mysqli->query($req); |
| 498 | - $data = $result->fetch_object(); |
|
| 498 | + $data = $result->fetch_object(); |
|
| 499 | 499 | |
| 500 | - $home->teams->instinct = $data->total; |
|
| 500 | + $home->teams->instinct = $data->total; |
|
| 501 | 501 | |
| 502 | 502 | |
| 503 | 503 | $req = "SELECT COUNT(DISTINCT(gym_id)) AS total FROM gym WHERE team_id = '0'"; |
| 504 | 504 | $result = $mysqli->query($req); |
| 505 | - $data = $result->fetch_object(); |
|
| 505 | + $data = $result->fetch_object(); |
|
| 506 | 506 | |
| 507 | - $home->teams->rocket = $data->total; |
|
| 507 | + $home->teams->rocket = $data->total; |
|
| 508 | 508 | } |
@@ -76,26 +76,26 @@ discard block |
||
| 76 | 76 | if ($pokemon->iv->available) { |
| 77 | 77 | if ($config->system->iv_numbers) { ?> |
| 78 | 78 | <div class="progress" style="height: 15px; margin-bottom: 0"> |
| 79 | - <div title="Attack IV: <?= $pokemon->iv->attack ?>" class="progress-bar progress-bar-danger" role="progressbar" aria-valuenow="<?= $pokemon->iv->attack ?>" aria-valuemin="0" aria-valuemax="45" style="width: <?= (100/3) ?>%; line-height: 16px"> |
|
| 79 | + <div title="Attack IV: <?= $pokemon->iv->attack ?>" class="progress-bar progress-bar-danger" role="progressbar" aria-valuenow="<?= $pokemon->iv->attack ?>" aria-valuemin="0" aria-valuemax="45" style="width: <?= (100 / 3) ?>%; line-height: 16px"> |
|
| 80 | 80 | <span class="sr-only"><?= $locales->ATTACK ?> IV: <?= $pokemon->iv->attack ?></span><?= $pokemon->iv->attack ?> |
| 81 | 81 | </div> |
| 82 | - <div title="Defense IV: <?= $pokemon->iv->defense ?>" class="progress-bar progress-bar-info" role="progressbar" aria-valuenow="<?= $pokemon->iv->defense ?>" aria-valuemin="0" aria-valuemax="45" style="width: <?= (100/3) ?>%; line-height: 16px"> |
|
| 82 | + <div title="Defense IV: <?= $pokemon->iv->defense ?>" class="progress-bar progress-bar-info" role="progressbar" aria-valuenow="<?= $pokemon->iv->defense ?>" aria-valuemin="0" aria-valuemax="45" style="width: <?= (100 / 3) ?>%; line-height: 16px"> |
|
| 83 | 83 | <span class="sr-only"><?= $locales->DEFENSE ?> IV: <?= $pokemon->iv->defense ?></span><?= $pokemon->iv->defense ?> |
| 84 | 84 | </div> |
| 85 | - <div title="Stamina IV: <?= $pokemon->iv->stamina ?>" class="progress-bar progress-bar-success" role="progressbar" aria-valuenow="<?= $pokemon->iv->stamina ?>" aria-valuemin="0" aria-valuemax="45" style="width: <?= (100/3) ?>%; line-height: 16px"> |
|
| 85 | + <div title="Stamina IV: <?= $pokemon->iv->stamina ?>" class="progress-bar progress-bar-success" role="progressbar" aria-valuenow="<?= $pokemon->iv->stamina ?>" aria-valuemin="0" aria-valuemax="45" style="width: <?= (100 / 3) ?>%; line-height: 16px"> |
|
| 86 | 86 | <span class="sr-only"><?= $locales->STAMINA ?> IV: <?= $pokemon->iv->stamina ?></span><?= $pokemon->iv->stamina ?> |
| 87 | 87 | </div> |
| 88 | 88 | </div> |
| 89 | 89 | <?php |
| 90 | 90 | } else { ?> |
| 91 | 91 | <div class="progress" style="height: 6px; width: 80%; margin: 5px auto 0 auto;"> |
| 92 | - <div title="Attack IV: <?= $pokemon->iv->attack ?>" class="progress-bar progress-bar-danger" role="progressbar" aria-valuenow="<?= $pokemon->iv->attack ?>" aria-valuemin="0" aria-valuemax="45" style="width: <?= ((100/15)*$pokemon->iv->attack)/3 ?>%"> |
|
| 92 | + <div title="Attack IV: <?= $pokemon->iv->attack ?>" class="progress-bar progress-bar-danger" role="progressbar" aria-valuenow="<?= $pokemon->iv->attack ?>" aria-valuemin="0" aria-valuemax="45" style="width: <?= ((100 / 15) * $pokemon->iv->attack) / 3 ?>%"> |
|
| 93 | 93 | <span class="sr-only"><?= $locales->ATTACK ?> IV: <?= $pokemon->iv->attack ?></span> |
| 94 | 94 | </div> |
| 95 | - <div title="Defense IV: <?= $pokemon->iv->defense ?>" class="progress-bar progress-bar-info" role="progressbar" aria-valuenow="<?= $pokemon->iv->defense ?>" aria-valuemin="0" aria-valuemax="45" style="width: <?= ((100/15)*$pokemon->iv->defense)/3 ?>%"> |
|
| 95 | + <div title="Defense IV: <?= $pokemon->iv->defense ?>" class="progress-bar progress-bar-info" role="progressbar" aria-valuenow="<?= $pokemon->iv->defense ?>" aria-valuemin="0" aria-valuemax="45" style="width: <?= ((100 / 15) * $pokemon->iv->defense) / 3 ?>%"> |
|
| 96 | 96 | <span class="sr-only"><?= $locales->DEFENSE ?> IV: <?= $pokemon->iv->defense ?></span> |
| 97 | 97 | </div> |
| 98 | - <div title="Stamina IV: <?= $pokemon->iv->stamina ?>" class="progress-bar progress-bar-success" role="progressbar" aria-valuenow="<?= $pokemon->iv->stamina ?>" aria-valuemin="0" aria-valuemax="45" style="width: <?= ((100/15)*$pokemon->iv->stamina)/3 ?>%"> |
|
| 98 | + <div title="Stamina IV: <?= $pokemon->iv->stamina ?>" class="progress-bar progress-bar-success" role="progressbar" aria-valuenow="<?= $pokemon->iv->stamina ?>" aria-valuemin="0" aria-valuemax="45" style="width: <?= ((100 / 15) * $pokemon->iv->stamina) / 3 ?>%"> |
|
| 99 | 99 | <span class="sr-only"><?= $locales->STAMINA ?> IV: <?= $pokemon->iv->stamina ?></span> |
| 100 | 100 | </div> |
| 101 | 101 | </div> |
@@ -106,13 +106,13 @@ discard block |
||
| 106 | 106 | } else { |
| 107 | 107 | if ($config->system->iv_numbers) { ?> |
| 108 | 108 | <div class="progress" style="height: 15px; margin-bottom: 0"> |
| 109 | - <div title="Attack IV: not available" class="progress-bar progress-bar-danger" role="progressbar" aria-valuenow="<?= $pokemon->iv->attack ?>" aria-valuemin="0" aria-valuemax="45" style="width: <?= (100/3) ?>%; line-height: 16px"> |
|
| 109 | + <div title="Attack IV: not available" class="progress-bar progress-bar-danger" role="progressbar" aria-valuenow="<?= $pokemon->iv->attack ?>" aria-valuemin="0" aria-valuemax="45" style="width: <?= (100 / 3) ?>%; line-height: 16px"> |
|
| 110 | 110 | <span class="sr-only"><?= $locales->ATTACK ?> IV: <?= $locales->NOT_AVAILABLE ?></span>? |
| 111 | 111 | </div> |
| 112 | - <div title="Defense IV: not available" class="progress-bar progress-bar-info" role="progressbar" aria-valuenow="<?= $pokemon->iv->defense ?>" aria-valuemin="0" aria-valuemax="45" style="width: <?= (100/3) ?>%; line-height: 16px"> |
|
| 112 | + <div title="Defense IV: not available" class="progress-bar progress-bar-info" role="progressbar" aria-valuenow="<?= $pokemon->iv->defense ?>" aria-valuemin="0" aria-valuemax="45" style="width: <?= (100 / 3) ?>%; line-height: 16px"> |
|
| 113 | 113 | <span class="sr-only"><?= $locales->DEFENSE ?> IV: <?= $locales->NOT_AVAILABLE ?></span>? |
| 114 | 114 | </div> |
| 115 | - <div title="Stamina IV: not available" class="progress-bar progress-bar-success" role="progressbar" aria-valuenow="<?= $pokemon->iv->stamina ?>" aria-valuemin="0" aria-valuemax="45" style="width: <?= (100/3) ?>%; line-height: 16px"> |
|
| 115 | + <div title="Stamina IV: not available" class="progress-bar progress-bar-success" role="progressbar" aria-valuenow="<?= $pokemon->iv->stamina ?>" aria-valuemin="0" aria-valuemax="45" style="width: <?= (100 / 3) ?>%; line-height: 16px"> |
|
| 116 | 116 | <span class="sr-only"><?= $locales->STAMINA ?> IV: <?= $locales->NOT_AVAILABLE ?></span>? |
| 117 | 117 | </div> |
| 118 | 118 | </div> |
@@ -58,153 +58,153 @@ 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 | - header('Content-Type: application/json'); |
|
| 128 | - echo json_encode($values); |
|
| 127 | + header('Content-Type: application/json'); |
|
| 128 | + echo json_encode($values); |
|
| 129 | 129 | |
| 130 | - break; |
|
| 130 | + break; |
|
| 131 | 131 | |
| 132 | 132 | |
| 133 | - #################################### |
|
| 134 | - // |
|
| 135 | - // Update latests spawn on homepage |
|
| 136 | - // |
|
| 137 | - #################################### |
|
| 133 | + #################################### |
|
| 134 | + // |
|
| 135 | + // Update latests spawn on homepage |
|
| 136 | + // |
|
| 137 | + #################################### |
|
| 138 | 138 | |
| 139 | - case 'spawnlist_update': |
|
| 140 | - // Recent spawn |
|
| 141 | - // ------------ |
|
| 142 | - $total_spawns = array(); |
|
| 143 | - $last_uid_param = ""; |
|
| 144 | - if (isset($_GET['last_uid'])) { |
|
| 145 | - $last_uid_param = $_GET['last_uid']; |
|
| 146 | - } |
|
| 147 | - if ($config->system->recents_filter) { |
|
| 148 | - // get all mythic pokemon ids |
|
| 149 | - $mythic_pokemons = array(); |
|
| 150 | - foreach ($pokemons->pokemon as $id => $pokemon) { |
|
| 151 | - if ($pokemon->spawn_rate < $config->system->recents_filter_rarity && $pokemon->rating >= $config->system->recents_filter_rating) { |
|
| 152 | - $mythic_pokemons[] = $id; |
|
| 153 | - } |
|
| 139 | + case 'spawnlist_update': |
|
| 140 | + // Recent spawn |
|
| 141 | + // ------------ |
|
| 142 | + $total_spawns = array(); |
|
| 143 | + $last_uid_param = ""; |
|
| 144 | + if (isset($_GET['last_uid'])) { |
|
| 145 | + $last_uid_param = $_GET['last_uid']; |
|
| 154 | 146 | } |
| 147 | + if ($config->system->recents_filter) { |
|
| 148 | + // get all mythic pokemon ids |
|
| 149 | + $mythic_pokemons = array(); |
|
| 150 | + foreach ($pokemons->pokemon as $id => $pokemon) { |
|
| 151 | + if ($pokemon->spawn_rate < $config->system->recents_filter_rarity && $pokemon->rating >= $config->system->recents_filter_rating) { |
|
| 152 | + $mythic_pokemons[] = $id; |
|
| 153 | + } |
|
| 154 | + } |
|
| 155 | 155 | |
| 156 | - // get last mythic pokemon |
|
| 157 | - $req = "SELECT pokemon_id, encounter_id, disappear_time, last_modified, (CONVERT_TZ(disappear_time, '+00:00', '".$time_offset."')) AS disappear_time_real, |
|
| 156 | + // get last mythic pokemon |
|
| 157 | + $req = "SELECT pokemon_id, encounter_id, disappear_time, last_modified, (CONVERT_TZ(disappear_time, '+00:00', '".$time_offset."')) AS disappear_time_real, |
|
| 158 | 158 | latitude, longitude, cp, individual_attack, individual_defense, individual_stamina |
| 159 | 159 | FROM pokemon |
| 160 | 160 | WHERE pokemon_id IN (".implode(",", $mythic_pokemons).") |
| 161 | 161 | ORDER BY last_modified DESC |
| 162 | 162 | LIMIT 0,12"; |
| 163 | - } else { |
|
| 164 | - // get last pokemon |
|
| 165 | - $req = "SELECT pokemon_id, encounter_id, disappear_time, last_modified, (CONVERT_TZ(disappear_time, '+00:00', '".$time_offset."')) AS disappear_time_real, |
|
| 163 | + } else { |
|
| 164 | + // get last pokemon |
|
| 165 | + $req = "SELECT pokemon_id, encounter_id, disappear_time, last_modified, (CONVERT_TZ(disappear_time, '+00:00', '".$time_offset."')) AS disappear_time_real, |
|
| 166 | 166 | latitude, longitude, cp, individual_attack, individual_defense, individual_stamina |
| 167 | 167 | FROM pokemon |
| 168 | 168 | ORDER BY last_modified DESC |
| 169 | 169 | LIMIT 0,12"; |
| 170 | - } |
|
| 171 | - $result = $mysqli->query($req); |
|
| 172 | - while ($data = $result->fetch_object()) { |
|
| 173 | - $new_spawn = array(); |
|
| 174 | - $pokeid = $data->pokemon_id; |
|
| 175 | - $pokeuid = $data->encounter_id; |
|
| 176 | - |
|
| 177 | - if ($last_uid_param != $pokeuid) { |
|
| 178 | - $last_seen = strtotime($data->disappear_time_real); |
|
| 179 | - |
|
| 180 | - $last_location = new stdClass(); |
|
| 181 | - $last_location->latitude = $data->latitude; |
|
| 182 | - $last_location->longitude = $data->longitude; |
|
| 183 | - |
|
| 184 | - if ($config->system->recents_show_iv) { |
|
| 185 | - $iv = new stdClass(); |
|
| 186 | - $iv->cp = $data->cp; |
|
| 187 | - $iv->attack = $data->individual_attack; |
|
| 188 | - $iv->defense = $data->individual_defense; |
|
| 189 | - $iv->stamina = $data->individual_stamina; |
|
| 190 | - if (isset($iv->attack) && isset($iv->defense) && isset($iv->stamina)) { |
|
| 191 | - $iv->available = true; |
|
| 192 | - } else { |
|
| 193 | - $iv->available = false; |
|
| 170 | + } |
|
| 171 | + $result = $mysqli->query($req); |
|
| 172 | + while ($data = $result->fetch_object()) { |
|
| 173 | + $new_spawn = array(); |
|
| 174 | + $pokeid = $data->pokemon_id; |
|
| 175 | + $pokeuid = $data->encounter_id; |
|
| 176 | + |
|
| 177 | + if ($last_uid_param != $pokeuid) { |
|
| 178 | + $last_seen = strtotime($data->disappear_time_real); |
|
| 179 | + |
|
| 180 | + $last_location = new stdClass(); |
|
| 181 | + $last_location->latitude = $data->latitude; |
|
| 182 | + $last_location->longitude = $data->longitude; |
|
| 183 | + |
|
| 184 | + if ($config->system->recents_show_iv) { |
|
| 185 | + $iv = new stdClass(); |
|
| 186 | + $iv->cp = $data->cp; |
|
| 187 | + $iv->attack = $data->individual_attack; |
|
| 188 | + $iv->defense = $data->individual_defense; |
|
| 189 | + $iv->stamina = $data->individual_stamina; |
|
| 190 | + if (isset($iv->attack) && isset($iv->defense) && isset($iv->stamina)) { |
|
| 191 | + $iv->available = true; |
|
| 192 | + } else { |
|
| 193 | + $iv->available = false; |
|
| 194 | + } |
|
| 194 | 195 | } |
| 195 | - } |
|
| 196 | 196 | |
| 197 | - $html = ' |
|
| 197 | + $html = ' |
|
| 198 | 198 | <div class="col-md-1 col-xs-4 pokemon-single" data-pokeid="'.$pokeid.'" data-pokeuid="'.$pokeuid.'" style="display: none;"> |
| 199 | 199 | <a href="pokemon/'.$pokeid.'"><img src="core/pokemons/'.$pokeid.$config->system->pokeimg_suffix.'" alt="'.$pokemons->pokemon->$pokeid->name.'" class="img-responsive"></a> |
| 200 | 200 | <a href="pokemon/'.$pokeid.'"><p class="pkmn-name">'.$pokemons->pokemon->$pokeid->name.'</p></a> |
| 201 | 201 | <a href="https://maps.google.com/?q='.$last_location->latitude.','.$last_location->longitude.'&ll='.$last_location->latitude.','.$last_location->longitude.'&z=16" target="_blank"> |
| 202 | 202 | <small class="pokemon-timer">00:00:00</small> |
| 203 | 203 | </a>'; |
| 204 | - if ($config->system->recents_show_iv) { |
|
| 205 | - if ($iv->available) { |
|
| 206 | - if ($config->system->iv_numbers) { |
|
| 207 | - $html .= ' |
|
| 204 | + if ($config->system->recents_show_iv) { |
|
| 205 | + if ($iv->available) { |
|
| 206 | + if ($config->system->iv_numbers) { |
|
| 207 | + $html .= ' |
|
| 208 | 208 | <div class="progress" style="height: 15px; margin-bottom: 0"> |
| 209 | 209 | <div title="'.$locales->IV_ATTACK.': '.$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"> |
| 210 | 210 | <span class="sr-only">'.$locales->IV_ATTACK.': '.$iv->attack.'</span>'.$iv->attack .' |
@@ -216,8 +216,8 @@ discard block |
||
| 216 | 216 | <span class="sr-only">'.$locales->IV_STAMINA.': '.$iv->stamina.'</span>'.$iv->stamina .' |
| 217 | 217 | </div> |
| 218 | 218 | </div>'; |
| 219 | - } else { |
|
| 220 | - $html .= ' |
|
| 219 | + } else { |
|
| 220 | + $html .= ' |
|
| 221 | 221 | <div class="progress" style="height: 6px; width: 80%; margin: 5px auto 0 auto"> |
| 222 | 222 | <div title="'.$locales->IV_ATTACK.': '.$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).'%"> |
| 223 | 223 | <span class="sr-only">'.$locales->IV_ATTACK.': '.$iv->attack.'</span> |
@@ -229,11 +229,11 @@ discard block |
||
| 229 | 229 | <span class="sr-only">'.$locales->IV_STAMINA.': '.$iv->stamina.'</span> |
| 230 | 230 | </div> |
| 231 | 231 | </div>'; |
| 232 | - } |
|
| 233 | - $html .= '<small>'.$iv->cp.'</small>'; |
|
| 234 | - } else { |
|
| 235 | - if ($config->system->iv_numbers) { |
|
| 236 | - $html .= ' |
|
| 232 | + } |
|
| 233 | + $html .= '<small>'.$iv->cp.'</small>'; |
|
| 234 | + } else { |
|
| 235 | + if ($config->system->iv_numbers) { |
|
| 236 | + $html .= ' |
|
| 237 | 237 | <div class="progress" style="height: 15px; margin-bottom: 0"> |
| 238 | 238 | <div title="'.$locales->IV_ATTACK.': 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"> |
| 239 | 239 | <span class="sr-only">'.$locales->IV_ATTACK.': '.$locales->NOT_AVAILABLE.'</span>? |
@@ -245,127 +245,127 @@ discard block |
||
| 245 | 245 | <span class="sr-only">'.$locales->IV_STAMINA.': '.$locales->NOT_AVAILABLE.'</span>? |
| 246 | 246 | </div> |
| 247 | 247 | </div>'; |
| 248 | - } else { |
|
| 249 | - $html .= ' |
|
| 248 | + } else { |
|
| 249 | + $html .= ' |
|
| 250 | 250 | <div class="progress" style="height: 6px; width: 80%; margin: 5px auto 0 auto"> |
| 251 | 251 | <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"> |
| 252 | 252 | <span class="sr-only">IV '.$locales->NOT_AVAILABLE.'</span> |
| 253 | 253 | </div> |
| 254 | 254 | </div>'; |
| 255 | + } |
|
| 256 | + $html .= '<small>???</small>'; |
|
| 255 | 257 | } |
| 256 | - $html .= '<small>???</small>'; |
|
| 257 | 258 | } |
| 258 | - } |
|
| 259 | - $html .= ' |
|
| 259 | + $html .= ' |
|
| 260 | 260 | </div>'; |
| 261 | - $new_spawn['html'] = $html; |
|
| 262 | - $countdown = $last_seen - time(); |
|
| 263 | - $new_spawn['countdown'] = $countdown; |
|
| 264 | - $new_spawn['pokemon_uid'] = $pokeuid; |
|
| 265 | - $total_spawns[] = $new_spawn; |
|
| 266 | - } else { |
|
| 267 | - break; |
|
| 261 | + $new_spawn['html'] = $html; |
|
| 262 | + $countdown = $last_seen - time(); |
|
| 263 | + $new_spawn['countdown'] = $countdown; |
|
| 264 | + $new_spawn['pokemon_uid'] = $pokeuid; |
|
| 265 | + $total_spawns[] = $new_spawn; |
|
| 266 | + } else { |
|
| 267 | + break; |
|
| 268 | + } |
|
| 268 | 269 | } |
| 269 | - } |
|
| 270 | 270 | |
| 271 | - header('Content-Type: application/json'); |
|
| 272 | - echo json_encode($total_spawns); |
|
| 271 | + header('Content-Type: application/json'); |
|
| 272 | + echo json_encode($total_spawns); |
|
| 273 | 273 | |
| 274 | - break; |
|
| 274 | + break; |
|
| 275 | 275 | |
| 276 | 276 | |
| 277 | - #################################### |
|
| 278 | - // |
|
| 279 | - // List Pokestop |
|
| 280 | - // |
|
| 281 | - #################################### |
|
| 277 | + #################################### |
|
| 278 | + // |
|
| 279 | + // List Pokestop |
|
| 280 | + // |
|
| 281 | + #################################### |
|
| 282 | 282 | |
| 283 | - case 'pokestop': |
|
| 284 | - $where = ""; |
|
| 285 | - if ($config->system->only_lured_pokestops) { |
|
| 286 | - $where = "WHERE lure_expiration > UTC_TIMESTAMP() ORDER BY lure_expiration"; |
|
| 287 | - } |
|
| 288 | - $req = "SELECT latitude, longitude, lure_expiration, UTC_TIMESTAMP() AS now, (CONVERT_TZ(lure_expiration, '+00:00', '".$time_offset."')) AS lure_expiration_real FROM pokestop ".$where.""; |
|
| 283 | + case 'pokestop': |
|
| 284 | + $where = ""; |
|
| 285 | + if ($config->system->only_lured_pokestops) { |
|
| 286 | + $where = "WHERE lure_expiration > UTC_TIMESTAMP() ORDER BY lure_expiration"; |
|
| 287 | + } |
|
| 288 | + $req = "SELECT latitude, longitude, lure_expiration, UTC_TIMESTAMP() AS now, (CONVERT_TZ(lure_expiration, '+00:00', '".$time_offset."')) AS lure_expiration_real FROM pokestop ".$where.""; |
|
| 289 | 289 | |
| 290 | - //show all stops if no lure active |
|
| 291 | - if (!$mysqli->query($req)->fetch_object()) { |
|
| 292 | - $req = "SELECT latitude, longitude, lure_expiration, UTC_TIMESTAMP() AS now, (CONVERT_TZ(lure_expiration, '+00:00', '".$time_offset."')) AS lure_expiration_real FROM pokestop"; |
|
| 293 | - } |
|
| 294 | - $result = $mysqli->query($req); |
|
| 290 | + //show all stops if no lure active |
|
| 291 | + if (!$mysqli->query($req)->fetch_object()) { |
|
| 292 | + $req = "SELECT latitude, longitude, lure_expiration, UTC_TIMESTAMP() AS now, (CONVERT_TZ(lure_expiration, '+00:00', '".$time_offset."')) AS lure_expiration_real FROM pokestop"; |
|
| 293 | + } |
|
| 294 | + $result = $mysqli->query($req); |
|
| 295 | 295 | |
| 296 | - $pokestops = []; |
|
| 296 | + $pokestops = []; |
|
| 297 | 297 | |
| 298 | - while ($data = $result->fetch_object()) { |
|
| 299 | - if ($data->lure_expiration >= $data->now) { |
|
| 300 | - $icon = 'pokestap_lured.png'; |
|
| 301 | - $text = sprintf($locales->POKESTOPS_MAP_LURED, date('H:i:s', strtotime($data->lure_expiration_real))); |
|
| 302 | - } else { |
|
| 303 | - $icon = 'pokestap.png'; |
|
| 304 | - $text = $locales->POKESTOPS_MAP_REGULAR; |
|
| 298 | + while ($data = $result->fetch_object()) { |
|
| 299 | + if ($data->lure_expiration >= $data->now) { |
|
| 300 | + $icon = 'pokestap_lured.png'; |
|
| 301 | + $text = sprintf($locales->POKESTOPS_MAP_LURED, date('H:i:s', strtotime($data->lure_expiration_real))); |
|
| 302 | + } else { |
|
| 303 | + $icon = 'pokestap.png'; |
|
| 304 | + $text = $locales->POKESTOPS_MAP_REGULAR; |
|
| 305 | + } |
|
| 306 | + |
|
| 307 | + $pokestops[] = [ |
|
| 308 | + $text, |
|
| 309 | + $icon, |
|
| 310 | + $data->latitude, |
|
| 311 | + $data->longitude |
|
| 312 | + ]; |
|
| 305 | 313 | } |
| 306 | 314 | |
| 307 | - $pokestops[] = [ |
|
| 308 | - $text, |
|
| 309 | - $icon, |
|
| 310 | - $data->latitude, |
|
| 311 | - $data->longitude |
|
| 312 | - ]; |
|
| 313 | - } |
|
| 315 | + header('Content-Type: application/json'); |
|
| 316 | + echo json_encode($pokestops); |
|
| 314 | 317 | |
| 315 | - header('Content-Type: application/json'); |
|
| 316 | - echo json_encode($pokestops); |
|
| 318 | + break; |
|
| 317 | 319 | |
| 318 | - break; |
|
| 319 | 320 | |
| 321 | + #################################### |
|
| 322 | + // |
|
| 323 | + // Update data for the gym battle |
|
| 324 | + // |
|
| 325 | + #################################### |
|
| 320 | 326 | |
| 321 | - #################################### |
|
| 322 | - // |
|
| 323 | - // Update data for the gym battle |
|
| 324 | - // |
|
| 325 | - #################################### |
|
| 326 | - |
|
| 327 | - case 'update_gym': |
|
| 328 | - $teams = new stdClass(); |
|
| 329 | - $teams->mystic = 1; |
|
| 330 | - $teams->valor = 2; |
|
| 331 | - $teams->instinct = 3; |
|
| 327 | + case 'update_gym': |
|
| 328 | + $teams = new stdClass(); |
|
| 329 | + $teams->mystic = 1; |
|
| 330 | + $teams->valor = 2; |
|
| 331 | + $teams->instinct = 3; |
|
| 332 | 332 | |
| 333 | 333 | |
| 334 | - foreach ($teams as $team_name => $team_id) { |
|
| 335 | - $req = "SELECT COUNT(DISTINCT(gym_id)) AS total, ROUND(AVG(gym_points),0) AS average_points FROM gym WHERE team_id = '".$team_id."'"; |
|
| 336 | - $result = $mysqli->query($req); |
|
| 337 | - $data = $result->fetch_object(); |
|
| 334 | + foreach ($teams as $team_name => $team_id) { |
|
| 335 | + $req = "SELECT COUNT(DISTINCT(gym_id)) AS total, ROUND(AVG(gym_points),0) AS average_points FROM gym WHERE team_id = '".$team_id."'"; |
|
| 336 | + $result = $mysqli->query($req); |
|
| 337 | + $data = $result->fetch_object(); |
|
| 338 | 338 | |
| 339 | - $return[] = $data->total; |
|
| 340 | - $return[] = $data->average_points; |
|
| 341 | - } |
|
| 339 | + $return[] = $data->total; |
|
| 340 | + $return[] = $data->average_points; |
|
| 341 | + } |
|
| 342 | 342 | |
| 343 | - header('Content-Type: application/json'); |
|
| 344 | - echo json_encode($return); |
|
| 343 | + header('Content-Type: application/json'); |
|
| 344 | + echo json_encode($return); |
|
| 345 | 345 | |
| 346 | - break; |
|
| 346 | + break; |
|
| 347 | 347 | |
| 348 | 348 | |
| 349 | - #################################### |
|
| 350 | - // |
|
| 351 | - // Get datas for the gym map |
|
| 352 | - // |
|
| 353 | - #################################### |
|
| 349 | + #################################### |
|
| 350 | + // |
|
| 351 | + // Get datas for the gym map |
|
| 352 | + // |
|
| 353 | + #################################### |
|
| 354 | 354 | |
| 355 | 355 | |
| 356 | - case 'gym_map': |
|
| 357 | - $req = "SELECT gym_id, team_id, gym_points, latitude, longitude, (CONVERT_TZ(last_scanned, '+00:00', '".$time_offset."')) AS last_scanned FROM gym"; |
|
| 358 | - $result = $mysqli->query($req); |
|
| 356 | + case 'gym_map': |
|
| 357 | + $req = "SELECT gym_id, team_id, gym_points, latitude, longitude, (CONVERT_TZ(last_scanned, '+00:00', '".$time_offset."')) AS last_scanned FROM gym"; |
|
| 358 | + $result = $mysqli->query($req); |
|
| 359 | 359 | |
| 360 | - $gyms = []; |
|
| 360 | + $gyms = []; |
|
| 361 | 361 | |
| 362 | - while ($data = $result->fetch_object()) { |
|
| 363 | - // Team |
|
| 364 | - // 1 = bleu |
|
| 365 | - // 2 = rouge |
|
| 366 | - // 3 = jaune |
|
| 362 | + while ($data = $result->fetch_object()) { |
|
| 363 | + // Team |
|
| 364 | + // 1 = bleu |
|
| 365 | + // 2 = rouge |
|
| 366 | + // 3 = jaune |
|
| 367 | 367 | |
| 368 | - switch ($data->team_id) { |
|
| 368 | + switch ($data->team_id) { |
|
| 369 | 369 | case 0: |
| 370 | 370 | $icon = 'map_white.png'; |
| 371 | 371 | $team = 'No Team (yet)'; |
@@ -389,7 +389,7 @@ discard block |
||
| 389 | 389 | $team = 'Team Instinct'; |
| 390 | 390 | $color = 'rgba(254, 217, 40, .6)'; |
| 391 | 391 | break; |
| 392 | - } |
|
| 392 | + } |
|
| 393 | 393 | |
| 394 | 394 | // Set gym level |
| 395 | 395 | $gym_level = gym_level($data->gym_points); |
@@ -418,50 +418,50 @@ discard block |
||
| 418 | 418 | // |
| 419 | 419 | #################################### |
| 420 | 420 | |
| 421 | - case 'gym_defenders': |
|
| 422 | - $gym_id = $mysqli->real_escape_string($_GET['gym_id']); |
|
| 423 | - $req = "SELECT gymdetails.name AS name, gymdetails.description AS description, gym.gym_points AS points, gymdetails.url AS url, gym.team_id AS team, |
|
| 421 | + case 'gym_defenders': |
|
| 422 | + $gym_id = $mysqli->real_escape_string($_GET['gym_id']); |
|
| 423 | + $req = "SELECT gymdetails.name AS name, gymdetails.description AS description, gym.gym_points AS points, gymdetails.url AS url, gym.team_id AS team, |
|
| 424 | 424 | (CONVERT_TZ(gym.last_scanned, '+00:00', '".$time_offset."')) AS last_scanned, gym.guard_pokemon_id AS guard_pokemon_id |
| 425 | 425 | FROM gymdetails |
| 426 | 426 | LEFT JOIN gym ON gym.gym_id = gymdetails.gym_id |
| 427 | 427 | WHERE gym.gym_id='".$gym_id."'"; |
| 428 | - $result = $mysqli->query($req); |
|
| 428 | + $result = $mysqli->query($req); |
|
| 429 | 429 | |
| 430 | - $gymData['gymDetails']['gymInfos'] = false; |
|
| 430 | + $gymData['gymDetails']['gymInfos'] = false; |
|
| 431 | 431 | |
| 432 | - while ($data = $result->fetch_object()) { |
|
| 433 | - $gymData['gymDetails']['gymInfos']['name'] = $data->name; |
|
| 434 | - $gymData['gymDetails']['gymInfos']['description'] = $data->description; |
|
| 435 | - if ($data->url == null) { |
|
| 436 | - $gymData['gymDetails']['gymInfos']['url'] = ''; |
|
| 437 | - } else { |
|
| 438 | - $gymData['gymDetails']['gymInfos']['url'] = $data->url; |
|
| 432 | + while ($data = $result->fetch_object()) { |
|
| 433 | + $gymData['gymDetails']['gymInfos']['name'] = $data->name; |
|
| 434 | + $gymData['gymDetails']['gymInfos']['description'] = $data->description; |
|
| 435 | + if ($data->url == null) { |
|
| 436 | + $gymData['gymDetails']['gymInfos']['url'] = ''; |
|
| 437 | + } else { |
|
| 438 | + $gymData['gymDetails']['gymInfos']['url'] = $data->url; |
|
| 439 | + } |
|
| 440 | + $gymData['gymDetails']['gymInfos']['points'] = $data->points; |
|
| 441 | + $gymData['gymDetails']['gymInfos']['level'] = 0; |
|
| 442 | + $gymData['gymDetails']['gymInfos']['last_scanned'] = $data->last_scanned; |
|
| 443 | + $gymData['gymDetails']['gymInfos']['team'] = $data->team; |
|
| 444 | + $gymData['gymDetails']['gymInfos']['guardPokemonId'] = $data->guard_pokemon_id; |
|
| 445 | + $gymData['gymDetails']['gymInfos']['level'] = gym_level($data->points); |
|
| 439 | 446 | } |
| 440 | - $gymData['gymDetails']['gymInfos']['points'] = $data->points; |
|
| 441 | - $gymData['gymDetails']['gymInfos']['level'] = 0; |
|
| 442 | - $gymData['gymDetails']['gymInfos']['last_scanned'] = $data->last_scanned; |
|
| 443 | - $gymData['gymDetails']['gymInfos']['team'] = $data->team; |
|
| 444 | - $gymData['gymDetails']['gymInfos']['guardPokemonId'] = $data->guard_pokemon_id; |
|
| 445 | - $gymData['gymDetails']['gymInfos']['level'] = gym_level($data->points); |
|
| 446 | - } |
|
| 447 | 447 | |
| 448 | - $req = "SELECT DISTINCT gympokemon.pokemon_uid, pokemon_id, iv_attack, iv_defense, iv_stamina, MAX(cp) AS cp, gymmember.gym_id |
|
| 448 | + $req = "SELECT DISTINCT gympokemon.pokemon_uid, pokemon_id, iv_attack, iv_defense, iv_stamina, MAX(cp) AS cp, gymmember.gym_id |
|
| 449 | 449 | FROM gympokemon INNER JOIN gymmember ON gympokemon.pokemon_uid=gymmember.pokemon_uid |
| 450 | 450 | GROUP BY gympokemon.pokemon_uid, pokemon_id, iv_attack, iv_defense, iv_stamina, gym_id |
| 451 | 451 | HAVING gymmember.gym_id='".$gym_id."' |
| 452 | 452 | ORDER BY cp DESC"; |
| 453 | - $result = $mysqli->query($req); |
|
| 453 | + $result = $mysqli->query($req); |
|
| 454 | 454 | |
| 455 | - $i = 0; |
|
| 455 | + $i = 0; |
|
| 456 | 456 | |
| 457 | - $gymData['infoWindow'] = ' |
|
| 457 | + $gymData['infoWindow'] = ' |
|
| 458 | 458 | <div class="gym_defenders"> |
| 459 | 459 | '; |
| 460 | - while ($data = $result->fetch_object()) { |
|
| 461 | - $gymData['gymDetails']['pokemons'][] = $data; |
|
| 462 | - if ($data != false) { |
|
| 463 | - if ($config->system->iv_numbers) { |
|
| 464 | - $gymData['infoWindow'] .= ' |
|
| 460 | + while ($data = $result->fetch_object()) { |
|
| 461 | + $gymData['gymDetails']['pokemons'][] = $data; |
|
| 462 | + if ($data != false) { |
|
| 463 | + if ($config->system->iv_numbers) { |
|
| 464 | + $gymData['infoWindow'] .= ' |
|
| 465 | 465 | <div style="text-align: center; width: 50px; display: inline-block; margin-right: 3px"> |
| 466 | 466 | <a href="pokemon/'.$data->pokemon_id.'"> |
| 467 | 467 | <img src="core/pokemons/'.$data->pokemon_id.$config->system->pokeimg_suffix.'" height="50" style="display:inline-block" > |
@@ -479,8 +479,8 @@ discard block |
||
| 479 | 479 | </div> |
| 480 | 480 | </div> |
| 481 | 481 | </div>'; |
| 482 | - } else { |
|
| 483 | - $gymData['infoWindow'] .= ' |
|
| 482 | + } else { |
|
| 483 | + $gymData['infoWindow'] .= ' |
|
| 484 | 484 | <div style="text-align: center; width: 50px; display: inline-block; margin-right: 3px"> |
| 485 | 485 | <a href="pokemon/'.$data->pokemon_id.'"> |
| 486 | 486 | <img src="core/pokemons/'.$data->pokemon_id.$config->system->pokeimg_suffix.'" height="50" style="display:inline-block" > |
@@ -498,76 +498,76 @@ discard block |
||
| 498 | 498 | </div> |
| 499 | 499 | </div> |
| 500 | 500 | </div>' |
| 501 | - ; } |
|
| 502 | - } else { |
|
| 503 | - $gymData['infoWindow'] .= ' |
|
| 501 | + ; } |
|
| 502 | + } else { |
|
| 503 | + $gymData['infoWindow'] .= ' |
|
| 504 | 504 | <div style="text-align: center; width: 50px; display: inline-block; margin-right: 3px"> |
| 505 | 505 | <a href="pokemon/'.$gymData['gymDetails']['gymInfos']['guardPokemonId'].'"> |
| 506 | 506 | <img src="core/pokemons/'.$gymData['gymDetails']['gymInfos']['guardPokemonId'].$config->system->pokeimg_suffix.'" height="50" style="display:inline-block" > |
| 507 | 507 | </a> |
| 508 | 508 | <p class="pkmn-name">???</p> |
| 509 | 509 | </div>' |
| 510 | - ; |
|
| 510 | + ; |
|
| 511 | + } |
|
| 512 | + $i++; |
|
| 511 | 513 | } |
| 512 | - $i++; |
|
| 513 | - } |
|
| 514 | 514 | |
| 515 | - // check whether we could retrieve gym infos, otherwise use basic gym info |
|
| 516 | - if (!$gymData['gymDetails']['gymInfos']) { |
|
| 517 | - $req = "SELECT gym_id, team_id, gym_points, guard_pokemon_id, latitude, longitude, (CONVERT_TZ(last_scanned, '+00:00', '".$time_offset."')) AS last_scanned |
|
| 515 | + // check whether we could retrieve gym infos, otherwise use basic gym info |
|
| 516 | + if (!$gymData['gymDetails']['gymInfos']) { |
|
| 517 | + $req = "SELECT gym_id, team_id, gym_points, guard_pokemon_id, latitude, longitude, (CONVERT_TZ(last_scanned, '+00:00', '".$time_offset."')) AS last_scanned |
|
| 518 | 518 | FROM gym WHERE gym_id='".$gym_id."'"; |
| 519 | - $result = $mysqli->query($req); |
|
| 520 | - $data = $result->fetch_object(); |
|
| 521 | - |
|
| 522 | - $gymData['gymDetails']['gymInfos']['name'] = $locales->NOT_AVAILABLE; |
|
| 523 | - $gymData['gymDetails']['gymInfos']['description'] = $locales->NOT_AVAILABLE; |
|
| 524 | - $gymData['gymDetails']['gymInfos']['url'] = 'https://upload.wikimedia.org/wikipedia/commons/thumb/8/86/Solid_grey.svg/200px-Solid_grey.svg.png'; |
|
| 525 | - $gymData['gymDetails']['gymInfos']['points'] = $data->gym_points; |
|
| 526 | - $gymData['gymDetails']['gymInfos']['level'] = 0; |
|
| 527 | - $gymData['gymDetails']['gymInfos']['last_scanned'] = $data->last_scanned; |
|
| 528 | - $gymData['gymDetails']['gymInfos']['team'] = $data->team_id; |
|
| 529 | - $gymData['gymDetails']['gymInfos']['guardPokemonId'] = $data->guard_pokemon_id; |
|
| 530 | - $gymData['gymDetails']['gymInfos']['level'] = gym_level($data->gym_points); |
|
| 531 | - |
|
| 532 | - $gymData['infoWindow'] .= ' |
|
| 519 | + $result = $mysqli->query($req); |
|
| 520 | + $data = $result->fetch_object(); |
|
| 521 | + |
|
| 522 | + $gymData['gymDetails']['gymInfos']['name'] = $locales->NOT_AVAILABLE; |
|
| 523 | + $gymData['gymDetails']['gymInfos']['description'] = $locales->NOT_AVAILABLE; |
|
| 524 | + $gymData['gymDetails']['gymInfos']['url'] = 'https://upload.wikimedia.org/wikipedia/commons/thumb/8/86/Solid_grey.svg/200px-Solid_grey.svg.png'; |
|
| 525 | + $gymData['gymDetails']['gymInfos']['points'] = $data->gym_points; |
|
| 526 | + $gymData['gymDetails']['gymInfos']['level'] = 0; |
|
| 527 | + $gymData['gymDetails']['gymInfos']['last_scanned'] = $data->last_scanned; |
|
| 528 | + $gymData['gymDetails']['gymInfos']['team'] = $data->team_id; |
|
| 529 | + $gymData['gymDetails']['gymInfos']['guardPokemonId'] = $data->guard_pokemon_id; |
|
| 530 | + $gymData['gymDetails']['gymInfos']['level'] = gym_level($data->gym_points); |
|
| 531 | + |
|
| 532 | + $gymData['infoWindow'] .= ' |
|
| 533 | 533 | <div style="text-align: center; width: 50px; display: inline-block; margin-right: 3px"> |
| 534 | 534 | <a href="pokemon/'.$data->guard_pokemon_id.'"> |
| 535 | 535 | <img src="core/pokemons/'.$data->guard_pokemon_id.$config->system->pokeimg_suffix.'" height="50" style="display:inline-block" > |
| 536 | 536 | </a> |
| 537 | 537 | <p class="pkmn-name">???</p> |
| 538 | 538 | </div>'; |
| 539 | - } |
|
| 540 | - $gymData['infoWindow'] = $gymData['infoWindow'].'</div>'; |
|
| 539 | + } |
|
| 540 | + $gymData['infoWindow'] = $gymData['infoWindow'].'</div>'; |
|
| 541 | 541 | |
| 542 | - header('Content-Type: application/json'); |
|
| 543 | - echo json_encode($gymData); |
|
| 542 | + header('Content-Type: application/json'); |
|
| 543 | + echo json_encode($gymData); |
|
| 544 | 544 | |
| 545 | - break; |
|
| 545 | + break; |
|
| 546 | 546 | |
| 547 | 547 | |
| 548 | - case 'trainer': |
|
| 549 | - $name = ""; |
|
| 550 | - $page = "0"; |
|
| 551 | - $where = ""; |
|
| 552 | - $order=""; |
|
| 553 | - $team=0; |
|
| 554 | - $ranking=0; |
|
| 555 | - if (isset($_GET['name'])) { |
|
| 556 | - $trainer_name = mysqli_real_escape_string($mysqli, $_GET['name']); |
|
| 557 | - $where = " HAVING name LIKE '%".$trainer_name."%'"; |
|
| 558 | - } |
|
| 559 | - if (isset($_GET['team']) && $_GET['team']!=0) { |
|
| 560 | - $team = mysqli_real_escape_string($mysqli, $_GET['team']); |
|
| 561 | - $where .= ($where==""?" HAVING":"AND ")." team = ".$team; |
|
| 562 | - } |
|
| 563 | - if (isset($_GET['page'])) { |
|
| 564 | - $page = mysqli_real_escape_string($mysqli, $_GET['page']); |
|
| 565 | - } |
|
| 566 | - if (isset($_GET['ranking'])) { |
|
| 567 | - $ranking = mysqli_real_escape_string($mysqli, $_GET['ranking']); |
|
| 568 | - } |
|
| 548 | + case 'trainer': |
|
| 549 | + $name = ""; |
|
| 550 | + $page = "0"; |
|
| 551 | + $where = ""; |
|
| 552 | + $order=""; |
|
| 553 | + $team=0; |
|
| 554 | + $ranking=0; |
|
| 555 | + if (isset($_GET['name'])) { |
|
| 556 | + $trainer_name = mysqli_real_escape_string($mysqli, $_GET['name']); |
|
| 557 | + $where = " HAVING name LIKE '%".$trainer_name."%'"; |
|
| 558 | + } |
|
| 559 | + if (isset($_GET['team']) && $_GET['team']!=0) { |
|
| 560 | + $team = mysqli_real_escape_string($mysqli, $_GET['team']); |
|
| 561 | + $where .= ($where==""?" HAVING":"AND ")." team = ".$team; |
|
| 562 | + } |
|
| 563 | + if (isset($_GET['page'])) { |
|
| 564 | + $page = mysqli_real_escape_string($mysqli, $_GET['page']); |
|
| 565 | + } |
|
| 566 | + if (isset($_GET['ranking'])) { |
|
| 567 | + $ranking = mysqli_real_escape_string($mysqli, $_GET['ranking']); |
|
| 568 | + } |
|
| 569 | 569 | |
| 570 | - switch ($ranking) { |
|
| 570 | + switch ($ranking) { |
|
| 571 | 571 | case 1: |
| 572 | 572 | $order=" ORDER BY active DESC "; |
| 573 | 573 | break; |
@@ -576,7 +576,7 @@ discard block |
||
| 576 | 576 | break; |
| 577 | 577 | default: |
| 578 | 578 | $order=" ORDER BY level DESC, active DESC "; |
| 579 | - } |
|
| 579 | + } |
|
| 580 | 580 | |
| 581 | 581 | $limit = " LIMIT ".($page*10).",10 "; |
| 582 | 582 | |
@@ -648,85 +648,85 @@ discard block |
||
| 648 | 648 | break; |
| 649 | 649 | |
| 650 | 650 | |
| 651 | - case 'pokemon_slider_init': |
|
| 652 | - $req = "SELECT MIN(disappear_time) AS min, MAX(disappear_time) AS max FROM pokemon"; |
|
| 653 | - $result = $mysqli->query($req); |
|
| 654 | - $bounds = $result->fetch_object(); |
|
| 651 | + case 'pokemon_slider_init': |
|
| 652 | + $req = "SELECT MIN(disappear_time) AS min, MAX(disappear_time) AS max FROM pokemon"; |
|
| 653 | + $result = $mysqli->query($req); |
|
| 654 | + $bounds = $result->fetch_object(); |
|
| 655 | + |
|
| 656 | + header('Content-Type: application/json'); |
|
| 657 | + echo json_encode($bounds); |
|
| 655 | 658 | |
| 656 | - header('Content-Type: application/json'); |
|
| 657 | - echo json_encode($bounds); |
|
| 659 | + break; |
|
| 658 | 660 | |
| 659 | - break; |
|
| 660 | 661 | |
| 662 | + case 'pokemon_heatmap_points': |
|
| 663 | + $json=""; |
|
| 664 | + if (isset($_GET['start'])&&isset($_GET['end']) && isset($_GET['pokemon_id'])) { |
|
| 665 | + $start = Date("Y-m-d H:i",(int)$_GET['start']); |
|
| 666 | + $end = Date("Y-m-d H:i",(int)$_GET['end']); |
|
| 667 | + $pokemon_id = mysqli_real_escape_string($mysqli, $_GET['pokemon_id']); |
|
| 668 | + $where = " WHERE pokemon_id = ".$pokemon_id." " |
|
| 669 | + . "AND disappear_time BETWEEN '".$start."' AND '".$end."'"; |
|
| 670 | + $req = "SELECT latitude, longitude FROM pokemon".$where." ORDER BY disappear_time DESC LIMIT 10000"; |
|
| 671 | + $result = $mysqli->query($req); |
|
| 672 | + $points = array(); |
|
| 673 | + while ($result && $data = $result->fetch_object()) { |
|
| 674 | + $points[] = $data; |
|
| 675 | + } |
|
| 661 | 676 | |
| 662 | - case 'pokemon_heatmap_points': |
|
| 663 | - $json=""; |
|
| 664 | - if (isset($_GET['start'])&&isset($_GET['end']) && isset($_GET['pokemon_id'])) { |
|
| 665 | - $start = Date("Y-m-d H:i",(int)$_GET['start']); |
|
| 666 | - $end = Date("Y-m-d H:i",(int)$_GET['end']); |
|
| 667 | - $pokemon_id = mysqli_real_escape_string($mysqli, $_GET['pokemon_id']); |
|
| 668 | - $where = " WHERE pokemon_id = ".$pokemon_id." " |
|
| 669 | - . "AND disappear_time BETWEEN '".$start."' AND '".$end."'"; |
|
| 670 | - $req = "SELECT latitude, longitude FROM pokemon".$where." ORDER BY disappear_time DESC LIMIT 10000"; |
|
| 671 | - $result = $mysqli->query($req); |
|
| 672 | - $points = array(); |
|
| 673 | - while ($result && $data = $result->fetch_object()) { |
|
| 674 | - $points[] = $data; |
|
| 677 | + $json = json_encode($points); |
|
| 675 | 678 | } |
| 676 | 679 | |
| 677 | - $json = json_encode($points); |
|
| 678 | - } |
|
| 679 | - |
|
| 680 | - header('Content-Type: application/json'); |
|
| 681 | - echo $json; |
|
| 682 | - break; |
|
| 680 | + header('Content-Type: application/json'); |
|
| 681 | + echo $json; |
|
| 682 | + break; |
|
| 683 | 683 | |
| 684 | 684 | |
| 685 | - case 'maps_localization_coordinates': |
|
| 686 | - $json=""; |
|
| 687 | - $req = "SELECT MAX(latitude) AS max_latitude, MIN(latitude) AS min_latitude, MAX(longitude) AS max_longitude, MIN(longitude) as min_longitude FROM spawnpoint"; |
|
| 688 | - $result = $mysqli->query($req); |
|
| 689 | - $coordinates = $result->fetch_object(); |
|
| 685 | + case 'maps_localization_coordinates': |
|
| 686 | + $json=""; |
|
| 687 | + $req = "SELECT MAX(latitude) AS max_latitude, MIN(latitude) AS min_latitude, MAX(longitude) AS max_longitude, MIN(longitude) as min_longitude FROM spawnpoint"; |
|
| 688 | + $result = $mysqli->query($req); |
|
| 689 | + $coordinates = $result->fetch_object(); |
|
| 690 | 690 | |
| 691 | - header('Content-Type: application/json'); |
|
| 692 | - echo json_encode($coordinates); |
|
| 691 | + header('Content-Type: application/json'); |
|
| 692 | + echo json_encode($coordinates); |
|
| 693 | 693 | |
| 694 | - break; |
|
| 694 | + break; |
|
| 695 | 695 | |
| 696 | 696 | |
| 697 | - case 'pokemon_graph_data': |
|
| 698 | - $json=""; |
|
| 699 | - if (isset($_GET['pokemon_id'])) { |
|
| 700 | - $pokemon_id = mysqli_real_escape_string($mysqli, $_GET['pokemon_id']); |
|
| 701 | - $req = "SELECT COUNT(*) AS total, |
|
| 697 | + case 'pokemon_graph_data': |
|
| 698 | + $json=""; |
|
| 699 | + if (isset($_GET['pokemon_id'])) { |
|
| 700 | + $pokemon_id = mysqli_real_escape_string($mysqli, $_GET['pokemon_id']); |
|
| 701 | + $req = "SELECT COUNT(*) AS total, |
|
| 702 | 702 | HOUR(CONVERT_TZ(disappear_time, '+00:00', '".$time_offset."')) AS disappear_hour |
| 703 | 703 | FROM (SELECT disappear_time FROM pokemon WHERE pokemon_id = '".$pokemon_id."' ORDER BY disappear_time LIMIT 10000) AS pokemonFiltered |
| 704 | 704 | GROUP BY disappear_hour |
| 705 | 705 | ORDER BY disappear_hour"; |
| 706 | - $result = $mysqli->query($req); |
|
| 707 | - $array = array_fill(0, 24, 0); |
|
| 708 | - while ($result && $data = $result->fetch_object()) { |
|
| 709 | - $array[$data->disappear_hour] = $data->total; |
|
| 706 | + $result = $mysqli->query($req); |
|
| 707 | + $array = array_fill(0, 24, 0); |
|
| 708 | + while ($result && $data = $result->fetch_object()) { |
|
| 709 | + $array[$data->disappear_hour] = $data->total; |
|
| 710 | + } |
|
| 711 | + // shift array because AM/PM starts at 1AM not 0:00 |
|
| 712 | + $array[] = $array[0]; |
|
| 713 | + array_shift($array); |
|
| 714 | + |
|
| 715 | + $json = json_encode($array); |
|
| 710 | 716 | } |
| 711 | - // shift array because AM/PM starts at 1AM not 0:00 |
|
| 712 | - $array[] = $array[0]; |
|
| 713 | - array_shift($array); |
|
| 714 | 717 | |
| 715 | - $json = json_encode($array); |
|
| 716 | - } |
|
| 718 | + header('Content-Type: application/json'); |
|
| 719 | + echo $json; |
|
| 720 | + break; |
|
| 717 | 721 | |
| 718 | - header('Content-Type: application/json'); |
|
| 719 | - echo $json; |
|
| 720 | - break; |
|
| 721 | 722 | |
| 723 | + case 'postRequest': |
|
| 724 | + break; |
|
| 722 | 725 | |
| 723 | - case 'postRequest': |
|
| 726 | + default: |
|
| 727 | + echo "What do you mean?"; |
|
| 728 | + exit(); |
|
| 724 | 729 | break; |
| 725 | - |
|
| 726 | - default: |
|
| 727 | - echo "What do you mean?"; |
|
| 728 | - exit(); |
|
| 729 | - break; |
|
| 730 | 730 | } |
| 731 | 731 | |
| 732 | 732 | if ($postRequest!="") { |
@@ -17,8 +17,8 @@ discard block |
||
| 17 | 17 | // Include & load the variables |
| 18 | 18 | // ############################ |
| 19 | 19 | |
| 20 | -$variables = SYS_PATH.'/core/json/variables.json'; |
|
| 21 | -$config = json_decode(file_get_contents($variables)); |
|
| 20 | +$variables = SYS_PATH.'/core/json/variables.json'; |
|
| 21 | +$config = json_decode(file_get_contents($variables)); |
|
| 22 | 22 | |
| 23 | 23 | // Manage Time Interval |
| 24 | 24 | // ##################### |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | include_once(SYS_PATH.'/functions.php'); |
| 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 | } |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | $postRequest = ""; |
| 50 | 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; |
@@ -207,13 +207,13 @@ discard block |
||
| 207 | 207 | $html .= ' |
| 208 | 208 | <div class="progress" style="height: 15px; margin-bottom: 0"> |
| 209 | 209 | <div title="'.$locales->IV_ATTACK.': '.$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"> |
| 210 | - <span class="sr-only">'.$locales->IV_ATTACK.': '.$iv->attack.'</span>'.$iv->attack .' |
|
| 210 | + <span class="sr-only">'.$locales->IV_ATTACK.': '.$iv->attack.'</span>'.$iv->attack.' |
|
| 211 | 211 | </div> |
| 212 | 212 | <div title="'.$locales->IV_DEFENSE.': '.$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"> |
| 213 | - <span class="sr-only">'.$locales->IV_DEFENSE.': '.$iv->defense.'</span>'.$iv->defense .' |
|
| 213 | + <span class="sr-only">'.$locales->IV_DEFENSE.': '.$iv->defense.'</span>'.$iv->defense.' |
|
| 214 | 214 | </div> |
| 215 | 215 | <div title="'.$locales->IV_STAMINA.': '.$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"> |
| 216 | - <span class="sr-only">'.$locales->IV_STAMINA.': '.$iv->stamina.'</span>'.$iv->stamina .' |
|
| 216 | + <span class="sr-only">'.$locales->IV_STAMINA.': '.$iv->stamina.'</span>'.$iv->stamina.' |
|
| 217 | 217 | </div> |
| 218 | 218 | </div>'; |
| 219 | 219 | } else { |
@@ -222,10 +222,10 @@ discard block |
||
| 222 | 222 | <div title="'.$locales->IV_ATTACK.': '.$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).'%"> |
| 223 | 223 | <span class="sr-only">'.$locales->IV_ATTACK.': '.$iv->attack.'</span> |
| 224 | 224 | </div> |
| 225 | - <div title="'.$locales->IV_DEFENSE.': '.$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).'%"> |
|
| 225 | + <div title="'.$locales->IV_DEFENSE.': '.$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).'%"> |
|
| 226 | 226 | <span class="sr-only">'.$locales->IV_DEFENSE.': '.$iv->defense.'</span> |
| 227 | 227 | </div> |
| 228 | - <div title="'.$locales->IV_STAMINA.': '.$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).'%"> |
|
| 228 | + <div title="'.$locales->IV_STAMINA.': '.$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).'%"> |
|
| 229 | 229 | <span class="sr-only">'.$locales->IV_STAMINA.': '.$iv->stamina.'</span> |
| 230 | 230 | </div> |
| 231 | 231 | </div>'; |
@@ -325,19 +325,19 @@ discard block |
||
| 325 | 325 | #################################### |
| 326 | 326 | |
| 327 | 327 | case 'update_gym': |
| 328 | - $teams = new stdClass(); |
|
| 329 | - $teams->mystic = 1; |
|
| 330 | - $teams->valor = 2; |
|
| 331 | - $teams->instinct = 3; |
|
| 328 | + $teams = new stdClass(); |
|
| 329 | + $teams->mystic = 1; |
|
| 330 | + $teams->valor = 2; |
|
| 331 | + $teams->instinct = 3; |
|
| 332 | 332 | |
| 333 | 333 | |
| 334 | 334 | foreach ($teams as $team_name => $team_id) { |
| 335 | - $req = "SELECT COUNT(DISTINCT(gym_id)) AS total, ROUND(AVG(gym_points),0) AS average_points FROM gym WHERE team_id = '".$team_id."'"; |
|
| 336 | - $result = $mysqli->query($req); |
|
| 337 | - $data = $result->fetch_object(); |
|
| 335 | + $req = "SELECT COUNT(DISTINCT(gym_id)) AS total, ROUND(AVG(gym_points),0) AS average_points FROM gym WHERE team_id = '".$team_id."'"; |
|
| 336 | + $result = $mysqli->query($req); |
|
| 337 | + $data = $result->fetch_object(); |
|
| 338 | 338 | |
| 339 | - $return[] = $data->total; |
|
| 340 | - $return[] = $data->average_points; |
|
| 339 | + $return[] = $data->total; |
|
| 340 | + $return[] = $data->average_points; |
|
| 341 | 341 | } |
| 342 | 342 | |
| 343 | 343 | header('Content-Type: application/json'); |
@@ -354,7 +354,7 @@ discard block |
||
| 354 | 354 | |
| 355 | 355 | |
| 356 | 356 | case 'gym_map': |
| 357 | - $req = "SELECT gym_id, team_id, gym_points, latitude, longitude, (CONVERT_TZ(last_scanned, '+00:00', '".$time_offset."')) AS last_scanned FROM gym"; |
|
| 357 | + $req = "SELECT gym_id, team_id, gym_points, latitude, longitude, (CONVERT_TZ(last_scanned, '+00:00', '".$time_offset."')) AS last_scanned FROM gym"; |
|
| 358 | 358 | $result = $mysqli->query($req); |
| 359 | 359 | |
| 360 | 360 | $gyms = []; |
@@ -369,25 +369,25 @@ discard block |
||
| 369 | 369 | case 0: |
| 370 | 370 | $icon = 'map_white.png'; |
| 371 | 371 | $team = 'No Team (yet)'; |
| 372 | - $color = 'rgba(0, 0, 0, .6)'; |
|
| 372 | + $color = 'rgba(0, 0, 0, .6)'; |
|
| 373 | 373 | break; |
| 374 | 374 | |
| 375 | 375 | case 1: |
| 376 | 376 | $icon = 'map_blue_'; |
| 377 | 377 | $team = 'Team Mystic'; |
| 378 | - $color = 'rgba(74, 138, 202, .6)'; |
|
| 378 | + $color = 'rgba(74, 138, 202, .6)'; |
|
| 379 | 379 | break; |
| 380 | 380 | |
| 381 | 381 | case 2: |
| 382 | 382 | $icon = 'map_red_'; |
| 383 | 383 | $team = 'Team Valor'; |
| 384 | - $color = 'rgba(240, 68, 58, .6)'; |
|
| 384 | + $color = 'rgba(240, 68, 58, .6)'; |
|
| 385 | 385 | break; |
| 386 | 386 | |
| 387 | 387 | case 3: |
| 388 | 388 | $icon = 'map_yellow_'; |
| 389 | 389 | $team = 'Team Instinct'; |
| 390 | - $color = 'rgba(254, 217, 40, .6)'; |
|
| 390 | + $color = 'rgba(254, 217, 40, .6)'; |
|
| 391 | 391 | break; |
| 392 | 392 | } |
| 393 | 393 | |
@@ -420,7 +420,7 @@ discard block |
||
| 420 | 420 | |
| 421 | 421 | case 'gym_defenders': |
| 422 | 422 | $gym_id = $mysqli->real_escape_string($_GET['gym_id']); |
| 423 | - $req = "SELECT gymdetails.name AS name, gymdetails.description AS description, gym.gym_points AS points, gymdetails.url AS url, gym.team_id AS team, |
|
| 423 | + $req = "SELECT gymdetails.name AS name, gymdetails.description AS description, gym.gym_points AS points, gymdetails.url AS url, gym.team_id AS team, |
|
| 424 | 424 | (CONVERT_TZ(gym.last_scanned, '+00:00', '".$time_offset."')) AS last_scanned, gym.guard_pokemon_id AS guard_pokemon_id |
| 425 | 425 | FROM gymdetails |
| 426 | 426 | LEFT JOIN gym ON gym.gym_id = gymdetails.gym_id |
@@ -445,7 +445,7 @@ discard block |
||
| 445 | 445 | $gymData['gymDetails']['gymInfos']['level'] = gym_level($data->points); |
| 446 | 446 | } |
| 447 | 447 | |
| 448 | - $req = "SELECT DISTINCT gympokemon.pokemon_uid, pokemon_id, iv_attack, iv_defense, iv_stamina, MAX(cp) AS cp, gymmember.gym_id |
|
| 448 | + $req = "SELECT DISTINCT gympokemon.pokemon_uid, pokemon_id, iv_attack, iv_defense, iv_stamina, MAX(cp) AS cp, gymmember.gym_id |
|
| 449 | 449 | FROM gympokemon INNER JOIN gymmember ON gympokemon.pokemon_uid=gymmember.pokemon_uid |
| 450 | 450 | GROUP BY gympokemon.pokemon_uid, pokemon_id, iv_attack, iv_defense, iv_stamina, gym_id |
| 451 | 451 | HAVING gymmember.gym_id='".$gym_id."' |
@@ -472,10 +472,10 @@ discard block |
||
| 472 | 472 | <span class="sr-only">'.$locales->IV_ATTACK.' : '.$data->iv_attack.'</span>'.$data->iv_attack.' |
| 473 | 473 | </div> |
| 474 | 474 | <div title="'.$locales->IV_DEFENSE.': '.$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"> |
| 475 | - <span class="sr-only">'.$locales->IV_DEFENSE.' : '.$data->iv_defense.'</span>'. $data->iv_defense .' |
|
| 475 | + <span class="sr-only">'.$locales->IV_DEFENSE.' : '.$data->iv_defense.'</span>'.$data->iv_defense.' |
|
| 476 | 476 | </div> |
| 477 | 477 | <div title="'.$locales->IV_STAMINA.': '.$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"> |
| 478 | - <span class="sr-only">'.$locales->IV_STAMINA.' : '.$data->iv_stamina.'</span>'. $data->iv_stamina .' |
|
| 478 | + <span class="sr-only">'.$locales->IV_STAMINA.' : '.$data->iv_stamina.'</span>'.$data->iv_stamina.' |
|
| 479 | 479 | </div> |
| 480 | 480 | </div> |
| 481 | 481 | </div>'; |
@@ -549,16 +549,16 @@ discard block |
||
| 549 | 549 | $name = ""; |
| 550 | 550 | $page = "0"; |
| 551 | 551 | $where = ""; |
| 552 | - $order=""; |
|
| 553 | - $team=0; |
|
| 554 | - $ranking=0; |
|
| 552 | + $order = ""; |
|
| 553 | + $team = 0; |
|
| 554 | + $ranking = 0; |
|
| 555 | 555 | if (isset($_GET['name'])) { |
| 556 | 556 | $trainer_name = mysqli_real_escape_string($mysqli, $_GET['name']); |
| 557 | 557 | $where = " HAVING name LIKE '%".$trainer_name."%'"; |
| 558 | 558 | } |
| 559 | - if (isset($_GET['team']) && $_GET['team']!=0) { |
|
| 559 | + if (isset($_GET['team']) && $_GET['team'] != 0) { |
|
| 560 | 560 | $team = mysqli_real_escape_string($mysqli, $_GET['team']); |
| 561 | - $where .= ($where==""?" HAVING":"AND ")." team = ".$team; |
|
| 561 | + $where .= ($where == "" ? " HAVING" : "AND ")." team = ".$team; |
|
| 562 | 562 | } |
| 563 | 563 | if (isset($_GET['page'])) { |
| 564 | 564 | $page = mysqli_real_escape_string($mysqli, $_GET['page']); |
@@ -569,16 +569,16 @@ discard block |
||
| 569 | 569 | |
| 570 | 570 | switch ($ranking) { |
| 571 | 571 | case 1: |
| 572 | - $order=" ORDER BY active DESC "; |
|
| 572 | + $order = " ORDER BY active DESC "; |
|
| 573 | 573 | break; |
| 574 | 574 | case 2: |
| 575 | - $order=" ORDER BY maxCp DESC "; |
|
| 575 | + $order = " ORDER BY maxCp DESC "; |
|
| 576 | 576 | break; |
| 577 | 577 | default: |
| 578 | - $order=" ORDER BY level DESC, active DESC "; |
|
| 578 | + $order = " ORDER BY level DESC, active DESC "; |
|
| 579 | 579 | } |
| 580 | 580 | |
| 581 | - $limit = " LIMIT ".($page*10).",10 "; |
|
| 581 | + $limit = " LIMIT ".($page * 10).",10 "; |
|
| 582 | 582 | |
| 583 | 583 | |
| 584 | 584 | $req = "SELECT trainer.*, COUNT(actives_pokemons.trainer_name) AS active, max(actives_pokemons.cp) AS maxCp |
@@ -599,7 +599,7 @@ discard block |
||
| 599 | 599 | $reqRanking = "SELECT COUNT(1) AS rank FROM trainer WHERE trainer.level >= ".$trainer->level; |
| 600 | 600 | $resultRanking = $mysqli->query($reqRanking); |
| 601 | 601 | while ($data = $resultRanking->fetch_object()) { |
| 602 | - $trainer->rank = $data->rank ; |
|
| 602 | + $trainer->rank = $data->rank; |
|
| 603 | 603 | } |
| 604 | 604 | $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 |
| 605 | 605 | FROM gympokemon INNER JOIN |
@@ -610,7 +610,7 @@ discard block |
||
| 610 | 610 | |
| 611 | 611 | $resultPkms = $mysqli->query($req); |
| 612 | 612 | $trainer->pokemons = array(); |
| 613 | - $active_gyms=0; |
|
| 613 | + $active_gyms = 0; |
|
| 614 | 614 | $pkmCount = 0; |
| 615 | 615 | while ($resultPkms && $dataPkm = $resultPkms->fetch_object()) { |
| 616 | 616 | $active_gyms++; |
@@ -649,7 +649,7 @@ discard block |
||
| 649 | 649 | |
| 650 | 650 | |
| 651 | 651 | case 'pokemon_slider_init': |
| 652 | - $req = "SELECT MIN(disappear_time) AS min, MAX(disappear_time) AS max FROM pokemon"; |
|
| 652 | + $req = "SELECT MIN(disappear_time) AS min, MAX(disappear_time) AS max FROM pokemon"; |
|
| 653 | 653 | $result = $mysqli->query($req); |
| 654 | 654 | $bounds = $result->fetch_object(); |
| 655 | 655 | |
@@ -660,18 +660,18 @@ discard block |
||
| 660 | 660 | |
| 661 | 661 | |
| 662 | 662 | case 'pokemon_heatmap_points': |
| 663 | - $json=""; |
|
| 664 | - if (isset($_GET['start'])&&isset($_GET['end']) && isset($_GET['pokemon_id'])) { |
|
| 665 | - $start = Date("Y-m-d H:i",(int)$_GET['start']); |
|
| 666 | - $end = Date("Y-m-d H:i",(int)$_GET['end']); |
|
| 663 | + $json = ""; |
|
| 664 | + if (isset($_GET['start']) && isset($_GET['end']) && isset($_GET['pokemon_id'])) { |
|
| 665 | + $start = Date("Y-m-d H:i", (int) $_GET['start']); |
|
| 666 | + $end = Date("Y-m-d H:i", (int) $_GET['end']); |
|
| 667 | 667 | $pokemon_id = mysqli_real_escape_string($mysqli, $_GET['pokemon_id']); |
| 668 | 668 | $where = " WHERE pokemon_id = ".$pokemon_id." " |
| 669 | 669 | . "AND disappear_time BETWEEN '".$start."' AND '".$end."'"; |
| 670 | 670 | $req = "SELECT latitude, longitude FROM pokemon".$where." ORDER BY disappear_time DESC LIMIT 10000"; |
| 671 | - $result = $mysqli->query($req); |
|
| 671 | + $result = $mysqli->query($req); |
|
| 672 | 672 | $points = array(); |
| 673 | 673 | while ($result && $data = $result->fetch_object()) { |
| 674 | - $points[] = $data; |
|
| 674 | + $points[] = $data; |
|
| 675 | 675 | } |
| 676 | 676 | |
| 677 | 677 | $json = json_encode($points); |
@@ -683,9 +683,9 @@ discard block |
||
| 683 | 683 | |
| 684 | 684 | |
| 685 | 685 | case 'maps_localization_coordinates': |
| 686 | - $json=""; |
|
| 687 | - $req = "SELECT MAX(latitude) AS max_latitude, MIN(latitude) AS min_latitude, MAX(longitude) AS max_longitude, MIN(longitude) as min_longitude FROM spawnpoint"; |
|
| 688 | - $result = $mysqli->query($req); |
|
| 686 | + $json = ""; |
|
| 687 | + $req = "SELECT MAX(latitude) AS max_latitude, MIN(latitude) AS min_latitude, MAX(longitude) AS max_longitude, MIN(longitude) as min_longitude FROM spawnpoint"; |
|
| 688 | + $result = $mysqli->query($req); |
|
| 689 | 689 | $coordinates = $result->fetch_object(); |
| 690 | 690 | |
| 691 | 691 | header('Content-Type: application/json'); |
@@ -695,7 +695,7 @@ discard block |
||
| 695 | 695 | |
| 696 | 696 | |
| 697 | 697 | case 'pokemon_graph_data': |
| 698 | - $json=""; |
|
| 698 | + $json = ""; |
|
| 699 | 699 | if (isset($_GET['pokemon_id'])) { |
| 700 | 700 | $pokemon_id = mysqli_real_escape_string($mysqli, $_GET['pokemon_id']); |
| 701 | 701 | $req = "SELECT COUNT(*) AS total, |
@@ -703,7 +703,7 @@ discard block |
||
| 703 | 703 | FROM (SELECT disappear_time FROM pokemon WHERE pokemon_id = '".$pokemon_id."' ORDER BY disappear_time LIMIT 10000) AS pokemonFiltered |
| 704 | 704 | GROUP BY disappear_hour |
| 705 | 705 | ORDER BY disappear_hour"; |
| 706 | - $result = $mysqli->query($req); |
|
| 706 | + $result = $mysqli->query($req); |
|
| 707 | 707 | $array = array_fill(0, 24, 0); |
| 708 | 708 | while ($result && $data = $result->fetch_object()) { |
| 709 | 709 | $array[$data->disappear_hour] = $data->total; |
@@ -729,30 +729,30 @@ discard block |
||
| 729 | 729 | break; |
| 730 | 730 | } |
| 731 | 731 | |
| 732 | -if ($postRequest!="") { |
|
| 732 | +if ($postRequest != "") { |
|
| 733 | 733 | switch ($postRequest) { |
| 734 | 734 | case 'pokemon_live': |
| 735 | - $json=""; |
|
| 736 | - if (isset( $_POST['pokemon_id'])) { |
|
| 735 | + $json = ""; |
|
| 736 | + if (isset($_POST['pokemon_id'])) { |
|
| 737 | 737 | $pokemon_id = mysqli_real_escape_string($mysqli, $_POST['pokemon_id']); |
| 738 | - $inmap_pkms_filter=""; |
|
| 738 | + $inmap_pkms_filter = ""; |
|
| 739 | 739 | $where = " WHERE disappear_time >= UTC_TIMESTAMP() AND pokemon_id = ".$pokemon_id; |
| 740 | 740 | |
| 741 | 741 | $reqTestIv = "SELECT MAX(individual_attack) AS iv FROM pokemon ".$where; |
| 742 | - $resultTestIv = $mysqli->query($reqTestIv); |
|
| 742 | + $resultTestIv = $mysqli->query($reqTestIv); |
|
| 743 | 743 | $testIv = $resultTestIv->fetch_object(); |
| 744 | - if (isset( $_POST['inmap_pokemons'])&&( $_POST['inmap_pokemons']!="")) { |
|
| 744 | + if (isset($_POST['inmap_pokemons']) && ($_POST['inmap_pokemons'] != "")) { |
|
| 745 | 745 | foreach ($_POST['inmap_pokemons'] as $inmap) { |
| 746 | 746 | $inmap_pkms_filter .= "'".$inmap."',"; |
| 747 | 747 | } |
| 748 | 748 | $inmap_pkms_filter = rtrim($inmap_pkms_filter, ","); |
| 749 | 749 | $where .= " AND encounter_id NOT IN (".$inmap_pkms_filter.") "; |
| 750 | 750 | } |
| 751 | - if ($testIv->iv!=null && isset( $_POST['ivMin'])&&( $_POST['ivMin']!="")) { |
|
| 751 | + if ($testIv->iv != null && isset($_POST['ivMin']) && ($_POST['ivMin'] != "")) { |
|
| 752 | 752 | $ivMin = mysqli_real_escape_string($mysqli, $_POST['ivMin']); |
| 753 | 753 | $where .= " AND ((100/45)*(individual_attack+individual_defense+individual_stamina)) >= (".$ivMin.") "; |
| 754 | 754 | } |
| 755 | - if ($testIv->iv!=null && isset( $_POST['ivMax'])&&( $_POST['ivMax']!="")) { |
|
| 755 | + if ($testIv->iv != null && isset($_POST['ivMax']) && ($_POST['ivMax'] != "")) { |
|
| 756 | 756 | $ivMax = mysqli_real_escape_string($mysqli, $_POST['ivMax']); |
| 757 | 757 | $where .= " AND ((100/45)*(individual_attack+individual_defense+individual_stamina)) <=(".$ivMax.") "; |
| 758 | 758 | } |
@@ -766,12 +766,12 @@ discard block |
||
| 766 | 766 | $json = array(); |
| 767 | 767 | $json['points'] = array(); |
| 768 | 768 | $locale = array(); |
| 769 | - $locale["ivAttack"] = $locales->IV_ATTACK; |
|
| 769 | + $locale["ivAttack"] = $locales->IV_ATTACK; |
|
| 770 | 770 | $locale["ivDefense"] = $locales->IV_DEFENSE; |
| 771 | - $locale["ivStamina"] = $locales->IV_STAMINA; |
|
| 771 | + $locale["ivStamina"] = $locales->IV_STAMINA; |
|
| 772 | 772 | $json['locale'] = $locale; |
| 773 | 773 | while ($result && $data = $result->fetch_object()) { |
| 774 | - $pokeid=$data->pokemon_id; |
|
| 774 | + $pokeid = $data->pokemon_id; |
|
| 775 | 775 | $data->name = $pokemons->pokemon->$pokeid->name; |
| 776 | 776 | if (isset($data->move_1)) { |
| 777 | 777 | $move1 = $data->move_1; |
@@ -785,7 +785,7 @@ discard block |
||
| 785 | 785 | } else { |
| 786 | 786 | $data->charge_move = "?"; |
| 787 | 787 | } |
| 788 | - $json['points'][] = $data; |
|
| 788 | + $json['points'][] = $data; |
|
| 789 | 789 | } |
| 790 | 790 | |
| 791 | 791 | $json = json_encode($json); |