Passed
Pull Request — master (#140)
by PoUpA
02:30
created
pages/home.page.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -65,13 +65,13 @@
 block discarded – undo
65 65
 				if ($config->system->recents_show_iv) {
66 66
 					if ($pokemon->iv->available) { ?>
67 67
 					<div class="progress" style="height: 6px; width: 80%; margin: 5px auto 15px auto;">
68
-						<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 ?>%">
68
+						<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 ?>%">
69 69
 							<span class="sr-only">Stamina IV: <?= $pokemon->iv->stamina ?></span>
70 70
 						</div>
71
-						<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 ?>%">
71
+						<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 ?>%">
72 72
 							<span class="sr-only">Attack IV: <?= $pokemon->iv->attack ?></span>
73 73
 						</div>
74
-						<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 ?>%">
74
+						<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 ?>%">
75 75
 							<span class="sr-only">Defense IV: <?= $pokemon->iv->defense ?></span>
76 76
 						</div>
77 77
 					</div>
Please login to merge, or discard this patch.
core/process/data.loader.php 1 patch
Spacing   +82 added lines, -82 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 	= realpath(dirname(__FILE__)).'/../json/variables.json';
7
-$config 	= json_decode(file_get_contents($variables));
6
+$variables = realpath(dirname(__FILE__)).'/../json/variables.json';
7
+$config = json_decode(file_get_contents($variables));
8 8
 
9 9
 if (!isset($config->system)) {
10 10
 	echo 'Could not load variables.';
@@ -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 != '') {
@@ -88,12 +88,12 @@  discard block
 block discarded – undo
88 88
 // ( 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
89 89
 // => check filemtime, if > 24h launch an update. )
90 90
 
91
-$pokedex_rarity_filetime	= filemtime($pokedex_rarity_file);
92
-$now				= time();
93
-$diff				= $now - $pokedex_rarity_filetime;
91
+$pokedex_rarity_filetime = filemtime($pokedex_rarity_file);
92
+$now = time();
93
+$diff = $now - $pokedex_rarity_filetime;
94 94
 
95 95
 // Update each 24h
96
-$update_delay		= 86400;
96
+$update_delay = 86400;
97 97
 
98 98
 if ($diff > $update_delay) {
99 99
 	include_once(SYS_PATH.'/core/cron/pokemon.rarity.php');
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
 			// ---------------------
125 125
 
126 126
 
127
-			$pokemon_id 			= mysqli_real_escape_string($mysqli, $_GET['id']);
127
+			$pokemon_id = mysqli_real_escape_string($mysqli, $_GET['id']);
128 128
 
129 129
 			if (!is_object($pokemons->pokemon->$pokemon_id)) {
130 130
 				header('Location:/404');
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
 
135 135
 			$pokemon			= new stdClass();
136 136
 			$pokemon			= $pokemons->pokemon->$pokemon_id;
137
-			$pokemon->id			= $pokemon_id;
137
+			$pokemon->id = $pokemon_id;
138 138
 
139 139
 
140 140
 
@@ -152,54 +152,54 @@  discard block
 block discarded – undo
152 152
 
153 153
 			// Total gym protected
154 154
 
155
-			$req 		= "SELECT count( DISTINCT(gym_id) ) as total FROM gym WHERE guard_pokemon_id = '".$pokemon_id."'  ";
156
-			$result 	= $mysqli->query($req);
157
-			$data 		= $result->fetch_object();
155
+			$req = "SELECT count( DISTINCT(gym_id) ) as total FROM gym WHERE guard_pokemon_id = '".$pokemon_id."'  ";
156
+			$result = $mysqli->query($req);
157
+			$data = $result->fetch_object();
158 158
 
159 159
 			$pokemon->protected_gyms = $data->total;
160 160
 
161 161
 
162 162
 			// Total spawn
163 163
 
164
-			$req 		= "SELECT COUNT(*) as total FROM pokemon WHERE pokemon_id = '".$pokemon_id."'";
165
-			$result 	= $mysqli->query($req);
166
-			$data 		= $result->fetch_object();
164
+			$req = "SELECT COUNT(*) as total FROM pokemon WHERE pokemon_id = '".$pokemon_id."'";
165
+			$result = $mysqli->query($req);
166
+			$data = $result->fetch_object();
167 167
 
168
-			$pokemon->total_spawn 	= $data->total;
168
+			$pokemon->total_spawn = $data->total;
169 169
 
170 170
 
171 171
 			// Spawn rate
172 172
 
173 173
 			if ($pokemon->total_spawn > 0) {
174 174
 				$req 		= "SELECT COUNT(DISTINCT DATE(disappear_time)) as total FROM pokemon";
175
-				$result 	= $mysqli->query($req);
175
+				$result = $mysqli->query($req);
176 176
 				$data		= $result->fetch_object();
177 177
 
178 178
 				$pokemon->total_days = $data->total;
179
-				$pokemon->spawn_rate 	= round(($pokemon->total_spawn/$pokemon->total_days), 2);
179
+				$pokemon->spawn_rate 	= round(($pokemon->total_spawn / $pokemon->total_days), 2);
180 180
 			} else {
181 181
 				$pokemon->total_days 	= 0;
182
-				$pokemon->spawn_rate	= 0;
182
+				$pokemon->spawn_rate = 0;
183 183
 			}
184 184
 
185 185
 
186 186
 			// Last seen
187 187
 
188
-			$req 		= "SELECT disappear_time, (CONVERT_TZ(disappear_time, '+00:00', '".$time_offset."')) as disappear_time_real, latitude, longitude
188
+			$req = "SELECT disappear_time, (CONVERT_TZ(disappear_time, '+00:00', '".$time_offset."')) as disappear_time_real, latitude, longitude
189 189
 			FROM pokemon
190 190
 			WHERE pokemon_id = '".$pokemon_id."'
191 191
 			ORDER BY disappear_time DESC
192 192
 			LIMIT 0,1";
193
-			$result 	= $mysqli->query($req);
194
-			$data 		= $result->fetch_object();
193
+			$result = $mysqli->query($req);
194
+			$data = $result->fetch_object();
195 195
 
196 196
 			if (isset($data)) {
197
-				$last_spawn 				= $data;
197
+				$last_spawn = $data;
198 198
 
199
-				$pokemon->last_seen			= strtotime($data->disappear_time_real);
200
-				$pokemon->last_position			= new stdClass();
201
-				$pokemon->last_position->latitude 	= $data->latitude;
202
-				$pokemon->last_position->longitude 	= $data->longitude;
199
+				$pokemon->last_seen = strtotime($data->disappear_time_real);
200
+				$pokemon->last_position = new stdClass();
201
+				$pokemon->last_position->latitude = $data->latitude;
202
+				$pokemon->last_position->longitude = $data->longitude;
203 203
 			}
204 204
 
205 205
 
@@ -237,23 +237,23 @@  discard block
 block discarded – undo
237 237
 
238 238
 
239 239
 			$max 		= $config->system->max_pokemon;
240
-			$pokedex 	= new stdClass();
240
+			$pokedex = new stdClass();
241 241
 
242 242
 			$req 		= "SELECT COUNT(*) as total,pokemon_id FROM pokemon GROUP by pokemon_id ";
243
-			$result 	= $mysqli->query($req);
243
+			$result = $mysqli->query($req);
244 244
 			$data_array = array();
245 245
 
246 246
 			while ($data = $result->fetch_object()) {
247 247
 				$data_array[$data->pokemon_id] = $data->total;
248 248
 			};
249 249
 
250
-			for ($i= 1; $i <= $max; $i++) {
251
-				$pokedex->$i			= new stdClass();
250
+			for ($i = 1; $i <= $max; $i++) {
251
+				$pokedex->$i = new stdClass();
252 252
 				$pokedex->$i->id 		= $i;
253
-				$pokedex->$i->permalink 	= 'pokemon/'.$i;
253
+				$pokedex->$i->permalink = 'pokemon/'.$i;
254 254
 				$pokedex->$i->img		= 'core/pokemons/'.$i.'.png';
255
-				$pokedex->$i->name		= $pokemons->pokemon->$i->name;
256
-				$pokedex->$i->spawn 		= isset($data_array[$i])? $data_array[$i] : 0;
255
+				$pokedex->$i->name = $pokemons->pokemon->$i->name;
256
+				$pokedex->$i->spawn = isset($data_array[$i]) ? $data_array[$i] : 0;
257 257
 			}
258 258
 
259 259
 
@@ -264,17 +264,17 @@  discard block
 block discarded – undo
264 264
 		############
265 265
 
266 266
 		case 'pokestops':
267
-			$pokestop 	= new stdClass();
267
+			$pokestop = new stdClass();
268 268
 
269
-			$req 		= "SELECT COUNT(*) as total FROM pokestop";
270
-			$result 	= $mysqli->query($req);
271
-			$data 		= $result->fetch_object();
269
+			$req = "SELECT COUNT(*) as total FROM pokestop";
270
+			$result = $mysqli->query($req);
271
+			$data = $result->fetch_object();
272 272
 
273 273
 			$pokestop->total = $data->total;
274 274
 
275
-			$req 		= "SELECT COUNT(*) as total FROM pokestop WHERE lure_expiration > UTC_TIMESTAMP()";
276
-			$result 	= $mysqli->query($req);
277
-			$data 		= $result->fetch_object();
275
+			$req = "SELECT COUNT(*) as total FROM pokestop WHERE lure_expiration > UTC_TIMESTAMP()";
276
+			$result = $mysqli->query($req);
277
+			$data = $result->fetch_object();
278 278
 
279 279
 			$pokestop->lured = $data->total;
280 280
 
@@ -291,36 +291,36 @@  discard block
 block discarded – undo
291 291
 			// 3 Teams (teamm rocket is neutral)
292 292
 			// 1 Fight
293 293
 
294
-			$teams 				= new stdClass();
294
+			$teams = new stdClass();
295 295
 
296
-			$teams->mystic 			= new stdClass();
297
-			$teams->mystic->guardians 	= new stdClass();
298
-			$teams->mystic->id 		= 1;
296
+			$teams->mystic = new stdClass();
297
+			$teams->mystic->guardians = new stdClass();
298
+			$teams->mystic->id = 1;
299 299
 
300
-			$teams->valor 			= new stdClass();
301
-			$teams->valor->guardians 	= new stdClass();
302
-			$teams->valor->id 		= 2;
300
+			$teams->valor = new stdClass();
301
+			$teams->valor->guardians = new stdClass();
302
+			$teams->valor->id = 2;
303 303
 
304
-			$teams->instinct 		= new stdClass();
305
-			$teams->instinct->guardians 	= new stdClass();
306
-			$teams->instinct->id 		= 3;
304
+			$teams->instinct = new stdClass();
305
+			$teams->instinct->guardians = new stdClass();
306
+			$teams->instinct->id = 3;
307 307
 
308
-			$teams->rocket 			= new stdClass();
309
-			$teams->rocket->guardians 	= new stdClass();
310
-			$teams->rocket->id 		= 0;
308
+			$teams->rocket = new stdClass();
309
+			$teams->rocket->guardians = new stdClass();
310
+			$teams->rocket->id = 0;
311 311
 
312 312
 
313 313
 
314 314
 			foreach ($teams as $team_key => $team_values) {
315 315
 				// Team Guardians
316 316
 
317
-				$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 ";
317
+				$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 ";
318 318
 				$result = $mysqli->query($req);
319 319
 
320
-				$i=0;
320
+				$i = 0;
321 321
 
322 322
 				while ($data = $result->fetch_object()) {
323
-					$teams->$team_key->guardians->$i	= $data->guard_pokemon_id;
323
+					$teams->$team_key->guardians->$i = $data->guard_pokemon_id;
324 324
 
325 325
 					$i++;
326 326
 				}
@@ -332,8 +332,8 @@  discard block
 block discarded – undo
332 332
 				$result = $mysqli->query($req);
333 333
 				$data	= $result->fetch_object();
334 334
 
335
-				$teams->$team_key->gym_owned	= $data->total;
336
-				$teams->$team_key->average	= $data->average_points;
335
+				$teams->$team_key->gym_owned = $data->total;
336
+				$teams->$team_key->average = $data->average_points;
337 337
 			}
338 338
 
339 339
 
@@ -346,7 +346,7 @@  discard block
 block discarded – undo
346 346
 		case 'dashboard':
347 347
 			// This case is only used for test purpose.
348 348
 
349
-			$stats_file	= SYS_PATH.'/core/json/gym.stats.json';
349
+			$stats_file = SYS_PATH.'/core/json/gym.stats.json';
350 350
 
351 351
 			if (!is_file($stats_file)) {
352 352
 				echo "Sorry, no Gym stats file was found. <br> Did you enable cron? ";
@@ -354,7 +354,7 @@  discard block
 block discarded – undo
354 354
 			}
355 355
 
356 356
 
357
-			$stats_file	= SYS_PATH.'/core/json/pokemon.stats.json';
357
+			$stats_file = SYS_PATH.'/core/json/pokemon.stats.json';
358 358
 
359 359
 			if (!is_file($stats_file)) {
360 360
 				echo "Sorry, no Pokémon stats file was found. <br> Did you enabled cron?";
@@ -362,7 +362,7 @@  discard block
 block discarded – undo
362 362
 			}
363 363
 
364 364
 
365
-			$stats_file	= SYS_PATH.'/core/json/pokestop.stats.json';
365
+			$stats_file = SYS_PATH.'/core/json/pokestop.stats.json';
366 366
 
367 367
 			if (!is_file($stats_file)) {
368 368
 				echo "Sorry, no Pokéstop stats file was found. <br> Did you enabled cron?";
@@ -383,9 +383,9 @@  discard block
 block discarded – undo
383 383
 	// Right now
384 384
 	// ---------
385 385
 
386
-	$req 		= "SELECT COUNT(*) as total FROM pokemon WHERE disappear_time > UTC_TIMESTAMP()";
387
-	$result 	= $mysqli->query($req);
388
-	$data 		= $result->fetch_object();
386
+	$req = "SELECT COUNT(*) as total FROM pokemon WHERE disappear_time > UTC_TIMESTAMP()";
387
+	$result = $mysqli->query($req);
388
+	$data = $result->fetch_object();
389 389
 
390 390
 
391 391
 	$home->pokemon_now = $data->total;
@@ -394,9 +394,9 @@  discard block
 block discarded – undo
394 394
 	// Lured stops
395 395
 	// -----------
396 396
 
397
-	$req 		= "SELECT COUNT(*) as total FROM pokestop WHERE lure_expiration > UTC_TIMESTAMP()";
398
-	$result 	= $mysqli->query($req);
399
-	$data 		= $result->fetch_object();
397
+	$req = "SELECT COUNT(*) as total FROM pokestop WHERE lure_expiration > UTC_TIMESTAMP()";
398
+	$result = $mysqli->query($req);
399
+	$data = $result->fetch_object();
400 400
 
401 401
 	$home->pokestop_lured = $data->total;
402 402
 
@@ -404,9 +404,9 @@  discard block
 block discarded – undo
404 404
 	// Gyms
405 405
 	// ----
406 406
 
407
-	$req 		= "SELECT COUNT(DISTINCT(gym_id)) as total FROM gym";
408
-	$result 	= $mysqli->query($req);
409
-	$data 		= $result->fetch_object();
407
+	$req = "SELECT COUNT(DISTINCT(gym_id)) as total FROM gym";
408
+	$result = $mysqli->query($req);
409
+	$data = $result->fetch_object();
410 410
 
411 411
 	$home->gyms = $data->total;
412 412
 
@@ -416,19 +416,19 @@  discard block
 block discarded – undo
416 416
 
417 417
 	if ($config->system->mythic_recents) {
418 418
 		// get all mythic pokemon ids
419
-		$mythic_pokemons  = array();
419
+		$mythic_pokemons = array();
420 420
 		foreach ($pokemons->pokemon as $id => $pokemon) {
421 421
 			if ($pokemon->spawn_rate < 0.01) {
422 422
 				$mythic_pokemons[] = $id;
423 423
 			}
424 424
 		}
425 425
 		// get all mythic pokemon
426
-		$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
426
+		$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
427 427
 				   WHERE pokemon_id IN (".implode(",", $mythic_pokemons).")
428 428
 				   ORDER BY last_modified DESC LIMIT 0,12";
429 429
 	} else {
430 430
 		// get all pokemon
431
-		$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
431
+		$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
432 432
 				   ORDER BY last_modified DESC LIMIT 0,12";
433 433
 	}
434 434
 	$result 	= $mysqli->query($req);
@@ -474,28 +474,28 @@  discard block
 block discarded – undo
474 474
 
475 475
 	$req = "SELECT count( DISTINCT(gym_id) ) as total FROM gym WHERE team_id = '1'  ";
476 476
 	$result = $mysqli->query($req);
477
-	$data 	= $result->fetch_object();
477
+	$data = $result->fetch_object();
478 478
 
479
-	$home->teams->mystic 	= $data->total;
479
+	$home->teams->mystic = $data->total;
480 480
 
481 481
 
482 482
 	$req = "SELECT count( DISTINCT(gym_id) ) as total FROM gym WHERE team_id = '2'  ";
483 483
 	$result = $mysqli->query($req);
484
-	$data 	= $result->fetch_object();
484
+	$data = $result->fetch_object();
485 485
 
486
-	$home->teams->valor 	= $data->total;
486
+	$home->teams->valor = $data->total;
487 487
 
488 488
 
489 489
 	$req = "SELECT count( DISTINCT(gym_id) ) as total FROM gym WHERE team_id = '3'  ";
490 490
 	$result = $mysqli->query($req);
491
-	$data 	= $result->fetch_object();
491
+	$data = $result->fetch_object();
492 492
 
493
-	$home->teams->instinct 	= $data->total;
493
+	$home->teams->instinct = $data->total;
494 494
 
495 495
 
496 496
 	$req = "SELECT count( DISTINCT(gym_id) ) as total FROM gym WHERE team_id = '0'  ";
497 497
 	$result = $mysqli->query($req);
498
-	$data 	= $result->fetch_object();
498
+	$data = $result->fetch_object();
499 499
 
500
-	$home->teams->rocket 	= $data->total;
500
+	$home->teams->rocket = $data->total;
501 501
 }
Please login to merge, or discard this patch.
core/process/aru.php 2 patches
Indentation   +40 added lines, -40 removed lines patch added patch discarded remove patch
@@ -157,39 +157,39 @@  discard block
 block discarded – undo
157 157
 		}
158 158
 		$result = $mysqli->query($req);
159 159
 		while ($data = $result->fetch_object()) {
160
-		    $new_spawn = array();
161
-		    $pokeid = $data->pokemon_id;
162
-		    $pokeuid = $data->encounter_id;
163
-
164
-		    if ($_GET['last_uid'] != $pokeuid) {
165
-			    $last_seen = strtotime($data->disappear_time_real);
166
-
167
-			    $last_location = new stdClass();
168
-			    $last_location->latitude = $data->latitude;
169
-			    $last_location->longitude = $data->longitude;
170
-
171
-			    if ($config->system->recents_show_iv) {
172
-				    $iv = new stdClass();
173
-				    $iv->attack = $data->individual_attack;
174
-				    $iv->defense = $data->individual_defense;
175
-				    $iv->stamina = $data->individual_stamina;
176
-				    if (isset($iv->attack) && isset($iv->defense) && isset($iv->stamina)) {
177
-					    $iv->available = true;
178
-				    } else {
179
-					    $iv->available = false;
180
-				    }
181
-			    }
182
-
183
-			    $html = '
160
+			$new_spawn = array();
161
+			$pokeid = $data->pokemon_id;
162
+			$pokeuid = $data->encounter_id;
163
+
164
+			if ($_GET['last_uid'] != $pokeuid) {
165
+				$last_seen = strtotime($data->disappear_time_real);
166
+
167
+				$last_location = new stdClass();
168
+				$last_location->latitude = $data->latitude;
169
+				$last_location->longitude = $data->longitude;
170
+
171
+				if ($config->system->recents_show_iv) {
172
+					$iv = new stdClass();
173
+					$iv->attack = $data->individual_attack;
174
+					$iv->defense = $data->individual_defense;
175
+					$iv->stamina = $data->individual_stamina;
176
+					if (isset($iv->attack) && isset($iv->defense) && isset($iv->stamina)) {
177
+						$iv->available = true;
178
+					} else {
179
+						$iv->available = false;
180
+					}
181
+				}
182
+
183
+				$html = '
184 184
 			    <div class="col-md-1 col-xs-4 pokemon-single" data-pokeid="'.$pokeid.'" data-pokeuid="'.$pokeuid.'" style="display: none;">
185 185
 				<a href="pokemon/'.$pokeid.'"><img src="core/pokemons/'.$pokeid.'.png" alt="'.$pokemons->pokemon->$pokeid->name.'" class="img-responsive"></a>
186 186
 				<a href="pokemon/'.$pokeid.'"><p class="pkmn-name">'.$pokemons->pokemon->$pokeid->name.'</p></a>
187 187
 				<a href="https://maps.google.com/?q='.$last_location->latitude.','.$last_location->longitude.'&ll='.$last_location->latitude.','.$last_location->longitude.'&z=16" target="_blank">
188 188
 				    <small class="pokemon-timer">00:00:00</small>
189 189
 				</a>';
190
-			    if ($config->system->recents_show_iv) {
191
-				    if ($iv->available) {
192
-					    $html .= '
190
+				if ($config->system->recents_show_iv) {
191
+					if ($iv->available) {
192
+						$html .= '
193 193
 					<div class="progress" style="height: 6px; width: 80%; margin: 5px auto 0 auto;">
194 194
 					    <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 .'%">
195 195
 						<span class="sr-only">Stamina IV: '. $iv->stamina .'</span>
@@ -201,25 +201,25 @@  discard block
 block discarded – undo
201 201
 						<span class="sr-only">Defense IV: '. $iv->defense .'</span>
202 202
 					    </div>
203 203
 					</div>';
204
-				    } else {
205
-					    $html .= '
204
+					} else {
205
+						$html .= '
206 206
 					    <div class="progress" style="height: 6px; width: 80%; margin: 5px auto 15px auto;">
207 207
 						    <div title="IV not available" class="progress-bar" role="progressbar" style="width: 100%; background-color: rgba(240,240,240,1);" aria-valuenow="1" aria-valuemin="0" aria-valuemax="1">
208 208
 							    <span class="sr-only">IV not available</span>
209 209
 						    </div>
210 210
 					    </div>';
211
-				    }
212
-			    }
213
-			    $html .= '
211
+					}
212
+				}
213
+				$html .= '
214 214
 			    </div>';
215
-			    $new_spawn['html'] = $html;
216
-			    $countdown = $last_seen - time();
217
-			    $new_spawn['countdown'] = $countdown;
218
-			    $new_spawn['pokemon_uid'] = $pokeuid;
219
-			    $total_spawns[] = $new_spawn;
220
-		    } else {
221
-			    break;
222
-		    }
215
+				$new_spawn['html'] = $html;
216
+				$countdown = $last_seen - time();
217
+				$new_spawn['countdown'] = $countdown;
218
+				$new_spawn['pokemon_uid'] = $pokeuid;
219
+				$total_spawns[] = $new_spawn;
220
+			} else {
221
+				break;
222
+			}
223 223
 		}
224 224
 		header('Content-Type: application/json');
225 225
 		echo json_encode($total_spawns);
Please login to merge, or discard this patch.
Spacing   +97 added lines, -97 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 	= realpath(dirname(__FILE__)).'/../json/variables.json';
23
-$config 	= json_decode(file_get_contents($variables));
22
+$variables = realpath(dirname(__FILE__)).'/../json/variables.json';
23
+$config = json_decode(file_get_contents($variables));
24 24
 
25 25
 
26 26
 
@@ -37,12 +37,12 @@  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
-$request 	= $_GET['type'];
45
+$request = $_GET['type'];
46 46
 
47 47
 switch ($request) {
48 48
 	############################
@@ -55,64 +55,64 @@  discard block
 block discarded – undo
55 55
 		// Right now
56 56
 		// ---------
57 57
 
58
-		$req 		= "SELECT COUNT(*) as total FROM pokemon WHERE disappear_time > UTC_TIMESTAMP()";
59
-		$result 	= $mysqli->query($req);
60
-		$data 		= $result->fetch_object();
58
+		$req = "SELECT COUNT(*) as total FROM pokemon WHERE disappear_time > UTC_TIMESTAMP()";
59
+		$result = $mysqli->query($req);
60
+		$data = $result->fetch_object();
61 61
 
62
-		$values[] 	= $data->total;
62
+		$values[] = $data->total;
63 63
 
64 64
 
65 65
 		// Lured stops
66 66
 		// -----------
67 67
 
68
-		$req 		= "SELECT COUNT(*) as total FROM pokestop WHERE lure_expiration > UTC_TIMESTAMP()";
69
-		$result 	= $mysqli->query($req);
70
-		$data 		= $result->fetch_object();
68
+		$req = "SELECT COUNT(*) as total FROM pokestop WHERE lure_expiration > UTC_TIMESTAMP()";
69
+		$result = $mysqli->query($req);
70
+		$data = $result->fetch_object();
71 71
 
72
-		$values[] 	= $data->total;
72
+		$values[] = $data->total;
73 73
 
74 74
 
75 75
 
76 76
 		// Team battle
77 77
 		// -----------
78 78
 
79
-		$req 		= "SELECT count( DISTINCT(gym_id) ) as total FROM gym";
80
-		$result 	= $mysqli->query($req);
81
-		$data 		= $result->fetch_object();
79
+		$req = "SELECT count( DISTINCT(gym_id) ) as total FROM gym";
80
+		$result = $mysqli->query($req);
81
+		$data = $result->fetch_object();
82 82
 
83
-		$values[] 	= $data->total;
83
+		$values[] = $data->total;
84 84
 
85 85
 		// Team
86 86
 		// 1 = bleu
87 87
 		// 2 = rouge
88 88
 		// 3 = jaune
89 89
 
90
-		$req	= "SELECT count( DISTINCT(gym_id) ) as total FROM gym WHERE team_id = '2'  ";
91
-		$result	= $mysqli->query($req);
92
-		$data	= $result->fetch_object();
90
+		$req = "SELECT count( DISTINCT(gym_id) ) as total FROM gym WHERE team_id = '2'  ";
91
+		$result = $mysqli->query($req);
92
+		$data = $result->fetch_object();
93 93
 
94 94
 		// Red
95 95
 		$values[] = $data->total;
96 96
 
97 97
 
98
-		$req	= "SELECT count( DISTINCT(gym_id) ) as total FROM gym WHERE team_id = '1'  ";
99
-		$result	= $mysqli->query($req);
100
-		$data	= $result->fetch_object();
98
+		$req = "SELECT count( DISTINCT(gym_id) ) as total FROM gym WHERE team_id = '1'  ";
99
+		$result = $mysqli->query($req);
100
+		$data = $result->fetch_object();
101 101
 
102 102
 		// Blue
103 103
 		$values[] = $data->total;
104 104
 
105 105
 
106
-		$req	= "SELECT count( DISTINCT(gym_id) ) as total FROM gym WHERE team_id = '3'  ";
107
-		$result	= $mysqli->query($req);
108
-		$data	= $result->fetch_object();
106
+		$req = "SELECT count( DISTINCT(gym_id) ) as total FROM gym WHERE team_id = '3'  ";
107
+		$result = $mysqli->query($req);
108
+		$data = $result->fetch_object();
109 109
 
110 110
 		// Yellow
111 111
 		$values[] = $data->total;
112 112
 
113
-		$req	= "SELECT count( DISTINCT(gym_id) ) as total FROM gym WHERE team_id = '0'  ";
114
-		$result	= $mysqli->query($req);
115
-		$data	= $result->fetch_object();
113
+		$req = "SELECT count( DISTINCT(gym_id) ) as total FROM gym WHERE team_id = '0'  ";
114
+		$result = $mysqli->query($req);
115
+		$data = $result->fetch_object();
116 116
 
117 117
 		// Neutral
118 118
 		$values[] = $data->total;
@@ -148,12 +148,12 @@  discard block
 block discarded – undo
148 148
 			}
149 149
 
150 150
 			// get last mythic pokemon
151
-			$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
151
+			$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
152 152
                         WHERE pokemon_id IN (".implode(",", $mythic_pokemons).")
153 153
                         ORDER BY last_modified DESC LIMIT 0,12";
154 154
 		} else {
155 155
 			// get last pokemon
156
-			$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";
156
+			$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";
157 157
 		}
158 158
 		$result = $mysqli->query($req);
159 159
 		while ($data = $result->fetch_object()) {
@@ -191,14 +191,14 @@  discard block
 block discarded – undo
191 191
 				    if ($iv->available) {
192 192
 					    $html .= '
193 193
 					<div class="progress" style="height: 6px; width: 80%; margin: 5px auto 0 auto;">
194
-					    <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 .'%">
195
-						<span class="sr-only">Stamina IV: '. $iv->stamina .'</span>
194
+					    <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.'%">
195
+						<span class="sr-only">Stamina IV: '. $iv->stamina.'</span>
196 196
 					    </div>
197
-					    <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 .'%">
198
-						<span class="sr-only">Attack IV: '. $iv->attack .'</span>
197
+					    <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.'%">
198
+						<span class="sr-only">Attack IV: '. $iv->attack.'</span>
199 199
 					    </div>
200
-					    <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 .'%">
201
-						<span class="sr-only">Defense IV: '. $iv->defense .'</span>
200
+					    <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.'%">
201
+						<span class="sr-only">Defense IV: '. $iv->defense.'</span>
202 202
 					    </div>
203 203
 					</div>';
204 204
 				    } else {
@@ -234,15 +234,15 @@  discard block
 block discarded – undo
234 234
 	####################################
235 235
 
236 236
 	case 'pokestop':
237
-		$req 		= "SELECT latitude, longitude, lure_expiration FROM pokestop";
238
-		$result 	= $mysqli->query($req);
237
+		$req = "SELECT latitude, longitude, lure_expiration FROM pokestop";
238
+		$result = $mysqli->query($req);
239 239
 
240
-		$i=0;
240
+		$i = 0;
241 241
 
242 242
 		while ($data = $result->fetch_object()) {
243 243
 			if ($data->lure_expiration != '') {
244 244
 				$icon = 'pokestap_lured.png';
245
-				$text = 'Lured expire @ '.date('h:i:s', strtotime($data->lure_expiration)+(3600*2)) ;
245
+				$text = 'Lured expire @ '.date('h:i:s', strtotime($data->lure_expiration) + (3600 * 2));
246 246
 			} else {
247 247
 				$icon = 'pokestap.png';
248 248
 				$text = 'Normal stop';
@@ -275,19 +275,19 @@  discard block
 block discarded – undo
275 275
 	####################################
276 276
 
277 277
 	case 'update_gym':
278
-		$teams			= new stdClass();
279
-		$teams->mystic 		= 1;
280
-		$teams->valor 		= 2;
281
-		$teams->instinct 	= 3;
278
+		$teams = new stdClass();
279
+		$teams->mystic = 1;
280
+		$teams->valor = 2;
281
+		$teams->instinct = 3;
282 282
 
283 283
 
284 284
 		foreach ($teams as $team_name => $team_id) {
285
-			$req	= "SELECT COUNT(DISTINCT(gym_id)) as total, ROUND(AVG(gym_points),0) as average_points FROM gym WHERE team_id = '".$team_id."'  ";
286
-			$result	= $mysqli->query($req);
287
-			$data	= $result->fetch_object();
285
+			$req = "SELECT COUNT(DISTINCT(gym_id)) as total, ROUND(AVG(gym_points),0) as average_points FROM gym WHERE team_id = '".$team_id."'  ";
286
+			$result = $mysqli->query($req);
287
+			$data = $result->fetch_object();
288 288
 
289
-			$return[] 	= $data->total;
290
-			$return[]	= $data->average_points;
289
+			$return[] = $data->total;
290
+			$return[] = $data->average_points;
291 291
 		}
292 292
 
293 293
 		$json = json_encode($return);
@@ -306,11 +306,11 @@  discard block
 block discarded – undo
306 306
 
307 307
 
308 308
 	case 'gym_map':
309
-		$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";
310
-		$result 	= $mysqli->query($req);
309
+		$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";
310
+		$result = $mysqli->query($req);
311 311
 
312 312
 
313
-		$i=0;
313
+		$i = 0;
314 314
 
315 315
 		while ($data = $result->fetch_object()) {
316 316
 			// Team
@@ -322,50 +322,50 @@  discard block
 block discarded – undo
322 322
 				case 0:
323 323
 					$icon	= 'map_white.png';
324 324
 					$team	= 'No Team (yet)';
325
-					$color	= 'rgba(0, 0, 0, .6)';
325
+					$color = 'rgba(0, 0, 0, .6)';
326 326
 					break;
327 327
 
328 328
 				case 1:
329 329
 					$icon	= 'map_blue_';
330 330
 					$team	= 'Team Mystic';
331
-					$color	= 'rgba(74, 138, 202, .6)';
331
+					$color = 'rgba(74, 138, 202, .6)';
332 332
 					break;
333 333
 
334 334
 				case 2:
335 335
 					$icon	= 'map_red_';
336 336
 					$team	= 'Team Valor';
337
-					$color	= 'rgba(240, 68, 58, .6)';
337
+					$color = 'rgba(240, 68, 58, .6)';
338 338
 					break;
339 339
 
340 340
 				case 3:
341 341
 					$icon	= 'map_yellow_';
342 342
 					$team	= 'Team Instinct';
343
-					$color	= 'rgba(254, 217, 40, .6)';
343
+					$color = 'rgba(254, 217, 40, .6)';
344 344
 					break;
345 345
 			}
346 346
 
347 347
 			// Set gym level
348
-			$data->gym_level=0;
348
+			$data->gym_level = 0;
349 349
 			if ($data->gym_points < 2000) {
350
-				$data->gym_level=1;
350
+				$data->gym_level = 1;
351 351
 			} elseif ($data->gym_points < 4000) {
352
-				$data->gym_level=2;
352
+				$data->gym_level = 2;
353 353
 			} elseif ($data->gym_points < 8000) {
354
-				$data->gym_level=3;
354
+				$data->gym_level = 3;
355 355
 			} elseif ($data->gym_points < 12000) {
356
-				$data->gym_level=4;
356
+				$data->gym_level = 4;
357 357
 			} elseif ($data->gym_points < 16000) {
358
-				$data->gym_level=5;
358
+				$data->gym_level = 5;
359 359
 			} elseif ($data->gym_points < 20000) {
360
-				$data->gym_level=6;
360
+				$data->gym_level = 6;
361 361
 			} elseif ($data->gym_points < 30000) {
362
-				$data->gym_level=7;
362
+				$data->gym_level = 7;
363 363
 			} elseif ($data->gym_points < 40000) {
364
-				$data->gym_level=8;
364
+				$data->gym_level = 8;
365 365
 			} elseif ($data->gym_points < 50000) {
366
-				$data->gym_level=9;
366
+				$data->gym_level = 9;
367 367
 			} else {
368
-				$data->gym_level=10;
368
+				$data->gym_level = 10;
369 369
 			}
370 370
 
371 371
 			## I know, I revert commit 6e8d2e7 from @kiralydavid but the way it was done broke the page.
@@ -416,8 +416,8 @@  discard block
 block discarded – undo
416 416
 
417 417
 	case 'gym_defenders':
418 418
 		$gym_id = $mysqli->real_escape_string($_GET['gym_id']);
419
-		$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."'";
420
-		$result 	= $mysqli->query($req);
419
+		$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."'";
420
+		$result = $mysqli->query($req);
421 421
 		$gymData['gymDetails']['gymInfos'] = false;
422 422
 		while ($data = $result->fetch_object()) {
423 423
 			$gymData['gymDetails']['gymInfos']['name'] = $data->name;
@@ -433,31 +433,31 @@  discard block
 block discarded – undo
433 433
 			$gymData['gymDetails']['gymInfos']['team'] = $data->team;
434 434
 			$gymData['gymDetails']['gymInfos']['guardPokemonId'] = $data->guard_pokemon_id;
435 435
 			if ($data->points < 2000) {
436
-				$gymData['gymDetails']['gymInfos']['level']=1;
436
+				$gymData['gymDetails']['gymInfos']['level'] = 1;
437 437
 			} elseif ($data->points < 4000) {
438
-				$gymData['gymDetails']['gymInfos']['level']=2;
438
+				$gymData['gymDetails']['gymInfos']['level'] = 2;
439 439
 			} elseif ($data->points < 8000) {
440
-				$gymData['gymDetails']['gymInfos']['level']=3;
440
+				$gymData['gymDetails']['gymInfos']['level'] = 3;
441 441
 			} elseif ($data->points < 12000) {
442
-				$gymData['gymDetails']['gymInfos']['level']=4;
442
+				$gymData['gymDetails']['gymInfos']['level'] = 4;
443 443
 			} elseif ($data->points < 16000) {
444
-				$gymData['gymDetails']['gymInfos']['level']=5;
444
+				$gymData['gymDetails']['gymInfos']['level'] = 5;
445 445
 			} elseif ($data->points < 20000) {
446
-				$gymData['gymDetails']['gymInfos']['level']=6;
446
+				$gymData['gymDetails']['gymInfos']['level'] = 6;
447 447
 			} elseif ($data->points < 30000) {
448
-				$gymData['gymDetails']['gymInfos']['level']=7;
448
+				$gymData['gymDetails']['gymInfos']['level'] = 7;
449 449
 			} elseif ($data->points < 40000) {
450
-				$gymData['gymDetails']['gymInfos']['level']=8;
450
+				$gymData['gymDetails']['gymInfos']['level'] = 8;
451 451
 			} elseif ($data->points < 50000) {
452
-				$gymData['gymDetails']['gymInfos']['level']=9;
452
+				$gymData['gymDetails']['gymInfos']['level'] = 9;
453 453
 			} else {
454
-				$gymData['gymDetails']['gymInfos']['level']=10;
454
+				$gymData['gymDetails']['gymInfos']['level'] = 10;
455 455
 			}
456 456
 		}
457 457
 		//print_r($gymData);
458
-		$req 		= "SELECT * FROM gympokemon inner join gymmember on gympokemon.pokemon_uid=gymmember.pokemon_uid where gym_id='".$gym_id."' ORDER BY cp DESC";
459
-		$result 	= $mysqli->query($req);
460
-		$i=0;
458
+		$req = "SELECT * FROM gympokemon inner join gymmember on gympokemon.pokemon_uid=gymmember.pokemon_uid where gym_id='".$gym_id."' ORDER BY cp DESC";
459
+		$result = $mysqli->query($req);
460
+		$i = 0;
461 461
 
462 462
 
463 463
 
@@ -475,15 +475,15 @@  discard block
 block discarded – undo
475 475
 					</a>
476 476
 					<p class="pkmn-name">'.$data->cp.'</p>
477 477
 					<div class="progress" style="height: 4px; width: 40px; margin-bottom: 10px; margin-top: 2px; margin-left: auto; margin-right: auto">
478
-						<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).'%">
478
+						<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).'%">
479 479
 							<span class="sr-only">Stamina IV: '.$data->iv_stamina.'</span>
480 480
 						</div>
481 481
 
482
-						<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).'%">
482
+						<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).'%">
483 483
 							<span class="sr-only">Attack IV: '.$data->iv_attack.'</span>
484 484
 						</div>
485 485
 
486
-						<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).'%">
486
+						<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).'%">
487 487
 							<span class="sr-only">Defense IV: '.$data->iv_defense.'</span>
488 488
 						</div>
489 489
 					</div>
@@ -513,16 +513,16 @@  discard block
 block discarded – undo
513 513
 		$name = "";
514 514
 		$page = "0";
515 515
 		$where = "";
516
-		$order="";
517
-		$team=0;
518
-		$ranking=0;
516
+		$order = "";
517
+		$team = 0;
518
+		$ranking = 0;
519 519
 		if (isset($_GET['name'])) {
520 520
 			$trainer_name = mysqli_real_escape_string($mysqli, $_GET['name']);
521 521
 			$where = " HAVING name LIKE '%".$trainer_name."%'";
522 522
 		}
523
-		if (isset($_GET['team']) && $_GET['team']!=0) {
523
+		if (isset($_GET['team']) && $_GET['team'] != 0) {
524 524
 			$team = mysqli_real_escape_string($mysqli, $_GET['team']);
525
-			$where .= ($where==""?" HAVING":"AND ")." team = ".$team;
525
+			$where .= ($where == "" ? " HAVING" : "AND ")." team = ".$team;
526 526
 		}
527 527
 		if (isset($_GET['page'])) {
528 528
 			$page = mysqli_real_escape_string($mysqli, $_GET['page']);
@@ -533,16 +533,16 @@  discard block
 block discarded – undo
533 533
 
534 534
 		switch ($ranking) {
535 535
 			case 1:
536
-				$order=" ORDER BY active DESC ";
536
+				$order = " ORDER BY active DESC ";
537 537
 				break;
538 538
 			case 2:
539
-				$order=" ORDER BY maxCp DESC ";
539
+				$order = " ORDER BY maxCp DESC ";
540 540
 				break;
541 541
 			default:
542
-				$order=" ORDER BY level DESC, active DESC ";
542
+				$order = " ORDER BY level DESC, active DESC ";
543 543
 		}
544 544
 
545
-		$limit = " LIMIT ".($page*10).",10 ";
545
+		$limit = " LIMIT ".($page * 10).",10 ";
546 546
 
547 547
 
548 548
 		$req = "SELECT trainer.*, count(actives_pokemons.trainer_name) as active, max(actives_pokemons.cp) as maxCp ".
@@ -561,7 +561,7 @@  discard block
 block discarded – undo
561 561
 			$reqRanking = "SELECT count(1) as rank FROM trainer where trainer.level >= ".$trainer->level;
562 562
 			$resultRanking = $mysqli->query($reqRanking);
563 563
 			while ($data = $resultRanking->fetch_object()) {
564
-				$trainer->rank = $data->rank ;
564
+				$trainer->rank = $data->rank;
565 565
 			}
566 566
 			$req = "(SELECT DISTINCT gympokemon.pokemon_id, gympokemon.pokemon_uid, gympokemon.cp, gympokemon.trainer_name, gympokemon.iv_defense, gympokemon.iv_stamina, gympokemon.iv_attack, filtered_gymmember.gym_id, '1' as active ".
567 567
 				"FROM gympokemon INNER JOIN ".
@@ -571,7 +571,7 @@  discard block
 block discarded – undo
571 571
 
572 572
 			$resultPkms = $mysqli->query($req);
573 573
 			$trainer->pokemons = array();
574
-			$active_gyms=0;
574
+			$active_gyms = 0;
575 575
 			$pkmCount = 0;
576 576
 			while ($resultPkms && $dataPkm = $resultPkms->fetch_object()) {
577 577
 				$active_gyms++;
Please login to merge, or discard this patch.