Failed Conditions
Pull Request — master (#353)
by Florian
02:31
created
core/cron/pokemon.cron.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@
 block discarded – undo
22 22
 $rarityarray = array();
23 23
 foreach ($counts as $poke_id => $total) {
24 24
 	$rarity = $pokemons->pokemon->$poke_id->rarity;
25
-	isset($rarityarray[$rarity]) ? $rarityarray[$rarity]+=$total : $rarityarray[$rarity]=$total;
25
+	isset($rarityarray[$rarity]) ? $rarityarray[$rarity] += $total : $rarityarray[$rarity] = $total;
26 26
 }
27 27
 
28 28
 // Set amount of Pokemon for each rarity to 0 if there weren't any at that time
Please login to merge, or discard this patch.
core/cron/crontabs.include.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
 // Load Query Manager
30 30
 // ###################
31 31
 
32
-include_once __DIR__ . '/../process/queries/QueryManager.php';
32
+include_once __DIR__.'/../process/queries/QueryManager.php';
33 33
 $manager = QueryManager::current();
34 34
 
35 35
 
@@ -51,10 +51,10 @@  discard block
 block discarded – undo
51 51
 	$pokedatas	= json_decode(file_get_contents($pokemonstats_file), true);
52 52
 }
53 53
 if (is_file($pokedex_counts_file)) {
54
-	$pokecountdatas	= json_decode(file_get_contents($pokedex_counts_file), true);
54
+	$pokecountdatas = json_decode(file_get_contents($pokedex_counts_file), true);
55 55
 }
56 56
 if (is_file($pokedex_raids_file)) {
57
-	$raiddatas	= json_decode(file_get_contents($pokedex_raids_file), true);
57
+	$raiddatas = json_decode(file_get_contents($pokedex_raids_file), true);
58 58
 }
59 59
 
60 60
 
Please login to merge, or discard this patch.
core/js/trainer.graph.js.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@
 block discarded – undo
28 28
 $trainer_lvl = [];
29 29
 # For all 3 teams
30 30
 for ($teamid = 1; $teamid <= 3; $teamid++) {
31
-    $data = $manager->getTrainerLevelCount($teamid);
31
+	$data = $manager->getTrainerLevelCount($teamid);
32 32
 	$trainer_lvl[$teamid] = $data;
33 33
 }
34 34
 
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@
 block discarded – undo
20 20
 // Load Query Manager
21 21
 // ###################
22 22
 
23
-include_once __DIR__ . '/../process/queries/QueryManager.php';
23
+include_once __DIR__.'/../process/queries/QueryManager.php';
24 24
 $manager = QueryManager::current();
25 25
 
26 26
 # Chart Graph datas	 
Please login to merge, or discard this patch.
core/process/data.loader.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
 // Load Query Manager
70 70
 // ###################
71 71
 
72
-include_once __DIR__ . '/queries/QueryManager.php';
72
+include_once __DIR__.'/queries/QueryManager.php';
73 73
 $manager = QueryManager::current();
74 74
 
75 75
 
@@ -268,7 +268,7 @@  discard block
 block discarded – undo
268 268
 
269 269
 
270 270
 				// Gym owned and average points
271
-				$data	= $manager->getOwnedAndPoints($team_values->id);
271
+				$data = $manager->getOwnedAndPoints($team_values->id);
272 272
 
273 273
 				$teams->$team_key->gym_owned = $data->total;
274 274
 				$teams->$team_key->average = $data->average_points;
Please login to merge, or discard this patch.
core/process/aru.php 2 patches
Spacing   +46 added lines, -46 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
 // Load Query Manager
41 41
 // ###################
42 42
 
43
-include_once __DIR__ . '/queries/QueryManager.php';
43
+include_once __DIR__.'/queries/QueryManager.php';
44 44
 $manager = QueryManager::current();
45 45
 
46 46
 $request = "";
@@ -161,10 +161,10 @@  discard block
 block discarded – undo
161 161
 					}
162 162
 
163 163
 					$html = '
164
-                    <div class="col-md-1 col-xs-4 pokemon-single" data-pokeid="' . $pokeid . '" data-pokeuid="' . $pokeuid . '" style="display: none;">
165
-                    <a href="pokemon/' . $pokeid . '"><img src="' . $pokemons->pokemon->$pokeid->img . '" alt="' . $pokemons->pokemon->$pokeid->name . '" class="img-responsive"></a>
166
-                    <a href="pokemon/' . $pokeid . '"><p class="pkmn-name">' . $pokemons->pokemon->$pokeid->name . '</p></a>
167
-                    <a href="' . $location_link . '" target="_blank">
164
+                    <div class="col-md-1 col-xs-4 pokemon-single" data-pokeid="' . $pokeid.'" data-pokeuid="'.$pokeuid.'" style="display: none;">
165
+                    <a href="pokemon/' . $pokeid.'"><img src="'.$pokemons->pokemon->$pokeid->img.'" alt="'.$pokemons->pokemon->$pokeid->name.'" class="img-responsive"></a>
166
+                    <a href="pokemon/' . $pokeid.'"><p class="pkmn-name">'.$pokemons->pokemon->$pokeid->name.'</p></a>
167
+                    <a href="' . $location_link.'" target="_blank">
168 168
                         <small class="pokemon-timer">00:00:00</small>
169 169
                     </a>';
170 170
 					if ($config->system->recents_encounter_details) {
@@ -172,50 +172,50 @@  discard block
 block discarded – undo
172 172
 							if ($config->system->iv_numbers) {
173 173
 								$html .= '
174 174
                                 <div class="progress" style="height: 15px; margin-bottom: 0">
175
-                                    <div title="' . $locales->IV_ATTACK . ': ' . $encdetails->attack . '" class="progress-bar progress-bar-danger" role="progressbar" aria-valuenow="' . $encdetails->attack . '" aria-valuemin="0" aria-valuemax="45" style="width: ' . (100 / 3) . '%; line-height: 16px">
176
-                                        <span class="sr-only">' . $locales->IV_ATTACK . ': ' . $encdetails->attack . '</span>' . $encdetails->attack . '
175
+                                    <div title="' . $locales->IV_ATTACK.': '.$encdetails->attack.'" class="progress-bar progress-bar-danger" role="progressbar" aria-valuenow="'.$encdetails->attack.'" aria-valuemin="0" aria-valuemax="45" style="width: '.(100 / 3).'%; line-height: 16px">
176
+                                        <span class="sr-only">' . $locales->IV_ATTACK.': '.$encdetails->attack.'</span>'.$encdetails->attack.'
177 177
                                     </div>
178
-                                    <div title="' . $locales->IV_DEFENSE . ': ' . $encdetails->defense . '" class="progress-bar progress-bar-info" role="progressbar" aria-valuenow="' . $encdetails->defense . '" aria-valuemin="0" aria-valuemax="45" style="width: ' . (100 / 3) . '%; line-height: 16px">
179
-                                        <span class="sr-only">' . $locales->IV_DEFENSE . ': ' . $encdetails->defense . '</span>' . $encdetails->defense . '
178
+                                    <div title="' . $locales->IV_DEFENSE.': '.$encdetails->defense.'" class="progress-bar progress-bar-info" role="progressbar" aria-valuenow="'.$encdetails->defense.'" aria-valuemin="0" aria-valuemax="45" style="width: '.(100 / 3).'%; line-height: 16px">
179
+                                        <span class="sr-only">' . $locales->IV_DEFENSE.': '.$encdetails->defense.'</span>'.$encdetails->defense.'
180 180
                                     </div>
181
-                                    <div title="' . $locales->IV_STAMINA . ': ' . $encdetails->stamina . '" class="progress-bar progress-bar-success" role="progressbar" aria-valuenow="' . $encdetails->stamina . '" aria-valuemin="0" aria-valuemax="45" style="width: ' . (100 / 3) . '%; line-height: 16px">
182
-                                        <span class="sr-only">' . $locales->IV_STAMINA . ': ' . $encdetails->stamina . '</span>' . $encdetails->stamina . '
181
+                                    <div title="' . $locales->IV_STAMINA.': '.$encdetails->stamina.'" class="progress-bar progress-bar-success" role="progressbar" aria-valuenow="'.$encdetails->stamina.'" aria-valuemin="0" aria-valuemax="45" style="width: '.(100 / 3).'%; line-height: 16px">
182
+                                        <span class="sr-only">' . $locales->IV_STAMINA.': '.$encdetails->stamina.'</span>'.$encdetails->stamina.'
183 183
                                     </div>
184 184
                                 </div>';
185 185
 							} else {
186 186
 								$html .= '
187 187
                                 <div class="progress" style="height: 6px; width: 80%; margin: 5px auto 0 auto">
188
-                                <div title="' . $locales->IV_ATTACK . ': ' . $encdetails->attack . '" class="progress-bar progress-bar-danger" role="progressbar" aria-valuenow="' . $encdetails->attack . '" aria-valuemin="0" aria-valuemax="45" style="width: ' . (((100 / 15) * $encdetails->attack) / 3) . '%">
189
-                                        <span class="sr-only">' . $locales->IV_ATTACK . ': ' . $encdetails->attack . '</span>
188
+                                <div title="' . $locales->IV_ATTACK.': '.$encdetails->attack.'" class="progress-bar progress-bar-danger" role="progressbar" aria-valuenow="'.$encdetails->attack.'" aria-valuemin="0" aria-valuemax="45" style="width: '.(((100 / 15) * $encdetails->attack) / 3).'%">
189
+                                        <span class="sr-only">' . $locales->IV_ATTACK.': '.$encdetails->attack.'</span>
190 190
                                 </div>
191
-                                <div title="' . $locales->IV_DEFENSE . ': ' . $encdetails->defense . '" class="progress-bar progress-bar-info" role="progressbar" aria-valuenow="' . $encdetails->defense . '" aria-valuemin="0" aria-valuemax="45" style="width: ' . (((100 / 15) * $encdetails->defense) / 3) . '%">
192
-                                        <span class="sr-only">' . $locales->IV_DEFENSE . ': ' . $encdetails->defense . '</span>
191
+                                <div title="' . $locales->IV_DEFENSE.': '.$encdetails->defense.'" class="progress-bar progress-bar-info" role="progressbar" aria-valuenow="'.$encdetails->defense.'" aria-valuemin="0" aria-valuemax="45" style="width: '.(((100 / 15) * $encdetails->defense) / 3).'%">
192
+                                        <span class="sr-only">' . $locales->IV_DEFENSE.': '.$encdetails->defense.'</span>
193 193
                                 </div>
194
-                                <div title="' . $locales->IV_STAMINA . ': ' . $encdetails->stamina . '" class="progress-bar progress-bar-success" role="progressbar" aria-valuenow="' . $encdetails->stamina . '" aria-valuemin="0" aria-valuemax="45" style="width: ' . (((100 / 15) * $encdetails->stamina) / 3) . '%">
195
-                                        <span class="sr-only">' . $locales->IV_STAMINA . ': ' . $encdetails->stamina . '</span>
194
+                                <div title="' . $locales->IV_STAMINA.': '.$encdetails->stamina.'" class="progress-bar progress-bar-success" role="progressbar" aria-valuenow="'.$encdetails->stamina.'" aria-valuemin="0" aria-valuemax="45" style="width: '.(((100 / 15) * $encdetails->stamina) / 3).'%">
195
+                                        <span class="sr-only">' . $locales->IV_STAMINA.': '.$encdetails->stamina.'</span>
196 196
                                 </div>
197 197
                                 </div>';
198 198
 							}
199
-							$html .= '<small>' . $encdetails->cp . '</small>';
199
+							$html .= '<small>'.$encdetails->cp.'</small>';
200 200
 						} else {
201 201
 							if ($config->system->iv_numbers) {
202 202
 								$html .= '
203 203
                                 <div class="progress" style="height: 15px; margin-bottom: 0">
204
-                                    <div title="' . $locales->IV_ATTACK . ': not available" class="progress-bar progress-bar-danger" role="progressbar" aria-valuenow="' . $encdetails->attack . '" aria-valuemin="0" aria-valuemax="45" style="width: ' . (100 / 3) . '%; line-height: 16px">
205
-                                        <span class="sr-only">' . $locales->IV_ATTACK . ': ' . $locales->NOT_AVAILABLE . '</span>?
204
+                                    <div title="' . $locales->IV_ATTACK.': not available" class="progress-bar progress-bar-danger" role="progressbar" aria-valuenow="'.$encdetails->attack.'" aria-valuemin="0" aria-valuemax="45" style="width: '.(100 / 3).'%; line-height: 16px">
205
+                                        <span class="sr-only">' . $locales->IV_ATTACK.': '.$locales->NOT_AVAILABLE.'</span>?
206 206
                                     </div>
207
-                                    <div title="' . $locales->IV_DEFENSE . ': not available" class="progress-bar progress-bar-info" role="progressbar" aria-valuenow="' . $encdetails->defense . '" aria-valuemin="0" aria-valuemax="45" style="width: ' . (100 / 3) . '%; line-height: 16px">
208
-                                        <span class="sr-only">' . $locales->IV_DEFENSE . ': ' . $locales->NOT_AVAILABLE . '</span>?
207
+                                    <div title="' . $locales->IV_DEFENSE.': not available" class="progress-bar progress-bar-info" role="progressbar" aria-valuenow="'.$encdetails->defense.'" aria-valuemin="0" aria-valuemax="45" style="width: '.(100 / 3).'%; line-height: 16px">
208
+                                        <span class="sr-only">' . $locales->IV_DEFENSE.': '.$locales->NOT_AVAILABLE.'</span>?
209 209
                                     </div>
210
-                                    <div title="' . $locales->IV_STAMINA . ': not available" class="progress-bar progress-bar-success" role="progressbar" aria-valuenow="' . $encdetails->stamina . '" aria-valuemin="0" aria-valuemax="45" style="width: ' . (100 / 3) . '%; line-height: 16px">
211
-                                        <span class="sr-only">' . $locales->IV_STAMINA . ': ' . $locales->NOT_AVAILABLE . '</span>?
210
+                                    <div title="' . $locales->IV_STAMINA.': not available" class="progress-bar progress-bar-success" role="progressbar" aria-valuenow="'.$encdetails->stamina.'" aria-valuemin="0" aria-valuemax="45" style="width: '.(100 / 3).'%; line-height: 16px">
211
+                                        <span class="sr-only">' . $locales->IV_STAMINA.': '.$locales->NOT_AVAILABLE.'</span>?
212 212
                                     </div>
213 213
                                 </div>';
214 214
 							} else {
215 215
 								$html .= '
216 216
                             <div class="progress" style="height: 6px; width: 80%; margin: 5px auto 0 auto">
217 217
                                 <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">
218
-                                    <span class="sr-only">IV ' . $locales->NOT_AVAILABLE . '</span>
218
+                                    <span class="sr-only">IV ' . $locales->NOT_AVAILABLE.'</span>
219 219
                                 </div>
220 220
                             </div>';
221 221
 							}
@@ -291,7 +291,7 @@  discard block
 block discarded – undo
291 291
 
292 292
 		foreach ($teams as $team_name => $team_id) {
293 293
 
294
-			$data	= $manager->getOwnedAndPoints($team_id);
294
+			$data = $manager->getOwnedAndPoints($team_id);
295 295
 
296 296
 			$return[] = $data->total;
297 297
 			$return[] = $data->average_points;
@@ -402,38 +402,38 @@  discard block
 block discarded – undo
402 402
 					if ($config->system->iv_numbers) {
403 403
 						$gymData['infoWindow'] .= '
404 404
 					<div style="text-align: center; width: 50px; display: inline-block; margin-right: 3px">
405
-						<a href="pokemon/' . $data->pokemon_id . '">
406
-						<img src="' . $pokemons->pokemon->$pokemon_id->img . '" height="50" style="display:inline-block" >
405
+						<a href="pokemon/' . $data->pokemon_id.'">
406
+						<img src="' . $pokemons->pokemon->$pokemon_id->img.'" height="50" style="display:inline-block" >
407 407
 						</a>
408
-						<p class="pkmn-name">' . $data->cp . '</p>
408
+						<p class="pkmn-name">' . $data->cp.'</p>
409 409
 						<div class="progress" style="height: 12px; margin-bottom: 0">
410
-							<div title="' . $locales->IV_ATTACK . ': ' . $data->iv_attack . '" class="progress-bar progress-bar-danger" role="progressbar" aria-valuenow="' . $data->iv_attack . '" aria-valuemin="0" aria-valuemax="45" style="width: ' . (100 / 3) . '%; line-height: 13px; font-size: 11px">
411
-								<span class="sr-only">' . $locales->IV_ATTACK . ' : ' . $data->iv_attack . '</span>' . $data->iv_attack . '
410
+							<div title="' . $locales->IV_ATTACK.': '.$data->iv_attack.'" class="progress-bar progress-bar-danger" role="progressbar" aria-valuenow="'.$data->iv_attack.'" aria-valuemin="0" aria-valuemax="45" style="width: '.(100 / 3).'%; line-height: 13px; font-size: 11px">
411
+								<span class="sr-only">' . $locales->IV_ATTACK.' : '.$data->iv_attack.'</span>'.$data->iv_attack.'
412 412
 								</div>
413
-								<div title="' . $locales->IV_DEFENSE . ': ' . $data->iv_defense . '" class="progress-bar progress-bar-info" role="progressbar" aria-valuenow="' . $data->iv_defense . '" aria-valuemin="0" aria-valuemax="45" style="width: ' . (100 / 3) . '%; line-height: 13px; font-size: 11px">
414
-									<span class="sr-only">' . $locales->IV_DEFENSE . ' : ' . $data->iv_defense . '</span>' . $data->iv_defense . '
413
+								<div title="' . $locales->IV_DEFENSE.': '.$data->iv_defense.'" class="progress-bar progress-bar-info" role="progressbar" aria-valuenow="'.$data->iv_defense.'" aria-valuemin="0" aria-valuemax="45" style="width: '.(100 / 3).'%; line-height: 13px; font-size: 11px">
414
+									<span class="sr-only">' . $locales->IV_DEFENSE.' : '.$data->iv_defense.'</span>'.$data->iv_defense.'
415 415
 								</div>
416
-								<div title="' . $locales->IV_STAMINA . ': ' . $data->iv_stamina . '" class="progress-bar progress-bar-success" role="progressbar" aria-valuenow="' . $data->iv_stamina . '" aria-valuemin="0" aria-valuemax="45" style="width: ' . (100 / 3) . '%; line-height: 13px; font-size: 11px">
417
-									<span class="sr-only">' . $locales->IV_STAMINA . ' : ' . $data->iv_stamina . '</span>' . $data->iv_stamina . '
416
+								<div title="' . $locales->IV_STAMINA.': '.$data->iv_stamina.'" class="progress-bar progress-bar-success" role="progressbar" aria-valuenow="'.$data->iv_stamina.'" aria-valuemin="0" aria-valuemax="45" style="width: '.(100 / 3).'%; line-height: 13px; font-size: 11px">
417
+									<span class="sr-only">' . $locales->IV_STAMINA.' : '.$data->iv_stamina.'</span>'.$data->iv_stamina.'
418 418
 								</div>
419 419
 							</div>
420 420
 						</div>';
421 421
 					} else {
422 422
 						$gymData['infoWindow'] .= '
423 423
 					<div style="text-align: center; width: 50px; display: inline-block; margin-right: 3px">
424
-						<a href="pokemon/' . $data->pokemon_id . '">
425
-						<img src="' . $pokemons->pokemon->$pokemon_id->img . '" height="50" style="display:inline-block" >
424
+						<a href="pokemon/' . $data->pokemon_id.'">
425
+						<img src="' . $pokemons->pokemon->$pokemon_id->img.'" height="50" style="display:inline-block" >
426 426
 						</a>
427
-						<p class="pkmn-name">' . $data->cp . '</p>
427
+						<p class="pkmn-name">' . $data->cp.'</p>
428 428
 						<div class="progress" style="height: 4px; width: 40px; margin-bottom: 10px; margin-top: 2px; margin-left: auto; margin-right: auto">
429
-							<div title="' . $locales->IV_ATTACK . ': ' . $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) . '%">
430
-								<span class="sr-only">' . $locales->IV_ATTACK . ': ' . $data->iv_attack . '</span>
429
+							<div title="' . $locales->IV_ATTACK.': '.$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).'%">
430
+								<span class="sr-only">' . $locales->IV_ATTACK.': '.$data->iv_attack.'</span>
431 431
 							</div>
432
-							<div title="' . $locales->IV_DEFENSE . ': ' . $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) . '%">
433
-								<span class="sr-only">' . $locales->IV_DEFENSE . ': ' . $data->iv_defense . '</span>
432
+							<div title="' . $locales->IV_DEFENSE.': '.$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).'%">
433
+								<span class="sr-only">' . $locales->IV_DEFENSE.': '.$data->iv_defense.'</span>
434 434
 							</div>
435
-							<div title="' . $locales->IV_STAMINA . ': ' . $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) . '%">
436
-								<span class="sr-only">' . $locales->IV_STAMINA . ': ' . $data->iv_stamina . '</span>
435
+							<div title="' . $locales->IV_STAMINA.': '.$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).'%">
436
+								<span class="sr-only">' . $locales->IV_STAMINA.': '.$data->iv_stamina.'</span>
437 437
 							</div>
438 438
 						</div>
439 439
 					</div>';
@@ -510,7 +510,7 @@  discard block
 block discarded – undo
510 510
 			} else {
511 511
 				$data->charge_move = "?";
512 512
 			}
513
-			$raids[10*$page + $i] = $data;
513
+			$raids[10 * $page + $i] = $data;
514 514
 			$i++;
515 515
 		}
516 516
 		$json = array();
@@ -525,7 +525,7 @@  discard block
 block discarded – undo
525 525
 		break;
526 526
 
527 527
 	case 'pokemon_slider_init':
528
-		$bounds		= $manager->getPokemonSliederMinMax();
528
+		$bounds = $manager->getPokemonSliederMinMax();
529 529
 
530 530
 		header('Content-Type: application/json');
531 531
 		echo json_encode($bounds);
Please login to merge, or discard this patch.
Switch Indentation   +318 added lines, -318 removed lines patch added patch discarded remove patch
@@ -59,118 +59,118 @@  discard block
 block discarded – undo
59 59
 	//
60 60
 	############################
61 61
 
62
-	case 'home_update':
63
-		$values = [];
64
-		// Right now
65
-		// ---------
66
-		$data = $manager->getTotalPokemon();
67
-		$values[] = $data->total;
62
+		case 'home_update':
63
+			$values = [];
64
+			// Right now
65
+			// ---------
66
+			$data = $manager->getTotalPokemon();
67
+			$values[] = $data->total;
68 68
 
69
-		// Lured stops
70
-		// -----------
71
-		$data = $manager->getTotalLures();
72
-		$values[] = $data->total;
69
+			// Lured stops
70
+			// -----------
71
+			$data = $manager->getTotalLures();
72
+			$values[] = $data->total;
73 73
 
74
-		// Active Raids
75
-		// -----------
76
-		$data = $manager->getTotalRaids();
77
-		$values[] = $data->total;
74
+			// Active Raids
75
+			// -----------
76
+			$data = $manager->getTotalRaids();
77
+			$values[] = $data->total;
78 78
 
79
-		// Team battle
80
-		// -----------
81
-		$data = $manager->getTotalGyms();
82
-		$values[] = $data->total;
79
+			// Team battle
80
+			// -----------
81
+			$data = $manager->getTotalGyms();
82
+			$values[] = $data->total;
83 83
 
84
-		// Red
85
-		$data = $manager->getTotalGymsForTeam(2);
86
-		$values[] = $data->total;
84
+			// Red
85
+			$data = $manager->getTotalGymsForTeam(2);
86
+			$values[] = $data->total;
87 87
 
88
-		// Blue
89
-		$data = $manager->getTotalGymsForTeam(1);
90
-		$values[] = $data->total;
88
+			// Blue
89
+			$data = $manager->getTotalGymsForTeam(1);
90
+			$values[] = $data->total;
91 91
 
92
-		// Yellow
93
-		$data = $manager->getTotalGymsForTeam(3);
94
-		$values[] = $data->total;
92
+			// Yellow
93
+			$data = $manager->getTotalGymsForTeam(3);
94
+			$values[] = $data->total;
95 95
 
96
-		// Neutral
97
-		$data = $manager->getTotalGymsForTeam(0);
98
-		$values[] = $data->total;
96
+			// Neutral
97
+			$data = $manager->getTotalGymsForTeam(0);
98
+			$values[] = $data->total;
99 99
 
100 100
 
101
-		header('Content-Type: application/json');
102
-		echo json_encode($values);
101
+			header('Content-Type: application/json');
102
+			echo json_encode($values);
103 103
 
104
-		break;
104
+			break;
105 105
 
106 106
 
107
-	####################################
108
-	//
109
-	// Update latests spawn on homepage
110
-	//
111
-	####################################
107
+		####################################
108
+		//
109
+		// Update latests spawn on homepage
110
+		//
111
+		####################################
112 112
 
113
-	case 'spawnlist_update':
114
-		// Recent spawn
115
-		// ------------
116
-		$total_spawns = array();
117
-		$last_uid_param = "";
118
-		if (isset($_GET['last_uid'])) {
119
-			$last_uid_param = $_GET['last_uid'];
120
-		}
121
-		if ($config->system->recents_filter) {
122
-			// get all mythic pokemon ids
123
-			$mythic_pokemons = array();
124
-			foreach ($pokemons->pokemon as $id => $pokemon) {
125
-				if ($pokemon->spawn_rate < $config->system->recents_filter_rarity && $pokemon->rating >= $config->system->recents_filter_rating) {
126
-					$mythic_pokemons[] = $id;
127
-				}
113
+		case 'spawnlist_update':
114
+			// Recent spawn
115
+			// ------------
116
+			$total_spawns = array();
117
+			$last_uid_param = "";
118
+			if (isset($_GET['last_uid'])) {
119
+				$last_uid_param = $_GET['last_uid'];
128 120
 			}
121
+			if ($config->system->recents_filter) {
122
+				// get all mythic pokemon ids
123
+				$mythic_pokemons = array();
124
+				foreach ($pokemons->pokemon as $id => $pokemon) {
125
+					if ($pokemon->spawn_rate < $config->system->recents_filter_rarity && $pokemon->rating >= $config->system->recents_filter_rating) {
126
+						$mythic_pokemons[] = $id;
127
+					}
128
+				}
129 129
 
130
-			// get last mythic pokemon
131
-			$result = $manager->getRecentMythic($mythic_pokemons);
132
-		} else {
133
-			// get last pokemon
134
-			$result = $manager->getRecentAll();
135
-		}
130
+				// get last mythic pokemon
131
+				$result = $manager->getRecentMythic($mythic_pokemons);
132
+			} else {
133
+				// get last pokemon
134
+				$result = $manager->getRecentAll();
135
+			}
136 136
 
137
-		if (count($result) > 0) {
138
-			foreach ($result as $data) {
139
-				$new_spawn = array();
140
-				$pokeid = $data->pokemon_id;
141
-				$pokeuid = $data->encounter_id;
142
-
143
-				if ($last_uid_param != $pokeuid) {
144
-					$last_seen = strtotime($data->disappear_time_real);
145
-
146
-					$location_link = isset($config->system->location_url) ? $config->system->location_url : 'https://maps.google.com/?q={latitude},{longitude}&ll={latitude},{longitude}&z=16';
147
-					$location_link = str_replace('{latitude}', $data->latitude, $location_link);
148
-					$location_link = str_replace('{longitude}', $data->longitude, $location_link);
149
-
150
-					if ($config->system->recents_encounter_details) {
151
-						$encdetails = new stdClass();
152
-						$encdetails->cp = $data->cp;
153
-						$encdetails->attack = $data->individual_attack;
154
-						$encdetails->defense = $data->individual_defense;
155
-						$encdetails->stamina = $data->individual_stamina;
156
-						if (isset($encdetails->cp) && isset($encdetails->attack) && isset($encdetails->defense) && isset($encdetails->stamina)) {
157
-							$encdetails->available = true;
158
-						} else {
159
-							$encdetails->available = false;
137
+			if (count($result) > 0) {
138
+				foreach ($result as $data) {
139
+					$new_spawn = array();
140
+					$pokeid = $data->pokemon_id;
141
+					$pokeuid = $data->encounter_id;
142
+
143
+					if ($last_uid_param != $pokeuid) {
144
+						$last_seen = strtotime($data->disappear_time_real);
145
+
146
+						$location_link = isset($config->system->location_url) ? $config->system->location_url : 'https://maps.google.com/?q={latitude},{longitude}&ll={latitude},{longitude}&z=16';
147
+						$location_link = str_replace('{latitude}', $data->latitude, $location_link);
148
+						$location_link = str_replace('{longitude}', $data->longitude, $location_link);
149
+
150
+						if ($config->system->recents_encounter_details) {
151
+							$encdetails = new stdClass();
152
+							$encdetails->cp = $data->cp;
153
+							$encdetails->attack = $data->individual_attack;
154
+							$encdetails->defense = $data->individual_defense;
155
+							$encdetails->stamina = $data->individual_stamina;
156
+							if (isset($encdetails->cp) && isset($encdetails->attack) && isset($encdetails->defense) && isset($encdetails->stamina)) {
157
+								$encdetails->available = true;
158
+							} else {
159
+								$encdetails->available = false;
160
+							}
160 161
 						}
161
-					}
162 162
 
163
-					$html = '
163
+						$html = '
164 164
                     <div class="col-md-1 col-xs-4 pokemon-single" data-pokeid="' . $pokeid . '" data-pokeuid="' . $pokeuid . '" style="display: none;">
165 165
                     <a href="pokemon/' . $pokeid . '"><img src="' . $pokemons->pokemon->$pokeid->img . '" alt="' . $pokemons->pokemon->$pokeid->name . '" class="img-responsive"></a>
166 166
                     <a href="pokemon/' . $pokeid . '"><p class="pkmn-name">' . $pokemons->pokemon->$pokeid->name . '</p></a>
167 167
                     <a href="' . $location_link . '" target="_blank">
168 168
                         <small class="pokemon-timer">00:00:00</small>
169 169
                     </a>';
170
-					if ($config->system->recents_encounter_details) {
171
-						if ($encdetails->available) {
172
-							if ($config->system->iv_numbers) {
173
-								$html .= '
170
+						if ($config->system->recents_encounter_details) {
171
+							if ($encdetails->available) {
172
+								if ($config->system->iv_numbers) {
173
+									$html .= '
174 174
                                 <div class="progress" style="height: 15px; margin-bottom: 0">
175 175
                                     <div title="' . $locales->IV_ATTACK . ': ' . $encdetails->attack . '" class="progress-bar progress-bar-danger" role="progressbar" aria-valuenow="' . $encdetails->attack . '" aria-valuemin="0" aria-valuemax="45" style="width: ' . (100 / 3) . '%; line-height: 16px">
176 176
                                         <span class="sr-only">' . $locales->IV_ATTACK . ': ' . $encdetails->attack . '</span>' . $encdetails->attack . '
@@ -182,8 +182,8 @@  discard block
 block discarded – undo
182 182
                                         <span class="sr-only">' . $locales->IV_STAMINA . ': ' . $encdetails->stamina . '</span>' . $encdetails->stamina . '
183 183
                                     </div>
184 184
                                 </div>';
185
-							} else {
186
-								$html .= '
185
+								} else {
186
+									$html .= '
187 187
                                 <div class="progress" style="height: 6px; width: 80%; margin: 5px auto 0 auto">
188 188
                                 <div title="' . $locales->IV_ATTACK . ': ' . $encdetails->attack . '" class="progress-bar progress-bar-danger" role="progressbar" aria-valuenow="' . $encdetails->attack . '" aria-valuemin="0" aria-valuemax="45" style="width: ' . (((100 / 15) * $encdetails->attack) / 3) . '%">
189 189
                                         <span class="sr-only">' . $locales->IV_ATTACK . ': ' . $encdetails->attack . '</span>
@@ -195,11 +195,11 @@  discard block
 block discarded – undo
195 195
                                         <span class="sr-only">' . $locales->IV_STAMINA . ': ' . $encdetails->stamina . '</span>
196 196
                                 </div>
197 197
                                 </div>';
198
-							}
199
-							$html .= '<small>' . $encdetails->cp . '</small>';
200
-						} else {
201
-							if ($config->system->iv_numbers) {
202
-								$html .= '
198
+								}
199
+								$html .= '<small>' . $encdetails->cp . '</small>';
200
+							} else {
201
+								if ($config->system->iv_numbers) {
202
+									$html .= '
203 203
                                 <div class="progress" style="height: 15px; margin-bottom: 0">
204 204
                                     <div title="' . $locales->IV_ATTACK . ': not available" class="progress-bar progress-bar-danger" role="progressbar" aria-valuenow="' . $encdetails->attack . '" aria-valuemin="0" aria-valuemax="45" style="width: ' . (100 / 3) . '%; line-height: 16px">
205 205
                                         <span class="sr-only">' . $locales->IV_ATTACK . ': ' . $locales->NOT_AVAILABLE . '</span>?
@@ -211,116 +211,116 @@  discard block
 block discarded – undo
211 211
                                         <span class="sr-only">' . $locales->IV_STAMINA . ': ' . $locales->NOT_AVAILABLE . '</span>?
212 212
                                     </div>
213 213
                                 </div>';
214
-							} else {
215
-								$html .= '
214
+								} else {
215
+									$html .= '
216 216
                             <div class="progress" style="height: 6px; width: 80%; margin: 5px auto 0 auto">
217 217
                                 <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">
218 218
                                     <span class="sr-only">IV ' . $locales->NOT_AVAILABLE . '</span>
219 219
                                 </div>
220 220
                             </div>';
221
+								}
222
+								$html .= '<small>???</small>';
221 223
 							}
222
-							$html .= '<small>???</small>';
223 224
 						}
224
-					}
225
-					$html .= '
225
+						$html .= '
226 226
                     </div>';
227
-					$new_spawn['html'] = $html;
228
-					$countdown = $last_seen - time();
229
-					$new_spawn['countdown'] = $countdown;
230
-					$new_spawn['pokemon_uid'] = $pokeuid;
231
-					$total_spawns[] = $new_spawn;
232
-				} else {
233
-					break;
227
+						$new_spawn['html'] = $html;
228
+						$countdown = $last_seen - time();
229
+						$new_spawn['countdown'] = $countdown;
230
+						$new_spawn['pokemon_uid'] = $pokeuid;
231
+						$total_spawns[] = $new_spawn;
232
+					} else {
233
+						break;
234
+					}
234 235
 				}
235 236
 			}
236
-		}
237 237
 
238
-		header('Content-Type: application/json');
239
-		echo json_encode($total_spawns);
238
+			header('Content-Type: application/json');
239
+			echo json_encode($total_spawns);
240 240
 
241
-		break;
241
+			break;
242 242
 
243 243
 
244
-	####################################
245
-	//
246
-	// List Pokestop
247
-	//
248
-	####################################
244
+		####################################
245
+		//
246
+		// List Pokestop
247
+		//
248
+		####################################
249 249
 
250
-	case 'pokestop':
251
-		$datas = $manager->getAllPokestops();
250
+		case 'pokestop':
251
+			$datas = $manager->getAllPokestops();
252 252
 
253
-		$pokestops = [];
254
-		foreach ($datas as $data) {
255
-			if ($data->lure_expiration >= $data->now) {
256
-				$icon = 'pokestap_lured.png';
257
-				$text = sprintf($locales->POKESTOPS_MAP_LURED, date('H:i:s', strtotime($data->lure_expiration_real)));
258
-				$lured = true;
259
-			} else {
260
-				$icon = 'pokestap.png';
261
-				$text = $locales->POKESTOPS_MAP_REGULAR;
262
-				$lured = false;
253
+			$pokestops = [];
254
+			foreach ($datas as $data) {
255
+				if ($data->lure_expiration >= $data->now) {
256
+					$icon = 'pokestap_lured.png';
257
+					$text = sprintf($locales->POKESTOPS_MAP_LURED, date('H:i:s', strtotime($data->lure_expiration_real)));
258
+					$lured = true;
259
+				} else {
260
+					$icon = 'pokestap.png';
261
+					$text = $locales->POKESTOPS_MAP_REGULAR;
262
+					$lured = false;
263
+				}
264
+
265
+				$pokestops[] = [
266
+					$text,
267
+					$icon,
268
+					$data->latitude,
269
+					$data->longitude,
270
+					$lured
271
+				];
263 272
 			}
264 273
 
265
-			$pokestops[] = [
266
-				$text,
267
-				$icon,
268
-				$data->latitude,
269
-				$data->longitude,
270
-				$lured
271
-			];
272
-		}
274
+			header('Content-Type: application/json');
275
+			echo json_encode($pokestops);
273 276
 
274
-		header('Content-Type: application/json');
275
-		echo json_encode($pokestops);
277
+			break;
276 278
 
277
-		break;
278 279
 
280
+		####################################
281
+		//
282
+		// Update data for the gym battle
283
+		//
284
+		####################################
279 285
 
280
-	####################################
281
-	//
282
-	// Update data for the gym battle
283
-	//
284
-	####################################
286
+		case 'update_gym':
287
+			$teams = new stdClass();
288
+			$teams->mystic = 1;
289
+			$teams->valor = 2;
290
+			$teams->instinct = 3;
285 291
 
286
-	case 'update_gym':
287
-		$teams = new stdClass();
288
-		$teams->mystic = 1;
289
-		$teams->valor = 2;
290
-		$teams->instinct = 3;
292
+			foreach ($teams as $team_name => $team_id) {
291 293
 
292
-		foreach ($teams as $team_name => $team_id) {
294
+				$data	= $manager->getOwnedAndPoints($team_id);
293 295
 
294
-			$data	= $manager->getOwnedAndPoints($team_id);
295
-
296
-			$return[] = $data->total;
297
-			$return[] = $data->average_points;
298
-		}
296
+				$return[] = $data->total;
297
+				$return[] = $data->average_points;
298
+			}
299 299
 
300
-		header('Content-Type: application/json');
301
-		echo json_encode($return);
300
+			header('Content-Type: application/json');
301
+			echo json_encode($return);
302 302
 
303
-		break;
303
+			break;
304 304
 
305 305
 
306
-	####################################
307
-	//
308
-	// Get datas for the gym map
309
-	//
310
-	####################################
306
+		####################################
307
+		//
308
+		// Get datas for the gym map
309
+		//
310
+		####################################
311 311
 
312 312
 
313
-	case 'gym_map':
314
-		$datas = $manager->getAllGyms();
313
+		case 'gym_map':
314
+			$datas = $manager->getAllGyms();
315 315
 
316
-		$gyms = [];
317
-		foreach ($datas as $data) {
318
-			// Team
319
-			// 1 = bleu
320
-			// 2 = rouge
321
-			// 3 = jaune
316
+			$gyms = [];
317
+			foreach ($datas as $data) {
318
+				// Team
319
+				// 1 = bleu
320
+				// 2 = rouge
321
+				// 3 = jaune
322 322
 
323
-			switch ($data->team_id) {
323
+				switch ($data->team_id) {
324 324
 				case 0:
325 325
 					$icon	= 'map_white.png';
326 326
 					$team	= 'No Team (yet)';
@@ -344,7 +344,7 @@  discard block
 block discarded – undo
344 344
 					$team	= 'Team Instinct';
345 345
 					$color = 'rgba(254, 217, 40, .6)';
346 346
 					break;
347
-			}
347
+				}
348 348
 
349 349
 			if ($data->team_id != 0) {
350 350
 				$icon .= $data->level.".png";
@@ -370,45 +370,45 @@  discard block
 block discarded – undo
370 370
 	//
371 371
 	####################################
372 372
 
373
-	case 'gym_defenders':
374
-		$gym_id = $manager->getEcapedString($_GET['gym_id']);
373
+		case 'gym_defenders':
374
+			$gym_id = $manager->getEcapedString($_GET['gym_id']);
375 375
 
376
-		$data = $manager->getGymData($gym_id);
377
-		$gymData['gymDetails']['gymInfos'] = false;
376
+			$data = $manager->getGymData($gym_id);
377
+			$gymData['gymDetails']['gymInfos'] = false;
378 378
 
379
-		if (!is_null($data)) {
380
-			if ($data->name == null) {
381
-				$gymData['gymDetails']['gymInfos']['name'] = "?";
382
-			} else {
383
-				$gymData['gymDetails']['gymInfos']['name'] = $data->name;
384
-			}
385
-			$gymData['gymDetails']['gymInfos']['description'] = $data->description;
386
-			if ($data->url == null) {
387
-				$gymData['gymDetails']['gymInfos']['url'] = 'https://upload.wikimedia.org/wikipedia/commons/thumb/8/86/Solid_grey.svg/200px-Solid_grey.svg.png';
388
-			} else {
389
-				$gymData['gymDetails']['gymInfos']['url'] = $data->url;
390
-			}
391
-			if ($data->url == null) {
392
-				$gymData['gymDetails']['gymInfos']['points'] = "?";
393
-			} else {
394
-				$gymData['gymDetails']['gymInfos']['points'] = $data->total_cp;
395
-			}
396
-			$gymData['gymDetails']['gymInfos']['level'] = $data->level;
397
-			$gymData['gymDetails']['gymInfos']['last_scanned'] = $data->last_scanned;
398
-			$gymData['gymDetails']['gymInfos']['team'] = $data->team;
399
-			$gymData['gymDetails']['gymInfos']['guardPokemonId'] = $data->guard_pokemon_id;
400
-
401
-			// Skip Query if team is none
402
-			if ($data->team > 0) {
403
-				$datas = $manager->getGymDefenders($gym_id);
404
-				$gymData['infoWindow'] = '
379
+			if (!is_null($data)) {
380
+				if ($data->name == null) {
381
+					$gymData['gymDetails']['gymInfos']['name'] = "?";
382
+				} else {
383
+					$gymData['gymDetails']['gymInfos']['name'] = $data->name;
384
+				}
385
+				$gymData['gymDetails']['gymInfos']['description'] = $data->description;
386
+				if ($data->url == null) {
387
+					$gymData['gymDetails']['gymInfos']['url'] = 'https://upload.wikimedia.org/wikipedia/commons/thumb/8/86/Solid_grey.svg/200px-Solid_grey.svg.png';
388
+				} else {
389
+					$gymData['gymDetails']['gymInfos']['url'] = $data->url;
390
+				}
391
+				if ($data->url == null) {
392
+					$gymData['gymDetails']['gymInfos']['points'] = "?";
393
+				} else {
394
+					$gymData['gymDetails']['gymInfos']['points'] = $data->total_cp;
395
+				}
396
+				$gymData['gymDetails']['gymInfos']['level'] = $data->level;
397
+				$gymData['gymDetails']['gymInfos']['last_scanned'] = $data->last_scanned;
398
+				$gymData['gymDetails']['gymInfos']['team'] = $data->team;
399
+				$gymData['gymDetails']['gymInfos']['guardPokemonId'] = $data->guard_pokemon_id;
400
+
401
+				// Skip Query if team is none
402
+				if ($data->team > 0) {
403
+					$datas = $manager->getGymDefenders($gym_id);
404
+					$gymData['infoWindow'] = '
405 405
 				<div class="gym_defenders">
406 406
 				';
407
-				foreach ($datas as $data) {
408
-					$gymData['gymDetails']['pokemons'][] = $data;
409
-					$pokemon_id = $data->pokemon_id;
410
-					if ($config->system->iv_numbers) {
411
-						$gymData['infoWindow'] .= '
407
+					foreach ($datas as $data) {
408
+						$gymData['gymDetails']['pokemons'][] = $data;
409
+						$pokemon_id = $data->pokemon_id;
410
+						if ($config->system->iv_numbers) {
411
+							$gymData['infoWindow'] .= '
412 412
 					<div style="text-align: center; width: 50px; display: inline-block; margin-right: 3px">
413 413
 						<a href="pokemon/' . $data->pokemon_id . '">
414 414
 						<img src="' . $pokemons->pokemon->$pokemon_id->img . '" height="50" style="display:inline-block" >
@@ -426,8 +426,8 @@  discard block
 block discarded – undo
426 426
 								</div>
427 427
 							</div>
428 428
 						</div>';
429
-					} else {
430
-						$gymData['infoWindow'] .= '
429
+						} else {
430
+							$gymData['infoWindow'] .= '
431 431
 					<div style="text-align: center; width: 50px; display: inline-block; margin-right: 3px">
432 432
 						<a href="pokemon/' . $data->pokemon_id . '">
433 433
 						<img src="' . $pokemons->pokemon->$pokemon_id->img . '" height="50" style="display:inline-block" >
@@ -445,149 +445,149 @@  discard block
 block discarded – undo
445 445
 							</div>
446 446
 						</div>
447 447
 					</div>';
448
+						}
448 449
 					}
449 450
 				}
451
+				$gymData['infoWindow'] = $gymData['infoWindow'].'</div>';
450 452
 			}
451
-			$gymData['infoWindow'] = $gymData['infoWindow'].'</div>';
452
-		}
453 453
 
454 454
 
455
-		header('Content-Type: application/json');
456
-		echo json_encode($gymData);
457
-
458
-		break;
455
+			header('Content-Type: application/json');
456
+			echo json_encode($gymData);
459 457
 
458
+			break;
460 459
 
461
-	case 'trainer':
462
-		$name = "";
463
-		$page = "0";
464
-		$team = 0;
465
-		$ranking = 0;
466
-		if (isset($_GET['name'])) {
467
-			$trainer_name = $manager->getEcapedString($_GET['name']);
468
-		}
469
-		if (isset($_GET['team'])) {
470
-			$team = $manager->getEcapedString($_GET['team']);
471
-		}
472
-		if (isset($_GET['page'])) {
473
-			$page = $manager->getEcapedString($_GET['page']);
474
-		}
475
-		if (isset($_GET['ranking'])) {
476
-			$ranking = $manager->getEcapedString($_GET['ranking']);
477
-		}
478 460
 
479
-		$trainers = $manager->getTrainers($trainer_name, $team, $page, $ranking);
480
-		$json = array();
481
-		$json['trainers'] = $trainers;
482
-		$locale = array();
483
-		$locale["today"] = $locales->TODAY;
484
-		$locale["day"] = $locales->DAY;
485
-		$locale["days"] = $locales->DAYS;
486
-		$locale["ivAttack"] = $locales->IV_ATTACK;
487
-		$locale["ivDefense"] = $locales->IV_DEFENSE;
488
-		$locale["ivStamina"] = $locales->IV_STAMINA;
489
-		$json['locale'] = $locale;
461
+		case 'trainer':
462
+			$name = "";
463
+			$page = "0";
464
+			$team = 0;
465
+			$ranking = 0;
466
+			if (isset($_GET['name'])) {
467
+				$trainer_name = $manager->getEcapedString($_GET['name']);
468
+			}
469
+			if (isset($_GET['team'])) {
470
+				$team = $manager->getEcapedString($_GET['team']);
471
+			}
472
+			if (isset($_GET['page'])) {
473
+				$page = $manager->getEcapedString($_GET['page']);
474
+			}
475
+			if (isset($_GET['ranking'])) {
476
+				$ranking = $manager->getEcapedString($_GET['ranking']);
477
+			}
490 478
 
491
-		header('Content-Type: application/json');
492
-		echo json_encode($json);
479
+			$trainers = $manager->getTrainers($trainer_name, $team, $page, $ranking);
480
+			$json = array();
481
+			$json['trainers'] = $trainers;
482
+			$locale = array();
483
+			$locale["today"] = $locales->TODAY;
484
+			$locale["day"] = $locales->DAY;
485
+			$locale["days"] = $locales->DAYS;
486
+			$locale["ivAttack"] = $locales->IV_ATTACK;
487
+			$locale["ivDefense"] = $locales->IV_DEFENSE;
488
+			$locale["ivStamina"] = $locales->IV_STAMINA;
489
+			$json['locale'] = $locale;
493 490
 
494
-		break;
491
+			header('Content-Type: application/json');
492
+			echo json_encode($json);
495 493
 
494
+			break;
496 495
 
497
-	case 'raids':
498
-		$page = "0";
499
-		if (isset($_GET['page'])) {
500
-			$page = $manager->getEcapedString($_GET['page']);
501
-		}
502 496
 
503
-		$datas = $manager->getAllRaids($page);
504
-		$i = 1;
505
-		$raids = array();
506
-		foreach ($datas as $data) {
507
-			$data->starttime = date("H:i", strtotime($data->start));
508
-			$data->endtime = date("H:i", strtotime($data->end));
509
-			$data->gym_id = str_replace('.', '_', $data->gym_id);
510
-			if (isset($data->move_1)) {
511
-				$move1 = $data->move_1;
512
-				$data->quick_move = $move->$move1->name;
513
-			} else {
514
-				$data->quick_move = "?";
497
+		case 'raids':
498
+			$page = "0";
499
+			if (isset($_GET['page'])) {
500
+				$page = $manager->getEcapedString($_GET['page']);
515 501
 			}
516
-			if (isset($data->move_2)) {
517
-				$move2 = $data->move_2;
518
-				$data->charge_move = $move->$move2->name;
519
-			} else {
520
-				$data->charge_move = "?";
502
+
503
+			$datas = $manager->getAllRaids($page);
504
+			$i = 1;
505
+			$raids = array();
506
+			foreach ($datas as $data) {
507
+				$data->starttime = date("H:i", strtotime($data->start));
508
+				$data->endtime = date("H:i", strtotime($data->end));
509
+				$data->gym_id = str_replace('.', '_', $data->gym_id);
510
+				if (isset($data->move_1)) {
511
+					$move1 = $data->move_1;
512
+					$data->quick_move = $move->$move1->name;
513
+				} else {
514
+					$data->quick_move = "?";
515
+				}
516
+				if (isset($data->move_2)) {
517
+					$move2 = $data->move_2;
518
+					$data->charge_move = $move->$move2->name;
519
+				} else {
520
+					$data->charge_move = "?";
521
+				}
522
+				$raids[10*$page + $i] = $data;
523
+				$i++;
521 524
 			}
522
-			$raids[10*$page + $i] = $data;
523
-			$i++;
524
-		}
525
-		$json = array();
526
-		$json['raids'] = $raids;
527
-		$locale = array();
528
-		$locale['noraids'] = $locales->RAIDS_NONE;
529
-		$json['locale'] = $locale;
525
+			$json = array();
526
+			$json['raids'] = $raids;
527
+			$locale = array();
528
+			$locale['noraids'] = $locales->RAIDS_NONE;
529
+			$json['locale'] = $locale;
530 530
 
531
-		header('Content-Type: application/json');
532
-		echo json_encode($json);
531
+			header('Content-Type: application/json');
532
+			echo json_encode($json);
533 533
 
534
-		break;
534
+			break;
535 535
 
536
-	case 'pokemon_slider_init':
537
-		$bounds		= $manager->getPokemonSliederMinMax();
536
+		case 'pokemon_slider_init':
537
+			$bounds		= $manager->getPokemonSliederMinMax();
538 538
 
539
-		header('Content-Type: application/json');
540
-		echo json_encode($bounds);
539
+			header('Content-Type: application/json');
540
+			echo json_encode($bounds);
541 541
 
542
-		break;
542
+			break;
543 543
 
544 544
 
545
-	case 'pokemon_heatmap_points':
546
-		$json = "";
547
-		if (isset($_GET['start']) && isset($_GET['end']) && isset($_GET['pokemon_id'])) {
548
-			$start = date("Y-m-d H:i", (int) $_GET['start']);
549
-			$end = date("Y-m-d H:i", (int) $_GET['end']);
550
-			$pokemon_id = $manager->getEcapedString($_GET['pokemon_id']);
551
-			$points = $manager->getPokemonHeatmap($pokemon_id, $start, $end);
545
+		case 'pokemon_heatmap_points':
546
+			$json = "";
547
+			if (isset($_GET['start']) && isset($_GET['end']) && isset($_GET['pokemon_id'])) {
548
+				$start = date("Y-m-d H:i", (int) $_GET['start']);
549
+				$end = date("Y-m-d H:i", (int) $_GET['end']);
550
+				$pokemon_id = $manager->getEcapedString($_GET['pokemon_id']);
551
+				$points = $manager->getPokemonHeatmap($pokemon_id, $start, $end);
552 552
 
553
-			$json = json_encode($points);
554
-		}
553
+				$json = json_encode($points);
554
+			}
555 555
 
556
-		header('Content-Type: application/json');
557
-		echo $json;
558
-		break;
556
+			header('Content-Type: application/json');
557
+			echo $json;
558
+			break;
559 559
 
560 560
 
561
-	case 'maps_localization_coordinates':
562
-		$coordinates = $manager->getMapsCoords();
561
+		case 'maps_localization_coordinates':
562
+			$coordinates = $manager->getMapsCoords();
563 563
 
564
-		header('Content-Type: application/json');
565
-		echo json_encode($coordinates);
564
+			header('Content-Type: application/json');
565
+			echo json_encode($coordinates);
566 566
 
567
-		break;
567
+			break;
568 568
 
569 569
 
570
-	case 'pokemon_graph_data':
571
-		$json = "";
572
-		if (isset($_GET['pokemon_id'])) {
573
-			$pokemon_id = $manager->getEcapedString($_GET['pokemon_id']);
574
-			$array = $manager->getPokemonGraph($pokemon_id);
570
+		case 'pokemon_graph_data':
571
+			$json = "";
572
+			if (isset($_GET['pokemon_id'])) {
573
+				$pokemon_id = $manager->getEcapedString($_GET['pokemon_id']);
574
+				$array = $manager->getPokemonGraph($pokemon_id);
575 575
 
576
-			$json = json_encode($array);
577
-		}
576
+				$json = json_encode($array);
577
+			}
578 578
 
579
-		header('Content-Type: application/json');
580
-		echo $json;
581
-		break;
579
+			header('Content-Type: application/json');
580
+			echo $json;
581
+			break;
582 582
 
583 583
 
584
-	case 'postRequest':
585
-		break;
584
+		case 'postRequest':
585
+			break;
586 586
 
587
-	default:
588
-		echo "What do you mean?";
589
-		exit();
590
-	break;
587
+		default:
588
+			echo "What do you mean?";
589
+			exit();
590
+		break;
591 591
 }
592 592
 
593 593
 if ($postRequest != "") {
Please login to merge, or discard this patch.
install/tester.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -3,7 +3,7 @@
 block discarded – undo
3 3
 // Load Query Manager
4 4
 // ###################
5 5
 
6
-include_once __DIR__ . '/../core/process/queries/QueryManager.php';
6
+include_once __DIR__.'/../core/process/queries/QueryManager.php';
7 7
 
8 8
 
9 9
 ########################################################################
Please login to merge, or discard this patch.
core/process/queries/QueryManagerPostgresql.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-include_once __DIR__ . '/QueryManagerPostgresqlMonocleAlternate.php';
3
+include_once __DIR__.'/QueryManagerPostgresqlMonocleAlternate.php';
4 4
 
5 5
 
6 6
 abstract class QueryManagerPostgresql extends QueryManager {
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
 		$this->db = pg_connect("host=".SYS_DB_HOST." port=".SYS_DB_PORT." dbname=".SYS_DB_NAME." user=".SYS_DB_USER." password=".SYS_DB_PSWD);
13 13
 
14 14
 		if ($this->db === false) {
15
-			header('Location:' . HOST_URL . 'offline.html');
15
+			header('Location:'.HOST_URL.'offline.html');
16 16
 			exit();
17 17
 		}
18 18
 	}
Please login to merge, or discard this patch.
Braces   +8 added lines, -4 removed lines patch added patch discarded remove patch
@@ -3,11 +3,13 @@  discard block
 block discarded – undo
3 3
 include_once __DIR__ . '/QueryManagerPostgresqlMonocleAlternate.php';
4 4
 
5 5
 
6
-abstract class QueryManagerPostgresql extends QueryManager {
6
+abstract class QueryManagerPostgresql extends QueryManager
7
+{
7 8
 
8 9
 	protected $db;
9 10
 
10
-	protected function __construct() {
11
+	protected function __construct()
12
+	{
11 13
 
12 14
 		$this->db = pg_connect("host=".SYS_DB_HOST." port=".SYS_DB_PORT." dbname=".SYS_DB_NAME." user=".SYS_DB_USER." password=".SYS_DB_PSWD);
13 15
 
@@ -17,7 +19,8 @@  discard block
 block discarded – undo
17 19
 		}
18 20
 	}
19 21
 
20
-	public function __destruct() {
22
+	public function __destruct()
23
+	{
21 24
 		pg_close($this->db);
22 25
 	}
23 26
 
@@ -25,7 +28,8 @@  discard block
 block discarded – undo
25 28
 	// Misc
26 29
 	/////////
27 30
 
28
-	public function getEcapedString($string) {
31
+	public function getEcapedString($string)
32
+	{
29 33
 		return pg_escape_string($this->db, $string);
30 34
 	}
31 35
 
Please login to merge, or discard this patch.
core/process/queries/QueryManagerMysqlMonocleAlternate.php 2 patches
Braces   +76 added lines, -38 removed lines patch added patch discarded remove patch
@@ -1,12 +1,15 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-class QueryManagerMysqlMonocleAlternate extends QueryManagerMysql {
3
+class QueryManagerMysqlMonocleAlternate extends QueryManagerMysql
4
+{
4 5
 
5
-	public function __construct() {
6
+	public function __construct()
7
+	{
6 8
 		parent::__construct();
7 9
 	}
8 10
 
9
-	public function __destruct() {
11
+	public function __destruct()
12
+	{
10 13
 		parent::__destruct();
11 14
 	}
12 15
 
@@ -14,7 +17,8 @@  discard block
 block discarded – undo
14 17
 	// Tester
15 18
 	///////////
16 19
 
17
-	function testTotalPokemon() {
20
+	function testTotalPokemon()
21
+	{
18 22
 		$req = "SELECT COUNT(*) as total FROM sightings";
19 23
 		$result = $this->mysqli->query($req);
20 24
 		if (!is_object($result)) {
@@ -30,7 +34,8 @@  discard block
 block discarded – undo
30 34
 		return 0;
31 35
 	}
32 36
 
33
-	function testTotalGyms() {
37
+	function testTotalGyms()
38
+	{
34 39
 		$req = "SELECT COUNT(*) as total FROM forts";
35 40
 		$result = $this->mysqli->query($req);
36 41
 		if (!is_object($result)) {
@@ -46,7 +51,8 @@  discard block
 block discarded – undo
46 51
 		return 0;
47 52
 	}
48 53
 
49
-	function testTotalPokestops() {
54
+	function testTotalPokestops()
55
+	{
50 56
 		$req = "SELECT COUNT(*) as total FROM pokestops";
51 57
 		$result = $this->mysqli->query($req);
52 58
 		if (!is_object($result)) {
@@ -67,26 +73,30 @@  discard block
 block discarded – undo
67 73
 	// Homepage
68 74
 	/////////////
69 75
 
70
-	function getTotalPokemon() {
76
+	function getTotalPokemon()
77
+	{
71 78
 		$req = "SELECT COUNT(*) AS total FROM sightings WHERE expire_timestamp >= UNIX_TIMESTAMP()";
72 79
 		$result = $this->mysqli->query($req);
73 80
 		$data = $result->fetch_object();
74 81
 		return $data;
75 82
 	}
76 83
 
77
-	function getTotalLures() {
84
+	function getTotalLures()
85
+	{
78 86
 		$data = (object) array("total" => 0);
79 87
 		return $data;
80 88
 	}
81 89
 
82
-	function getTotalGyms() {
90
+	function getTotalGyms()
91
+	{
83 92
 		$req = "SELECT COUNT(*) AS total FROM forts";
84 93
 		$result = $this->mysqli->query($req);
85 94
 		$data = $result->fetch_object();
86 95
 		return $data;
87 96
 	}
88 97
 
89
-	function getTotalRaids() {
98
+	function getTotalRaids()
99
+	{
90 100
 		$req = "SELECT COUNT(*) AS total FROM raids WHERE time_battle <= UNIX_TIMESTAMP() AND time_end >= UNIX_TIMESTAMP()";
91 101
 		$result = $this->mysqli->query($req);
92 102
 		$data = $result->fetch_object();
@@ -94,14 +104,16 @@  discard block
 block discarded – undo
94 104
 	}
95 105
 
96 106
 
97
-	function getTotalGymsForTeam($team_id) {
107
+	function getTotalGymsForTeam($team_id)
108
+	{
98 109
 		$req = "SELECT COUNT(*) AS total FROM fort_sightings WHERE team = '$team_id'";
99 110
 		$result = $this->mysqli->query($req);
100 111
 		$data = $result->fetch_object();
101 112
 		return $data;
102 113
 	}
103 114
 
104
-	function getRecentAll() {
115
+	function getRecentAll()
116
+	{
105 117
 		$req = "SELECT DISTINCT pokemon_id, encounter_id, FROM_UNIXTIME(expire_timestamp) AS disappear_time, FROM_UNIXTIME(updated) AS last_modified, FROM_UNIXTIME(expire_timestamp) AS disappear_time_real,
106 118
               lat AS latitude, lon AS longitude, cp, atk_iv AS individual_attack, def_iv AS individual_defense, sta_iv AS individual_stamina
107 119
               FROM sightings
@@ -117,7 +129,8 @@  discard block
 block discarded – undo
117 129
 		return $data;
118 130
 	}
119 131
 
120
-	function getRecentMythic($mythic_pokemon) {
132
+	function getRecentMythic($mythic_pokemon)
133
+	{
121 134
 		$req = "SELECT DISTINCT pokemon_id as pokemon_id, CONCAT('A', encounter_id) as encounter_id, FROM_UNIXTIME(expire_timestamp) AS disappear_time, FROM_UNIXTIME(updated) AS last_modified, FROM_UNIXTIME(expire_timestamp) AS disappear_time_real,
122 135
                 lat AS latitude, lon AS longitude, cp, atk_iv AS individual_attack, def_iv AS individual_defense, sta_iv AS individual_stamina
123 136
                 FROM sightings
@@ -138,14 +151,16 @@  discard block
 block discarded – undo
138 151
 	// Single Pokemon
139 152
 	///////////////////
140 153
 
141
-	function getGymsProtectedByPokemon($pokemon_id) {
154
+	function getGymsProtectedByPokemon($pokemon_id)
155
+	{
142 156
 		$req = "SELECT COUNT(DISTINCT(fort_id)) AS total FROM fort_sightings WHERE guard_pokemon_id = '".$pokemon_id."'";
143 157
 		$result = $this->mysqli->query($req);
144 158
 		$data = $result->fetch_object();
145 159
 		return $data;
146 160
 	}
147 161
 
148
-	function getPokemonLastSeen($pokemon_id) {
162
+	function getPokemonLastSeen($pokemon_id)
163
+	{
149 164
 		$req = "SELECT FROM_UNIXTIME(expire_timestamp) AS expire_timestamp, FROM_UNIXTIME(expire_timestamp) AS disappear_time_real, lat AS latitude, lon AS longitude
150 165
                 FROM sightings
151 166
                 WHERE pokemon_id = '".$pokemon_id."'
@@ -156,7 +171,8 @@  discard block
 block discarded – undo
156 171
 		return $data;
157 172
 	}
158 173
 
159
-	function getTop50Pokemon($pokemon_id, $top_order_by, $top_direction) {
174
+	function getTop50Pokemon($pokemon_id, $top_order_by, $top_direction)
175
+	{
160 176
 		$req = "SELECT FROM_UNIXTIME(expire_timestamp) AS distime, pokemon_id as pokemon_id, FROM_UNIXTIME(expire_timestamp) as disappear_time, lat as latitude, lon as longitude,
161 177
                 cp, atk_iv as individual_attack, def_iv as individual_defense, sta_iv as individual_stamina,
162 178
                 ROUND(100*(atk_iv+def_iv+sta_iv)/45,1) AS IV, move_1 as move_1, move_2, form
@@ -174,7 +190,8 @@  discard block
 block discarded – undo
174 190
 		return $top;
175 191
 	}
176 192
 
177
-	function getTop50Trainers($pokemon_id, $best_order_by, $best_direction) {
193
+	function getTop50Trainers($pokemon_id, $best_order_by, $best_direction)
194
+	{
178 195
 		$trainer_blacklist = "";
179 196
 		if (!empty(self::$config->system->trainer_blacklist)) {
180 197
 			$trainer_blacklist = " AND owner_name NOT IN ('" . implode("','", self::$config->system->trainer_blacklist) . "')";
@@ -196,7 +213,8 @@  discard block
 block discarded – undo
196 213
 		return $toptrainer;
197 214
 	}
198 215
 
199
-	public function getPokemonHeatmap($pokemon_id, $start, $end) {
216
+	public function getPokemonHeatmap($pokemon_id, $start, $end)
217
+	{
200 218
 		$where = " WHERE pokemon_id = ".$pokemon_id." "
201 219
 			. "AND FROM_UNIXTIME(expire_timestamp) BETWEEN '".$start."' AND '".$end."'";
202 220
 		$req 		= "SELECT lat AS latitude, lon AS longitude FROM sightings".$where." ORDER BY expire_timestamp DESC LIMIT 100000";
@@ -208,7 +226,8 @@  discard block
 block discarded – undo
208 226
 		return $points;
209 227
 	}
210 228
 
211
-	public function getPokemonGraph($pokemon_id) {
229
+	public function getPokemonGraph($pokemon_id)
230
+	{
212 231
 		$req = "SELECT COUNT(*) AS total, HOUR(disappear_time) AS disappear_hour
213 232
 					FROM (SELECT FROM_UNIXTIME(expire_timestamp) as disappear_time FROM sightings WHERE pokemon_id = '".$pokemon_id."' ORDER BY disappear_time LIMIT 100000) AS pokemonFiltered
214 233
 				GROUP BY disappear_hour
@@ -224,7 +243,8 @@  discard block
 block discarded – undo
224 243
 		return $array;
225 244
 	}
226 245
 
227
-	public function getPokemonLive($pokemon_id, $ivMin, $ivMax, $inmap_pokemons) {
246
+	public function getPokemonLive($pokemon_id, $ivMin, $ivMax, $inmap_pokemons)
247
+	{
228 248
 		$inmap_pkms_filter = "";
229 249
 		$where = " WHERE expire_timestamp >= UNIX_TIMESTAMP() AND pokemon_id = " . $pokemon_id;
230 250
 
@@ -260,14 +280,16 @@  discard block
 block discarded – undo
260 280
 		return $spawns;
261 281
 	}
262 282
 
263
-	public function getPokemonSliederMinMax() {
283
+	public function getPokemonSliederMinMax()
284
+	{
264 285
 		$req = "SELECT FROM_UNIXTIME(MIN(expire_timestamp)) AS min, FROM_UNIXTIME(MAX(expire_timestamp)) AS max FROM sightings";
265 286
 		$result = $this->mysqli->query($req);
266 287
 		$data = $result->fetch_object();
267 288
 		return $data;
268 289
 	}
269 290
 
270
-	public function getMapsCoords() {
291
+	public function getMapsCoords()
292
+	{
271 293
 		$req = "SELECT MAX(lat) AS max_latitude, MIN(lat) AS min_latitude, MAX(lon) AS max_longitude, MIN(lon) as min_longitude FROM spawnpoints";
272 294
 		$result = $this->mysqli->query($req);
273 295
 		$data = $result->fetch_object();
@@ -280,14 +302,16 @@  discard block
 block discarded – undo
280 302
 	//////////////
281 303
 
282 304
 
283
-	function getTotalPokestops() {
305
+	function getTotalPokestops()
306
+	{
284 307
 		$req = "SELECT COUNT(*) as total FROM pokestops";
285 308
 		$result = $this->mysqli->query($req);
286 309
 		$data = $result->fetch_object();
287 310
 		return $data;
288 311
 	}
289 312
 
290
-	public function getAllPokestops() {
313
+	public function getAllPokestops()
314
+	{
291 315
 		$req = "SELECT lat as latitude, lon as longitude, null AS lure_expiration, UNIX_TIMESTAMP() AS now, null AS lure_expiration_real FROM pokestops";
292 316
 		$result = $this->mysqli->query($req);
293 317
 		$pokestops = array();
@@ -302,7 +326,8 @@  discard block
 block discarded – undo
302 326
 	// Gyms
303 327
 	/////////
304 328
 
305
-	function getTeamGuardians($team_id) {
329
+	function getTeamGuardians($team_id)
330
+	{
306 331
 		$req = "SELECT COUNT(*) AS total, guard_pokemon_id FROM fort_sightings WHERE team = '".$team_id."' GROUP BY guard_pokemon_id ORDER BY total DESC LIMIT 0,3";
307 332
 		$result = $this->mysqli->query($req);
308 333
 
@@ -314,7 +339,8 @@  discard block
 block discarded – undo
314 339
 		return $datas;
315 340
 	}
316 341
 
317
-	function getOwnedAndPoints($team_id) {
342
+	function getOwnedAndPoints($team_id)
343
+	{
318 344
 		$req = "SELECT COUNT(DISTINCT(fs.fort_id)) AS total, ROUND((SUM(gd.cp)) / COUNT(DISTINCT(fs.fort_id)),0) AS average_points
319 345
         			FROM fort_sightings fs
320 346
         			JOIN gym_defenders gd ON fs.fort_id = gd.fort_id
@@ -324,7 +350,8 @@  discard block
 block discarded – undo
324 350
 		return $data;
325 351
 	}
326 352
 
327
-	function getAllGyms() {
353
+	function getAllGyms()
354
+	{
328 355
 		$req = "SELECT f.id as gym_id, team as team_id, f.lat as latitude, f.lon as longitude, updated as last_scanned, (6 - fs.slots_available) AS level FROM forts f LEFT JOIN fort_sightings fs ON f.id = fs.fort_id;";
329 356
 		$result = $this->mysqli->query($req);
330 357
 		$gyms = array();
@@ -334,7 +361,8 @@  discard block
 block discarded – undo
334 361
 		return $gyms;
335 362
 	}
336 363
 
337
-	public function getGymData($gym_id) {
364
+	public function getGymData($gym_id)
365
+	{
338 366
 		$req = "SELECT f.name AS name, null AS description, f.url AS url, fs.team AS team, FROM_UNIXTIME(fs.updated) AS last_scanned, fs.guard_pokemon_id AS guard_pokemon_id, (6 - fs.slots_available) AS level, SUM(gd.cp) as total_cp	
339 367
 			FROM fort_sightings fs
340 368
 			LEFT JOIN forts f ON f.id = fs.fort_id
@@ -345,7 +373,8 @@  discard block
 block discarded – undo
345 373
 		return $data;
346 374
 	}
347 375
 
348
-	public function getGymDefenders($gym_id) {
376
+	public function getGymDefenders($gym_id)
377
+	{
349 378
 		$req = "SELECT DISTINCT external_id as pokemon_uid, pokemon_id, atk_iv as iv_attack, def_iv as iv_defense, sta_iv as iv_stamina, cp, fort_id as gym_id
350 379
 			FROM gym_defenders 
351 380
 			WHERE fort_id='".$gym_id."'
@@ -363,7 +392,8 @@  discard block
 block discarded – undo
363 392
 	// Raids
364 393
 	///////////
365 394
 
366
-	public function getAllRaids($page) {
395
+	public function getAllRaids($page)
396
+	{
367 397
 		$limit = " LIMIT ".($page * 10).",10";
368 398
 		$req = "SELECT r.fort_id AS gym_id, r.level AS level, r.pokemon_id AS pokemon_id, r.cp AS cp, r.move_1 AS move_1, r.move_2 AS move_2, FROM_UNIXTIME(r.time_spawn) AS spawn, FROM_UNIXTIME(r.time_battle) AS start, FROM_UNIXTIME(r.time_end) AS end, FROM_UNIXTIME(fs.updated) AS last_scanned, f.name, f.lat AS latitude, f.lon as longitude 
369 399
 					FROM raids r 
@@ -384,11 +414,13 @@  discard block
 block discarded – undo
384 414
 	// Trainers
385 415
 	//////////////
386 416
 
387
-	public function getTrainers($trainer_name, $team, $page, $ranking) {
417
+	public function getTrainers($trainer_name, $team, $page, $ranking)
418
+	{
388 419
 		return array(); // Waiting for Monocle to store level
389 420
 	}
390 421
 
391
-	public function getTrainerLevelCount($team_id) {
422
+	public function getTrainerLevelCount($team_id)
423
+	{
392 424
 		$levelData = array();
393 425
 		for ($i = 5; $i <= 40; $i++) {
394 426
 			if (!isset($levelData[$i])) {
@@ -403,7 +435,8 @@  discard block
 block discarded – undo
403 435
 	// Cron
404 436
 	/////////
405 437
 
406
-	public function getPokemonCountsActive() {
438
+	public function getPokemonCountsActive()
439
+	{
407 440
 		$req = "SELECT pokemon_id, COUNT(*) as total FROM sightings WHERE expire_timestamp >= UNIX_TIMESTAMP() GROUP BY pokemon_id";
408 441
 		$result = $this->mysqli->query($req);
409 442
 		$counts = array();
@@ -413,7 +446,8 @@  discard block
 block discarded – undo
413 446
 		return $counts;
414 447
 	}
415 448
 
416
-	public function getPoekmonCountsLastDay() {
449
+	public function getPoekmonCountsLastDay()
450
+	{
417 451
 		$req = "SELECT pokemon_id, COUNT(*) AS spawns_last_day
418 452
 					FROM sightings
419 453
 					WHERE FROM_UNIXTIME(expire_timestamp) >= (SELECT FROM_UNIXTIME(MAX(expire_timestamp)) FROM sightings) - INTERVAL 1 DAY
@@ -427,7 +461,8 @@  discard block
 block discarded – undo
427 461
 		return $counts;
428 462
 	}
429 463
 
430
-	public function getPokemonSinceLastUpdate($pokemon_id, $last_update) {
464
+	public function getPokemonSinceLastUpdate($pokemon_id, $last_update)
465
+	{
431 466
 		$req = "SELECT COUNT(*) AS count, MAX(expire_timestamp) AS last_timestamp, (FROM_UNIXTIME(MAX(expire_timestamp))) AS disappear_time_real, lat as latitude, lon as longitude
432 467
 					FROM sightings
433 468
 					WHERE pokemon_id = '".$pokemon_id."' && expire_timestamp > '".$last_update."'";
@@ -436,7 +471,8 @@  discard block
 block discarded – undo
436 471
 		return $data;
437 472
 	}
438 473
 
439
-	public function getRaidsSinceLastUpdate($pokemon_id, $last_update) {
474
+	public function getRaidsSinceLastUpdate($pokemon_id, $last_update)
475
+	{
440 476
 		$where = "WHERE pokemon_id = '".$pokemon_id."' && time_battle > '".$last_update."'";
441 477
 		$req = "SELECT time_battle AS start_timestamp, time_end as end, (FROM_UNIXTIME(time_end)) AS end_time_real, lat as latitude, lon as longitude, count
442 478
 					FROM raids r
@@ -454,14 +490,16 @@  discard block
 block discarded – undo
454 490
 		return $data;
455 491
 	}
456 492
 
457
-	public function getCaptchaCount() {
493
+	public function getCaptchaCount()
494
+	{
458 495
 		$req = " SELECT COUNT(*) as total FROM accounts WHERE captchaed IS NOT NULL AND reason IS NULL";
459 496
 		$result = $this->mysqli->query($req);
460 497
 		$data = $result->fetch_object();
461 498
 		return $data;
462 499
 	}
463 500
 
464
-	public function getNestData() {
501
+	public function getNestData()
502
+	{
465 503
 		$pokemon_exclude_sql = "";
466 504
 		if (!empty(self::$config->system->nest_exclude_pokemon)) {
467 505
 			$pokemon_exclude_sql = "AND p.pokemon_id NOT IN (" . implode(",", self::$config->system->nest_exclude_pokemon) . ")";
Please login to merge, or discard this patch.
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -161,7 +161,7 @@  discard block
 block discarded – undo
161 161
                 cp, atk_iv as individual_attack, def_iv as individual_defense, sta_iv as individual_stamina,
162 162
                 ROUND(100*(atk_iv+def_iv+sta_iv)/45,1) AS IV, move_1 as move_1, move_2, form
163 163
                 FROM sightings
164
-	            WHERE pokemon_id = '" . $pokemon_id . "' AND move_1 IS NOT NULL AND move_1 <> '0'
164
+	            WHERE pokemon_id = '" . $pokemon_id."' AND move_1 IS NOT NULL AND move_1 <> '0'
165 165
 	            GROUP BY encounter_id
166 166
 	            ORDER BY $top_order_by $top_direction, expire_timestamp DESC
167 167
 	            LIMIT 0,50";
@@ -177,13 +177,13 @@  discard block
 block discarded – undo
177 177
 	function getTop50Trainers($pokemon_id, $best_order_by, $best_direction) {
178 178
 		$trainer_blacklist = "";
179 179
 		if (!empty(self::$config->system->trainer_blacklist)) {
180
-			$trainer_blacklist = " AND owner_name NOT IN ('" . implode("','", self::$config->system->trainer_blacklist) . "')";
180
+			$trainer_blacklist = " AND owner_name NOT IN ('".implode("','", self::$config->system->trainer_blacklist)."')";
181 181
 		}
182 182
 
183 183
 		$req = "SELECT owner_name as trainer_name, ROUND((100*((atk_iv)+(def_iv)+(sta_iv))/45),1) AS IV, move_1, move_2, cp as cp,
184 184
                 FROM_UNIXTIME(last_modified) AS lasttime, last_modified as last_seen
185 185
                 FROM gym_defenders
186
-				WHERE pokemon_id = '" . $pokemon_id . "'" . $trainer_blacklist . "
186
+				WHERE pokemon_id = '" . $pokemon_id."'".$trainer_blacklist."
187 187
 				GROUP BY external_id, 
188 188
 				ORDER BY $best_order_by $best_direction, owner_name ASC
189 189
 				LIMIT 0,50";
@@ -226,9 +226,9 @@  discard block
 block discarded – undo
226 226
 
227 227
 	public function getPokemonLive($pokemon_id, $ivMin, $ivMax, $inmap_pokemons) {
228 228
 		$inmap_pkms_filter = "";
229
-		$where = " WHERE expire_timestamp >= UNIX_TIMESTAMP() AND pokemon_id = " . $pokemon_id;
229
+		$where = " WHERE expire_timestamp >= UNIX_TIMESTAMP() AND pokemon_id = ".$pokemon_id;
230 230
 
231
-		$reqTestIv = "SELECT MAX(atk_iv) AS iv FROM sightings " . $where;
231
+		$reqTestIv = "SELECT MAX(atk_iv) AS iv FROM sightings ".$where;
232 232
 		$resultTestIv = $this->mysqli->query($reqTestIv);
233 233
 		$testIv = $resultTestIv->fetch_object();
234 234
 		if (!is_null($inmap_pokemons) && ($inmap_pokemons != "")) {
@@ -236,20 +236,20 @@  discard block
 block discarded – undo
236 236
 				$inmap_pkms_filter .= "'".$inmap."',";
237 237
 			}
238 238
 			$inmap_pkms_filter = rtrim($inmap_pkms_filter, ",");
239
-			$where .= " AND encounter_id NOT IN (" . $inmap_pkms_filter . ") ";
239
+			$where .= " AND encounter_id NOT IN (".$inmap_pkms_filter.") ";
240 240
 		}
241 241
 		if ($testIv->iv != null && !is_null($ivMin) && ($ivMin != "")) {
242
-			$where .= " AND ((100/45)*(atk_iv + def_iv + sta_iv)) >= (" . $ivMin . ") ";
242
+			$where .= " AND ((100/45)*(atk_iv + def_iv + sta_iv)) >= (".$ivMin.") ";
243 243
 		}
244 244
 		if ($testIv->iv != null && !is_null($ivMax) && ($ivMax != "")) {
245
-			$where .= " AND ((100/45)*(atk_iv + def_iv + sta_iv)) <= (" . $ivMax . ") ";
245
+			$where .= " AND ((100/45)*(atk_iv + def_iv + sta_iv)) <= (".$ivMax.") ";
246 246
 		}
247 247
 		$req = "SELECT pokemon_id, lat AS latitude, lon AS longitude,
248 248
     					FROM_UNIXTIME(expire_timestamp) AS disappear_time,
249 249
     					FROM_UNIXTIME(expire_timestamp) AS disappear_time_real,
250 250
     					atk_iv AS individual_attack, def_iv AS individual_defense, sta_iv AS individual_stamina,
251 251
    						move_1, move_2
252
-					FROM sightings " . $where . "
252
+					FROM sightings " . $where."
253 253
 					ORDER BY disappear_time DESC
254 254
 					LIMIT 5000";
255 255
 		$result = $this->mysqli->query($req);
@@ -318,7 +318,7 @@  discard block
 block discarded – undo
318 318
 		$req = "SELECT COUNT(DISTINCT(fs.fort_id)) AS total, ROUND((SUM(gd.cp)) / COUNT(DISTINCT(fs.fort_id)),0) AS average_points
319 319
         			FROM fort_sightings fs
320 320
         			JOIN gym_defenders gd ON fs.fort_id = gd.fort_id
321
-        			WHERE fs.team = '" . $team_id . "'";
321
+        			WHERE fs.team = '" . $team_id."'";
322 322
 		$result = $this->mysqli->query($req);
323 323
 		$data = $result->fetch_object();
324 324
 		return $data;
@@ -446,7 +446,7 @@  discard block
 block discarded – undo
446 446
                     " . $where."
447 447
                 ) x 
448 448
 				ON r.fort_id = g.id
449
-                " . $where . "
449
+                " . $where."
450 450
                 ORDER BY time_battle DESC
451 451
 				LIMIT 0 , 1";
452 452
 		$result = $this->mysqli->query($req);
@@ -464,13 +464,13 @@  discard block
 block discarded – undo
464 464
 	public function getNestData() {
465 465
 		$pokemon_exclude_sql = "";
466 466
 		if (!empty(self::$config->system->nest_exclude_pokemon)) {
467
-			$pokemon_exclude_sql = "AND p.pokemon_id NOT IN (" . implode(",", self::$config->system->nest_exclude_pokemon) . ")";
467
+			$pokemon_exclude_sql = "AND p.pokemon_id NOT IN (".implode(",", self::$config->system->nest_exclude_pokemon).")";
468 468
 		}
469 469
 		$req = "SELECT p.pokemon_id, p.lat AS latitude, p.lon AS longitude, count(p.pokemon_id) AS total_pokemon, FROM_UNIXTIME(s.updated) as latest_seen, coalesce(duration,30)*60 as duration
470 470
 			          FROM sightings p
471 471
 			          INNER JOIN spawnpoints s ON (p.spawn_id = s.spawn_id)
472 472
 			          WHERE p.expire_timestamp > UNIX_TIMESTAMP() - 86400
473
-			          " . $pokemon_exclude_sql . "
473
+			          " . $pokemon_exclude_sql."
474 474
 			          GROUP BY p.spawn_id, p.pokemon_id
475 475
 			          HAVING COUNT(p.pokemon_id) >= 6
476 476
 			          ORDER BY p.pokemon_id";
Please login to merge, or discard this patch.
core/process/queries/QueryManagerMysqlRocketmap.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -302,7 +302,7 @@  discard block
 block discarded – undo
302 302
 	/////////
303 303
 
304 304
 	function getTeamGuardians($team_id) {
305
-		$req = "SELECT COUNT(*) AS total, guard_pokemon_id FROM gym WHERE team_id = '".$team_id ."' GROUP BY guard_pokemon_id ORDER BY total DESC LIMIT 0,3";
305
+		$req = "SELECT COUNT(*) AS total, guard_pokemon_id FROM gym WHERE team_id = '".$team_id."' GROUP BY guard_pokemon_id ORDER BY total DESC LIMIT 0,3";
306 306
 		$result = $this->mysqli->query($req);
307 307
 		$datas = array();
308 308
 		while ($data = $result->fetch_object()) {
@@ -455,7 +455,7 @@  discard block
 block discarded – undo
455 455
 				FROM gympokemon
456 456
 				INNER JOIN (SELECT gymmember.pokemon_uid, gymmember.gym_id FROM gymmember GROUP BY gymmember.pokemon_uid, gymmember.gym_id HAVING gymmember.gym_id <> '') AS filtered_gymmember
457 457
 				ON gympokemon.pokemon_uid = filtered_gymmember.pokemon_uid) AS actives_pokemons ON actives_pokemons.trainer_name = trainer.name
458
-				GROUP BY trainer.name " . $where . $order . $limit;
458
+				GROUP BY trainer.name " . $where.$order.$limit;
459 459
 
460 460
 		$result = $this->mysqli->query($req);
461 461
 		$trainers = array();
@@ -476,7 +476,7 @@  discard block
 block discarded – undo
476 476
 		return $data;
477 477
 	}
478 478
 
479
-	private function getTrainerActivePokemon($trainer_name){
479
+	private function getTrainerActivePokemon($trainer_name) {
480 480
 		$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, CONVERT_TZ(filtered_gymmember.deployment_time, '+00:00', '".self::$time_offset."') as deployment_time, '1' AS active
481 481
 					FROM gympokemon INNER JOIN
482 482
 					(SELECT gymmember.pokemon_uid, gymmember.gym_id, gymmember.deployment_time FROM gymmember GROUP BY gymmember.pokemon_uid, gymmember.deployment_time, gymmember.gym_id HAVING gymmember.gym_id <> '') AS filtered_gymmember
@@ -491,7 +491,7 @@  discard block
 block discarded – undo
491 491
 		return $pokemons;
492 492
 	}
493 493
 
494
-	private function getTrainerInactivePokemon($trainer_name){
494
+	private function getTrainerInactivePokemon($trainer_name) {
495 495
 		$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, null AS gym_id, CONVERT_TZ(filtered_gymmember.deployment_time, '+00:00', '".self::$time_offset."') as deployment_time, '0' AS active
496 496
 					FROM gympokemon LEFT JOIN
497 497
 					(SELECT * FROM gymmember HAVING gymmember.gym_id <> '') AS filtered_gymmember
@@ -578,7 +578,7 @@  discard block
 block discarded – undo
578 578
 			          FROM pokemon p 
579 579
 			          INNER JOIN spawnpoint s ON (p.spawnpoint_id = s.id) 
580 580
 			          WHERE p.disappear_time > UTC_TIMESTAMP() - INTERVAL 24 HOUR 
581
-			          " . $pokemon_exclude_sql . " 
581
+			          " . $pokemon_exclude_sql." 
582 582
 			          GROUP BY p.spawnpoint_id, p.pokemon_id 
583 583
 			          HAVING COUNT(p.pokemon_id) >= 6 
584 584
 			          ORDER BY p.pokemon_id";
Please login to merge, or discard this patch.
Braces   +84 added lines, -42 removed lines patch added patch discarded remove patch
@@ -1,12 +1,15 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-final class QueryManagerMysqlRocketmap extends QueryManagerMysql {
3
+final class QueryManagerMysqlRocketmap extends QueryManagerMysql
4
+{
4 5
 
5
-	public function __construct() {
6
+	public function __construct()
7
+	{
6 8
 		parent::__construct();
7 9
 	}
8 10
 
9
-	public function __destruct() {
11
+	public function __destruct()
12
+	{
10 13
 		parent::__destruct();
11 14
 	}
12 15
 
@@ -14,7 +17,8 @@  discard block
 block discarded – undo
14 17
 	// Tester
15 18
 	///////////
16 19
 	
17
-	function testTotalPokemon() {
20
+	function testTotalPokemon()
21
+	{
18 22
 		$req = "SELECT COUNT(*) as total FROM pokemon";
19 23
 		$result = $this->mysqli->query($req);
20 24
 		if (!is_object($result)) {
@@ -30,7 +34,8 @@  discard block
 block discarded – undo
30 34
 		return 0;
31 35
 	}
32 36
 	
33
-	function testTotalGyms() {
37
+	function testTotalGyms()
38
+	{
34 39
 		$req = "SELECT COUNT(*) as total FROM gym";
35 40
 		$result = $this->mysqli->query($req);
36 41
 		if (!is_object($result)) {
@@ -46,7 +51,8 @@  discard block
 block discarded – undo
46 51
 		return 0;
47 52
 	}
48 53
 	
49
-	function testTotalPokestops() {
54
+	function testTotalPokestops()
55
+	{
50 56
 		$req = "SELECT COUNT(*) as total FROM pokestop";
51 57
 		$result = $this->mysqli->query($req);
52 58
 		if (!is_object($result)) {
@@ -67,42 +73,48 @@  discard block
 block discarded – undo
67 73
 	// Homepage
68 74
 	/////////////
69 75
 	
70
-	function getTotalPokemon() {
76
+	function getTotalPokemon()
77
+	{
71 78
 		$req = "SELECT COUNT(*) AS total FROM pokemon WHERE disappear_time >= UTC_TIMESTAMP()";
72 79
 		$result = $this->mysqli->query($req);
73 80
 		$data = $result->fetch_object();
74 81
 		return $data;
75 82
 	}
76 83
 	
77
-	function getTotalLures() {
84
+	function getTotalLures()
85
+	{
78 86
 		$req = "SELECT COUNT(*) AS total FROM pokestop WHERE lure_expiration >= UTC_TIMESTAMP()";
79 87
 		$result = $this->mysqli->query($req);
80 88
 		$data = $result->fetch_object();
81 89
 		return $data;
82 90
 	}
83 91
 	
84
-	function getTotalGyms() {
92
+	function getTotalGyms()
93
+	{
85 94
 		$req = "SELECT COUNT(DISTINCT(gym_id)) AS total FROM gym";
86 95
 		$result = $this->mysqli->query($req);
87 96
 		$data = $result->fetch_object();
88 97
 		return $data;
89 98
 	}
90 99
 	
91
-	function getTotalRaids() {
100
+	function getTotalRaids()
101
+	{
92 102
 		$req = "SELECT COUNT(*) AS total FROM raid WHERE start <= UTC_TIMESTAMP AND  end >= UTC_TIMESTAMP()";
93 103
 		$result = $this->mysqli->query($req);
94 104
 		$data = $result->fetch_object();
95 105
 		return $data;
96 106
 	}
97 107
 	
98
-	function getTotalGymsForTeam($team_id) {
108
+	function getTotalGymsForTeam($team_id)
109
+	{
99 110
 		$req = "SELECT COUNT(DISTINCT(gym_id)) AS total FROM gym WHERE team_id = '".$team_id."'";
100 111
 		$result = $this->mysqli->query($req);
101 112
 		$data = $result->fetch_object();
102 113
 		return $data;
103 114
 	}
104 115
 	
105
-	function getRecentAll() {
116
+	function getRecentAll()
117
+	{
106 118
 		$req = "SELECT DISTINCT pokemon_id, encounter_id, disappear_time, last_modified, (CONVERT_TZ(disappear_time, '+00:00', '".self::$time_offset."')) AS disappear_time_real,
107 119
 					latitude, longitude, cp, individual_attack, individual_defense, individual_stamina
108 120
 					FROM pokemon
@@ -118,7 +130,8 @@  discard block
 block discarded – undo
118 130
 		return $data;
119 131
 	}
120 132
 	
121
-	function getRecentMythic($mythic_pokemons) {
133
+	function getRecentMythic($mythic_pokemons)
134
+	{
122 135
 		$req = "SELECT DISTINCT pokemon_id, encounter_id, disappear_time, last_modified, (CONVERT_TZ(disappear_time, '+00:00', '".self::$time_offset."')) AS disappear_time_real,
123 136
 					latitude, longitude, cp, individual_attack, individual_defense, individual_stamina
124 137
 					FROM pokemon
@@ -139,14 +152,16 @@  discard block
 block discarded – undo
139 152
 	// Single Pokemon
140 153
 	///////////////////
141 154
 	
142
-	function getGymsProtectedByPokemon($pokemon_id) {
155
+	function getGymsProtectedByPokemon($pokemon_id)
156
+	{
143 157
 		$req = "SELECT COUNT(DISTINCT(gym_id)) AS total FROM gym WHERE guard_pokemon_id = '".$pokemon_id."'";
144 158
 		$result = $this->mysqli->query($req);
145 159
 		$data = $result->fetch_object();
146 160
 		return $data;
147 161
 	}
148 162
 	
149
-	function getPokemonLastSeen($pokemon_id) {
163
+	function getPokemonLastSeen($pokemon_id)
164
+	{
150 165
 		$req = "SELECT disappear_time, (CONVERT_TZ(disappear_time, '+00:00', '".self::$time_offset."')) AS disappear_time_real, latitude, longitude
151 166
 							FROM pokemon
152 167
 							WHERE pokemon_id = '".$pokemon_id."'
@@ -157,7 +172,8 @@  discard block
 block discarded – undo
157 172
 		return $data;
158 173
 	}
159 174
 
160
-	function getTop50Pokemon($pokemon_id, $top_order_by, $top_direction) {
175
+	function getTop50Pokemon($pokemon_id, $top_order_by, $top_direction)
176
+	{
161 177
 		$req = "SELECT (CONVERT_TZ(disappear_time, '+00:00', '".self::$time_offset."')) AS distime, pokemon_id, disappear_time, latitude, longitude,
162 178
 							cp, individual_attack, individual_defense, individual_stamina,
163 179
 							ROUND(100*(individual_attack+individual_defense+individual_stamina)/45,1) AS IV, move_1, move_2, form
@@ -175,7 +191,8 @@  discard block
 block discarded – undo
175 191
 		return $top;
176 192
 	}
177 193
 
178
-	function getTop50Trainers($pokemon_id, $best_order_by, $best_direction) {
194
+	function getTop50Trainers($pokemon_id, $best_order_by, $best_direction)
195
+	{
179 196
 		$trainer_blacklist = "";
180 197
 		if (!empty(self::$config->system->trainer_blacklist)) {
181 198
 			$trainer_blacklist = " AND trainer_name NOT IN ('".implode("','", self::$config->system->trainer_blacklist)."')";
@@ -197,7 +214,8 @@  discard block
 block discarded – undo
197 214
 		return $toptrainer;
198 215
 	}
199 216
 
200
-	public function getPokemonHeatmap($pokemon_id, $start, $end) {
217
+	public function getPokemonHeatmap($pokemon_id, $start, $end)
218
+	{
201 219
 		$where = " WHERE pokemon_id = ".$pokemon_id." "
202 220
 			. "AND disappear_time BETWEEN '".$start."' AND '".$end."'";
203 221
 		$req 		= "SELECT latitude, longitude FROM pokemon".$where." ORDER BY disappear_time DESC LIMIT 10000";
@@ -209,7 +227,8 @@  discard block
 block discarded – undo
209 227
 		return $points;
210 228
 	}
211 229
 
212
-	public function getPokemonGraph($pokemon_id) {
230
+	public function getPokemonGraph($pokemon_id)
231
+	{
213 232
 		$req = "SELECT COUNT(*) AS total,
214 233
 					HOUR(CONVERT_TZ(disappear_time, '+00:00', '".self::$time_offset."')) AS disappear_hour
215 234
 					FROM (SELECT disappear_time FROM pokemon WHERE pokemon_id = '".$pokemon_id."' ORDER BY disappear_time LIMIT 100000) AS pokemonFiltered
@@ -226,7 +245,8 @@  discard block
 block discarded – undo
226 245
 		return $array;
227 246
 	}
228 247
 
229
-	public function getPokemonLive($pokemon_id, $ivMin, $ivMax, $inmap_pokemons) {
248
+	public function getPokemonLive($pokemon_id, $ivMin, $ivMax, $inmap_pokemons)
249
+	{
230 250
 		$inmap_pkms_filter = "";
231 251
 		$where = " WHERE disappear_time >= UTC_TIMESTAMP() AND pokemon_id = ".$pokemon_id;
232 252
 
@@ -260,14 +280,16 @@  discard block
 block discarded – undo
260 280
 		return $spawns;
261 281
 	}
262 282
 
263
-	public function getPokemonSliederMinMax() {
283
+	public function getPokemonSliederMinMax()
284
+	{
264 285
 		$req = "SELECT MIN(disappear_time) AS min, MAX(disappear_time) AS max FROM pokemon";
265 286
 		$result = $this->mysqli->query($req);
266 287
 		$data = $result->fetch_object();
267 288
 		return $data;
268 289
 	}
269 290
 
270
-	public function getMapsCoords() {
291
+	public function getMapsCoords()
292
+	{
271 293
 		$req = "SELECT MAX(latitude) AS max_latitude, MIN(latitude) AS min_latitude, MAX(longitude) AS max_longitude, MIN(longitude) as min_longitude FROM spawnpoint";
272 294
 		$result = $this->mysqli->query($req);
273 295
 		$data = $result->fetch_object();
@@ -279,14 +301,16 @@  discard block
 block discarded – undo
279 301
 	// Pokestops
280 302
 	//////////////
281 303
 
282
-	function getTotalPokestops() {
304
+	function getTotalPokestops()
305
+	{
283 306
 		$req = "SELECT COUNT(*) as total FROM pokestop";
284 307
 		$result = $this->mysqli->query($req);
285 308
 		$data = $result->fetch_object();
286 309
 		return $data;
287 310
 	}
288 311
 
289
-	public function getAllPokestops() {
312
+	public function getAllPokestops()
313
+	{
290 314
 		$req = "SELECT latitude, longitude, lure_expiration, UTC_TIMESTAMP() AS now, (CONVERT_TZ(lure_expiration, '+00:00', '".self::$time_offset."')) AS lure_expiration_real FROM pokestop";
291 315
 		$result = $this->mysqli->query($req);
292 316
 		$pokestops = array();
@@ -301,7 +325,8 @@  discard block
 block discarded – undo
301 325
 	// Gyms
302 326
 	/////////
303 327
 
304
-	function getTeamGuardians($team_id) {
328
+	function getTeamGuardians($team_id)
329
+	{
305 330
 		$req = "SELECT COUNT(*) AS total, guard_pokemon_id FROM gym WHERE team_id = '".$team_id ."' GROUP BY guard_pokemon_id ORDER BY total DESC LIMIT 0,3";
306 331
 		$result = $this->mysqli->query($req);
307 332
 		$datas = array();
@@ -311,14 +336,16 @@  discard block
 block discarded – undo
311 336
 		return $datas;
312 337
 	}
313 338
 
314
-	function getOwnedAndPoints($team_id) {
339
+	function getOwnedAndPoints($team_id)
340
+	{
315 341
 		$req 	= "SELECT COUNT(DISTINCT(gym_id)) AS total, ROUND(AVG(total_cp),0) AS average_points FROM gym WHERE team_id = '".$team_id."'";
316 342
 		$result = $this->mysqli->query($req);
317 343
 		$data = $result->fetch_object();
318 344
 		return $data;
319 345
 	}
320 346
 
321
-	function getAllGyms() {
347
+	function getAllGyms()
348
+	{
322 349
 		$req = "SELECT gym_id, team_id, latitude, longitude, (CONVERT_TZ(last_scanned, '+00:00', '".self::$time_offset."')) AS last_scanned, (6 - slots_available) AS level FROM gym";
323 350
 		$result = $this->mysqli->query($req);
324 351
 		$gyms = array();
@@ -328,7 +355,8 @@  discard block
 block discarded – undo
328 355
 		return $gyms;
329 356
 	}
330 357
 
331
-	public function getGymData($gym_id) {
358
+	public function getGymData($gym_id)
359
+	{
332 360
 		$req = "SELECT gymdetails.name AS name, gymdetails.description AS description, gymdetails.url AS url, gym.team_id AS team,
333 361
 					(CONVERT_TZ(gym.last_scanned, '+00:00', '".self::$time_offset."')) AS last_scanned, gym.guard_pokemon_id AS guard_pokemon_id, gym.total_cp AS total_cp, (6 - gym.slots_available) AS level
334 362
 					FROM gymdetails
@@ -339,7 +367,8 @@  discard block
 block discarded – undo
339 367
 		return $data;
340 368
 	}
341 369
 
342
-	public function getGymDefenders($gym_id) {
370
+	public function getGymDefenders($gym_id)
371
+	{
343 372
 		$req = "SELECT DISTINCT gympokemon.pokemon_uid, pokemon_id, iv_attack, iv_defense, iv_stamina, MAX(cp) AS cp, gymmember.gym_id
344 373
 					FROM gympokemon INNER JOIN gymmember ON gympokemon.pokemon_uid=gymmember.pokemon_uid
345 374
 					GROUP BY gympokemon.pokemon_uid, pokemon_id, iv_attack, iv_defense, iv_stamina, gym_id
@@ -358,7 +387,8 @@  discard block
 block discarded – undo
358 387
 	// Raids
359 388
 	///////////
360 389
 
361
-	public function getAllRaids($page) {
390
+	public function getAllRaids($page)
391
+	{
362 392
 		$limit = " LIMIT ".($page * 10).",10";
363 393
 		$req = "SELECT raid.gym_id, raid.level, raid.pokemon_id, raid.cp, raid.move_1, raid.move_2, CONVERT_TZ(raid.spawn, '+00:00', '".self::$time_offset."') AS spawn, CONVERT_TZ(raid.start, '+00:00', '".self::$time_offset."') AS start, CONVERT_TZ(raid.end, '+00:00', '".self::$time_offset."') AS end, CONVERT_TZ(raid.last_scanned, '+00:00', '".self::$time_offset."') AS last_scanned, gymdetails.name, gym.latitude, gym.longitude FROM raid
364 394
 					JOIN gymdetails ON gymdetails.gym_id = raid.gym_id
@@ -378,7 +408,8 @@  discard block
 block discarded – undo
378 408
 	// Trainers
379 409
 	//////////////
380 410
 
381
-	public function getTrainers($trainer_name, $team, $page, $ranking) {
411
+	public function getTrainers($trainer_name, $team, $page, $ranking)
412
+	{
382 413
 		$trainers = $this->getTrainerData($trainer_name, $team, $page, $ranking);
383 414
 		foreach ($trainers as $trainer) {
384 415
 
@@ -403,7 +434,8 @@  discard block
 block discarded – undo
403 434
 		return $trainers;
404 435
 	}
405 436
 
406
-	public function getTrainerLevelCount($team_id) {
437
+	public function getTrainerLevelCount($team_id)
438
+	{
407 439
 		$req = "SELECT level, count(level) AS count FROM trainer WHERE team = '".$team_id."'";
408 440
 		if (!empty(self::$config->system->trainer_blacklist)) {
409 441
 			$req .= " AND name NOT IN ('".implode("','", self::$config->system->trainer_blacklist)."')";
@@ -424,7 +456,8 @@  discard block
 block discarded – undo
424 456
 		return $levelData;
425 457
 	}
426 458
 
427
-	private function getTrainerData($trainer_name, $team, $page, $ranking) {
459
+	private function getTrainerData($trainer_name, $team, $page, $ranking)
460
+	{
428 461
 		$where = "";
429 462
 
430 463
 		if (!empty(self::$config->system->trainer_blacklist)) {
@@ -465,7 +498,8 @@  discard block
 block discarded – undo
465 498
 		return $trainers;
466 499
 	}
467 500
 
468
-	private function getTrainerLevelRating($level) {
501
+	private function getTrainerLevelRating($level)
502
+	{
469 503
 		$req = "SELECT COUNT(1) AS rank FROM trainer WHERE level = ".$level;
470 504
 		if (!empty(self::$config->system->trainer_blacklist)) {
471 505
 			$req .= " AND name NOT IN ('".implode("','", self::$config->system->trainer_blacklist)."')";
@@ -475,7 +509,8 @@  discard block
 block discarded – undo
475 509
 		return $data;
476 510
 	}
477 511
 
478
-	private function getTrainerActivePokemon($trainer_name){
512
+	private function getTrainerActivePokemon($trainer_name)
513
+	{
479 514
 		$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, CONVERT_TZ(filtered_gymmember.deployment_time, '+00:00', '".self::$time_offset."') as deployment_time, '1' AS active
480 515
 					FROM gympokemon INNER JOIN
481 516
 					(SELECT gymmember.pokemon_uid, gymmember.gym_id, gymmember.deployment_time FROM gymmember GROUP BY gymmember.pokemon_uid, gymmember.deployment_time, gymmember.gym_id HAVING gymmember.gym_id <> '') AS filtered_gymmember
@@ -490,7 +525,8 @@  discard block
 block discarded – undo
490 525
 		return $pokemons;
491 526
 	}
492 527
 
493
-	private function getTrainerInactivePokemon($trainer_name){
528
+	private function getTrainerInactivePokemon($trainer_name)
529
+	{
494 530
 		$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, null AS gym_id, CONVERT_TZ(filtered_gymmember.deployment_time, '+00:00', '".self::$time_offset."') as deployment_time, '0' AS active
495 531
 					FROM gympokemon LEFT JOIN
496 532
 					(SELECT * FROM gymmember HAVING gymmember.gym_id <> '') AS filtered_gymmember
@@ -510,7 +546,8 @@  discard block
 block discarded – undo
510 546
 	// Cron
511 547
 	/////////
512 548
 
513
-	public function getPokemonCountsActive() {
549
+	public function getPokemonCountsActive()
550
+	{
514 551
 		$req = "SELECT pokemon_id, COUNT(*) as total FROM pokemon WHERE disappear_time >= UTC_TIMESTAMP() GROUP BY pokemon_id";
515 552
 		$result = $this->mysqli->query($req);
516 553
 		$counts = array();
@@ -520,7 +557,8 @@  discard block
 block discarded – undo
520 557
 		return $counts;
521 558
 	}
522 559
 
523
-	public function getPoekmonCountsLastDay() {
560
+	public function getPoekmonCountsLastDay()
561
+	{
524 562
 		$req = "SELECT pokemon_id, COUNT(*) AS spawns_last_day
525 563
 					FROM pokemon
526 564
 					WHERE disappear_time >= (SELECT MAX(disappear_time) FROM pokemon) - INTERVAL 1 DAY
@@ -534,7 +572,8 @@  discard block
 block discarded – undo
534 572
 		return $counts;
535 573
 	}
536 574
 
537
-	public function getPokemonSinceLastUpdate($pokemon_id, $last_update) {
575
+	public function getPokemonSinceLastUpdate($pokemon_id, $last_update)
576
+	{
538 577
 		$req = "SELECT COUNT(*) as count, UNIX_TIMESTAMP(MAX(disappear_time)) as last_timestamp, (CONVERT_TZ(MAX(disappear_time), '+00:00', '".self::$time_offset."')) AS disappear_time_real, latitude, longitude 
539 578
 				FROM pokemon 
540 579
 				WHERE pokemon_id = '".$pokemon_id."' && UNIX_TIMESTAMP(disappear_time) > '".$last_update."'";
@@ -543,7 +582,8 @@  discard block
 block discarded – undo
543 582
 		return $data;
544 583
 	}
545 584
 
546
-	public function getRaidsSinceLastUpdate($pokemon_id, $last_update) {
585
+	public function getRaidsSinceLastUpdate($pokemon_id, $last_update)
586
+	{
547 587
 		$where = "WHERE pokemon_id = '".$pokemon_id."' && UNIX_TIMESTAMP(start) > '".$last_update."'";
548 588
 		$req = "SELECT UNIX_TIMESTAMP(start) as start_timestamp, end, (CONVERT_TZ(end, '+00:00', '".self::$time_offset."')) AS end_time_real, latitude, longitude, count
549 589
                 FROM raid r
@@ -561,14 +601,16 @@  discard block
 block discarded – undo
561 601
 		return $data;
562 602
 	}
563 603
 
564
-	public function getCaptchaCount() {
604
+	public function getCaptchaCount()
605
+	{
565 606
 		$req = "SELECT SUM(accounts_captcha) AS total FROM mainworker";
566 607
 		$result = $this->mysqli->query($req);
567 608
 		$data = $result->fetch_object();
568 609
 		return $data;
569 610
 	}
570 611
 
571
-	public function getNestData() {
612
+	public function getNestData()
613
+	{
572 614
 		$pokemon_exclude_sql = "";
573 615
 		if (!empty(self::$config->system->nest_exclude_pokemon)) {
574 616
 			$pokemon_exclude_sql = "AND p.pokemon_id NOT IN (".implode(",", self::$config->system->nest_exclude_pokemon).")";
Please login to merge, or discard this patch.