mirror of
https://github.com/ZoneMinder/zoneminder.git
synced 2026-10-20 05:34:12 -04:00
remove second use of HTTP_HOST and use a better method of stripping off port from HTTP_HOST
This commit is contained in:
1 parent
5258415e83
commit
a1141d2dc4
1 file changed
+3
-13
+3
-13
@@ -51,13 +51,8 @@ class Server {
|
||||
} else if ( $this->Id() ) {
|
||||
return $this->{'Name'};
|
||||
}
|
||||
# Use HTTP_HOST instead of SERVER_NAME here for nginx compatiblity
|
||||
# ICON: Hi, I just met you, and this is crazy, but I need to strip port.
|
||||
$host_with_port_maybe = $_SERVER['HTTP_HOST'];
|
||||
$heres_my_host = preg_replace('/([^:]+)(:\d+)?/','${1}', $host_with_port_maybe);
|
||||
#Just use it baby
|
||||
|
||||
return $heres_my_host;
|
||||
$result = explode(':',$_SERVER['HTTP_HOST']);
|
||||
return $result[0];
|
||||
}
|
||||
|
||||
public function Protocol( $new = null ) {
|
||||
@@ -96,12 +91,7 @@ class Server {
|
||||
|
||||
public function Url( $port = null ) {
|
||||
$url = $this->Protocol().'://';
|
||||
if ( $this->Id() ) {
|
||||
$url .= $this->Hostname();
|
||||
} else {
|
||||
# Use HTTP_HOST instead of SERVER_NAME here for nginx compatiblity
|
||||
$url .= $_SERVER['HTTP_HOST'];
|
||||
}
|
||||
$url .= $this->Hostname();
|
||||
if ( $port ) {
|
||||
$url .= ':'.$port;
|
||||
} else {
|
||||
|
||||
Reference in new issue
Block a user