summaryrefslogtreecommitdiffstats
path: root/pages/home.php
diff options
context:
space:
mode:
authorPatrick Davison <snapwilliam@gmail.com>2012-03-19 19:26:40 -0700
committerPatrick Davison <snapwilliam@gmail.com>2012-03-19 19:26:40 -0700
commit2f084afa390dd1e5dc2774860472553fcb7474f5 (patch)
tree10babd0cbc967e92aa85e5d71a803ea84985d414 /pages/home.php
parent323ffff2203f8b77262e235b2d566d8781f7ef72 (diff)
downloadpathery-2f084afa390dd1e5dc2774860472553fcb7474f5.tar.xz
Home changes and updates.
Diffstat (limited to 'pages/home.php')
-rw-r--r--pages/home.php250
1 files changed, 130 insertions, 120 deletions
diff --git a/pages/home.php b/pages/home.php
index 66c5182..cc4aca9 100644
--- a/pages/home.php
+++ b/pages/home.php
@@ -1,16 +1,16 @@
-<?PHP
-htmlHeader(array('stats'));
+<?php
+htmlHeader(array('stats'), 'Pathery');
+include_once ('./includes/maps.php');
+include_once ('./includes/mapoftheday.php');
+include_once ('./includes/db.inc.php');
+include_once ('./includes/datas.php');
//Get custom wall colors;
-
-
$wallColor = '';
$wallEmblem = '';
-
if ($_SESSION[accepted] == 1) {
$userID = $_SESSION['userID'];
- include_once('./includes/db.inc.php');
$sql = "
SELECT
@@ -21,13 +21,24 @@ if ($_SESSION[accepted] == 1) {
$result = mysql_query($sql);
if ($result)
list($wallColor, $wallEmblem) = mysql_fetch_row($result);
+
+ $note = getNotified($userID);
+ if ($note !== false) {
+ //$note = str_replace("'", "\'", $note);
+ //Double your slashes double your fun (Required)
+ $note = addslashes($note);
+ $note = addslashes($note);
+ $noteScript = "
+<script type='text/javascript'>
+setTimeout(\"showNotification('".$note."');\", 1000);
+if (getCookie('pref_mute') != 'true') {
+ setTimeout(\"soundManager.setVolume('achieve', 40);\", 1340);
+ setTimeout(\"soundManager.play('achieve');\", 1350);
+}
+</script>
+ ";
+ }
}
-
-//$wallColor = '#ff3344';
-//$wallEmblem = 'StarsR_W.png';
-//$wallEmblem = 'DiagonalCover_B.png';
-//$wallEmblem = 'DiagonalCover_W.png';
-//$wallEmblem = 'X_B.png';
function tutorialComplete($userID) {
@@ -40,96 +51,28 @@ function tutorialComplete($userID) {
return false;
}
+
?>
+<body>
<script type="text/javascript">
-
playerWallColor = '<?PHP echo $wallColor; ?>';
playerWallEmblem = '<?PHP echo $wallEmblem; ?>';
-//playerEmblem = 'Shine.gif';
</script>
-<body>
<?php
-include('./includes/maps.php');
-include('./includes/mapoftheday.php');
-
-include('./includes/datas.php');
-
-//Get the current day as int.
-$numday = date('w');
-$numday = intval($numday);
-switch ($numday) {
- case 0:
- $mapstyle = 'Thirty';
- break;
- case 1:
- $mapstyle = 'Simple';
- break;
- case 2:
- $mapstyle = "ABC's";
- break;
- case 3:
- $mapstyle = 'Teleport Madness';
- break;
- case 4:
- $mapstyle = 'Rocky Maze';
- break;
- case 5: //Friday
- $mapstyle = 'Side to Side';
- break;
- case 6: //Saturday
- $mapstyle = "Seeing Double";
- break;
-}
-
-$easy = '<a href="home?maptype=easy">Simple</a>';
-$normal = '<a href="home?maptype=normal">Normal</a>';
-$hard = '<a href="home?maptype=hard">Complex</a>';
-
-$today = date('l') . "'s";
-$special = "<a href=\"home?maptype=day\">$today $mapstyle</a>";
-
-switch ($_GET['maptype']) {
- case "easy":
- case "1":
- default:
- $maptype = 1;
- $easy = '<a href="home?maptype=easy" class="selected">Simple</a>';
- break;
- case "normal":
- case "2":
- $maptype = 2;
- $normal = '<a href="home?maptype=normal" class="selected">Normal</a>';
- break;
- case "hard":
- case "3":
- $maptype = 3;
- $hard = '<a href="home?maptype=hard" class="selected">Complex</a>';
- break;
- case "day":
- case "4":
- $maptype = 4;
- $special = "<a href=\"home?maptype=day\" class=\"selected\">$today $mapstyle</a>";
- break;
-}
-
-//$motd = getMapOfTheDay();
-$motd = MapOfTheDay($maptype);
-
topbar($Links);
-$mapID = $motd['id'];
-$map = $motd['map'];
-$userID = $_SESSION['userID'];
-//$mergesolution = mergeMapSolution($map, $mysolution);
-$topscores = topScores($motd['id'], 30);
-$topscorediv = "<div id='$mapID,dspScore'>\n$topscores\n</div>";
-$mergesolution = $map;
?>
<div class="wrapper">
+<strong>Update in progress</strong>
+<p><strong>M</strong>any improvements including Achievements are being added!
+<br />During this testing phase, some achievements and unlocks may be removed or re-added for you.
+<br />Thank your for your patience! - Also please <a href='about'>email me or contact me</a> if you have suggestions or feedback.
+</p>
+
<?
if ($_SESSION['accepted'] == 1) {
if (tutorialComplete($userID) == false) {
@@ -137,45 +80,88 @@ $mergesolution = $map;
echo "<table><tr><td style='background-color:#4444ff;' class='grid_td_rocks'></td></tr></table></center><br />";
}
}
+ ?>
+
+ <div id="difficulties">
+ <a href="javascript:showStats(1)" id="dl-1">Simple</a>
+ <a href="javascript:showStats(2)" id="dl-2">Normal</a>
+ <a href="javascript:showStats(3)" id="dl-3">Complex</a>
+ <a href="javascript:showStats(4)" id="dl-4">Special</a>
+ </div>
+ <div style="clear: both"></div>
+
+ <noscript>Sorry, this game requires scripts to run. Please enable javascript and <a href='home'>Reload this site</a>
+ <br />This game is best viewed in <a href='http://www.google.com/chrome'>Google Chrome</a>
+ </noscript>
+
+
+<?
+function displayMaze($mapType, $name) {
- echo "<div id='difficulties'>";
- echo "$easy";
- echo "$normal";
- echo "$hard";
- echo "$special";
- echo "</div>";
-
- echo DisplayMap($mergesolution, $mapID);
-
- if ($_SESSION['accepted'] == 1)
- $mysolution = getSolution($userID, $mapID);
- if (isset($_SESSION[$mapID.'sol']) AND $mysolution == '')
+ //Gather data for map;
+ $motd = MapOfTheDay($mapType);
+ $mapID = $motd['id'];
+ $map = $motd['map'];
+ $width = $map[0][0];
+ //data for the topscores
+ $topscores = topScores($motd['id'], 30);
+ $topscorediv = "<div id='$mapID,dspScore'>\n$topscores\n</div>";
+
+ $userID = $_SESSION['userID'];
+ if ($_SESSION['accepted'] == 1) {
+ $sol = getSolution($userID, $mapID);
+ $mysolution = $sol['solution'];
+ //!! implement mymoves
+ $mymoves = $sol['moves'];
+ }
+ if (isset($_SESSION[$mapID.'sol']) AND $mysolution == '') {
$mysolution = $_SESSION[$mapID.'sol'];
+ $mymoves = $_SESSION[$mapID.'moves'];
+ }
- $solutiondiv .= "<div id='mapsol' style='visibility:hidden;display:none'>";
- $solutiondiv .= $mapID.":".$mysolution;
- $solutiondiv .= '</div>';
-
- echo $solutiondiv;
-
+
+ echo "<div id=\"yms-$mapType\" class='hidden-maps'>";
+ echo " <div class='wrapper'>";
+
+ // if ($width <= 16) {
+ // echo ' <div class="col1">';
+ // echo $topscorediv;
+ // echo ' </div>';
+
+ // echo ' <div class="col2">';
+ // echo "<a href='javascript:requestSol(\"$mapID\");'>Load your best solution</a><br />";
+ // echo DisplayMap($map, $mapID);
+ // echo ' </div>';
+ echo " <div style='text-align: center;'>";
+ echo " <div style='display:inline-block;margin: 0 auto;text-align: left;'>";
+ echo " <a href='javascript:requestSol(\"$mapID\");'>Load your best solution</a><br />";
+ echo DisplayMap($map, $mapID);
+ echo " </div></div>";
+
+ echo " <div style='padding-top: 20px;'>";
echo $topscorediv;
+ echo ' </div>';
+ echo ' </div>';
+ echo '</div>';
- if ($_SESSION['accepted'] != 1) {
- echo "
- <div style='text-align: center; margin-top: 20px'>
- <a href='login'>Sign in</a> to have your score saved.
- </div>
- ";
- }
-?>
+ $mapSolDiv = "<script>
+ loadSol(\"$mapID:$mysolution\", \"$mymoves\");
+ </script>";
+ echo $mapSolDiv;
+
+ //Clear our floatingness
+ echo '<div style="clear: both"></div>';
+
+}
+displayMaze(1, 'Simple');
+displayMaze(2, 'Normal');
+displayMaze(3, 'Complex');
+displayMaze(4, 'Special');
- <div id="fb">
- </div>
-<?PHP
$timerem = strtotime("tomorrow") - strtotime("now");
?>
- <div style='text-align: center; margin-top: 5px'>
+ <div style='text-align: center; margin-top: 5px;'>
New maps in: <span id="countdown">00:00:00</span>
</div>
<script type="text/javascript">
@@ -203,14 +189,38 @@ $timerem = strtotime("tomorrow") - strtotime("now");
</script>
</div>
-<div id="copy">
- <iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.facebook.com/pages/Pathery/176985129018434&amp;layout=button_count&amp;show_faces=false&amp;width=90&amp;action=like&amp;font&amp;colorscheme=dark&amp;height=21"></iframe>
+
+
+<div id="copy" style='width:100%;clear: both'>
Copyright &copy; 2011 pathery.com
</div>
+
+
+<script>
+function showStats(type) {
+ for (var i = 1; i <= 4; i++) {
+ var elem = document.getElementById("yms-" + i);
+ elem.className = elem.className.replace('shown-maps', 'hidden-maps');
+ // var elem = document.getElementById("yms-" + i);
+ // if (elem.className.indexOf('hidden-maps') < 0)
+ // elem.className += 'hidden-maps';
+ elem = document.getElementById("dl-" + i);
+ elem.className = elem.className.replace('selected', '');
+ }
+ var elem = document.getElementById("yms-" + type);
+ elem.className = elem.className.replace('hidden-maps', 'shown-maps');
+ elem = document.getElementById("dl-" + type);
+ if (elem.className.indexOf('selected') < 0)
+ elem.className += 'selected';
+}
+showStats(1);
+</script>
<script src="sounds/script/soundmanager.js"></script>
<script type="text/javascript">soundManagerInit();</script>
+<?PHP echo $noteScript; ?>
+
<?php
htmlFooter();
?> \ No newline at end of file