From 6617a14297ef1f41933f93dfdf4cf5c2b79d76c9 Mon Sep 17 00:00:00 2001 From: Herman van Rink Date: Mon, 25 Apr 2011 14:19:43 +0200 Subject: [PATCH] Add a loop to remove code duplication --- server_privileges.php | 74 ++++++++++++++----------------------------- 1 file changed, 23 insertions(+), 51 deletions(-) diff --git a/server_privileges.php b/server_privileges.php index 09104e15b..1e6aa5a9a 100644 --- a/server_privileges.php +++ b/server_privileges.php @@ -509,6 +509,8 @@ function PMA_displayPrivTable($db = '*', $table = '*', $submit = TRUE) // g l o b a l o r d b - s p e c i f i c // + $privTable_names = array(0 => __('Data'), 1 => __('Structure'), 2 => __('Administration')); + // d a t a $privTable[0] = array( array('Select', 'SELECT', __('Allows reading data.')), @@ -582,59 +584,29 @@ function PMA_displayPrivTable($db = '*', $table = '*', $submit = TRUE) . $GLOBALS['url_query'] . '" onclick="setCheckboxes(\'addUsersForm_' . $random_n . '\', false); return false;">' . __('Uncheck All') . ')' . "\n" . ' ' . "\n" - . '

' . __(' Note: MySQL privilege names are expressed in English ') . '

' . "\n" - . '
' . "\n" - . ' ' . __('Data') . '' . "\n"; - foreach ($privTable[0] as $priv) - { - echo '
' . "\n" - . ' ' . "\n" - . ' ' . "\n" - . '
' . "\n"; - } - echo '
' . "\n" - . '
' . "\n" - . ' ' . __('Structure') . '' . "\n"; - foreach ($privTable[1] as $priv) - { - echo '
' . "\n" - . ' ' . "\n" - . ' ' . "\n" - . '
' . "\n"; - } - echo '
' . "\n" - . '
' . "\n" - . ' ' . __('Administration') . '' . "\n"; - foreach ($privTable[2] as $priv) - { - echo '
' . "\n" - . ' ' . "\n" - . ' ' . "\n" - . '
' . "\n"; + . '

' . __(' Note: MySQL privilege names are expressed in English ') . '

' . "\n"; + + // Output the Global privilege tables + foreach($privTable as $i => $table) { + echo '
' . "\n" + . ' ' . __($privTable_names[$i]) . '' . "\n"; + foreach ($table as $priv) + { + echo '
' . "\n" + . ' ' . "\n" + . ' ' . "\n" + . '
' . "\n"; + } + echo '
' . "\n"; } - echo '
' . "\n"; // The "Resource limits" box is not displayed for db-specific privs if ($db == '*') { echo '
' . "\n"