diff options
Diffstat (limited to 'index.php')
-rw-r--r-- | index.php | 104 |
1 files changed, 57 insertions, 47 deletions
@@ -24,71 +24,81 @@ require_once('model/Relive.php'); require_once('model/Upcoming.php'); -$route = @$_GET['route']; -$route = rtrim($route, '/'); - -// GLOBAL CSS (for conferences overview) -if($route == 'gen/main.css') -{ - handle_lesscss_request('assets/css/main.less', '../assets/css/'); - exit; -} +ob_start(); +try { + $route = @$_GET['route']; + $route = rtrim($route, '/'); -// generic template -$tpl = new PhpTemplate('template/page.phtml'); -$tpl->set(array( - 'baseurl' => forceslash(baseurl()), - 'route' => $route, - 'canonicalurl' => forceslash(baseurl()).forceslash($route), - 'assemblies' => './template/assemblies/', - 'assets' => 'assets/', + // GLOBAL CSS (for conferences overview) + if($route == 'gen/main.css') + { + handle_lesscss_request('assets/css/main.less', '../assets/css/'); + exit; + } - 'conference' => new GenericConference(), -)); + // generic template + $tpl = new PhpTemplate('template/page.phtml'); + $tpl->set(array( + 'baseurl' => forceslash(baseurl()), + 'route' => $route, + 'canonicalurl' => forceslash(baseurl()).forceslash($route), + 'assemblies' => './template/assemblies/', + 'assets' => 'assets/', -@list($mandator, $route) = explode('/', $route, 2); -if(!$mandator) -{ - // root requested + 'conference' => new GenericConference(), + )); - if(Conferences::getActiveConferencesCount() == 0) + @list($mandator, $route) = explode('/', $route, 2); + if(!$mandator) { - // no clients - // error + // root requested - require('view/allclosed.php'); - exit; - } - else if(Conferences::getActiveConferencesCount() == 1) - { - // one client - // redirect + if(Conferences::getActiveConferencesCount() == 0) + { + // no clients + // error - $clients = Conferences::getActiveConferences(); - header('Location: '.forceslash( baseurl() . $clients[0] )); - exit; + require('view/allclosed.php'); + exit; + } + else if(Conferences::getActiveConferencesCount() == 1) + { + // one client + // redirect + + $clients = Conferences::getActiveConferences(); + header('Location: '.forceslash( baseurl() . $clients[0]['link'] )); + exit; + } + else + { + // multiple clients + // show overview + + require('view/allconferences.php'); + exit; + } } - else + else if(!Conferences::exists($mandator)) { - // multiple clients - // show overview - - require('view/allconferences.php'); + // old url OR wrong client OR + // -> error + require('view/404.php'); exit; } + + Conferences::load($mandator); } -else if(!Conferences::exists($mandator)) +catch(Exception $e) { - // old url OR wrong client OR - // -> error - require('view/404.php'); - exit; + ob_clean(); + require('view/500.php'); } -Conferences::load($mandator); // PER-CONFERENCE CODE +$GLOBALS['MANDATOR'] = $mandator; $conference = new Conference(); $tpl = new PhpTemplate('template/page.phtml'); |