]> source.dussan.org Git - nextcloud-server.git/commitdiff
use our own serverHost call so that ownCloud works with reverse proxy servers
authorFrank Karlitschek <frank@owncloud.org>
Thu, 31 May 2012 18:26:09 +0000 (20:26 +0200)
committerFrank Karlitschek <frank@owncloud.org>
Thu, 31 May 2012 18:26:09 +0000 (20:26 +0200)
apps/files_sharing/ajax/email.php
apps/user_openid/phpmyid.php
apps/user_openid/user_openid.php
core/lostpassword/index.php
lib/ocs.php
ocs/providers.php

index 163683cd0e3c3bc3624df039983d30dbaffa6659..523c3d2078b66dacca21860bd0b346380c3b3215 100644 (file)
@@ -7,7 +7,7 @@ $type = (strpos($_POST['file'], '.') === false) ? 'folder' : 'file';
 $subject = $user.' shared a '.$type.' with you';
 $link = $_POST['link'];
 $text = $user.' shared the '.$type.' '.$_POST['file'].' with you. It is available for download here: '.$link;
-$fromaddress = OCP\Config::getUserValue($user, 'settings', 'email', 'sharing-noreply@'.$_SERVER['HTTP_HOST']);
+$fromaddress = OCP\Config::getUserValue($user, 'settings', 'email', 'sharing-noreply@'.OCP\Util::getServerHost());
 OC_Mail::send($_POST['toaddress'], $_POST['toaddress'], $subject, $text, $fromaddress, $user);
 
-?>
\ No newline at end of file
+?>
index 137daa485a90378f2974f3198604458f66766df3..5aaab64285649274fb23fbe94858fbf8678b9264 100644 (file)
@@ -1624,7 +1624,7 @@ if (! array_key_exists('idp_url', $profile))
 //Determine the requested URL - DO NOT OVERRIDE
 $profile['req_url'] = sprintf("%s://%s%s",
                      $proto,
-                     $_SERVER['HTTP_HOST'],
+                     OCP\Util::getServerHost(),
 //                   $port,//host  already includes the path
                      $_SERVER["REQUEST_URI"]);
 
index 8deb42f68c8637acc23bc5612c94a243bb708ffb..3267db3fa0f407f8832dd843afc76ac40f1e3eb0 100644 (file)
@@ -39,9 +39,9 @@ class OC_USER_OPENID extends OC_User_Backend {
                // Get identity from user and redirect browser to OpenID Server
                $openid = new SimpleOpenID;
                $openid->SetIdentity($uid);
-               $openid->SetTrustRoot('http://' . $_SERVER["HTTP_HOST"]);
+               $openid->SetTrustRoot('http://' . OCP\Util::getServerHost());
                if ($openid->GetOpenIDServer()){
-                       $openid->SetApprovedURL('http://' . $_SERVER["HTTP_HOST"] . OC::$WEBROOT);      // Send Response from OpenID server to this script
+                       $openid->SetApprovedURL('http://' . OCP\Util::getServerHost() . OC::$WEBROOT);      // Send Response from OpenID server to this script
                        $openid->Redirect();     // This will redirect user to OpenID Server
                        exit;
                }else{
index 6a4748588fc9755342291554b5726c8d89e427b2..f1d90eaeffea646816d7843555949ac24f80c097 100644 (file)
@@ -22,7 +22,7 @@ if (isset($_POST['user'])) {
                        $tmpl->assign('link', $link);
                        $msg = $tmpl->fetchPage();
                        $l = OC_L10N::get('core');
-                       $from = 'lostpassword-noreply@' . $_SERVER['HTTP_HOST'];
+                       $from = 'lostpassword-noreply@' . OCP\Util::getServerHost();
                        $r=mail($email, $l->t('Owncloud password reset'), $msg, 'From:' . $from);
                        OC_MAIL::send($email,$_POST['user'],$l->t('ownCloud password reset'),$msg,$from,'ownCloud');
                        echo('sent');
index e28eb61987c1f50338603120f7345bb9b0eac741..1be41202d780183b2e5c752449225adeeb0fb161 100644 (file)
@@ -357,11 +357,11 @@ class OC_OCS {
    */
   private static function apiConfig($format) {
     $user=OC_OCS::checkpassword(false);
-    $url=substr($_SERVER['HTTP_HOST'].$_SERVER['SCRIPT_NAME'],0,-11).'';
+    $url=substr(OCP\Util::getServerHost().$_SERVER['SCRIPT_NAME'],0,-11).'';
 
     $xml['version']='1.5';
     $xml['website']='ownCloud';
-    $xml['host']=$_SERVER['HTTP_HOST'];
+    $xml['host']=OCP\Util::getServerHost();
     $xml['contact']='';
     $xml['ssl']='false';
     echo(OC_OCS::generatexml($format,'ok',100,'',$xml,'config','',1));
index 397d2f06f5df098efac1b3fb813408c1026fdc80..adaa28db6cd7feab015713005fb21fe4d7a22031 100644 (file)
@@ -23,7 +23,7 @@
 
 require_once('../lib/base.php');
 
-$url='http://'.substr($_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'],0,-17).'ocs/v1.php/';
+$url='http://'.substr(OCP\Util::getServerHost().$_SERVER['REQUEST_URI'],0,-17).'ocs/v1.php/';
 
 echo('
 <providers>