Failed Conditions
Pull Request — master (#326)
by
unknown
02:28
created
core/cron/crontabs.include.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -48,7 +48,7 @@
 block discarded – undo
48 48
 	$pokedatas	= json_decode(file_get_contents($pokemonstats_file), true);
49 49
 }
50 50
 if (is_file($pokedex_raids_file)) {
51
-    $raiddatas	= json_decode(file_get_contents($pokedex_raids_file), true);
51
+	$raiddatas	= json_decode(file_get_contents($pokedex_raids_file), true);
52 52
 }
53 53
 
54 54
 
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
 include_once(SYS_PATH.'/functions.php');
13 13
 
14 14
 // Load timezone
15
-include_once(SYS_PATH. '/core/process/timezone.loader.php');
15
+include_once(SYS_PATH.'/core/process/timezone.loader.php');
16 16
 
17 17
 
18 18
 // Load variables.json
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
 	$pokedatas	= json_decode(file_get_contents($pokemonstats_file), true);
54 54
 }
55 55
 if (is_file($pokedex_raids_file)) {
56
-    $raiddatas	= json_decode(file_get_contents($pokedex_raids_file), true);
56
+    $raiddatas = json_decode(file_get_contents($pokedex_raids_file), true);
57 57
 }
58 58
 
59 59
 
Please login to merge, or discard this patch.
core/process/locales.loader.php 1 patch
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -211,14 +211,14 @@
 block discarded – undo
211 211
 	$pokemon->spawn_count = $pokemon_counts->$pokeid;
212 212
 
213 213
 	// Add raid data to array
214
-    $raid_data = $raid_counts->$pokeid;
215
-    if (isset($raid_data->end_time)) {
216
-        $pokemon->last_raid_seen = strtotime($raid_data->end_time);
217
-        $pokemon->last_raid_position = new stdClass();
218
-        $pokemon->last_raid_position->latitude = $raid_data->latitude;
219
-        $pokemon->last_raid_position->longitude = $raid_data->longitude;
220
-    }
221
-    $pokemon->raid_count = $raid_data->count;
214
+	$raid_data = $raid_counts->$pokeid;
215
+	if (isset($raid_data->end_time)) {
216
+		$pokemon->last_raid_seen = strtotime($raid_data->end_time);
217
+		$pokemon->last_raid_position = new stdClass();
218
+		$pokemon->last_raid_position->latitude = $raid_data->latitude;
219
+		$pokemon->last_raid_position->longitude = $raid_data->longitude;
220
+	}
221
+	$pokemon->raid_count = $raid_data->count;
222 222
 
223 223
 	// Calculate and add rarities to array
224 224
 	$spawn_rate = $pokemons_rarity->$pokeid->rate;
Please login to merge, or discard this patch.
core/cron/pokedex_raids.cron.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -19,10 +19,10 @@
 block discarded – undo
19 19
                 JOIN gym g
20 20
                 JOIN (SELECT count(*) as count
21 21
                     FROM raid
22
-                    " . $where . "
22
+                    " . $where."
23 23
                 ) x
24 24
                 ON r.gym_id = g.gym_id
25
-                " . $where . "
25
+                " . $where."
26 26
                 ORDER BY start DESC
27 27
                 LIMIT 0,1";
28 28
     $result = $mysqli->query($req);
Please login to merge, or discard this patch.
Indentation   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -6,15 +6,15 @@  discard block
 block discarded – undo
6 6
 $newraiddatas = $raiddatas;
7 7
 
8 8
 for ($pid = 1; $pid <= $maxpid; $pid++) {
9
-    // Get count since update
10
-    if (isset($raiddatas[$pid]['last_update'])) {
11
-        $last_update = $raiddatas[$pid]['last_update'];
12
-    } else {
13
-        $last_update = 0;
14
-    }
9
+	// Get count since update
10
+	if (isset($raiddatas[$pid]['last_update'])) {
11
+		$last_update = $raiddatas[$pid]['last_update'];
12
+	} else {
13
+		$last_update = 0;
14
+	}
15 15
 
16
-    $where = "WHERE pokemon_id = '".$pid."' && UNIX_TIMESTAMP(start) > '".$last_update."'";
17
-    $req = "SELECT UNIX_TIMESTAMP(start) as start_timestamp, end, (CONVERT_TZ(end, '+00:00', '".$time_offset."')) AS end_time_real, latitude, longitude, count
16
+	$where = "WHERE pokemon_id = '".$pid."' && UNIX_TIMESTAMP(start) > '".$last_update."'";
17
+	$req = "SELECT UNIX_TIMESTAMP(start) as start_timestamp, end, (CONVERT_TZ(end, '+00:00', '".$time_offset."')) AS end_time_real, latitude, longitude, count
18 18
                 FROM raid r
19 19
                 JOIN gym g
20 20
                 JOIN (SELECT count(*) as count
@@ -25,29 +25,29 @@  discard block
 block discarded – undo
25 25
                 " . $where . "
26 26
                 ORDER BY start DESC
27 27
                 LIMIT 0,1";
28
-    $result = $mysqli->query($req);
29
-    $data = $result->fetch_object();
28
+	$result = $mysqli->query($req);
29
+	$data = $result->fetch_object();
30 30
 
31
-    if (isset($data)) {
32
-        $count = $data->count;
33
-    } else {
34
-        $count = 0;
35
-    }
31
+	if (isset($data)) {
32
+		$count = $data->count;
33
+	} else {
34
+		$count = 0;
35
+	}
36 36
 
37
-    if ($count != 0) {
38
-        echo $count;
39
-        $newraiddatas[$pid]['count'] += $count;
40
-        $newraiddatas[$pid]['last_update'] = $data->start_timestamp;
41
-        $newraiddatas[$pid]['end_time'] = $data->end_time_real;
42
-        $newraiddatas[$pid]['latitude'] = $data->latitude;
43
-        $newraiddatas[$pid]['longitude'] = $data->longitude;
44
-    } elseif (is_null($newraiddatas[$pid]['count'])) {
45
-        $newraiddatas[$pid]['count'] = 0;
46
-        $newraiddatas[$pid]['last_update'] = 0;
47
-        $newraiddatas[$pid]['end_time'] = null;
48
-        $newraiddatas[$pid]['latitude'] = null;
49
-        $newraiddatas[$pid]['longitude'] = null;
50
-    }
37
+	if ($count != 0) {
38
+		echo $count;
39
+		$newraiddatas[$pid]['count'] += $count;
40
+		$newraiddatas[$pid]['last_update'] = $data->start_timestamp;
41
+		$newraiddatas[$pid]['end_time'] = $data->end_time_real;
42
+		$newraiddatas[$pid]['latitude'] = $data->latitude;
43
+		$newraiddatas[$pid]['longitude'] = $data->longitude;
44
+	} elseif (is_null($newraiddatas[$pid]['count'])) {
45
+		$newraiddatas[$pid]['count'] = 0;
46
+		$newraiddatas[$pid]['last_update'] = 0;
47
+		$newraiddatas[$pid]['end_time'] = null;
48
+		$newraiddatas[$pid]['latitude'] = null;
49
+		$newraiddatas[$pid]['longitude'] = null;
50
+	}
51 51
 }
52 52
 
53 53
 // Write to file
Please login to merge, or discard this patch.
pages/pokemon.page.php 3 patches
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -304,8 +304,7 @@
 block discarded – undo
304 304
 									} elseif (!is_null($obj->info)) {
305 305
                                         $infoName = 'INFO_' . $obj->info;
306 306
                                         echo '<br>(' . $locales->$infoName . ')';
307
-                                    }
308
-									else {
307
+                                    } else {
309 308
 										echo '<br> </br>';
310 309
 									}
311 310
 									?>
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -285,7 +285,7 @@  discard block
 block discarded – undo
285 285
 		<?php
286 286
         $skip = false;
287 287
 		for ($i = 0; $i < $depth; $i++) {
288
-			$i_id = intval(($i+1)/2);
288
+			$i_id = intval(($i + 1) / 2);
289 289
 			$data = get_tree_at_depth($tree, $i_id, $config->system->max_pokemon);
290 290
 			?>
291 291
 
@@ -296,9 +296,9 @@  discard block
 block discarded – undo
296 296
                     foreach ($data as $obj) {
297 297
 						$obj_id = $obj->id;
298 298
 						$tree_pokemon = $pokemons->pokemon->$obj_id;
299
-						$link = "/pokemon/" . $obj_id;
299
+						$link = "/pokemon/".$obj_id;
300 300
 
301
-						if ($i%2 == 0) { ?>
301
+						if ($i % 2 == 0) { ?>
302 302
 
303 303
 							<div>
304 304
 								<a href="<?= $link ?>"><img src="<?= $tree_pokemon->img ?>" alt="<?= $tree_pokemon->name ?>" class="img"></a>
@@ -313,13 +313,13 @@  discard block
 block discarded – undo
313 313
 								<img src="core/img/arrow<?=$obj->array_sufix?>.png" alt="Arrow" class="img">
314 314
 								<p class="pkmn-name">
315 315
 									<?php
316
-									echo $obj->candies . ' ' . $locales->POKEMON_CANDIES;
316
+									echo $obj->candies.' '.$locales->POKEMON_CANDIES;
317 317
 									if (!is_null($obj->item)) {
318
-										$itemName = 'ITEM_' . $obj->item;
319
-										echo '<br>+ ' . $locales->$itemName;
318
+										$itemName = 'ITEM_'.$obj->item;
319
+										echo '<br>+ '.$locales->$itemName;
320 320
 									} elseif (!is_null($obj->info)) {
321
-                                        $infoName = 'INFO_' . $obj->info;
322
-                                        echo '<br>(' . $locales->$infoName . ')';
321
+                                        $infoName = 'INFO_'.$obj->info;
322
+                                        echo '<br>('.$locales->$infoName.')';
323 323
                                     }
324 324
 									else {
325 325
 										echo '<br> </br>';
Please login to merge, or discard this patch.
Indentation   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -100,8 +100,8 @@  discard block
 block discarded – undo
100 100
 				<td class="col-md-4 col-xs-4">
101 101
 
102 102
 				<?php
103
-                if (isset($pokemon->last_position)) {
104
-                    ?>
103
+				if (isset($pokemon->last_position)) {
104
+					?>
105 105
 
106 106
 					<a href="https://maps.google.com/?q=<?= $pokemon->last_position->latitude ?>,<?= $pokemon->last_position->longitude ?>&ll=<?= $pokemon->last_position->latitude ?>,<?= $pokemon->last_position->longitude ?>&z=16" target="_blank"><?= time_ago($pokemon->last_seen, $locales) ?></a>
107 107
 
@@ -124,15 +124,15 @@  discard block
 block discarded – undo
124 124
 			<tr>
125 125
 				<td class="col-md-8 col-xs-8">
126 126
                     <?php
127
-                    if (isset($pokemon->protected_gyms)) {
128
-					    echo "<strong>".$locales->POKEMON_GYM.$pokemon->name."</strong> :";
129
-				    } ?>
127
+					if (isset($pokemon->protected_gyms)) {
128
+						echo "<strong>".$locales->POKEMON_GYM.$pokemon->name."</strong> :";
129
+					} ?>
130 130
                 </td>
131 131
 				<td class="col-md-4 col-xs-4">
132 132
                     <?php
133
-                    if (isset($pokemon->protected_gyms)) {
134
-					    echo $pokemon->protected_gyms;
135
-				    }?>
133
+					if (isset($pokemon->protected_gyms)) {
134
+						echo $pokemon->protected_gyms;
135
+					}?>
136 136
                 </td>
137 137
 			</tr>
138 138
 		</table>
@@ -145,16 +145,16 @@  discard block
 block discarded – undo
145 145
 				<td class="col-md-4 col-xs-4">
146 146
 
147 147
                     <?php
148
-                    if (isset($pokemon->last_raid_position)) {
149
-                        ?>
148
+					if (isset($pokemon->last_raid_position)) {
149
+						?>
150 150
 
151 151
 					    <a href="https://maps.google.com/?q=<?= $pokemon->last_raid_position->latitude ?>,<?= $pokemon->last_raid_position->longitude ?>&ll=<?= $pokemon->last_raid_position->latitude ?>,<?= $pokemon->last_raid_position->longitude ?>&z=16" target="_blank"><?= time_ago($pokemon->last_raid_seen, $locales) ?></a>
152 152
 
153 153
 					    <?php
154
-                    } else {
155
-                        echo $locales->NEVER;
156
-                    }
157
-                    ?>
154
+					} else {
155
+						echo $locales->NEVER;
156
+					}
157
+					?>
158 158
 
159 159
 				</td>
160 160
 			</tr>
@@ -277,14 +277,14 @@  discard block
 block discarded – undo
277 277
 	
278 278
 	<?php
279 279
 	$tree = array($pokemon->tree);
280
-    $depth = get_depth($tree);
281
-    ?>
280
+	$depth = get_depth($tree);
281
+	?>
282 282
 
283 283
 	<h3 class="col-md-12 text-center sub-title"><strong><?= $locales->POKEMON_EVOLUTIONS ?></strong></h3>
284 284
 	<div class="col-md-12 flex-container-tree results">
285 285
 
286 286
 		<?php
287
-        $skip = false;
287
+		$skip = false;
288 288
 		for ($i = 0; $i < $depth; $i++) {
289 289
 			$i_id = intval(($i+1)/2);
290 290
 			$data = get_tree_at_depth($tree, $i_id, $config->system->max_pokemon);
@@ -294,7 +294,7 @@  discard block
 block discarded – undo
294 294
 			if (!is_null($data) && sizeof($data) != 0 && !$skip) { ?>
295 295
 				<div class="col-md-12 flex-item-tree">
296 296
 					<?php
297
-                    foreach ($data as $obj) {
297
+					foreach ($data as $obj) {
298 298
 						$obj_id = $obj->id;
299 299
 						$tree_pokemon = $pokemons->pokemon->$obj_id;
300 300
 						$link = "/pokemon/" . $obj_id;
@@ -308,7 +308,7 @@  discard block
 block discarded – undo
308 308
 
309 309
 						<?php
310 310
 						} else {
311
-						    ?>
311
+							?>
312 312
 
313 313
 							<div>
314 314
 								<img src="core/img/arrow<?=$obj->array_sufix?>.png" alt="Arrow" class="img">
@@ -319,9 +319,9 @@  discard block
 block discarded – undo
319 319
 										$itemName = 'ITEM_' . $obj->item;
320 320
 										echo '<br>+ ' . $locales->$itemName;
321 321
 									} elseif (!is_null($obj->info)) {
322
-                                        $infoName = 'INFO_' . $obj->info;
323
-                                        echo '<br>(' . $locales->$infoName . ')';
324
-                                    }
322
+										$infoName = 'INFO_' . $obj->info;
323
+										echo '<br>(' . $locales->$infoName . ')';
324
+									}
325 325
 									else {
326 326
 										echo '<br> </br>';
327 327
 									}
@@ -329,16 +329,16 @@  discard block
 block discarded – undo
329 329
 								</p>
330 330
 							</div>
331 331
                             <?php
332
-                        }
332
+						}
333 333
 					}
334 334
 					?>
335 335
                 </div>
336 336
             <?php
337
-            } elseif ($skip) {
338
-                $skip = false;
339
-            } else {
340
-                $skip = true;
341
-            }
337
+			} elseif ($skip) {
338
+				$skip = false;
339
+			} else {
340
+				$skip = true;
341
+			}
342 342
 		}
343 343
 		?>
344 344
 	</div>
Please login to merge, or discard this patch.
functions.php 3 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -213,6 +213,9 @@
 block discarded – undo
213 213
 ########################################################################
214 214
 // used in get_tree_at_depth
215 215
 ########################################################################
216
+/**
217
+ * @param integer $currentDepth
218
+ */
216 219
 function tree_check_array($array, $depth, $currentDepth) {
217 220
     $i = 0;
218 221
     $count = count($array);
Please login to merge, or discard this patch.
Indentation   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -197,16 +197,16 @@  discard block
 block discarded – undo
197 197
 ########################################################################
198 198
 function get_tree_at_depth($trees, $depth, $max_pokemon, $currentDepth = 0) {
199 199
 	if ($depth == $currentDepth) { // Found depth
200
-        return tree_remove_bellow($trees, $max_pokemon);
200
+		return tree_remove_bellow($trees, $max_pokemon);
201 201
 	} else { // Go deeper
202 202
 		$arr = array();
203 203
 		foreach ($trees as $temp) { // Go into all trees
204 204
 			$tree = $temp->evolutions;
205 205
 			$results = tree_remove_bellow(get_tree_at_depth($tree, $depth, $max_pokemon, $currentDepth + 1), $max_pokemon);
206 206
 			array_merge($arr, tree_check_array($results, $depth, $currentDepth));
207
-            echo "<br>";
207
+			echo "<br>";
208 208
 		}
209
-        return $arr;
209
+		return $arr;
210 210
 	}
211 211
 }
212 212
 
@@ -214,23 +214,23 @@  discard block
 block discarded – undo
214 214
 // used in get_tree_at_depth
215 215
 ########################################################################
216 216
 function tree_check_array($array, $depth, $currentDepth) {
217
-    $i = 0;
218
-    $count = count($array);
219
-    if (!is_null($array)) { // check if exists
220
-        foreach ($array as $res) { // Check if above, equal or bellow center
221
-            if ($count != 1 && $depth - $currentDepth == 1) { // only add arrow once
222
-                $num = $i / ($count - 1);
223
-                if ($num < 0.5) {
224
-                    $res->array_sufix = "_up";
225
-                } elseif ($num > 0.5) {
226
-                    $res->array_sufix = "_down";
227
-                }
228
-            }
229
-            $arr[] = $res;
230
-            $i++;
231
-        }
232
-    }
233
-    return $arr;
217
+	$i = 0;
218
+	$count = count($array);
219
+	if (!is_null($array)) { // check if exists
220
+		foreach ($array as $res) { // Check if above, equal or bellow center
221
+			if ($count != 1 && $depth - $currentDepth == 1) { // only add arrow once
222
+				$num = $i / ($count - 1);
223
+				if ($num < 0.5) {
224
+					$res->array_sufix = "_up";
225
+				} elseif ($num > 0.5) {
226
+					$res->array_sufix = "_down";
227
+				}
228
+			}
229
+			$arr[] = $res;
230
+			$i++;
231
+		}
232
+	}
233
+	return $arr;
234 234
 }
235 235
 
236 236
 ########################################################################
@@ -238,14 +238,14 @@  discard block
 block discarded – undo
238 238
 ########################################################################
239 239
 function tree_remove_bellow($tree, $max_pokemon)
240 240
 {
241
-    if (is_null($tree)) {
242
-        return null;
243
-    }
244
-    $arr = array();
245
-    foreach ($tree as $item) { // Check if above, equal or bellow center
246
-        if ($item->id <= $max_pokemon) {
247
-            $arr[] = $item;
248
-        }
249
-    }
250
-    return $arr;
241
+	if (is_null($tree)) {
242
+		return null;
243
+	}
244
+	$arr = array();
245
+	foreach ($tree as $item) { // Check if above, equal or bellow center
246
+		if ($item->id <= $max_pokemon) {
247
+			$arr[] = $item;
248
+		}
249
+	}
250
+	return $arr;
251 251
 }
252 252
\ No newline at end of file
Please login to merge, or discard this patch.
Braces   +20 added lines, -10 removed lines patch added patch discarded remove patch
@@ -177,7 +177,8 @@  discard block
 block discarded – undo
177 177
 //
178 178
 // Retruns max depth of array
179 179
 ########################################################################
180
-function get_depth($arr) {
180
+function get_depth($arr)
181
+{
181 182
 	$it = new RecursiveIteratorIterator(new RecursiveArrayIterator($arr));
182 183
 	$depth = 0;
183 184
 	foreach ($it as $v) {
@@ -195,12 +196,16 @@  discard block
 block discarded – undo
195 196
 //
196 197
 // Return all pokemon with data at a certain tree depth
197 198
 ########################################################################
198
-function get_tree_at_depth($trees, $depth, $max_pokemon, $currentDepth = 0) {
199
-	if ($depth == $currentDepth) { // Found depth
199
+function get_tree_at_depth($trees, $depth, $max_pokemon, $currentDepth = 0)
200
+{
201
+	if ($depth == $currentDepth) {
202
+// Found depth
200 203
         return tree_remove_bellow($trees, $max_pokemon);
201
-	} else { // Go deeper
204
+	} else {
205
+// Go deeper
202 206
 		$arr = array();
203
-		foreach ($trees as $temp) { // Go into all trees
207
+		foreach ($trees as $temp) {
208
+// Go into all trees
204 209
 			$tree = $temp->evolutions;
205 210
 			$results = tree_remove_bellow(get_tree_at_depth($tree, $depth, $max_pokemon, $currentDepth + 1), $max_pokemon);
206 211
 			array_merge($arr, tree_check_array($results, $depth, $currentDepth));
@@ -213,12 +218,16 @@  discard block
 block discarded – undo
213 218
 ########################################################################
214 219
 // used in get_tree_at_depth
215 220
 ########################################################################
216
-function tree_check_array($array, $depth, $currentDepth) {
221
+function tree_check_array($array, $depth, $currentDepth)
222
+{
217 223
     $i = 0;
218 224
     $count = count($array);
219
-    if (!is_null($array)) { // check if exists
220
-        foreach ($array as $res) { // Check if above, equal or bellow center
221
-            if ($count != 1 && $depth - $currentDepth == 1) { // only add arrow once
225
+    if (!is_null($array)) {
226
+// check if exists
227
+        foreach ($array as $res) {
228
+// Check if above, equal or bellow center
229
+            if ($count != 1 && $depth - $currentDepth == 1) {
230
+// only add arrow once
222 231
                 $num = $i / ($count - 1);
223 232
                 if ($num < 0.5) {
224 233
                     $res->array_sufix = "_up";
@@ -242,7 +251,8 @@  discard block
 block discarded – undo
242 251
         return null;
243 252
     }
244 253
     $arr = array();
245
-    foreach ($tree as $item) { // Check if above, equal or bellow center
254
+    foreach ($tree as $item) {
255
+// Check if above, equal or bellow center
246 256
         if ($item->id <= $max_pokemon) {
247 257
             $arr[] = $item;
248 258
         }
Please login to merge, or discard this patch.