From c1c54bd1295d9de8b3575cef25efa3dd5f6b0c85 Mon Sep 17 00:00:00 2001 From: MaZderMind Date: Wed, 23 Dec 2015 13:53:05 +0100 Subject: show warning when running in preview mode --- model/Conference.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'model') diff --git a/model/Conference.php b/model/Conference.php index 701d7c7..8a8291b 100644 --- a/model/Conference.php +++ b/model/Conference.php @@ -6,16 +6,18 @@ class Conference extends ModelBase return $this->get('CONFERENCE.TITLE', 'C3Voc Streaming'); } + public function isPreviewEnabled() { + return $this->has('PREVIEW_DOMAIN') && ($this->get('PREVIEW_DOMAIN') == $_SERVER['HTTP_HOST']); + } + public function isClosed() { return !$this->hasBegun() || $this->hasEnded(); } public function hasBegun() { // on the preview-domain all conferences are always open - if($this->has('PREVIEW_DOMAIN') && $this->get('PREVIEW_DOMAIN') == $_SERVER['HTTP_HOST']) - { + if($this->isPreviewEnabled()) return true; - } if($this->has('CONFERENCE.CLOSED')) { $closed = $this->get('CONFERENCE.CLOSED'); @@ -42,10 +44,8 @@ class Conference extends ModelBase public function hasEnded() { // on the preview-domain no conference ever ends - if($this->has('PREVIEW_DOMAIN') && $this->get('PREVIEW_DOMAIN') == $_SERVER['HTTP_HOST']) - { + if($this->isPreviewEnabled()) return false; - } if($this->has('CONFERENCE.CLOSED')) { $closed = $this->get('CONFERENCE.CLOSED'); -- cgit v1.2.3