- sometimes parse_url error workaround

This commit is contained in:
Max Pozdeev 2010-02-20 22:17:15 +03:00
parent 0ef925c80a
commit 7bc64d66e6

View file

@ -145,6 +145,7 @@ function formatDate3($format, $ay, $am, $ad, $lang)
function url_dir($url)
{
if(false !== $p = strpos($url, '?')) $url = substr($url,0,$p); # to avoid parse errors on strange query strings
$p = parse_url($url, PHP_URL_PATH);
if($p == '') return '/';
if(substr($p,-1) == '/') return $p;