Passed
Push — master ( 2ffa28...8ef86c )
by Markus
07:33
created
core/cron/gym.cron.php 1 patch
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -8,45 +8,45 @@
 block discarded – undo
8 8
 // -----------------------------------------------------------------------------------------------------------
9 9
 
10 10
 
11
-$gym['timestamp']	= $timestamp;
11
+$gym['timestamp'] = $timestamp;
12 12
 
13
-$req		= "SELECT COUNT(DISTINCT(gym_id)) AS total FROM gym";
14
-$result		= $mysqli->query($req);
15
-$data		= $result->fetch_object();
13
+$req = "SELECT COUNT(DISTINCT(gym_id)) AS total FROM gym";
14
+$result = $mysqli->query($req);
15
+$data = $result->fetch_object();
16 16
 
17
-$gym['total'] 	= $data->total;
17
+$gym['total'] = $data->total;
18 18
 
19 19
 
20 20
 // Mystic
21 21
 
22
-$req		= "SELECT COUNT(DISTINCT(gym_id)) AS total, ROUND(AVG(gym_points),0) AS average_points FROM gym WHERE team_id = '1'";
23
-$result		= $mysqli->query($req);
24
-$data		= $result->fetch_object();
22
+$req = "SELECT COUNT(DISTINCT(gym_id)) AS total, ROUND(AVG(gym_points),0) AS average_points FROM gym WHERE team_id = '1'";
23
+$result = $mysqli->query($req);
24
+$data = $result->fetch_object();
25 25
 
26
-$gym['team']['mystic']['gym_owned']	= $data->total;
27
-$gym['team']['mystic']['average']	= $data->average_points;
26
+$gym['team']['mystic']['gym_owned'] = $data->total;
27
+$gym['team']['mystic']['average'] = $data->average_points;
28 28
 
29 29
 
30 30
 // Valor
31 31
 
32
-$req		= "SELECT COUNT(DISTINCT(gym_id)) AS total, ROUND(AVG(gym_points),0) AS average_points FROM gym WHERE team_id = '2'";
33
-$result		= $mysqli->query($req);
34
-$data		= $result->fetch_object();
32
+$req = "SELECT COUNT(DISTINCT(gym_id)) AS total, ROUND(AVG(gym_points),0) AS average_points FROM gym WHERE team_id = '2'";
33
+$result = $mysqli->query($req);
34
+$data = $result->fetch_object();
35 35
 
36
-$gym['team']['valor']['gym_owned']	= $data->total;
37
-$gym['team']['valor']['average']	= $data->average_points;
36
+$gym['team']['valor']['gym_owned'] = $data->total;
37
+$gym['team']['valor']['average'] = $data->average_points;
38 38
 
39 39
 
40 40
 // Instinct
41 41
 
42
-$req		= "SELECT COUNT(DISTINCT(gym_id)) AS total, ROUND(AVG(gym_points),0) AS average_points FROM gym WHERE team_id = '3'";
43
-$result		= $mysqli->query($req);
44
-$data		= $result->fetch_object();
42
+$req = "SELECT COUNT(DISTINCT(gym_id)) AS total, ROUND(AVG(gym_points),0) AS average_points FROM gym WHERE team_id = '3'";
43
+$result = $mysqli->query($req);
44
+$data = $result->fetch_object();
45 45
 
46
-$gym['team']['instinct']['gym_owned'] 	= $data->total;
47
-$gym['team']['instinct']['average'] 	= $data->average_points;
46
+$gym['team']['instinct']['gym_owned'] = $data->total;
47
+$gym['team']['instinct']['average'] = $data->average_points;
48 48
 
49 49
 
50 50
 // Add the datas in file
51
-$gymsdatas[]		= $gym;
51
+$gymsdatas[] = $gym;
52 52
 file_put_contents($gym_file, json_encode($gymsdatas));
Please login to merge, or discard this patch.
core/cron/captcha.cron.php 1 patch
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -5,7 +5,7 @@  discard block
 block discarded – undo
5 5
 // Total lured
6 6
 // -----------------------------------------------------------------------------------------------------------
7 7
 
8
-$captcha_file	= SYS_PATH.'/core/json/captcha.stats.json';
8
+$captcha_file = SYS_PATH.'/core/json/captcha.stats.json';
9 9
 if (is_file($captcha_file)) {
10 10
 	$capdatas	= json_decode(file_get_contents($captcha_file), true);
11 11
 	// Trim json stats files to last 7 days of data
@@ -16,37 +16,37 @@  discard block
 block discarded – undo
16 16
 $variables_secret = SYS_PATH.'/core/json/variables.secret.json';
17 17
 $config_secret = json_decode(file_get_contents($variables_secret));
18 18
 
19
-if ($config_secret->captcha_key=="") {
19
+if ($config_secret->captcha_key == "") {
20 20
 	$captcha['timestamp'] = $timestamp;
21 21
 	// get amount of accounts requiring a captcha
22 22
 	$req = "SELECT COUNT(*) AS total
23 23
 			FROM workerstatus
24 24
 			WHERE `captcha` > '0'
25 25
 			AND last_modified >= UTC_TIMESTAMP() - INTERVAL 60 SECOND";
26
-	$result 	= $mysqli->query($req);
27
-	$data 		= $result->fetch_object();
26
+	$result = $mysqli->query($req);
27
+	$data = $result->fetch_object();
28 28
 	$captcha['captcha_accs'] = $data->total;
29 29
 	// Add the datas in file
30
-	$capdatas[] 	= $captcha;
30
+	$capdatas[] = $captcha;
31 31
 } else {
32 32
 	if (!empty($capdatas)) {
33 33
 		$lastCaptcha = array_pop($capdatas);
34 34
 	} else {
35
-		$lastCaptcha["timestamp"]=strtotime("-7 days", strtotime(date("Y-m-d")));
35
+		$lastCaptcha["timestamp"] = strtotime("-7 days", strtotime(date("Y-m-d")));
36 36
 	}
37 37
 	$lastCaptchaDate = date("Y-m-d", $lastCaptcha["timestamp"]);
38 38
 	$startTime = strtotime($lastCaptchaDate);
39
-	$endTime = strtotime(date("Y-m-d"))+date("Z");
39
+	$endTime = strtotime(date("Y-m-d")) + date("Z");
40 40
 	$timeDiff = abs($endTime - $startTime);
41
-	$numberDays = intval($timeDiff/86400) ;  // 86400 seconds in one day
42
-	if ($numberDays>7) {
43
-		$numberDays=7;
41
+	$numberDays = intval($timeDiff / 86400); // 86400 seconds in one day
42
+	if ($numberDays > 7) {
43
+		$numberDays = 7;
44 44
 	}
45
-	while ($numberDays>=0) {
46
-		$day = $endTime-($numberDays*86400);
45
+	while ($numberDays >= 0) {
46
+		$day = $endTime - ($numberDays * 86400);
47 47
 		$captchaUrl =
48
-				"http://2captcha.com/res.php?key=" .
49
-				$config_secret->captcha_key . "&action=getstats&date=" . date("Y-m-d", $day);
48
+				"http://2captcha.com/res.php?key=".
49
+				$config_secret->captcha_key."&action=getstats&date=".date("Y-m-d", $day);
50 50
 
51 51
 		$ch = curl_init();
52 52
 		curl_setopt($ch, CURLOPT_URL, $captchaUrl);
@@ -68,14 +68,14 @@  discard block
 block discarded – undo
68 68
 		$capXml = simplexml_load_string($fileContents);
69 69
 
70 70
 		foreach ($capXml as $key => $value) {
71
-			if (	($numberDays==0
72
-				&& ((int)$value->Attributes()->hour >= (int)date("H", $lastCaptcha["timestamp"])
73
-				&& ((int)$value->Attributes()->hour <= (int)date("H")))
74
-				) || $numberDays>0) {
71
+			if (($numberDays == 0
72
+				&& ((int) $value->Attributes()->hour >= (int) date("H", $lastCaptcha["timestamp"])
73
+				&& ((int) $value->Attributes()->hour <= (int) date("H")))
74
+				) || $numberDays > 0) {
75 75
 				$captcha['timestamp'] =
76
-						strtotime(date("Y-m-d", $day) . " " . $value->Attributes()->hour . ":00")+date("Z");
77
-				$captcha['captcha_accs'] = (string)$value->volume;
78
-				$capdatas[] 	= $captcha;
76
+						strtotime(date("Y-m-d", $day)." ".$value->Attributes()->hour.":00") + date("Z");
77
+				$captcha['captcha_accs'] = (string) $value->volume;
78
+				$capdatas[] = $captcha;
79 79
 			}
80 80
 		}
81 81
 		--$numberDays;
Please login to merge, or discard this patch.
core/cron/pokestop.cron.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -9,20 +9,20 @@
 block discarded – undo
9 9
 
10 10
 $pokestop['timestamp'] = $timestamp;
11 11
 
12
-$req 		= "SELECT COUNT(*) AS total FROM pokestop";
13
-$result 	= $mysqli->query($req);
14
-$data 		= $result->fetch_object();
12
+$req = "SELECT COUNT(*) AS total FROM pokestop";
13
+$result = $mysqli->query($req);
14
+$data = $result->fetch_object();
15 15
 
16 16
 $pokestop['total'] = $data->total;
17 17
 
18
-$req 		= "SELECT COUNT(*) AS total FROM pokestop WHERE lure_expiration >= UTC_TIMESTAMP()";
19
-$result 	= $mysqli->query($req);
20
-$data 		= $result->fetch_object();
18
+$req = "SELECT COUNT(*) AS total FROM pokestop WHERE lure_expiration >= UTC_TIMESTAMP()";
19
+$result = $mysqli->query($req);
20
+$data = $result->fetch_object();
21 21
 
22 22
 $pokestop['lured'] = $data->total;
23 23
 
24 24
 
25 25
 
26 26
 // Add the datas in file
27
-$stopdatas[] 	= $pokestop;
27
+$stopdatas[] = $pokestop;
28 28
 file_put_contents($pokestop_file, json_encode($stopdatas));
Please login to merge, or discard this patch.
core/cron/pokemon.cron.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -16,19 +16,19 @@  discard block
 block discarded – undo
16 16
 $pokemon_stats['timestamp'] = $timestamp;
17 17
 
18 18
 
19
-$req 		= "SELECT COUNT(*) AS total FROM pokemon WHERE disappear_time >= UTC_TIMESTAMP()";
20
-$result 	= $mysqli->query($req);
21
-$data 		= $result->fetch_object();
19
+$req = "SELECT COUNT(*) AS total FROM pokemon WHERE disappear_time >= UTC_TIMESTAMP()";
20
+$result = $mysqli->query($req);
21
+$data = $result->fetch_object();
22 22
 
23
-$pokemon_stats['pokemon_now'] 	= $data->total;
23
+$pokemon_stats['pokemon_now'] = $data->total;
24 24
 
25
-$req 		= "SELECT pokemon_id FROM pokemon WHERE disappear_time >= UTC_TIMESTAMP()";
26
-$result 	= $mysqli->query($req);
25
+$req = "SELECT pokemon_id FROM pokemon WHERE disappear_time >= UTC_TIMESTAMP()";
26
+$result = $mysqli->query($req);
27 27
 
28 28
 $rarityarray = array();
29 29
 while ($data = $result->fetch_object()) {
30
-	$poke_id 	= $data->pokemon_id;
31
-	$rarity 	= $pokemons->pokemon->$poke_id->rarity;
30
+	$poke_id = $data->pokemon_id;
31
+	$rarity = $pokemons->pokemon->$poke_id->rarity;
32 32
 	
33 33
 	isset($rarityarray[$rarity]) ? $rarityarray[$rarity]++ : $rarityarray[$rarity] = 1;
34 34
 }
@@ -43,5 +43,5 @@  discard block
 block discarded – undo
43 43
 
44 44
 
45 45
 // Write to file
46
-$pokedatas[] 	= $pokemon_stats;
46
+$pokedatas[] = $pokemon_stats;
47 47
 file_put_contents($pokemonstats_file, json_encode($pokedatas));
Please login to merge, or discard this patch.
core/process/aru.php 2 patches
Switch Indentation   +327 added lines, -327 removed lines patch added patch discarded remove patch
@@ -58,157 +58,157 @@  discard block
 block discarded – undo
58 58
 	//
59 59
 	############################
60 60
 
61
-	case 'home_update':
62
-		// Right now
63
-		// ---------
61
+		case 'home_update':
62
+			// Right now
63
+			// ---------
64 64
 
65
-		$req 		= "SELECT COUNT(*) AS total FROM pokemon WHERE disappear_time >= UTC_TIMESTAMP()";
66
-		$result 	= $mysqli->query($req);
67
-		$data 		= $result->fetch_object();
65
+			$req 		= "SELECT COUNT(*) AS total FROM pokemon WHERE disappear_time >= UTC_TIMESTAMP()";
66
+			$result 	= $mysqli->query($req);
67
+			$data 		= $result->fetch_object();
68 68
 
69
-		$values[] 	= $data->total;
69
+			$values[] 	= $data->total;
70 70
 
71 71
 
72
-		// Lured stops
73
-		// -----------
72
+			// Lured stops
73
+			// -----------
74 74
 
75
-		$req 		= "SELECT COUNT(*) AS total FROM pokestop WHERE lure_expiration >= UTC_TIMESTAMP()";
76
-		$result 	= $mysqli->query($req);
77
-		$data 		= $result->fetch_object();
75
+			$req 		= "SELECT COUNT(*) AS total FROM pokestop WHERE lure_expiration >= UTC_TIMESTAMP()";
76
+			$result 	= $mysqli->query($req);
77
+			$data 		= $result->fetch_object();
78 78
 
79
-		$values[] 	= $data->total;
79
+			$values[] 	= $data->total;
80 80
 
81 81
 
82 82
 
83
-		// Team battle
84
-		// -----------
83
+			// Team battle
84
+			// -----------
85 85
 
86
-		$req 		= "SELECT COUNT(DISTINCT(gym_id)) AS total FROM gym";
87
-		$result 	= $mysqli->query($req);
88
-		$data 		= $result->fetch_object();
86
+			$req 		= "SELECT COUNT(DISTINCT(gym_id)) AS total FROM gym";
87
+			$result 	= $mysqli->query($req);
88
+			$data 		= $result->fetch_object();
89 89
 
90
-		$values[] 	= $data->total;
90
+			$values[] 	= $data->total;
91 91
 
92
-		// Team
93
-		// 1 = bleu
94
-		// 2 = rouge
95
-		// 3 = jaune
92
+			// Team
93
+			// 1 = bleu
94
+			// 2 = rouge
95
+			// 3 = jaune
96 96
 
97
-		$req	= "SELECT COUNT(DISTINCT(gym_id)) AS total FROM gym WHERE team_id = '2'";
98
-		$result	= $mysqli->query($req);
99
-		$data	= $result->fetch_object();
97
+			$req	= "SELECT COUNT(DISTINCT(gym_id)) AS total FROM gym WHERE team_id = '2'";
98
+			$result	= $mysqli->query($req);
99
+			$data	= $result->fetch_object();
100 100
 
101
-		// Red
102
-		$values[] = $data->total;
101
+			// Red
102
+			$values[] = $data->total;
103 103
 
104 104
 
105
-		$req	= "SELECT COUNT(DISTINCT(gym_id)) AS total FROM gym WHERE team_id = '1'";
106
-		$result	= $mysqli->query($req);
107
-		$data	= $result->fetch_object();
105
+			$req	= "SELECT COUNT(DISTINCT(gym_id)) AS total FROM gym WHERE team_id = '1'";
106
+			$result	= $mysqli->query($req);
107
+			$data	= $result->fetch_object();
108 108
 
109
-		// Blue
110
-		$values[] = $data->total;
109
+			// Blue
110
+			$values[] = $data->total;
111 111
 
112 112
 
113
-		$req	= "SELECT COUNT(DISTINCT(gym_id)) AS total FROM gym WHERE team_id = '3'";
114
-		$result	= $mysqli->query($req);
115
-		$data	= $result->fetch_object();
113
+			$req	= "SELECT COUNT(DISTINCT(gym_id)) AS total FROM gym WHERE team_id = '3'";
114
+			$result	= $mysqli->query($req);
115
+			$data	= $result->fetch_object();
116 116
 
117
-		// Yellow
118
-		$values[] = $data->total;
117
+			// Yellow
118
+			$values[] = $data->total;
119 119
 
120
-		$req	= "SELECT COUNT(DISTINCT(gym_id)) AS total FROM gym WHERE team_id = '0'";
121
-		$result	= $mysqli->query($req);
122
-		$data	= $result->fetch_object();
120
+			$req	= "SELECT COUNT(DISTINCT(gym_id)) AS total FROM gym WHERE team_id = '0'";
121
+			$result	= $mysqli->query($req);
122
+			$data	= $result->fetch_object();
123 123
 
124
-		// Neutral
125
-		$values[] = $data->total;
124
+			// Neutral
125
+			$values[] = $data->total;
126 126
 
127 127
 
128
-		header('Content-Type: application/json');
129
-		$json = json_encode($values);
128
+			header('Content-Type: application/json');
129
+			$json = json_encode($values);
130 130
 
131
-		echo $json;
131
+			echo $json;
132 132
 
133 133
 
134
-		break;
134
+			break;
135 135
 
136 136
 
137 137
 
138
-	####################################
139
-	//
140
-	// Update latests spawn on homepage
141
-	//
142
-	####################################
138
+		####################################
139
+		//
140
+		// Update latests spawn on homepage
141
+		//
142
+		####################################
143 143
 
144
-	case 'spawnlist_update':
145
-		// Recent spawn
146
-		// ------------
147
-		$total_spawns = array();
148
-		$last_uid_param = "";
149
-		if (isset($_GET['last_uid'])) {
150
-			$last_uid_param = $_GET['last_uid'];
151
-		}
152
-		if ($config->system->recents_filter) {
153
-			// get all mythic pokemon ids
154
-			$mythic_pokemons = array();
155
-			foreach ($pokemons->pokemon as $id => $pokemon) {
156
-				if ($pokemon->spawn_rate < $config->system->recents_filter_rarity && $pokemon->rating >= $config->system->recents_filter_rating) {
157
-					$mythic_pokemons[] = $id;
158
-				}
144
+		case 'spawnlist_update':
145
+			// Recent spawn
146
+			// ------------
147
+			$total_spawns = array();
148
+			$last_uid_param = "";
149
+			if (isset($_GET['last_uid'])) {
150
+				$last_uid_param = $_GET['last_uid'];
159 151
 			}
152
+			if ($config->system->recents_filter) {
153
+				// get all mythic pokemon ids
154
+				$mythic_pokemons = array();
155
+				foreach ($pokemons->pokemon as $id => $pokemon) {
156
+					if ($pokemon->spawn_rate < $config->system->recents_filter_rarity && $pokemon->rating >= $config->system->recents_filter_rating) {
157
+						$mythic_pokemons[] = $id;
158
+					}
159
+				}
160 160
 
161
-			// get last mythic pokemon
162
-			$req = "SELECT pokemon_id, encounter_id, disappear_time, last_modified, (CONVERT_TZ(disappear_time, '+00:00', '".$time_offset."')) AS disappear_time_real,
161
+				// get last mythic pokemon
162
+				$req = "SELECT pokemon_id, encounter_id, disappear_time, last_modified, (CONVERT_TZ(disappear_time, '+00:00', '".$time_offset."')) AS disappear_time_real,
163 163
 					latitude, longitude, individual_attack, individual_defense, individual_stamina
164 164
 					FROM pokemon
165 165
 					WHERE pokemon_id IN (".implode(",", $mythic_pokemons).")
166 166
 					ORDER BY last_modified DESC
167 167
 					LIMIT 0,12";
168
-		} else {
169
-			// get last pokemon
170
-			$req = "SELECT pokemon_id, encounter_id, disappear_time, last_modified, (CONVERT_TZ(disappear_time, '+00:00', '".$time_offset."')) AS disappear_time_real,
168
+			} else {
169
+				// get last pokemon
170
+				$req = "SELECT pokemon_id, encounter_id, disappear_time, last_modified, (CONVERT_TZ(disappear_time, '+00:00', '".$time_offset."')) AS disappear_time_real,
171 171
 					latitude, longitude, individual_attack, individual_defense, individual_stamina
172 172
 					FROM pokemon
173 173
 					ORDER BY last_modified DESC
174 174
 					LIMIT 0,12";
175
-		}
176
-		$result = $mysqli->query($req);
177
-		while ($data = $result->fetch_object()) {
178
-			$new_spawn = array();
179
-			$pokeid = $data->pokemon_id;
180
-			$pokeuid = $data->encounter_id;
181
-
182
-			if ($last_uid_param != $pokeuid) {
183
-				$last_seen = strtotime($data->disappear_time_real);
184
-
185
-				$last_location = new stdClass();
186
-				$last_location->latitude = $data->latitude;
187
-				$last_location->longitude = $data->longitude;
188
-
189
-				if ($config->system->recents_show_iv) {
190
-					$iv = new stdClass();
191
-					$iv->attack = $data->individual_attack;
192
-					$iv->defense = $data->individual_defense;
193
-					$iv->stamina = $data->individual_stamina;
194
-					if (isset($iv->attack) && isset($iv->defense) && isset($iv->stamina)) {
195
-						$iv->available = true;
196
-					} else {
197
-						$iv->available = false;
175
+			}
176
+			$result = $mysqli->query($req);
177
+			while ($data = $result->fetch_object()) {
178
+				$new_spawn = array();
179
+				$pokeid = $data->pokemon_id;
180
+				$pokeuid = $data->encounter_id;
181
+
182
+				if ($last_uid_param != $pokeuid) {
183
+					$last_seen = strtotime($data->disappear_time_real);
184
+
185
+					$last_location = new stdClass();
186
+					$last_location->latitude = $data->latitude;
187
+					$last_location->longitude = $data->longitude;
188
+
189
+					if ($config->system->recents_show_iv) {
190
+						$iv = new stdClass();
191
+						$iv->attack = $data->individual_attack;
192
+						$iv->defense = $data->individual_defense;
193
+						$iv->stamina = $data->individual_stamina;
194
+						if (isset($iv->attack) && isset($iv->defense) && isset($iv->stamina)) {
195
+							$iv->available = true;
196
+						} else {
197
+							$iv->available = false;
198
+						}
198 199
 					}
199
-				}
200 200
 
201
-				$html = '
201
+					$html = '
202 202
 			    <div class="col-md-1 col-xs-4 pokemon-single" data-pokeid="'.$pokeid.'" data-pokeuid="'.$pokeuid.'" style="display: none;">
203 203
 				<a href="pokemon/'.$pokeid.'"><img src="core/pokemons/'.$pokeid.$config->system->pokeimg_suffix.'" alt="'.$pokemons->pokemon->$pokeid->name.'" class="img-responsive"></a>
204 204
 				<a href="pokemon/'.$pokeid.'"><p class="pkmn-name">'.$pokemons->pokemon->$pokeid->name.'</p></a>
205 205
 				<a href="https://maps.google.com/?q='.$last_location->latitude.','.$last_location->longitude.'&ll='.$last_location->latitude.','.$last_location->longitude.'&z=16" target="_blank">
206 206
 				    <small class="pokemon-timer">00:00:00</small>
207 207
 				</a>';
208
-				if ($config->system->recents_show_iv) {
209
-					if ($iv->available) {
210
-						if ($config->system->iv_numbers) {
211
-							$html .= '
208
+					if ($config->system->recents_show_iv) {
209
+						if ($iv->available) {
210
+							if ($config->system->iv_numbers) {
211
+								$html .= '
212 212
 							<div class="progress" style="height: 15px; margin-bottom: 0">
213 213
 								<div title="'.$locales->IV_ATTACK.': '.$iv->attack.'" class="progress-bar progress-bar-danger" role="progressbar" aria-valuenow="'.$iv->attack.'" aria-valuemin="0" aria-valuemax="45" style="width: '.(100 / 3).'%; line-height: 16px";>
214 214
 									<span class="sr-only">'.$locales->IV_ATTACK.': '.$iv->attack.'</span>'.$iv->attack .'
@@ -220,8 +220,8 @@  discard block
 block discarded – undo
220 220
 									<span class="sr-only">'.$locales->IV_STAMINA.': '.$iv->stamina.'</span>'.$iv->stamina .'
221 221
 								</div>
222 222
 							</div>';
223
-						} else {
224
-							$html .= '
223
+							} else {
224
+								$html .= '
225 225
 							<div class="progress" style="height: 6px; width: 80%; margin: 5px auto 0 auto;">
226 226
 					    		<div title="'.$locales->IV_ATTACK.': '.$iv->attack.'" class="progress-bar progress-bar-danger" role="progressbar" aria-valuenow="'.$iv->attack.'" aria-valuemin="0" aria-valuemax="45" style="width: '.(((100 / 15) * $iv->attack) / 3).'%">
227 227
 									<span class="sr-only">'.$locales->IV_ATTACK.': '.$iv->attack.'</span>
@@ -233,10 +233,10 @@  discard block
 block discarded – undo
233 233
 									<span class="sr-only">'.$locales->IV_STAMINA.': '.$iv->stamina.'</span>
234 234
 					    		</div>
235 235
 							</div>';
236
-						}
237
-					} else {
238
-						if ($config->system->iv_numbers) {
239
-							$html .= '
236
+							}
237
+						} else {
238
+							if ($config->system->iv_numbers) {
239
+								$html .= '
240 240
 							<div class="progress" style="height: 15px; margin-bottom: 0">
241 241
 								<div title="'.$locales->IV_ATTACK.': not available" class="progress-bar progress-bar-danger" role="progressbar" aria-valuenow="'.$iv->attack.'" aria-valuemin="0" aria-valuemax="45" style="width: '.(100 / 3).'%; line-height: 16px";>
242 242
 									<span class="sr-only">'.$locales->IV_ATTACK.': '.$locales->NOT_AVAILABLE.'</span>
@@ -248,129 +248,129 @@  discard block
 block discarded – undo
248 248
 									<span class="sr-only">'.$locales->IV_STAMINA.': '.$locales->NOT_AVAILABLE.'</span>
249 249
 								</div>
250 250
 							</div>';
251
-						} else {
252
-						$html .= '
251
+							} else {
252
+							$html .= '
253 253
 					    <div class="progress" style="height: 6px; width: 80%; margin: 5px auto 15px auto;">
254 254
 						    <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">
255 255
 							    <span class="sr-only">IV '.$locales->NOT_AVAILABLE.'</span>
256 256
 						    </div>
257 257
 					    </div>';
258
+							}
258 259
 						}
259 260
 					}
260
-				}
261
-				$html .= '
261
+					$html .= '
262 262
 			    </div>';
263
-				$new_spawn['html'] = $html;
264
-				$countdown = $last_seen - time();
265
-				$new_spawn['countdown'] = $countdown;
266
-				$new_spawn['pokemon_uid'] = $pokeuid;
267
-				$total_spawns[] = $new_spawn;
268
-			} else {
269
-				break;
263
+					$new_spawn['html'] = $html;
264
+					$countdown = $last_seen - time();
265
+					$new_spawn['countdown'] = $countdown;
266
+					$new_spawn['pokemon_uid'] = $pokeuid;
267
+					$total_spawns[] = $new_spawn;
268
+				} else {
269
+					break;
270
+				}
270 271
 			}
271
-		}
272
-		header('Content-Type: application/json');
273
-		echo json_encode($total_spawns);
274
-		break;
275
-
276
-
272
+			header('Content-Type: application/json');
273
+			echo json_encode($total_spawns);
274
+			break;
277 275
 
278
-	####################################
279
-	//
280
-	// List Pokestop
281
-	//
282
-	####################################
283 276
 
284
-	case 'pokestop':
285
-		if (!($config->system->only_lured_pokestops)) {
286
-			$req = "SELECT latitude, longitude, lure_expiration, UTC_TIMESTAMP() AS now, (CONVERT_TZ(lure_expiration, '+00:00', '".$time_offset."')) AS lure_expiration_real FROM pokestop";
287
-		} else {
288
-			$req = "SELECT latitude, longitude, lure_expiration, UTC_TIMESTAMP() AS now, (CONVERT_TZ(lure_expiration, '+00:00', '".$time_offset."')) AS lure_expiration_real FROM pokestop WHERE lure_expiration > UTC_TIMESTAMP()";
289
-		}
290
-		$result = $mysqli->query($req);
291 277
 
292
-		$i=0;
278
+		####################################
279
+		//
280
+		// List Pokestop
281
+		//
282
+		####################################
293 283
 
294
-		while ($data = $result->fetch_object()) {
295
-			if ($data->lure_expiration >= $data->now) {
296
-				$icon = 'pokestap_lured.png';
297
-				$text = sprintf($locales->POKESTOPS_MAP_LURED, date('H:i:s', strtotime($data->lure_expiration_real)));
284
+		case 'pokestop':
285
+			if (!($config->system->only_lured_pokestops)) {
286
+				$req = "SELECT latitude, longitude, lure_expiration, UTC_TIMESTAMP() AS now, (CONVERT_TZ(lure_expiration, '+00:00', '".$time_offset."')) AS lure_expiration_real FROM pokestop";
298 287
 			} else {
299
-				$icon = 'pokestap.png';
300
-				$text = $locales->POKESTOPS_MAP_REGULAR;
288
+				$req = "SELECT latitude, longitude, lure_expiration, UTC_TIMESTAMP() AS now, (CONVERT_TZ(lure_expiration, '+00:00', '".$time_offset."')) AS lure_expiration_real FROM pokestop WHERE lure_expiration > UTC_TIMESTAMP()";
301 289
 			}
290
+			$result = $mysqli->query($req);
302 291
 
303
-			$temp[$i][] = $text;
304
-			$temp[$i][] = $icon;
305
-			$temp[$i][] = $data->latitude;
306
-			$temp[$i][] = $data->longitude;
307
-			$temp[$i][] = $i;
292
+			$i=0;
308 293
 
309
-			$temp_json[] = json_encode($temp[$i]);
294
+			while ($data = $result->fetch_object()) {
295
+				if ($data->lure_expiration >= $data->now) {
296
+					$icon = 'pokestap_lured.png';
297
+					$text = sprintf($locales->POKESTOPS_MAP_LURED, date('H:i:s', strtotime($data->lure_expiration_real)));
298
+				} else {
299
+					$icon = 'pokestap.png';
300
+					$text = $locales->POKESTOPS_MAP_REGULAR;
301
+				}
310 302
 
303
+				$temp[$i][] = $text;
304
+				$temp[$i][] = $icon;
305
+				$temp[$i][] = $data->latitude;
306
+				$temp[$i][] = $data->longitude;
307
+				$temp[$i][] = $i;
311 308
 
312
-			$i++;
313
-		}
309
+				$temp_json[] = json_encode($temp[$i]);
314 310
 
315
-		$return = json_encode($temp_json);
316 311
 
317
-		echo $return;
312
+				$i++;
313
+			}
318 314
 
319
-		break;
315
+			$return = json_encode($temp_json);
320 316
 
317
+			echo $return;
321 318
 
319
+			break;
322 320
 
323
-	####################################
324
-	//
325
-	// Update data for the gym battle
326
-	//
327
-	####################################
328 321
 
329
-	case 'update_gym':
330
-		$teams			= new stdClass();
331
-		$teams->mystic 		= 1;
332
-		$teams->valor 		= 2;
333
-		$teams->instinct 	= 3;
334 322
 
323
+		####################################
324
+		//
325
+		// Update data for the gym battle
326
+		//
327
+		####################################
335 328
 
336
-		foreach ($teams as $team_name => $team_id) {
337
-			$req	= "SELECT COUNT(DISTINCT(gym_id)) AS total, ROUND(AVG(gym_points),0) AS average_points FROM gym WHERE team_id = '".$team_id."'";
338
-			$result	= $mysqli->query($req);
339
-			$data	= $result->fetch_object();
329
+		case 'update_gym':
330
+			$teams			= new stdClass();
331
+			$teams->mystic 		= 1;
332
+			$teams->valor 		= 2;
333
+			$teams->instinct 	= 3;
340 334
 
341
-			$return[] 	= $data->total;
342
-			$return[]	= $data->average_points;
343
-		}
344 335
 
345
-		$json = json_encode($return);
336
+			foreach ($teams as $team_name => $team_id) {
337
+				$req	= "SELECT COUNT(DISTINCT(gym_id)) AS total, ROUND(AVG(gym_points),0) AS average_points FROM gym WHERE team_id = '".$team_id."'";
338
+				$result	= $mysqli->query($req);
339
+				$data	= $result->fetch_object();
346 340
 
347
-		header('Content-Type: application/json');
348
-		echo $json;
341
+				$return[] 	= $data->total;
342
+				$return[]	= $data->average_points;
343
+			}
349 344
 
345
+			$json = json_encode($return);
350 346
 
351
-		break;
347
+			header('Content-Type: application/json');
348
+			echo $json;
352 349
 
353
-	####################################
354
-	//
355
-	// Get datas for the gym map
356
-	//
357
-	####################################
358 350
 
351
+			break;
359 352
 
360
-	case 'gym_map':
361
-		$req	= "SELECT gym_id, team_id, guard_pokemon_id, gym_points, latitude, longitude, (CONVERT_TZ(last_scanned, '+00:00', '".$time_offset."')) AS last_scanned FROM gym";
362
-		$result = $mysqli->query($req);
353
+		####################################
354
+		//
355
+		// Get datas for the gym map
356
+		//
357
+		####################################
363 358
 
364 359
 
365
-		$i=0;
360
+		case 'gym_map':
361
+			$req	= "SELECT gym_id, team_id, guard_pokemon_id, gym_points, latitude, longitude, (CONVERT_TZ(last_scanned, '+00:00', '".$time_offset."')) AS last_scanned FROM gym";
362
+			$result = $mysqli->query($req);
366 363
 
367
-		while ($data = $result->fetch_object()) {
368
-			// Team
369
-			// 1 = bleu
370
-			// 2 = rouge
371
-			// 3 = jaune
372 364
 
373
-			switch ($data->team_id) {
365
+			$i=0;
366
+
367
+			while ($data = $result->fetch_object()) {
368
+				// Team
369
+				// 1 = bleu
370
+				// 2 = rouge
371
+				// 3 = jaune
372
+
373
+				switch ($data->team_id) {
374 374
 				case 0:
375 375
 					$icon	= 'map_white.png';
376 376
 					$team	= 'No Team (yet)';
@@ -394,7 +394,7 @@  discard block
 block discarded – undo
394 394
 					$team	= 'Team Instinct';
395 395
 					$color	= 'rgba(254, 217, 40, .6)';
396 396
 					break;
397
-			}
397
+				}
398 398
 
399 399
 			// Set gym level
400 400
 			$data->gym_level=0;
@@ -466,69 +466,69 @@  discard block
 block discarded – undo
466 466
 	//
467 467
 	####################################
468 468
 
469
-	case 'gym_defenders':
470
-		$gym_id = $mysqli->real_escape_string($_GET['gym_id']);
471
-		$req	= "SELECT gymdetails.name AS name, gymdetails.description AS description, gym.gym_points AS points, gymdetails.url AS url, gym.team_id AS team,
469
+		case 'gym_defenders':
470
+			$gym_id = $mysqli->real_escape_string($_GET['gym_id']);
471
+			$req	= "SELECT gymdetails.name AS name, gymdetails.description AS description, gym.gym_points AS points, gymdetails.url AS url, gym.team_id AS team,
472 472
 					(CONVERT_TZ(gym.last_scanned, '+00:00', '".$time_offset."')) AS last_scanned, gym.guard_pokemon_id AS guard_pokemon_id
473 473
 					FROM gymdetails
474 474
 					LEFT JOIN gym ON gym.gym_id = gymdetails.gym_id
475 475
 					WHERE gym.gym_id='".$gym_id."'";
476
-		$result = $mysqli->query($req);
477
-		$gymData['gymDetails']['gymInfos'] = false;
476
+			$result = $mysqli->query($req);
477
+			$gymData['gymDetails']['gymInfos'] = false;
478 478
 		
479
-		while ($data = $result->fetch_object()) {
480
-			$gymData['gymDetails']['gymInfos']['name'] = $data->name;
481
-			$gymData['gymDetails']['gymInfos']['description'] = $data->description;
482
-			if ($data->url == null) {
483
-				$gymData['gymDetails']['gymInfos']['url'] = '';
484
-			} else {
485
-				$gymData['gymDetails']['gymInfos']['url'] = $data->url;
486
-			}
487
-			$gymData['gymDetails']['gymInfos']['points'] = $data->points;
488
-			$gymData['gymDetails']['gymInfos']['level'] = 0;
489
-			$gymData['gymDetails']['gymInfos']['last_scanned'] = $data->last_scanned;
490
-			$gymData['gymDetails']['gymInfos']['team'] = $data->team;
491
-			$gymData['gymDetails']['gymInfos']['guardPokemonId'] = $data->guard_pokemon_id;
492
-			if ($data->points < 2000) {
493
-				$gymData['gymDetails']['gymInfos']['level']=1;
494
-			} elseif ($data->points < 4000) {
495
-				$gymData['gymDetails']['gymInfos']['level']=2;
496
-			} elseif ($data->points < 8000) {
497
-				$gymData['gymDetails']['gymInfos']['level']=3;
498
-			} elseif ($data->points < 12000) {
499
-				$gymData['gymDetails']['gymInfos']['level']=4;
500
-			} elseif ($data->points < 16000) {
501
-				$gymData['gymDetails']['gymInfos']['level']=5;
502
-			} elseif ($data->points < 20000) {
503
-				$gymData['gymDetails']['gymInfos']['level']=6;
504
-			} elseif ($data->points < 30000) {
505
-				$gymData['gymDetails']['gymInfos']['level']=7;
506
-			} elseif ($data->points < 40000) {
507
-				$gymData['gymDetails']['gymInfos']['level']=8;
508
-			} elseif ($data->points < 50000) {
509
-				$gymData['gymDetails']['gymInfos']['level']=9;
510
-			} else {
511
-				$gymData['gymDetails']['gymInfos']['level']=10;
479
+			while ($data = $result->fetch_object()) {
480
+				$gymData['gymDetails']['gymInfos']['name'] = $data->name;
481
+				$gymData['gymDetails']['gymInfos']['description'] = $data->description;
482
+				if ($data->url == null) {
483
+					$gymData['gymDetails']['gymInfos']['url'] = '';
484
+				} else {
485
+					$gymData['gymDetails']['gymInfos']['url'] = $data->url;
486
+				}
487
+				$gymData['gymDetails']['gymInfos']['points'] = $data->points;
488
+				$gymData['gymDetails']['gymInfos']['level'] = 0;
489
+				$gymData['gymDetails']['gymInfos']['last_scanned'] = $data->last_scanned;
490
+				$gymData['gymDetails']['gymInfos']['team'] = $data->team;
491
+				$gymData['gymDetails']['gymInfos']['guardPokemonId'] = $data->guard_pokemon_id;
492
+				if ($data->points < 2000) {
493
+					$gymData['gymDetails']['gymInfos']['level']=1;
494
+				} elseif ($data->points < 4000) {
495
+					$gymData['gymDetails']['gymInfos']['level']=2;
496
+				} elseif ($data->points < 8000) {
497
+					$gymData['gymDetails']['gymInfos']['level']=3;
498
+				} elseif ($data->points < 12000) {
499
+					$gymData['gymDetails']['gymInfos']['level']=4;
500
+				} elseif ($data->points < 16000) {
501
+					$gymData['gymDetails']['gymInfos']['level']=5;
502
+				} elseif ($data->points < 20000) {
503
+					$gymData['gymDetails']['gymInfos']['level']=6;
504
+				} elseif ($data->points < 30000) {
505
+					$gymData['gymDetails']['gymInfos']['level']=7;
506
+				} elseif ($data->points < 40000) {
507
+					$gymData['gymDetails']['gymInfos']['level']=8;
508
+				} elseif ($data->points < 50000) {
509
+					$gymData['gymDetails']['gymInfos']['level']=9;
510
+				} else {
511
+					$gymData['gymDetails']['gymInfos']['level']=10;
512
+				}
512 513
 			}
513
-		}
514
-		//print_r($gymData);
515
-		$req 	= "SELECT DISTINCT gympokemon.pokemon_uid, pokemon_id, iv_attack, iv_defense, iv_stamina, MAX(cp) AS cp, gymmember.gym_id
514
+			//print_r($gymData);
515
+			$req 	= "SELECT DISTINCT gympokemon.pokemon_uid, pokemon_id, iv_attack, iv_defense, iv_stamina, MAX(cp) AS cp, gymmember.gym_id
516 516
 					FROM gympokemon INNER JOIN gymmember ON gympokemon.pokemon_uid=gymmember.pokemon_uid
517 517
 					GROUP BY gympokemon.pokemon_uid, pokemon_id, iv_attack, iv_defense, iv_stamina, gym_id
518 518
 					HAVING gymmember.gym_id='".$gym_id."'
519 519
 					ORDER BY cp DESC";
520
-		$result = $mysqli->query($req);
520
+			$result = $mysqli->query($req);
521 521
 		
522
-		$i = 0;
522
+			$i = 0;
523 523
 		
524
-		$gymData['infoWindow'] = '
524
+			$gymData['infoWindow'] = '
525 525
 			<div class="gym_defenders">
526 526
 			';
527
-		while ($data = $result->fetch_object()) {
528
-			$gymData['gymDetails']['pokemons'][] = $data;
529
-			if ($data != false) {
530
-				if ($config->system->iv_numbers) {
531
-					$gymData['infoWindow'] .= '
527
+			while ($data = $result->fetch_object()) {
528
+				$gymData['gymDetails']['pokemons'][] = $data;
529
+				if ($data != false) {
530
+					if ($config->system->iv_numbers) {
531
+						$gymData['infoWindow'] .= '
532 532
 					<div style="text-align: center; width: 50px; display: inline-block; margin-right: 3px">
533 533
 						<a href="pokemon/'.$data->pokemon_id.'">
534 534
 						<img src="core/pokemons/'.$data->pokemon_id.$config->system->pokeimg_suffix.'" height="50" style="display:inline-block" >
@@ -546,8 +546,8 @@  discard block
 block discarded – undo
546 546
 								</div>
547 547
 							</div>
548 548
 						</div>';
549
-				} else {
550
-					$gymData['infoWindow'] .= '
549
+					} else {
550
+						$gymData['infoWindow'] .= '
551 551
 					<div style="text-align: center; width: 50px; display: inline-block; margin-right: 3px">
552 552
 						<a href="pokemon/'.$data->pokemon_id.'">
553 553
 						<img src="core/pokemons/'.$data->pokemon_id.$config->system->pokeimg_suffix.'" height="50" style="display:inline-block" >
@@ -565,50 +565,50 @@  discard block
 block discarded – undo
565 565
 							</div>
566 566
 						</div>
567 567
 					</div>'
568
-						; }
569
-			} else {
570
-				$gymData['infoWindow'] .= '
568
+							; }
569
+				} else {
570
+					$gymData['infoWindow'] .= '
571 571
 				<div style="text-align: center; width: 50px; display: inline-block; margin-right: 3px">
572 572
 					<a href="pokemon/'.$gymData['gymDetails']['gymInfos']['guardPokemonId'].'">
573 573
 					<img src="core/pokemons/'.$gymData['gymDetails']['gymInfos']['guardPokemonId'].$config->system->pokeimg_suffix.'" height="50" style="display:inline-block" >
574 574
 					</a>
575 575
 					<p class="pkmn-name">???</p>
576 576
 				</div>'
577
-				;
577
+					;
578
+				}
579
+				$i++;
578 580
 			}
579
-			$i++;
580
-		}
581
-		$gymData['infoWindow'] = $gymData['infoWindow'].'</div>';
582
-		$return = json_encode($gymData);
581
+			$gymData['infoWindow'] = $gymData['infoWindow'].'</div>';
582
+			$return = json_encode($gymData);
583 583
 
584
-		echo $return;
584
+			echo $return;
585 585
 
586 586
 
587
-		break;
587
+			break;
588 588
 
589
-	case 'trainer':
590
-		$name = "";
591
-		$page = "0";
592
-		$where = "";
593
-		$order="";
594
-		$team=0;
595
-		$ranking=0;
596
-		if (isset($_GET['name'])) {
597
-			$trainer_name = mysqli_real_escape_string($mysqli, $_GET['name']);
598
-			$where = " HAVING name LIKE '%".$trainer_name."%'";
599
-		}
600
-		if (isset($_GET['team']) && $_GET['team']!=0) {
601
-			$team = mysqli_real_escape_string($mysqli, $_GET['team']);
602
-			$where .= ($where==""?" HAVING":"AND ")." team = ".$team;
603
-		}
604
-		if (isset($_GET['page'])) {
605
-			$page = mysqli_real_escape_string($mysqli, $_GET['page']);
606
-		}
607
-		if (isset($_GET['ranking'])) {
608
-			$ranking = mysqli_real_escape_string($mysqli, $_GET['ranking']);
609
-		}
589
+		case 'trainer':
590
+			$name = "";
591
+			$page = "0";
592
+			$where = "";
593
+			$order="";
594
+			$team=0;
595
+			$ranking=0;
596
+			if (isset($_GET['name'])) {
597
+				$trainer_name = mysqli_real_escape_string($mysqli, $_GET['name']);
598
+				$where = " HAVING name LIKE '%".$trainer_name."%'";
599
+			}
600
+			if (isset($_GET['team']) && $_GET['team']!=0) {
601
+				$team = mysqli_real_escape_string($mysqli, $_GET['team']);
602
+				$where .= ($where==""?" HAVING":"AND ")." team = ".$team;
603
+			}
604
+			if (isset($_GET['page'])) {
605
+				$page = mysqli_real_escape_string($mysqli, $_GET['page']);
606
+			}
607
+			if (isset($_GET['ranking'])) {
608
+				$ranking = mysqli_real_escape_string($mysqli, $_GET['ranking']);
609
+			}
610 610
 
611
-		switch ($ranking) {
611
+			switch ($ranking) {
612 612
 			case 1:
613 613
 				$order=" ORDER BY active DESC ";
614 614
 				break;
@@ -617,7 +617,7 @@  discard block
 block discarded – undo
617 617
 				break;
618 618
 			default:
619 619
 				$order=" ORDER BY level DESC, active DESC ";
620
-		}
620
+			}
621 621
 
622 622
 		$limit = " LIMIT ".($page*10).",10 ";
623 623
 
@@ -688,77 +688,77 @@  discard block
 block discarded – undo
688 688
 
689 689
 		break;
690 690
 
691
-	case 'pokemon_slider_init':
692
-		$req 		= "SELECT MIN(disappear_time) AS min, MAX(disappear_time) AS max FROM pokemon";
693
-		$result 	= $mysqli->query($req);
694
-		$data 		= $result->fetch_object();
695
-		$bounds 	= $data;
691
+		case 'pokemon_slider_init':
692
+			$req 		= "SELECT MIN(disappear_time) AS min, MAX(disappear_time) AS max FROM pokemon";
693
+			$result 	= $mysqli->query($req);
694
+			$data 		= $result->fetch_object();
695
+			$bounds 	= $data;
696 696
 
697
-		header('Content-Type: application/json');
698
-		$json = json_encode($bounds);
697
+			header('Content-Type: application/json');
698
+			$json = json_encode($bounds);
699 699
 
700
-		echo $json;
701
-		break;
700
+			echo $json;
701
+			break;
702 702
 
703
-	case 'pokemon_heatmap_points':
704
-		$json="";
705
-		if (isset($_GET['start'])&&isset($_GET['end']) && isset($_GET['pokemon_id'])) {
706
-			$start = Date("Y-m-d H:i",(int)$_GET['start']);
707
-			$end = Date("Y-m-d H:i",(int)$_GET['end']);
708
-			$pokemon_id = mysqli_real_escape_string($mysqli, $_GET['pokemon_id']);
709
-			$where = " WHERE pokemon_id = ".$pokemon_id." "
710
-					. "AND disappear_time BETWEEN '".$start."' AND '".$end."'";
711
-			$req 		= "SELECT latitude, longitude FROM pokemon".$where." ORDER BY disappear_time DESC LIMIT 10000";
712
-			$result 	= $mysqli->query($req);
713
-			$points = array();
714
-			while ($result && $data = $result->fetch_object()) {
715
-				$points[] 	= $data;
716
-			}
703
+		case 'pokemon_heatmap_points':
704
+			$json="";
705
+			if (isset($_GET['start'])&&isset($_GET['end']) && isset($_GET['pokemon_id'])) {
706
+				$start = Date("Y-m-d H:i",(int)$_GET['start']);
707
+				$end = Date("Y-m-d H:i",(int)$_GET['end']);
708
+				$pokemon_id = mysqli_real_escape_string($mysqli, $_GET['pokemon_id']);
709
+				$where = " WHERE pokemon_id = ".$pokemon_id." "
710
+						. "AND disappear_time BETWEEN '".$start."' AND '".$end."'";
711
+				$req 		= "SELECT latitude, longitude FROM pokemon".$where." ORDER BY disappear_time DESC LIMIT 10000";
712
+				$result 	= $mysqli->query($req);
713
+				$points = array();
714
+				while ($result && $data = $result->fetch_object()) {
715
+					$points[] 	= $data;
716
+				}
717 717
 
718
-			$json = json_encode($points);
719
-		}
718
+				$json = json_encode($points);
719
+			}
720 720
 
721
-		header('Content-Type: application/json');
721
+			header('Content-Type: application/json');
722 722
 
723
-		echo $json;
723
+			echo $json;
724 724
 
725
-		break;
725
+			break;
726 726
 
727
-	case 'pokemon_graph_data':
728
-		$json="";
729
-		if (isset($_GET['pokemon_id'])) {
730
-			$pokemon_id = mysqli_real_escape_string($mysqli, $_GET['pokemon_id']);
731
-			$req = "SELECT COUNT(*) AS total,
727
+		case 'pokemon_graph_data':
728
+			$json="";
729
+			if (isset($_GET['pokemon_id'])) {
730
+				$pokemon_id = mysqli_real_escape_string($mysqli, $_GET['pokemon_id']);
731
+				$req = "SELECT COUNT(*) AS total,
732 732
 					HOUR(CONVERT_TZ(disappear_time, '+00:00', '".$time_offset."')) AS disappear_hour
733 733
 					FROM (SELECT disappear_time FROM pokemon WHERE pokemon_id = '".$pokemon_id."' ORDER BY disappear_time LIMIT 10000) AS pokemonFiltered
734 734
 					GROUP BY disappear_hour
735 735
 					ORDER BY disappear_hour";
736
-			$result	= $mysqli->query($req);
737
-			$array = array_fill(0, 24, 0);
738
-			while ($result && $data = $result->fetch_object()) {
739
-				$array[$data->disappear_hour] = $data->total;
740
-			}
741
-			// shift array because AM/PM starts at 1AM not 0:00
742
-			$array[] = $array[0];
743
-			array_shift($array);
736
+				$result	= $mysqli->query($req);
737
+				$array = array_fill(0, 24, 0);
738
+				while ($result && $data = $result->fetch_object()) {
739
+					$array[$data->disappear_hour] = $data->total;
740
+				}
741
+				// shift array because AM/PM starts at 1AM not 0:00
742
+				$array[] = $array[0];
743
+				array_shift($array);
744 744
 
745
-			$json = json_encode($array);
746
-		}
745
+				$json = json_encode($array);
746
+			}
747 747
 
748
-		header('Content-Type: application/json');
748
+			header('Content-Type: application/json');
749 749
 
750
-		echo $json;
750
+			echo $json;
751 751
 
752
-		break;
752
+			break;
753 753
 
754
-	case 'postRequest':
755
-		break;
754
+		case 'postRequest':
755
+			break;
756 756
 
757
-	default:
758
-		echo "What do you mean?";
759
-		exit();
757
+		default:
758
+			echo "What do you mean?";
759
+			exit();
760 760
 
761
-	break;
761
+		break;
762 762
 }
763 763
 if ($postRequest!="") {
764 764
 	switch ($postRequest) {
Please login to merge, or discard this patch.
Spacing   +109 added lines, -109 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@  discard block
 block discarded – undo
6 6
 
7 7
 $pos = !empty($_SERVER['HTTP_REFERER']) && strpos($_SERVER['HTTP_REFERER'], getenv('HTTP_HOST'));
8 8
 
9
-if ($pos===false) {
9
+if ($pos === false) {
10 10
 	http_response_code(401);
11 11
 	die('Restricted access');
12 12
 }
@@ -19,8 +19,8 @@  discard block
 block discarded – undo
19 19
 // Include & load the variables
20 20
 // ############################
21 21
 
22
-$variables 	= SYS_PATH.'/core/json/variables.json';
23
-$config 	= json_decode(file_get_contents($variables));
22
+$variables = SYS_PATH.'/core/json/variables.json';
23
+$config = json_decode(file_get_contents($variables));
24 24
 
25 25
 
26 26
 
@@ -37,19 +37,19 @@  discard block
 block discarded – undo
37 37
 
38 38
 
39 39
 # MySQL
40
-$mysqli 	= new mysqli(SYS_DB_HOST, SYS_DB_USER, SYS_DB_PSWD, SYS_DB_NAME, SYS_DB_PORT);
40
+$mysqli = new mysqli(SYS_DB_HOST, SYS_DB_USER, SYS_DB_PSWD, SYS_DB_NAME, SYS_DB_PORT);
41 41
 if ($mysqli->connect_error != '') {
42 42
 	exit('Error MySQL Connect');
43 43
 }
44 44
 $mysqli->set_charset('utf8');
45 45
 $request = "";
46 46
 if (isset($_GET['type'])) {
47
-$request 	= $_GET['type'];
47
+$request = $_GET['type'];
48 48
 }
49 49
 $postRequest = "";
50 50
 if (isset($_POST['type'])) {
51 51
 	$postRequest = $_POST['type'];
52
-	$request= "postRequest";
52
+	$request = "postRequest";
53 53
 }
54 54
 switch ($request) {
55 55
 	############################
@@ -62,64 +62,64 @@  discard block
 block discarded – undo
62 62
 		// Right now
63 63
 		// ---------
64 64
 
65
-		$req 		= "SELECT COUNT(*) AS total FROM pokemon WHERE disappear_time >= UTC_TIMESTAMP()";
66
-		$result 	= $mysqli->query($req);
67
-		$data 		= $result->fetch_object();
65
+		$req = "SELECT COUNT(*) AS total FROM pokemon WHERE disappear_time >= UTC_TIMESTAMP()";
66
+		$result = $mysqli->query($req);
67
+		$data = $result->fetch_object();
68 68
 
69
-		$values[] 	= $data->total;
69
+		$values[] = $data->total;
70 70
 
71 71
 
72 72
 		// Lured stops
73 73
 		// -----------
74 74
 
75
-		$req 		= "SELECT COUNT(*) AS total FROM pokestop WHERE lure_expiration >= UTC_TIMESTAMP()";
76
-		$result 	= $mysqli->query($req);
77
-		$data 		= $result->fetch_object();
75
+		$req = "SELECT COUNT(*) AS total FROM pokestop WHERE lure_expiration >= UTC_TIMESTAMP()";
76
+		$result = $mysqli->query($req);
77
+		$data = $result->fetch_object();
78 78
 
79
-		$values[] 	= $data->total;
79
+		$values[] = $data->total;
80 80
 
81 81
 
82 82
 
83 83
 		// Team battle
84 84
 		// -----------
85 85
 
86
-		$req 		= "SELECT COUNT(DISTINCT(gym_id)) AS total FROM gym";
87
-		$result 	= $mysqli->query($req);
88
-		$data 		= $result->fetch_object();
86
+		$req = "SELECT COUNT(DISTINCT(gym_id)) AS total FROM gym";
87
+		$result = $mysqli->query($req);
88
+		$data = $result->fetch_object();
89 89
 
90
-		$values[] 	= $data->total;
90
+		$values[] = $data->total;
91 91
 
92 92
 		// Team
93 93
 		// 1 = bleu
94 94
 		// 2 = rouge
95 95
 		// 3 = jaune
96 96
 
97
-		$req	= "SELECT COUNT(DISTINCT(gym_id)) AS total FROM gym WHERE team_id = '2'";
98
-		$result	= $mysqli->query($req);
99
-		$data	= $result->fetch_object();
97
+		$req = "SELECT COUNT(DISTINCT(gym_id)) AS total FROM gym WHERE team_id = '2'";
98
+		$result = $mysqli->query($req);
99
+		$data = $result->fetch_object();
100 100
 
101 101
 		// Red
102 102
 		$values[] = $data->total;
103 103
 
104 104
 
105
-		$req	= "SELECT COUNT(DISTINCT(gym_id)) AS total FROM gym WHERE team_id = '1'";
106
-		$result	= $mysqli->query($req);
107
-		$data	= $result->fetch_object();
105
+		$req = "SELECT COUNT(DISTINCT(gym_id)) AS total FROM gym WHERE team_id = '1'";
106
+		$result = $mysqli->query($req);
107
+		$data = $result->fetch_object();
108 108
 
109 109
 		// Blue
110 110
 		$values[] = $data->total;
111 111
 
112 112
 
113
-		$req	= "SELECT COUNT(DISTINCT(gym_id)) AS total FROM gym WHERE team_id = '3'";
114
-		$result	= $mysqli->query($req);
115
-		$data	= $result->fetch_object();
113
+		$req = "SELECT COUNT(DISTINCT(gym_id)) AS total FROM gym WHERE team_id = '3'";
114
+		$result = $mysqli->query($req);
115
+		$data = $result->fetch_object();
116 116
 
117 117
 		// Yellow
118 118
 		$values[] = $data->total;
119 119
 
120
-		$req	= "SELECT COUNT(DISTINCT(gym_id)) AS total FROM gym WHERE team_id = '0'";
121
-		$result	= $mysqli->query($req);
122
-		$data	= $result->fetch_object();
120
+		$req = "SELECT COUNT(DISTINCT(gym_id)) AS total FROM gym WHERE team_id = '0'";
121
+		$result = $mysqli->query($req);
122
+		$data = $result->fetch_object();
123 123
 
124 124
 		// Neutral
125 125
 		$values[] = $data->total;
@@ -211,13 +211,13 @@  discard block
 block discarded – undo
211 211
 							$html .= '
212 212
 							<div class="progress" style="height: 15px; margin-bottom: 0">
213 213
 								<div title="'.$locales->IV_ATTACK.': '.$iv->attack.'" class="progress-bar progress-bar-danger" role="progressbar" aria-valuenow="'.$iv->attack.'" aria-valuemin="0" aria-valuemax="45" style="width: '.(100 / 3).'%; line-height: 16px";>
214
-									<span class="sr-only">'.$locales->IV_ATTACK.': '.$iv->attack.'</span>'.$iv->attack .'
214
+									<span class="sr-only">'.$locales->IV_ATTACK.': '.$iv->attack.'</span>'.$iv->attack.'
215 215
 								</div>
216 216
 								<div title="'.$locales->IV_DEFENSE.': '.$iv->defense.'" class="progress-bar progress-bar-info" role="progressbar" aria-valuenow="'.$iv->defense.'" aria-valuemin="0" aria-valuemax="45" style="width: '.(100 / 3).'%; line-height: 16px";>
217
-									<span class="sr-only">'.$locales->IV_DEFENSE.': '.$iv->defense.'</span>'.$iv->defense .'
217
+									<span class="sr-only">'.$locales->IV_DEFENSE.': '.$iv->defense.'</span>'.$iv->defense.'
218 218
 								</div>
219 219
 								<div title="'.$locales->IV_STAMINA.': '.$iv->stamina.'" class="progress-bar progress-bar-success" role="progressbar" aria-valuenow="'.$iv->stamina.'" aria-valuemin="0" aria-valuemax="45" style="width: '.(100 / 3).'%; line-height: 16px";>
220
-									<span class="sr-only">'.$locales->IV_STAMINA.': '.$iv->stamina.'</span>'.$iv->stamina .'
220
+									<span class="sr-only">'.$locales->IV_STAMINA.': '.$iv->stamina.'</span>'.$iv->stamina.'
221 221
 								</div>
222 222
 							</div>';
223 223
 						} else {
@@ -226,10 +226,10 @@  discard block
 block discarded – undo
226 226
 					    		<div title="'.$locales->IV_ATTACK.': '.$iv->attack.'" class="progress-bar progress-bar-danger" role="progressbar" aria-valuenow="'.$iv->attack.'" aria-valuemin="0" aria-valuemax="45" style="width: '.(((100 / 15) * $iv->attack) / 3).'%">
227 227
 									<span class="sr-only">'.$locales->IV_ATTACK.': '.$iv->attack.'</span>
228 228
 					    		</div>
229
-					    		<div title="'.$locales->IV_DEFENSE.': '.$iv->defense .'" class="progress-bar progress-bar-info" role="progressbar" aria-valuenow="'.$iv->defense.'" aria-valuemin="0" aria-valuemax="45" style="width: '.(((100 / 15) * $iv->defense) / 3).'%">
229
+					    		<div title="'.$locales->IV_DEFENSE.': '.$iv->defense.'" class="progress-bar progress-bar-info" role="progressbar" aria-valuenow="'.$iv->defense.'" aria-valuemin="0" aria-valuemax="45" style="width: '.(((100 / 15) * $iv->defense) / 3).'%">
230 230
 									<span class="sr-only">'.$locales->IV_DEFENSE.': '.$iv->defense.'</span>
231 231
 					    		</div>
232
-					    		<div title="'.$locales->IV_STAMINA.': '.$iv->stamina .'" class="progress-bar progress-bar-success" role="progressbar" aria-valuenow="'.$iv->stamina.'" aria-valuemin="0" aria-valuemax="45" style="width: '.(((100 / 15) * $iv->stamina) / 3).'%">
232
+					    		<div title="'.$locales->IV_STAMINA.': '.$iv->stamina.'" class="progress-bar progress-bar-success" role="progressbar" aria-valuenow="'.$iv->stamina.'" aria-valuemin="0" aria-valuemax="45" style="width: '.(((100 / 15) * $iv->stamina) / 3).'%">
233 233
 									<span class="sr-only">'.$locales->IV_STAMINA.': '.$iv->stamina.'</span>
234 234
 					    		</div>
235 235
 							</div>';
@@ -289,7 +289,7 @@  discard block
 block discarded – undo
289 289
 		}
290 290
 		$result = $mysqli->query($req);
291 291
 
292
-		$i=0;
292
+		$i = 0;
293 293
 
294 294
 		while ($data = $result->fetch_object()) {
295 295
 			if ($data->lure_expiration >= $data->now) {
@@ -327,19 +327,19 @@  discard block
 block discarded – undo
327 327
 	####################################
328 328
 
329 329
 	case 'update_gym':
330
-		$teams			= new stdClass();
331
-		$teams->mystic 		= 1;
332
-		$teams->valor 		= 2;
333
-		$teams->instinct 	= 3;
330
+		$teams = new stdClass();
331
+		$teams->mystic = 1;
332
+		$teams->valor = 2;
333
+		$teams->instinct = 3;
334 334
 
335 335
 
336 336
 		foreach ($teams as $team_name => $team_id) {
337
-			$req	= "SELECT COUNT(DISTINCT(gym_id)) AS total, ROUND(AVG(gym_points),0) AS average_points FROM gym WHERE team_id = '".$team_id."'";
338
-			$result	= $mysqli->query($req);
339
-			$data	= $result->fetch_object();
337
+			$req = "SELECT COUNT(DISTINCT(gym_id)) AS total, ROUND(AVG(gym_points),0) AS average_points FROM gym WHERE team_id = '".$team_id."'";
338
+			$result = $mysqli->query($req);
339
+			$data = $result->fetch_object();
340 340
 
341
-			$return[] 	= $data->total;
342
-			$return[]	= $data->average_points;
341
+			$return[] = $data->total;
342
+			$return[] = $data->average_points;
343 343
 		}
344 344
 
345 345
 		$json = json_encode($return);
@@ -358,11 +358,11 @@  discard block
 block discarded – undo
358 358
 
359 359
 
360 360
 	case 'gym_map':
361
-		$req	= "SELECT gym_id, team_id, guard_pokemon_id, gym_points, latitude, longitude, (CONVERT_TZ(last_scanned, '+00:00', '".$time_offset."')) AS last_scanned FROM gym";
361
+		$req = "SELECT gym_id, team_id, guard_pokemon_id, gym_points, latitude, longitude, (CONVERT_TZ(last_scanned, '+00:00', '".$time_offset."')) AS last_scanned FROM gym";
362 362
 		$result = $mysqli->query($req);
363 363
 
364 364
 
365
-		$i=0;
365
+		$i = 0;
366 366
 
367 367
 		while ($data = $result->fetch_object()) {
368 368
 			// Team
@@ -374,50 +374,50 @@  discard block
 block discarded – undo
374 374
 				case 0:
375 375
 					$icon	= 'map_white.png';
376 376
 					$team	= 'No Team (yet)';
377
-					$color	= 'rgba(0, 0, 0, .6)';
377
+					$color = 'rgba(0, 0, 0, .6)';
378 378
 					break;
379 379
 
380 380
 				case 1:
381 381
 					$icon	= 'map_blue_';
382 382
 					$team	= 'Team Mystic';
383
-					$color	= 'rgba(74, 138, 202, .6)';
383
+					$color = 'rgba(74, 138, 202, .6)';
384 384
 					break;
385 385
 
386 386
 				case 2:
387 387
 					$icon	= 'map_red_';
388 388
 					$team	= 'Team Valor';
389
-					$color	= 'rgba(240, 68, 58, .6)';
389
+					$color = 'rgba(240, 68, 58, .6)';
390 390
 					break;
391 391
 
392 392
 				case 3:
393 393
 					$icon	= 'map_yellow_';
394 394
 					$team	= 'Team Instinct';
395
-					$color	= 'rgba(254, 217, 40, .6)';
395
+					$color = 'rgba(254, 217, 40, .6)';
396 396
 					break;
397 397
 			}
398 398
 
399 399
 			// Set gym level
400
-			$data->gym_level=0;
400
+			$data->gym_level = 0;
401 401
 			if ($data->gym_points < 2000) {
402
-				$data->gym_level=1;
402
+				$data->gym_level = 1;
403 403
 			} elseif ($data->gym_points < 4000) {
404
-				$data->gym_level=2;
404
+				$data->gym_level = 2;
405 405
 			} elseif ($data->gym_points < 8000) {
406
-				$data->gym_level=3;
406
+				$data->gym_level = 3;
407 407
 			} elseif ($data->gym_points < 12000) {
408
-				$data->gym_level=4;
408
+				$data->gym_level = 4;
409 409
 			} elseif ($data->gym_points < 16000) {
410
-				$data->gym_level=5;
410
+				$data->gym_level = 5;
411 411
 			} elseif ($data->gym_points < 20000) {
412
-				$data->gym_level=6;
412
+				$data->gym_level = 6;
413 413
 			} elseif ($data->gym_points < 30000) {
414
-				$data->gym_level=7;
414
+				$data->gym_level = 7;
415 415
 			} elseif ($data->gym_points < 40000) {
416
-				$data->gym_level=8;
416
+				$data->gym_level = 8;
417 417
 			} elseif ($data->gym_points < 50000) {
418
-				$data->gym_level=9;
418
+				$data->gym_level = 9;
419 419
 			} else {
420
-				$data->gym_level=10;
420
+				$data->gym_level = 10;
421 421
 			}
422 422
 
423 423
 			## I know, I revert commit 6e8d2e7 from @kiralydavid but the way it was done broke the page.
@@ -468,7 +468,7 @@  discard block
 block discarded – undo
468 468
 
469 469
 	case 'gym_defenders':
470 470
 		$gym_id = $mysqli->real_escape_string($_GET['gym_id']);
471
-		$req	= "SELECT gymdetails.name AS name, gymdetails.description AS description, gym.gym_points AS points, gymdetails.url AS url, gym.team_id AS team,
471
+		$req = "SELECT gymdetails.name AS name, gymdetails.description AS description, gym.gym_points AS points, gymdetails.url AS url, gym.team_id AS team,
472 472
 					(CONVERT_TZ(gym.last_scanned, '+00:00', '".$time_offset."')) AS last_scanned, gym.guard_pokemon_id AS guard_pokemon_id
473 473
 					FROM gymdetails
474 474
 					LEFT JOIN gym ON gym.gym_id = gymdetails.gym_id
@@ -490,29 +490,29 @@  discard block
 block discarded – undo
490 490
 			$gymData['gymDetails']['gymInfos']['team'] = $data->team;
491 491
 			$gymData['gymDetails']['gymInfos']['guardPokemonId'] = $data->guard_pokemon_id;
492 492
 			if ($data->points < 2000) {
493
-				$gymData['gymDetails']['gymInfos']['level']=1;
493
+				$gymData['gymDetails']['gymInfos']['level'] = 1;
494 494
 			} elseif ($data->points < 4000) {
495
-				$gymData['gymDetails']['gymInfos']['level']=2;
495
+				$gymData['gymDetails']['gymInfos']['level'] = 2;
496 496
 			} elseif ($data->points < 8000) {
497
-				$gymData['gymDetails']['gymInfos']['level']=3;
497
+				$gymData['gymDetails']['gymInfos']['level'] = 3;
498 498
 			} elseif ($data->points < 12000) {
499
-				$gymData['gymDetails']['gymInfos']['level']=4;
499
+				$gymData['gymDetails']['gymInfos']['level'] = 4;
500 500
 			} elseif ($data->points < 16000) {
501
-				$gymData['gymDetails']['gymInfos']['level']=5;
501
+				$gymData['gymDetails']['gymInfos']['level'] = 5;
502 502
 			} elseif ($data->points < 20000) {
503
-				$gymData['gymDetails']['gymInfos']['level']=6;
503
+				$gymData['gymDetails']['gymInfos']['level'] = 6;
504 504
 			} elseif ($data->points < 30000) {
505
-				$gymData['gymDetails']['gymInfos']['level']=7;
505
+				$gymData['gymDetails']['gymInfos']['level'] = 7;
506 506
 			} elseif ($data->points < 40000) {
507
-				$gymData['gymDetails']['gymInfos']['level']=8;
507
+				$gymData['gymDetails']['gymInfos']['level'] = 8;
508 508
 			} elseif ($data->points < 50000) {
509
-				$gymData['gymDetails']['gymInfos']['level']=9;
509
+				$gymData['gymDetails']['gymInfos']['level'] = 9;
510 510
 			} else {
511
-				$gymData['gymDetails']['gymInfos']['level']=10;
511
+				$gymData['gymDetails']['gymInfos']['level'] = 10;
512 512
 			}
513 513
 		}
514 514
 		//print_r($gymData);
515
-		$req 	= "SELECT DISTINCT gympokemon.pokemon_uid, pokemon_id, iv_attack, iv_defense, iv_stamina, MAX(cp) AS cp, gymmember.gym_id
515
+		$req = "SELECT DISTINCT gympokemon.pokemon_uid, pokemon_id, iv_attack, iv_defense, iv_stamina, MAX(cp) AS cp, gymmember.gym_id
516 516
 					FROM gympokemon INNER JOIN gymmember ON gympokemon.pokemon_uid=gymmember.pokemon_uid
517 517
 					GROUP BY gympokemon.pokemon_uid, pokemon_id, iv_attack, iv_defense, iv_stamina, gym_id
518 518
 					HAVING gymmember.gym_id='".$gym_id."'
@@ -539,10 +539,10 @@  discard block
 block discarded – undo
539 539
 								<span class="sr-only">'.$locales->IV_ATTACK.' : '.$data->iv_attack.'</span>'.$data->iv_attack.'
540 540
 								</div>
541 541
 								<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">
542
-									<span class="sr-only">'.$locales->IV_DEFENSE.' : '.$data->iv_defense.'</span>'. $data->iv_defense .'
542
+									<span class="sr-only">'.$locales->IV_DEFENSE.' : '.$data->iv_defense.'</span>'.$data->iv_defense.'
543 543
 								</div>
544 544
 								<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">
545
-									<span class="sr-only">'.$locales->IV_STAMINA.' : '.$data->iv_stamina.'</span>'. $data->iv_stamina .'
545
+									<span class="sr-only">'.$locales->IV_STAMINA.' : '.$data->iv_stamina.'</span>'.$data->iv_stamina.'
546 546
 								</div>
547 547
 							</div>
548 548
 						</div>';
@@ -590,16 +590,16 @@  discard block
 block discarded – undo
590 590
 		$name = "";
591 591
 		$page = "0";
592 592
 		$where = "";
593
-		$order="";
594
-		$team=0;
595
-		$ranking=0;
593
+		$order = "";
594
+		$team = 0;
595
+		$ranking = 0;
596 596
 		if (isset($_GET['name'])) {
597 597
 			$trainer_name = mysqli_real_escape_string($mysqli, $_GET['name']);
598 598
 			$where = " HAVING name LIKE '%".$trainer_name."%'";
599 599
 		}
600
-		if (isset($_GET['team']) && $_GET['team']!=0) {
600
+		if (isset($_GET['team']) && $_GET['team'] != 0) {
601 601
 			$team = mysqli_real_escape_string($mysqli, $_GET['team']);
602
-			$where .= ($where==""?" HAVING":"AND ")." team = ".$team;
602
+			$where .= ($where == "" ? " HAVING" : "AND ")." team = ".$team;
603 603
 		}
604 604
 		if (isset($_GET['page'])) {
605 605
 			$page = mysqli_real_escape_string($mysqli, $_GET['page']);
@@ -610,16 +610,16 @@  discard block
 block discarded – undo
610 610
 
611 611
 		switch ($ranking) {
612 612
 			case 1:
613
-				$order=" ORDER BY active DESC ";
613
+				$order = " ORDER BY active DESC ";
614 614
 				break;
615 615
 			case 2:
616
-				$order=" ORDER BY maxCp DESC ";
616
+				$order = " ORDER BY maxCp DESC ";
617 617
 				break;
618 618
 			default:
619
-				$order=" ORDER BY level DESC, active DESC ";
619
+				$order = " ORDER BY level DESC, active DESC ";
620 620
 		}
621 621
 
622
-		$limit = " LIMIT ".($page*10).",10 ";
622
+		$limit = " LIMIT ".($page * 10).",10 ";
623 623
 
624 624
 
625 625
 		$req = "SELECT trainer.*, COUNT(actives_pokemons.trainer_name) AS active, max(actives_pokemons.cp) AS maxCp
@@ -640,7 +640,7 @@  discard block
 block discarded – undo
640 640
 			$reqRanking = "SELECT COUNT(1) AS rank FROM trainer WHERE trainer.level >= ".$trainer->level;
641 641
 			$resultRanking = $mysqli->query($reqRanking);
642 642
 			while ($data = $resultRanking->fetch_object()) {
643
-				$trainer->rank = $data->rank ;
643
+				$trainer->rank = $data->rank;
644 644
 			}
645 645
 			$req = "(SELECT DISTINCT gympokemon.pokemon_id, gympokemon.pokemon_uid, gympokemon.cp, DATEDIFF(UTC_TIMESTAMP(), gympokemon.last_seen) AS last_scanned, gympokemon.trainer_name, gympokemon.iv_defense, gympokemon.iv_stamina, gympokemon.iv_attack, filtered_gymmember.gym_id, '1' AS active
646 646
 					FROM gympokemon INNER JOIN
@@ -651,7 +651,7 @@  discard block
 block discarded – undo
651 651
 
652 652
 			$resultPkms = $mysqli->query($req);
653 653
 			$trainer->pokemons = array();
654
-			$active_gyms=0;
654
+			$active_gyms = 0;
655 655
 			$pkmCount = 0;
656 656
 			while ($resultPkms && $dataPkm = $resultPkms->fetch_object()) {
657 657
 				$active_gyms++;
@@ -689,9 +689,9 @@  discard block
 block discarded – undo
689 689
 		break;
690 690
 
691 691
 	case 'pokemon_slider_init':
692
-		$req 		= "SELECT MIN(disappear_time) AS min, MAX(disappear_time) AS max FROM pokemon";
692
+		$req = "SELECT MIN(disappear_time) AS min, MAX(disappear_time) AS max FROM pokemon";
693 693
 		$result 	= $mysqli->query($req);
694
-		$data 		= $result->fetch_object();
694
+		$data = $result->fetch_object();
695 695
 		$bounds 	= $data;
696 696
 
697 697
 		header('Content-Type: application/json');
@@ -701,18 +701,18 @@  discard block
 block discarded – undo
701 701
 		break;
702 702
 
703 703
 	case 'pokemon_heatmap_points':
704
-		$json="";
705
-		if (isset($_GET['start'])&&isset($_GET['end']) && isset($_GET['pokemon_id'])) {
706
-			$start = Date("Y-m-d H:i",(int)$_GET['start']);
707
-			$end = Date("Y-m-d H:i",(int)$_GET['end']);
704
+		$json = "";
705
+		if (isset($_GET['start']) && isset($_GET['end']) && isset($_GET['pokemon_id'])) {
706
+			$start = Date("Y-m-d H:i", (int) $_GET['start']);
707
+			$end = Date("Y-m-d H:i", (int) $_GET['end']);
708 708
 			$pokemon_id = mysqli_real_escape_string($mysqli, $_GET['pokemon_id']);
709 709
 			$where = " WHERE pokemon_id = ".$pokemon_id." "
710 710
 					. "AND disappear_time BETWEEN '".$start."' AND '".$end."'";
711 711
 			$req 		= "SELECT latitude, longitude FROM pokemon".$where." ORDER BY disappear_time DESC LIMIT 10000";
712
-			$result 	= $mysqli->query($req);
712
+			$result = $mysqli->query($req);
713 713
 			$points = array();
714 714
 			while ($result && $data = $result->fetch_object()) {
715
-				$points[] 	= $data;
715
+				$points[] = $data;
716 716
 			}
717 717
 
718 718
 			$json = json_encode($points);
@@ -725,7 +725,7 @@  discard block
 block discarded – undo
725 725
 		break;
726 726
 
727 727
 	case 'pokemon_graph_data':
728
-		$json="";
728
+		$json = "";
729 729
 		if (isset($_GET['pokemon_id'])) {
730 730
 			$pokemon_id = mysqli_real_escape_string($mysqli, $_GET['pokemon_id']);
731 731
 			$req = "SELECT COUNT(*) AS total,
@@ -733,7 +733,7 @@  discard block
 block discarded – undo
733 733
 					FROM (SELECT disappear_time FROM pokemon WHERE pokemon_id = '".$pokemon_id."' ORDER BY disappear_time LIMIT 10000) AS pokemonFiltered
734 734
 					GROUP BY disappear_hour
735 735
 					ORDER BY disappear_hour";
736
-			$result	= $mysqli->query($req);
736
+			$result = $mysqli->query($req);
737 737
 			$array = array_fill(0, 24, 0);
738 738
 			while ($result && $data = $result->fetch_object()) {
739 739
 				$array[$data->disappear_hour] = $data->total;
@@ -760,30 +760,30 @@  discard block
 block discarded – undo
760 760
 
761 761
 	break;
762 762
 }
763
-if ($postRequest!="") {
763
+if ($postRequest != "") {
764 764
 	switch ($postRequest) {
765 765
 		case 'pokemon_live':
766
-			$json="";
767
-			if (isset( $_POST['pokemon_id'])) {
766
+			$json = "";
767
+			if (isset($_POST['pokemon_id'])) {
768 768
 				$pokemon_id = mysqli_real_escape_string($mysqli, $_POST['pokemon_id']);
769
-				$inmap_pkms_filter="";
769
+				$inmap_pkms_filter = "";
770 770
 				$where = " WHERE disappear_time >= UTC_TIMESTAMP() AND pokemon_id = ".$pokemon_id;
771 771
 
772 772
 				$reqTestIv = "SELECT MAX(individual_attack) AS iv FROM pokemon ".$where;
773
-				$resultTestIv 	= $mysqli->query($reqTestIv);
773
+				$resultTestIv = $mysqli->query($reqTestIv);
774 774
 				$testIv = $resultTestIv->fetch_object();
775
-				if (isset( $_POST['inmap_pokemons'])&&( $_POST['inmap_pokemons']!="")) {
775
+				if (isset($_POST['inmap_pokemons']) && ($_POST['inmap_pokemons'] != "")) {
776 776
 					foreach ($_POST['inmap_pokemons'] as $inmap) {
777 777
 						$inmap_pkms_filter .= "'".$inmap."',";
778 778
 					}
779 779
 					$inmap_pkms_filter = rtrim($inmap_pkms_filter, ",");
780 780
 					$where .= " AND encounter_id NOT IN (".$inmap_pkms_filter.") ";
781 781
 				}
782
-				if ($testIv->iv!=null && isset( $_POST['ivMin'])&&( $_POST['ivMin']!="")) {
782
+				if ($testIv->iv != null && isset($_POST['ivMin']) && ($_POST['ivMin'] != "")) {
783 783
 					$ivMin = mysqli_real_escape_string($mysqli, $_POST['ivMin']);
784 784
 					$where .= " AND ((100/45)*(individual_attack+individual_defense+individual_stamina)) >= (".$ivMin.") ";
785 785
 				}
786
-				if ($testIv->iv!=null && isset( $_POST['ivMax'])&&( $_POST['ivMax']!="")) {
786
+				if ($testIv->iv != null && isset($_POST['ivMax']) && ($_POST['ivMax'] != "")) {
787 787
 					$ivMax = mysqli_real_escape_string($mysqli, $_POST['ivMax']);
788 788
 					$where .= " AND ((100/45)*(individual_attack+individual_defense+individual_stamina)) <=(".$ivMax.") ";
789 789
 				}
@@ -797,12 +797,12 @@  discard block
 block discarded – undo
797 797
 				$json = array();
798 798
 				$json['points'] = array();
799 799
 				$locale = array();
800
-				$locale["ivAttack"] =  $locales->IV_ATTACK;
800
+				$locale["ivAttack"] = $locales->IV_ATTACK;
801 801
 				$locale["ivDefense"] = $locales->IV_DEFENSE;
802
-				$locale["ivStamina"] =  $locales->IV_STAMINA;
802
+				$locale["ivStamina"] = $locales->IV_STAMINA;
803 803
 				$json['locale'] = $locale;
804 804
 				while ($result && $data = $result->fetch_object()) {
805
-					$pokeid=$data->pokemon_id;
805
+					$pokeid = $data->pokemon_id;
806 806
 					$data->name = $pokemons->pokemon->$pokeid->name;
807 807
 					if (isset($data->move_1)) {
808 808
 						$move1 = $data->move_1;
@@ -816,7 +816,7 @@  discard block
 block discarded – undo
816 816
 					} else {
817 817
 						$data->charge_move = "?";
818 818
 					}
819
-					$json['points'][] 	= $data;
819
+					$json['points'][] = $data;
820 820
 				}
821 821
 
822 822
 				$json = json_encode($json);
Please login to merge, or discard this patch.
core/process/data.loader.php 1 patch
Spacing   +70 added lines, -70 removed lines patch added patch discarded remove patch
@@ -3,8 +3,8 @@  discard block
 block discarded – undo
3 3
 // Include & load the variables
4 4
 // ############################
5 5
 
6
-$variables 	= SYS_PATH.'/core/json/variables.json';
7
-$config 	= json_decode(file_get_contents($variables));
6
+$variables = SYS_PATH.'/core/json/variables.json';
7
+$config = json_decode(file_get_contents($variables));
8 8
 
9 9
 if (!defined('SYS_PATH')) {
10 10
 	echo 'Error: config.php does not exist or failed to load.<br>';
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
 #################
39 39
 
40 40
 
41
-$mysqli 	= new mysqli(SYS_DB_HOST, SYS_DB_USER, SYS_DB_PSWD, SYS_DB_NAME, SYS_DB_PORT);
41
+$mysqli = new mysqli(SYS_DB_HOST, SYS_DB_USER, SYS_DB_PSWD, SYS_DB_NAME, SYS_DB_PORT);
42 42
 
43 43
 
44 44
 if ($mysqli->connect_error != '') {
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
 			// Current Pokemon datas
99 99
 			// ---------------------
100 100
 
101
-			$pokemon_id 			= mysqli_real_escape_string($mysqli, $_GET['id']);
101
+			$pokemon_id = mysqli_real_escape_string($mysqli, $_GET['id']);
102 102
 
103 103
 			if (!is_object($pokemons->pokemon->$pokemon_id)) {
104 104
 				header('Location:/404');
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
 
109 109
 			$pokemon			= new stdClass();
110 110
 			$pokemon			= $pokemons->pokemon->$pokemon_id;
111
-			$pokemon->id			= $pokemon_id;
111
+			$pokemon->id = $pokemon_id;
112 112
 
113 113
 
114 114
 			// Some math
@@ -124,9 +124,9 @@  discard block
 block discarded – undo
124 124
 
125 125
 			// Total gym protected
126 126
 
127
-			$req 		= "SELECT COUNT(DISTINCT(gym_id)) AS total FROM gym WHERE guard_pokemon_id = '".$pokemon_id."'";
128
-			$result 	= $mysqli->query($req);
129
-			$data 		= $result->fetch_object();
127
+			$req = "SELECT COUNT(DISTINCT(gym_id)) AS total FROM gym WHERE guard_pokemon_id = '".$pokemon_id."'";
128
+			$result = $mysqli->query($req);
129
+			$data = $result->fetch_object();
130 130
 
131 131
 			$pokemon->protected_gyms = $data->total;
132 132
 
@@ -140,21 +140,21 @@  discard block
 block discarded – undo
140 140
 
141 141
 			// Last seen
142 142
 
143
-			$req 		= "SELECT disappear_time, (CONVERT_TZ(disappear_time, '+00:00', '".$time_offset."')) AS disappear_time_real, latitude, longitude
143
+			$req = "SELECT disappear_time, (CONVERT_TZ(disappear_time, '+00:00', '".$time_offset."')) AS disappear_time_real, latitude, longitude
144 144
 						FROM pokemon
145 145
 						WHERE pokemon_id = '".$pokemon_id."'
146 146
 						ORDER BY disappear_time DESC
147 147
 						LIMIT 0,1";
148
-			$result 	= $mysqli->query($req);
149
-			$data 		= $result->fetch_object();
148
+			$result = $mysqli->query($req);
149
+			$data = $result->fetch_object();
150 150
 
151 151
 			if (isset($data)) {
152
-				$last_spawn 				= $data;
152
+				$last_spawn = $data;
153 153
 
154
-				$pokemon->last_seen			= strtotime($data->disappear_time_real);
155
-				$pokemon->last_position			= new stdClass();
156
-				$pokemon->last_position->latitude 	= $data->latitude;
157
-				$pokemon->last_position->longitude 	= $data->longitude;
154
+				$pokemon->last_seen = strtotime($data->disappear_time_real);
155
+				$pokemon->last_position = new stdClass();
156
+				$pokemon->last_position->latitude = $data->latitude;
157
+				$pokemon->last_position->longitude = $data->longitude;
158 158
 			}
159 159
 
160 160
 			// Related Pokemons
@@ -238,16 +238,16 @@  discard block
 block discarded – undo
238 238
 			// --------------------------------
239 239
 
240 240
 			$max 		= $config->system->max_pokemon;
241
-			$pokedex 	= new stdClass();
241
+			$pokedex = new stdClass();
242 242
 
243
-			for ($i= 1; $i <= $max; $i++) {
244
-				$pokedex->$i				= new stdClass();
243
+			for ($i = 1; $i <= $max; $i++) {
244
+				$pokedex->$i = new stdClass();
245 245
 				$pokedex->$i->id 			= $i;
246
-				$pokedex->$i->permalink 	= 'pokemon/'.$i;
246
+				$pokedex->$i->permalink = 'pokemon/'.$i;
247 247
 				$pokedex->$i->img			= 'core/pokemons/'.$i.$config->system->pokeimg_suffix;
248
-				$pokedex->$i->name			= $pokemons->pokemon->$i->name;
249
-				$pokedex->$i->spawn 		= ($pokemons->pokemon->$i->spawn_count > 0) ? 1 : 0;
250
-				$pokedex->$i->spawn_count	= $pokemons->pokemon->$i->spawn_count;
248
+				$pokedex->$i->name = $pokemons->pokemon->$i->name;
249
+				$pokedex->$i->spawn = ($pokemons->pokemon->$i->spawn_count > 0) ? 1 : 0;
250
+				$pokedex->$i->spawn_count = $pokemons->pokemon->$i->spawn_count;
251 251
 			}
252 252
 
253 253
 
@@ -258,17 +258,17 @@  discard block
 block discarded – undo
258 258
 		############
259 259
 
260 260
 		case 'pokestops':
261
-			$pokestop 	= new stdClass();
261
+			$pokestop = new stdClass();
262 262
 
263
-			$req 		= "SELECT COUNT(*) AS total FROM pokestop";
264
-			$result 	= $mysqli->query($req);
265
-			$data 		= $result->fetch_object();
263
+			$req = "SELECT COUNT(*) AS total FROM pokestop";
264
+			$result = $mysqli->query($req);
265
+			$data = $result->fetch_object();
266 266
 
267 267
 			$pokestop->total = $data->total;
268 268
 
269
-			$req 		= "SELECT COUNT(*) AS total FROM pokestop WHERE lure_expiration >= UTC_TIMESTAMP()";
270
-			$result 	= $mysqli->query($req);
271
-			$data 		= $result->fetch_object();
269
+			$req = "SELECT COUNT(*) AS total FROM pokestop WHERE lure_expiration >= UTC_TIMESTAMP()";
270
+			$result = $mysqli->query($req);
271
+			$data = $result->fetch_object();
272 272
 
273 273
 			$pokestop->lured = $data->total;
274 274
 
@@ -285,36 +285,36 @@  discard block
 block discarded – undo
285 285
 			// 3 Teams (teamm rocket is neutral)
286 286
 			// 1 Fight
287 287
 
288
-			$teams 				= new stdClass();
288
+			$teams = new stdClass();
289 289
 
290
-			$teams->mystic 			= new stdClass();
291
-			$teams->mystic->guardians 	= new stdClass();
292
-			$teams->mystic->id 		= 1;
290
+			$teams->mystic = new stdClass();
291
+			$teams->mystic->guardians = new stdClass();
292
+			$teams->mystic->id = 1;
293 293
 
294
-			$teams->valor 			= new stdClass();
295
-			$teams->valor->guardians 	= new stdClass();
296
-			$teams->valor->id 		= 2;
294
+			$teams->valor = new stdClass();
295
+			$teams->valor->guardians = new stdClass();
296
+			$teams->valor->id = 2;
297 297
 
298
-			$teams->instinct 		= new stdClass();
299
-			$teams->instinct->guardians 	= new stdClass();
300
-			$teams->instinct->id 		= 3;
298
+			$teams->instinct = new stdClass();
299
+			$teams->instinct->guardians = new stdClass();
300
+			$teams->instinct->id = 3;
301 301
 
302
-			$teams->rocket 			= new stdClass();
303
-			$teams->rocket->guardians 	= new stdClass();
304
-			$teams->rocket->id 		= 0;
302
+			$teams->rocket = new stdClass();
303
+			$teams->rocket->guardians = new stdClass();
304
+			$teams->rocket->id = 0;
305 305
 
306 306
 
307 307
 
308 308
 			foreach ($teams as $team_key => $team_values) {
309 309
 				// Team Guardians
310 310
 
311
-				$req 	= "SELECT COUNT(*) AS total, guard_pokemon_id FROM gym WHERE team_id = '".$team_values->id."' GROUP BY guard_pokemon_id ORDER BY total DESC LIMIT 0,3";
311
+				$req = "SELECT COUNT(*) AS total, guard_pokemon_id FROM gym WHERE team_id = '".$team_values->id."' GROUP BY guard_pokemon_id ORDER BY total DESC LIMIT 0,3";
312 312
 				$result = $mysqli->query($req);
313 313
 
314
-				$i=0;
314
+				$i = 0;
315 315
 
316 316
 				while ($data = $result->fetch_object()) {
317
-					$teams->$team_key->guardians->$i	= $data->guard_pokemon_id;
317
+					$teams->$team_key->guardians->$i = $data->guard_pokemon_id;
318 318
 
319 319
 					$i++;
320 320
 				}
@@ -326,8 +326,8 @@  discard block
 block discarded – undo
326 326
 				$result = $mysqli->query($req);
327 327
 				$data	= $result->fetch_object();
328 328
 
329
-				$teams->$team_key->gym_owned	= $data->total;
330
-				$teams->$team_key->average	= $data->average_points;
329
+				$teams->$team_key->gym_owned = $data->total;
330
+				$teams->$team_key->average = $data->average_points;
331 331
 			}
332 332
 
333 333
 
@@ -340,7 +340,7 @@  discard block
 block discarded – undo
340 340
 		case 'dashboard':
341 341
 			// This case is only used for test purpose.
342 342
 
343
-			$stats_file	= SYS_PATH.'/core/json/gym.stats.json';
343
+			$stats_file = SYS_PATH.'/core/json/gym.stats.json';
344 344
 
345 345
 			if (!is_file($stats_file)) {
346 346
 				echo "Sorry, no Gym stats file was found. <br> Did you enable cron? ";
@@ -348,7 +348,7 @@  discard block
 block discarded – undo
348 348
 			}
349 349
 
350 350
 
351
-			$stats_file	= SYS_PATH.'/core/json/pokemon.stats.json';
351
+			$stats_file = SYS_PATH.'/core/json/pokemon.stats.json';
352 352
 
353 353
 			if (!is_file($stats_file)) {
354 354
 				echo "Sorry, no Pokémon stats file was found. <br> Did you enabled cron?";
@@ -356,7 +356,7 @@  discard block
 block discarded – undo
356 356
 			}
357 357
 
358 358
 
359
-			$stats_file	= SYS_PATH.'/core/json/pokestop.stats.json';
359
+			$stats_file = SYS_PATH.'/core/json/pokestop.stats.json';
360 360
 
361 361
 			if (!is_file($stats_file)) {
362 362
 				echo "Sorry, no Pokéstop stats file was found. <br> Did you enabled cron?";
@@ -364,7 +364,7 @@  discard block
 block discarded – undo
364 364
 			}
365 365
 
366 366
 			if ($config->system->captcha_support) {
367
-				$stats_file	= SYS_PATH.'/core/json/captcha.stats.json';
367
+				$stats_file = SYS_PATH.'/core/json/captcha.stats.json';
368 368
 
369 369
 				if (!is_file($stats_file)) {
370 370
 					echo "Sorry, no Captcha stats file were found  <br> Have you enable cron?";
@@ -384,9 +384,9 @@  discard block
 block discarded – undo
384 384
 	// Right now
385 385
 	// ---------
386 386
 
387
-	$req 		= "SELECT COUNT(*) AS total FROM pokemon WHERE disappear_time >= UTC_TIMESTAMP()";
388
-	$result 	= $mysqli->query($req);
389
-	$data 		= $result->fetch_object();
387
+	$req = "SELECT COUNT(*) AS total FROM pokemon WHERE disappear_time >= UTC_TIMESTAMP()";
388
+	$result = $mysqli->query($req);
389
+	$data = $result->fetch_object();
390 390
 
391 391
 
392 392
 	$home->pokemon_now = $data->total;
@@ -395,9 +395,9 @@  discard block
 block discarded – undo
395 395
 	// Lured stops
396 396
 	// -----------
397 397
 
398
-	$req 		= "SELECT COUNT(*) AS total FROM pokestop WHERE lure_expiration >= UTC_TIMESTAMP()";
399
-	$result 	= $mysqli->query($req);
400
-	$data 		= $result->fetch_object();
398
+	$req = "SELECT COUNT(*) AS total FROM pokestop WHERE lure_expiration >= UTC_TIMESTAMP()";
399
+	$result = $mysqli->query($req);
400
+	$data = $result->fetch_object();
401 401
 
402 402
 	$home->pokestop_lured = $data->total;
403 403
 
@@ -405,9 +405,9 @@  discard block
 block discarded – undo
405 405
 	// Gyms
406 406
 	// ----
407 407
 
408
-	$req 		= "SELECT COUNT(DISTINCT(gym_id)) AS total FROM gym";
409
-	$result 	= $mysqli->query($req);
410
-	$data 		= $result->fetch_object();
408
+	$req = "SELECT COUNT(DISTINCT(gym_id)) AS total FROM gym";
409
+	$result = $mysqli->query($req);
410
+	$data = $result->fetch_object();
411 411
 
412 412
 	$home->gyms = $data->total;
413 413
 
@@ -417,7 +417,7 @@  discard block
 block discarded – undo
417 417
 
418 418
 	if ($config->system->recents_filter) {
419 419
 		// get all mythic pokemon ids
420
-		$mythic_pokemons  = array();
420
+		$mythic_pokemons = array();
421 421
 		foreach ($pokemons->pokemon as $id => $pokemon) {
422 422
 			if ($pokemon->spawn_rate < $config->system->recents_filter_rarity && $pokemon->rating >= $config->system->recents_filter_rating) {
423 423
 				$mythic_pokemons[] = $id;
@@ -481,28 +481,28 @@  discard block
 block discarded – undo
481 481
 
482 482
 	$req = "SELECT COUNT(DISTINCT(gym_id)) AS total FROM gym WHERE team_id = '1'";
483 483
 	$result = $mysqli->query($req);
484
-	$data 	= $result->fetch_object();
484
+	$data = $result->fetch_object();
485 485
 
486
-	$home->teams->mystic 	= $data->total;
486
+	$home->teams->mystic = $data->total;
487 487
 
488 488
 
489 489
 	$req = "SELECT COUNT(DISTINCT(gym_id)) AS total FROM gym WHERE team_id = '2'";
490 490
 	$result = $mysqli->query($req);
491
-	$data 	= $result->fetch_object();
491
+	$data = $result->fetch_object();
492 492
 
493
-	$home->teams->valor 	= $data->total;
493
+	$home->teams->valor = $data->total;
494 494
 
495 495
 
496 496
 	$req = "SELECT COUNT(DISTINCT(gym_id)) AS total FROM gym WHERE team_id = '3'";
497 497
 	$result = $mysqli->query($req);
498
-	$data 	= $result->fetch_object();
498
+	$data = $result->fetch_object();
499 499
 
500
-	$home->teams->instinct 	= $data->total;
500
+	$home->teams->instinct = $data->total;
501 501
 
502 502
 
503 503
 	$req = "SELECT COUNT(DISTINCT(gym_id)) AS total FROM gym WHERE team_id = '0'";
504 504
 	$result = $mysqli->query($req);
505
-	$data 	= $result->fetch_object();
505
+	$data = $result->fetch_object();
506 506
 
507
-	$home->teams->rocket 	= $data->total;
507
+	$home->teams->rocket = $data->total;
508 508
 }
Please login to merge, or discard this patch.