diff options
author | Patrick Davison <snapwilliam@gmail.com> | 2013-05-16 17:19:15 -0700 |
---|---|---|
committer | Patrick Davison <snapwilliam@gmail.com> | 2013-05-16 17:19:15 -0700 |
commit | 329cc1f9b6657ce580b3a297e39a7cd259a62537 (patch) | |
tree | dca09b3a78fcdb9a39646f8968312bf0c722b455 | |
parent | c6e4239a672d2456c67e219da480a63f77056723 (diff) | |
download | pathery-329cc1f9b6657ce580b3a297e39a7cd259a62537.tar.xz |
More PHP warning and notice fixes.
-rw-r--r-- | ajax/chat.ajax.php | 4 | ||||
-rw-r--r-- | ajax/scores.ajax.php | 2 | ||||
-rw-r--r-- | do.php | 17 | ||||
-rw-r--r-- | favicon.ico | bin | 1406 -> 1406 bytes | |||
-rw-r--r-- | globe.php | 3 | ||||
-rw-r--r-- | includes/datas.php | 15 | ||||
-rw-r--r-- | pages/login.php | 7 | ||||
-rw-r--r-- | 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 @@ <?
session_start();
-$userID = $_SESSION['userID'];
+//$userID = $_SESSION['userID'];
require('../includes/maps.php');
require('../includes/mapclass.php');
@@ -173,8 +173,12 @@ if ($_GET['r'] == 'getpath') { $encoded = json_encode($json);
die($encoded);
}
-
-
+ //TODO: !! tutorial complete hackery!
+ if ($mapID == 5 && $moves == 75 && $accepted == false) {
+ $_SESSION['preCompletedTutorial'] = true;
+ $_SESSION['preCompletedTutorialNotified'] = false;
+ }
+
if ($_GET['isChallenge'] == 'true') {
if (isChallengeMap($mapID)) {
// $firephp->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 Binary files differindex 71cd1b2..4609f20 100644 --- a/favicon.ico +++ b/favicon.ico @@ -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 @@ <?php
if ($accepted) {
- if ($_GET['mobile'] == 'true') {
+ if (isset($_GET['mobile']) AND $_GET['mobile'] == 'true') {
header("Location: $mydomain"."easytoken");
exit;
}
@@ -160,9 +160,10 @@ try { setcookie("doLogin", "yes", $expire);
setcookie("auth", $three, $expire);
-
+ $refTo = null;
+ if (isset($_GET['ref'])) $refTo = $_GET['ref'];
//DoRedirect("Thank you $display.", $_GET['ref']);
- DoRedirect("", $_GET['ref'], 0);
+ DoRedirect("", $refTo, 0);
exit;
} //Okay well, we considered logging in at least, right?
else {
diff --git a/redirect.php b/redirect.php index 4732002..4161e7d 100644 --- a/redirect.php +++ b/redirect.php @@ -1,7 +1,11 @@ <?
$to = $_GET['to'];
-include('globe.php');
+include_once('globe.php');
if ($to == '') $to = $mydomain;
+
+$time = 3;
+
+
?>
<html>
@@ -51,7 +55,7 @@ a:hover { <script>
-var timeLeft = 5;
+var timeLeft = "<? echo $time; ?>";
var countdownRedirectInt = self.setInterval(countdownRedirect, 1000);
function countdownRedirect() {
@@ -72,7 +76,7 @@ function countdownRedirect() { <body>
<div class='update'>
-<h3 id='redirectTitle'>You are being redirected in 5 seconds</h3>
+<h3 id='redirectTitle'>You are being redirected in <? echo $time; ?>" seconds</h3>
<p>Let's go!: <a href='<? echo $to; ?>'><? echo $to; ?></a></p>
<p>Back to: <a href='<? echo $mydomain; ?>' title='Go back'><? echo $mydomain; ?></a>
|