summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ajax/scores.ajax.php2
-rw-r--r--changelog/.htaccess1
-rw-r--r--css/page.css11
-rw-r--r--css/stats.css2
-rw-r--r--do.php52
-rw-r--r--globe.php13
-rw-r--r--images/marks/rotate.php67
-rw-r--r--images/rotate.php20
-rw-r--r--includes/.htaccess1
-rw-r--r--includes/chats.php3
-rw-r--r--includes/constants.php28
-rw-r--r--includes/datas.php150
-rw-r--r--includes/header.php60
-rw-r--r--index.php14
-rw-r--r--js/mapspecs.js30
-rw-r--r--js/scores.js13
-rw-r--r--pages/achievements.php171
-rw-r--r--pages/admin.php8
-rw-r--r--pages/chat.php2
-rw-r--r--pages/home.php2
-rw-r--r--pages/login.php2
-rw-r--r--pages/process.php135
-rw-r--r--pages/scores.php5
23 files changed, 560 insertions, 232 deletions
diff --git a/ajax/scores.ajax.php b/ajax/scores.ajax.php
index f2d38fc..897da3b 100644
--- a/ajax/scores.ajax.php
+++ b/ajax/scores.ajax.php
@@ -1,7 +1,5 @@
<?
-// Session as read-only to not lock the file.
session_start();
-session_write_close();
$userID = $_SESSION['userID'];
diff --git a/changelog/.htaccess b/changelog/.htaccess
new file mode 100644
index 0000000..3418e55
--- /dev/null
+++ b/changelog/.htaccess
@@ -0,0 +1 @@
+deny from all \ No newline at end of file
diff --git a/css/page.css b/css/page.css
index ec0f1c9..97f3882 100644
--- a/css/page.css
+++ b/css/page.css
@@ -149,9 +149,10 @@ a img {border: none;} /* IE specific: remove outline around image links */
#oid_box {
width:500px;
height:300px;
- background-color:#ccc;
+ background-color:#999;
padding: 5px 15px 5px 15px;
box-shadow: 0 0 4px #888;
+ border-radius: 10px;
}
#oid_btn {
background-color: #bbb;
@@ -180,16 +181,18 @@ position:absolute;color:#333;left:25px;bottom:20px;
-moz-animation: signinAnimate 1s; /* Firefox */
position:fixed;
color:#000;
- background-color:#999;
+ background-color: rgb(216, 216, 216);
+ background-color: rgba(216, 216, 216, 0.95);
box-shadow: 0 0 5px #888;
z-index:200;
padding: 0px 15px 15px 15px;
text-align: left;
left:50%;
- top:120px;
+ top:100px;
width:530px;
margin-left:-275px;
display:inline;
+ border-radius:15px;
}
#oid_hidden {
position:fixed;
@@ -296,7 +299,7 @@ position:absolute;color:#333;left:25px;bottom:20px;
font-weight:bold;
padding: 15px 0px 15px 0px;
padding: 0px;
- height:50px
+ height:50px;
text-align:center;
position: relative;
min-width: 960px;
diff --git a/css/stats.css b/css/stats.css
index 28d190a..bfb9571 100644
--- a/css/stats.css
+++ b/css/stats.css
@@ -97,7 +97,7 @@
.scoreCol {
min-height:500px;
- min-width:277px;
+ min-width:325px;
float:left;
}
.mapCol {
diff --git a/do.php b/do.php
index f85539f..cb90d84 100644
--- a/do.php
+++ b/do.php
@@ -15,23 +15,21 @@ $note = false;
//Auto login;
include_once("globe.php");
-if (!isset($_SESSION['accepted']) || $_SESSION['accepted'] <> 1)
- if (isset($_COOKIE['doLogin']) && $_COOKIE['doLogin'] == 'yes')
+if (!isset($_SESSION['accepted']) || $_SESSION['accepted'] <> 1) {
+ if (isset($_COOKIE['doLogin']) && $_COOKIE['doLogin'] == 'yes') {
CookieLogin();
+ }
+}
-if (!isset($_SESSION['accepted']) || $_SESSION['accepted'] <> 1)
+if (!isset($_SESSION['accepted']) || $_SESSION['accepted'] <> 1) {
$accepted = false;
-else
+} else {
$accepted = true;
-
-
-// encode array $json to JSON string
+}
$debug = false;
-
//$debug = true;
-
if (isset($_GET['act']) && $_GET['act'] == "getmap") {
$map = GenerateMapByCode($_GET['mapcode']);
@@ -52,8 +50,7 @@ if (isset($_GET['checkachieve']) && $_GET['checkachieve'] == 'true' && $_SESSION
$userID = $_SESSION['userID'];
//Located in includes/datas.php
$note = getNotified($userID);
- if ($note !== false)
- $json['notificationtext'] = $note;
+ if ($note !== false) $json['notificationtext'] = $note;
}
if ($_GET['r'] == 'reqMemberPage') {
@@ -73,39 +70,6 @@ if ($_GET['r'] == 'reqMemberPage') {
}
-//TODO: DEPRECIATE!
-if ($_GET['r'] == 'reqScorePage') {
- $mapID = $_GET['mapid'] + 0;
- $page = $_GET['reqPage'] + 0;
- if (!is_int($mapID) OR !is_int($page))
- return;
-
- //Include the notification text
- $json = getScores($mapID, $page, 10);
- $json['mapid'] = $mapID;
- $json['page'] = $page;
-
- $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>";
- }
- }
- if ($note !== false)
- $json['notificationtext'] = $note;
-
- $encoded = json_encode($json);
- die($encoded);
-}
-
if ($_GET['r'] == 'getsol') {
$mapID = $_GET['mapID'] + 0;
//echo "working...";
diff --git a/globe.php b/globe.php
index dda0fd2..7a3d472 100644
--- a/globe.php
+++ b/globe.php
@@ -7,9 +7,10 @@ if (!session_id())
//Database login:
//include_once 'sqlEmbedded.php';
-//TODO: CONFIRM THIS DOMAIN BEFORE TRANSFER
+//!! CONFIRM THIS DOMAIN BEFORE TRANSFER
//$mydomain = "http://www.mazetd.4xg.net/";
-$mydomain = "http://www.blue.4xg.net/";
+//$mydomain = "http://www.blue.4xg.net/
+$mydomain = "http://www.pathery.com/";
function LogError($error) {
@@ -19,6 +20,12 @@ function LogError($error) {
fclose($fd);
}
+function linkEmblem($emblem, $orientation) {
+ $orientation = $orientation - 0;
+ $url = 'images/marks/';
+ if ($orientation == 0) return $url.$emblem;
+ return $url.'rotate.php?r='.$orientation.'&emblem='.$emblem;
+}
function soundManager1() {
return '
@@ -49,6 +56,8 @@ soundManager.setup({
soundManager.createSound({id: 'click',url: '/sounds/click.mp3'});
soundManager.createSound({id: 'sc',url: '/sounds/transmission.mp3'});
soundManager.createSound({id: 'hologram',url: '/sounds/hologram.mp3'});
+ soundManager.createSound({id: 'pit',url: '/sounds/pit.mp3'});
+ soundManager.createSound({id: 'select',url: '/sounds/select.mp3'});
}
});
</script>
diff --git a/images/marks/rotate.php b/images/marks/rotate.php
new file mode 100644
index 0000000..41a203a
--- /dev/null
+++ b/images/marks/rotate.php
@@ -0,0 +1,67 @@
+<?php
+// File and rotation
+$filename = 'OffsetStripesDiagonal_B.png';
+$rotate = $_GET['r'] * 1;
+//Probably not the best syntax.
+if (!is_int($rotate) OR !($rotate > 0) OR !($rotate < 4)) exit;
+
+$emblem = $_GET['emblem'];
+$degrees = $_GET['r'] * 90;
+
+// Content type
+header('Content-type: image/jpeg');
+//TODO Update Cache
+header("Cache-Control: private, max-age=10800, pre-check=10800");
+header("Pragma: private");
+header("Expires: " . date(DATE_RFC822,strtotime(" 2 day")));
+
+$simage = @imagecreatefrompng($emblem);
+if(!$simage) {
+ exit;
+}
+
+$background = imagecolorallocate($simage, 0, 0, 0);
+//$simage = rotateMaintain($simage, $degrees, $background);
+$simage = imagerotate($simage, $degrees, 0);
+// removing the black from the placeholder
+imagecolortransparent($simage, $background);
+// turning off alpha blending (to ensure alpha channel information
+// is preserved, rather than removed (blending with the rest of the
+// image in the form of black))
+imagealphablending($simage, false);
+// turning on alpha channel information saving (to ensure the full range
+// of transparency is preserved)
+imagesavealpha($simage, true);
+imagepng($simage);
+
+
+
+//Couldn't do this and maintain transparency ?
+function rotateMaintain($img1, $angle, $background) {
+ $width_before = imagesx($img1);
+
+ $height_before = imagesy($img1);
+ $img1 = imagerotate($img1, $angle, $background);
+
+ //but imagerotate scales, so we clip to the original size
+ $img2 = @imagecreatetruecolor($width_before, $height_before);
+ $new_width = imagesx($img1); // whese dimensions are
+ $new_height = imagesy($img1);// the scaled ones (by imagerotate)
+ imagecopyresampled(
+ $img2, $img1,
+ 0, 0,
+ ($new_width-$width_before)/2,
+ ($new_height-$height_before)/2,
+ $width_before,
+ $height_before,
+ $width_before,
+ $height_before
+ );
+ return $img2;
+}
+
+
+
+
+
+?> \ No newline at end of file
diff --git a/images/rotate.php b/images/rotate.php
deleted file mode 100644
index ae0df87..0000000
--- a/images/rotate.php
+++ /dev/null
@@ -1,20 +0,0 @@
-<?php
-// File and rotation
-$filename = 'OverlayStart50.png';
-
-$degrees = $_GET['r'] * 90;
-//$degrees = 180;
-
-// Content type
-header('Content-type: image/jpeg');
-
-// Load
-$source = imagecreatefrompng($filename);
-
-// Rotate
-$rotate = imagerotate($source, $degrees, 0);
-
-// Output
-imagepng($rotate);
-
-?> \ No newline at end of file
diff --git a/includes/.htaccess b/includes/.htaccess
new file mode 100644
index 0000000..3418e55
--- /dev/null
+++ b/includes/.htaccess
@@ -0,0 +1 @@
+deny from all \ No newline at end of file
diff --git a/includes/chats.php b/includes/chats.php
index 18d0810..6991a48 100644
--- a/includes/chats.php
+++ b/includes/chats.php
@@ -62,7 +62,8 @@ function getChat($startID = 0) {
users.displayName,
users.displayColor,
users.wallColor,
- users.wallEmblem
+ users.wallEmblem,
+ users.wallOrientation
FROM `chat`
LEFT JOIN `users`
ON chat.userID = users.ID
diff --git a/includes/constants.php b/includes/constants.php
index a6826b1..a1d4dbe 100644
--- a/includes/constants.php
+++ b/includes/constants.php
@@ -75,4 +75,32 @@ $mapNamesByType = array(1 => 'Simple', 2 => 'Normal', 3 => 'Complex', 4 => 'Spec
* Make sure the first one is always 0...
*/
$tierChallengeRequirements = array(0, 5, 10, 15, 20, 25, 30);
+
+
+
+/**
+ * Unlock Types
+ */
+define('UNLOCK_WALL_COLOR', 1);
+define('UNLOCK_WALL_EMBLEM', 2);
+define('UNLOCK_DISPLAY_COLOR', 3);
+define('UNLOCK_WALL_ORIENTATION', 4);
+define('UNLOCK_EXTRAS', 8);
+// MISC SUBTYPES:
+
+define('MISC_UNLOCK_INSANE_SPEED', 1);
+
+/**
+ * Achievement Types
+ */
+define('ACHIEVEMENT_MOVES_CAREER', 1);
+define('ACHIEVEMENT_MAZE_CAREER', 2);
+define('ACHIEVEMENT_MAZE_MASTERY', 3);
+define('ACHIEVEMENT_CHAMPION_POINTS', 4);
+define('ACHIEVEMENT_PERFECT_DAY', 5);
+
+define('ACHIEVEMENT_TUTORIAL', 32);
+
+
+
?>
diff --git a/includes/datas.php b/includes/datas.php
index 74487fd..af10cd2 100644
--- a/includes/datas.php
+++ b/includes/datas.php
@@ -12,35 +12,34 @@ include_once('constants.php');
//Returns text refering to any notifications.
function getNotified($userID) {
-
$r = '';
$sql = "SELECT `ID`, `type`, `level`
FROM `achievements`
WHERE `notified` = false
AND userID = '$userID'
- LIMIT 25";
+ LIMIT 5";
$resultA = mysql_query($sql);
- if (mysql_num_rows($resultA) <= 0)
- return false;
+ if (mysql_num_rows($resultA) <= 0) return false;
// --------- We found an achievement they don't know they got!
while (list($aID, $aType, $aLevel) = mysql_fetch_row($resultA)) {
- if ($r != '')
- $r .= '<br /><hr />';
+ if ($r != '') $r .= '<br /><hr />';
- $aTypeNames[1] = "Path Career Level $aLevel!";
- $aTypeNames[2] = "Mazes Career Level $aLevel!";
- $aTypeNames[3] = "Maze Mastery Level $aLevel!";
- $aTypeNames[4] = "Champion Level $aLevel!";
- $aTypeNames[32] = 'Tutorial Complete!';
+ $aTypeNames[ACHIEVEMENT_MOVES_CAREER] = "Path Career Level $aLevel!";
+ $aTypeNames[ACHIEVEMENT_MAZE_CAREER] = "Mazes Career Level $aLevel!";
+ $aTypeNames[ACHIEVEMENT_MAZE_MASTERY] = "Maze Mastery Level $aLevel!";
+ $aTypeNames[ACHIEVEMENT_CHAMPION_POINTS] = "Champion Level $aLevel!";
+ $aTypeNames[ACHIEVEMENT_PERFECT_DAY] = 'Perfect Day Level!';
+ $aTypeNames[ACHIEVEMENT_TUTORIAL] = 'Tutorial Complete!';
- $aTypeCurrency[1] = "total moves mazed";
- $aTypeCurrency[2] = "mazes played";
- $aTypeCurrency[3] = "mazes with (tied) top score";
- $aTypeCurrency[4] = "champion points";
+ $aTypeCurrency[ACHIEVEMENT_MOVES_CAREER] = "total moves mazed";
+ $aTypeCurrency[ACHIEVEMENT_MAZE_CAREER] = "mazes played";
+ $aTypeCurrency[ACHIEVEMENT_MAZE_MASTERY] = "mazes with (tied) top score";
+ $aTypeCurrency[ACHIEVEMENT_CHAMPION_POINTS] = "champion points";
+ $aTypeCurrency[ACHIEVEMENT_PERFECT_DAY] = "total times you've tied all 4 maps";
$aName = $aTypeNames[$aType];
$currency = $aTypeCurrency[$aType];
@@ -54,20 +53,7 @@ function getNotified($userID) {
if (mysql_num_rows($result) >= 1) {
$unlocked = "You've unlocked: ";
while (list($uType, $uName, $uValue) = mysql_fetch_row($result)) {
- switch ($uType) {
- case 1:
- $unlocked .= "$uName Wall Color!";
- $unlocked .= "<table><tr><td onclick='changeWallColor(\"$uValue\")' style='background-color:$uValue;' class='grid_td_rocks'></td></tr></table>";
- break;
- case 2:
- $unlocked .= "$uName Emblem!";
- $unlocked .= "<div class='grid_td_rocks' title='' onClick='emblemclick(this,\"$uValue\", \"0\")' style='background: #999 url(../images/marks/$uValue);' >";
- $unlocked .= "<div class='grid_inner grid_td_walls'></div></div>";
- break;
- case 3:
- $unlocked .= "<br /><span style='color:$uValue;'>$uName Username color!</span><br />";
- break;
- }
+ $unlocked .= displayUnlock($uType, $uValue, $uName);
}
}
// ---------- Prepare response
@@ -92,8 +78,6 @@ function getNotified($userID) {
}
-
-
// Item ID List
$aIDList[] = "'$aID'";
}
@@ -110,6 +94,40 @@ function getNotified($userID) {
// ---------- Done!
}
+function displayUnlock($uType, $uValue, $uName) {
+ switch ($uType) {
+ case UNLOCK_WALL_COLOR:
+ $r .= "$uName Wall Color!";
+ $r .= "<table><tr><td onclick='changeWallColor(\"$uValue\")' style='background-color:$uValue;' class='grid_td_rocks'></td></tr></table>";
+ break;
+
+ case UNLOCK_WALL_EMBLEM:
+ $r .= "$uName Emblem!";
+ $r .= "<div class='emblemDisplay' title='' style='background: #999 url(../images/marks/$uValue);' >";
+ //$r .= "<div class='grid_inner grid_td_gray'></div></div>";
+ $r .= "<div class='emblemDisplayInner' style='width:35px; height:35px;'></div></div>";
+ break;
+
+ case UNLOCK_DISPLAY_COLOR:
+ $r .= "<br /><span style='color:$uValue;font-weight:bold;font-size:110%;background-color:#222;'>$uName Username color!</span>";
+ break;
+
+ case UNLOCK_WALL_ORIENTATION:
+ $r .= "Emblem Rotation $uName!";
+ break;
+
+ case UNLOCK_EXTRAS:
+ $r .= "Extras: $uName";
+ break;
+
+ default:
+ $r .= "$uName";
+ break;
+ }
+ return $r;
+}
+
+
//Returns true when an achievement is applied.
// Usage example: applyCareerAchievement($userID);
// TODO: DEPRECIATED
@@ -531,13 +549,25 @@ function getAchievementCurrency($userID, $aType) {
$sql = "SELECT championPoints
FROM `users`
WHERE `ID` = '$userID'";
+ break;
+ case 5:
+ $sql = "SELECT count(*)
+ FROM solutions
+ INNER JOIN mapOfTheDay ON solutions.mapID = mapOfTheDay.mapID
+ WHERE mapOfTheDay.mapType
+ IN ( 1, 2, 3, 4 )
+ AND solutions.userID = '$userID'
+ GROUP BY solutions.userID, mapOfTheDay.mapDate
+ HAVING SUM( isTiedForHighScore ) = 4";
+ $result = mysql_query($sql) OR die("SQL query failed; $sql");
+ return mysql_num_rows($result);
break;
}
- if ($sql == '')
- return false;
+ if ($sql == '') return false;
$result = mysql_query($sql) OR die("SQL query failed; $sql");
- if (mysql_num_rows($result) == 1)
+ if (mysql_num_rows($result) == 1) {
list($r) = mysql_fetch_row($result);
+ }
return $r;
}
@@ -552,22 +582,20 @@ function getAchievementLevel($userID, $aType) {
ORDER BY `level` DESC
LIMIT 1";
$result = mysql_query($sql);
- if (mysql_num_rows($result) == 1)
+ if (mysql_num_rows($result) == 1) {
list($r) = mysql_fetch_row($result);
+ }
return $r;
}
function getAchievementsArray($type) {
- if ($type == 1)
- return getCareerPathArray();
- if ($type == 2)
- return getCareerMazesArray();
- if ($type == 3)
- return getMazeMasteryArray();
- if ($type == 4)
- return getChampionPointsArray();
+ if ($type == ACHIEVEMENT_MOVES_CAREER) return getCareerPathArray();
+ if ($type == ACHIEVEMENT_MAZE_CAREER) return getCareerMazesArray();
+ if ($type == ACHIEVEMENT_MAZE_MASTERY) return getMazeMasteryArray();
+ if ($type == ACHIEVEMENT_CHAMPION_POINTS) return getChampionPointsArray();
+ if ($type == ACHIEVEMENT_PERFECT_DAY) return getPerfectDayArray();
//Tutorial
- if ($type == 32) {
+ if ($type == ACHIEVEMENT_TUTORIAL) {
$r[1] = array(1, 1, '#4444ff', 'Blue');
return $r;
}
@@ -655,11 +683,27 @@ function getChampionPointsArray() {
$r[7] = array(8000, 2, 'CrossXLDonut_B_I.png', 'Inverted Dark Large Intersection', 0);
$r[8] = array(16000, 2, 'DiamondLarge_B.png', 'Dark Large Diamond', 0);
$r[9] = array(32000, 1, '#22ff22', 'Neon Lime', 1);
- //$r[7] = array(75, 2, 'CircleSmall_W_I.png', 'Inverted Bright Small Circle', 0);
return $r;
}
+//TYPE 5
+function getPerfectDayArray() {
+ //($required, $unlockType, $unlockValue, $unlockName, $unlockSubtype)
+ //$cp[0] = array(requiredpoints, type, 'value', 'name');
+ $r[1] = array(1, UNLOCK_EXTRAS, '5', 'Insane Speed', MISC_UNLOCK_INSANE_SPEED);
+ //Give 0* at the same time
+ $r[2] = array(5, UNLOCK_WALL_ORIENTATION, '1', '90*', 0);
+ $r[3] = array(50, UNLOCK_WALL_ORIENTATION, '2', '180*', 0);
+ $r[4] = array(100, UNLOCK_WALL_ORIENTATION, '3', '270*', 0);
+ //These numbers temporarly unreasonable
+ $r[5] = array(9275, UNLOCK_WALL_EMBLEM, 'CircleSmall_W_I.png', 'Inverted Bright Small Circle', 0);
+ $r[6] = array(10000, UNLOCK_WALL_EMBLEM, 'DiamondLarge_W_I.png', 'Inverted Light Large Diamond', 0);
+
+ return $r;
+}
+
+
//Select Members
function getMembers($pageNumber = 1, $pageDivide = 50, $order = 'DESC', $orderBy = 'dateJoined') {
@@ -716,6 +760,7 @@ function getMembers($pageNumber = 1, $pageDivide = 50, $order = 'DESC', $orderBy
users.wallColor,
users.displayColor,
users.wallEmblem,
+ users.wallOrientation,
users.datejoined as dateJoined,
users.dateLogin as dateLogin
FROM `users`
@@ -812,6 +857,7 @@ function getScores($mapID, $pageNumber = 1, $pageDivide = 10) {
users.displayColor,
users.wallColor,
users.wallEmblem,
+ users.wallOrientation,
$requestSolutions
solutions.dateModified as cdate,
solutions.ID as solutionID
@@ -907,6 +953,20 @@ function hasCompletedTutorial($userID) {
return (mysql_num_rows($result) >= 1);
}
+function hasExtrasUnlock($userID, $unlockType, $unlockSubtype) {
+ $userID = mysql_escape_string($userID);
+ $unlockType = mysql_escape_string($unlockType);
+ $unlockSubtype = mysql_escape_string($unlockSubtype);
+
+ $sql = "SELECT `value` FROM `unlocks`
+ WHERE `userID` = '$userID'
+ AND `type` = '$unlockType'
+ AND `subtype` = '$unlockSubtype'
+ LIMIT 1";
+ $result = mysql_query($sql);
+ return (mysql_num_rows($result) >= 1);
+}
+
/**
* Returns a MySQL resultset for all challenges for the given mapID
* @param $mapIdUnsanitized The mapID to load. Assumed to be unsanitized.
diff --git a/includes/header.php b/includes/header.php
index cf427e4..71c2a5c 100644
--- a/includes/header.php
+++ b/includes/header.php
@@ -41,17 +41,17 @@ function htmlHeader($css = array(), $title = 'Pathery', $desc = '', $scripts = a
</script>
<script>
-<? echo userDataToJS(); ?>
function showSignin() {
- if (document.getElementById('oid_hidden') !== undefined) {
+ if (typeof document.getElementById('oid_hidden') !== 'undefined') {
document.getElementById('oid_hidden').id = 'oid_wrapper';
}
}
function hideSignin() {
- if (document.getElementById('oid_wrapper') !== undefined) {
+ if (typeof document.getElementById('oid_wrapper') !== 'undefined') {
document.getElementById('oid_wrapper').id = 'oid_hidden';
}
}
+<? echo userDataToJS(); ?>
</script>
</head>
@@ -145,7 +145,6 @@ function htmlFooter() {
?>
})();
- createSignin();
</script>
</body>
@@ -154,7 +153,25 @@ function htmlFooter() {
}
function topbar($links) {
- global $accepted, $wallColor, $wallEmblem, $request;
+ global $accepted, $wallColor, $wallEmblem, $wallOrientation, $request;
+
+
+
+ //Empty first-div contains sound manager stuff
+ echo '<div></div>';
+
+ //echo '<script>createSignin();</script>';
+ echo ' <div class="wrapper" id="oid_hidden" >
+ <h2>Sign in</h2>
+ <div id="oid_box">
+ <h2 style="color:#333;">Do you have an account here?</h2>
+ <a rel="nofollow" href="login?op=google"><img id="oid_btn" src="images/btns/signin_Google.png" alt="Sign in with Google" /></a>
+ <a rel="nofollow" href="login?op=yahoo"><img id="oid_btn" src="images/btns/signin_Yahoo.png" alt="Sign in with Yahoo" /></a>
+ <a id="oid_learn" href="http://openid.net/get-an-openid/what-is-openid/" target="_blank" >Learn more about OpenID</a>
+ <a id="oid_cancel" href="javascript:hideSignin();">X</a>
+ </div>
+ </div>';
+
echo '<div id="topbar"><div id="topbarContent">';
foreach ($links as $key => $value) {
@@ -174,7 +191,7 @@ function topbar($links) {
echo " <a href='cp' title='change name'>Update your name</a> | ";
echo " <a href='logout'>Logout</a>";
echo " </div>";
- echo "<div id='topbarBadge' style='background-color: $wallColor; background-image: url(images/marks/$wallEmblem);'>
+ echo "<div id='topbarBadge' style='background-color: $wallColor; background-image: url(".linkEmblem($wallEmblem, $wallOrientation).");'>
<a href='achievements'><div></div></a>
</div>";
@@ -183,16 +200,6 @@ function topbar($links) {
} else {
?>
<a href='javascript:showSignin();'>Sign in</a>
-<!-- <div class="wrapper" id="oid_hidden" >
- <h2>Sign in</h2>
- <div id="oid_box">
- <h2 style="color:#333;">Do you have an account here?</h2>
- <a rel="nofollow" href="login?op=google"><img id="oid_btn" src="images/btns/signin_Google.png" alt="Sign in with Google" /></a>
- <a rel="nofollow" href="login?op=yahoo"><img id="oid_btn" src="images/btns/signin_Yahoo.png" alt="Sign in with Yahoo" /></a>
- <a id="oid_learn" href="http://openid.net/get-an-openid/what-is-openid/" target="_blank" >Learn more about OpenID</a>
- <a id="oid_cancel" href="javascript:hideSignin();">X</a>
- </div>
- </div> -->
<?
}
echo " </div>";
@@ -200,14 +207,25 @@ function topbar($links) {
}
function userDataToJS() {
- global $wallColor, $wallEmblem, $accepted;
+ global $wallColor, $wallEmblem, $wallOrientation, $accepted;
if (!$accepted) {
- $r = 'var userObj = {"wallColor":false,"wallEmblem":false,';
- $r .= '"ID":"-1","accepted":false};';
+ $r = 'var userObj = {"wallColor":false,"wallEmblem":false,"wallOrientation":false,';
+ $r .= '"ID":"-1","accepted":false,"hasInsaneSpeed":false};';
} else {
$userID = $_SESSION['userID'];
- $r = 'var userObj = {"wallColor":"'.$wallColor.'","wallEmblem":"'.$wallEmblem.'",';
- $r .= '"ID":"'.$userID.'","accepted":true};';
+ include_once('includes/datas.php');
+ $hasInsaneSpeed = hasExtrasUnlock($userID, UNLOCK_EXTRAS, MISC_UNLOCK_INSANE_SPEED);
+ $r .= 'hasInsaneSpeed":'.$hasInsaneSpeed.'};'."\n";
+ $json = array('ID' => 'fat');
+ $json['ID'] = $userID;
+ $json['wallColor'] = $wallColor;
+ $json['wallEmblem'] = $wallEmblem;
+ $json['wallOrientation'] = $wallOrientation;
+ $json['hasInsaneSpeed'] = $hasInsaneSpeed;
+ $json['accepted'] = 'true';
+
+ $encoded = json_encode($json);
+ $r = 'var userObj = decryptJSON(\''.json_encode($json).'\');'."\n";
}
return $r;
}
diff --git a/index.php b/index.php
index 2786237..9e47971 100644
--- a/index.php
+++ b/index.php
@@ -31,12 +31,12 @@ if ($accepted) {
$sql = "
SELECT
users.wallColor,
- users.wallEmblem
+ users.wallEmblem,
+ users.wallOrientation
FROM `users`
WHERE ID = '$userID' ";
$result = mysql_query($sql);
- if ($result)
- list($wallColor, $wallEmblem) = mysql_fetch_row($result);
+ if ($result) list($wallColor, $wallEmblem, $wallOrientation) = mysql_fetch_row($result);
}
// Footer Links
@@ -230,6 +230,14 @@ switch ($request) {
require 'pages/about.php';
}
break;
+
+ case "process":
+ if ($_SESSION['isAdmin'] == true) {
+ require 'pages/process.php';
+ } else {
+ require 'pages/about.php';
+ }
+ break;
case "massemail":
if ($_SESSION['isAdmin'] == true) {
diff --git a/js/mapspecs.js b/js/mapspecs.js
index 688c9dc..cf2450a 100644
--- a/js/mapspecs.js
+++ b/js/mapspecs.js
@@ -21,6 +21,7 @@ else if (document.attachEvent) { // IE 8-
var wallColor = false;
var wallEmblem = false;
+var wallOrientation = 0;
var isChallenge = false;
var isTutorial = false;
@@ -84,6 +85,13 @@ function changeWallEmblem(newEmblem) {
loadSol(null);
}
+function linkEmblem(emblem, orientation) {
+ orientation = orientation - 0;
+ var url = 'images/marks/';
+ if (orientation == 0) return url+emblem;
+ return url+'rotate.php?r='+orientation+'&emblem='+emblem;
+}
+
function grid_click(obj) {
//Prepare data
@@ -141,9 +149,18 @@ function grid_click(obj) {
wallEmblem = playerWallEmblem;
}
}
+ //TODO: Copy below - above w/ userObj
+ if (wallOrientation == false) {
+ if (typeof userObj !== 'undefined' && userObj.wallOrientation !== '') {
+ wallOrientation = userObj.wallOrientation;
+ }
+ }
+
obj.style.backgroundColor = wallColor;
if (wallEmblem !== false) {
- obj.style.backgroundImage="url(images/marks/"+wallEmblem+")";
+ //obj.style.backgroundImage="url(images/marks/"+wallEmblem+")";
+ //obj.style.backgroundImage="url(images/marks/rotate.php?r=1&emblem="+wallEmblem+")";
+ obj.style.backgroundImage="url("+linkEmblem(wallEmblem, wallOrientation)+")";
}
//Add Wall
@@ -852,17 +869,12 @@ function mapAsHTML(map, targetWidth, mapEditor) {
//console.log("MapObj", map);
mapdata[map.ID] = map;
+ //Map bigger than target width?
if (!targetWidth || (map.width * 35) <= targetWidth)
{
+ //Use standard size.
targetWidth = (map.width * 35);
}
- else
- {
- //Need to take into account padding of .grid_outer
- var fakeGridDom = $('<div class="grid_outer"></div>');
- var gridOuterPadding = parseInt(fakeGridDom.css('padding-left')) + parseInt(fakeGridDom.css('padding-right'));
- targetWidth -= gridOuterPadding;
- }
var scale = map.width / targetWidth;
//alert(scale);
@@ -1018,7 +1030,7 @@ function getSpeedOptions(mapID) {
listObj[2] = 'Med';
listObj[3] = 'Fast';
listObj[4] = 'Ultra';
- listObj[5] = 'Insane';
+ if (userObj.hasInsaneSpeed) listObj[5] = 'Insane';
var r = '';
r += " <select onChange='savePref(\"speed\", this.value)' id='"+mapID+",speed'>";
for (var i in listObj) {
diff --git a/js/scores.js b/js/scores.js
index 0e81213..3e01ca8 100644
--- a/js/scores.js
+++ b/js/scores.js
@@ -188,7 +188,7 @@ function scoresFormatPage(JO) {
}
p = p+ i+ "</td>";
p = p+ "<td style='vertical-align: middle;'>";
- p = p+ " <div class='grid_td' style='float:left; width:35px; height:35px; background:"+u.wallColor+" url(images/marks/"+u.wallEmblem+");'>";
+ p = p+ " <div class='grid_td' style='float:left; width:35px; height:35px; background:"+u.wallColor+" url("+linkEmblem(u.wallEmblem, u.wallOrientation)+");'>";
p = p+ " <div style='background-color:transparent;' class='grid_td_inner grid_td_rocks'>";
p = p+ " </div>";
p = p+ " </div>";
@@ -443,19 +443,20 @@ function membersFormatPage(JO) {
var styleClass = '';
- if (previousI != i + 1)
- if (previousI < i - 1 && previousI != 0)
+ if (previousI != i + 1) {
+ if (previousI < i - 1 && previousI != 0) {
styleClass = 'border-top: 6px solid #777799;';
+ }
+ }
- if (u.wallEmblem == undefined)
- u.wallEmblem = 'blank.png';
+ if (u.wallEmblem == undefined) u.wallEmblem = 'blank.png';
p = p+ "<tr style='"+styleClass+" background-color: "+u.background+"; color:"+u.displayColor+";' title=''>";
p = p+ "<td style='text-align:left;'>";
p = p+ i+ "</td>";
p = p+ "<td style='vertical-align: middle;width:180px;'>";
- p = p+ " <div class='grid_td' style='float:left; width:35px; height:35px; background:"+u.wallColor+" url(images/marks/"+u.wallEmblem+");'>";
+ p = p+ " <div class='grid_td' style='float:left; width:35px; height:35px; background:"+u.wallColor+" url("+linkEmblem(u.wallEmblem, u.wallOrientation)+");'>";
p = p+ " <div style='background-color:transparent;' class='grid_td_inner grid_td_rocks'>";
p = p+ " </div>";
p = p+ " </div>";
diff --git a/pages/achievements.php b/pages/achievements.php
index 249077c..fb20f2b 100644
--- a/pages/achievements.php
+++ b/pages/achievements.php
@@ -20,8 +20,9 @@ else
// $userID = 3;
$viewer = true;
-if ($userID == $_SESSION['userID'])
+if ($userID == $_SESSION['userID']) {
$viewer = false;
+}
if ($_GET['apply'] == 'true') {
applyCareerMazesAchievements($userID);
@@ -54,8 +55,6 @@ foreach ($ac3 as $c3) {
echo "</tr><tr>";
foreach ($ac1 as $c1) {
foreach ($ac2 as $c2) {
-
-
$c = "#$c1$c2$c3";
if ($_GET['showcolor'] == 'all') {
//echo "<td onclick='changeWallColor(\"#$c1$c2$c3\")' title='#$c1$c2$c3' style='background-color:#$c3$c1$c2;' class='grid_td_rocks'></td>";
@@ -69,9 +68,9 @@ echo "</tr></table>";
$debug = false;
-if ($_GET['debuglevels'] == 'yes')
+if ($_GET['debuglevels'] == 'yes') {
$debug = true;
-
+}
if ($_GET['showemblems'] == 'all') {
@@ -147,10 +146,11 @@ return("#".substr("000000".dechex($n),-6));
//Self-healing code for unlocks.
if (!$viewer) {
- applyAchievements($userID, 1);
- applyAchievements($userID, 2);
- applyAchievements($userID, 3);
- applyAchievements($userID, 4);
+ applyAchievements($userID, ACHIEVEMENT_MOVES_CAREER);
+ applyAchievements($userID, ACHIEVEMENT_MAZE_CAREER);
+ applyAchievements($userID, ACHIEVEMENT_MAZE_MASTERY);
+ applyAchievements($userID, ACHIEVEMENT_CHAMPION_POINTS);
+ applyAchievements($userID, ACHIEVEMENT_PERFECT_DAY);
}
?>
@@ -175,7 +175,8 @@ function emblemclick(obj, emblem, unlockID) {
if (viewer)
return;
var hbadge = document.getElementById('badge');
- hbadge.style.backgroundImage="url(images/marks/"+emblem+")";
+ var orientation = document.getElementById('selectOrientation').value;
+ hbadge.style.backgroundImage="url("+linkEmblem(emblem, orientation)+")"
document.getElementById('selectEmblem').value = emblem;
document.getElementById('selectEmblemID').value = unlockID;
}
@@ -188,6 +189,17 @@ function namecolorclick(obj, color, unlockID) {
document.getElementById('selectNameColor').value = color;
document.getElementById('selectNameColorID').value = unlockID;
}
+function wallOrientationClick(obj, orientation, unlockID) {
+ if (viewer) return;
+ var emblem = document.getElementById('selectEmblem').value;
+ var hbadge = document.getElementById('badge');
+ hbadge.style.backgroundImage="url("+linkEmblem(emblem, orientation)+")";
+
+// hbadge.style.backgroundImage="url("+linkEmblem(emblem, +")";
+ document.getElementById('selectOrientation').value = orientation;
+ document.getElementById('selectOrientationID').value = unlockID;
+}
+
</script>
<?
@@ -199,6 +211,7 @@ function namecolorclick(obj, color, unlockID) {
$unlocks[1][0] = array('id' => 0, 'subtype' => 0, 'name' => 'Default Charcoal', 'value' => '#666666', 'aType' => -1);
$unlocks[2][0] = array('id' => 0, 'subtype' => 0, 'name' => 'Default Blank', 'value' => 'blank.png', 'aType' => -1);
$unlocks[3][0] = array('id' => 0, 'subtype' => 0, 'name' => 'Default', 'value' => '#cccccc', 'aType' => -1);
+$unlocks[4][0] = array('id' => 0, 'subtype' => 0, 'name' => 'Default: (0*)', 'value' => '0', 'aType' => -1);
$sql = "SELECT
unlocks.id,
unlocks.type,
@@ -219,6 +232,9 @@ if ($result) {
$unlocks[$row['type']][$row['id']] = $row;
}
+//Destroy some defaults to make them not show up.
+if (count($unlocks[3]) == 1) unset($unlocks[3]);
+if (count($unlocks[4]) == 1) unset($unlocks[4]);
//print_R($_POST);
@@ -235,12 +251,14 @@ if (isset($_POST['doupdate']) AND !$viewer) {
$unlockIDNC = $_POST['selectNameColorID'];
$unlockNameColor = $unlocks[3][$unlockIDNC]['value'];
- if ($unlockIDC == 0)
- $unlockColor = '#666666';
- if ($unlockIDE == 0)
- $unlockEmblem = 'blank.png';
- if ($unlockIDNC == 0)
- $unlockNameColor = '#cccccc';
+ $orientationUnlockID = $_POST['selectOrientationID'];
+ $orientationNewValue = $unlocks[UNLOCK_WALL_ORIENTATION][$orientationUnlockID]['value'];
+
+ //Default values
+ if ($unlockIDC == 0) $unlockColor = '#666666';
+ if ($unlockIDE == 0) $unlockEmblem = 'blank.png';
+ if ($unlockIDNC == 0) $unlockNameColor = '#cccccc';
+ if ($orientationUnlockID == 0) $orientationNewValue = '0';
if ($unlockColor == $_POST['selectColor']) {
$sql = "UPDATE `users`
@@ -269,7 +287,6 @@ if (isset($_POST['doupdate']) AND !$viewer) {
$data['post'] = print_r($_POST, true);
EmailError($data);
}
-
}
if ($unlockNameColor == $_POST['selectNameColor']) {
$sql = "UPDATE `users`
@@ -285,6 +302,20 @@ if (isset($_POST['doupdate']) AND !$viewer) {
EmailError($data);
}
}
+ if ($orientationNewValue == $_POST['selectOrientation']) {
+ $sql = "UPDATE `users`
+ SET `wallOrientation` = '$orientationNewValue'
+ WHERE `ID` = '$userID'";
+ $result = mysql_query($sql);
+ if (!$result) {
+ echo "Error updating wall Orientation";
+ $data = array();
+ $data['error'] = "Error when updating wall orientation";
+ $data['session'] = print_r($_SESSION, true);
+ $data['post'] = print_r($_POST, true);
+ EmailError($data);
+ }
+ }
}
$achievements = array();
@@ -307,8 +338,9 @@ order by maxLevel.type";
$result = mysql_query($sql);
if ($result) {
- while ($row = mysql_fetch_assoc($result))
+ while ($row = mysql_fetch_assoc($result)) {
$achievements[$row['type']] = $row;
+ }
}
@@ -322,7 +354,8 @@ SELECT
users.totalMazes AS totalSolutions,
users.wallColor,
users.displayColor,
- users.wallEmblem
+ users.wallEmblem,
+ users.wallOrientation
FROM `users`
LEFT JOIN `solutions`
ON users.ID = solutions.userID
@@ -338,7 +371,7 @@ if (!$result OR mysql_num_rows($result) <= 0) {
htmlFooter();
exit;
}
-list($UDisplay, $UAdmin, $UTotalMoves, $UTotalSolutions, $wallColor, $nameColor, $wallEmblem) = mysql_fetch_row($result);
+list($UDisplay, $UAdmin, $UTotalMoves, $UTotalSolutions, $wallColor, $nameColor, $wallEmblem, $wallOrientation) = mysql_fetch_row($result);
if ($wallEmblem == '')
$wallEmblem = 'blank.png';
@@ -350,43 +383,50 @@ $uStats[1] = $UTotalMoves;
$uStats[2] = $UTotalSolutions;
echo "<div class='wrapper' style='padding-left:30px; width:800px;'>";
-if ($viewer)
- echo "<center><h3>Viewing</h3></center>";
+if ($viewer) echo "<center><h3>Viewing</h3></center>";
+
+$badgeURL = linkEmblem($wallEmblem, $wallOrientation);
echo "
<h1 id='badgeheader' style='margin-left:10px;color:$nameColor;'>
-<div id='badge' style='margin-right:10px; background:$wallColor url(../images/marks/$wallEmblem);float:left;background-size:100%;' class='badge'>
+<div id='badge' style='margin-right:10px; background:$wallColor url($badgeURL);float:left;background-size:100%;' class='badge'>
<div style='width:100%; height:100%; background-color:transparent; background-size:100%;' class='grid_td_rocks grid_inner'></div>
</div>$UDisplay</h1>";
-function displayUnlockItem($uType, $item) {
+function unlockItemAsTD($uType, $item) {
$aLevel = $item['aLevel'];
$aCompleted = $item['dateUnlocked'];
- $aTypeNames[1] = "Path Career Level $aLevel";
- $aTypeNames[2] = "Mazes Career Level $aLevel";
- $aTypeNames[3] = "Maze Mastery Level $aLevel";
- $aTypeNames[4] = "Champion Level $aLevel";
- $aTypeNames[32] = 'Completing Tutorial';
+ $aTypeNames[ACHIEVEMENT_MOVES_CAREER] = "Path Career Level $aLevel";
+ $aTypeNames[ACHIEVEMENT_MAZE_CAREER] = "Mazes Career Level $aLevel";
+ $aTypeNames[ACHIEVEMENT_MAZE_MASTERY] = "Maze Mastery Level $aLevel";
+ $aTypeNames[ACHIEVEMENT_CHAMPION_POINTS] = "Champion Level $aLevel";
+ $aTypeNames[ACHIEVEMENT_PERFECT_DAY] = "Perfect Days $aLevel";
+ $aTypeNames[ACHIEVEMENT_TUTORIAL] = 'Completing Tutorial';
$by = $aTypeNames[$item['aType']];
$on = relative_date(strtotime($aCompleted));
$unlockTitle = "$item[name]. From $by $on";
- if ($item['aType'] == -1)
+ if ($item['aType'] == -1) {
$unlockTitle = "$item[name]";
+ }
$border = 'border: 1px solid #000; border-width: 2px 0px 2px 0px;';
$border = 'border: 1px solid #000;';
$class = 'grid_td_walls';
+ //$r .= displayUnlock($uType, $item[value], $unlockTitle);
+ //return $r;
+
switch ($uType) {
- case 1:
+ case UNLOCK_WALL_COLOR:
if ($GLOBALS['wallColor'] == $item[value]) {
$class = 'grid_td_active';
$border = 'border: 1px solid #26b;';
}
$r .= "<td class='grid_td $class' id='color_$item[id]' title='$unlockTitle' onClick='colorclick(this,\"$item[value]\", \"$item[id]\")' style='padding: 0px;background-color:$item[value];$border'></td>";
break;
- case 2:
+
+ case UNLOCK_WALL_EMBLEM:
if ($GLOBALS['wallEmblem'] == $item[value]) {
$class = 'grid_td_active';
$border = 'border: 1px solid #26b;';
@@ -394,13 +434,27 @@ function displayUnlockItem($uType, $item) {
$r .= "<td class='grid_td_walls' title='$unlockTitle' id='' onClick='emblemclick(this,\"$item[value]\", \"$item[id]\")' style='background: #999 url(../images/marks/$item[value]);$border' >
<div class='grid_inner $class grid_td_walls'></div></td>";
break;
- case 3:
+
+ case UNLOCK_DISPLAY_COLOR:
if ($GLOBALS['nameColor'] == $item[value])
$border = 'border: 1px solid #26b;';
$r .= "<td class='name_color_select'><span title='$unlockTitle' onClick='namecolorclick(this,\"$item[value]\", \"$item[id]\")' style='color:$item[value]; margin-right:15px;$border'>";
$r .= "&nbsp;$item[name]&nbsp;";
$r .= "</span></td>";
break;
+
+ case UNLOCK_WALL_ORIENTATION:
+ $checked = '';
+ if (intval($GLOBALS['wallOrientation']) == intval($item[value])) $checked = 'checked';
+ //$r .= "<td class='name_color_select'>";
+ $r .= "<td class='name_color_select'>";
+ $r .= "<input onClick='wallOrientationClick(this,\"$item[value]\", \"$item[id]\")' type='radio' name='wallOrientation' value='male' $checked>$item[name] ";
+ $r .= "</td>";
+ break;
+
+ case UNLOCK_EXTRAS:
+ $r .= "<td style='border: 1px solid gray;' class='name_color_select' title='$unlockTitle'>$item[name]</td>";
+ break;
}
return $r;
}
@@ -408,17 +462,19 @@ function displayUnlockItem($uType, $item) {
if (isset($unlocks)) {
echo "<h2>Unlocks</h2>";
-
+
//Define some names
- $uTypeNames[1] = "Wall Colors";
- $uTypeNames[2] = "Emblems";
- $uTypeNames[3] = "Username Colors";
+ $uTypeNames[UNLOCK_WALL_COLOR] = "Wall Colors";
+ $uTypeNames[UNLOCK_WALL_EMBLEM] = "Emblems";
+ $uTypeNames[UNLOCK_DISPLAY_COLOR] = "Username Colors";
+ $uTypeNames[UNLOCK_WALL_ORIENTATION] = "Emblem Rotations";
+ $uTypeNames[UNLOCK_EXTRAS] = "Extras";
- $uSubtypeNames[1][0] = "Darker";
- $uSubtypeNames[1][1] = "Brighter";
+ $uSubtypeNames[UNLOCK_WALL_COLOR][0] = "Darker";
+ $uSubtypeNames[UNLOCK_WALL_COLOR][1] = "Brighter";
- $uSubtypeNames[2][0] = "Simple";
- $uSubtypeNames[2][1] = "Complicated";
+ $uSubtypeNames[UNLOCK_WALL_EMBLEM][0] = "Simple";
+ $uSubtypeNames[UNLOCK_WALL_EMBLEM][1] = "Complicated";
//For every unlock type that the user has.
foreach ($unlocks as $uType => $unlock) {
@@ -426,7 +482,7 @@ if (isset($unlocks)) {
echo "<h3>$uTypeNames[$uType] unlocked:</h3>";
foreach ($unlock as $item) {
- $subtype[$item['subtype']][] = displayUnlockItem($uType, $item);
+ $subtype[$item['subtype']][] = unlockItemAsTD($uType, $item);
if ((sizeof($subtype[$item['subtype']]) + 1) % 14 == 0)
$subtype[$item['subtype']][] = '</tr></table><table><tr>';
}
@@ -448,6 +504,7 @@ echo "<br />";
if (!$viewer) {
+ //TODO add wall orientation
echo "
<form action='achievements' method='post' name='updateBadge'>
<input id='doupdate' type='hidden' name='doupdate' value='true' />
@@ -455,6 +512,8 @@ if (!$viewer) {
<input id='selectColorID' type='hidden' name='selectColorID' value='' />
<input id='selectEmblem' type='hidden' name='selectEmblem' value='$wallEmblem' />
<input id='selectEmblemID' type='hidden' name='selectEmblemID' value='' />
+ <input id='selectOrientation' type='hidden' name='selectOrientation' value='$wallOrientation' />
+ <input id='selectOrientationID' type='hidden' name='selectOrientationID' value='' />
<input id='selectNameColor' type='hidden' name='selectNameColor' value='$nameColor' />
<input id='selectNameColorID' type='hidden' name='selectNameColorID' value='' />
<input type='submit' value='Save Changes' />
@@ -476,8 +535,7 @@ foreach($achievements as $aType => $a) {
$aCompleted = $a['dateCompleted'];
$aCompleted = relative_date(strtotime($aCompleted));
- if (!isset($uStats[$aType]))
- $uStats[$aType] = getAchievementCurrency($userID, $aType);
+ if (!isset($uStats[$aType])) $uStats[$aType] = getAchievementCurrency($userID, $aType);
$uStats[$aType] = str_replace(",", "", $uStats[$aType]);
@@ -487,13 +545,14 @@ foreach($achievements as $aType => $a) {
$aTypeNames[1] = "<img src='../images/Achievement_PathCareer.png' style='width:36px;height:36px;vertical-align:middle'>Path Career Level $aLevel!";
$aTypeNames[2] = "<img src='../images/Achievement_MazeCareer.png' style='width:36px;height:36px;vertical-align:middle'>Mazes Career Level $aLevel!";
$aTypeNames[3] = "<img src='../images/MedalSilverCAR.png' style='width:36px;height:36px;vertical-align:middle'>Maze Mastery Level $aLevel!";
- $aTypeNames[4] = "<img src='../images/championpoints.png' style='width:36px;height:36px;vertical-align:middle'>Champion Level $aLevel!";
+ $aTypeNames[ACHIEVEMENT_CHAMPION_POINTS] = "<img src='../images/championpoints.png' style='width:36px;height:36px;vertical-align:middle'>Champion Level $aLevel!";
+ $aTypeNames[ACHIEVEMENT_PERFECT_DAY] = "Perfect Day level $aLevel!";
$aTypeNames[32] = 'Tutorial Complete!';
$aTypeCurrency[1] = "total moves mazed";
$aTypeCurrency[2] = "mazes played";
$aTypeCurrency[3] = "mazes with (tied) top score";
- $aTypeCurrency[4] = "champion points";
+ $aTypeCurrency[ACHIEVEMENT_CHAMPION_POINTS] = "champion points";
$name = $aTypeNames[$aType];
$currency = $aTypeCurrency[$aType];
@@ -543,26 +602,6 @@ foreach($achievements as $aType => $a) {
}
-function displayUnlock($uType, $uValue, $uName) {
- switch ($uType) {
- case 1:
- $r .= "$uName Wall Color!";
- $r .= "<table><tr><td onclick='changeWallColor(\"$uValue\")' style='background-color:$uValue;' class='grid_td_rocks'></td></tr></table>";
- break;
- case 2:
- $r .= "$uName Emblem!";
- $r .= "<div class='emblemDisplay' title='' style='background: #999 url(../images/marks/$uValue);' >";
- //$r .= "<div class='grid_inner grid_td_gray'></div></div>";
- $r .= "<div class='emblemDisplayInner' style='width:35px; height:35px;'></div></div>";
- break;
- case 3:
- $r .= "<br /><span style='color:$uValue;font-weight:bold;font-size:110%;background-color:#222;'>$uName Username color!</span>";
- break;
- }
- return $r;
-}
-
-
?>
</div>
diff --git a/pages/admin.php b/pages/admin.php
index c0a142f..86317a3 100644
--- a/pages/admin.php
+++ b/pages/admin.php
@@ -16,8 +16,14 @@ include_once('./includes/chats.php');
if ($_GET['applyall'] == 'true') {
echo "Apply-All command heard. Executing...";
+ //TODO: Horrible hackery shall follow...
+ $res = mysqli_query($mysqli, "SELECT count(*) as count FROM `users`");
+ $row = mysqli_fetch_assoc($res);
+ $memberCount = $row['count'];
+
$x = 0;
- while ($x <= 200) {
+ // +40 because there's missing userID's... Don't judge me...- I'm going to fix it.
+ while ($x <= $memberCount + 40) {
$x++;
$i = 0;
while ($i <= 4) {
diff --git a/pages/chat.php b/pages/chat.php
index 5be6689..68a0abf 100644
--- a/pages/chat.php
+++ b/pages/chat.php
@@ -101,7 +101,7 @@ function getChatDone(data) {
p = '';
p = p+ " <div class='chatColumn1'>";
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 class='grid_td chatBadge' style='float:left; width:35px; height:35px; background:"+chat.wallColor+" url("+linkEmblem(chat.wallEmblem, chat.wallOrientation)+");'>";
p = p+ " <div style='background-color:transparent;' class='grid_td_inner grid_td_rocks'>";
p = p+ " </div>";
p = p+ " </div>";
diff --git a/pages/home.php b/pages/home.php
index 8c88d49..4a3c8a6 100644
--- a/pages/home.php
+++ b/pages/home.php
@@ -308,7 +308,7 @@ $timeUntilNewWeeklyMap = strtotime(getNextWeeklyMapDateTime()) - strtotime("now"
document.getElementById("countdown").innerHTML = newMapStr;
//TODO: It would not be very hard to dynamically load the new map w/o refresh.
- if (timerem <= 1 && userConfirm == true) {
+ if (timerem <= 1000 && userConfirm == true) {
userConfirm = confirm("It's Tomorrow Today! Go to new maps?")
if (userConfirm) {
location.reload(true);
diff --git a/pages/login.php b/pages/login.php
index bcd3b39..f8a5ba7 100644
--- a/pages/login.php
+++ b/pages/login.php
@@ -52,7 +52,7 @@ try {
$claimedid = $openid->__get('identity');
//I know just where to put this stuff!
- include_once('./includes/sqlEmbedded.php');
+ include_once('./includes/sqlEmbedded.php');
//Unless I already have this information...
//* Modify this to WHERE `email`
//$sql = "SELECT `ID`, `isAdmin`, `openID`, `displayName` FROM `users` WHERE `email` = '$email'";
diff --git a/pages/process.php b/pages/process.php
new file mode 100644
index 0000000..21604de
--- /dev/null
+++ b/pages/process.php
@@ -0,0 +1,135 @@
+<?php
+//include_once('./includes/maps.php');
+//include_once('./includes/mapclass.php');
+
+//Self-ajax.
+if ($_REQUEST['command'] == 'updateTask') {
+ $taskName = 'FAKE RECALCULATION';
+ $progress = $_SESSION['tmp'];
+
+ if ($progress >= 100) $_SESSION['dotask'] = false;
+
+ if ($_SESSION['dotask'] !== true) {
+ $json['percentComplete'] = $_SESSION['tmp'];
+ $json['taskName'] = $taskName;
+ $json['completed'] = true;
+ echo json_encode($json);
+ exit;
+ }
+
+ $_SESSION['tmp'] = $_SESSION['tmp'] + 25;
+
+
+ $json['percentComplete'] = $_SESSION['tmp'];
+ $json['taskName'] = $taskName;
+ $json['completed'] = 'false';
+ echo json_encode($json);
+ exit;
+}
+
+if ($_REQUEST['command'] == 'recalculateStats') {
+ //Already working on a task?
+ if ($_SESSION['dotask'] == true) {
+ $json['error'] = 'Task in progress!';
+ echo json_encode($json);
+ exit;
+ }
+
+ $_SESSION['tmp'] = 0;
+ $_SESSION['dotask'] = true;
+ $json['percentComplete'] = $_SESSION['tmp'];
+ $json['taskName'] = 'FAKE_Recalculation of stats';
+ echo json_encode($json);
+ exit;
+}
+
+htmlHeader(array('stats', 'achievements'), 'Process Tasks',
+ 'Process Tasks',
+ array());
+
+
+?>
+
+<body>
+<?php
+topbar($Links);
+
+?>
+<script>
+//setTimeout("start();", 500);
+function start() {
+}
+
+var requestComplete = true;
+processTimer();
+function processTimer() {
+ setTimeout("processTimer()", 3000);
+ if (requestComplete == false) return;
+ getTaskUpdate('updateTask');
+}
+
+function recalculate() {
+ if (!confirm('Are you sure?')) return;
+ getTaskUpdate('recalculateStats');
+}
+
+function getTaskUpdate(command) {
+ //var URLString = 'process?initiate=true&x'+JSON.stringify(testMap);
+ requestComplete = false;
+ var URLString = 'process?command='+command;
+ $.ajax({
+ type: "GET",
+ url: URLString,
+ cache: true,
+ data: '',
+ fail: function() { alert("error"); },
+ complete: function(data) {
+ if (data.responseText.length <= 1) {
+ console.log('null response');
+ requestComplete = true;
+ return;
+ }
+ json = decryptJSON(data.responseText);
+ if (json.error) {
+ alert('ERROR: "' + json.error + '".')
+ requestComplete = true;
+ return;
+ }
+ $('#taskProgressDisp').width(json.percentComplete+'%');
+ $('#taskProgressName').html(json.taskName);
+ // if (json.completed == true) {
+ // alert("TASK COMPLETE!");
+ // }
+ requestComplete = true;
+ }
+ });
+}
+
+
+</script>
+
+<div class='wrapper'>
+
+<h3>Task Processor</h3>
+ <div class='wrapper'>
+ <form>
+ <fieldset>
+ <legend>Load Map:</legend>
+ <div class='plusMinus'>
+ Recalculate all statistics: <input type="button" value="Recalculate!" class="forminput" onclick='recalculate()'/>
+ </div>
+ Processing: "<span id='taskProgressName'>Loading...</span>"
+ <div class='progressBar' style='width:600px'>
+ <div id='taskProgressDisp' style='width:0%;'>
+ </div>
+ </div>
+
+ </fieldset>
+
+ </form>
+ </div>
+</div>
+
+<?php
+htmlFooter();
+?> \ No newline at end of file
diff --git a/pages/scores.php b/pages/scores.php
index 3f252ec..fc86b4f 100644
--- a/pages/scores.php
+++ b/pages/scores.php
@@ -118,10 +118,7 @@ function displayMapScores(mapID) {
scoresShowPage(pointerPage, mapID);
- //Create a fake DOM element to determine the margin-left of the map, to get the target width
- var fakeMapDom = $('<div class="mapCol"></div>');
- var mapMargin = parseInt(fakeMapDom.css('margin-left'));
- var targetWidth = $('.mapNavCon').width() - $('#scoreDisplay').width() - mapMargin;
+ targetWidth = parseInt($('.wrapper').css("width")) - parseInt($('.scoreCol').css("width"));
displayMap(mapID, "mapDisplay", targetWidth);
}