Replace build_querystring() by http_build_query() introduced in PHP 5

This commit is contained in:
Hypolite Petovan 2019-05-27 17:18:42 -04:00
parent 0fadc7730c
commit cd05d15b04
2 changed files with 1 additions and 34 deletions

View File

@ -534,39 +534,6 @@ function is_site_admin()
return local_user() && $admin_email && in_array(defaults($a->user, 'email', ''), $adminlist);
}
/**
* @brief Returns querystring as string from a mapped array.
*
* @param array $params mapped array with query parameters
* @param string $name of parameter, default null
*
* @return string
*/
function build_querystring($params, $name = null)
{
$ret = "";
foreach ($params as $key => $val) {
if (is_array($val)) {
/// @TODO maybe not compare against null, use is_null()
if ($name == null) {
$ret .= build_querystring($val, $key);
} else {
$ret .= build_querystring($val, $name . "[$key]");
}
} else {
$val = urlencode($val);
/// @TODO maybe not compare against null, use is_null()
if ($name != null) {
/// @TODO two string concated, can be merged to one
$ret .= $name . "[$key]" . "=$val&";
} else {
$ret .= "$key=$val&";
}
}
}
return $ret;
}
function explode_querystring($query)
{
$arg_st = strpos($query, '?');

View File

@ -140,7 +140,7 @@ function network_init(App $a)
if ($remember_tab) {
$net_args = array_merge($query_array, $net_args);
$net_queries = build_querystring($net_args);
$net_queries = http_build_query($net_args);
$redir_url = ($net_queries ? $net_baseurl . '?' . $net_queries : $net_baseurl);