From 8ac9634c7a1a545c4841e5c256bdf68f038d7466 Mon Sep 17 00:00:00 2001 From: Hugues Peccatte Date: Sat, 24 Oct 2015 13:30:22 +0200 Subject: [PATCH] Make PHPCS happy. Signed-off-by: Hugues Peccatte --- libraries/Console.php | 5 +++- libraries/Header.php | 16 +++++++----- libraries/bookmark.lib.php | 31 ++++++++++++++++++----- libraries/build_html_for_db.lib.php | 10 ++++++-- libraries/common.inc.php | 8 ++++-- libraries/config.values.php | 3 ++- libraries/create_addfield.lib.php | 9 +++++-- libraries/db_table_exists.lib.php | 7 ++--- libraries/dbi/DBIDummy.php | 7 +++-- libraries/display_change_password.lib.php | 12 ++++++--- libraries/display_export.lib.php | 26 +++++++++++-------- libraries/display_git_revision.lib.php | 8 ++++-- libraries/display_import.lib.php | 10 ++++++-- libraries/display_import_ajax.lib.php | 15 ++++++----- libraries/export.lib.php | 4 +-- libraries/normalization.lib.php | 4 ++- libraries/operations.lib.php | 3 ++- libraries/rte/rte_events.lib.php | 12 ++++++--- libraries/rte/rte_list.lib.php | 3 ++- libraries/rte/rte_routines.lib.php | 4 ++- 20 files changed, 135 insertions(+), 62 deletions(-) diff --git a/libraries/Console.php b/libraries/Console.php index fff3034e9863..a5a814258815 100644 --- a/libraries/Console.php +++ b/libraries/Console.php @@ -112,7 +112,10 @@ public static function getBookmarkContent() __('shared') ); $output .= sprintf( - /* l10n: First parameter will be replaced with the translation for Total and the number of bookmarks, second one with the translation for private and the third one, with the translation for shared */ + /* l10n: First parameter will be replaced with the translation + for Total and the number of bookmarks, second one with the + translation for private and the third one, with the translation + for shared */ __('%1$s, %2$s and %3$s bookmarks included'), $bookmarks_message, $private_message, diff --git a/libraries/Header.php b/libraries/Header.php index caabb1b97746..c302f5e64b97 100644 --- a/libraries/Header.php +++ b/libraries/Header.php @@ -236,7 +236,7 @@ public function getJsParams() 'db' => $db, 'token' => $_SESSION[' PMA_token '], 'text_dir' => $GLOBALS['text_dir'], - 'show_databases_navigation_as_tree'=> $GLOBALS['cfg']['ShowDatabasesNavigationAsTree'], + 'show_databases_navigation_as_tree' => $GLOBALS['cfg']['ShowDatabasesNavigationAsTree'], 'pma_absolute_uri' => $GLOBALS['cfg']['PmaAbsoluteUri'], 'pma_text_default_tab' => Util::getTitleForTarget( $GLOBALS['cfg']['DefaultTabTable'] @@ -531,8 +531,9 @@ public function sendHttpHeaders() if (!empty($GLOBALS['cfg']['CaptchaLoginPrivateKey']) && !empty($GLOBALS['cfg']['CaptchaLoginPublicKey']) ) { - $captcha_url = ' https://apis.google.com https://www.google.com/recaptcha/' - . ' https://www.gstatic.com/recaptcha/ https://ssl.gstatic.com/ '; + $captcha_url + = ' https://apis.google.com https://www.google.com/recaptcha/' + . ' https://www.gstatic.com/recaptcha/ https://ssl.gstatic.com/ '; } else { $captcha_url = ''; } @@ -593,9 +594,9 @@ public function sendHttpHeaders() header( 'X-XSS-Protection: 1; mode=block' ); - // "nosniff", prevents Internet Explorer and Google Chrome from MIME-sniffing a - // response away from the declared content-type - /// see https://www.owasp.org/index.php/List_of_useful_HTTP_headers + // "nosniff", prevents Internet Explorer and Google Chrome from MIME-sniffing + // a response away from the declared content-type + // see https://www.owasp.org/index.php/List_of_useful_HTTP_headers header( 'X-Content-Type-Options: nosniff' ); @@ -682,7 +683,8 @@ private function _getLinkTags() $retval .= ''; - // load Print view's CSS last, so that it overrides all other CSS while 'printing' + // load Print view's CSS last, so that it overrides all other CSS while + // 'printing' $retval .= ''; } diff --git a/libraries/bookmark.lib.php b/libraries/bookmark.lib.php index 4830a16314be..41684aff0af0 100644 --- a/libraries/bookmark.lib.php +++ b/libraries/bookmark.lib.php @@ -69,10 +69,15 @@ function PMA_Bookmark_getList($db = false) $cfgBookmark['db'] ) . '.' . PMA\libraries\Util::backquote($cfgBookmark['table']) . ' WHERE dbase = \'' . PMA\libraries\Util::sqlAddSlashes($db) . '\'' - . ' AND user = \'' . PMA\libraries\Util::sqlAddSlashes($cfgBookmark['user']) . '\'' + . ' AND user = \'' . PMA\libraries\Util::sqlAddSlashes($cfgBookmark['user']) + . '\'' . ' ORDER BY label'; $per_user = $GLOBALS['dbi']->fetchResult( - $query, 'id', null, $controllink, PMA\libraries\DatabaseInterface::QUERY_STORE + $query, + 'id', + null, + $controllink, + PMA\libraries\DatabaseInterface::QUERY_STORE ); $query = 'SELECT query, label, id FROM ' . PMA\libraries\Util::backquote( @@ -82,7 +87,11 @@ function PMA_Bookmark_getList($db = false) . ' AND user = \'\'' . ' ORDER BY label'; $global = $GLOBALS['dbi']->fetchResult( - $query, 'id', null, $controllink, PMA\libraries\DatabaseInterface::QUERY_STORE + $query, + 'id', + null, + $controllink, + PMA\libraries\DatabaseInterface::QUERY_STORE ); foreach ($global as $key => $val) { @@ -98,7 +107,8 @@ function PMA_Bookmark_getList($db = false) . " FROM " . PMA\libraries\Util::backquote($cfgBookmark['db']) . "." . PMA\libraries\Util::backquote($cfgBookmark['table']) . " WHERE `user` = '' OR" - . " `user` = '" . PMA\libraries\Util::sqlAddSlashes($cfgBookmark['user']) . "'"; + . " `user` = '" . PMA\libraries\Util::sqlAddSlashes($cfgBookmark['user']) + . "'"; $ret = $GLOBALS['dbi']->fetchResult( $query, @@ -191,7 +201,11 @@ function PMA_Bookmark_save($bkm_fields, $all_users = false) . ' VALUES (NULL, \'' . PMA\libraries\Util::sqlAddSlashes($bkm_fields['bkm_database']) . '\', ' . '\'' - . ($all_users ? '' : PMA\libraries\Util::sqlAddSlashes($bkm_fields['bkm_user'])) + . ($all_users + ? '' + : PMA\libraries\Util::sqlAddSlashes( + $bkm_fields['bkm_user'] + )) . '\', ' . '\'' . PMA\libraries\Util::sqlAddSlashes(urldecode($bkm_fields['bkm_sql_query'])) @@ -224,7 +238,8 @@ function PMA_Bookmark_delete($id) $query = 'DELETE FROM ' . PMA\libraries\Util::backquote($cfgBookmark['db']) . '.' . PMA\libraries\Util::backquote($cfgBookmark['table']) - . ' WHERE (user = \'' . PMA\libraries\Util::sqlAddSlashes($cfgBookmark['user']) . '\'' + . ' WHERE (user = \'' + . PMA\libraries\Util::sqlAddSlashes($cfgBookmark['user']) . '\'' . ' OR user = \'\')' . ' AND id = ' . $id; return $GLOBALS['dbi']->tryQuery($query, $controllink); @@ -264,7 +279,9 @@ function PMA_Bookmark_applyVariables($query) for ($i = 1; $i <= $number_of_variables; $i++) { $var = ''; if (! empty($_REQUEST['bookmark_variable'][$i])) { - $var = PMA\libraries\Util::sqlAddSlashes($_REQUEST['bookmark_variable'][$i]); + $var = PMA\libraries\Util::sqlAddSlashes( + $_REQUEST['bookmark_variable'][$i] + ); } $query = str_replace('[VARIABLE' . $i . ']', $var, $query); // backward compatibility diff --git a/libraries/build_html_for_db.lib.php b/libraries/build_html_for_db.lib.php index 6f1eface1435..a2df78b2909d 100644 --- a/libraries/build_html_for_db.lib.php +++ b/libraries/build_html_for_db.lib.php @@ -143,7 +143,10 @@ function PMA_buildHtmlForDb( $replication_info[$type]['Ignore_DB'] ); if (/*overload*/mb_strlen($key) > 0) { - $out .= PMA\libraries\Util::getIcon('s_cancel.png', __('Not replicated')); + $out .= PMA\libraries\Util::getIcon( + 's_cancel.png', + __('Not replicated') + ); } else { $key = array_search( $current["SCHEMA_NAME"], $replication_info[$type]['Do_DB'] @@ -155,7 +158,10 @@ function PMA_buildHtmlForDb( && count($replication_info[$type]['Do_DB']) == 1) ) { // if ($key != null) did not work for index "0" - $out .= PMA\libraries\Util::getIcon('s_success.png', __('Replicated')); + $out .= PMA\libraries\Util::getIcon( + 's_success.png', + __('Replicated') + ); } } diff --git a/libraries/common.inc.php b/libraries/common.inc.php index ca916fc92d37..7f68a3a37cdf 100644 --- a/libraries/common.inc.php +++ b/libraries/common.inc.php @@ -56,7 +56,10 @@ * PHP 5 function, so cannot easily localize this message. */ if (version_compare(PHP_VERSION, '5.5.0', 'lt')) { - die('PHP 5.5+ is required.
Currently installed version is: ' . phpversion()); + die( + 'PHP 5.5+ is required.
Currently installed version is: ' + . phpversion() + ); } /** @@ -804,7 +807,8 @@ // get LoginCookieValidity from preferences cache // no generic solution for loading preferences from cache as some settings - // need to be kept for processing in PMA\libraries\Config::loadUserPreferences() + // need to be kept for processing in + // PMA\libraries\Config::loadUserPreferences() $cache_key = 'server_' . $GLOBALS['server']; if (isset($_SESSION['cache'][$cache_key]['userprefs']['LoginCookieValidity']) ) { diff --git a/libraries/config.values.php b/libraries/config.values.php index 54735b49a752..bc7786fc1718 100644 --- a/libraries/config.values.php +++ b/libraries/config.values.php @@ -99,7 +99,8 @@ 'D' => __('display column') ); $cfg_db['DefaultTabServer'] = array( - 'welcome' => __('Welcome'), // the welcome page (recommended for multiuser setups) + // the welcome page (recommended for multiuser setups) + 'welcome' => __('Welcome'), 'databases' => __('Databases'), // list of databases 'status' => __('Status'), // runtime information 'variables' => __('Variables'), // MySQL server variables diff --git a/libraries/create_addfield.lib.php b/libraries/create_addfield.lib.php index 3f02fbc9cbcc..e25aa8c5bbf5 100644 --- a/libraries/create_addfield.lib.php +++ b/libraries/create_addfield.lib.php @@ -190,7 +190,8 @@ function PMA_buildIndexStatements($index, $index_choice, $comment = $index['Index_comment']; if (! empty($comment)) { - $sql_query .= " COMMENT '" . PMA\libraries\Util::sqlAddSlashes($comment) . "'"; + $sql_query .= " COMMENT '" . PMA\libraries\Util::sqlAddSlashes($comment) + . "'"; } $statement[] = $sql_query; @@ -385,7 +386,11 @@ function PMA_getPartitionDefinition($name, $partition, $isSubPartition = false) $j = 0; $subpartitions = array(); foreach ($partition['subpartitions'] as $subpartition) { - $subpartitions[] = PMA_getPartitionDefinition($name . 's' . $j, $subpartition, true); + $subpartitions[] = PMA_getPartitionDefinition( + $name . 's' . $j, + $subpartition, + true + ); $j++; } $sql_query .= " (" . implode(", ", $subpartitions) . ")"; diff --git a/libraries/db_table_exists.lib.php b/libraries/db_table_exists.lib.php index 71f9e4c5bfb6..736d8bfc3b05 100644 --- a/libraries/db_table_exists.lib.php +++ b/libraries/db_table_exists.lib.php @@ -64,8 +64,8 @@ if (! $is_table) { $_result = $GLOBALS['dbi']->tryQuery( - 'SHOW TABLES LIKE \'' . PMA\libraries\Util::sqlAddSlashes($table, true) - . '\';', + 'SHOW TABLES LIKE \'' + . PMA\libraries\Util::sqlAddSlashes($table, true) . '\';', null, PMA\libraries\DatabaseInterface::QUERY_STORE ); $is_table = @$GLOBALS['dbi']->numRows($_result); @@ -87,7 +87,8 @@ * only happen if IS_TRANSFORMATION_WRAPPER? */ $_result = $GLOBALS['dbi']->tryQuery( - 'SELECT COUNT(*) FROM ' . PMA\libraries\Util::backquote($table) . ';', + 'SELECT COUNT(*) FROM ' . PMA\libraries\Util::backquote($table) + . ';', null, PMA\libraries\DatabaseInterface::QUERY_STORE ); diff --git a/libraries/dbi/DBIDummy.php b/libraries/dbi/DBIDummy.php index acb5b3f50303..7e86279cad7a 100644 --- a/libraries/dbi/DBIDummy.php +++ b/libraries/dbi/DBIDummy.php @@ -606,7 +606,9 @@ ), array( 'query' => 'SELECT @@default_authentication_plugin', - 'result' => array(array('@@default_authentication_plugin' => 'mysql_native_password')) + 'result' => array( + array('@@default_authentication_plugin' => 'mysql_native_password') + ), ), array( 'query' => "SELECT TABLE_NAME FROM information_schema.VIEWS WHERE " @@ -647,7 +649,8 @@ ), array( 'query' => "SELECT `PLUGIN_NAME`, `PLUGIN_DESCRIPTION` " - . "FROM `information_schema`.`PLUGINS` WHERE `PLUGIN_TYPE` = 'AUTHENTICATION';", + . "FROM `information_schema`.`PLUGINS` " + . "WHERE `PLUGIN_TYPE` = 'AUTHENTICATION';", 'result' => array() ) ); diff --git a/libraries/display_change_password.lib.php b/libraries/display_change_password.lib.php index 782762185898..b294d1a21369 100644 --- a/libraries/display_change_password.lib.php +++ b/libraries/display_change_password.lib.php @@ -113,15 +113,19 @@ function PMA_getHtmlForChangePassword($mode, $username, $hostname) . ''; $html .= '
' . Message::notice( __( 'This method requires using an \'SSL connection\' ' - . 'or an \'unencrypted connection that encrypts the password ' - . 'using RSA\'; while connecting to the server.' + . 'or an \'unencrypted connection that encrypts the ' + . 'password using RSA\'; while connecting to the server.' + ) + . PMA\libraries\Util::showMySQLDocu( + 'sha256-authentication-plugin' ) - . PMA\libraries\Util::showMySQLDocu('sha256-authentication-plugin') ) ->getDisplay() . '
'; diff --git a/libraries/display_export.lib.php b/libraries/display_export.lib.php index b12eb9cb30dc..dd858b28db34 100644 --- a/libraries/display_export.lib.php +++ b/libraries/display_export.lib.php @@ -253,21 +253,24 @@ function PMA_getOptionsForExportTemplates($export_type) . PMA\libraries\Util::backquote($cfgRelation['db']) . '.' . PMA\libraries\Util::backquote($cfgRelation['export_templates']) . " WHERE `username` = " - . "'" . PMA\libraries\Util::sqlAddSlashes($GLOBALS['cfg']['Server']['user']) . "'" - . " AND `export_type` = '" . $export_type . "'" + . "'" . PMA\libraries\Util::sqlAddSlashes($GLOBALS['cfg']['Server']['user']) + . "' AND `export_type` = '" . $export_type . "'" . " ORDER BY `template_name`;"; $result = PMA_queryAsControlUser($query); - if ($result) { - while ($row = $GLOBALS['dbi']->fetchAssoc($result, $GLOBALS['controllink'])) { - $ret .= '