From 329cc1f9b6657ce580b3a297e39a7cd259a62537 Mon Sep 17 00:00:00 2001 From: Patrick Davison Date: Thu, 16 May 2013 17:19:15 -0700 Subject: More PHP warning and notice fixes. --- ajax/chat.ajax.php | 4 ++-- ajax/scores.ajax.php | 2 +- do.php | 17 ++++++++++------- favicon.ico | Bin 1406 -> 1406 bytes globe.php | 3 ++- includes/datas.php | 15 ++++++++------- pages/login.php | 7 ++++--- redirect.php | 10 +++++++--- 8 files changed, 34 insertions(+), 24 deletions(-) diff --git a/ajax/chat.ajax.php b/ajax/chat.ajax.php index c191b33..07df57c 100644 --- a/ajax/chat.ajax.php +++ b/ajax/chat.ajax.php @@ -9,7 +9,7 @@ session_start(); if (isset($_SESSION['chatLastReset'])) $chatLastReset = $_SESSION['chatLastReset']; else $chatLastReset = 0; -if (strtotime('now') - $_SESSION['chatLastReset'] > 6) { +if (strtotime('now') - $chatLastReset > 6) { $_SESSION['chatSendCount'] = 0; $_SESSION['chatLastReset'] = strtotime('now'); } @@ -70,7 +70,7 @@ if (isset($_REQUEST['messages'])) { $messages = $_REQUEST['messages']; $messages = explode("|:|", $messages); foreach ($messages as $message) { - //$message = chatFilter(stripslashes($message)); + $message = chatFilter($message); if ($message[0] == "/") { $arguements = explode(" ", substr($message, 1)); $command = $arguements[0]; diff --git a/ajax/scores.ajax.php b/ajax/scores.ajax.php index 70d78ff..c304465 100644 --- a/ajax/scores.ajax.php +++ b/ajax/scores.ajax.php @@ -1,7 +1,7 @@ log('Calling challenges'); @@ -183,9 +187,9 @@ if ($_GET['r'] == 'getpath') { // $firephp->log('Challenges called!'); die(json_encode($json)); } - exit; + die(json_encode($json)); } - + //Get current score data. - to see if a pertinent score was beat. $sql = "SELECT `moves` as bestmoves, `displayName`, IFNULL(q1.mymoves, 0) FROM `solutions`, `users` @@ -211,7 +215,6 @@ if ($_GET['r'] == 'getpath') { $json['best'] = 0; $json['bestby'] = 'no one'; } - // --------- ------------------------------ --------- // --------- RUSH THE PATH BACK TO THE USER --------- // --------- ------------------------------ --------- @@ -225,6 +228,7 @@ if ($_GET['r'] == 'getpath') { flush(); //The connection is now closed, no further communication to the client can be done! } + // --------- CONTINUE EXECUTION --------- //TODO: !! Close the session with session_write_close(); as soon as possible. @@ -293,8 +297,7 @@ if ($_GET['r'] == 'getpath') { // --------- USER LOGGED IN //Is the map still valid to score on? - if (!isCurrentMap($mapID)) - return; + if (!isCurrentMap($mapID)) return; // --------- UPDATE SCORES $json['error'][] = 'map is current'; diff --git a/favicon.ico b/favicon.ico index 71cd1b2..4609f20 100644 Binary files a/favicon.ico and b/favicon.ico differ diff --git a/globe.php b/globe.php index 236ef8d..d8cc78d 100644 --- a/globe.php +++ b/globe.php @@ -174,7 +174,8 @@ Function CheckAuth($page) { //TODO: Contains domain !! Function DoRedirect($message = "Thanks", $to = NULL, $duration = "3") { - $to=(is_null($to)?$mydomain:$to); + global $mydomain; + $to = (is_null($to)?$mydomain:$to); if ($duration == 0) { header("Location: $to"); diff --git a/includes/datas.php b/includes/datas.php index 6bf04d6..2985853 100644 --- a/includes/datas.php +++ b/includes/datas.php @@ -509,8 +509,7 @@ function applyAchievements($userID, $aType) { //Is there a next level for this? $aNextLevel = $aLevel + 1; - if (!isset($aArray[$aNextLevel])) - return false; + if (!isset($aArray[$aNextLevel])) return false; list($required, $unlockType, $unlockValue, $unlockName, $unlockSubtype) = $aArray[$aNextLevel]; if ($amount < $required) return false; @@ -800,8 +799,8 @@ function getMembers($pageNumber = 1, $pageDivide = 50, $order = 'DESC', $orderBy $row['dateJoined'] = Date("Y-m-d", strtotime($row['dateJoined'])); $row['dateLogin'] = Date("Y-m-d", strtotime($row['dateLogin'])); - $scoredDate = strtotime($row['cdate']); - $secondsSinceScored = strtotime("now") - $scoredDate ; + //$scoredDate = strtotime($row['cdate']); + //$secondsSinceScored = strtotime("now") - $scoredDate ; //Alternate background colors $background = '#262631'; @@ -814,7 +813,7 @@ function getMembers($pageNumber = 1, $pageDivide = 50, $order = 'DESC', $orderBy } $output['users'][$i] = $row; - $output['users'][$i]['secondsSinceScored'] = $secondsSinceScored; + //$output['users'][$i]['secondsSinceScored'] = $secondsSinceScored; $output['users'][$i]['background'] = $background; $output['users'][$i]['isUser'] = $userPosition == $i; } // END WHILE @@ -846,7 +845,9 @@ function getScores($mapID, $pageNumber = 1, $pageDivide = 10) { $pageReqEnd = $tmp[1]; } - $userID = $_SESSION['userID']; + $userID = 0; + if (isset($_SESSION['userID'])) $userID = $_SESSION['userID']; + $myBestMoves = 0; if ($isBlindMap) { $sql = "SELECT `moves` FROM `solutions` WHERE `mapID` = '$mapID' AND `userID` = '$userID'"; @@ -904,7 +905,7 @@ function getScores($mapID, $pageNumber = 1, $pageDivide = 10) { $output['bestBy'] = $row['display']; } - if ($_SESSION['userID'] == $requestedUserID) { + if (isset($_SESSION['userID']) AND $_SESSION['userID'] == $requestedUserID) { $userPosition = $i; //$myBestMoves = $moves; } else { diff --git a/pages/login.php b/pages/login.php index f893683..f73ca8c 100644 --- a/pages/login.php +++ b/pages/login.php @@ -1,6 +1,6 @@ @@ -51,7 +55,7 @@ a:hover {