@@ -167,7 +167,7 @@ discard block |
||
| 167 | 167 | cp, atk_iv as individual_attack, def_iv as individual_defense, sta_iv as individual_stamina, |
| 168 | 168 | ROUND(100*(atk_iv+def_iv+sta_iv)/45,1) AS \"IV\", move_1 as move_1, move_2, form |
| 169 | 169 | FROM sightings |
| 170 | - WHERE pokemon_id = '" . $pokemon_id . "' AND move_1 IS NOT NULL AND move_1 <> '0' |
|
| 170 | + WHERE pokemon_id = '" . $pokemon_id."' AND move_1 IS NOT NULL AND move_1 <> '0' |
|
| 171 | 171 | ORDER BY $top_order_by $top_direction, expire_timestamp DESC |
| 172 | 172 | LIMIT 50 OFFSET 0"; |
| 173 | 173 | $result = pg_query($this->db, $req); |
@@ -181,13 +181,13 @@ discard block |
||
| 181 | 181 | function getTop50Trainers($pokemon_id, $best_order_by, $best_direction) { |
| 182 | 182 | $trainer_blacklist = ""; |
| 183 | 183 | if (!empty(self::$config->system->trainer_blacklist)) { |
| 184 | - $trainer_blacklist = " AND owner_name NOT IN ('" . implode("','", self::$config->system->trainer_blacklist) . "')"; |
|
| 184 | + $trainer_blacklist = " AND owner_name NOT IN ('".implode("','", self::$config->system->trainer_blacklist)."')"; |
|
| 185 | 185 | } |
| 186 | 186 | |
| 187 | 187 | $req = "SELECT owner_name as trainer_name, ROUND((100.0*((atk_iv)+(def_iv)+(sta_iv))/45),1) AS \"IV\", move_1, move_2, cp as cp, |
| 188 | 188 | TO_TIMESTAMP(last_modified) AS lasttime, last_modified as last_seen |
| 189 | 189 | FROM gym_defenders |
| 190 | - WHERE pokemon_id = '" . $pokemon_id . "'" . $trainer_blacklist . " |
|
| 190 | + WHERE pokemon_id = '" . $pokemon_id."'".$trainer_blacklist." |
|
| 191 | 191 | ORDER BY $best_order_by $best_direction, owner_name ASC |
| 192 | 192 | LIMIT 50 OFFSET 0"; |
| 193 | 193 | |
@@ -229,9 +229,9 @@ discard block |
||
| 229 | 229 | |
| 230 | 230 | public function getPokemonLive($pokemon_id, $ivMin, $ivMax, $inmap_pokemons) { |
| 231 | 231 | $inmap_pkms_filter = ""; |
| 232 | - $where = " WHERE expire_timestamp >= EXTRACT(EPOCH FROM NOW()) AND pokemon_id = " . $pokemon_id; |
|
| 232 | + $where = " WHERE expire_timestamp >= EXTRACT(EPOCH FROM NOW()) AND pokemon_id = ".$pokemon_id; |
|
| 233 | 233 | |
| 234 | - $reqTestIv = "SELECT MAX(atk_iv) AS iv FROM sightings " . $where; |
|
| 234 | + $reqTestIv = "SELECT MAX(atk_iv) AS iv FROM sightings ".$where; |
|
| 235 | 235 | $resultTestIv = pg_query($this->db, $reqTestIv); |
| 236 | 236 | $testIv = pg_fetch_object($resultTestIv); |
| 237 | 237 | if (!is_null($inmap_pokemons) && ($inmap_pokemons != "")) { |
@@ -239,20 +239,20 @@ discard block |
||
| 239 | 239 | $inmap_pkms_filter .= "'".$inmap."',"; |
| 240 | 240 | } |
| 241 | 241 | $inmap_pkms_filter = rtrim($inmap_pkms_filter, ","); |
| 242 | - $where .= " AND encounter_id NOT IN (" . $inmap_pkms_filter . ") "; |
|
| 242 | + $where .= " AND encounter_id NOT IN (".$inmap_pkms_filter.") "; |
|
| 243 | 243 | } |
| 244 | 244 | if ($testIv->iv != null && !is_null($ivMin) && ($ivMin != "")) { |
| 245 | - $where .= " AND ((100/45)*(atk_iv + def_iv + sta_iv)) >= (" . $ivMin . ") "; |
|
| 245 | + $where .= " AND ((100/45)*(atk_iv + def_iv + sta_iv)) >= (".$ivMin.") "; |
|
| 246 | 246 | } |
| 247 | 247 | if ($testIv->iv != null && !is_null($ivMax) && ($ivMax != "")) { |
| 248 | - $where .= " AND ((100/45)*(atk_iv + def_iv + sta_iv)) <= (" . $ivMax . ") "; |
|
| 248 | + $where .= " AND ((100/45)*(atk_iv + def_iv + sta_iv)) <= (".$ivMax.") "; |
|
| 249 | 249 | } |
| 250 | 250 | $req = "SELECT pokemon_id, lat AS latitude, lon AS longitude, |
| 251 | 251 | TO_TIMESTAMP(expire_timestamp) AS disappear_time, |
| 252 | 252 | TO_TIMESTAMP(expire_timestamp) AS disappear_time_real, |
| 253 | 253 | atk_iv AS individual_attack, def_iv AS individual_defense, sta_iv AS individual_stamina, |
| 254 | 254 | move_1, move_2 |
| 255 | - FROM sightings " . $where . " |
|
| 255 | + FROM sightings " . $where." |
|
| 256 | 256 | ORDER BY disappear_time DESC |
| 257 | 257 | LIMIT 5000"; |
| 258 | 258 | $result = pg_query($this->db, $req); |
@@ -321,7 +321,7 @@ discard block |
||
| 321 | 321 | $req = "SELECT COUNT(DISTINCT(fs.fort_id)) AS total, ROUND((SUM(gd.cp)) / COUNT(DISTINCT(fs.fort_id)),0) AS average_points |
| 322 | 322 | FROM fort_sightings fs |
| 323 | 323 | JOIN gym_defenders gd ON fs.fort_id = gd.fort_id |
| 324 | - WHERE fs.team = '" . $team_id . "'"; |
|
| 324 | + WHERE fs.team = '" . $team_id."'"; |
|
| 325 | 325 | $result = pg_query($this->db, $req); |
| 326 | 326 | $data = pg_fetch_object($result); |
| 327 | 327 | return $data; |
@@ -368,7 +368,7 @@ discard block |
||
| 368 | 368 | /////////// |
| 369 | 369 | |
| 370 | 370 | public function getAllRaids($page) { |
| 371 | - $limit = " LIMIT 10 OFFSET ". ($page * 10); |
|
| 371 | + $limit = " LIMIT 10 OFFSET ".($page * 10); |
|
| 372 | 372 | $req = "SELECT r.fort_id AS gym_id, r.level AS level, r.pokemon_id AS pokemon_id, r.cp AS cp, r.move_1 AS move_1, r.move_2 AS move_2, TO_TIMESTAMP(r.time_spawn) AS spawn, TO_TIMESTAMP(r.time_battle) AS start, TO_TIMESTAMP(r.time_end) AS end, TO_TIMESTAMP(fs.updated) AS last_scanned, f.name, f.lat AS latitude, f.lon as longitude |
| 373 | 373 | FROM raids r |
| 374 | 374 | JOIN forts f ON f.id = r.fort_id |
@@ -437,9 +437,9 @@ discard block |
||
| 437 | 437 | FROM sightings |
| 438 | 438 | JOIN (SELECT COUNT(*) AS count |
| 439 | 439 | FROM sightings |
| 440 | - " . $where. " |
|
| 440 | + " . $where." |
|
| 441 | 441 | ) count ON 1 = 1 |
| 442 | - " . $where . " |
|
| 442 | + " . $where." |
|
| 443 | 443 | ORDER BY expire_timestamp DESC |
| 444 | 444 | LIMIT 1 OFFSET 0"; |
| 445 | 445 | $result = pg_query($this->db, $req); |
@@ -474,13 +474,13 @@ discard block |
||
| 474 | 474 | public function getNestData() { |
| 475 | 475 | $pokemon_exclude_sql = ""; |
| 476 | 476 | if (!empty(self::$config->system->nest_exclude_pokemon)) { |
| 477 | - $pokemon_exclude_sql = "AND p.pokemon_id NOT IN (" . implode(",", self::$config->system->nest_exclude_pokemon) . ")"; |
|
| 477 | + $pokemon_exclude_sql = "AND p.pokemon_id NOT IN (".implode(",", self::$config->system->nest_exclude_pokemon).")"; |
|
| 478 | 478 | } |
| 479 | 479 | $req = "SELECT p.spawn_id, p.pokemon_id, MAX(p.lat) AS latitude, MAX(p.lon) AS longitude, count(p.pokemon_id) AS total_pokemon, TO_TIMESTAMP(MAX(s.updated)) as latest_seen, coalesce(MAX(duration),30)*60 as duration |
| 480 | 480 | FROM sightings p |
| 481 | 481 | INNER JOIN spawnpoints s ON (p.spawn_id = s.spawn_id) |
| 482 | 482 | WHERE p.expire_timestamp > EXTRACT(EPOCH FROM NOW()) - 86400 |
| 483 | - " . $pokemon_exclude_sql . " |
|
| 483 | + " . $pokemon_exclude_sql." |
|
| 484 | 484 | GROUP BY p.spawn_id, p.pokemon_id |
| 485 | 485 | HAVING COUNT(p.pokemon_id) >= 6 |
| 486 | 486 | ORDER BY p.pokemon_id"; |
@@ -6,13 +6,16 @@ discard block |
||
| 6 | 6 | * Time: 02:26 |
| 7 | 7 | */ |
| 8 | 8 | |
| 9 | -class QueryManagerPostgresqlMonocleAlternate extends QueryManagerPostgresql { |
|
| 9 | +class QueryManagerPostgresqlMonocleAlternate extends QueryManagerPostgresql |
|
| 10 | +{ |
|
| 10 | 11 | |
| 11 | - public function __construct() { |
|
| 12 | + public function __construct() |
|
| 13 | + { |
|
| 12 | 14 | parent::__construct(); |
| 13 | 15 | } |
| 14 | 16 | |
| 15 | - public function __destruct() { |
|
| 17 | + public function __destruct() |
|
| 18 | + { |
|
| 16 | 19 | parent::__destruct(); |
| 17 | 20 | } |
| 18 | 21 | |
@@ -20,7 +23,8 @@ discard block |
||
| 20 | 23 | // Tester |
| 21 | 24 | /////////// |
| 22 | 25 | |
| 23 | - function testTotalPokemon() { |
|
| 26 | + function testTotalPokemon() |
|
| 27 | + { |
|
| 24 | 28 | $req = "SELECT COUNT(*) as total FROM sightings"; |
| 25 | 29 | $result = pg_query($this->db, $req); |
| 26 | 30 | if ($result === false) { |
@@ -36,7 +40,8 @@ discard block |
||
| 36 | 40 | return 0; |
| 37 | 41 | } |
| 38 | 42 | |
| 39 | - function testTotalGyms() { |
|
| 43 | + function testTotalGyms() |
|
| 44 | + { |
|
| 40 | 45 | $req = "SELECT COUNT(*) as total FROM forts"; |
| 41 | 46 | $result = pg_query($this->db, $req); |
| 42 | 47 | if ($result === false) { |
@@ -52,7 +57,8 @@ discard block |
||
| 52 | 57 | return 0; |
| 53 | 58 | } |
| 54 | 59 | |
| 55 | - function testTotalPokestops() { |
|
| 60 | + function testTotalPokestops() |
|
| 61 | + { |
|
| 56 | 62 | $req = "SELECT COUNT(*) as total FROM pokestops"; |
| 57 | 63 | $result = pg_query($this->db, $req); |
| 58 | 64 | if ($result === false) { |
@@ -73,26 +79,30 @@ discard block |
||
| 73 | 79 | // Homepage |
| 74 | 80 | ///////////// |
| 75 | 81 | |
| 76 | - function getTotalPokemon() { |
|
| 82 | + function getTotalPokemon() |
|
| 83 | + { |
|
| 77 | 84 | $req = "SELECT COUNT(*) AS total FROM sightings WHERE expire_timestamp >= EXTRACT(EPOCH FROM NOW())"; |
| 78 | 85 | $result = pg_query($this->db, $req); |
| 79 | 86 | $data = pg_fetch_object($result); |
| 80 | 87 | return $data; |
| 81 | 88 | } |
| 82 | 89 | |
| 83 | - function getTotalLures() { |
|
| 90 | + function getTotalLures() |
|
| 91 | + { |
|
| 84 | 92 | $data = (object) array("total" => 0); |
| 85 | 93 | return $data; |
| 86 | 94 | } |
| 87 | 95 | |
| 88 | - function getTotalGyms() { |
|
| 96 | + function getTotalGyms() |
|
| 97 | + { |
|
| 89 | 98 | $req = "SELECT COUNT(*) AS total FROM forts"; |
| 90 | 99 | $result = pg_query($this->db, $req); |
| 91 | 100 | $data = pg_fetch_object($result); |
| 92 | 101 | return $data; |
| 93 | 102 | } |
| 94 | 103 | |
| 95 | - function getTotalRaids() { |
|
| 104 | + function getTotalRaids() |
|
| 105 | + { |
|
| 96 | 106 | $req = "SELECT COUNT(*) AS total FROM raids WHERE time_battle <= EXTRACT(EPOCH FROM NOW()) AND time_end >= EXTRACT(EPOCH FROM NOW())"; |
| 97 | 107 | $result = pg_query($this->db, $req); |
| 98 | 108 | $data = pg_fetch_object($result); |
@@ -100,14 +110,16 @@ discard block |
||
| 100 | 110 | } |
| 101 | 111 | |
| 102 | 112 | |
| 103 | - function getTotalGymsForTeam($team_id) { |
|
| 113 | + function getTotalGymsForTeam($team_id) |
|
| 114 | + { |
|
| 104 | 115 | $req = "SELECT COUNT(*) AS total FROM fort_sightings WHERE team = '$team_id'"; |
| 105 | 116 | $result = pg_query($this->db, $req); |
| 106 | 117 | $data = pg_fetch_object($result); |
| 107 | 118 | return $data; |
| 108 | 119 | } |
| 109 | 120 | |
| 110 | - function getRecentAll() { |
|
| 121 | + function getRecentAll() |
|
| 122 | + { |
|
| 111 | 123 | $req = "SELECT DISTINCT pokemon_id, encounter_id, TO_TIMESTAMP(expire_timestamp) AS disappear_time, TO_TIMESTAMP(updated) AS last_modified, TO_TIMESTAMP(expire_timestamp) AS disappear_time_real, |
| 112 | 124 | lat AS latitude, lon AS longitude, cp, atk_iv AS individual_attack, def_iv AS individual_defense, sta_iv AS individual_stamina |
| 113 | 125 | FROM sightings |
@@ -123,7 +135,8 @@ discard block |
||
| 123 | 135 | return $data; |
| 124 | 136 | } |
| 125 | 137 | |
| 126 | - function getRecentMythic($mythic_pokemon) { |
|
| 138 | + function getRecentMythic($mythic_pokemon) |
|
| 139 | + { |
|
| 127 | 140 | $req = "SELECT DISTINCT pokemon_id as pokemon_id, CONCAT('A', encounter_id) as encounter_id, TO_TIMESTAMP(expire_timestamp) AS disappear_time, TO_TIMESTAMP(updated) AS last_modified, TO_TIMESTAMP(expire_timestamp) AS disappear_time_real, |
| 128 | 141 | lat AS latitude, lon AS longitude, cp, atk_iv AS individual_attack, def_iv AS individual_defense, sta_iv AS individual_stamina |
| 129 | 142 | FROM sightings |
@@ -144,14 +157,16 @@ discard block |
||
| 144 | 157 | // Single Pokemon |
| 145 | 158 | /////////////////// |
| 146 | 159 | |
| 147 | - function getGymsProtectedByPokemon($pokemon_id) { |
|
| 160 | + function getGymsProtectedByPokemon($pokemon_id) |
|
| 161 | + { |
|
| 148 | 162 | $req = "SELECT COUNT(DISTINCT(fort_id)) AS total FROM fort_sightings WHERE guard_pokemon_id = '".$pokemon_id."'"; |
| 149 | 163 | $result = pg_query($this->db, $req); |
| 150 | 164 | $data = pg_fetch_object($result); |
| 151 | 165 | return $data; |
| 152 | 166 | } |
| 153 | 167 | |
| 154 | - function getPokemonLastSeen($pokemon_id) { |
|
| 168 | + function getPokemonLastSeen($pokemon_id) |
|
| 169 | + { |
|
| 155 | 170 | $req = "SELECT TO_TIMESTAMP(expire_timestamp) AS expire_timestamp, TO_TIMESTAMP(expire_timestamp) AS disappear_time_real, lat AS latitude, lon AS longitude |
| 156 | 171 | FROM sightings |
| 157 | 172 | WHERE pokemon_id = '".$pokemon_id."' |
@@ -162,7 +177,8 @@ discard block |
||
| 162 | 177 | return $data; |
| 163 | 178 | } |
| 164 | 179 | |
| 165 | - function getTop50Pokemon($pokemon_id, $top_order_by, $top_direction) { |
|
| 180 | + function getTop50Pokemon($pokemon_id, $top_order_by, $top_direction) |
|
| 181 | + { |
|
| 166 | 182 | $req = "SELECT expire_timestamp, TO_TIMESTAMP(expire_timestamp) AS distime, pokemon_id as pokemon_id, TO_TIMESTAMP(expire_timestamp) as disappear_time, lat as latitude, lon as longitude, |
| 167 | 183 | cp, atk_iv as individual_attack, def_iv as individual_defense, sta_iv as individual_stamina, |
| 168 | 184 | ROUND(100*(atk_iv+def_iv+sta_iv)/45,1) AS \"IV\", move_1 as move_1, move_2, form |
@@ -178,7 +194,8 @@ discard block |
||
| 178 | 194 | return $top; |
| 179 | 195 | } |
| 180 | 196 | |
| 181 | - function getTop50Trainers($pokemon_id, $best_order_by, $best_direction) { |
|
| 197 | + function getTop50Trainers($pokemon_id, $best_order_by, $best_direction) |
|
| 198 | + { |
|
| 182 | 199 | $trainer_blacklist = ""; |
| 183 | 200 | if (!empty(self::$config->system->trainer_blacklist)) { |
| 184 | 201 | $trainer_blacklist = " AND owner_name NOT IN ('" . implode("','", self::$config->system->trainer_blacklist) . "')"; |
@@ -199,7 +216,8 @@ discard block |
||
| 199 | 216 | return $toptrainer; |
| 200 | 217 | } |
| 201 | 218 | |
| 202 | - public function getPokemonHeatmap($pokemon_id, $start, $end) { |
|
| 219 | + public function getPokemonHeatmap($pokemon_id, $start, $end) |
|
| 220 | + { |
|
| 203 | 221 | $where = " WHERE pokemon_id = ".$pokemon_id." " |
| 204 | 222 | . "AND TO_TIMESTAMP(expire_timestamp) BETWEEN '".$start."' AND '".$end."'"; |
| 205 | 223 | $req = "SELECT lat AS latitude, lon AS longitude FROM sightings".$where." ORDER BY expire_timestamp DESC LIMIT 100000"; |
@@ -211,7 +229,8 @@ discard block |
||
| 211 | 229 | return $points; |
| 212 | 230 | } |
| 213 | 231 | |
| 214 | - public function getPokemonGraph($pokemon_id) { |
|
| 232 | + public function getPokemonGraph($pokemon_id) |
|
| 233 | + { |
|
| 215 | 234 | $req = "SELECT COUNT(*) AS total, EXTRACT(HOUR FROM disappear_time) AS disappear_hour |
| 216 | 235 | FROM (SELECT TO_TIMESTAMP(expire_timestamp) as disappear_time FROM sightings WHERE pokemon_id = '".$pokemon_id."' ORDER BY disappear_time LIMIT 100000) AS pokemonFiltered |
| 217 | 236 | GROUP BY disappear_hour |
@@ -227,7 +246,8 @@ discard block |
||
| 227 | 246 | return $array; |
| 228 | 247 | } |
| 229 | 248 | |
| 230 | - public function getPokemonLive($pokemon_id, $ivMin, $ivMax, $inmap_pokemons) { |
|
| 249 | + public function getPokemonLive($pokemon_id, $ivMin, $ivMax, $inmap_pokemons) |
|
| 250 | + { |
|
| 231 | 251 | $inmap_pkms_filter = ""; |
| 232 | 252 | $where = " WHERE expire_timestamp >= EXTRACT(EPOCH FROM NOW()) AND pokemon_id = " . $pokemon_id; |
| 233 | 253 | |
@@ -263,14 +283,16 @@ discard block |
||
| 263 | 283 | return $spawns; |
| 264 | 284 | } |
| 265 | 285 | |
| 266 | - public function getPokemonSliderMinMax() { |
|
| 286 | + public function getPokemonSliderMinMax() |
|
| 287 | + { |
|
| 267 | 288 | $req = "SELECT TO_TIMESTAMP(MIN(expire_timestamp)) AS min, TO_TIMESTAMP(MAX(expire_timestamp)) AS max FROM sightings"; |
| 268 | 289 | $result = pg_query($this->db, $req); |
| 269 | 290 | $data = pg_fetch_object($result); |
| 270 | 291 | return $data; |
| 271 | 292 | } |
| 272 | 293 | |
| 273 | - public function getMapsCoords() { |
|
| 294 | + public function getMapsCoords() |
|
| 295 | + { |
|
| 274 | 296 | $req = "SELECT MAX(lat) AS max_latitude, MIN(lat) AS min_latitude, MAX(lon) AS max_longitude, MIN(lon) as min_longitude FROM spawnpoints"; |
| 275 | 297 | $result = pg_query($this->db, $req); |
| 276 | 298 | $data = pg_fetch_object($result); |
@@ -283,14 +305,16 @@ discard block |
||
| 283 | 305 | ////////////// |
| 284 | 306 | |
| 285 | 307 | |
| 286 | - function getTotalPokestops() { |
|
| 308 | + function getTotalPokestops() |
|
| 309 | + { |
|
| 287 | 310 | $req = "SELECT COUNT(*) as total FROM pokestops"; |
| 288 | 311 | $result = pg_query($this->db, $req); |
| 289 | 312 | $data = pg_fetch_object($result); |
| 290 | 313 | return $data; |
| 291 | 314 | } |
| 292 | 315 | |
| 293 | - public function getAllPokestops() { |
|
| 316 | + public function getAllPokestops() |
|
| 317 | + { |
|
| 294 | 318 | $req = "SELECT lat as latitude, lon as longitude, null AS lure_expiration, EXTRACT(EPOCH FROM NOW()) AS now, null AS lure_expiration_real FROM pokestops"; |
| 295 | 319 | $result = pg_query($this->db, $req); |
| 296 | 320 | $pokestops = array(); |
@@ -305,7 +329,8 @@ discard block |
||
| 305 | 329 | // Gyms |
| 306 | 330 | ///////// |
| 307 | 331 | |
| 308 | - function getTeamGuardians($team_id) { |
|
| 332 | + function getTeamGuardians($team_id) |
|
| 333 | + { |
|
| 309 | 334 | $req = "SELECT COUNT(*) AS total, guard_pokemon_id FROM fort_sightings WHERE team = '".$team_id."' GROUP BY guard_pokemon_id ORDER BY total DESC LIMIT 3 OFFSET 0"; |
| 310 | 335 | $result = pg_query($this->db, $req); |
| 311 | 336 | |
@@ -317,7 +342,8 @@ discard block |
||
| 317 | 342 | return $datas; |
| 318 | 343 | } |
| 319 | 344 | |
| 320 | - function getOwnedAndPoints($team_id) { |
|
| 345 | + function getOwnedAndPoints($team_id) |
|
| 346 | + { |
|
| 321 | 347 | $req = "SELECT COUNT(DISTINCT(fs.fort_id)) AS total, ROUND((SUM(gd.cp)) / COUNT(DISTINCT(fs.fort_id)),0) AS average_points |
| 322 | 348 | FROM fort_sightings fs |
| 323 | 349 | JOIN gym_defenders gd ON fs.fort_id = gd.fort_id |
@@ -327,7 +353,8 @@ discard block |
||
| 327 | 353 | return $data; |
| 328 | 354 | } |
| 329 | 355 | |
| 330 | - function getAllGyms() { |
|
| 356 | + function getAllGyms() |
|
| 357 | + { |
|
| 331 | 358 | $req = "SELECT f.id as gym_id, team as team_id, f.lat as latitude, f.lon as longitude, updated as last_scanned, (6 - fs.slots_available) AS level FROM forts f LEFT JOIN fort_sightings fs ON f.id = fs.fort_id;"; |
| 332 | 359 | $result = pg_query($this->db, $req); |
| 333 | 360 | $gyms = array(); |
@@ -337,7 +364,8 @@ discard block |
||
| 337 | 364 | return $gyms; |
| 338 | 365 | } |
| 339 | 366 | |
| 340 | - public function getGymData($gym_id) { |
|
| 367 | + public function getGymData($gym_id) |
|
| 368 | + { |
|
| 341 | 369 | $req = "SELECT f.name AS name, null AS description, f.url AS url, fs.team AS team, TO_TIMESTAMP(fs.updated) AS last_scanned, fs.guard_pokemon_id AS guard_pokemon_id, (6 - fs.slots_available) AS level, SUM(gd.cp) as total_cp |
| 342 | 370 | FROM fort_sightings fs |
| 343 | 371 | LEFT JOIN forts f ON f.id = fs.fort_id |
@@ -349,7 +377,8 @@ discard block |
||
| 349 | 377 | return $data; |
| 350 | 378 | } |
| 351 | 379 | |
| 352 | - public function getGymDefenders($gym_id) { |
|
| 380 | + public function getGymDefenders($gym_id) |
|
| 381 | + { |
|
| 353 | 382 | $req = "SELECT DISTINCT external_id as pokemon_uid, pokemon_id, atk_iv as iv_attack, def_iv as iv_defense, sta_iv as iv_stamina, cp, fort_id as gym_id |
| 354 | 383 | FROM gym_defenders |
| 355 | 384 | WHERE fort_id='".$gym_id."' |
@@ -367,7 +396,8 @@ discard block |
||
| 367 | 396 | // Raids |
| 368 | 397 | /////////// |
| 369 | 398 | |
| 370 | - public function getAllRaids($page) { |
|
| 399 | + public function getAllRaids($page) |
|
| 400 | + { |
|
| 371 | 401 | $limit = " LIMIT 10 OFFSET ". ($page * 10); |
| 372 | 402 | $req = "SELECT r.fort_id AS gym_id, r.level AS level, r.pokemon_id AS pokemon_id, r.cp AS cp, r.move_1 AS move_1, r.move_2 AS move_2, TO_TIMESTAMP(r.time_spawn) AS spawn, TO_TIMESTAMP(r.time_battle) AS start, TO_TIMESTAMP(r.time_end) AS end, TO_TIMESTAMP(fs.updated) AS last_scanned, f.name, f.lat AS latitude, f.lon as longitude |
| 373 | 403 | FROM raids r |
@@ -388,11 +418,13 @@ discard block |
||
| 388 | 418 | // Trainers |
| 389 | 419 | ////////////// |
| 390 | 420 | |
| 391 | - public function getTrainers($trainer_name, $team, $page, $ranking) { |
|
| 421 | + public function getTrainers($trainer_name, $team, $page, $ranking) |
|
| 422 | + { |
|
| 392 | 423 | return array(); // Waiting for Monocle to store level |
| 393 | 424 | } |
| 394 | 425 | |
| 395 | - public function getTrainerLevelCount($team_id) { |
|
| 426 | + public function getTrainerLevelCount($team_id) |
|
| 427 | + { |
|
| 396 | 428 | $levelData = array(); |
| 397 | 429 | for ($i = 5; $i <= 40; $i++) { |
| 398 | 430 | if (!isset($levelData[$i])) { |
@@ -407,7 +439,8 @@ discard block |
||
| 407 | 439 | // Cron |
| 408 | 440 | ///////// |
| 409 | 441 | |
| 410 | - public function getPokemonCountsActive() { |
|
| 442 | + public function getPokemonCountsActive() |
|
| 443 | + { |
|
| 411 | 444 | $req = "SELECT pokemon_id, COUNT(*) as total FROM sightings WHERE expire_timestamp >= EXTRACT(EPOCH FROM NOW()) GROUP BY pokemon_id"; |
| 412 | 445 | $result = pg_query($this->db, $req); |
| 413 | 446 | $counts = array(); |
@@ -417,7 +450,8 @@ discard block |
||
| 417 | 450 | return $counts; |
| 418 | 451 | } |
| 419 | 452 | |
| 420 | - public function getPokemonCountsLastDay() { |
|
| 453 | + public function getPokemonCountsLastDay() |
|
| 454 | + { |
|
| 421 | 455 | $req = "SELECT pokemon_id, COUNT(*) AS spawns_last_day |
| 422 | 456 | FROM sightings |
| 423 | 457 | WHERE TO_TIMESTAMP(expire_timestamp) >= (SELECT TO_TIMESTAMP(MAX(expire_timestamp)) FROM sightings) - INTERVAL 1 DAY |
@@ -431,7 +465,8 @@ discard block |
||
| 431 | 465 | return $counts; |
| 432 | 466 | } |
| 433 | 467 | |
| 434 | - public function getPokemonSinceLastUpdate($pokemon_id, $last_update) { |
|
| 468 | + public function getPokemonSinceLastUpdate($pokemon_id, $last_update) |
|
| 469 | + { |
|
| 435 | 470 | $where = "WHERE pokemon_id = '".$pokemon_id."' AND id > '".$last_update."'"; |
| 436 | 471 | $req = "SELECT count, id AS last_timestamp, (TO_TIMESTAMP(expire_timestamp)) AS disappear_time_real, lat as latitude, lon as longitude |
| 437 | 472 | FROM sightings |
@@ -447,7 +482,8 @@ discard block |
||
| 447 | 482 | return $data; |
| 448 | 483 | } |
| 449 | 484 | |
| 450 | - public function getRaidsSinceLastUpdate($pokemon_id, $last_update) { |
|
| 485 | + public function getRaidsSinceLastUpdate($pokemon_id, $last_update) |
|
| 486 | + { |
|
| 451 | 487 | $where = "WHERE pokemon_id = '".$pokemon_id."' AND time_battle > '".$last_update."'"; |
| 452 | 488 | $req = "SELECT time_battle AS start_timestamp, time_end as end, (TO_TIMESTAMP(time_end)) AS end_time_real, lat as latitude, lon as longitude, count |
| 453 | 489 | FROM raids r |
@@ -464,14 +500,16 @@ discard block |
||
| 464 | 500 | return $data; |
| 465 | 501 | } |
| 466 | 502 | |
| 467 | - public function getCaptchaCount() { |
|
| 503 | + public function getCaptchaCount() |
|
| 504 | + { |
|
| 468 | 505 | $req = " SELECT COUNT(*) as total FROM accounts WHERE captchaed IS NOT NULL AND reason IS NULL"; |
| 469 | 506 | $result = pg_query($this->db, $req); |
| 470 | 507 | $data = pg_fetch_object($result); |
| 471 | 508 | return $data; |
| 472 | 509 | } |
| 473 | 510 | |
| 474 | - public function getNestData() { |
|
| 511 | + public function getNestData() |
|
| 512 | + { |
|
| 475 | 513 | $pokemon_exclude_sql = ""; |
| 476 | 514 | if (!empty(self::$config->system->nest_exclude_pokemon)) { |
| 477 | 515 | $pokemon_exclude_sql = "AND p.pokemon_id NOT IN (" . implode(",", self::$config->system->nest_exclude_pokemon) . ")"; |
@@ -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,149 +449,149 @@ 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 | - case 'pokemon_slider_init': |
|
| 541 | - $bounds = $manager->getPokemonSliderMinMax(); |
|
| 540 | + case 'pokemon_slider_init': |
|
| 541 | + $bounds = $manager->getPokemonSliderMinMax(); |
|
| 542 | 542 | |
| 543 | - header('Content-Type: application/json'); |
|
| 544 | - echo json_encode($bounds); |
|
| 543 | + header('Content-Type: application/json'); |
|
| 544 | + echo json_encode($bounds); |
|
| 545 | 545 | |
| 546 | - break; |
|
| 546 | + break; |
|
| 547 | 547 | |
| 548 | 548 | |
| 549 | - case 'pokemon_heatmap_points': |
|
| 550 | - $json = ""; |
|
| 551 | - if (isset($_GET['start']) && isset($_GET['end']) && isset($_GET['pokemon_id'])) { |
|
| 552 | - $start = date("Y-m-d H:i", (int) $_GET['start']); |
|
| 553 | - $end = date("Y-m-d H:i", (int) $_GET['end']); |
|
| 554 | - $pokemon_id = $manager->getEcapedString($_GET['pokemon_id']); |
|
| 555 | - $points = $manager->getPokemonHeatmap($pokemon_id, $start, $end); |
|
| 549 | + case 'pokemon_heatmap_points': |
|
| 550 | + $json = ""; |
|
| 551 | + if (isset($_GET['start']) && isset($_GET['end']) && isset($_GET['pokemon_id'])) { |
|
| 552 | + $start = date("Y-m-d H:i", (int) $_GET['start']); |
|
| 553 | + $end = date("Y-m-d H:i", (int) $_GET['end']); |
|
| 554 | + $pokemon_id = $manager->getEcapedString($_GET['pokemon_id']); |
|
| 555 | + $points = $manager->getPokemonHeatmap($pokemon_id, $start, $end); |
|
| 556 | 556 | |
| 557 | - $json = json_encode($points); |
|
| 558 | - } |
|
| 557 | + $json = json_encode($points); |
|
| 558 | + } |
|
| 559 | 559 | |
| 560 | - header('Content-Type: application/json'); |
|
| 561 | - echo $json; |
|
| 562 | - break; |
|
| 560 | + header('Content-Type: application/json'); |
|
| 561 | + echo $json; |
|
| 562 | + break; |
|
| 563 | 563 | |
| 564 | 564 | |
| 565 | - case 'maps_localization_coordinates': |
|
| 566 | - $coordinates = $manager->getMapsCoords(); |
|
| 565 | + case 'maps_localization_coordinates': |
|
| 566 | + $coordinates = $manager->getMapsCoords(); |
|
| 567 | 567 | |
| 568 | - header('Content-Type: application/json'); |
|
| 569 | - echo json_encode($coordinates); |
|
| 568 | + header('Content-Type: application/json'); |
|
| 569 | + echo json_encode($coordinates); |
|
| 570 | 570 | |
| 571 | - break; |
|
| 571 | + break; |
|
| 572 | 572 | |
| 573 | 573 | |
| 574 | - case 'pokemon_graph_data': |
|
| 575 | - $json = ""; |
|
| 576 | - if (isset($_GET['pokemon_id'])) { |
|
| 577 | - $pokemon_id = $manager->getEcapedString($_GET['pokemon_id']); |
|
| 578 | - $array = $manager->getPokemonGraph($pokemon_id); |
|
| 574 | + case 'pokemon_graph_data': |
|
| 575 | + $json = ""; |
|
| 576 | + if (isset($_GET['pokemon_id'])) { |
|
| 577 | + $pokemon_id = $manager->getEcapedString($_GET['pokemon_id']); |
|
| 578 | + $array = $manager->getPokemonGraph($pokemon_id); |
|
| 579 | 579 | |
| 580 | - $json = json_encode($array); |
|
| 581 | - } |
|
| 580 | + $json = json_encode($array); |
|
| 581 | + } |
|
| 582 | 582 | |
| 583 | - header('Content-Type: application/json'); |
|
| 584 | - echo $json; |
|
| 585 | - break; |
|
| 583 | + header('Content-Type: application/json'); |
|
| 584 | + echo $json; |
|
| 585 | + break; |
|
| 586 | 586 | |
| 587 | 587 | |
| 588 | - case 'postRequest': |
|
| 589 | - break; |
|
| 588 | + case 'postRequest': |
|
| 589 | + break; |
|
| 590 | 590 | |
| 591 | - default: |
|
| 592 | - echo "What do you mean?"; |
|
| 593 | - exit(); |
|
| 594 | - break; |
|
| 591 | + default: |
|
| 592 | + echo "What do you mean?"; |
|
| 593 | + exit(); |
|
| 594 | + break; |
|
| 595 | 595 | } |
| 596 | 596 | |
| 597 | 597 | if ($postRequest != "") { |
@@ -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(); |
@@ -538,7 +538,7 @@ discard block |
||
| 538 | 538 | break; |
| 539 | 539 | |
| 540 | 540 | case 'pokemon_slider_init': |
| 541 | - $bounds = $manager->getPokemonSliderMinMax(); |
|
| 541 | + $bounds = $manager->getPokemonSliderMinMax(); |
|
| 542 | 542 | |
| 543 | 543 | header('Content-Type: application/json'); |
| 544 | 544 | echo json_encode($bounds); |