From 3fe20b3cdf59f3f24b5fcb17e8c3600a30568f3d Mon Sep 17 00:00:00 2001 From: Madhura Jayaratne Date: Mon, 27 Apr 2015 17:46:51 +0530 Subject: [PATCH 1/8] Exclude sql-formatter Signed-off-by: Madhura Jayaratne --- build.xml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/build.xml b/build.xml index 41ab34e7ec..de75690b79 100644 --- a/build.xml +++ b/build.xml @@ -55,7 +55,7 @@ @@ -73,6 +73,7 @@ --exclude libraries/phpseclib --exclude libraries/plugins/auth/recaptchalib.php --exclude libraries/plugins/auth/swekey/swekey.php + --exclude libraries/sql-formatter/ ${source}" /> @@ -90,6 +91,7 @@ --exclude libraries/phpseclib --exclude libraries/plugins/auth/recaptchalib.php --exclude libraries/plugins/auth/swekey/swekey.php + --exclude libraries/sql-formatter/ ${source}" /> @@ -97,7 +99,7 @@ ' . PMA_getHtmlForColumnNull($row_num, 6, 0, array('Null'=>$row['col_isNull'])) . ''; - + $tableHtml .= '' . PMA_getHtmlForColumnExtra( diff --git a/libraries/display_import.lib.php b/libraries/display_import.lib.php index 76dbb69fac..b15341ab44 100644 --- a/libraries/display_import.lib.php +++ b/libraries/display_import.lib.php @@ -235,7 +235,7 @@ function PMA_getHtmlForImportOptionsFile($max_upload_size, $import_list) $html .= ' _getPaginationParamsHtml($node); if ($GLOBALS['cfg']['ShowDatabasesNavigationAsTree'] - || $parentName != 'root' + || $parentName != 'root' ) { $retval .= $node->getIcon($match); } diff --git a/libraries/server_status_processes.lib.php b/libraries/server_status_processes.lib.php index e0e1ec7189..19ca6bb684 100644 --- a/libraries/server_status_processes.lib.php +++ b/libraries/server_status_processes.lib.php @@ -126,16 +126,16 @@ function PMA_getHtmlForServerProcesslist() $sql_query = $show_full_sql ? 'SHOW FULL PROCESSLIST' : 'SHOW PROCESSLIST'; - if ( (! empty($_REQUEST['order_by_field']) - && ! empty($_REQUEST['sort_order']) ) - || (! empty($_REQUEST['showExecuting']) ) + if ((! empty($_REQUEST['order_by_field']) + && ! empty($_REQUEST['sort_order'])) + || (! empty($_REQUEST['showExecuting'])) ) { $sql_query = 'SELECT * FROM `INFORMATION_SCHEMA`.`PROCESSLIST` '; } if (! empty($_REQUEST['showExecuting'])) { $sql_query .= ' WHERE state = "executing" '; } - if (! empty($_REQUEST['order_by_field']) && ! empty($_REQUEST['sort_order']) ) { + if (! empty($_REQUEST['order_by_field']) && ! empty($_REQUEST['sort_order'])) { $sql_query .= ' ORDER BY ' . PMA_Util::backquote($_REQUEST['order_by_field']) . ' ' . $_REQUEST['sort_order']; @@ -272,7 +272,7 @@ function PMA_getHtmlForServerProcessItem($process, $odd_row, $show_full_sql) { // Array keys need to modify due to the way it has used // to display column values - if ( (! empty($_REQUEST['order_by_field']) && ! empty($_REQUEST['sort_order']) ) + if ((! empty($_REQUEST['order_by_field']) && ! empty($_REQUEST['sort_order'])) || (! empty($_REQUEST['showExecuting'])) ) { foreach (array_keys($process) as $key) { From fb52e6af04e9c87ee2b31d74dfcb7b14bbe4f14a Mon Sep 17 00:00:00 2001 From: Madhura Jayaratne Date: Mon, 27 Apr 2015 17:57:36 +0530 Subject: [PATCH 3/8] Closing parenthesis of a multi-line function call must be on a line by itself Signed-off-by: Madhura Jayaratne --- js/get_image.js.php | 8 +++++--- js/get_scripts.js.php | 8 +++++--- js/messages.php | 8 +++++--- js/whitelist.php | 8 +++++--- libraries/Console.class.php | 6 ++++-- libraries/Header.class.php | 6 ++++-- phpmyadmin.css.php | 8 +++++--- 7 files changed, 33 insertions(+), 19 deletions(-) diff --git a/js/get_image.js.php b/js/get_image.js.php index 7ac1ffd410..19c57c0308 100644 --- a/js/get_image.js.php +++ b/js/get_image.js.php @@ -20,9 +20,11 @@ require_once './libraries/common.inc.php'; require_once './libraries/OutputBuffering.class.php'; $buffer = PMA_OutputBuffering::getInstance(); $buffer->start(); -register_shutdown_function(function() { - echo PMA_OutputBuffering::getInstance()->getContents(); -}); +register_shutdown_function( + function() { + echo PMA_OutputBuffering::getInstance()->getContents(); + } +); // Get the data for the sprites, if it's available if (is_readable($_SESSION['PMA_Theme']->getPath() . '/sprites.lib.php')) { diff --git a/js/get_scripts.js.php b/js/get_scripts.js.php index 61777297d9..c2cf8204b6 100644 --- a/js/get_scripts.js.php +++ b/js/get_scripts.js.php @@ -29,9 +29,11 @@ require_once './libraries/common.inc.php'; include_once './libraries/OutputBuffering.class.php'; $buffer = PMA_OutputBuffering::getInstance(); $buffer->start(); -register_shutdown_function(function() { - echo PMA_OutputBuffering::getInstance()->getContents(); -}); +register_shutdown_function( + function() { + echo PMA_OutputBuffering::getInstance()->getContents(); + } +); $_GET['scripts'] = json_decode($_GET['scripts']); if (! empty($_GET['scripts']) && is_array($_GET['scripts'])) { diff --git a/js/messages.php b/js/messages.php index 7487cc1d1f..000d159821 100644 --- a/js/messages.php +++ b/js/messages.php @@ -29,9 +29,11 @@ require_once './libraries/Util.class.php'; require_once './libraries/OutputBuffering.class.php'; $buffer = PMA_OutputBuffering::getInstance(); $buffer->start(); -register_shutdown_function(function() { - echo PMA_OutputBuffering::getInstance()->getContents(); -}); +register_shutdown_function( + function() { + echo PMA_OutputBuffering::getInstance()->getContents(); + } +); $js_messages['strNoDropDatabases'] = __('"DROP DATABASE" statements are disabled.'); if ($cfg['AllowUserDropDatabase']) { diff --git a/js/whitelist.php b/js/whitelist.php index b6793d525e..85b411c11e 100644 --- a/js/whitelist.php +++ b/js/whitelist.php @@ -25,9 +25,11 @@ session_write_close(); require_once './libraries/OutputBuffering.class.php'; $buffer = PMA_OutputBuffering::getInstance(); $buffer->start(); -register_shutdown_function(function() { - echo PMA_OutputBuffering::getInstance()->getContents(); -}); +register_shutdown_function( + function() { + echo PMA_OutputBuffering::getInstance()->getContents(); + } +); echo "var PMA_gotoWhitelist = new Array();\n"; $i = -1; diff --git a/libraries/Console.class.php b/libraries/Console.class.php index db9d66341f..122854a3e8 100644 --- a/libraries/Console.class.php +++ b/libraries/Console.class.php @@ -307,8 +307,10 @@ class PMA_Console . '
' . '
' + . __( + 'Execute queries on Enter and insert new line with Shift + Enter. ' + . 'To make this permanent, view settings.' + ) . '
' . '
' . ''; diff --git a/libraries/Header.class.php b/libraries/Header.class.php index 7847a16481..4064a235c1 100644 --- a/libraries/Header.class.php +++ b/libraries/Header.class.php @@ -404,8 +404,10 @@ class PMA_Header $this->_scripts->addFile('codemirror/addon/hint/show-hint.js'); $this->_scripts->addFile('codemirror/addon/hint/sql-hint.js'); } - $this->_scripts->addCode('ConsoleEnterExecutes=' - . ($GLOBALS['cfg']['ConsoleEnterExecutes'] ? 'true' : 'false')); + $this->_scripts->addCode( + 'ConsoleEnterExecutes=' + . ($GLOBALS['cfg']['ConsoleEnterExecutes'] ? 'true' : 'false') + ); $this->_scripts->addFiles($this->_console->getScripts()); if ($this->_userprefsOfferImport) { $this->_scripts->addFile('config.js'); diff --git a/phpmyadmin.css.php b/phpmyadmin.css.php index 6516d5c6ce..52866b45f9 100644 --- a/phpmyadmin.css.php +++ b/phpmyadmin.css.php @@ -23,9 +23,11 @@ if (PMA_USR_BROWSER_AGENT == 'IE' && PMA_USR_BROWSER_VER == '6' include_once 'libraries/OutputBuffering.class.php'; $buffer = PMA_OutputBuffering::getInstance(); $buffer->start(); - register_shutdown_function(function() { - echo PMA_OutputBuffering::getInstance()->getContents(); - }); + register_shutdown_function( + function() { + echo PMA_OutputBuffering::getInstance()->getContents(); + } + ); } // Send correct type: From 90120e1cc0612761beca5e7d1859be442d5f684f Mon Sep 17 00:00:00 2001 From: Madhura Jayaratne Date: Mon, 27 Apr 2015 17:59:11 +0530 Subject: [PATCH 4/8] Space after foreach Signed-off-by: Madhura Jayaratne --- libraries/export.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/export.lib.php b/libraries/export.lib.php index 6212f12fd3..7cbc3bd8e7 100644 --- a/libraries/export.lib.php +++ b/libraries/export.lib.php @@ -893,7 +893,7 @@ function PMA_mergeAliases($aliases1, $aliases2) function PMA_lockTables($db, $tables, $lockType = "WRITE") { $locks = array(); - foreach($tables as $table) { + foreach ($tables as $table) { $locks[] = PMA_Util::backquote($db) . "." . PMA_Util::backquote($table) . " " . $lockType; } From 7c82094f60d8bee56d127cab111a57e8cc085844 Mon Sep 17 00:00:00 2001 From: Madhura Jayaratne Date: Mon, 27 Apr 2015 18:00:49 +0530 Subject: [PATCH 5/8] Do not use inline control structures Signed-off-by: Madhura Jayaratne --- libraries/plugins/export/PMA_ExportPdf.class.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libraries/plugins/export/PMA_ExportPdf.class.php b/libraries/plugins/export/PMA_ExportPdf.class.php index fb606940a3..cf48dba751 100644 --- a/libraries/plugins/export/PMA_ExportPdf.class.php +++ b/libraries/plugins/export/PMA_ExportPdf.class.php @@ -287,7 +287,9 @@ class PMA_ExportPdf extends PMA_PDF foreach ($triggers as $trigger) { $i++; break; } - if ($i==0) return; //prevents printing blank trigger list for any table + if ($i == 0) { + return; //prevents printing blank trigger list for any table + } unset($this->tablewidths); unset($this->colTitles); From 3d85296d79135107c77d66ebb361311a95f35fc2 Mon Sep 17 00:00:00 2001 From: Madhura Jayaratne Date: Mon, 27 Apr 2015 18:06:36 +0530 Subject: [PATCH 6/8] Spaces around assignments Signed-off-by: Madhura Jayaratne --- db_central_columns.php | 2 +- libraries/DisplayResults.class.php | 2 +- libraries/error_report.lib.php | 2 +- libraries/insert_edit.lib.php | 4 ++-- libraries/normalization.lib.php | 8 ++++---- .../plugins/export/PMA_ExportPdf.class.php | 2 +- .../plugins/export/TableProperty.class.php | 2 +- libraries/rte/rte_list.lib.php | 2 +- libraries/rte/rte_routines.lib.php | 20 +++++++++---------- libraries/server_status_monitor.lib.php | 2 +- libraries/server_status_variables.lib.php | 2 +- libraries/sqlparser.lib.php | 10 +++++----- libraries/tbl_views.lib.php | 2 +- 13 files changed, 30 insertions(+), 30 deletions(-) diff --git a/db_central_columns.php b/db_central_columns.php index 0d9bdc8b95..d6a70f6b08 100644 --- a/db_central_columns.php +++ b/db_central_columns.php @@ -131,7 +131,7 @@ $tableheader = PMA_getCentralColumnsTableHeader( $response->addHTML($tableheader); $result = PMA_getColumnsList($db, $pos, $max_rows); $odd_row = true; -$row_num=0; +$row_num = 0; foreach ($result as $row) { $tableHtmlRow = PMA_getHTMLforCentralColumnsTableRow( $row, $odd_row, $row_num, $db diff --git a/libraries/DisplayResults.class.php b/libraries/DisplayResults.class.php index b6ab402c0e..59000a6abc 100644 --- a/libraries/DisplayResults.class.php +++ b/libraries/DisplayResults.class.php @@ -4211,7 +4211,7 @@ class PMA_DisplayResults $map = array(); // find tables - $target=array(); + $target = array(); if (isset($analyzed_sql[0]['table_ref']) && is_array($analyzed_sql[0]['table_ref']) ) { diff --git a/libraries/error_report.lib.php b/libraries/error_report.lib.php index 9a9768a410..fbef2101c8 100644 --- a/libraries/error_report.lib.php +++ b/libraries/error_report.lib.php @@ -95,7 +95,7 @@ function PMA_getReportData($exception_type = 'js') } elseif ($exception_type == 'php') { $errors = array(); // create php error report - $i=0; + $i = 0; if (!isset($_SESSION['prev_errors']) || $_SESSION['prev_errors'] == '' ) { diff --git a/libraries/insert_edit.lib.php b/libraries/insert_edit.lib.php index 227fb7c5af..61594ff596 100644 --- a/libraries/insert_edit.lib.php +++ b/libraries/insert_edit.lib.php @@ -2786,11 +2786,11 @@ function PMA_getHtmlForInsertEditFormColumn($table_columns, $i, $column, // HTML attribute //add data attributes "no of decimals" and "data type" - $no_decimals=0; + $no_decimals = 0; $type = current(explode("(", $column['pma_type'])); if (preg_match('/\(([^()]+)\)/', $column['pma_type'], $match)) { $match[0] = trim($match[0], '()'); - $no_decimals=$match[0]; + $no_decimals = $match[0]; } $html_output .= '' . "\n"; diff --git a/libraries/normalization.lib.php b/libraries/normalization.lib.php index f06a80d52d..f0611c2d1a 100644 --- a/libraries/normalization.lib.php +++ b/libraries/normalization.lib.php @@ -336,7 +336,7 @@ function PMA_getHtmlFor2NFstep1($db, $table) . 'whose values combined together are sufficient' . ' to determine the value of the column.' ); - $cnt=0; + $cnt = 0; foreach ($columns as $column) { if (!in_array($column, $pk)) { $cnt++; @@ -383,7 +383,7 @@ function PMA_getHtmlForNewTables2NF($partialDependencies,$table) ), htmlspecialchars($table) ) . '

'; $tableName = $table; - $i=1; + $i = 1; foreach ($partialDependencies as $key=>$dependents) { $html .= '

' @@ -483,7 +483,7 @@ function PMA_createNewTablesFor2NF($partialDependencies, $tablesName, $table, $d function PMA_getHtmlForNewTables3NF($dependencies, $tables, $db) { $html = ""; - $i=1; + $i = 1; $newTables = array(); foreach ($tables as $table=>$arrDependson) { if (count(array_unique($arrDependson)) == 1) { @@ -699,7 +699,7 @@ function PMA_getHtmlFor3NFstep1($db, $tables) . 'Note: A column may have no transitive dependency, ' . 'in that case you don\'t have to select any.' ); - $cnt=0; + $cnt = 0; foreach ($tables as $key=>$table) { $primary = PMA_Index::getPrimary($table, $db); $primarycols = $primary->getColumns(); diff --git a/libraries/plugins/export/PMA_ExportPdf.class.php b/libraries/plugins/export/PMA_ExportPdf.class.php index cf48dba751..dc69531286 100644 --- a/libraries/plugins/export/PMA_ExportPdf.class.php +++ b/libraries/plugins/export/PMA_ExportPdf.class.php @@ -282,7 +282,7 @@ class PMA_ExportPdf extends PMA_PDF */ public function getTriggers($db, $table) { - $i=0; + $i = 0; $triggers = $GLOBALS['dbi']->getTriggers($db, $table); foreach ($triggers as $trigger) { $i++; break; diff --git a/libraries/plugins/export/TableProperty.class.php b/libraries/plugins/export/TableProperty.class.php index 16d4c5b578..81b7ea478e 100644 --- a/libraries/plugins/export/TableProperty.class.php +++ b/libraries/plugins/export/TableProperty.class.php @@ -199,7 +199,7 @@ class TableProperty */ function isPK() { - return $this->key=="PRI"; + return $this->key == "PRI"; } /** diff --git a/libraries/rte/rte_list.lib.php b/libraries/rte/rte_list.lib.php index 7b7ab3d4e5..79eb07576d 100644 --- a/libraries/rte/rte_list.lib.php +++ b/libraries/rte/rte_list.lib.php @@ -184,7 +184,7 @@ function PMA_RTN_getRowForList($routine, $rowclass = '') if ($routine !== false) { if (PMA_Util::currentUserHasPrivilege('EXECUTE', $db)) { $execute_action = 'execute_routine'; - for ($i=0; $i<$routine_details['item_num_params']; $i++) { + for ($i = 0; $i<$routine_details['item_num_params']; $i++) { if ($routine_details['item_type'] == 'PROCEDURE' && $routine_details['item_param_dir'][$i] == 'OUT' ) { diff --git a/libraries/rte/rte_routines.lib.php b/libraries/rte/rte_routines.lib.php index 6b26f5dd30..36b582fa04 100644 --- a/libraries/rte/rte_routines.lib.php +++ b/libraries/rte/rte_routines.lib.php @@ -123,7 +123,7 @@ function PMA_RTN_parseOneParameter($value) $depth = 0; $param_length = ''; $param_opts = array(); - for ($i=$pos; $i<$parsed_param['len']; $i++) { + for ($i = $pos; $i<$parsed_param['len']; $i++) { if (($parsed_param[$i]['type'] == 'alpha_columnType' || $parsed_param[$i]['type'] == 'alpha_functionName') && $depth == 0 ) { @@ -183,7 +183,7 @@ function PMA_RTN_parseAllParameters($parsed_query, $routine_type) $params = array(); $fetching = false; $depth = 0; - for ($i=0; $i<$parsed_query['len']; $i++) { + for ($i = 0; $i<$parsed_query['len']; $i++) { if ($parsed_query[$i]['type'] == 'alpha_reservedWord' && $parsed_query[$i]['data'] == $routine_type ) { @@ -249,7 +249,7 @@ function PMA_RTN_parseRoutineDefiner($parsed_query) { $retval = ''; $fetching = false; - for ($i=0; $i<$parsed_query['len']; $i++) { + for ($i = 0; $i<$parsed_query['len']; $i++) { if ($parsed_query[$i]['type'] == 'alpha_reservedWord' && $parsed_query[$i]['data'] == 'DEFINER' ) { @@ -684,7 +684,7 @@ function PMA_RTN_getDataFromName($name, $type, $all = true) // information about the return variable. $dtd = ''; $fetching = false; - for ($i=0; $i<$parsed_query['len']; $i++) { + for ($i = 0; $i<$parsed_query['len']; $i++) { if ($parsed_query[$i]['type'] == 'alpha_reservedWord' && /*overload*/mb_strtoupper($parsed_query[$i]['data']) == 'RETURNS' ) { @@ -877,7 +877,7 @@ function PMA_RTN_getEditorForm($mode, $operation, $routine) foreach ($need_escape as $key => $index) { $routine[$index] = htmlentities($routine[$index], ENT_QUOTES, 'UTF-8'); } - for ($i=0; $i<$routine['item_num_params']; $i++) { + for ($i = 0; $i<$routine['item_num_params']; $i++) { $routine['item_param_name'][$i] = htmlentities( $routine['item_param_name'][$i], ENT_QUOTES @@ -992,7 +992,7 @@ function PMA_RTN_getEditorForm($mode, $operation, $routine) $retval .= " " . __('Options') . "\n"; $retval .= "  \n"; $retval .= " "; - for ($i=0; $i<$routine['item_num_params']; $i++) { // each parameter + for ($i = 0; $i<$routine['item_num_params']; $i++) { // each parameter $retval .= PMA_RTN_getParameterRow($routine, $i, $isprocedure_class); } $retval .= " "; @@ -1350,7 +1350,7 @@ function PMA_RTN_handleExecute() $end_query = array(); $args = array(); $all_functions = $GLOBALS['PMA_Types']->getAllFunctions(); - for ($i=0; $i<$routine['item_num_params']; $i++) { + for ($i = 0; $i<$routine['item_num_params']; $i++) { if (isset($_REQUEST['params'][$routine['item_param_name'][$i]])) { $value = $_REQUEST['params'][$routine['item_param_name'][$i]]; if (is_array($value)) { // is SET type @@ -1593,7 +1593,7 @@ function PMA_RTN_getExecuteForm($routine) // Escape special characters $routine['item_name'] = htmlentities($routine['item_name'], ENT_QUOTES); - for ($i=0; $i<$routine['item_num_params']; $i++) { + for ($i = 0; $i<$routine['item_num_params']; $i++) { $routine['item_param_name'][$i] = htmlentities( $routine['item_param_name'][$i], ENT_QUOTES @@ -1631,7 +1631,7 @@ function PMA_RTN_getExecuteForm($routine) $retval .= "\n"; // Get a list of data types that are not yet supported. $no_support_types = PMA_Util::unsupportedDatatypes(); - for ($i=0; $i<$routine['item_num_params']; $i++) { // Each parameter + for ($i = 0; $i<$routine['item_num_params']; $i++) { // Each parameter if ($routine['item_type'] == 'PROCEDURE' && $routine['item_param_dir'][$i] == 'OUT' ) { @@ -1687,7 +1687,7 @@ function PMA_RTN_getExecuteForm($routine) } else { $input_type = 'checkbox'; } - for ($j=0; $j<$tokens['len']; $j++) { + for ($j = 0; $j<$tokens['len']; $j++) { if ($tokens[$j]['type'] != 'punct_listsep') { $tokens[$j]['data'] = htmlentities( PMA_Util::unquote($tokens[$j]['data']), diff --git a/libraries/server_status_monitor.lib.php b/libraries/server_status_monitor.lib.php index 1f3466b17e..fb9ddfee8e 100644 --- a/libraries/server_status_monitor.lib.php +++ b/libraries/server_status_monitor.lib.php @@ -40,7 +40,7 @@ function PMA_getHtmlForMonitor($ServerStatusData) $retval .= '