@@ -3,8 +3,8 @@ discard block |
||
| 3 | 3 | // Include & load the variables |
| 4 | 4 | // ############################ |
| 5 | 5 | |
| 6 | -$variables = SYS_PATH.'/core/json/variables.json'; |
|
| 7 | -$config = json_decode(file_get_contents($variables)); |
|
| 6 | +$variables = SYS_PATH.'/core/json/variables.json'; |
|
| 7 | +$config = json_decode(file_get_contents($variables)); |
|
| 8 | 8 | |
| 9 | 9 | if (!defined('SYS_PATH')) { |
| 10 | 10 | echo 'Error: config.php does not exist or failed to load.<br>'; |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | ################# |
| 39 | 39 | |
| 40 | 40 | |
| 41 | -$mysqli = new mysqli(SYS_DB_HOST, SYS_DB_USER, SYS_DB_PSWD, SYS_DB_NAME, SYS_DB_PORT); |
|
| 41 | +$mysqli = new mysqli(SYS_DB_HOST, SYS_DB_USER, SYS_DB_PSWD, SYS_DB_NAME, SYS_DB_PORT); |
|
| 42 | 42 | |
| 43 | 43 | |
| 44 | 44 | if ($mysqli->connect_error != '') { |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | // Current Pokemon datas |
| 97 | 97 | // --------------------- |
| 98 | 98 | |
| 99 | - $pokemon_id = mysqli_real_escape_string($mysqli, $_GET['id']); |
|
| 99 | + $pokemon_id = mysqli_real_escape_string($mysqli, $_GET['id']); |
|
| 100 | 100 | |
| 101 | 101 | if (!is_object($pokemons->pokemon->$pokemon_id)) { |
| 102 | 102 | header('Location:/404'); |
@@ -106,7 +106,7 @@ discard block |
||
| 106 | 106 | |
| 107 | 107 | $pokemon = new stdClass(); |
| 108 | 108 | $pokemon = $pokemons->pokemon->$pokemon_id; |
| 109 | - $pokemon->id = $pokemon_id; |
|
| 109 | + $pokemon->id = $pokemon_id; |
|
| 110 | 110 | |
| 111 | 111 | |
| 112 | 112 | // Some math |
@@ -122,19 +122,19 @@ discard block |
||
| 122 | 122 | |
| 123 | 123 | // Total gym protected |
| 124 | 124 | |
| 125 | - $req = "SELECT count( DISTINCT(gym_id) ) as total FROM gym WHERE guard_pokemon_id = '".$pokemon_id."' "; |
|
| 126 | - $result = $mysqli->query($req); |
|
| 127 | - $data = $result->fetch_object(); |
|
| 125 | + $req = "SELECT count( DISTINCT(gym_id) ) as total FROM gym WHERE guard_pokemon_id = '".$pokemon_id."' "; |
|
| 126 | + $result = $mysqli->query($req); |
|
| 127 | + $data = $result->fetch_object(); |
|
| 128 | 128 | |
| 129 | 129 | $pokemon->protected_gyms = $data->total; |
| 130 | 130 | |
| 131 | 131 | // Total spawn |
| 132 | 132 | |
| 133 | - $req = "SELECT COUNT(*) as total FROM pokemon WHERE pokemon_id = '".$pokemon_id."'"; |
|
| 134 | - $result = $mysqli->query($req); |
|
| 135 | - $data = $result->fetch_object(); |
|
| 133 | + $req = "SELECT COUNT(*) as total FROM pokemon WHERE pokemon_id = '".$pokemon_id."'"; |
|
| 134 | + $result = $mysqli->query($req); |
|
| 135 | + $data = $result->fetch_object(); |
|
| 136 | 136 | |
| 137 | - $pokemon->total_spawn = $data->total; |
|
| 137 | + $pokemon->total_spawn = $data->total; |
|
| 138 | 138 | // Spawn rate |
| 139 | 139 | |
| 140 | 140 | if ($pokemon->total_spawn > 0) { |
@@ -142,28 +142,28 @@ discard block |
||
| 142 | 142 | $result = $mysqli->query($req); |
| 143 | 143 | $data = $result->fetch_object(); |
| 144 | 144 | // Calc spawns_per_day for last week |
| 145 | - $pokemon->spawns_per_day = round(($data->spawns_last_week/7), 2); |
|
| 145 | + $pokemon->spawns_per_day = round(($data->spawns_last_week / 7), 2); |
|
| 146 | 146 | } else { |
| 147 | 147 | $pokemon->spawns_per_day = 0; |
| 148 | 148 | } |
| 149 | 149 | |
| 150 | 150 | // Last seen |
| 151 | 151 | |
| 152 | - $req = "SELECT disappear_time, (CONVERT_TZ(disappear_time, '+00:00', '".$time_offset."')) as disappear_time_real, latitude, longitude |
|
| 152 | + $req = "SELECT disappear_time, (CONVERT_TZ(disappear_time, '+00:00', '".$time_offset."')) as disappear_time_real, latitude, longitude |
|
| 153 | 153 | FROM pokemon |
| 154 | 154 | WHERE pokemon_id = '".$pokemon_id."' |
| 155 | 155 | ORDER BY disappear_time DESC |
| 156 | 156 | LIMIT 0,1"; |
| 157 | - $result = $mysqli->query($req); |
|
| 158 | - $data = $result->fetch_object(); |
|
| 157 | + $result = $mysqli->query($req); |
|
| 158 | + $data = $result->fetch_object(); |
|
| 159 | 159 | |
| 160 | 160 | if (isset($data)) { |
| 161 | - $last_spawn = $data; |
|
| 161 | + $last_spawn = $data; |
|
| 162 | 162 | |
| 163 | - $pokemon->last_seen = strtotime($data->disappear_time_real); |
|
| 164 | - $pokemon->last_position = new stdClass(); |
|
| 165 | - $pokemon->last_position->latitude = $data->latitude; |
|
| 166 | - $pokemon->last_position->longitude = $data->longitude; |
|
| 163 | + $pokemon->last_seen = strtotime($data->disappear_time_real); |
|
| 164 | + $pokemon->last_position = new stdClass(); |
|
| 165 | + $pokemon->last_position->latitude = $data->latitude; |
|
| 166 | + $pokemon->last_position->longitude = $data->longitude; |
|
| 167 | 167 | } |
| 168 | 168 | |
| 169 | 169 | // Related Pokemons |
@@ -251,23 +251,23 @@ discard block |
||
| 251 | 251 | $total = $data->total; |
| 252 | 252 | |
| 253 | 253 | $max = $config->system->max_pokemon; |
| 254 | - $pokedex = new stdClass(); |
|
| 254 | + $pokedex = new stdClass(); |
|
| 255 | 255 | |
| 256 | 256 | $req = "SELECT DISTINCT pokemon_id FROM pokemon"; |
| 257 | - $result = $mysqli->query($req); |
|
| 257 | + $result = $mysqli->query($req); |
|
| 258 | 258 | $data_array = array(); |
| 259 | 259 | |
| 260 | 260 | while ($data = $result->fetch_object()) { |
| 261 | 261 | $data_array[$data->pokemon_id] = 1; |
| 262 | 262 | }; |
| 263 | 263 | |
| 264 | - for ($i= 1; $i <= $max; $i++) { |
|
| 265 | - $pokedex->$i = new stdClass(); |
|
| 264 | + for ($i = 1; $i <= $max; $i++) { |
|
| 265 | + $pokedex->$i = new stdClass(); |
|
| 266 | 266 | $pokedex->$i->id = $i; |
| 267 | - $pokedex->$i->permalink = 'pokemon/'.$i; |
|
| 267 | + $pokedex->$i->permalink = 'pokemon/'.$i; |
|
| 268 | 268 | $pokedex->$i->img = 'core/pokemons/'.$i.$config->system->pokeimg_suffix; |
| 269 | - $pokedex->$i->name = $pokemons->pokemon->$i->name; |
|
| 270 | - $pokedex->$i->spawn = isset($data_array[$i])? $data_array[$i] : 0; |
|
| 269 | + $pokedex->$i->name = $pokemons->pokemon->$i->name; |
|
| 270 | + $pokedex->$i->spawn = isset($data_array[$i]) ? $data_array[$i] : 0; |
|
| 271 | 271 | } |
| 272 | 272 | |
| 273 | 273 | |
@@ -278,17 +278,17 @@ discard block |
||
| 278 | 278 | ############ |
| 279 | 279 | |
| 280 | 280 | case 'pokestops': |
| 281 | - $pokestop = new stdClass(); |
|
| 281 | + $pokestop = new stdClass(); |
|
| 282 | 282 | |
| 283 | - $req = "SELECT COUNT(*) as total FROM pokestop"; |
|
| 284 | - $result = $mysqli->query($req); |
|
| 285 | - $data = $result->fetch_object(); |
|
| 283 | + $req = "SELECT COUNT(*) as total FROM pokestop"; |
|
| 284 | + $result = $mysqli->query($req); |
|
| 285 | + $data = $result->fetch_object(); |
|
| 286 | 286 | |
| 287 | 287 | $pokestop->total = $data->total; |
| 288 | 288 | |
| 289 | - $req = "SELECT COUNT(*) as total FROM pokestop WHERE lure_expiration >= UTC_TIMESTAMP()"; |
|
| 290 | - $result = $mysqli->query($req); |
|
| 291 | - $data = $result->fetch_object(); |
|
| 289 | + $req = "SELECT COUNT(*) as total FROM pokestop WHERE lure_expiration >= UTC_TIMESTAMP()"; |
|
| 290 | + $result = $mysqli->query($req); |
|
| 291 | + $data = $result->fetch_object(); |
|
| 292 | 292 | |
| 293 | 293 | $pokestop->lured = $data->total; |
| 294 | 294 | |
@@ -305,36 +305,36 @@ discard block |
||
| 305 | 305 | // 3 Teams (teamm rocket is neutral) |
| 306 | 306 | // 1 Fight |
| 307 | 307 | |
| 308 | - $teams = new stdClass(); |
|
| 308 | + $teams = new stdClass(); |
|
| 309 | 309 | |
| 310 | - $teams->mystic = new stdClass(); |
|
| 311 | - $teams->mystic->guardians = new stdClass(); |
|
| 312 | - $teams->mystic->id = 1; |
|
| 310 | + $teams->mystic = new stdClass(); |
|
| 311 | + $teams->mystic->guardians = new stdClass(); |
|
| 312 | + $teams->mystic->id = 1; |
|
| 313 | 313 | |
| 314 | - $teams->valor = new stdClass(); |
|
| 315 | - $teams->valor->guardians = new stdClass(); |
|
| 316 | - $teams->valor->id = 2; |
|
| 314 | + $teams->valor = new stdClass(); |
|
| 315 | + $teams->valor->guardians = new stdClass(); |
|
| 316 | + $teams->valor->id = 2; |
|
| 317 | 317 | |
| 318 | - $teams->instinct = new stdClass(); |
|
| 319 | - $teams->instinct->guardians = new stdClass(); |
|
| 320 | - $teams->instinct->id = 3; |
|
| 318 | + $teams->instinct = new stdClass(); |
|
| 319 | + $teams->instinct->guardians = new stdClass(); |
|
| 320 | + $teams->instinct->id = 3; |
|
| 321 | 321 | |
| 322 | - $teams->rocket = new stdClass(); |
|
| 323 | - $teams->rocket->guardians = new stdClass(); |
|
| 324 | - $teams->rocket->id = 0; |
|
| 322 | + $teams->rocket = new stdClass(); |
|
| 323 | + $teams->rocket->guardians = new stdClass(); |
|
| 324 | + $teams->rocket->id = 0; |
|
| 325 | 325 | |
| 326 | 326 | |
| 327 | 327 | |
| 328 | 328 | foreach ($teams as $team_key => $team_values) { |
| 329 | 329 | // Team Guardians |
| 330 | 330 | |
| 331 | - $req = "SELECT COUNT(*) as total, guard_pokemon_id FROM gym WHERE team_id = '".$team_values->id."' GROUP BY guard_pokemon_id ORDER BY total DESC LIMIT 0,3 "; |
|
| 331 | + $req = "SELECT COUNT(*) as total, guard_pokemon_id FROM gym WHERE team_id = '".$team_values->id."' GROUP BY guard_pokemon_id ORDER BY total DESC LIMIT 0,3 "; |
|
| 332 | 332 | $result = $mysqli->query($req); |
| 333 | 333 | |
| 334 | - $i=0; |
|
| 334 | + $i = 0; |
|
| 335 | 335 | |
| 336 | 336 | while ($data = $result->fetch_object()) { |
| 337 | - $teams->$team_key->guardians->$i = $data->guard_pokemon_id; |
|
| 337 | + $teams->$team_key->guardians->$i = $data->guard_pokemon_id; |
|
| 338 | 338 | |
| 339 | 339 | $i++; |
| 340 | 340 | } |
@@ -346,8 +346,8 @@ discard block |
||
| 346 | 346 | $result = $mysqli->query($req); |
| 347 | 347 | $data = $result->fetch_object(); |
| 348 | 348 | |
| 349 | - $teams->$team_key->gym_owned = $data->total; |
|
| 350 | - $teams->$team_key->average = $data->average_points; |
|
| 349 | + $teams->$team_key->gym_owned = $data->total; |
|
| 350 | + $teams->$team_key->average = $data->average_points; |
|
| 351 | 351 | } |
| 352 | 352 | |
| 353 | 353 | |
@@ -360,7 +360,7 @@ discard block |
||
| 360 | 360 | case 'dashboard': |
| 361 | 361 | // This case is only used for test purpose. |
| 362 | 362 | |
| 363 | - $stats_file = SYS_PATH.'/core/json/gym.stats.json'; |
|
| 363 | + $stats_file = SYS_PATH.'/core/json/gym.stats.json'; |
|
| 364 | 364 | |
| 365 | 365 | if (!is_file($stats_file)) { |
| 366 | 366 | echo "Sorry, no Gym stats file was found. <br> Did you enable cron? "; |
@@ -368,7 +368,7 @@ discard block |
||
| 368 | 368 | } |
| 369 | 369 | |
| 370 | 370 | |
| 371 | - $stats_file = SYS_PATH.'/core/json/pokemon.stats.json'; |
|
| 371 | + $stats_file = SYS_PATH.'/core/json/pokemon.stats.json'; |
|
| 372 | 372 | |
| 373 | 373 | if (!is_file($stats_file)) { |
| 374 | 374 | echo "Sorry, no Pokémon stats file was found. <br> Did you enabled cron?"; |
@@ -376,7 +376,7 @@ discard block |
||
| 376 | 376 | } |
| 377 | 377 | |
| 378 | 378 | |
| 379 | - $stats_file = SYS_PATH.'/core/json/pokestop.stats.json'; |
|
| 379 | + $stats_file = SYS_PATH.'/core/json/pokestop.stats.json'; |
|
| 380 | 380 | |
| 381 | 381 | if (!is_file($stats_file)) { |
| 382 | 382 | echo "Sorry, no Pokéstop stats file was found. <br> Did you enabled cron?"; |
@@ -384,7 +384,7 @@ discard block |
||
| 384 | 384 | } |
| 385 | 385 | |
| 386 | 386 | if ($config->system->captcha_support) { |
| 387 | - $stats_file = SYS_PATH.'/core/json/captcha.stats.json'; |
|
| 387 | + $stats_file = SYS_PATH.'/core/json/captcha.stats.json'; |
|
| 388 | 388 | |
| 389 | 389 | if (!is_file($stats_file)) { |
| 390 | 390 | echo "Sorry, no Captcha stats file were found <br> Have you enable cron?"; |
@@ -404,9 +404,9 @@ discard block |
||
| 404 | 404 | // Right now |
| 405 | 405 | // --------- |
| 406 | 406 | |
| 407 | - $req = "SELECT COUNT(*) as total FROM pokemon WHERE disappear_time >= UTC_TIMESTAMP()"; |
|
| 408 | - $result = $mysqli->query($req); |
|
| 409 | - $data = $result->fetch_object(); |
|
| 407 | + $req = "SELECT COUNT(*) as total FROM pokemon WHERE disappear_time >= UTC_TIMESTAMP()"; |
|
| 408 | + $result = $mysqli->query($req); |
|
| 409 | + $data = $result->fetch_object(); |
|
| 410 | 410 | |
| 411 | 411 | |
| 412 | 412 | $home->pokemon_now = $data->total; |
@@ -415,9 +415,9 @@ discard block |
||
| 415 | 415 | // Lured stops |
| 416 | 416 | // ----------- |
| 417 | 417 | |
| 418 | - $req = "SELECT COUNT(*) as total FROM pokestop WHERE lure_expiration >= UTC_TIMESTAMP()"; |
|
| 419 | - $result = $mysqli->query($req); |
|
| 420 | - $data = $result->fetch_object(); |
|
| 418 | + $req = "SELECT COUNT(*) as total FROM pokestop WHERE lure_expiration >= UTC_TIMESTAMP()"; |
|
| 419 | + $result = $mysqli->query($req); |
|
| 420 | + $data = $result->fetch_object(); |
|
| 421 | 421 | |
| 422 | 422 | $home->pokestop_lured = $data->total; |
| 423 | 423 | |
@@ -425,9 +425,9 @@ discard block |
||
| 425 | 425 | // Gyms |
| 426 | 426 | // ---- |
| 427 | 427 | |
| 428 | - $req = "SELECT COUNT(DISTINCT(gym_id)) as total FROM gym"; |
|
| 429 | - $result = $mysqli->query($req); |
|
| 430 | - $data = $result->fetch_object(); |
|
| 428 | + $req = "SELECT COUNT(DISTINCT(gym_id)) as total FROM gym"; |
|
| 429 | + $result = $mysqli->query($req); |
|
| 430 | + $data = $result->fetch_object(); |
|
| 431 | 431 | |
| 432 | 432 | $home->gyms = $data->total; |
| 433 | 433 | |
@@ -437,19 +437,19 @@ discard block |
||
| 437 | 437 | |
| 438 | 438 | if ($config->system->recents_filter) { |
| 439 | 439 | // get all mythic pokemon ids |
| 440 | - $mythic_pokemons = array(); |
|
| 440 | + $mythic_pokemons = array(); |
|
| 441 | 441 | foreach ($pokemons->pokemon as $id => $pokemon) { |
| 442 | 442 | if ($pokemon->spawn_rate < $config->system->recents_filter_rarity && $pokemon->rating >= $config->system->recents_filter_rating) { |
| 443 | 443 | $mythic_pokemons[] = $id; |
| 444 | 444 | } |
| 445 | 445 | } |
| 446 | 446 | // get all mythic pokemon |
| 447 | - $req = "SELECT DISTINCT pokemon_id, encounter_id, disappear_time, last_modified, (CONVERT_TZ(disappear_time, '+00:00', '".$time_offset."')) as disappear_time_real, latitude, longitude, individual_attack, individual_defense, individual_stamina FROM pokemon |
|
| 447 | + $req = "SELECT DISTINCT pokemon_id, encounter_id, disappear_time, last_modified, (CONVERT_TZ(disappear_time, '+00:00', '".$time_offset."')) as disappear_time_real, latitude, longitude, individual_attack, individual_defense, individual_stamina FROM pokemon |
|
| 448 | 448 | WHERE pokemon_id IN (".implode(",", $mythic_pokemons).") |
| 449 | 449 | ORDER BY last_modified DESC LIMIT 0,12"; |
| 450 | 450 | } else { |
| 451 | 451 | // get all pokemon |
| 452 | - $req = "SELECT DISTINCT pokemon_id, encounter_id, disappear_time, last_modified, (CONVERT_TZ(disappear_time, '+00:00', '".$time_offset."')) as disappear_time_real, latitude, longitude, individual_attack, individual_defense, individual_stamina FROM pokemon |
|
| 452 | + $req = "SELECT DISTINCT pokemon_id, encounter_id, disappear_time, last_modified, (CONVERT_TZ(disappear_time, '+00:00', '".$time_offset."')) as disappear_time_real, latitude, longitude, individual_attack, individual_defense, individual_stamina FROM pokemon |
|
| 453 | 453 | ORDER BY last_modified DESC LIMIT 0,12"; |
| 454 | 454 | } |
| 455 | 455 | $result = $mysqli->query($req); |
@@ -495,28 +495,28 @@ discard block |
||
| 495 | 495 | |
| 496 | 496 | $req = "SELECT count( DISTINCT(gym_id) ) as total FROM gym WHERE team_id = '1' "; |
| 497 | 497 | $result = $mysqli->query($req); |
| 498 | - $data = $result->fetch_object(); |
|
| 498 | + $data = $result->fetch_object(); |
|
| 499 | 499 | |
| 500 | - $home->teams->mystic = $data->total; |
|
| 500 | + $home->teams->mystic = $data->total; |
|
| 501 | 501 | |
| 502 | 502 | |
| 503 | 503 | $req = "SELECT count( DISTINCT(gym_id) ) as total FROM gym WHERE team_id = '2' "; |
| 504 | 504 | $result = $mysqli->query($req); |
| 505 | - $data = $result->fetch_object(); |
|
| 505 | + $data = $result->fetch_object(); |
|
| 506 | 506 | |
| 507 | - $home->teams->valor = $data->total; |
|
| 507 | + $home->teams->valor = $data->total; |
|
| 508 | 508 | |
| 509 | 509 | |
| 510 | 510 | $req = "SELECT count( DISTINCT(gym_id) ) as total FROM gym WHERE team_id = '3' "; |
| 511 | 511 | $result = $mysqli->query($req); |
| 512 | - $data = $result->fetch_object(); |
|
| 512 | + $data = $result->fetch_object(); |
|
| 513 | 513 | |
| 514 | - $home->teams->instinct = $data->total; |
|
| 514 | + $home->teams->instinct = $data->total; |
|
| 515 | 515 | |
| 516 | 516 | |
| 517 | 517 | $req = "SELECT count( DISTINCT(gym_id) ) as total FROM gym WHERE team_id = '0' "; |
| 518 | 518 | $result = $mysqli->query($req); |
| 519 | - $data = $result->fetch_object(); |
|
| 519 | + $data = $result->fetch_object(); |
|
| 520 | 520 | |
| 521 | - $home->teams->rocket = $data->total; |
|
| 521 | + $home->teams->rocket = $data->total; |
|
| 522 | 522 | } |
@@ -19,7 +19,7 @@ discard block |
||
| 19 | 19 | * |
| 20 | 20 | * @return array Sorted list of "accept" options |
| 21 | 21 | */ |
| 22 | -$sortAccept = function ($header) { |
|
| 22 | +$sortAccept = function($header) { |
|
| 23 | 23 | $matches = array(); |
| 24 | 24 | foreach (explode(',', $header) as $option) { |
| 25 | 25 | $option = array_map('trim', explode(';', $option)); |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | * |
| 53 | 53 | * @return string|NULL a matched option, or NULL if no match |
| 54 | 54 | */ |
| 55 | -$matchAccept = function ($header, $supported) use ($sortAccept) { |
|
| 55 | +$matchAccept = function($header, $supported) use ($sortAccept) { |
|
| 56 | 56 | $matches = $sortAccept($header); |
| 57 | 57 | foreach ($matches as $key => $q) { |
| 58 | 58 | if (isset($supported[$key])) { |
@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | * |
| 84 | 84 | * @return string The negotiated language result or the supplied default. |
| 85 | 85 | */ |
| 86 | -$negotiateLanguage = function ($supported, $default = 'en-US') use ($matchAccept) { |
|
| 86 | +$negotiateLanguage = function($supported, $default = 'en-US') use ($matchAccept) { |
|
| 87 | 87 | $supp = array(); |
| 88 | 88 | foreach ($supported as $lang => $isSupported) { |
| 89 | 89 | if ($isSupported) { |
@@ -162,22 +162,22 @@ discard block |
||
| 162 | 162 | // Merge the pokedex, pokemon translation and rarity file into a new array |
| 163 | 163 | ########################################################################## |
| 164 | 164 | |
| 165 | -$pokedex_file = file_get_contents(SYS_PATH.'/core/json/pokedex.json'); |
|
| 166 | -$pokemons = json_decode($pokedex_file); |
|
| 165 | +$pokedex_file = file_get_contents(SYS_PATH.'/core/json/pokedex.json'); |
|
| 166 | +$pokemons = json_decode($pokedex_file); |
|
| 167 | 167 | |
| 168 | 168 | $pokedex_rarity_file = SYS_PATH.'/core/json/pokedex.rarity.json'; |
| 169 | 169 | $pokemons_rarity = json_decode(file_get_contents($pokedex_rarity_file)); |
| 170 | 170 | |
| 171 | 171 | foreach ($pokemons->pokemon as $pokeid => $pokemon) { |
| 172 | 172 | // Merge name and description from translation files |
| 173 | - $pokemon->name = $pokemon_trans->pokemon->$pokeid->name; |
|
| 174 | - $pokemon->description = $pokemon_trans->pokemon->$pokeid->description; |
|
| 173 | + $pokemon->name = $pokemon_trans->pokemon->$pokeid->name; |
|
| 174 | + $pokemon->description = $pokemon_trans->pokemon->$pokeid->description; |
|
| 175 | 175 | |
| 176 | 176 | // Replace quick and charge move with translation |
| 177 | - $quick_move = $pokemon->quick_move; |
|
| 178 | - $pokemon->quick_move = $pokemon_trans->quick_moves->$quick_move; |
|
| 179 | - $charge_move = $pokemon->charge_move; |
|
| 180 | - $pokemon->charge_move = $pokemon_trans->charge_moves->$charge_move; |
|
| 177 | + $quick_move = $pokemon->quick_move; |
|
| 178 | + $pokemon->quick_move = $pokemon_trans->quick_moves->$quick_move; |
|
| 179 | + $charge_move = $pokemon->charge_move; |
|
| 180 | + $pokemon->charge_move = $pokemon_trans->charge_moves->$charge_move; |
|
| 181 | 181 | |
| 182 | 182 | // Replace types with translation |
| 183 | 183 | foreach ($pokemon->types as &$type) { |
@@ -187,8 +187,8 @@ discard block |
||
| 187 | 187 | |
| 188 | 188 | // Resolve candy_id to candy_name |
| 189 | 189 | if (isset($pokemon->candy_id)) { |
| 190 | - $candy_id = $pokemon->candy_id; |
|
| 191 | - $pokemon->candy_name = $pokemon_trans->pokemon->$candy_id->name; |
|
| 190 | + $candy_id = $pokemon->candy_id; |
|
| 191 | + $pokemon->candy_name = $pokemon_trans->pokemon->$candy_id->name; |
|
| 192 | 192 | unset($pokemon->candy_id); |
| 193 | 193 | } |
| 194 | 194 | // Convert move numbers to names |
@@ -224,8 +224,8 @@ discard block |
||
| 224 | 224 | // Translate typecolors array keys as well |
| 225 | 225 | $types_temp = new stdClass(); |
| 226 | 226 | foreach ($pokemons->typecolors as $type => $color) { |
| 227 | - $type_trans = $pokemon_trans->types->$type; |
|
| 228 | - $types_temp->$type_trans = $color; |
|
| 227 | + $type_trans = $pokemon_trans->types->$type; |
|
| 228 | + $types_temp->$type_trans = $color; |
|
| 229 | 229 | } |
| 230 | 230 | // Replace typecolors array with translated one |
| 231 | 231 | $pokemons->typecolors = $types_temp; |
@@ -3,7 +3,7 @@ discard block |
||
| 3 | 3 | // This file only include other files to have only 1 entry in your crontabs. |
| 4 | 4 | // ------------------------------------------------------------------------ |
| 5 | 5 | |
| 6 | -$config_file = dirname(__FILE__).'/../../config.php'; |
|
| 6 | +$config_file = dirname(__FILE__).'/../../config.php'; |
|
| 7 | 7 | |
| 8 | 8 | include_once($config_file); |
| 9 | 9 | |
@@ -23,7 +23,7 @@ discard block |
||
| 23 | 23 | |
| 24 | 24 | |
| 25 | 25 | # MySQL |
| 26 | -$mysqli = new mysqli(SYS_DB_HOST, SYS_DB_USER, SYS_DB_PSWD, SYS_DB_NAME, SYS_DB_PORT); |
|
| 26 | +$mysqli = new mysqli(SYS_DB_HOST, SYS_DB_USER, SYS_DB_PSWD, SYS_DB_NAME, SYS_DB_PORT); |
|
| 27 | 27 | |
| 28 | 28 | if ($mysqli->connect_error != '') { |
| 29 | 29 | die('MySQL connect error'); |
@@ -32,9 +32,9 @@ discard block |
||
| 32 | 32 | |
| 33 | 33 | // Update dashboard data |
| 34 | 34 | // the following files are updated every run |
| 35 | -$gym_file = SYS_PATH.'/core/json/gym.stats.json'; |
|
| 36 | -$pokestop_file = SYS_PATH.'/core/json/pokestop.stats.json'; |
|
| 37 | -$pokemonstats_file = SYS_PATH.'/core/json/pokemon.stats.json'; |
|
| 35 | +$gym_file = SYS_PATH.'/core/json/gym.stats.json'; |
|
| 36 | +$pokestop_file = SYS_PATH.'/core/json/pokestop.stats.json'; |
|
| 37 | +$pokemonstats_file = SYS_PATH.'/core/json/pokemon.stats.json'; |
|
| 38 | 38 | |
| 39 | 39 | |
| 40 | 40 | if (is_file($gym_file)) { |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | $pokedatas = json_decode(file_get_contents($pokemonstats_file), true); |
| 48 | 48 | } |
| 49 | 49 | |
| 50 | -$timestamp = time(); |
|
| 50 | +$timestamp = time(); |
|
| 51 | 51 | |
| 52 | 52 | include_once(SYS_PATH.'/core/cron/gym.cron.php'); |
| 53 | 53 | include_once(SYS_PATH.'/core/cron/pokemon.cron.php'); |