From 6156d666f556e50fad01dc576c1218415e198399 Mon Sep 17 00:00:00 2001 From: Peter Körner Date: Tue, 22 Mar 2016 14:48:19 +0100 Subject: harden against no-planned dg & cr events --- configs/conferences/datengarten/config.php | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) (limited to 'configs/conferences/datengarten/config.php') diff --git a/configs/conferences/datengarten/config.php b/configs/conferences/datengarten/config.php index 4c7f1ae..13d9a94 100644 --- a/configs/conferences/datengarten/config.php +++ b/configs/conferences/datengarten/config.php @@ -5,12 +5,21 @@ $upcoming_events = $upcoming->getNextEvents(); $upcoming_dgs = array_values(array_filter($upcoming_events, function($event) { return preg_match('/^dg[0-9]+$/i', $event['short_name']); })); -$upcoming_dg = $upcoming_dgs[0]; -preg_match('/^dg([0-9]+)$/i', $upcoming_dg['short_name'], $m); - -$EPISODE = intval($m[1]); -$DATE = strtotime($upcoming_dg['start_date'].' 20:00'); -$TITLE = $upcoming_dg['name']; +if(count($upcoming_dgs) < 1) +{ + $EPISODE = '???'; + $DATE = strtotime('1970-01-01 22:00'); + $TITLE = 'Unknown'; +} +else +{ + $upcoming_dg = $upcoming_dgs[0]; + preg_match('/^dg([0-9]+)$/i', $upcoming_dg['short_name'], $m); + + $EPISODE = intval($m[1]); + $DATE = strtotime($upcoming_dg['start_date'].' 20:00'); + $TITLE = $upcoming_dg['name']; +} $GLOBALS['CONFIG']['CONFERENCE'] = array( -- cgit v1.2.3