From 247e7df7abf9fdd9b4bad6653cb8c17a9ea9e6e4 Mon Sep 17 00:00:00 2001 From: Patrick Davison Date: Tue, 12 Mar 2013 20:10:28 -0700 Subject: Login issue fix. --- pages/login.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'pages') diff --git a/pages/login.php b/pages/login.php index f3510c0..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! - require './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'"; -- cgit v1.2.3 From 96803882ec2a7677f9e92f1707636b589edca461 Mon Sep 17 00:00:00 2001 From: Patrick Davison Date: Tue, 12 Mar 2013 22:46:55 -0700 Subject: Scoreboard dynamic map width. --- css/stats.css | 2 +- js/mapspecs.js | 9 ++------- pages/scores.php | 5 +---- 3 files changed, 4 insertions(+), 12 deletions(-) (limited to 'pages') 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/js/mapspecs.js b/js/mapspecs.js index 688c9dc..dbb1c60 100644 --- a/js/mapspecs.js +++ b/js/mapspecs.js @@ -852,17 +852,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 = $('
'); - var gridOuterPadding = parseInt(fakeGridDom.css('padding-left')) + parseInt(fakeGridDom.css('padding-right')); - targetWidth -= gridOuterPadding; - } var scale = map.width / targetWidth; //alert(scale); 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 = $('
'); - 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); } -- cgit v1.2.3 From a444a1d8117c17f221899524a0d14df6dd65aaec Mon Sep 17 00:00:00 2001 From: Patrick Davison Date: Tue, 12 Mar 2013 22:58:30 -0700 Subject: BUGFIX: "Tomorrow today" not executing --- pages/home.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'pages') 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); -- cgit v1.2.3 From 1c9f62a731637f1d373485473f064626d311d705 Mon Sep 17 00:00:00 2001 From: Patrick Davison Date: Tue, 12 Mar 2013 23:15:31 -0700 Subject: I'm lazy, and I'm not sure there's a point to this command! --- pages/admin.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'pages') 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) { -- cgit v1.2.3 From 32cce4bee8a242f7a2e6d6a9e1c9e77b4af87728 Mon Sep 17 00:00:00 2001 From: Patrick Davison Date: Wed, 13 Mar 2013 02:26:09 -0700 Subject: Achievement back-end for Insane Speed - and any other 'Extra' unlocks like it. --- includes/constants.php | 28 +++++++++++++++ includes/datas.php | 92 ++++++++++++++++++++++++++++++++++---------------- pages/achievements.php | 80 +++++++++++++++++++++---------------------- 3 files changed, 129 insertions(+), 71 deletions(-) (limited to 'pages') diff --git a/includes/constants.php b/includes/constants.php index a6826b1..7b32819 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_ROTATION', 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..7e64732 100644 --- a/includes/datas.php +++ b/includes/datas.php @@ -19,7 +19,7 @@ function getNotified($userID) { FROM `achievements` WHERE `notified` = false AND userID = '$userID' - LIMIT 25"; + LIMIT 5"; $resultA = mysql_query($sql); if (mysql_num_rows($resultA) <= 0) @@ -54,20 +54,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 .= "
"; - break; - case 2: - $unlocked .= "$uName Emblem!"; - $unlocked .= "
"; - $unlocked .= "
"; - break; - case 3: - $unlocked .= "
$uName Username color!
"; - break; - } + $unlocked .= displayUnlock($uType, $uValue, $uName); } } // ---------- Prepare response @@ -110,6 +97,32 @@ function getNotified($userID) { // ---------- Done! } +function displayUnlock($uType, $uValue, $uName) { + switch ($uType) { + case UNLOCK_WALL_COLOR: + $r .= "$uName Wall Color!"; + $r .= "
"; + break; + + case UNLOCK_WALL_EMBLEM: + $r .= "$uName Emblem!"; + $r .= "
"; + //$r .= "
"; + $r .= "
"; + break; + + case UNLOCK_DISPLAY_COLOR: + $r .= "
$uName Username color!"; + break; + + case UNLOCK_EXTRAS: + $r .= "Extras: $uName"; + break; + } + return $r; +} + + //Returns true when an achievement is applied. // Usage example: applyCareerAchievement($userID); // TODO: DEPRECIATED @@ -531,13 +544,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 COUNT( 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 +577,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 +678,22 @@ 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() { + //$cp[0] = array(requiredpoints, type, 'value', 'name'); + $r[1] = array(1, UNLOCK_EXTRAS, MISC_UNLOCK_INSANE_SPEED, 'Insane Speed'); + //These numbers temporarly unreasonable + $r[2] = array(9275, UNLOCK_WALL_EMBLEM, 'CircleSmall_W_I.png', 'Inverted Bright Small Circle', 0); + $r[3] = 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') { diff --git a/pages/achievements.php b/pages/achievements.php index 249077c..a5e56ed 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); @@ -69,9 +70,9 @@ echo ""; $debug = false; -if ($_GET['debuglevels'] == 'yes') +if ($_GET['debuglevels'] == 'yes') { $debug = true; - +} if ($_GET['showemblems'] == 'all') { @@ -147,10 +148,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); } ?> @@ -307,8 +309,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; + } } @@ -358,35 +361,41 @@ echo "
$UDisplay"; -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 1: if ($GLOBALS['wallColor'] == $item[value]) { $class = 'grid_td_active'; $border = 'border: 1px solid #26b;'; } $r .= ""; break; - case 2: + + case 2: if ($GLOBALS['wallEmblem'] == $item[value]) { $class = 'grid_td_active'; $border = 'border: 1px solid #26b;'; @@ -394,13 +403,18 @@ function displayUnlockItem($uType, $item) { $r .= "
"; break; - case 3: + + case 3: if ($GLOBALS['nameColor'] == $item[value]) $border = 'border: 1px solid #26b;'; $r .= ""; $r .= " $item[name] "; $r .= ""; break; + + case UNLOCK_EXTRAS: + $r .= "$item[name]"; + break; } return $r; } @@ -408,11 +422,12 @@ function displayUnlockItem($uType, $item) { if (isset($unlocks)) { echo "

Unlocks

"; - + //Define some names $uTypeNames[1] = "Wall Colors"; $uTypeNames[2] = "Emblems"; $uTypeNames[3] = "Username Colors"; + $uTypeNames[UNLOCK_EXTRAS] = "Extras"; $uSubtypeNames[1][0] = "Darker"; $uSubtypeNames[1][1] = "Brighter"; @@ -426,7 +441,7 @@ if (isset($unlocks)) { echo "

$uTypeNames[$uType] unlocked:

"; 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']][] = ''; } @@ -487,13 +502,14 @@ foreach($achievements as $aType => $a) { $aTypeNames[1] = "Path Career Level $aLevel!"; $aTypeNames[2] = "Mazes Career Level $aLevel!"; $aTypeNames[3] = "Maze Mastery Level $aLevel!"; - $aTypeNames[4] = "Champion Level $aLevel!"; + $aTypeNames[ACHIEVEMENT_CHAMPION_POINTS] = "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 +559,6 @@ foreach($achievements as $aType => $a) { } -function displayUnlock($uType, $uValue, $uName) { - switch ($uType) { - case 1: - $r .= "$uName Wall Color!"; - $r .= "
"; - break; - case 2: - $r .= "$uName Emblem!"; - $r .= "
"; - //$r .= "
"; - $r .= "
"; - break; - case 3: - $r .= "
$uName Username color!"; - break; - } - return $r; -} - - ?> -- cgit v1.2.3 From f797f84a2f708912ac039340a217e18066f9eba3 Mon Sep 17 00:00:00 2001 From: Patrick Davison Date: Thu, 14 Mar 2013 02:00:08 -0700 Subject: More achievement cleanups --- includes/datas.php | 29 +++++++++++++---------------- pages/achievements.php | 3 +-- 2 files changed, 14 insertions(+), 18 deletions(-) (limited to 'pages') diff --git a/includes/datas.php b/includes/datas.php index d79e3ae..f599533 100644 --- a/includes/datas.php +++ b/includes/datas.php @@ -12,7 +12,6 @@ include_once('constants.php'); //Returns text refering to any notifications. function getNotified($userID) { - $r = ''; $sql = "SELECT `ID`, `type`, `level` @@ -22,25 +21,25 @@ function getNotified($userID) { 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 .= '

'; + if ($r != '') $r .= '

'; - $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]; @@ -79,8 +78,6 @@ function getNotified($userID) { } - - // Item ID List $aIDList[] = "'$aID'"; } diff --git a/pages/achievements.php b/pages/achievements.php index a5e56ed..383de70 100644 --- a/pages/achievements.php +++ b/pages/achievements.php @@ -491,8 +491,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]); -- cgit v1.2.3 From c5175d4a06c993ff7f42c16178b6d4db49b7387e Mon Sep 17 00:00:00 2001 From: Patrick Davison Date: Mon, 18 Mar 2013 01:32:14 -0700 Subject: Wall orientation achievements - huge commit. --- css/page.css | 2 +- globe.php | 6 ++++ images/marks/rotate.php | 5 ++- includes/chats.php | 3 +- includes/constants.php | 2 +- includes/datas.php | 18 ++++++++-- includes/header.php | 9 ++--- index.php | 6 ++-- js/mapspecs.js | 19 +++++++++- js/scores.js | 13 +++---- pages/achievements.php | 94 ++++++++++++++++++++++++++++++++++++------------- pages/chat.php | 2 +- 12 files changed, 133 insertions(+), 46 deletions(-) (limited to 'pages') diff --git a/css/page.css b/css/page.css index 10038e4..d396766 100644 --- a/css/page.css +++ b/css/page.css @@ -299,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/globe.php b/globe.php index 7353e74..7a3d472 100644 --- a/globe.php +++ b/globe.php @@ -20,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 ' diff --git a/images/marks/rotate.php b/images/marks/rotate.php index 9b0a3fe..41a203a 100644 --- a/images/marks/rotate.php +++ b/images/marks/rotate.php @@ -10,7 +10,10 @@ $degrees = $_GET['r'] * 90; // Content type header('Content-type: image/jpeg'); -//TODO Add cache +//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) { 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 7b32819..a1d4dbe 100644 --- a/includes/constants.php +++ b/includes/constants.php @@ -84,7 +84,7 @@ $tierChallengeRequirements = array(0, 5, 10, 15, 20, 25, 30); define('UNLOCK_WALL_COLOR', 1); define('UNLOCK_WALL_EMBLEM', 2); define('UNLOCK_DISPLAY_COLOR', 3); -define('UNLOCK_WALL_ROTATION', 4); +define('UNLOCK_WALL_ORIENTATION', 4); define('UNLOCK_EXTRAS', 8); // MISC SUBTYPES: diff --git a/includes/datas.php b/includes/datas.php index f599533..af10cd2 100644 --- a/includes/datas.php +++ b/includes/datas.php @@ -110,11 +110,19 @@ function displayUnlock($uType, $uValue, $uName) { case UNLOCK_DISPLAY_COLOR: $r .= "
$uName Username color!"; + break; + + case UNLOCK_WALL_ORIENTATION: + $r .= "Emblem Rotation $uName!"; break; case UNLOCK_EXTRAS: $r .= "Extras: $uName"; break; + + default: + $r .= "$uName"; + break; } return $r; } @@ -684,9 +692,13 @@ 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[2] = array(9275, UNLOCK_WALL_EMBLEM, 'CircleSmall_W_I.png', 'Inverted Bright Small Circle', 0); - $r[3] = array(10000, UNLOCK_WALL_EMBLEM, 'DiamondLarge_W_I.png', 'Inverted Light Large Diamond', 0); + $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; } @@ -748,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` @@ -844,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 diff --git a/includes/header.php b/includes/header.php index 3965357..71c2a5c 100644 --- a/includes/header.php +++ b/includes/header.php @@ -153,7 +153,7 @@ function htmlFooter() { } function topbar($links) { - global $accepted, $wallColor, $wallEmblem, $request; + global $accepted, $wallColor, $wallEmblem, $wallOrientation, $request; @@ -191,7 +191,7 @@ function topbar($links) { echo " Update your name | "; echo " Logout"; echo " "; - echo "
+ echo "
"; @@ -207,9 +207,9 @@ function topbar($links) { } function userDataToJS() { - global $wallColor, $wallEmblem, $accepted; + global $wallColor, $wallEmblem, $wallOrientation, $accepted; if (!$accepted) { - $r = 'var userObj = {"wallColor":false,"wallEmblem":false,'; + $r = 'var userObj = {"wallColor":false,"wallEmblem":false,"wallOrientation":false,'; $r .= '"ID":"-1","accepted":false,"hasInsaneSpeed":false};'; } else { $userID = $_SESSION['userID']; @@ -220,6 +220,7 @@ function userDataToJS() { $json['ID'] = $userID; $json['wallColor'] = $wallColor; $json['wallEmblem'] = $wallEmblem; + $json['wallOrientation'] = $wallOrientation; $json['hasInsaneSpeed'] = $hasInsaneSpeed; $json['accepted'] = 'true'; diff --git a/index.php b/index.php index 2786237..ed7a836 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 diff --git a/js/mapspecs.js b/js/mapspecs.js index 5a124b1..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 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+ ""; p = p+ ""; - p = p+ "
"; + p = p+ "
"; p = p+ "
"; p = p+ "
"; p = p+ "
"; @@ -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+ ""; p = p+ ""; p = p+ i+ ""; p = p+ ""; - p = p+ "
"; + p = p+ "
"; p = p+ "
"; p = p+ "
"; p = p+ "
"; diff --git a/pages/achievements.php b/pages/achievements.php index 383de70..fb20f2b 100644 --- a/pages/achievements.php +++ b/pages/achievements.php @@ -55,8 +55,6 @@ foreach ($ac3 as $c3) { echo ""; foreach ($ac1 as $c1) { foreach ($ac2 as $c2) { - - $c = "#$c1$c2$c3"; if ($_GET['showcolor'] == 'all') { //echo ""; @@ -177,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; } @@ -190,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; +} + 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, @@ -221,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); @@ -237,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` @@ -271,7 +287,6 @@ if (isset($_POST['doupdate']) AND !$viewer) { $data['post'] = print_r($_POST, true); EmailError($data); } - } if ($unlockNameColor == $_POST['selectNameColor']) { $sql = "UPDATE `users` @@ -287,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(); @@ -325,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 @@ -341,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'; @@ -353,11 +383,12 @@ $uStats[1] = $UTotalMoves; $uStats[2] = $UTotalSolutions; echo "
"; -if ($viewer) - echo "

Viewing

"; +if ($viewer) echo "

Viewing

"; + +$badgeURL = linkEmblem($wallEmblem, $wallOrientation); echo "

-
+
$UDisplay

"; @@ -387,7 +418,7 @@ function unlockItemAsTD($uType, $item) { //return $r; switch ($uType) { - case 1: + case UNLOCK_WALL_COLOR: if ($GLOBALS['wallColor'] == $item[value]) { $class = 'grid_td_active'; $border = 'border: 1px solid #26b;'; @@ -395,7 +426,7 @@ function unlockItemAsTD($uType, $item) { $r .= ""; break; - case 2: + case UNLOCK_WALL_EMBLEM: if ($GLOBALS['wallEmblem'] == $item[value]) { $class = 'grid_td_active'; $border = 'border: 1px solid #26b;'; @@ -404,13 +435,22 @@ function unlockItemAsTD($uType, $item) {
"; break; - case 3: + case UNLOCK_DISPLAY_COLOR: if ($GLOBALS['nameColor'] == $item[value]) $border = 'border: 1px solid #26b;'; $r .= ""; $r .= " $item[name] "; $r .= ""; break; + + case UNLOCK_WALL_ORIENTATION: + $checked = ''; + if (intval($GLOBALS['wallOrientation']) == intval($item[value])) $checked = 'checked'; + //$r .= ""; + $r .= ""; + $r .= "$item[name] "; + $r .= ""; + break; case UNLOCK_EXTRAS: $r .= "$item[name]"; @@ -424,16 +464,17 @@ if (isset($unlocks)) { echo "

Unlocks

"; //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) { @@ -463,6 +504,7 @@ echo "
"; if (!$viewer) { + //TODO add wall orientation echo "
@@ -470,6 +512,8 @@ if (!$viewer) { + + 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+ "
"; p = p+ " ["+timestamp+"]"; - p = p+ "
"; + p = p+ "
"; p = p+ "
"; p = p+ "
"; p = p+ "
"; -- cgit v1.2.3 From bc57b007dfa5e6e723946143671a9db68a82f348 Mon Sep 17 00:00:00 2001 From: Patrick Davison Date: Tue, 19 Mar 2013 00:59:53 -0700 Subject: UI Framework for processing tasks. --- index.php | 8 ++++ pages/process.php | 135 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 143 insertions(+) create mode 100644 pages/process.php (limited to 'pages') diff --git a/index.php b/index.php index ed7a836..9e47971 100644 --- a/index.php +++ b/index.php @@ -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/pages/process.php b/pages/process.php new file mode 100644 index 0000000..21604de --- /dev/null +++ b/pages/process.php @@ -0,0 +1,135 @@ += 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()); + + +?> + + + + + +
+ +

Task Processor

+
+ +
+ Load Map: +
+ Recalculate all statistics: +
+ Processing: "Loading..." +
+
+
+
+ +
+ + +
+
+ + \ No newline at end of file -- cgit v1.2.3