From 10a3d48be197104d3508f5665ed4baac19aeb637 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20=C4=8Ciha=C5=99?= Date: Wed, 10 Jul 2013 15:21:50 +0200 Subject: [PATCH 1/3] Properly wrap array statements --- libraries/server_privileges.lib.php | 87 +++++++++++++++++++---------- 1 file changed, 58 insertions(+), 29 deletions(-) diff --git a/libraries/server_privileges.lib.php b/libraries/server_privileges.lib.php index 7b8dc0fad2..fd28ce55e9 100644 --- a/libraries/server_privileges.lib.php +++ b/libraries/server_privileges.lib.php @@ -164,121 +164,150 @@ function PMA_getGrantsArray() array( 'Select_priv', 'SELECT', - __('Allows reading data.')), + __('Allows reading data.') + ), array( 'Insert_priv', 'INSERT', - __('Allows inserting and replacing data.')), + __('Allows inserting and replacing data.') + ), array( 'Update_priv', 'UPDATE', - __('Allows changing data.')), + __('Allows changing data.') + ), array( 'Delete_priv', 'DELETE', - __('Allows deleting data.')), + __('Allows deleting data.') + ), array( 'Create_priv', 'CREATE', - __('Allows creating new databases and tables.')), + __('Allows creating new databases and tables.') + ), array( 'Drop_priv', 'DROP', - __('Allows dropping databases and tables.')), + __('Allows dropping databases and tables.') + ), array( 'Reload_priv', 'RELOAD', - __('Allows reloading server settings and flushing the server\'s caches.')), + __('Allows reloading server settings and flushing the server\'s caches.') + ), array( 'Shutdown_priv', 'SHUTDOWN', - __('Allows shutting down the server.')), + __('Allows shutting down the server.') + ), array( 'Process_priv', 'PROCESS', - __('Allows viewing processes of all users')), + __('Allows viewing processes of all users') + ), array( 'File_priv', 'FILE', - __('Allows importing data from and exporting data into files.')), + __('Allows importing data from and exporting data into files.') + ), array( 'References_priv', 'REFERENCES', - __('Has no effect in this MySQL version.')), + __('Has no effect in this MySQL version.') + ), array( 'Index_priv', 'INDEX', - __('Allows creating and dropping indexes.')), + __('Allows creating and dropping indexes.') + ), array( 'Alter_priv', 'ALTER', - __('Allows altering the structure of existing tables.')), + __('Allows altering the structure of existing tables.') + ), array( 'Show_db_priv', 'SHOW DATABASES', - __('Gives access to the complete list of databases.')), + __('Gives access to the complete list of databases.') + ), array( 'Super_priv', 'SUPER', - __('Allows connecting, even if maximum number of connections is reached; required for most administrative operations like setting global variables or killing threads of other users.')), + __('Allows connecting, even if maximum number of connections is reached; required for most administrative operations like setting global variables or killing threads of other users.') + ), array( 'Create_tmp_table_priv', 'CREATE TEMPORARY TABLES', - __('Allows creating temporary tables.')), + __('Allows creating temporary tables.') + ), array( 'Lock_tables_priv', 'LOCK TABLES', - __('Allows locking tables for the current thread.')), + __('Allows locking tables for the current thread.') + ), array( 'Repl_slave_priv', 'REPLICATION SLAVE', - __('Needed for the replication slaves.')), + __('Needed for the replication slaves.') + ), array( 'Repl_client_priv', 'REPLICATION CLIENT', - __('Allows the user to ask where the slaves / masters are.')), + __('Allows the user to ask where the slaves / masters are.') + ), array( 'Create_view_priv', 'CREATE VIEW', - __('Allows creating new views.')), + __('Allows creating new views.') + ), array( 'Event_priv', 'EVENT', - __('Allows to set up events for the event scheduler')), + __('Allows to set up events for the event scheduler') + ), array( 'Trigger_priv', 'TRIGGER', - __('Allows creating and dropping triggers')), + __('Allows creating and dropping triggers') + ), // for table privs: array( 'Create View_priv', 'CREATE VIEW', - __('Allows creating new views.')), + __('Allows creating new views.') + ), array( 'Show_view_priv', 'SHOW VIEW', - __('Allows performing SHOW CREATE VIEW queries.')), + __('Allows performing SHOW CREATE VIEW queries.') + ), // for table privs: array( 'Show view_priv', 'SHOW VIEW', - __('Allows performing SHOW CREATE VIEW queries.')), + __('Allows performing SHOW CREATE VIEW queries.') + ), array( 'Create_routine_priv', 'CREATE ROUTINE', - __('Allows creating stored routines.')), + __('Allows creating stored routines.') + ), array( 'Alter_routine_priv', 'ALTER ROUTINE', - __('Allows altering and dropping stored routines.')), + __('Allows altering and dropping stored routines.') + ), array( 'Create_user_priv', 'CREATE USER', - __('Allows creating, dropping and renaming user accounts.')), + __('Allows creating, dropping and renaming user accounts.') + ), array( 'Execute_priv', 'EXECUTE', - __('Allows executing stored routines.')), + __('Allows executing stored routines.') + ), ); } From 77a229ad9a81f970390030bf5f7911f23338a0f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20=C4=8Ciha=C5=99?= Date: Wed, 10 Jul 2013 15:22:32 +0200 Subject: [PATCH 2/3] Add missing docs --- libraries/server_privileges.lib.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libraries/server_privileges.lib.php b/libraries/server_privileges.lib.php index fd28ce55e9..46a35c6970 100644 --- a/libraries/server_privileges.lib.php +++ b/libraries/server_privileges.lib.php @@ -591,12 +591,12 @@ function PMA_getHtmlForDisplayResourceLimits($row) * @param string $db the database * @param string $table the table * @param boolean $columns columns array - * @param $row + * @param $row current privileges row * * @return string $html_output */ -function PMA_getHtmlForTableSpecificPrivileges($username, $hostname, $db, - $table, $columns, $row +function PMA_getHtmlForTableSpecificPrivileges( + $username, $hostname, $db, $table, $columns, $row ) { $res = $GLOBALS['dbi']->query( 'SELECT `Column_name`, `Column_priv`' From 770daca8a6e8c77b64479610e526db3d61680900 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20=C4=8Ciha=C5=99?= Date: Wed, 10 Jul 2013 15:26:24 +0200 Subject: [PATCH 3/3] Various coding style improvements --- libraries/select_lang.lib.php | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/libraries/select_lang.lib.php b/libraries/select_lang.lib.php index a14f5e897c..df1f0fb91c 100644 --- a/libraries/select_lang.lib.php +++ b/libraries/select_lang.lib.php @@ -12,7 +12,7 @@ if (! defined('PHPMYADMIN')) { /** * Returns language name * - * @param string $tmplang + * @param string $tmplang Language code * * @return string */ @@ -119,7 +119,10 @@ function PMA_langSet(&$lang) /* Partial backward compatibility with 3.3 and older branches */ $lang = str_replace('-utf-8', '', $lang); - if (!is_string($lang) || empty($lang) || empty($GLOBALS['available_languages'][$lang])) { + if (!is_string($lang) + || empty($lang) + || empty($GLOBALS['available_languages'][$lang]) + ) { return false; } $GLOBALS['lang'] = $lang; @@ -343,8 +346,8 @@ function PMA_langDetails($lang) // only TW and HK use traditional Chinese while others (CN, SG, MY) // use simplified Chinese return array( - 'zh(?![-_](tw|hk))([-_][[:alpha:]]{2,3})?|chinese simplified', - 'zh', + 'zh(?![-_](tw|hk))([-_][[:alpha:]]{2,3})?|chinese simplified', + 'zh', '中文' ); } @@ -389,7 +392,8 @@ function PMA_langList() } /** - * @global string path to the translations directory; may be absent if the kit is English-only + * @global string path to the translations directory; + * may be absent if the kit is English-only */ $GLOBALS['lang_path'] = './locale/'; @@ -483,7 +487,10 @@ if (! PMA_langCheck()) { ); // stop execution // and tell the user that his chosen language is invalid - PMA_fatalError('Could not load any language, please check your language settings and folder.'); + PMA_fatalError( + 'Could not load any language, ' + . 'please check your language settings and folder.' + ); } }