diff --git a/apps/bookmarks/templates/list.php b/apps/bookmarks/templates/list.php
index a6053184aa2..d4215e82ddb 100644
--- a/apps/bookmarks/templates/list.php
+++ b/apps/bookmarks/templates/list.php
@@ -2,7 +2,7 @@
diff --git a/apps/files_publiclink/admin.php b/apps/files_publiclink/admin.php
index f5163547963..33d8f04a603 100644
--- a/apps/files_publiclink/admin.php
+++ b/apps/files_publiclink/admin.php
@@ -37,11 +37,7 @@ OC_App::setActiveNavigationEntry( "files_publiclink_administration" );
OC_Util::addScript( 'files_publiclink', 'admin' );
-if(isset($_SERVER['HTTPS'])) {
- $baseUrl= "https://". $_SERVER['SERVER_NAME'] . OC_Helper::linkTo('files_publiclink','get.php');
-}else{
- $baseUrl= "http://". $_SERVER['SERVER_NAME'] . OC_Helper::linkTo('files_publiclink','get.php');
-}
+$baseUrl = OC_Helper::linkTo('files_publiclink','get.php', null, true);
// return template
diff --git a/apps/media/lib_ampache.php b/apps/media/lib_ampache.php
index a0123f87c51..b3bd7b16189 100644
--- a/apps/media/lib_ampache.php
+++ b/apps/media/lib_ampache.php
@@ -166,11 +166,6 @@ class OC_MEDIA_AMPACHE{
}
$artistName=utf8_decode(htmlentities($artistName));
$albumName=utf8_decode(htmlentities($albumName));
- if (isset($_SERVER['HTTPS'])) {
- $PROTO="https://";
- } else {
- $PROTO="http://";
- }
$id=$song['song_id'];
$name=utf8_decode(htmlentities($song['song_name']));
$artist=$song['song_artist'];
@@ -179,7 +174,7 @@ class OC_MEDIA_AMPACHE{
echo("\t\t
$name\n");
echo("\t\t
$artistName\n");
echo("\t\t
$albumName\n");
- $url="$PROTO{$_SERVER["HTTP_HOST"]}$WEBROOT/apps/media/server/xml.server.php?action=play&song=$id&auth={$_GET['auth']}";
+ $url=OC_Helper::linkTo('media', 'server/xml.server.php', null, true)."?action=play&song=$id&auth={$_GET['auth']}";
$url=htmlentities($url);
echo("\t\t
$url\n");
echo("\t\t
\n");
diff --git a/apps/user_openid/appinfo/app.php b/apps/user_openid/appinfo/app.php
index 3cdf2664e81..886265cd312 100644
--- a/apps/user_openid/appinfo/app.php
+++ b/apps/user_openid/appinfo/app.php
@@ -5,8 +5,6 @@ if (!in_array ('curl', get_loaded_extensions())){
return;
}
-$urlBase=((isset($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] == 'on') ? 'https' : 'http').'://'.$_SERVER['HTTP_HOST'];
-
$userName='';
if(strpos($_SERVER["REQUEST_URI"],'?') and !strpos($_SERVER["REQUEST_URI"],'=')){
if(strpos($_SERVER["REQUEST_URI"],'/?')){
@@ -16,8 +14,8 @@ if(strpos($_SERVER["REQUEST_URI"],'?') and !strpos($_SERVER["REQUEST_URI"],'='))
}
}
-OC_Util::addHeader('link',array('rel'=>'openid.server', 'href'=>$urlBase.OC_Helper::linkTo( "user_openid", "user.php" ).'/'.$userName));
-OC_Util::addHeader('link',array('rel'=>'openid.delegate', 'href'=>$urlBase.OC_Helper::linkTo( "user_openid", "user.php" ).'/'.$userName));
+OC_Util::addHeader('link',array('rel'=>'openid.server', 'href'=>OC_Helper::linkTo( "user_openid", "user.php", null, true ).'/'.$userName));
+OC_Util::addHeader('link',array('rel'=>'openid.delegate', 'href'=>$OC_Helper::linkTo( "user_openid", "user.php", null, true ).'/'.$userName));
OC_APP::registerPersonal('user_openid','settings');
diff --git a/apps/user_openid/user.php b/apps/user_openid/user.php
index 3743d232b6d..52fa1047344 100644
--- a/apps/user_openid/user.php
+++ b/apps/user_openid/user.php
@@ -43,7 +43,7 @@ if(!OC_User::userExists($USERNAME)){
$USERNAME='';
}
global $WEBROOT;
-$IDENTITY=((isset($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] == 'on') ? 'https' : 'http').'://'.$_SERVER['HTTP_HOST'].$WEBROOT.'/apps/user_openid/user.php/'.$USERNAME;
+$IDENTITY=OC_Helper::linkTo( "user_openid", "user.php", null, true ).'/'.$USERNAME;
require_once 'phpmyid.php';
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
diff --git a/settings/templates/personal.php b/settings/templates/personal.php
index decda043b8a..65a6f12712b 100644
--- a/settings/templates/personal.php
+++ b/settings/templates/personal.php
@@ -33,7 +33,7 @@
WebDAV
-
+
t('use this address to connect to your ownCloud in your file manager');?>