summaryrefslogtreecommitdiffstats
path: root/lib/helper.php
diff options
context:
space:
mode:
authorBart Visscher <bartv@thisnet.nl>2011-09-09 20:51:53 +0200
committerBart Visscher <bartv@thisnet.nl>2011-09-09 22:19:15 +0200
commit760b47a62fe3a8bcf1f58da74ffdaefe33793f7e (patch)
tree587bacf51807c5a58d7c335cfb7c2644e2bd3615 /lib/helper.php
parent80f5942868d42bd6939c9242eca7213a3dc8c79d (diff)
downloadnextcloud-server-760b47a62fe3a8bcf1f58da74ffdaefe33793f7e.tar.gz
nextcloud-server-760b47a62fe3a8bcf1f58da74ffdaefe33793f7e.zip
Use OC_Helper::linkTo also for absolute urls.
One central place to check for https.
Diffstat (limited to 'lib/helper.php')
-rw-r--r--lib/helper.php8
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/helper.php b/lib/helper.php
index 272f4607011..d9b47280ff7 100644
--- a/lib/helper.php
+++ b/lib/helper.php
@@ -34,7 +34,7 @@ class OC_Helper {
*
* Returns a url to the given app and file.
*/
- public static function linkTo( $app, $file , $redirect_url=NULL ){
+ public static function linkTo( $app, $file, $redirect_url=NULL, $absolute=false ){
global $WEBROOT;
global $SERVERROOT;
@@ -57,6 +57,12 @@ class OC_Helper {
}
}
+ if($absolute){
+ // Checking if the request was made through HTTPS. The last in line is for IIS
+ $protocol = isset($_SERVER['HTTPS']) && ($_SERVER['HTTPS']) && ($_SERVER['HTTPS']!='off');
+ $urlLinkTo = ($protocol?'https':'http') . '://' . $_SERVER['HTTP_HOST'] . $urlLinkTo;
+ }
+
if($redirect_url)
return $urlLinkTo.'?redirect_url='.$redirect_url;
else