summaryrefslogtreecommitdiffstats
path: root/ajax
diff options
context:
space:
mode:
Diffstat (limited to 'ajax')
-rw-r--r--ajax/maps.ajax.php17
1 files changed, 8 insertions, 9 deletions
diff --git a/ajax/maps.ajax.php b/ajax/maps.ajax.php
index 31c041c..bd060fe 100644
--- a/ajax/maps.ajax.php
+++ b/ajax/maps.ajax.php
@@ -9,11 +9,11 @@ $tmp = explode(".", $_GET['mapid']);
$mapID = $tmp[0] * 1;
if (!is_int($mapID)) exit;
-//$map = new map(getMapCode($mapID), $mapID);
$map = getMapObjectByID($mapID);
-//62 days
-$expires = 62*24*60*60;
+$expires = 365*24*60*60;
+//TODO: Remove this line once we're confident in data in the mapObject.
+$expires = 1*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");
@@ -22,21 +22,20 @@ echo json_encode($map);
function getMapObjectByID($mapID) {
include_once('../includes/sqlEmbedded.php');
include_once('../includes/maps.php');
- $sql = "SELECT `code`, `name`
+ $sql = "SELECT `code`, `name`, `mapExpireTime`
FROM `maps`
- WHERE `ID` = '$mapID'
+ INNER JOIN `mapOfTheDay` ON mapID = maps.ID
+ WHERE maps.ID = '$mapID'
";
$result = mysql_query($sql);
if (mysql_num_rows($result) > 0) {
- list($code, $name) = mysql_fetch_row($result);
+ list($code, $name, $mapExpireTime) = mysql_fetch_row($result);
$map = new map($code, $mapID);
$map->name = $name;
- //$map->name = "bobs";
+ $map->dateExpires = $mapExpireTime;
return $map;
}
}
-
-
?> \ No newline at end of file