Use Server->Url() more,, moving the logic into Server->Url()

This commit is contained in:
Isaac Connor 2018-07-09 12:09:29 -04:00
parent 34299aff2c
commit 661876b998
1 changed files with 11 additions and 17 deletions

View File

@ -195,20 +195,13 @@ private $control_fields = array(
}
}
public function getStreamSrc( $args, $querySep='&' ) {
public function getStreamSrc($args, $querySep='&') {
$streamSrc = $this->Server()->Url(
ZM_MIN_STREAMING_PORT ?
ZM_MIN_STREAMING_PORT+$this->{'Id'} :
null);
$streamSrc = ZM_BASE_PROTOCOL.'://';
if ( isset($this->{'ServerId'}) and $this->{'ServerId'} ) {
$Server = new Server( $this->{'ServerId'} );
$streamSrc .= $Server->Hostname();
if ( ZM_MIN_STREAMING_PORT ) {
$streamSrc .= ':'.(ZM_MIN_STREAMING_PORT+$this->{'Id'});
}
} else if ( ZM_MIN_STREAMING_PORT ) {
$streamSrc .= $_SERVER['SERVER_NAME'].':'.(ZM_MIN_STREAMING_PORT+$this->{'Id'});
} else {
$streamSrc .= $_SERVER['HTTP_HOST'];
}
$streamSrc .= ZM_PATH_ZMS;
$args['monitor'] = $this->{'Id'};
@ -230,9 +223,9 @@ private $control_fields = array(
$args['rand'] = time();
}
$streamSrc .= '?'.http_build_query( $args,'', $querySep );
$streamSrc .= '?'.http_build_query($args,'', $querySep);
return( $streamSrc );
return $streamSrc;
} // end function getStreamSrc
public function Width($new = null) {
@ -487,9 +480,10 @@ private $control_fields = array(
$source = preg_replace( '/^.*\//', '', $this->{'Path'} );
} elseif ( $this->{'Type'} == 'Ffmpeg' || $this->{'Type'} == 'Libvlc' || $this->{'Type'} == 'WebSite' ) {
$url_parts = parse_url( $this->{'Path'} );
if ( ZM_WEB_FILTER_SOURCE == "Hostname" ) { # Filter out everything but the hostname
if ( ZM_WEB_FILTER_SOURCE == 'Hostname' ) { # Filter out everything but the hostname
$source = $url_parts['host'];
} elseif ( ZM_WEB_FILTER_SOURCE == "NoCredentials" ) { # Filter out sensitive and common items
} elseif ( ZM_WEB_FILTER_SOURCE == 'NoCredentials' ) {
# Filter out sensitive and common items
unset($url_parts['user']);
unset($url_parts['pass']);
#unset($url_parts['scheme']);