]> git.immae.eu Git - github/wallabag/wallabag.git/blobdiff - inc/poche/Tools.class.php
minimum of control on server side added
[github/wallabag/wallabag.git] / inc / poche / Tools.class.php
index a130e94b6eaa51a89e2460f25fea1a7cd54ca192..cc01f4030498ef8127574bad949408f6a24065c2 100755 (executable)
@@ -18,8 +18,6 @@ class Tools
             die(_('Oops, it seems you don\'t have PHP 5.'));
         }
 
-        error_reporting(E_ALL);
-
         function stripslashesDeep($value) {
             return is_array($value)
                 ? array_map('stripslashesDeep', $value)
@@ -59,8 +57,14 @@ class Tools
             return $scriptname;
         }
 
+        $host = (isset($_SERVER['HTTP_X_FORWARDED_HOST']) ? $_SERVER['HTTP_X_FORWARDED_HOST'] : (isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : $_SERVER['SERVER_NAME']));
+
+        if (strpos($host, ':') !== false) {
+            $serverport = '';
+        }
+
         return 'http' . ($https ? 's' : '') . '://'
-            . $_SERVER["HTTP_HOST"] . $serverport . $scriptname;
+            . $host . $serverport . $scriptname;
     }
 
     public static function redirect($url = '')
@@ -212,7 +216,7 @@ class Tools
 
     public static function getDomain($url)
     {
-      return parse_url($url, PHP_URL_HOST);
+        return parse_url($url, PHP_URL_HOST);
     }
 
     public static function getReadingTime($text) {