X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;ds=inline;f=inc%2Fpoche%2FTools.class.php;h=cc01f4030498ef8127574bad949408f6a24065c2;hb=dc764892213e8d1cb458621910aa8d0ce0a3eb7e;hp=a130e94b6eaa51a89e2460f25fea1a7cd54ca192;hpb=182faf2696b38502d4784efc3f84f2f00290343f;p=github%2Fwallabag%2Fwallabag.git diff --git a/inc/poche/Tools.class.php b/inc/poche/Tools.class.php index a130e94b..cc01f403 100755 --- a/inc/poche/Tools.class.php +++ b/inc/poche/Tools.class.php @@ -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) {