diff options
author | Peter Körner | 2016-03-22 14:48:19 +0100 |
---|---|---|
committer | Peter Körner | 2016-03-22 14:48:19 +0100 |
commit | 6156d666f556e50fad01dc576c1218415e198399 (patch) | |
tree | 08c7c6a9f0e44f6422e9547f2570e55aa9fc70df | |
parent | 8fcb5786082cfab982d5b3163bfb02fcacd93d92 (diff) |
harden against no-planned dg & cr events
Diffstat (limited to '')
-rw-r--r-- | configs/conferences/chaosradio/config.php | 24 | ||||
-rw-r--r-- | configs/conferences/datengarten/config.php | 21 |
2 files changed, 32 insertions, 13 deletions
diff --git a/configs/conferences/chaosradio/config.php b/configs/conferences/chaosradio/config.php index 812b832..c1e76e0 100644 --- a/configs/conferences/chaosradio/config.php +++ b/configs/conferences/chaosradio/config.php @@ -5,14 +5,24 @@ $upcoming_events = $upcoming->getNextEvents(); $upcoming_crs = array_values(array_filter($upcoming_events, function($event) { return preg_match('/^cr[0-9]+$/i', $event['short_name']); })); -$upcoming_cr = $upcoming_crs[0]; -preg_match('/^cr([0-9]+)$/i', $upcoming_cr['short_name'], $m); - -$EPISODE = intval($m[1]); -$DATE = strtotime($upcoming_cr['start_date'].' 22:00'); -$TITLE = $upcoming_cr['name']; -$IM_CCCB = ($upcoming_cr['location'] == 'CCCB'); +if(count($upcoming_crs) < 1) +{ + $EPISODE = '???'; + $DATE = strtotime('1970-01-01 22:00'); + $TITLE = 'Unknown'; + $IM_CCCB = true; +} +else +{ + $upcoming_cr = $upcoming_crs[0]; + preg_match('/^cr([0-9]+)$/i', $upcoming_cr['short_name'], $m); + + $EPISODE = intval($m[1]); + $DATE = strtotime($upcoming_cr['start_date'].' 22:00'); + $TITLE = $upcoming_cr['name']; + $IM_CCCB = ($upcoming_cr['location'] == 'CCCB'); +} $STREAM = $IM_CCCB ? 's5' : 'q2'; 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( |