Skip to content

Commit

Permalink
Website: Parse JSON properly
Browse files Browse the repository at this point in the history
  • Loading branch information
mia-pi-git committed Jul 20, 2024
1 parent 0b16145 commit 8e10a46
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
7 changes: 6 additions & 1 deletion play.pokemonshowdown.com/ladder.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,12 @@
</tr>
<?php
}

$coil_vals = array();
try {
json_decode(file_get_contents('./config/coil.json'));
} catch (Exception $e) {}

foreach ($toplist as $row)
{
$i++;
Expand All @@ -47,7 +53,6 @@
<td><?php echo '<em>'.round($row['rpr']).'<small> &#177; '.round($row['rprd']).'</small></em>'; /* if (floatval($row['rprd']) > 100) echo ' <small>(provisional)</small>'; */ ?></td>
<td>
<?php
$coil_vals = json_parse(file_get_contents('./config/coil.json'));
if (in_array($coil_vals, $row['formatid'])) {
echo number_format($N ? 40*$row['gxe']*pow(2.0,-$coil_vals[$row['formatid']]/$N) : 0,1,'.','');
} else echo '--';
Expand Down
5 changes: 4 additions & 1 deletion pokemonshowdown.com/ladder.php
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,10 @@
</tr>
<?php
$toplist = $ladder->getTop();
$coil_vals = json_parse(file_get_contents('./config/coil.json'));
$coil_vals = array();
try {
json_decode(file_get_contents('./config/coil.json'));
} catch (Exception $e) {}
$i=0;

if (!count($toplist)) {
Expand Down

0 comments on commit 8e10a46

Please sign in to comment.