diff options
Diffstat (limited to 'lib/helper.php')
-rw-r--r-- | lib/helper.php | 48 |
1 files changed, 1 insertions, 47 deletions
diff --git a/lib/helper.php b/lib/helper.php index c404f6e5440..8c362747a27 100644 --- a/lib/helper.php +++ b/lib/helper.php @@ -65,52 +65,6 @@ class OC_Helper { } /** - * @brief Returns the server host - * @returns the server host - * - * Returns the server host, even if the website uses one or more - * reverse proxies - */ - public static function serverHost() { - if(OC::$CLI){ - return 'localhost'; - } - if (isset($_SERVER['HTTP_X_FORWARDED_HOST'])) { - if (strpos($_SERVER['HTTP_X_FORWARDED_HOST'], ",") !== false) { - $host = trim(array_pop(explode(",", $_SERVER['HTTP_X_FORWARDED_HOST']))); - } - else{ - $host=$_SERVER['HTTP_X_FORWARDED_HOST']; - } - } - else{ - $host = $_SERVER['HTTP_HOST']; - } - return $host; - } - - - /** - * @brief Returns the server protocol - * @returns the server protocol - * - * Returns the server protocol. It respects reverse proxy servers and load balancers - */ - public static function serverProtocol() { - if (isset($_SERVER['HTTP_X_FORWARDED_PROTO'])) { - $proto = strtolower($_SERVER['HTTP_X_FORWARDED_PROTO']); - }else{ - if(isset($_SERVER['HTTPS']) and !empty($_SERVER['HTTPS']) and ($_SERVER['HTTPS']!='off')) { - $proto = 'https'; - }else{ - $proto = 'http'; - } - } - return($proto); - } - - - /** * @brief Creates an absolute url * @param $app app * @param $file file @@ -132,7 +86,7 @@ class OC_Helper { */ public static function makeURLAbsolute( $url ) { - return self::serverProtocol(). '://' . self::serverHost() . $url; + return OC_Request::serverProtocol(). '://' . OC_Request::serverHost() . $url; } /** |