changeset 1023:bef88b4e99d7

Merged.
author Matti Hamalainen <ccr@tnsp.org>
date Fri, 06 Nov 2015 21:34:58 +0200
parents 74b98743697b (current diff) f2b392ee89e8 (diff)
children 2a96426159f1
files
diffstat 2 files changed, 29 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/util/router.php	Fri Nov 06 21:34:58 2015 +0200
@@ -0,0 +1,27 @@
+<?php
+//
+// The hack to get this working on PHP 5.4 built-in web server,
+// simply run the following:
+//
+// $ php -S localhost:8888 router.php
+//
+// Then head your browser to http://localhost:8888/
+//
+
+if (!file_exists("index.php"))
+  return true;
+
+$_SERVER["HTTPS"] = "on";
+
+if (preg_match("/\/[a-z0-9_-]+\.(?:png|jpg|jpeg|gif|css|php|js|txt|ogg|mp3|ttf)/i", $_SERVER["REQUEST_URI"]))
+  return false; // Serve the requested resource as-is.
+else
+if (preg_match("/^\/([a-z]+)/", $_SERVER["REQUEST_URI"], $m))
+{
+  $_GET["page"] = $m[1];
+  require_once "index.php";
+  return true;
+}
+else
+  return false;
+?>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/util/server.sh	Fri Nov 06 21:34:58 2015 +0200
@@ -0,0 +1,2 @@
+#!/bin/sh
+php -S "localhost:8888" router.php