Failed Conditions
Pull Request — master (#347)
by Florian
04:33 queued 02:01
created
pages/home.page.php 1 patch
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -53,8 +53,8 @@
 block discarded – undo
53 53
 			</a>
54 54
 		</div>
55 55
 		<?php
56
-    }
57
-    ?>
56
+	}
57
+	?>
58 58
 
59 59
 	<div class="flex-item-homepage big-data">
60 60
 		<a href="<?= $config->homewidget->url ?>" target="_blank">
Please login to merge, or discard this patch.
core/process/aru.php 1 patch
Switch Indentation   +373 added lines, -373 removed lines patch added patch discarded remove patch
@@ -58,163 +58,163 @@  discard block
 block discarded – undo
58 58
 	//
59 59
 	############################
60 60
 
61
-	case 'home_update':
61
+		case 'home_update':
62 62
 
63
-		// Right now
64
-		// ---------
63
+			// Right now
64
+			// ---------
65 65
 
66
-		$req = "SELECT COUNT(*) AS total FROM pokemon WHERE disappear_time >= UTC_TIMESTAMP()";
67
-		$result = $mysqli->query($req);
68
-		$data = $result->fetch_object();
66
+			$req = "SELECT COUNT(*) AS total FROM pokemon WHERE disappear_time >= UTC_TIMESTAMP()";
67
+			$result = $mysqli->query($req);
68
+			$data = $result->fetch_object();
69 69
 
70
-		$values[] = $data->total;
70
+			$values[] = $data->total;
71 71
 
72 72
 
73
-		// Lured stops
74
-		// -----------
73
+			// Lured stops
74
+			// -----------
75 75
 
76
-		$req = "SELECT COUNT(*) AS total FROM pokestop WHERE lure_expiration >= UTC_TIMESTAMP()";
77
-		$result = $mysqli->query($req);
78
-		$data = $result->fetch_object();
76
+			$req = "SELECT COUNT(*) AS total FROM pokestop WHERE lure_expiration >= UTC_TIMESTAMP()";
77
+			$result = $mysqli->query($req);
78
+			$data = $result->fetch_object();
79 79
 
80
-		$values[] = $data->total;
80
+			$values[] = $data->total;
81 81
 
82 82
 
83
-		// Active Raids
84
-		// -----------
83
+			// Active Raids
84
+			// -----------
85 85
 
86
-		$req = "SELECT COUNT(*) AS total FROM raid WHERE start <= UTC_TIMESTAMP AND  end >= UTC_TIMESTAMP()";
87
-		$result = $mysqli->query($req);
88
-		$data = $result->fetch_object();
86
+			$req = "SELECT COUNT(*) AS total FROM raid WHERE start <= UTC_TIMESTAMP AND  end >= UTC_TIMESTAMP()";
87
+			$result = $mysqli->query($req);
88
+			$data = $result->fetch_object();
89 89
 
90
-		$values[] = $data->total;
90
+			$values[] = $data->total;
91 91
 
92 92
 
93
-		// Team battle
94
-		// -----------
93
+			// Team battle
94
+			// -----------
95 95
 
96
-		$req = "SELECT COUNT(DISTINCT(gym_id)) AS total FROM gym";
97
-		$result = $mysqli->query($req);
98
-		$data = $result->fetch_object();
96
+			$req = "SELECT COUNT(DISTINCT(gym_id)) AS total FROM gym";
97
+			$result = $mysqli->query($req);
98
+			$data = $result->fetch_object();
99 99
 
100
-		$values[] = $data->total;
100
+			$values[] = $data->total;
101 101
 
102
-		// Team
103
-		// 1 = bleu
104
-		// 2 = rouge
105
-		// 3 = jaune
102
+			// Team
103
+			// 1 = bleu
104
+			// 2 = rouge
105
+			// 3 = jaune
106 106
 
107
-		$req = "SELECT COUNT(DISTINCT(gym_id)) AS total FROM gym WHERE team_id = '2'";
108
-		$result = $mysqli->query($req);
109
-		$data = $result->fetch_object();
107
+			$req = "SELECT COUNT(DISTINCT(gym_id)) AS total FROM gym WHERE team_id = '2'";
108
+			$result = $mysqli->query($req);
109
+			$data = $result->fetch_object();
110 110
 
111
-		// Red
112
-		$values[] = $data->total;
111
+			// Red
112
+			$values[] = $data->total;
113 113
 
114 114
 
115
-		$req = "SELECT COUNT(DISTINCT(gym_id)) AS total FROM gym WHERE team_id = '1'";
116
-		$result = $mysqli->query($req);
117
-		$data = $result->fetch_object();
115
+			$req = "SELECT COUNT(DISTINCT(gym_id)) AS total FROM gym WHERE team_id = '1'";
116
+			$result = $mysqli->query($req);
117
+			$data = $result->fetch_object();
118 118
 
119
-		// Blue
120
-		$values[] = $data->total;
119
+			// Blue
120
+			$values[] = $data->total;
121 121
 
122 122
 
123
-		$req = "SELECT COUNT(DISTINCT(gym_id)) AS total FROM gym WHERE team_id = '3'";
124
-		$result = $mysqli->query($req);
125
-		$data = $result->fetch_object();
123
+			$req = "SELECT COUNT(DISTINCT(gym_id)) AS total FROM gym WHERE team_id = '3'";
124
+			$result = $mysqli->query($req);
125
+			$data = $result->fetch_object();
126 126
 
127
-		// Yellow
128
-		//$values[] = $data->total;
127
+			// Yellow
128
+			//$values[] = $data->total;
129 129
 
130
-		$req = "SELECT COUNT(DISTINCT(gym_id)) AS total FROM gym WHERE team_id = '0'";
131
-		$result = $mysqli->query($req);
132
-		$data = $result->fetch_object();
130
+			$req = "SELECT COUNT(DISTINCT(gym_id)) AS total FROM gym WHERE team_id = '0'";
131
+			$result = $mysqli->query($req);
132
+			$data = $result->fetch_object();
133 133
 
134
-		// Neutral
135
-		//$values[] = $data->total;
134
+			// Neutral
135
+			//$values[] = $data->total;
136 136
 
137
-		header('Content-Type: application/json');
138
-		echo json_encode($values);
137
+			header('Content-Type: application/json');
138
+			echo json_encode($values);
139 139
 
140
-		break;
140
+			break;
141 141
 
142 142
 
143
-	####################################
144
-	//
145
-	// Update latests spawn on homepage
146
-	//
147
-	####################################
143
+		####################################
144
+		//
145
+		// Update latests spawn on homepage
146
+		//
147
+		####################################
148 148
 
149
-	case 'spawnlist_update':
150
-		// Recent spawn
151
-		// ------------
152
-		$total_spawns = array();
153
-		$last_uid_param = "";
154
-		if (isset($_GET['last_uid'])) {
155
-			$last_uid_param = $_GET['last_uid'];
156
-		}
157
-		if ($config->system->recents_filter) {
158
-			// get all mythic pokemon ids
159
-			$mythic_pokemons = array();
160
-			foreach ($pokemons->pokemon as $id => $pokemon) {
161
-				if ($pokemon->spawn_rate < $config->system->recents_filter_rarity && $pokemon->rating >= $config->system->recents_filter_rating) {
162
-					$mythic_pokemons[] = $id;
163
-				}
149
+		case 'spawnlist_update':
150
+			// Recent spawn
151
+			// ------------
152
+			$total_spawns = array();
153
+			$last_uid_param = "";
154
+			if (isset($_GET['last_uid'])) {
155
+				$last_uid_param = $_GET['last_uid'];
164 156
 			}
157
+			if ($config->system->recents_filter) {
158
+				// get all mythic pokemon ids
159
+				$mythic_pokemons = array();
160
+				foreach ($pokemons->pokemon as $id => $pokemon) {
161
+					if ($pokemon->spawn_rate < $config->system->recents_filter_rarity && $pokemon->rating >= $config->system->recents_filter_rating) {
162
+						$mythic_pokemons[] = $id;
163
+					}
164
+				}
165 165
 
166
-			// get last mythic pokemon
167
-			$req = "SELECT pokemon_id, encounter_id, disappear_time, last_modified, (CONVERT_TZ(disappear_time, '+00:00', '".$time_offset."')) AS disappear_time_real,
166
+				// get last mythic pokemon
167
+				$req = "SELECT pokemon_id, encounter_id, disappear_time, last_modified, (CONVERT_TZ(disappear_time, '+00:00', '".$time_offset."')) AS disappear_time_real,
168 168
 					latitude, longitude, cp, individual_attack, individual_defense, individual_stamina
169 169
 					FROM pokemon
170 170
 					WHERE pokemon_id IN (".implode(",", $mythic_pokemons).")
171 171
 					ORDER BY last_modified DESC
172 172
 					LIMIT 0,12";
173
-		} else {
174
-			// get last pokemon
175
-			$req = "SELECT pokemon_id, encounter_id, disappear_time, last_modified, (CONVERT_TZ(disappear_time, '+00:00', '".$time_offset."')) AS disappear_time_real,
173
+			} else {
174
+				// get last pokemon
175
+				$req = "SELECT pokemon_id, encounter_id, disappear_time, last_modified, (CONVERT_TZ(disappear_time, '+00:00', '".$time_offset."')) AS disappear_time_real,
176 176
 					latitude, longitude, cp, individual_attack, individual_defense, individual_stamina
177 177
 					FROM pokemon
178 178
 					ORDER BY last_modified DESC
179 179
 					LIMIT 0,12";
180
-		}
181
-		$result = $mysqli->query($req);
182
-		while ($data = $result->fetch_object()) {
183
-			$new_spawn = array();
184
-			$pokeid = $data->pokemon_id;
185
-			$pokeuid = $data->encounter_id;
186
-
187
-			if ($last_uid_param != $pokeuid) {
188
-				$last_seen = strtotime($data->disappear_time_real);
189
-
190
-				$location_link = isset($config->system->location_url) ? $config->system->location_url : 'https://maps.google.com/?q={latitude},{longitude}&ll={latitude},{longitude}&z=16';
191
-				$location_link = str_replace('{latitude}', $data->latitude, $location_link);
192
-				$location_link = str_replace('{longitude}', $data->longitude, $location_link);
193
-
194
-				if ($config->system->recents_encounter_details) {
195
-					$encdetails = new stdClass();
196
-					$encdetails->cp = $data->cp;
197
-					$encdetails->attack = $data->individual_attack;
198
-					$encdetails->defense = $data->individual_defense;
199
-					$encdetails->stamina = $data->individual_stamina;
200
-					if (isset($encdetails->cp) && isset($encdetails->attack) && isset($encdetails->defense) && isset($encdetails->stamina)) {
201
-						$encdetails->available = true;
202
-					} else {
203
-						$encdetails->available = false;
180
+			}
181
+			$result = $mysqli->query($req);
182
+			while ($data = $result->fetch_object()) {
183
+				$new_spawn = array();
184
+				$pokeid = $data->pokemon_id;
185
+				$pokeuid = $data->encounter_id;
186
+
187
+				if ($last_uid_param != $pokeuid) {
188
+					$last_seen = strtotime($data->disappear_time_real);
189
+
190
+					$location_link = isset($config->system->location_url) ? $config->system->location_url : 'https://maps.google.com/?q={latitude},{longitude}&ll={latitude},{longitude}&z=16';
191
+					$location_link = str_replace('{latitude}', $data->latitude, $location_link);
192
+					$location_link = str_replace('{longitude}', $data->longitude, $location_link);
193
+
194
+					if ($config->system->recents_encounter_details) {
195
+						$encdetails = new stdClass();
196
+						$encdetails->cp = $data->cp;
197
+						$encdetails->attack = $data->individual_attack;
198
+						$encdetails->defense = $data->individual_defense;
199
+						$encdetails->stamina = $data->individual_stamina;
200
+						if (isset($encdetails->cp) && isset($encdetails->attack) && isset($encdetails->defense) && isset($encdetails->stamina)) {
201
+							$encdetails->available = true;
202
+						} else {
203
+							$encdetails->available = false;
204
+						}
204 205
 					}
205
-				}
206 206
 
207
-				$html = '
207
+					$html = '
208 208
 			    <div class="col-md-1 col-xs-4 pokemon-single" data-pokeid="'.$pokeid.'" data-pokeuid="'.$pokeuid.'" style="display: none;">
209 209
 				<a href="pokemon/'.$pokeid.'"><img src="'.$pokemons->pokemon->$pokeid->img.'" alt="'.$pokemons->pokemon->$pokeid->name.'" class="img-responsive"></a>
210 210
 				<a href="pokemon/'.$pokeid.'"><p class="pkmn-name">'.$pokemons->pokemon->$pokeid->name.'</p></a>
211 211
 				<a href="'.$location_link.'" target="_blank">
212 212
 					<small class="pokemon-timer">00:00:00</small>
213 213
 				</a>';
214
-				if ($config->system->recents_encounter_details) {
215
-					if ($encdetails->available) {
216
-						if ($config->system->iv_numbers) {
217
-							$html .= '
214
+					if ($config->system->recents_encounter_details) {
215
+						if ($encdetails->available) {
216
+							if ($config->system->iv_numbers) {
217
+								$html .= '
218 218
 							<div class="progress" style="height: 15px; margin-bottom: 0">
219 219
 								<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">
220 220
 									<span class="sr-only">'.$locales->IV_ATTACK.': '.$encdetails->attack.'</span>'.$encdetails->attack.'
@@ -226,8 +226,8 @@  discard block
 block discarded – undo
226 226
 									<span class="sr-only">'.$locales->IV_STAMINA.': '.$encdetails->stamina.'</span>'.$encdetails->stamina.'
227 227
 								</div>
228 228
 							</div>';
229
-						} else {
230
-							$html .= '
229
+							} else {
230
+								$html .= '
231 231
 							<div class="progress" style="height: 6px; width: 80%; margin: 5px auto 0 auto">
232 232
 							<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).'%">
233 233
 									<span class="sr-only">'.$locales->IV_ATTACK.': '.$encdetails->attack.'</span>
@@ -239,11 +239,11 @@  discard block
 block discarded – undo
239 239
 									<span class="sr-only">'.$locales->IV_STAMINA.': '.$encdetails->stamina.'</span>
240 240
 							</div>
241 241
 							</div>';
242
-						}
243
-						$html .= '<small>'.$encdetails->cp.'</small>';
244
-					} else {
245
-						if ($config->system->iv_numbers) {
246
-							$html .= '
242
+							}
243
+							$html .= '<small>'.$encdetails->cp.'</small>';
244
+						} else {
245
+							if ($config->system->iv_numbers) {
246
+								$html .= '
247 247
 							<div class="progress" style="height: 15px; margin-bottom: 0">
248 248
 								<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">
249 249
 									<span class="sr-only">'.$locales->IV_ATTACK.': '.$locales->NOT_AVAILABLE.'</span>?
@@ -255,123 +255,123 @@  discard block
 block discarded – undo
255 255
 									<span class="sr-only">'.$locales->IV_STAMINA.': '.$locales->NOT_AVAILABLE.'</span>?
256 256
 								</div>
257 257
 							</div>';
258
-						} else {
259
-						$html .= '
258
+							} else {
259
+							$html .= '
260 260
 					    <div class="progress" style="height: 6px; width: 80%; margin: 5px auto 0 auto">
261 261
 						    <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">
262 262
 							    <span class="sr-only">IV '.$locales->NOT_AVAILABLE.'</span>
263 263
 						    </div>
264 264
 					    </div>';
265
+							}
266
+							$html .= '<small>???</small>';
265 267
 						}
266
-						$html .= '<small>???</small>';
267 268
 					}
268
-				}
269
-				$html .= '
269
+					$html .= '
270 270
 			    </div>';
271
-				$new_spawn['html'] = $html;
272
-				$countdown = $last_seen - time();
273
-				$new_spawn['countdown'] = $countdown;
274
-				$new_spawn['pokemon_uid'] = $pokeuid;
275
-				$total_spawns[] = $new_spawn;
276
-			} else {
277
-				break;
271
+					$new_spawn['html'] = $html;
272
+					$countdown = $last_seen - time();
273
+					$new_spawn['countdown'] = $countdown;
274
+					$new_spawn['pokemon_uid'] = $pokeuid;
275
+					$total_spawns[] = $new_spawn;
276
+				} else {
277
+					break;
278
+				}
278 279
 			}
279
-		}
280 280
 
281
-		header('Content-Type: application/json');
282
-		echo json_encode($total_spawns);
281
+			header('Content-Type: application/json');
282
+			echo json_encode($total_spawns);
283 283
 
284
-		break;
284
+			break;
285 285
 
286 286
 
287
-	####################################
288
-	//
289
-	// List Pokestop
290
-	//
291
-	####################################
287
+		####################################
288
+		//
289
+		// List Pokestop
290
+		//
291
+		####################################
292 292
 
293
-	case 'pokestop':
294
-		$where = "";
295
-		$req = "SELECT latitude, longitude, lure_expiration, UTC_TIMESTAMP() AS now, (CONVERT_TZ(lure_expiration, '+00:00', '".$time_offset."')) AS lure_expiration_real FROM pokestop ";
293
+		case 'pokestop':
294
+			$where = "";
295
+			$req = "SELECT latitude, longitude, lure_expiration, UTC_TIMESTAMP() AS now, (CONVERT_TZ(lure_expiration, '+00:00', '".$time_offset."')) AS lure_expiration_real FROM pokestop ";
296 296
 
297
-		$result = $mysqli->query($req);
297
+			$result = $mysqli->query($req);
298 298
 
299
-		$pokestops = [];
299
+			$pokestops = [];
300 300
 
301
-		while ($data = $result->fetch_object()) {
302
-			if ($data->lure_expiration >= $data->now) {
303
-				$icon = 'pokestap_lured.png';
304
-				$text = sprintf($locales->POKESTOPS_MAP_LURED, date('H:i:s', strtotime($data->lure_expiration_real)));
305
-				$lured = true;
306
-			} else {
307
-				$icon = 'pokestap.png';
308
-				$text = $locales->POKESTOPS_MAP_REGULAR;
309
-				$lured = false;
310
-			}
301
+			while ($data = $result->fetch_object()) {
302
+				if ($data->lure_expiration >= $data->now) {
303
+					$icon = 'pokestap_lured.png';
304
+					$text = sprintf($locales->POKESTOPS_MAP_LURED, date('H:i:s', strtotime($data->lure_expiration_real)));
305
+					$lured = true;
306
+				} else {
307
+					$icon = 'pokestap.png';
308
+					$text = $locales->POKESTOPS_MAP_REGULAR;
309
+					$lured = false;
310
+				}
311 311
 
312
-			$pokestops[] = [
313
-				$text,
314
-				$icon,
315
-				$data->latitude,
316
-				$data->longitude,
317
-				$lured
318
-			];
319
-		}
312
+				$pokestops[] = [
313
+					$text,
314
+					$icon,
315
+					$data->latitude,
316
+					$data->longitude,
317
+					$lured
318
+				];
319
+			}
320 320
 
321
-		header('Content-Type: application/json');
322
-		echo json_encode($pokestops);
321
+			header('Content-Type: application/json');
322
+			echo json_encode($pokestops);
323 323
 
324
-		break;
324
+			break;
325 325
 
326 326
 
327
-	####################################
328
-	//
329
-	// Update data for the gym battle
330
-	//
331
-	####################################
327
+		####################################
328
+		//
329
+		// Update data for the gym battle
330
+		//
331
+		####################################
332 332
 
333
-	case 'update_gym':
334
-		$teams = new stdClass();
335
-		$teams->mystic = 1;
336
-		$teams->valor = 2;
337
-		$teams->instinct = 3;
333
+		case 'update_gym':
334
+			$teams = new stdClass();
335
+			$teams->mystic = 1;
336
+			$teams->valor = 2;
337
+			$teams->instinct = 3;
338 338
 
339 339
 
340
-		foreach ($teams as $team_name => $team_id) {
341
-			$req = "SELECT COUNT(DISTINCT(gym_id)) AS total, ROUND(AVG(total_cp),0) AS average_points FROM gym WHERE team_id = '".$team_id."'";
342
-			$result = $mysqli->query($req);
343
-			$data = $result->fetch_object();
340
+			foreach ($teams as $team_name => $team_id) {
341
+				$req = "SELECT COUNT(DISTINCT(gym_id)) AS total, ROUND(AVG(total_cp),0) AS average_points FROM gym WHERE team_id = '".$team_id."'";
342
+				$result = $mysqli->query($req);
343
+				$data = $result->fetch_object();
344 344
 
345
-			$return[] = $data->total;
346
-			$return[] = $data->average_points;
347
-		}
345
+				$return[] = $data->total;
346
+				$return[] = $data->average_points;
347
+			}
348 348
 
349
-		header('Content-Type: application/json');
350
-		echo json_encode($return);
349
+			header('Content-Type: application/json');
350
+			echo json_encode($return);
351 351
 
352
-		break;
352
+			break;
353 353
 
354 354
 
355
-	####################################
356
-	//
357
-	// Get datas for the gym map
358
-	//
359
-	####################################
355
+		####################################
356
+		//
357
+		// Get datas for the gym map
358
+		//
359
+		####################################
360 360
 
361 361
 
362
-	case 'gym_map':
363
-		$req = "SELECT gym_id, team_id, latitude, longitude, (CONVERT_TZ(last_scanned, '+00:00', '".$time_offset."')) AS last_scanned, (6 - slots_available) AS level FROM gym";
364
-		$result = $mysqli->query($req);
362
+		case 'gym_map':
363
+			$req = "SELECT gym_id, team_id, latitude, longitude, (CONVERT_TZ(last_scanned, '+00:00', '".$time_offset."')) AS last_scanned, (6 - slots_available) AS level FROM gym";
364
+			$result = $mysqli->query($req);
365 365
 
366
-		$gyms = [];
366
+			$gyms = [];
367 367
 
368
-		while ($data = $result->fetch_object()) {
369
-			// Team
370
-			// 1 = bleu
371
-			// 2 = rouge
372
-			// 3 = jaune
368
+			while ($data = $result->fetch_object()) {
369
+				// Team
370
+				// 1 = bleu
371
+				// 2 = rouge
372
+				// 3 = jaune
373 373
 
374
-			switch ($data->team_id) {
374
+				switch ($data->team_id) {
375 375
 				case 0:
376 376
 					$icon	= 'map_white.png';
377 377
 					$team	= 'No Team (yet)';
@@ -395,7 +395,7 @@  discard block
 block discarded – undo
395 395
 					$team	= 'Team Instinct';
396 396
 					$color = 'rgba(254, 217, 40, .6)';
397 397
 					break;
398
-			}
398
+				}
399 399
 
400 400
 			if ($data->team_id != 0) {
401 401
 				$icon .= $data->level.".png";
@@ -421,50 +421,50 @@  discard block
 block discarded – undo
421 421
 	//
422 422
 	####################################
423 423
 
424
-	case 'gym_defenders':
425
-		$gym_id = $mysqli->real_escape_string($_GET['gym_id']);
426
-		$req = "SELECT gymdetails.name AS name, gymdetails.description AS description, gymdetails.url AS url, gym.team_id AS team,
424
+		case 'gym_defenders':
425
+			$gym_id = $mysqli->real_escape_string($_GET['gym_id']);
426
+			$req = "SELECT gymdetails.name AS name, gymdetails.description AS description, gymdetails.url AS url, gym.team_id AS team,
427 427
 					(CONVERT_TZ(gym.last_scanned, '+00:00', '".$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
428 428
 					FROM gymdetails
429 429
 					LEFT JOIN gym ON gym.gym_id = gymdetails.gym_id
430 430
 					WHERE gym.gym_id='".$gym_id."'";
431
-		$result = $mysqli->query($req);
431
+			$result = $mysqli->query($req);
432 432
 
433
-		$gymData['gymDetails']['gymInfos'] = false;
433
+			$gymData['gymDetails']['gymInfos'] = false;
434 434
 
435
-		while ($data = $result->fetch_object()) {
436
-			$gymData['gymDetails']['gymInfos']['name'] = $data->name;
437
-			$gymData['gymDetails']['gymInfos']['description'] = $data->description;
438
-			if ($data->url == null) {
439
-				$gymData['gymDetails']['gymInfos']['url'] = '';
440
-			} else {
441
-				$gymData['gymDetails']['gymInfos']['url'] = $data->url;
435
+			while ($data = $result->fetch_object()) {
436
+				$gymData['gymDetails']['gymInfos']['name'] = $data->name;
437
+				$gymData['gymDetails']['gymInfos']['description'] = $data->description;
438
+				if ($data->url == null) {
439
+					$gymData['gymDetails']['gymInfos']['url'] = '';
440
+				} else {
441
+					$gymData['gymDetails']['gymInfos']['url'] = $data->url;
442
+				}
443
+				$gymData['gymDetails']['gymInfos']['points'] = $data->total_cp;
444
+				$gymData['gymDetails']['gymInfos']['level'] = $data->level;
445
+				$gymData['gymDetails']['gymInfos']['last_scanned'] = $data->last_scanned;
446
+				$gymData['gymDetails']['gymInfos']['team'] = $data->team;
447
+				$gymData['gymDetails']['gymInfos']['guardPokemonId'] = $data->guard_pokemon_id;
442 448
 			}
443
-			$gymData['gymDetails']['gymInfos']['points'] = $data->total_cp;
444
-			$gymData['gymDetails']['gymInfos']['level'] = $data->level;
445
-			$gymData['gymDetails']['gymInfos']['last_scanned'] = $data->last_scanned;
446
-			$gymData['gymDetails']['gymInfos']['team'] = $data->team;
447
-			$gymData['gymDetails']['gymInfos']['guardPokemonId'] = $data->guard_pokemon_id;
448
-		}
449 449
 
450
-		$req = "SELECT DISTINCT gympokemon.pokemon_uid, pokemon_id, iv_attack, iv_defense, iv_stamina, MAX(cp) AS cp, gymmember.gym_id
450
+			$req = "SELECT DISTINCT gympokemon.pokemon_uid, pokemon_id, iv_attack, iv_defense, iv_stamina, MAX(cp) AS cp, gymmember.gym_id
451 451
 					FROM gympokemon INNER JOIN gymmember ON gympokemon.pokemon_uid=gymmember.pokemon_uid
452 452
 					GROUP BY gympokemon.pokemon_uid, pokemon_id, iv_attack, iv_defense, iv_stamina, gym_id
453 453
 					HAVING gymmember.gym_id='".$gym_id."'
454 454
 					ORDER BY cp DESC";
455
-		$result = $mysqli->query($req);
455
+			$result = $mysqli->query($req);
456 456
 
457
-		$i = 0;
457
+			$i = 0;
458 458
 
459
-		$gymData['infoWindow'] = '
459
+			$gymData['infoWindow'] = '
460 460
 			<div class="gym_defenders">
461 461
 			';
462
-		while ($data = $result->fetch_object()) {
463
-			$gymData['gymDetails']['pokemons'][] = $data;
464
-			if ($data != false) {
465
-				$pokemon_id = $data->pokemon_id;
466
-				if ($config->system->iv_numbers) {
467
-					$gymData['infoWindow'] .= '
462
+			while ($data = $result->fetch_object()) {
463
+				$gymData['gymDetails']['pokemons'][] = $data;
464
+				if ($data != false) {
465
+					$pokemon_id = $data->pokemon_id;
466
+					if ($config->system->iv_numbers) {
467
+						$gymData['infoWindow'] .= '
468 468
 					<div style="text-align: center; width: 50px; display: inline-block; margin-right: 3px">
469 469
 						<a href="pokemon/'.$data->pokemon_id.'">
470 470
 						<img src="'.$pokemons->pokemon->$pokemon_id->img.'" height="50" style="display:inline-block" >
@@ -482,8 +482,8 @@  discard block
 block discarded – undo
482 482
 								</div>
483 483
 							</div>
484 484
 						</div>';
485
-				} else {
486
-					$gymData['infoWindow'] .= '
485
+					} else {
486
+						$gymData['infoWindow'] .= '
487 487
 					<div style="text-align: center; width: 50px; display: inline-block; margin-right: 3px">
488 488
 						<a href="pokemon/'.$data->pokemon_id.'">
489 489
 						<img src="'.$pokemons->pokemon->$pokemon_id->img.'" height="50" style="display:inline-block" >
@@ -501,80 +501,80 @@  discard block
 block discarded – undo
501 501
 							</div>
502 502
 						</div>
503 503
 					</div>'
504
-						; }
505
-			} else {
506
-				$pokemon_id = $gymData['gymDetails']['gymInfos']['guardPokemonId'];
507
-				$gymData['infoWindow'] .= '
504
+							; }
505
+				} else {
506
+					$pokemon_id = $gymData['gymDetails']['gymInfos']['guardPokemonId'];
507
+					$gymData['infoWindow'] .= '
508 508
 				<div style="text-align: center; width: 50px; display: inline-block; margin-right: 3px">
509 509
 					<a href="pokemon/'.$gymData['gymDetails']['gymInfos']['guardPokemonId'].'">
510 510
 					<img src="'.$pokemons->pokemon->$pokemon_id->img.'" height="50" style="display:inline-block" >
511 511
 					</a>
512 512
 					<p class="pkmn-name">???</p>
513 513
 				</div>'
514
-				;
514
+					;
515
+				}
516
+				$i++;
515 517
 			}
516
-			$i++;
517
-		}
518 518
 
519
-		// check whether we could retrieve gym infos, otherwise use basic gym info
520
-		if (!$gymData['gymDetails']['gymInfos']) {
521
-			$req = "SELECT gym_id, team_id, guard_pokemon_id, latitude, longitude, (CONVERT_TZ(last_scanned, '+00:00', '".$time_offset."')) AS last_scanned, total_cp, (6 - slots_available) AS level
519
+			// check whether we could retrieve gym infos, otherwise use basic gym info
520
+			if (!$gymData['gymDetails']['gymInfos']) {
521
+				$req = "SELECT gym_id, team_id, guard_pokemon_id, latitude, longitude, (CONVERT_TZ(last_scanned, '+00:00', '".$time_offset."')) AS last_scanned, total_cp, (6 - slots_available) AS level
522 522
 				FROM gym WHERE gym_id='".$gym_id."'";
523
-			$result = $mysqli->query($req);
524
-			$data = $result->fetch_object();
525
-
526
-			$gymData['gymDetails']['gymInfos']['name'] = $locales->NOT_AVAILABLE;
527
-			$gymData['gymDetails']['gymInfos']['description'] = $locales->NOT_AVAILABLE;
528
-			$gymData['gymDetails']['gymInfos']['url'] = 'https://upload.wikimedia.org/wikipedia/commons/thumb/8/86/Solid_grey.svg/200px-Solid_grey.svg.png';
529
-			$gymData['gymDetails']['gymInfos']['points'] = $data->total_cp;
530
-			$gymData['gymDetails']['gymInfos']['level'] = $data->level;
531
-			$gymData['gymDetails']['gymInfos']['last_scanned'] = $data->last_scanned;
532
-			$gymData['gymDetails']['gymInfos']['team'] = $data->team_id;
533
-			$gymData['gymDetails']['gymInfos']['guardPokemonId'] = $data->guard_pokemon_id;
534
-
535
-			$pokemon_id = $data->guard_pokemon_id;
536
-			$gymData['infoWindow'] .= '
523
+				$result = $mysqli->query($req);
524
+				$data = $result->fetch_object();
525
+
526
+				$gymData['gymDetails']['gymInfos']['name'] = $locales->NOT_AVAILABLE;
527
+				$gymData['gymDetails']['gymInfos']['description'] = $locales->NOT_AVAILABLE;
528
+				$gymData['gymDetails']['gymInfos']['url'] = 'https://upload.wikimedia.org/wikipedia/commons/thumb/8/86/Solid_grey.svg/200px-Solid_grey.svg.png';
529
+				$gymData['gymDetails']['gymInfos']['points'] = $data->total_cp;
530
+				$gymData['gymDetails']['gymInfos']['level'] = $data->level;
531
+				$gymData['gymDetails']['gymInfos']['last_scanned'] = $data->last_scanned;
532
+				$gymData['gymDetails']['gymInfos']['team'] = $data->team_id;
533
+				$gymData['gymDetails']['gymInfos']['guardPokemonId'] = $data->guard_pokemon_id;
534
+
535
+				$pokemon_id = $data->guard_pokemon_id;
536
+				$gymData['infoWindow'] .= '
537 537
 				<div style="text-align: center; width: 50px; display: inline-block; margin-right: 3px">
538 538
 					<a href="pokemon/'.$data->guard_pokemon_id.'">
539 539
 					<img src="'.$pokemons->pokemon->$pokemon_id->img.'" height="50" style="display:inline-block" >
540 540
 					</a>
541 541
 					<p class="pkmn-name">???</p>
542 542
 				</div>';
543
-		}
544
-		$gymData['infoWindow'] = $gymData['infoWindow'].'</div>';
543
+			}
544
+			$gymData['infoWindow'] = $gymData['infoWindow'].'</div>';
545 545
 
546
-		header('Content-Type: application/json');
547
-		echo json_encode($gymData);
546
+			header('Content-Type: application/json');
547
+			echo json_encode($gymData);
548 548
 
549
-		break;
549
+			break;
550 550
 
551 551
 
552
-	case 'trainer':
553
-		$name = "";
554
-		$page = "0";
555
-		$where = "";
556
-		$order = "";
557
-		$team = 0;
558
-		$ranking = 0;
559
-		if (isset($_GET['name'])) {
560
-			$trainer_name = mysqli_real_escape_string($mysqli, $_GET['name']);
561
-			$where = " HAVING name LIKE '%".$trainer_name."%'";
562
-		}
563
-		if (isset($_GET['team']) && $_GET['team'] != 0) {
564
-			$team = mysqli_real_escape_string($mysqli, $_GET['team']);
565
-			$where .= ($where == "" ? " HAVING" : " AND")." team = ".$team;
566
-		}
567
-		if (!empty($config->system->trainer_blacklist)) {
568
-			$where .= ($where == "" ? " HAVING" : " AND")." name NOT IN ('".implode("','", $config->system->trainer_blacklist)."')";
569
-		}
570
-		if (isset($_GET['page'])) {
571
-			$page = mysqli_real_escape_string($mysqli, $_GET['page']);
572
-		}
573
-		if (isset($_GET['ranking'])) {
574
-			$ranking = mysqli_real_escape_string($mysqli, $_GET['ranking']);
575
-		}
552
+		case 'trainer':
553
+			$name = "";
554
+			$page = "0";
555
+			$where = "";
556
+			$order = "";
557
+			$team = 0;
558
+			$ranking = 0;
559
+			if (isset($_GET['name'])) {
560
+				$trainer_name = mysqli_real_escape_string($mysqli, $_GET['name']);
561
+				$where = " HAVING name LIKE '%".$trainer_name."%'";
562
+			}
563
+			if (isset($_GET['team']) && $_GET['team'] != 0) {
564
+				$team = mysqli_real_escape_string($mysqli, $_GET['team']);
565
+				$where .= ($where == "" ? " HAVING" : " AND")." team = ".$team;
566
+			}
567
+			if (!empty($config->system->trainer_blacklist)) {
568
+				$where .= ($where == "" ? " HAVING" : " AND")." name NOT IN ('".implode("','", $config->system->trainer_blacklist)."')";
569
+			}
570
+			if (isset($_GET['page'])) {
571
+				$page = mysqli_real_escape_string($mysqli, $_GET['page']);
572
+			}
573
+			if (isset($_GET['ranking'])) {
574
+				$ranking = mysqli_real_escape_string($mysqli, $_GET['ranking']);
575
+			}
576 576
 
577
-		switch ($ranking) {
577
+			switch ($ranking) {
578 578
 			case 1:
579 579
 				$order = " ORDER BY active DESC, level DESC";
580 580
 				break;
@@ -583,7 +583,7 @@  discard block
 block discarded – undo
583 583
 				break;
584 584
 			default:
585 585
 				$order = " ORDER BY level DESC, active DESC";
586
-		}
586
+			}
587 587
 
588 588
 		$order .= ", last_seen DESC, name ";
589 589
 
@@ -659,130 +659,130 @@  discard block
 block discarded – undo
659 659
 		break;
660 660
 
661 661
 
662
-	case 'raids':
663
-		$page = "0";
664
-		if (isset($_GET['page'])) {
665
-			$page = mysqli_real_escape_string($mysqli, $_GET['page']);
666
-		}
662
+		case 'raids':
663
+			$page = "0";
664
+			if (isset($_GET['page'])) {
665
+				$page = mysqli_real_escape_string($mysqli, $_GET['page']);
666
+			}
667 667
 
668
-		$limit = " LIMIT ".($page * 10).",10";
668
+			$limit = " LIMIT ".($page * 10).",10";
669 669
 
670
-		$req = "SELECT raid.gym_id, raid.level, raid.pokemon_id, raid.cp, raid.move_1, raid.move_2, CONVERT_TZ(raid.spawn, '+00:00', '".$time_offset."') AS spawn, CONVERT_TZ(raid.start, '+00:00', '".$time_offset."') AS start, CONVERT_TZ(raid.end, '+00:00', '".$time_offset."') AS end, CONVERT_TZ(raid.last_scanned, '+00:00', '".$time_offset."') AS last_scanned, gymdetails.name, gym.latitude, gym.longitude FROM raid
670
+			$req = "SELECT raid.gym_id, raid.level, raid.pokemon_id, raid.cp, raid.move_1, raid.move_2, CONVERT_TZ(raid.spawn, '+00:00', '".$time_offset."') AS spawn, CONVERT_TZ(raid.start, '+00:00', '".$time_offset."') AS start, CONVERT_TZ(raid.end, '+00:00', '".$time_offset."') AS end, CONVERT_TZ(raid.last_scanned, '+00:00', '".$time_offset."') AS last_scanned, gymdetails.name, gym.latitude, gym.longitude FROM raid
671 671
 				JOIN gymdetails ON gymdetails.gym_id = raid.gym_id
672 672
 				JOIN gym ON gym.gym_id = raid.gym_id
673 673
 				WHERE raid.end > UTC_TIMESTAMP()
674 674
 				ORDER BY raid.level DESC, raid.start".$limit;
675 675
 
676
-		$result = $mysqli->query($req);
677
-		$raids = array();
678
-		while ($data = $result->fetch_object()) {
679
-			$data->starttime = date("H:i", strtotime($data->start));
680
-			$data->endtime = date("H:i", strtotime($data->end));
681
-			$data->gym_id = str_replace('.', '_', $data->gym_id);
682
-			if (isset($data->move_1)) {
683
-				$move1 = $data->move_1;
684
-				$data->quick_move = $move->$move1->name;
685
-			} else {
686
-				$data->quick_move = "?";
687
-			}
688
-			if (isset($data->move_2)) {
689
-				$move2 = $data->move_2;
690
-				$data->charge_move = $move->$move2->name;
691
-			} else {
692
-				$data->charge_move = "?";
676
+			$result = $mysqli->query($req);
677
+			$raids = array();
678
+			while ($data = $result->fetch_object()) {
679
+				$data->starttime = date("H:i", strtotime($data->start));
680
+				$data->endtime = date("H:i", strtotime($data->end));
681
+				$data->gym_id = str_replace('.', '_', $data->gym_id);
682
+				if (isset($data->move_1)) {
683
+					$move1 = $data->move_1;
684
+					$data->quick_move = $move->$move1->name;
685
+				} else {
686
+					$data->quick_move = "?";
687
+				}
688
+				if (isset($data->move_2)) {
689
+					$move2 = $data->move_2;
690
+					$data->charge_move = $move->$move2->name;
691
+				} else {
692
+					$data->charge_move = "?";
693
+				}
694
+				$raids[$data->gym_id] = $data;
693 695
 			}
694
-			$raids[$data->gym_id] = $data;
695
-		}
696
-		$json = array();
697
-		$json['raids'] = $raids;
698
-		$locale = array();
699
-		$locale['noraids'] = $locales->RAIDS_NONE;
700
-		$json['locale'] = $locale;
696
+			$json = array();
697
+			$json['raids'] = $raids;
698
+			$locale = array();
699
+			$locale['noraids'] = $locales->RAIDS_NONE;
700
+			$json['locale'] = $locale;
701 701
 
702
-		header('Content-Type: application/json');
703
-		echo json_encode($json);
702
+			header('Content-Type: application/json');
703
+			echo json_encode($json);
704 704
 
705
-		break;
705
+			break;
706 706
 
707
-	case 'pokemon_slider_init':
708
-		$req = "SELECT MIN(disappear_time) AS min, MAX(disappear_time) AS max FROM pokemon";
709
-		$result 	= $mysqli->query($req);
710
-		$bounds		= $result->fetch_object();
707
+		case 'pokemon_slider_init':
708
+			$req = "SELECT MIN(disappear_time) AS min, MAX(disappear_time) AS max FROM pokemon";
709
+			$result 	= $mysqli->query($req);
710
+			$bounds		= $result->fetch_object();
711 711
 
712
-		header('Content-Type: application/json');
713
-		echo json_encode($bounds);
712
+			header('Content-Type: application/json');
713
+			echo json_encode($bounds);
714 714
 
715
-		break;
715
+			break;
716 716
 
717 717
 
718
-	case 'pokemon_heatmap_points':
719
-		$json = "";
720
-		if (isset($_GET['start']) && isset($_GET['end']) && isset($_GET['pokemon_id'])) {
721
-			$start = date("Y-m-d H:i", (int) $_GET['start']);
722
-			$end = date("Y-m-d H:i", (int) $_GET['end']);
723
-			$pokemon_id = mysqli_real_escape_string($mysqli, $_GET['pokemon_id']);
724
-			$where = " WHERE pokemon_id = ".$pokemon_id." "
725
-					. "AND disappear_time BETWEEN '".$start."' AND '".$end."'";
726
-			$req 		= "SELECT latitude, longitude FROM pokemon".$where." ORDER BY disappear_time DESC LIMIT 10000";
727
-			$result = $mysqli->query($req);
728
-			$points = array();
729
-			while ($result && $data = $result->fetch_object()) {
730
-				$points[] = $data;
731
-			}
718
+		case 'pokemon_heatmap_points':
719
+			$json = "";
720
+			if (isset($_GET['start']) && isset($_GET['end']) && isset($_GET['pokemon_id'])) {
721
+				$start = date("Y-m-d H:i", (int) $_GET['start']);
722
+				$end = date("Y-m-d H:i", (int) $_GET['end']);
723
+				$pokemon_id = mysqli_real_escape_string($mysqli, $_GET['pokemon_id']);
724
+				$where = " WHERE pokemon_id = ".$pokemon_id." "
725
+						. "AND disappear_time BETWEEN '".$start."' AND '".$end."'";
726
+				$req 		= "SELECT latitude, longitude FROM pokemon".$where." ORDER BY disappear_time DESC LIMIT 10000";
727
+				$result = $mysqli->query($req);
728
+				$points = array();
729
+				while ($result && $data = $result->fetch_object()) {
730
+					$points[] = $data;
731
+				}
732 732
 
733
-			$json = json_encode($points);
734
-		}
733
+				$json = json_encode($points);
734
+			}
735 735
 
736
-		header('Content-Type: application/json');
737
-		echo $json;
738
-		break;
736
+			header('Content-Type: application/json');
737
+			echo $json;
738
+			break;
739 739
 
740 740
 
741
-	case 'maps_localization_coordinates':
742
-		$json = "";
743
-		$req = "SELECT MAX(latitude) AS max_latitude, MIN(latitude) AS min_latitude, MAX(longitude) AS max_longitude, MIN(longitude) as min_longitude FROM spawnpoint";
744
-		$result = $mysqli->query($req);
745
-		$coordinates = $result->fetch_object();
741
+		case 'maps_localization_coordinates':
742
+			$json = "";
743
+			$req = "SELECT MAX(latitude) AS max_latitude, MIN(latitude) AS min_latitude, MAX(longitude) AS max_longitude, MIN(longitude) as min_longitude FROM spawnpoint";
744
+			$result = $mysqli->query($req);
745
+			$coordinates = $result->fetch_object();
746 746
 
747
-		header('Content-Type: application/json');
748
-		echo json_encode($coordinates);
747
+			header('Content-Type: application/json');
748
+			echo json_encode($coordinates);
749 749
 
750
-		break;
750
+			break;
751 751
 
752 752
 
753
-	case 'pokemon_graph_data':
754
-		$json = "";
755
-		if (isset($_GET['pokemon_id'])) {
756
-			$pokemon_id = mysqli_real_escape_string($mysqli, $_GET['pokemon_id']);
757
-			$req = "SELECT COUNT(*) AS total,
753
+		case 'pokemon_graph_data':
754
+			$json = "";
755
+			if (isset($_GET['pokemon_id'])) {
756
+				$pokemon_id = mysqli_real_escape_string($mysqli, $_GET['pokemon_id']);
757
+				$req = "SELECT COUNT(*) AS total,
758 758
 					HOUR(CONVERT_TZ(disappear_time, '+00:00', '".$time_offset."')) AS disappear_hour
759 759
 					FROM (SELECT disappear_time FROM pokemon WHERE pokemon_id = '".$pokemon_id."' ORDER BY disappear_time LIMIT 10000) AS pokemonFiltered
760 760
 					GROUP BY disappear_hour
761 761
 					ORDER BY disappear_hour";
762
-			$result = $mysqli->query($req);
763
-			$array = array_fill(0, 24, 0);
764
-			while ($result && $data = $result->fetch_object()) {
765
-				$array[$data->disappear_hour] = $data->total;
762
+				$result = $mysqli->query($req);
763
+				$array = array_fill(0, 24, 0);
764
+				while ($result && $data = $result->fetch_object()) {
765
+					$array[$data->disappear_hour] = $data->total;
766
+				}
767
+				// shift array because AM/PM starts at 1AM not 0:00
768
+				$array[] = $array[0];
769
+				array_shift($array);
770
+
771
+				$json = json_encode($array);
766 772
 			}
767
-			// shift array because AM/PM starts at 1AM not 0:00
768
-			$array[] = $array[0];
769
-			array_shift($array);
770 773
 
771
-			$json = json_encode($array);
772
-		}
774
+			header('Content-Type: application/json');
775
+			echo $json;
776
+			break;
773 777
 
774
-		header('Content-Type: application/json');
775
-		echo $json;
776
-		break;
777 778
 
779
+		case 'postRequest':
780
+			break;
778 781
 
779
-	case 'postRequest':
782
+		default:
783
+			echo "What do you mean?";
784
+			exit();
780 785
 		break;
781
-
782
-	default:
783
-		echo "What do you mean?";
784
-		exit();
785
-	break;
786 786
 }
787 787
 
788 788
 if ($postRequest != "") {
Please login to merge, or discard this patch.