From 79d928cd42c32122edd47d1a450fb0c4ced3de2f Mon Sep 17 00:00:00 2001 From: raylu Date: Wed, 18 Jul 2012 01:45:55 -0700 Subject: fix lots of warnings, whitespace --- includes/datas.php | 4 ++-- includes/header.php | 12 ++++++------ includes/maps.php | 34 +++++++++++++++++++--------------- 3 files changed, 27 insertions(+), 23 deletions(-) (limited to 'includes') diff --git a/includes/datas.php b/includes/datas.php index 5d901ee..c445ca1 100644 --- a/includes/datas.php +++ b/includes/datas.php @@ -26,9 +26,9 @@ function topScores($mapid, $top = 5, $bottom = 0) { ORDER BY solutions.moves DESC, solutions.dateModified ASC LIMIT $bottom, $top "; - $result = mysql_query($sql); + $result = mysql_query($sql) or die(mysql_error()); $utime = date("g:i A (T)"); - $output .= ""; + $output = "
"; $output .= ""; $output .= ""; $output .= ""; diff --git a/includes/header.php b/includes/header.php index d718588..887aa41 100644 --- a/includes/header.php +++ b/includes/header.php @@ -1,6 +1,7 @@ @@ -25,7 +26,7 @@ function htmlHeader($css = array(), $title = 'Pathery', $desc = '') { for(e=0;e'; - $page = $_GET['page']; - if ($page == '') - $page = 'home'; + $page = isset($_GET['page']) ? $_GET['page'] : 'home'; foreach ($links as $key => $value) { if ($page == $key) $selected = " selected"; @@ -103,7 +103,7 @@ function topbar($links) { } echo "
"; - if ($_SESSION['accepted'] == 1) { + if ($accepted) { echo "Logged in as $_SESSION[displayName]
"; if ($_SESSION['displayName'] == 'noname') echo "Update your name | "; 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 = "
@@ -134,16 +134,20 @@ function DisplayMap($mapMatrix, $idprefix = 1, $style = 'normal', $speed = NULL)
RankBadge
$maptable
"; - - - $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 .= "