diff --git a/www/knoteninfo.php b/www/knoteninfo.php index b11dc0d..c607e2f 100644 --- a/www/knoteninfo.php +++ b/www/knoteninfo.php @@ -1,14 +1,54 @@ documentation (wiki) +// /m/ -> map (hopglass) +// /s/ -> statistics (monitor) + +if (count($_GET)) { + $knoten = ($_GET["knoten"] ?? "%"); + $typ = ($_GET["typ"] ?? ""); +} + +$request_uri = $_SERVER['REQUEST_URI']; +$script_name = $_SERVER['SCRIPT_NAME']; + +if (strpos($request_uri, $script_name) === 0) { + $request_path = substr($request_uri, strlen($script_name)); +} else { + $request_path = $request_uri; +} + +$parsed_url = parse_url($request_path); +$path = $parsed_url['path']; +$path_elements = explode('/', trim($path, '/')); + +if (count($path_elements) == 2) { + switch ($path_elements[0]) { + case "d": + $typ = "wiki"; + break; + case "m": + $typ = "hopglass"; + break; + case "s": + $typ = "monitor"; + break; + } + ; + $knoten = $path_elements[1]; +} + -$knoten = ($_GET["knoten"] ?? "%"); $knoten = preg_replace("/\.olsr$/", "", $knoten); if(preg_match('/[^A-Za-z0-9\\.\\-\\_]/', $knoten)) die("Ungültiger Knotenname."); -$typ = ($_GET["typ"] ?? ""); function getUrl($url) { $ctx = stream_context_create(["http" => ["method" => "GET"]]); @@ -56,11 +96,11 @@ function getWikiLink($knoten) { echo "$knoten auf..."; echo "