From f6c0270d40f6730fe1e1820f2866b08792df1db6 Mon Sep 17 00:00:00 2001 From: MaZderMind Date: Sat, 10 Dec 2016 18:22:34 +0100 Subject: rewrite data-model so that every configuration option is accessed through the conference --- index.php | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) (limited to 'index.php') diff --git a/index.php b/index.php index 9a5e304..19a174a 100644 --- a/index.php +++ b/index.php @@ -59,7 +59,8 @@ try { 'route' => $route, 'canonicalurl' => forceslash(baseurl()).forceslash($route), 'assemblies' => 'template/assemblies/', - 'assets' => 'assets/', + 'assets' => forceslash('assets'), + 'conference_assets' => '/', 'conference' => new GenericConference(), )); @@ -113,7 +114,7 @@ try { // redirect $clients = Conferences::getActiveConferences(); - header('Location: '.forceslash( baseurl() . $clients[0]['link'] )); + header('Location: '.joinpath([baseurl(), $clients[0]->getSlug()])); exit; } else @@ -132,8 +133,9 @@ try { require('view/404.php'); exit; } - - Conferences::load($mandator); + else { + // fallthrough through to the main mandator-based routes + } } catch(Exception $e) { @@ -144,20 +146,19 @@ catch(Exception $e) // PER-CONFERENCE CODE -$GLOBALS['MANDATOR'] = $mandator; -$conference = new Conference(); +$conference = Conferences::getConference($mandator); // update template information $tpl->set(array( 'baseurl' => forceslash(baseurl()), 'route' => $route, - 'canonicalurl' => forceslash(baseurl()).forceslash($route), - 'assets' => '../assets/', + 'canonicalurl' => joinpath([baseurl(), $mandator, $route]), + 'conference_assets' => forceslash($mandator), 'conference' => $conference, - 'feedback' => new Feedback(), - 'schedule' => new Schedule(), - 'subtitles' => new Subtitles(), + 'feedback' => $conference->getFeedback(), + 'schedule' => $conference->getSchedule(), + 'subtitles' => $conference->getSubtitles(), )); ob_start(); -- cgit v1.2.3 From d0a891dcc4f261300616883aab384bd93f9f487c Mon Sep 17 00:00:00 2001 From: MaZderMind Date: Sat, 10 Dec 2016 18:23:22 +0100 Subject: aways print a stack-trace --- index.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'index.php') diff --git a/index.php b/index.php index 19a174a..b27055e 100644 --- a/index.php +++ b/index.php @@ -140,7 +140,16 @@ try { catch(Exception $e) { ob_clean(); - require('view/500.php'); + try { + require('view/500.php'); + exit; + } + catch(Exception $e) { + header("HTTP/1.1 500 Internal Server Error"); + header("Content-Type: text/plain"); + print_r($e); + exit; + } } -- cgit v1.2.3 From 3de0b86d9c3c82428ed7d1f0e04cec9fa2d0d758 Mon Sep 17 00:00:00 2001 From: MaZderMind Date: Sat, 10 Dec 2016 18:23:45 +0100 Subject: alwas allow access to the conference about-page --- index.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'index.php') diff --git a/index.php b/index.php index b27055e..414dede 100644 --- a/index.php +++ b/index.php @@ -214,6 +214,11 @@ try { require('view/multiview.php'); } + else if($route == 'about') + { + require('view/about.php'); + } + // HAS-NOT-BEGUN VIEW else if(!$conference->hasBegun()) { @@ -247,11 +252,6 @@ try { require('view/overview.php'); } - else if($route == 'about') - { - require('view/about.php'); - } - else if($route == 'feedback') { require('view/feedback.php'); -- cgit v1.2.3 From 738878b8b060b3cfcdde2d88a1a28d5ce83e4aa7 Mon Sep 17 00:00:00 2001 From: MaZderMind Date: Sun, 11 Dec 2016 20:01:33 +0100 Subject: better handling for legacy config errors --- index.php | 30 ++++++++++++++---------------- 1 file changed, 14 insertions(+), 16 deletions(-) (limited to 'index.php') diff --git a/index.php b/index.php index 414dede..ef3944c 100644 --- a/index.php +++ b/index.php @@ -153,25 +153,23 @@ catch(Exception $e) } - // PER-CONFERENCE CODE -$conference = Conferences::getConference($mandator); - -// update template information -$tpl->set(array( - 'baseurl' => forceslash(baseurl()), - 'route' => $route, - 'canonicalurl' => joinpath([baseurl(), $mandator, $route]), - 'conference_assets' => forceslash($mandator), - - 'conference' => $conference, - 'feedback' => $conference->getFeedback(), - 'schedule' => $conference->getSchedule(), - 'subtitles' => $conference->getSubtitles(), -)); - ob_start(); try { + $conference = Conferences::getConference($mandator); + + // update template information + $tpl->set(array( + 'baseurl' => forceslash(baseurl()), + 'route' => $route, + 'canonicalurl' => joinpath([baseurl(), $mandator, $route]), + 'conference_assets' => forceslash($mandator), + + 'conference' => $conference, + 'feedback' => $conference->getFeedback(), + 'schedule' => $conference->getSchedule(), + 'subtitles' => $conference->getSubtitles(), + )); // ALWAYS AVAILABLE ROUTES if($route == 'feedback/read') -- cgit v1.2.3 From 895b7fa70883b60ad7ee15fefed6f908020310b9 Mon Sep 17 00:00:00 2001 From: MaZderMind Date: Sun, 11 Dec 2016 19:55:39 +0100 Subject: add linebreak to error message --- index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'index.php') diff --git a/index.php b/index.php index ef3944c..6c62e34 100644 --- a/index.php +++ b/index.php @@ -1,7 +1,7 @@