diff options
-rw-r--r-- | do.php | 15 | ||||
-rw-r--r-- | includes/datas.php | 145 | ||||
-rw-r--r-- | includes/header.php | 11 | ||||
-rw-r--r-- | includes/maps.php | 4 | ||||
-rw-r--r-- | js/mapspecs.js | 131 | ||||
-rw-r--r-- | js/scores.js | 3 | ||||
-rw-r--r-- | pages/embed.php | 114 | ||||
-rw-r--r-- | pages/home.php | 5 | ||||
-rw-r--r-- | pages/tutorial.php | 5 |
9 files changed, 38 insertions, 395 deletions
@@ -104,17 +104,6 @@ if ($_GET['r'] == 'reqScorePage') { die($encoded);
}
-if ($_GET['r'] == 'getscores') {
- $mapID = $_GET['mapid'] + 0;
- if (!is_int($mapID))
- return;
- $topscores = topScores($mapID, 30);
- $json['scores'] = $topscores;
- $json['mapid'] = $mapID;
- $encoded = json_encode($json);
- die($encoded);
-}
-
if ($_GET['r'] == 'getsol') {
$mapID = $_GET['mapID'] + 0;
//echo "working...";
@@ -289,8 +278,8 @@ if ($_GET['r'] == 'getpath') { $_SESSION['preCompletedTutorial'] = true;
$_SESSION['preCompletedTutorialNotified'] = false;
}
- if ($accepted == false)
- die(json_encode($json));
+ if ($accepted == false) die(json_encode($json));
+ //TODO: Where's $paths coming from?
getCompletedChallenges($userID, $mapID, $solution, $moves, $paths);
die(json_encode($json));
}
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 = ";
diff --git a/js/mapspecs.js b/js/mapspecs.js index 4adc3d1..adbf5d8 100644 --- a/js/mapspecs.js +++ b/js/mapspecs.js @@ -249,6 +249,7 @@ function clearwalls(mapid) { getmapdata(mapid);
}
+//TODO:An undo button rather than confirm..
function resetwalls(mapid) {
answer = confirm("Remove walls and start fresh?");
if (answer) {
@@ -464,23 +465,7 @@ function doanimate(x, y, p, c, mapid, pathNumber) { //Outs
case 'u': case 'n': case 'h': case 'j': case 'l':
- case 'r':
- // if (handle.pressed == true)
- // break;
- //case 'a': case 'b': case 'c': case 'd': case 'e':
-
- //handle.setAttribute('class', 'grid_td_pressed');
- //handle.classOrigName = 'grid_td_pressed';
- //if (handle.pressed == true) {
-
- //var currentColor = rgbStringToHex(handle.style.backgroundColor);
- //if (currentColor == '')
- // break;
- //var dulled = '#'+dullColor(currentColor, .6);
- //console.log('bgcolor', dulled, currentColor);
- //handle.style.backgroundColor = dulled;
- //setTimeout("document.getElementById('"+eid+"').style.backgroundColor = '"+dulled+"';", 865);
-
+ case 'r':
if (mapdata[mapid].isMultiPath == false) {
handle.style.backgroundColor = '#dddddd';
setTimeout("document.getElementById('"+eid+"').style.backgroundColor = '#dddddd';", 865);
@@ -723,7 +708,6 @@ function targetColor(target) { }
-
function flashelement(eid, times, color, speed) {
if (document.getElementById(eid) == undefined) return;
if (!color) {
@@ -769,82 +753,6 @@ function contains(a, obj) { }
-function dullColor(colorAsHex, value) {
- var r = hexToR(colorAsHex);
- var g = hexToG(colorAsHex);
- var b = hexToB(colorAsHex);
-
- r = r + ((221 - r) * value)
- g = g + ((221 - g) * value)
- b = b + ((221 - b) * value)
- r = parseInt(r);
- g = parseInt(g);
- b = parseInt(b);
- return rgbToHex(r, g, b);
-}
-
-//Color modifications
-// Thanks javascripter.net
-function rgbToHex(R,G,B) {
- return toHex(R)+toHex(G)+toHex(B)
- }
-function toHex(n) {
- n = parseInt(n,10);
- if (isNaN(n)) return "00";
- n = Math.max(0,Math.min(n,255));
- return "0123456789ABCDEF".charAt((n-n%16)/16)
- + "0123456789ABCDEF".charAt(n%16);
-}
-function hexToR(h) {
- return parseInt((cutHex(h)).substring(0,2),16)
- }
-function hexToG(h) {
- return parseInt((cutHex(h)).substring(2,4),16)
- }
-function hexToB(h) {
- return parseInt((cutHex(h)).substring(4,6),16)
- }
-function cutHex(h) {
- return (h.charAt(0)=="#") ? h.substring(1,7):h
- }
-
-//Thanks stackExchange
-function rgbStringToHex(rgbString) {
- if (rgbString == '')
- return '';
- // var rgbString = "rgb(0, 70, 255)"; // get this in whatever way.
-
- var parts = rgbString.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/);
- // parts now should be ["rgb(0, 70, 255", "0", "70", "255"]
-
- delete (parts[0]);
- for (var i = 1; i <= 3; ++i) {
- parts[i] = parseInt(parts[i]).toString(16);
- if (parts[i].length == 1) parts[i] = '0' + parts[i];
- }
- return hexString ='#'+parts.join('').toUpperCase(); // "#0070FF"
-}
-
-var ignoreMuteChecks = false;
-function setMute(value)
-{
- if(!ignoreMuteChecks)
- {
- //Prevent changes to other checkboxes from calling this function:
- ignoreMuteChecks = true;
-
- //Set all other checkboxes
- var muteButtons = document.getElementsByClassName("checkbox_mute");
- for(var i=0; i < muteButtons.length; i++)
- {
- muteButtons[i].checked = value;
- }
- savePref('mute', value);
-
- ignoreMuteChecks = false;
- }
-}
-
//Shows a solution temporarly
function useSolution(mapid, inputSolution, moves, tempWallColor, tempWallEmblem) {
solution[mapid] = inputSolution;
@@ -857,7 +765,7 @@ function useSolution(mapid, inputSolution, moves, tempWallColor, tempWallEmblem) setTimeout(animateA, 250);
setTimeout(animateB, 450);
}
-//TODO
+//Shows a solution for temporary use, see 'RestoreSolution'
function showTempSolution(mapid, tempSolution, moves, tempWallColor, tempWallEmblem) {
//console.log('showTempSolution', mapid, solution, moves, tempWallColor, tempWallEmblem);
@@ -884,14 +792,12 @@ function showTempSolution(mapid, tempSolution, moves, tempWallColor, tempWallEmb mapdata[mapid].savedSolution = savedSolution;
}
-
+//Restores a solution after a showTempSolution
function restoreSolution(mapid) {
showTempSolution(mapid, mapdata[mapid].savedSolution, 0, false, false);
}
-
-//NEW MAP INSERTING METHOD
-//Map as object.
+//Map as object. If target width is NULL or False, default width is used.
function mapAsHTML(map, targetWidth, demo) {
console.log("loading MapHTML for ", map);
@@ -985,6 +891,26 @@ function mapAsHTML(map, targetWidth, demo) { return r;
}
+var ignoreMuteChecks = false;
+function setMute(value)
+{
+ if(!ignoreMuteChecks)
+ {
+ //Prevent changes to other checkboxes from calling this function:
+ ignoreMuteChecks = true;
+
+ //Set all other checkboxes
+ var muteButtons = document.getElementsByClassName("checkbox_mute");
+ for(var i=0; i < muteButtons.length; i++)
+ {
+ muteButtons[i].checked = value;
+ }
+ savePref('mute', value);
+
+ ignoreMuteChecks = false;
+ }
+}
+
function getMuteOption(mapID) {
var selectedSpeed = 2;
var r = '';
@@ -1016,13 +942,6 @@ function getSpeedOptions(mapID) { r += " </select>";
return r;
}
-//END METHOD
-
-
-
-
-
-
function savePref(pref, value) {
diff --git a/js/scores.js b/js/scores.js index c327fe2..47a37c3 100644 --- a/js/scores.js +++ b/js/scores.js @@ -480,6 +480,3 @@ function membersFormatPage(JO) { p = p+"</table>";
return p;
}
-
-
-
diff --git a/pages/embed.php b/pages/embed.php index 7d7e615..ba3ca3d 100644 --- a/pages/embed.php +++ b/pages/embed.php @@ -1,113 +1 @@ -<?PHP
-htmlHeader();
-?>
-
-<body>
-<script type="text/javascript" src="sounds/script/soundmanager.js"></script>
-
-<?php
-include('./includes/maps.php');
-include('./includes/mapoftheday.php');
-
-include('./includes/datas.php');
-
-
-
-//Get the current day as int.
-$numday = date('w');
-$numday = intval($numday);
-switch ($numday) {
- case 0:
- $mapstyle = 'Thirty';
- break;
- case 1:
- $mapstyle = 'Simple';
- break;
- case 2:
- $mapstyle = "ABC's";
- break;
- case 3:
- $mapstyle = 'Teleport Madness';
- break;
- case 4:
- $mapstyle = 'Rocky Maze';
- break;
- case 5: //Friday
- $mapstyle = 'Side to Side';
- break;
- case 6: //Saturday
- $mapstyle = "Seeing Double";
- break;
-}
-
-$normal = 'Normal';
-$easy = 'Simple';
-$hard = 'Complex';
-
-$today = date('l');
-//if ($today == 'Sunday' OR $today == 'Saturday')
- //$today = 'Weekend Map';
-//else
- $today .= "'s";
-$special = "$today $mapstyle";
-
-switch ($_GET['maptype']) {
- case "normal":
- case "2":
- $maptype = 2;
- $normal = '<b>Normal</b>';
- break;
-
- case "hard":
- case "3":
- $maptype = 3;
- $hard = '<b>Complex</b>';
- break;
-
- case "day":
- case "4":
- $maptype = 4;
- $special = "<b>$special</b>";
- break;
-
- case "easy":
- case "1":
- default:
- $maptype = 1;
- $easy = '<b>Simple</b>';
-}
-
-$motd = MapOfTheDay($maptype);
-$mapID = $motd['id'];
-$map = $motd['map'];
-$userID = $_SESSION['userID'];
-$date = date("m-d-y");
-//$mergesolution = mergeMapSolution($map, $mysolution);
-$topscores = topScores($motd['id'], 30);
-$topscorediv = "<div id='$mapID,dspScore'>\n$topscores\n</div>";
-$mergesolution = $map;
-
-?>
-<div class="col2" style="text-align: center">
-<?
-echo "$date: <a href='embed?maptype=easy'>Easy</a> | ";
-echo "<a href='embed?maptype=normal'>Normal</a> | ";
-echo "<a href='embed?maptype=hard'>Hard</a> | ";
-echo "<a href='embed?maptype=day'>Special</a>";
-
-echo DisplayMap($mergesolution, $mapID);
-
-$mysolution = getSolution($userID, $mapID);
-$solutiondiv .= "<div id='mapsol' style='visibility:hidden;display:none'>";
-//$solutiondiv .= "<div id='mapsol'>";
-$solutiondiv .= $mapID.":".$mysolution;
-$solutiondiv .= '</div>';
-
-echo $solutiondiv;
-?>
-<a href="http://www.pathery.com">www.pathery.com</a>
-</div>
-<script type="text/javascript">soundManagerInit();</script>
-
-</body>
-</html>
+Service no longer available.
\ No newline at end of file diff --git a/pages/home.php b/pages/home.php index f8841b5..cc94068 100644 --- a/pages/home.php +++ b/pages/home.php @@ -196,11 +196,6 @@ function displayMaze($motd, $mapType) { //Gather data for map;
$mapID = $motd['id'];
$map = $motd['map'];
- $width = $map[0][0];
-
- //data for the topscores
- //$topscores = topScores($motd['id'], 30);
- //$topscorediv = "<div id='$mapID,dspScore'>\n$topscores\n</div>";
$topscorediv = "
<div class='scoreContainer2' style='position:relative;' id='$mapID,dspScore'>
diff --git a/pages/tutorial.php b/pages/tutorial.php index 88095da..10e5372 100644 --- a/pages/tutorial.php +++ b/pages/tutorial.php @@ -1,8 +1,5 @@ <?php
-if ($request == 'tutorial')
- htmlHeader(array('tutorial'), 'Pathery Tutorial', 'How to play Pathery', array('scores') );
-else
- htmlHeader(array('tutorial'), 'Pathery', 'Compete to create the longest maze possible. 4 New maps every day at 9 PM Pacific', array('scores') );
+htmlHeader(array('tutorial'), 'Pathery', 'Compete to create the longest maze possible. 4 New maps every day at 9 PM Pacific', array('scores') );
?>
<body>
|