guess url param separator only once;

optionally encode it;
This commit is contained in:
Sebastian Mendel
2007-09-04 13:45:07 +00:00
parent a1549e61d5
commit a064d0cf9c

View File

@@ -200,22 +200,38 @@ function PMA_generate_common_url ($db = '', $table = '', $delim = '&')
/** /**
* Returns url separator * Returns url separator
* *
* @return string character used for separating url parts * @uses ini_get()
* * @uses strpos()
* @uses strlen()
* @param string whether to encode separator or not, currently 'none' or 'html'
* @return string character used for separating url parts usally ; or &
* @access public * @access public
*
* @author nijel * @author nijel
*/ */
function PMA_get_arg_separator() { function PMA_get_arg_separator($encoded = 'none')
{
static $separator = null;
if (null === $separator) {
// use seperators defined by php, but prefer ';' // use seperators defined by php, but prefer ';'
// as recommended by W3C // as recommended by W3C
$php_arg_separator_input = ini_get('arg_separator.input'); $php_arg_separator_input = ini_get('arg_separator.input');
if (strpos($php_arg_separator_input, ';') !== false) { if (strpos($php_arg_separator_input, ';') !== false) {
return ';'; $separator = ';';
} elseif (strlen($php_arg_separator_input) > 0) { } elseif (strlen($php_arg_separator_input) > 0) {
return $php_arg_separator_input{0}; $separator = $php_arg_separator_input{0};
} else { } else {
return '&'; $separator = '&';
}
}
switch ($encoded) {
case 'html':
return htmlentities($separator);
break;
case 'none' :
default :
return $separator;
} }
} }