diff options
author | Bart Visscher <bartv@thisnet.nl> | 2012-02-16 19:45:00 +0100 |
---|---|---|
committer | Bart Visscher <bartv@thisnet.nl> | 2012-02-17 22:07:14 +0100 |
commit | f47444e1f776912cbf141ec9cc3763110f4e3552 (patch) | |
tree | e50acafa0fc13b943aafc7b8f424cab142236363 /lib/helper.php | |
parent | 5f3c54922773068091dfe8b40e3b407512ef4cfe (diff) | |
download | nextcloud-server-f47444e1f776912cbf141ec9cc3763110f4e3552.tar.gz nextcloud-server-f47444e1f776912cbf141ec9cc3763110f4e3552.zip |
Use separate function to make absolute urls
Diffstat (limited to 'lib/helper.php')
-rw-r--r-- | lib/helper.php | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/lib/helper.php b/lib/helper.php index 6d3df6d97e7..b1e6d053a19 100644 --- a/lib/helper.php +++ b/lib/helper.php @@ -54,12 +54,6 @@ class OC_Helper { } } - if($absolute){ - // Checking if the request was made through HTTPS. The last in line is for IIS - $protocol = isset($_SERVER['HTTPS']) && !empty($_SERVER['HTTPS']) && ($_SERVER['HTTPS']!='off'); - $urlLinkTo = ($protocol?'https':'http') . '://' . $_SERVER['HTTP_HOST'] . $urlLinkTo; - } - if($redirect_url) return $urlLinkTo.'?redirect_url='.urlencode($_SERVER["REQUEST_URI"]); else @@ -68,6 +62,23 @@ class OC_Helper { } /** + * @brief Creates an absolute url + * @param $app app + * @param $file file + * @param $redirect_url redirect_url variable is appended to the URL + * @returns the url + * + * Returns a absolute url to the given app and file. + */ + public static function linkToAbsolute( $app, $file, $redirect_url=NULL ) { + $urlLinkTo = self::linkTo( $app, $file, $redirect_url ); + // Checking if the request was made through HTTPS. The last in line is for IIS + $protocol = isset($_SERVER['HTTPS']) && !empty($_SERVER['HTTPS']) && ($_SERVER['HTTPS']!='off'); + $urlLinkTo = ($protocol?'https':'http') . '://' . $_SERVER['HTTP_HOST'] . $urlLinkTo; + return $urlLinkTo; + } + + /** * @brief Creates path to an image * @param $app app * @param $image image name |