Failed Conditions
Pull Request — master (#162)
by PoUpA
02:17
created
core/process/aru.php 1 patch
Spacing   +105 added lines, -105 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,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;
@@ -152,12 +152,12 @@  discard block
 block discarded – undo
152 152
 			}
153 153
 
154 154
 			// get last mythic pokemon
155
-			$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
155
+			$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
156 156
                         WHERE pokemon_id IN (".implode(",", $mythic_pokemons).")
157 157
                         ORDER BY last_modified DESC LIMIT 0,12";
158 158
 		} else {
159 159
 			// get last pokemon
160
-			$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";
160
+			$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";
161 161
 		}
162 162
 		$result = $mysqli->query($req);
163 163
 		while ($data = $result->fetch_object()) {
@@ -195,14 +195,14 @@  discard block
 block discarded – undo
195 195
 					if ($iv->available) {
196 196
 						$html .= '
197 197
 					<div class="progress" style="height: 6px; width: 80%; margin: 5px auto 0 auto;">
198
-					    <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 .'%">
199
-						<span class="sr-only">Stamina IV: '. $iv->stamina .'</span>
198
+					    <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.'%">
199
+						<span class="sr-only">Stamina IV: '. $iv->stamina.'</span>
200 200
 					    </div>
201
-					    <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 .'%">
202
-						<span class="sr-only">Attack IV: '. $iv->attack .'</span>
201
+					    <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.'%">
202
+						<span class="sr-only">Attack IV: '. $iv->attack.'</span>
203 203
 					    </div>
204
-					    <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 .'%">
205
-						<span class="sr-only">Defense IV: '. $iv->defense .'</span>
204
+					    <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.'%">
205
+						<span class="sr-only">Defense IV: '. $iv->defense.'</span>
206 206
 					    </div>
207 207
 					</div>';
208 208
 					} else {
@@ -238,15 +238,15 @@  discard block
 block discarded – undo
238 238
 	####################################
239 239
 
240 240
 	case 'pokestop':
241
-		$req 		= "SELECT latitude, longitude, lure_expiration FROM pokestop";
242
-		$result 	= $mysqli->query($req);
241
+		$req = "SELECT latitude, longitude, lure_expiration FROM pokestop";
242
+		$result = $mysqli->query($req);
243 243
 
244
-		$i=0;
244
+		$i = 0;
245 245
 
246 246
 		while ($data = $result->fetch_object()) {
247 247
 			if ($data->lure_expiration != '') {
248 248
 				$icon = 'pokestap_lured.png';
249
-				$text = 'Lured expire @ '.date('h:i:s', strtotime($data->lure_expiration)+(3600*2)) ;
249
+				$text = 'Lured expire @ '.date('h:i:s', strtotime($data->lure_expiration) + (3600 * 2));
250 250
 			} else {
251 251
 				$icon = 'pokestap.png';
252 252
 				$text = 'Normal stop';
@@ -279,19 +279,19 @@  discard block
 block discarded – undo
279 279
 	####################################
280 280
 
281 281
 	case 'update_gym':
282
-		$teams			= new stdClass();
283
-		$teams->mystic 		= 1;
284
-		$teams->valor 		= 2;
285
-		$teams->instinct 	= 3;
282
+		$teams = new stdClass();
283
+		$teams->mystic = 1;
284
+		$teams->valor = 2;
285
+		$teams->instinct = 3;
286 286
 
287 287
 
288 288
 		foreach ($teams as $team_name => $team_id) {
289
-			$req	= "SELECT COUNT(DISTINCT(gym_id)) as total, ROUND(AVG(gym_points),0) as average_points FROM gym WHERE team_id = '".$team_id."'  ";
290
-			$result	= $mysqli->query($req);
291
-			$data	= $result->fetch_object();
289
+			$req = "SELECT COUNT(DISTINCT(gym_id)) as total, ROUND(AVG(gym_points),0) as average_points FROM gym WHERE team_id = '".$team_id."'  ";
290
+			$result = $mysqli->query($req);
291
+			$data = $result->fetch_object();
292 292
 
293
-			$return[] 	= $data->total;
294
-			$return[]	= $data->average_points;
293
+			$return[] = $data->total;
294
+			$return[] = $data->average_points;
295 295
 		}
296 296
 
297 297
 		$json = json_encode($return);
@@ -310,11 +310,11 @@  discard block
 block discarded – undo
310 310
 
311 311
 
312 312
 	case 'gym_map':
313
-		$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";
314
-		$result 	= $mysqli->query($req);
313
+		$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";
314
+		$result = $mysqli->query($req);
315 315
 
316 316
 
317
-		$i=0;
317
+		$i = 0;
318 318
 
319 319
 		while ($data = $result->fetch_object()) {
320 320
 			// Team
@@ -326,50 +326,50 @@  discard block
 block discarded – undo
326 326
 				case 0:
327 327
 					$icon	= 'map_white.png';
328 328
 					$team	= 'No Team (yet)';
329
-					$color	= 'rgba(0, 0, 0, .6)';
329
+					$color = 'rgba(0, 0, 0, .6)';
330 330
 					break;
331 331
 
332 332
 				case 1:
333 333
 					$icon	= 'map_blue_';
334 334
 					$team	= 'Team Mystic';
335
-					$color	= 'rgba(74, 138, 202, .6)';
335
+					$color = 'rgba(74, 138, 202, .6)';
336 336
 					break;
337 337
 
338 338
 				case 2:
339 339
 					$icon	= 'map_red_';
340 340
 					$team	= 'Team Valor';
341
-					$color	= 'rgba(240, 68, 58, .6)';
341
+					$color = 'rgba(240, 68, 58, .6)';
342 342
 					break;
343 343
 
344 344
 				case 3:
345 345
 					$icon	= 'map_yellow_';
346 346
 					$team	= 'Team Instinct';
347
-					$color	= 'rgba(254, 217, 40, .6)';
347
+					$color = 'rgba(254, 217, 40, .6)';
348 348
 					break;
349 349
 			}
350 350
 
351 351
 			// Set gym level
352
-			$data->gym_level=0;
352
+			$data->gym_level = 0;
353 353
 			if ($data->gym_points < 2000) {
354
-				$data->gym_level=1;
354
+				$data->gym_level = 1;
355 355
 			} elseif ($data->gym_points < 4000) {
356
-				$data->gym_level=2;
356
+				$data->gym_level = 2;
357 357
 			} elseif ($data->gym_points < 8000) {
358
-				$data->gym_level=3;
358
+				$data->gym_level = 3;
359 359
 			} elseif ($data->gym_points < 12000) {
360
-				$data->gym_level=4;
360
+				$data->gym_level = 4;
361 361
 			} elseif ($data->gym_points < 16000) {
362
-				$data->gym_level=5;
362
+				$data->gym_level = 5;
363 363
 			} elseif ($data->gym_points < 20000) {
364
-				$data->gym_level=6;
364
+				$data->gym_level = 6;
365 365
 			} elseif ($data->gym_points < 30000) {
366
-				$data->gym_level=7;
366
+				$data->gym_level = 7;
367 367
 			} elseif ($data->gym_points < 40000) {
368
-				$data->gym_level=8;
368
+				$data->gym_level = 8;
369 369
 			} elseif ($data->gym_points < 50000) {
370
-				$data->gym_level=9;
370
+				$data->gym_level = 9;
371 371
 			} else {
372
-				$data->gym_level=10;
372
+				$data->gym_level = 10;
373 373
 			}
374 374
 
375 375
 			## I know, I revert commit 6e8d2e7 from @kiralydavid but the way it was done broke the page.
@@ -420,8 +420,8 @@  discard block
 block discarded – undo
420 420
 
421 421
 	case 'gym_defenders':
422 422
 		$gym_id = $mysqli->real_escape_string($_GET['gym_id']);
423
-		$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."'";
424
-		$result 	= $mysqli->query($req);
423
+		$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."'";
424
+		$result = $mysqli->query($req);
425 425
 		$gymData['gymDetails']['gymInfos'] = false;
426 426
 		while ($data = $result->fetch_object()) {
427 427
 			$gymData['gymDetails']['gymInfos']['name'] = $data->name;
@@ -437,31 +437,31 @@  discard block
 block discarded – undo
437 437
 			$gymData['gymDetails']['gymInfos']['team'] = $data->team;
438 438
 			$gymData['gymDetails']['gymInfos']['guardPokemonId'] = $data->guard_pokemon_id;
439 439
 			if ($data->points < 2000) {
440
-				$gymData['gymDetails']['gymInfos']['level']=1;
440
+				$gymData['gymDetails']['gymInfos']['level'] = 1;
441 441
 			} elseif ($data->points < 4000) {
442
-				$gymData['gymDetails']['gymInfos']['level']=2;
442
+				$gymData['gymDetails']['gymInfos']['level'] = 2;
443 443
 			} elseif ($data->points < 8000) {
444
-				$gymData['gymDetails']['gymInfos']['level']=3;
444
+				$gymData['gymDetails']['gymInfos']['level'] = 3;
445 445
 			} elseif ($data->points < 12000) {
446
-				$gymData['gymDetails']['gymInfos']['level']=4;
446
+				$gymData['gymDetails']['gymInfos']['level'] = 4;
447 447
 			} elseif ($data->points < 16000) {
448
-				$gymData['gymDetails']['gymInfos']['level']=5;
448
+				$gymData['gymDetails']['gymInfos']['level'] = 5;
449 449
 			} elseif ($data->points < 20000) {
450
-				$gymData['gymDetails']['gymInfos']['level']=6;
450
+				$gymData['gymDetails']['gymInfos']['level'] = 6;
451 451
 			} elseif ($data->points < 30000) {
452
-				$gymData['gymDetails']['gymInfos']['level']=7;
452
+				$gymData['gymDetails']['gymInfos']['level'] = 7;
453 453
 			} elseif ($data->points < 40000) {
454
-				$gymData['gymDetails']['gymInfos']['level']=8;
454
+				$gymData['gymDetails']['gymInfos']['level'] = 8;
455 455
 			} elseif ($data->points < 50000) {
456
-				$gymData['gymDetails']['gymInfos']['level']=9;
456
+				$gymData['gymDetails']['gymInfos']['level'] = 9;
457 457
 			} else {
458
-				$gymData['gymDetails']['gymInfos']['level']=10;
458
+				$gymData['gymDetails']['gymInfos']['level'] = 10;
459 459
 			}
460 460
 		}
461 461
 		//print_r($gymData);
462
-		$req 		= "SELECT * FROM gympokemon inner join gymmember on gympokemon.pokemon_uid=gymmember.pokemon_uid where gym_id='".$gym_id."' ORDER BY cp DESC";
463
-		$result 	= $mysqli->query($req);
464
-		$i=0;
462
+		$req = "SELECT * FROM gympokemon inner join gymmember on gympokemon.pokemon_uid=gymmember.pokemon_uid where gym_id='".$gym_id."' ORDER BY cp DESC";
463
+		$result = $mysqli->query($req);
464
+		$i = 0;
465 465
 
466 466
 
467 467
 
@@ -479,15 +479,15 @@  discard block
 block discarded – undo
479 479
 					</a>
480 480
 					<p class="pkmn-name">'.$data->cp.'</p>
481 481
 					<div class="progress" style="height: 4px; width: 40px; margin-bottom: 10px; margin-top: 2px; margin-left: auto; margin-right: auto">
482
-						<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).'%">
482
+						<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).'%">
483 483
 							<span class="sr-only">Stamina IV: '.$data->iv_stamina.'</span>
484 484
 						</div>
485 485
 
486
-						<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).'%">
486
+						<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).'%">
487 487
 							<span class="sr-only">Attack IV: '.$data->iv_attack.'</span>
488 488
 						</div>
489 489
 
490
-						<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).'%">
490
+						<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).'%">
491 491
 							<span class="sr-only">Defense IV: '.$data->iv_defense.'</span>
492 492
 						</div>
493 493
 					</div>
@@ -517,16 +517,16 @@  discard block
 block discarded – undo
517 517
 		$name = "";
518 518
 		$page = "0";
519 519
 		$where = "";
520
-		$order="";
521
-		$team=0;
522
-		$ranking=0;
520
+		$order = "";
521
+		$team = 0;
522
+		$ranking = 0;
523 523
 		if (isset($_GET['name'])) {
524 524
 			$trainer_name = mysqli_real_escape_string($mysqli, $_GET['name']);
525 525
 			$where = " HAVING name LIKE '%".$trainer_name."%'";
526 526
 		}
527
-		if (isset($_GET['team']) && $_GET['team']!=0) {
527
+		if (isset($_GET['team']) && $_GET['team'] != 0) {
528 528
 			$team = mysqli_real_escape_string($mysqli, $_GET['team']);
529
-			$where .= ($where==""?" HAVING":"AND ")." team = ".$team;
529
+			$where .= ($where == "" ? " HAVING" : "AND ")." team = ".$team;
530 530
 		}
531 531
 		if (isset($_GET['page'])) {
532 532
 			$page = mysqli_real_escape_string($mysqli, $_GET['page']);
@@ -537,16 +537,16 @@  discard block
 block discarded – undo
537 537
 
538 538
 		switch ($ranking) {
539 539
 			case 1:
540
-				$order=" ORDER BY active DESC ";
540
+				$order = " ORDER BY active DESC ";
541 541
 				break;
542 542
 			case 2:
543
-				$order=" ORDER BY maxCp DESC ";
543
+				$order = " ORDER BY maxCp DESC ";
544 544
 				break;
545 545
 			default:
546
-				$order=" ORDER BY level DESC, active DESC ";
546
+				$order = " ORDER BY level DESC, active DESC ";
547 547
 		}
548 548
 
549
-		$limit = " LIMIT ".($page*10).",10 ";
549
+		$limit = " LIMIT ".($page * 10).",10 ";
550 550
 
551 551
 
552 552
 		$req = "SELECT trainer.*, count(actives_pokemons.trainer_name) as active, max(actives_pokemons.cp) as maxCp ".
@@ -565,7 +565,7 @@  discard block
 block discarded – undo
565 565
 			$reqRanking = "SELECT count(1) as rank FROM trainer where trainer.level >= ".$trainer->level;
566 566
 			$resultRanking = $mysqli->query($reqRanking);
567 567
 			while ($data = $resultRanking->fetch_object()) {
568
-				$trainer->rank = $data->rank ;
568
+				$trainer->rank = $data->rank;
569 569
 			}
570 570
 			$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 ".
571 571
 				"FROM gympokemon INNER JOIN ".
@@ -575,7 +575,7 @@  discard block
 block discarded – undo
575 575
 
576 576
 			$resultPkms = $mysqli->query($req);
577 577
 			$trainer->pokemons = array();
578
-			$active_gyms=0;
578
+			$active_gyms = 0;
579 579
 			$pkmCount = 0;
580 580
 			while ($resultPkms && $dataPkm = $resultPkms->fetch_object()) {
581 581
 				$active_gyms++;
@@ -603,9 +603,9 @@  discard block
 block discarded – undo
603 603
 
604 604
 	case 'pokemon_slider_init':
605 605
 
606
-		$req 		= "SELECT MIN(pokemon.disappear_time) as min, MAX(pokemon.disappear_time) as max from pokemon";
606
+		$req = "SELECT MIN(pokemon.disappear_time) as min, MAX(pokemon.disappear_time) as max from pokemon";
607 607
 		$result 	= $mysqli->query($req);
608
-		$data 		= $result->fetch_object();
608
+		$data = $result->fetch_object();
609 609
 		$bounds 	= $data;
610 610
 
611 611
 		header('Content-Type: application/json');
@@ -618,19 +618,19 @@  discard block
 block discarded – undo
618 618
 
619 619
 	case 'pokemon_heatmap_points':
620 620
 
621
-		$json="";
622
-		if (isset($_GET['start'])&&isset($_GET['end']) && isset($_GET['pokemon_id'])) {
623
-			$start = Date("Y-m-d H:i",(int)$_GET['start']);
624
-			$end = Date("Y-m-d H:i",(int)$_GET['end']);
621
+		$json = "";
622
+		if (isset($_GET['start']) && isset($_GET['end']) && isset($_GET['pokemon_id'])) {
623
+			$start = Date("Y-m-d H:i", (int) $_GET['start']);
624
+			$end = Date("Y-m-d H:i", (int) $_GET['end']);
625 625
 			$pokemon_id = mysqli_real_escape_string($mysqli, $_GET['pokemon_id']);
626 626
 			$where = " WHERE pokemon.pokemon_id = ".$pokemon_id." "
627 627
 					. "AND pokemon.disappear_time BETWEEN '".$start."' AND '".$end."'";
628 628
 
629 629
 			$req 		= "SELECT latitude, longitude FROM pokemon".$where;
630
-			$result 	= $mysqli->query($req);
630
+			$result = $mysqli->query($req);
631 631
 			$points = array();
632 632
 			while ($result && $data = $result->fetch_object()) {
633
-				$points[] 	= $data;
633
+				$points[] = $data;
634 634
 			}
635 635
 
636 636
 			$json = json_encode($points);
Please login to merge, or discard this patch.
core/cron/captcha.cron.php 1 patch
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -5,45 +5,45 @@  discard block
 block discarded – undo
5 5
 // Total lured
6 6
 // -----------------------------------------------------------------------------------------------------------
7 7
 
8
-$captcha_file	= SYS_PATH.'/core/json/captcha.stats.json';
8
+$captcha_file = SYS_PATH.'/core/json/captcha.stats.json';
9 9
 if (is_file($captcha_file)) {
10
-	$capdatas	= json_decode(file_get_contents($captcha_file), true);
10
+	$capdatas = json_decode(file_get_contents($captcha_file), true);
11 11
 }
12 12
 
13 13
 
14 14
 $variables_secret = SYS_PATH.'/core/json/variables.secret.json';
15 15
 $config_secret = json_decode(file_get_contents($variables_secret));
16 16
 
17
-if ($config_secret->captcha_key=="") {
17
+if ($config_secret->captcha_key == "") {
18 18
 	$captcha['timestamp'] = $timestamp;
19 19
 	// get amount of accounts requiring a captcha
20 20
 	$req = "SELECT COUNT(*) as total "
21 21
 			. "FROM workerstatus WHERE message LIKE '%encountering a captcha%' "
22 22
 			. "AND last_modified >= UTC_TIMESTAMP() - INTERVAL 60 SECOND";
23
-	$result 	= $mysqli->query($req);
24
-	$data 		= $result->fetch_object();
23
+	$result = $mysqli->query($req);
24
+	$data = $result->fetch_object();
25 25
 	$captcha['captcha_accs'] = $data->total;
26 26
 	// Add the datas in file
27
-	$capdatas[] 	= $captcha;
27
+	$capdatas[] = $captcha;
28 28
 } else {
29 29
 	if (!empty($capdatas)) {
30 30
 		$lastCaptcha = array_pop($capdatas);
31 31
 	} else {
32
-		$lastCaptcha["timestamp"]=strtotime("-7 days", strtotime(date("Y-m-d")));
32
+		$lastCaptcha["timestamp"] = strtotime("-7 days", strtotime(date("Y-m-d")));
33 33
 	}
34 34
 	$lastCaptchaDate = date("Y-m-d", $lastCaptcha["timestamp"]);
35 35
 	$startTime = strtotime($lastCaptchaDate);
36
-	$endTime = strtotime(date("Y-m-d"))+date("Z");;
36
+	$endTime = strtotime(date("Y-m-d")) + date("Z"); ;
37 37
 	$timeDiff = abs($endTime - $startTime);
38
-	$numberDays = intval($timeDiff/86400) ;  // 86400 seconds in one day
39
-	if ($numberDays>7) {
40
-		$numberDays=7;
38
+	$numberDays = intval($timeDiff / 86400); // 86400 seconds in one day
39
+	if ($numberDays > 7) {
40
+		$numberDays = 7;
41 41
 	}
42
-	while ($numberDays>=0) {
43
-		$day = $endTime-($numberDays*86400);
42
+	while ($numberDays >= 0) {
43
+		$day = $endTime - ($numberDays * 86400);
44 44
 		$captchaUrl =
45
-				"http://2captcha.com/res.php?key=" .
46
-				$config_secret->captcha_key . "&action=getstats&date=" . date("Y-m-d", $day);
45
+				"http://2captcha.com/res.php?key=".
46
+				$config_secret->captcha_key."&action=getstats&date=".date("Y-m-d", $day);
47 47
 
48 48
 		$ch = curl_init();
49 49
 		curl_setopt($ch, CURLOPT_URL, $captchaUrl);
@@ -65,18 +65,18 @@  discard block
 block discarded – undo
65 65
 		$capXml = simplexml_load_string($fileContents);
66 66
 
67 67
 		foreach ($capXml as $key => $value) {
68
-			if (	($numberDays==0
69
-				&& ((int)$value->Attributes()->hour >= (int)date("H", $lastCaptcha["timestamp"])
70
-				&& ((int)$value->Attributes()->hour <= (int)date("H")))
71
-				) || $numberDays>0) {
68
+			if (($numberDays == 0
69
+				&& ((int) $value->Attributes()->hour >= (int) date("H", $lastCaptcha["timestamp"])
70
+				&& ((int) $value->Attributes()->hour <= (int) date("H")))
71
+				) || $numberDays > 0) {
72 72
 				$captcha['timestamp'] =
73
-						strtotime(date("Y-m-d", $day) . " " . $value->Attributes()->hour . ":00")-date("Z");
74
-				$captcha['captcha_accs'] = (string)$value->volume;
75
-				$capdatas[] 	= $captcha;
73
+						strtotime(date("Y-m-d", $day)." ".$value->Attributes()->hour.":00") - date("Z");
74
+				$captcha['captcha_accs'] = (string) $value->volume;
75
+				$capdatas[] = $captcha;
76 76
 			}
77 77
 		}
78 78
 		--$numberDays;
79 79
 	}
80 80
 }
81
-$json 		= json_encode($capdatas);
81
+$json = json_encode($capdatas);
82 82
 file_put_contents($captcha_file, $json);
Please login to merge, or discard this patch.
index.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@
 block discarded – undo
20 20
 		<link href="https://fonts.googleapis.com/css?family=Lato:400,300,700" rel="stylesheet" type="text/css">
21 21
 		<link href="core/css/font-awesome.min.css" rel="stylesheet">
22 22
 		<link href="<?php auto_ver('core/css/style.css'); ?>" rel="stylesheet">
23
-		<?php if($page=="pokemon"){ ?>
23
+		<?php if ($page == "pokemon") { ?>
24 24
 			<link href="<?php auto_ver('core/css/classic-min.css'); ?>" rel="stylesheet">
25 25
 		<?php } ?>
26 26
 	</head>
Please login to merge, or discard this patch.