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 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; }
<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"; } else {
function addRecordX($zone, $rtype) { global $primary_ns; $errText = ""; $rtype = strtoupper($rtype); if (isValidType($rtype)) { switch ($rtype) { case "A": $sql_string = "INSERT INTO dns_records (zone,type) VALUES (" . ToDBString($zone) . ",UCASE(" . ToDBString($rtype) . "));"; if (zoneExists($zone)) { $sql = @mysql_query($sql_string); $err = mysql_errno(); } else { $errText .= "Zone does not exist. (zone: " . $zone . ")\r\n"; } break; case "SOA": $sql_string = "INSERT INTO dns_records (zone,host,type,data,ttl,refresh,retry,expire,minimum,serial,resp_person) VALUES (" . ToDBString($zone) . ",'@',UCASE(" . ToDBString($rtype) . "),'" . $primary_ns . "',86400,7200,3600,604800,3600," . date("U") . ",'hostmaster');"; if (!zoneExists($zone)) { $sql = @mysql_query($sql_string); $err = mysql_errno(); global $cfg_newzone_defaults; foreach ($cfg_newzone_defaults as $dflt) { switch (strtoupper($dflt["type"])) { case "A": $sql = "INSERT INTO dns_records (zone,host,type,data) \n\t\t VALUES (" . ToDBString($zone) . ", " . ToDBString($dflt["name"]) . ", 'A', \n\t\t\t " . ToDBString($dflt["ip"]) . ")"; mysql_query($sql); break; case "NS": $sql = "INSERT INTO dns_records (zone,host,type,data) \n\t\t VALUES (" . ToDBString($zone) . ", '@', 'NS', " . ToDBString($dflt["nameserver"]) . ")"; mysql_query($sql); break; case "MX": if (empty($dflt["priority"])) { $dflt["priority"] = 10; } $sql = "INSERT INTO dns_records (zone,host,type,data,mx_priority) \n\t\t VALUES (" . ToDBString($zone) . ", '@', 'MX', \n\t\t\t " . ToDBString($dflt["name"]) . ", " . ToDBString($dflt["priority"]) . ")"; mysql_query($sql); break; case "CNAME": $sql = "INSERT INTO dns_records (zone,host,type,data) \n\t\t VALUES (" . ToDBString($zone) . ", " . ToDBString($dflt["name"]) . ", 'CNAME', \n\t\t\t " . ToDBString($dflt["target"]) . ")"; mysql_query($sql); break; case "TXT": $sql = "INSERT INTO dns_records (zone,host,type,data) \n\t\t VALUES (" . ToDBString($zone) . ", " . ToDBString($dflt["name"]) . ", 'TXT', \n\t\t\t " . ToDBString($dflt["text"]) . ")"; mysql_query($sql); break; } } } else { $errText .= "Zone already exists. (zone: " . $zone . ")\r\n"; } break; break; default: $sql_string = "INSERT INTO dns_records (zone,host,type) VALUES (" . ToDBString($zone) . ",'@',UCASE(" . ToDBString($rtype) . "));"; if (zoneExists($zone)) { $sql = @mysql_query($sql_string); $err = mysql_errno(); } else { $errText .= "Zone does not exist. (zone: " . $zone . ")\r\n"; } break; } } else { $errText .= "Invalid record type specified. (type: " . $rtype . ")\r\n"; } // create string to return to the page if ($err != 0) { $errText .= "MySQL Error: " . mysql_error() . "\r\n"; } $typehtml = ""; switch ($rtype) { case "NS": $typehtml = getNSRecords($zone); break; case "MX": $typehtml = getMXRecords($zone); break; case "A": $typehtml = getARecords($zone); break; case "SOA": $typehtml = getSOARecord($zone); break; case 'CNAME': $typehtml = getCNAMERecords($zone); break; case 'TXT': $typehtml = getTXTRecords($zone); break; } $newtext = $rtype . '~~|~~' . $typehtml . '~~|~~' . $errText; return $newtext; }