diff options
Diffstat (limited to '')
-rw-r--r-- | config.php | 6 | ||||
-rw-r--r-- | index.php | 2 | ||||
-rw-r--r-- | lib/helper.php | 12 | ||||
-rw-r--r-- | model/Stream.php | 12 |
4 files changed, 23 insertions, 9 deletions
@@ -6,8 +6,12 @@ date_default_timezone_set('Europe/Berlin'); * In Produktionssituationen sollte manuell eine konfiguriert werden um Überraschungen zu vermeiden */ if($_SERVER['HTTP_HOST'] != 'localhost') - $GLOBALS['CONFIG']['BASEURL'] = 'http://streaming.media.ccc.de/'; + $GLOBALS['CONFIG']['BASEURL'] = proto().'://streaming.media.ccc.de/'; +/** + * Beispielkonfiguration für Produktionssituationen + */ +//$GLOBALS['CONFIG']['BASEURL'] = proto().'://streaming.media.ccc.de/'; $GLOBALS['CONFIG']['CONFERENCE'] = array( /** @@ -3,11 +3,11 @@ if(!ini_get('short_open_tag')) die('`short_open_tag = On` is required'); +require_once('lib/helper.php'); require_once('config.php'); require_once('lib/PhpTemplate.php'); require_once('lib/Exceptions.php'); -require_once('lib/helper.php'); require_once('model/ModelBase.php'); require_once('model/Conference.php'); diff --git a/lib/helper.php b/lib/helper.php index e462089..4cf089f 100644 --- a/lib/helper.php +++ b/lib/helper.php @@ -1,11 +1,21 @@ <?php +function ssl() +{ + return isset($_SERVER['HTTPS']) && $_SERVER['HTTPS']; +} + +function proto() +{ + return ssl() ? 'https' : 'http'; +} + function baseurl() { if(isset($GLOBALS['CONFIG']['BASEURL'])) return $GLOBALS['CONFIG']['BASEURL']; - $base = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS']) ? 'https://' : 'http://'; + $base = ssl() ? 'https://' : 'http://'; $base .= $_SERVER['HTTP_HOST']; $base .= forceslash(dirname($_SERVER['SCRIPT_NAME'])); diff --git a/model/Stream.php b/model/Stream.php index fe333ce..f9488a0 100644 --- a/model/Stream.php +++ b/model/Stream.php @@ -114,10 +114,10 @@ class Stream switch($proto) { case 'webm': - return 'http://cdn.c3voc.de/'.rawurlencode($this->getRoom()->getStream()).'_'.rawurlencode($this->getLanguage()).'_'.rawurlencode($this->getSelection()).'.webm'; + return proto().'://cdn.c3voc.de/'.rawurlencode($this->getRoom()->getStream()).'_'.rawurlencode($this->getLanguage()).'_'.rawurlencode($this->getSelection()).'.webm'; case 'hls': - return 'http://cdn.c3voc.de/hls/'.rawurlencode($this->getRoom()->getStream()).'_'.rawurlencode($this->getLanguage()).'_'.rawurlencode($this->getSelection()).'.m3u8'; + return proto().'://cdn.c3voc.de/hls/'.rawurlencode($this->getRoom()->getStream()).'_'.rawurlencode($this->getLanguage()).'_'.rawurlencode($this->getSelection()).'.m3u8'; } return null; @@ -179,10 +179,10 @@ class Stream switch($proto) { case 'mp3': - return 'http://cdn.c3voc.de/'.rawurlencode($this->getRoom()->getStream()).'_'.rawurlencode($this->getLanguage()).'.mp3'; + return proto().'://cdn.c3voc.de/'.rawurlencode($this->getRoom()->getStream()).'_'.rawurlencode($this->getLanguage()).'.mp3'; case 'opus': - return 'http://cdn.c3voc.de/'.rawurlencode($this->getRoom()->getStream()).'_'.rawurlencode($this->getLanguage()).'.opus'; + return proto().'://cdn.c3voc.de/'.rawurlencode($this->getRoom()->getStream()).'_'.rawurlencode($this->getLanguage()).'.opus'; } return null; @@ -213,10 +213,10 @@ class Stream switch($proto) { case 'mp3': - return 'http://cdn.c3voc.de/'.rawurlencode($this->getRoom()->getStream()).'.mp3'; + return proto().'://cdn.c3voc.de/'.rawurlencode($this->getRoom()->getStream()).'.mp3'; case 'opus': - return 'http://cdn.c3voc.de/'.rawurlencode($this->getRoom()->getStream()).'.opus'; + return proto().'://cdn.c3voc.de/'.rawurlencode($this->getRoom()->getStream()).'.opus'; default: return null; |