Failed Conditions
Pull Request — master (#233)
by Ramiro
02:39
created
pages/home.page.php 1 patch
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.
pages/pokedex.page.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -32,10 +32,10 @@
 block discarded – undo
32 32
 					echo 'unseen';
33 33
 } ?> "></a>
34 34
 				<p class="pkmn-name"><a href="<?= $pokemon->permalink ?>"><?= $pokemon->name ?></a></p>
35
-				<p><?php if ($pokemon->spawn ==0) {
35
+				<p><?php if ($pokemon->spawn == 0) {
36 36
 					echo $locales->UNSEEN;
37 37
 } else {
38
-	echo '<span class="spawn-counter" id="spawn_pokemon_'.$pokemon->id.'">?</span>'. $locales->SEEN;
38
+	echo '<span class="spawn-counter" id="spawn_pokemon_'.$pokemon->id.'">?</span>'.$locales->SEEN;
39 39
 } ?> </p>
40 40
 
41 41
 			</div>
Please login to merge, or discard this patch.
core/js/dashboard.graph.js.php 1 patch
Spacing   +26 added lines, -26 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,12 +59,12 @@  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 66
 	if ($data->timestamp > $yesterday) {
67
-		$labels[] = '"'.date('H:i', $data->timestamp ).'"';
67
+		$labels[] = '"'.date('H:i', $data->timestamp).'"';
68 68
 
69 69
 		if (isset($data->rarity_spawn->{'Very common'})) {
70 70
 			$veco[]		= $data->rarity_spawn->{'Very common'};
@@ -93,47 +93,47 @@  discard block
 block discarded – undo
93 93
 }
94 94
 
95 95
 
96
-$stats_file	= SYS_PATH.'/core/json/gym.stats.json';
97
-$stats		= json_decode(file_get_contents($stats_file));
96
+$stats_file = SYS_PATH.'/core/json/gym.stats.json';
97
+$stats = json_decode(file_get_contents($stats_file));
98 98
 
99 99
 
100 100
 foreach ($stats as $data) {
101 101
 	if ($data->timestamp > $lastweek) {
102
-		$labels_gym[]			= '"'.date('D H:i', $data->timestamp).'"';
102
+		$labels_gym[] = '"'.date('D H:i', $data->timestamp).'"';
103 103
 
104
-		$mystic_average[]		= $data->team->mystic->average;
104
+		$mystic_average[] = $data->team->mystic->average;
105 105
 		$mystic_owned[]			= $data->team->mystic->gym_owned;
106 106
 
107 107
 		$valor_average[]		= $data->team->valor->average;
108
-		$valor_owned[]			= $data->team->valor->gym_owned;
108
+		$valor_owned[] = $data->team->valor->gym_owned;
109 109
 
110
-		$instinct_average[]		= $data->team->instinct->average;
111
-		$instinct_owned[]		= $data->team->instinct->gym_owned;
110
+		$instinct_average[] = $data->team->instinct->average;
111
+		$instinct_owned[] = $data->team->instinct->gym_owned;
112 112
 	}
113 113
 }
114 114
 
115 115
 
116
-$stats_file	= SYS_PATH.'/core/json/pokestop.stats.json';
117
-$stats		= json_decode(file_get_contents($stats_file));
116
+$stats_file = SYS_PATH.'/core/json/pokestop.stats.json';
117
+$stats = json_decode(file_get_contents($stats_file));
118 118
 
119 119
 
120 120
 foreach ($stats as $data) {
121 121
 	if ($data->timestamp > $lastweek) {
122
-		$labels_stops[]			= '"'.date('D H:i', $data->timestamp).'"';
123
-		$lure[]				= $data->lured;
122
+		$labels_stops[] = '"'.date('D H:i', $data->timestamp).'"';
123
+		$lure[] = $data->lured;
124 124
 	}
125 125
 }
126 126
 
127 127
 
128 128
 if ($config->system->captcha_support) {
129
-	$stats_file	= SYS_PATH.'/core/json/captcha.stats.json';
130
-	$stats		= json_decode(file_get_contents($stats_file));
129
+	$stats_file = SYS_PATH.'/core/json/captcha.stats.json';
130
+	$stats = json_decode(file_get_contents($stats_file));
131 131
 
132 132
 
133 133
 	foreach ($stats as $data) {
134 134
 		if ($data->timestamp > $lastweek) {
135
-			$labels_captcha[]		= '"'.date('D H:i', $data->timestamp).'"';
136
-			$captcha_accs[]			= $data->captcha_accs;
135
+			$labels_captcha[] = '"'.date('D H:i', $data->timestamp).'"';
136
+			$captcha_accs[] = $data->captcha_accs;
137 137
 		}
138 138
 	}
139 139
 }
Please login to merge, or discard this patch.
core/process/data.loader.php 1 patch
Spacing   +81 added lines, -81 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.<br>';
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
 #################
34 34
 
35 35
 
36
-$mysqli 	= new mysqli(SYS_DB_HOST, SYS_DB_USER, SYS_DB_PSWD, SYS_DB_NAME, SYS_DB_PORT);
36
+$mysqli = new mysqli(SYS_DB_HOST, SYS_DB_USER, SYS_DB_PSWD, SYS_DB_NAME, SYS_DB_PORT);
37 37
 
38 38
 
39 39
 if ($mysqli->connect_error != '') {
@@ -76,12 +76,12 @@  discard block
 block discarded – undo
76 76
 // ( 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
77 77
 // => check filemtime, if > 24h launch an update. )
78 78
 
79
-$pokedex_rarity_filetime	= filemtime($pokedex_rarity_file);
80
-$now				= time();
81
-$diff				= $now - $pokedex_rarity_filetime;
79
+$pokedex_rarity_filetime = filemtime($pokedex_rarity_file);
80
+$now = time();
81
+$diff = $now - $pokedex_rarity_filetime;
82 82
 
83 83
 // Update each 24h
84
-$update_delay		= 86400;
84
+$update_delay = 86400;
85 85
 
86 86
 if ($diff > $update_delay) {
87 87
 	include_once(SYS_PATH.'/core/cron/pokedex.rarity.php');
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
 			// Current Pokemon datas
112 112
 			// ---------------------
113 113
 
114
-			$pokemon_id 			= mysqli_real_escape_string($mysqli, $_GET['id']);
114
+			$pokemon_id = mysqli_real_escape_string($mysqli, $_GET['id']);
115 115
 
116 116
 			if (!is_object($pokemons->pokemon->$pokemon_id)) {
117 117
 				header('Location:/404');
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
 
122 122
 			$pokemon			= new stdClass();
123 123
 			$pokemon			= $pokemons->pokemon->$pokemon_id;
124
-			$pokemon->id			= $pokemon_id;
124
+			$pokemon->id = $pokemon_id;
125 125
 
126 126
 
127 127
 			// Some math
@@ -137,19 +137,19 @@  discard block
 block discarded – undo
137 137
 
138 138
 			// Total gym protected
139 139
 
140
-			$req 		= "SELECT count( DISTINCT(gym_id) ) as total FROM gym WHERE guard_pokemon_id = '".$pokemon_id."'  ";
141
-			$result 	= $mysqli->query($req);
142
-			$data 		= $result->fetch_object();
140
+			$req = "SELECT count( DISTINCT(gym_id) ) as total FROM gym WHERE guard_pokemon_id = '".$pokemon_id."'  ";
141
+			$result = $mysqli->query($req);
142
+			$data = $result->fetch_object();
143 143
 
144 144
 			$pokemon->protected_gyms = $data->total;
145 145
 
146 146
 			// Total spawn
147 147
 
148
-			$req 		= "SELECT COUNT(*) as total FROM pokemon WHERE pokemon_id = '".$pokemon_id."'";
149
-			$result 	= $mysqli->query($req);
150
-			$data 		= $result->fetch_object();
148
+			$req = "SELECT COUNT(*) as total FROM pokemon WHERE pokemon_id = '".$pokemon_id."'";
149
+			$result = $mysqli->query($req);
150
+			$data = $result->fetch_object();
151 151
 
152
-			$pokemon->total_spawn 	= $data->total;
152
+			$pokemon->total_spawn = $data->total;
153 153
 			// Spawn rate
154 154
 
155 155
 			if ($pokemon->total_spawn > 0) {
@@ -157,28 +157,28 @@  discard block
 block discarded – undo
157 157
 				$result = $mysqli->query($req);
158 158
 				$data = $result->fetch_object();
159 159
 				// Calc spawns_per_day for last week
160
-				$pokemon->spawns_per_day = round(($data->spawns_last_week/7), 2);
160
+				$pokemon->spawns_per_day = round(($data->spawns_last_week / 7), 2);
161 161
 			} else {
162 162
 				$pokemon->spawns_per_day = 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
@@ -220,23 +220,23 @@  discard block
 block discarded – undo
220 220
 			$total = $data->total;
221 221
 
222 222
 			$max 		= $config->system->max_pokemon;
223
-			$pokedex 	= new stdClass();
223
+			$pokedex = new stdClass();
224 224
 
225 225
 			$req 		= "SELECT DISTINCT pokemon_id FROM pokemon";
226
-			$result 	= $mysqli->query($req);
226
+			$result = $mysqli->query($req);
227 227
 			$data_array = array();
228 228
 
229 229
 			while ($data = $result->fetch_object()) {
230 230
 				$data_array[$data->pokemon_id] = 1;
231 231
 			};
232 232
 
233
-			for ($i= 1; $i <= $max; $i++) {
234
-				$pokedex->$i			= new stdClass();
233
+			for ($i = 1; $i <= $max; $i++) {
234
+				$pokedex->$i = new stdClass();
235 235
 				$pokedex->$i->id 		= $i;
236
-				$pokedex->$i->permalink 	= 'pokemon/'.$i;
236
+				$pokedex->$i->permalink = 'pokemon/'.$i;
237 237
 				$pokedex->$i->img		= 'core/pokemons/'.$i.$config->system->pokeimg_suffix;
238
-				$pokedex->$i->name		= $pokemons->pokemon->$i->name;
239
-				$pokedex->$i->spawn 		= isset($data_array[$i])? $data_array[$i] : 0;
238
+				$pokedex->$i->name = $pokemons->pokemon->$i->name;
239
+				$pokedex->$i->spawn = isset($data_array[$i]) ? $data_array[$i] : 0;
240 240
 			}
241 241
 
242 242
 
@@ -247,17 +247,17 @@  discard block
 block discarded – undo
247 247
 		############
248 248
 
249 249
 		case 'pokestops':
250
-			$pokestop 	= new stdClass();
250
+			$pokestop = new stdClass();
251 251
 
252
-			$req 		= "SELECT COUNT(*) as total FROM pokestop";
253
-			$result 	= $mysqli->query($req);
254
-			$data 		= $result->fetch_object();
252
+			$req = "SELECT COUNT(*) as total FROM pokestop";
253
+			$result = $mysqli->query($req);
254
+			$data = $result->fetch_object();
255 255
 
256 256
 			$pokestop->total = $data->total;
257 257
 
258
-			$req 		= "SELECT COUNT(*) as total FROM pokestop WHERE lure_expiration >= UTC_TIMESTAMP()";
259
-			$result 	= $mysqli->query($req);
260
-			$data 		= $result->fetch_object();
258
+			$req = "SELECT COUNT(*) as total FROM pokestop WHERE lure_expiration >= UTC_TIMESTAMP()";
259
+			$result = $mysqli->query($req);
260
+			$data = $result->fetch_object();
261 261
 
262 262
 			$pokestop->lured = $data->total;
263 263
 
@@ -274,36 +274,36 @@  discard block
 block discarded – undo
274 274
 			// 3 Teams (teamm rocket is neutral)
275 275
 			// 1 Fight
276 276
 
277
-			$teams 				= new stdClass();
277
+			$teams = new stdClass();
278 278
 
279
-			$teams->mystic 			= new stdClass();
280
-			$teams->mystic->guardians 	= new stdClass();
281
-			$teams->mystic->id 		= 1;
279
+			$teams->mystic = new stdClass();
280
+			$teams->mystic->guardians = new stdClass();
281
+			$teams->mystic->id = 1;
282 282
 
283
-			$teams->valor 			= new stdClass();
284
-			$teams->valor->guardians 	= new stdClass();
285
-			$teams->valor->id 		= 2;
283
+			$teams->valor = new stdClass();
284
+			$teams->valor->guardians = new stdClass();
285
+			$teams->valor->id = 2;
286 286
 
287
-			$teams->instinct 		= new stdClass();
288
-			$teams->instinct->guardians 	= new stdClass();
289
-			$teams->instinct->id 		= 3;
287
+			$teams->instinct = new stdClass();
288
+			$teams->instinct->guardians = new stdClass();
289
+			$teams->instinct->id = 3;
290 290
 
291
-			$teams->rocket 			= new stdClass();
292
-			$teams->rocket->guardians 	= new stdClass();
293
-			$teams->rocket->id 		= 0;
291
+			$teams->rocket = new stdClass();
292
+			$teams->rocket->guardians = new stdClass();
293
+			$teams->rocket->id = 0;
294 294
 
295 295
 
296 296
 
297 297
 			foreach ($teams as $team_key => $team_values) {
298 298
 				// Team Guardians
299 299
 
300
-				$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 ";
300
+				$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 ";
301 301
 				$result = $mysqli->query($req);
302 302
 
303
-				$i=0;
303
+				$i = 0;
304 304
 
305 305
 				while ($data = $result->fetch_object()) {
306
-					$teams->$team_key->guardians->$i	= $data->guard_pokemon_id;
306
+					$teams->$team_key->guardians->$i = $data->guard_pokemon_id;
307 307
 
308 308
 					$i++;
309 309
 				}
@@ -315,8 +315,8 @@  discard block
 block discarded – undo
315 315
 				$result = $mysqli->query($req);
316 316
 				$data	= $result->fetch_object();
317 317
 
318
-				$teams->$team_key->gym_owned	= $data->total;
319
-				$teams->$team_key->average	= $data->average_points;
318
+				$teams->$team_key->gym_owned = $data->total;
319
+				$teams->$team_key->average = $data->average_points;
320 320
 			}
321 321
 
322 322
 
@@ -329,7 +329,7 @@  discard block
 block discarded – undo
329 329
 		case 'dashboard':
330 330
 			// This case is only used for test purpose.
331 331
 
332
-			$stats_file	= SYS_PATH.'/core/json/gym.stats.json';
332
+			$stats_file = SYS_PATH.'/core/json/gym.stats.json';
333 333
 
334 334
 			if (!is_file($stats_file)) {
335 335
 				echo "Sorry, no Gym stats file was found. <br> Did you enable cron? ";
@@ -337,7 +337,7 @@  discard block
 block discarded – undo
337 337
 			}
338 338
 
339 339
 
340
-			$stats_file	= SYS_PATH.'/core/json/pokemon.stats.json';
340
+			$stats_file = SYS_PATH.'/core/json/pokemon.stats.json';
341 341
 
342 342
 			if (!is_file($stats_file)) {
343 343
 				echo "Sorry, no Pokémon stats file was found. <br> Did you enabled cron?";
@@ -345,7 +345,7 @@  discard block
 block discarded – undo
345 345
 			}
346 346
 
347 347
 
348
-			$stats_file	= SYS_PATH.'/core/json/pokestop.stats.json';
348
+			$stats_file = SYS_PATH.'/core/json/pokestop.stats.json';
349 349
 
350 350
 			if (!is_file($stats_file)) {
351 351
 				echo "Sorry, no Pokéstop stats file was found. <br> Did you enabled cron?";
@@ -353,7 +353,7 @@  discard block
 block discarded – undo
353 353
 			}
354 354
 
355 355
 			if ($config->system->captcha_support) {
356
-				$stats_file	= SYS_PATH.'/core/json/captcha.stats.json';
356
+				$stats_file = SYS_PATH.'/core/json/captcha.stats.json';
357 357
 
358 358
 				if (!is_file($stats_file)) {
359 359
 					echo "Sorry, no Captcha stats file were found  <br> Have you enable cron?";
@@ -373,9 +373,9 @@  discard block
 block discarded – undo
373 373
 	// Right now
374 374
 	// ---------
375 375
 
376
-	$req 		= "SELECT COUNT(*) as total FROM pokemon WHERE disappear_time >= UTC_TIMESTAMP()";
377
-	$result 	= $mysqli->query($req);
378
-	$data 		= $result->fetch_object();
376
+	$req = "SELECT COUNT(*) as total FROM pokemon WHERE disappear_time >= UTC_TIMESTAMP()";
377
+	$result = $mysqli->query($req);
378
+	$data = $result->fetch_object();
379 379
 
380 380
 
381 381
 	$home->pokemon_now = $data->total;
@@ -384,9 +384,9 @@  discard block
 block discarded – undo
384 384
 	// Lured stops
385 385
 	// -----------
386 386
 
387
-	$req 		= "SELECT COUNT(*) as total FROM pokestop WHERE lure_expiration >= UTC_TIMESTAMP()";
388
-	$result 	= $mysqli->query($req);
389
-	$data 		= $result->fetch_object();
387
+	$req = "SELECT COUNT(*) as total FROM pokestop WHERE lure_expiration >= UTC_TIMESTAMP()";
388
+	$result = $mysqli->query($req);
389
+	$data = $result->fetch_object();
390 390
 
391 391
 	$home->pokestop_lured = $data->total;
392 392
 
@@ -394,9 +394,9 @@  discard block
 block discarded – undo
394 394
 	// Gyms
395 395
 	// ----
396 396
 
397
-	$req 		= "SELECT COUNT(DISTINCT(gym_id)) as total FROM gym";
398
-	$result 	= $mysqli->query($req);
399
-	$data 		= $result->fetch_object();
397
+	$req = "SELECT COUNT(DISTINCT(gym_id)) as total FROM gym";
398
+	$result = $mysqli->query($req);
399
+	$data = $result->fetch_object();
400 400
 
401 401
 	$home->gyms = $data->total;
402 402
 
@@ -406,19 +406,19 @@  discard block
 block discarded – undo
406 406
 
407 407
 	if ($config->system->recents_filter) {
408 408
 		// get all mythic pokemon ids
409
-		$mythic_pokemons  = array();
409
+		$mythic_pokemons = array();
410 410
 		foreach ($pokemons->pokemon as $id => $pokemon) {
411 411
 			if ($pokemon->spawn_rate < $config->system->recents_filter_rarity && $pokemon->rating >= $config->system->recents_filter_rating) {
412 412
 				$mythic_pokemons[] = $id;
413 413
 			}
414 414
 		}
415 415
 		// get all mythic 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
 				   WHERE pokemon_id IN (".implode(",", $mythic_pokemons).")
418 418
 				   ORDER BY last_modified DESC LIMIT 0,12";
419 419
 	} else {
420 420
 		// get all pokemon
421
-		$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
421
+		$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
422 422
 				   ORDER BY last_modified DESC LIMIT 0,12";
423 423
 	}
424 424
 	$result 	= $mysqli->query($req);
@@ -464,28 +464,28 @@  discard block
 block discarded – undo
464 464
 
465 465
 	$req = "SELECT count( DISTINCT(gym_id) ) as total FROM gym WHERE team_id = '1'  ";
466 466
 	$result = $mysqli->query($req);
467
-	$data 	= $result->fetch_object();
467
+	$data = $result->fetch_object();
468 468
 
469
-	$home->teams->mystic 	= $data->total;
469
+	$home->teams->mystic = $data->total;
470 470
 
471 471
 
472 472
 	$req = "SELECT count( DISTINCT(gym_id) ) as total FROM gym WHERE team_id = '2'  ";
473 473
 	$result = $mysqli->query($req);
474
-	$data 	= $result->fetch_object();
474
+	$data = $result->fetch_object();
475 475
 
476
-	$home->teams->valor 	= $data->total;
476
+	$home->teams->valor = $data->total;
477 477
 
478 478
 
479 479
 	$req = "SELECT count( DISTINCT(gym_id) ) as total FROM gym WHERE team_id = '3'  ";
480 480
 	$result = $mysqli->query($req);
481
-	$data 	= $result->fetch_object();
481
+	$data = $result->fetch_object();
482 482
 
483
-	$home->teams->instinct 	= $data->total;
483
+	$home->teams->instinct = $data->total;
484 484
 
485 485
 
486 486
 	$req = "SELECT count( DISTINCT(gym_id) ) as total FROM gym WHERE team_id = '0'  ";
487 487
 	$result = $mysqli->query($req);
488
-	$data 	= $result->fetch_object();
488
+	$data = $result->fetch_object();
489 489
 
490
-	$home->teams->rocket 	= $data->total;
490
+	$home->teams->rocket = $data->total;
491 491
 }
Please login to merge, or discard this patch.
core/js/pokemon.graph.js.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -26,8 +26,8 @@  discard block
 block discarded – undo
26 26
 
27 27
 # Polar Graph datas
28 28
 
29
-$pokemon_file	= file_get_contents(SYS_PATH.'/core/json/pokedex.json');
30
-$pokemons	= json_decode($pokemon_file);
29
+$pokemon_file = file_get_contents(SYS_PATH.'/core/json/pokedex.json');
30
+$pokemons = json_decode($pokemon_file);
31 31
 
32 32
 $atk		= $pokemons->pokemon->$pokemon_id->atk;
33 33
 $def		= $pokemons->pokemon->$pokemon_id->def;
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
 
37 37
 ?>
38 38
 
39
-var pokemon_id = '<?= (int)$pokemon_id ?>';
39
+var pokemon_id = '<?= (int) $pokemon_id ?>';
40 40
 
41 41
 Chart.defaults.global.legend.display = false;
42 42
 
Please login to merge, or discard this patch.
core/process/aru.php 2 patches
Switch Indentation   +347 added lines, -347 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,129 +241,129 @@  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
-		if (!($config->system->only_lured_pokestops)) {
279
-			$req 		= "SELECT latitude, longitude, lure_expiration, UTC_TIMESTAMP() as now, (CONVERT_TZ(lure_expiration, '+00:00', '".$time_offset."')) as lure_expiration_real FROM pokestop";
280
-		} else {
281
-			$req 		= "SELECT latitude, longitude, lure_expiration, UTC_TIMESTAMP() as now, (CONVERT_TZ(lure_expiration, '+00:00', '".$time_offset."')) as lure_expiration_real FROM pokestop WHERE lure_expiration > UTC_TIMESTAMP()";
282
-		}
283
-		$result 	= $mysqli->query($req);
284
-
285
-		$i=0;
286
-
287
-		while ($data = $result->fetch_object()) {
288
-			if ($data->lure_expiration >= $data->now) {
289
-				$icon = 'pokestap_lured.png';
290
-				$text = 'Lured expire @ '.date('H:i:s', strtotime($data->lure_expiration_real)) ;
277
+		case 'pokestop':
278
+			if (!($config->system->only_lured_pokestops)) {
279
+				$req 		= "SELECT latitude, longitude, lure_expiration, UTC_TIMESTAMP() as now, (CONVERT_TZ(lure_expiration, '+00:00', '".$time_offset."')) as lure_expiration_real FROM pokestop";
291 280
 			} else {
292
-				$icon = 'pokestap.png';
293
-				$text = 'Normal stop';
281
+				$req 		= "SELECT latitude, longitude, lure_expiration, UTC_TIMESTAMP() as now, (CONVERT_TZ(lure_expiration, '+00:00', '".$time_offset."')) as lure_expiration_real FROM pokestop WHERE lure_expiration > UTC_TIMESTAMP()";
294 282
 			}
283
+			$result 	= $mysqli->query($req);
295 284
 
296
-			$temp[$i][] = $text;
297
-			$temp[$i][] = $icon;
298
-			$temp[$i][] = $data->latitude;
299
-			$temp[$i][] = $data->longitude;
300
-			$temp[$i][] = $i;
285
+			$i=0;
301 286
 
302
-			$temp_json[] = json_encode($temp[$i]);
287
+			while ($data = $result->fetch_object()) {
288
+				if ($data->lure_expiration >= $data->now) {
289
+					$icon = 'pokestap_lured.png';
290
+					$text = 'Lured expire @ '.date('H:i:s', strtotime($data->lure_expiration_real)) ;
291
+				} else {
292
+					$icon = 'pokestap.png';
293
+					$text = 'Normal stop';
294
+				}
303 295
 
296
+				$temp[$i][] = $text;
297
+				$temp[$i][] = $icon;
298
+				$temp[$i][] = $data->latitude;
299
+				$temp[$i][] = $data->longitude;
300
+				$temp[$i][] = $i;
304 301
 
305
-			$i++;
306
-		}
302
+				$temp_json[] = json_encode($temp[$i]);
307 303
 
308
-		$return = json_encode($temp_json);
309 304
 
310
-		echo $return;
305
+				$i++;
306
+			}
311 307
 
312
-		break;
308
+			$return = json_encode($temp_json);
313 309
 
310
+			echo $return;
314 311
 
312
+			break;
315 313
 
316
-	####################################
317
-	//
318
-	// Update data for the gym battle
319
-	//
320
-	####################################
321 314
 
322
-	case 'update_gym':
323
-		$teams			= new stdClass();
324
-		$teams->mystic 		= 1;
325
-		$teams->valor 		= 2;
326
-		$teams->instinct 	= 3;
327 315
 
316
+		####################################
317
+		//
318
+		// Update data for the gym battle
319
+		//
320
+		####################################
328 321
 
329
-		foreach ($teams as $team_name => $team_id) {
330
-			$req	= "SELECT COUNT(DISTINCT(gym_id)) as total, ROUND(AVG(gym_points),0) as average_points FROM gym WHERE team_id = '".$team_id."'  ";
331
-			$result	= $mysqli->query($req);
332
-			$data	= $result->fetch_object();
322
+		case 'update_gym':
323
+			$teams			= new stdClass();
324
+			$teams->mystic 		= 1;
325
+			$teams->valor 		= 2;
326
+			$teams->instinct 	= 3;
333 327
 
334
-			$return[] 	= $data->total;
335
-			$return[]	= $data->average_points;
336
-		}
337 328
 
338
-		$json = json_encode($return);
329
+			foreach ($teams as $team_name => $team_id) {
330
+				$req	= "SELECT COUNT(DISTINCT(gym_id)) as total, ROUND(AVG(gym_points),0) as average_points FROM gym WHERE team_id = '".$team_id."'  ";
331
+				$result	= $mysqli->query($req);
332
+				$data	= $result->fetch_object();
339 333
 
340
-		header('Content-Type: application/json');
341
-		echo $json;
334
+				$return[] 	= $data->total;
335
+				$return[]	= $data->average_points;
336
+			}
342 337
 
338
+			$json = json_encode($return);
343 339
 
344
-		break;
340
+			header('Content-Type: application/json');
341
+			echo $json;
345 342
 
346
-	####################################
347
-	//
348
-	// Get datas for the gym map
349
-	//
350
-	####################################
351 343
 
344
+			break;
352 345
 
353
-	case 'gym_map':
354
-		$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";
355
-		$result 	= $mysqli->query($req);
346
+		####################################
347
+		//
348
+		// Get datas for the gym map
349
+		//
350
+		####################################
356 351
 
357 352
 
358
-		$i=0;
353
+		case 'gym_map':
354
+			$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";
355
+			$result 	= $mysqli->query($req);
359 356
 
360
-		while ($data = $result->fetch_object()) {
361
-			// Team
362
-			// 1 = bleu
363
-			// 2 = rouge
364
-			// 3 = jaune
365 357
 
366
-			switch ($data->team_id) {
358
+			$i=0;
359
+
360
+			while ($data = $result->fetch_object()) {
361
+				// Team
362
+				// 1 = bleu
363
+				// 2 = rouge
364
+				// 3 = jaune
365
+
366
+				switch ($data->team_id) {
367 367
 				case 0:
368 368
 					$icon	= 'map_white.png';
369 369
 					$team	= 'No Team (yet)';
@@ -387,7 +387,7 @@  discard block
 block discarded – undo
387 387
 					$team	= 'Team Instinct';
388 388
 					$color	= 'rgba(254, 217, 40, .6)';
389 389
 					break;
390
-			}
390
+				}
391 391
 
392 392
 			// Set gym level
393 393
 			$data->gym_level=0;
@@ -459,65 +459,65 @@  discard block
 block discarded – undo
459 459
 	//
460 460
 	####################################
461 461
 
462
-	case 'gym_defenders':
463
-		$gym_id = $mysqli->real_escape_string($_GET['gym_id']);
464
-		$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."'";
465
-		$result 	= $mysqli->query($req);
466
-		$gymData['gymDetails']['gymInfos'] = false;
467
-		while ($data = $result->fetch_object()) {
468
-			$gymData['gymDetails']['gymInfos']['name'] = $data->name;
469
-			$gymData['gymDetails']['gymInfos']['description'] = $data->description;
470
-			if ($data->url == null) {
471
-				$gymData['gymDetails']['gymInfos']['url'] = '';
472
-			} else {
473
-				$gymData['gymDetails']['gymInfos']['url'] = $data->url;
474
-			}
475
-			$gymData['gymDetails']['gymInfos']['points'] = $data->points;
476
-			$gymData['gymDetails']['gymInfos']['level'] = 0;
477
-			$gymData['gymDetails']['gymInfos']['last_scanned'] = $data->last_scanned;
478
-			$gymData['gymDetails']['gymInfos']['team'] = $data->team;
479
-			$gymData['gymDetails']['gymInfos']['guardPokemonId'] = $data->guard_pokemon_id;
480
-			if ($data->points < 2000) {
481
-				$gymData['gymDetails']['gymInfos']['level']=1;
482
-			} elseif ($data->points < 4000) {
483
-				$gymData['gymDetails']['gymInfos']['level']=2;
484
-			} elseif ($data->points < 8000) {
485
-				$gymData['gymDetails']['gymInfos']['level']=3;
486
-			} elseif ($data->points < 12000) {
487
-				$gymData['gymDetails']['gymInfos']['level']=4;
488
-			} elseif ($data->points < 16000) {
489
-				$gymData['gymDetails']['gymInfos']['level']=5;
490
-			} elseif ($data->points < 20000) {
491
-				$gymData['gymDetails']['gymInfos']['level']=6;
492
-			} elseif ($data->points < 30000) {
493
-				$gymData['gymDetails']['gymInfos']['level']=7;
494
-			} elseif ($data->points < 40000) {
495
-				$gymData['gymDetails']['gymInfos']['level']=8;
496
-			} elseif ($data->points < 50000) {
497
-				$gymData['gymDetails']['gymInfos']['level']=9;
498
-			} else {
499
-				$gymData['gymDetails']['gymInfos']['level']=10;
462
+		case 'gym_defenders':
463
+			$gym_id = $mysqli->real_escape_string($_GET['gym_id']);
464
+			$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."'";
465
+			$result 	= $mysqli->query($req);
466
+			$gymData['gymDetails']['gymInfos'] = false;
467
+			while ($data = $result->fetch_object()) {
468
+				$gymData['gymDetails']['gymInfos']['name'] = $data->name;
469
+				$gymData['gymDetails']['gymInfos']['description'] = $data->description;
470
+				if ($data->url == null) {
471
+					$gymData['gymDetails']['gymInfos']['url'] = '';
472
+				} else {
473
+					$gymData['gymDetails']['gymInfos']['url'] = $data->url;
474
+				}
475
+				$gymData['gymDetails']['gymInfos']['points'] = $data->points;
476
+				$gymData['gymDetails']['gymInfos']['level'] = 0;
477
+				$gymData['gymDetails']['gymInfos']['last_scanned'] = $data->last_scanned;
478
+				$gymData['gymDetails']['gymInfos']['team'] = $data->team;
479
+				$gymData['gymDetails']['gymInfos']['guardPokemonId'] = $data->guard_pokemon_id;
480
+				if ($data->points < 2000) {
481
+					$gymData['gymDetails']['gymInfos']['level']=1;
482
+				} elseif ($data->points < 4000) {
483
+					$gymData['gymDetails']['gymInfos']['level']=2;
484
+				} elseif ($data->points < 8000) {
485
+					$gymData['gymDetails']['gymInfos']['level']=3;
486
+				} elseif ($data->points < 12000) {
487
+					$gymData['gymDetails']['gymInfos']['level']=4;
488
+				} elseif ($data->points < 16000) {
489
+					$gymData['gymDetails']['gymInfos']['level']=5;
490
+				} elseif ($data->points < 20000) {
491
+					$gymData['gymDetails']['gymInfos']['level']=6;
492
+				} elseif ($data->points < 30000) {
493
+					$gymData['gymDetails']['gymInfos']['level']=7;
494
+				} elseif ($data->points < 40000) {
495
+					$gymData['gymDetails']['gymInfos']['level']=8;
496
+				} elseif ($data->points < 50000) {
497
+					$gymData['gymDetails']['gymInfos']['level']=9;
498
+				} else {
499
+					$gymData['gymDetails']['gymInfos']['level']=10;
500
+				}
500 501
 			}
501
-		}
502
-		//print_r($gymData);
503
-		$req 		= "SELECT DISTINCT gympokemon.pokemon_uid, "
504
-				. "pokemon_id, iv_attack, iv_defense, iv_stamina, MAX(cp) as cp, gymmember.gym_id "
505
-				. "FROM gympokemon inner join gymmember on gympokemon.pokemon_uid=gymmember.pokemon_uid "
506
-				. "GROUP BY gympokemon.pokemon_uid, pokemon_id, iv_attack, iv_defense, iv_stamina, gym_id"
507
-				. " HAVING gymmember.gym_id='".$gym_id."' ORDER BY cp DESC";
508
-		$result 	= $mysqli->query($req);
509
-		$i=0;
502
+			//print_r($gymData);
503
+			$req 		= "SELECT DISTINCT gympokemon.pokemon_uid, "
504
+					. "pokemon_id, iv_attack, iv_defense, iv_stamina, MAX(cp) as cp, gymmember.gym_id "
505
+					. "FROM gympokemon inner join gymmember on gympokemon.pokemon_uid=gymmember.pokemon_uid "
506
+					. "GROUP BY gympokemon.pokemon_uid, pokemon_id, iv_attack, iv_defense, iv_stamina, gym_id"
507
+					. " HAVING gymmember.gym_id='".$gym_id."' ORDER BY cp DESC";
508
+			$result 	= $mysqli->query($req);
509
+			$i=0;
510 510
 
511 511
 
512 512
 
513
-		$gymData['infoWindow'] = '
513
+			$gymData['infoWindow'] = '
514 514
 			<div class="gym_defenders">
515 515
 			';
516
-		while ($data = $result->fetch_object()) {
517
-			$gymData['gymDetails']['pokemons'][] = $data;
518
-			if ($data != false) {
519
-				if ($config->system->iv_numbers) {
520
-					$gymData['infoWindow'] .= '
516
+			while ($data = $result->fetch_object()) {
517
+				$gymData['gymDetails']['pokemons'][] = $data;
518
+				if ($data != false) {
519
+					if ($config->system->iv_numbers) {
520
+						$gymData['infoWindow'] .= '
521 521
 					<div style="text-align: center; width: 50px; display: inline-block; margin-right: 3px">
522 522
 						<a href="pokemon/'.$data->pokemon_id.'">
523 523
 						<img src="core/pokemons/'.$data->pokemon_id.$config->system->pokeimg_suffix.'" height="50" style="display:inline-block" >
@@ -535,8 +535,8 @@  discard block
 block discarded – undo
535 535
 								</div>
536 536
 							</div>
537 537
 						</div>';
538
-				} else {
539
-					$gymData['infoWindow'] .= '
538
+					} else {
539
+						$gymData['infoWindow'] .= '
540 540
 					<div style="text-align: center; width: 50px; display: inline-block; margin-right: 3px">
541 541
 						<a href="pokemon/'.$data->pokemon_id.'">
542 542
 						<img src="core/pokemons/'.$data->pokemon_id.$config->system->pokeimg_suffix.'" height="50" style="display:inline-block" >
@@ -554,50 +554,50 @@  discard block
 block discarded – undo
554 554
 							</div>
555 555
 						</div>
556 556
 					</div>'
557
-						; }
558
-			} else {
559
-				$gymData['infoWindow'] .= '
557
+							; }
558
+				} else {
559
+					$gymData['infoWindow'] .= '
560 560
 				<div style="text-align: center; width: 50px; display: inline-block; margin-right: 3px">
561 561
 					<a href="pokemon/'.$gymData['gymDetails']['gymInfos']['guardPokemonId'].'">
562 562
 					<img src="core/pokemons/'.$gymData['gymDetails']['gymInfos']['guardPokemonId'].$config->system->pokeimg_suffix.'" height="50" style="display:inline-block" >
563 563
 					</a>
564 564
 					<p class="pkmn-name">???</p>
565 565
 				</div>'
566
-				;
566
+					;
567
+				}
568
+				$i++;
567 569
 			}
568
-			$i++;
569
-		}
570
-		$gymData['infoWindow'] = $gymData['infoWindow'].'</div>';
571
-		$return = json_encode($gymData);
570
+			$gymData['infoWindow'] = $gymData['infoWindow'].'</div>';
571
+			$return = json_encode($gymData);
572 572
 
573
-		echo $return;
573
+			echo $return;
574 574
 
575 575
 
576
-		break;
576
+			break;
577 577
 
578
-	case 'trainer':
579
-		$name = "";
580
-		$page = "0";
581
-		$where = "";
582
-		$order="";
583
-		$team=0;
584
-		$ranking=0;
585
-		if (isset($_GET['name'])) {
586
-			$trainer_name = mysqli_real_escape_string($mysqli, $_GET['name']);
587
-			$where = " HAVING name LIKE '%".$trainer_name."%'";
588
-		}
589
-		if (isset($_GET['team']) && $_GET['team']!=0) {
590
-			$team = mysqli_real_escape_string($mysqli, $_GET['team']);
591
-			$where .= ($where==""?" HAVING":"AND ")." team = ".$team;
592
-		}
593
-		if (isset($_GET['page'])) {
594
-			$page = mysqli_real_escape_string($mysqli, $_GET['page']);
595
-		}
596
-		if (isset($_GET['ranking'])) {
597
-			$ranking = mysqli_real_escape_string($mysqli, $_GET['ranking']);
598
-		}
578
+		case 'trainer':
579
+			$name = "";
580
+			$page = "0";
581
+			$where = "";
582
+			$order="";
583
+			$team=0;
584
+			$ranking=0;
585
+			if (isset($_GET['name'])) {
586
+				$trainer_name = mysqli_real_escape_string($mysqli, $_GET['name']);
587
+				$where = " HAVING name LIKE '%".$trainer_name."%'";
588
+			}
589
+			if (isset($_GET['team']) && $_GET['team']!=0) {
590
+				$team = mysqli_real_escape_string($mysqli, $_GET['team']);
591
+				$where .= ($where==""?" HAVING":"AND ")." team = ".$team;
592
+			}
593
+			if (isset($_GET['page'])) {
594
+				$page = mysqli_real_escape_string($mysqli, $_GET['page']);
595
+			}
596
+			if (isset($_GET['ranking'])) {
597
+				$ranking = mysqli_real_escape_string($mysqli, $_GET['ranking']);
598
+			}
599 599
 
600
-		switch ($ranking) {
600
+			switch ($ranking) {
601 601
 			case 1:
602 602
 				$order=" ORDER BY active DESC ";
603 603
 				break;
@@ -606,7 +606,7 @@  discard block
 block discarded – undo
606 606
 				break;
607 607
 			default:
608 608
 				$order=" ORDER BY level DESC, active DESC ";
609
-		}
609
+			}
610 610
 
611 611
 		$limit = " LIMIT ".($page*10).",10 ";
612 612
 
@@ -663,98 +663,98 @@  discard block
 block discarded – undo
663 663
 
664 664
 		break;
665 665
 
666
-	case 'pokemon_slider_init':
667
-		$req 		= "SELECT MIN(pokemon.disappear_time) as min, MAX(pokemon.disappear_time) as max from pokemon";
668
-		$result 	= $mysqli->query($req);
669
-		$data 		= $result->fetch_object();
670
-		$bounds 	= $data;
666
+		case 'pokemon_slider_init':
667
+			$req 		= "SELECT MIN(pokemon.disappear_time) as min, MAX(pokemon.disappear_time) as max from pokemon";
668
+			$result 	= $mysqli->query($req);
669
+			$data 		= $result->fetch_object();
670
+			$bounds 	= $data;
671 671
 
672
-		header('Content-Type: application/json');
673
-		$json = json_encode($bounds);
672
+			header('Content-Type: application/json');
673
+			$json = json_encode($bounds);
674 674
 
675
-		echo $json;
676
-		break;
675
+			echo $json;
676
+			break;
677 677
 
678
-	case 'pokemon_heatmap_points':
679
-		$json="";
680
-		if (isset($_GET['start'])&&isset($_GET['end']) && isset($_GET['pokemon_id'])) {
681
-			$start = Date("Y-m-d H:i",(int)$_GET['start']);
682
-			$end = Date("Y-m-d H:i",(int)$_GET['end']);
683
-			$pokemon_id = mysqli_real_escape_string($mysqli, $_GET['pokemon_id']);
684
-			$where = " WHERE pokemon.pokemon_id = ".$pokemon_id." "
685
-					. "AND pokemon.disappear_time BETWEEN '".$start."' AND '".$end."'";
686
-			$req 		= "SELECT latitude, longitude FROM pokemon".$where." ORDER BY disappear_time DESC LIMIT 10000";
687
-			$result 	= $mysqli->query($req);
688
-			$points = array();
689
-			while ($result && $data = $result->fetch_object()) {
690
-				$points[] 	= $data;
678
+		case 'pokemon_heatmap_points':
679
+			$json="";
680
+			if (isset($_GET['start'])&&isset($_GET['end']) && isset($_GET['pokemon_id'])) {
681
+				$start = Date("Y-m-d H:i",(int)$_GET['start']);
682
+				$end = Date("Y-m-d H:i",(int)$_GET['end']);
683
+				$pokemon_id = mysqli_real_escape_string($mysqli, $_GET['pokemon_id']);
684
+				$where = " WHERE pokemon.pokemon_id = ".$pokemon_id." "
685
+						. "AND pokemon.disappear_time BETWEEN '".$start."' AND '".$end."'";
686
+				$req 		= "SELECT latitude, longitude FROM pokemon".$where." ORDER BY disappear_time DESC LIMIT 10000";
687
+				$result 	= $mysqli->query($req);
688
+				$points = array();
689
+				while ($result && $data = $result->fetch_object()) {
690
+					$points[] 	= $data;
691
+				}
692
+
693
+				$json = json_encode($points);
691 694
 			}
692 695
 
693
-			$json = json_encode($points);
694
-		}
696
+			header('Content-Type: application/json');
695 697
 
696
-		header('Content-Type: application/json');
698
+			echo $json;
697 699
 
698
-		echo $json;
700
+			break;
699 701
 
700
-		break;
702
+		case 'pokedex':
703
+			$json="";
704
+			if (isset($_GET['pokemon_id'])) {
705
+				$pokemon_id = mysqli_real_escape_string($mysqli, $_GET['pokemon_id']);
706
+				$where = " WHERE pokemon.pokemon_id = ".$pokemon_id;
707
+				$req 		= "SELECT COUNT(encounter_id) as total FROM pokemon".$where;
708
+				$result 	= $mysqli->query($req);
709
+				$total = 0;
710
+				while ($result && $data = $result->fetch_object()) {
711
+					$total 	= $data;
712
+				}
701 713
 
702
-	case 'pokedex':
703
-		$json="";
704
-		if (isset($_GET['pokemon_id'])) {
705
-			$pokemon_id = mysqli_real_escape_string($mysqli, $_GET['pokemon_id']);
706
-			$where = " WHERE pokemon.pokemon_id = ".$pokemon_id;
707
-			$req 		= "SELECT COUNT(encounter_id) as total FROM pokemon".$where;
708
-			$result 	= $mysqli->query($req);
709
-			$total = 0;
710
-			while ($result && $data = $result->fetch_object()) {
711
-				$total 	= $data;
714
+				$json = json_encode($total);
712 715
 			}
713 716
 
714
-			$json = json_encode($total);
715
-		}
716
-
717
-		header('Content-Type: application/json');
717
+			header('Content-Type: application/json');
718 718
 
719
-		echo $json;
719
+			echo $json;
720 720
 
721
-		break;
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
-			$req 		= "SELECT COUNT(*) as total, "
728
-					. "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
+				$req 		= "SELECT COUNT(*) as total, "
728
+						. "HOUR(CONVERT_TZ(disappear_time, '+00:00', '".$time_offset."')) as disappear_hour
729 729
 			FROM (SELECT disappear_time FROM pokemon WHERE pokemon_id = '".$pokemon_id."' LIMIT 10000) as pokemonFiltered
730 730
 			GROUP BY disappear_hour
731 731
 			ORDER BY disappear_hour";
732
-			$result 	= $mysqli->query($req);
733
-			$array = array_fill(0, 24, 0);
734
-			while ($result && $data = $result->fetch_object()) {
735
-				$array[$data->disappear_hour] = $data->total;
736
-			}
737
-			// shift array because AM/PM starts at 1AM not 0:00
738
-			$array[] = $array[0];
739
-			array_shift($array);
732
+				$result 	= $mysqli->query($req);
733
+				$array = array_fill(0, 24, 0);
734
+				while ($result && $data = $result->fetch_object()) {
735
+					$array[$data->disappear_hour] = $data->total;
736
+				}
737
+				// shift array because AM/PM starts at 1AM not 0:00
738
+				$array[] = $array[0];
739
+				array_shift($array);
740 740
 
741
-			$json = json_encode($array);
742
-		}
741
+				$json = json_encode($array);
742
+			}
743 743
 
744
-		header('Content-Type: application/json');
744
+			header('Content-Type: application/json');
745 745
 
746
-		echo $json;
746
+			echo $json;
747 747
 
748
-		break;
748
+			break;
749 749
 
750
-	case 'postRequest':
751
-		break;
750
+		case 'postRequest':
751
+			break;
752 752
 
753
-	default:
754
-		echo "What do you mean?";
755
-		exit();
753
+		default:
754
+			echo "What do you mean?";
755
+			exit();
756 756
 
757
-	break;
757
+		break;
758 758
 }
759 759
 if ($postRequest!="") {
760 760
 	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 46
 if (isset($_GET['type'])) {
47
-$request 	= $_GET['type'];
47
+$request = $_GET['type'];
48 48
 }
49 49
 $postRequest = "";
50 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>';
@@ -280,14 +280,14 @@  discard block
 block discarded – undo
280 280
 		} else {
281 281
 			$req 		= "SELECT latitude, longitude, lure_expiration, UTC_TIMESTAMP() as now, (CONVERT_TZ(lure_expiration, '+00:00', '".$time_offset."')) as lure_expiration_real FROM pokestop WHERE lure_expiration > UTC_TIMESTAMP()";
282 282
 		}
283
-		$result 	= $mysqli->query($req);
283
+		$result = $mysqli->query($req);
284 284
 
285
-		$i=0;
285
+		$i = 0;
286 286
 
287 287
 		while ($data = $result->fetch_object()) {
288 288
 			if ($data->lure_expiration >= $data->now) {
289 289
 				$icon = 'pokestap_lured.png';
290
-				$text = 'Lured expire @ '.date('H:i:s', strtotime($data->lure_expiration_real)) ;
290
+				$text = 'Lured expire @ '.date('H:i:s', strtotime($data->lure_expiration_real));
291 291
 			} else {
292 292
 				$icon = 'pokestap.png';
293 293
 				$text = 'Normal stop';
@@ -320,19 +320,19 @@  discard block
 block discarded – undo
320 320
 	####################################
321 321
 
322 322
 	case 'update_gym':
323
-		$teams			= new stdClass();
324
-		$teams->mystic 		= 1;
325
-		$teams->valor 		= 2;
326
-		$teams->instinct 	= 3;
323
+		$teams = new stdClass();
324
+		$teams->mystic = 1;
325
+		$teams->valor = 2;
326
+		$teams->instinct = 3;
327 327
 
328 328
 
329 329
 		foreach ($teams as $team_name => $team_id) {
330
-			$req	= "SELECT COUNT(DISTINCT(gym_id)) as total, ROUND(AVG(gym_points),0) as average_points FROM gym WHERE team_id = '".$team_id."'  ";
331
-			$result	= $mysqli->query($req);
332
-			$data	= $result->fetch_object();
330
+			$req = "SELECT COUNT(DISTINCT(gym_id)) as total, ROUND(AVG(gym_points),0) as average_points FROM gym WHERE team_id = '".$team_id."'  ";
331
+			$result = $mysqli->query($req);
332
+			$data = $result->fetch_object();
333 333
 
334
-			$return[] 	= $data->total;
335
-			$return[]	= $data->average_points;
334
+			$return[] = $data->total;
335
+			$return[] = $data->average_points;
336 336
 		}
337 337
 
338 338
 		$json = json_encode($return);
@@ -351,11 +351,11 @@  discard block
 block discarded – undo
351 351
 
352 352
 
353 353
 	case 'gym_map':
354
-		$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";
355
-		$result 	= $mysqli->query($req);
354
+		$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";
355
+		$result = $mysqli->query($req);
356 356
 
357 357
 
358
-		$i=0;
358
+		$i = 0;
359 359
 
360 360
 		while ($data = $result->fetch_object()) {
361 361
 			// Team
@@ -367,50 +367,50 @@  discard block
 block discarded – undo
367 367
 				case 0:
368 368
 					$icon	= 'map_white.png';
369 369
 					$team	= 'No Team (yet)';
370
-					$color	= 'rgba(0, 0, 0, .6)';
370
+					$color = 'rgba(0, 0, 0, .6)';
371 371
 					break;
372 372
 
373 373
 				case 1:
374 374
 					$icon	= 'map_blue_';
375 375
 					$team	= 'Team Mystic';
376
-					$color	= 'rgba(74, 138, 202, .6)';
376
+					$color = 'rgba(74, 138, 202, .6)';
377 377
 					break;
378 378
 
379 379
 				case 2:
380 380
 					$icon	= 'map_red_';
381 381
 					$team	= 'Team Valor';
382
-					$color	= 'rgba(240, 68, 58, .6)';
382
+					$color = 'rgba(240, 68, 58, .6)';
383 383
 					break;
384 384
 
385 385
 				case 3:
386 386
 					$icon	= 'map_yellow_';
387 387
 					$team	= 'Team Instinct';
388
-					$color	= 'rgba(254, 217, 40, .6)';
388
+					$color = 'rgba(254, 217, 40, .6)';
389 389
 					break;
390 390
 			}
391 391
 
392 392
 			// Set gym level
393
-			$data->gym_level=0;
393
+			$data->gym_level = 0;
394 394
 			if ($data->gym_points < 2000) {
395
-				$data->gym_level=1;
395
+				$data->gym_level = 1;
396 396
 			} elseif ($data->gym_points < 4000) {
397
-				$data->gym_level=2;
397
+				$data->gym_level = 2;
398 398
 			} elseif ($data->gym_points < 8000) {
399
-				$data->gym_level=3;
399
+				$data->gym_level = 3;
400 400
 			} elseif ($data->gym_points < 12000) {
401
-				$data->gym_level=4;
401
+				$data->gym_level = 4;
402 402
 			} elseif ($data->gym_points < 16000) {
403
-				$data->gym_level=5;
403
+				$data->gym_level = 5;
404 404
 			} elseif ($data->gym_points < 20000) {
405
-				$data->gym_level=6;
405
+				$data->gym_level = 6;
406 406
 			} elseif ($data->gym_points < 30000) {
407
-				$data->gym_level=7;
407
+				$data->gym_level = 7;
408 408
 			} elseif ($data->gym_points < 40000) {
409
-				$data->gym_level=8;
409
+				$data->gym_level = 8;
410 410
 			} elseif ($data->gym_points < 50000) {
411
-				$data->gym_level=9;
411
+				$data->gym_level = 9;
412 412
 			} else {
413
-				$data->gym_level=10;
413
+				$data->gym_level = 10;
414 414
 			}
415 415
 
416 416
 			## I know, I revert commit 6e8d2e7 from @kiralydavid but the way it was done broke the page.
@@ -461,8 +461,8 @@  discard block
 block discarded – undo
461 461
 
462 462
 	case 'gym_defenders':
463 463
 		$gym_id = $mysqli->real_escape_string($_GET['gym_id']);
464
-		$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."'";
465
-		$result 	= $mysqli->query($req);
464
+		$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."'";
465
+		$result = $mysqli->query($req);
466 466
 		$gymData['gymDetails']['gymInfos'] = false;
467 467
 		while ($data = $result->fetch_object()) {
468 468
 			$gymData['gymDetails']['gymInfos']['name'] = $data->name;
@@ -478,35 +478,35 @@  discard block
 block discarded – undo
478 478
 			$gymData['gymDetails']['gymInfos']['team'] = $data->team;
479 479
 			$gymData['gymDetails']['gymInfos']['guardPokemonId'] = $data->guard_pokemon_id;
480 480
 			if ($data->points < 2000) {
481
-				$gymData['gymDetails']['gymInfos']['level']=1;
481
+				$gymData['gymDetails']['gymInfos']['level'] = 1;
482 482
 			} elseif ($data->points < 4000) {
483
-				$gymData['gymDetails']['gymInfos']['level']=2;
483
+				$gymData['gymDetails']['gymInfos']['level'] = 2;
484 484
 			} elseif ($data->points < 8000) {
485
-				$gymData['gymDetails']['gymInfos']['level']=3;
485
+				$gymData['gymDetails']['gymInfos']['level'] = 3;
486 486
 			} elseif ($data->points < 12000) {
487
-				$gymData['gymDetails']['gymInfos']['level']=4;
487
+				$gymData['gymDetails']['gymInfos']['level'] = 4;
488 488
 			} elseif ($data->points < 16000) {
489
-				$gymData['gymDetails']['gymInfos']['level']=5;
489
+				$gymData['gymDetails']['gymInfos']['level'] = 5;
490 490
 			} elseif ($data->points < 20000) {
491
-				$gymData['gymDetails']['gymInfos']['level']=6;
491
+				$gymData['gymDetails']['gymInfos']['level'] = 6;
492 492
 			} elseif ($data->points < 30000) {
493
-				$gymData['gymDetails']['gymInfos']['level']=7;
493
+				$gymData['gymDetails']['gymInfos']['level'] = 7;
494 494
 			} elseif ($data->points < 40000) {
495
-				$gymData['gymDetails']['gymInfos']['level']=8;
495
+				$gymData['gymDetails']['gymInfos']['level'] = 8;
496 496
 			} elseif ($data->points < 50000) {
497
-				$gymData['gymDetails']['gymInfos']['level']=9;
497
+				$gymData['gymDetails']['gymInfos']['level'] = 9;
498 498
 			} else {
499
-				$gymData['gymDetails']['gymInfos']['level']=10;
499
+				$gymData['gymDetails']['gymInfos']['level'] = 10;
500 500
 			}
501 501
 		}
502 502
 		//print_r($gymData);
503
-		$req 		= "SELECT DISTINCT gympokemon.pokemon_uid, "
503
+		$req = "SELECT DISTINCT gympokemon.pokemon_uid, "
504 504
 				. "pokemon_id, iv_attack, iv_defense, iv_stamina, MAX(cp) as cp, gymmember.gym_id "
505 505
 				. "FROM gympokemon inner join gymmember on gympokemon.pokemon_uid=gymmember.pokemon_uid "
506 506
 				. "GROUP BY gympokemon.pokemon_uid, pokemon_id, iv_attack, iv_defense, iv_stamina, gym_id"
507 507
 				. " HAVING gymmember.gym_id='".$gym_id."' ORDER BY cp DESC";
508
-		$result 	= $mysqli->query($req);
509
-		$i=0;
508
+		$result = $mysqli->query($req);
509
+		$i = 0;
510 510
 
511 511
 
512 512
 
@@ -524,14 +524,14 @@  discard block
 block discarded – undo
524 524
 						</a>
525 525
 						<p class="pkmn-name">'.$data->cp.'</p>
526 526
 						<div class="progress" style="height: 12px; margin-bottom: 0">
527
-							<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">
528
-								<span class="sr-only">Angriff IV : '. $data->iv_attack .'</span>'.$data->iv_attack.'
527
+							<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">
528
+								<span class="sr-only">Angriff IV : '. $data->iv_attack.'</span>'.$data->iv_attack.'
529 529
 								</div>
530
-								<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">
531
-									<span class="sr-only">Verteidigung IV : '. $data->iv_defense .'</span>'. $data->iv_defense .'
530
+								<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">
531
+									<span class="sr-only">Verteidigung IV : '. $data->iv_defense.'</span>'.$data->iv_defense.'
532 532
 								</div>
533
-								<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">
534
-									<span class="sr-only">KP IV : '. $data->iv_stamina .'</span>'. $data->iv_stamina .'
533
+								<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">
534
+									<span class="sr-only">KP IV : '. $data->iv_stamina.'</span>'.$data->iv_stamina.'
535 535
 								</div>
536 536
 							</div>
537 537
 						</div>';
@@ -543,13 +543,13 @@  discard block
 block discarded – undo
543 543
 						</a>
544 544
 						<p class="pkmn-name">'.$data->cp.'</p>
545 545
 						<div class="progress" style="height: 4px; width: 40px; margin-bottom: 10px; margin-top: 2px; margin-left: auto; margin-right: auto">
546
-							<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).'%">
546
+							<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).'%">
547 547
 								<span class="sr-only">Attack IV: '.$data->iv_attack.'</span>
548 548
 							</div>
549
-							<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).'%">
549
+							<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).'%">
550 550
 								<span class="sr-only">Defense IV: '.$data->iv_defense.'</span>
551 551
 							</div>
552
-							<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).'%">
552
+							<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).'%">
553 553
 								<span class="sr-only">Stamina IV: '.$data->iv_stamina.'</span>
554 554
 							</div>
555 555
 						</div>
@@ -579,16 +579,16 @@  discard block
 block discarded – undo
579 579
 		$name = "";
580 580
 		$page = "0";
581 581
 		$where = "";
582
-		$order="";
583
-		$team=0;
584
-		$ranking=0;
582
+		$order = "";
583
+		$team = 0;
584
+		$ranking = 0;
585 585
 		if (isset($_GET['name'])) {
586 586
 			$trainer_name = mysqli_real_escape_string($mysqli, $_GET['name']);
587 587
 			$where = " HAVING name LIKE '%".$trainer_name."%'";
588 588
 		}
589
-		if (isset($_GET['team']) && $_GET['team']!=0) {
589
+		if (isset($_GET['team']) && $_GET['team'] != 0) {
590 590
 			$team = mysqli_real_escape_string($mysqli, $_GET['team']);
591
-			$where .= ($where==""?" HAVING":"AND ")." team = ".$team;
591
+			$where .= ($where == "" ? " HAVING" : "AND ")." team = ".$team;
592 592
 		}
593 593
 		if (isset($_GET['page'])) {
594 594
 			$page = mysqli_real_escape_string($mysqli, $_GET['page']);
@@ -599,16 +599,16 @@  discard block
 block discarded – undo
599 599
 
600 600
 		switch ($ranking) {
601 601
 			case 1:
602
-				$order=" ORDER BY active DESC ";
602
+				$order = " ORDER BY active DESC ";
603 603
 				break;
604 604
 			case 2:
605
-				$order=" ORDER BY maxCp DESC ";
605
+				$order = " ORDER BY maxCp DESC ";
606 606
 				break;
607 607
 			default:
608
-				$order=" ORDER BY level DESC, active DESC ";
608
+				$order = " ORDER BY level DESC, active DESC ";
609 609
 		}
610 610
 
611
-		$limit = " LIMIT ".($page*10).",10 ";
611
+		$limit = " LIMIT ".($page * 10).",10 ";
612 612
 
613 613
 
614 614
 		$req = "SELECT trainer.*, count(actives_pokemons.trainer_name) as active, max(actives_pokemons.cp) as maxCp ".
@@ -627,7 +627,7 @@  discard block
 block discarded – undo
627 627
 			$reqRanking = "SELECT count(1) as rank FROM trainer where trainer.level >= ".$trainer->level;
628 628
 			$resultRanking = $mysqli->query($reqRanking);
629 629
 			while ($data = $resultRanking->fetch_object()) {
630
-				$trainer->rank = $data->rank ;
630
+				$trainer->rank = $data->rank;
631 631
 			}
632 632
 			$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 ".
633 633
 				"FROM gympokemon INNER JOIN ".
@@ -637,7 +637,7 @@  discard block
 block discarded – undo
637 637
 
638 638
 			$resultPkms = $mysqli->query($req);
639 639
 			$trainer->pokemons = array();
640
-			$active_gyms=0;
640
+			$active_gyms = 0;
641 641
 			$pkmCount = 0;
642 642
 			while ($resultPkms && $dataPkm = $resultPkms->fetch_object()) {
643 643
 				$active_gyms++;
@@ -664,9 +664,9 @@  discard block
 block discarded – undo
664 664
 		break;
665 665
 
666 666
 	case 'pokemon_slider_init':
667
-		$req 		= "SELECT MIN(pokemon.disappear_time) as min, MAX(pokemon.disappear_time) as max from pokemon";
667
+		$req = "SELECT MIN(pokemon.disappear_time) as min, MAX(pokemon.disappear_time) as max from pokemon";
668 668
 		$result 	= $mysqli->query($req);
669
-		$data 		= $result->fetch_object();
669
+		$data = $result->fetch_object();
670 670
 		$bounds 	= $data;
671 671
 
672 672
 		header('Content-Type: application/json');
@@ -676,18 +676,18 @@  discard block
 block discarded – undo
676 676
 		break;
677 677
 
678 678
 	case 'pokemon_heatmap_points':
679
-		$json="";
680
-		if (isset($_GET['start'])&&isset($_GET['end']) && isset($_GET['pokemon_id'])) {
681
-			$start = Date("Y-m-d H:i",(int)$_GET['start']);
682
-			$end = Date("Y-m-d H:i",(int)$_GET['end']);
679
+		$json = "";
680
+		if (isset($_GET['start']) && isset($_GET['end']) && isset($_GET['pokemon_id'])) {
681
+			$start = Date("Y-m-d H:i", (int) $_GET['start']);
682
+			$end = Date("Y-m-d H:i", (int) $_GET['end']);
683 683
 			$pokemon_id = mysqli_real_escape_string($mysqli, $_GET['pokemon_id']);
684 684
 			$where = " WHERE pokemon.pokemon_id = ".$pokemon_id." "
685 685
 					. "AND pokemon.disappear_time BETWEEN '".$start."' AND '".$end."'";
686 686
 			$req 		= "SELECT latitude, longitude FROM pokemon".$where." ORDER BY disappear_time DESC LIMIT 10000";
687
-			$result 	= $mysqli->query($req);
687
+			$result = $mysqli->query($req);
688 688
 			$points = array();
689 689
 			while ($result && $data = $result->fetch_object()) {
690
-				$points[] 	= $data;
690
+				$points[] = $data;
691 691
 			}
692 692
 
693 693
 			$json = json_encode($points);
@@ -700,7 +700,7 @@  discard block
 block discarded – undo
700 700
 		break;
701 701
 
702 702
 	case 'pokedex':
703
-		$json="";
703
+		$json = "";
704 704
 		if (isset($_GET['pokemon_id'])) {
705 705
 			$pokemon_id = mysqli_real_escape_string($mysqli, $_GET['pokemon_id']);
706 706
 			$where = " WHERE pokemon.pokemon_id = ".$pokemon_id;
@@ -721,15 +721,15 @@  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
-			$req 		= "SELECT COUNT(*) as total, "
727
+			$req = "SELECT COUNT(*) as total, "
728 728
 					. "HOUR(CONVERT_TZ(disappear_time, '+00:00', '".$time_offset."')) as disappear_hour
729 729
 			FROM (SELECT disappear_time FROM pokemon WHERE pokemon_id = '".$pokemon_id."' LIMIT 10000) as pokemonFiltered
730 730
 			GROUP BY disappear_hour
731 731
 			ORDER BY disappear_hour";
732
-			$result 	= $mysqli->query($req);
732
+			$result = $mysqli->query($req);
733 733
 			$array = array_fill(0, 24, 0);
734 734
 			while ($result && $data = $result->fetch_object()) {
735 735
 				$array[$data->disappear_hour] = $data->total;
@@ -756,30 +756,30 @@  discard block
 block discarded – undo
756 756
 
757 757
 	break;
758 758
 }
759
-if ($postRequest!="") {
759
+if ($postRequest != "") {
760 760
 	switch ($postRequest) {
761 761
 		case 'pokemon_live':
762
-			$json="";
763
-			if (isset( $_POST['pokemon_id'])) {
762
+			$json = "";
763
+			if (isset($_POST['pokemon_id'])) {
764 764
 				$pokemon_id = mysqli_real_escape_string($mysqli, $_POST['pokemon_id']);
765
-				$inmap_pkms_filter="";
765
+				$inmap_pkms_filter = "";
766 766
 				$where = " WHERE disappear_time >= UTC_TIMESTAMP() AND pokemon.pokemon_id = ".$pokemon_id;
767 767
 
768 768
 				$reqTestIv = "SELECT MAX(individual_attack) as iv FROM pokemon ".$where;
769
-				$resultTestIv 	= $mysqli->query($reqTestIv);
769
+				$resultTestIv = $mysqli->query($reqTestIv);
770 770
 				$testIv = $resultTestIv->fetch_object();
771
-				if (isset( $_POST['inmap_pokemons'])&&( $_POST['inmap_pokemons']!="")) {
771
+				if (isset($_POST['inmap_pokemons']) && ($_POST['inmap_pokemons'] != "")) {
772 772
 					foreach ($_POST['inmap_pokemons'] as $inmap) {
773 773
 						$inmap_pkms_filter .= "'".$inmap."',";
774 774
 					}
775 775
 					$inmap_pkms_filter = rtrim($inmap_pkms_filter, ",");
776 776
 					$where .= " AND pokemon.encounter_id NOT IN (".$inmap_pkms_filter.") ";
777 777
 				}
778
-				if ($testIv->iv!=null && isset( $_POST['ivMin'])&&( $_POST['ivMin']!="")) {
778
+				if ($testIv->iv != null && isset($_POST['ivMin']) && ($_POST['ivMin'] != "")) {
779 779
 					$ivMin = mysqli_real_escape_string($mysqli, $_POST['ivMin']);
780 780
 					$where .= " AND ((100/45)*(individual_attack+individual_defense+individual_stamina)) >= (".$ivMin.") ";
781 781
 				}
782
-				if ($testIv->iv!=null && isset( $_POST['ivMax'])&&( $_POST['ivMax']!="")) {
782
+				if ($testIv->iv != null && isset($_POST['ivMax']) && ($_POST['ivMax'] != "")) {
783 783
 					$ivMax = mysqli_real_escape_string($mysqli, $_POST['ivMax']);
784 784
 					$where .= " AND ((100/45)*(individual_attack+individual_defense+individual_stamina)) <=(".$ivMax.") ";
785 785
 				}
@@ -787,16 +787,16 @@  discard block
 block discarded – undo
787 787
 						. " (CONVERT_TZ(disappear_time, '+00:00', '".$time_offset."')) as disappear_time_real, "
788 788
 						. " individual_attack, individual_defense, individual_stamina, move_1, move_2 "
789 789
 						. "FROM pokemon".$where." ORDER BY disappear_time DESC LIMIT 5000";
790
-				$result 	= $mysqli->query($req);
790
+				$result = $mysqli->query($req);
791 791
 				$points = array();
792 792
 				while ($result && $data = $result->fetch_object()) {
793
-					$pokeid=$data->pokemon_id;
793
+					$pokeid = $data->pokemon_id;
794 794
 					$data->name = $pokemons->pokemon->$pokeid->name;
795
-					$move1=$data->move_1;
796
-					$move2=$data->move_2;
795
+					$move1 = $data->move_1;
796
+					$move2 = $data->move_2;
797 797
 					$data->quick_move = $move->$move1->name;
798 798
 					$data->charge_move = $move->$move2->name;
799
-					$points[] 	= $data;
799
+					$points[] = $data;
800 800
 				}
801 801
 
802 802
 				$json = json_encode($points);
Please login to merge, or discard this patch.
core/cron/pokedex.rarity.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -39,7 +39,7 @@
 block discarded – undo
39 39
 	// Use alltime count if there was no scan last 7 days
40 40
 	$total_pokemon          = ($total_pokemon_last_week > 0) ? $total_pokemon_last_week : $total_pokemon_alltime;
41 41
 
42
-	$percent                = ($pokemon['total']*100) / $total_pokemon;
42
+	$percent                = ($pokemon['total'] * 100) / $total_pokemon;
43 43
 	$rounded                = round($percent, 4);
44 44
 	// do not round to 0 if there was a spawn. Set to min 0.0001.
45 45
 	$rounded                = ($rounded == 0.0000 && $pokemon['total'] > 0) ? $rounded = 0.0001 : $rounded;
Please login to merge, or discard this patch.
core/process/locales.loader.php 3 patches
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -13,12 +13,12 @@
 block discarded – undo
13 13
  */
14 14
 
15 15
  /**
16
- * Parses and sorts a weighed "Accept" HTTP header
17
- *
18
- * @param string $header The HTTP "Accept" header to parse
19
- *
20
- * @return array Sorted list of "accept" options
21
- */
16
+  * Parses and sorts a weighed "Accept" HTTP header
17
+  *
18
+  * @param string $header The HTTP "Accept" header to parse
19
+  *
20
+  * @return array Sorted list of "accept" options
21
+  */
22 22
 $sortAccept = function ($header) {
23 23
 	$matches = array();
24 24
 	foreach (explode(',', $header) as $option) {
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
  *
20 20
  * @return array Sorted list of "accept" options
21 21
  */
22
-$sortAccept = function ($header) {
22
+$sortAccept = function($header) {
23 23
 	$matches = array();
24 24
 	foreach (explode(',', $header) as $option) {
25 25
 		$option = array_map('trim', explode(';', $option));
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
  *
53 53
  * @return string|NULL a matched option, or NULL if no match
54 54
  */
55
-$matchAccept = function ($header, $supported) use ($sortAccept) {
55
+$matchAccept = function($header, $supported) use ($sortAccept) {
56 56
 	$matches = $sortAccept($header);
57 57
 	foreach ($matches as $key => $q) {
58 58
 		if (isset($supported[$key])) {
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
  *
84 84
  * @return string The negotiated language result or the supplied default.
85 85
  */
86
-$negotiateLanguage = function ($supported, $default = 'en-US') use ($matchAccept) {
86
+$negotiateLanguage = function($supported, $default = 'en-US') use ($matchAccept) {
87 87
 	$supp = array();
88 88
 	foreach ($supported as $lang => $isSupported) {
89 89
 		if ($isSupported) {
Please login to merge, or discard this patch.
Braces   +6 added lines, -3 removed lines patch added patch discarded remove patch
@@ -19,7 +19,8 @@  discard block
 block discarded – undo
19 19
  *
20 20
  * @return array Sorted list of "accept" options
21 21
  */
22
-$sortAccept = function ($header) {
22
+$sortAccept = function ($header)
23
+{
23 24
 	$matches = array();
24 25
 	foreach (explode(',', $header) as $option) {
25 26
 		$option = array_map('trim', explode(';', $option));
@@ -52,7 +53,8 @@  discard block
 block discarded – undo
52 53
  *
53 54
  * @return string|NULL a matched option, or NULL if no match
54 55
  */
55
-$matchAccept = function ($header, $supported) use ($sortAccept) {
56
+$matchAccept = function ($header, $supported) use ($sortAccept)
57
+{
56 58
 	$matches = $sortAccept($header);
57 59
 	foreach ($matches as $key => $q) {
58 60
 		if (isset($supported[$key])) {
@@ -83,7 +85,8 @@  discard block
 block discarded – undo
83 85
  *
84 86
  * @return string The negotiated language result or the supplied default.
85 87
  */
86
-$negotiateLanguage = function ($supported, $default = 'en-US') use ($matchAccept) {
88
+$negotiateLanguage = function ($supported, $default = 'en-US') use ($matchAccept)
89
+{
87 90
 	$supp = array();
88 91
 	foreach ($supported as $lang => $isSupported) {
89 92
 		if ($isSupported) {
Please login to merge, or discard this patch.