<?php require_once dirname(__FILE__) . "/../include/master.inc.php"; require_once dirname(__FILE__) . "/../include/classes/statistics.class.php"; $mapId = (int) $_GET['mapid']; $stats = new Statistics(); $map = getMapById($mapId); $cacheDirectory = dirname(__FILE__) . "/../cache"; $cacheFile = $cacheDirectory . "/" . md5($mapId) . ".cache"; if (file_exists($cacheFile)) { // Show file from cache $stats->addMapView($_SERVER['REMOTE_ADDR'], $mapId, $map['name'], $map['users_id']); echo file_get_contents($cacheFile); exit; } $user = getUserInfo(); if ($map) { if ($map['password'] == "" || $_POST['password'] == $map['password'] || $user && $user['id'] == $map['users_id']) { $shapes = getShapesByMapId($mapId); $content = processMapFile($map, $shapes, dirname(__FILE__) . "/map/view.tpl"); if ($map['password'] == "") { file_put_contents($cacheFile, $content); } $stats->addMapView($_SERVER['REMOTE_ADDR'], $mapId, $map['name'], $map['users_id']); echo $content; exit; } } else { die("Map Not Found!"); } ?>
function getPureJSON($mapId) { $map = getMapById((int) $mapId); $shapes = getShapesByMapId($mapId); $geoJSON = array("type" => "FeatureCollection", "features" => array()); if (is_array($shapes) && count($shapes) > 0) { $i = 0; foreach ($shapes as $shape) { $propertiesList = array(); $properties = json_decode($shape['properties']); foreach ($properties as $property) { $propertiesList[$property->name] = $property->value; } $geoJSON['features'][$i] = array("type" => "Feature", "properties" => $propertiesList, "geometry" => array("type" => $shape['type'], "coordinates" => json_decode($shape['coordinates']))); $i++; } } return json_encode($geoJSON); }
<?php require_once dirname(__FILE__) . "/../include/master.inc.php"; if (!isLogin()) { redirect("login.php"); } $user = getUserInfo(); if (isset($_GET['action']) && $_GET['action'] == 'delete') { deleteMarker((int) $_GET['marker_id'], (int) $_GET['id'], $user['id']); redirect("map-edit.php?id=" . (int) $_GET['id']); } $map = getMapById((int) $_GET['id'], (int) $user['id']); if (!$map) { redirect("map.php"); } $shapes = getShapesByMapId((int) $map['id']); $create_update = "Update"; if ($_GET['action'] == 'create') { $PAGE = "MAP_CREATE"; $create_update = "Create"; } else { $PAGE = "MAP_VIEW"; } $layers = getLayersByUserId($user['id']); $groups = getGroupsByUserId($user['id']); if (isAdmin($user)) { $projects = getProjectsByUserId($user['id']); } else { $projects = getMyProjects($user['id']); } ?>
<?php require_once dirname(__FILE__) . "/../include/master.inc.php"; if (!isLogin()) { redirect("login.php"); } $user = $_SESSION['user']; $map = getMapById($_GET['id'], $user['id']); if (!$map) { redirect("csv.php"); } $csv = new CSV(); $rows = $csv->createCSVFromMapId($map['id']); $shapeIds = $csv->getShapeIds(); $defaultProperty = $csv->getDefaultProperty(); $error = ""; if (strlen($_SESSION['response']['csv-edit']['error']) > 0) { $error = '<div ng-show="authMsg" class="alert alert-danger text-center ng-binding">' . $_SESSION['response']['csv-edit']['error'] . '</div>'; } unset($_SESSION['response']['csv-edit']['error']); $PAGE = "CSV_VIEW"; ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>Edit Table Map</title> <?php require_once dirname(__FILE__) . "/../include/header.tpl.php";