From 52b1439d511fbf99c5da5bc18bd5ee67af4eca7c Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Mon, 8 Oct 2018 09:55:47 -0400 Subject: [PATCH] fix the lack of /zm/index.php in url in Server->Url() and multiport --- web/includes/Monitor.php | 2 +- web/includes/Server.php | 13 +++++++++---- 2 files changed, 10 insertions(+), 5 deletions(-) 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'} != '' ) ) {