summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ajax/chat.ajax.php4
-rw-r--r--ajax/maps.ajax.php2
-rw-r--r--ajax/scores.ajax.php7
-rw-r--r--do.php2
-rw-r--r--includes/datas.php10
-rw-r--r--includes/header.php16
-rw-r--r--js/mapspecs.js18
-rw-r--r--pages/chat.php2
-rw-r--r--pages/home.php2
-rw-r--r--pages/memberlist.php5
10 files changed, 41 insertions, 27 deletions
diff --git a/ajax/chat.ajax.php b/ajax/chat.ajax.php
index 97db510..59f7ae3 100644
--- a/ajax/chat.ajax.php
+++ b/ajax/chat.ajax.php
@@ -9,7 +9,7 @@ if (strtotime('now') - $_SESSION['chatLastReset'] > 6) {
$_SESSION['chatSendCount'] = 0;
$_SESSION['chatLastReset'] = strtotime('now');
}
-if ($_REQUEST['messages']) {
+if (isset($_REQUEST['messages'])) {
$_SESSION['chatSendCount']++;
if ($_SESSION['chatSendCount'] > 4) {
$r[0]['error'] = 'Spam';
@@ -40,7 +40,7 @@ require('../includes/chats.php');
$sent = false;
-if ($_REQUEST['messages']) {
+if (isset($_REQUEST['messages'])) {
$date = isMuted($userID);
if ($date !== false) {
$r[0]['error'] = 'Muted';
diff --git a/ajax/maps.ajax.php b/ajax/maps.ajax.php
index 4919fb9..210fd1b 100644
--- a/ajax/maps.ajax.php
+++ b/ajax/maps.ajax.php
@@ -31,7 +31,7 @@ if (isset($_GET['mapid'])) {
function sendCacheHeaders() {
$expires = 365*24*60*60;
//TODO: Remove this line once we're confident in data in the mapObject.
- $expires = 120;
+ $expires = 31*24*60*60;
header("Cache-Control: public, maxage=".$expires);
header('Expires: ' . gmdate('D, d M Y H:i:s', time()+$expires) . ' GMT');
header("Content-type: text/javascript");
diff --git a/ajax/scores.ajax.php b/ajax/scores.ajax.php
index 897da3b..70d78ff 100644
--- a/ajax/scores.ajax.php
+++ b/ajax/scores.ajax.php
@@ -22,11 +22,14 @@ $json['page'] = $page;
//TODO: Show notifications someplace else!
$note = false;
-if ($_SESSION['accepted'] == 1) {
+if (isset($_SESSION['accepted']) AND $_SESSION['accepted'] == 1) {
$userID = $_SESSION['userID'];
$note = getNotified($userID);
} else {
- if ($_SESSION['preCompletedTutorial'] == true && $_SESSION['preCompletedTutorialNotified'] == false) {
+ if (
+ isset($_SESSION['preCompletedTutorial']) &&
+ $_SESSION['preCompletedTutorial'] == true &&
+ $_SESSION['preCompletedTutorialNotified'] == false) {
$_SESSION['preCompletedTutorialNotified'] = true;
$note = "<strong>Tutorial Completed!</strong>";
$note .= "<center>You've unlocked: Blue Wall Color!";
diff --git a/do.php b/do.php
index 43da407..ad48408 100644
--- a/do.php
+++ b/do.php
@@ -126,7 +126,7 @@ if ($_GET['r'] == 'getpath') {
$userID = $_SESSION['userID'] + 0;
//valid mapID?
- $mapID = $_GET[mapid] + 0;
+ $mapID = $_GET['mapid'] + 0;
if (!is_int($mapID)) return;
//$firephp->log($mapID, "mapID");
diff --git a/includes/datas.php b/includes/datas.php
index 2e48b14..b8ffef7 100644
--- a/includes/datas.php
+++ b/includes/datas.php
@@ -512,8 +512,7 @@ function applyAchievements($userID, $aType) {
if (!isset($aArray[$aNextLevel]))
return false;
list($required, $unlockType, $unlockValue, $unlockName, $unlockSubtype) = $aArray[$aNextLevel];
- if ($amount < $required)
- return false;
+ if ($amount < $required) return false;
$sql = "INSERT INTO `achievements`
(`userID`, `type`, `level`)
@@ -788,12 +787,13 @@ function getMembers($pageNumber = 1, $pageDivide = 50, $order = 'DESC', $orderBy
$output['updateTime'] = date("g:i A (T)");
$i = $limitTop;
+ $userPosition = -1;
$foundUser = false;
while ($row = mysql_fetch_assoc($result)) {
$i++;
$userID = $row['ID'];
- if ($_SESSION['userID'] == $userID) {
+ if (isset($_SESSION['userID']) AND $_SESSION['userID'] == $userID) {
$userPosition = $i;
}
@@ -889,6 +889,7 @@ function getScores($mapID, $pageNumber = 1, $pageDivide = 10) {
$output['updateTime'] = time();
$i = 0;
+ $userPosition = -1;
$foundUser = false;
while ($row = mysql_fetch_assoc($result)) {
@@ -1056,9 +1057,8 @@ function loadChallengeMapCode($mapIdUnsanitized)
return NULL;
}
-
function isCurrentMap($mapID) {
- include_once('./includes/sqlEmbedded.php');
+ include_once('sqlEmbedded.php');
$sql = "SELECT mapID
FROM `mapOfTheDay`
WHERE `mapID` = '$mapID'
diff --git a/includes/header.php b/includes/header.php
index da5e11d..35fd323 100644
--- a/includes/header.php
+++ b/includes/header.php
@@ -1,6 +1,7 @@
<?php
function htmlHeader($css = array(), $title = 'Pathery', $desc = '', $scripts = array()) {
global $accepted;
+ $resourceVer = '050513.js';
?>
<!DOCTYPE html>
<html xml:lang="en" lang="en">
@@ -9,7 +10,14 @@ function htmlHeader($css = array(), $title = 'Pathery', $desc = '', $scripts = a
<title><? echo $title; ?></title>
<link href="css/page.css?v=011013" rel="stylesheet" type="text/css" />
- <link href="css/maps.css?v=122612" rel="stylesheet" type="text/css" />
+<?
+ if (isset($_GET['skin']) AND $_GET['skin'] == 'true') {
+ echo '<link href="skin/cute/css/maps.css" rel="stylesheet" type="text/css" />';
+ } else {
+ echo "<link href='css/maps.css?v=$resourceVer' rel='stylesheet' type='text/css' />";
+ }
+ // <link href="css/maps.css?v=122612" rel="stylesheet" type="text/css" />
+?>
<link rel="image_src" type="image/png" href="/images/linkdsp.png" />
<?php
foreach ($css as $c) {
@@ -17,7 +25,7 @@ function htmlHeader($css = array(), $title = 'Pathery', $desc = '', $scripts = a
}
if ($desc !== '') echo " <meta name='Description' content='$desc'>";
- foreach ($scripts as $s) echo "<script src='js/$s.js?v=122612'></script>";
+ foreach ($scripts as $s) echo "<script src='js/$s.js?v=$resourceVer'></script>";
?>
<script src="js/ajax.js" async="async"></script>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
@@ -136,12 +144,14 @@ function htmlFooter() {
s.parentNode.appendChild(ga, s);
<?
+ if (isset($_SESSION['displayName'])) {
echo "mixpanel.people.set({
\$email: " . json_encode($_SESSION['email']) . ",
\$username: " . json_encode($_SESSION['displayName']) . ",
\$last_login: '" . date(DateTime::ISO8601) . "',
\$created: '" . $_SESSION['dateJoined'] . "'
});";
+ }
?>
})();
@@ -215,7 +225,7 @@ function userDataToJS() {
$userID = $_SESSION['userID'];
include_once('includes/datas.php');
$hasInsaneSpeed = hasExtrasUnlock($userID, UNLOCK_EXTRAS, MISC_UNLOCK_INSANE_SPEED);
- $r .= 'hasInsaneSpeed":'.$hasInsaneSpeed.'};'."\n";
+ $r = 'hasInsaneSpeed":'.$hasInsaneSpeed.'};'."\n";
$json = array('ID' => 'fat');
$json['ID'] = $userID;
$json['wallColor'] = $wallColor;
diff --git a/js/mapspecs.js b/js/mapspecs.js
index f55eb14..1a0693f 100644
--- a/js/mapspecs.js
+++ b/js/mapspecs.js
@@ -876,15 +876,19 @@ function mapAsHTML(map, targetWidth, mapEditor) {
var scale = map.width / targetWidth;
//alert(scale);
- var width = parseInt(map.width / scale);
- var height = parseInt(map.height / scale);
- var tileWidth = parseInt(width / map.width);
+ //var width = parseInt(map.width / scale);
+ //var height = parseInt(map.height / scale);
- width = tileWidth * map.width;
+ var tileWidth = parseInt((map.width / scale) / map.width);
+ var tileHeight = tileWidth;
+
+ var width = tileWidth * map.width;
+ var height = tileHeight * map.height;
var mapgrid = '';
mapgrid += '<div style="clear:both;"></div><div class="map playable" style="width:'+width+'px; height:'+height+'px">';
+
for (var y in map.tiles) {
for (var x in map.tiles[y]) {
var type = map.tiles[y][x][0];
@@ -901,13 +905,13 @@ function mapAsHTML(map, targetWidth, mapEditor) {
//oldy is used for Position too... for now
if (mapEditor == true) {
- mapgrid += "<div style='float:left; width:"+tileWidth+"px; height:"+tileWidth+"px; ' class='mapcell "+type+value+"' title='Position: "+x+","+oldy+"' id='"+idHandle+"' onMouseOver='mapEditOver(this)' onMouseDown='mapEditClick(this)' >";
+ mapgrid += "<div style='float:left; width:"+tileWidth+"px; height:"+tileHeight+"px; ' class='mapcell "+type+value+"' title='Position: "+x+","+oldy+"' id='"+idHandle+"' onMouseOver='mapEditOver(this)' onMouseDown='mapEditClick(this)' >";
mapgrid += "<div id='child_"+idHandle+"' class='child'></div></div>";
} else if (type == 'o') {
- mapgrid += "<div style='float:left; width:"+tileWidth+"px; height:"+tileWidth+"px; ' class='mapcell "+type+value+"' title='Position: "+x+","+oldy+"' id='"+idHandle+"' onClick='grid_click(this)' >";
+ mapgrid += "<div style='float:left; width:"+tileWidth+"px; height:"+tileHeight+"px; ' class='mapcell "+type+value+"' title='Position: "+x+","+oldy+"' id='"+idHandle+"' onClick='grid_click(this)' >";
mapgrid += "<div id='child_"+idHandle+"' class='child'></div></div>";
} else {
- mapgrid += "<div style='float:left; width:"+tileWidth+"px; height:"+tileWidth+"px; ' class='mapcell "+type+value+"' title='"+Tile[type]+" "+value+" On: "+x+","+oldy+"' id='"+idHandle+"' >";
+ mapgrid += "<div style='float:left; width:"+tileWidth+"px; height:"+tileHeight+"px; ' class='mapcell "+type+value+"' title='"+Tile[type]+" "+value+" On: "+x+","+oldy+"' id='"+idHandle+"' >";
mapgrid += "<div id='child_"+idHandle+"' class='child'></div></div>";
}
}
diff --git a/pages/chat.php b/pages/chat.php
index d479f7b..8b8217d 100644
--- a/pages/chat.php
+++ b/pages/chat.php
@@ -70,6 +70,8 @@ function getChatDone(data) {
var timestamp = postDate.format("hh:MM:ss");
var timestampDetails = postDate.format("ddd h:MM TT");
+ if (!chat.message) return;
+
var strClass = '';
if (chat.userID == userObj.ID) {
strClass += ' self';
diff --git a/pages/home.php b/pages/home.php
index 696c0cc..9c4cf3d 100644
--- a/pages/home.php
+++ b/pages/home.php
@@ -90,7 +90,7 @@ function adToggle() {
<?php
topbar($Links);
-$showAd = ($_COOKIE['pref_showAd'] == "yes");
+$showAd = (isset($_COOKIE['pref_showAd']) AND $_COOKIE['pref_showAd'] == "yes");
$adClass = 'adHidden';
$adShow = 'Hide';
if ($showAd) {
diff --git a/pages/memberlist.php b/pages/memberlist.php
index b68c60b..da2264d 100644
--- a/pages/memberlist.php
+++ b/pages/memberlist.php
@@ -15,11 +15,6 @@ topbar($Links);
javascript:membersShowPage(1);
</script>
-<?
-
-$json = json_encode($data);
-
-?>
<div class='wrapper'>
<h2>Members</h2>
<!-- To be added later or never