@@ -6,30 +6,30 @@ discard block |
||
| 6 | 6 | $total_pokemon_last_day = 0; |
| 7 | 7 | $pokelist = array(); |
| 8 | 8 | foreach ($data as $pokemon_id => $total) { |
| 9 | - $total_pokemon_last_day += $total; |
|
| 10 | - $pokelist[$pokemon_id]['spawns_last_day'] = $total; |
|
| 9 | + $total_pokemon_last_day += $total; |
|
| 10 | + $pokelist[$pokemon_id]['spawns_last_day'] = $total; |
|
| 11 | 11 | } |
| 12 | 12 | |
| 13 | 13 | // calc rarity for last 24h |
| 14 | 14 | foreach ($pokelist as &$pokemon) { |
| 15 | - $percent = $pokemon['spawns_last_day'] * 100 / $total_pokemon_last_day; |
|
| 16 | - $pokemon['rate'] = round($percent, 4); |
|
| 15 | + $percent = $pokemon['spawns_last_day'] * 100 / $total_pokemon_last_day; |
|
| 16 | + $pokemon['rate'] = round($percent, 4); |
|
| 17 | 17 | } |
| 18 | 18 | |
| 19 | 19 | // set values for all available pokemon |
| 20 | 20 | $maxpid = $config->system->max_pokemon; |
| 21 | 21 | $pokedex_rarity = new stdClass(); |
| 22 | 22 | for ($pid = 1; $pid <= $maxpid; ++$pid) { |
| 23 | - $pokedex_rarity->$pid = new stdClass(); |
|
| 24 | - if (isset($pokelist[$pid])) { |
|
| 25 | - // seen |
|
| 26 | - $pokedex_rarity->$pid->rate = $pokelist[$pid]['rate']; |
|
| 27 | - $pokedex_rarity->$pid->per_day = (int) $pokelist[$pid]['spawns_last_day']; |
|
| 28 | - } else { |
|
| 29 | - // unseen |
|
| 30 | - $pokedex_rarity->$pid->rate = 0.0; |
|
| 31 | - $pokedex_rarity->$pid->per_day = 0; |
|
| 32 | - } |
|
| 23 | + $pokedex_rarity->$pid = new stdClass(); |
|
| 24 | + if (isset($pokelist[$pid])) { |
|
| 25 | + // seen |
|
| 26 | + $pokedex_rarity->$pid->rate = $pokelist[$pid]['rate']; |
|
| 27 | + $pokedex_rarity->$pid->per_day = (int) $pokelist[$pid]['spawns_last_day']; |
|
| 28 | + } else { |
|
| 29 | + // unseen |
|
| 30 | + $pokedex_rarity->$pid->rate = 0.0; |
|
| 31 | + $pokedex_rarity->$pid->per_day = 0; |
|
| 32 | + } |
|
| 33 | 33 | } |
| 34 | 34 | |
| 35 | 35 | // Write to file |
@@ -37,23 +37,23 @@ discard block |
||
| 37 | 37 | |
| 38 | 38 | $rm_pokemon_file = $config->system->rm_pokemon_file; |
| 39 | 39 | if (!is_null($rm_pokemon_file)) { |
| 40 | - $string = file_get_contents($rm_pokemon_file); |
|
| 41 | - $json = json_decode($string, true); |
|
| 42 | - foreach ($pokedex_rarity as $pid => $rarity) { |
|
| 43 | - $rate = $rarity->rate; |
|
| 44 | - if ($rate >= 1) { |
|
| 45 | - $rarity_string = 'Common'; |
|
| 46 | - } elseif ($rate >= 0.20) { |
|
| 47 | - $rarity_string = 'Uncommon'; |
|
| 48 | - } elseif ($rate >= 0.01) { |
|
| 49 | - $rarity_string = 'Rare'; |
|
| 50 | - } elseif ($rate >= 0.0025) { |
|
| 51 | - $rarity_string = 'Very Rare'; |
|
| 52 | - } else { |
|
| 53 | - $rarity_string = 'Ultra Rare'; |
|
| 54 | - } |
|
| 55 | - unset($json[$pid]['rarity']); |
|
| 56 | - $json[$pid]['rarity'] = $rarity_string; |
|
| 57 | - } |
|
| 58 | - file_put_contents($rm_pokemon_file, json_encode($json)); |
|
| 40 | + $string = file_get_contents($rm_pokemon_file); |
|
| 41 | + $json = json_decode($string, true); |
|
| 42 | + foreach ($pokedex_rarity as $pid => $rarity) { |
|
| 43 | + $rate = $rarity->rate; |
|
| 44 | + if ($rate >= 1) { |
|
| 45 | + $rarity_string = 'Common'; |
|
| 46 | + } elseif ($rate >= 0.20) { |
|
| 47 | + $rarity_string = 'Uncommon'; |
|
| 48 | + } elseif ($rate >= 0.01) { |
|
| 49 | + $rarity_string = 'Rare'; |
|
| 50 | + } elseif ($rate >= 0.0025) { |
|
| 51 | + $rarity_string = 'Very Rare'; |
|
| 52 | + } else { |
|
| 53 | + $rarity_string = 'Ultra Rare'; |
|
| 54 | + } |
|
| 55 | + unset($json[$pid]['rarity']); |
|
| 56 | + $json[$pid]['rarity'] = $rarity_string; |
|
| 57 | + } |
|
| 58 | + file_put_contents($rm_pokemon_file, json_encode($json)); |
|
| 59 | 59 | } |
@@ -19,8 +19,8 @@ |
||
| 19 | 19 | |
| 20 | 20 | $rarityarray = array(); |
| 21 | 21 | foreach ($counts as $poke_id => $total) { |
| 22 | - $rarity = $pokemons->pokemon->$poke_id->rarity; |
|
| 23 | - isset($rarityarray[$rarity]) ? $rarityarray[$rarity] += $total : $rarityarray[$rarity] = $total; |
|
| 22 | + $rarity = $pokemons->pokemon->$poke_id->rarity; |
|
| 23 | + isset($rarityarray[$rarity]) ? $rarityarray[$rarity] += $total : $rarityarray[$rarity] = $total; |
|
| 24 | 24 | } |
| 25 | 25 | |
| 26 | 26 | // Set amount of Pokemon for each rarity to 0 if there weren't any at that time |
@@ -8,73 +8,73 @@ |
||
| 8 | 8 | |
| 9 | 9 | $captcha_file = SYS_PATH.'/core/json/captcha.stats.json'; |
| 10 | 10 | if (is_file($captcha_file)) { |
| 11 | - $capdatas = json_decode(file_get_contents($captcha_file), true); |
|
| 12 | - // Trim json stats files to last 7 days of data |
|
| 13 | - $capdatas = trim_stats_json($capdatas, $timestamp_lastweek); |
|
| 11 | + $capdatas = json_decode(file_get_contents($captcha_file), true); |
|
| 12 | + // Trim json stats files to last 7 days of data |
|
| 13 | + $capdatas = trim_stats_json($capdatas, $timestamp_lastweek); |
|
| 14 | 14 | } |
| 15 | 15 | |
| 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 | 19 | if ('' == $config_secret->captcha_key) { |
| 20 | - $captcha['timestamp'] = $timestamp; |
|
| 21 | - // get amount of accounts requiring a captcha |
|
| 22 | - $data = $manager->getCaptchaCount(); |
|
| 23 | - $captcha['captcha_accs'] = $data->total; |
|
| 24 | - // Add the datas in file |
|
| 25 | - $capdatas[] = $captcha; |
|
| 20 | + $captcha['timestamp'] = $timestamp; |
|
| 21 | + // get amount of accounts requiring a captcha |
|
| 22 | + $data = $manager->getCaptchaCount(); |
|
| 23 | + $captcha['captcha_accs'] = $data->total; |
|
| 24 | + // Add the datas in file |
|
| 25 | + $capdatas[] = $captcha; |
|
| 26 | 26 | } else { |
| 27 | - if (!empty($capdatas)) { |
|
| 28 | - $lastCaptcha = array_pop($capdatas); |
|
| 29 | - } else { |
|
| 30 | - $lastCaptcha['timestamp'] = strtotime('-7 days', strtotime(date('Y-m-d'))); |
|
| 31 | - } |
|
| 32 | - $lastCaptchaDate = date('Y-m-d', $lastCaptcha['timestamp']); |
|
| 33 | - $startTime = strtotime($lastCaptchaDate); |
|
| 34 | - $endTime = strtotime(date('Y-m-d')) + date('Z'); |
|
| 35 | - $timeDiff = abs($endTime - $startTime); |
|
| 36 | - $numberDays = intval($timeDiff / 86400); // 86400 seconds in one day |
|
| 37 | - if ($numberDays > 7) { |
|
| 38 | - $numberDays = 7; |
|
| 39 | - } |
|
| 40 | - while ($numberDays >= 0) { |
|
| 41 | - $day = $endTime - ($numberDays * 86400); |
|
| 42 | - $captchaUrl = |
|
| 43 | - 'http://2captcha.com/res.php?key='. |
|
| 44 | - $config_secret->captcha_key.'&action=getstats&date='.date('Y-m-d', $day); |
|
| 27 | + if (!empty($capdatas)) { |
|
| 28 | + $lastCaptcha = array_pop($capdatas); |
|
| 29 | + } else { |
|
| 30 | + $lastCaptcha['timestamp'] = strtotime('-7 days', strtotime(date('Y-m-d'))); |
|
| 31 | + } |
|
| 32 | + $lastCaptchaDate = date('Y-m-d', $lastCaptcha['timestamp']); |
|
| 33 | + $startTime = strtotime($lastCaptchaDate); |
|
| 34 | + $endTime = strtotime(date('Y-m-d')) + date('Z'); |
|
| 35 | + $timeDiff = abs($endTime - $startTime); |
|
| 36 | + $numberDays = intval($timeDiff / 86400); // 86400 seconds in one day |
|
| 37 | + if ($numberDays > 7) { |
|
| 38 | + $numberDays = 7; |
|
| 39 | + } |
|
| 40 | + while ($numberDays >= 0) { |
|
| 41 | + $day = $endTime - ($numberDays * 86400); |
|
| 42 | + $captchaUrl = |
|
| 43 | + 'http://2captcha.com/res.php?key='. |
|
| 44 | + $config_secret->captcha_key.'&action=getstats&date='.date('Y-m-d', $day); |
|
| 45 | 45 | |
| 46 | - $ch = curl_init(); |
|
| 47 | - curl_setopt($ch, CURLOPT_URL, $captchaUrl); |
|
| 48 | - curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5); |
|
| 49 | - curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); |
|
| 50 | - $fileContents = curl_exec($ch); |
|
| 51 | - if (curl_errno($ch)) { |
|
| 52 | - echo curl_error($ch); |
|
| 53 | - echo "\n<br />"; |
|
| 54 | - $fileContents = ''; |
|
| 55 | - } else { |
|
| 56 | - curl_close($ch); |
|
| 57 | - } |
|
| 46 | + $ch = curl_init(); |
|
| 47 | + curl_setopt($ch, CURLOPT_URL, $captchaUrl); |
|
| 48 | + curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5); |
|
| 49 | + curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); |
|
| 50 | + $fileContents = curl_exec($ch); |
|
| 51 | + if (curl_errno($ch)) { |
|
| 52 | + echo curl_error($ch); |
|
| 53 | + echo "\n<br />"; |
|
| 54 | + $fileContents = ''; |
|
| 55 | + } else { |
|
| 56 | + curl_close($ch); |
|
| 57 | + } |
|
| 58 | 58 | |
| 59 | - if (!is_string($fileContents) || !strlen($fileContents)) { |
|
| 60 | - echo 'Failed to get contents.'; |
|
| 61 | - $fileContents = ''; |
|
| 62 | - } |
|
| 63 | - $capXml = simplexml_load_string($fileContents); |
|
| 59 | + if (!is_string($fileContents) || !strlen($fileContents)) { |
|
| 60 | + echo 'Failed to get contents.'; |
|
| 61 | + $fileContents = ''; |
|
| 62 | + } |
|
| 63 | + $capXml = simplexml_load_string($fileContents); |
|
| 64 | 64 | |
| 65 | - foreach ($capXml as $key => $value) { |
|
| 66 | - if ((0 == $numberDays |
|
| 67 | - && ((int) $value->Attributes()->hour >= (int) date('H', $lastCaptcha['timestamp']) |
|
| 68 | - && ((int) $value->Attributes()->hour <= (int) date('H'))) |
|
| 69 | - ) || $numberDays > 0) { |
|
| 70 | - $captcha['timestamp'] = |
|
| 71 | - strtotime(date('Y-m-d', $day).' '.$value->Attributes()->hour.':00') + date('Z'); |
|
| 72 | - $captcha['captcha_accs'] = (string) $value->volume; |
|
| 73 | - $capdatas[] = $captcha; |
|
| 74 | - } |
|
| 75 | - } |
|
| 76 | - --$numberDays; |
|
| 77 | - } |
|
| 65 | + foreach ($capXml as $key => $value) { |
|
| 66 | + if ((0 == $numberDays |
|
| 67 | + && ((int) $value->Attributes()->hour >= (int) date('H', $lastCaptcha['timestamp']) |
|
| 68 | + && ((int) $value->Attributes()->hour <= (int) date('H'))) |
|
| 69 | + ) || $numberDays > 0) { |
|
| 70 | + $captcha['timestamp'] = |
|
| 71 | + strtotime(date('Y-m-d', $day).' '.$value->Attributes()->hour.':00') + date('Z'); |
|
| 72 | + $captcha['captcha_accs'] = (string) $value->volume; |
|
| 73 | + $capdatas[] = $captcha; |
|
| 74 | + } |
|
| 75 | + } |
|
| 76 | + --$numberDays; |
|
| 77 | + } |
|
| 78 | 78 | } |
| 79 | 79 | |
| 80 | 80 | // Write to file |
@@ -37,13 +37,13 @@ discard block |
||
| 37 | 37 | $pokemonstats_file = SYS_PATH.'/core/json/pokemon.stats.json'; |
| 38 | 38 | |
| 39 | 39 | if (is_file($gym_file)) { |
| 40 | - $gymsdatas = json_decode(file_get_contents($gym_file), true); |
|
| 40 | + $gymsdatas = json_decode(file_get_contents($gym_file), true); |
|
| 41 | 41 | } |
| 42 | 42 | if (is_file($pokestop_file)) { |
| 43 | - $stopdatas = json_decode(file_get_contents($pokestop_file), true); |
|
| 43 | + $stopdatas = json_decode(file_get_contents($pokestop_file), true); |
|
| 44 | 44 | } |
| 45 | 45 | if (is_file($pokemonstats_file)) { |
| 46 | - $pokedatas = json_decode(file_get_contents($pokemonstats_file), true); |
|
| 46 | + $pokedatas = json_decode(file_get_contents($pokemonstats_file), true); |
|
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | $timestamp = time(); |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | include_once SYS_PATH.'/core/cron/pokemon.cron.php'; |
| 60 | 60 | include_once SYS_PATH.'/core/cron/pokestop.cron.php'; |
| 61 | 61 | if ($config->system->captcha_support) { |
| 62 | - include_once SYS_PATH.'/core/cron/captcha.cron.php'; |
|
| 62 | + include_once SYS_PATH.'/core/cron/captcha.cron.php'; |
|
| 63 | 63 | } |
| 64 | 64 | |
| 65 | 65 | // The following files are updated every 24h only because the queries are quite expensive |
@@ -72,48 +72,48 @@ discard block |
||
| 72 | 72 | $migration->setTimezone(new DateTimeZone('UTC')); |
| 73 | 73 | $migration->setTimestamp(1493856000); |
| 74 | 74 | do { |
| 75 | - $migrationPrev = clone $migration; |
|
| 76 | - $migration->modify('+14 days'); |
|
| 75 | + $migrationPrev = clone $migration; |
|
| 76 | + $migration->modify('+14 days'); |
|
| 77 | 77 | } while ($migration < new DateTime()); |
| 78 | 78 | $migration = $migrationPrev->getTimestamp(); |
| 79 | 79 | |
| 80 | 80 | if (filemtime($nests_parks_file) - $migration <= 0) { |
| 81 | - file_put_contents($nests_file, json_encode(array())); |
|
| 82 | - file_put_contents($nests_parks_file, json_encode(array())); |
|
| 83 | - touch($nests_parks_file, 1); |
|
| 81 | + file_put_contents($nests_file, json_encode(array())); |
|
| 82 | + file_put_contents($nests_parks_file, json_encode(array())); |
|
| 83 | + touch($nests_parks_file, 1); |
|
| 84 | 84 | } |
| 85 | 85 | |
| 86 | 86 | // Do not update both files at the same time to lower cpu load |
| 87 | 87 | if (file_update_ago($pokedex_rarity_file) > 86400) { |
| 88 | - // set file mtime to now before executing long running queries |
|
| 89 | - // so we don't try to update the file twice |
|
| 90 | - touch($pokedex_rarity_file); |
|
| 91 | - // update pokedex rarity |
|
| 92 | - include_once SYS_PATH.'/core/cron/pokedex_rarity.cron.php'; |
|
| 88 | + // set file mtime to now before executing long running queries |
|
| 89 | + // so we don't try to update the file twice |
|
| 90 | + touch($pokedex_rarity_file); |
|
| 91 | + // update pokedex rarity |
|
| 92 | + include_once SYS_PATH.'/core/cron/pokedex_rarity.cron.php'; |
|
| 93 | 93 | } elseif ((file_update_ago($nests_parks_file) >= 43200) && (time() - $migration >= 43200) && (time() - $migration < 86400)) { // extra update 12h after migration |
| 94 | - if (is_file($nests_parks_file)) { |
|
| 95 | - $prevNestTime = filemtime($nests_parks_file); |
|
| 96 | - } else { |
|
| 97 | - $prevNestTime = 1; |
|
| 98 | - } |
|
| 99 | - |
|
| 100 | - // set file mtime to now before executing long running queries |
|
| 101 | - // so we don't try to update the file twice |
|
| 102 | - touch($nests_parks_file); |
|
| 103 | - // update nests |
|
| 104 | - $nestTime = 12; |
|
| 105 | - include_once SYS_PATH.'/core/cron/nests.cron.php'; |
|
| 94 | + if (is_file($nests_parks_file)) { |
|
| 95 | + $prevNestTime = filemtime($nests_parks_file); |
|
| 96 | + } else { |
|
| 97 | + $prevNestTime = 1; |
|
| 98 | + } |
|
| 99 | + |
|
| 100 | + // set file mtime to now before executing long running queries |
|
| 101 | + // so we don't try to update the file twice |
|
| 102 | + touch($nests_parks_file); |
|
| 103 | + // update nests |
|
| 104 | + $nestTime = 12; |
|
| 105 | + include_once SYS_PATH.'/core/cron/nests.cron.php'; |
|
| 106 | 106 | } elseif ((file_update_ago($nests_parks_file) >= 86400) && (time() - $migration >= 86400)) { |
| 107 | - if (is_file($nests_parks_file)) { |
|
| 108 | - $prevNestTime = filemtime($nests_parks_file); |
|
| 109 | - } else { |
|
| 110 | - $prevNestTime = 1; |
|
| 111 | - } |
|
| 112 | - |
|
| 113 | - // set file mtime to now before executing long running queries |
|
| 114 | - // so we don't try to update the file twice |
|
| 115 | - touch($nests_parks_file); |
|
| 116 | - // update nests |
|
| 117 | - $nestTime = 24; |
|
| 118 | - include_once SYS_PATH.'/core/cron/nests.cron.php'; |
|
| 107 | + if (is_file($nests_parks_file)) { |
|
| 108 | + $prevNestTime = filemtime($nests_parks_file); |
|
| 109 | + } else { |
|
| 110 | + $prevNestTime = 1; |
|
| 111 | + } |
|
| 112 | + |
|
| 113 | + // set file mtime to now before executing long running queries |
|
| 114 | + // so we don't try to update the file twice |
|
| 115 | + touch($nests_parks_file); |
|
| 116 | + // update nests |
|
| 117 | + $nestTime = 24; |
|
| 118 | + include_once SYS_PATH.'/core/cron/nests.cron.php'; |
|
| 119 | 119 | } |
@@ -90,7 +90,8 @@ |
||
| 90 | 90 | touch($pokedex_rarity_file); |
| 91 | 91 | // update pokedex rarity |
| 92 | 92 | include_once SYS_PATH.'/core/cron/pokedex_rarity.cron.php'; |
| 93 | -} elseif ((file_update_ago($nests_parks_file) >= 43200) && (time() - $migration >= 43200) && (time() - $migration < 86400)) { // extra update 12h after migration |
|
| 93 | +} elseif ((file_update_ago($nests_parks_file) >= 43200) && (time() - $migration >= 43200) && (time() - $migration < 86400)) { |
|
| 94 | +// extra update 12h after migration |
|
| 94 | 95 | if (is_file($nests_parks_file)) { |
| 95 | 96 | $prevNestTime = filemtime($nests_parks_file); |
| 96 | 97 | } else { |
@@ -27,8 +27,8 @@ discard block |
||
| 27 | 27 | $trainer_lvl = []; |
| 28 | 28 | // For all 3 teams |
| 29 | 29 | for ($teamid = 1; $teamid <= 3; ++$teamid) { |
| 30 | - $data = $manager->getTrainerLevelCount($teamid); |
|
| 31 | - $trainer_lvl[$teamid] = $data; |
|
| 30 | + $data = $manager->getTrainerLevelCount($teamid); |
|
| 31 | + $trainer_lvl[$teamid] = $data; |
|
| 32 | 32 | } |
| 33 | 33 | |
| 34 | 34 | ?> |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | borderColor: 'rgba(59,129,255,1)', |
| 69 | 69 | borderWidth: 1, |
| 70 | 70 | data: [<?php if (isset($trainer_lvl[1])) { |
| 71 | - echo implode(',', $trainer_lvl[1]); |
|
| 71 | + echo implode(',', $trainer_lvl[1]); |
|
| 72 | 72 | } ?>], |
| 73 | 73 | }, |
| 74 | 74 | { |
@@ -77,7 +77,7 @@ discard block |
||
| 77 | 77 | borderColor: 'rgba(247,10,20,1)', |
| 78 | 78 | borderWidth: 1, |
| 79 | 79 | data: [<?php if (isset($trainer_lvl[2])) { |
| 80 | - echo implode(',', $trainer_lvl[2]); |
|
| 80 | + echo implode(',', $trainer_lvl[2]); |
|
| 81 | 81 | } ?>], |
| 82 | 82 | }, |
| 83 | 83 | { |
@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | borderColor: 'rgba(248,153,0,1)', |
| 87 | 87 | borderWidth: 1, |
| 88 | 88 | data: [<?php if (isset($trainer_lvl[3])) { |
| 89 | - echo implode(',', $trainer_lvl[3]); |
|
| 89 | + echo implode(',', $trainer_lvl[3]); |
|
| 90 | 90 | } ?>], |
| 91 | 91 | } |
| 92 | 92 | ] |
@@ -1,13 +1,13 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | - // Send Javascript header |
|
| 3 | - header('Content-type: text/javascript'); |
|
| 4 | - |
|
| 5 | - // Load variables and locales |
|
| 6 | - include_once '../../config.php'; |
|
| 7 | - $variables = SYS_PATH.'/core/json/variables.json'; |
|
| 8 | - $config = json_decode(file_get_contents($variables)); |
|
| 9 | - include_once '../process/locales.loader.php'; |
|
| 10 | - include_once '../../functions.php'; |
|
| 2 | + // Send Javascript header |
|
| 3 | + header('Content-type: text/javascript'); |
|
| 4 | + |
|
| 5 | + // Load variables and locales |
|
| 6 | + include_once '../../config.php'; |
|
| 7 | + $variables = SYS_PATH.'/core/json/variables.json'; |
|
| 8 | + $config = json_decode(file_get_contents($variables)); |
|
| 9 | + include_once '../process/locales.loader.php'; |
|
| 10 | + include_once '../../functions.php'; |
|
| 11 | 11 | ?> |
| 12 | 12 | |
| 13 | 13 | /** global: google */ |
@@ -15,9 +15,9 @@ discard block |
||
| 15 | 15 | |
| 16 | 16 | var pokemon = { |
| 17 | 17 | <?php |
| 18 | - foreach ($pokemons->pokemon as $pokeid => $pokemon) { |
|
| 19 | - echo $pokeid.':"'.$pokemon->name.'",'; |
|
| 20 | - } |
|
| 18 | + foreach ($pokemons->pokemon as $pokeid => $pokemon) { |
|
| 19 | + echo $pokeid.':"'.$pokemon->name.'",'; |
|
| 20 | + } |
|
| 21 | 21 | ?> |
| 22 | 22 | } |
| 23 | 23 | var map; |
@@ -3,9 +3,9 @@ |
||
| 3 | 3 | // Test to check if the file is called properly |
| 4 | 4 | |
| 5 | 5 | if (!isset($_GET['id'])) { |
| 6 | - http_response_code(400); |
|
| 7 | - echo 'Bad Request'; |
|
| 8 | - exit(); |
|
| 6 | + http_response_code(400); |
|
| 7 | + echo 'Bad Request'; |
|
| 8 | + exit(); |
|
| 9 | 9 | } |
| 10 | 10 | |
| 11 | 11 | // Send Javascript header |
@@ -58,78 +58,78 @@ discard block |
||
| 58 | 58 | $captcha_accs = array(); |
| 59 | 59 | |
| 60 | 60 | foreach ($stats as $data) { |
| 61 | - if ($data->timestamp > $lastweek) { |
|
| 62 | - $labels_global[] = '"'.date('D H:i', $data->timestamp).'"'; |
|
| 63 | - $total[] = $data->pokemon_now; |
|
| 64 | - } |
|
| 65 | - |
|
| 66 | - if ($data->timestamp > $yesterday) { |
|
| 67 | - $labels[] = '"'.date('H:i', $data->timestamp).'"'; |
|
| 68 | - |
|
| 69 | - if (isset($data->rarity_spawn->{'Very common'})) { |
|
| 70 | - $veco[] = $data->rarity_spawn->{'Very common'}; |
|
| 71 | - } else { |
|
| 72 | - $veco[] = 0; |
|
| 73 | - } |
|
| 74 | - |
|
| 75 | - if (isset($data->rarity_spawn->Common)) { |
|
| 76 | - $commo[] = $data->rarity_spawn->Common; |
|
| 77 | - } else { |
|
| 78 | - $commo[] = 0; |
|
| 79 | - } |
|
| 80 | - |
|
| 81 | - if (isset($data->rarity_spawn->Rare)) { |
|
| 82 | - $rare[] = $data->rarity_spawn->Rare; |
|
| 83 | - } else { |
|
| 84 | - $rare[] = 0; |
|
| 85 | - } |
|
| 86 | - |
|
| 87 | - if (isset($data->rarity_spawn->Mythic)) { |
|
| 88 | - $myth[] = $data->rarity_spawn->Mythic; |
|
| 89 | - } else { |
|
| 90 | - $myth[] = 0; |
|
| 91 | - } |
|
| 92 | - } |
|
| 61 | + if ($data->timestamp > $lastweek) { |
|
| 62 | + $labels_global[] = '"'.date('D H:i', $data->timestamp).'"'; |
|
| 63 | + $total[] = $data->pokemon_now; |
|
| 64 | + } |
|
| 65 | + |
|
| 66 | + if ($data->timestamp > $yesterday) { |
|
| 67 | + $labels[] = '"'.date('H:i', $data->timestamp).'"'; |
|
| 68 | + |
|
| 69 | + if (isset($data->rarity_spawn->{'Very common'})) { |
|
| 70 | + $veco[] = $data->rarity_spawn->{'Very common'}; |
|
| 71 | + } else { |
|
| 72 | + $veco[] = 0; |
|
| 73 | + } |
|
| 74 | + |
|
| 75 | + if (isset($data->rarity_spawn->Common)) { |
|
| 76 | + $commo[] = $data->rarity_spawn->Common; |
|
| 77 | + } else { |
|
| 78 | + $commo[] = 0; |
|
| 79 | + } |
|
| 80 | + |
|
| 81 | + if (isset($data->rarity_spawn->Rare)) { |
|
| 82 | + $rare[] = $data->rarity_spawn->Rare; |
|
| 83 | + } else { |
|
| 84 | + $rare[] = 0; |
|
| 85 | + } |
|
| 86 | + |
|
| 87 | + if (isset($data->rarity_spawn->Mythic)) { |
|
| 88 | + $myth[] = $data->rarity_spawn->Mythic; |
|
| 89 | + } else { |
|
| 90 | + $myth[] = 0; |
|
| 91 | + } |
|
| 92 | + } |
|
| 93 | 93 | } |
| 94 | 94 | |
| 95 | 95 | $stats_file = SYS_PATH.'/core/json/gym.stats.json'; |
| 96 | 96 | $stats = json_decode(file_get_contents($stats_file)); |
| 97 | 97 | |
| 98 | 98 | foreach ($stats as $data) { |
| 99 | - if ($data->timestamp > $lastweek) { |
|
| 100 | - $labels_gym[] = '"'.date('D H:i', $data->timestamp).'"'; |
|
| 99 | + if ($data->timestamp > $lastweek) { |
|
| 100 | + $labels_gym[] = '"'.date('D H:i', $data->timestamp).'"'; |
|
| 101 | 101 | |
| 102 | - $mystic_average[] = $data->team->mystic->average; |
|
| 103 | - $mystic_owned[] = $data->team->mystic->gym_owned; |
|
| 102 | + $mystic_average[] = $data->team->mystic->average; |
|
| 103 | + $mystic_owned[] = $data->team->mystic->gym_owned; |
|
| 104 | 104 | |
| 105 | - $valor_average[] = $data->team->valor->average; |
|
| 106 | - $valor_owned[] = $data->team->valor->gym_owned; |
|
| 105 | + $valor_average[] = $data->team->valor->average; |
|
| 106 | + $valor_owned[] = $data->team->valor->gym_owned; |
|
| 107 | 107 | |
| 108 | - $instinct_average[] = $data->team->instinct->average; |
|
| 109 | - $instinct_owned[] = $data->team->instinct->gym_owned; |
|
| 110 | - } |
|
| 108 | + $instinct_average[] = $data->team->instinct->average; |
|
| 109 | + $instinct_owned[] = $data->team->instinct->gym_owned; |
|
| 110 | + } |
|
| 111 | 111 | } |
| 112 | 112 | |
| 113 | 113 | $stats_file = SYS_PATH.'/core/json/pokestop.stats.json'; |
| 114 | 114 | $stats = json_decode(file_get_contents($stats_file)); |
| 115 | 115 | |
| 116 | 116 | foreach ($stats as $data) { |
| 117 | - if ($data->timestamp > $lastweek) { |
|
| 118 | - $labels_stops[] = '"'.date('D H:i', $data->timestamp).'"'; |
|
| 119 | - $lure[] = $data->lured; |
|
| 120 | - } |
|
| 117 | + if ($data->timestamp > $lastweek) { |
|
| 118 | + $labels_stops[] = '"'.date('D H:i', $data->timestamp).'"'; |
|
| 119 | + $lure[] = $data->lured; |
|
| 120 | + } |
|
| 121 | 121 | } |
| 122 | 122 | |
| 123 | 123 | if ($config->system->captcha_support) { |
| 124 | - $stats_file = SYS_PATH.'/core/json/captcha.stats.json'; |
|
| 125 | - $stats = json_decode(file_get_contents($stats_file)); |
|
| 126 | - |
|
| 127 | - foreach ($stats as $data) { |
|
| 128 | - if ($data->timestamp > $lastweek) { |
|
| 129 | - $labels_captcha[] = '"'.date('D H:i', $data->timestamp).'"'; |
|
| 130 | - $captcha_accs[] = $data->captcha_accs; |
|
| 131 | - } |
|
| 132 | - } |
|
| 124 | + $stats_file = SYS_PATH.'/core/json/captcha.stats.json'; |
|
| 125 | + $stats = json_decode(file_get_contents($stats_file)); |
|
| 126 | + |
|
| 127 | + foreach ($stats as $data) { |
|
| 128 | + if ($data->timestamp > $lastweek) { |
|
| 129 | + $labels_captcha[] = '"'.date('D H:i', $data->timestamp).'"'; |
|
| 130 | + $captcha_accs[] = $data->captcha_accs; |
|
| 131 | + } |
|
| 132 | + } |
|
| 133 | 133 | } |
| 134 | 134 | |
| 135 | 135 | ?> |
@@ -563,7 +563,7 @@ discard block |
||
| 563 | 563 | // ------------- |
| 564 | 564 | |
| 565 | 565 | <?php if ($config->system->captcha_support) { |
| 566 | - ?> |
|
| 566 | + ?> |
|
| 567 | 567 | var ctx_captcha_accs = $('#captcha'); |
| 568 | 568 | |
| 569 | 569 | var data_captcha_accs = { |
@@ -21,7 +21,7 @@ discard block |
||
| 21 | 21 | <link href="core/css/font-awesome.min.css" rel="stylesheet"> |
| 22 | 22 | <link href="<?php auto_ver('core/css/style.css'); ?>" rel="stylesheet"> |
| 23 | 23 | <?php if ('pokemon' == $page) { |
| 24 | - ?> |
|
| 24 | + ?> |
|
| 25 | 25 | <link href="<?php auto_ver('core/css/jQRangeSlider-bootstrap.min.css'); ?>" rel="stylesheet"> |
| 26 | 26 | <?php |
| 27 | 27 | } ?> |
@@ -29,11 +29,11 @@ discard block |
||
| 29 | 29 | <body id="page-top" data-spy="scroll" data-target=".navbar-fixed-top"> |
| 30 | 30 | |
| 31 | 31 | <?php |
| 32 | - // Google Analytics |
|
| 33 | - if (is_file('analyticstracking.php')) { |
|
| 34 | - include_once 'analyticstracking.php'; |
|
| 35 | - } |
|
| 36 | - ?> |
|
| 32 | + // Google Analytics |
|
| 33 | + if (is_file('analyticstracking.php')) { |
|
| 34 | + include_once 'analyticstracking.php'; |
|
| 35 | + } |
|
| 36 | + ?> |
|
| 37 | 37 | |
| 38 | 38 | <nav class="navbar navbar-default navbar-fixed-top"> |
| 39 | 39 | <div class="container"> |
@@ -53,15 +53,15 @@ discard block |
||
| 53 | 53 | <ul class="nav navbar-nav navbar-right"> |
| 54 | 54 | |
| 55 | 55 | <?php |
| 56 | - if (!isset($config->menu)) { |
|
| 57 | - echo 'Please update variables.json file with menu values'; |
|
| 58 | - exit(); |
|
| 59 | - } |
|
| 56 | + if (!isset($config->menu)) { |
|
| 57 | + echo 'Please update variables.json file with menu values'; |
|
| 58 | + exit(); |
|
| 59 | + } |
|
| 60 | 60 | |
| 61 | - foreach ($config->menu as $menu) { |
|
| 62 | - printMenuitems($menu, 1, $locales); |
|
| 63 | - } |
|
| 64 | - ?> |
|
| 61 | + foreach ($config->menu as $menu) { |
|
| 62 | + printMenuitems($menu, 1, $locales); |
|
| 63 | + } |
|
| 64 | + ?> |
|
| 65 | 65 | |
| 66 | 66 | </ul> |
| 67 | 67 | </div> <!-- /.navbar-collapse --> |
@@ -70,21 +70,21 @@ discard block |
||
| 70 | 70 | |
| 71 | 71 | <div class="container"> |
| 72 | 72 | <?php |
| 73 | - // Include the pages |
|
| 74 | - if (!empty($_GET['page'])) { |
|
| 75 | - $file = SYS_PATH.'/pages/'.$page.'.page.php'; |
|
| 76 | - |
|
| 77 | - if (is_file($file)) { |
|
| 78 | - echo '<!-- Page :: '.$page.' -->'; |
|
| 79 | - include $file; |
|
| 80 | - } else { |
|
| 81 | - include 'pages/home.page.php'; |
|
| 82 | - } |
|
| 83 | - } else { |
|
| 84 | - include 'pages/home.page.php'; |
|
| 85 | - } |
|
| 86 | - |
|
| 87 | - ?> |
|
| 73 | + // Include the pages |
|
| 74 | + if (!empty($_GET['page'])) { |
|
| 75 | + $file = SYS_PATH.'/pages/'.$page.'.page.php'; |
|
| 76 | + |
|
| 77 | + if (is_file($file)) { |
|
| 78 | + echo '<!-- Page :: '.$page.' -->'; |
|
| 79 | + include $file; |
|
| 80 | + } else { |
|
| 81 | + include 'pages/home.page.php'; |
|
| 82 | + } |
|
| 83 | + } else { |
|
| 84 | + include 'pages/home.page.php'; |
|
| 85 | + } |
|
| 86 | + |
|
| 87 | + ?> |
|
| 88 | 88 | </div> |
| 89 | 89 | |
| 90 | 90 | <footer> |
@@ -107,8 +107,8 @@ discard block |
||
| 107 | 107 | <script src="core/js/bootstrap.min.js"></script> |
| 108 | 108 | |
| 109 | 109 | <?php // Load scripts only for page |
| 110 | - if (empty($page)) { |
|
| 111 | - ?> |
|
| 110 | + if (empty($page)) { |
|
| 111 | + ?> |
|
| 112 | 112 | |
| 113 | 113 | <script src="<?php auto_ver('core/js/home.script.js'); ?>"></script> |
| 114 | 114 | |
@@ -124,10 +124,10 @@ discard block |
||
| 124 | 124 | updateCounter(<?= $home->teams->rocket; ?>,'.total-rocket-js'); |
| 125 | 125 | </script> |
| 126 | 126 | <?php |
| 127 | - } else { |
|
| 128 | - switch ($page) { |
|
| 129 | - case 'pokemon': |
|
| 130 | - ?> |
|
| 127 | + } else { |
|
| 128 | + switch ($page) { |
|
| 129 | + case 'pokemon': |
|
| 130 | + ?> |
|
| 131 | 131 | |
| 132 | 132 | <script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.5.0/Chart.min.js"></script> |
| 133 | 133 | <script src="core/js/pokemon.graph.js.php?id=<?= $pokemon_id; ?>"></script> |
@@ -141,19 +141,19 @@ discard block |
||
| 141 | 141 | <script src="https://maps.googleapis.com/maps/api/js?key=<?= $config->system->GMaps_Key; ?>&libraries=visualization&callback=initMap&v=3"></script> |
| 142 | 142 | |
| 143 | 143 | <?php |
| 144 | - break; |
|
| 144 | + break; |
|
| 145 | 145 | |
| 146 | - case 'pokestops': |
|
| 147 | - ?> |
|
| 146 | + case 'pokestops': |
|
| 147 | + ?> |
|
| 148 | 148 | |
| 149 | 149 | <script src="<?php auto_ver('core/js/pokestops.maps.js'); ?>"></script> |
| 150 | 150 | <script src="https://maps.googleapis.com/maps/api/js?key=<?= $config->system->GMaps_Key; ?>&libraries=visualization&callback=initMap&v=3"></script> |
| 151 | 151 | |
| 152 | 152 | <?php |
| 153 | - break; |
|
| 153 | + break; |
|
| 154 | 154 | |
| 155 | - case 'gym': |
|
| 156 | - ?> |
|
| 155 | + case 'gym': |
|
| 156 | + ?> |
|
| 157 | 157 | |
| 158 | 158 | <script src="<?php auto_ver('core/js/gym.script.js'); ?>"></script> |
| 159 | 159 | <script> |
@@ -171,10 +171,10 @@ discard block |
||
| 171 | 171 | <script src="https://maps.googleapis.com/maps/api/js?key=<?= $config->system->GMaps_Key; ?>&libraries=visualization&callback=initMap&v=3"></script> |
| 172 | 172 | |
| 173 | 173 | <?php |
| 174 | - break; |
|
| 174 | + break; |
|
| 175 | 175 | |
| 176 | - case 'pokedex': |
|
| 177 | - ?> |
|
| 176 | + case 'pokedex': |
|
| 177 | + ?> |
|
| 178 | 178 | |
| 179 | 179 | <script src="core/js/holmes.min.js"></script> |
| 180 | 180 | <script> |
@@ -191,56 +191,56 @@ discard block |
||
| 191 | 191 | </script> |
| 192 | 192 | |
| 193 | 193 | <?php |
| 194 | - break; |
|
| 194 | + break; |
|
| 195 | 195 | |
| 196 | - case 'dashboard': |
|
| 197 | - ?> |
|
| 196 | + case 'dashboard': |
|
| 197 | + ?> |
|
| 198 | 198 | |
| 199 | 199 | <script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.5.0/Chart.min.js"></script> |
| 200 | 200 | <script src="core/js/dashboard.graph.js.php"></script> |
| 201 | 201 | |
| 202 | 202 | <?php |
| 203 | - break; |
|
| 203 | + break; |
|
| 204 | 204 | |
| 205 | - case 'trainer': |
|
| 206 | - ?> |
|
| 205 | + case 'trainer': |
|
| 206 | + ?> |
|
| 207 | 207 | |
| 208 | 208 | <script src="<?php auto_ver('core/js/trainer.content.js'); ?>"></script> |
| 209 | 209 | <script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.5.0/Chart.min.js"></script> |
| 210 | 210 | <script src="core/js/trainer.graph.js.php"></script> |
| 211 | 211 | |
| 212 | 212 | <?php |
| 213 | - break; |
|
| 213 | + break; |
|
| 214 | 214 | |
| 215 | - case 'nests': |
|
| 216 | - ?> |
|
| 215 | + case 'nests': |
|
| 216 | + ?> |
|
| 217 | 217 | |
| 218 | 218 | <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery.countdown/2.2.0/jquery.countdown.min.js"></script> |
| 219 | 219 | <script src="core/js/nests.maps.js.php"></script> |
| 220 | 220 | <script src="https://maps.googleapis.com/maps/api/js?key=<?= $config->system->GMaps_Key; ?>&libraries=visualization,geometry&callback=initMap&v=3"></script> |
| 221 | 221 | |
| 222 | 222 | <?php |
| 223 | - break; |
|
| 223 | + break; |
|
| 224 | 224 | |
| 225 | - case 'raids': |
|
| 226 | - ?> |
|
| 225 | + case 'raids': |
|
| 226 | + ?> |
|
| 227 | 227 | |
| 228 | 228 | <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery.countdown/2.2.0/jquery.countdown.min.js"></script> |
| 229 | 229 | <script src="<?php auto_ver('core/js/raids.content.js'); ?>"></script> |
| 230 | 230 | |
| 231 | 231 | <?php |
| 232 | - break; |
|
| 232 | + break; |
|
| 233 | 233 | |
| 234 | - case 'gymhistory': |
|
| 235 | - ?> |
|
| 234 | + case 'gymhistory': |
|
| 235 | + ?> |
|
| 236 | 236 | |
| 237 | 237 | <script src="<?php auto_ver('core/js/gymhistory.content.js'); ?>"></script> |
| 238 | 238 | |
| 239 | 239 | <?php |
| 240 | - break; |
|
| 241 | - } |
|
| 242 | - } |
|
| 243 | - ?> |
|
| 240 | + break; |
|
| 241 | + } |
|
| 242 | + } |
|
| 243 | + ?> |
|
| 244 | 244 | |
| 245 | 245 | </body> |
| 246 | 246 | </html> |