diff options
Diffstat (limited to '')
-rw-r--r-- | include/functions_url.inc.php | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/include/functions_url.inc.php b/include/functions_url.inc.php index 02b938ecb..906cf915a 100644 --- a/include/functions_url.inc.php +++ b/include/functions_url.inc.php @@ -794,4 +794,42 @@ function get_gallery_home_url() return make_index_url(); } } + +/** + * returns $_SERVER['QUERY_STRING'] whithout keys given in parameters + * + * @param string[] $rejects + * @param boolean $escape escape *&* to *&* + * @returns string + */ +function get_query_string_diff($rejects=array(), $escape=true) +{ + if (empty($_SERVER['QUERY_STRING'])) + { + return ''; + } + + parse_str($_SERVER['QUERY_STRING'], $vars); + + $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 + or strncmp($url, 'https://', 8)==0 ) + { + return true; + } + return false; +} + ?>
\ No newline at end of file |