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/datas.php | |
parent | 519b360a15bfdeb1aa5cc560281f97def797050a (diff) | |
download | pathery-b40457114a6f5796229357555c80dfef74937a40.tar.xz |
Code cleanup / deletions.
Diffstat (limited to 'includes/datas.php')
-rw-r--r-- | includes/datas.php | 145 |
1 files changed, 1 insertions, 144 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; } |