summaryrefslogtreecommitdiffstats
path: root/pages
diff options
context:
space:
mode:
authorPatrick Davison <snapwilliam@gmail.com>2013-01-14 14:49:51 -0800
committerPatrick Davison <snapwilliam@gmail.com>2013-01-14 14:49:51 -0800
commit59fc439d341900d99c00a31ff1653b274ba2a037 (patch)
tree5bd4b89bb500bc5557750228030ee0f2b8e2fb6d /pages
parentfab36d921f22cb5999357932785e03aa88269f8d (diff)
parent532faa4d5cc5b20fba8422c87b0aac846874af43 (diff)
downloadpathery-59fc439d341900d99c00a31ff1653b274ba2a037.tar.xz
Merge branch 'HEAD' of ssh://git@git.raylu.net/pathery
Conflicts: css/challenge.css
Diffstat (limited to 'pages')
-rw-r--r--pages/achievements.php6
-rw-r--r--pages/admin.php26
-rw-r--r--pages/challenge.php10
-rw-r--r--pages/challengelist.php2
-rw-r--r--pages/cp.php2
-rw-r--r--pages/faq.php24
-rw-r--r--pages/feedback.php2
-rw-r--r--pages/gallery.php2
-rw-r--r--pages/home.php2
-rw-r--r--pages/leaderboard.php31
-rw-r--r--pages/login.php2
-rw-r--r--pages/massemail.php4
-rw-r--r--pages/memberlist.php7
-rw-r--r--pages/tutorial.php2
14 files changed, 82 insertions, 40 deletions
diff --git a/pages/achievements.php b/pages/achievements.php
index ac7aded..6dbabe7 100644
--- a/pages/achievements.php
+++ b/pages/achievements.php
@@ -7,7 +7,7 @@ htmlHeader(array('profile'), 'Pathery Achievements');
<?php
topbar($Links);
-include_once('./includes/db.inc.php');
+include_once('./includes/sqlEmbedded.php');
include_once('./includes/datas.php');
//Get UserID
@@ -499,13 +499,13 @@ 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/MedalGoldCAR.png' style='width:36px;height:36px;vertical-align:middle'>Champion Level $aLevel!";
+ $aTypeNames[4] = "<img src='../images/championpoints.png' style='width:36px;height:36px;vertical-align:middle'>Champion Level $aLevel!";
$aTypeNames[32] = 'Tutorial Complete!';
$aTypeCurrency[1] = "total moves mazed";
$aTypeCurrency[2] = "mazes played";
$aTypeCurrency[3] = "mazes with (tied) top score";
- $aTypeCurrency[4] = "maze wins";
+ $aTypeCurrency[4] = "champion points";
$name = $aTypeNames[$aType];
$currency = $aTypeCurrency[$aType];
diff --git a/pages/admin.php b/pages/admin.php
index 983c4bc..0f54285 100644
--- a/pages/admin.php
+++ b/pages/admin.php
@@ -6,10 +6,11 @@ htmlHeader();
<?php
topbar($Links);
-include('./includes/datas.php');
-include('./includes/maps.php');
-include('./includes/mapoftheday.php');
-include('./includes/db.inc.php');
+include_once('./includes/datas.php');
+include_once('./includes/maps.php');
+include_once('./includes/mapoftheday.php');
+include_once('./includes/sqlEmbedded.php');
+include_once('./includes/playerStats.php');
if ($_GET['applyall'] == 'true') {
echo "Apply-All command heard. Executing...";
@@ -26,22 +27,33 @@ if ($_GET['applyall'] == 'true') {
echo "Execution complete!";
}
+else if ($_GET['recalcStats'] == 'true') {
+ echo "Recalculating all player stats...";
+
+ recalculateStatsForAllPlayers();
+
+ echo "Complete!";
+}
$sql = "SELECT `ID`, `displayName`, `dateJoined`, `dateLogin`, `email`, `isAdmin` FROM `users`";
$result = mysql_query($sql);
-echo "
+echo '
<center>
<h3>Administrators Page</h3>
<p>News:</p>
+<p>Buttons:<br />
+ <input type="button" value="Apply all achievements" onClick="parent.location=\'admin?applyall=true\'">
+ <input type="button" value="Recalculate all player stats" onClick="parent.location=\'admin?recalcStats=true\'">
+</p>
<p>Hello admins, this is our current userlist.</p>
</center>
-<table style='padding-left:20px;'>
+<table style="padding-left:20px;">
<tr>
<th>ID</th><th>Display name:</th><th>Joined On:</th><th>Last Logon</th><th>Email</th><th>Administrator</th>
</tr>
-";
+';
while (list($CUID, $CUsername, $Joined, $LastLogon, $email, $isAdmin) = mysql_fetch_row($result)) {
diff --git a/pages/challenge.php b/pages/challenge.php
index 8d312d1..ceefebe 100644
--- a/pages/challenge.php
+++ b/pages/challenge.php
@@ -6,7 +6,7 @@ htmlHeader(
include_once ('./includes/maps.php');
include_once ('./includes/mapoftheday.php');
-include_once ('./includes/db.inc.php');
+include_once ('./includes/sqlEmbedded.php');
include_once ('./includes/datas.php');
//Get custom wall colors;
@@ -131,21 +131,19 @@ function displayChallenges($challengeResultset)
{
echo '<div id="challenges">';
echo '<div id="challenges_title">Challenges</div>';
- echo '<div id="challenges_listing"><ol>';
+ echo '<div id="challenges_listing"><ul class="challenge_ulist">';
while($challenge = mysql_fetch_array($challengeResultset))
{
$mapID = $_GET["mapID"];
$challengeId = $challenge["challengeID"];
- echo "<li>";
if($challenge["dateSolved"] !== NULL)
$cssClass = "challenge_complete";
else
$cssClass = "challenge_incomplete";
$loadSolutionString = "<a href='javascript:requestChallengeSolution(\"$mapID\", \"$challengeId\");'> Load this solution</a>";
- echo "<span class='$cssClass' id='challenge_id_$challengeId'>" . getChallengeDisplayString($challenge) . " $loadSolutionString </span>";
- echo "</li>";
+ echo "<li class='$cssClass' id='challenge_id_$challengeId'>" . getChallengeDisplayString($challenge) . " $loadSolutionString </li>";
}
- echo "</ol></div></div>";
+ echo "</ul></div></div>";
}
/**
diff --git a/pages/challengelist.php b/pages/challengelist.php
index a6a4ade..ca9fe46 100644
--- a/pages/challengelist.php
+++ b/pages/challengelist.php
@@ -6,7 +6,7 @@ htmlHeader(
include_once ('./includes/maps.php');
include_once ('./includes/mapoftheday.php');
-include_once ('./includes/db.inc.php');
+include_once ('./includes/sqlEmbedded.php');
include_once ('./includes/datas.php');
include_once ('./includes/mapclass.php');
diff --git a/pages/cp.php b/pages/cp.php
index 06ec0e8..a807200 100644
--- a/pages/cp.php
+++ b/pages/cp.php
@@ -9,7 +9,7 @@ htmlHeader();
topbar($Links);
include('./includes/maps.php');
-include_once('./includes/db.inc.php');
+include_once('./includes/sqlEmbedded.php');
function validatename($name) {
if (strlen($name) < 1)
diff --git a/pages/faq.php b/pages/faq.php
index 3df08eb..95b0b87 100644
--- a/pages/faq.php
+++ b/pages/faq.php
@@ -7,7 +7,8 @@ htmlHeader(array(), 'FAQ', 'How does the pathing work?');
echo soundManager2();
topbar($Links);
-include('./includes/maps.php');
+include_once('./includes/maps.php');
+include_once('./includes/playerStats.php');
// Demo maps:
@@ -72,6 +73,7 @@ Your question not here? Ask me via the <a href='feedback'>Feedback Page</a>.
<li><a href='#pathing'>How does the pathing work? / How does it choose which way to go?</a></li>
<li><a href='#multipath'>How does Multi-path work? (Two paths at once)</a></li>
<li><a href='#greed'>More than one of the same checkpoint?</a></li>
+ <li><a href='#championPoints'>What are 'Champion Points?'</a></li>
</ul>
<a name='pathing'>&nbsp;</a>
@@ -131,6 +133,26 @@ When there's more than one checkpoint, you can completely wall one off.
<? echo $demo3; ?>
<div style='clear:both'></div>
+<hr width='60%' />
+
+<a name='championPoints'>&nbsp;</a>
+<h3>What are 'Champion Points?'</h3>
+<img src="../images/championpoints.png"></img>
+<p>Champion Points are a way to give you recognition for your skills and dedication. They work like this:
+<ul><li>Just for attempting a map, you get <?echo CP_POINTS_FOR_ATTEMPTING;?> points. That's <?echo CP_POINTS_FOR_ATTEMPTING*4;?> points a day just for clicking go!</li>
+ <li>If you tie the high score, you get anywhere between <?echo CP_MIN_WORTH;?> and <?echo CP_MAX_WORTH_SPECIAL;?> points,
+ depending on how many people tied or didn't tie the high score.</li>
+ <li>The winner of each map receives an additional small bonus.</li>
+ <? /*TODO: REVIEW AFTER PUSHING THE WEEKLY MAP UPDATE*/ //<li>On the weekly maps, <i>everyone</i> gets points! The more people you beat, the more points you'll get!</li> ?>
+ <? //<li>You also receive points for completing additional tasks, like <a href="challengelist">completing challenges</a>,
+ //<a href="achievements">getting achievements</a>!</li>, or even <a href="ADD LINK HERE">liking us on facebook</a> ?>
+</ul>
+ Make sure to play every day to receive as many points as possible!
+</p>
+
+<br />
+<div style='clear:both'></div>
+
</div>
diff --git a/pages/feedback.php b/pages/feedback.php
index 33c3e1d..e971f12 100644
--- a/pages/feedback.php
+++ b/pages/feedback.php
@@ -10,7 +10,7 @@ if (isset($_POST['regarding']) AND isset($_SESSION['accepted'])) {
if (!is_int($userID))
return;
- include_once "includes/db.inc.php";
+ include_once "includes/sqlEmbedded.php";
$sql = "SELECT `email` FROM `users`
WHERE `ID` = '$userID'";
$result = mysql_query($sql);
diff --git a/pages/gallery.php b/pages/gallery.php
index f8e1b9d..525c73a 100644
--- a/pages/gallery.php
+++ b/pages/gallery.php
@@ -1,7 +1,7 @@
<?PHP
htmlHeader(array(), '', '', array('scores'));
-include_once ('./includes/db.inc.php');
+include_once ('./includes/sqlEmbedded.php');
if ($accepted) {
$userID = $_SESSION['userID'];
diff --git a/pages/home.php b/pages/home.php
index 37a94c3..d5ba45f 100644
--- a/pages/home.php
+++ b/pages/home.php
@@ -2,7 +2,7 @@
include_once ('./includes/maps.php');
include_once ('./includes/mapoftheday.php');
-include_once ('./includes/db.inc.php');
+include_once ('./includes/sqlEmbedded.php');
include_once ('./includes/datas.php');
htmlHeader(
diff --git a/pages/leaderboard.php b/pages/leaderboard.php
index 9f40d8b..b5e3a76 100644
--- a/pages/leaderboard.php
+++ b/pages/leaderboard.php
@@ -11,7 +11,7 @@ include('./includes/maps.php');
//include('./includes/mapoftheday.php');
include('./includes/datas.php');
-include_once ('./includes/db.inc.php');
+include_once ('./includes/sqlEmbedded.php');
function day_diff($date1, $date2) {
$current = $date1;
@@ -109,7 +109,10 @@ function getStat ($type, $daysAgo = 1) {
userData.wallColor,
userData.wallEmblem,
userData.displayColor,
- users.ID as userID
+ users.ID as userID,
+ SUM(CASE WHEN solutions.dateModified < CURDATE()
+ THEN solutions.championPointsWorth
+ ELSE 0 END) AS championPointsWorth
FROM `maps`
JOIN `solutions`
ON maps.ID = solutions.mapID
@@ -198,7 +201,8 @@ function displayPastMaze($mapType, $name, $daysAgo = 1) {
userData.wallColor,
userData.wallEmblem,
userData.displayColor,
- users.ID as userID
+ users.ID as userID,
+ solutions.championPointsWorth
FROM `maps`
JOIN `solutions`
ON maps.ID = solutions.mapID
@@ -254,11 +258,11 @@ function displayPastMaze($mapType, $name, $daysAgo = 1) {
function displaystats($result, $caption = NULL) {
//Get names.
- $headers = "<tr>";
- $headers .= "<th style='border:1px solid #ccc'>Rank</th>";
- $headers .= "<th style='border:1px solid #ccc'>Name</th>";
- $headers .= "<th style='border:1px solid #ccc'>Moves</th>";
- $headers .= "<th style='border:1px solid #ccc'>Time taken</th>";
+ $headers = "<tr class='leaderboardHeaders'>";
+ $headers .= "<th class='leaderboardHeadersRank'>Rank</th>";
+ $headers .= "<th class='leaderboardHeadersName'>Name</th>";
+ $headers .= "<th class='leaderboardHeadersMoves'>Moves</th>";
+ $headers .= "<th class='leaderboardHeadersTime'>Time taken</th>";
$headers .= "</th>";
//Start table
//$r .= "<table style='border:1px solid #FFF'>";
@@ -269,6 +273,7 @@ function displaystats($result, $caption = NULL) {
//$r .= "</tr>";
$i = 1;
+ $championPoints = null;
while ($row = mysql_fetch_assoc($result)) {
$rowcontent = '';
$mapid = $row['mapID'];
@@ -285,7 +290,7 @@ function displaystats($result, $caption = NULL) {
$x = "<tr class='lbrow' onmouseover='changeWallEmblem(\"$wallEmblem\"); changeWallColor(\"$wallColor\"); loadSol(\"$mapid:$solution\");'>\n";
$x .= "<td>$i</td>";
- $x .= "<td><span title='UserID: $userID'><a href='achievements?id=$userID' style='color:$displayColor'>$displayName</a></span></td>";
+ $x .= "<td class='leaderboardName'><span title='UserID: $userID'><a href='achievements?id=$userID' style='color:$displayColor'>$displayName</a></span></td>";
//$x .= "<td style='color:$displayColor';>" . $row['Name'] . '</td>';
$x .= '<td><a href="javascript:void(0)">' . $row['Moves'] . '</a></td>';
$x .= '<td>' . $row['Timetaken'] . '</td>';
@@ -293,6 +298,7 @@ function displaystats($result, $caption = NULL) {
if ($userID == $_SESSION['userID']) {
$promotedContent .= $x;
+ $championPoints = $row['championPointsWorth'];
} else {
$content .= $x;
}
@@ -300,7 +306,12 @@ function displaystats($result, $caption = NULL) {
$i++;
}
- $r = "<table style='border:1px solid #FFF'>";
+ $r = '';
+ if($championPoints != null && $championPoints > 0)
+ {
+ $r .= "<div class='myPoints'>Points earned: <span class='myPointsValue'>$championPoints</span> <img src='../images/championpoints.png' width='16px' height='16px'></img></div>";
+ }
+ $r .= "<table style='border:1px solid #FFF'>";
$r .= "<caption>$caption</caption>";
$r .= $headers;
$r .= $promotedContent;
diff --git a/pages/login.php b/pages/login.php
index 92b71fd..9358d89 100644
--- a/pages/login.php
+++ b/pages/login.php
@@ -48,7 +48,7 @@ try {
$claimedid = $openid->__get('identity');
//I know just where to put this stuff!
- require './includes/db.inc.php';
+ require './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/massemail.php b/pages/massemail.php
index a861500..d45588b 100644
--- a/pages/massemail.php
+++ b/pages/massemail.php
@@ -6,7 +6,7 @@ htmlHeader();
topbar($Links);
include('./includes/datas.php');
-include('./includes/db.inc.php');
+include('./includes/sqlEmbedded.php');
if (isset($_POST['massemail']) AND isset($_SESSION['accepted'])) {
@@ -22,7 +22,7 @@ if (isset($_POST['massemail']) AND isset($_SESSION['accepted'])) {
if (!is_int($userID))
return;
- include_once "includes/db.inc.php";
+ include_once "includes/sqlEmbedded.php";
$sql = "SELECT `email` FROM `users`
WHERE `ID` = '$userID'";
$result = mysql_query($sql);
diff --git a/pages/memberlist.php b/pages/memberlist.php
index 22d88b4..2fa2cdc 100644
--- a/pages/memberlist.php
+++ b/pages/memberlist.php
@@ -13,7 +13,7 @@ htmlHeader(
topbar($Links);
-include_once ('./includes/db.inc.php');
+include_once ('./includes/sqlEmbedded.php');
include_once ('./includes/datas.php');
@@ -115,8 +115,8 @@ $sql = "SELECT
WHERE solutions.userID = users.ID AND
solutions.dateModified BETWEEN DATE_SUB(CURRENT_DATE, INTERVAL 7 DAY) AND CURRENT_DATE) AS totalMovesThisWeek,
(SELECT COUNT(*) FROM solutions WHERE solutions.userID = users.ID AND solutions.dateModified < CURRENT_DATE) AS totalMazes,
- SUM(CASE WHEN statistics.type IN (32, 33, 34, 35) THEN statistics.value ELSE 0 END) as totalWins,
- SUM(CASE WHEN statistics.type IN (1, 2, 3, 4) THEN statistics.value ELSE 0 END) as totalTies,
+ users.totalWins,
+ users.totalTies,
IfNull(userData.wallColor, '#666666') as wallColor,
IfNull(userData.displayColor, '#cccccc'),
userData.wallEmblem,
@@ -124,7 +124,6 @@ $sql = "SELECT
users.dateLogin as dateLogin
FROM `users`
LEFT JOIN `userData` ON users.ID = userData.userID
-LEFT JOIN `statistics` ON users.ID = statistics.userID
GROUP BY users.ID
$order
";
diff --git a/pages/tutorial.php b/pages/tutorial.php
index 4d2446f..5208a57 100644
--- a/pages/tutorial.php
+++ b/pages/tutorial.php
@@ -13,7 +13,7 @@ topbar($Links);
//TODO: Turn this into a function?
if ($accepted) {
- include_once ('./includes/db.inc.php');
+ include_once ('./includes/sqlEmbedded.php');
$userID = $_SESSION['userID'];
$sql = "