diff options
author | MaZderMind | 2015-11-06 16:45:55 +0100 |
---|---|---|
committer | MaZderMind | 2015-11-06 16:45:55 +0100 |
commit | 4c52028f555c361c232cbee166fa62522c66af5b (patch) | |
tree | c72490cd50670e925619344bd9e4ad0c6aa541db | |
parent | e84ce4fea6b18ac72243e87e159d37e6cdffae04 (diff) |
experimental multi-client capability
Diffstat (limited to '')
-rw-r--r-- | configs/clients/31c3.php (renamed from config.php) | 0 | ||||
-rw-r--r-- | index.php | 56 | ||||
-rw-r--r-- | lib/helper.php | 4 |
3 files changed, 53 insertions, 7 deletions
diff --git a/config.php b/configs/clients/31c3.php index 391ca4d..391ca4d 100644 --- a/config.php +++ b/configs/clients/31c3.php @@ -4,7 +4,56 @@ if(!ini_get('short_open_tag')) die('`short_open_tag = On` is required'); require_once('lib/helper.php'); -require_once('config.php'); + +$route = @$_GET['route']; +$route = rtrim($route, '/'); + +if($route == '') +{ + // list of clients + $clients = array_values(array_filter(array_map(function($file) + { + $info = pathinfo($file); + + if($info['extension'] == 'php') + return $info['filename']; + + }, scandir('configs/clients/')))); + + + if(count($clients) == 0) + { + // no clients + // error + + die('no clients'); + } + else if(count($clients) == 1) + { + // one client + // redirect + + header('Location: '.baseurl().$clients[0].'/'); + exit; + } + else + { + // multiple clients + // show overview + + // TODO Template + print_r($clients); + exit; + } +} +else +{ + list($client, $route) = explode('/', $route, 2); + + $GLOBALS['CLIENT'] = $client; + require_once('configs/clients/'.$client.'.php'); +} + require_once('lib/PhpTemplate.php'); require_once('lib/Exceptions.php'); @@ -22,9 +71,6 @@ require_once('model/Stream.php'); require_once('model/Relive.php'); require_once('model/Upcoming.php'); -$route = @$_GET['route']; -$route = rtrim($route, '/'); - $conference = new Conference(); $tpl = new PhpTemplate('template/page.phtml'); @@ -71,7 +117,7 @@ try { $dir = forceslash(sys_get_temp_dir()); $css_file = Less_Cache::Get([ - 'assets/css/main.less' => '../assets/css/', + 'assets/css/main.less' => '../../assets/css/', ], [ 'sourceMap' => true, 'compress' => true, diff --git a/lib/helper.php b/lib/helper.php index c6fd9a9..eb9fc6d 100644 --- a/lib/helper.php +++ b/lib/helper.php @@ -18,14 +18,14 @@ function baseurl() if(startswith('//', $base)) $base = proto().':'.$base; - return $base; + return forceslash($base.'/'.$GLOBALS['CLIENT']); } $base = ssl() ? 'https://' : 'http://'; $base .= $_SERVER['HTTP_HOST']; $base .= forceslash(dirname($_SERVER['SCRIPT_NAME'])); - return $base; + return forceslash($base.$GLOBALS['CLIENT']); } function forceslash($url) |