summaryrefslogtreecommitdiffstats
path: root/includes/maps.php
diff options
context:
space:
mode:
authorraylu <raylu@mixpanel.com>2012-07-18 01:45:55 -0700
committerraylu <raylu@mixpanel.com>2012-07-18 01:45:55 -0700
commit79d928cd42c32122edd47d1a450fb0c4ced3de2f (patch)
tree9989a6fc699476a01b7721a13a330f9e214fe0de /includes/maps.php
parent9f7a77eb549d1cfe93b406a0c29862db8664de76 (diff)
downloadpathery-79d928cd42c32122edd47d1a450fb0c4ced3de2f.tar.xz
fix lots of warnings, whitespace
Diffstat (limited to 'includes/maps.php')
-rw-r--r--includes/maps.php34
1 files changed, 19 insertions, 15 deletions
diff --git a/includes/maps.php b/includes/maps.php
index 4618ff8..16aa35c 100644
--- a/includes/maps.php
+++ b/includes/maps.php
@@ -109,7 +109,7 @@ function DisplayMap($mapMatrix, $idprefix = 1, $style = 'normal', $speed = NULL)
$jsonmap = str_replace("'", "\'", json_encode($mapdata));
//This works in chrome, not sure about others.
- $preloaddiv .= "
+ $preloaddiv = "
<div style='visibility:hidden;display:none'>
<img src='images/Path1.png' alt=''>
<img src='images/Path2.png' alt=''>
@@ -134,16 +134,20 @@ function DisplayMap($mapMatrix, $idprefix = 1, $style = 'normal', $speed = NULL)
<table style='width:$width;height:$height;' class='grid_table'>
$maptable
</table>";
-
-
- $prefSpeed = $_COOKIE['pref_speed'];
- $speedOption['Slow'] = 1;
- $speedOption['Med'] = 2;
- $speedOption['Fast'] = 3;
- $speedOption['Ultra'] = 4;
- if (!in_array($prefSpeed, $speedOption))
+
+
+ if (isset($_COOKIE['pref_speed'])) {
+ $prefSpeed = $_COOKIE['pref_speed'];
+ $speedOption['Slow'] = 1;
+ $speedOption['Med'] = 2;
+ $speedOption['Fast'] = 3;
+ $speedOption['Ultra'] = 4;
+ if (!in_array($prefSpeed, $speedOption))
+ $prefSpeed = '2';
+ } else
$prefSpeed = '2';
+ $rOption = '';
foreach ($speedOption as $key => $value) {
$rOption .= "<option value='$value'";
if ($prefSpeed == $value)
@@ -151,7 +155,7 @@ function DisplayMap($mapMatrix, $idprefix = 1, $style = 'normal', $speed = NULL)
$rOption .= ">$key</option>\n";
}
- if ($_COOKIE['pref_mute'] == "true") {
+ if (isset($_COOKIE['pref_mute']) && $_COOKIE['pref_mute'] == "true") {
$mutebutton = "<label><input onclick='savePref(\"mute\", this.checked)' type='checkbox' id='$idprefix,mute' checked='checked' />Mute</label>";
} else {
$mutebutton = "<label><input onclick='savePref(\"mute\", this.checked)' type='checkbox' id='$idprefix,mute' />Mute</label>";
@@ -400,27 +404,27 @@ function GenerateShapedMap($shape, $params) {
// $checkpoints++;
//Confirm params.
- if ($params['rockchance'])
+ if (isset($params['rockchance']))
$rockchance = $params['rockchance'];
else
$rockchance = 10;
- if ($params['checkpoints'])
+ if (isset($params['checkpoints']))
$checkpoints = $params['checkpoints'];
else
$checkpoints = 0;
- if ($params['teleports'])
+ if (isset($params['teleports']))
$teleports = $params['teleports'];
else
$teleports = 0;
- if ($params['name'])
+ if (isset($params['name']))
$mapName = $params['name'];
else
$mapName = '';
- if (is_int($params['walls']))
+ if (isset($params['walls']) && is_int($params['walls']))
$walls = $params['walls'];
else
$walls = 13;