aboutsummaryrefslogtreecommitdiff
path: root/index.php
diff options
context:
space:
mode:
authorMaZderMind2015-11-08 14:40:30 +0100
committerMaZderMind2015-11-08 14:40:30 +0100
commitefe1f83a7cc419df700dfe36ef11da20607d8eae (patch)
tree409bea306e44a8decbb8b5fee127b863e0c5e99f /index.php
parent4c52028f555c361c232cbee166fa62522c66af5b (diff)
implement mandator handling, supporting different styles per mandantor
Diffstat (limited to '')
-rw-r--r--index.php106
1 files changed, 53 insertions, 53 deletions
diff --git a/index.php b/index.php
index 0a527d4..f12d914 100644
--- a/index.php
+++ b/index.php
@@ -5,35 +5,47 @@ if(!ini_get('short_open_tag'))
require_once('lib/helper.php');
-$route = @$_GET['route'];
-$route = rtrim($route, '/');
+require_once('lib/PhpTemplate.php');
+require_once('lib/Exceptions.php');
+require_once('lib/less.php/Less.php');
-if($route == '')
-{
- // list of clients
- $clients = array_values(array_filter(array_map(function($file)
- {
- $info = pathinfo($file);
+require_once('model/ModelBase.php');
+require_once('model/Conferences.php');
+require_once('model/Conference.php');
+require_once('model/Feedback.php');
+require_once('model/Schedule.php');
+require_once('model/Overview.php');
+require_once('model/Room.php');
+require_once('model/RoomTab.php');
+require_once('model/RoomSelection.php');
+require_once('model/Stream.php');
+require_once('model/Relive.php');
+require_once('model/Upcoming.php');
- if($info['extension'] == 'php')
- return $info['filename'];
- }, scandir('configs/clients/'))));
+$route = @$_GET['route'];
+$route = rtrim($route, '/');
+@list($mandator, $route) = explode('/', $route, 2);
+if(!$mandator)
+{
+ // root requested
- if(count($clients) == 0)
+ if(Conferences::getActiveConferencesCount() == 0)
{
// no clients
// error
- die('no clients');
+ var_dump('no clients');
+ exit;
}
- else if(count($clients) == 1)
+ else if(Conferences::getActiveConferencesCount() == 1)
{
// one client
// redirect
- header('Location: '.baseurl().$clients[0].'/');
+ $clients = Conferences::getActiveConferences();
+ header('Location: '.forceslash( baseurl() . $clients[0] ));
exit;
}
else
@@ -42,35 +54,23 @@ if($route == '')
// show overview
// TODO Template
- print_r($clients);
+ $clients = Conferences::getActiveConferences();
+ var_dump('multiple clients');
+ var_dump($clients);
exit;
}
}
-else
+else if(!Conferences::exists($mandator))
{
- list($client, $route) = explode('/', $route, 2);
-
- $GLOBALS['CLIENT'] = $client;
- require_once('configs/clients/'.$client.'.php');
+ // old url OR wrong client OR
+ // -> error
+ die('unknown conference '.$mandator);
}
+Conferences::load($mandator);
-require_once('lib/PhpTemplate.php');
-require_once('lib/Exceptions.php');
-require_once('lib/less.php/Less.php');
-
-require_once('model/ModelBase.php');
-require_once('model/Conference.php');
-require_once('model/Feedback.php');
-require_once('model/Schedule.php');
-require_once('model/Overview.php');
-require_once('model/Room.php');
-require_once('model/RoomTab.php');
-require_once('model/RoomSelection.php');
-require_once('model/Stream.php');
-require_once('model/Relive.php');
-require_once('model/Upcoming.php');
+// PER-CONFERENCE CODE
$conference = new Conference();
$tpl = new PhpTemplate('template/page.phtml');
@@ -96,7 +96,7 @@ if(startswith('//', @$GLOBALS['CONFIG']['BASEURL']))
ob_start();
try {
-
+ // ALWAYS AVAILABLE ROUTES
if($route == 'feedback/read')
{
require('view/feedback-read.php');
@@ -114,29 +114,25 @@ try {
else if($route == 'gen/main.css')
{
- $dir = forceslash(sys_get_temp_dir());
-
- $css_file = Less_Cache::Get([
- 'assets/css/main.less' => '../../assets/css/',
- ], [
- 'sourceMap' => true,
- 'compress' => true,
- 'relativeUrls' => true,
-
- 'cache_dir' => $dir,
- ]);
-
- $css = file_get_contents($dir.$css_file);
- header('Content-Type: text/css');
- header('Content-Length: '.strlen($css));
- print($css);
+ if(Conferences::hasCustomStyles($mandator))
+ {
+ handle_lesscss_request(
+ Conferences::getCustomStyles($mandator),
+ '../../'.Conferences::getCustomStylesDir($mandator)
+ );
+ }
+ else {
+ handle_lesscss_request('assets/css/main.less', '../../assets/css/');
+ }
}
+ // HAS-NOT-BEGUN VIEW
else if(!$conference->hasBegun())
{
require('view/not-started.php');
}
+ // ROUTES AVAILABLE AFTER BUT NOT BEFORE THE CONFERENCE
else if(preg_match('@^relive/([0-9]+)$@', $route, $m))
{
$_GET = array(
@@ -150,11 +146,14 @@ try {
require('view/relive.php');
}
+
+ // HAS-ENDED VIEW
else if($conference->hasEnded())
{
require('view/closed.php');
}
+ // ROUTES AVAILABLE ONLY DURING THE CONFERENCE
else if($route == '')
{
require('view/overview.php');
@@ -226,6 +225,7 @@ try {
require('view/embed.php');
}
+ // UNKNOWN ROUTE
else
{
throw new NotFoundException();