aboutsummaryrefslogtreecommitdiff
path: root/index.php
diff options
context:
space:
mode:
authorMaZderMind2015-11-08 17:17:16 +0100
committerMaZderMind2015-11-08 17:17:16 +0100
commitaec65f8a241d3810d5e7a029f861bc6090b65cb9 (patch)
tree467409791060ef43b13d025384df3c1c733c41e3 /index.php
parent0d91cc5f111fac882f1bb375c2bf426195c9cae2 (diff)
better exception-handling in mandator-code
Diffstat (limited to 'index.php')
-rw-r--r--index.php104
1 files changed, 57 insertions, 47 deletions
diff --git a/index.php b/index.php
index a26f391..b7fe5da 100644
--- a/index.php
+++ b/index.php
@@ -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');