diff options
author | mistic100 <mistic@piwigo.org> | 2013-10-10 10:53:59 +0000 |
---|---|---|
committer | mistic100 <mistic@piwigo.org> | 2013-10-10 10:53:59 +0000 |
commit | 92d692a3349b0fb9b8e16d31085dc0a5e2ac9190 (patch) | |
tree | a3fa81261b85e7e60688478b4f8a91023d2a9b13 | |
parent | b75d88bdf06756f87d660ed1e44aff39eeb915b1 (diff) |
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
-rw-r--r-- | include/functions.inc.php | 25 |
1 files changed, 9 insertions, 16 deletions
diff --git a/include/functions.inc.php b/include/functions.inc.php index ac20b73bb..be6c57114 100644 --- a/include/functions.inc.php +++ b/include/functions.inc.php @@ -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 |