Failed Conditions
Pull Request — master (#353)
by Florian
07:09
created
core/process/queries/QueryManagerMysqlRocketmap.php 2 patches
Spacing   +6 added lines, -6 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()) {
@@ -454,7 +454,7 @@  discard block
 block discarded – undo
454 454
 				FROM gympokemon
455 455
 				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
456 456
 				ON gympokemon.pokemon_uid = filtered_gymmember.pokemon_uid) AS actives_pokemons ON actives_pokemons.trainer_name = trainer.name
457
-				GROUP BY trainer.name " . $where . $order . $limit;
457
+				GROUP BY trainer.name " . $where.$order.$limit;
458 458
 
459 459
 		$result = $this->mysqli->query($req);
460 460
 		$trainers = array();
@@ -475,7 +475,7 @@  discard block
 block discarded – undo
475 475
 		return $data;
476 476
 	}
477 477
 
478
-	private function getTrainerActivePokemon($trainer_name){
478
+	private function getTrainerActivePokemon($trainer_name) {
479 479
 		$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 480
 					FROM gympokemon INNER JOIN
481 481
 					(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 +490,7 @@  discard block
 block discarded – undo
490 490
 		return $pokemons;
491 491
 	}
492 492
 
493
-	private function getTrainerInactivePokemon($trainer_name){
493
+	private function getTrainerInactivePokemon($trainer_name) {
494 494
 		$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 495
 					FROM gympokemon LEFT JOIN
496 496
 					(SELECT * FROM gymmember HAVING gymmember.gym_id <> '') AS filtered_gymmember
@@ -544,7 +544,7 @@  discard block
 block discarded – undo
544 544
                     JOIN spawnpoint s ON p.spawnpoint_id = s.id
545 545
                     " . $where."
546 546
                 ) x
547
-				" . $where . "
547
+				" . $where."
548 548
 				ORDER BY last_timestamp DESC
549 549
                 LIMIT 0,1";
550 550
 		$result = $this->mysqli->query($req);
@@ -586,7 +586,7 @@  discard block
 block discarded – undo
586 586
 			          FROM pokemon p 
587 587
 			          INNER JOIN spawnpoint s ON (p.spawnpoint_id = s.id) 
588 588
 			          WHERE p.disappear_time > UTC_TIMESTAMP() - INTERVAL 24 HOUR 
589
-			          " . $pokemon_exclude_sql . " 
589
+			          " . $pokemon_exclude_sql." 
590 590
 			          GROUP BY p.spawnpoint_id, p.pokemon_id 
591 591
 			          HAVING COUNT(p.pokemon_id) >= 6 
592 592
 			          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
 		$where = "WHERE p.pokemon_id = '".$pokemon_id."' AND (UNIX_TIMESTAMP(p.disappear_time) - (LENGTH(s.kind) - LENGTH( REPLACE ( kind, \"s\", \"\") )) * 900) > '".$last_update."'";
539 578
 		$req = "SELECT count, (UNIX_TIMESTAMP(p.disappear_time) - (LENGTH(s.kind) - LENGTH( REPLACE ( kind, \"s\", \"\") )) * 900) as last_timestamp, (CONVERT_TZ(p.disappear_time, '+00:00', '".self::$time_offset."')) AS disappear_time_real, p.latitude, p.longitude 
540 579
 				FROM pokemon p
@@ -552,7 +591,8 @@  discard block
 block discarded – undo
552 591
 		return $data;
553 592
 	}
554 593
 
555
-	public function getRaidsSinceLastUpdate($pokemon_id, $last_update) {
594
+	public function getRaidsSinceLastUpdate($pokemon_id, $last_update)
595
+	{
556 596
 		$where = "WHERE pokemon_id = '".$pokemon_id."' AND UNIX_TIMESTAMP(start) > '".$last_update."'";
557 597
 		$req = "SELECT UNIX_TIMESTAMP(start) as start_timestamp, end, (CONVERT_TZ(end, '+00:00', '".self::$time_offset."')) AS end_time_real, latitude, longitude, count
558 598
                 FROM raid r
@@ -570,14 +610,16 @@  discard block
 block discarded – undo
570 610
 		return $data;
571 611
 	}
572 612
 
573
-	public function getCaptchaCount() {
613
+	public function getCaptchaCount()
614
+	{
574 615
 		$req = "SELECT SUM(accounts_captcha) AS total FROM mainworker";
575 616
 		$result = $this->mysqli->query($req);
576 617
 		$data = $result->fetch_object();
577 618
 		return $data;
578 619
 	}
579 620
 
580
-	public function getNestData() {
621
+	public function getNestData()
622
+	{
581 623
 		$pokemon_exclude_sql = "";
582 624
 		if (!empty(self::$config->system->nest_exclude_pokemon)) {
583 625
 			$pokemon_exclude_sql = "AND p.pokemon_id NOT IN (".implode(",", self::$config->system->nest_exclude_pokemon).")";
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
 		$where = "WHERE pokemon_id = '".$pokemon_id."' AND id > '".$last_update."'";
432 467
 		$req = "SELECT count, id AS last_timestamp, (FROM_UNIXTIME(expire_timestamp)) AS disappear_time_real, lat as latitude, lon as longitude
433 468
 					FROM sightings
@@ -443,7 +478,8 @@  discard block
 block discarded – undo
443 478
 		return $data;
444 479
 	}
445 480
 
446
-	public function getRaidsSinceLastUpdate($pokemon_id, $last_update) {
481
+	public function getRaidsSinceLastUpdate($pokemon_id, $last_update)
482
+	{
447 483
 		$where = "WHERE pokemon_id = '".$pokemon_id."AND".$last_update."'";
448 484
 		$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
449 485
 					FROM raids r
@@ -461,14 +497,16 @@  discard block
 block discarded – undo
461 497
 		return $data;
462 498
 	}
463 499
 
464
-	public function getCaptchaCount() {
500
+	public function getCaptchaCount()
501
+	{
465 502
 		$req = " SELECT COUNT(*) as total FROM accounts WHERE captchaed IS NOT NULL AND reason IS NULL";
466 503
 		$result = $this->mysqli->query($req);
467 504
 		$data = $result->fetch_object();
468 505
 		return $data;
469 506
 	}
470 507
 
471
-	public function getNestData() {
508
+	public function getNestData()
509
+	{
472 510
 		$pokemon_exclude_sql = "";
473 511
 		if (!empty(self::$config->system->nest_exclude_pokemon)) {
474 512
 			$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   +14 added lines, -14 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
 	            ORDER BY $top_order_by $top_direction, expire_timestamp DESC
166 166
 	            LIMIT 0,50";
167 167
 
@@ -176,13 +176,13 @@  discard block
 block discarded – undo
176 176
 	function getTop50Trainers($pokemon_id, $best_order_by, $best_direction) {
177 177
 		$trainer_blacklist = "";
178 178
 		if (!empty(self::$config->system->trainer_blacklist)) {
179
-			$trainer_blacklist = " AND owner_name NOT IN ('" . implode("','", self::$config->system->trainer_blacklist) . "')";
179
+			$trainer_blacklist = " AND owner_name NOT IN ('".implode("','", self::$config->system->trainer_blacklist)."')";
180 180
 		}
181 181
 
182 182
 		$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,
183 183
                 FROM_UNIXTIME(last_modified) AS lasttime, last_modified as last_seen
184 184
                 FROM gym_defenders
185
-				WHERE pokemon_id = '" . $pokemon_id . "'" . $trainer_blacklist . "
185
+				WHERE pokemon_id = '" . $pokemon_id."'".$trainer_blacklist."
186 186
 				GROUP BY external_id 
187 187
 				ORDER BY $best_order_by $best_direction, owner_name ASC
188 188
 				LIMIT 0,50";
@@ -225,9 +225,9 @@  discard block
 block discarded – undo
225 225
 
226 226
 	public function getPokemonLive($pokemon_id, $ivMin, $ivMax, $inmap_pokemons) {
227 227
 		$inmap_pkms_filter = "";
228
-		$where = " WHERE expire_timestamp >= UNIX_TIMESTAMP() AND pokemon_id = " . $pokemon_id;
228
+		$where = " WHERE expire_timestamp >= UNIX_TIMESTAMP() AND pokemon_id = ".$pokemon_id;
229 229
 
230
-		$reqTestIv = "SELECT MAX(atk_iv) AS iv FROM sightings " . $where;
230
+		$reqTestIv = "SELECT MAX(atk_iv) AS iv FROM sightings ".$where;
231 231
 		$resultTestIv = $this->mysqli->query($reqTestIv);
232 232
 		$testIv = $resultTestIv->fetch_object();
233 233
 		if (!is_null($inmap_pokemons) && ($inmap_pokemons != "")) {
@@ -235,20 +235,20 @@  discard block
 block discarded – undo
235 235
 				$inmap_pkms_filter .= "'".$inmap."',";
236 236
 			}
237 237
 			$inmap_pkms_filter = rtrim($inmap_pkms_filter, ",");
238
-			$where .= " AND encounter_id NOT IN (" . $inmap_pkms_filter . ") ";
238
+			$where .= " AND encounter_id NOT IN (".$inmap_pkms_filter.") ";
239 239
 		}
240 240
 		if ($testIv->iv != null && !is_null($ivMin) && ($ivMin != "")) {
241
-			$where .= " AND ((100/45)*(atk_iv + def_iv + sta_iv)) >= (" . $ivMin . ") ";
241
+			$where .= " AND ((100/45)*(atk_iv + def_iv + sta_iv)) >= (".$ivMin.") ";
242 242
 		}
243 243
 		if ($testIv->iv != null && !is_null($ivMax) && ($ivMax != "")) {
244
-			$where .= " AND ((100/45)*(atk_iv + def_iv + sta_iv)) <= (" . $ivMax . ") ";
244
+			$where .= " AND ((100/45)*(atk_iv + def_iv + sta_iv)) <= (".$ivMax.") ";
245 245
 		}
246 246
 		$req = "SELECT pokemon_id, lat AS latitude, lon AS longitude,
247 247
     					FROM_UNIXTIME(expire_timestamp) AS disappear_time,
248 248
     					FROM_UNIXTIME(expire_timestamp) AS disappear_time_real,
249 249
     					atk_iv AS individual_attack, def_iv AS individual_defense, sta_iv AS individual_stamina,
250 250
    						move_1, move_2
251
-					FROM sightings " . $where . "
251
+					FROM sightings " . $where."
252 252
 					ORDER BY disappear_time DESC
253 253
 					LIMIT 5000";
254 254
 		$result = $this->mysqli->query($req);
@@ -317,7 +317,7 @@  discard block
 block discarded – undo
317 317
 		$req = "SELECT COUNT(DISTINCT(fs.fort_id)) AS total, ROUND((SUM(gd.cp)) / COUNT(DISTINCT(fs.fort_id)),0) AS average_points
318 318
         			FROM fort_sightings fs
319 319
         			JOIN gym_defenders gd ON fs.fort_id = gd.fort_id
320
-        			WHERE fs.team = '" . $team_id . "'";
320
+        			WHERE fs.team = '" . $team_id."'";
321 321
 		$result = $this->mysqli->query($req);
322 322
 		$data = $result->fetch_object();
323 323
 		return $data;
@@ -434,7 +434,7 @@  discard block
 block discarded – undo
434 434
 						FROM sightings
435 435
                     	" . $where."
436 436
                     ) x
437
-					" . $where . "
437
+					" . $where."
438 438
 					ORDER BY expire_timestamp DESC
439 439
 					LIMIT 0 , 1";
440 440
 		$result = $this->mysqli->query($req);
@@ -452,7 +452,7 @@  discard block
 block discarded – undo
452 452
                     	" . $where."
453 453
                     ) x 
454 454
 					ON r.fort_id = g.id
455
-                    " . $where . "
455
+                    " . $where."
456 456
                     ORDER BY time_battle DESC
457 457
 					LIMIT 0 , 1";
458 458
 		$result = $this->mysqli->query($req);
@@ -470,13 +470,13 @@  discard block
 block discarded – undo
470 470
 	public function getNestData() {
471 471
 		$pokemon_exclude_sql = "";
472 472
 		if (!empty(self::$config->system->nest_exclude_pokemon)) {
473
-			$pokemon_exclude_sql = "AND p.pokemon_id NOT IN (" . implode(",", self::$config->system->nest_exclude_pokemon) . ")";
473
+			$pokemon_exclude_sql = "AND p.pokemon_id NOT IN (".implode(",", self::$config->system->nest_exclude_pokemon).")";
474 474
 		}
475 475
 		$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
476 476
 			          FROM sightings p
477 477
 			          INNER JOIN spawnpoints s ON (p.spawn_id = s.spawn_id)
478 478
 			          WHERE p.expire_timestamp > UNIX_TIMESTAMP() - 86400
479
-			          " . $pokemon_exclude_sql . "
479
+			          " . $pokemon_exclude_sql."
480 480
 			          GROUP BY p.spawn_id, p.pokemon_id
481 481
 			          HAVING COUNT(p.pokemon_id) >= 6
482 482
 			          ORDER BY p.pokemon_id";
Please login to merge, or discard this patch.