aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaZderMind2016-06-20 22:41:47 +0200
committerMaZderMind2016-06-20 22:41:47 +0200
commit9b8e234c6c9ae545df3788c0603a5dd97ffc62b4 (patch)
tree448c21748ff9a9db0a2e71b04f1e1355c5447b09
parent37554e5112397ee0f3565e3bcece2f4149ccd3df (diff)
support php internal webserver
Diffstat (limited to '')
-rw-r--r--.htaccess2
-rw-r--r--README.md15
-rw-r--r--index.php18
-rwxr-xr-xserve.sh2
4 files changed, 35 insertions, 2 deletions
diff --git a/.htaccess b/.htaccess
index 431bbb1..85a4c06 100644
--- a/.htaccess
+++ b/.htaccess
@@ -5,4 +5,4 @@ RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
-RewriteRule (.*) index.php?route=$1 [L]
+RewriteRule (.*) index.php?route=$1&htaccess=1 [L]
diff --git a/README.md b/README.md
index 97b16aa..3b29819 100644
--- a/README.md
+++ b/README.md
@@ -9,6 +9,21 @@ zu haben, die mit wenigen Konfigurationsoptionen und ein paar CSS-Rules an die
Gegebenheiten und die Gestaltung der Konferenz angepasst werden können.
+## Development
+
+Während der Entwicklung kann der eingebaute PHP-Webserver verwendet werden:
+```
+$ ./serve.sh
+PHP 7.0.4-7ubuntu2.1 Development Server started at Mon Jun 20 22:40:17 2016
+Listening on http://localhost:8000
+Document root is /home/peter/VOC/streaming-website
+Press Ctrl-C to quit.
+…
+```
+
+Unterstützt wird PHP ab 5.4.
+
+
## Setup
diff --git a/index.php b/index.php
index eeaca82..2d6a575 100644
--- a/index.php
+++ b/index.php
@@ -28,7 +28,23 @@ require_once('model/Upcoming.php');
ob_start();
try {
- $route = @$_GET['route'];
+ if(isset($_GET['htaccess']))
+ {
+ $route = @$_GET['route'];
+ }
+ elseif(isset($_SERVER["REQUEST_URI"]))
+ {
+ $route = ltrim(@$_SERVER["REQUEST_URI"], '/');
+
+ // serve static
+ if($route != '' && file_exists($_SERVER["DOCUMENT_ROOT"].'/'.$route))
+ {
+ return false;
+ }
+
+ }
+ else $route = '';
+
$route = rtrim($route, '/');
// generic template
diff --git a/serve.sh b/serve.sh
new file mode 100755
index 0000000..88881f4
--- /dev/null
+++ b/serve.sh
@@ -0,0 +1,2 @@
+#!/bin/sh
+php -S localhost:8000 -d short_open_tag=true index.php