make get_query_string_diff compatible with arrays and use build-in functions

git-svn-id: http://piwigo.org/svn/trunk@24833 68402e56-0260-453c-a942-63ccdbb3a9ee
This commit is contained in:
mistic100
2013-10-10 10:53:59 +00:00
parent b75d88bdf0
commit 92d692a334
+9 -16
View File
@@ -763,25 +763,18 @@ function get_query_string_diff($rejects=array(), $escape=true)
return '';
}
$query_string = '';
parse_str($_SERVER['QUERY_STRING'], $vars);
$str = $_SERVER['QUERY_STRING'];
parse_str($str, $vars);
$is_first = true;
foreach ($vars as $key => $value)
{
if (!in_array($key, $rejects))
{
$query_string.= $is_first ? '?' : ($escape ? '&' : '&' );
$is_first = false;
$query_string.= $key.'='.$value;
}
}
return $query_string;
$vars = array_diff_key($vars, array_flip($rejects));
return '?' . http_build_query($vars, '', $escape ? '&' : '&');
}
/**
* returns true if the url is absolute (begins with http)
* @param string $url
* @returns boolean
*/
function url_is_remote($url)
{
if ( strncmp($url, 'http://', 7)==0