diff --git a/web/includes/Monitor.php b/web/includes/Monitor.php index a3bd1b738..e425e7f85 100644 --- a/web/includes/Monitor.php +++ b/web/includes/Monitor.php @@ -547,7 +547,7 @@ private $control_fields = array( } // end function Source public function Url() { - return $this->Server()->Url() .':'. ( ZM_MIN_STREAMING_PORT ? (ZM_MIN_STREAMING_PORT+$this->Id()) : $_SERVER['SERVER_PORT'] ); + return $this->Server()->Url( ZM_MIN_STREAMING_PORT ? (ZM_MIN_STREAMING_PORT+$this->Id()) : null ); } } // end class Monitor diff --git a/web/includes/Server.php b/web/includes/Server.php index 154c1744c..8b7e9f50f 100644 --- a/web/includes/Server.php +++ b/web/includes/Server.php @@ -38,13 +38,18 @@ class Server { } } - public function Url() { + public function Url( $port = null ) { + $url = ZM_BASE_PROTOCOL . '://'; if ( $this->Id() ) { - return ZM_BASE_PROTOCOL . '://'. $this->Hostname().$_SERVER['PHP_SELF']; + $url .= $this->Hostname(); } else { - return ZM_BASE_PROTOCOL . '://'. $_SERVER['SERVER_NAME'].$_SERVER['PHP_SELF']; - return ''; + $url .= $_SERVER['SERVER_NAME']; } + if ( $port ) { + $url .= ':'.$port; + } + $url .= $_SERVER['PHP_SELF']; + return $url; } public function Hostname() { if ( isset( $this->{'Hostname'} ) and ( $this->{'Hostname'} != '' ) ) {