From 9210a1acc95a3dc7956d4addfdede75efae84c21 Mon Sep 17 00:00:00 2001 From: Thilina Buddika Date: Wed, 18 Jul 2012 07:48:44 +0530 Subject: [PATCH] remove global variables --- libraries/server_privileges.lib.php | 20 ++++++++++---------- server_privileges.php | 9 ++++++--- 2 files changed, 16 insertions(+), 13 deletions(-) diff --git a/libraries/server_privileges.lib.php b/libraries/server_privileges.lib.php index 1198d52e64..2b83f07cd5 100644 --- a/libraries/server_privileges.lib.php +++ b/libraries/server_privileges.lib.php @@ -1484,7 +1484,6 @@ function PMA_getListOfPrivilegesAndComparedPrivileges() /** * Get the HTML for user form and check the privileges for a particular database. * - * @param string $dbToCheck database to check for privileges * @param string $link_edit standard link for edit * @param string $conditional_class if ajaxable 'Ajax' otherwise '' * @@ -1501,8 +1500,8 @@ function PMA_getHtmlForSpecificDbPrivileges($dbToCheck, $link_edit, $conditional . sprintf( __('Users having access to "%s"'), '' - . htmlspecialchars($dbToCheck) + . PMA_generate_common_url($_REQUEST['checkprivs']) . '">' + . htmlspecialchars($_REQUEST['checkprivs']) . '' ) . "\n" @@ -1525,7 +1524,7 @@ function PMA_getHtmlForSpecificDbPrivileges($dbToCheck, $link_edit, $conditional $sql_query = '(SELECT ' . $list_of_privileges . ', `Db`' .' FROM `mysql`.`db`' - .' WHERE \'' . $common_functions->sqlAddSlashes($dbToCheck) . "'" + .' WHERE \'' . $common_functions->sqlAddSlashes($_REQUEST['checkprivs']) . "'" .' LIKE `Db`' .' AND NOT (' . $list_of_compared_privileges. ')) ' .'UNION ' @@ -1541,7 +1540,7 @@ function PMA_getHtmlForSpecificDbPrivileges($dbToCheck, $link_edit, $conditional $found = true; } $html_output .= PMA_getHtmlTableBodyForSpecificDbPrivs( - $found, $row, $odd_row, $link_edit, $res, $dbToCheck + $found, $row, $odd_row, $link_edit, $res ); $html_output .= '' . '' @@ -1560,9 +1559,9 @@ function PMA_getHtmlForSpecificDbPrivileges($dbToCheck, $link_edit, $conditional $html_output .= '' . "\n" . $common_functions->getIcon('b_usradd.png') @@ -1581,12 +1580,11 @@ function PMA_getHtmlForSpecificDbPrivileges($dbToCheck, $link_edit, $conditional * @param boolean $odd_row whether odd or not * @param string $link_edit standard link for edit * @param string $res ran sql query - * @param string $dbToCheck database to check for privileges * * @return string $html_output */ function PMA_getHtmlTableBodyForSpecificDbPrivs($found, $row, $odd_row, - $link_edit, $res, $dbToCheck + $link_edit, $res ) { $html_output = '' . "\n"; if ($found) { @@ -1626,7 +1624,9 @@ function PMA_getHtmlTableBodyForSpecificDbPrivs($found, $row, $odd_row, if (! isset($current['Db']) || $current['Db'] == '*') { $html_output .= __('global'); } elseif ( - $current['Db'] == PMA_CommonFunctions::getInstance()->escapeMysqlWildcards($dbToCheck) + $current['Db'] == PMA_CommonFunctions::getInstance()->escapeMysqlWildcards( + $_REQUEST['checkprivs'] + ) ) { $html_output .= __('database-specific'); } else { diff --git a/server_privileges.php b/server_privileges.php index 56d4faa5d9..8f5c23e70a 100644 --- a/server_privileges.php +++ b/server_privileges.php @@ -476,7 +476,7 @@ if ($GLOBALS['is_ajax_request'] * Displays the links */ if (isset($viewing_mode) && $viewing_mode == 'db') { - $db = $checkprivs; + $db = $_REQUEST['checkprivs']; $url_query .= '&goto=db_operations.php'; // Gets the database structure @@ -512,7 +512,10 @@ if (isset($_REQUEST['export']) } } -if (empty($_REQUEST['adduser']) && (! isset($checkprivs) || ! strlen($checkprivs))) { +if (empty($_REQUEST['adduser']) + && (! isset($_REQUEST['checkprivs']) + || ! strlen($_REQUEST['checkprivs'])) +) { if (! isset($username)) { // No username is given --> display the overview $response->addHTML( @@ -549,7 +552,7 @@ if (empty($_REQUEST['adduser']) && (! isset($checkprivs) || ! strlen($checkprivs } else { // check the privileges for a particular database. $response->addHTML( - PMA_getHtmlForSpecificDbPrivileges($checkprivs, $link_edit, $conditional_class) + PMA_getHtmlForSpecificDbPrivileges($link_edit, $conditional_class) ); } // end if (empty($_REQUEST['adduser']) && empty($checkprivs)) ... elseif ... else ...