X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;ds=sidebyside;f=lib%2Futil.php;h=a061d17739356cc0bc9643a39bec2106513b7efb;hb=ab053fe2ca8bb2be76d6af0d313f38d89540d768;hp=75037625d095e808125580d8d893d1c0e8c65a62;hpb=12588b1cf73fad7d0a76a29a46ec355150eaa54e;p=quix0rs-gnu-social.git diff --git a/lib/util.php b/lib/util.php index 75037625d0..a061d17739 100644 --- a/lib/util.php +++ b/lib/util.php @@ -1307,11 +1307,11 @@ function common_inject_session($url, $serverpart = null) { if (common_have_session()) { - if (empty($serverpart)) { - $serverpart = parse_url($url, PHP_URL_HOST); - } + if (empty($serverpart)) { + $serverpart = parse_url($url, PHP_URL_HOST); + } - $currentServer = $_SERVER['HTTP_HOST']; + $currentServer = (array_key_exists('HTTP_HOST', $_SERVER)) ? $_SERVER['HTTP_HOST'] : null; // Are we pointing to another server (like an SSL server?) @@ -2163,7 +2163,11 @@ function common_shorten_url($long_url, User $user=null, $force = false) } else { $shortenedUrl = common_local_url('redirecturl', array('id' => $f->id)); - return $shortenedUrl; + if ((mb_strlen($shortenedUrl) < mb_strlen($long_url)) || $force) { + return $shortenedUrl; + } else { + return $long_url; + } } } else { return $long_url;