diff --git a/libraries/structure.lib.php b/libraries/structure.lib.php index bc5a13d17a..f797bd313a 100644 --- a/libraries/structure.lib.php +++ b/libraries/structure.lib.php @@ -962,18 +962,19 @@ function PMA_sortableTableHeader($title, $sort, $initial_sort_order = 'ASC') $_url_params = array( 'db' => $_REQUEST['db'], + 'pos' => 0, // We set the position back to 0 every time they sort. + 'sort' => $sort, + 'sort_order' => $future_sort_order, ); - - $url = 'db_structure.php' . PMA_URL_getCommon($_url_params); - // We set the position back to 0 every time they sort. - $url .= "&pos=0&sort=$sort&sort_order=$future_sort_order"; - if (! empty($_REQUEST['tbl_type'])) { - $url .= "&tbl_type=" . $_REQUEST['tbl_type']; + if (PMA_isValid($_REQUEST['tbl_type'], array('view', 'table'))) { + $_url_params['tbl_type'] = $_REQUEST['tbl_type']; } if (! empty($_REQUEST['tbl_group'])) { - $url .= "&tbl_group=" . $_REQUEST['tbl_group']; + $_url_params['tbl_group'] = $_REQUEST['tbl_group']; } + $url = 'db_structure.php' . PMA_URL_getCommon($_url_params); + return PMA_Util::linkOrButton( $url, $title . $order_img, $order_link_params );