X-Git-Url: https://vcs.fsf.org/?p=squirrelmail.git;a=blobdiff_plain;f=functions%2Fhtml.php;h=f1722d8e79064e30727022f00361b94ef1ccb96a;hp=2df57f2e7aa0e9550a2e1639a06e7070ae1e5d48;hb=26543a0d5311f0d197fbffde2926db05b8d60277;hpb=4fe67ca69790ddeb9b85be15e2b7a5e9e451ce03 diff --git a/functions/html.php b/functions/html.php index 2df57f2e..f1722d8e 100644 --- a/functions/html.php +++ b/functions/html.php @@ -237,7 +237,7 @@ function create_body($onload='', $class='', $aAttribs=array()) { /** * Generates html tags -//FIXME: This should not be used anywhere in the core, or we should convert this to use templates. We sould not be assuming HTML output. +//FIXME: This should not be used anywhere in the core, or we should convert this to use templates. We should not be assuming HTML output. * * @param string $tag Tag to output * @param string $val Value between tags @@ -313,6 +313,43 @@ function html_tag( $tag, // Tag to output } +/** + * This function is used to add, modify or delete more than + * one GET variable at a time in a URL. This simply takes + * an array of variables (key/value pairs) and passes them + * one at a time to {@link set_url_var}. + * + * Note that the value for any one of the variables may be + * an array, and it will be handled properly. + * + * As with set_url_var, any of the variable values may be + * set to NULL to remove it from the URI. + * + * Also, to ensure compatibility with older versions, use + * $val='0' to set $var to 0. + * + * @param string $uri URI that must be modified + * @param array $values List of GET variable names and their values + * @param boolean $sanitize Controls sanitizing of ampersand in URIs + * + * @return string The modified URI + * + * @since 1.5.2 + * + */ +function set_uri_vars($uri, $values, $sanitize=TRUE) { + foreach ($values as $key => $value) + if (is_array($value)) { + $i = 0; + foreach ($value as $val) + $uri = set_url_var($uri, $key . '[' . $i++ . ']', $val, $sanitize); + } + else + $uri = set_url_var($uri, $key, $value, $sanitize); + return $uri; +} + + /** * This function is used to add, modify or delete GET variables in a URL. * It is especially useful when $url = $PHP_SELF