@@ -22,7 +22,7 @@ |
||
| 22 | 22 | $rarityarray = array(); |
| 23 | 23 | foreach ($counts as $poke_id => $total) { |
| 24 | 24 | $rarity = $pokemons->pokemon->$poke_id->rarity; |
| 25 | - isset($rarityarray[$rarity]) ? $rarityarray[$rarity]+=$total : $rarityarray[$rarity]=$total; |
|
| 25 | + isset($rarityarray[$rarity]) ? $rarityarray[$rarity] += $total : $rarityarray[$rarity] = $total; |
|
| 26 | 26 | } |
| 27 | 27 | |
| 28 | 28 | // Set amount of Pokemon for each rarity to 0 if there weren't any at that time |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | // Load Query Manager |
| 30 | 30 | // ################### |
| 31 | 31 | |
| 32 | -include_once __DIR__ . '/../process/queries/QueryManager.php'; |
|
| 32 | +include_once __DIR__.'/../process/queries/QueryManager.php'; |
|
| 33 | 33 | $manager = QueryManager::current(); |
| 34 | 34 | |
| 35 | 35 | |
@@ -51,10 +51,10 @@ discard block |
||
| 51 | 51 | $pokedatas = json_decode(file_get_contents($pokemonstats_file), true); |
| 52 | 52 | } |
| 53 | 53 | if (is_file($pokedex_counts_file)) { |
| 54 | - $pokecountdatas = json_decode(file_get_contents($pokedex_counts_file), true); |
|
| 54 | + $pokecountdatas = json_decode(file_get_contents($pokedex_counts_file), true); |
|
| 55 | 55 | } |
| 56 | 56 | if (is_file($pokedex_raids_file)) { |
| 57 | - $raiddatas = json_decode(file_get_contents($pokedex_raids_file), true); |
|
| 57 | + $raiddatas = json_decode(file_get_contents($pokedex_raids_file), true); |
|
| 58 | 58 | } |
| 59 | 59 | |
| 60 | 60 | |
@@ -28,7 +28,7 @@ |
||
| 28 | 28 | $trainer_lvl = []; |
| 29 | 29 | # For all 3 teams |
| 30 | 30 | for ($teamid = 1; $teamid <= 3; $teamid++) { |
| 31 | - $data = $manager->getTrainerLevelCount($teamid); |
|
| 31 | + $data = $manager->getTrainerLevelCount($teamid); |
|
| 32 | 32 | $trainer_lvl[$teamid] = $data; |
| 33 | 33 | } |
| 34 | 34 | |
@@ -20,7 +20,7 @@ |
||
| 20 | 20 | // Load Query Manager |
| 21 | 21 | // ################### |
| 22 | 22 | |
| 23 | -include_once __DIR__ . '/../process/queries/QueryManager.php'; |
|
| 23 | +include_once __DIR__.'/../process/queries/QueryManager.php'; |
|
| 24 | 24 | $manager = QueryManager::current(); |
| 25 | 25 | |
| 26 | 26 | # Chart Graph datas |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | // Load Query Manager |
| 70 | 70 | // ################### |
| 71 | 71 | |
| 72 | -include_once __DIR__ . '/queries/QueryManager.php'; |
|
| 72 | +include_once __DIR__.'/queries/QueryManager.php'; |
|
| 73 | 73 | $manager = QueryManager::current(); |
| 74 | 74 | |
| 75 | 75 | |
@@ -268,7 +268,7 @@ discard block |
||
| 268 | 268 | |
| 269 | 269 | |
| 270 | 270 | // Gym owned and average points |
| 271 | - $data = $manager->getOwnedAndPoints($team_values->id); |
|
| 271 | + $data = $manager->getOwnedAndPoints($team_values->id); |
|
| 272 | 272 | |
| 273 | 273 | $teams->$team_key->gym_owned = $data->total; |
| 274 | 274 | $teams->$team_key->average = $data->average_points; |
@@ -3,7 +3,7 @@ |
||
| 3 | 3 | // Load Query Manager |
| 4 | 4 | // ################### |
| 5 | 5 | |
| 6 | -include_once __DIR__ . '/../core/process/queries/QueryManager.php'; |
|
| 6 | +include_once __DIR__.'/../core/process/queries/QueryManager.php'; |
|
| 7 | 7 | |
| 8 | 8 | |
| 9 | 9 | ######################################################################## |
@@ -1,6 +1,6 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -include_once __DIR__ . '/QueryManagerPostgresqlMonocleAlternate.php'; |
|
| 3 | +include_once __DIR__.'/QueryManagerPostgresqlMonocleAlternate.php'; |
|
| 4 | 4 | |
| 5 | 5 | |
| 6 | 6 | abstract class QueryManagerPostgresql extends QueryManager { |
@@ -12,7 +12,7 @@ discard block |
||
| 12 | 12 | $this->db = pg_connect("host=".SYS_DB_HOST." port=".SYS_DB_PORT." dbname=".SYS_DB_NAME." user=".SYS_DB_USER." password=".SYS_DB_PSWD); |
| 13 | 13 | |
| 14 | 14 | if ($this->db === false) { |
| 15 | - header('Location:' . HOST_URL . 'offline.html'); |
|
| 15 | + header('Location:'.HOST_URL.'offline.html'); |
|
| 16 | 16 | exit(); |
| 17 | 17 | } |
| 18 | 18 | } |
@@ -3,11 +3,13 @@ discard block |
||
| 3 | 3 | include_once __DIR__ . '/QueryManagerPostgresqlMonocleAlternate.php'; |
| 4 | 4 | |
| 5 | 5 | |
| 6 | -abstract class QueryManagerPostgresql extends QueryManager { |
|
| 6 | +abstract class QueryManagerPostgresql extends QueryManager |
|
| 7 | +{ |
|
| 7 | 8 | |
| 8 | 9 | protected $db; |
| 9 | 10 | |
| 10 | - protected function __construct() { |
|
| 11 | + protected function __construct() |
|
| 12 | + { |
|
| 11 | 13 | |
| 12 | 14 | $this->db = pg_connect("host=".SYS_DB_HOST." port=".SYS_DB_PORT." dbname=".SYS_DB_NAME." user=".SYS_DB_USER." password=".SYS_DB_PSWD); |
| 13 | 15 | |
@@ -17,7 +19,8 @@ discard block |
||
| 17 | 19 | } |
| 18 | 20 | } |
| 19 | 21 | |
| 20 | - public function __destruct() { |
|
| 22 | + public function __destruct() |
|
| 23 | + { |
|
| 21 | 24 | pg_close($this->db); |
| 22 | 25 | } |
| 23 | 26 | |
@@ -25,7 +28,8 @@ discard block |
||
| 25 | 28 | // Misc |
| 26 | 29 | ///////// |
| 27 | 30 | |
| 28 | - public function getEcapedString($string) { |
|
| 31 | + public function getEcapedString($string) |
|
| 32 | + { |
|
| 29 | 33 | return pg_escape_string($this->db, $string); |
| 30 | 34 | } |
| 31 | 35 | |
@@ -1,7 +1,7 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -include_once __DIR__ . '/QueryManagerMysqlRocketmap.php'; |
|
| 4 | -include_once __DIR__ . '/QueryManagerMysqlMonocleAlternate.php'; |
|
| 3 | +include_once __DIR__.'/QueryManagerMysqlRocketmap.php'; |
|
| 4 | +include_once __DIR__.'/QueryManagerMysqlMonocleAlternate.php'; |
|
| 5 | 5 | |
| 6 | 6 | |
| 7 | 7 | abstract class QueryManagerMysql extends QueryManager { |
@@ -4,11 +4,13 @@ discard block |
||
| 4 | 4 | include_once __DIR__ . '/QueryManagerMysqlMonocleAlternate.php'; |
| 5 | 5 | |
| 6 | 6 | |
| 7 | -abstract class QueryManagerMysql extends QueryManager { |
|
| 7 | +abstract class QueryManagerMysql extends QueryManager |
|
| 8 | +{ |
|
| 8 | 9 | |
| 9 | 10 | protected $mysqli; |
| 10 | 11 | |
| 11 | - protected function __construct() { |
|
| 12 | + protected function __construct() |
|
| 13 | + { |
|
| 12 | 14 | $this->mysqli = new mysqli(SYS_DB_HOST, SYS_DB_USER, SYS_DB_PSWD, SYS_DB_NAME, SYS_DB_PORT); |
| 13 | 15 | if ($this->mysqli->connect_error != '') { |
| 14 | 16 | header('Location:'.HOST_URL.'offline.html'); |
@@ -22,7 +24,8 @@ discard block |
||
| 22 | 24 | } |
| 23 | 25 | } |
| 24 | 26 | |
| 25 | - public function __destruct() { |
|
| 27 | + public function __destruct() |
|
| 28 | + { |
|
| 26 | 29 | $this->mysqli->close(); |
| 27 | 30 | } |
| 28 | 31 | |
@@ -30,7 +33,8 @@ discard block |
||
| 30 | 33 | // Misc |
| 31 | 34 | ///////// |
| 32 | 35 | |
| 33 | - public function getEcapedString($string) { |
|
| 36 | + public function getEcapedString($string) |
|
| 37 | + { |
|
| 34 | 38 | return mysqli_real_escape_string($this->mysqli, $string); |
| 35 | 39 | } |
| 36 | 40 | |
@@ -1,8 +1,8 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -include_once __DIR__ . '/../../../config.php'; |
|
| 4 | -include_once __DIR__ . '/QueryManagerMysql.php'; |
|
| 5 | -include_once __DIR__ . '/QueryManagerPostgresql.php'; |
|
| 3 | +include_once __DIR__.'/../../../config.php'; |
|
| 4 | +include_once __DIR__.'/QueryManagerMysql.php'; |
|
| 5 | +include_once __DIR__.'/QueryManagerPostgresql.php'; |
|
| 6 | 6 | |
| 7 | 7 | abstract class QueryManager { |
| 8 | 8 | |
@@ -15,7 +15,7 @@ discard block |
||
| 15 | 15 | |
| 16 | 16 | if (self::$current == null) { |
| 17 | 17 | |
| 18 | - $variables = realpath(dirname(__FILE__)) . '/../../json/variables.json'; |
|
| 18 | + $variables = realpath(dirname(__FILE__)).'/../../json/variables.json'; |
|
| 19 | 19 | self::$config = json_decode(file_get_contents($variables)); |
| 20 | 20 | |
| 21 | 21 | include_once(SYS_PATH.'/core/process/timezone.loader.php'); |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | } |
| 38 | 38 | return self::$current; |
| 39 | 39 | } |
| 40 | - private function __construct(){} |
|
| 40 | + private function __construct() {} |
|
| 41 | 41 | |
| 42 | 42 | // Misc |
| 43 | 43 | abstract public function getEcapedString($string); |
@@ -4,13 +4,15 @@ discard block |
||
| 4 | 4 | include_once __DIR__ . '/QueryManagerMysql.php'; |
| 5 | 5 | include_once __DIR__ . '/QueryManagerPostgresql.php'; |
| 6 | 6 | |
| 7 | -abstract class QueryManager { |
|
| 7 | +abstract class QueryManager |
|
| 8 | +{ |
|
| 8 | 9 | |
| 9 | 10 | protected static $time_offset; |
| 10 | 11 | protected static $config; |
| 11 | 12 | |
| 12 | 13 | private static $current; |
| 13 | - public static function current() { |
|
| 14 | + public static function current() |
|
| 15 | + { |
|
| 14 | 16 | global $time_offset; |
| 15 | 17 | |
| 16 | 18 | if (self::$current == null) { |
@@ -37,7 +39,9 @@ discard block |
||
| 37 | 39 | } |
| 38 | 40 | return self::$current; |
| 39 | 41 | } |
| 40 | - private function __construct(){} |
|
| 42 | + private function __construct() |
|
| 43 | + { |
|
| 44 | +} |
|
| 41 | 45 | |
| 42 | 46 | // Misc |
| 43 | 47 | abstract public function getEcapedString($string); |
@@ -17,8 +17,8 @@ |
||
| 17 | 17 | $nests['lng'] = $data->longitude; |
| 18 | 18 | $starttime = $data->latest_seen - $data->duration; |
| 19 | 19 | |
| 20 | - $nests['st'] = date("i",$starttime); |
|
| 21 | - $nests['et'] = date("i",$data->latest_seen); |
|
| 20 | + $nests['st'] = date("i", $starttime); |
|
| 21 | + $nests['et'] = date("i", $data->latest_seen); |
|
| 22 | 22 | |
| 23 | 23 | // Add the data to array |
| 24 | 24 | $nestsdatas[] = $nests; |