diff options
91 files changed, 1383 insertions, 534 deletions
@@ -18,10 +18,18 @@ RewriteRule ^([a-z]+)$ /index\.php?page=$1 [QSA,NC] # GetMap Re-write
RewriteRule ^map/(.*)$ /ajax/maps\.ajax\.php?mapid=$1 [QSA,NC]
+RewriteRule ^a/map/(.*)$ /ajax/maps\.ajax\.php?mapid=$1 [QSA,NC]
+
+RewriteRule ^a/mapsbydate/(.*)$ /ajax/maps\.ajax\.php?getmapidsbydate=$1 [QSA,NC]
RewriteRule ^challenge/(.*)$ /ajax/challenges\.ajax\.php?challengeid=$1 [QSA,NC]
+RewriteRule ^a/challenge/(.*)$ /ajax/challenges\.ajax\.php?challengeid=$1 [QSA,NC]
RewriteRule ^user/(.*)$ /ajax/users\.ajax\.php?userid=$1 [QSA,NC]
+RewriteRule ^a/user/(.*)$ /ajax/users\.ajax\.php?userid=$1 [QSA,NC]
+
+RewriteRule ^a/score/(.*)$ /ajax/scores\.ajax\.php?r=$1 [QSA,NC]
+
# CSS and JS cache for 480 weeks
diff --git a/ajax/chat.ajax.php b/ajax/chat.ajax.php index ae00b6f..7f5684c 100644 --- a/ajax/chat.ajax.php +++ b/ajax/chat.ajax.php @@ -1,13 +1,36 @@ <?
session_start();
+if (strtotime('now') - $_SESSION['chatLastReset'] > 6) {
+ $_SESSION['chatSendCount'] = 0;
+ $_SESSION['chatLastReset'] = strtotime('now');
+}
+if ($_REQUEST['messages']) {
+ $_SESSION['chatSendCount']++;
+ if ($_SESSION['chatSendCount'] > 4) {
+ $r[0]['error'] = 'Spam';
+ $r[0]['serverMessage'] = 'true';
+ $r[0]['message'] = "You're talking too fast - or your internet is being too slow. *OR ARE YOU SPAMMING ON PURPOSE?! JERK!*";
+ $r[0]['secondsSince'] = 0;
+ $r[0]['displayName'] = 'SERVER';
+ $r[0]['userID'] = -1;
+ echo json_encode($r);
+ exit;
+ }
+}
+//Don't lockout requests by holding the session file open!
session_write_close();
-//Just doing this as evidence that $_SESSION as read-only is still available.
$userID = $_SESSION['userID'];
$chatLockDown = false;
// STOP CHAT?
//$chatLockDown = true;
+if (true) {
+ if ($_SESSION['accepted'] !== 1) {
+ exit;
+ }
+}
+
require('../includes/chats.php');
$sent = false;
@@ -49,10 +72,13 @@ if ($_REQUEST['messages']) { $insertID = addchat(-1, substr($message, 5));
}
}
- //Anyone commands:
+ //javascript based commands:
+ if ($command == 'spoiler' OR $command == 'me') {
+ $insertID = addchat($userID, $message);
+ }
if ($command == 'help') {
$r[0]['serverMessage'] = 'true';
- $r[0]['message'] = "Commands: /help /time . - Chat by Pathery.com";
+ $r[0]['message'] = "Commands: /help /time /spoiler /me. Surround text with ** for bold * for italics and ~~ for strikethrough. Chat by Pathery.com";
$r[0]['secondsSince'] = 0;
$r[0]['userID'] = -1;
echo json_encode($r);
@@ -66,7 +92,7 @@ if ($_REQUEST['messages']) { echo json_encode($r);
exit;
}
- } else {
+ } else {
$insertID = addchat($userID, $message);
}
}
@@ -97,7 +123,6 @@ if ($_REQUEST['getChatFromID']) { }
exit;
-
function prepareChatData($data) {
if ($data) {
foreach($data as &$user) {
@@ -109,26 +134,40 @@ function prepareChatData($data) { return $data;
}
-
function chatFilter($chat) {
//cuss words
$chat = str_ireplace("fuck you", "i am moron", $chat);
- $chat = preg_replace("[fF]+\s*[uUvV]+\s*[hH]*\s*[cC\(kK]+\s*[iI]*\s*[nN]*\s*[gG]*", "dumb", $chat);
- $chat = str_ireplace("asshole", "dumb", $chat);
- $chat = str_ireplace("damnit", "do'h", $chat);
+ $chat = preg_replace("/[f]+\s*[uv]+\s*[h]*\s*[c\(k]+\s*(([i]*\s*[n]*\s*[g])|([e]*\s*[r]*))*/i", "dumb ", $chat); //fucker / fucking
+ $chat = preg_replace("/[^a-z]fag(g?[oi]t)?/i", " prince", $chat); //faggot
+ $chat = preg_replace("/^fag(g?[oi]t)?/i", "prince", $chat); //faggot (beginning of line)
+ $chat = preg_replace("/^suck\s*my.*(cock|dick|penis)/i", "join me in a riveting game of checkers", $chat); //suck my dick
+
$chat = str_ireplace("damn", "dumb", $chat);
- $chat = str_ireplace("cunt", "dumb", $chat);
$chat = str_ireplace("shit", "dumb", $chat);
- $chat = str_ireplace("bitch", "dumb", $chat);
- $chat = str_ireplace("cock", "elbow", $chat);
$chat = str_ireplace("sucks ass", "is dumb", $chat);
$chat = str_ireplace("suck ass", "are dumb", $chat);
+ $chat = str_ireplace("damnit", "do'h", $chat);
+
+ $chat = str_ireplace("a bitch", "an engaging conversationalist", $chat);
+ $chat = str_ireplace("bitch", "engaging conversationalist", $chat);
+ $chat = str_ireplace("an asshole", "a pleasant person to be around", $chat);
+ $chat = str_ireplace("asshole", "pleasant person to be around", $chat);
+
+ $chat = str_ireplace("cock", "elbow", $chat);
+ $chat = str_ireplace("dick", "elbow", $chat);
+ $chat = str_ireplace("penis", "elbow", $chat);
+ $chat = str_ireplace("vagina", "femur bone", $chat);
+ $chat = str_ireplace("cunt", "femur bone", $chat);
+
+ $chat = str_ireplace("hell", "the supermarket", $chat);
+ $chat = str_ireplace("whore", "entrepreneur", $chat);
$chat = str_ireplace("stfu", "be still my beating heart", $chat);
$chat = str_ireplace("omfg", "omg", $chat);
+ $chat = str_ireplace("4chan", "NEWT GINGRICH", $chat);
+ $chat = str_ireplace("nigger", "classy gentleman", $chat);
+ $chat = str_ireplace("pedophile", "Optimus Prime", $chat);
+ $chat = str_ireplace("pedo", "Optimus Prime", $chat);
+ $chat = str_ireplace("rape", "shake hands with", $chat);
return $chat;
}
-
-
-
-
?>
\ No newline at end of file diff --git a/ajax/maps.ajax.php b/ajax/maps.ajax.php index 611080d..8ceade5 100644 --- a/ajax/maps.ajax.php +++ b/ajax/maps.ajax.php @@ -3,21 +3,35 @@ ob_start("ob_gzhandler"); include('../includes/mapclass.php');
include('../includes/maps.php');
+include('../includes/sqlEmbedded.php');
-//Remove the ending .js
-$tmp = explode(".", $_GET['mapid']);
-$mapID = $tmp[0] * 1;
-if (!is_int($mapID)) exit;
-
-$map = getMapObjectByID($mapID);
+if (isset($_GET['getmapidsbydate'])) {
+ //Remove the ending .js
+ $tmp = explode(".", $_GET['getmapidsbydate']);
+ $requestDate = $tmp[0];
+ sendCacheHeaders();
+ echo json_encode(getMapIDsByDate($requestDate));
+ exit;
+}
+if (isset($_GET['mapid'])) {
+ //Remove the ending .js
+ $tmp = explode(".", $_GET['mapid']);
+ $mapID = $tmp[0] * 1;
+ if (!is_int($mapID)) exit;
+ $map = getMapObjectByID($mapID);
+ sendCacheHeaders();
+ echo json_encode($map);
+ exit;
+}
-$expires = 365*24*60*60;
-//TODO: Remove this line once we're confident in data in the mapObject.
-$expires = 1*24*60*60;
-header("Cache-Control: public, maxage=".$expires);
-header('Expires: ' . gmdate('D, d M Y H:i:s', time()+$expires) . ' GMT');
-header("Content-type: text/javascript");
-echo json_encode($map);
+function sendCacheHeaders() {
+ $expires = 365*24*60*60;
+ //TODO: Remove this line once we're confident in data in the mapObject.
+ $expires = 120;
+ header("Cache-Control: public, maxage=".$expires);
+ header('Expires: ' . gmdate('D, d M Y H:i:s', time()+$expires) . ' GMT');
+ header("Content-type: text/javascript");
+}
function getMapObjectByID($mapID) {
include_once('../includes/sqlEmbedded.php');
@@ -37,5 +51,27 @@ function getMapObjectByID($mapID) { }
}
+function getMapIDsByDate($date) {
+ global $mysqli;
+ $sql = "SELECT MIN(mapOfTheDay.mapId) AS mapId
+ FROM `mapOfTheDay`
+ INNER JOIN
+ (
+ SELECT mapType, MIN(mapExpireTime) AS mapExpireTime
+ FROM mapOfTheDay
+ WHERE mapExpireTime > ?
+ GROUP BY mapType
+ ) AS expireTimes ON mapOfTheDay.mapType = expireTimes.mapType
+ AND mapOfTheDay.mapExpireTime = expireTimes.mapExpireTime
+ GROUP BY mapOfTheDay.mapType";
+ $stmt = $mysqli->prepare($sql);
+ $stmt->bind_param("s", $date);
+ $stmt->execute();
+ $stmt->bind_result($mapID);
+ while ($stmt->fetch()) {
+ $ids[] = $mapID;
+ }
+ return $ids;
+}
?>
\ No newline at end of file diff --git a/ajax/scores.ajax.php b/ajax/scores.ajax.php index 7ba25d0..f2d38fc 100644 --- a/ajax/scores.ajax.php +++ b/ajax/scores.ajax.php @@ -8,153 +8,37 @@ $userID = $_SESSION['userID']; require('../includes/maps.php');
require('../includes/mapclass.php');
require('../includes/datas.php');
-include_once('../includes/sqli.php');
-
-if ($_GET['getmap'] == 'true') {
- $mapID = $_GET['mapID'];
- $code = getMapCode($mapID);
- $map = GenerateMapByCode($code);
- echo displaymap($map, $mapID);
-}
-
-
-if ($_GET['getscores'] == 'true') {
-
-}
-
-if ($_GET['getmaplist'] == 'true') {
- $daysAgo = $_GET['daysago'];
- //echo "$daysAgo";
- $todaysScoreMaps = getMapsPlayed($daysAgo);
- echo getMapNavigation($todaysScoreMaps);
-}
-
-if (isset($_GET['getmapidsbydate'])) {
- //TODO: SANATIZE
- $requestDate = $_GET['getmapidsbydate'];
- echo json_encode(getMapIDsByDate($requestDate));
-}
-
-// Here is that SQL for you
-// SELECT correctMapIds.mapType, maps.ID, maps.code
-// FROM maps
-// INNER JOIN
-// (
- // SELECT MIN(mapOfTheDay.mapId) AS mapId, mapOfTheDay.mapType
- // FROM `mapOfTheDay`
- // INNER JOIN
- // (
- // SELECT mapType, MIN(mapExpireTime) AS mapExpireTime
- // FROM mapOfTheDay
- // WHERE mapExpireTime > DATE_ADD(CURDATE(), INTERVAL -1 DAY)
- // GROUP BY mapType
- // ) AS expireTimes ON mapOfTheDay.mapType = expireTimes.mapType
- // AND mapOfTheDay.mapExpireTime = expireTimes.mapExpireTime
- // GROUP BY mapOfTheDay.mapType
-// ) AS correctMapIds ON maps.ID = correctMapIds.mapId
-
-//TODO: SANITIZE.
-function getMapIDsByDate($date) {
- global $mysqli;
-$sql = "SELECT MIN(mapOfTheDay.mapId) AS mapId
-FROM `mapOfTheDay`
-INNER JOIN
-(
- SELECT mapType, MIN(mapExpireTime) AS mapExpireTime
- FROM mapOfTheDay
- WHERE mapExpireTime > ?
- GROUP BY mapType
-) AS expireTimes ON mapOfTheDay.mapType = expireTimes.mapType
- AND mapOfTheDay.mapExpireTime = expireTimes.mapExpireTime
-GROUP BY mapOfTheDay.mapType";
-
-$stmt = $mysqli->prepare($sql);
-$stmt->bind_param("s", $date);
-$stmt->execute();
-
- $stmt->bind_result($mapID);
- /* fetch values */
- while ($stmt->fetch()) {
- $ids[] = $mapID;
- }
-
- return $ids;
-
-var_dump($ids);
-
-
-while ($myrow[] = $result->fetch_assoc()) {}
-
- $result = mysql_query($sql) or die(mysql_error());
- if (mysql_num_rows($result) == 0) return -1;
- global $mapNamesByType;
- $r = array();
- while($data[] = mysql_fetch_array($result)) {
- $mapID = $data['mapID'];
- $mapType = $data['mapType'];
- $map = new map($code);
- if ($map->name == '')
- $map->name = $mapNamesByType[$mapType];
- $r[$mapID] = $map;
+include_once('../includes/sqlEmbedded.php');
+
+$tmp = explode('.', $_GET['r']);
+$args = explode('_', $tmp[0]);
+$mapID = $args[0] * 1;
+$page = $args[1] * 1;
+
+if (!is_int($mapID) OR !is_int($page)) return;
+
+//Include the notification text
+$json = getScores($mapID, $page, 10);
+$json['mapid'] = $mapID;
+$json['page'] = $page;
+
+//TODO: Show notifications someplace else!
+$note = false;
+if ($_SESSION['accepted'] == 1) {
+ $userID = $_SESSION['userID'];
+ $note = getNotified($userID);
+} else {
+ if ($_SESSION['preCompletedTutorial'] == true && $_SESSION['preCompletedTutorialNotified'] == false) {
+ $_SESSION['preCompletedTutorialNotified'] = true;
+ $note = "<strong>Tutorial Completed!</strong>";
+ $note .= "<center>You've unlocked: Blue Wall Color!";
+ $note .= "<table><tr><td onclick='changeWallColor(\"#4444ff\")' style='background-color:#4444ff;' class='grid_td_rocks'></td></tr></table>";
+ $note .= '<br /><a href="javascript:showSignin();"><strong>Sign in</strong></a> to save your progress!<br />';
+ $note .= "</center>";
}
- return $myrow;
}
+if ($note !== false) $json['notificationtext'] = $note;
-
-function getMapsPlayed($daysAgo) {
- // $sql = "
- // SELECT `mapID`, `code`, `mapType`
- // FROM `mapOfTheDay`
- // INNER JOIN `maps` ON `mapID` = maps.ID
- // WHERE DATE_ADD(CURDATE(), INTERVAL -$daysAgo DAY) =
- // mapDate AND
- // `mapType` IN (1, 2, 3, 4, 5)
- // ";
-
- $sql = "SELECT correctMapIds.mapType, maps.ID as mapID, maps.code
-FROM maps
-INNER JOIN
-(
- SELECT MIN(mapOfTheDay.mapId) AS mapId, mapOfTheDay.mapType
- FROM `mapOfTheDay`
- INNER JOIN
- (
- SELECT mapType, MIN(mapExpireTime) AS mapExpireTime
- FROM mapOfTheDay
- WHERE mapExpireTime > DATE_ADD(CURDATE(), INTERVAL -$daysAgo DAY)
- GROUP BY mapType
- ) AS expireTimes ON mapOfTheDay.mapType = expireTimes.mapType
- AND mapOfTheDay.mapExpireTime = expireTimes.mapExpireTime
- GROUP BY mapOfTheDay.mapType
-) AS correctMapIds ON maps.ID = correctMapIds.mapId";
-
- $result = mysql_query($sql) or die(mysql_error());
- if (mysql_num_rows($result) == 0)
- return -1;
- global $mapNamesByType;
- $r = array();
- while($data = mysql_fetch_array($result)) {
- $code = $data['code'];
- $mapID = $data['mapID'];
- $mapType = $data['mapType'];
- $map = new map($code);
- if ($map->name == '') $map->name = $mapNamesByType[$mapType];
- $r[$mapID] = $map;
-
- }
- return $r;
-}
-
-function getMapNavigation(&$maps) {
- foreach ($maps as $mapID => &$map) {
- $r .= "<div class='mapThumbnail' onclick='displayMap($mapID)'>";
- $r .= $map->name;
- $r .= DisplayMapThumbnail($map);
- $r .= "</div>";;
- }
- return $r;
-}
-
-
+echo json_encode($json);
?>
\ No newline at end of file diff --git a/ajax/users.ajax.php b/ajax/users.ajax.php index 7ee9cc2..9ac3754 100644 --- a/ajax/users.ajax.php +++ b/ajax/users.ajax.php @@ -3,7 +3,7 @@ ob_start("ob_gzhandler"); //include('../includes/mapclass.php');
//include('../includes/maps.php');
-include_once('../includes/sqli.php');
+include_once('../includes/sqlEmbedded.php');
//Remove the ending .js
$tmp = explode(".", $_GET['userid']);
diff --git a/css/profile.css b/css/achievements.css index 3adf15e..24fd034 100644 --- a/css/profile.css +++ b/css/achievements.css @@ -1,56 +1,79 @@ -
-
-@keyframes badgeAnimate
-{
-0% {transform: rotate(-90deg);}
-80% {transform: rotate(10deg);}
-95% {transform: rotate(-4deg);}
-97% {transform: rotate(1deg);}
-99% {transform: rotate(-1deg);}
-100% {transform: rotate(0deg);}
-}
-@-moz-keyframes badgeAnimate /* Firefox */
-{
-0% {-moz-transform: rotate(-90deg);}
-80% {-moz-transform: rotate(10deg);}
-95% {-moz-transform: rotate(-4deg);}
-97% {-moz-transform: rotate(1deg);}
-99% {-moz-transform: rotate(-1deg);}
-100% {-moz-transform: rotate(0deg);}
-}
-@-o-keyframes badgeAnimate /* Opera */
-{
-0% {-o-transform: rotate(-90deg);}
-80% {-o-transform: rotate(10deg);}
-95% {-o-transform: rotate(-4deg);}
-97% {-o-transform: rotate(1deg);}
-99% {-o-transform: rotate(-1deg);}
-100% {-o-transform: rotate(0deg);}
-}
-@-webkit-keyframes badgeAnimate /* Safari and Chrome */
-{
-0% {-webkit-transform: rotate(-90deg);}
-90% {-webkit-transform: rotate(8deg);}
-95% {-webkit-transform: rotate(-4deg);}
-97% {-webkit-transform: rotate(1deg);}
-99% {-webkit-transform: rotate(-1deg);}
-100% {-webkit-transform: rotate(0deg);}
-}
-
-.badge
-{
- animation: badgeAnimate 1s linear;
- -moz-animation: badgeAnimate 1s linear; /* Firefox */
- -o-animation: badgeAnimate 1s linear; /* Opera */
- -webkit-animation: badgeAnimate 1s linear; /* Safari and Chrome */
-
- width:45px;
- height:45px;
- background-color: #666666;
- background-size:100%;
- padding: 1px 1px;
- border-radius: 5px;
- text-decoration: none;
- border: 2px solid #888;
- box-shadow: 0 0 3px #445;
+ +.progressBar { + align:left; + width:310px; + height:16px; + background-color:#222; + border:1px solid #26b; + border-radius: 0px 6px 6px 0px; +} + +.progressBar div { + border-right:1px solid #37e; + height:16px; + border-radius: 0px 6px 6px 0px; + background: #1e5799; /* Old browsers */ + background: -moz-linear-gradient(45deg, #1e5799 0%, #7db9e8 100%); /* FF3.6+ */ + background: -webkit-gradient(linear, left bottom, right top, color-stop(0%,#1e5799), color-stop(100%,#7db9e8)); /* Chrome,Safari4+ */ + background: -webkit-linear-gradient(45deg, #1e5799 0%,#7db9e8 100%); /* Chrome10+,Safari5.1+ */ + background: -o-linear-gradient(45deg, #1e5799 0%,#7db9e8 100%); /* Opera 11.10+ */ + background: -ms-linear-gradient(45deg, #1e5799 0%,#7db9e8 100%); /* IE10+ */ + background: linear-gradient(45deg, #1e5799 0%,#7db9e8 100%); /* W3C */ + filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#1e5799', endColorstr='#7db9e8',GradientType=1 ); /* IE6-9 fallback on horizontal gradient */ +} + + +@keyframes badgeAnimate +{ +0% {transform: rotate(-90deg);} +80% {transform: rotate(10deg);} +95% {transform: rotate(-4deg);} +97% {transform: rotate(1deg);} +99% {transform: rotate(-1deg);} +100% {transform: rotate(0deg);} +} +@-moz-keyframes badgeAnimate /* Firefox */ +{ +0% {-moz-transform: rotate(-90deg);} +80% {-moz-transform: rotate(10deg);} +95% {-moz-transform: rotate(-4deg);} +97% {-moz-transform: rotate(1deg);} +99% {-moz-transform: rotate(-1deg);} +100% {-moz-transform: rotate(0deg);} +} +@-o-keyframes badgeAnimate /* Opera */ +{ +0% {-o-transform: rotate(-90deg);} +80% {-o-transform: rotate(10deg);} +95% {-o-transform: rotate(-4deg);} +97% {-o-transform: rotate(1deg);} +99% {-o-transform: rotate(-1deg);} +100% {-o-transform: rotate(0deg);} +} +@-webkit-keyframes badgeAnimate /* Safari and Chrome */ +{ +0% {-webkit-transform: rotate(-90deg);} +90% {-webkit-transform: rotate(8deg);} +95% {-webkit-transform: rotate(-4deg);} +97% {-webkit-transform: rotate(1deg);} +99% {-webkit-transform: rotate(-1deg);} +100% {-webkit-transform: rotate(0deg);} +} + +.badge +{ + animation: badgeAnimate 1s linear; + -moz-animation: badgeAnimate 1s linear; /* Firefox */ + -o-animation: badgeAnimate 1s linear; /* Opera */ + -webkit-animation: badgeAnimate 1s linear; /* Safari and Chrome */ + + width:45px; + height:45px; + background-color: #666666; + background-size:100%; + padding: 1px 1px; + border-radius: 5px; + text-decoration: none; + border: 2px solid #888; + box-shadow: 0 0 3px #445; }
\ No newline at end of file diff --git a/css/chat.css b/css/chat.css index 0b38d70..f612887 100644 --- a/css/chat.css +++ b/css/chat.css @@ -3,15 +3,34 @@ font-family: 'Trebuchet MS1', 'Trebuchet MS', sans-serif; border: 1px solid gray; background-color:#999; - width: 700px; - margin: 7px; + width: 680px; + margin: 7px 3px; padding: 2px; border-radius: 10px; border-bottom-right-radius: 20px; border-top-right-radius: 20px; } .chatButton { - margin: 4px; + margin: 0px; + width: 50px; +} + +#chatMute { + display:inline-block; + border:1px solid gray; + width:17px; + height:17px; + background-size: 100%; + position: relative; + top: 5px; + margin-right: 5px; +} + +.chatMute_true { + background-image: url(../images/Sound.png); +} +.chatMute_false { + background-image: url(../images/Mute.png); } #chatContainer { @@ -29,17 +48,30 @@ .chatBadge { height:100%; + z-index:2; float:left; } .chatUsername { font-family: 'Trebuchet MS1', 'Trebuchet MS', sans-serif; font-size: 17px; - text-overflow: ellipsis; + text-overflow: clip; overflow:hidden; float: left; padding-top: 5px; width: 115px; } +.chatUsername:after { + content:":"; +} +.chatUsername.me { + text-align:right; +} +.chatUsername.me:after { + content:""; +} +.chatUsername.me:before { + content:"*"; +} .chatText { font-family: 'Trebuchet MS1', 'Trebuchet MS', sans-serif; font-size: 16px; @@ -53,12 +85,13 @@ word-wrap: break-word; /* IE */ } .chatTimestamp { - font-family:"Times New Roman", Times, serif; + font-family: Trebuchet MS1, Trebuchet MS, sans-serif; + font-size: 1em; float:left; - padding: 5px 3px 3px 3px; - min-width:70px; + padding: 5px 0px 3px 0px; + width:83px; overflow:hidden; - text-overflow: ellipsis; + text-overflow: clip; white-space:nowrap; } .chatColumn1 { @@ -95,6 +128,16 @@ background-color: #844; } +.chatText.spoiler { + color:transparent; +} +.chatText.spoiler:before { + content: " Click to reveal Spoiler "; + color:#7AF; + font-style: italic; +} + + .chatContainer2 { background-color: #222; padding:10px; diff --git a/css/mapeditor.css b/css/mapeditor.css new file mode 100644 index 0000000..60a6e78 --- /dev/null +++ b/css/mapeditor.css @@ -0,0 +1,10 @@ + + + +.plusMinus { + float:left; + width:130px; + border:1px solid gray; + padding:2px; + margin:2px; +}
\ No newline at end of file diff --git a/css/maps.css b/css/maps.css index 857647a..86a2f76 100644 --- a/css/maps.css +++ b/css/maps.css @@ -15,6 +15,10 @@ padding: 0px;
margin: 0px;
background-size: 100%;
+ transition:background-color .4s;
+ -webkit-transition:background-color .4s;
+ -o-transition:background-color .4s;
+ -moz-transition:background-color .4s;
}
.map .w {
background-image: url(../images/OverlayTileFaceted50b.png);
@@ -184,6 +188,13 @@ background-image: url(../images/OverlayTileFaceted20.png);
}
+.tileDisplay div {
+ float:left;
+ border:1px solid blue;
+ margin:2px;
+ width:36px;
+ height:36px;
+}
/* grid stuff */
diff --git a/css/page.css b/css/page.css index ad45e8b..ec0f1c9 100644 --- a/css/page.css +++ b/css/page.css @@ -56,7 +56,7 @@ form { padding: 15px 0px;
text-align: center;
position: relative;
- min-width: 900px;
+ min-width: 960px;
background: #272727;
background: -moz-linear-gradient(top, #272727 0%, #111111 100%);
@@ -72,7 +72,7 @@ form { .copyAndButtons
{
margin: 0 auto;
- width: 900px;
+ width: 960px;
}
.copyAndButtons #copy
@@ -255,19 +255,24 @@ position:absolute;color:#333;left:25px;bottom:20px; -.topbarSpacer {
- width:900px;
- height:70px;
-}
.wrapper {
- width: 900px;
+ width: 960px;
margin: 0 auto;
}
.wrapper2 {
- width:900px;
+ width:960px;
min-height:20px;
margin: 0 auto;
}
+.contentWrapper {
+ width: 930px;
+ margin: 0 auto;
+ border: 1px solid #333;
+ border-top:0px;
+ border-bottom:0px;
+ padding-left:15px;
+ padding-right:15px;
+}
.hidden-maps {
display:none;
@@ -283,13 +288,18 @@ position:absolute;color:#333;left:25px;bottom:20px; float:right;
}
+.topbarSpacer {
+ width:960px;
+ height:0px;
+}
#topbar {
font-weight:bold;
- padding: 15px 15px;
- margin: 0 auto 40px;
- text-align: center;
- position: fixed; /* for #user */
- min-width: 900px;
+ padding: 15px 0px 15px 0px;
+ padding: 0px;
+ height:50px
+ text-align:center;
+ position: relative;
+ min-width: 960px;
width:100%;
background: -moz-linear-gradient(top, #555, #222);
background: -webkit-linear-gradient(top, #555, #222);
@@ -300,25 +310,47 @@ position:absolute;color:#333;left:25px;bottom:20px; -khtml-opacity: 0.9;
opacity: 0.9;
}
-#topbar a.nav {
+#topbarContent {
+ margin: 0 auto;
+ position: relative;
+ text-align: center;
+ width:960px;
+ height:100%;
+}
+#topbarContent a.nav {
background-color: #222;
- margin-right: 15px;
+ display: inline-block;
+ margin: 7px;
padding: 7px 10px;
border-radius: 5px;
text-decoration: none;
border: 1px solid #333;
box-shadow: 0 0 1px #444;
}
-#topbar a.nav.selected, #topbar a.nav:hover {
+#topbarContent a.nav.selected, #topbarContent a.nav:hover {
border: 1px solid #222;
- background-color: #2c2c2c;
+ background-color: inherit;
}
-#topbar #user {
- position: absolute;
- right: 45px;
- top: 5px;
+#topbarContent #user {
+ position: fixed;
+ right: 10px;
+ top: 2px;
text-align: right;
}
+#topbarBadge {
+ margin-left:10px;
+ margin-top:4px;
+ background-size: 100%;
+ width:41px;
+ height:41px;
+ float:left;
+}
+#topbarBadge div {
+ width:100%;
+ height:100%;
+ background-image: url(../images/OverlayTileFaceted50b.png);
+ background-size:100%;
+}
#difficulties {
width: 100%;
@@ -475,5 +507,14 @@ table.score th { background-color:#356;
cursor:default;
}
+.unselectable
+{
+ -webkit-touch-callout: none;
+ -webkit-user-select: none;
+ -khtml-user-select: none;
+ -moz-user-select: none;
+ -ms-user-select: none;
+ user-select: none;
+}
diff --git a/css/stats.css b/css/stats.css index 166573d..e63be80 100644 --- a/css/stats.css +++ b/css/stats.css @@ -1,3 +1,9 @@ +#displayDate +{ + font-size: 105%; + text-align: center; + padding: 7px 0px; +} .col1 { float: left; margin-right: 8px; @@ -32,7 +38,7 @@ .mapNavCon { height:135px; - width:900px; + width:960px; margin-bottom:10px; } .mapNavLeft { @@ -48,23 +54,31 @@ border-radius: 0px 25px 6px 0px; vertical-align: middle; text-align:center; - line-height: 130px; + line-height: 126px; text-decoration: none; background-color: #262631; font-size:200%; border-radius: 5px; border: 1px solid #333; + cursor: auto; +} +.mapNavActive { + cursor: pointer; } .mapNavActive:hover { background-color: #343c57; } +.mapNavActive:active { + background-color: #555588; +} .mapNavDisabled { background-color: #222223; + cursor: default; } .mapNavCenter { float:left; height:135px; - width:780px; + width:840px; margin-left:20px; margin-right:20px; background-color:#222223; @@ -74,18 +88,30 @@ overflow-y:hidden; } #mapNavigation { - margin-left: 45px; + margin-left: 75px; padding:1px; white-space: nowrap; overflow-x:hidden; overflow-y:hidden; } +.scoreCol { + min-height:500px; + min-width:277px; + float:left; +} +.mapCol { + min-height:500px; + float:left; + margin-left: 7px; + max-width:500px; +} + .mapThumbnail { display:inline-block; padding: 8px; background-color:#334; - margin: 3px; + margin: 4px; border-radius:10px; cursor:pointer; padding-top: 0px; @@ -94,11 +120,31 @@ background-color:#445; } -.mapThumbnail.current { - background-color:#557; +.mapThumbnail.selectedMap { + border-color: #CC3333; + border-style: solid; + /* Make sure border-width + margin == .mapThumbnail margin */ + border-width: 3px; + margin: 1px; +} +.mapThumbnail.currentlyRunning { + background-color: #373737; + color: #CCCCCC; +} +.mapThumbnail.currentlyRunning:hover { + background-color:#474747; +} +#currentlyRunningMessage { + color: #FF2818; + display: none; + text-align: center; + padding-bottom: 12px; } -.mapThumbnail.current:hover { - background-color:#668; + +#currentlyRunningMessage span { + background-color: #1A1A1A; + border-radius: 8px 8px 8px 8px; + padding: 3px 10px; } @@ -168,6 +214,9 @@ td, th { .scoreActive:hover { background-color: #343c57; } +.scoreActive:active { + background-color: #555588; +} .scoreDisabled { background-color: #222223; } diff --git a/db updates.sql b/db updates.sql index 938e46d..e2ea27f 100644 --- a/db updates.sql +++ b/db updates.sql @@ -99,4 +99,7 @@ UPDATE maps INNER JOIN mapOfTheDay ON maps.Id = mapOfTheDay.mapId SET maps.name = 'Ultra Complex' WHERE mapOfTheDay.mapType = 5 -AND (maps.name IS NULL OR maps.name = '');
\ No newline at end of file +AND (maps.name IS NULL OR maps.name = ''); + +--Need to support bigger solutions for these crazy new unlimited-tower maps +ALTER TABLE `solutions` CHANGE `solution` `solution` VARCHAR( 4095 ) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL
\ No newline at end of file @@ -72,6 +72,8 @@ if ($_GET['r'] == 'reqMemberPage') { die($encoded);
}
+
+//TODO: DEPRECIATE!
if ($_GET['r'] == 'reqScorePage') {
$mapID = $_GET['mapid'] + 0;
$page = $_GET['reqPage'] + 0;
@@ -366,19 +368,6 @@ $json['error'][] = 'Rush-send failed'; die(json_encode($json));
-function isCurrentMap($mapID) {
- include_once('./includes/sqlEmbedded.php');
- $sql = "SELECT mapID
- FROM `mapOfTheDay`
- WHERE `mapID` = '$mapID'
- AND mapExpireTime > NOW()
- LIMIT 1
- ";
-
- $result = mysql_query($sql) or die(mysql_error());
- return (mysql_num_rows($result) != 0);
-}
-
//Very simple, confirm that all targets are reachable.
function ValidateMap($mygrid) {
$start = "0,1.";
diff --git a/humans.txt b/humans.txt new file mode 100644 index 0000000..6d5c2ec --- /dev/null +++ b/humans.txt @@ -0,0 +1,40 @@ +/* People Behind Pathery */
+/* see humanstxt.org */
+
+/* TEAM */
+ Founder/Creator/Lead Design: Patrick Davison
+ Nickname: Snap
+ Contact: snap [at] pathery.com
+ Twitter: @snapems
+ From: Eugene, Oregon. US
+
+ Founder: Rex Ounekeo
+ From: Texas. US
+
+ Developer: <>
+ Nickname: BlueRaja
+ From: <>
+
+ Mobile - iOS Dev: <Nath>
+
+ Mobile - iOS Dev: <Ande>
+
+/* THANKS */
+
+ Nickname: raylu
+
+ Name: Steven Gosling
+
+/* SITE */
+ Language: English
+ Standards: HTML5, CSS3
+ Components: jQuery
+ IDE: Notepad++, NetBeans, GIMP, Freesounds.org
+ Launch: March 13th 2011
+
+__________ __ .__
+\______ \_____ _/ |_| |__ ___________ ___.__.
+ | ___/\__ \\ __\ | \_/ __ \_ __ < | |
+ | | / __ \| | | Y \ ___/| | \/\___ |
+ |____| (____ /__| |___| /\___ >__| / ____|
+ \/ \/ \/ \/
\ No newline at end of file diff --git a/images/Mute.png b/images/Mute.png Binary files differnew file mode 100644 index 0000000..8210033 --- /dev/null +++ b/images/Mute.png diff --git a/images/Sound.png b/images/Sound.png Binary files differnew file mode 100644 index 0000000..f2a51fa --- /dev/null +++ b/images/Sound.png diff --git a/images/linkdsp.png b/images/linkdsp.png Binary files differnew file mode 100644 index 0000000..118ae0b --- /dev/null +++ b/images/linkdsp.png diff --git a/images/smileys/Angel.png b/images/smileys/Angel.png Binary files differnew file mode 100644 index 0000000..0cf707b --- /dev/null +++ b/images/smileys/Angel.png diff --git a/images/smileys/Angry.png b/images/smileys/Angry.png Binary files differnew file mode 100644 index 0000000..9ae5d18 --- /dev/null +++ b/images/smileys/Angry.png diff --git a/images/smileys/Aww.png b/images/smileys/Aww.png Binary files differnew file mode 100644 index 0000000..3512863 --- /dev/null +++ b/images/smileys/Aww.png diff --git a/images/smileys/Aww_2.png b/images/smileys/Aww_2.png Binary files differnew file mode 100644 index 0000000..60510bb --- /dev/null +++ b/images/smileys/Aww_2.png diff --git a/images/smileys/Blushing.png b/images/smileys/Blushing.png Binary files differnew file mode 100644 index 0000000..ab03ee8 --- /dev/null +++ b/images/smileys/Blushing.png diff --git a/images/smileys/Childish.png b/images/smileys/Childish.png Binary files differnew file mode 100644 index 0000000..1a31c50 --- /dev/null +++ b/images/smileys/Childish.png diff --git a/images/smileys/Confused.png b/images/smileys/Confused.png Binary files differnew file mode 100644 index 0000000..08ba7d3 --- /dev/null +++ b/images/smileys/Confused.png diff --git a/images/smileys/Creepy.png b/images/smileys/Creepy.png Binary files differnew file mode 100644 index 0000000..5615058 --- /dev/null +++ b/images/smileys/Creepy.png diff --git a/images/smileys/Crying.png b/images/smileys/Crying.png Binary files differnew file mode 100644 index 0000000..2532976 --- /dev/null +++ b/images/smileys/Crying.png diff --git a/images/smileys/Cthulhu.png b/images/smileys/Cthulhu.png Binary files differnew file mode 100644 index 0000000..fafc4b3 --- /dev/null +++ b/images/smileys/Cthulhu.png diff --git a/images/smileys/Cute.png b/images/smileys/Cute.png Binary files differnew file mode 100644 index 0000000..a883ac3 --- /dev/null +++ b/images/smileys/Cute.png diff --git a/images/smileys/Cute_Winking.png b/images/smileys/Cute_Winking.png Binary files differnew file mode 100644 index 0000000..ad3383d --- /dev/null +++ b/images/smileys/Cute_Winking.png diff --git a/images/smileys/Devil.png b/images/smileys/Devil.png Binary files differnew file mode 100644 index 0000000..afc5c2c --- /dev/null +++ b/images/smileys/Devil.png diff --git a/images/smileys/Gah.png b/images/smileys/Gah.png Binary files differnew file mode 100644 index 0000000..b03ee1b --- /dev/null +++ b/images/smileys/Gah.png diff --git a/images/smileys/Gah_2.png b/images/smileys/Gah_2.png Binary files differnew file mode 100644 index 0000000..b682458 --- /dev/null +++ b/images/smileys/Gah_2.png diff --git a/images/smileys/Gasping.png b/images/smileys/Gasping.png Binary files differnew file mode 100644 index 0000000..b6655ce --- /dev/null +++ b/images/smileys/Gasping.png diff --git a/images/smileys/Greedy.png b/images/smileys/Greedy.png Binary files differnew file mode 100644 index 0000000..a179638 --- /dev/null +++ b/images/smileys/Greedy.png diff --git a/images/smileys/Grinning.png b/images/smileys/Grinning.png Binary files differnew file mode 100644 index 0000000..85ff915 --- /dev/null +++ b/images/smileys/Grinning.png diff --git a/images/smileys/Grinning_Winking.png b/images/smileys/Grinning_Winking.png Binary files differnew file mode 100644 index 0000000..5b1d5b7 --- /dev/null +++ b/images/smileys/Grinning_Winking.png diff --git a/images/smileys/Happy.png b/images/smileys/Happy.png Binary files differnew file mode 100644 index 0000000..51cf1a2 --- /dev/null +++ b/images/smileys/Happy.png diff --git a/images/smileys/Happy_2.png b/images/smileys/Happy_2.png Binary files differnew file mode 100644 index 0000000..1332686 --- /dev/null +++ b/images/smileys/Happy_2.png diff --git a/images/smileys/Happy_3.png b/images/smileys/Happy_3.png Binary files differnew file mode 100644 index 0000000..be79df0 --- /dev/null +++ b/images/smileys/Happy_3.png diff --git a/images/smileys/Heart.png b/images/smileys/Heart.png Binary files differnew file mode 100644 index 0000000..dcd28b9 --- /dev/null +++ b/images/smileys/Heart.png diff --git a/images/smileys/Huh.png b/images/smileys/Huh.png Binary files differnew file mode 100644 index 0000000..241f50f --- /dev/null +++ b/images/smileys/Huh.png diff --git a/images/smileys/Huh_2.png b/images/smileys/Huh_2.png Binary files differnew file mode 100644 index 0000000..a1a54e4 --- /dev/null +++ b/images/smileys/Huh_2.png diff --git a/images/smileys/Laughing.png b/images/smileys/Laughing.png Binary files differnew file mode 100644 index 0000000..edefc95 --- /dev/null +++ b/images/smileys/Laughing.png diff --git a/images/smileys/Lips_Sealed.png b/images/smileys/Lips_Sealed.png Binary files differnew file mode 100644 index 0000000..46e4701 --- /dev/null +++ b/images/smileys/Lips_Sealed.png diff --git a/images/smileys/Madness.png b/images/smileys/Madness.png Binary files differnew file mode 100644 index 0000000..1c0946c --- /dev/null +++ b/images/smileys/Madness.png diff --git a/images/smileys/Malicious.png b/images/smileys/Malicious.png Binary files differnew file mode 100644 index 0000000..23f2579 --- /dev/null +++ b/images/smileys/Malicious.png diff --git a/images/smileys/Sick.png b/images/smileys/Sick.png Binary files differnew file mode 100644 index 0000000..6f73e2f --- /dev/null +++ b/images/smileys/Sick.png diff --git a/images/smileys/Smiling.png b/images/smileys/Smiling.png Binary files differnew file mode 100644 index 0000000..725eef5 --- /dev/null +++ b/images/smileys/Smiling.png diff --git a/images/smileys/Speechless.png b/images/smileys/Speechless.png Binary files differnew file mode 100644 index 0000000..4fc4246 --- /dev/null +++ b/images/smileys/Speechless.png diff --git a/images/smileys/Spiteful.png b/images/smileys/Spiteful.png Binary files differnew file mode 100644 index 0000000..195ced8 --- /dev/null +++ b/images/smileys/Spiteful.png diff --git a/images/smileys/Stupid.png b/images/smileys/Stupid.png Binary files differnew file mode 100644 index 0000000..3fcea49 --- /dev/null +++ b/images/smileys/Stupid.png diff --git a/images/smileys/Sunglasses.png b/images/smileys/Sunglasses.png Binary files differnew file mode 100644 index 0000000..cad8379 --- /dev/null +++ b/images/smileys/Sunglasses.png diff --git a/images/smileys/Terrified.png b/images/smileys/Terrified.png Binary files differnew file mode 100644 index 0000000..fad2e06 --- /dev/null +++ b/images/smileys/Terrified.png diff --git a/images/smileys/Thumb_Down.png b/images/smileys/Thumb_Down.png Binary files differnew file mode 100644 index 0000000..4f70696 --- /dev/null +++ b/images/smileys/Thumb_Down.png diff --git a/images/smileys/Thumb_Up.png b/images/smileys/Thumb_Up.png Binary files differnew file mode 100644 index 0000000..2ca0e0d --- /dev/null +++ b/images/smileys/Thumb_Up.png diff --git a/images/smileys/Tired.png b/images/smileys/Tired.png Binary files differnew file mode 100644 index 0000000..13f7d12 --- /dev/null +++ b/images/smileys/Tired.png diff --git a/images/smileys/Tongue_Out.png b/images/smileys/Tongue_Out.png Binary files differnew file mode 100644 index 0000000..3d154f9 --- /dev/null +++ b/images/smileys/Tongue_Out.png diff --git a/images/smileys/Tongue_Out_Laughing.png b/images/smileys/Tongue_Out_Laughing.png Binary files differnew file mode 100644 index 0000000..fba5d75 --- /dev/null +++ b/images/smileys/Tongue_Out_Laughing.png diff --git a/images/smileys/Tongue_Out_Left.png b/images/smileys/Tongue_Out_Left.png Binary files differnew file mode 100644 index 0000000..8015de7 --- /dev/null +++ b/images/smileys/Tongue_Out_Left.png diff --git a/images/smileys/Tongue_Out_Up.png b/images/smileys/Tongue_Out_Up.png Binary files differnew file mode 100644 index 0000000..46328fb --- /dev/null +++ b/images/smileys/Tongue_Out_Up.png diff --git a/images/smileys/Tongue_Out_Up_Left.png b/images/smileys/Tongue_Out_Up_Left.png Binary files differnew file mode 100644 index 0000000..b67b69f --- /dev/null +++ b/images/smileys/Tongue_Out_Up_Left.png diff --git a/images/smileys/Tongue_Out_Winking.png b/images/smileys/Tongue_Out_Winking.png Binary files differnew file mode 100644 index 0000000..2a22cf6 --- /dev/null +++ b/images/smileys/Tongue_Out_Winking.png diff --git a/images/smileys/Uncertain.png b/images/smileys/Uncertain.png Binary files differnew file mode 100644 index 0000000..7176856 --- /dev/null +++ b/images/smileys/Uncertain.png diff --git a/images/smileys/Uncertain_2.png b/images/smileys/Uncertain_2.png Binary files differnew file mode 100644 index 0000000..a7f5370 --- /dev/null +++ b/images/smileys/Uncertain_2.png diff --git a/images/smileys/Unhappy.png b/images/smileys/Unhappy.png Binary files differnew file mode 100644 index 0000000..79fc0c0 --- /dev/null +++ b/images/smileys/Unhappy.png diff --git a/images/smileys/Winking.png b/images/smileys/Winking.png Binary files differnew file mode 100644 index 0000000..1e01f94 --- /dev/null +++ b/images/smileys/Winking.png diff --git a/includes/.gitignore b/includes/.gitignore new file mode 100644 index 0000000..4f36fe0 --- /dev/null +++ b/includes/.gitignore @@ -0,0 +1 @@ +/db.inc.php diff --git a/includes/chats.php b/includes/chats.php index dcd46c9..18d0810 100644 --- a/includes/chats.php +++ b/includes/chats.php @@ -2,7 +2,7 @@ /*
* addChat, getChat functions
*/
-include_once('sqli.php');
+include_once('sqlEmbedded.php');
define('CHAT_ROWS_TO_KEEP', 75);
diff --git a/includes/datas.php b/includes/datas.php index c341ddf..1db0060 100644 --- a/includes/datas.php +++ b/includes/datas.php @@ -646,7 +646,9 @@ function getMazeMasteryArray() { //TYPE 4 function getChampionPointsArray() { //$cp[0] = array(requiredpoints, type, 'value', 'name'); - $r[1] = array(100, 2, 'DiagonalCover_B.png', 'Light Diagnol Cover', 0); + //TODO: Crap.... typo... Need to fix this in SQL too. + //$r[1] = array(100, 2, 'DiagonalCover_B.png', 'Light Diagnol Cover', 0); + $r[1] = array(100, 2, 'DiagonalCover_B.png', 'Light Diagonal Cover', 0); $r[2] = array(250, 1, '#22aaaa', 'Teal'); $r[3] = array(500, 2, 'OffsetStripesDiagonal_B.png', 'Dark Diagonal Stripes', 0); $r[4] = array(1000, 2, 'DiamondLargeDonut_W_I.png', 'Inverted Light Annulated Diamond', 0); @@ -807,7 +809,7 @@ function getScores($mapID, $pageNumber = 1, $pageDivide = 10) { timediff(solutions.dateModified, TIMESTAMP(CURDATE())) as diff, users.displayName as display, solutions.moves as moves, - solutions.challengePointsWorth as points, + solutions.championPointsWorth as points, users.ID as ID, users.displayColor, users.wallColor, @@ -825,7 +827,7 @@ function getScores($mapID, $pageNumber = 1, $pageDivide = 10) { $result = mysql_query($sql); //$utime = date("g:i A (T)"); - $output['updateTime'] = date("g:i A (T)"); + $output['updateTime'] = time(); $i = 0; $foundUser = false; @@ -853,7 +855,7 @@ function getScores($mapID, $pageNumber = 1, $pageDivide = 10) { } $scoredDate = strtotime($row['cdate']); - $secondsSinceScored = strtotime("now") - $scoredDate ; + $secondsSinceScored = strtotime("now") - $scoredDate; //Alternate background colors $background = '#262631'; @@ -980,4 +982,20 @@ function loadChallengeMapCode($mapIdUnsanitized) } return NULL; } + + +function isCurrentMap($mapID) { + include_once('./includes/sqlEmbedded.php'); + $sql = "SELECT mapID + FROM `mapOfTheDay` + WHERE `mapID` = '$mapID' + AND mapExpireTime > NOW() + LIMIT 1 + "; + + $result = mysql_query($sql) or die(mysql_error()); + return (mysql_num_rows($result) != 0); +} + + ?> diff --git a/includes/db.inc.php b/includes/db.inc.php deleted file mode 100644 index 6cd3f01..0000000 --- a/includes/db.inc.php +++ /dev/null @@ -1,11 +0,0 @@ -<?php
-
-global $mysqlid;
-$db_host = "db2894.perfora.net";
-$db_user = "dbo362854667";
-$db_name = "db362854667";
-$db_pass = "mazes4me";
-$mysqlid = @mysql_connect($db_host,$db_user, $db_pass) or die("Cannot connect to database.");
-@mysql_select_db($db_name, $mysqlid) or die("Invalid database.");
-
-?>
diff --git a/includes/emails.php b/includes/emails.php index 182749c..74658ad 100644 --- a/includes/emails.php +++ b/includes/emails.php @@ -2,7 +2,7 @@ /*
* Email methods; QueueEmail and SendQueuedEmail
*/
-include_once('sqli.php');
+include_once('sqlEmbedded.php');
//Email sending lock
define('FILE_EMAIL_LOCK', './emailLockFile');
diff --git a/includes/header.php b/includes/header.php index c18ae2e..cf427e4 100644 --- a/includes/header.php +++ b/includes/header.php @@ -10,6 +10,7 @@ function htmlHeader($css = array(), $title = 'Pathery', $desc = '', $scripts = a <link href="css/page.css?v=011013" rel="stylesheet" type="text/css" />
<link href="css/maps.css?v=122612" rel="stylesheet" type="text/css" />
+ <link rel="image_src" type="image/png" href="/images/linkdsp.png" />
<?php
foreach ($css as $c) {
echo " <link href=\"css/$c.css\" rel=\"stylesheet\" type=\"text/css\" />\n";
@@ -19,11 +20,10 @@ function htmlHeader($css = array(), $title = 'Pathery', $desc = '', $scripts = a foreach ($scripts as $s) echo "<script src='js/$s.js?v=122612'></script>";
?>
<script src="js/ajax.js" async="async"></script>
+ <script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<script src="js/mapspecs.js?v=122612"></script>
<script src="js/globe.js?v=122612"></script>
- <script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
-
<script>
(function(c,a){window.mixpanel=a;var b,d,h,e;b=c.createElement("script");b.type="text/javascript";b.async=!0;b.src=("https:"===c.location.protocol?"https:":"http:")+'//cdn.mxpnl.com/libs/mixpanel-2.1.min.js';d=c.getElementsByTagName("script")[0];d.parentNode.insertBefore(b,d);a._i=[];a.init=function(b,c,f){function d(a,b){var c=b.split(".");2==c.length&&(a=a[c[0]],b=c[1]);a[b]=function(){a.push([b].concat(Array.prototype.slice.call(arguments,0)))}}var g=a;"undefined"!==typeof f?
g=a[f]=[]:f="mixpanel";g.people=g.people||[];h="disable track track_pageview track_links track_forms register register_once unregister identify name_tag set_config people.identify people.set people.increment".split(" ");for(e=0;e<h.length;e++)d(g,h[e]);a._i.push([b,c,f])};a.__SV=1.1})(document,window.mixpanel||[]);
@@ -155,7 +155,7 @@ function htmlFooter() { function topbar($links) {
global $accepted, $wallColor, $wallEmblem, $request;
- echo '<div id="topbar">';
+ echo '<div id="topbar"><div id="topbarContent">';
foreach ($links as $key => $value) {
if ($request == $key) {
@@ -174,13 +174,10 @@ function topbar($links) { echo " <a href='cp' title='change name'>Update your name</a> | ";
echo " <a href='logout'>Logout</a>";
echo " </div>";
- echo "
- <div class='grid_td' style='float:left; margin:5px 1px 1px 9px; width:35px; height:35px; background:$wallColor url(images/marks/$wallEmblem);'>
- <a href='achievements'>
- <div style='background-color:transparent;' class='grid_td_inner grid_td_rocks'>
- </div>
- </a>
+ echo "<div id='topbarBadge' style='background-color: $wallColor; background-image: url(images/marks/$wallEmblem);'>
+ <a href='achievements'><div></div></a>
</div>";
+
} else {
@@ -199,7 +196,7 @@ function topbar($links) { <?
}
echo " </div>";
- echo "</div><div class='topbarSpacer'></div>"; //div id='user'
+ echo "</div></div><div class='topbarSpacer'></div>"; //div id='user'
}
function userDataToJS() {
diff --git a/includes/mapclass.php b/includes/mapclass.php index 9e91d3f..24b9108 100644 --- a/includes/mapclass.php +++ b/includes/mapclass.php @@ -43,8 +43,15 @@ class map { public function __construct($code = NULL, $mapID = NULL) { //TODO: Use new code by default. if ($mapID !== NULL) $this->ID = $mapID; - if ($code !== NULL) $this->applyMapFromOldCode($code); - //$this->applyMapFromCode($code); + if ($code !== NULL) { + $dimensions = explode('.', explode(':', $code)[0])[0]; + if (strpos($dimensions, 'x') == true) { + $this->applyMapFromOldCode($code); + } else { + $this->applyMapFromCode($code); + } + } + } public function applyMapFromOldCode($code) { @@ -218,8 +225,7 @@ class map { //Outputs the new code. public function getCode() { //If we already have the code on hand... - if ($this->code) - return $this->code; + //if ($this->code) return $this->code; //Otherwise we need to build the code: $headers[0] = $this->width; $headers[1] = $this->height; @@ -247,6 +253,74 @@ class map { return $code; } + function getOldCode() { + + $code = ""; //The string to return to the database. + $index = 0; //The current number of tiles from the last tile saved. + + $code = $this->width.'x'.$this->height; + $code .= '.c'.$this->checkpoints; + $code .= '.r0'; //rocks... yeah. + $code .= '.w'.$this->walls; + $code .= '.t'.$this->teleports; + $code .= '.'.$this->name; + $code .= ".:"; + + $oldNames['o'] = 'o'; + + $oldNames['s'] = 's'; + $oldNames['s2'] = 'S'; + $oldNames['f'] = 'f'; + + $oldNames['c'] = 'a'; + $oldNames['c2'] = 'b'; + $oldNames['c3'] = 'c'; + $oldNames['c4'] = 'd'; + $oldNames['c5'] = 'e'; + + $oldNames['t'] = 't'; + $oldNames['t2'] = 'm'; + $oldNames['t3'] = 'g'; + $oldNames['t4'] = 'i'; + $oldNames['t5'] = 'k'; + + $oldNames['u'] = 'u'; + $oldNames['u2'] = 'n'; + $oldNames['u3'] = 'h'; + $oldNames['u4'] = 'j'; + $oldNames['u5'] = 'l'; + + $oldNames['x'] = 'x'; + $oldNames['x2'] = 'X'; + + $oldNames['r'] = 'r'; + $oldNames['r2'] = 'R'; + + for( $i = 0; $i < $this->height; $i++) { + for( $j = 0; $j < $this->width; $j++) { + if($this->tiles[$i][$j][0] != 'o') { + //As long as the tile is NOT open, embed it in the code. + + + $type = $this->tiles[$i][$j][0]; + $value = $this->tiles[$i][$j][1]; + if ($value <= 1) $value = ''; + + $code .= $index.$oldNames[$type.$value].'.'; + + + //$code .= $index.$mapMatrix[$i][$j].'.'; + //Start from 0 again. + $index = -1; + } + $index += 1; + } + } + + return $code; + + } + //Other "Magical" functions. public function __toString() { return $this->name; diff --git a/includes/sqlEmbedded.php b/includes/sqlEmbedded.php index b7a32b5..64fa5c5 100644 --- a/includes/sqlEmbedded.php +++ b/includes/sqlEmbedded.php @@ -1,6 +1,9 @@ <?php include_once('db.inc.php'); +global $mysqli; +$mysqli = @mysqli_connect($db_host, $db_user, $db_pass, $db_name) or die("SQLI Failed to connect to database"); + global $mysqlid; $mysqlid = @mysql_connect($db_host,$db_user, $db_pass) or die("Cannot connect to database."); @mysql_select_db($db_name, $mysqlid) or die("Invalid database."); diff --git a/includes/sqli.php b/includes/sqli.php deleted file mode 100644 index d19069b..0000000 --- a/includes/sqli.php +++ /dev/null @@ -1,4 +0,0 @@ -<?php
-include_once('db.inc.php');
-$mysqli = mysqli_connect($db_host, $db_user, $db_pass, $db_name) or die("Failed to connect to database");
-?>
\ No newline at end of file @@ -98,6 +98,18 @@ switch ($request) { require("pages/tutorial.php");
break;
+ case "redirect":
+ //Whitelist things?
+ if (true) {
+ require('redirect.php');
+ } else {
+ //Redirect instantly:
+ $to = $_GET['to'];
+ DoRedirect(NULL, $to, $duration = "0");
+ }
+ exit;
+ break;
+
case "hometutorial":
header("Location: $mydomain"."tutorial");
exit;
@@ -207,6 +219,10 @@ switch ($request) { require 'pages/chat.php';
break;
+ case "mapeditor":
+ require 'pages/mapeditor.php';
+ break;
+
case "admin":
if ($_SESSION['isAdmin'] == true) {
require 'pages/admin.php';
diff --git a/js/globe.js b/js/globe.js index 9538d9b..152ad71 100644 --- a/js/globe.js +++ b/js/globe.js @@ -1,4 +1,3 @@ -
function showSignin() {
if (document.getElementById('oid_hidden') !== undefined) {
document.getElementById('oid_hidden').id = 'oid_wrapper';
@@ -26,6 +25,11 @@ function createSignin() { document.body.appendChild(div.firstChild);
}
-
-
-
+//Make unselectable elements unselectable (hack for IE 9.0 and below, which doesn't support our CSS)
+$(document).ready(function()
+{
+ if ($.browser.msie && $.browser.version < 10)
+ {
+ $('.unselectable').find(':not(input)').attr('unselectable', 'on');
+ }
+});
\ No newline at end of file diff --git a/js/mapspecs.js b/js/mapspecs.js index 2a5bd1d..6ab7286 100644 --- a/js/mapspecs.js +++ b/js/mapspecs.js @@ -141,10 +141,7 @@ function grid_click(obj) { wallEmblem = playerWallEmblem;
}
}
- console.log('using wallcolors:', wallColor, wallEmblem);
-
obj.style.backgroundColor = wallColor;
-
if (wallEmblem !== false) {
obj.style.backgroundImage="url(images/marks/"+wallEmblem+")";
}
@@ -588,14 +585,14 @@ function doanimate(x, y, p, c, mapid, pathNumber) { rs = 84;
//How fast should we be going?
selectbox = document.getElementById(mapid+',speed');
- selected = selectbox.options[selectbox.selectedIndex].value;
- switch (selected) {
+ var selectedSpeed = selectbox.options[selectbox.selectedIndex].value;
+ switch (selectedSpeed) {
case '1':
- rs =160;
+ rs =180;
break;
case '2':
- rs =84;
+ rs =94;
break;
case '3':
@@ -634,7 +631,8 @@ function doanimate(x, y, p, c, mapid, pathNumber) { case 'a': case 'b': case 'c':
case 'd': case 'e': case 'f':
- rs = rs + 410;
+ rs = rs + 410;
+ if (selectedSpeed <= 2) rs = rs + 200;
mapdata[mapid].pathColor[pathNumber] = targetColor(t);
break;
@@ -712,7 +710,12 @@ function targetColor(target) { function flashelement(eid, times, color, speed) {
- if (document.getElementById(eid) == undefined) return;
+
+ if (typeof(document.getElementById(eid)) == 'undefined') return;
+ var elementToFlash = document.getElementById(eid);
+ if (elementToFlash.isBeingFlashed == true) return;
+ elementToFlash.isBeingFlashed = true;
+
if (!color) {
color = "#FFFF44";
}
@@ -720,28 +723,23 @@ function flashelement(eid, times, color, speed) { speed = 220;
}
speedon = speed * .5;
- //document.getElementById(eid).setAttribute('class', 'no_transition');
- var currentclass = document.getElementById(eid).className;
- if (document.getElementById(eid).classOrigName != undefined)
- currentclass = document.getElementById(eid).classOrigName;
- var currentColor = document.getElementById(eid).style.backgroundColor;
- document.getElementById(eid).className='no_transition '+currentclass;
- document.getElementById(eid).style.backgroundColor = '#000000';
+
+ var currentclass = elementToFlash.className;
+ if (elementToFlash.classOrigName != undefined)
+ currentclass = elementToFlash.classOrigName;
+ var currentColor = elementToFlash.style.backgroundColor;
+ elementToFlash.className='no_transition '+currentclass;
+ elementToFlash.style.backgroundColor = '#000000';
for (var i=0; i<times; i++) {
//Flash bright
setTimeout("document.getElementById('"+eid+"').style.color = '#000000'", i*speed);
setTimeout("document.getElementById('"+eid+"').style.backgroundColor = '"+color+"'", i*speed);
- // setTimeout("document.getElementById('"+mapid+",dspCount').style.fontWeight = 'bold'", i*200);
//Flash out
setTimeout("document.getElementById('"+eid+"').style.color = ''", (i*speed) + speedon);
setTimeout("document.getElementById('"+eid+"').style.backgroundColor = ''", (i*speed) + speedon);
- // setTimeout("document.getElementById('"+mapid+",dspCount').style.fontWeight = ''", i*200);
}
-
- //setTimeout("document.getElementById('"+eid+"').className = '"+currentclass+"'", (i*220) + 200);
setTimeout("document.getElementById('"+eid+"').style.backgroundColor = '"+currentColor+"'", (i*speed) + 200);
-//document.getElementById(eid).className=currentclass;
-//document.getElementById(eid).style.backgroundColor=currentColor;
+ setTimeout("document.getElementById('"+eid+"').isBeingFlashed = false", (i*speed) + 220);
}
@@ -761,12 +759,14 @@ function useSolution(mapid, inputSolution, moves, tempWallColor, tempWallEmblem) solution[mapid] = inputSolution;
var animateA = "showTempSolution(\""+mapid+"\", \""+inputSolution+"\", \""+moves+"\", \""+tempWallColor+"\", \""+tempWallEmblem+"\");";
var animateB = "showTempSolution(\""+mapid+"\", \""+inputSolution+"\", \""+moves+"\", false, false);";
+ //TODO: Sticky colors for the placed walls by the user would be cool.
+ //var animateC = "wallColor = false; wallEmblem = false;";
setTimeout(animateA, 50);
- setTimeout(animateB, 100);
- setTimeout(animateA, 150);
- setTimeout(animateB, 200);
+ setTimeout(animateB, 150);
setTimeout(animateA, 250);
- setTimeout(animateB, 450);
+ setTimeout(animateB, 350);
+ setTimeout(animateA, 450);
+ setTimeout(animateB, 550);
}
//Shows a solution for temporary use, see 'RestoreSolution'
function showTempSolution(mapid, tempSolution, moves, tempWallColor, tempWallEmblem) {
@@ -802,30 +802,45 @@ function restoreSolution(mapid) { showTempSolution(mapid, mapdata[mapid].savedSolution, 0, false, false);
}
-function displayMap(mapid, divID, goalSize, solution, moves, challengeMap) {
+function displayMap(mapid, divID, goalSize, solution, moves, challengeMap, isThumb) {
- var stringURL = 'map/'+mapid+".js";
- if (challengeMap == true) stringURL = 'challenge/'+mapid+".js";
+ var stringURL = 'a/map/'+mapid+".js";
+ if (challengeMap == true) stringURL = 'a/challenge/'+mapid+".js";
$.ajax({
type: "GET",
- url: 'map/'+mapid+".js",
+ url: stringURL,
dataType: 'json',
cache: true,
data: '',
//TODO: Better fail option?
fail: (function() { console.log("FAIL Map Download"); }),
complete: function(data) {
- $("#"+divID).html(mapAsHTML(decryptJSON(data.responseText), goalSize)).fadeIn('slow');
- mapdata[mapid].savedSolution = solution;
- restoreSolution(mapid);
+ if (isThumb) {
+ $("#"+divID).html(mapThumbnailHTML(decryptJSON(data.responseText), goalSize)).fadeIn('fast');
+ } else {
+ $("#"+divID).html(mapAsHTML(decryptJSON(data.responseText), goalSize)).fadeIn('fast');
+ //$("#"+divID).html(mapAsHTML(decryptJSON(data.responseText), goalSize)).show();
+ mapdata[mapid].savedSolution = solution;
+ restoreSolution(mapid);
+ }
}
});
}
+var Tile = {
+"o" : "Open",
+"s" : "Start",
+"f" : "Finish",
+"c" : "Checkpoint",
+"r" : "Rock",
+"t" : "Teleport In",
+"u" : "Teleport Out",
+"p" : "Unbuildable",
+"x" : "Single-Path-Rock"};
+
//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);
+function mapAsHTML(map, targetWidth, mapEditor) {
+
map.mapid = map.ID;
//console.log("MapID:", map.mapid);
//console.log("MapObj", map);
@@ -858,19 +873,24 @@ function mapAsHTML(map, targetWidth, demo) { // GOAL WOULD BE THIS LINE INSTEAD.. As it's not retarded.
//var idHandle = map.ID+','+x+','+y;
-
+
//oldy is used for Position too... for now
- if (type == 'o') {
+ if (mapEditor == true) {
+ mapgrid += "<div style='float:left; width:"+tileWidth+"px; height:"+tileWidth+"px; ' class='mapcell "+type+value+"' title='Position: "+x+","+oldy+"' id='"+idHandle+"' onMouseOver='mapEditOver(this)' onMouseDown='mapEditClick(this)' >";
+ mapgrid += "<div id='child_"+idHandle+"' class='child'></div></div>";
+ } else if (type == 'o') {
mapgrid += "<div style='float:left; width:"+tileWidth+"px; height:"+tileWidth+"px; ' class='mapcell "+type+value+"' title='Position: "+x+","+oldy+"' id='"+idHandle+"' onClick='grid_click(this)' >";
mapgrid += "<div id='child_"+idHandle+"' class='child'></div></div>";
} else {
- mapgrid += "<div style='float:left; width:"+tileWidth+"px; height:"+tileWidth+"px; ' class='mapcell "+type+value+"' title='Position: "+x+","+oldy+"' id='"+idHandle+"' >";
+ mapgrid += "<div style='float:left; width:"+tileWidth+"px; height:"+tileWidth+"px; ' class='mapcell "+type+value+"' title='"+Tile[type]+" "+value+" On: "+x+","+oldy+"' id='"+idHandle+"' >";
mapgrid += "<div id='child_"+idHandle+"' class='child'></div></div>";
}
}
}
mapgrid += '</div>';
+ if (mapEditor == true) return mapgrid;
+
var r = '';
//TODO: Track down where that 1 pixel is comingfrom, width-1 is a hack.
@@ -916,6 +936,39 @@ function mapAsHTML(map, targetWidth, demo) { return r;
}
+function mapThumbnailHTML(map, targetWidth, isActive) {
+ if (!targetWidth) targetWidth = 120;
+ var scale = map.width / targetWidth;
+
+ var width = parseInt(map.width / scale);
+ var height = parseInt(map.height / scale);
+ var tileWidth = parseInt(width / map.width);
+
+ width = tileWidth * map.width;
+ height = tileWidth * map.height;
+
+ var mapgrid = '';
+ var r = '';
+ r += map.name;
+
+ mapgrid += '<div class="map" style="width:'+width+'px; height:'+height+'px">';
+ for (var y in map.tiles) {
+ for (var x in map.tiles[y]) {
+ var type = map.tiles[y][x][0];
+ var value = map.tiles[y][x][1];
+ if (!value) value = '';
+
+ mapgrid += "<div style='float:left; width:"+tileWidth+"px; height:"+tileWidth+"px; ' class='mapcell "+type+value+"'>";
+ mapgrid += "</div>";
+ }
+ }
+ mapgrid += '</div>';
+ r += mapgrid;
+ return r;
+}
+
+
+
var ignoreMuteChecks = false;
function setMute(value)
{
diff --git a/js/scores.js b/js/scores.js index 3fba599..e384831 100644 --- a/js/scores.js +++ b/js/scores.js @@ -20,7 +20,8 @@ function scoresRequestPage(mapid, page) { //console.log("Requesting Page", mapid, page, ajax.inUse);
// == Additionally, check for achievements.
- ajax.requestFile = "do.php?r=reqScorePage&mapid="+mapid+"&reqPage="+page;
+ //ajax.requestFile = "do.php?r=reqScorePage&mapid="+mapid+"&reqPage="+page;
+ ajax.requestFile = "a/score/"+mapid+"_"+page+".js";
ajax.onCompletion = scoresRequestPageDone; // Specify function to be executed on response.
//ajax.onLoading = '';
//ajax.onLoaded = '';
@@ -113,10 +114,15 @@ function scoresFormatPage(JO) { //console.log("jo object", JO);
var navi = '';
if (JO.pageCount > 1) {
- navi = "<tr><th colspan='3' style='text-align:center;'>"+formatPageNavi(JO, "scoresShowPage", JO.mapid)+"</th></tr>";
+ navi = "<tr><th class='unselectable' colspan='3' style='text-align:center;'>"+formatPageNavi(JO, "scoresShowPage", JO.mapid)+"</th></tr>";
p = p+navi;
}
- p = p+"<tr title='Updated "+JO.updateTime+"'>";
+
+ var localTime = new Date();
+ var updatedLocalTime = new Date();
+ updatedLocalTime.setTime(JO.updateTime * 1000);
+
+ p = p+"<tr title='Last-Update: "+updatedLocalTime.format("mmm d, h:MM TT")+"'>";
p = p+"<th>Rank</th>";
p = p+"<th style='width:125px; overflow:hidden; text-align:left; padding-left:42px;'>Name</th>";
p = p+"<th>Moves</th>";
@@ -127,9 +133,6 @@ function scoresFormatPage(JO) { var x = 0;
var previousI = 0;
- //TODO !!
- //var isWeeklyMap = (document.getElementById("dl-5").className.indexOf('selected') >= 0);
-
for (var i in JO.users) {
var u = JO.users[i];
var scoredLocalTime = new Date();
@@ -137,33 +140,37 @@ function scoresFormatPage(JO) { var styleClass = '';
- if (previousI != i + 1)
- if (previousI < i - 1 && previousI != 0)
- styleClass = 'border-top: 6px solid #777799;';
- //TODO:
- //var scoredTimeFormat = (isWeeklyMap ? "mmm d, h:MM:ss TT" : "h:MM:ss TT");
- var scoredTimeFormat = (false ? "mmm d, h:MM:ss TT" : "h:MM:ss TT");
+ if (previousI != i + 1 && previousI < i - 1 && previousI != 0) {
+ styleClass = 'border-top: 6px solid #777799;';
+ }
+
+ var wasLongAgo = localTime.getTime() > (scoredLocalTime.getTime() + 43200000); //12*60*60*1000
+ var scoredTimeFormat = (wasLongAgo ? "mmm d, h:MM:ss TT" : "h:MM:ss TT");
var scoredTimeStr = scoredLocalTime.format(scoredTimeFormat);
var rowclass = 'scoreRow'+((i % 2)+1);
-
- if (u.isUser) {
+
+ if (u.ID == userObj.ID) {
rowclass = 'scoreRowSelf';
+ }
+ if (typeof(pointerUserID) != 'undefined' && u.ID == pointerUserID) {
+ setTimeout("useSolution(\""+JO.mapid+"\", \""+u.solution+"\", \""+u.moves+"\", \""+u.wallColor+"\", \""+u.wallEmblem+"\");", 400);
+ pointerUserID = '';
}
if (u.solution) {
rowclass += ' scoreRowSolutionAvailable';
p += "<tr class='"+rowclass+"' ";
p += "onmouseover='showTempSolution(\""+JO.mapid+"\", \""+u.solution+"\", \""+u.moves+"\", \""+u.wallColor+"\", \""+u.wallEmblem+"\")'";
- p += "onclick='useSolution(\""+JO.mapid+"\", \""+u.solution+"\", \""+u.moves+"\", \""+u.wallColor+"\", \""+u.wallEmblem+"\")'";
+ p += "onclick='useSolution(\""+JO.mapid+"\", \""+u.solution+"\", \""+u.moves+"\", \""+u.wallColor+"\", \""+u.wallEmblem+"\");saveScoreLocation("+JO.page+", "+u.ID+");'";
p += "onmouseout='restoreSolution(\""+JO.mapid+"\")' ";
- p += " style='"+styleClass+" color:"+u.displayColor+";' title='Scored "+scoredTimeStr+"'>";
+ p += " style='"+styleClass+";' title='Last improved "+scoredTimeStr+"'>";
} else {
- p = p+ "<tr class='"+rowclass+"' style='"+styleClass+" color:"+u.displayColor+";' title='Scored "+scoredTimeStr+"'>";
+ p = p+ "<tr class='"+rowclass+"' style='"+styleClass+"' title='Last improved "+scoredTimeStr+"'>";
}
// background-color: "+u.background+";
- p = p+ "<td class='scoreMedal'>";
+ p = p+ "<td class='scoreMedal' style='color:"+u.displayColor+"'>";
if (u.medal == 'gold') {
p = p+ "<img title='Current Champion' src='../images/MedalGoldCAR.png'>";
@@ -179,9 +186,12 @@ function scoresFormatPage(JO) { p = p+ "";
p = p+ "<span class='scoreName'><a href='achievements?id="+u.ID+"' style='color:"+u.displayColor+"'>"+u.display+"</a></span>";
p = p+ "</td>";
- p = p+ "<td style='text-align:right;'>"+u.moves+"</td>";
if (u.solution) {
- p += "<td>"+u.points+"</td>";
+ p = p+ "<td style='text-align:right;'><a href='javascript: void(0);'>"+u.moves+"</a></td>";
+ p = p+ "<td style='text-align:right;'>"+u.points+"</td>";
+ } else {
+ p = p+ "<td style='text-align:right;'>"+u.moves+"</td>";
+ p = p+ "<td></td>";
}
p = p+ "</tr>";
@@ -338,11 +348,12 @@ function formatPageNavi(JO, callback) { if (!showedPrevPage)
r = r + ' ... ';
if (JO.page == i) {
- r = r + " <b style='color:#aaaabb; font-size:150%;'>" + i + "</b>";
+ r = r + " <b class='unselectable' style='color:#aaaabb; font-size:150%;'>" + i + "</b>";
} else if (i == JO.userPage) {
- r = r + " <a href='javascript:"+callback+"("+i+", "+arguments[2]+", "+arguments[3]+")' style='color:#99cc99;' title='You are on this page'><i>" + i + '</i></a>';
+ r = r + " <a class='unselectable' href='javascript:"+callback+"("+i+", "+arguments[2]+", "+arguments[3]
+ + ")' style='color:#99cc99;' title='You are on this page'><i>" + i + '</i></a>';
} else {
- r = r + " <a href='javascript:"+callback+"("+i+", "+arguments[2]+", "+arguments[3]+")'>" + i + '</a>';
+ r = r + " <a class='unselectable' href='javascript:"+callback+"("+i+", "+arguments[2]+", "+arguments[3]+")'>" + i + '</a>';
}
showedPrevPage = true;
} else {
@@ -353,18 +364,18 @@ function formatPageNavi(JO, callback) { var prevPage = JO.page - 1;
if (JO.pageCount > 1) {
if (JO.page < JO.pageCount) {
- r = r+" <a class='scoreRight' title='Last' href='javascript:"+callback+"("+JO.pageCount+", "+arguments[2]+", "+arguments[3]+")'>>>></a>";
- r = r+" <a class='scoreRight' title='Next' href='javascript:"+callback+"("+nextPage+", "+arguments[2]+", "+arguments[3]+")'>></a>";
+ r = r+" <a class='scoreRight unselectable' title='Last' href='javascript:"+callback+"("+JO.pageCount+", "+arguments[2]+", "+arguments[3]+")'>>>></a>";
+ r = r+" <a class='scoreRight unselectable' title='Next' href='javascript:"+callback+"("+nextPage+", "+arguments[2]+", "+arguments[3]+")'>></a>";
} else {
- r = r+" <span class='scoreRight'>>>></span>";
- r = r+" <span class='scoreRight'>></span>";
+ r = r+" <span class='scoreRight unselectable'>>>></span>";
+ r = r+" <span class='scoreRight unselectable'>></span>";
}
if (JO.page > 1) {
- r = " <a class='scoreLeft' title='Previous' href='javascript:"+callback+"("+prevPage+", "+arguments[2]+", "+arguments[3]+")'><</a>"+r;
- r = " <a class='scoreLeft' title='First' href='javascript:"+callback+"(1, "+arguments[2]+", "+arguments[3]+")'><<<</a>"+r;
+ r = " <a class='scoreLeft unselectable' title='Previous' href='javascript:"+callback+"("+prevPage+", "+arguments[2]+", "+arguments[3]+")'><</a>"+r;
+ r = " <a class='scoreLeft unselectable' title='First' href='javascript:"+callback+"(1, "+arguments[2]+", "+arguments[3]+")'><<<</a>"+r;
} else {
- r = r+" <span class='scoreLeft'><<<</span>";
- r = r+" <span class='scoreLeft'><</span>";
+ r = r+" <span class='scoreLeft unselectable'><<<</span>";
+ r = r+" <span class='scoreLeft unselectable'><</span>";
}
}
diff --git a/pages/achievements.php b/pages/achievements.php index 6717cbe..249077c 100644 --- a/pages/achievements.php +++ b/pages/achievements.php @@ -1,5 +1,5 @@ <?php
-htmlHeader(array('profile'), 'Pathery Achievements');
+htmlHeader(array('achievements'), 'Pathery Achievements');
?>
<body>
@@ -533,9 +533,9 @@ foreach($achievements as $aType => $a) { echo "Last level earned $aCompleted";
echo "<br />Currently $pronoun $nUCurrent $currency";
echo "
- <div title='$percent% to $nRequired' style='align:left;width:210px;height:16px;background-color:#222;border:1px solid #26b;'>
- <div style='border-right:1px solid #37e;width:$percent%;height:16px;background-color:#26b;'>
- </div>
+ <div class='progressBar' title='$percent% to $nRequired'>
+ <div style='width:$percent%;'>
+ </div>
</div>
";
echo "Next level at $nRequired will unlock: ";
diff --git a/pages/admin.php b/pages/admin.php index 24feda4..e98dc49 100644 --- a/pages/admin.php +++ b/pages/admin.php @@ -9,7 +9,7 @@ topbar($Links); include_once('./includes/datas.php');
include_once('./includes/maps.php');
include_once('./includes/mapoftheday.php');
-include_once('./includes/sqli.php');
+include_once('./includes/sqlEmbedded.php');
include_once('./includes/playerStats.php');
include_once('./includes/chats.php');
diff --git a/pages/challenge.php b/pages/challenge.php index e6dbff2..efc0361 100644 --- a/pages/challenge.php +++ b/pages/challenge.php @@ -97,7 +97,15 @@ $challengeMapID = $_GET["challengeMapID"] + 0; if (!is_int($challengeMapID))
return;
-$mapContent = displayMap(GenerateMapByCode($mapCode), $_GET["challengeMapID"]);
+ $challengeID = $_GET["challengeMapID"];
+
+//$mapContent = displayMap(GenerateMapByCode($mapCode), $_GET["challengeMapID"]);
+
+$mapContent .= "<div id='innerChallengeMapDsp_$challengeID'>\n";
+$mapContent .= "</div>\n";
+$mapContent .= "<script>";
+$mapContent .= " displayMap($challengeID, 'innerChallengeMapDsp_$challengeID', false, '$mysolution', '$mymoves', true);";
+$mapContent .= "</script>";
$challengeResultset = loadChallengesForMap($challengeMapID, $userID);
if($challengeResultset === NULL)
{
diff --git a/pages/challengelist.php b/pages/challengelist.php index ade47b6..51c8f69 100644 --- a/pages/challengelist.php +++ b/pages/challengelist.php @@ -82,14 +82,20 @@ function getChallengeListHtml($challengeListResultset) { $challengeMapID = $firstChallenge['challengeMapID']; //$mapCode = getMapCode($mapid); - $mapCode = $firstChallenge['mapCode']; - $map = new map($mapCode); - $thumbnail = DisplayMapThumbnail($map); + //$mapCode = $firstChallenge['mapCode']; + //$map = new map($mapCode); + //$thumbnail = DisplayMapThumbnail($map); $r .= "<div class='challengelist_map' onclick='document.location.href=\"challenge?challengeMapID=$challengeMapID\"'>"; - $r .= "$map->name"; - $r .= $thumbnail; + //$r .= "$map->name"; + //$r .= $thumbnail; + $r .= "<div id='innerChallengeMapDspThumb_$challengeMapID'>\n"; + $r .= "</div>\n"; + $r .= "<script>"; + $r .= " displayMap($challengeMapID, 'innerChallengeMapDspThumb_$challengeMapID', 170, '', '', true, true);"; + $r .= "</script>"; + foreach ($challenge as $ordering => $content) { //Each challenge gets its own star if($content["dateSolved"] !== NULL) diff --git a/pages/chat.php b/pages/chat.php index b90226c..c6ff79c 100644 --- a/pages/chat.php +++ b/pages/chat.php @@ -45,6 +45,9 @@ function getChatDone(data) { var p; //our prep string
var newChats = false;
+ var lastDisplay = '';
+ var lastMessage = '';
+
////console.log('datalength', data.length);
if (data.length < 3 || data == 'false')
@@ -58,52 +61,69 @@ function getChatDone(data) { //console.log("JSON PREPED");
- $.each(json, function(key, user) {
+ $.each(json, function(key, chat) {
var postDate = new Date();
- postDate.setTime(postDate.getTime() + user.secondsSince * 1000);
+ postDate.setTime(postDate.getTime() + chat.secondsSince * 1000);
//var timestamp = postDate.format("ddd h:MM TT");
//var timestamp = postDate.format("h:MM:ss");
var timestamp = postDate.format("hh:MM:ss");
+ var timestampDetails = postDate.format("ddd h:MM TT");
var strClass = '';
- if (user.userID == userObj.ID) {
+ if (chat.userID == userObj.ID) {
strClass += ' self';
- }
- if (user.userID == '-1') {
+ }
+ if (chat.userID == '-1') {
strClass += ' server';
- user.displayName = 'SERVER'
+ chat.displayName = 'SERVER'
}
-
+
+ var usernameClass = '';
+ if (chat.message.indexOf("/me ") == 0) {
+ chat.message = chat.message.substring(4);
+ usernameClass = ' me';
+ }
+
+ var isSpoiler = false;
+ if (chat.message.indexOf("/spoiler ") == 0) {
+ chat.message = chat.message.substring(9);
+ isSpoiler = true;
+ }
+
+
//console.log("INSIDE BUILD START");
p = '';
p = p+ " <div class='chatColumn1'>";
- p = p+ " <span class='chatTimestamp'>["+timestamp+"]</span>";
- p = p+ " <div class='grid_td chatBadge' style='float:left; width:35px; height:35px; background:"+user.wallColor+" url(images/marks/"+user.wallEmblem+");'>";
+ p = p+ " <span class='chatTimestamp' title='"+timestampDetails+"'>["+timestamp+"]</span>";
+ p = p+ " <div class='grid_td chatBadge' style='float:left; width:35px; height:35px; background:"+chat.wallColor+" url(images/marks/"+chat.wallEmblem+");'>";
p = p+ " <div style='background-color:transparent;' class='grid_td_inner grid_td_rocks'>";
p = p+ " </div>";
p = p+ " </div>";
p = p+ " </div>";
p = p+ " <div class='chatColumn2'>";
- if (user.userID == '-1') {
- p = p+ "<span class='chatUsername'><a href='home'>";
+ if (chat.userID == '-1') {
+ p = p+ "<span class='chatUsername"+usernameClass+"'><a href='home'>";
} else {
- p = p+ "<span class='chatUsername'><a href='achievements?id="+user.userID+"' style='color:"+user.displayColor+"'>";
+ p = p+ "<span class='chatUsername"+usernameClass+"'><a href='achievements?id="+chat.userID+"' style='color:"+chat.displayColor+"'>";
}
- p = p+ user.displayName+"</a>:</span>";
+ p = p+ chat.displayName+"</a></span>";
- p = p+ " <span class='chatText'>";
- p = p+ htmlEncode(user.message);
+ if (isSpoiler == true) p = p+ " <span class='chatText spoiler' onclick='spoil(this);'>";
+ else p = p+ " <span class='chatText'>";
+ p = p+ chatReplaceAndEncode(chat.message);
p = p+ " </span>";
p = p+ " </div>";
//Message is legitmently new or a server message?
- if (user.ID > lastID || typeof(user.ID) == 'undefined') {
- items.push('<div class="chatMessage'+strClass+'" id="C_' + user.ID + '">' + p + '</div>');
+ if (chat.ID > lastID || typeof(chat.ID) == 'undefined') {
+ items.push('<div class="chatMessage'+strClass+'" id="C_' + chat.ID + '">' + p + '</div>');
newChats = true;
}
- if (user.ID > 0) lastID = user.ID;
+ lastDisplay = chat.displayName
+ lastMessage = chat.message
+ if (chat.ID > 0) lastID = chat.ID;
});
//console.log("BUILD DONE");
@@ -111,32 +131,55 @@ function getChatDone(data) { if (newChats) {
if (chatTimerDelay > chatTimerDelayLower) chatTimerDelay -= 1000;
- var new_chatDiv = $('<div/>', {
- 'class': 'my-new-list',
- //'style': 'display: none',
- html: items.join('')
- });
var elem = $("#chatContainer");
- //var atBottom = (elem[0].scrollHeight - elem.scrollTop() == elem.outerHeight());
var atBottom = (elem.scrollTop() >= elem[0].scrollHeight - elem.outerHeight() - 1);
-
-
- //var elem = $("#chatContainer"); console.log ("Ret", elem[0].scrollHeight, elem.scrollTop(), elem.outerHeight(), elem[0].scrollHeight - elem.scrollTop());
-
- //new_chatDiv.appendTo('#chatContainer').slideDown('fast');
- new_chatDiv.appendTo('#chatContainer');
-
+
+ $("#chatContainer").append(items.join(''));
+
if (atBottom || firstGetChat) {
$("#chatContainer").scrollTop($("#chatContainer")[0].scrollHeight);
firstGetChat = false;
}
- soundManager.setVolume('charm', 20);
- soundManager.setPan('charm', -60)
- soundManager.setPosition('charm',150);
- soundManager.play('charm');
+ document.title = lastDisplay+': '+lastMessage.substring(0, 10)+'... Pathery Chat';
+ if (chatIsMuted == 'true') {
+ soundManager.setVolume('charm', 20);
+ soundManager.setPan('charm', -60)
+ soundManager.setPosition('charm',150);
+ soundManager.play('charm');
+ }
}
}
+function chatReplaceAndEncode(chat) {
+ chat = htmlEncode(chat);
+ chat = chat.replace(/\*\*(\S(.*?\S)?)\*\*/gm, "<b>$1</b>");
+ chat = chat.replace(/\~\~(\S(.*?\S)?)\~\~/gm, "<s>$1</s>");
+ chat = chat.replace(/\*(\S(.*?\S)?)\*/gm, "<i>$1</i>");
+
+ chat = replaceSmileys(chat);
+
+ //Surround all URLs with a <a> link
+ var URLexp = /(\b(https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/ig;
+ chat = chat.replace(URLexp, "<a href='redirect?to=$1' target='_blank'>$1</a>");
+
+ //Replace # in the URL with %23
+ chat = chat.replace(/<a href='redirect\?to=(.*?)(#)(.*?)' target='_blank'>/ig, "<a href='redirect?to=$1%23$3' target='_blank'>");
+ chat = chat.replace(/<a href='redirect\?to=(.*?)(&)(.*?)' target='_blank'>/ig, "<a href='redirect?to=$1%26$3' target='_blank'>");
+ //Making the bet that not all browsers do the same:
+ chat = chat.replace(/<a href='redirect\?to=(.*?)(&)(.*?)' target='_blank'>/ig, "<a href='redirect?to=$1%26$3' target='_blank'>");
+
+ return chat;
+}
+
+function replaceSmileys(chat) {
+ chat = chat.replace(/:\)/g, '<img class="chatSmiley" src="images/smileys/Smiling.png" />');
+ chat = chat.replace(/\(:/g, '<img class="chatSmiley" src="images/smileys/Smiling.png" />');
+ //chat = chat.replace(/:\//g, '<img class="chatSmiley" src="images/smileys/Uncertain.png" />');
+ chat = chat.replace(/:\(/g, '<img class="chatSmiley" src="images/smileys/Unhappy.png" />');
+ chat = chat.replace(/\<3/g, '<img class="chatSmiley" src="images/smileys/Heart.png" />');
+ return chat;
+}
+
function prepChat(chat) {
chat = chat.join('|:|');
chat = chat.replace(/\&/g,'%26')
@@ -144,6 +187,10 @@ function prepChat(chat) { return chat;
}
+function spoil(obj) {
+ $(obj).removeClass("spoiler");
+}
+
function getChat(message) {
var dataString = 'getChatFromID='+lastID;
if (chatBuffer.length > 0) {
@@ -166,8 +213,8 @@ function sendChat() { $("input#message").val('');
if (skipNextGetChat == false) {
skipNextGetChat = true;
- getChat();
}
+ getChat();
return false;
}
@@ -187,6 +234,23 @@ function htmlEncode(value){ }
}
+
+<?
+$chatMute = (isset($_COOKIE['pref_chatMute']) && $_COOKIE['pref_chatMute'] == "true");
+$chatMute = ($chatMute) ? 'true' : 'false';
+?>
+var chatIsMuted = '<? echo $chatMute; ?>';
+function setChatMute() {
+ var value = chatIsMuted;
+
+ $('#chatMute').removeClass("chatMute_"+value);
+ if (value == 'true') value = 'false';
+ else value = 'true';
+ chatIsMuted = value;
+ $('#chatMute').addClass("chatMute_"+value);
+ savePref('chatMute', value);
+}
+
</script>
<div class='wrapper'>
@@ -198,6 +262,12 @@ function htmlEncode(value){ <form id='sendChat' onsubmit="return false">
<? if($accepted) { /*Only show the chat button if we're logged in*/ ?>
<input type="hidden" name="stuff" value="1724">
+
+ <?
+ echo "
+ <a title='Mute sound?' class='chatMute_$chatMute unselectable' href='javascript:setChatMute()' id='chatMute'/></a>";
+ ?>
+
<input class='chatButton' type="button" class="send" id='chatSendBtn' value='Send' onClick="sendChat();">
<input class='chatInputMessage' type="text" name="message" id="message" value="" maxlength="255" autocomplete="off" >
<? } ?>
diff --git a/pages/home.php b/pages/home.php index 544b3fe..8c88d49 100644 --- a/pages/home.php +++ b/pages/home.php @@ -9,7 +9,7 @@ include_once ('./includes/constants.php'); htmlHeader(
array('stats'), 'Pathery',
- 'Compete to create the longest path possible. New maps every day!',
+ 'Path lengthening competition inspired by Tower Defense mazing concepts',
array('scores', 'dateformat')
);
diff --git a/pages/login.php b/pages/login.php index 9358d89..e9bc13a 100644 --- a/pages/login.php +++ b/pages/login.php @@ -132,6 +132,8 @@ try { throwLoginError($d, "Unknown DB Registration failure");
exit;
}
+ include_once('includes/chats.php');
+ addchat(-1, "New user registered: \"$display\"");
}
//If 'remember me' use this for cookie password
//$_SESSION['Passcode'] = MD5($Password.$Pepper.$Username);
diff --git a/pages/mapeditor.php b/pages/mapeditor.php new file mode 100644 index 0000000..0d6cf94 --- /dev/null +++ b/pages/mapeditor.php @@ -0,0 +1,314 @@ +<?php +include_once('./includes/maps.php'); +include_once('./includes/mapclass.php'); + +//Self-ajax. +if ($_REQUEST['mapByCode']) { + $map = new map($_REQUEST['mapByCode']); + echo json_encode($map); + exit; +} + +if ($_REQUEST['mapByMap']) { + $jsonMap = json_decode($_REQUEST['mapByMap']); + + $map = new map(); + foreach ($jsonMap as $key => $value) { + $map->$key = $value; + } + //Store the code in the object + $code = $map->getOldCode(); + $map->code = $code; + echo json_encode($map); + exit; +} + + +htmlHeader(array('stats', 'mapeditor'), 'Map Editor', + 'Map Editor', + array('dateformat')); + + +?> + +<body> +<?php +echo soundManager2(); +topbar($Links); + +?> +<script> + + +var testMap = new Object; + +testMap.ID = 0; +testMap.editMap = true; +testMap.width = 6; +testMap.height = 5; +testMap.tiles = constructTiles(6, 5); +testMap.name = 'Testmap'; +testMap.walls = 5; + +setTimeout("reloadMap();", 500); +setTimeout("start();", 500); +function start() { + //$('#testMapDisplay').html(mapAsHTML(testMap)); + + $(window).mousedown(function(){ + mouseIsDown = true; + + }); + + $(window).mouseup(function(){ + mouseIsDown = false; + }); + +} + +var mouseIsDown = false; + +var mapHasChanged = false; +function mapEditOver(obj) { + if (mouseIsDown == true) mapEditClick(obj); +} +function mapEditClick(obj) { + + console.log("Map Click"); + tmp = obj.id.split(','); + mapid = tmp[0] - 0; + //hack hacky hack. + y = tmp[1] - 1; + x = tmp[2]; + + testMap.tiles[y][x] = Array(palleteType, palleteValue); + y++; + $(obj).attr('class', 'mapcell '+palleteType+palleteValue); + mapHasChanged = true; +} + +getMapTimer(); +function getMapTimer() { + setTimeout("getMapTimer()", 3000); + if (mapHasChanged) { + loadPlayableMap(); + mapHasChanged = false; + } +} + + +var palleteType = 's'; +var palleteValue = ''; +function paletteSelect(type, value) { + palleteValue = value; + palleteType = type; +} + +function plusWalls() { + testMap.walls = testMap.walls - 0 + 1; + reloadMap(); +} +function minusWalls() { + testMap.walls = testMap.walls - 1; + reloadMap(); +} +function plusWidth() { + changeDimensions(testMap.width - 0 + 1, testMap.height) +} +function minusWidth() { + changeDimensions(testMap.width - 1, testMap.height) +} +function plusHeight() { + changeDimensions(testMap.width, testMap.height - 0 + 1) +} +function minusHeight() { + changeDimensions(testMap.width, testMap.height - 1) +} + +function changeDimensions(width, height) { + + testMap.tiles = constructTiles(width, height, testMap); + //testMap.tiles[0][3] = Array('s'); + //testMap.tiles[4][3] = Array('f'); + testMap.width = width; + testMap.height = height; + console.log('rl'); + reloadMap(); +} + +var playableMap; +function reloadMap() { + $('#testMapDisplay').html(mapAsHTML(testMap, 590, true)); + //Duplicate object + var returnedMap = jQuery.extend(true, {}, testMap); + + loadPlayableMap(); +} + +var isLoadingMap = false; +function loadPlayableMap() { + + if (isLoadingMap == true) return; + isLoadingMap = true; + + var URLString = 'mapeditor?mapByMap='+JSON.stringify(testMap); + $.ajax({ + type: "GET", + url: URLString, + cache: true, + data: '', + fail: function() { alert("error"); }, + complete: function(data) { + playableMap = decryptJSON(data.responseText); + playableMap.editMap = false; + playableMap.ID = -1; + $('#playableMapDisplay').html(mapAsHTML(playableMap, 960)); + $('#playableMapCodeDisplay').val(playableMap.code); + isLoadingMap = false; + } + }); +} + +function loadMap(by) { + + var URLString = ''; + var mapID = 0; + if (by == 'ID') { + mapID = $('#mapID').val(); + URLString = 'a/map/'+mapID+'.js'; + } else if (by == 'code') { + mapCode = $('#mapCode').val(); + URLString = 'mapeditor?mapByCode='+mapCode; + } + $.ajax({ + type: "GET", + url: URLString, + cache: true, + data: '', + fail: function() { alert("error"); }, + complete: function(data) { + var map = decryptJSON(data.responseText); + testMap = map; + testMap.ID = 0; + testMap.editMap = true; + reloadMap(); + } + }); +} + +function constructTiles(width, height, baseMap) { + console.log('construct start'); + var tiles = new Array; + for (var y = 0; y < height; y++) { + tiles[y] = new Array; + for (var x = 0; x < width; x++) { + tiles[y][x] = new Array; + if (typeof(baseMap) !== 'undefined' && + typeof(baseMap.tiles[y]) !== 'undefined' && + typeof(baseMap.tiles[y][x]) !== 'undefined' + ) tiles[y][x] = baseMap.tiles[y][x]; + else tiles[y][x][0] = 'o'; + } + } + console.log('construct done'); + return tiles; +} + +</script> + +<div class='wrapper'> + +<h3>Map Editor Beta</h3> + + + <div class='wrapper'> + <form> + <fieldset> + <legend>Load Map:</legend> + <div class='plusMinus'> + Load map by ID:<input id='mapID' size="5" type="text" value="" class="forminput"/> + <input type="button" value="Load" class="forminput" onclick='loadMap("ID")'/> + </div> + + <div class='plusMinus' style='width:300px;'> + Load map by code:<input id='mapCode' size="30" type="text" value="" class="forminput"/> + <input type="button" value="Load" class="forminput" onclick='loadMap("code")'/> + </div> + + </fieldset> + + </form> + </div> + + <form><div> + <div class='' id='' style='float:left; width:340px;height:350px;'> + + <fieldset style='width:300px'> + <legend>Settings:</legend> + <div class='plusMinus'> + Height:<input type="button" value="+" class="forminput" onclick='plusHeight()'/> + <input type="button" value="-" class="forminput" onclick='minusHeight()'/> + </div> + <div class='plusMinus'> + <span style='width:70px;'>Width:</span><input type="button" value="+" class="forminput" onclick='plusWidth()'/> + <input type="button" value="-" class="forminput" onclick='minusWidth()'/> + </div> + <div class='plusMinus'> + <span style='width:70px;'>Walls:</span><input type="button" value="+" class="forminput" onclick='plusWalls()'/> + <input type="button" value="-" class="forminput" onclick='minusWalls()'/> + </div> + + <div style='clear:both'></div> + + <?PHP + $tilesArray = array( + 's', 's2', 'f', 'w', + 'space', + 'r', 'r2', 'o', 'q', 'x', 'x2', + 'space', + 'c', 'c2', 'c3', 'c4', 'c5', + 'space', + 't', 't2', 't3', 't4', 't5', + 'space', + 'u', 'u2', 'u3', 'u4', 'u5' + ); + + foreach($tilesArray as $key) { + if ($key == 'space') { + echo '<div style="clear:both"></div>'; + continue; + } + + echo " + <div class='tileDisplay map'> + <div class='$key' onclick=\"paletteSelect('$key[0]', '$key[1]')\"></div> + </div>"; + } + + ?> + + </fieldset> + </div> + <fieldset style='width:590px'> + <legend>Edit Map:</legend> + <div id='testMapDisplay' style='float:left;'> + Loading... + </div> + </fieldset> + </div></form> + <div style='clear:both;'></div> + + <div class="divide"><strong>Playable Map</strong></div> + <div style='clear:both;'></div> + <div class='wrapper'> + MapCode: <input id='playableMapCodeDisplay' size="100" type="text" value="" class="forminput"/> + </div> + <div id='playableMapDisplay' style='float:left;'> + Returned map goes here. + </div> + <div style='clear:both;'></div> +</div> + +<?php +htmlFooter(); +?>
\ No newline at end of file diff --git a/pages/massemail.php b/pages/massemail.php index 4bbd26b..d2634ef 100644 --- a/pages/massemail.php +++ b/pages/massemail.php @@ -77,7 +77,7 @@ if ($_POST['queueMassEmail'] == 'true') { exit;
}
-include_once('./includes/sqli.php');
+include_once('./includes/sqlEmbedded.php');
$res = mysqli_query($mysqli, "SELECT count(*) as count FROM `emailQueue`");
$row = mysqli_fetch_assoc($res);
diff --git a/pages/scores.php b/pages/scores.php index f3ce459..90c87bb 100644 --- a/pages/scores.php +++ b/pages/scores.php @@ -1,6 +1,6 @@ <?php
htmlHeader(
- array('stats', 'challenge'), 'Scores',
+ array('stats'), 'Scores',
'Score history for Pathery',
array('scores', 'dateformat')
);
@@ -15,13 +15,13 @@ if (isset($_GET['date'])) { } else $dateLookup = $dateDisplay;
-$dateNextDay = date('Y-m-d', strtotime("+1 day", $dateAgo));
-
-//!! TODO:
-$timeUntilNewDailyMap = strtotime("tomorrow") - strtotime("now");
+$jsYear = date("Y");
+//The part where you face palm...
+$jsMonth = date("n") - 1;
+$jsDay = date("j");
+$jsDate = "$jsYear,$jsMonth,$jsDay";
?>
-
<script type="text/javascript" src="js/jquery.keystrokes.min.js"></script>
<script type="text/javascript">
@@ -30,18 +30,12 @@ playerWallEmblem = '<?PHP echo isset($wallEmblem) ? $wallEmblem : ''; ?>'; </script>
<script>
+var startOfPathery = new Date(2011,2,13);
-
-var tomorrow = new Date();
-tomorrow.setTime(tomorrow.getTime() + <? echo $timeUntilNewDailyMap; ?> * 1000);
-var serverTomorrow = '<? echo $dateNextDay; ?>';
-
-var serverTime = new Date();
-serverTime.setTime(<? echo time() * 1000; ?>);
+var serverToday = new Date(<? echo $jsDate; ?>);
var pointerTime = new Date();
-pointerTime.setTime(serverTime.getTime())
-
+pointerTime.setTime(serverToday.getTime())
setTimeout("start();", 500);
@@ -55,12 +49,28 @@ function start() { if (typeof(hashParts[1]) !== 'undefined') {
pointerMapID = hashParts[1];
}
+ if (typeof(hashParts[2]) !== 'undefined' && hashParts[2]-0 > 0) {
+ pointerPage = hashParts[2];
+ } else pointerPage = 1;
+ if (typeof(hashParts[3]) !== 'undefined') {
+ pointerUserID = hashParts[3];
+ }
//+1 because i'm gonna use prev.
pointerTime = new Date(dateSplit[0],dateSplit[1]-1,dateSplit[2]-0+1);
}
getMapIDs('prev');
}
-//$(window).on('hashchange', function() {
+
+function addDay(dateObj) {
+ var d = dateObj;
+ d.setDate(d.getDate()+1);
+ return d;
+}
+function minusDay(dateObj) {
+ var d = dateObj;
+ d.setDate(d.getDate()-1);
+ return d;
+}
//Contra
$(document).bind('keystrokes', {
@@ -80,47 +90,80 @@ function displayMapScores(mapID) { $('#scoreDisplay').empty();
newDiv.prependTo('#scoreDisplay');
}
- scoresShowPage(1, mapID);
+
+ //Set the 'selectedMap' class
+ $('.selectedMap').removeClass('selectedMap');
+ var currentMapDiv = $('#thumb_'+mapID).children();
+ currentMapDiv.addClass('selectedMap');
+
+ //Hack: display the "current map" div for currently running maps
+ //Relies on the fact that the #thumb_<mapId> div has a single child with the 'current' class..
+ var showCurrentMapMessage = currentMapDiv.hasClass('currentlyRunning');
+ $('#currentlyRunningMessage').toggle(showCurrentMapMessage);
+
$("#mapDisplay").fadeOut('fast');
- displayMap(mapID, "mapDisplay", 622);
+ displayMap(mapID, "mapDisplay", 682);
+ scoresShowPage(pointerPage, mapID);
+ //console.log(pointerPage, mapID);
}
-
function updateHash() {
var tmp = document.location + '';
tmp = tmp.split("#");
var anchorTag = tmp[0]+'#'+pointerDate;
anchorTag += "_"+pointerMapID;
+ if (pointerPage) anchorTag += "_"+pointerPage;
+ else anchorTag += "_";
+ if (pointerUserID) anchorTag += "_"+pointerUserID;
+ else anchorTag += "_";
document.location=anchorTag;
}
+var pointerPage = 1, pointerUserID
+function saveScoreLocation(page, userID) {
+ pointerPage = page;
+ pointerUserID = userID;
+ updateHash();
+ console.log("SaveScoreLoc");
+}
+
var pointerDate;
function getMapIDs(request) {
switch (request) {
case "next":
- if (pointerTime.getTime() + (24*60*60*1000) < serverTime.getTime()) {
- pointerTime.setTime(pointerTime.getTime() + (24*60*60*1000));
+ if (pointerTime.getTime() < serverToday.getTime()) {
+ addDay(pointerTime);
pointerDate = pointerTime.format("yyyy-mm-dd");
} else return;
break;
case "prev":
- if (pointerTime.getTime() + (24*60*60*1000) > 1) {
- pointerTime.setTime(pointerTime.getTime() - (24*60*60*1000));
+ if (pointerTime.getTime() > startOfPathery.getTime()) {
+ minusDay(pointerTime);
pointerDate = pointerTime.format("yyyy-mm-dd");
} else return;
break;
}
- $('#displayDate').html(pointerTime.format("dddd, mmmm dS, yyyy"));
- if (pointerTime.getTime() + (1*24*60*60*1000) > serverTime.getTime()) {
+ var timeDisplayPrefix = '';
+ if (pointerTime.getTime() >= serverToday.getTime()) {
$('#mapNavRight').removeClass('mapNavActive');
$('#mapNavRight').addClass('mapNavDisabled');
+ timeDisplayPrefix = '<i title="(Server Time)">Today </i>';
} else {
$('#mapNavRight').addClass('mapNavActive');
$('#mapNavRight').removeClass('mapNavDisabled');
}
+ if (pointerTime.getTime() <= startOfPathery.getTime()) {
+ $('#mapNavLeft').removeClass('mapNavActive');
+ $('#mapNavLeft').addClass('mapNavDisabled');
+ timeDisplayPrefix = '<i title="The start!">Pathery Started </i>';
+ } else {
+ $('#mapNavLeft').addClass('mapNavActive');
+ $('#mapNavLeft').removeClass('mapNavDisabled');
+ }
+ $('#displayDate').html(timeDisplayPrefix+pointerTime.format("dddd, mmmm dS, yyyy"));
- var urlString = "ajax/scores.ajax.php?getmapidsbydate="+pointerDate;
+ var urlString = "a/mapsbydate/"+pointerDate+'.js';
updateHash();
$.ajax({
type: "GET",
@@ -152,15 +195,18 @@ function getMapIDsResponse(response) { //Add non-existing maps
//console.log("going through json", json);
+ var lastMapID = 0;
$.each(json, function(key, mapID) {
//console.log("add: compare:", mapID, mapsInNav);
if (jQuery.inArray(mapID, mapsInNav) == -1) {
addMapToNav(mapID);
- if (goToPointer == true && pointerMapID < 0) {
- pointerMapID = mapID;
- }
+ lastMapID = mapID;
}
});
+ if (goToPointer == true && pointerMapID < 0) {
+ pointerMapID = lastMapID;
+ }
+
//Don't queue animations...
if ($('#mapNavigation').is(':animated')) {
$("#mapNavigation").show(0);
@@ -176,12 +222,9 @@ function addMapToNav(mapID) { //console.log("adding map to nav:", mapID);
var $newdiv1 = $("<div style='float:left;min-width:120px;' id='thumb_"+mapID+"'/>");
- //$("#mapNavigation").append($newdiv1);
$("#mapNavigation").prepend($newdiv1);
-
- //var URLString = 'map/'+mapID+'.js';
- var URLString = 'map/'+mapID;
-
+
+ var URLString = 'a/map/'+mapID+'.js';
$.ajax({
type: "GET",
url: URLString,
@@ -189,70 +232,43 @@ function addMapToNav(mapID) { data: '',
fail: function() { alert("error"); },
complete: function(data) {
- $("#thumb_"+mapID).html(mapThumbnailHTML(decryptJSON(data.responseText), 120)).show();
+ var map = decryptJSON(data.responseText);
+ var mapDate = new Date(map.dateExpires*1000);
+ isActive = mapDate.getTime() > serverToday.getTime();
+
+
+ $("#thumb_"+mapID).html(formatMapThumbForNav(data.responseText)).show();
+ //$("#thumb_"+mapID).html(mapThumbnailHTML(map, 120, isActive)).show();
}
});
mapsInNav.unshift(mapID);
}
-function removeMapFromNav(mapID) {
- //console.log("remove map:", mapID, mapsInNav.indexOf(mapID));
- $("#thumb_"+mapID).hide('fast', function(){ $("#thumb_"+mapID).remove(); });
-}
-
-var Tile = {"Wall" : "w",
-"Empty" : "o",
-"Start" : "o",
-"Finish" : "o",
-"Checkpoint" : "o",
-"TileRock" : "o",
-"TeleportIn" : "o",
-"TeleportOut" : "o",
-"Unbuildable" : "o",
-"SinglePath" : "o"};
-
-function mapThumbnailHTML(map, targetWidth) {
- if (!targetWidth) targetWidth = 120;
- var scale = map.width / targetWidth;
-
- var width = parseInt(map.width / scale);
- var height = parseInt(map.height / scale);
- var tileWidth = parseInt(width / map.width);
-
- width = tileWidth * map.width;
- height = tileWidth * map.height;
-
- var mapgrid = '';
-
+function formatMapThumbForNav(json) {
+ var map = decryptJSON(json);
+ var mapDate = new Date(map.dateExpires*1000);
var mapClass = '';
var toolTip = 'Inactive map';
- var mapDate = new Date(map.dateExpires*1000);
- if (mapDate.getTime() > serverTime.getTime()) {
- mapClass = ' current';
+
+ var isCurrentlyRunning = mapDate.getTime() > serverToday.getTime();
+
+ if (isCurrentlyRunning) {
+ mapClass = ' currentlyRunning';
toolTip = 'This map can still be played.';
}
-
+
var r = '';
r += "<div class='mapThumbnail"+mapClass+"' title='"+toolTip+"'; onclick='displayMapScores("+map.ID+")'>";
- r += map.name;
-
- mapgrid += '<div class="map" style="width:'+width+'px; height:'+height+'px">';
- for (var y in map.tiles) {
- for (var x in map.tiles[y]) {
- var type = map.tiles[y][x][0];
- var value = map.tiles[y][x][1];
- if (!value) value = '';
-
- mapgrid += "<div style='float:left; width:"+tileWidth+"px; height:"+tileWidth+"px; ' class='mapcell "+type+value+"'>";
- mapgrid += "</div>";
- }
- }
- mapgrid += '</div>';
-
- r += mapgrid;
+ r += mapThumbnailHTML(map, 120, isActive);
r += '</div>';
return r;
+
+}
+
+function removeMapFromNav(mapID) {
+ //console.log("remove map:", mapID, mapsInNav.indexOf(mapID));
+ $("#thumb_"+mapID).hide('fast', function(){ $("#thumb_"+mapID).remove(); });
}
</script>
@@ -265,22 +281,22 @@ topbar($Links); <div class="wrapper">
- <div style='font-size: 105%;text-align:center;padding-bottom:7px;' id='displayDate'>
+ <div id='displayDate'>
Loading...
</div>
<div class='mapNavCon'>
- <div id='mapNavLeft' class='mapNavLeft mapNavActive' onclick='javascript:getMapIDs("prev");'><</div>
- <div id='mapNavRight' class='mapNavRight mapNavActive' onclick='javascript:getMapIDs("next");'>></div>
+ <a id='mapNavLeft' class='mapNavLeft mapNavActive unselectable' href='javascript:getMapIDs("prev");'><</a>
+ <a id='mapNavRight' class='mapNavRight mapNavActive unselectable' href='javascript:getMapIDs("next");'>></a>
<div class='mapNavCenter'>
<div id='mapNavigation'></div>
</div>
</div>
-
+ <div id="currentlyRunningMessage"><span>This map hasn't completed yet, so points/solutions are not available</span></div>
<div style='clear:both'></div>
<div>
- <div id='scoreDisplay' style="float:left;"></div>
- <div id='mapDisplay' style='display:none; float:left;' class="col2"></div>
+ <div class='scoreCol' id='scoreDisplay'></div>
+ <div class="mapCol" id='mapDisplay' style='display:none; float:left;'></div>
</div>
diff --git a/pages/share.php b/pages/share.php index 098c281..3c72c11 100644 --- a/pages/share.php +++ b/pages/share.php @@ -6,10 +6,12 @@ htmlHeader(array('stats')); <body>
<?php
+echo soundManager2();
topbar($Links);
include('./includes/maps.php');
+include('./includes/mapclass.php');
@@ -18,18 +20,28 @@ if (is_int($_GET['mapid'] + 0)) $mapcode = getMapCode($mapID);
//New code:
-if ($_GET['mapcode'])
- $mapcode = $_GET['mapcode'];
+if ($_GET['mapcode']) $mapcode = $_GET['mapcode'];
-$map = GenerateMapByCode($mapcode);
+//$map = GenerateMapByCode($mapcode);
+$map = new map($mapcode);
+$map->ID = 0;
+
+echo "<div class='wrapper'>";
+echo "<script>";
+echo "document.write(mapAsHTML(";
+echo json_encode($map);
+echo "))";
+echo "</script>";
+echo "</div>";
//echo DisplayMap($map, 1, 'example', 1);
-echo DisplayMap($map, 1);
+//echo DisplayMap($map, 1);
?>
+
<script>
loadSol('1:<? echo $_GET[solution]; ?>');
</script>
diff --git a/redirect.php b/redirect.php new file mode 100644 index 0000000..e010d94 --- /dev/null +++ b/redirect.php @@ -0,0 +1,83 @@ +<?
+$to = $_GET['to'];
+include('globe.php');
+?>
+<html>
+
+<head>
+<title>Pathery.com - Redirecting...</title>
+
+<meta http-equiv="refresh" content="6;URL=<? echo $to; ?>">
+
+<style>
+body {
+background-color: #121212;
+color:#ddd
+}
+
+.update {
+ background-color: #222229;
+ margin:0 auto;
+ margin-top: 200px;
+ width:400px;
+ border: 0px outset #aaa;
+ padding: 10px;
+ border-radius: 25px;
+}
+h3 {
+ text-align: center;
+}
+
+.buttons a {
+ margin: 10px;
+ opacity: 0.7;
+ filter: alpha(opacity=70);
+}
+.buttons a:hover {
+ opacity: 1;
+ filter: alpha(opacity=100);
+}
+
+a {
+ text-decoration: underline;
+ color: #aaaa99;
+}
+a:hover {
+ text-decoration: underline;
+ color: #FFFFFF;
+}
+</style>
+
+<script>
+
+var timeLeft = 5;
+var countdownRedirectInt = self.setInterval(countdownRedirect, 1000);
+
+function countdownRedirect() {
+ if (timeLeft <= 0) {
+ return;
+ }
+ timeLeft--;
+ var handle = document.getElementById("redirectTitle")
+ handle.innerHTML = 'You are being redirected in '+timeLeft+' seconds';
+
+ if (timeLeft <= 0) {
+ window.location = "<? echo $to; ?>";
+ }
+}
+// http://www.mazetd.4xg.net/redirect?to=http://www.mazetd.4xg.net/redirect?to=http://www.youtube.com/watch?v=FCSBoOcGFFE
+</script>
+
+</head>
+<body>
+
+<div class='update'>
+<h3 id='redirectTitle'>You are being redirected in 5 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>
+</p>
+</div>
+
+</body>
+</html>
\ No newline at end of file |