diff options
author | Patrick Davison <snapwilliam@gmail.com> | 2013-02-09 15:37:46 -0800 |
---|---|---|
committer | Patrick Davison <snapwilliam@gmail.com> | 2013-02-09 15:37:46 -0800 |
commit | b40457114a6f5796229357555c80dfef74937a40 (patch) | |
tree | 21669b29bba7c64a0a030cf50aaabad92cc11a27 /includes | |
parent | 519b360a15bfdeb1aa5cc560281f97def797050a (diff) | |
download | pathery-b40457114a6f5796229357555c80dfef74937a40.tar.xz |
Code cleanup / deletions.
Diffstat (limited to 'includes')
-rw-r--r-- | includes/datas.php | 145 | ||||
-rw-r--r-- | includes/header.php | 11 | ||||
-rw-r--r-- | includes/maps.php | 4 |
3 files changed, 9 insertions, 151 deletions
diff --git a/includes/datas.php b/includes/datas.php index 3f65466..c64edd6 100644 --- a/includes/datas.php +++ b/includes/datas.php @@ -9,69 +9,6 @@ include_once('constants.php'); //require_once('includes/FirePHPCore/FirePHP.class.php'); //FirePHP stuff - TODO: Delete -//Select Stats/Scores. -function topScores($mapid, $top = 5, $bottom = 0) { - $sql = " - SELECT - timediff(solutions.dateModified, TIMESTAMP(CURDATE())) as diff, - users.displayName as display, - solutions.moves as m, - users.ID as ID, - users.displayColor, - users.wallColor, - users.wallEmblem, - solutions.dateModified as cdate - FROM - `users` - JOIN `solutions` - ON users.ID = solutions.userID - WHERE solutions.mapID = '$mapid' - ORDER BY solutions.moves DESC, solutions.dateModified ASC - LIMIT $bottom, $top - "; - $result = mysql_query($sql) or die(mysql_error()); - $utime = date("g:i A (T)"); - $output = "<table class='score'>"; - $output .= "<tr title='Updated $utime'>"; - $output .= "<th>Rank</th>"; - $output .= "<th>Badge</th>"; - $output .= "<th>Name</th>"; - $output .= "<th>Moves</th>"; - //$output .= "<th title='Time since map generation'>Time</th>"; - $output .= "</tr>"; - while (list($diff, $display, $moves, $userID, $displayColor, $wallColor, $wallEmblem, $cdate) = mysql_fetch_row($result)) { - $i++; - - //$cdate = date("g:i A (T)", strtotime($cdate)); - $cdate = relativeTime(strtotime($cdate)); - - $background = '#262631'; - if ($i % 2 == 1) - $background = '#20202a'; - - if ($_SESSION['userID'] == $userID) - $background = '#343c57'; - //$background = '#356'; - - $output .= "<tr style='background-color: $background; color:$displayColor;' "; - $output .= "title='Scored $cdate'>"; - - $output .= "<td>$i</td> -<td> - <div class='grid_td' style='width:35px; height:35px; background:$wallColor url(images/marks/$wallEmblem);'> - <div style='background-color:transparent;' class='grid_td_inner grid_td_rocks'> - </div> - </div> -</td> -<td><span title='UserID: $userID'><a href='achievements?id=$userID' style='color:$displayColor'>$display</a></span></td> -<td>$moves</td>\n"; - //$output .= "<td >$diff</td>"; - $output .= "</tr>"; - } - $output .= "</table>"; - return $output; -} - //Returns text refering to any notifications. function getNotified($userID) { @@ -738,9 +675,6 @@ function getMembers($pageNumber = 1, $pageDivide = 50, $order = 'DESC', $orderBy //These values are now confirmed. $sqlOrder = "ORDER BY `$orderBy` $order"; - $top = $pageNumber * $pageDivide; - $bottom = $top - $pageDivide; - $limitTop = ($pageNumber - 1) * $pageDivide; $sql = "SELECT COUNT(*) as 'count' FROM `users`"; @@ -799,25 +733,11 @@ function getMembers($pageNumber = 1, $pageDivide = 50, $order = 'DESC', $orderBy while ($row = mysql_fetch_assoc($result)) { $i++; - $moves = $row['moves']; - $userID = $row['ID']; if ($_SESSION['userID'] == $userID) { $userPosition = $i; } - // } else { - // if ($i > $top) - // continue; - // if ($i <= $bottom) - // continue; - // } - if ($wallEmblem == '') - $wallEmblem = 'blank.png'; - - $cdate = $row['cdate']; - $cdate = date("g:i A (T)", strtotime($cdate)); - $row['dateJoined'] = Date("Y-m-d", strtotime($row['dateJoined'])); $row['dateLogin'] = Date("Y-m-d", strtotime($row['dateLogin'])); @@ -834,43 +754,12 @@ function getMembers($pageNumber = 1, $pageDivide = 50, $order = 'DESC', $orderBy $foundUser = true; } - // if is blind map. - // $row['moves'] = '???'; - $output['users'][$i] = $row; - $output['users'][$i]['scoredDate'] = $cdate; $output['users'][$i]['secondsSinceScored'] = $secondsSinceScored; $output['users'][$i]['background'] = $background; - $output['users'][$i]['medal'] = $medal; $output['users'][$i]['isUser'] = $userPosition == $i; - //$output['users'][$i]['debug'] = "Bestmoves: $bestMoves moves: $moves"; } // END WHILE - //Need to look this up. - //$output['pageCount'] = ceil(($i / $pageDivide)); - //$output['pageCount'] = 5; - if ($prevPage > 0) { - $navi .= " <a href='javascript:scoresShowPage($mapid, 1);'><<</a> "; - $navi .= " <a href='javascript:scoresShowPage($mapid, $prevPage);'><</a> "; - } else { - $navi .= " << "; - $navi .= " <"; - } - for ($x = 1; $x <= $pageCount; $x++) { - if ($x < $pageNumber - 3 OR $x > $pageNumber + 3) - continue; - if ($x == $pageNumber) - $navi .= "<strong> $x </strong>"; - elseif ($userPage == $x) - $navi .= " <a href='javascript:scoresShowPage($mapid, $x)'><i>$x</i></a> "; - else - $navi .= " <a href='javascript:scoresShowPage($mapid, $x)'>$x</a> "; - } - if ($nextPage <= $pageCount) { - $navi .= " <a href='javascript:scoresShowPage($mapid, $nextPage);'>></a> "; - $navi .= " <a href='javascript:scoresShowPage($mapid, $pageCount);'>>></a> "; - } - return $output; } @@ -962,12 +851,6 @@ function getScores($mapID, $pageNumber = 1, $pageDivide = 10) { continue; } - if ($wallEmblem == '') - $wallEmblem = 'blank.png'; - - $cdate = $row['cdate']; - $cdate = date("g:i A (T)", strtotime($cdate)); - $scoredDate = strtotime($row['cdate']); $secondsSinceScored = strtotime("now") - $scoredDate ; @@ -988,16 +871,13 @@ function getScores($mapID, $pageNumber = 1, $pageDivide = 10) { $medal = 'gold'; // if is blind map. - if ($isBlindMap AND $myBestMoves < $moves) - $row['moves'] = '???'; + if ($isBlindMap AND $myBestMoves < $moves) $row['moves'] = '???'; $output['users'][$i] = $row; - $output['users'][$i]['scoredDate'] = $cdate; $output['users'][$i]['secondsSinceScored'] = $secondsSinceScored; $output['users'][$i]['background'] = $background; $output['users'][$i]['medal'] = $medal; $output['users'][$i]['isUser'] = $userPosition == $i; - //$output['users'][$i]['debug'] = "Bestmoves: $bestMoves moves: $moves"; } // END WHILE if ($foundUser) { @@ -1007,29 +887,6 @@ function getScores($mapID, $pageNumber = 1, $pageDivide = 10) { } $output['pageCount'] = ceil(($i / $pageDivide)); - - if ($prevPage > 0) { - $navi .= " <a href='javascript:scoresShowPage($mapID, 1);'><<</a> "; - $navi .= " <a href='javascript:scoresShowPage($mapID, $prevPage);'><</a> "; - } else { - $navi .= " << "; - $navi .= " <"; - } - for ($x = 1; $x <= $pageCount; $x++) { - if ($x < $pageNumber - 3 OR $x > $pageNumber + 3) - continue; - if ($x == $pageNumber) - $navi .= "<strong> $x </strong>"; - elseif ($userPage == $x) - $navi .= " <a href='javascript:scoresShowPage($mapID, $x)'><i>$x</i></a> "; - else - $navi .= " <a href='javascript:scoresShowPage($mapID, $x)'>$x</a> "; - } - if ($nextPage <= $pageCount) { - $navi .= " <a href='javascript:scoresShowPage($mapID, $nextPage);'>></a> "; - $navi .= " <a href='javascript:scoresShowPage($mapID, $pageCount);'>>></a> "; - } - return $output; } diff --git a/includes/header.php b/includes/header.php index 428ccfd..e654cd3 100644 --- a/includes/header.php +++ b/includes/header.php @@ -14,11 +14,9 @@ function htmlHeader($css = array(), $title = 'Pathery', $desc = '', $scripts = a foreach ($css as $c) {
echo " <link href=\"css/$c.css\" rel=\"stylesheet\" type=\"text/css\" />\n";
}
- if ($desc !== '')
- echo " <meta name='Description' content='$desc'>";
+ if ($desc !== '') echo " <meta name='Description' content='$desc'>";
- foreach ($scripts as $s)
- echo "<script src='js/$s.js?v=121212'></script>";
+ foreach ($scripts as $s) echo "<script src='js/$s.js?v=122612'></script>";
?>
<script src="js/ajax.js" async="async"></script>
<script src="js/mapspecs.js?v=121212"></script>
@@ -157,10 +155,11 @@ function topbar($links) { echo '<div id="topbar">';
foreach ($links as $key => $value) {
- if ($request == $key)
+ if ($request == $key) {
$selected = " selected";
- else
+ } else {
$selected = "";
+ }
echo "<a href='$key' class='nav$selected'>$value</a>";
}
diff --git a/includes/maps.php b/includes/maps.php index 9ee6984..efe17b8 100644 --- a/includes/maps.php +++ b/includes/maps.php @@ -1,5 +1,6 @@ <?PHP
//Displays the map
+//TODO: SOON TO DEPRECIATE!! YAY!
function DisplayMap($mapMatrix, $idprefix = 1, $style = 'normal', $speed = NULL) {
//Iterate through $mapMatrix and generate the html
$maptable = ""; //The string to return to the database.
@@ -287,6 +288,7 @@ function DisplayMap($mapMatrix, $idprefix = 1, $style = 'normal', $speed = NULL) //This requires the map as an object.
+//TODO: SOON TO DEPRECIATE!
function DisplayMapThumbnail($map, $link = false) {
$r = ''; //Prepare our return value:
@@ -609,7 +611,7 @@ function insertPoint($array, $new, $target = '?') { //Somehow an invalid target got into our list of valid targets...
echo "<br/>";
echo "Error in selecting $indexTarget ($x,$y). Replacement stopped on $new[0].<br/>";
- echo "indexTarget = $indextarget<br/>";
+ echo "indexTarget = $indexTarget<br/>";
echo "indexReplace = $indexReplace<br/>";
echo "array = ";
|