--- tablesort-4.6.inc 2006-02-10 13:25:31.858575200 -0500 +++ tablesort.inc 2006-02-10 13:24:05.860226400 -0500 @@ -134,16 +134,38 @@ * A query string that consists of all components of the current page request * except for those pertaining to table sorting. */ -function tablesort_get_querystring() { - $cgi = $_SERVER['REQUEST_METHOD'] == 'GET' ? $_GET : $_POST; +function tablesort_get_querystring() { + $cgi = $_SERVER['REQUEST_METHOD'] == 'GET' ? $_GET : $_POST; + $query_string = ''; + $query_string = _tablesort_get_querystring($cgi); + return $query_string; +} + +/** + * tablesort_get_querystring helper function + * + * @param $cgi + * An array of variables to be converted into a query string. + * @param $prefix + * A string that will prefix the name of variables to make them part of an + * array. + */ +function _tablesort_get_querystring($cgi, $prefix = '') { $query_string = ''; foreach ($cgi as $key => $val) { - if ($key != 'order' && $key != 'sort' && $key != 'q') { - $query_string .= '&'. $key .'='. $val; + $query_key = $prefix == '' ? $key : "${prefix}[${key}]"; + if (gettype($val) == 'array') { + $query_string .= _tablesort_get_querystring($val, $query_key); + } else { + if ($key != 'order' && $key != 'sort' && $key != 'q') { + $query_string .= '&'. $query_key .'='. $val; + } } } return $query_string; -} +} + + /** * Determine the current sort criterion.