@@ -22,7 +22,7 @@ |
||
22 | 22 | $rarityarray = array(); |
23 | 23 | foreach ($counts as $poke_id => $total) { |
24 | 24 | $rarity = $pokemons->pokemon->$poke_id->rarity; |
25 | - isset($rarityarray[$rarity]) ? $rarityarray[$rarity]+=$total : $rarityarray[$rarity]=$total; |
|
25 | + isset($rarityarray[$rarity]) ? $rarityarray[$rarity] += $total : $rarityarray[$rarity] = $total; |
|
26 | 26 | } |
27 | 27 | |
28 | 28 | // Set amount of Pokemon for each rarity to 0 if there weren't any at that time |
@@ -28,7 +28,7 @@ |
||
28 | 28 | $trainer_lvl = []; |
29 | 29 | # For all 3 teams |
30 | 30 | for ($teamid = 1; $teamid <= 3; $teamid++) { |
31 | - $data = $manager->getTrainerLevelCount($teamid); |
|
31 | + $data = $manager->getTrainerLevelCount($teamid); |
|
32 | 32 | $trainer_lvl[$teamid] = $data; |
33 | 33 | } |
34 | 34 |
@@ -20,7 +20,7 @@ |
||
20 | 20 | // Load Query Manager |
21 | 21 | // ################### |
22 | 22 | |
23 | -include_once __DIR__ . '/../process/queries/QueryManager.php'; |
|
23 | +include_once __DIR__.'/../process/queries/QueryManager.php'; |
|
24 | 24 | $manager = QueryManager::current(); |
25 | 25 | |
26 | 26 | # Chart Graph datas |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | // Load Query Manager |
70 | 70 | // ################### |
71 | 71 | |
72 | -include_once __DIR__ . '/queries/QueryManager.php'; |
|
72 | +include_once __DIR__.'/queries/QueryManager.php'; |
|
73 | 73 | $manager = QueryManager::current(); |
74 | 74 | |
75 | 75 | |
@@ -268,7 +268,7 @@ discard block |
||
268 | 268 | |
269 | 269 | |
270 | 270 | // Gym owned and average points |
271 | - $data = $manager->getOwnedAndPoints($team_values->id); |
|
271 | + $data = $manager->getOwnedAndPoints($team_values->id); |
|
272 | 272 | |
273 | 273 | $teams->$team_key->gym_owned = $data->total; |
274 | 274 | $teams->$team_key->average = $data->average_points; |
@@ -3,7 +3,7 @@ |
||
3 | 3 | // Load Query Manager |
4 | 4 | // ################### |
5 | 5 | |
6 | -include_once __DIR__ . '/../core/process/queries/QueryManager.php'; |
|
6 | +include_once __DIR__.'/../core/process/queries/QueryManager.php'; |
|
7 | 7 | |
8 | 8 | |
9 | 9 | ######################################################################## |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -include_once __DIR__ . '/QueryManagerPostgresqlMonocleAlternate.php'; |
|
3 | +include_once __DIR__.'/QueryManagerPostgresqlMonocleAlternate.php'; |
|
4 | 4 | |
5 | 5 | |
6 | 6 | abstract class QueryManagerPostgresql extends QueryManager { |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | $this->db = pg_connect("host=".SYS_DB_HOST." port=".SYS_DB_PORT." dbname=".SYS_DB_NAME." user=".SYS_DB_USER." password=".SYS_DB_PSWD); |
13 | 13 | |
14 | 14 | if ($this->db === false) { |
15 | - header('Location:' . HOST_URL . 'offline.html'); |
|
15 | + header('Location:'.HOST_URL.'offline.html'); |
|
16 | 16 | exit(); |
17 | 17 | } |
18 | 18 | } |
@@ -3,11 +3,13 @@ discard block |
||
3 | 3 | include_once __DIR__ . '/QueryManagerPostgresqlMonocleAlternate.php'; |
4 | 4 | |
5 | 5 | |
6 | -abstract class QueryManagerPostgresql extends QueryManager { |
|
6 | +abstract class QueryManagerPostgresql extends QueryManager |
|
7 | +{ |
|
7 | 8 | |
8 | 9 | protected $db; |
9 | 10 | |
10 | - protected function __construct() { |
|
11 | + protected function __construct() |
|
12 | + { |
|
11 | 13 | |
12 | 14 | $this->db = pg_connect("host=".SYS_DB_HOST." port=".SYS_DB_PORT." dbname=".SYS_DB_NAME." user=".SYS_DB_USER." password=".SYS_DB_PSWD); |
13 | 15 | |
@@ -17,7 +19,8 @@ discard block |
||
17 | 19 | } |
18 | 20 | } |
19 | 21 | |
20 | - public function __destruct() { |
|
22 | + public function __destruct() |
|
23 | + { |
|
21 | 24 | pg_close($this->db); |
22 | 25 | } |
23 | 26 | |
@@ -25,7 +28,8 @@ discard block |
||
25 | 28 | // Misc |
26 | 29 | ///////// |
27 | 30 | |
28 | - public function getEcapedString($string) { |
|
31 | + public function getEcapedString($string) |
|
32 | + { |
|
29 | 33 | return pg_escape_string($this->db, $string); |
30 | 34 | } |
31 | 35 |
@@ -1,7 +1,7 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -include_once __DIR__ . '/QueryManagerMysqlRocketmap.php'; |
|
4 | -include_once __DIR__ . '/QueryManagerMysqlMonocleAlternate.php'; |
|
3 | +include_once __DIR__.'/QueryManagerMysqlRocketmap.php'; |
|
4 | +include_once __DIR__.'/QueryManagerMysqlMonocleAlternate.php'; |
|
5 | 5 | |
6 | 6 | |
7 | 7 | abstract class QueryManagerMysql extends QueryManager { |
@@ -4,11 +4,13 @@ discard block |
||
4 | 4 | include_once __DIR__ . '/QueryManagerMysqlMonocleAlternate.php'; |
5 | 5 | |
6 | 6 | |
7 | -abstract class QueryManagerMysql extends QueryManager { |
|
7 | +abstract class QueryManagerMysql extends QueryManager |
|
8 | +{ |
|
8 | 9 | |
9 | 10 | protected $mysqli; |
10 | 11 | |
11 | - protected function __construct() { |
|
12 | + protected function __construct() |
|
13 | + { |
|
12 | 14 | $this->mysqli = new mysqli(SYS_DB_HOST, SYS_DB_USER, SYS_DB_PSWD, SYS_DB_NAME, SYS_DB_PORT); |
13 | 15 | if ($this->mysqli->connect_error != '') { |
14 | 16 | header('Location:'.HOST_URL.'offline.html'); |
@@ -22,7 +24,8 @@ discard block |
||
22 | 24 | } |
23 | 25 | } |
24 | 26 | |
25 | - public function __destruct() { |
|
27 | + public function __destruct() |
|
28 | + { |
|
26 | 29 | $this->mysqli->close(); |
27 | 30 | } |
28 | 31 | |
@@ -30,7 +33,8 @@ discard block |
||
30 | 33 | // Misc |
31 | 34 | ///////// |
32 | 35 | |
33 | - public function getEcapedString($string) { |
|
36 | + public function getEcapedString($string) |
|
37 | + { |
|
34 | 38 | return mysqli_real_escape_string($this->mysqli, $string); |
35 | 39 | } |
36 | 40 |
@@ -1,8 +1,8 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -include_once __DIR__ . '/../../../config.php'; |
|
4 | -include_once __DIR__ . '/QueryManagerMysql.php'; |
|
5 | -include_once __DIR__ . '/QueryManagerPostgresql.php'; |
|
3 | +include_once __DIR__.'/../../../config.php'; |
|
4 | +include_once __DIR__.'/QueryManagerMysql.php'; |
|
5 | +include_once __DIR__.'/QueryManagerPostgresql.php'; |
|
6 | 6 | |
7 | 7 | abstract class QueryManager { |
8 | 8 | |
@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | |
16 | 16 | if (self::$current == null) { |
17 | 17 | |
18 | - $variables = realpath(dirname(__FILE__)) . '/../../json/variables.json'; |
|
18 | + $variables = realpath(dirname(__FILE__)).'/../../json/variables.json'; |
|
19 | 19 | self::$config = json_decode(file_get_contents($variables)); |
20 | 20 | |
21 | 21 | include_once(SYS_PATH.'/core/process/timezone.loader.php'); |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | } |
38 | 38 | return self::$current; |
39 | 39 | } |
40 | - private function __construct(){} |
|
40 | + private function __construct() {} |
|
41 | 41 | |
42 | 42 | // Misc |
43 | 43 | abstract public function getEcapedString($string); |
@@ -4,13 +4,15 @@ discard block |
||
4 | 4 | include_once __DIR__ . '/QueryManagerMysql.php'; |
5 | 5 | include_once __DIR__ . '/QueryManagerPostgresql.php'; |
6 | 6 | |
7 | -abstract class QueryManager { |
|
7 | +abstract class QueryManager |
|
8 | +{ |
|
8 | 9 | |
9 | 10 | protected static $time_offset; |
10 | 11 | protected static $config; |
11 | 12 | |
12 | 13 | private static $current; |
13 | - public static function current() { |
|
14 | + public static function current() |
|
15 | + { |
|
14 | 16 | global $time_offset; |
15 | 17 | |
16 | 18 | if (self::$current == null) { |
@@ -37,7 +39,9 @@ discard block |
||
37 | 39 | } |
38 | 40 | return self::$current; |
39 | 41 | } |
40 | - private function __construct(){} |
|
42 | + private function __construct() |
|
43 | + { |
|
44 | +} |
|
41 | 45 | |
42 | 46 | // Misc |
43 | 47 | abstract public function getEcapedString($string); |
@@ -17,8 +17,8 @@ |
||
17 | 17 | $nests['lng'] = $data->longitude; |
18 | 18 | $starttime = $data->latest_seen - $data->duration; |
19 | 19 | |
20 | - $nests['st'] = date("i",$starttime); |
|
21 | - $nests['et'] = date("i",$data->latest_seen); |
|
20 | + $nests['st'] = date("i", $starttime); |
|
21 | + $nests['et'] = date("i", $data->latest_seen); |
|
22 | 22 | |
23 | 23 | // Add the data to array |
24 | 24 | $nestsdatas[] = $nests; |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | // Load Query Manager |
41 | 41 | // ################### |
42 | 42 | |
43 | -include_once __DIR__ . '/queries/QueryManager.php'; |
|
43 | +include_once __DIR__.'/queries/QueryManager.php'; |
|
44 | 44 | $manager = QueryManager::current(); |
45 | 45 | |
46 | 46 | $request = ""; |
@@ -161,10 +161,10 @@ discard block |
||
161 | 161 | } |
162 | 162 | |
163 | 163 | $html = ' |
164 | - <div class="col-md-1 col-xs-4 pokemon-single" data-pokeid="' . $pokeid . '" data-pokeuid="' . $pokeuid . '" style="display: none;"> |
|
165 | - <a href="pokemon/' . $pokeid . '"><img src="' . $pokemons->pokemon->$pokeid->img . '" alt="' . $pokemons->pokemon->$pokeid->name . '" class="img-responsive"></a> |
|
166 | - <a href="pokemon/' . $pokeid . '"><p class="pkmn-name">' . $pokemons->pokemon->$pokeid->name . '</p></a> |
|
167 | - <a href="' . $location_link . '" target="_blank"> |
|
164 | + <div class="col-md-1 col-xs-4 pokemon-single" data-pokeid="' . $pokeid.'" data-pokeuid="'.$pokeuid.'" style="display: none;"> |
|
165 | + <a href="pokemon/' . $pokeid.'"><img src="'.$pokemons->pokemon->$pokeid->img.'" alt="'.$pokemons->pokemon->$pokeid->name.'" class="img-responsive"></a> |
|
166 | + <a href="pokemon/' . $pokeid.'"><p class="pkmn-name">'.$pokemons->pokemon->$pokeid->name.'</p></a> |
|
167 | + <a href="' . $location_link.'" target="_blank"> |
|
168 | 168 | <small class="pokemon-timer">00:00:00</small> |
169 | 169 | </a>'; |
170 | 170 | if ($config->system->recents_encounter_details) { |
@@ -172,50 +172,50 @@ discard block |
||
172 | 172 | if ($config->system->iv_numbers) { |
173 | 173 | $html .= ' |
174 | 174 | <div class="progress" style="height: 15px; margin-bottom: 0"> |
175 | - <div title="' . $locales->IV_ATTACK . ': ' . $encdetails->attack . '" class="progress-bar progress-bar-danger" role="progressbar" aria-valuenow="' . $encdetails->attack . '" aria-valuemin="0" aria-valuemax="45" style="width: ' . (100 / 3) . '%; line-height: 16px"> |
|
176 | - <span class="sr-only">' . $locales->IV_ATTACK . ': ' . $encdetails->attack . '</span>' . $encdetails->attack . ' |
|
175 | + <div title="' . $locales->IV_ATTACK.': '.$encdetails->attack.'" class="progress-bar progress-bar-danger" role="progressbar" aria-valuenow="'.$encdetails->attack.'" aria-valuemin="0" aria-valuemax="45" style="width: '.(100 / 3).'%; line-height: 16px"> |
|
176 | + <span class="sr-only">' . $locales->IV_ATTACK.': '.$encdetails->attack.'</span>'.$encdetails->attack.' |
|
177 | 177 | </div> |
178 | - <div title="' . $locales->IV_DEFENSE . ': ' . $encdetails->defense . '" class="progress-bar progress-bar-info" role="progressbar" aria-valuenow="' . $encdetails->defense . '" aria-valuemin="0" aria-valuemax="45" style="width: ' . (100 / 3) . '%; line-height: 16px"> |
|
179 | - <span class="sr-only">' . $locales->IV_DEFENSE . ': ' . $encdetails->defense . '</span>' . $encdetails->defense . ' |
|
178 | + <div title="' . $locales->IV_DEFENSE.': '.$encdetails->defense.'" class="progress-bar progress-bar-info" role="progressbar" aria-valuenow="'.$encdetails->defense.'" aria-valuemin="0" aria-valuemax="45" style="width: '.(100 / 3).'%; line-height: 16px"> |
|
179 | + <span class="sr-only">' . $locales->IV_DEFENSE.': '.$encdetails->defense.'</span>'.$encdetails->defense.' |
|
180 | 180 | </div> |
181 | - <div title="' . $locales->IV_STAMINA . ': ' . $encdetails->stamina . '" class="progress-bar progress-bar-success" role="progressbar" aria-valuenow="' . $encdetails->stamina . '" aria-valuemin="0" aria-valuemax="45" style="width: ' . (100 / 3) . '%; line-height: 16px"> |
|
182 | - <span class="sr-only">' . $locales->IV_STAMINA . ': ' . $encdetails->stamina . '</span>' . $encdetails->stamina . ' |
|
181 | + <div title="' . $locales->IV_STAMINA.': '.$encdetails->stamina.'" class="progress-bar progress-bar-success" role="progressbar" aria-valuenow="'.$encdetails->stamina.'" aria-valuemin="0" aria-valuemax="45" style="width: '.(100 / 3).'%; line-height: 16px"> |
|
182 | + <span class="sr-only">' . $locales->IV_STAMINA.': '.$encdetails->stamina.'</span>'.$encdetails->stamina.' |
|
183 | 183 | </div> |
184 | 184 | </div>'; |
185 | 185 | } else { |
186 | 186 | $html .= ' |
187 | 187 | <div class="progress" style="height: 6px; width: 80%; margin: 5px auto 0 auto"> |
188 | - <div title="' . $locales->IV_ATTACK . ': ' . $encdetails->attack . '" class="progress-bar progress-bar-danger" role="progressbar" aria-valuenow="' . $encdetails->attack . '" aria-valuemin="0" aria-valuemax="45" style="width: ' . (((100 / 15) * $encdetails->attack) / 3) . '%"> |
|
189 | - <span class="sr-only">' . $locales->IV_ATTACK . ': ' . $encdetails->attack . '</span> |
|
188 | + <div title="' . $locales->IV_ATTACK.': '.$encdetails->attack.'" class="progress-bar progress-bar-danger" role="progressbar" aria-valuenow="'.$encdetails->attack.'" aria-valuemin="0" aria-valuemax="45" style="width: '.(((100 / 15) * $encdetails->attack) / 3).'%"> |
|
189 | + <span class="sr-only">' . $locales->IV_ATTACK.': '.$encdetails->attack.'</span> |
|
190 | 190 | </div> |
191 | - <div title="' . $locales->IV_DEFENSE . ': ' . $encdetails->defense . '" class="progress-bar progress-bar-info" role="progressbar" aria-valuenow="' . $encdetails->defense . '" aria-valuemin="0" aria-valuemax="45" style="width: ' . (((100 / 15) * $encdetails->defense) / 3) . '%"> |
|
192 | - <span class="sr-only">' . $locales->IV_DEFENSE . ': ' . $encdetails->defense . '</span> |
|
191 | + <div title="' . $locales->IV_DEFENSE.': '.$encdetails->defense.'" class="progress-bar progress-bar-info" role="progressbar" aria-valuenow="'.$encdetails->defense.'" aria-valuemin="0" aria-valuemax="45" style="width: '.(((100 / 15) * $encdetails->defense) / 3).'%"> |
|
192 | + <span class="sr-only">' . $locales->IV_DEFENSE.': '.$encdetails->defense.'</span> |
|
193 | 193 | </div> |
194 | - <div title="' . $locales->IV_STAMINA . ': ' . $encdetails->stamina . '" class="progress-bar progress-bar-success" role="progressbar" aria-valuenow="' . $encdetails->stamina . '" aria-valuemin="0" aria-valuemax="45" style="width: ' . (((100 / 15) * $encdetails->stamina) / 3) . '%"> |
|
195 | - <span class="sr-only">' . $locales->IV_STAMINA . ': ' . $encdetails->stamina . '</span> |
|
194 | + <div title="' . $locales->IV_STAMINA.': '.$encdetails->stamina.'" class="progress-bar progress-bar-success" role="progressbar" aria-valuenow="'.$encdetails->stamina.'" aria-valuemin="0" aria-valuemax="45" style="width: '.(((100 / 15) * $encdetails->stamina) / 3).'%"> |
|
195 | + <span class="sr-only">' . $locales->IV_STAMINA.': '.$encdetails->stamina.'</span> |
|
196 | 196 | </div> |
197 | 197 | </div>'; |
198 | 198 | } |
199 | - $html .= '<small>' . $encdetails->cp . '</small>'; |
|
199 | + $html .= '<small>'.$encdetails->cp.'</small>'; |
|
200 | 200 | } else { |
201 | 201 | if ($config->system->iv_numbers) { |
202 | 202 | $html .= ' |
203 | 203 | <div class="progress" style="height: 15px; margin-bottom: 0"> |
204 | - <div title="' . $locales->IV_ATTACK . ': not available" class="progress-bar progress-bar-danger" role="progressbar" aria-valuenow="' . $encdetails->attack . '" aria-valuemin="0" aria-valuemax="45" style="width: ' . (100 / 3) . '%; line-height: 16px"> |
|
205 | - <span class="sr-only">' . $locales->IV_ATTACK . ': ' . $locales->NOT_AVAILABLE . '</span>? |
|
204 | + <div title="' . $locales->IV_ATTACK.': not available" class="progress-bar progress-bar-danger" role="progressbar" aria-valuenow="'.$encdetails->attack.'" aria-valuemin="0" aria-valuemax="45" style="width: '.(100 / 3).'%; line-height: 16px"> |
|
205 | + <span class="sr-only">' . $locales->IV_ATTACK.': '.$locales->NOT_AVAILABLE.'</span>? |
|
206 | 206 | </div> |
207 | - <div title="' . $locales->IV_DEFENSE . ': not available" class="progress-bar progress-bar-info" role="progressbar" aria-valuenow="' . $encdetails->defense . '" aria-valuemin="0" aria-valuemax="45" style="width: ' . (100 / 3) . '%; line-height: 16px"> |
|
208 | - <span class="sr-only">' . $locales->IV_DEFENSE . ': ' . $locales->NOT_AVAILABLE . '</span>? |
|
207 | + <div title="' . $locales->IV_DEFENSE.': not available" class="progress-bar progress-bar-info" role="progressbar" aria-valuenow="'.$encdetails->defense.'" aria-valuemin="0" aria-valuemax="45" style="width: '.(100 / 3).'%; line-height: 16px"> |
|
208 | + <span class="sr-only">' . $locales->IV_DEFENSE.': '.$locales->NOT_AVAILABLE.'</span>? |
|
209 | 209 | </div> |
210 | - <div title="' . $locales->IV_STAMINA . ': not available" class="progress-bar progress-bar-success" role="progressbar" aria-valuenow="' . $encdetails->stamina . '" aria-valuemin="0" aria-valuemax="45" style="width: ' . (100 / 3) . '%; line-height: 16px"> |
|
211 | - <span class="sr-only">' . $locales->IV_STAMINA . ': ' . $locales->NOT_AVAILABLE . '</span>? |
|
210 | + <div title="' . $locales->IV_STAMINA.': not available" class="progress-bar progress-bar-success" role="progressbar" aria-valuenow="'.$encdetails->stamina.'" aria-valuemin="0" aria-valuemax="45" style="width: '.(100 / 3).'%; line-height: 16px"> |
|
211 | + <span class="sr-only">' . $locales->IV_STAMINA.': '.$locales->NOT_AVAILABLE.'</span>? |
|
212 | 212 | </div> |
213 | 213 | </div>'; |
214 | 214 | } else { |
215 | 215 | $html .= ' |
216 | 216 | <div class="progress" style="height: 6px; width: 80%; margin: 5px auto 0 auto"> |
217 | 217 | <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"> |
218 | - <span class="sr-only">IV ' . $locales->NOT_AVAILABLE . '</span> |
|
218 | + <span class="sr-only">IV ' . $locales->NOT_AVAILABLE.'</span> |
|
219 | 219 | </div> |
220 | 220 | </div>'; |
221 | 221 | } |
@@ -291,7 +291,7 @@ discard block |
||
291 | 291 | |
292 | 292 | foreach ($teams as $team_name => $team_id) { |
293 | 293 | |
294 | - $data = $manager->getOwnedAndPoints($team_id); |
|
294 | + $data = $manager->getOwnedAndPoints($team_id); |
|
295 | 295 | |
296 | 296 | $return[] = $data->total; |
297 | 297 | $return[] = $data->average_points; |
@@ -414,38 +414,38 @@ discard block |
||
414 | 414 | if ($config->system->iv_numbers) { |
415 | 415 | $gymData['infoWindow'] .= ' |
416 | 416 | <div style="text-align: center; width: 50px; display: inline-block; margin-right: 3px"> |
417 | - <a href="pokemon/' . $data->pokemon_id . '"> |
|
418 | - <img src="' . $pokemons->pokemon->$pokemon_id->img . '" height="50" style="display:inline-block" > |
|
417 | + <a href="pokemon/' . $data->pokemon_id.'"> |
|
418 | + <img src="' . $pokemons->pokemon->$pokemon_id->img.'" height="50" style="display:inline-block" > |
|
419 | 419 | </a> |
420 | - <p class="pkmn-name">' . $data->cp . '</p> |
|
420 | + <p class="pkmn-name">' . $data->cp.'</p> |
|
421 | 421 | <div class="progress" style="height: 12px; margin-bottom: 0"> |
422 | - <div title="' . $locales->IV_ATTACK . ': ' . $data->iv_attack . '" class="progress-bar progress-bar-danger" role="progressbar" aria-valuenow="' . $data->iv_attack . '" aria-valuemin="0" aria-valuemax="45" style="width: ' . (100 / 3) . '%; line-height: 13px; font-size: 11px"> |
|
423 | - <span class="sr-only">' . $locales->IV_ATTACK . ' : ' . $data->iv_attack . '</span>' . $data->iv_attack . ' |
|
422 | + <div title="' . $locales->IV_ATTACK.': '.$data->iv_attack.'" class="progress-bar progress-bar-danger" role="progressbar" aria-valuenow="'.$data->iv_attack.'" aria-valuemin="0" aria-valuemax="45" style="width: '.(100 / 3).'%; line-height: 13px; font-size: 11px"> |
|
423 | + <span class="sr-only">' . $locales->IV_ATTACK.' : '.$data->iv_attack.'</span>'.$data->iv_attack.' |
|
424 | 424 | </div> |
425 | - <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"> |
|
426 | - <span class="sr-only">' . $locales->IV_DEFENSE . ' : ' . $data->iv_defense . '</span>' . $data->iv_defense . ' |
|
425 | + <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"> |
|
426 | + <span class="sr-only">' . $locales->IV_DEFENSE.' : '.$data->iv_defense.'</span>'.$data->iv_defense.' |
|
427 | 427 | </div> |
428 | - <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"> |
|
429 | - <span class="sr-only">' . $locales->IV_STAMINA . ' : ' . $data->iv_stamina . '</span>' . $data->iv_stamina . ' |
|
428 | + <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"> |
|
429 | + <span class="sr-only">' . $locales->IV_STAMINA.' : '.$data->iv_stamina.'</span>'.$data->iv_stamina.' |
|
430 | 430 | </div> |
431 | 431 | </div> |
432 | 432 | </div>'; |
433 | 433 | } else { |
434 | 434 | $gymData['infoWindow'] .= ' |
435 | 435 | <div style="text-align: center; width: 50px; display: inline-block; margin-right: 3px"> |
436 | - <a href="pokemon/' . $data->pokemon_id . '"> |
|
437 | - <img src="' . $pokemons->pokemon->$pokemon_id->img . '" height="50" style="display:inline-block" > |
|
436 | + <a href="pokemon/' . $data->pokemon_id.'"> |
|
437 | + <img src="' . $pokemons->pokemon->$pokemon_id->img.'" height="50" style="display:inline-block" > |
|
438 | 438 | </a> |
439 | - <p class="pkmn-name">' . $data->cp . '</p> |
|
439 | + <p class="pkmn-name">' . $data->cp.'</p> |
|
440 | 440 | <div class="progress" style="height: 4px; width: 40px; margin-bottom: 10px; margin-top: 2px; margin-left: auto; margin-right: auto"> |
441 | - <div title="' . $locales->IV_ATTACK . ': ' . $data->iv_attack . '" class="progress-bar progress-bar-danger" role="progressbar" aria-valuenow="' . $data->iv_attack . '" aria-valuemin="0" aria-valuemax="45" style="width: ' . (((100 / 15) * $data->iv_attack) / 3) . '%"> |
|
442 | - <span class="sr-only">' . $locales->IV_ATTACK . ': ' . $data->iv_attack . '</span> |
|
441 | + <div title="' . $locales->IV_ATTACK.': '.$data->iv_attack.'" class="progress-bar progress-bar-danger" role="progressbar" aria-valuenow="'.$data->iv_attack.'" aria-valuemin="0" aria-valuemax="45" style="width: '.(((100 / 15) * $data->iv_attack) / 3).'%"> |
|
442 | + <span class="sr-only">' . $locales->IV_ATTACK.': '.$data->iv_attack.'</span> |
|
443 | 443 | </div> |
444 | - <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 / 15) * $data->iv_defense) / 3) . '%"> |
|
445 | - <span class="sr-only">' . $locales->IV_DEFENSE . ': ' . $data->iv_defense . '</span> |
|
444 | + <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 / 15) * $data->iv_defense) / 3).'%"> |
|
445 | + <span class="sr-only">' . $locales->IV_DEFENSE.': '.$data->iv_defense.'</span> |
|
446 | 446 | </div> |
447 | - <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 / 15) * $data->iv_stamina) / 3) . '%"> |
|
448 | - <span class="sr-only">' . $locales->IV_STAMINA . ': ' . $data->iv_stamina . '</span> |
|
447 | + <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 / 15) * $data->iv_stamina) / 3).'%"> |
|
448 | + <span class="sr-only">' . $locales->IV_STAMINA.': '.$data->iv_stamina.'</span> |
|
449 | 449 | </div> |
450 | 450 | </div> |
451 | 451 | </div>'; |
@@ -523,7 +523,7 @@ discard block |
||
523 | 523 | } else { |
524 | 524 | $data->charge_move = "?"; |
525 | 525 | } |
526 | - $raids[10*$page + $i] = $data; |
|
526 | + $raids[10 * $page + $i] = $data; |
|
527 | 527 | $i++; |
528 | 528 | } |
529 | 529 | $json = array(); |
@@ -611,7 +611,7 @@ discard block |
||
611 | 611 | $entry->total_cp_diff = 0; |
612 | 612 | $entry->only_cp_changed = true; |
613 | 613 | if ($idx < count($entries) - 1) { |
614 | - $next_entry = $entries[$idx+1]; |
|
614 | + $next_entry = $entries[$idx + 1]; |
|
615 | 615 | $entry->total_cp_diff = $entry->total_cp - $next_entry->total_cp; |
616 | 616 | $entry->class = $entry->total_cp_diff > 0 ? 'gain' : ($entry->total_cp_diff < 0 ? 'loss' : ''); |
617 | 617 | $entry_pokemon = preg_split('/,/', $entry->pokemon_uids, null, PREG_SPLIT_NO_EMPTY); |
@@ -624,7 +624,7 @@ discard block |
||
624 | 624 | foreach ($old_pokemon as $pkm) { |
625 | 625 | $next_entry->pokemon[$pkm]->class = 'old'; |
626 | 626 | } |
627 | - if ($entry->team_id != $next_entry->team_id|| $entry->pokemon_uids != $next_entry->pokemon_uids) { |
|
627 | + if ($entry->team_id != $next_entry->team_id || $entry->pokemon_uids != $next_entry->pokemon_uids) { |
|
628 | 628 | $entry->only_cp_changed = false; |
629 | 629 | } |
630 | 630 | } |
@@ -646,7 +646,7 @@ discard block |
||
646 | 646 | |
647 | 647 | |
648 | 648 | case 'pokemon_slider_init': |
649 | - $bounds = $manager->getPokemonSliderMinMax(); |
|
649 | + $bounds = $manager->getPokemonSliderMinMax(); |
|
650 | 650 | |
651 | 651 | header('Content-Type: application/json'); |
652 | 652 | echo json_encode($bounds); |
@@ -59,118 +59,118 @@ discard block |
||
59 | 59 | // |
60 | 60 | ############################ |
61 | 61 | |
62 | - case 'home_update': |
|
63 | - $values = []; |
|
64 | - // Right now |
|
65 | - // --------- |
|
66 | - $data = $manager->getTotalPokemon(); |
|
67 | - $values[] = $data->total; |
|
62 | + case 'home_update': |
|
63 | + $values = []; |
|
64 | + // Right now |
|
65 | + // --------- |
|
66 | + $data = $manager->getTotalPokemon(); |
|
67 | + $values[] = $data->total; |
|
68 | 68 | |
69 | - // Lured stops |
|
70 | - // ----------- |
|
71 | - $data = $manager->getTotalLures(); |
|
72 | - $values[] = $data->total; |
|
69 | + // Lured stops |
|
70 | + // ----------- |
|
71 | + $data = $manager->getTotalLures(); |
|
72 | + $values[] = $data->total; |
|
73 | 73 | |
74 | - // Active Raids |
|
75 | - // ----------- |
|
76 | - $data = $manager->getTotalRaids(); |
|
77 | - $values[] = $data->total; |
|
74 | + // Active Raids |
|
75 | + // ----------- |
|
76 | + $data = $manager->getTotalRaids(); |
|
77 | + $values[] = $data->total; |
|
78 | 78 | |
79 | - // Team battle |
|
80 | - // ----------- |
|
81 | - $data = $manager->getTotalGyms(); |
|
82 | - $values[] = $data->total; |
|
79 | + // Team battle |
|
80 | + // ----------- |
|
81 | + $data = $manager->getTotalGyms(); |
|
82 | + $values[] = $data->total; |
|
83 | 83 | |
84 | - // Red |
|
85 | - $data = $manager->getTotalGymsForTeam(2); |
|
86 | - $values[] = $data->total; |
|
84 | + // Red |
|
85 | + $data = $manager->getTotalGymsForTeam(2); |
|
86 | + $values[] = $data->total; |
|
87 | 87 | |
88 | - // Blue |
|
89 | - $data = $manager->getTotalGymsForTeam(1); |
|
90 | - $values[] = $data->total; |
|
88 | + // Blue |
|
89 | + $data = $manager->getTotalGymsForTeam(1); |
|
90 | + $values[] = $data->total; |
|
91 | 91 | |
92 | - // Yellow |
|
93 | - $data = $manager->getTotalGymsForTeam(3); |
|
94 | - $values[] = $data->total; |
|
92 | + // Yellow |
|
93 | + $data = $manager->getTotalGymsForTeam(3); |
|
94 | + $values[] = $data->total; |
|
95 | 95 | |
96 | - // Neutral |
|
97 | - $data = $manager->getTotalGymsForTeam(0); |
|
98 | - $values[] = $data->total; |
|
96 | + // Neutral |
|
97 | + $data = $manager->getTotalGymsForTeam(0); |
|
98 | + $values[] = $data->total; |
|
99 | 99 | |
100 | 100 | |
101 | - header('Content-Type: application/json'); |
|
102 | - echo json_encode($values); |
|
101 | + header('Content-Type: application/json'); |
|
102 | + echo json_encode($values); |
|
103 | 103 | |
104 | - break; |
|
104 | + break; |
|
105 | 105 | |
106 | 106 | |
107 | - #################################### |
|
108 | - // |
|
109 | - // Update latests spawn on homepage |
|
110 | - // |
|
111 | - #################################### |
|
107 | + #################################### |
|
108 | + // |
|
109 | + // Update latests spawn on homepage |
|
110 | + // |
|
111 | + #################################### |
|
112 | 112 | |
113 | - case 'spawnlist_update': |
|
114 | - // Recent spawn |
|
115 | - // ------------ |
|
116 | - $total_spawns = array(); |
|
117 | - $last_uid_param = ""; |
|
118 | - if (isset($_GET['last_uid'])) { |
|
119 | - $last_uid_param = $_GET['last_uid']; |
|
120 | - } |
|
121 | - if ($config->system->recents_filter) { |
|
122 | - // get all mythic pokemon ids |
|
123 | - $mythic_pokemons = array(); |
|
124 | - foreach ($pokemons->pokemon as $id => $pokemon) { |
|
125 | - if ($pokemon->spawn_rate < $config->system->recents_filter_rarity && $pokemon->rating >= $config->system->recents_filter_rating) { |
|
126 | - $mythic_pokemons[] = $id; |
|
127 | - } |
|
113 | + case 'spawnlist_update': |
|
114 | + // Recent spawn |
|
115 | + // ------------ |
|
116 | + $total_spawns = array(); |
|
117 | + $last_uid_param = ""; |
|
118 | + if (isset($_GET['last_uid'])) { |
|
119 | + $last_uid_param = $_GET['last_uid']; |
|
128 | 120 | } |
121 | + if ($config->system->recents_filter) { |
|
122 | + // get all mythic pokemon ids |
|
123 | + $mythic_pokemons = array(); |
|
124 | + foreach ($pokemons->pokemon as $id => $pokemon) { |
|
125 | + if ($pokemon->spawn_rate < $config->system->recents_filter_rarity && $pokemon->rating >= $config->system->recents_filter_rating) { |
|
126 | + $mythic_pokemons[] = $id; |
|
127 | + } |
|
128 | + } |
|
129 | 129 | |
130 | - // get last mythic pokemon |
|
131 | - $result = $manager->getRecentMythic($mythic_pokemons); |
|
132 | - } else { |
|
133 | - // get last pokemon |
|
134 | - $result = $manager->getRecentAll(); |
|
135 | - } |
|
130 | + // get last mythic pokemon |
|
131 | + $result = $manager->getRecentMythic($mythic_pokemons); |
|
132 | + } else { |
|
133 | + // get last pokemon |
|
134 | + $result = $manager->getRecentAll(); |
|
135 | + } |
|
136 | 136 | |
137 | - if (count($result) > 0) { |
|
138 | - foreach ($result as $data) { |
|
139 | - $new_spawn = array(); |
|
140 | - $pokeid = $data->pokemon_id; |
|
141 | - $pokeuid = $data->encounter_id; |
|
142 | - |
|
143 | - if ($last_uid_param != $pokeuid) { |
|
144 | - $last_seen = strtotime($data->disappear_time_real); |
|
145 | - |
|
146 | - $location_link = isset($config->system->location_url) ? $config->system->location_url : 'https://maps.google.com/?q={latitude},{longitude}&ll={latitude},{longitude}&z=16'; |
|
147 | - $location_link = str_replace('{latitude}', $data->latitude, $location_link); |
|
148 | - $location_link = str_replace('{longitude}', $data->longitude, $location_link); |
|
149 | - |
|
150 | - if ($config->system->recents_encounter_details) { |
|
151 | - $encdetails = new stdClass(); |
|
152 | - $encdetails->cp = $data->cp; |
|
153 | - $encdetails->attack = $data->individual_attack; |
|
154 | - $encdetails->defense = $data->individual_defense; |
|
155 | - $encdetails->stamina = $data->individual_stamina; |
|
156 | - if (isset($encdetails->cp) && isset($encdetails->attack) && isset($encdetails->defense) && isset($encdetails->stamina)) { |
|
157 | - $encdetails->available = true; |
|
158 | - } else { |
|
159 | - $encdetails->available = false; |
|
137 | + if (count($result) > 0) { |
|
138 | + foreach ($result as $data) { |
|
139 | + $new_spawn = array(); |
|
140 | + $pokeid = $data->pokemon_id; |
|
141 | + $pokeuid = $data->encounter_id; |
|
142 | + |
|
143 | + if ($last_uid_param != $pokeuid) { |
|
144 | + $last_seen = strtotime($data->disappear_time_real); |
|
145 | + |
|
146 | + $location_link = isset($config->system->location_url) ? $config->system->location_url : 'https://maps.google.com/?q={latitude},{longitude}&ll={latitude},{longitude}&z=16'; |
|
147 | + $location_link = str_replace('{latitude}', $data->latitude, $location_link); |
|
148 | + $location_link = str_replace('{longitude}', $data->longitude, $location_link); |
|
149 | + |
|
150 | + if ($config->system->recents_encounter_details) { |
|
151 | + $encdetails = new stdClass(); |
|
152 | + $encdetails->cp = $data->cp; |
|
153 | + $encdetails->attack = $data->individual_attack; |
|
154 | + $encdetails->defense = $data->individual_defense; |
|
155 | + $encdetails->stamina = $data->individual_stamina; |
|
156 | + if (isset($encdetails->cp) && isset($encdetails->attack) && isset($encdetails->defense) && isset($encdetails->stamina)) { |
|
157 | + $encdetails->available = true; |
|
158 | + } else { |
|
159 | + $encdetails->available = false; |
|
160 | + } |
|
160 | 161 | } |
161 | - } |
|
162 | 162 | |
163 | - $html = ' |
|
163 | + $html = ' |
|
164 | 164 | <div class="col-md-1 col-xs-4 pokemon-single" data-pokeid="' . $pokeid . '" data-pokeuid="' . $pokeuid . '" style="display: none;"> |
165 | 165 | <a href="pokemon/' . $pokeid . '"><img src="' . $pokemons->pokemon->$pokeid->img . '" alt="' . $pokemons->pokemon->$pokeid->name . '" class="img-responsive"></a> |
166 | 166 | <a href="pokemon/' . $pokeid . '"><p class="pkmn-name">' . $pokemons->pokemon->$pokeid->name . '</p></a> |
167 | 167 | <a href="' . $location_link . '" target="_blank"> |
168 | 168 | <small class="pokemon-timer">00:00:00</small> |
169 | 169 | </a>'; |
170 | - if ($config->system->recents_encounter_details) { |
|
171 | - if ($encdetails->available) { |
|
172 | - if ($config->system->iv_numbers) { |
|
173 | - $html .= ' |
|
170 | + if ($config->system->recents_encounter_details) { |
|
171 | + if ($encdetails->available) { |
|
172 | + if ($config->system->iv_numbers) { |
|
173 | + $html .= ' |
|
174 | 174 | <div class="progress" style="height: 15px; margin-bottom: 0"> |
175 | 175 | <div title="' . $locales->IV_ATTACK . ': ' . $encdetails->attack . '" class="progress-bar progress-bar-danger" role="progressbar" aria-valuenow="' . $encdetails->attack . '" aria-valuemin="0" aria-valuemax="45" style="width: ' . (100 / 3) . '%; line-height: 16px"> |
176 | 176 | <span class="sr-only">' . $locales->IV_ATTACK . ': ' . $encdetails->attack . '</span>' . $encdetails->attack . ' |
@@ -182,8 +182,8 @@ discard block |
||
182 | 182 | <span class="sr-only">' . $locales->IV_STAMINA . ': ' . $encdetails->stamina . '</span>' . $encdetails->stamina . ' |
183 | 183 | </div> |
184 | 184 | </div>'; |
185 | - } else { |
|
186 | - $html .= ' |
|
185 | + } else { |
|
186 | + $html .= ' |
|
187 | 187 | <div class="progress" style="height: 6px; width: 80%; margin: 5px auto 0 auto"> |
188 | 188 | <div title="' . $locales->IV_ATTACK . ': ' . $encdetails->attack . '" class="progress-bar progress-bar-danger" role="progressbar" aria-valuenow="' . $encdetails->attack . '" aria-valuemin="0" aria-valuemax="45" style="width: ' . (((100 / 15) * $encdetails->attack) / 3) . '%"> |
189 | 189 | <span class="sr-only">' . $locales->IV_ATTACK . ': ' . $encdetails->attack . '</span> |
@@ -195,11 +195,11 @@ discard block |
||
195 | 195 | <span class="sr-only">' . $locales->IV_STAMINA . ': ' . $encdetails->stamina . '</span> |
196 | 196 | </div> |
197 | 197 | </div>'; |
198 | - } |
|
199 | - $html .= '<small>' . $encdetails->cp . '</small>'; |
|
200 | - } else { |
|
201 | - if ($config->system->iv_numbers) { |
|
202 | - $html .= ' |
|
198 | + } |
|
199 | + $html .= '<small>' . $encdetails->cp . '</small>'; |
|
200 | + } else { |
|
201 | + if ($config->system->iv_numbers) { |
|
202 | + $html .= ' |
|
203 | 203 | <div class="progress" style="height: 15px; margin-bottom: 0"> |
204 | 204 | <div title="' . $locales->IV_ATTACK . ': not available" class="progress-bar progress-bar-danger" role="progressbar" aria-valuenow="' . $encdetails->attack . '" aria-valuemin="0" aria-valuemax="45" style="width: ' . (100 / 3) . '%; line-height: 16px"> |
205 | 205 | <span class="sr-only">' . $locales->IV_ATTACK . ': ' . $locales->NOT_AVAILABLE . '</span>? |
@@ -211,116 +211,116 @@ discard block |
||
211 | 211 | <span class="sr-only">' . $locales->IV_STAMINA . ': ' . $locales->NOT_AVAILABLE . '</span>? |
212 | 212 | </div> |
213 | 213 | </div>'; |
214 | - } else { |
|
215 | - $html .= ' |
|
214 | + } else { |
|
215 | + $html .= ' |
|
216 | 216 | <div class="progress" style="height: 6px; width: 80%; margin: 5px auto 0 auto"> |
217 | 217 | <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"> |
218 | 218 | <span class="sr-only">IV ' . $locales->NOT_AVAILABLE . '</span> |
219 | 219 | </div> |
220 | 220 | </div>'; |
221 | + } |
|
222 | + $html .= '<small>???</small>'; |
|
221 | 223 | } |
222 | - $html .= '<small>???</small>'; |
|
223 | 224 | } |
224 | - } |
|
225 | - $html .= ' |
|
225 | + $html .= ' |
|
226 | 226 | </div>'; |
227 | - $new_spawn['html'] = $html; |
|
228 | - $countdown = $last_seen - time(); |
|
229 | - $new_spawn['countdown'] = $countdown; |
|
230 | - $new_spawn['pokemon_uid'] = $pokeuid; |
|
231 | - $total_spawns[] = $new_spawn; |
|
232 | - } else { |
|
233 | - break; |
|
227 | + $new_spawn['html'] = $html; |
|
228 | + $countdown = $last_seen - time(); |
|
229 | + $new_spawn['countdown'] = $countdown; |
|
230 | + $new_spawn['pokemon_uid'] = $pokeuid; |
|
231 | + $total_spawns[] = $new_spawn; |
|
232 | + } else { |
|
233 | + break; |
|
234 | + } |
|
234 | 235 | } |
235 | 236 | } |
236 | - } |
|
237 | 237 | |
238 | - header('Content-Type: application/json'); |
|
239 | - echo json_encode($total_spawns); |
|
238 | + header('Content-Type: application/json'); |
|
239 | + echo json_encode($total_spawns); |
|
240 | 240 | |
241 | - break; |
|
241 | + break; |
|
242 | 242 | |
243 | 243 | |
244 | - #################################### |
|
245 | - // |
|
246 | - // List Pokestop |
|
247 | - // |
|
248 | - #################################### |
|
244 | + #################################### |
|
245 | + // |
|
246 | + // List Pokestop |
|
247 | + // |
|
248 | + #################################### |
|
249 | 249 | |
250 | - case 'pokestop': |
|
251 | - $datas = $manager->getAllPokestops(); |
|
250 | + case 'pokestop': |
|
251 | + $datas = $manager->getAllPokestops(); |
|
252 | 252 | |
253 | - $pokestops = []; |
|
254 | - foreach ($datas as $data) { |
|
255 | - if ($data->lure_expiration >= $data->now) { |
|
256 | - $icon = 'pokestap_lured.png'; |
|
257 | - $text = sprintf($locales->POKESTOPS_MAP_LURED, date('H:i:s', strtotime($data->lure_expiration_real))); |
|
258 | - $lured = true; |
|
259 | - } else { |
|
260 | - $icon = 'pokestap.png'; |
|
261 | - $text = $locales->POKESTOPS_MAP_REGULAR; |
|
262 | - $lured = false; |
|
263 | - } |
|
253 | + $pokestops = []; |
|
254 | + foreach ($datas as $data) { |
|
255 | + if ($data->lure_expiration >= $data->now) { |
|
256 | + $icon = 'pokestap_lured.png'; |
|
257 | + $text = sprintf($locales->POKESTOPS_MAP_LURED, date('H:i:s', strtotime($data->lure_expiration_real))); |
|
258 | + $lured = true; |
|
259 | + } else { |
|
260 | + $icon = 'pokestap.png'; |
|
261 | + $text = $locales->POKESTOPS_MAP_REGULAR; |
|
262 | + $lured = false; |
|
263 | + } |
|
264 | 264 | |
265 | - $pokestops[] = [ |
|
266 | - $text, |
|
267 | - $icon, |
|
268 | - $data->latitude, |
|
269 | - $data->longitude, |
|
270 | - $lured |
|
271 | - ]; |
|
272 | - } |
|
265 | + $pokestops[] = [ |
|
266 | + $text, |
|
267 | + $icon, |
|
268 | + $data->latitude, |
|
269 | + $data->longitude, |
|
270 | + $lured |
|
271 | + ]; |
|
272 | + } |
|
273 | 273 | |
274 | - header('Content-Type: application/json'); |
|
275 | - echo json_encode($pokestops); |
|
274 | + header('Content-Type: application/json'); |
|
275 | + echo json_encode($pokestops); |
|
276 | 276 | |
277 | - break; |
|
277 | + break; |
|
278 | 278 | |
279 | 279 | |
280 | - #################################### |
|
281 | - // |
|
282 | - // Update data for the gym battle |
|
283 | - // |
|
284 | - #################################### |
|
280 | + #################################### |
|
281 | + // |
|
282 | + // Update data for the gym battle |
|
283 | + // |
|
284 | + #################################### |
|
285 | 285 | |
286 | - case 'update_gym': |
|
287 | - $teams = new stdClass(); |
|
288 | - $teams->mystic = 1; |
|
289 | - $teams->valor = 2; |
|
290 | - $teams->instinct = 3; |
|
286 | + case 'update_gym': |
|
287 | + $teams = new stdClass(); |
|
288 | + $teams->mystic = 1; |
|
289 | + $teams->valor = 2; |
|
290 | + $teams->instinct = 3; |
|
291 | 291 | |
292 | - foreach ($teams as $team_name => $team_id) { |
|
292 | + foreach ($teams as $team_name => $team_id) { |
|
293 | 293 | |
294 | - $data = $manager->getOwnedAndPoints($team_id); |
|
294 | + $data = $manager->getOwnedAndPoints($team_id); |
|
295 | 295 | |
296 | - $return[] = $data->total; |
|
297 | - $return[] = $data->average_points; |
|
298 | - } |
|
296 | + $return[] = $data->total; |
|
297 | + $return[] = $data->average_points; |
|
298 | + } |
|
299 | 299 | |
300 | - header('Content-Type: application/json'); |
|
301 | - echo json_encode($return); |
|
300 | + header('Content-Type: application/json'); |
|
301 | + echo json_encode($return); |
|
302 | 302 | |
303 | - break; |
|
303 | + break; |
|
304 | 304 | |
305 | 305 | |
306 | - #################################### |
|
307 | - // |
|
308 | - // Get datas for the gym map |
|
309 | - // |
|
310 | - #################################### |
|
306 | + #################################### |
|
307 | + // |
|
308 | + // Get datas for the gym map |
|
309 | + // |
|
310 | + #################################### |
|
311 | 311 | |
312 | 312 | |
313 | - case 'gym_map': |
|
314 | - $datas = $manager->getAllGyms(); |
|
313 | + case 'gym_map': |
|
314 | + $datas = $manager->getAllGyms(); |
|
315 | 315 | |
316 | - $gyms = []; |
|
317 | - foreach ($datas as $data) { |
|
318 | - // Team |
|
319 | - // 1 = bleu |
|
320 | - // 2 = rouge |
|
321 | - // 3 = jaune |
|
316 | + $gyms = []; |
|
317 | + foreach ($datas as $data) { |
|
318 | + // Team |
|
319 | + // 1 = bleu |
|
320 | + // 2 = rouge |
|
321 | + // 3 = jaune |
|
322 | 322 | |
323 | - switch ($data->team_id) { |
|
323 | + switch ($data->team_id) { |
|
324 | 324 | case 0: |
325 | 325 | $icon = 'map_white.png'; |
326 | 326 | $team = 'No Team (yet)'; |
@@ -344,7 +344,7 @@ discard block |
||
344 | 344 | $team = 'Team Instinct'; |
345 | 345 | $color = 'rgba(254, 217, 40, .6)'; |
346 | 346 | break; |
347 | - } |
|
347 | + } |
|
348 | 348 | |
349 | 349 | if ($data->team_id != 0) { |
350 | 350 | $icon .= $data->level.".png"; |
@@ -370,49 +370,49 @@ discard block |
||
370 | 370 | // |
371 | 371 | #################################### |
372 | 372 | |
373 | - case 'gym_defenders': |
|
374 | - $gym_id = $manager->getEcapedString($_GET['gym_id']); |
|
373 | + case 'gym_defenders': |
|
374 | + $gym_id = $manager->getEcapedString($_GET['gym_id']); |
|
375 | 375 | |
376 | - $data = $manager->getGymData($gym_id); |
|
377 | - $gymData['gymDetails']['gymInfos'] = false; |
|
376 | + $data = $manager->getGymData($gym_id); |
|
377 | + $gymData['gymDetails']['gymInfos'] = false; |
|
378 | 378 | |
379 | - if (!is_null($data)) { |
|
380 | - if ($data->name == null) { |
|
381 | - $gymData['gymDetails']['gymInfos']['name'] = "?"; |
|
382 | - } else { |
|
383 | - $gymData['gymDetails']['gymInfos']['name'] = $data->name; |
|
384 | - } |
|
385 | - $gymData['gymDetails']['gymInfos']['description'] = $data->description; |
|
386 | - if ($data->url == null) { |
|
387 | - $gymData['gymDetails']['gymInfos']['url'] = 'https://upload.wikimedia.org/wikipedia/commons/thumb/8/86/Solid_grey.svg/200px-Solid_grey.svg.png'; |
|
388 | - } else { |
|
389 | - $gymData['gymDetails']['gymInfos']['url'] = $data->url; |
|
390 | - } |
|
391 | - if ($data->url == null) { |
|
392 | - $gymData['gymDetails']['gymInfos']['points'] = "?"; |
|
393 | - } else { |
|
394 | - $gymData['gymDetails']['gymInfos']['points'] = $data->total_cp; |
|
395 | - } |
|
396 | - $gymData['gymDetails']['gymInfos']['level'] = $data->level; |
|
397 | - if ($data->last_scanned == null) { |
|
398 | - $gymData['gymDetails']['gymInfos']['last_scanned'] = "?"; |
|
399 | - } else { |
|
400 | - $gymData['gymDetails']['gymInfos']['last_scanned'] = $data->last_scanned; |
|
401 | - } |
|
402 | - $gymData['gymDetails']['gymInfos']['team'] = $data->team; |
|
403 | - $gymData['gymDetails']['gymInfos']['guardPokemonId'] = $data->guard_pokemon_id; |
|
379 | + if (!is_null($data)) { |
|
380 | + if ($data->name == null) { |
|
381 | + $gymData['gymDetails']['gymInfos']['name'] = "?"; |
|
382 | + } else { |
|
383 | + $gymData['gymDetails']['gymInfos']['name'] = $data->name; |
|
384 | + } |
|
385 | + $gymData['gymDetails']['gymInfos']['description'] = $data->description; |
|
386 | + if ($data->url == null) { |
|
387 | + $gymData['gymDetails']['gymInfos']['url'] = 'https://upload.wikimedia.org/wikipedia/commons/thumb/8/86/Solid_grey.svg/200px-Solid_grey.svg.png'; |
|
388 | + } else { |
|
389 | + $gymData['gymDetails']['gymInfos']['url'] = $data->url; |
|
390 | + } |
|
391 | + if ($data->url == null) { |
|
392 | + $gymData['gymDetails']['gymInfos']['points'] = "?"; |
|
393 | + } else { |
|
394 | + $gymData['gymDetails']['gymInfos']['points'] = $data->total_cp; |
|
395 | + } |
|
396 | + $gymData['gymDetails']['gymInfos']['level'] = $data->level; |
|
397 | + if ($data->last_scanned == null) { |
|
398 | + $gymData['gymDetails']['gymInfos']['last_scanned'] = "?"; |
|
399 | + } else { |
|
400 | + $gymData['gymDetails']['gymInfos']['last_scanned'] = $data->last_scanned; |
|
401 | + } |
|
402 | + $gymData['gymDetails']['gymInfos']['team'] = $data->team; |
|
403 | + $gymData['gymDetails']['gymInfos']['guardPokemonId'] = $data->guard_pokemon_id; |
|
404 | 404 | |
405 | - // Skip Query if team is none |
|
406 | - if ($data->team > 0) { |
|
407 | - $datas = $manager->getGymDefenders($gym_id); |
|
408 | - $gymData['infoWindow'] = ' |
|
405 | + // Skip Query if team is none |
|
406 | + if ($data->team > 0) { |
|
407 | + $datas = $manager->getGymDefenders($gym_id); |
|
408 | + $gymData['infoWindow'] = ' |
|
409 | 409 | <div class="gym_defenders"> |
410 | 410 | '; |
411 | - foreach ($datas as $data) { |
|
412 | - $gymData['gymDetails']['pokemons'][] = $data; |
|
413 | - $pokemon_id = $data->pokemon_id; |
|
414 | - if ($config->system->iv_numbers) { |
|
415 | - $gymData['infoWindow'] .= ' |
|
411 | + foreach ($datas as $data) { |
|
412 | + $gymData['gymDetails']['pokemons'][] = $data; |
|
413 | + $pokemon_id = $data->pokemon_id; |
|
414 | + if ($config->system->iv_numbers) { |
|
415 | + $gymData['infoWindow'] .= ' |
|
416 | 416 | <div style="text-align: center; width: 50px; display: inline-block; margin-right: 3px"> |
417 | 417 | <a href="pokemon/' . $data->pokemon_id . '"> |
418 | 418 | <img src="' . $pokemons->pokemon->$pokemon_id->img . '" height="50" style="display:inline-block" > |
@@ -430,8 +430,8 @@ discard block |
||
430 | 430 | </div> |
431 | 431 | </div> |
432 | 432 | </div>'; |
433 | - } else { |
|
434 | - $gymData['infoWindow'] .= ' |
|
433 | + } else { |
|
434 | + $gymData['infoWindow'] .= ' |
|
435 | 435 | <div style="text-align: center; width: 50px; display: inline-block; margin-right: 3px"> |
436 | 436 | <a href="pokemon/' . $data->pokemon_id . '"> |
437 | 437 | <img src="' . $pokemons->pokemon->$pokemon_id->img . '" height="50" style="display:inline-block" > |
@@ -449,254 +449,254 @@ discard block |
||
449 | 449 | </div> |
450 | 450 | </div> |
451 | 451 | </div>'; |
452 | + } |
|
452 | 453 | } |
453 | 454 | } |
455 | + $gymData['infoWindow'] = $gymData['infoWindow'].'</div>'; |
|
454 | 456 | } |
455 | - $gymData['infoWindow'] = $gymData['infoWindow'].'</div>'; |
|
456 | - } |
|
457 | 457 | |
458 | 458 | |
459 | - header('Content-Type: application/json'); |
|
460 | - echo json_encode($gymData); |
|
459 | + header('Content-Type: application/json'); |
|
460 | + echo json_encode($gymData); |
|
461 | 461 | |
462 | - break; |
|
462 | + break; |
|
463 | 463 | |
464 | 464 | |
465 | - case 'trainer': |
|
466 | - $name = ""; |
|
467 | - $page = "0"; |
|
468 | - $team = 0; |
|
469 | - $ranking = 0; |
|
470 | - if (isset($_GET['name'])) { |
|
471 | - $trainer_name = $manager->getEcapedString($_GET['name']); |
|
472 | - } |
|
473 | - if (isset($_GET['team'])) { |
|
474 | - $team = $manager->getEcapedString($_GET['team']); |
|
475 | - } |
|
476 | - if (isset($_GET['page'])) { |
|
477 | - $page = $manager->getEcapedString($_GET['page']); |
|
478 | - } |
|
479 | - if (isset($_GET['ranking'])) { |
|
480 | - $ranking = $manager->getEcapedString($_GET['ranking']); |
|
481 | - } |
|
482 | - |
|
483 | - $trainers = $manager->getTrainers($trainer_name, $team, $page, $ranking); |
|
484 | - $json = array(); |
|
485 | - $json['trainers'] = $trainers; |
|
486 | - $locale = array(); |
|
487 | - $locale["today"] = $locales->TODAY; |
|
488 | - $locale["day"] = $locales->DAY; |
|
489 | - $locale["days"] = $locales->DAYS; |
|
490 | - $locale["ivAttack"] = $locales->IV_ATTACK; |
|
491 | - $locale["ivDefense"] = $locales->IV_DEFENSE; |
|
492 | - $locale["ivStamina"] = $locales->IV_STAMINA; |
|
493 | - $json['locale'] = $locale; |
|
465 | + case 'trainer': |
|
466 | + $name = ""; |
|
467 | + $page = "0"; |
|
468 | + $team = 0; |
|
469 | + $ranking = 0; |
|
470 | + if (isset($_GET['name'])) { |
|
471 | + $trainer_name = $manager->getEcapedString($_GET['name']); |
|
472 | + } |
|
473 | + if (isset($_GET['team'])) { |
|
474 | + $team = $manager->getEcapedString($_GET['team']); |
|
475 | + } |
|
476 | + if (isset($_GET['page'])) { |
|
477 | + $page = $manager->getEcapedString($_GET['page']); |
|
478 | + } |
|
479 | + if (isset($_GET['ranking'])) { |
|
480 | + $ranking = $manager->getEcapedString($_GET['ranking']); |
|
481 | + } |
|
494 | 482 | |
495 | - header('Content-Type: application/json'); |
|
496 | - echo json_encode($json); |
|
483 | + $trainers = $manager->getTrainers($trainer_name, $team, $page, $ranking); |
|
484 | + $json = array(); |
|
485 | + $json['trainers'] = $trainers; |
|
486 | + $locale = array(); |
|
487 | + $locale["today"] = $locales->TODAY; |
|
488 | + $locale["day"] = $locales->DAY; |
|
489 | + $locale["days"] = $locales->DAYS; |
|
490 | + $locale["ivAttack"] = $locales->IV_ATTACK; |
|
491 | + $locale["ivDefense"] = $locales->IV_DEFENSE; |
|
492 | + $locale["ivStamina"] = $locales->IV_STAMINA; |
|
493 | + $json['locale'] = $locale; |
|
497 | 494 | |
498 | - break; |
|
495 | + header('Content-Type: application/json'); |
|
496 | + echo json_encode($json); |
|
499 | 497 | |
498 | + break; |
|
500 | 499 | |
501 | - case 'raids': |
|
502 | - $page = "0"; |
|
503 | - if (isset($_GET['page'])) { |
|
504 | - $page = $manager->getEcapedString($_GET['page']); |
|
505 | - } |
|
506 | 500 | |
507 | - $datas = $manager->getAllRaids($page); |
|
508 | - $i = 1; |
|
509 | - $raids = array(); |
|
510 | - foreach ($datas as $data) { |
|
511 | - $data->starttime = date("H:i", strtotime($data->start)); |
|
512 | - $data->endtime = date("H:i", strtotime($data->end)); |
|
513 | - $data->gym_id = str_replace('.', '_', $data->gym_id); |
|
514 | - if (isset($data->move_1)) { |
|
515 | - $move1 = $data->move_1; |
|
516 | - $data->quick_move = $move->$move1->name; |
|
517 | - } else { |
|
518 | - $data->quick_move = "?"; |
|
501 | + case 'raids': |
|
502 | + $page = "0"; |
|
503 | + if (isset($_GET['page'])) { |
|
504 | + $page = $manager->getEcapedString($_GET['page']); |
|
519 | 505 | } |
520 | - if (isset($data->move_2)) { |
|
521 | - $move2 = $data->move_2; |
|
522 | - $data->charge_move = $move->$move2->name; |
|
523 | - } else { |
|
524 | - $data->charge_move = "?"; |
|
506 | + |
|
507 | + $datas = $manager->getAllRaids($page); |
|
508 | + $i = 1; |
|
509 | + $raids = array(); |
|
510 | + foreach ($datas as $data) { |
|
511 | + $data->starttime = date("H:i", strtotime($data->start)); |
|
512 | + $data->endtime = date("H:i", strtotime($data->end)); |
|
513 | + $data->gym_id = str_replace('.', '_', $data->gym_id); |
|
514 | + if (isset($data->move_1)) { |
|
515 | + $move1 = $data->move_1; |
|
516 | + $data->quick_move = $move->$move1->name; |
|
517 | + } else { |
|
518 | + $data->quick_move = "?"; |
|
519 | + } |
|
520 | + if (isset($data->move_2)) { |
|
521 | + $move2 = $data->move_2; |
|
522 | + $data->charge_move = $move->$move2->name; |
|
523 | + } else { |
|
524 | + $data->charge_move = "?"; |
|
525 | + } |
|
526 | + $raids[10*$page + $i] = $data; |
|
527 | + $i++; |
|
525 | 528 | } |
526 | - $raids[10*$page + $i] = $data; |
|
527 | - $i++; |
|
528 | - } |
|
529 | - $json = array(); |
|
530 | - $json['raids'] = $raids; |
|
531 | - $locale = array(); |
|
532 | - $locale['noraids'] = $locales->RAIDS_NONE; |
|
533 | - $json['locale'] = $locale; |
|
529 | + $json = array(); |
|
530 | + $json['raids'] = $raids; |
|
531 | + $locale = array(); |
|
532 | + $locale['noraids'] = $locales->RAIDS_NONE; |
|
533 | + $json['locale'] = $locale; |
|
534 | 534 | |
535 | - header('Content-Type: application/json'); |
|
536 | - echo json_encode($json); |
|
535 | + header('Content-Type: application/json'); |
|
536 | + echo json_encode($json); |
|
537 | 537 | |
538 | - break; |
|
538 | + break; |
|
539 | 539 | |
540 | 540 | |
541 | - case 'gyms': |
|
542 | - $page = '0'; |
|
543 | - $ranking = 0; |
|
544 | - $gym_name = ''; |
|
545 | - $team = ''; |
|
546 | - if (isset($_GET['name']) && $_GET['name'] != '') { |
|
547 | - $gym_name = $manager->getEcapedString($_GET['name']); |
|
548 | - } |
|
549 | - if (isset($_GET['team']) && $_GET['team'] != '') { |
|
550 | - $team = $manager->getEcapedString($_GET['team']); |
|
551 | - } |
|
552 | - if (isset($_GET['page'])) { |
|
553 | - $page = $manager->getEcapedString($_GET['page']); |
|
554 | - } |
|
555 | - if (isset($_GET['ranking'])) { |
|
556 | - $ranking = $manager->getEcapedString($_GET['ranking']); |
|
557 | - } |
|
541 | + case 'gyms': |
|
542 | + $page = '0'; |
|
543 | + $ranking = 0; |
|
544 | + $gym_name = ''; |
|
545 | + $team = ''; |
|
546 | + if (isset($_GET['name']) && $_GET['name'] != '') { |
|
547 | + $gym_name = $manager->getEcapedString($_GET['name']); |
|
548 | + } |
|
549 | + if (isset($_GET['team']) && $_GET['team'] != '') { |
|
550 | + $team = $manager->getEcapedString($_GET['team']); |
|
551 | + } |
|
552 | + if (isset($_GET['page'])) { |
|
553 | + $page = $manager->getEcapedString($_GET['page']); |
|
554 | + } |
|
555 | + if (isset($_GET['ranking'])) { |
|
556 | + $ranking = $manager->getEcapedString($_GET['ranking']); |
|
557 | + } |
|
558 | 558 | |
559 | 559 | |
560 | - $datas = $manager->getGymHistories($gym_name, $team, $page, $ranking); |
|
561 | - $gyms = array(); |
|
562 | - foreach ($datas as $data) { |
|
563 | - $pkm = array(); |
|
564 | - if ($data->total_cp > 0) { |
|
565 | - $pkm = $manager->getGymHistoriesPokemon($data->gym_id); |
|
560 | + $datas = $manager->getGymHistories($gym_name, $team, $page, $ranking); |
|
561 | + $gyms = array(); |
|
562 | + foreach ($datas as $data) { |
|
563 | + $pkm = array(); |
|
564 | + if ($data->total_cp > 0) { |
|
565 | + $pkm = $manager->getGymHistoriesPokemon($data->gym_id); |
|
566 | + } |
|
567 | + $data->pokemon = $pkm; |
|
568 | + unset($data->pokemon_uids); |
|
569 | + $data->gym_id = str_replace('.', '_', $data->gym_id); |
|
570 | + $gyms[] = $data; |
|
566 | 571 | } |
567 | - $data->pokemon = $pkm; |
|
568 | - unset($data->pokemon_uids); |
|
569 | - $data->gym_id = str_replace('.', '_', $data->gym_id); |
|
570 | - $gyms[] = $data; |
|
571 | - } |
|
572 | - $json = array(); |
|
573 | - $json['gyms'] = $gyms; |
|
574 | - $locale = array(); |
|
575 | - $json['locale'] = $locale; |
|
572 | + $json = array(); |
|
573 | + $json['gyms'] = $gyms; |
|
574 | + $locale = array(); |
|
575 | + $json['locale'] = $locale; |
|
576 | 576 | |
577 | - header('Content-Type: application/json'); |
|
578 | - echo json_encode($json); |
|
577 | + header('Content-Type: application/json'); |
|
578 | + echo json_encode($json); |
|
579 | 579 | |
580 | - break; |
|
580 | + break; |
|
581 | 581 | |
582 | 582 | |
583 | 583 | |
584 | - case 'gymhistory': |
|
585 | - $gym_id = ''; |
|
586 | - $page = '0'; |
|
587 | - if (isset($_GET['gym_id'])) { |
|
588 | - $gym_id = $manager->getEcapedString($_GET['gym_id']); |
|
589 | - $gym_id = str_replace('_', '.', $gym_id); |
|
590 | - } |
|
591 | - if (isset($_GET['page'])) { |
|
592 | - $page = $manager->getEcapedString($_GET['page']); |
|
593 | - } |
|
584 | + case 'gymhistory': |
|
585 | + $gym_id = ''; |
|
586 | + $page = '0'; |
|
587 | + if (isset($_GET['gym_id'])) { |
|
588 | + $gym_id = $manager->getEcapedString($_GET['gym_id']); |
|
589 | + $gym_id = str_replace('_', '.', $gym_id); |
|
590 | + } |
|
591 | + if (isset($_GET['page'])) { |
|
592 | + $page = $manager->getEcapedString($_GET['page']); |
|
593 | + } |
|
594 | 594 | |
595 | - $entries = array(); |
|
595 | + $entries = array(); |
|
596 | 596 | |
597 | - $last_page = true; |
|
598 | - if ($gym_id != '') { |
|
599 | - $datas = $manager->getHistoryForGym($page, $gym_id); |
|
600 | - foreach ($datas['data'] as $data) { |
|
601 | - $data->gym_id = str_replace('.', '_', $data->gym_id); |
|
602 | - $entries[] = $data; |
|
603 | - } |
|
604 | - $last_page = $datas['last_page']; |
|
605 | - |
|
606 | - foreach ($entries as $idx => $entry) { |
|
607 | - $entry->total_cp_diff = 0; |
|
608 | - $entry->only_cp_changed = true; |
|
609 | - if ($idx < count($entries) - 1) { |
|
610 | - $next_entry = $entries[$idx+1]; |
|
611 | - $entry->total_cp_diff = $entry->total_cp - $next_entry->total_cp; |
|
612 | - $entry->class = $entry->total_cp_diff > 0 ? 'gain' : ($entry->total_cp_diff < 0 ? 'loss' : ''); |
|
613 | - $entry_pokemon = preg_split('/,/', $entry->pokemon_uids, null, PREG_SPLIT_NO_EMPTY); |
|
614 | - $next_entry_pokemon = preg_split('/,/', $next_entry->pokemon_uids, null, PREG_SPLIT_NO_EMPTY); |
|
615 | - $new_pokemon = array_diff($entry_pokemon, $next_entry_pokemon); |
|
616 | - $old_pokemon = array_diff($next_entry_pokemon, $entry_pokemon); |
|
617 | - foreach ($new_pokemon as $pkm) { |
|
618 | - $entry->pokemon[$pkm]->class = 'new'; |
|
619 | - } |
|
620 | - foreach ($old_pokemon as $pkm) { |
|
621 | - $next_entry->pokemon[$pkm]->class = 'old'; |
|
622 | - } |
|
623 | - if ($entry->team_id != $next_entry->team_id|| $entry->pokemon_uids != $next_entry->pokemon_uids) { |
|
624 | - $entry->only_cp_changed = false; |
|
597 | + $last_page = true; |
|
598 | + if ($gym_id != '') { |
|
599 | + $datas = $manager->getHistoryForGym($page, $gym_id); |
|
600 | + foreach ($datas['data'] as $data) { |
|
601 | + $data->gym_id = str_replace('.', '_', $data->gym_id); |
|
602 | + $entries[] = $data; |
|
603 | + } |
|
604 | + $last_page = $datas['last_page']; |
|
605 | + |
|
606 | + foreach ($entries as $idx => $entry) { |
|
607 | + $entry->total_cp_diff = 0; |
|
608 | + $entry->only_cp_changed = true; |
|
609 | + if ($idx < count($entries) - 1) { |
|
610 | + $next_entry = $entries[$idx+1]; |
|
611 | + $entry->total_cp_diff = $entry->total_cp - $next_entry->total_cp; |
|
612 | + $entry->class = $entry->total_cp_diff > 0 ? 'gain' : ($entry->total_cp_diff < 0 ? 'loss' : ''); |
|
613 | + $entry_pokemon = preg_split('/,/', $entry->pokemon_uids, null, PREG_SPLIT_NO_EMPTY); |
|
614 | + $next_entry_pokemon = preg_split('/,/', $next_entry->pokemon_uids, null, PREG_SPLIT_NO_EMPTY); |
|
615 | + $new_pokemon = array_diff($entry_pokemon, $next_entry_pokemon); |
|
616 | + $old_pokemon = array_diff($next_entry_pokemon, $entry_pokemon); |
|
617 | + foreach ($new_pokemon as $pkm) { |
|
618 | + $entry->pokemon[$pkm]->class = 'new'; |
|
619 | + } |
|
620 | + foreach ($old_pokemon as $pkm) { |
|
621 | + $next_entry->pokemon[$pkm]->class = 'old'; |
|
622 | + } |
|
623 | + if ($entry->team_id != $next_entry->team_id|| $entry->pokemon_uids != $next_entry->pokemon_uids) { |
|
624 | + $entry->only_cp_changed = false; |
|
625 | + } |
|
625 | 626 | } |
627 | + unset($entry->pokemon_uids); |
|
626 | 628 | } |
627 | - unset($entry->pokemon_uids); |
|
629 | + |
|
630 | + if (count($entries) > 10) { array_pop($entries); } |
|
628 | 631 | } |
629 | 632 | |
630 | - if (count($entries) > 10) { array_pop($entries); } |
|
631 | - } |
|
633 | + $json = array(); |
|
634 | + $json['entries'] = $entries; |
|
635 | + $locale = array(); |
|
636 | + $json['locale'] = $locale; |
|
637 | + $json['last_page'] = $last_page; |
|
632 | 638 | |
633 | - $json = array(); |
|
634 | - $json['entries'] = $entries; |
|
635 | - $locale = array(); |
|
636 | - $json['locale'] = $locale; |
|
637 | - $json['last_page'] = $last_page; |
|
639 | + header('Content-Type: application/json'); |
|
640 | + echo json_encode($json); |
|
638 | 641 | |
639 | - header('Content-Type: application/json'); |
|
640 | - echo json_encode($json); |
|
642 | + break; |
|
641 | 643 | |
642 | - break; |
|
643 | 644 | |
645 | + case 'pokemon_slider_init': |
|
646 | + $bounds = $manager->getPokemonSliderMinMax(); |
|
644 | 647 | |
645 | - case 'pokemon_slider_init': |
|
646 | - $bounds = $manager->getPokemonSliderMinMax(); |
|
648 | + header('Content-Type: application/json'); |
|
649 | + echo json_encode($bounds); |
|
647 | 650 | |
648 | - header('Content-Type: application/json'); |
|
649 | - echo json_encode($bounds); |
|
651 | + break; |
|
650 | 652 | |
651 | - break; |
|
652 | 653 | |
654 | + case 'pokemon_heatmap_points': |
|
655 | + $json = ""; |
|
656 | + if (isset($_GET['start']) && isset($_GET['end']) && isset($_GET['pokemon_id'])) { |
|
657 | + $start = date("Y-m-d H:i", (int) $_GET['start']); |
|
658 | + $end = date("Y-m-d H:i", (int) $_GET['end']); |
|
659 | + $pokemon_id = $manager->getEcapedString($_GET['pokemon_id']); |
|
660 | + $points = $manager->getPokemonHeatmap($pokemon_id, $start, $end); |
|
653 | 661 | |
654 | - case 'pokemon_heatmap_points': |
|
655 | - $json = ""; |
|
656 | - if (isset($_GET['start']) && isset($_GET['end']) && isset($_GET['pokemon_id'])) { |
|
657 | - $start = date("Y-m-d H:i", (int) $_GET['start']); |
|
658 | - $end = date("Y-m-d H:i", (int) $_GET['end']); |
|
659 | - $pokemon_id = $manager->getEcapedString($_GET['pokemon_id']); |
|
660 | - $points = $manager->getPokemonHeatmap($pokemon_id, $start, $end); |
|
662 | + $json = json_encode($points); |
|
663 | + } |
|
661 | 664 | |
662 | - $json = json_encode($points); |
|
663 | - } |
|
665 | + header('Content-Type: application/json'); |
|
666 | + echo $json; |
|
667 | + break; |
|
664 | 668 | |
665 | - header('Content-Type: application/json'); |
|
666 | - echo $json; |
|
667 | - break; |
|
668 | 669 | |
670 | + case 'maps_localization_coordinates': |
|
671 | + $coordinates = $manager->getMapsCoords(); |
|
669 | 672 | |
670 | - case 'maps_localization_coordinates': |
|
671 | - $coordinates = $manager->getMapsCoords(); |
|
673 | + header('Content-Type: application/json'); |
|
674 | + echo json_encode($coordinates); |
|
672 | 675 | |
673 | - header('Content-Type: application/json'); |
|
674 | - echo json_encode($coordinates); |
|
676 | + break; |
|
675 | 677 | |
676 | - break; |
|
677 | 678 | |
679 | + case 'pokemon_graph_data': |
|
680 | + $json = ""; |
|
681 | + if (isset($_GET['pokemon_id'])) { |
|
682 | + $pokemon_id = $manager->getEcapedString($_GET['pokemon_id']); |
|
683 | + $array = $manager->getPokemonGraph($pokemon_id); |
|
678 | 684 | |
679 | - case 'pokemon_graph_data': |
|
680 | - $json = ""; |
|
681 | - if (isset($_GET['pokemon_id'])) { |
|
682 | - $pokemon_id = $manager->getEcapedString($_GET['pokemon_id']); |
|
683 | - $array = $manager->getPokemonGraph($pokemon_id); |
|
685 | + $json = json_encode($array); |
|
686 | + } |
|
684 | 687 | |
685 | - $json = json_encode($array); |
|
686 | - } |
|
688 | + header('Content-Type: application/json'); |
|
689 | + echo $json; |
|
690 | + break; |
|
687 | 691 | |
688 | - header('Content-Type: application/json'); |
|
689 | - echo $json; |
|
690 | - break; |
|
691 | 692 | |
693 | + case 'postRequest': |
|
694 | + break; |
|
692 | 695 | |
693 | - case 'postRequest': |
|
696 | + default: |
|
697 | + echo "What do you mean?"; |
|
698 | + exit(); |
|
694 | 699 | break; |
695 | - |
|
696 | - default: |
|
697 | - echo "What do you mean?"; |
|
698 | - exit(); |
|
699 | - break; |
|
700 | 700 | } |
701 | 701 | |
702 | 702 | if ($postRequest != "") { |