Passed
Pull Request — master (#192)
by PoUpA
02:32
created
core/cron/captcha.cron.php 1 patch
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -5,45 +5,45 @@  discard block
 block discarded – undo
5 5
 // Total lured
6 6
 // -----------------------------------------------------------------------------------------------------------
7 7
 
8
-$captcha_file	= SYS_PATH.'/core/json/captcha.stats.json';
8
+$captcha_file = SYS_PATH.'/core/json/captcha.stats.json';
9 9
 if (is_file($captcha_file)) {
10
-	$capdatas	= json_decode(file_get_contents($captcha_file), true);
10
+	$capdatas = json_decode(file_get_contents($captcha_file), true);
11 11
 }
12 12
 
13 13
 
14 14
 $variables_secret = SYS_PATH.'/core/json/variables.secret.json';
15 15
 $config_secret = json_decode(file_get_contents($variables_secret));
16 16
 
17
-if ($config_secret->captcha_key=="") {
17
+if ($config_secret->captcha_key == "") {
18 18
 	$captcha['timestamp'] = $timestamp;
19 19
 	// get amount of accounts requiring a captcha
20 20
 	$req = "SELECT COUNT(*) as total "
21 21
 			. "FROM workerstatus WHERE message LIKE '%encountering a captcha%' "
22 22
 			. "AND last_modified >= UTC_TIMESTAMP() - INTERVAL 60 SECOND";
23
-	$result 	= $mysqli->query($req);
24
-	$data 		= $result->fetch_object();
23
+	$result = $mysqli->query($req);
24
+	$data = $result->fetch_object();
25 25
 	$captcha['captcha_accs'] = $data->total;
26 26
 	// Add the datas in file
27
-	$capdatas[] 	= $captcha;
27
+	$capdatas[] = $captcha;
28 28
 } else {
29 29
 	if (!empty($capdatas)) {
30 30
 		$lastCaptcha = array_pop($capdatas);
31 31
 	} else {
32
-		$lastCaptcha["timestamp"]=strtotime("-7 days", strtotime(date("Y-m-d")));
32
+		$lastCaptcha["timestamp"] = strtotime("-7 days", strtotime(date("Y-m-d")));
33 33
 	}
34 34
 	$lastCaptchaDate = date("Y-m-d", $lastCaptcha["timestamp"]);
35 35
 	$startTime = strtotime($lastCaptchaDate);
36
-	$endTime = strtotime(date("Y-m-d"))+date("Z");
36
+	$endTime = strtotime(date("Y-m-d")) + date("Z");
37 37
 	$timeDiff = abs($endTime - $startTime);
38
-	$numberDays = intval($timeDiff/86400) ;  // 86400 seconds in one day
39
-	if ($numberDays>7) {
40
-		$numberDays=7;
38
+	$numberDays = intval($timeDiff / 86400); // 86400 seconds in one day
39
+	if ($numberDays > 7) {
40
+		$numberDays = 7;
41 41
 	}
42
-	while ($numberDays>=0) {
43
-		$day = $endTime-($numberDays*86400);
42
+	while ($numberDays >= 0) {
43
+		$day = $endTime - ($numberDays * 86400);
44 44
 		$captchaUrl =
45
-				"http://2captcha.com/res.php?key=" .
46
-				$config_secret->captcha_key . "&action=getstats&date=" . date("Y-m-d", $day);
45
+				"http://2captcha.com/res.php?key=".
46
+				$config_secret->captcha_key."&action=getstats&date=".date("Y-m-d", $day);
47 47
 
48 48
 		$ch = curl_init();
49 49
 		curl_setopt($ch, CURLOPT_URL, $captchaUrl);
@@ -65,18 +65,18 @@  discard block
 block discarded – undo
65 65
 		$capXml = simplexml_load_string($fileContents);
66 66
 
67 67
 		foreach ($capXml as $key => $value) {
68
-			if (	($numberDays==0
69
-				&& ((int)$value->Attributes()->hour >= (int)date("H", $lastCaptcha["timestamp"])
70
-				&& ((int)$value->Attributes()->hour <= (int)date("H")))
71
-				) || $numberDays>0) {
68
+			if (($numberDays == 0
69
+				&& ((int) $value->Attributes()->hour >= (int) date("H", $lastCaptcha["timestamp"])
70
+				&& ((int) $value->Attributes()->hour <= (int) date("H")))
71
+				) || $numberDays > 0) {
72 72
 				$captcha['timestamp'] =
73
-						strtotime(date("Y-m-d", $day) . " " . $value->Attributes()->hour . ":00")+date("Z");
74
-				$captcha['captcha_accs'] = (string)$value->volume;
75
-				$capdatas[] 	= $captcha;
73
+						strtotime(date("Y-m-d", $day)." ".$value->Attributes()->hour.":00") + date("Z");
74
+				$captcha['captcha_accs'] = (string) $value->volume;
75
+				$capdatas[] = $captcha;
76 76
 			}
77 77
 		}
78 78
 		--$numberDays;
79 79
 	}
80 80
 }
81
-$json 		= json_encode($capdatas);
81
+$json = json_encode($capdatas);
82 82
 file_put_contents($captcha_file, $json);
Please login to merge, or discard this patch.
pages/pokedex.page.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -30,10 +30,10 @@
 block discarded – undo
30 30
 					echo 'unseen';
31 31
 } ?> "></a>
32 32
 				<p class="pkmn-name"><a href="<?= $pokemon->permalink ?>"><?= $pokemon->name ?></a></p>
33
-				<p><?php if ($pokemon->spawn ==0) {
34
-					echo $locales->UNSEEN ;
33
+				<p><?php if ($pokemon->spawn == 0) {
34
+					echo $locales->UNSEEN;
35 35
 } else {
36
-	echo '<span class="spawn-counter" id="spawn_pokemon_'.$pokemon->id.'">?</span>'. $locales->SEEN ;
36
+	echo '<span class="spawn-counter" id="spawn_pokemon_'.$pokemon->id.'">?</span>'.$locales->SEEN;
37 37
 } ?> </p>
38 38
 
39 39
 			</div>
Please login to merge, or discard this patch.
core/js/dashboard.graph.js.php 2 patches
Braces   +8 added lines, -11 removed lines patch added patch discarded remove patch
@@ -63,36 +63,33 @@
 block discarded – undo
63 63
 		$total[]		= $data->pokemon_now;
64 64
 	}
65 65
 
66
-	if($data->timestamp > $yesterday){
66
+	if($data->timestamp > $yesterday) {
67 67
 
68 68
 		$labels[] = '"'.date('H:i', $data->timestamp ).'"';
69 69
 
70 70
 
71
-		if(!empty($data->rarity_spawn->{'Very common'})){
71
+		if(!empty($data->rarity_spawn->{'Very common'})) {
72 72
 			$veco[]		= $data->rarity_spawn->{'Very common'};
73
-		}
74
-		else {
73
+		} else {
75 74
 			$veco[]		= 0;
76 75
 		}
77 76
 
78 77
 
79
-		if(!empty($data->rarity_spawn->Common)){
78
+		if(!empty($data->rarity_spawn->Common)) {
80 79
 			$commo[]	= $data->rarity_spawn->Common;
81
-		}
82
-		else {
80
+		} else {
83 81
 			$commo[]	= 0;
84 82
 		}
85 83
 
86 84
 
87
-		if(!empty($data->rarity_spawn->Rare)){
85
+		if(!empty($data->rarity_spawn->Rare)) {
88 86
 			$rare[]		= $data->rarity_spawn->Rare;
89
-		}
90
-		else {
87
+		} else {
91 88
 			$rare[]		= 0;
92 89
 		}
93 90
 
94 91
 
95
-		if(!empty($data->rarity_spawn->Mythic)){
92
+		if(!empty($data->rarity_spawn->Mythic)) {
96 93
 			$myth[]		= $data->rarity_spawn->Mythic;
97 94
 		}
98 95
 	}
Please login to merge, or discard this patch.
Spacing   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -10,8 +10,8 @@  discard block
 block discarded – undo
10 10
 // Include & load the variables
11 11
 // ############################
12 12
 
13
-$variables	= SYS_PATH.'/core/json/variables.json';
14
-$config		= json_decode(file_get_contents($variables));
13
+$variables = SYS_PATH.'/core/json/variables.json';
14
+$config = json_decode(file_get_contents($variables));
15 15
 
16 16
 
17 17
 // Include & load locales (because it's REALLY REALLY REALLY IMPORTANT TO HAVE A FULLY TRANSLATE DASHBOARD )
@@ -24,15 +24,15 @@  discard block
 block discarded – undo
24 24
 // Check if there's a pokemon stat file
25 25
 // ####################################
26 26
 
27
-$stats_file	= SYS_PATH.'/core/json/pokemon.stats.json';
28
-$stats		= json_decode(file_get_contents($stats_file));
27
+$stats_file = SYS_PATH.'/core/json/pokemon.stats.json';
28
+$stats = json_decode(file_get_contents($stats_file));
29 29
 
30 30
 
31
-$now		= time();
32
-$yesterday	= $now-86400;
33
-$lastweek	= $now-604800;
31
+$now = time();
32
+$yesterday = $now - 86400;
33
+$lastweek = $now - 604800;
34 34
 
35
-$i=0;
35
+$i = 0;
36 36
 $labels_global = array();
37 37
 $total = array();
38 38
 $labels = array();
@@ -59,16 +59,16 @@  discard block
 block discarded – undo
59 59
 
60 60
 foreach ($stats as $data) {
61 61
 	if ($data->timestamp > $lastweek) {
62
-		$labels_global[]	= '"'.date('D H:i', $data->timestamp).'"';
63
-		$total[]		= $data->pokemon_now;
62
+		$labels_global[] = '"'.date('D H:i', $data->timestamp).'"';
63
+		$total[] = $data->pokemon_now;
64 64
 	}
65 65
 
66
-	if($data->timestamp > $yesterday){
66
+	if ($data->timestamp > $yesterday) {
67 67
 
68
-		$labels[] = '"'.date('H:i', $data->timestamp ).'"';
68
+		$labels[] = '"'.date('H:i', $data->timestamp).'"';
69 69
 
70 70
 
71
-		if(!empty($data->rarity_spawn->{'Very common'})){
71
+		if (!empty($data->rarity_spawn->{'Very common'})) {
72 72
 			$veco[]		= $data->rarity_spawn->{'Very common'};
73 73
 		}
74 74
 		else {
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
 		}
77 77
 
78 78
 
79
-		if(!empty($data->rarity_spawn->Common)){
79
+		if (!empty($data->rarity_spawn->Common)) {
80 80
 			$commo[]	= $data->rarity_spawn->Common;
81 81
 		}
82 82
 		else {
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
 		}
85 85
 
86 86
 
87
-		if(!empty($data->rarity_spawn->Rare)){
87
+		if (!empty($data->rarity_spawn->Rare)) {
88 88
 			$rare[]		= $data->rarity_spawn->Rare;
89 89
 		}
90 90
 		else {
@@ -92,54 +92,54 @@  discard block
 block discarded – undo
92 92
 		}
93 93
 
94 94
 
95
-		if(!empty($data->rarity_spawn->Mythic)){
96
-			$myth[]		= $data->rarity_spawn->Mythic;
95
+		if (!empty($data->rarity_spawn->Mythic)) {
96
+			$myth[] = $data->rarity_spawn->Mythic;
97 97
 		}
98 98
 	}
99 99
 }
100 100
 
101 101
 
102
-$stats_file	= SYS_PATH.'/core/json/gym.stats.json';
103
-$stats		= json_decode(file_get_contents($stats_file));
102
+$stats_file = SYS_PATH.'/core/json/gym.stats.json';
103
+$stats = json_decode(file_get_contents($stats_file));
104 104
 
105 105
 
106 106
 foreach ($stats as $data) {
107 107
 	if ($data->timestamp > $lastweek) {
108
-		$labels_gym[]			= '"'.date('D H:i', $data->timestamp).'"';
108
+		$labels_gym[] = '"'.date('D H:i', $data->timestamp).'"';
109 109
 
110
-		$mystic_average[]		= $data->team->mystic->average;
110
+		$mystic_average[] = $data->team->mystic->average;
111 111
 		$mystic_owned[]			= $data->team->mystic->gym_owned;
112 112
 
113 113
 		$valor_average[]		= $data->team->valor->average;
114
-		$valor_owned[]			= $data->team->valor->gym_owned;
114
+		$valor_owned[] = $data->team->valor->gym_owned;
115 115
 
116
-		$instinct_average[]		= $data->team->instinct->average;
117
-		$instinct_owned[]		= $data->team->instinct->gym_owned;
116
+		$instinct_average[] = $data->team->instinct->average;
117
+		$instinct_owned[] = $data->team->instinct->gym_owned;
118 118
 	}
119 119
 }
120 120
 
121 121
 
122
-$stats_file	= SYS_PATH.'/core/json/pokestop.stats.json';
123
-$stats		= json_decode(file_get_contents($stats_file));
122
+$stats_file = SYS_PATH.'/core/json/pokestop.stats.json';
123
+$stats = json_decode(file_get_contents($stats_file));
124 124
 
125 125
 
126 126
 foreach ($stats as $data) {
127 127
 	if ($data->timestamp > $lastweek) {
128
-		$labels_stops[]			= '"'.date('D H:i', $data->timestamp).'"';
129
-		$lure[]				= $data->lured;
128
+		$labels_stops[] = '"'.date('D H:i', $data->timestamp).'"';
129
+		$lure[] = $data->lured;
130 130
 	}
131 131
 }
132 132
 
133 133
 
134 134
 if ($config->system->captcha_support) {
135
-	$stats_file	= SYS_PATH.'/core/json/captcha.stats.json';
136
-	$stats		= json_decode(file_get_contents($stats_file));
135
+	$stats_file = SYS_PATH.'/core/json/captcha.stats.json';
136
+	$stats = json_decode(file_get_contents($stats_file));
137 137
 
138 138
 
139 139
 	foreach ($stats as $data) {
140 140
 		if ($data->timestamp > $lastweek) {
141
-			$labels_captcha[]		= '"'.date('D H:i', $data->timestamp).'"';
142
-			$captcha_accs[]			= $data->captcha_accs;
141
+			$labels_captcha[] = '"'.date('D H:i', $data->timestamp).'"';
142
+			$captcha_accs[] = $data->captcha_accs;
143 143
 		}
144 144
 	}
145 145
 }
Please login to merge, or discard this patch.
core/js/pokemon.graph.js.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
 $pokemon_id = mysqli_real_escape_string($mysqli, $_GET['id']);
33 33
 
34 34
 // Create the h24 array with associated values
35
-for ($i= 0; $i <= 23; $i++) {
35
+for ($i = 0; $i <= 23; $i++) {
36 36
 	if ($i < 10) {
37 37
 		$key = '0'.$i;
38 38
 	} else {
@@ -63,17 +63,17 @@  discard block
 block discarded – undo
63 63
 
64 64
 # Polar Graph datas
65 65
 
66
-$pokemon_file	= file_get_contents(SYS_PATH.'/core/json/pokedex.json');
67
-$pokemons		= json_decode($pokemon_file);
66
+$pokemon_file = file_get_contents(SYS_PATH.'/core/json/pokedex.json');
67
+$pokemons = json_decode($pokemon_file);
68 68
 
69 69
 $atk			= $pokemons->pokemon->$pokemon_id->atk;
70 70
 $def			= $pokemons->pokemon->$pokemon_id->def;
71
-$stam			= $pokemons->pokemon->$pokemon_id->stam;
71
+$stam = $pokemons->pokemon->$pokemon_id->stam;
72 72
 
73 73
 
74 74
 ?>
75 75
 
76
-var pokemon_id = '<?= (int)$pokemon_id ?>';
76
+var pokemon_id = '<?= (int) $pokemon_id ?>';
77 77
 
78 78
 Chart.defaults.global.legend.display = false;
79 79
 
Please login to merge, or discard this patch.
pages/trainer.page.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -97,7 +97,7 @@
 block discarded – undo
97 97
 <script type="text/javascript">
98 98
 <?=
99 99
 $trainerName = "";
100
-if(isset($_GET['name'])&&$_GET['name']!=""){
100
+if (isset($_GET['name']) && $_GET['name'] != "") {
101 101
 	$trainerName = htmlentities($_GET['name']);
102 102
 }
103 103
 
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -97,7 +97,7 @@
 block discarded – undo
97 97
 <script type="text/javascript">
98 98
 <?=
99 99
 $trainerName = "";
100
-if(isset($_GET['name'])&&$_GET['name']!=""){
100
+if(isset($_GET['name'])&&$_GET['name']!="") {
101 101
 	$trainerName = htmlentities($_GET['name']);
102 102
 }
103 103
 
Please login to merge, or discard this patch.
core/process/data.loader.php 1 patch
Spacing   +83 added lines, -83 removed lines patch added patch discarded remove patch
@@ -3,8 +3,8 @@  discard block
 block discarded – undo
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 (!isset($config->system)) {
10 10
 	echo 'Error: Could not load core/json/variables.json.';
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
 #################
32 32
 
33 33
 
34
-$mysqli 	= new mysqli(SYS_DB_HOST, SYS_DB_USER, SYS_DB_PSWD, SYS_DB_NAME, SYS_DB_PORT);
34
+$mysqli = new mysqli(SYS_DB_HOST, SYS_DB_USER, SYS_DB_PSWD, SYS_DB_NAME, SYS_DB_PORT);
35 35
 
36 36
 
37 37
 if ($mysqli->connect_error != '') {
@@ -74,12 +74,12 @@  discard block
 block discarded – undo
74 74
 // ( for Brusselopole we use CRONTAB but as we're not sure that every had access to it we build this really simple false crontab system
75 75
 // => check filemtime, if > 24h launch an update. )
76 76
 
77
-$pokedex_rarity_filetime	= filemtime($pokedex_rarity_file);
78
-$now				= time();
79
-$diff				= $now - $pokedex_rarity_filetime;
77
+$pokedex_rarity_filetime = filemtime($pokedex_rarity_file);
78
+$now = time();
79
+$diff = $now - $pokedex_rarity_filetime;
80 80
 
81 81
 // Update each 24h
82
-$update_delay		= 86400;
82
+$update_delay = 86400;
83 83
 
84 84
 if ($diff > $update_delay) {
85 85
 	include_once(SYS_PATH.'/core/cron/pokemon.rarity.php');
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
 			// Current Pokemon datas
110 110
 			// ---------------------
111 111
 
112
-			$pokemon_id 			= mysqli_real_escape_string($mysqli, $_GET['id']);
112
+			$pokemon_id = mysqli_real_escape_string($mysqli, $_GET['id']);
113 113
 
114 114
 			if (!is_object($pokemons->pokemon->$pokemon_id)) {
115 115
 				header('Location:/404');
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
 
120 120
 			$pokemon			= new stdClass();
121 121
 			$pokemon			= $pokemons->pokemon->$pokemon_id;
122
-			$pokemon->id			= $pokemon_id;
122
+			$pokemon->id = $pokemon_id;
123 123
 
124 124
 
125 125
 			// Some math
@@ -135,50 +135,50 @@  discard block
 block discarded – undo
135 135
 
136 136
 			// Total gym protected
137 137
 
138
-			$req 		= "SELECT count( DISTINCT(gym_id) ) as total FROM gym WHERE guard_pokemon_id = '".$pokemon_id."'  ";
139
-			$result 	= $mysqli->query($req);
140
-			$data 		= $result->fetch_object();
138
+			$req = "SELECT count( DISTINCT(gym_id) ) as total FROM gym WHERE guard_pokemon_id = '".$pokemon_id."'  ";
139
+			$result = $mysqli->query($req);
140
+			$data = $result->fetch_object();
141 141
 
142 142
 			$pokemon->protected_gyms = $data->total;
143 143
 
144 144
 			// Total spawn
145 145
 
146
-			$req 		= "SELECT COUNT(*) as total FROM pokemon WHERE pokemon_id = '".$pokemon_id."'";
147
-			$result 	= $mysqli->query($req);
148
-			$data 		= $result->fetch_object();
146
+			$req = "SELECT COUNT(*) as total FROM pokemon WHERE pokemon_id = '".$pokemon_id."'";
147
+			$result = $mysqli->query($req);
148
+			$data = $result->fetch_object();
149 149
 
150
-			$pokemon->total_spawn 	= $data->total;
150
+			$pokemon->total_spawn = $data->total;
151 151
 			// Spawn rate
152 152
 
153 153
 			if ($pokemon->total_spawn > 0) {
154 154
 				$req 		= "SELECT ROUND((UNIX_TIMESTAMP(max(disappear_time))-UNIX_TIMESTAMP(min(disappear_time)))/(24*60*60)) total FROM pokemon";
155
-				$result 	= $mysqli->query($req);
155
+				$result = $mysqli->query($req);
156 156
 				$data		= $result->fetch_object();
157 157
 
158 158
 				$pokemon->total_days = $data->total;
159
-				$pokemon->spawn_rate 	= round(($pokemon->total_spawn/$pokemon->total_days), 2);
159
+				$pokemon->spawn_rate 	= round(($pokemon->total_spawn / $pokemon->total_days), 2);
160 160
 			} else {
161 161
 				$pokemon->total_days 	= 0;
162
-				$pokemon->spawn_rate	= 0;
162
+				$pokemon->spawn_rate = 0;
163 163
 			}
164 164
 
165 165
 			// Last seen
166 166
 
167
-			$req 		= "SELECT disappear_time, (CONVERT_TZ(disappear_time, '+00:00', '".$time_offset."')) as disappear_time_real, latitude, longitude
167
+			$req = "SELECT disappear_time, (CONVERT_TZ(disappear_time, '+00:00', '".$time_offset."')) as disappear_time_real, latitude, longitude
168 168
 			FROM pokemon
169 169
 			WHERE pokemon_id = '".$pokemon_id."'
170 170
 			ORDER BY disappear_time DESC
171 171
 			LIMIT 0,1";
172
-			$result 	= $mysqli->query($req);
173
-			$data 		= $result->fetch_object();
172
+			$result = $mysqli->query($req);
173
+			$data = $result->fetch_object();
174 174
 
175 175
 			if (isset($data)) {
176
-				$last_spawn 				= $data;
176
+				$last_spawn = $data;
177 177
 
178
-				$pokemon->last_seen			= strtotime($data->disappear_time_real);
179
-				$pokemon->last_position			= new stdClass();
180
-				$pokemon->last_position->latitude 	= $data->latitude;
181
-				$pokemon->last_position->longitude 	= $data->longitude;
178
+				$pokemon->last_seen = strtotime($data->disappear_time_real);
179
+				$pokemon->last_position = new stdClass();
180
+				$pokemon->last_position->latitude = $data->latitude;
181
+				$pokemon->last_position->longitude = $data->longitude;
182 182
 			}
183 183
 
184 184
 			// Related Pokemons
@@ -215,23 +215,23 @@  discard block
 block discarded – undo
215 215
 
216 216
 
217 217
 			$max 		= $config->system->max_pokemon;
218
-			$pokedex 	= new stdClass();
218
+			$pokedex = new stdClass();
219 219
 
220 220
 			$req 		= "SELECT DISTINCT pokemon_id FROM pokemon";
221
-			$result 	= $mysqli->query($req);
221
+			$result = $mysqli->query($req);
222 222
 			$data_array = array();
223 223
 
224 224
 			while ($data = $result->fetch_object()) {
225 225
 				$data_array[$data->pokemon_id] = 1;
226 226
 			};
227 227
 
228
-			for ($i= 1; $i <= $max; $i++) {
229
-				$pokedex->$i			= new stdClass();
228
+			for ($i = 1; $i <= $max; $i++) {
229
+				$pokedex->$i = new stdClass();
230 230
 				$pokedex->$i->id 		= $i;
231
-				$pokedex->$i->permalink 	= 'pokemon/'.$i;
231
+				$pokedex->$i->permalink = 'pokemon/'.$i;
232 232
 				$pokedex->$i->img		= 'core/pokemons/'.$i.$config->system->pokeimg_suffix;
233
-				$pokedex->$i->name		= $pokemons->pokemon->$i->name;
234
-				$pokedex->$i->spawn 		= isset($data_array[$i])? $data_array[$i] : 0;
233
+				$pokedex->$i->name = $pokemons->pokemon->$i->name;
234
+				$pokedex->$i->spawn = isset($data_array[$i]) ? $data_array[$i] : 0;
235 235
 			}
236 236
 
237 237
 
@@ -242,17 +242,17 @@  discard block
 block discarded – undo
242 242
 		############
243 243
 
244 244
 		case 'pokestops':
245
-			$pokestop 	= new stdClass();
245
+			$pokestop = new stdClass();
246 246
 
247
-			$req 		= "SELECT COUNT(*) as total FROM pokestop";
248
-			$result 	= $mysqli->query($req);
249
-			$data 		= $result->fetch_object();
247
+			$req = "SELECT COUNT(*) as total FROM pokestop";
248
+			$result = $mysqli->query($req);
249
+			$data = $result->fetch_object();
250 250
 
251 251
 			$pokestop->total = $data->total;
252 252
 
253
-			$req 		= "SELECT COUNT(*) as total FROM pokestop WHERE lure_expiration >= UTC_TIMESTAMP()";
254
-			$result 	= $mysqli->query($req);
255
-			$data 		= $result->fetch_object();
253
+			$req = "SELECT COUNT(*) as total FROM pokestop WHERE lure_expiration >= UTC_TIMESTAMP()";
254
+			$result = $mysqli->query($req);
255
+			$data = $result->fetch_object();
256 256
 
257 257
 			$pokestop->lured = $data->total;
258 258
 
@@ -269,36 +269,36 @@  discard block
 block discarded – undo
269 269
 			// 3 Teams (teamm rocket is neutral)
270 270
 			// 1 Fight
271 271
 
272
-			$teams 				= new stdClass();
272
+			$teams = new stdClass();
273 273
 
274
-			$teams->mystic 			= new stdClass();
275
-			$teams->mystic->guardians 	= new stdClass();
276
-			$teams->mystic->id 		= 1;
274
+			$teams->mystic = new stdClass();
275
+			$teams->mystic->guardians = new stdClass();
276
+			$teams->mystic->id = 1;
277 277
 
278
-			$teams->valor 			= new stdClass();
279
-			$teams->valor->guardians 	= new stdClass();
280
-			$teams->valor->id 		= 2;
278
+			$teams->valor = new stdClass();
279
+			$teams->valor->guardians = new stdClass();
280
+			$teams->valor->id = 2;
281 281
 
282
-			$teams->instinct 		= new stdClass();
283
-			$teams->instinct->guardians 	= new stdClass();
284
-			$teams->instinct->id 		= 3;
282
+			$teams->instinct = new stdClass();
283
+			$teams->instinct->guardians = new stdClass();
284
+			$teams->instinct->id = 3;
285 285
 
286
-			$teams->rocket 			= new stdClass();
287
-			$teams->rocket->guardians 	= new stdClass();
288
-			$teams->rocket->id 		= 0;
286
+			$teams->rocket = new stdClass();
287
+			$teams->rocket->guardians = new stdClass();
288
+			$teams->rocket->id = 0;
289 289
 
290 290
 
291 291
 
292 292
 			foreach ($teams as $team_key => $team_values) {
293 293
 				// Team Guardians
294 294
 
295
-				$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 ";
295
+				$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 ";
296 296
 				$result = $mysqli->query($req);
297 297
 
298
-				$i=0;
298
+				$i = 0;
299 299
 
300 300
 				while ($data = $result->fetch_object()) {
301
-					$teams->$team_key->guardians->$i	= $data->guard_pokemon_id;
301
+					$teams->$team_key->guardians->$i = $data->guard_pokemon_id;
302 302
 
303 303
 					$i++;
304 304
 				}
@@ -310,8 +310,8 @@  discard block
 block discarded – undo
310 310
 				$result = $mysqli->query($req);
311 311
 				$data	= $result->fetch_object();
312 312
 
313
-				$teams->$team_key->gym_owned	= $data->total;
314
-				$teams->$team_key->average	= $data->average_points;
313
+				$teams->$team_key->gym_owned = $data->total;
314
+				$teams->$team_key->average = $data->average_points;
315 315
 			}
316 316
 
317 317
 
@@ -324,7 +324,7 @@  discard block
 block discarded – undo
324 324
 		case 'dashboard':
325 325
 			// This case is only used for test purpose.
326 326
 
327
-			$stats_file	= SYS_PATH.'/core/json/gym.stats.json';
327
+			$stats_file = SYS_PATH.'/core/json/gym.stats.json';
328 328
 
329 329
 			if (!is_file($stats_file)) {
330 330
 				echo "Sorry, no Gym stats file was found. <br> Did you enable cron? ";
@@ -332,7 +332,7 @@  discard block
 block discarded – undo
332 332
 			}
333 333
 
334 334
 
335
-			$stats_file	= SYS_PATH.'/core/json/pokemon.stats.json';
335
+			$stats_file = SYS_PATH.'/core/json/pokemon.stats.json';
336 336
 
337 337
 			if (!is_file($stats_file)) {
338 338
 				echo "Sorry, no Pokémon stats file was found. <br> Did you enabled cron?";
@@ -340,7 +340,7 @@  discard block
 block discarded – undo
340 340
 			}
341 341
 
342 342
 
343
-			$stats_file	= SYS_PATH.'/core/json/pokestop.stats.json';
343
+			$stats_file = SYS_PATH.'/core/json/pokestop.stats.json';
344 344
 
345 345
 			if (!is_file($stats_file)) {
346 346
 				echo "Sorry, no Pokéstop stats file was found. <br> Did you enabled cron?";
@@ -348,7 +348,7 @@  discard block
 block discarded – undo
348 348
 			}
349 349
 
350 350
 			if ($config->system->captcha_support) {
351
-				$stats_file	= SYS_PATH.'/core/json/captcha.stats.json';
351
+				$stats_file = SYS_PATH.'/core/json/captcha.stats.json';
352 352
 
353 353
 				if (!is_file($stats_file)) {
354 354
 					echo "Sorry, no Captcha stats file were found  <br> Have you enable cron?";
@@ -368,9 +368,9 @@  discard block
 block discarded – undo
368 368
 	// Right now
369 369
 	// ---------
370 370
 
371
-	$req 		= "SELECT COUNT(*) as total FROM pokemon WHERE disappear_time >= UTC_TIMESTAMP()";
372
-	$result 	= $mysqli->query($req);
373
-	$data 		= $result->fetch_object();
371
+	$req = "SELECT COUNT(*) as total FROM pokemon WHERE disappear_time >= UTC_TIMESTAMP()";
372
+	$result = $mysqli->query($req);
373
+	$data = $result->fetch_object();
374 374
 
375 375
 
376 376
 	$home->pokemon_now = $data->total;
@@ -379,9 +379,9 @@  discard block
 block discarded – undo
379 379
 	// Lured stops
380 380
 	// -----------
381 381
 
382
-	$req 		= "SELECT COUNT(*) as total FROM pokestop WHERE lure_expiration >= UTC_TIMESTAMP()";
383
-	$result 	= $mysqli->query($req);
384
-	$data 		= $result->fetch_object();
382
+	$req = "SELECT COUNT(*) as total FROM pokestop WHERE lure_expiration >= UTC_TIMESTAMP()";
383
+	$result = $mysqli->query($req);
384
+	$data = $result->fetch_object();
385 385
 
386 386
 	$home->pokestop_lured = $data->total;
387 387
 
@@ -389,9 +389,9 @@  discard block
 block discarded – undo
389 389
 	// Gyms
390 390
 	// ----
391 391
 
392
-	$req 		= "SELECT COUNT(DISTINCT(gym_id)) as total FROM gym";
393
-	$result 	= $mysqli->query($req);
394
-	$data 		= $result->fetch_object();
392
+	$req = "SELECT COUNT(DISTINCT(gym_id)) as total FROM gym";
393
+	$result = $mysqli->query($req);
394
+	$data = $result->fetch_object();
395 395
 
396 396
 	$home->gyms = $data->total;
397 397
 
@@ -401,19 +401,19 @@  discard block
 block discarded – undo
401 401
 
402 402
 	if ($config->system->recents_filter) {
403 403
 		// get all mythic pokemon ids
404
-		$mythic_pokemons  = array();
404
+		$mythic_pokemons = array();
405 405
 		foreach ($pokemons->pokemon as $id => $pokemon) {
406 406
 			if ($pokemon->spawn_rate < $config->system->recents_filter_rarity && $pokemon->rating >= $config->system->recents_filter_rating) {
407 407
 				$mythic_pokemons[] = $id;
408 408
 			}
409 409
 		}
410 410
 		// get all mythic pokemon
411
-		$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
411
+		$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
412 412
 				   WHERE pokemon_id IN (".implode(",", $mythic_pokemons).")
413 413
 				   ORDER BY last_modified DESC LIMIT 0,12";
414 414
 	} else {
415 415
 		// get all pokemon
416
-		$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
416
+		$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
417 417
 				   ORDER BY last_modified DESC LIMIT 0,12";
418 418
 	}
419 419
 	$result 	= $mysqli->query($req);
@@ -459,28 +459,28 @@  discard block
 block discarded – undo
459 459
 
460 460
 	$req = "SELECT count( DISTINCT(gym_id) ) as total FROM gym WHERE team_id = '1'  ";
461 461
 	$result = $mysqli->query($req);
462
-	$data 	= $result->fetch_object();
462
+	$data = $result->fetch_object();
463 463
 
464
-	$home->teams->mystic 	= $data->total;
464
+	$home->teams->mystic = $data->total;
465 465
 
466 466
 
467 467
 	$req = "SELECT count( DISTINCT(gym_id) ) as total FROM gym WHERE team_id = '2'  ";
468 468
 	$result = $mysqli->query($req);
469
-	$data 	= $result->fetch_object();
469
+	$data = $result->fetch_object();
470 470
 
471
-	$home->teams->valor 	= $data->total;
471
+	$home->teams->valor = $data->total;
472 472
 
473 473
 
474 474
 	$req = "SELECT count( DISTINCT(gym_id) ) as total FROM gym WHERE team_id = '3'  ";
475 475
 	$result = $mysqli->query($req);
476
-	$data 	= $result->fetch_object();
476
+	$data = $result->fetch_object();
477 477
 
478
-	$home->teams->instinct 	= $data->total;
478
+	$home->teams->instinct = $data->total;
479 479
 
480 480
 
481 481
 	$req = "SELECT count( DISTINCT(gym_id) ) as total FROM gym WHERE team_id = '0'  ";
482 482
 	$result = $mysqli->query($req);
483
-	$data 	= $result->fetch_object();
483
+	$data = $result->fetch_object();
484 484
 
485
-	$home->teams->rocket 	= $data->total;
485
+	$home->teams->rocket = $data->total;
486 486
 }
Please login to merge, or discard this patch.
pages/home.page.php 2 patches
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -76,26 +76,26 @@  discard block
 block discarded – undo
76 76
 					if ($pokemon->iv->available) { 
77 77
 						if ($config->system->iv_numbers) { ?>
78 78
 							<div class="progress" style="height: 15px; margin-bottom: 0">
79
-								<div title="Attack IV: <?= $pokemon->iv->attack ?>" class="progress-bar progress-bar-danger" role="progressbar" aria-valuenow="<?= $pokemon->iv->attack ?>" aria-valuemin="0" aria-valuemax="45" style="width: <?= (100/3)  ?>%; line-height: 16px";>
79
+								<div title="Attack IV: <?= $pokemon->iv->attack ?>" class="progress-bar progress-bar-danger" role="progressbar" aria-valuenow="<?= $pokemon->iv->attack ?>" aria-valuemin="0" aria-valuemax="45" style="width: <?= (100 / 3)  ?>%; line-height: 16px";>
80 80
 									<span class="sr-only">Attack IV: <?= $pokemon->iv->attack ?></span><?= $pokemon->iv->attack ?>
81 81
 								</div>
82
-								<div title="Defense IV: <?= $pokemon->iv->defense ?>" class="progress-bar progress-bar-info" role="progressbar" aria-valuenow="<?= $pokemon->iv->defense ?>" aria-valuemin="0" aria-valuemax="45" style="width: <?= (100/3)  ?>%; line-height: 16px";>
82
+								<div title="Defense IV: <?= $pokemon->iv->defense ?>" class="progress-bar progress-bar-info" role="progressbar" aria-valuenow="<?= $pokemon->iv->defense ?>" aria-valuemin="0" aria-valuemax="45" style="width: <?= (100 / 3)  ?>%; line-height: 16px";>
83 83
 									<span class="sr-only">Defense IV: <?= $pokemon->iv->defense ?></span><?= $pokemon->iv->defense ?>
84 84
 								</div>
85
-								<div title="Stamina IV: <?= $pokemon->iv->stamina ?>" class="progress-bar progress-bar-success" role="progressbar" aria-valuenow="<?= $pokemon->iv->stamina ?>" aria-valuemin="0" aria-valuemax="45" style="width: <?= (100/3) ?>%; line-height: 16px";>
85
+								<div title="Stamina IV: <?= $pokemon->iv->stamina ?>" class="progress-bar progress-bar-success" role="progressbar" aria-valuenow="<?= $pokemon->iv->stamina ?>" aria-valuemin="0" aria-valuemax="45" style="width: <?= (100 / 3) ?>%; line-height: 16px";>
86 86
 									<span class="sr-only">Stamina IV: <?= $pokemon->iv->stamina ?></span><?= $pokemon->iv->stamina ?>
87 87
 								</div>
88 88
 							</div>
89 89
 						<?php 
90 90
 						} else { ?>
91 91
 							<div class="progress" style="height: 6px; width: 80%; margin: 5px auto 15px auto;">
92
-								<div title="Attack IV: <?= $pokemon->iv->attack ?>" class="progress-bar progress-bar-danger" role="progressbar" aria-valuenow="<?= $pokemon->iv->attack ?>" aria-valuemin="0" aria-valuemax="45" style="width: <?= ((100/15)*$pokemon->iv->attack)/3 ?>%">
92
+								<div title="Attack IV: <?= $pokemon->iv->attack ?>" class="progress-bar progress-bar-danger" role="progressbar" aria-valuenow="<?= $pokemon->iv->attack ?>" aria-valuemin="0" aria-valuemax="45" style="width: <?= ((100 / 15) * $pokemon->iv->attack) / 3 ?>%">
93 93
 									<span class="sr-only">Attack IV: <?= $pokemon->iv->attack ?></span>
94 94
 								</div>
95
-								<div title="Defense IV: <?= $pokemon->iv->defense ?>" class="progress-bar progress-bar-info" role="progressbar" aria-valuenow="<?= $pokemon->iv->defense ?>" aria-valuemin="0" aria-valuemax="45" style="width: <?= ((100/15)*$pokemon->iv->defense)/3 ?>%">
95
+								<div title="Defense IV: <?= $pokemon->iv->defense ?>" class="progress-bar progress-bar-info" role="progressbar" aria-valuenow="<?= $pokemon->iv->defense ?>" aria-valuemin="0" aria-valuemax="45" style="width: <?= ((100 / 15) * $pokemon->iv->defense) / 3 ?>%">
96 96
 									<span class="sr-only">Defense IV: <?= $pokemon->iv->defense ?></span>
97 97
 								</div>
98
-								<div title="Stamina IV: <?= $pokemon->iv->stamina ?>" class="progress-bar progress-bar-success" role="progressbar" aria-valuenow="<?= $pokemon->iv->stamina ?>" aria-valuemin="0" aria-valuemax="45" style="width: <?= ((100/15)*$pokemon->iv->stamina)/3 ?>%">
98
+								<div title="Stamina IV: <?= $pokemon->iv->stamina ?>" class="progress-bar progress-bar-success" role="progressbar" aria-valuenow="<?= $pokemon->iv->stamina ?>" aria-valuemin="0" aria-valuemax="45" style="width: <?= ((100 / 15) * $pokemon->iv->stamina) / 3 ?>%">
99 99
 									<span class="sr-only">Stamina IV: <?= $pokemon->iv->stamina ?></span>
100 100
 								</div>
101 101
 							</div>
@@ -104,13 +104,13 @@  discard block
 block discarded – undo
104 104
 					} else { 
105 105
 						if ($config->system->iv_numbers) { ?>
106 106
 							<div class="progress" style="height: 15px; margin-bottom: 0">
107
-								<div title="Attack IV: not available" class="progress-bar progress-bar-danger" role="progressbar" aria-valuenow="<?= $pokemon->iv->attack ?>" aria-valuemin="0" aria-valuemax="45" style="width: <?= (100/3)  ?>%; line-height: 16px";>
107
+								<div title="Attack IV: not available" class="progress-bar progress-bar-danger" role="progressbar" aria-valuenow="<?= $pokemon->iv->attack ?>" aria-valuemin="0" aria-valuemax="45" style="width: <?= (100 / 3)  ?>%; line-height: 16px";>
108 108
 									<span class="sr-only">Attack IV: not available</span>?
109 109
 								</div>
110
-								<div title="Defense IV: not available" class="progress-bar progress-bar-info" role="progressbar" aria-valuenow="<?= $pokemon->iv->defense ?>" aria-valuemin="0" aria-valuemax="45" style="width: <?= (100/3)  ?>%; line-height: 16px";>
110
+								<div title="Defense IV: not available" class="progress-bar progress-bar-info" role="progressbar" aria-valuenow="<?= $pokemon->iv->defense ?>" aria-valuemin="0" aria-valuemax="45" style="width: <?= (100 / 3)  ?>%; line-height: 16px";>
111 111
 									<span class="sr-only">Defense IV: not available</span>?
112 112
 								</div>
113
-								<div title="Stamina IV: not available" class="progress-bar progress-bar-success" role="progressbar" aria-valuenow="<?= $pokemon->iv->stamina ?>" aria-valuemin="0" aria-valuemax="45" style="width: <?= (100/3) ?>%; line-height: 16px";>
113
+								<div title="Stamina IV: not available" class="progress-bar progress-bar-success" role="progressbar" aria-valuenow="<?= $pokemon->iv->stamina ?>" aria-valuemin="0" aria-valuemax="45" style="width: <?= (100 / 3) ?>%; line-height: 16px";>
114 114
 									<span class="sr-only">Stamina IV: not available</span>?
115 115
 								</div>
116 116
 							</div>
Please login to merge, or discard this patch.
Braces   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
 				</a>
74 74
 				<?php
75 75
 				if ($config->system->recents_show_iv) {
76
-					if ($pokemon->iv->available) { 
76
+					if ($pokemon->iv->available) {
77 77
 						if ($config->system->iv_numbers) { ?>
78 78
 							<div class="progress" style="height: 15px; margin-bottom: 0">
79 79
 								<div title="Attack IV: <?= $pokemon->iv->attack ?>" class="progress-bar progress-bar-danger" role="progressbar" aria-valuenow="<?= $pokemon->iv->attack ?>" aria-valuemin="0" aria-valuemax="45" style="width: <?= (100/3)  ?>%; line-height: 16px";>
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
 							</div>
102 102
 					<?php
103 103
 						}
104
-					} else { 
104
+					} else {
105 105
 						if ($config->system->iv_numbers) { ?>
106 106
 							<div class="progress" style="height: 15px; margin-bottom: 0">
107 107
 								<div title="Attack IV: not available" class="progress-bar progress-bar-danger" role="progressbar" aria-valuenow="<?= $pokemon->iv->attack ?>" aria-valuemin="0" aria-valuemax="45" style="width: <?= (100/3)  ?>%; line-height: 16px";>
Please login to merge, or discard this patch.
core/process/aru.php 3 patches
Switch Indentation   +340 added lines, -340 removed lines patch added patch discarded remove patch
@@ -58,150 +58,150 @@  discard block
 block discarded – undo
58 58
 	//
59 59
 	############################
60 60
 
61
-	case 'home_update':
62
-		// Right now
63
-		// ---------
61
+		case 'home_update':
62
+			// Right now
63
+			// ---------
64 64
 
65
-		$req 		= "SELECT COUNT(*) as total FROM pokemon WHERE disappear_time >= UTC_TIMESTAMP()";
66
-		$result 	= $mysqli->query($req);
67
-		$data 		= $result->fetch_object();
65
+			$req 		= "SELECT COUNT(*) as total FROM pokemon WHERE disappear_time >= UTC_TIMESTAMP()";
66
+			$result 	= $mysqli->query($req);
67
+			$data 		= $result->fetch_object();
68 68
 
69
-		$values[] 	= $data->total;
69
+			$values[] 	= $data->total;
70 70
 
71 71
 
72
-		// Lured stops
73
-		// -----------
72
+			// Lured stops
73
+			// -----------
74 74
 
75
-		$req 		= "SELECT COUNT(*) as total FROM pokestop WHERE lure_expiration >= UTC_TIMESTAMP()";
76
-		$result 	= $mysqli->query($req);
77
-		$data 		= $result->fetch_object();
75
+			$req 		= "SELECT COUNT(*) as total FROM pokestop WHERE lure_expiration >= UTC_TIMESTAMP()";
76
+			$result 	= $mysqli->query($req);
77
+			$data 		= $result->fetch_object();
78 78
 
79
-		$values[] 	= $data->total;
79
+			$values[] 	= $data->total;
80 80
 
81 81
 
82 82
 
83
-		// Team battle
84
-		// -----------
83
+			// Team battle
84
+			// -----------
85 85
 
86
-		$req 		= "SELECT count( DISTINCT(gym_id) ) as total FROM gym";
87
-		$result 	= $mysqli->query($req);
88
-		$data 		= $result->fetch_object();
86
+			$req 		= "SELECT count( DISTINCT(gym_id) ) as total FROM gym";
87
+			$result 	= $mysqli->query($req);
88
+			$data 		= $result->fetch_object();
89 89
 
90
-		$values[] 	= $data->total;
90
+			$values[] 	= $data->total;
91 91
 
92
-		// Team
93
-		// 1 = bleu
94
-		// 2 = rouge
95
-		// 3 = jaune
92
+			// Team
93
+			// 1 = bleu
94
+			// 2 = rouge
95
+			// 3 = jaune
96 96
 
97
-		$req	= "SELECT count( DISTINCT(gym_id) ) as total FROM gym WHERE team_id = '2'  ";
98
-		$result	= $mysqli->query($req);
99
-		$data	= $result->fetch_object();
97
+			$req	= "SELECT count( DISTINCT(gym_id) ) as total FROM gym WHERE team_id = '2'  ";
98
+			$result	= $mysqli->query($req);
99
+			$data	= $result->fetch_object();
100 100
 
101
-		// Red
102
-		$values[] = $data->total;
101
+			// Red
102
+			$values[] = $data->total;
103 103
 
104 104
 
105
-		$req	= "SELECT count( DISTINCT(gym_id) ) as total FROM gym WHERE team_id = '1'  ";
106
-		$result	= $mysqli->query($req);
107
-		$data	= $result->fetch_object();
105
+			$req	= "SELECT count( DISTINCT(gym_id) ) as total FROM gym WHERE team_id = '1'  ";
106
+			$result	= $mysqli->query($req);
107
+			$data	= $result->fetch_object();
108 108
 
109
-		// Blue
110
-		$values[] = $data->total;
109
+			// Blue
110
+			$values[] = $data->total;
111 111
 
112 112
 
113
-		$req	= "SELECT count( DISTINCT(gym_id) ) as total FROM gym WHERE team_id = '3'  ";
114
-		$result	= $mysqli->query($req);
115
-		$data	= $result->fetch_object();
113
+			$req	= "SELECT count( DISTINCT(gym_id) ) as total FROM gym WHERE team_id = '3'  ";
114
+			$result	= $mysqli->query($req);
115
+			$data	= $result->fetch_object();
116 116
 
117
-		// Yellow
118
-		$values[] = $data->total;
117
+			// Yellow
118
+			$values[] = $data->total;
119 119
 
120
-		$req	= "SELECT count( DISTINCT(gym_id) ) as total FROM gym WHERE team_id = '0'  ";
121
-		$result	= $mysqli->query($req);
122
-		$data	= $result->fetch_object();
120
+			$req	= "SELECT count( DISTINCT(gym_id) ) as total FROM gym WHERE team_id = '0'  ";
121
+			$result	= $mysqli->query($req);
122
+			$data	= $result->fetch_object();
123 123
 
124
-		// Neutral
125
-		$values[] = $data->total;
124
+			// Neutral
125
+			$values[] = $data->total;
126 126
 
127 127
 
128
-		header('Content-Type: application/json');
129
-		$json = json_encode($values);
128
+			header('Content-Type: application/json');
129
+			$json = json_encode($values);
130 130
 
131
-		echo $json;
131
+			echo $json;
132 132
 
133 133
 
134
-		break;
134
+			break;
135 135
 
136 136
 
137 137
 
138
-	####################################
139
-	//
140
-	// Update latests spawn on homepage
141
-	//
142
-	####################################
138
+		####################################
139
+		//
140
+		// Update latests spawn on homepage
141
+		//
142
+		####################################
143 143
 
144
-	case 'spawnlist_update':
145
-		// Recent spawn
146
-		// ------------
147
-		$total_spawns = array();
148
-		$last_uid_param = "";
149
-		if (isset($_GET['last_uid'])) {
150
-			$last_uid_param = $_GET['last_uid'];
151
-		}
152
-		if ($config->system->recents_filter) {
153
-			// get all mythic pokemon ids
154
-			$mythic_pokemons = array();
155
-			foreach ($pokemons->pokemon as $id => $pokemon) {
156
-				if ($pokemon->spawn_rate < $config->system->recents_filter_rarity && $pokemon->rating >= $config->system->recents_filter_rating) {
157
-					$mythic_pokemons[] = $id;
158
-				}
144
+		case 'spawnlist_update':
145
+			// Recent spawn
146
+			// ------------
147
+			$total_spawns = array();
148
+			$last_uid_param = "";
149
+			if (isset($_GET['last_uid'])) {
150
+				$last_uid_param = $_GET['last_uid'];
159 151
 			}
152
+			if ($config->system->recents_filter) {
153
+				// get all mythic pokemon ids
154
+				$mythic_pokemons = array();
155
+				foreach ($pokemons->pokemon as $id => $pokemon) {
156
+					if ($pokemon->spawn_rate < $config->system->recents_filter_rarity && $pokemon->rating >= $config->system->recents_filter_rating) {
157
+						$mythic_pokemons[] = $id;
158
+					}
159
+				}
160 160
 
161
-			// get last mythic pokemon
162
-			$req		= "SELECT 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
161
+				// get last mythic pokemon
162
+				$req		= "SELECT 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
163 163
                         WHERE pokemon_id IN (".implode(",", $mythic_pokemons).")
164 164
                         ORDER BY last_modified DESC LIMIT 0,12";
165
-		} else {
166
-			// get last pokemon
167
-			$req		= "SELECT 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 ORDER BY last_modified DESC LIMIT 0,12";
168
-		}
169
-		$result = $mysqli->query($req);
170
-		while ($data = $result->fetch_object()) {
171
-			$new_spawn = array();
172
-			$pokeid = $data->pokemon_id;
173
-			$pokeuid = $data->encounter_id;
174
-
175
-			if ($last_uid_param != $pokeuid) {
176
-				$last_seen = strtotime($data->disappear_time_real);
177
-
178
-				$last_location = new stdClass();
179
-				$last_location->latitude = $data->latitude;
180
-				$last_location->longitude = $data->longitude;
181
-
182
-				if ($config->system->recents_show_iv) {
183
-					$iv = new stdClass();
184
-					$iv->attack = $data->individual_attack;
185
-					$iv->defense = $data->individual_defense;
186
-					$iv->stamina = $data->individual_stamina;
187
-					if (isset($iv->attack) && isset($iv->defense) && isset($iv->stamina)) {
188
-						$iv->available = true;
189
-					} else {
190
-						$iv->available = false;
165
+			} else {
166
+				// get last pokemon
167
+				$req		= "SELECT 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 ORDER BY last_modified DESC LIMIT 0,12";
168
+			}
169
+			$result = $mysqli->query($req);
170
+			while ($data = $result->fetch_object()) {
171
+				$new_spawn = array();
172
+				$pokeid = $data->pokemon_id;
173
+				$pokeuid = $data->encounter_id;
174
+
175
+				if ($last_uid_param != $pokeuid) {
176
+					$last_seen = strtotime($data->disappear_time_real);
177
+
178
+					$last_location = new stdClass();
179
+					$last_location->latitude = $data->latitude;
180
+					$last_location->longitude = $data->longitude;
181
+
182
+					if ($config->system->recents_show_iv) {
183
+						$iv = new stdClass();
184
+						$iv->attack = $data->individual_attack;
185
+						$iv->defense = $data->individual_defense;
186
+						$iv->stamina = $data->individual_stamina;
187
+						if (isset($iv->attack) && isset($iv->defense) && isset($iv->stamina)) {
188
+							$iv->available = true;
189
+						} else {
190
+							$iv->available = false;
191
+						}
191 192
 					}
192
-				}
193 193
 
194
-				$html = '
194
+					$html = '
195 195
 			    <div class="col-md-1 col-xs-4 pokemon-single" data-pokeid="'.$pokeid.'" data-pokeuid="'.$pokeuid.'" style="display: none;">
196 196
 				<a href="pokemon/'.$pokeid.'"><img src="core/pokemons/'.$pokeid.$config->system->pokeimg_suffix.'" alt="'.$pokemons->pokemon->$pokeid->name.'" class="img-responsive"></a>
197 197
 				<a href="pokemon/'.$pokeid.'"><p class="pkmn-name">'.$pokemons->pokemon->$pokeid->name.'</p></a>
198 198
 				<a href="https://maps.google.com/?q='.$last_location->latitude.','.$last_location->longitude.'&ll='.$last_location->latitude.','.$last_location->longitude.'&z=16" target="_blank">
199 199
 				    <small class="pokemon-timer">00:00:00</small>
200 200
 				</a>';
201
-				if ($config->system->recents_show_iv) {
202
-					if ($iv->available) {
203
-						if ($config->system->iv_numbers) {
204
-							$html .= '
201
+					if ($config->system->recents_show_iv) {
202
+						if ($iv->available) {
203
+							if ($config->system->iv_numbers) {
204
+								$html .= '
205 205
 							<div class="progress" style="height: 15px; margin-bottom: 0">
206 206
 								<div title="Attack IV: '. $iv->attack .'" class="progress-bar progress-bar-danger" role="progressbar" aria-valuenow="'. $iv->attack .'" aria-valuemin="0" aria-valuemax="45" style="width: '. (100/3)  .'%; line-height: 16px";>
207 207
 									<span class="sr-only">Attack IV: '. $iv->attack .'</span>'. $iv->attack .'
@@ -213,8 +213,8 @@  discard block
 block discarded – undo
213 213
 									<span class="sr-only">Stamina IV: '. $iv->stamina .'</span>'. $iv->stamina .'
214 214
 								</div>
215 215
 							</div>';
216
-						} else {
217
-							$html .= '
216
+							} else {
217
+								$html .= '
218 218
 							<div class="progress" style="height: 6px; width: 80%; margin: 5px auto 0 auto;">
219 219
 					    		<div title="Attack IV: '. $iv->attack .'" class="progress-bar progress-bar-danger" role="progressbar" aria-valuenow="'. $iv->attack .'" aria-valuemin="0" aria-valuemax="45" style="width: '. ((100/15)*$iv->attack)/3 .'%">
220 220
 									<span class="sr-only">Attack IV: '. $iv->attack .'</span>
@@ -226,10 +226,10 @@  discard block
 block discarded – undo
226 226
 									<span class="sr-only">Stamina IV: '. $iv->stamina .'</span>
227 227
 					    		</div>
228 228
 							</div>';
229
-						}
230
-					} else {
231
-						if ($config->system->iv_numbers) {
232
-							$html .= '
229
+							}
230
+						} else {
231
+							if ($config->system->iv_numbers) {
232
+								$html .= '
233 233
 							<div class="progress" style="height: 15px; margin-bottom: 0">
234 234
 								<div title="Attack IV: not available" class="progress-bar progress-bar-danger" role="progressbar" aria-valuenow="'. $iv->attack .'" aria-valuemin="0" aria-valuemax="45" style="width: '. (100/3)  .'%; line-height: 16px";>
235 235
 									<span class="sr-only">Attack IV: not available</span>?
@@ -241,125 +241,125 @@  discard block
 block discarded – undo
241 241
 									<span class="sr-only">Stamina IV: not available</span>?
242 242
 								</div>
243 243
 							</div>';
244
-						} else {
245
-						$html .= '
244
+							} else {
245
+							$html .= '
246 246
 					    <div class="progress" style="height: 6px; width: 80%; margin: 5px auto 15px auto;">
247 247
 						    <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">
248 248
 							    <span class="sr-only">IV not available</span>
249 249
 						    </div>
250 250
 					    </div>';
251
+							}
251 252
 						}
252 253
 					}
253
-				}
254
-				$html .= '
254
+					$html .= '
255 255
 			    </div>';
256
-				$new_spawn['html'] = $html;
257
-				$countdown = $last_seen - time();
258
-				$new_spawn['countdown'] = $countdown;
259
-				$new_spawn['pokemon_uid'] = $pokeuid;
260
-				$total_spawns[] = $new_spawn;
261
-			} else {
262
-				break;
256
+					$new_spawn['html'] = $html;
257
+					$countdown = $last_seen - time();
258
+					$new_spawn['countdown'] = $countdown;
259
+					$new_spawn['pokemon_uid'] = $pokeuid;
260
+					$total_spawns[] = $new_spawn;
261
+				} else {
262
+					break;
263
+				}
263 264
 			}
264
-		}
265
-		header('Content-Type: application/json');
266
-		echo json_encode($total_spawns);
267
-		break;
265
+			header('Content-Type: application/json');
266
+			echo json_encode($total_spawns);
267
+			break;
268 268
 
269 269
 
270 270
 
271
-	####################################
272
-	//
273
-	// List Pokestop
274
-	//
275
-	####################################
271
+		####################################
272
+		//
273
+		// List Pokestop
274
+		//
275
+		####################################
276 276
 
277
-	case 'pokestop':
278
-		$req 		= "SELECT latitude, longitude, lure_expiration, UTC_TIMESTAMP() as now, (CONVERT_TZ(lure_expiration, '+00:00', '".$time_offset."')) as lure_expiration_real FROM pokestop";
279
-		$result 	= $mysqli->query($req);
277
+		case 'pokestop':
278
+			$req 		= "SELECT latitude, longitude, lure_expiration, UTC_TIMESTAMP() as now, (CONVERT_TZ(lure_expiration, '+00:00', '".$time_offset."')) as lure_expiration_real FROM pokestop";
279
+			$result 	= $mysqli->query($req);
280 280
 
281
-		$i=0;
281
+			$i=0;
282 282
 
283
-		while ($data = $result->fetch_object()) {
284
-			if ($data->lure_expiration >= $data->now) {
285
-				$icon = 'pokestap_lured.png';
286
-				$text = 'Lured expire @ '.date('H:i:s', strtotime($data->lure_expiration_real)) ;
287
-			} else {
288
-				$icon = 'pokestap.png';
289
-				$text = 'Normal stop';
290
-			}
283
+			while ($data = $result->fetch_object()) {
284
+				if ($data->lure_expiration >= $data->now) {
285
+					$icon = 'pokestap_lured.png';
286
+					$text = 'Lured expire @ '.date('H:i:s', strtotime($data->lure_expiration_real)) ;
287
+				} else {
288
+					$icon = 'pokestap.png';
289
+					$text = 'Normal stop';
290
+				}
291 291
 
292
-			$temp[$i][] = $text;
293
-			$temp[$i][] = $icon;
294
-			$temp[$i][] = $data->latitude;
295
-			$temp[$i][] = $data->longitude;
296
-			$temp[$i][] = $i;
292
+				$temp[$i][] = $text;
293
+				$temp[$i][] = $icon;
294
+				$temp[$i][] = $data->latitude;
295
+				$temp[$i][] = $data->longitude;
296
+				$temp[$i][] = $i;
297 297
 
298
-			$temp_json[] = json_encode($temp[$i]);
298
+				$temp_json[] = json_encode($temp[$i]);
299 299
 
300 300
 
301
-			$i++;
302
-		}
301
+				$i++;
302
+			}
303 303
 
304
-		$return = json_encode($temp_json);
304
+			$return = json_encode($temp_json);
305 305
 
306
-		echo $return;
306
+			echo $return;
307 307
 
308
-		break;
308
+			break;
309 309
 
310 310
 
311 311
 
312
-	####################################
313
-	//
314
-	// Update data for the gym battle
315
-	//
316
-	####################################
312
+		####################################
313
+		//
314
+		// Update data for the gym battle
315
+		//
316
+		####################################
317 317
 
318
-	case 'update_gym':
319
-		$teams			= new stdClass();
320
-		$teams->mystic 		= 1;
321
-		$teams->valor 		= 2;
322
-		$teams->instinct 	= 3;
318
+		case 'update_gym':
319
+			$teams			= new stdClass();
320
+			$teams->mystic 		= 1;
321
+			$teams->valor 		= 2;
322
+			$teams->instinct 	= 3;
323 323
 
324 324
 
325
-		foreach ($teams as $team_name => $team_id) {
326
-			$req	= "SELECT COUNT(DISTINCT(gym_id)) as total, ROUND(AVG(gym_points),0) as average_points FROM gym WHERE team_id = '".$team_id."'  ";
327
-			$result	= $mysqli->query($req);
328
-			$data	= $result->fetch_object();
325
+			foreach ($teams as $team_name => $team_id) {
326
+				$req	= "SELECT COUNT(DISTINCT(gym_id)) as total, ROUND(AVG(gym_points),0) as average_points FROM gym WHERE team_id = '".$team_id."'  ";
327
+				$result	= $mysqli->query($req);
328
+				$data	= $result->fetch_object();
329 329
 
330
-			$return[] 	= $data->total;
331
-			$return[]	= $data->average_points;
332
-		}
330
+				$return[] 	= $data->total;
331
+				$return[]	= $data->average_points;
332
+			}
333 333
 
334
-		$json = json_encode($return);
334
+			$json = json_encode($return);
335 335
 
336
-		header('Content-Type: application/json');
337
-		echo $json;
336
+			header('Content-Type: application/json');
337
+			echo $json;
338 338
 
339 339
 
340
-		break;
340
+			break;
341 341
 
342
-	####################################
343
-	//
344
-	// Get datas for the gym map
345
-	//
346
-	####################################
342
+		####################################
343
+		//
344
+		// Get datas for the gym map
345
+		//
346
+		####################################
347 347
 
348 348
 
349
-	case 'gym_map':
350
-		$req 		= "SELECT gym_id, team_id, guard_pokemon_id, gym_points, latitude, longitude, (CONVERT_TZ(last_scanned, '+00:00', '".$time_offset."')) as last_scanned FROM gym";
351
-		$result 	= $mysqli->query($req);
349
+		case 'gym_map':
350
+			$req 		= "SELECT gym_id, team_id, guard_pokemon_id, gym_points, latitude, longitude, (CONVERT_TZ(last_scanned, '+00:00', '".$time_offset."')) as last_scanned FROM gym";
351
+			$result 	= $mysqli->query($req);
352 352
 
353 353
 
354
-		$i=0;
354
+			$i=0;
355 355
 
356
-		while ($data = $result->fetch_object()) {
357
-			// Team
358
-			// 1 = bleu
359
-			// 2 = rouge
360
-			// 3 = jaune
356
+			while ($data = $result->fetch_object()) {
357
+				// Team
358
+				// 1 = bleu
359
+				// 2 = rouge
360
+				// 3 = jaune
361 361
 
362
-			switch ($data->team_id) {
362
+				switch ($data->team_id) {
363 363
 				case 0:
364 364
 					$icon	= 'map_white.png';
365 365
 					$team	= 'No Team (yet)';
@@ -383,7 +383,7 @@  discard block
 block discarded – undo
383 383
 					$team	= 'Team Instinct';
384 384
 					$color	= 'rgba(254, 217, 40, .6)';
385 385
 					break;
386
-			}
386
+				}
387 387
 
388 388
 			// Set gym level
389 389
 			$data->gym_level=0;
@@ -455,65 +455,65 @@  discard block
 block discarded – undo
455 455
 	//
456 456
 	####################################
457 457
 
458
-	case 'gym_defenders':
459
-		$gym_id = $mysqli->real_escape_string($_GET['gym_id']);
460
-		$req 		= "SELECT gymdetails.name as name, gymdetails.description as description, gym.gym_points as points, gymdetails.url as url, gym.team_id as team, (CONVERT_TZ(gym.last_scanned, '+00:00', '".$time_offset."')) as last_scanned, gym.guard_pokemon_id as guard_pokemon_id FROM gymdetails LEFT JOIN gym on gym.gym_id = gymdetails.gym_id WHERE gym.gym_id='".$gym_id."'";
461
-		$result 	= $mysqli->query($req);
462
-		$gymData['gymDetails']['gymInfos'] = false;
463
-		while ($data = $result->fetch_object()) {
464
-			$gymData['gymDetails']['gymInfos']['name'] = $data->name;
465
-			$gymData['gymDetails']['gymInfos']['description'] = $data->description;
466
-			if ($data->url == null) {
467
-				$gymData['gymDetails']['gymInfos']['url'] = '';
468
-			} else {
469
-				$gymData['gymDetails']['gymInfos']['url'] = $data->url;
470
-			}
471
-			$gymData['gymDetails']['gymInfos']['points'] = $data->points;
472
-			$gymData['gymDetails']['gymInfos']['level'] = 0;
473
-			$gymData['gymDetails']['gymInfos']['last_scanned'] = $data->last_scanned;
474
-			$gymData['gymDetails']['gymInfos']['team'] = $data->team;
475
-			$gymData['gymDetails']['gymInfos']['guardPokemonId'] = $data->guard_pokemon_id;
476
-			if ($data->points < 2000) {
477
-				$gymData['gymDetails']['gymInfos']['level']=1;
478
-			} elseif ($data->points < 4000) {
479
-				$gymData['gymDetails']['gymInfos']['level']=2;
480
-			} elseif ($data->points < 8000) {
481
-				$gymData['gymDetails']['gymInfos']['level']=3;
482
-			} elseif ($data->points < 12000) {
483
-				$gymData['gymDetails']['gymInfos']['level']=4;
484
-			} elseif ($data->points < 16000) {
485
-				$gymData['gymDetails']['gymInfos']['level']=5;
486
-			} elseif ($data->points < 20000) {
487
-				$gymData['gymDetails']['gymInfos']['level']=6;
488
-			} elseif ($data->points < 30000) {
489
-				$gymData['gymDetails']['gymInfos']['level']=7;
490
-			} elseif ($data->points < 40000) {
491
-				$gymData['gymDetails']['gymInfos']['level']=8;
492
-			} elseif ($data->points < 50000) {
493
-				$gymData['gymDetails']['gymInfos']['level']=9;
494
-			} else {
495
-				$gymData['gymDetails']['gymInfos']['level']=10;
458
+		case 'gym_defenders':
459
+			$gym_id = $mysqli->real_escape_string($_GET['gym_id']);
460
+			$req 		= "SELECT gymdetails.name as name, gymdetails.description as description, gym.gym_points as points, gymdetails.url as url, gym.team_id as team, (CONVERT_TZ(gym.last_scanned, '+00:00', '".$time_offset."')) as last_scanned, gym.guard_pokemon_id as guard_pokemon_id FROM gymdetails LEFT JOIN gym on gym.gym_id = gymdetails.gym_id WHERE gym.gym_id='".$gym_id."'";
461
+			$result 	= $mysqli->query($req);
462
+			$gymData['gymDetails']['gymInfos'] = false;
463
+			while ($data = $result->fetch_object()) {
464
+				$gymData['gymDetails']['gymInfos']['name'] = $data->name;
465
+				$gymData['gymDetails']['gymInfos']['description'] = $data->description;
466
+				if ($data->url == null) {
467
+					$gymData['gymDetails']['gymInfos']['url'] = '';
468
+				} else {
469
+					$gymData['gymDetails']['gymInfos']['url'] = $data->url;
470
+				}
471
+				$gymData['gymDetails']['gymInfos']['points'] = $data->points;
472
+				$gymData['gymDetails']['gymInfos']['level'] = 0;
473
+				$gymData['gymDetails']['gymInfos']['last_scanned'] = $data->last_scanned;
474
+				$gymData['gymDetails']['gymInfos']['team'] = $data->team;
475
+				$gymData['gymDetails']['gymInfos']['guardPokemonId'] = $data->guard_pokemon_id;
476
+				if ($data->points < 2000) {
477
+					$gymData['gymDetails']['gymInfos']['level']=1;
478
+				} elseif ($data->points < 4000) {
479
+					$gymData['gymDetails']['gymInfos']['level']=2;
480
+				} elseif ($data->points < 8000) {
481
+					$gymData['gymDetails']['gymInfos']['level']=3;
482
+				} elseif ($data->points < 12000) {
483
+					$gymData['gymDetails']['gymInfos']['level']=4;
484
+				} elseif ($data->points < 16000) {
485
+					$gymData['gymDetails']['gymInfos']['level']=5;
486
+				} elseif ($data->points < 20000) {
487
+					$gymData['gymDetails']['gymInfos']['level']=6;
488
+				} elseif ($data->points < 30000) {
489
+					$gymData['gymDetails']['gymInfos']['level']=7;
490
+				} elseif ($data->points < 40000) {
491
+					$gymData['gymDetails']['gymInfos']['level']=8;
492
+				} elseif ($data->points < 50000) {
493
+					$gymData['gymDetails']['gymInfos']['level']=9;
494
+				} else {
495
+					$gymData['gymDetails']['gymInfos']['level']=10;
496
+				}
496 497
 			}
497
-		}
498
-		//print_r($gymData);
499
-		$req 		= "SELECT DISTINCT gympokemon.pokemon_uid, "
500
-				. "pokemon_id, iv_attack, iv_defense, iv_stamina, MAX(cp) as cp, gymmember.gym_id "
501
-				. "FROM gympokemon inner join gymmember on gympokemon.pokemon_uid=gymmember.pokemon_uid "
502
-				. "GROUP BY gympokemon.pokemon_uid, pokemon_id, iv_attack, iv_defense, iv_stamina, gym_id"
503
-				. " HAVING gymmember.gym_id='".$gym_id."' ORDER BY cp DESC";
504
-		$result 	= $mysqli->query($req);
505
-		$i=0;
498
+			//print_r($gymData);
499
+			$req 		= "SELECT DISTINCT gympokemon.pokemon_uid, "
500
+					. "pokemon_id, iv_attack, iv_defense, iv_stamina, MAX(cp) as cp, gymmember.gym_id "
501
+					. "FROM gympokemon inner join gymmember on gympokemon.pokemon_uid=gymmember.pokemon_uid "
502
+					. "GROUP BY gympokemon.pokemon_uid, pokemon_id, iv_attack, iv_defense, iv_stamina, gym_id"
503
+					. " HAVING gymmember.gym_id='".$gym_id."' ORDER BY cp DESC";
504
+			$result 	= $mysqli->query($req);
505
+			$i=0;
506 506
 
507 507
 
508 508
 
509
-		$gymData['infoWindow'] = '
509
+			$gymData['infoWindow'] = '
510 510
 			<div class="gym_defenders">
511 511
 			';
512
-		while ($data = $result->fetch_object()) {
513
-			$gymData['gymDetails']['pokemons'][] = $data;
514
-			if ($data != false) {
515
-				if ($config->system->iv_numbers) {
516
-					$gymData['infoWindow'] .= '
512
+			while ($data = $result->fetch_object()) {
513
+				$gymData['gymDetails']['pokemons'][] = $data;
514
+				if ($data != false) {
515
+					if ($config->system->iv_numbers) {
516
+						$gymData['infoWindow'] .= '
517 517
 					<div style="text-align: center; width: 50px; display: inline-block; margin-right: 3px">
518 518
 						<a href="pokemon/'.$data->pokemon_id.'">
519 519
 						<img src="core/pokemons/'.$data->pokemon_id.$config->system->pokeimg_suffix.'" height="50" style="display:inline-block" >
@@ -531,9 +531,9 @@  discard block
 block discarded – undo
531 531
 								</div>
532 532
 							</div>
533 533
 						</div>';
534
-				}
535
-				else {
536
-					$gymData['infoWindow'] .= '
534
+					}
535
+					else {
536
+						$gymData['infoWindow'] .= '
537 537
 					<div style="text-align: center; width: 50px; display: inline-block; margin-right: 3px">
538 538
 						<a href="pokemon/'.$data->pokemon_id.'">
539 539
 						<img src="core/pokemons/'.$data->pokemon_id.$config->system->pokeimg_suffix.'" height="50" style="display:inline-block" >
@@ -551,50 +551,50 @@  discard block
 block discarded – undo
551 551
 							</div>
552 552
 						</div>
553 553
 					</div>'
554
-						; }
555
-			} else {
556
-				$gymData['infoWindow'] .= '
554
+							; }
555
+				} else {
556
+					$gymData['infoWindow'] .= '
557 557
 				<div style="text-align: center; width: 50px; display: inline-block; margin-right: 3px">
558 558
 					<a href="pokemon/'.$gymData['gymDetails']['gymInfos']['guardPokemonId'].'">
559 559
 					<img src="core/pokemons/'.$gymData['gymDetails']['gymInfos']['guardPokemonId'].$config->system->pokeimg_suffix.'" height="50" style="display:inline-block" >
560 560
 					</a>
561 561
 					<p class="pkmn-name">???</p>
562 562
 				</div>'
563
-				;
563
+					;
564
+				}
565
+				$i++;
564 566
 			}
565
-			$i++;
566
-		}
567
-		$gymData['infoWindow'] = $gymData['infoWindow'].'</div>';
568
-		$return = json_encode($gymData);
567
+			$gymData['infoWindow'] = $gymData['infoWindow'].'</div>';
568
+			$return = json_encode($gymData);
569 569
 
570
-		echo $return;
570
+			echo $return;
571 571
 
572 572
 
573
-		break;
573
+			break;
574 574
 
575
-	case 'trainer':
576
-		$name = "";
577
-		$page = "0";
578
-		$where = "";
579
-		$order="";
580
-		$team=0;
581
-		$ranking=0;
582
-		if (isset($_GET['name'])) {
583
-			$trainer_name = mysqli_real_escape_string($mysqli, $_GET['name']);
584
-			$where = " HAVING name LIKE '%".$trainer_name."%'";
585
-		}
586
-		if (isset($_GET['team']) && $_GET['team']!=0) {
587
-			$team = mysqli_real_escape_string($mysqli, $_GET['team']);
588
-			$where .= ($where==""?" HAVING":"AND ")." team = ".$team;
589
-		}
590
-		if (isset($_GET['page'])) {
591
-			$page = mysqli_real_escape_string($mysqli, $_GET['page']);
592
-		}
593
-		if (isset($_GET['ranking'])) {
594
-			$ranking = mysqli_real_escape_string($mysqli, $_GET['ranking']);
595
-		}
575
+		case 'trainer':
576
+			$name = "";
577
+			$page = "0";
578
+			$where = "";
579
+			$order="";
580
+			$team=0;
581
+			$ranking=0;
582
+			if (isset($_GET['name'])) {
583
+				$trainer_name = mysqli_real_escape_string($mysqli, $_GET['name']);
584
+				$where = " HAVING name LIKE '%".$trainer_name."%'";
585
+			}
586
+			if (isset($_GET['team']) && $_GET['team']!=0) {
587
+				$team = mysqli_real_escape_string($mysqli, $_GET['team']);
588
+				$where .= ($where==""?" HAVING":"AND ")." team = ".$team;
589
+			}
590
+			if (isset($_GET['page'])) {
591
+				$page = mysqli_real_escape_string($mysqli, $_GET['page']);
592
+			}
593
+			if (isset($_GET['ranking'])) {
594
+				$ranking = mysqli_real_escape_string($mysqli, $_GET['ranking']);
595
+			}
596 596
 
597
-		switch ($ranking) {
597
+			switch ($ranking) {
598 598
 			case 1:
599 599
 				$order=" ORDER BY active DESC ";
600 600
 				break;
@@ -603,7 +603,7 @@  discard block
 block discarded – undo
603 603
 				break;
604 604
 			default:
605 605
 				$order=" ORDER BY level DESC, active DESC ";
606
-		}
606
+			}
607 607
 
608 608
 		$limit = " LIMIT ".($page*10).",10 ";
609 609
 
@@ -660,100 +660,100 @@  discard block
 block discarded – undo
660 660
 
661 661
 		break;
662 662
 
663
-	case 'pokemon_slider_init':
664
-		$req 		= "SELECT MIN(pokemon.disappear_time) as min, MAX(pokemon.disappear_time) as max from pokemon";
665
-		$result 	= $mysqli->query($req);
666
-		$data 		= $result->fetch_object();
667
-		$bounds 	= $data;
663
+		case 'pokemon_slider_init':
664
+			$req 		= "SELECT MIN(pokemon.disappear_time) as min, MAX(pokemon.disappear_time) as max from pokemon";
665
+			$result 	= $mysqli->query($req);
666
+			$data 		= $result->fetch_object();
667
+			$bounds 	= $data;
668 668
 
669
-		header('Content-Type: application/json');
670
-		$json = json_encode($bounds);
669
+			header('Content-Type: application/json');
670
+			$json = json_encode($bounds);
671 671
 
672
-		echo $json;
673
-		break;
672
+			echo $json;
673
+			break;
674 674
 
675
-	case 'pokemon_heatmap_points':
676
-		$json="";
677
-		if (isset($_GET['start'])&&isset($_GET['end']) && isset($_GET['pokemon_id'])) {
678
-			$start = Date("Y-m-d H:i",(int)$_GET['start']);
679
-			$end = Date("Y-m-d H:i",(int)$_GET['end']);
680
-			$pokemon_id = mysqli_real_escape_string($mysqli, $_GET['pokemon_id']);
681
-			$where = " WHERE pokemon.pokemon_id = ".$pokemon_id." "
682
-					. "AND pokemon.disappear_time BETWEEN '".$start."' AND '".$end."'";
683
-			$req 		= "SELECT latitude, longitude FROM pokemon".$where." ORDER BY disappear_time DESC LIMIT 10000";
684
-			$result 	= $mysqli->query($req);
685
-			$points = array();
686
-			while ($result && $data = $result->fetch_object()) {
687
-				$points[] 	= $data;
675
+		case 'pokemon_heatmap_points':
676
+			$json="";
677
+			if (isset($_GET['start'])&&isset($_GET['end']) && isset($_GET['pokemon_id'])) {
678
+				$start = Date("Y-m-d H:i",(int)$_GET['start']);
679
+				$end = Date("Y-m-d H:i",(int)$_GET['end']);
680
+				$pokemon_id = mysqli_real_escape_string($mysqli, $_GET['pokemon_id']);
681
+				$where = " WHERE pokemon.pokemon_id = ".$pokemon_id." "
682
+						. "AND pokemon.disappear_time BETWEEN '".$start."' AND '".$end."'";
683
+				$req 		= "SELECT latitude, longitude FROM pokemon".$where." ORDER BY disappear_time DESC LIMIT 10000";
684
+				$result 	= $mysqli->query($req);
685
+				$points = array();
686
+				while ($result && $data = $result->fetch_object()) {
687
+					$points[] 	= $data;
688
+				}
689
+
690
+				$json = json_encode($points);
688 691
 			}
689 692
 
690
-			$json = json_encode($points);
691
-		}
693
+			header('Content-Type: application/json');
692 694
 
693
-		header('Content-Type: application/json');
695
+			echo $json;
694 696
 
695
-		echo $json;
697
+			break;
696 698
 
697
-		break;
699
+		case 'pokedex':
700
+			$json="";
701
+			if (isset($_GET['pokemon_id'])) {
702
+				$pokemon_id = mysqli_real_escape_string($mysqli, $_GET['pokemon_id']);
703
+				$where = " WHERE pokemon.pokemon_id = ".$pokemon_id;
704
+				$req 		= "SELECT COUNT(encounter_id) as total FROM pokemon".$where;
705
+				$result 	= $mysqli->query($req);
706
+				$total = 0;
707
+				while ($result && $data = $result->fetch_object()) {
708
+					$total 	= $data;
709
+				}
698 710
 
699
-	case 'pokedex':
700
-		$json="";
701
-		if (isset($_GET['pokemon_id'])) {
702
-			$pokemon_id = mysqli_real_escape_string($mysqli, $_GET['pokemon_id']);
703
-			$where = " WHERE pokemon.pokemon_id = ".$pokemon_id;
704
-			$req 		= "SELECT COUNT(encounter_id) as total FROM pokemon".$where;
705
-			$result 	= $mysqli->query($req);
706
-			$total = 0;
707
-			while ($result && $data = $result->fetch_object()) {
708
-				$total 	= $data;
711
+				$json = json_encode($total);
709 712
 			}
710 713
 
711
-			$json = json_encode($total);
712
-		}
713
-
714
-		header('Content-Type: application/json');
714
+			header('Content-Type: application/json');
715 715
 
716
-		echo $json;
716
+			echo $json;
717 717
 
718
-		break;
718
+			break;
719 719
 
720 720
 		case 'postRequest':
721 721
 		break;
722 722
 
723
-	case 'pokemon_graph_data':
724
-		$json="";
725
-		if (isset($_GET['pokemon_id'])) {
726
-			$pokemon_id = mysqli_real_escape_string($mysqli, $_GET['pokemon_id']);
727
-			$where = " WHERE pokemonFiltered.pokemon_id = ".$pokemon_id;
728
-			$req 		= "SELECT COUNT(*) as total, "
729
-					. "HOUR(CONVERT_TZ(disappear_time, '+00:00', '".$time_offset."')) as disappear_hour
723
+		case 'pokemon_graph_data':
724
+			$json="";
725
+			if (isset($_GET['pokemon_id'])) {
726
+				$pokemon_id = mysqli_real_escape_string($mysqli, $_GET['pokemon_id']);
727
+				$where = " WHERE pokemonFiltered.pokemon_id = ".$pokemon_id;
728
+				$req 		= "SELECT COUNT(*) as total, "
729
+						. "HOUR(CONVERT_TZ(disappear_time, '+00:00', '".$time_offset."')) as disappear_hour
730 730
 			FROM (SELECT * FROM pokemon WHERE pokemon_id = '".$pokemon_id."' LIMIT 10000) as pokemonFiltered
731 731
 			GROUP BY disappear_hour
732 732
 			ORDER BY disappear_hour";
733
-			$result 	= $mysqli->query($req);
734
-			$array = array();
735
-			while ($result && $data = $result->fetch_object()) {
736
-				$array[] = $data->total;
733
+				$result 	= $mysqli->query($req);
734
+				$array = array();
735
+				while ($result && $data = $result->fetch_object()) {
736
+					$array[] = $data->total;
737
+				}
738
+				$array[] = array_shift($array);
739
+				$json = json_encode($array);
737 740
 			}
738
-			$array[] = array_shift($array);
739
-			$json = json_encode($array);
740
-		}
741 741
 
742
-		header('Content-Type: application/json');
742
+			header('Content-Type: application/json');
743 743
 
744
-		echo $json;
744
+			echo $json;
745 745
 
746
-		break;
746
+			break;
747 747
 
748 748
 		case 'postRequest':
749 749
 		break;
750 750
 
751 751
 
752
-	default:
753
-		echo "What do you mean?";
754
-		exit();
752
+		default:
753
+			echo "What do you mean?";
754
+			exit();
755 755
 
756
-	break;
756
+		break;
757 757
 }
758 758
 if ($postRequest!=""){
759 759
 	switch ($postRequest) {
Please login to merge, or discard this patch.
Spacing   +137 added lines, -137 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@  discard block
 block discarded – undo
6 6
 
7 7
 $pos = !empty($_SERVER['HTTP_REFERER']) && strpos($_SERVER['HTTP_REFERER'], getenv('HTTP_HOST'));
8 8
 
9
-if ($pos===false) {
9
+if ($pos === false) {
10 10
 	http_response_code(401);
11 11
 	die('Restricted access');
12 12
 }
@@ -19,8 +19,8 @@  discard block
 block discarded – undo
19 19
 // Include & load the variables
20 20
 // ############################
21 21
 
22
-$variables 	= SYS_PATH.'/core/json/variables.json';
23
-$config 	= json_decode(file_get_contents($variables));
22
+$variables = SYS_PATH.'/core/json/variables.json';
23
+$config = json_decode(file_get_contents($variables));
24 24
 
25 25
 
26 26
 
@@ -37,19 +37,19 @@  discard block
 block discarded – undo
37 37
 
38 38
 
39 39
 # MySQL
40
-$mysqli 	= new mysqli(SYS_DB_HOST, SYS_DB_USER, SYS_DB_PSWD, SYS_DB_NAME, SYS_DB_PORT);
40
+$mysqli = new mysqli(SYS_DB_HOST, SYS_DB_USER, SYS_DB_PSWD, SYS_DB_NAME, SYS_DB_PORT);
41 41
 if ($mysqli->connect_error != '') {
42 42
 	exit('Error MySQL Connect');
43 43
 }
44 44
 $mysqli->set_charset('utf8');
45 45
 $request = "";
46
-if (isset($_GET['type'])){
47
-$request 	= $_GET['type'];
46
+if (isset($_GET['type'])) {
47
+$request = $_GET['type'];
48 48
 }
49 49
 $postRequest = "";
50
-if (isset($_POST['type'])){
50
+if (isset($_POST['type'])) {
51 51
 	$postRequest = $_POST['type'];
52
-	$request= "postRequest";
52
+	$request = "postRequest";
53 53
 }
54 54
 switch ($request) {
55 55
 	############################
@@ -62,64 +62,64 @@  discard block
 block discarded – undo
62 62
 		// Right now
63 63
 		// ---------
64 64
 
65
-		$req 		= "SELECT COUNT(*) as total FROM pokemon WHERE disappear_time >= UTC_TIMESTAMP()";
66
-		$result 	= $mysqli->query($req);
67
-		$data 		= $result->fetch_object();
65
+		$req = "SELECT COUNT(*) as total FROM pokemon WHERE disappear_time >= UTC_TIMESTAMP()";
66
+		$result = $mysqli->query($req);
67
+		$data = $result->fetch_object();
68 68
 
69
-		$values[] 	= $data->total;
69
+		$values[] = $data->total;
70 70
 
71 71
 
72 72
 		// Lured stops
73 73
 		// -----------
74 74
 
75
-		$req 		= "SELECT COUNT(*) as total FROM pokestop WHERE lure_expiration >= UTC_TIMESTAMP()";
76
-		$result 	= $mysqli->query($req);
77
-		$data 		= $result->fetch_object();
75
+		$req = "SELECT COUNT(*) as total FROM pokestop WHERE lure_expiration >= UTC_TIMESTAMP()";
76
+		$result = $mysqli->query($req);
77
+		$data = $result->fetch_object();
78 78
 
79
-		$values[] 	= $data->total;
79
+		$values[] = $data->total;
80 80
 
81 81
 
82 82
 
83 83
 		// Team battle
84 84
 		// -----------
85 85
 
86
-		$req 		= "SELECT count( DISTINCT(gym_id) ) as total FROM gym";
87
-		$result 	= $mysqli->query($req);
88
-		$data 		= $result->fetch_object();
86
+		$req = "SELECT count( DISTINCT(gym_id) ) as total FROM gym";
87
+		$result = $mysqli->query($req);
88
+		$data = $result->fetch_object();
89 89
 
90
-		$values[] 	= $data->total;
90
+		$values[] = $data->total;
91 91
 
92 92
 		// Team
93 93
 		// 1 = bleu
94 94
 		// 2 = rouge
95 95
 		// 3 = jaune
96 96
 
97
-		$req	= "SELECT count( DISTINCT(gym_id) ) as total FROM gym WHERE team_id = '2'  ";
98
-		$result	= $mysqli->query($req);
99
-		$data	= $result->fetch_object();
97
+		$req = "SELECT count( DISTINCT(gym_id) ) as total FROM gym WHERE team_id = '2'  ";
98
+		$result = $mysqli->query($req);
99
+		$data = $result->fetch_object();
100 100
 
101 101
 		// Red
102 102
 		$values[] = $data->total;
103 103
 
104 104
 
105
-		$req	= "SELECT count( DISTINCT(gym_id) ) as total FROM gym WHERE team_id = '1'  ";
106
-		$result	= $mysqli->query($req);
107
-		$data	= $result->fetch_object();
105
+		$req = "SELECT count( DISTINCT(gym_id) ) as total FROM gym WHERE team_id = '1'  ";
106
+		$result = $mysqli->query($req);
107
+		$data = $result->fetch_object();
108 108
 
109 109
 		// Blue
110 110
 		$values[] = $data->total;
111 111
 
112 112
 
113
-		$req	= "SELECT count( DISTINCT(gym_id) ) as total FROM gym WHERE team_id = '3'  ";
114
-		$result	= $mysqli->query($req);
115
-		$data	= $result->fetch_object();
113
+		$req = "SELECT count( DISTINCT(gym_id) ) as total FROM gym WHERE team_id = '3'  ";
114
+		$result = $mysqli->query($req);
115
+		$data = $result->fetch_object();
116 116
 
117 117
 		// Yellow
118 118
 		$values[] = $data->total;
119 119
 
120
-		$req	= "SELECT count( DISTINCT(gym_id) ) as total FROM gym WHERE team_id = '0'  ";
121
-		$result	= $mysqli->query($req);
122
-		$data	= $result->fetch_object();
120
+		$req = "SELECT count( DISTINCT(gym_id) ) as total FROM gym WHERE team_id = '0'  ";
121
+		$result = $mysqli->query($req);
122
+		$data = $result->fetch_object();
123 123
 
124 124
 		// Neutral
125 125
 		$values[] = $data->total;
@@ -159,12 +159,12 @@  discard block
 block discarded – undo
159 159
 			}
160 160
 
161 161
 			// get last mythic pokemon
162
-			$req		= "SELECT 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
162
+			$req = "SELECT 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
163 163
                         WHERE pokemon_id IN (".implode(",", $mythic_pokemons).")
164 164
                         ORDER BY last_modified DESC LIMIT 0,12";
165 165
 		} else {
166 166
 			// get last pokemon
167
-			$req		= "SELECT 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 ORDER BY last_modified DESC LIMIT 0,12";
167
+			$req = "SELECT 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 ORDER BY last_modified DESC LIMIT 0,12";
168 168
 		}
169 169
 		$result = $mysqli->query($req);
170 170
 		while ($data = $result->fetch_object()) {
@@ -203,27 +203,27 @@  discard block
 block discarded – undo
203 203
 						if ($config->system->iv_numbers) {
204 204
 							$html .= '
205 205
 							<div class="progress" style="height: 15px; margin-bottom: 0">
206
-								<div title="Attack IV: '. $iv->attack .'" class="progress-bar progress-bar-danger" role="progressbar" aria-valuenow="'. $iv->attack .'" aria-valuemin="0" aria-valuemax="45" style="width: '. (100/3)  .'%; line-height: 16px";>
207
-									<span class="sr-only">Attack IV: '. $iv->attack .'</span>'. $iv->attack .'
206
+								<div title="Attack IV: '. $iv->attack.'" class="progress-bar progress-bar-danger" role="progressbar" aria-valuenow="'.$iv->attack.'" aria-valuemin="0" aria-valuemax="45" style="width: '.(100 / 3).'%; line-height: 16px";>
207
+									<span class="sr-only">Attack IV: '. $iv->attack.'</span>'.$iv->attack.'
208 208
 								</div>
209
-								<div title="Defense IV: '. $iv->defense .'" class="progress-bar progress-bar-info" role="progressbar" aria-valuenow="'. $iv->defense .'" aria-valuemin="0" aria-valuemax="45" style="width: '. (100/3)  .'%; line-height: 16px";>
210
-									<span class="sr-only">Defense IV: '. $iv->defense .'</span>'. $iv->defense .'
209
+								<div title="Defense IV: '. $iv->defense.'" class="progress-bar progress-bar-info" role="progressbar" aria-valuenow="'.$iv->defense.'" aria-valuemin="0" aria-valuemax="45" style="width: '.(100 / 3).'%; line-height: 16px";>
210
+									<span class="sr-only">Defense IV: '. $iv->defense.'</span>'.$iv->defense.'
211 211
 								</div>
212
-								<div title="Stamina IV: '. $iv->stamina .'" class="progress-bar progress-bar-success" role="progressbar" aria-valuenow="'. $iv->stamina .'" aria-valuemin="0" aria-valuemax="45" style="width: '. (100/3)  .'%; line-height: 16px";>
213
-									<span class="sr-only">Stamina IV: '. $iv->stamina .'</span>'. $iv->stamina .'
212
+								<div title="Stamina IV: '. $iv->stamina.'" class="progress-bar progress-bar-success" role="progressbar" aria-valuenow="'.$iv->stamina.'" aria-valuemin="0" aria-valuemax="45" style="width: '.(100 / 3).'%; line-height: 16px";>
213
+									<span class="sr-only">Stamina IV: '. $iv->stamina.'</span>'.$iv->stamina.'
214 214
 								</div>
215 215
 							</div>';
216 216
 						} else {
217 217
 							$html .= '
218 218
 							<div class="progress" style="height: 6px; width: 80%; margin: 5px auto 0 auto;">
219
-					    		<div title="Attack IV: '. $iv->attack .'" class="progress-bar progress-bar-danger" role="progressbar" aria-valuenow="'. $iv->attack .'" aria-valuemin="0" aria-valuemax="45" style="width: '. ((100/15)*$iv->attack)/3 .'%">
220
-									<span class="sr-only">Attack IV: '. $iv->attack .'</span>
219
+					    		<div title="Attack IV: '. $iv->attack.'" class="progress-bar progress-bar-danger" role="progressbar" aria-valuenow="'.$iv->attack.'" aria-valuemin="0" aria-valuemax="45" style="width: '.((100 / 15) * $iv->attack) / 3.'%">
220
+									<span class="sr-only">Attack IV: '. $iv->attack.'</span>
221 221
 					    		</div>
222
-					    		<div title="Defense IV: '. $iv->defense .'" class="progress-bar progress-bar-info" role="progressbar" aria-valuenow="'. $iv->defense .'" aria-valuemin="0" aria-valuemax="45" style="width: '. ((100/15)*$iv->defense)/3 .'%">
223
-									<span class="sr-only">Defense IV: '. $iv->defense .'</span>
222
+					    		<div title="Defense IV: '. $iv->defense.'" class="progress-bar progress-bar-info" role="progressbar" aria-valuenow="'.$iv->defense.'" aria-valuemin="0" aria-valuemax="45" style="width: '.((100 / 15) * $iv->defense) / 3.'%">
223
+									<span class="sr-only">Defense IV: '. $iv->defense.'</span>
224 224
 					    		</div>
225
-					    		<div title="Stamina IV: '. $iv->stamina .'" class="progress-bar progress-bar-success" role="progressbar" aria-valuenow="'. $iv->stamina .'" aria-valuemin="0" aria-valuemax="45" style="width: '. ((100/15)*$iv->stamina)/3 .'%">
226
-									<span class="sr-only">Stamina IV: '. $iv->stamina .'</span>
225
+					    		<div title="Stamina IV: '. $iv->stamina.'" class="progress-bar progress-bar-success" role="progressbar" aria-valuenow="'.$iv->stamina.'" aria-valuemin="0" aria-valuemax="45" style="width: '.((100 / 15) * $iv->stamina) / 3.'%">
226
+									<span class="sr-only">Stamina IV: '. $iv->stamina.'</span>
227 227
 					    		</div>
228 228
 							</div>';
229 229
 						}
@@ -231,13 +231,13 @@  discard block
 block discarded – undo
231 231
 						if ($config->system->iv_numbers) {
232 232
 							$html .= '
233 233
 							<div class="progress" style="height: 15px; margin-bottom: 0">
234
-								<div title="Attack IV: not available" class="progress-bar progress-bar-danger" role="progressbar" aria-valuenow="'. $iv->attack .'" aria-valuemin="0" aria-valuemax="45" style="width: '. (100/3)  .'%; line-height: 16px";>
234
+								<div title="Attack IV: not available" class="progress-bar progress-bar-danger" role="progressbar" aria-valuenow="'. $iv->attack.'" aria-valuemin="0" aria-valuemax="45" style="width: '.(100 / 3).'%; line-height: 16px";>
235 235
 									<span class="sr-only">Attack IV: not available</span>?
236 236
 								</div>
237
-								<div title="Defense IV: not available" class="progress-bar progress-bar-info" role="progressbar" aria-valuenow="'. $iv->defense .'" aria-valuemin="0" aria-valuemax="45" style="width: '. (100/3)  .'%; line-height: 16px";>
237
+								<div title="Defense IV: not available" class="progress-bar progress-bar-info" role="progressbar" aria-valuenow="'. $iv->defense.'" aria-valuemin="0" aria-valuemax="45" style="width: '.(100 / 3).'%; line-height: 16px";>
238 238
 									<span class="sr-only">Defense IV: not available</span>?
239 239
 								</div>
240
-								<div title="Stamina IV: not available" class="progress-bar progress-bar-success" role="progressbar" aria-valuenow="'. $iv->stamina .'" aria-valuemin="0" aria-valuemax="45" style="width: '. (100/3)  .'%; line-height: 16px";>
240
+								<div title="Stamina IV: not available" class="progress-bar progress-bar-success" role="progressbar" aria-valuenow="'. $iv->stamina.'" aria-valuemin="0" aria-valuemax="45" style="width: '.(100 / 3).'%; line-height: 16px";>
241 241
 									<span class="sr-only">Stamina IV: not available</span>?
242 242
 								</div>
243 243
 							</div>';
@@ -275,15 +275,15 @@  discard block
 block discarded – undo
275 275
 	####################################
276 276
 
277 277
 	case 'pokestop':
278
-		$req 		= "SELECT latitude, longitude, lure_expiration, UTC_TIMESTAMP() as now, (CONVERT_TZ(lure_expiration, '+00:00', '".$time_offset."')) as lure_expiration_real FROM pokestop";
279
-		$result 	= $mysqli->query($req);
278
+		$req = "SELECT latitude, longitude, lure_expiration, UTC_TIMESTAMP() as now, (CONVERT_TZ(lure_expiration, '+00:00', '".$time_offset."')) as lure_expiration_real FROM pokestop";
279
+		$result = $mysqli->query($req);
280 280
 
281
-		$i=0;
281
+		$i = 0;
282 282
 
283 283
 		while ($data = $result->fetch_object()) {
284 284
 			if ($data->lure_expiration >= $data->now) {
285 285
 				$icon = 'pokestap_lured.png';
286
-				$text = 'Lured expire @ '.date('H:i:s', strtotime($data->lure_expiration_real)) ;
286
+				$text = 'Lured expire @ '.date('H:i:s', strtotime($data->lure_expiration_real));
287 287
 			} else {
288 288
 				$icon = 'pokestap.png';
289 289
 				$text = 'Normal stop';
@@ -316,19 +316,19 @@  discard block
 block discarded – undo
316 316
 	####################################
317 317
 
318 318
 	case 'update_gym':
319
-		$teams			= new stdClass();
320
-		$teams->mystic 		= 1;
321
-		$teams->valor 		= 2;
322
-		$teams->instinct 	= 3;
319
+		$teams = new stdClass();
320
+		$teams->mystic = 1;
321
+		$teams->valor = 2;
322
+		$teams->instinct = 3;
323 323
 
324 324
 
325 325
 		foreach ($teams as $team_name => $team_id) {
326
-			$req	= "SELECT COUNT(DISTINCT(gym_id)) as total, ROUND(AVG(gym_points),0) as average_points FROM gym WHERE team_id = '".$team_id."'  ";
327
-			$result	= $mysqli->query($req);
328
-			$data	= $result->fetch_object();
326
+			$req = "SELECT COUNT(DISTINCT(gym_id)) as total, ROUND(AVG(gym_points),0) as average_points FROM gym WHERE team_id = '".$team_id."'  ";
327
+			$result = $mysqli->query($req);
328
+			$data = $result->fetch_object();
329 329
 
330
-			$return[] 	= $data->total;
331
-			$return[]	= $data->average_points;
330
+			$return[] = $data->total;
331
+			$return[] = $data->average_points;
332 332
 		}
333 333
 
334 334
 		$json = json_encode($return);
@@ -347,11 +347,11 @@  discard block
 block discarded – undo
347 347
 
348 348
 
349 349
 	case 'gym_map':
350
-		$req 		= "SELECT gym_id, team_id, guard_pokemon_id, gym_points, latitude, longitude, (CONVERT_TZ(last_scanned, '+00:00', '".$time_offset."')) as last_scanned FROM gym";
351
-		$result 	= $mysqli->query($req);
350
+		$req = "SELECT gym_id, team_id, guard_pokemon_id, gym_points, latitude, longitude, (CONVERT_TZ(last_scanned, '+00:00', '".$time_offset."')) as last_scanned FROM gym";
351
+		$result = $mysqli->query($req);
352 352
 
353 353
 
354
-		$i=0;
354
+		$i = 0;
355 355
 
356 356
 		while ($data = $result->fetch_object()) {
357 357
 			// Team
@@ -363,50 +363,50 @@  discard block
 block discarded – undo
363 363
 				case 0:
364 364
 					$icon	= 'map_white.png';
365 365
 					$team	= 'No Team (yet)';
366
-					$color	= 'rgba(0, 0, 0, .6)';
366
+					$color = 'rgba(0, 0, 0, .6)';
367 367
 					break;
368 368
 
369 369
 				case 1:
370 370
 					$icon	= 'map_blue_';
371 371
 					$team	= 'Team Mystic';
372
-					$color	= 'rgba(74, 138, 202, .6)';
372
+					$color = 'rgba(74, 138, 202, .6)';
373 373
 					break;
374 374
 
375 375
 				case 2:
376 376
 					$icon	= 'map_red_';
377 377
 					$team	= 'Team Valor';
378
-					$color	= 'rgba(240, 68, 58, .6)';
378
+					$color = 'rgba(240, 68, 58, .6)';
379 379
 					break;
380 380
 
381 381
 				case 3:
382 382
 					$icon	= 'map_yellow_';
383 383
 					$team	= 'Team Instinct';
384
-					$color	= 'rgba(254, 217, 40, .6)';
384
+					$color = 'rgba(254, 217, 40, .6)';
385 385
 					break;
386 386
 			}
387 387
 
388 388
 			// Set gym level
389
-			$data->gym_level=0;
389
+			$data->gym_level = 0;
390 390
 			if ($data->gym_points < 2000) {
391
-				$data->gym_level=1;
391
+				$data->gym_level = 1;
392 392
 			} elseif ($data->gym_points < 4000) {
393
-				$data->gym_level=2;
393
+				$data->gym_level = 2;
394 394
 			} elseif ($data->gym_points < 8000) {
395
-				$data->gym_level=3;
395
+				$data->gym_level = 3;
396 396
 			} elseif ($data->gym_points < 12000) {
397
-				$data->gym_level=4;
397
+				$data->gym_level = 4;
398 398
 			} elseif ($data->gym_points < 16000) {
399
-				$data->gym_level=5;
399
+				$data->gym_level = 5;
400 400
 			} elseif ($data->gym_points < 20000) {
401
-				$data->gym_level=6;
401
+				$data->gym_level = 6;
402 402
 			} elseif ($data->gym_points < 30000) {
403
-				$data->gym_level=7;
403
+				$data->gym_level = 7;
404 404
 			} elseif ($data->gym_points < 40000) {
405
-				$data->gym_level=8;
405
+				$data->gym_level = 8;
406 406
 			} elseif ($data->gym_points < 50000) {
407
-				$data->gym_level=9;
407
+				$data->gym_level = 9;
408 408
 			} else {
409
-				$data->gym_level=10;
409
+				$data->gym_level = 10;
410 410
 			}
411 411
 
412 412
 			## I know, I revert commit 6e8d2e7 from @kiralydavid but the way it was done broke the page.
@@ -457,8 +457,8 @@  discard block
 block discarded – undo
457 457
 
458 458
 	case 'gym_defenders':
459 459
 		$gym_id = $mysqli->real_escape_string($_GET['gym_id']);
460
-		$req 		= "SELECT gymdetails.name as name, gymdetails.description as description, gym.gym_points as points, gymdetails.url as url, gym.team_id as team, (CONVERT_TZ(gym.last_scanned, '+00:00', '".$time_offset."')) as last_scanned, gym.guard_pokemon_id as guard_pokemon_id FROM gymdetails LEFT JOIN gym on gym.gym_id = gymdetails.gym_id WHERE gym.gym_id='".$gym_id."'";
461
-		$result 	= $mysqli->query($req);
460
+		$req = "SELECT gymdetails.name as name, gymdetails.description as description, gym.gym_points as points, gymdetails.url as url, gym.team_id as team, (CONVERT_TZ(gym.last_scanned, '+00:00', '".$time_offset."')) as last_scanned, gym.guard_pokemon_id as guard_pokemon_id FROM gymdetails LEFT JOIN gym on gym.gym_id = gymdetails.gym_id WHERE gym.gym_id='".$gym_id."'";
461
+		$result = $mysqli->query($req);
462 462
 		$gymData['gymDetails']['gymInfos'] = false;
463 463
 		while ($data = $result->fetch_object()) {
464 464
 			$gymData['gymDetails']['gymInfos']['name'] = $data->name;
@@ -474,35 +474,35 @@  discard block
 block discarded – undo
474 474
 			$gymData['gymDetails']['gymInfos']['team'] = $data->team;
475 475
 			$gymData['gymDetails']['gymInfos']['guardPokemonId'] = $data->guard_pokemon_id;
476 476
 			if ($data->points < 2000) {
477
-				$gymData['gymDetails']['gymInfos']['level']=1;
477
+				$gymData['gymDetails']['gymInfos']['level'] = 1;
478 478
 			} elseif ($data->points < 4000) {
479
-				$gymData['gymDetails']['gymInfos']['level']=2;
479
+				$gymData['gymDetails']['gymInfos']['level'] = 2;
480 480
 			} elseif ($data->points < 8000) {
481
-				$gymData['gymDetails']['gymInfos']['level']=3;
481
+				$gymData['gymDetails']['gymInfos']['level'] = 3;
482 482
 			} elseif ($data->points < 12000) {
483
-				$gymData['gymDetails']['gymInfos']['level']=4;
483
+				$gymData['gymDetails']['gymInfos']['level'] = 4;
484 484
 			} elseif ($data->points < 16000) {
485
-				$gymData['gymDetails']['gymInfos']['level']=5;
485
+				$gymData['gymDetails']['gymInfos']['level'] = 5;
486 486
 			} elseif ($data->points < 20000) {
487
-				$gymData['gymDetails']['gymInfos']['level']=6;
487
+				$gymData['gymDetails']['gymInfos']['level'] = 6;
488 488
 			} elseif ($data->points < 30000) {
489
-				$gymData['gymDetails']['gymInfos']['level']=7;
489
+				$gymData['gymDetails']['gymInfos']['level'] = 7;
490 490
 			} elseif ($data->points < 40000) {
491
-				$gymData['gymDetails']['gymInfos']['level']=8;
491
+				$gymData['gymDetails']['gymInfos']['level'] = 8;
492 492
 			} elseif ($data->points < 50000) {
493
-				$gymData['gymDetails']['gymInfos']['level']=9;
493
+				$gymData['gymDetails']['gymInfos']['level'] = 9;
494 494
 			} else {
495
-				$gymData['gymDetails']['gymInfos']['level']=10;
495
+				$gymData['gymDetails']['gymInfos']['level'] = 10;
496 496
 			}
497 497
 		}
498 498
 		//print_r($gymData);
499
-		$req 		= "SELECT DISTINCT gympokemon.pokemon_uid, "
499
+		$req = "SELECT DISTINCT gympokemon.pokemon_uid, "
500 500
 				. "pokemon_id, iv_attack, iv_defense, iv_stamina, MAX(cp) as cp, gymmember.gym_id "
501 501
 				. "FROM gympokemon inner join gymmember on gympokemon.pokemon_uid=gymmember.pokemon_uid "
502 502
 				. "GROUP BY gympokemon.pokemon_uid, pokemon_id, iv_attack, iv_defense, iv_stamina, gym_id"
503 503
 				. " HAVING gymmember.gym_id='".$gym_id."' ORDER BY cp DESC";
504
-		$result 	= $mysqli->query($req);
505
-		$i=0;
504
+		$result = $mysqli->query($req);
505
+		$i = 0;
506 506
 
507 507
 
508 508
 
@@ -520,14 +520,14 @@  discard block
 block discarded – undo
520 520
 						</a>
521 521
 						<p class="pkmn-name">'.$data->cp.'</p>
522 522
 						<div class="progress" style="height: 12px; margin-bottom: 0">
523
-							<div title="Attack IV: '. $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">
524
-								<span class="sr-only">Angriff IV : '. $data->iv_attack .'</span>'.$data->iv_attack.'
523
+							<div title="Attack IV: '. $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">
524
+								<span class="sr-only">Angriff IV : '. $data->iv_attack.'</span>'.$data->iv_attack.'
525 525
 								</div>
526
-								<div title="Defense IV: '. $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">
527
-									<span class="sr-only">Verteidigung IV : '. $data->iv_defense .'</span>'. $data->iv_defense .'
526
+								<div title="Defense IV: '. $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">
527
+									<span class="sr-only">Verteidigung IV : '. $data->iv_defense.'</span>'.$data->iv_defense.'
528 528
 								</div>
529
-								<div title="Stamina IV: '. $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">
530
-									<span class="sr-only">KP IV : '. $data->iv_stamina .'</span>'. $data->iv_stamina .'
529
+								<div title="Stamina IV: '. $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">
530
+									<span class="sr-only">KP IV : '. $data->iv_stamina.'</span>'.$data->iv_stamina.'
531 531
 								</div>
532 532
 							</div>
533 533
 						</div>';
@@ -540,13 +540,13 @@  discard block
 block discarded – undo
540 540
 						</a>
541 541
 						<p class="pkmn-name">'.$data->cp.'</p>
542 542
 						<div class="progress" style="height: 4px; width: 40px; margin-bottom: 10px; margin-top: 2px; margin-left: auto; margin-right: auto">
543
-							<div title="Attack IV: '.$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).'%">
543
+							<div title="Attack IV: '.$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).'%">
544 544
 								<span class="sr-only">Attack IV: '.$data->iv_attack.'</span>
545 545
 							</div>
546
-							<div title="Defense IV: '.$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).'%">
546
+							<div title="Defense IV: '.$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).'%">
547 547
 								<span class="sr-only">Defense IV: '.$data->iv_defense.'</span>
548 548
 							</div>
549
-							<div title="Stamina IV: '.$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).'%">
549
+							<div title="Stamina IV: '.$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).'%">
550 550
 								<span class="sr-only">Stamina IV: '.$data->iv_stamina.'</span>
551 551
 							</div>
552 552
 						</div>
@@ -576,16 +576,16 @@  discard block
 block discarded – undo
576 576
 		$name = "";
577 577
 		$page = "0";
578 578
 		$where = "";
579
-		$order="";
580
-		$team=0;
581
-		$ranking=0;
579
+		$order = "";
580
+		$team = 0;
581
+		$ranking = 0;
582 582
 		if (isset($_GET['name'])) {
583 583
 			$trainer_name = mysqli_real_escape_string($mysqli, $_GET['name']);
584 584
 			$where = " HAVING name LIKE '%".$trainer_name."%'";
585 585
 		}
586
-		if (isset($_GET['team']) && $_GET['team']!=0) {
586
+		if (isset($_GET['team']) && $_GET['team'] != 0) {
587 587
 			$team = mysqli_real_escape_string($mysqli, $_GET['team']);
588
-			$where .= ($where==""?" HAVING":"AND ")." team = ".$team;
588
+			$where .= ($where == "" ? " HAVING" : "AND ")." team = ".$team;
589 589
 		}
590 590
 		if (isset($_GET['page'])) {
591 591
 			$page = mysqli_real_escape_string($mysqli, $_GET['page']);
@@ -596,16 +596,16 @@  discard block
 block discarded – undo
596 596
 
597 597
 		switch ($ranking) {
598 598
 			case 1:
599
-				$order=" ORDER BY active DESC ";
599
+				$order = " ORDER BY active DESC ";
600 600
 				break;
601 601
 			case 2:
602
-				$order=" ORDER BY maxCp DESC ";
602
+				$order = " ORDER BY maxCp DESC ";
603 603
 				break;
604 604
 			default:
605
-				$order=" ORDER BY level DESC, active DESC ";
605
+				$order = " ORDER BY level DESC, active DESC ";
606 606
 		}
607 607
 
608
-		$limit = " LIMIT ".($page*10).",10 ";
608
+		$limit = " LIMIT ".($page * 10).",10 ";
609 609
 
610 610
 
611 611
 		$req = "SELECT trainer.*, count(actives_pokemons.trainer_name) as active, max(actives_pokemons.cp) as maxCp ".
@@ -624,7 +624,7 @@  discard block
 block discarded – undo
624 624
 			$reqRanking = "SELECT count(1) as rank FROM trainer where trainer.level >= ".$trainer->level;
625 625
 			$resultRanking = $mysqli->query($reqRanking);
626 626
 			while ($data = $resultRanking->fetch_object()) {
627
-				$trainer->rank = $data->rank ;
627
+				$trainer->rank = $data->rank;
628 628
 			}
629 629
 			$req = "(SELECT DISTINCT gympokemon.pokemon_id, gympokemon.pokemon_uid, gympokemon.cp, DATEDIFF(UTC_TIMESTAMP(), gympokemon.last_seen) AS last_scanned, gympokemon.trainer_name, gympokemon.iv_defense, gympokemon.iv_stamina, gympokemon.iv_attack, filtered_gymmember.gym_id, '1' as active ".
630 630
 				"FROM gympokemon INNER JOIN ".
@@ -634,7 +634,7 @@  discard block
 block discarded – undo
634 634
 
635 635
 			$resultPkms = $mysqli->query($req);
636 636
 			$trainer->pokemons = array();
637
-			$active_gyms=0;
637
+			$active_gyms = 0;
638 638
 			$pkmCount = 0;
639 639
 			while ($resultPkms && $dataPkm = $resultPkms->fetch_object()) {
640 640
 				$active_gyms++;
@@ -661,9 +661,9 @@  discard block
 block discarded – undo
661 661
 		break;
662 662
 
663 663
 	case 'pokemon_slider_init':
664
-		$req 		= "SELECT MIN(pokemon.disappear_time) as min, MAX(pokemon.disappear_time) as max from pokemon";
664
+		$req = "SELECT MIN(pokemon.disappear_time) as min, MAX(pokemon.disappear_time) as max from pokemon";
665 665
 		$result 	= $mysqli->query($req);
666
-		$data 		= $result->fetch_object();
666
+		$data = $result->fetch_object();
667 667
 		$bounds 	= $data;
668 668
 
669 669
 		header('Content-Type: application/json');
@@ -673,18 +673,18 @@  discard block
 block discarded – undo
673 673
 		break;
674 674
 
675 675
 	case 'pokemon_heatmap_points':
676
-		$json="";
677
-		if (isset($_GET['start'])&&isset($_GET['end']) && isset($_GET['pokemon_id'])) {
678
-			$start = Date("Y-m-d H:i",(int)$_GET['start']);
679
-			$end = Date("Y-m-d H:i",(int)$_GET['end']);
676
+		$json = "";
677
+		if (isset($_GET['start']) && isset($_GET['end']) && isset($_GET['pokemon_id'])) {
678
+			$start = Date("Y-m-d H:i", (int) $_GET['start']);
679
+			$end = Date("Y-m-d H:i", (int) $_GET['end']);
680 680
 			$pokemon_id = mysqli_real_escape_string($mysqli, $_GET['pokemon_id']);
681 681
 			$where = " WHERE pokemon.pokemon_id = ".$pokemon_id." "
682 682
 					. "AND pokemon.disappear_time BETWEEN '".$start."' AND '".$end."'";
683 683
 			$req 		= "SELECT latitude, longitude FROM pokemon".$where." ORDER BY disappear_time DESC LIMIT 10000";
684
-			$result 	= $mysqli->query($req);
684
+			$result = $mysqli->query($req);
685 685
 			$points = array();
686 686
 			while ($result && $data = $result->fetch_object()) {
687
-				$points[] 	= $data;
687
+				$points[] = $data;
688 688
 			}
689 689
 
690 690
 			$json = json_encode($points);
@@ -697,7 +697,7 @@  discard block
 block discarded – undo
697 697
 		break;
698 698
 
699 699
 	case 'pokedex':
700
-		$json="";
700
+		$json = "";
701 701
 		if (isset($_GET['pokemon_id'])) {
702 702
 			$pokemon_id = mysqli_real_escape_string($mysqli, $_GET['pokemon_id']);
703 703
 			$where = " WHERE pokemon.pokemon_id = ".$pokemon_id;
@@ -721,7 +721,7 @@  discard block
 block discarded – undo
721 721
 		break;
722 722
 
723 723
 	case 'pokemon_graph_data':
724
-		$json="";
724
+		$json = "";
725 725
 		if (isset($_GET['pokemon_id'])) {
726 726
 			$pokemon_id = mysqli_real_escape_string($mysqli, $_GET['pokemon_id']);
727 727
 			$where = " WHERE pokemonFiltered.pokemon_id = ".$pokemon_id;
@@ -730,7 +730,7 @@  discard block
 block discarded – undo
730 730
 			FROM (SELECT * FROM pokemon WHERE pokemon_id = '".$pokemon_id."' LIMIT 10000) as pokemonFiltered
731 731
 			GROUP BY disappear_hour
732 732
 			ORDER BY disappear_hour";
733
-			$result 	= $mysqli->query($req);
733
+			$result = $mysqli->query($req);
734 734
 			$array = array();
735 735
 			while ($result && $data = $result->fetch_object()) {
736 736
 				$array[] = $data->total;
@@ -755,30 +755,30 @@  discard block
 block discarded – undo
755 755
 
756 756
 	break;
757 757
 }
758
-if ($postRequest!=""){
758
+if ($postRequest != "") {
759 759
 	switch ($postRequest) {
760 760
 		case 'pokemon_live':
761
-			$json="";
762
-			if (isset( $_POST['pokemon_id'])) {
761
+			$json = "";
762
+			if (isset($_POST['pokemon_id'])) {
763 763
 				$pokemon_id = mysqli_real_escape_string($mysqli, $_POST['pokemon_id']);
764
-				$inmap_pkms_filter="";
764
+				$inmap_pkms_filter = "";
765 765
 				$where = " WHERE disappear_time >= UTC_TIMESTAMP() AND pokemon.pokemon_id = ".$pokemon_id;
766 766
 
767 767
 				$reqTestIv = "SELECT MAX(individual_attack) as iv FROM pokemon ".$where;
768
-				$resultTestIv 	= $mysqli->query($reqTestIv);
768
+				$resultTestIv = $mysqli->query($reqTestIv);
769 769
 				$testIv = $resultTestIv->fetch_object();
770
-				if (isset( $_POST['inmap_pokemons'])&&( $_POST['inmap_pokemons']!="")) {
770
+				if (isset($_POST['inmap_pokemons']) && ($_POST['inmap_pokemons'] != "")) {
771 771
 					foreach ($_POST['inmap_pokemons'] as $inmap) {
772 772
 						$inmap_pkms_filter .= "'".$inmap."',";
773 773
 					}
774 774
 					$inmap_pkms_filter = rtrim($inmap_pkms_filter, ",");
775 775
 					$where .= " AND pokemon.encounter_id NOT IN (".$inmap_pkms_filter.") ";
776 776
 				}
777
-				if ($testIv->iv!=null && isset( $_POST['ivMin'])&&( $_POST['ivMin']!="")) {
777
+				if ($testIv->iv != null && isset($_POST['ivMin']) && ($_POST['ivMin'] != "")) {
778 778
 					$ivMin = mysqli_real_escape_string($mysqli, $_POST['ivMin']);
779 779
 					$where .= " AND ((100/45)*(individual_attack+individual_defense+individual_stamina)) >= (".$ivMin.") ";
780 780
 				}
781
-				if ($testIv->iv!=null && isset( $_POST['ivMax'])&&( $_POST['ivMax']!="")) {
781
+				if ($testIv->iv != null && isset($_POST['ivMax']) && ($_POST['ivMax'] != "")) {
782 782
 					$ivMax = mysqli_real_escape_string($mysqli, $_POST['ivMax']);
783 783
 					$where .= " AND ((100/45)*(individual_attack+individual_defense+individual_stamina)) <=(".$ivMax.") ";
784 784
 				}
@@ -786,12 +786,12 @@  discard block
 block discarded – undo
786 786
 						. " (CONVERT_TZ(disappear_time, '+00:00', '".$time_offset."')) as disappear_time_real, "
787 787
 						. " individual_attack, individual_defense, individual_stamina "
788 788
 						. "FROM pokemon".$where." ORDER BY disappear_time DESC LIMIT 5000";
789
-				$result 	= $mysqli->query($req);
789
+				$result = $mysqli->query($req);
790 790
 				$points = array();
791 791
 				while ($result && $data = $result->fetch_object()) {
792
-					$pokeid=$data->pokemon_id;
792
+					$pokeid = $data->pokemon_id;
793 793
 					$data->name = $pokemons->pokemon->$pokeid->name;
794
-					$points[] 	= $data;
794
+					$points[] = $data;
795 795
 				}
796 796
 
797 797
 				$json = json_encode($points);
Please login to merge, or discard this patch.
Braces   +4 added lines, -5 removed lines patch added patch discarded remove patch
@@ -43,11 +43,11 @@  discard block
 block discarded – undo
43 43
 }
44 44
 $mysqli->set_charset('utf8');
45 45
 $request = "";
46
-if (isset($_GET['type'])){
46
+if (isset($_GET['type'])) {
47 47
 $request 	= $_GET['type'];
48 48
 }
49 49
 $postRequest = "";
50
-if (isset($_POST['type'])){
50
+if (isset($_POST['type'])) {
51 51
 	$postRequest = $_POST['type'];
52 52
 	$request= "postRequest";
53 53
 }
@@ -531,8 +531,7 @@  discard block
 block discarded – undo
531 531
 								</div>
532 532
 							</div>
533 533
 						</div>';
534
-				}
535
-				else {
534
+				} else {
536 535
 					$gymData['infoWindow'] .= '
537 536
 					<div style="text-align: center; width: 50px; display: inline-block; margin-right: 3px">
538 537
 						<a href="pokemon/'.$data->pokemon_id.'">
@@ -755,7 +754,7 @@  discard block
 block discarded – undo
755 754
 
756 755
 	break;
757 756
 }
758
-if ($postRequest!=""){
757
+if ($postRequest!="") {
759 758
 	switch ($postRequest) {
760 759
 		case 'pokemon_live':
761 760
 			$json="";
Please login to merge, or discard this patch.