Failed Conditions
Pull Request — master (#371)
by
unknown
02:05
created
core/process/locales.loader.php 3 patches
Indentation   +158 added lines, -158 removed lines patch added patch discarded remove patch
@@ -26,28 +26,28 @@  discard block
 block discarded – undo
26 26
  * @return array Sorted list of "accept" options
27 27
  */
28 28
 $sortAccept = function ($header) {
29
-    $matches = array();
30
-    foreach (explode(',', $header) as $option) {
31
-        $option = array_map('trim', explode(';', $option));
32
-        $l = strtolower($option[0]);
33
-        if (isset($option[1])) {
34
-            $q = (float) str_replace('q=', '', $option[1]);
35
-        } else {
36
-            $q = null;
37
-            // Assign default low weight for generic values
38
-            if ('*/*' == $l) {
39
-                $q = 0.01;
40
-            } elseif ('*' == substr($l, -1)) {
41
-                $q = 0.02;
42
-            }
43
-        }
44
-        // Unweighted values, get high weight by their position in the
45
-        // list
46
-        $matches[$l] = isset($q) ? $q : 1000 - count($matches);
47
-    }
48
-    arsort($matches, SORT_NUMERIC);
49
-
50
-    return $matches;
29
+	$matches = array();
30
+	foreach (explode(',', $header) as $option) {
31
+		$option = array_map('trim', explode(';', $option));
32
+		$l = strtolower($option[0]);
33
+		if (isset($option[1])) {
34
+			$q = (float) str_replace('q=', '', $option[1]);
35
+		} else {
36
+			$q = null;
37
+			// Assign default low weight for generic values
38
+			if ('*/*' == $l) {
39
+				$q = 0.01;
40
+			} elseif ('*' == substr($l, -1)) {
41
+				$q = 0.02;
42
+			}
43
+		}
44
+		// Unweighted values, get high weight by their position in the
45
+		// list
46
+		$matches[$l] = isset($q) ? $q : 1000 - count($matches);
47
+	}
48
+	arsort($matches, SORT_NUMERIC);
49
+
50
+	return $matches;
51 51
 };
52 52
 
53 53
 /**
@@ -60,18 +60,18 @@  discard block
 block discarded – undo
60 60
  * @return string|null a matched option, or NULL if no match
61 61
  */
62 62
 $matchAccept = function ($header, $supported) use ($sortAccept) {
63
-    $matches = $sortAccept($header);
64
-    foreach ($matches as $key => $q) {
65
-        if (isset($supported[$key])) {
66
-            return $supported[$key];
67
-        }
68
-    }
69
-    // If any (i.e. "*") is acceptable, return the first supported format
70
-    if (isset($matches['*'])) {
71
-        return array_shift($supported);
72
-    }
73
-
74
-    return null;
63
+	$matches = $sortAccept($header);
64
+	foreach ($matches as $key => $q) {
65
+		if (isset($supported[$key])) {
66
+			return $supported[$key];
67
+		}
68
+	}
69
+	// If any (i.e. "*") is acceptable, return the first supported format
70
+	if (isset($matches['*'])) {
71
+		return array_shift($supported);
72
+	}
73
+
74
+	return null;
75 75
 };
76 76
 
77 77
 /**
@@ -92,46 +92,46 @@  discard block
 block discarded – undo
92 92
  * @return string the negotiated language result or the supplied default
93 93
  */
94 94
 $negotiateLanguage = function ($supported, $default = 'en-US') use ($matchAccept) {
95
-    $supp = array();
96
-    foreach ($supported as $lang => $isSupported) {
97
-        if ($isSupported) {
98
-            $supp[strtolower($lang)] = $lang;
99
-        }
100
-    }
101
-    if (!count($supp)) {
102
-        return $default;
103
-    }
104
-    if (isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
105
-        $match = $matchAccept(
106
-            $_SERVER['HTTP_ACCEPT_LANGUAGE'],
107
-            $supp
108
-        );
109
-        if (!is_null($match)) {
110
-            return $match;
111
-        }
112
-    }
113
-    if (isset($_SERVER['REMOTE_HOST'])) {
114
-        $domain = explode('.', $_SERVER['REMOTE_HOST']);
115
-        $lang = strtolower(end($domain));
116
-        if (isset($supp[$lang])) {
117
-            return $supp[$lang];
118
-        }
119
-    }
120
-
121
-    return $default;
95
+	$supp = array();
96
+	foreach ($supported as $lang => $isSupported) {
97
+		if ($isSupported) {
98
+			$supp[strtolower($lang)] = $lang;
99
+		}
100
+	}
101
+	if (!count($supp)) {
102
+		return $default;
103
+	}
104
+	if (isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
105
+		$match = $matchAccept(
106
+			$_SERVER['HTTP_ACCEPT_LANGUAGE'],
107
+			$supp
108
+		);
109
+		if (!is_null($match)) {
110
+			return $match;
111
+		}
112
+	}
113
+	if (isset($_SERVER['REMOTE_HOST'])) {
114
+		$domain = explode('.', $_SERVER['REMOTE_HOST']);
115
+		$lang = strtolower(end($domain));
116
+		if (isset($supp[$lang])) {
117
+			return $supp[$lang];
118
+		}
119
+	}
120
+
121
+	return $default;
122 122
 };
123 123
 
124 124
 // Language setting
125 125
 //##################
126 126
 if (empty($config->system->forced_lang)) {
127
-    $directories = glob(SYS_PATH.'/core/json/locales/*', GLOB_ONLYDIR);
128
-    $directories = array_map('basename', $directories);
129
-    //print_r($directories);
130
-    $browser_lang = $negotiateLanguage(array_fill_keys($directories, true), $config->system->default_lang);
127
+	$directories = glob(SYS_PATH.'/core/json/locales/*', GLOB_ONLYDIR);
128
+	$directories = array_map('basename', $directories);
129
+	//print_r($directories);
130
+	$browser_lang = $negotiateLanguage(array_fill_keys($directories, true), $config->system->default_lang);
131 131
 //print_r($browser_lang);
132 132
 } else {
133
-    // Use forced language
134
-    $browser_lang = $config->system->forced_lang;
133
+	// Use forced language
134
+	$browser_lang = $config->system->forced_lang;
135 135
 }
136 136
 
137 137
 // Activate lang
@@ -140,15 +140,15 @@  discard block
 block discarded – undo
140 140
 $translation_file = '{}';
141 141
 $pokemon_file = '{}';
142 142
 if (is_file($locale_dir.'/pokes.json')) {
143
-    $pokemon_file = file_get_contents($locale_dir.'/pokes.json');
143
+	$pokemon_file = file_get_contents($locale_dir.'/pokes.json');
144 144
 }
145 145
 if (is_file($locale_dir.'/translations.json')) {
146
-    $translation_file = file_get_contents($locale_dir.'/translations.json');
146
+	$translation_file = file_get_contents($locale_dir.'/translations.json');
147 147
 }
148 148
 if (is_file($locale_dir.'/moves.json')) {
149
-    $moves_file = json_decode(file_get_contents($locale_dir.'/moves.json'));
149
+	$moves_file = json_decode(file_get_contents($locale_dir.'/moves.json'));
150 150
 } else {
151
-    $moves_file = json_decode(file_get_contents(SYS_PATH.'/core/json/locales/EN/moves.json'));
151
+	$moves_file = json_decode(file_get_contents(SYS_PATH.'/core/json/locales/EN/moves.json'));
152 152
 }
153 153
 
154 154
 // Merge translation files
@@ -181,91 +181,91 @@  discard block
 block discarded – undo
181 181
 $totalCountPoke = 0;
182 182
 $maxpid = $config->system->max_pokemon;
183 183
 for ($pokeid = 1; $pokeid <= $maxpid; ++$pokeid) {
184
-    if (!isset($pokemons_all->pokemon->$pokeid)) {
185
-        continue;
186
-    }
187
-    // Merge name and description from translation files
188
-    $pokemon = $pokemons_all->pokemon->$pokeid;
189
-    $pokemon->id = $pokeid;
190
-    $pokemon->name = $pokemon_trans->pokemon->$pokeid->name;
191
-    $pokemon->description = $pokemon_trans->pokemon->$pokeid->description;
192
-    $pokemon->img = 'core/pokemons/'.$pokeid.$config->system->pokeimg_suffix;
193
-
194
-    // Replace quick and charge move with translation
195
-    $quick_move = $pokemon->quick_move;
196
-    $pokemon->quick_move = $pokemon_trans->quick_moves->$quick_move;
197
-    $charge_move = $pokemon->charge_move;
198
-    $pokemon->charge_move = $pokemon_trans->charge_moves->$charge_move;
199
-
200
-    // Replace types with translation
201
-    foreach ($pokemon->types as &$type) {
202
-        $type = $pokemon_trans->types->$type;
203
-    }
204
-    unset($type);
205
-
206
-    // Convert move numbers to names
207
-    $move = new stdClass();
208
-    foreach ($moves_file as $move_id => $move_name) {
209
-        if (isset($move_name)) {
210
-            $move->$move_id = new stdClass();
211
-            $move->$move_id->name = $move_name->name;
212
-        }
213
-    }
214
-
215
-    // Add pokemon counts to array
216
-    $data = $manager->getPokemonCount($pokeid);
217
-    if (isset($data->count)) {
218
-        $pokemon->spawn_count = $data->count;
219
-        $pokemon->last_seen = $data->last_seen;
220
-        $pokemon->last_position = new stdClass();
221
-        $pokemon->last_position->latitude = $data->latitude;
222
-        $pokemon->last_position->longitude = $data->longitude;
223
-
224
-        $totalCountPoke += $data->count;
225
-    } else {
226
-        $pokemon->spawn_count = 0;
227
-        $pokemon->last_seen = null;
228
-        $pokemon->last_position = null;
229
-    }
230
-
231
-    // Add raid counts to array
232
-    $data = $manager->getRaidCount($pokeid);
233
-    if (isset($data->count)) {
234
-        $pokemon->raid_count = $data->count;
235
-        $pokemon->last_raid_seen = $data->last_seen;
236
-        $pokemon->last_raid_position = new stdClass();
237
-        $pokemon->last_raid_position->latitude = $data->latitude;
238
-        $pokemon->last_raid_position->longitude = $data->longitude;
239
-    } else {
240
-        $pokemon->raid_count = 0;
241
-        $pokemon->last_raid_seen = null;
242
-        $pokemon->last_raid_position = null;
243
-    }
244
-
245
-    // Calculate and add rarities to array
246
-    $spawn_rate = $pokemons_rarity->$pokeid->rate;
247
-    $pokemon->spawn_rate = $spawn_rate;
248
-    $pokemon->per_day = $pokemons_rarity->$pokeid->per_day;
249
-
250
-    // >= 1          = Very common
251
-    // 0.20 - 1      = Common
252
-    // 0.01 - 0.20   = Rare
253
-    // > 0  - 0.01   = Mythic
254
-    // Unseen
255
-    if ($spawn_rate >= 1) {
256
-        $pokemon->rarity = $locales->VERYCOMMON;
257
-    } elseif ($spawn_rate >= 0.20) {
258
-        $pokemon->rarity = $locales->COMMON;
259
-    } elseif ($spawn_rate >= 0.01) {
260
-        $pokemon->rarity = $locales->RARE;
261
-    } elseif ($spawn_rate > 0 || $pokemon->spawn_count > 0) {
262
-        // pokemon with at least 1 spawn in the past aren't unseen!
263
-        $pokemon->rarity = $locales->MYTHIC;
264
-    } else {
265
-        $pokemon->rarity = $locales->UNSEEN;
266
-    }
267
-
268
-    $pokemons->pokemon->$pokeid = $pokemon;
184
+	if (!isset($pokemons_all->pokemon->$pokeid)) {
185
+		continue;
186
+	}
187
+	// Merge name and description from translation files
188
+	$pokemon = $pokemons_all->pokemon->$pokeid;
189
+	$pokemon->id = $pokeid;
190
+	$pokemon->name = $pokemon_trans->pokemon->$pokeid->name;
191
+	$pokemon->description = $pokemon_trans->pokemon->$pokeid->description;
192
+	$pokemon->img = 'core/pokemons/'.$pokeid.$config->system->pokeimg_suffix;
193
+
194
+	// Replace quick and charge move with translation
195
+	$quick_move = $pokemon->quick_move;
196
+	$pokemon->quick_move = $pokemon_trans->quick_moves->$quick_move;
197
+	$charge_move = $pokemon->charge_move;
198
+	$pokemon->charge_move = $pokemon_trans->charge_moves->$charge_move;
199
+
200
+	// Replace types with translation
201
+	foreach ($pokemon->types as &$type) {
202
+		$type = $pokemon_trans->types->$type;
203
+	}
204
+	unset($type);
205
+
206
+	// Convert move numbers to names
207
+	$move = new stdClass();
208
+	foreach ($moves_file as $move_id => $move_name) {
209
+		if (isset($move_name)) {
210
+			$move->$move_id = new stdClass();
211
+			$move->$move_id->name = $move_name->name;
212
+		}
213
+	}
214
+
215
+	// Add pokemon counts to array
216
+	$data = $manager->getPokemonCount($pokeid);
217
+	if (isset($data->count)) {
218
+		$pokemon->spawn_count = $data->count;
219
+		$pokemon->last_seen = $data->last_seen;
220
+		$pokemon->last_position = new stdClass();
221
+		$pokemon->last_position->latitude = $data->latitude;
222
+		$pokemon->last_position->longitude = $data->longitude;
223
+
224
+		$totalCountPoke += $data->count;
225
+	} else {
226
+		$pokemon->spawn_count = 0;
227
+		$pokemon->last_seen = null;
228
+		$pokemon->last_position = null;
229
+	}
230
+
231
+	// Add raid counts to array
232
+	$data = $manager->getRaidCount($pokeid);
233
+	if (isset($data->count)) {
234
+		$pokemon->raid_count = $data->count;
235
+		$pokemon->last_raid_seen = $data->last_seen;
236
+		$pokemon->last_raid_position = new stdClass();
237
+		$pokemon->last_raid_position->latitude = $data->latitude;
238
+		$pokemon->last_raid_position->longitude = $data->longitude;
239
+	} else {
240
+		$pokemon->raid_count = 0;
241
+		$pokemon->last_raid_seen = null;
242
+		$pokemon->last_raid_position = null;
243
+	}
244
+
245
+	// Calculate and add rarities to array
246
+	$spawn_rate = $pokemons_rarity->$pokeid->rate;
247
+	$pokemon->spawn_rate = $spawn_rate;
248
+	$pokemon->per_day = $pokemons_rarity->$pokeid->per_day;
249
+
250
+	// >= 1          = Very common
251
+	// 0.20 - 1      = Common
252
+	// 0.01 - 0.20   = Rare
253
+	// > 0  - 0.01   = Mythic
254
+	// Unseen
255
+	if ($spawn_rate >= 1) {
256
+		$pokemon->rarity = $locales->VERYCOMMON;
257
+	} elseif ($spawn_rate >= 0.20) {
258
+		$pokemon->rarity = $locales->COMMON;
259
+	} elseif ($spawn_rate >= 0.01) {
260
+		$pokemon->rarity = $locales->RARE;
261
+	} elseif ($spawn_rate > 0 || $pokemon->spawn_count > 0) {
262
+		// pokemon with at least 1 spawn in the past aren't unseen!
263
+		$pokemon->rarity = $locales->MYTHIC;
264
+	} else {
265
+		$pokemon->rarity = $locales->UNSEEN;
266
+	}
267
+
268
+	$pokemons->pokemon->$pokeid = $pokemon;
269 269
 }
270 270
 
271 271
 $pokemons->total = $totalCountPoke;
@@ -273,8 +273,8 @@  discard block
 block discarded – undo
273 273
 // Translate typecolors array keys as well
274 274
 $types_temp = new stdClass();
275 275
 foreach ($pokemons_all->typecolors as $type => $color) {
276
-    $type_trans = $pokemon_trans->types->$type;
277
-    $types_temp->$type_trans = $color;
276
+	$type_trans = $pokemon_trans->types->$type;
277
+	$types_temp->$type_trans = $color;
278 278
 }
279 279
 // Replace typecolors array with translated one
280 280
 $pokemons->typecolors = $types_temp;
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
  *
26 26
  * @return array Sorted list of "accept" options
27 27
  */
28
-$sortAccept = function ($header) {
28
+$sortAccept = function($header) {
29 29
     $matches = array();
30 30
     foreach (explode(',', $header) as $option) {
31 31
         $option = array_map('trim', explode(';', $option));
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
  *
60 60
  * @return string|null a matched option, or NULL if no match
61 61
  */
62
-$matchAccept = function ($header, $supported) use ($sortAccept) {
62
+$matchAccept = function($header, $supported) use ($sortAccept) {
63 63
     $matches = $sortAccept($header);
64 64
     foreach ($matches as $key => $q) {
65 65
         if (isset($supported[$key])) {
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
  *
92 92
  * @return string the negotiated language result or the supplied default
93 93
  */
94
-$negotiateLanguage = function ($supported, $default = 'en-US') use ($matchAccept) {
94
+$negotiateLanguage = function($supported, $default = 'en-US') use ($matchAccept) {
95 95
     $supp = array();
96 96
     foreach ($supported as $lang => $isSupported) {
97 97
         if ($isSupported) {
Please login to merge, or discard this patch.
Braces   +6 added lines, -3 removed lines patch added patch discarded remove patch
@@ -25,7 +25,8 @@  discard block
 block discarded – undo
25 25
  *
26 26
  * @return array Sorted list of "accept" options
27 27
  */
28
-$sortAccept = function ($header) {
28
+$sortAccept = function ($header)
29
+{
29 30
     $matches = array();
30 31
     foreach (explode(',', $header) as $option) {
31 32
         $option = array_map('trim', explode(';', $option));
@@ -59,7 +60,8 @@  discard block
 block discarded – undo
59 60
  *
60 61
  * @return string|null a matched option, or NULL if no match
61 62
  */
62
-$matchAccept = function ($header, $supported) use ($sortAccept) {
63
+$matchAccept = function ($header, $supported) use ($sortAccept)
64
+{
63 65
     $matches = $sortAccept($header);
64 66
     foreach ($matches as $key => $q) {
65 67
         if (isset($supported[$key])) {
@@ -91,7 +93,8 @@  discard block
 block discarded – undo
91 93
  *
92 94
  * @return string the negotiated language result or the supplied default
93 95
  */
94
-$negotiateLanguage = function ($supported, $default = 'en-US') use ($matchAccept) {
96
+$negotiateLanguage = function ($supported, $default = 'en-US') use ($matchAccept)
97
+{
95 98
     $supp = array();
96 99
     foreach ($supported as $lang => $isSupported) {
97 100
         if ($isSupported) {
Please login to merge, or discard this patch.
core/inc/meta.inc.php 2 patches
Indentation   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
 		<meta name="theme-color" content="#ffffff">
20 20
 
21 21
 <?php if (!isset($_GET['page'])) {
22
-    ?>
22
+	?>
23 23
 
24 24
 		<title><?= $config->infos->site_name; ?> | <?= strip_tags($config->infos->site_title); ?></title>
25 25
 
@@ -46,9 +46,9 @@  discard block
 block discarded – undo
46 46
 
47 47
 <?php
48 48
 } else {
49
-        switch ($_GET['page']) {
50
-        case 'pokemon':
51
-        ?>
49
+		switch ($_GET['page']) {
50
+		case 'pokemon':
51
+		?>
52 52
 
53 53
 		<title><?= $config->infos->site_name; ?> | <?= $locales->FIND; ?> <?= $pokemon->name; ?> <?= sprintf($locales->INCITY, $config->infos->city); ?></title>
54 54
 
@@ -71,10 +71,10 @@  discard block
 block discarded – undo
71 71
 
72 72
 
73 73
 		<?php
74
-            break;
74
+			break;
75 75
 
76
-        case 'pokestops':
77
-        ?>
76
+		case 'pokestops':
77
+		?>
78 78
 
79 79
 
80 80
 		<title><?= $config->infos->site_name; ?> | <?= sprintf($locales->POKESTOPS_METATITLE, $config->infos->city); ?></title>
@@ -97,10 +97,10 @@  discard block
 block discarded – undo
97 97
 
98 98
 
99 99
 		<?php
100
-            break;
100
+			break;
101 101
 
102
-        case 'gym':
103
-        ?>
102
+		case 'gym':
103
+		?>
104 104
 
105 105
 		<title><?= $config->infos->site_name; ?> | <?= $locales->GYMS_METATITLE; ?></title>
106 106
 
@@ -122,10 +122,10 @@  discard block
 block discarded – undo
122 122
 		<meta name="twitter:image" content="<?= HOST_URL; ?>core/img/logo.jpg" />
123 123
 
124 124
 		<?php
125
-            break;
125
+			break;
126 126
 
127
-        case 'trainer':
128
-        ?>
127
+		case 'trainer':
128
+		?>
129 129
 
130 130
 		<title><?= $config->infos->site_name; ?> | <?= $locales->TRAINERS_METATITLE; ?></title>
131 131
 
@@ -146,10 +146,10 @@  discard block
 block discarded – undo
146 146
 		<meta name="twitter:image" content="<?= HOST_URL; ?>core/img/logo.jpg" />
147 147
 
148 148
 		<?php
149
-            break;
149
+			break;
150 150
 
151
-        case 'dashboard':
152
-        ?>
151
+		case 'dashboard':
152
+		?>
153 153
 
154 154
 		<title><?= $config->infos->site_name; ?> | <?= $locales->NAV_DASHBOARD; ?></title>
155 155
 
@@ -171,10 +171,10 @@  discard block
 block discarded – undo
171 171
 
172 172
 
173 173
 		<?php
174
-            break;
174
+			break;
175 175
 
176
-        case 'pokedex':
177
-        ?>
176
+		case 'pokedex':
177
+		?>
178 178
 
179 179
 		<title><?= $config->infos->site_name; ?> | <?= $locales->POKEDEX_METATITLE; ?></title>
180 180
 
@@ -195,10 +195,10 @@  discard block
 block discarded – undo
195 195
 		<meta name="twitter:image" content="<?= HOST_URL; ?>core/img/logo.jpg" />
196 196
 
197 197
 		<?php
198
-            break;
198
+			break;
199 199
 
200
-        case 'nests':
201
-        ?>
200
+		case 'nests':
201
+		?>
202 202
 
203 203
 		<title><?= $config->infos->site_name; ?> | <?= $locales->NAV_NESTS; ?></title>
204 204
 
@@ -219,10 +219,10 @@  discard block
 block discarded – undo
219 219
 		<meta name="twitter:image" content="<?= HOST_URL; ?>core/img/logo.jpg" />
220 220
 
221 221
 		<?php
222
-            break;
222
+			break;
223 223
 
224
-        case 'raids':
225
-        ?>
224
+		case 'raids':
225
+		?>
226 226
 
227 227
 		<title><?= $config->infos->site_name; ?> | <?= $locales->NAV_RAIDS; ?></title>
228 228
 
@@ -243,10 +243,10 @@  discard block
 block discarded – undo
243 243
 		<meta name="twitter:image" content="<?= HOST_URL; ?>core/img/logo.jpg" />
244 244
 
245 245
 		<?php
246
-            break;
246
+			break;
247 247
 
248
-        case 'gymhistory':
249
-        ?>
248
+		case 'gymhistory':
249
+		?>
250 250
 
251 251
 		<title><?= $config->infos->site_name; ?> | Gym History</title>
252 252
 
@@ -267,8 +267,8 @@  discard block
 block discarded – undo
267 267
 		<meta name="twitter:image" content="<?= HOST_URL; ?>core/img/logo.jpg" />
268 268
 
269 269
 		<?php
270
-            break;
271
-    }
272
-    }
270
+			break;
271
+	}
272
+	}
273 273
 
274 274
 ?>
Please login to merge, or discard this patch.
Switch Indentation   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -47,8 +47,8 @@  discard block
 block discarded – undo
47 47
 <?php
48 48
 } else {
49 49
         switch ($_GET['page']) {
50
-        case 'pokemon':
51
-        ?>
50
+        	case 'pokemon':
51
+        	?>
52 52
 
53 53
 		<title><?= $config->infos->site_name; ?> | <?= $locales->FIND; ?> <?= $pokemon->name; ?> <?= sprintf($locales->INCITY, $config->infos->city); ?></title>
54 54
 
@@ -71,10 +71,10 @@  discard block
 block discarded – undo
71 71
 
72 72
 
73 73
 		<?php
74
-            break;
74
+            	break;
75 75
 
76
-        case 'pokestops':
77
-        ?>
76
+        	case 'pokestops':
77
+        	?>
78 78
 
79 79
 
80 80
 		<title><?= $config->infos->site_name; ?> | <?= sprintf($locales->POKESTOPS_METATITLE, $config->infos->city); ?></title>
@@ -97,10 +97,10 @@  discard block
 block discarded – undo
97 97
 
98 98
 
99 99
 		<?php
100
-            break;
100
+            	break;
101 101
 
102
-        case 'gym':
103
-        ?>
102
+        	case 'gym':
103
+        	?>
104 104
 
105 105
 		<title><?= $config->infos->site_name; ?> | <?= $locales->GYMS_METATITLE; ?></title>
106 106
 
@@ -122,10 +122,10 @@  discard block
 block discarded – undo
122 122
 		<meta name="twitter:image" content="<?= HOST_URL; ?>core/img/logo.jpg" />
123 123
 
124 124
 		<?php
125
-            break;
125
+            	break;
126 126
 
127
-        case 'trainer':
128
-        ?>
127
+        	case 'trainer':
128
+        	?>
129 129
 
130 130
 		<title><?= $config->infos->site_name; ?> | <?= $locales->TRAINERS_METATITLE; ?></title>
131 131
 
@@ -146,10 +146,10 @@  discard block
 block discarded – undo
146 146
 		<meta name="twitter:image" content="<?= HOST_URL; ?>core/img/logo.jpg" />
147 147
 
148 148
 		<?php
149
-            break;
149
+            	break;
150 150
 
151
-        case 'dashboard':
152
-        ?>
151
+        	case 'dashboard':
152
+        	?>
153 153
 
154 154
 		<title><?= $config->infos->site_name; ?> | <?= $locales->NAV_DASHBOARD; ?></title>
155 155
 
@@ -171,10 +171,10 @@  discard block
 block discarded – undo
171 171
 
172 172
 
173 173
 		<?php
174
-            break;
174
+            	break;
175 175
 
176
-        case 'pokedex':
177
-        ?>
176
+        	case 'pokedex':
177
+        	?>
178 178
 
179 179
 		<title><?= $config->infos->site_name; ?> | <?= $locales->POKEDEX_METATITLE; ?></title>
180 180
 
@@ -195,10 +195,10 @@  discard block
 block discarded – undo
195 195
 		<meta name="twitter:image" content="<?= HOST_URL; ?>core/img/logo.jpg" />
196 196
 
197 197
 		<?php
198
-            break;
198
+            	break;
199 199
 
200
-        case 'nests':
201
-        ?>
200
+        	case 'nests':
201
+        	?>
202 202
 
203 203
 		<title><?= $config->infos->site_name; ?> | <?= $locales->NAV_NESTS; ?></title>
204 204
 
@@ -219,10 +219,10 @@  discard block
 block discarded – undo
219 219
 		<meta name="twitter:image" content="<?= HOST_URL; ?>core/img/logo.jpg" />
220 220
 
221 221
 		<?php
222
-            break;
222
+            	break;
223 223
 
224
-        case 'raids':
225
-        ?>
224
+        	case 'raids':
225
+        	?>
226 226
 
227 227
 		<title><?= $config->infos->site_name; ?> | <?= $locales->NAV_RAIDS; ?></title>
228 228
 
@@ -243,10 +243,10 @@  discard block
 block discarded – undo
243 243
 		<meta name="twitter:image" content="<?= HOST_URL; ?>core/img/logo.jpg" />
244 244
 
245 245
 		<?php
246
-            break;
246
+            	break;
247 247
 
248
-        case 'gymhistory':
249
-        ?>
248
+        	case 'gymhistory':
249
+        	?>
250 250
 
251 251
 		<title><?= $config->infos->site_name; ?> | Gym History</title>
252 252
 
@@ -267,7 +267,7 @@  discard block
 block discarded – undo
267 267
 		<meta name="twitter:image" content="<?= HOST_URL; ?>core/img/logo.jpg" />
268 268
 
269 269
 		<?php
270
-            break;
270
+            	break;
271 271
     }
272 272
     }
273 273
 
Please login to merge, or discard this patch.
core/cron/nests.cron.php 2 patches
Indentation   +160 added lines, -160 removed lines patch added patch discarded remove patch
@@ -18,19 +18,19 @@  discard block
 block discarded – undo
18 18
 $allNestParks = array();
19 19
 
20 20
 for ($iLat = 0; $iLat < $countLat;) {
21
-    for ($iLng = 0; $iLng < $countLng;) {
22
-        $minLatitude = $totalMinLat + $iLat * 0.5;
23
-        $maxLatitude = min($minLatitude + 0.5, $totalMaxLat);
24
-        $minLongitude = $totalMinLon + $iLng * 0.5;
25
-        $maxLongitude = min($minLongitude + 0.5, $totalMaxLon);
26
-
27
-        if (0 == $manager->getSpawnpointCount($minLatitude, $maxLatitude, $minLongitude, $maxLongitude)->total) { //Skip empty areas
28
-            ++$iLng;
29
-            continue;
30
-        }
31
-
32
-        // Get Parks from overpass
33
-        $req = '[timeout:600][out:json][date:"2017-01-22T00:00:00Z"][bbox:'.$minLatitude.','.$minLongitude.','.$maxLatitude.','.$maxLongitude.'];
21
+	for ($iLng = 0; $iLng < $countLng;) {
22
+		$minLatitude = $totalMinLat + $iLat * 0.5;
23
+		$maxLatitude = min($minLatitude + 0.5, $totalMaxLat);
24
+		$minLongitude = $totalMinLon + $iLng * 0.5;
25
+		$maxLongitude = min($minLongitude + 0.5, $totalMaxLon);
26
+
27
+		if (0 == $manager->getSpawnpointCount($minLatitude, $maxLatitude, $minLongitude, $maxLongitude)->total) { //Skip empty areas
28
+			++$iLng;
29
+			continue;
30
+		}
31
+
32
+		// Get Parks from overpass
33
+		$req = '[timeout:600][out:json][date:"2017-01-22T00:00:00Z"][bbox:'.$minLatitude.','.$minLongitude.','.$maxLatitude.','.$maxLongitude.'];
34 34
 				(
35 35
 					way["leisure"="park"];
36 36
 					way["leisure"="garden"];
@@ -83,157 +83,157 @@  discard block
 block discarded – undo
83 83
 				out meta geom;
84 84
 				>;
85 85
 				out skel qt;';
86
-        $endpoint = 'https://overpass-api.de/api/interpreter';
87
-
88
-        $curl = curl_init($endpoint);
89
-
90
-        curl_setopt($curl, CURLOPT_POST, 1);
91
-        curl_setopt($curl, CURLOPT_POSTFIELDS, 'data='.urlencode($req));
92
-        curl_setopt($curl, CURLOPT_USERAGENT, 'Worldopole/NestUpdater '.$config->infos->site_name);
93
-        curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 60);
94
-        curl_setopt($curl, CURLOPT_TIMEOUT, 660);
95
-        curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
96
-
97
-        $response = curl_exec($curl);
98
-        $status = curl_getinfo($curl, CURLINFO_HTTP_CODE);
99
-        curl_close($curl);
100
-
101
-        if (200 == $status) {
102
-            $json = json_decode($response, true);
103
-
104
-            $parks = array();
105
-            foreach ($json['elements'] as $key => &$element) {
106
-                $tempGeos = array();
107
-                if (isset($element['type']) && 'way' == $element['type'] && isset($element['geometry'])) {
108
-                    $tempGeos = array($element['geometry']);
109
-                } elseif (isset($element['type']) && 'relation' == $element['type'] && isset($element['members'])) {
110
-                    $outers = array();
111
-                    $members = $element['members'];
112
-                    foreach ($members as $member) {
113
-                        if (isset($member['role']) && 'outer' == $member['role'] && isset($member['geometry'])) {
114
-                            $outers[] = $member['geometry'];
115
-                        }
116
-                    }
117
-                    $tempGeos = combineOuter($outers);
118
-                }
119
-                foreach ($tempGeos as $key => $tempGeo) {
120
-                    if (!is_null($tempGeo) && 0 != count($tempGeo)) {
121
-                        $data = array();
122
-                        $geo = array();
123
-                        foreach ($tempGeo as $ele) {
124
-                            $geo[] = array('lat' => $ele['lat'], 'lng' => $ele['lon']);
125
-                        }
126
-
127
-                        // Finish poly where we started
128
-                        $firstEle = $geo[0];
129
-                        $lastEle = $geo[count($geo) - 1];
130
-                        if ($firstEle != $lastEle) {
131
-                            $geo[] = $firstEle;
132
-                        }
133
-
134
-                        $data['geo'] = $geo;
135
-                        if (isset($element['tags']) && isset($element['tags']['name'])) {
136
-                            $data['name'] = $element['tags']['name'];
137
-                        } else {
138
-                            $data['name'] = null;
139
-                        }
140
-                        $data['id'] = $element['id'].'#'.$key;
141
-                        $data['bounds'] = $element['bounds'];
142
-                        $parks[] = $data;
143
-                    }
144
-                }
145
-                unset($json[$key]);
146
-            }
147
-
148
-            // Get frequent spawn points
149
-            $datas = $manager->getNestData($nestTime, $minLatitude, $maxLatitude, $minLongitude, $maxLongitude);
150
-            $nestsdatas = array();
151
-            foreach ($datas as $key => &$data) {
152
-                $nests['pid'] = $data->pokemon_id;
153
-                $nests['c'] = $data->total_pokemon;
154
-                $nests['lat'] = $data->latitude;
155
-                $nests['lng'] = $data->longitude;
156
-                // $starttime = $data->latest_seen - $data->duration;
157
-
158
-                $nests['st'] = '00'; // date('i', $starttime);
159
-                $nests['et'] = '00'; // date('i', $data->latest_seen);
160
-
161
-                // Add the data to array
162
-                $nestsdatas[] = $nests;
163
-                $allNestSpawns[] = $nests;
164
-                unset($datas[$key]);
165
-            }
166
-
167
-            // Checking Parks for Spawnpoints.
168
-            foreach ($parks as $key => &$park) {
169
-                $spawns = array();
170
-
171
-                foreach ($nestsdatas as $spawnpoint) {
172
-                    $lat = $spawnpoint['lat'];
173
-                    $lng = $spawnpoint['lng'];
174
-                    $pid = $spawnpoint['pid'];
175
-
176
-                    if (pointIsInsidePolygon($lat, $lng, $park['geo'], $park['bounds'])) {
177
-                        if (!isset($spawns[$pid])) {
178
-                            $spawns[$pid] = 0;
179
-                        }
180
-                        ++$spawns[$pid];
181
-                    }
182
-                }
183
-
184
-                $mostPid = 0;
185
-                $mostPidCount = 0;
186
-                foreach ($spawns as $pid => $count) {
187
-                    if ($count > $mostPidCount) {
188
-                        $mostPidCount = $count;
189
-                        $mostPid = $pid;
190
-                    }
191
-                }
192
-                if (0 != $mostPidCount && (!isset($config->system->nest_min_count) || $mostPidCount >= $config->system->nest_min_count)) {
193
-                    $park['pid'] = $mostPid;
194
-                    $park['count'] = $mostPidCount;
195
-
196
-                    $parkId = $park['id'];
197
-                    if (!array_key_exists($parkId, $allNestParks)) {
198
-                        $allNestParks[$parkId] = $park;
199
-                        unset($park['id']);
200
-                    } else {
201
-                        $savedPark = $allNestParks[$parkId];
202
-                        if ($park['pid'] == $savedPark['pid']) {
203
-                            $savedPark['count'] += $park['count'];
204
-                        } elseif ($park['count'] > $savedPark['count']) {
205
-                            $savedPark['count'] = $park['count'];
206
-                            $savedPark['pid'] = $park['pid'];
207
-                        }
208
-                        $allNestParks[$parkId] = $savedPark;
209
-                    }
210
-                }
211
-                unset($parks[$key]);
212
-            }
213
-            ++$iLng;
214
-        } elseif (429 == $status) {
215
-            echo "Got Error 429: Trying again in 5 Minutes...\n";
216
-            sleep(300);
217
-        } else {
218
-            echo 'Error '.$status." while getting nests from overpass-turbo. Aborting Nest Update.\n";
219
-            touch($nests_parks_file, $prevNestTime);
220
-            exit();
221
-        }
222
-    }
223
-    ++$iLat;
86
+		$endpoint = 'https://overpass-api.de/api/interpreter';
87
+
88
+		$curl = curl_init($endpoint);
89
+
90
+		curl_setopt($curl, CURLOPT_POST, 1);
91
+		curl_setopt($curl, CURLOPT_POSTFIELDS, 'data='.urlencode($req));
92
+		curl_setopt($curl, CURLOPT_USERAGENT, 'Worldopole/NestUpdater '.$config->infos->site_name);
93
+		curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 60);
94
+		curl_setopt($curl, CURLOPT_TIMEOUT, 660);
95
+		curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
96
+
97
+		$response = curl_exec($curl);
98
+		$status = curl_getinfo($curl, CURLINFO_HTTP_CODE);
99
+		curl_close($curl);
100
+
101
+		if (200 == $status) {
102
+			$json = json_decode($response, true);
103
+
104
+			$parks = array();
105
+			foreach ($json['elements'] as $key => &$element) {
106
+				$tempGeos = array();
107
+				if (isset($element['type']) && 'way' == $element['type'] && isset($element['geometry'])) {
108
+					$tempGeos = array($element['geometry']);
109
+				} elseif (isset($element['type']) && 'relation' == $element['type'] && isset($element['members'])) {
110
+					$outers = array();
111
+					$members = $element['members'];
112
+					foreach ($members as $member) {
113
+						if (isset($member['role']) && 'outer' == $member['role'] && isset($member['geometry'])) {
114
+							$outers[] = $member['geometry'];
115
+						}
116
+					}
117
+					$tempGeos = combineOuter($outers);
118
+				}
119
+				foreach ($tempGeos as $key => $tempGeo) {
120
+					if (!is_null($tempGeo) && 0 != count($tempGeo)) {
121
+						$data = array();
122
+						$geo = array();
123
+						foreach ($tempGeo as $ele) {
124
+							$geo[] = array('lat' => $ele['lat'], 'lng' => $ele['lon']);
125
+						}
126
+
127
+						// Finish poly where we started
128
+						$firstEle = $geo[0];
129
+						$lastEle = $geo[count($geo) - 1];
130
+						if ($firstEle != $lastEle) {
131
+							$geo[] = $firstEle;
132
+						}
133
+
134
+						$data['geo'] = $geo;
135
+						if (isset($element['tags']) && isset($element['tags']['name'])) {
136
+							$data['name'] = $element['tags']['name'];
137
+						} else {
138
+							$data['name'] = null;
139
+						}
140
+						$data['id'] = $element['id'].'#'.$key;
141
+						$data['bounds'] = $element['bounds'];
142
+						$parks[] = $data;
143
+					}
144
+				}
145
+				unset($json[$key]);
146
+			}
147
+
148
+			// Get frequent spawn points
149
+			$datas = $manager->getNestData($nestTime, $minLatitude, $maxLatitude, $minLongitude, $maxLongitude);
150
+			$nestsdatas = array();
151
+			foreach ($datas as $key => &$data) {
152
+				$nests['pid'] = $data->pokemon_id;
153
+				$nests['c'] = $data->total_pokemon;
154
+				$nests['lat'] = $data->latitude;
155
+				$nests['lng'] = $data->longitude;
156
+				// $starttime = $data->latest_seen - $data->duration;
157
+
158
+				$nests['st'] = '00'; // date('i', $starttime);
159
+				$nests['et'] = '00'; // date('i', $data->latest_seen);
160
+
161
+				// Add the data to array
162
+				$nestsdatas[] = $nests;
163
+				$allNestSpawns[] = $nests;
164
+				unset($datas[$key]);
165
+			}
166
+
167
+			// Checking Parks for Spawnpoints.
168
+			foreach ($parks as $key => &$park) {
169
+				$spawns = array();
170
+
171
+				foreach ($nestsdatas as $spawnpoint) {
172
+					$lat = $spawnpoint['lat'];
173
+					$lng = $spawnpoint['lng'];
174
+					$pid = $spawnpoint['pid'];
175
+
176
+					if (pointIsInsidePolygon($lat, $lng, $park['geo'], $park['bounds'])) {
177
+						if (!isset($spawns[$pid])) {
178
+							$spawns[$pid] = 0;
179
+						}
180
+						++$spawns[$pid];
181
+					}
182
+				}
183
+
184
+				$mostPid = 0;
185
+				$mostPidCount = 0;
186
+				foreach ($spawns as $pid => $count) {
187
+					if ($count > $mostPidCount) {
188
+						$mostPidCount = $count;
189
+						$mostPid = $pid;
190
+					}
191
+				}
192
+				if (0 != $mostPidCount && (!isset($config->system->nest_min_count) || $mostPidCount >= $config->system->nest_min_count)) {
193
+					$park['pid'] = $mostPid;
194
+					$park['count'] = $mostPidCount;
195
+
196
+					$parkId = $park['id'];
197
+					if (!array_key_exists($parkId, $allNestParks)) {
198
+						$allNestParks[$parkId] = $park;
199
+						unset($park['id']);
200
+					} else {
201
+						$savedPark = $allNestParks[$parkId];
202
+						if ($park['pid'] == $savedPark['pid']) {
203
+							$savedPark['count'] += $park['count'];
204
+						} elseif ($park['count'] > $savedPark['count']) {
205
+							$savedPark['count'] = $park['count'];
206
+							$savedPark['pid'] = $park['pid'];
207
+						}
208
+						$allNestParks[$parkId] = $savedPark;
209
+					}
210
+				}
211
+				unset($parks[$key]);
212
+			}
213
+			++$iLng;
214
+		} elseif (429 == $status) {
215
+			echo "Got Error 429: Trying again in 5 Minutes...\n";
216
+			sleep(300);
217
+		} else {
218
+			echo 'Error '.$status." while getting nests from overpass-turbo. Aborting Nest Update.\n";
219
+			touch($nests_parks_file, $prevNestTime);
220
+			exit();
221
+		}
222
+	}
223
+	++$iLat;
224 224
 }
225 225
 
226 226
 // Check for nests in nests of same pokemon
227 227
 foreach ($allNestParks as $keyA => $parkA) {
228
-    foreach ($allNestParks as $keyB => $parkB) {
229
-        if ($keyA != $keyB && $parkA['pid'] == $parkB['pid']) {
230
-            if (polyIsInsidePolygon($parkA['geo'], $parkA['bounds'], $parkB['geo'], $parkB['bounds'])) {
231
-                unset($allNestParks[$keyA]);
232
-            } elseif (polyIsInsidePolygon($parkB['geo'], $parkB['bounds'], $parkA['geo'], $parkA['bounds'])) {
233
-                unset($allNestParks[$keyB]);
234
-            }
235
-        }
236
-    }
228
+	foreach ($allNestParks as $keyB => $parkB) {
229
+		if ($keyA != $keyB && $parkA['pid'] == $parkB['pid']) {
230
+			if (polyIsInsidePolygon($parkA['geo'], $parkA['bounds'], $parkB['geo'], $parkB['bounds'])) {
231
+				unset($allNestParks[$keyA]);
232
+			} elseif (polyIsInsidePolygon($parkB['geo'], $parkB['bounds'], $parkA['geo'], $parkA['bounds'])) {
233
+				unset($allNestParks[$keyB]);
234
+			}
235
+		}
236
+	}
237 237
 }
238 238
 
239 239
 // Write files
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -24,7 +24,8 @@
 block discarded – undo
24 24
         $minLongitude = $totalMinLon + $iLng * 0.5;
25 25
         $maxLongitude = min($minLongitude + 0.5, $totalMaxLon);
26 26
 
27
-        if (0 == $manager->getSpawnpointCount($minLatitude, $maxLatitude, $minLongitude, $maxLongitude)->total) { //Skip empty areas
27
+        if (0 == $manager->getSpawnpointCount($minLatitude, $maxLatitude, $minLongitude, $maxLongitude)->total) {
28
+//Skip empty areas
28 29
             ++$iLng;
29 30
             continue;
30 31
         }
Please login to merge, or discard this patch.
core/cron/pokedex_rarity.cron.php 1 patch
Indentation   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -6,30 +6,30 @@  discard block
 block discarded – undo
6 6
 $total_pokemon_last_day = 0;
7 7
 $pokelist = array();
8 8
 foreach ($data as $pokemon_id => $total) {
9
-    $total_pokemon_last_day += $total;
10
-    $pokelist[$pokemon_id]['spawns_last_day'] = $total;
9
+	$total_pokemon_last_day += $total;
10
+	$pokelist[$pokemon_id]['spawns_last_day'] = $total;
11 11
 }
12 12
 
13 13
 // calc rarity for last 24h
14 14
 foreach ($pokelist as &$pokemon) {
15
-    $percent = $pokemon['spawns_last_day'] * 100 / $total_pokemon_last_day;
16
-    $pokemon['rate'] = round($percent, 4);
15
+	$percent = $pokemon['spawns_last_day'] * 100 / $total_pokemon_last_day;
16
+	$pokemon['rate'] = round($percent, 4);
17 17
 }
18 18
 
19 19
 // set values for all available pokemon
20 20
 $maxpid = $config->system->max_pokemon;
21 21
 $pokedex_rarity = new stdClass();
22 22
 for ($pid = 1; $pid <= $maxpid; ++$pid) {
23
-    $pokedex_rarity->$pid = new stdClass();
24
-    if (isset($pokelist[$pid])) {
25
-        // seen
26
-        $pokedex_rarity->$pid->rate = $pokelist[$pid]['rate'];
27
-        $pokedex_rarity->$pid->per_day = (int) $pokelist[$pid]['spawns_last_day'];
28
-    } else {
29
-        // unseen
30
-        $pokedex_rarity->$pid->rate = 0.0;
31
-        $pokedex_rarity->$pid->per_day = 0;
32
-    }
23
+	$pokedex_rarity->$pid = new stdClass();
24
+	if (isset($pokelist[$pid])) {
25
+		// seen
26
+		$pokedex_rarity->$pid->rate = $pokelist[$pid]['rate'];
27
+		$pokedex_rarity->$pid->per_day = (int) $pokelist[$pid]['spawns_last_day'];
28
+	} else {
29
+		// unseen
30
+		$pokedex_rarity->$pid->rate = 0.0;
31
+		$pokedex_rarity->$pid->per_day = 0;
32
+	}
33 33
 }
34 34
 
35 35
 // Write to file
@@ -37,23 +37,23 @@  discard block
 block discarded – undo
37 37
 
38 38
 $rm_pokemon_file = $config->system->rm_pokemon_file;
39 39
 if (!is_null($rm_pokemon_file)) {
40
-    $string = file_get_contents($rm_pokemon_file);
41
-    $json = json_decode($string, true);
42
-    foreach ($pokedex_rarity as $pid => $rarity) {
43
-        $rate = $rarity->rate;
44
-        if ($rate >= 1) {
45
-            $rarity_string = 'Common';
46
-        } elseif ($rate >= 0.20) {
47
-            $rarity_string = 'Uncommon';
48
-        } elseif ($rate >= 0.01) {
49
-            $rarity_string = 'Rare';
50
-        } elseif ($rate >= 0.0025) {
51
-            $rarity_string = 'Very Rare';
52
-        } else {
53
-            $rarity_string = 'Ultra Rare';
54
-        }
55
-        unset($json[$pid]['rarity']);
56
-        $json[$pid]['rarity'] = $rarity_string;
57
-    }
58
-    file_put_contents($rm_pokemon_file, json_encode($json));
40
+	$string = file_get_contents($rm_pokemon_file);
41
+	$json = json_decode($string, true);
42
+	foreach ($pokedex_rarity as $pid => $rarity) {
43
+		$rate = $rarity->rate;
44
+		if ($rate >= 1) {
45
+			$rarity_string = 'Common';
46
+		} elseif ($rate >= 0.20) {
47
+			$rarity_string = 'Uncommon';
48
+		} elseif ($rate >= 0.01) {
49
+			$rarity_string = 'Rare';
50
+		} elseif ($rate >= 0.0025) {
51
+			$rarity_string = 'Very Rare';
52
+		} else {
53
+			$rarity_string = 'Ultra Rare';
54
+		}
55
+		unset($json[$pid]['rarity']);
56
+		$json[$pid]['rarity'] = $rarity_string;
57
+	}
58
+	file_put_contents($rm_pokemon_file, json_encode($json));
59 59
 }
Please login to merge, or discard this patch.
core/cron/pokemon.cron.php 1 patch
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -19,8 +19,8 @@
 block discarded – undo
19 19
 
20 20
 $rarityarray = array();
21 21
 foreach ($counts as $poke_id => $total) {
22
-    $rarity = $pokemons->pokemon->$poke_id->rarity;
23
-    isset($rarityarray[$rarity]) ? $rarityarray[$rarity] += $total : $rarityarray[$rarity] = $total;
22
+	$rarity = $pokemons->pokemon->$poke_id->rarity;
23
+	isset($rarityarray[$rarity]) ? $rarityarray[$rarity] += $total : $rarityarray[$rarity] = $total;
24 24
 }
25 25
 
26 26
 // Set amount of Pokemon for each rarity to 0 if there weren't any at that time
Please login to merge, or discard this patch.
core/cron/captcha.cron.php 1 patch
Indentation   +57 added lines, -57 removed lines patch added patch discarded remove patch
@@ -8,73 +8,73 @@
 block discarded – undo
8 8
 
9 9
 $captcha_file = SYS_PATH.'/core/json/captcha.stats.json';
10 10
 if (is_file($captcha_file)) {
11
-    $capdatas = json_decode(file_get_contents($captcha_file), true);
12
-    // Trim json stats files to last 7 days of data
13
-    $capdatas = trim_stats_json($capdatas, $timestamp_lastweek);
11
+	$capdatas = json_decode(file_get_contents($captcha_file), true);
12
+	// Trim json stats files to last 7 days of data
13
+	$capdatas = trim_stats_json($capdatas, $timestamp_lastweek);
14 14
 }
15 15
 
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 19
 if ('' == $config_secret->captcha_key) {
20
-    $captcha['timestamp'] = $timestamp;
21
-    // get amount of accounts requiring a captcha
22
-    $data = $manager->getCaptchaCount();
23
-    $captcha['captcha_accs'] = $data->total;
24
-    // Add the datas in file
25
-    $capdatas[] = $captcha;
20
+	$captcha['timestamp'] = $timestamp;
21
+	// get amount of accounts requiring a captcha
22
+	$data = $manager->getCaptchaCount();
23
+	$captcha['captcha_accs'] = $data->total;
24
+	// Add the datas in file
25
+	$capdatas[] = $captcha;
26 26
 } else {
27
-    if (!empty($capdatas)) {
28
-        $lastCaptcha = array_pop($capdatas);
29
-    } else {
30
-        $lastCaptcha['timestamp'] = strtotime('-7 days', strtotime(date('Y-m-d')));
31
-    }
32
-    $lastCaptchaDate = date('Y-m-d', $lastCaptcha['timestamp']);
33
-    $startTime = strtotime($lastCaptchaDate);
34
-    $endTime = strtotime(date('Y-m-d')) + date('Z');
35
-    $timeDiff = abs($endTime - $startTime);
36
-    $numberDays = intval($timeDiff / 86400); // 86400 seconds in one day
37
-    if ($numberDays > 7) {
38
-        $numberDays = 7;
39
-    }
40
-    while ($numberDays >= 0) {
41
-        $day = $endTime - ($numberDays * 86400);
42
-        $captchaUrl =
43
-                'http://2captcha.com/res.php?key='.
44
-                $config_secret->captcha_key.'&action=getstats&date='.date('Y-m-d', $day);
27
+	if (!empty($capdatas)) {
28
+		$lastCaptcha = array_pop($capdatas);
29
+	} else {
30
+		$lastCaptcha['timestamp'] = strtotime('-7 days', strtotime(date('Y-m-d')));
31
+	}
32
+	$lastCaptchaDate = date('Y-m-d', $lastCaptcha['timestamp']);
33
+	$startTime = strtotime($lastCaptchaDate);
34
+	$endTime = strtotime(date('Y-m-d')) + date('Z');
35
+	$timeDiff = abs($endTime - $startTime);
36
+	$numberDays = intval($timeDiff / 86400); // 86400 seconds in one day
37
+	if ($numberDays > 7) {
38
+		$numberDays = 7;
39
+	}
40
+	while ($numberDays >= 0) {
41
+		$day = $endTime - ($numberDays * 86400);
42
+		$captchaUrl =
43
+				'http://2captcha.com/res.php?key='.
44
+				$config_secret->captcha_key.'&action=getstats&date='.date('Y-m-d', $day);
45 45
 
46
-        $ch = curl_init();
47
-        curl_setopt($ch, CURLOPT_URL, $captchaUrl);
48
-        curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5);
49
-        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
50
-        $fileContents = curl_exec($ch);
51
-        if (curl_errno($ch)) {
52
-            echo curl_error($ch);
53
-            echo "\n<br />";
54
-            $fileContents = '';
55
-        } else {
56
-            curl_close($ch);
57
-        }
46
+		$ch = curl_init();
47
+		curl_setopt($ch, CURLOPT_URL, $captchaUrl);
48
+		curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5);
49
+		curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
50
+		$fileContents = curl_exec($ch);
51
+		if (curl_errno($ch)) {
52
+			echo curl_error($ch);
53
+			echo "\n<br />";
54
+			$fileContents = '';
55
+		} else {
56
+			curl_close($ch);
57
+		}
58 58
 
59
-        if (!is_string($fileContents) || !strlen($fileContents)) {
60
-            echo 'Failed to get contents.';
61
-            $fileContents = '';
62
-        }
63
-        $capXml = simplexml_load_string($fileContents);
59
+		if (!is_string($fileContents) || !strlen($fileContents)) {
60
+			echo 'Failed to get contents.';
61
+			$fileContents = '';
62
+		}
63
+		$capXml = simplexml_load_string($fileContents);
64 64
 
65
-        foreach ($capXml as $key => $value) {
66
-            if ((0 == $numberDays
67
-                && ((int) $value->Attributes()->hour >= (int) date('H', $lastCaptcha['timestamp'])
68
-                && ((int) $value->Attributes()->hour <= (int) date('H')))
69
-                ) || $numberDays > 0) {
70
-                $captcha['timestamp'] =
71
-                        strtotime(date('Y-m-d', $day).' '.$value->Attributes()->hour.':00') + date('Z');
72
-                $captcha['captcha_accs'] = (string) $value->volume;
73
-                $capdatas[] = $captcha;
74
-            }
75
-        }
76
-        --$numberDays;
77
-    }
65
+		foreach ($capXml as $key => $value) {
66
+			if ((0 == $numberDays
67
+				&& ((int) $value->Attributes()->hour >= (int) date('H', $lastCaptcha['timestamp'])
68
+				&& ((int) $value->Attributes()->hour <= (int) date('H')))
69
+				) || $numberDays > 0) {
70
+				$captcha['timestamp'] =
71
+						strtotime(date('Y-m-d', $day).' '.$value->Attributes()->hour.':00') + date('Z');
72
+				$captcha['captcha_accs'] = (string) $value->volume;
73
+				$capdatas[] = $captcha;
74
+			}
75
+		}
76
+		--$numberDays;
77
+	}
78 78
 }
79 79
 
80 80
 // Write to file
Please login to merge, or discard this patch.
core/cron/crontabs.include.php 2 patches
Indentation   +38 added lines, -38 removed lines patch added patch discarded remove patch
@@ -37,13 +37,13 @@  discard block
 block discarded – undo
37 37
 $pokemonstats_file = SYS_PATH.'/core/json/pokemon.stats.json';
38 38
 
39 39
 if (is_file($gym_file)) {
40
-    $gymsdatas = json_decode(file_get_contents($gym_file), true);
40
+	$gymsdatas = json_decode(file_get_contents($gym_file), true);
41 41
 }
42 42
 if (is_file($pokestop_file)) {
43
-    $stopdatas = json_decode(file_get_contents($pokestop_file), true);
43
+	$stopdatas = json_decode(file_get_contents($pokestop_file), true);
44 44
 }
45 45
 if (is_file($pokemonstats_file)) {
46
-    $pokedatas = json_decode(file_get_contents($pokemonstats_file), true);
46
+	$pokedatas = json_decode(file_get_contents($pokemonstats_file), true);
47 47
 }
48 48
 
49 49
 $timestamp = time();
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
 include_once SYS_PATH.'/core/cron/pokemon.cron.php';
60 60
 include_once SYS_PATH.'/core/cron/pokestop.cron.php';
61 61
 if ($config->system->captcha_support) {
62
-    include_once SYS_PATH.'/core/cron/captcha.cron.php';
62
+	include_once SYS_PATH.'/core/cron/captcha.cron.php';
63 63
 }
64 64
 
65 65
 // The following files are updated every 24h only because the queries are quite expensive
@@ -72,48 +72,48 @@  discard block
 block discarded – undo
72 72
 $migration->setTimezone(new DateTimeZone('UTC'));
73 73
 $migration->setTimestamp(1493856000);
74 74
 do {
75
-    $migrationPrev = clone $migration;
76
-    $migration->modify('+14 days');
75
+	$migrationPrev = clone $migration;
76
+	$migration->modify('+14 days');
77 77
 } while ($migration < new DateTime());
78 78
 $migration = $migrationPrev->getTimestamp();
79 79
 
80 80
 if (filemtime($nests_parks_file) - $migration <= 0) {
81
-    file_put_contents($nests_file, json_encode(array()));
82
-    file_put_contents($nests_parks_file, json_encode(array()));
83
-    touch($nests_parks_file, 1);
81
+	file_put_contents($nests_file, json_encode(array()));
82
+	file_put_contents($nests_parks_file, json_encode(array()));
83
+	touch($nests_parks_file, 1);
84 84
 }
85 85
 
86 86
 // Do not update both files at the same time to lower cpu load
87 87
 if (file_update_ago($pokedex_rarity_file) > 86400) {
88
-    // set file mtime to now before executing long running queries
89
-    // so we don't try to update the file twice
90
-    touch($pokedex_rarity_file);
91
-    // update pokedex rarity
92
-    include_once SYS_PATH.'/core/cron/pokedex_rarity.cron.php';
88
+	// set file mtime to now before executing long running queries
89
+	// so we don't try to update the file twice
90
+	touch($pokedex_rarity_file);
91
+	// update pokedex rarity
92
+	include_once SYS_PATH.'/core/cron/pokedex_rarity.cron.php';
93 93
 } elseif ((file_update_ago($nests_parks_file) >= 43200) && (time() - $migration >= 43200) && (time() - $migration < 86400)) { // extra update 12h after migration
94
-    if (is_file($nests_parks_file)) {
95
-        $prevNestTime = filemtime($nests_parks_file);
96
-    } else {
97
-        $prevNestTime = 1;
98
-    }
99
-
100
-    // set file mtime to now before executing long running queries
101
-    // so we don't try to update the file twice
102
-    touch($nests_parks_file);
103
-    // update nests
104
-    $nestTime = 12;
105
-    include_once SYS_PATH.'/core/cron/nests.cron.php';
94
+	if (is_file($nests_parks_file)) {
95
+		$prevNestTime = filemtime($nests_parks_file);
96
+	} else {
97
+		$prevNestTime = 1;
98
+	}
99
+
100
+	// set file mtime to now before executing long running queries
101
+	// so we don't try to update the file twice
102
+	touch($nests_parks_file);
103
+	// update nests
104
+	$nestTime = 12;
105
+	include_once SYS_PATH.'/core/cron/nests.cron.php';
106 106
 } elseif ((file_update_ago($nests_parks_file) >= 86400) && (time() - $migration >= 86400)) {
107
-    if (is_file($nests_parks_file)) {
108
-        $prevNestTime = filemtime($nests_parks_file);
109
-    } else {
110
-        $prevNestTime = 1;
111
-    }
112
-
113
-    // set file mtime to now before executing long running queries
114
-    // so we don't try to update the file twice
115
-    touch($nests_parks_file);
116
-    // update nests
117
-    $nestTime = 24;
118
-    include_once SYS_PATH.'/core/cron/nests.cron.php';
107
+	if (is_file($nests_parks_file)) {
108
+		$prevNestTime = filemtime($nests_parks_file);
109
+	} else {
110
+		$prevNestTime = 1;
111
+	}
112
+
113
+	// set file mtime to now before executing long running queries
114
+	// so we don't try to update the file twice
115
+	touch($nests_parks_file);
116
+	// update nests
117
+	$nestTime = 24;
118
+	include_once SYS_PATH.'/core/cron/nests.cron.php';
119 119
 }
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -90,7 +90,8 @@
 block discarded – undo
90 90
     touch($pokedex_rarity_file);
91 91
     // update pokedex rarity
92 92
     include_once SYS_PATH.'/core/cron/pokedex_rarity.cron.php';
93
-} elseif ((file_update_ago($nests_parks_file) >= 43200) && (time() - $migration >= 43200) && (time() - $migration < 86400)) { // extra update 12h after migration
93
+} elseif ((file_update_ago($nests_parks_file) >= 43200) && (time() - $migration >= 43200) && (time() - $migration < 86400)) {
94
+// extra update 12h after migration
94 95
     if (is_file($nests_parks_file)) {
95 96
         $prevNestTime = filemtime($nests_parks_file);
96 97
     } else {
Please login to merge, or discard this patch.
core/js/trainer.graph.js.php 1 patch
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -27,8 +27,8 @@  discard block
 block discarded – undo
27 27
 $trainer_lvl = [];
28 28
 // For all 3 teams
29 29
 for ($teamid = 1; $teamid <= 3; ++$teamid) {
30
-    $data = $manager->getTrainerLevelCount($teamid);
31
-    $trainer_lvl[$teamid] = $data;
30
+	$data = $manager->getTrainerLevelCount($teamid);
31
+	$trainer_lvl[$teamid] = $data;
32 32
 }
33 33
 
34 34
 ?>
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
 			borderColor: 'rgba(59,129,255,1)',
69 69
 			borderWidth: 1,
70 70
 			data: [<?php if (isset($trainer_lvl[1])) {
71
-    echo implode(',', $trainer_lvl[1]);
71
+	echo implode(',', $trainer_lvl[1]);
72 72
 } ?>],
73 73
 		},
74 74
 		{
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
 			borderColor: 'rgba(247,10,20,1)',
78 78
 			borderWidth: 1,
79 79
 			data: [<?php if (isset($trainer_lvl[2])) {
80
-    echo implode(',', $trainer_lvl[2]);
80
+	echo implode(',', $trainer_lvl[2]);
81 81
 } ?>],
82 82
 		},
83 83
 		{
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
 			borderColor: 'rgba(248,153,0,1)',
87 87
 			borderWidth: 1,
88 88
 			data: [<?php if (isset($trainer_lvl[3])) {
89
-    echo implode(',', $trainer_lvl[3]);
89
+	echo implode(',', $trainer_lvl[3]);
90 90
 } ?>],
91 91
 		}
92 92
 	]
Please login to merge, or discard this patch.
core/js/nests.maps.js.php 1 patch
Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -1,13 +1,13 @@  discard block
 block discarded – undo
1 1
 <?php
2
-    // Send Javascript header
3
-    header('Content-type: text/javascript');
4
-
5
-    // Load variables and locales
6
-    include_once '../../config.php';
7
-    $variables = SYS_PATH.'/core/json/variables.json';
8
-    $config = json_decode(file_get_contents($variables));
9
-    include_once '../process/locales.loader.php';
10
-    include_once '../../functions.php';
2
+	// Send Javascript header
3
+	header('Content-type: text/javascript');
4
+
5
+	// Load variables and locales
6
+	include_once '../../config.php';
7
+	$variables = SYS_PATH.'/core/json/variables.json';
8
+	$config = json_decode(file_get_contents($variables));
9
+	include_once '../process/locales.loader.php';
10
+	include_once '../../functions.php';
11 11
 ?>
12 12
 
13 13
 /** global: google */
@@ -15,9 +15,9 @@  discard block
 block discarded – undo
15 15
 
16 16
 var pokemon = {
17 17
 <?php
18
-    foreach ($pokemons->pokemon as $pokeid => $pokemon) {
19
-        echo $pokeid.':"'.$pokemon->name.'",';
20
-    }
18
+	foreach ($pokemons->pokemon as $pokeid => $pokemon) {
19
+		echo $pokeid.':"'.$pokemon->name.'",';
20
+	}
21 21
 ?>
22 22
 }
23 23
 var map;
Please login to merge, or discard this patch.