This program comes with ABSOLUTELY NO WARRANTY. This is free software, and you are welcome to redistribute it under certain conditions. See http://wiki.openstreetmap.org/wiki/OpenLinkMap for details. */ require_once "functions.php"; // include translation file includeLocale($_GET['lang']); $format = $_GET['format']; $id = $_GET['id']; $type = $_GET['type']; // offset of user's timezone to UTC $offset = offset($_GET['offset']); $callback = $_GET['callback']; date_default_timezone_set('UTC'); // protection of sql injections if (!isValidType($type) || !isValidId($id)) { echo "NULL"; exit; } // get the most important langs of the user $langs = getLangs(); if ($_GET['lang']) { $langs[0] = $_GET['lang']; } if (!getDetails($db, $id, $type, $langs, $offset)) { echo "NULL"; } function getDetails($db, $id, $type, $langs, $offset) { global $format, $callback; // request
function urlArgsToParam($checkMobile, $urlbase) { echo "<script type=\"text/javascript\">\n"; echo "var params={\n"; echo "urlbase : '" . $urlbase . "',\n"; echo "id : " . (isValidId('id') ? $_GET['id'] : "null") . ",\n"; echo "type : " . (isValidType('type') ? "'" . $_GET['type'] . "'" : "null") . ",\n"; echo "lat : "; if (isValidCoordinate('lat')) { echo $_GET['lat'] . ",\n"; } else { $latlon = getLatLon('id', isset($type) ? $type : ""); if ($latlon) { echo $latlon[1] . ",\n"; } else { echo "null,\n"; } } echo "lon : "; if (isValidCoordinate('lon')) { echo $_GET['lon'] . ",\n"; } else { $latlon = getLatLon('id', isset($type) ? $type : ""); if ($latlon) { echo $latlon[0] . ",\n"; } else { echo "null,\n"; } } echo "zoom : " . (isValidZoom('zoom') ? $_GET['zoom'] : "null") . ",\n"; echo "offset : " . (isValidOffset('offset') ? $_GET['offset'] : "null") . ",\n"; echo "searchquery : " . (isset($_GET['q']) ? json_encode($_GET['q']) : "''") . ",\n"; echo "lang : '" . $lang . "',\n"; echo "ref : " . (isset($_GET['ref']) ? json_encode($_GET['ref']) : "null") . ",\n"; echo "name : " . (isset($_GET['name']) ? json_encode($_GET['name']) : "null") . ",\n"; echo "line : " . (isset($_GET['line']) ? json_encode($_GET['line']) : "null") . ",\n"; echo "operator : " . (isset($_GET['operator']) ? json_encode($_GET['operator']) : "null") . ",\n"; if ($checkMobile) { echo "mobile : " . (isset($_GET['mobile']) ? $_GET['mobile'] != '0' && $_GET['mobile'] != 'false' ? "true" : "false" : "null") . ",\n"; } echo "style : " . (isset($_GET['style']) ? json_encode($_GET['style']) : "null") . "\n"; echo "};\n"; echo "</script>\n"; }
function getBlogContent($path) { $action = array_shift($path); if ($action == null) { $action = '1'; } switch ($action) { case "post": global $title; $postId = array_shift($path); if (isValidId($postId, "posts")) { $title = fetchPostTitle($postId) . " (Post)" . $title; return getPost($postId); } else { return get404(); } break; case "tags": global $currentTag; global $title; $currentTag = array_shift($path); if (isValidId($currentTag, "tags")) { $title = fetchTagName($currentTag) . " (Tag)" . $title; return getTag($currentTag); } else { return get404(); } break; default: global $title; $validNumber = preg_match("/^[0-9]+\$/", $action, $matches); if (!$validNumber) { return get404(); } if (getPageCount("posts") < $action) { return get404(); } $title = "Blog" . $title; if ($action == 1) { $content = '<h1>Blog</h1><p>A small collection of thoughts and progress notes I thought the would would possibly what to know about. I try to keep my updates sparse but informative but I can\'t hold that promise.</p>'; } else { $content = getPageLinks("You are viewing blog posts from a past time.<br>", $action, "/blog/", "posts"); } return $content . getRecentPosts($action - 1) . getPageLinks("Page Selection<br>", $action, "/blog/", "posts"); break; } }
<link rel="shortcut icon" href="img/favicon.ico" type="image/vnd.microsoft.icon" /> <link rel="icon" href="img/favicon.ico" type="image/vnd.microsoft.icon" /> <meta http-equiv="content-script-type" content="text/javascript" /> <meta http-equiv="content-style-type" content="text/css" /> <link rel="stylesheet" type="text/css" href="css/map.css" /> <link rel="stylesheet" href="css/leaflet.css" /> <!--[if lte IE 8]> <link rel="stylesheet" href="css/leaflet.ie.css" /> <![endif]--> <script type="text/javascript" src="js/leaflet-0.6.2.js"></script> <script type="text/javascript" src="js/L.TileLayer.Grayscale.js"></script> <?php // params echo "<script type=\"text/javascript\">\n"; echo "var params={\n"; echo "id : " . (isValidId($_GET['id']) ? $_GET['id'] : "null") . ",\n"; echo "type : " . (isValidType($_GET['type']) ? "'" . $_GET['type'] . "'" : "null") . ",\n"; echo "lat : "; if (isValidCoordinate($_GET['lat'])) { echo $_GET['lat'] . ",\n"; } else { $latlon = getLatLon($_GET['id'], $type); if ($latlon) { echo $latlon[1] . ",\n"; } else { echo "null,\n"; } } echo "lon : "; if (isValidCoordinate($_GET['lon'])) { echo $_GET['lon'] . ",\n";
function getLatLon($id, $type) { global $db; if (isValidId($id) && isValidType($type)) { $connection = connectToDatabase($db); if (!$connection) { exit; } $query = "SELECT\n\t\t\t\t\t\tid, ST_X(geom), ST_Y(geom)\n\t\t\t\t\t\tFROM " . $_GET[$type] . "s\n\t\t\t\t\t\tWHERE (id = " . $_GET[$id] . ");"; $response = requestDetails($query, $connection); pg_close($connection); if (!$response) { $connection = connectToDatabase($ptdb); if (!$connection) { exit; } $response = requestDetails($query, $connection); pg_close($connection); if (!$response) { return false; } } foreach ($response as $element) { return array($element['st_x'], $element['st_y']); } } return false; }