From cd05d15b040569279cd57d0f6070838b469282d6 Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Mon, 27 May 2019 17:18:42 -0400 Subject: [PATCH] Replace build_querystring() by http_build_query() introduced in PHP 5 --- boot.php | 33 --------------------------------- mod/network.php | 2 +- 2 files changed, 1 insertion(+), 34 deletions(-) diff --git a/boot.php b/boot.php index b8705fdf13..eb04732c5d 100644 --- a/boot.php +++ b/boot.php @@ -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, '?'); diff --git a/mod/network.php b/mod/network.php index c8786b2f7b..009f70b606 100644 --- a/mod/network.php +++ b/mod/network.php @@ -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); -- 2.39.5