@@ -8,48 +8,48 @@ |
||
8 | 8 | // ----------------------------------------------------------------------------------------------------------- |
9 | 9 | |
10 | 10 | |
11 | -$gym['timestamp'] = $timestamp; |
|
11 | +$gym['timestamp'] = $timestamp; |
|
12 | 12 | |
13 | -$req = "SELECT count( DISTINCT(gym_id) ) as total FROM gym"; |
|
14 | -$result = $mysqli->query($req); |
|
15 | -$data = $result->fetch_object(); |
|
13 | +$req = "SELECT count( DISTINCT(gym_id) ) as total FROM gym"; |
|
14 | +$result = $mysqli->query($req); |
|
15 | +$data = $result->fetch_object(); |
|
16 | 16 | |
17 | -$gym['total'] = $data->total; |
|
17 | +$gym['total'] = $data->total; |
|
18 | 18 | |
19 | 19 | |
20 | 20 | // Mystic |
21 | 21 | |
22 | -$req = "SELECT count(DISTINCT(gym_id)) as total, ROUND(AVG(gym_points),0) as average_points FROM gym WHERE team_id = '1'"; |
|
23 | -$result = $mysqli->query($req); |
|
24 | -$data = $result->fetch_object(); |
|
22 | +$req = "SELECT count(DISTINCT(gym_id)) as total, ROUND(AVG(gym_points),0) as average_points FROM gym WHERE team_id = '1'"; |
|
23 | +$result = $mysqli->query($req); |
|
24 | +$data = $result->fetch_object(); |
|
25 | 25 | |
26 | -$gym['team']['mystic']['gym_owned'] = $data->total; |
|
27 | -$gym['team']['mystic']['average'] = $data->average_points; |
|
26 | +$gym['team']['mystic']['gym_owned'] = $data->total; |
|
27 | +$gym['team']['mystic']['average'] = $data->average_points; |
|
28 | 28 | |
29 | 29 | |
30 | 30 | // Valor |
31 | 31 | |
32 | -$req = "SELECT count(DISTINCT(gym_id)) as total, ROUND(AVG(gym_points),0) as average_points FROM gym WHERE team_id = '2'"; |
|
33 | -$result = $mysqli->query($req); |
|
34 | -$data = $result->fetch_object(); |
|
32 | +$req = "SELECT count(DISTINCT(gym_id)) as total, ROUND(AVG(gym_points),0) as average_points FROM gym WHERE team_id = '2'"; |
|
33 | +$result = $mysqli->query($req); |
|
34 | +$data = $result->fetch_object(); |
|
35 | 35 | |
36 | -$gym['team']['valor']['gym_owned'] = $data->total; |
|
37 | -$gym['team']['valor']['average'] = $data->average_points; |
|
36 | +$gym['team']['valor']['gym_owned'] = $data->total; |
|
37 | +$gym['team']['valor']['average'] = $data->average_points; |
|
38 | 38 | |
39 | 39 | |
40 | 40 | // Instinct |
41 | 41 | |
42 | -$req = "SELECT count(DISTINCT(gym_id)) as total, ROUND(AVG(gym_points),0) as average_points FROM gym WHERE team_id = '3'"; |
|
43 | -$result = $mysqli->query($req); |
|
44 | -$data = $result->fetch_object(); |
|
42 | +$req = "SELECT count(DISTINCT(gym_id)) as total, ROUND(AVG(gym_points),0) as average_points FROM gym WHERE team_id = '3'"; |
|
43 | +$result = $mysqli->query($req); |
|
44 | +$data = $result->fetch_object(); |
|
45 | 45 | |
46 | -$gym['team']['instinct']['gym_owned'] = $data->total; |
|
47 | -$gym['team']['instinct']['average'] = $data->average_points; |
|
46 | +$gym['team']['instinct']['gym_owned'] = $data->total; |
|
47 | +$gym['team']['instinct']['average'] = $data->average_points; |
|
48 | 48 | |
49 | 49 | |
50 | 50 | // Add the datas in file |
51 | 51 | |
52 | -$gymsdatas[] = $gym; |
|
53 | -$json = json_encode($gymsdatas); |
|
52 | +$gymsdatas[] = $gym; |
|
53 | +$json = json_encode($gymsdatas); |
|
54 | 54 | |
55 | 55 | file_put_contents($gym_file, $json); |
@@ -17,9 +17,9 @@ discard block |
||
17 | 17 | |
18 | 18 | <div class="col-sm-1 hidden-xs"> |
19 | 19 | |
20 | - <?php if ($pokemon->id-1 > 0) { ?> |
|
20 | + <?php if ($pokemon->id - 1 > 0) { ?> |
|
21 | 21 | |
22 | - <p class="nav-links"><a href="pokemon/<?= $pokemon->id-1 ?>"><i class="fa fa-chevron-left"></i></a></p> |
|
22 | + <p class="nav-links"><a href="pokemon/<?= $pokemon->id - 1 ?>"><i class="fa fa-chevron-left"></i></a></p> |
|
23 | 23 | |
24 | 24 | <?php }?> |
25 | 25 | |
@@ -41,9 +41,9 @@ discard block |
||
41 | 41 | |
42 | 42 | <div class="col-sm-1 hidden-xs"> |
43 | 43 | |
44 | - <?php if ($pokemon->id+1 < $config->system->max_pokemon) { ?> |
|
44 | + <?php if ($pokemon->id + 1 < $config->system->max_pokemon) { ?> |
|
45 | 45 | |
46 | - <p class="nav-links"><a href="pokemon/<?= $pokemon->id+1 ?>"><i class="fa fa-chevron-right"></i></a></p> |
|
46 | + <p class="nav-links"><a href="pokemon/<?= $pokemon->id + 1 ?>"><i class="fa fa-chevron-right"></i></a></p> |
|
47 | 47 | |
48 | 48 | <?php } ?> |
49 | 49 | </div> |
@@ -116,10 +116,10 @@ discard block |
||
116 | 116 | </tr> |
117 | 117 | <tr> |
118 | 118 | <td class="col-md-8 col-xs-8"><?php if (isset($pokemon->protected_gyms)) { |
119 | - echo "<strong>" . $locales->POKEMON_GYM . $pokemon->name . "</strong> :"; |
|
119 | + echo "<strong>".$locales->POKEMON_GYM.$pokemon->name."</strong> :"; |
|
120 | 120 | } ?></td> |
121 | 121 | <td class="col-md-4 col-xs-4"><?php if (isset($pokemon->protected_gyms)) { |
122 | - echo $pokemon->protected_gyms ; |
|
122 | + echo $pokemon->protected_gyms; |
|
123 | 123 | }?></td> |
124 | 124 | </tr> |
125 | 125 | </table> |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | <tr> |
131 | 131 | <td class="col-md-8 col-xs-8"><strong><?= $locales->POKEMON_EVOLUTION ?> :</strong></td> |
132 | 132 | <td class="col-md-4 col-xs-4"><?php if (isset($pokemon->candies)) { |
133 | - echo $pokemon->candies . " ". $pokemon->candy_name . " " . $locales->POKEMON_CANDIES ; |
|
133 | + echo $pokemon->candies." ".$pokemon->candy_name." ".$locales->POKEMON_CANDIES; |
|
134 | 134 | } else { |
135 | 135 | echo $locales->POKEMON_FINAL; |
136 | 136 | } ?></td> |
@@ -57,8 +57,8 @@ |
||
57 | 57 | if ($root == $filePath) { |
58 | 58 | return ''; // installed in the root |
59 | 59 | } else { |
60 | - $subdir_path = explode('/', $filePath); |
|
61 | - $subdir = end($subdir_path); |
|
60 | + $subdir_path = explode('/', $filePath); |
|
61 | + $subdir = end($subdir_path); |
|
62 | 62 | return $subdir; |
63 | 63 | } |
64 | 64 | } |
@@ -18,19 +18,19 @@ discard block |
||
18 | 18 | $pokemon_stats['timestamp'] = $timestamp; |
19 | 19 | |
20 | 20 | |
21 | -$req = "SELECT COUNT(*) as total FROM pokemon WHERE disappear_time >= UTC_TIMESTAMP()"; |
|
22 | -$result = $mysqli->query($req); |
|
23 | -$data = $result->fetch_object(); |
|
21 | +$req = "SELECT COUNT(*) as total FROM pokemon WHERE disappear_time >= UTC_TIMESTAMP()"; |
|
22 | +$result = $mysqli->query($req); |
|
23 | +$data = $result->fetch_object(); |
|
24 | 24 | |
25 | -$pokemon_stats['pokemon_now'] = $data->total; |
|
25 | +$pokemon_stats['pokemon_now'] = $data->total; |
|
26 | 26 | |
27 | -$req = "SELECT pokemon_id FROM pokemon WHERE disappear_time >= UTC_TIMESTAMP()"; |
|
28 | -$result = $mysqli->query($req); |
|
27 | +$req = "SELECT pokemon_id FROM pokemon WHERE disappear_time >= UTC_TIMESTAMP()"; |
|
28 | +$result = $mysqli->query($req); |
|
29 | 29 | |
30 | 30 | $rarityarray = array(); |
31 | 31 | while ($data = $result->fetch_object()) { |
32 | - $poke_id = $data->pokemon_id; |
|
33 | - $rarity = $pokemons->pokemon->$poke_id->rarity; |
|
32 | + $poke_id = $data->pokemon_id; |
|
33 | + $rarity = $pokemons->pokemon->$poke_id->rarity; |
|
34 | 34 | |
35 | 35 | isset($rarityarray[$rarity]) ? $rarityarray[$rarity]++ : $rarityarray[$rarity] = 1; |
36 | 36 | } |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | |
40 | 40 | // Add the datas in file |
41 | 41 | |
42 | -$pokedatas[] = $pokemon_stats; |
|
43 | -$json = json_encode($pokedatas); |
|
42 | +$pokedatas[] = $pokemon_stats; |
|
43 | +$json = json_encode($pokedatas); |
|
44 | 44 | |
45 | 45 | file_put_contents($pokemonstats_file, $json); |
@@ -9,15 +9,15 @@ discard block |
||
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 | |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | |
26 | 26 | // Add the datas in file |
27 | 27 | |
28 | -$stopdatas[] = $pokestop; |
|
29 | -$json = json_encode($stopdatas); |
|
28 | +$stopdatas[] = $pokestop; |
|
29 | +$json = json_encode($stopdatas); |
|
30 | 30 | |
31 | 31 | file_put_contents($pokestop_file, $json); |
@@ -10,8 +10,8 @@ discard block |
||
10 | 10 | // Include & load the variables |
11 | 11 | // ############################ |
12 | 12 | |
13 | -$variables = SYS_PATH.'/core/json/variables.json'; |
|
14 | -$config = json_decode(file_get_contents($variables)); |
|
13 | +$variables = SYS_PATH.'/core/json/variables.json'; |
|
14 | +$config = json_decode(file_get_contents($variables)); |
|
15 | 15 | |
16 | 16 | |
17 | 17 | # Connect MySQL |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | $trainer_lvl = []; |
26 | 26 | # For all 3 teams |
27 | 27 | for ($teamid = 1; $teamid <= 3; $teamid++) { |
28 | - $req = "SELECT level, count(level) AS count FROM trainer WHERE team = '".$teamid."' GROUP BY level"; |
|
28 | + $req = "SELECT level, count(level) AS count FROM trainer WHERE team = '".$teamid."' GROUP BY level"; |
|
29 | 29 | if ($result = $mysqli->query($req)) { |
30 | 30 | # build level=>count array |
31 | 31 | $data = []; |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | # fill empty levels counts with 0 |
39 | 39 | for ($i = 5; $i <= 40; $i++) { |
40 | 40 | if (!isset($data[$i])) { |
41 | - $data[$i]=0; |
|
41 | + $data[$i] = 0; |
|
42 | 42 | } |
43 | 43 | } |
44 | 44 | # sort array again |
@@ -3,8 +3,8 @@ discard block |
||
3 | 3 | // This file only include other files to have only 1 entry in your crontabs. |
4 | 4 | // ------------------------------------------------------------------------ |
5 | 5 | |
6 | -$filePath = dirname(__FILE__); |
|
7 | -$config_file = $filePath.'/../../config.php'; |
|
6 | +$filePath = dirname(__FILE__); |
|
7 | +$config_file = $filePath.'/../../config.php'; |
|
8 | 8 | |
9 | 9 | include_once($config_file); |
10 | 10 | |
@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | |
16 | 16 | |
17 | 17 | # MySQL |
18 | -$mysqli = new mysqli(SYS_DB_HOST, SYS_DB_USER, SYS_DB_PSWD, SYS_DB_NAME, SYS_DB_PORT); |
|
18 | +$mysqli = new mysqli(SYS_DB_HOST, SYS_DB_USER, SYS_DB_PSWD, SYS_DB_NAME, SYS_DB_PORT); |
|
19 | 19 | |
20 | 20 | if ($mysqli->connect_error != '') { |
21 | 21 | die('MySQL connect error'); |
@@ -23,9 +23,9 @@ discard block |
||
23 | 23 | |
24 | 24 | |
25 | 25 | |
26 | -$gym_file = SYS_PATH.'/core/json/gym.stats.json'; |
|
27 | -$pokestop_file = SYS_PATH.'/core/json/pokestop.stats.json'; |
|
28 | -$pokemonstats_file = SYS_PATH.'/core/json/pokemon.stats.json'; |
|
26 | +$gym_file = SYS_PATH.'/core/json/gym.stats.json'; |
|
27 | +$pokestop_file = SYS_PATH.'/core/json/pokestop.stats.json'; |
|
28 | +$pokemonstats_file = SYS_PATH.'/core/json/pokemon.stats.json'; |
|
29 | 29 | |
30 | 30 | |
31 | 31 | if (is_file($gym_file)) { |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | $pokedatas = json_decode(file_get_contents($pokemonstats_file), true); |
39 | 39 | } |
40 | 40 | |
41 | -$timestamp = time(); |
|
41 | +$timestamp = time(); |
|
42 | 42 | |
43 | 43 | include_once(SYS_PATH.'/core/cron/gym.cron.php'); |
44 | 44 | include_once(SYS_PATH.'/core/cron/pokemon.cron.php'); |
@@ -22,11 +22,11 @@ discard block |
||
22 | 22 | { |
23 | 23 | $lock_msg = ''; |
24 | 24 | |
25 | - $mysqli = new mysqli(SYS_DB_HOST, SYS_DB_USER, SYS_DB_PSWD, SYS_DB_NAME, SYS_DB_PORT); |
|
25 | + $mysqli = new mysqli(SYS_DB_HOST, SYS_DB_USER, SYS_DB_PSWD, SYS_DB_NAME, SYS_DB_PORT); |
|
26 | 26 | |
27 | 27 | // Pokemon Test |
28 | - $req = "SELECT COUNT(*) as total FROM pokemon"; |
|
29 | - $result = $mysqli->query($req); |
|
28 | + $req = "SELECT COUNT(*) as total FROM pokemon"; |
|
29 | + $result = $mysqli->query($req); |
|
30 | 30 | |
31 | 31 | if (!is_object($result)) { |
32 | 32 | $lock_msg .= "Error: No Pokémon database found<br>"; |
@@ -40,8 +40,8 @@ discard block |
||
40 | 40 | } |
41 | 41 | |
42 | 42 | // Gym Test |
43 | - $req = "SELECT COUNT(*) as total FROM gym"; |
|
44 | - $result = $mysqli->query($req); |
|
43 | + $req = "SELECT COUNT(*) as total FROM gym"; |
|
44 | + $result = $mysqli->query($req); |
|
45 | 45 | |
46 | 46 | if (!is_object($result)) { |
47 | 47 | $lock_msg .= "Error: No Gym database found<br>"; |
@@ -56,8 +56,8 @@ discard block |
||
56 | 56 | |
57 | 57 | |
58 | 58 | // Pokéstop Test |
59 | - $req = "SELECT COUNT(*) as total FROM pokestop"; |
|
60 | - $result = $mysqli->query($req); |
|
59 | + $req = "SELECT COUNT(*) as total FROM pokestop"; |
|
60 | + $result = $mysqli->query($req); |
|
61 | 61 | |
62 | 62 | if (!is_object($result)) { |
63 | 63 | $lock_msg .= "Error: No Pokestop database found<br>"; |
@@ -5,45 +5,45 @@ 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 | - $capdatas = json_decode(file_get_contents($captcha_file), true); |
|
10 | + $capdatas = json_decode(file_get_contents($captcha_file), true); |
|
11 | 11 | } |
12 | 12 | |
13 | 13 | |
14 | 14 | $variables_secret = SYS_PATH.'/core/json/variables.secret.json'; |
15 | 15 | $config_secret = json_decode(file_get_contents($variables_secret)); |
16 | 16 | |
17 | -if ($config_secret->captcha_key=="") { |
|
17 | +if ($config_secret->captcha_key == "") { |
|
18 | 18 | $captcha['timestamp'] = $timestamp; |
19 | 19 | // get amount of accounts requiring a captcha |
20 | 20 | $req = "SELECT COUNT(*) as total " |
21 | 21 | . "FROM workerstatus WHERE `captcha` > '0' " |
22 | 22 | . "AND last_modified >= UTC_TIMESTAMP() - INTERVAL 60 SECOND"; |
23 | - $result = $mysqli->query($req); |
|
24 | - $data = $result->fetch_object(); |
|
23 | + $result = $mysqli->query($req); |
|
24 | + $data = $result->fetch_object(); |
|
25 | 25 | $captcha['captcha_accs'] = $data->total; |
26 | 26 | // Add the datas in file |
27 | - $capdatas[] = $captcha; |
|
27 | + $capdatas[] = $captcha; |
|
28 | 28 | } else { |
29 | 29 | if (!empty($capdatas)) { |
30 | 30 | $lastCaptcha = array_pop($capdatas); |
31 | 31 | } else { |
32 | - $lastCaptcha["timestamp"]=strtotime("-7 days", strtotime(date("Y-m-d"))); |
|
32 | + $lastCaptcha["timestamp"] = strtotime("-7 days", strtotime(date("Y-m-d"))); |
|
33 | 33 | } |
34 | 34 | $lastCaptchaDate = date("Y-m-d", $lastCaptcha["timestamp"]); |
35 | 35 | $startTime = strtotime($lastCaptchaDate); |
36 | - $endTime = strtotime(date("Y-m-d"))+date("Z"); |
|
36 | + $endTime = strtotime(date("Y-m-d")) + date("Z"); |
|
37 | 37 | $timeDiff = abs($endTime - $startTime); |
38 | - $numberDays = intval($timeDiff/86400) ; // 86400 seconds in one day |
|
39 | - if ($numberDays>7) { |
|
40 | - $numberDays=7; |
|
38 | + $numberDays = intval($timeDiff / 86400); // 86400 seconds in one day |
|
39 | + if ($numberDays > 7) { |
|
40 | + $numberDays = 7; |
|
41 | 41 | } |
42 | - while ($numberDays>=0) { |
|
43 | - $day = $endTime-($numberDays*86400); |
|
42 | + while ($numberDays >= 0) { |
|
43 | + $day = $endTime - ($numberDays * 86400); |
|
44 | 44 | $captchaUrl = |
45 | - "http://2captcha.com/res.php?key=" . |
|
46 | - $config_secret->captcha_key . "&action=getstats&date=" . date("Y-m-d", $day); |
|
45 | + "http://2captcha.com/res.php?key=". |
|
46 | + $config_secret->captcha_key."&action=getstats&date=".date("Y-m-d", $day); |
|
47 | 47 | |
48 | 48 | $ch = curl_init(); |
49 | 49 | curl_setopt($ch, CURLOPT_URL, $captchaUrl); |
@@ -65,18 +65,18 @@ discard block |
||
65 | 65 | $capXml = simplexml_load_string($fileContents); |
66 | 66 | |
67 | 67 | foreach ($capXml as $key => $value) { |
68 | - if ( ($numberDays==0 |
|
69 | - && ((int)$value->Attributes()->hour >= (int)date("H", $lastCaptcha["timestamp"]) |
|
70 | - && ((int)$value->Attributes()->hour <= (int)date("H"))) |
|
71 | - ) || $numberDays>0) { |
|
68 | + if (($numberDays == 0 |
|
69 | + && ((int) $value->Attributes()->hour >= (int) date("H", $lastCaptcha["timestamp"]) |
|
70 | + && ((int) $value->Attributes()->hour <= (int) date("H"))) |
|
71 | + ) || $numberDays > 0) { |
|
72 | 72 | $captcha['timestamp'] = |
73 | - strtotime(date("Y-m-d", $day) . " " . $value->Attributes()->hour . ":00")+date("Z"); |
|
74 | - $captcha['captcha_accs'] = (string)$value->volume; |
|
75 | - $capdatas[] = $captcha; |
|
73 | + strtotime(date("Y-m-d", $day)." ".$value->Attributes()->hour.":00") + date("Z"); |
|
74 | + $captcha['captcha_accs'] = (string) $value->volume; |
|
75 | + $capdatas[] = $captcha; |
|
76 | 76 | } |
77 | 77 | } |
78 | 78 | --$numberDays; |
79 | 79 | } |
80 | 80 | } |
81 | -$json = json_encode($capdatas); |
|
81 | +$json = json_encode($capdatas); |
|
82 | 82 | file_put_contents($captcha_file, $json); |