Example #1
0
<?php

date_default_timezone_set('Asia/Manila');
require_once 'includes/constants.php';
require_once 'includes/MySessions.php';
//DBObject included
require_once 'includes/util.php';
require_once 'includes/common.php';
$session = new MySessions(COOKIE_NAME);
$cooking = $session->init();
$backgroundurl = getBackgroundImage(mt_rand(1, 5));
?>
<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<title>Language Development Center</title>
	<!--<link href="https://fonts.googleapis.com/css?family=Quicksand:400,700|Open+Sans:400,700,400italic,700italic" rel="stylesheet" type="text/css">-->
	<style type="text/css">
		#main-header {
			background: url(<?php 
echo $backgroundurl;
?>
) no-repeat;
			background-position: center top;
			background-attachment: fixed;
			background-size: cover;
		}
	</style>
	
	<link href="/css/jquery-ui.min.css" rel="stylesheet" type="text/css">
if (isset($_GET['x']) && isset($_GET['y'])) {
    $extension = 'png';
    $cache = Neuron_Core_Cache::__getInstance('minimap/');
    // Fetch cache
    $cachename = 'i' . intval($_GET['x']) . 'p' . intval($_GET['y']) . $tilesToLoad . $extension;
    $image = $cache->getCache($cachename, 60 * 60 * 6);
    //$image = false;
    if ($image && !$nocache) {
        header("Content-type: image/" . $extension);
        header("Expires: " . gmdate("D, d M Y H:i:s", time() + 60 * 60 * 12) . " GMT");
        echo $image;
    } else {
        //$cache->setCache ($cachename, 'locked');
        $x = $_GET['x'];
        $y = $_GET['y'];
        $im = getBackgroundImage($x, $y, $tilesToLoad);
        $color_cache = array();
        // Build the new background image.
        $tileSizeX = 8;
        $tileSizeY = $tileSizeX / 2;
        $halfTileX = floor($tileSizeX / 2);
        $halfTileY = floor($tileSizeY / 2);
        $switchpoint = $tilesToLoad;
        $loadExtra = 1;
        $startX = ($x + $y) * $switchpoint;
        $startY = ($x - $y) * $switchpoint;
        $db = Neuron_Core_Database::__getInstance();
        $locations = array(array($startX + $switchpoint / 2, $startY - $switchpoint / 2));
        // Load buildings from SQL
        $buildingSQL = Dolumar_Map_Map::getBuildingsFromLocations($locations, $switchpoint + 25);
        foreach ($buildingSQL as $buildingV) {