This commit is contained in:
Marc Delisle 2015-04-27 08:43:57 -04:00
commit 9ffc3b4b91
26 changed files with 83 additions and 65 deletions

View File

@ -55,7 +55,7 @@
<arg line="${source_comma_sep}
xml
codesize,design,naming,unusedcode
--exclude test,build,tcpdf,php-gettext,bfShapeFiles,PMAStandard,phpseclib,recaptchalib.php,swekey.php,vendor
--exclude test,build,tcpdf,php-gettext,bfShapeFiles,PMAStandard,phpseclib,recaptchalib.php,swekey.php,vendor,sql-formatter
--reportfile '${basedir}/build/logs/pmd.xml'" />
</exec>
</target>
@ -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}" />
</exec>
</target>
@ -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}" />
</exec>
</target>
@ -97,7 +99,7 @@
<target name="phpcs" description="Generate checkstyle.xml using PHP_CodeSniffer excluding third party libraries">
<exec executable="phpcs">
<arg line="
--ignore=*/php-gettext/*,*/vendor/*,*/tcpdf/*,*/canvg/*,*/codemirror/*,*/openlayers/*,*/jquery/*,*/jqplot/*,*/build/*,*/bfShapeFiles/*,*/PMAStandard/*,*/phpseclib/*,*/recaptchalib.php,*/swekey.php
--ignore=*/php-gettext/*,*/vendor/*,*/tcpdf/*,*/canvg/*,*/codemirror/*,*/openlayers/*,*/jquery/*,*/jqplot/*,*/build/*,*/bfShapeFiles/*,*/PMAStandard/*,*/phpseclib/*,*/recaptchalib.php,*/swekey.php,*/sql-formatter/*
--report=checkstyle
--extensions=php
--report-file='${basedir}/build/logs/checkstyle.xml'

View File

@ -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

View File

@ -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')) {

View File

@ -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'])) {

View File

@ -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']) {

View File

@ -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;

View File

@ -307,8 +307,10 @@ class PMA_Console
. '<label><input type="checkbox" name="current_query">'
. __('Show current browsing query') . '</label><br>'
. '<label><input type="checkbox" name="enter_executes">'
. __('Execute queries on Enter and insert new line with Shift + Enter. '
. 'To make this permanent, view settings.') . '</label><br>'
. __(
'Execute queries on Enter and insert new line with Shift + Enter. '
. 'To make this permanent, view settings.'
) . '</label><br>'
. '<label><input type="checkbox" name="dark_theme">'
. __('Switch to dark theme') . '</label><br>'
. '</div>';

View File

@ -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'])
) {
@ -5346,7 +5346,7 @@ class PMA_DisplayResults
} else {
if ($relational_display == self::RELATIONAL_DISPLAY_COLUMN
&& ! empty($map[$meta->name][2])
&& ! empty($map[$meta->name][2])
) {
// user chose "relational display field" in the
// display options, so show display field in the cell

View File

@ -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');

View File

@ -975,7 +975,7 @@ function PMA_getHTMLforCentralColumnsEditTableRow($row, $odd_row, $row_num)
$meta['DefaultType'] = 'NONE';
} else {
if ($row['col_default'] == 'CURRENT_TIMESTAMP'
|| $row['col_default'] == 'NULL'
|| $row['col_default'] == 'NULL'
) {
$meta['DefaultType'] = $row['col_default'];
} else {
@ -1006,7 +1006,7 @@ function PMA_getHTMLforCentralColumnsEditTableRow($row, $odd_row, $row_num)
'<td class="nowrap" name="col_isNull">'
. PMA_getHtmlForColumnNull($row_num, 6, 0, array('Null'=>$row['col_isNull']))
. '</td>';
$tableHtml .=
'<td class="nowrap" name="col_extra">'
. PMA_getHtmlForColumnExtra(

View File

@ -235,7 +235,7 @@ function PMA_getHtmlForImportOptionsFile($max_upload_size, $import_list)
$html .= ' <input type="radio" name="file_location" '
. 'id="radio_local_import_file"';
if (! empty($GLOBALS['timeout_passed'])
&& ! empty($GLOBALS['local_import_file'])
&& ! empty($GLOBALS['local_import_file'])
) {
$html .= ' checked="checked"';
}

View File

@ -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'] == ''
) {

View File

@ -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;
}

View File

@ -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 .= '<td' . ' data-type="' . $type . '"' . ' data-decimals="'
. $no_decimals . '">' . "\n";

View File

@ -1009,7 +1009,7 @@ class PMA_NavigationTree
$retval .= "</span>";
$retval .= $this->_getPaginationParamsHtml($node);
if ($GLOBALS['cfg']['ShowDatabasesNavigationAsTree']
|| $parentName != 'root'
|| $parentName != 'root'
) {
$retval .= $node->getIcon($match);
}

View File

@ -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)
) . '</b></p>';
$tableName = $table;
$i=1;
$i = 1;
foreach ($partialDependencies as $key=>$dependents) {
$html .= '<p><input type="text" name="' . htmlspecialchars($key)
. '" value="' . htmlspecialchars($tableName) . '"/>'
@ -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();

View File

@ -282,12 +282,14 @@ 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;
}
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);

View File

@ -199,7 +199,7 @@ class TableProperty
*/
function isPK()
{
return $this->key=="PRI";
return $this->key == "PRI";
}
/**

View File

@ -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'
) {

View File

@ -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 .= " <th colspan='2'>" . __('Options') . "</th>\n";
$retval .= " <th class='routine_param_remove hide'>&nbsp;</th>\n";
$retval .= " </tr>";
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 .= " </table>";
@ -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 .= "</tr>\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']),

View File

@ -40,7 +40,7 @@ function PMA_getHtmlForMonitor($ServerStatusData)
$retval .= '<script type="text/javascript">';
$retval .= 'variableNames = [ ';
$i=0;
$i = 0;
foreach ($ServerStatusData->status as $name=>$value) {
if (is_numeric($value)) {
if ($i++ > 0) {

View File

@ -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) {

View File

@ -98,7 +98,7 @@ function PMA_getHtmlForLinkSuggestions($ServerStatusData)
$retval .= '<p class="notice">' . __('Related links:');
foreach ($ServerStatusData->links as $section_name => $section_links) {
$retval .= '<span class="status_' . $section_name . '"> ';
$i=0;
$i = 0;
foreach ($section_links as $link_name => $link_url) {
if ($i > 0) {
$retval .= ', ';

View File

@ -1505,10 +1505,10 @@ function PMA_SQP_analyze($arr)
&& ($seen_end_of_table_ref || $i == $size-1)
&& $subresult != $subresult_empty
) {
for ($tr=0; $tr <= $current_table_ref; $tr++) {
for ($tr = 0; $tr <= $current_table_ref; $tr++) {
$alias = $subresult['table_ref'][$tr]['table_alias'];
$truename = $subresult['table_ref'][$tr]['table_true_name'];
for ($se=0; $se <= $current_select_expr; $se++) {
for ($se = 0; $se <= $current_select_expr; $se++) {
if (isset($alias)
&& /*overload*/mb_strlen($alias)
&& $subresult['select_expr'][$se]['table_true_name'] == $alias
@ -1591,7 +1591,7 @@ function PMA_SQP_analyze($arr)
//DEBUG
/*
if (isset($current_select_expr)) {
for ($trace=0; $trace<=$current_select_expr; $trace++) {
for ($trace = 0; $trace <= $current_select_expr; $trace++) {
echo "<br />";
reset ($subresult['select_expr'][$trace]);
while (list ($key, $val) = each ($subresult['select_expr'][$trace]))
@ -1601,7 +1601,7 @@ function PMA_SQP_analyze($arr)
if (isset($current_table_ref)) {
echo "current_table_ref = " . $current_table_ref . "<br>";
for ($trace=0; $trace<=$current_table_ref; $trace++) {
for ($trace = 0; $trace <= $current_table_ref; $trace++) {
echo "<br />";
reset ($subresult['table_ref'][$trace]);
@ -1911,7 +1911,7 @@ function PMA_SQP_analyze($arr)
$sep = ' ';
if ($arr[$i]['type'] == 'alpha_functionName') {
$sep='';
$sep = '';
$upper_data = /*overload*/mb_strtoupper($arr[$i]['data']);
if ($upper_data =='GROUP_CONCAT') {
$in_group_concat = true;
@ -2033,7 +2033,7 @@ function PMA_SQP_analyze($arr)
}
// clear $upper_data for next iteration
$upper_data='';
$upper_data = '';
} // end for $i (loop #2)
if (empty($section_before_limit)) {
$section_before_limit = $arr['raw'];
@ -2457,7 +2457,7 @@ function PMA_SQP_format(
$typearr[4] = '';
}
for ($j=0; $j<4; $j++) {
for ($j = 0; $j < 4; $j++) {
$typearr[$j] = $typearr[$j + 1];
}

View File

@ -35,7 +35,7 @@ function PMA_getColumnMap($sql_query, $view_columns)
$nbFields = count($real_source_fields_meta);
if ($nbFields > 0) {
for ($i=0; $i < $nbFields; $i++) {
for ($i = 0; $i < $nbFields; $i++) {
$map = array();
$map['table_name'] = $real_source_fields_meta[$i]->table;

View File

@ -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: