Skip to content

Commit

Permalink
better handling for legacy config errors
Browse files Browse the repository at this point in the history
  • Loading branch information
MaZderMind committed Dec 11, 2016
1 parent a38a7fc commit 738878b
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 18 deletions.
30 changes: 14 additions & 16 deletions index.php
Original file line number Diff line number Diff line change
Expand Up @@ -153,25 +153,23 @@
}



// 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')
Expand Down
1 change: 1 addition & 0 deletions lib/Exceptions.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ function exception_error_handler($errno, $errstr, $errfile, $errline ) {

class NotFoundException extends Exception {}
class ScheduleException extends Exception {}
class ConfigException extends Exception {}
10 changes: 8 additions & 2 deletions model/Conferences.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,14 @@ public static function exists($mandator) {
}

public static function loadConferenceConfig($mandator) {
$config = forceslash(Conferences::MANDATOR_DIR).forceslash($mandator).'config.php';
return include($config);
$configfile = forceslash(Conferences::MANDATOR_DIR).forceslash($mandator).'config.php';
$config = include($configfile);

if(!is_array($config)) {
throw new ConfigException("Loading $configfile did not return an array. Maybe it's missing a return-statement?");
}

return $config;
}

public static function getConference($mandator) {
Expand Down

0 comments on commit 738878b

Please sign in to comment.