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