Fix some coding standard errors

- Fixes array identation
- Removes empty statements

Signed-off-by: Maurício Meneghini Fauth <mauriciofauth@gmail.com>
This commit is contained in:
Maurício Meneghini Fauth 2019-01-05 21:25:08 -02:00
parent 3a7e1503ac
commit 999b4d14f0
61 changed files with 815 additions and 765 deletions

View File

@ -31,8 +31,8 @@ $AUTH_MAP = [
'https://launchpad.net/~username' => [
'user' => 'root',
'password' => '',
],
];
],
];
/**
* Simple function to show HTML page with given content.

View File

@ -56,123 +56,123 @@ if (isset($_GET['check_time_out'])) {
* without checking
*/
$post_params = [
'db',
'table',
'what',
'single_table',
'export_type',
'export_method',
'quick_or_custom',
'db_select',
'table_select',
'table_structure',
'table_data',
'limit_to',
'limit_from',
'allrows',
'lock_tables',
'output_format',
'filename_template',
'maxsize',
'remember_template',
'charset',
'compression',
'as_separate_files',
'knjenc',
'xkana',
'htmlword_structure_or_data',
'htmlword_null',
'htmlword_columns',
'mediawiki_headers',
'mediawiki_structure_or_data',
'mediawiki_caption',
'pdf_structure_or_data',
'odt_structure_or_data',
'odt_relation',
'odt_comments',
'odt_mime',
'odt_columns',
'odt_null',
'codegen_structure_or_data',
'codegen_format',
'excel_null',
'excel_removeCRLF',
'excel_columns',
'excel_edition',
'excel_structure_or_data',
'yaml_structure_or_data',
'ods_null',
'ods_structure_or_data',
'ods_columns',
'json_structure_or_data',
'json_pretty_print',
'json_unicode',
'xml_structure_or_data',
'xml_export_events',
'xml_export_functions',
'xml_export_procedures',
'xml_export_tables',
'xml_export_triggers',
'xml_export_views',
'xml_export_contents',
'texytext_structure_or_data',
'texytext_columns',
'texytext_null',
'phparray_structure_or_data',
'sql_include_comments',
'sql_header_comment',
'sql_dates',
'sql_relation',
'sql_mime',
'sql_use_transaction',
'sql_disable_fk',
'sql_compatibility',
'sql_structure_or_data',
'sql_create_database',
'sql_drop_table',
'sql_procedure_function',
'sql_create_table',
'sql_create_view',
'sql_create_trigger',
'sql_view_current_user',
'sql_if_not_exists',
'sql_or_replace_view',
'sql_auto_increment',
'sql_backquotes',
'sql_truncate',
'sql_delayed',
'sql_ignore',
'sql_type',
'sql_insert_syntax',
'sql_max_query_size',
'sql_hex_for_binary',
'sql_utc_time',
'sql_drop_database',
'sql_views_as_tables',
'sql_metadata',
'csv_separator',
'csv_enclosed',
'csv_escaped',
'csv_terminated',
'csv_null',
'csv_removeCRLF',
'csv_columns',
'csv_structure_or_data',
// csv_replace should have been here but we use it directly from $_POST
'latex_caption',
'latex_structure_or_data',
'latex_structure_caption',
'latex_structure_continued_caption',
'latex_structure_label',
'latex_relation',
'latex_comments',
'latex_mime',
'latex_columns',
'latex_data_caption',
'latex_data_continued_caption',
'latex_data_label',
'latex_null',
'aliases'
'db',
'table',
'what',
'single_table',
'export_type',
'export_method',
'quick_or_custom',
'db_select',
'table_select',
'table_structure',
'table_data',
'limit_to',
'limit_from',
'allrows',
'lock_tables',
'output_format',
'filename_template',
'maxsize',
'remember_template',
'charset',
'compression',
'as_separate_files',
'knjenc',
'xkana',
'htmlword_structure_or_data',
'htmlword_null',
'htmlword_columns',
'mediawiki_headers',
'mediawiki_structure_or_data',
'mediawiki_caption',
'pdf_structure_or_data',
'odt_structure_or_data',
'odt_relation',
'odt_comments',
'odt_mime',
'odt_columns',
'odt_null',
'codegen_structure_or_data',
'codegen_format',
'excel_null',
'excel_removeCRLF',
'excel_columns',
'excel_edition',
'excel_structure_or_data',
'yaml_structure_or_data',
'ods_null',
'ods_structure_or_data',
'ods_columns',
'json_structure_or_data',
'json_pretty_print',
'json_unicode',
'xml_structure_or_data',
'xml_export_events',
'xml_export_functions',
'xml_export_procedures',
'xml_export_tables',
'xml_export_triggers',
'xml_export_views',
'xml_export_contents',
'texytext_structure_or_data',
'texytext_columns',
'texytext_null',
'phparray_structure_or_data',
'sql_include_comments',
'sql_header_comment',
'sql_dates',
'sql_relation',
'sql_mime',
'sql_use_transaction',
'sql_disable_fk',
'sql_compatibility',
'sql_structure_or_data',
'sql_create_database',
'sql_drop_table',
'sql_procedure_function',
'sql_create_table',
'sql_create_view',
'sql_create_trigger',
'sql_view_current_user',
'sql_if_not_exists',
'sql_or_replace_view',
'sql_auto_increment',
'sql_backquotes',
'sql_truncate',
'sql_delayed',
'sql_ignore',
'sql_type',
'sql_insert_syntax',
'sql_max_query_size',
'sql_hex_for_binary',
'sql_utc_time',
'sql_drop_database',
'sql_views_as_tables',
'sql_metadata',
'csv_separator',
'csv_enclosed',
'csv_escaped',
'csv_terminated',
'csv_null',
'csv_removeCRLF',
'csv_columns',
'csv_structure_or_data',
// csv_replace should have been here but we use it directly from $_POST
'latex_caption',
'latex_structure_or_data',
'latex_structure_caption',
'latex_structure_continued_caption',
'latex_structure_label',
'latex_relation',
'latex_comments',
'latex_mime',
'latex_columns',
'latex_data_caption',
'latex_data_continued_caption',
'latex_data_label',
'latex_null',
'aliases'
];
foreach ($post_params as $one_post_param) {

View File

@ -724,7 +724,8 @@ class Config
$user2 = [
'name' => trim($user[1]),
'email' => trim($user[2]),
'date' => date('Y-m-d H:i:s', (int) $user[3])];
'date' => date('Y-m-d H:i:s', (int) $user[3])
];
if (isset($user[4])) {
$user2['date'] .= $user[4];
}
@ -736,11 +737,13 @@ class Config
$author = [
'name' => $commit_json->author->name,
'email' => $commit_json->author->email,
'date' => $commit_json->author->date];
'date' => $commit_json->author->date
];
$committer = [
'name' => $commit_json->committer->name,
'email' => $commit_json->committer->email,
'date' => $commit_json->committer->date];
'date' => $commit_json->committer->date
];
$message = trim($commit_json->message);
} else {
$this->set('PMA_VERSION_GIT', 0);
@ -1412,7 +1415,7 @@ class Config
'PMA_USR_OS',
'PMA_USR_BROWSER_VER',
'PMA_USR_BROWSER_AGENT'
];
];
foreach ($defines as $define) {
if (! defined($define)) {

View File

@ -103,7 +103,8 @@ class FormDisplay
'error_nan_nneg' => __('Not a non-negative number!'),
'error_incorrect_port' => __('Not a valid port number!'),
'error_invalid_value' => __('Incorrect value!'),
'error_value_lte' => __('Value must be equal or lower than %s!')];
'error_value_lte' => __('Value must be equal or lower than %s!')
];
$this->_configFile = $cf;
// initialize validators
Validator::getValidators($this->_configFile);
@ -861,7 +862,8 @@ class FormDisplay
$funcs = [
'ZipDump' => ['zip_open', 'gzcompress'],
'GZipDump' => ['gzopen', 'gzencode'],
'BZipDump' => ['bzopen', 'bzcompress']];
'BZipDump' => ['bzopen', 'bzcompress']
];
if (!function_exists($funcs[$systemPath][0])) {
$comment = sprintf(
__(

View File

@ -31,8 +31,8 @@ class FeaturesForm extends \PhpMyAdmin\Config\Forms\User\FeaturesForm
'UploadDir',
'SaveDir',
'RecodingEngine' => ':group',
'IconvExtraParams',
':group:end',
'IconvExtraParams',
':group:end',
'ZipDump',
'GZipDump',
'BZipDump',

View File

@ -23,68 +23,92 @@ class ServersForm extends BaseForm
public static function getForms()
{
return [
'Server' => ['Servers' => [1 => [
'verbose',
'host',
'port',
'socket',
'ssl',
'compress']]],
'Server_auth' => ['Servers' => [1 => [
'auth_type',
':group:' . __('Config authentication'),
'user',
'password',
':group:end',
':group:' . __('HTTP authentication'),
'auth_http_realm',
':group:end',
':group:' . __('Signon authentication'),
'SignonSession',
'SignonURL',
'LogoutURL']]],
'Server_config' => ['Servers' => [1 => [
'only_db',
'hide_db',
'AllowRoot',
'AllowNoPassword',
'DisableIS',
'AllowDeny/order',
'AllowDeny/rules',
'SessionTimeZone']]],
'Server_pmadb' => ['Servers' => [1 => [
'pmadb' => 'phpmyadmin',
'controlhost',
'controlport',
'controluser',
'controlpass',
'bookmarktable' => 'pma__bookmark',
'relation' => 'pma__relation',
'userconfig' => 'pma__userconfig',
'users' => 'pma__users',
'usergroups' => 'pma__usergroups',
'navigationhiding' => 'pma__navigationhiding',
'table_info' => 'pma__table_info',
'column_info' => 'pma__column_info',
'history' => 'pma__history',
'recent' => 'pma__recent',
'favorite' => 'pma__favorite',
'table_uiprefs' => 'pma__table_uiprefs',
'tracking' => 'pma__tracking',
'table_coords' => 'pma__table_coords',
'pdf_pages' => 'pma__pdf_pages',
'savedsearches' => 'pma__savedsearches',
'central_columns' => 'pma__central_columns',
'designer_settings' => 'pma__designer_settings',
'export_templates' => 'pma__export_templates',
'MaxTableUiprefs' => 100]]],
'Server_tracking' => ['Servers' => [1 => [
'tracking_version_auto_create',
'tracking_default_statements',
'tracking_add_drop_view',
'tracking_add_drop_table',
'tracking_add_drop_database',
]]],
'Server' => [
'Servers' => [
1 => [
'verbose',
'host',
'port',
'socket',
'ssl',
'compress'
]
]
],
'Server_auth' => [
'Servers' => [
1 => [
'auth_type',
':group:' . __('Config authentication'),
'user',
'password',
':group:end',
':group:' . __('HTTP authentication'),
'auth_http_realm',
':group:end',
':group:' . __('Signon authentication'),
'SignonSession',
'SignonURL',
'LogoutURL'
]
]
],
'Server_config' => [
'Servers' => [
1 => [
'only_db',
'hide_db',
'AllowRoot',
'AllowNoPassword',
'DisableIS',
'AllowDeny/order',
'AllowDeny/rules',
'SessionTimeZone'
]
]
],
'Server_pmadb' => [
'Servers' => [
1 => [
'pmadb' => 'phpmyadmin',
'controlhost',
'controlport',
'controluser',
'controlpass',
'bookmarktable' => 'pma__bookmark',
'relation' => 'pma__relation',
'userconfig' => 'pma__userconfig',
'users' => 'pma__users',
'usergroups' => 'pma__usergroups',
'navigationhiding' => 'pma__navigationhiding',
'table_info' => 'pma__table_info',
'column_info' => 'pma__column_info',
'history' => 'pma__history',
'recent' => 'pma__recent',
'favorite' => 'pma__favorite',
'table_uiprefs' => 'pma__table_uiprefs',
'tracking' => 'pma__tracking',
'table_coords' => 'pma__table_coords',
'pdf_pages' => 'pma__pdf_pages',
'savedsearches' => 'pma__savedsearches',
'central_columns' => 'pma__central_columns',
'designer_settings' => 'pma__designer_settings',
'export_templates' => 'pma__export_templates',
'MaxTableUiprefs' => 100
]
]
],
'Server_tracking' => [
'Servers' => [
1 => [
'tracking_version_auto_create',
'tracking_default_statements',
'tracking_add_drop_view',
'tracking_add_drop_table',
'tracking_add_drop_database',
]
]
],
];
}
}

View File

@ -26,29 +26,29 @@ class ExportForm extends BaseForm
'Export_defaults' => [
'Export/method',
':group:' . __('Quick'),
'Export/quick_export_onserver',
'Export/quick_export_onserver_overwrite',
':group:end',
'Export/quick_export_onserver',
'Export/quick_export_onserver_overwrite',
':group:end',
':group:' . __('Custom'),
'Export/format',
'Export/compression',
'Export/charset',
'Export/lock_tables',
'Export/as_separate_files',
'Export/asfile' => ':group',
'Export/onserver',
'Export/onserver_overwrite',
':group:end',
'Export/file_template_table',
'Export/file_template_database',
'Export/file_template_server'
'Export/format',
'Export/compression',
'Export/charset',
'Export/lock_tables',
'Export/as_separate_files',
'Export/asfile' => ':group',
'Export/onserver',
'Export/onserver_overwrite',
':group:end',
'Export/file_template_table',
'Export/file_template_database',
'Export/file_template_server'
],
'Sql' => [
'Export/sql_include_comments' => ':group',
'Export/sql_dates',
'Export/sql_relation',
'Export/sql_mime',
':group:end',
'Export/sql_dates',
'Export/sql_relation',
'Export/sql_mime',
':group:end',
'Export/sql_use_transaction',
'Export/sql_disable_fk',
'Export/sql_views_as_tables',
@ -56,93 +56,94 @@ class ExportForm extends BaseForm
'Export/sql_compatibility',
'Export/sql_structure_or_data',
':group:' . __('Structure'),
'Export/sql_drop_database',
'Export/sql_create_database',
'Export/sql_drop_table',
'Export/sql_create_table' => ':group',
'Export/sql_if_not_exists',
'Export/sql_auto_increment',
':group:end',
'Export/sql_create_view' => ':group',
'Export/sql_view_current_user',
'Export/sql_or_replace_view',
':group:end',
'Export/sql_procedure_function',
'Export/sql_create_trigger',
'Export/sql_backquotes',
':group:end',
'Export/sql_drop_database',
'Export/sql_create_database',
'Export/sql_drop_table',
'Export/sql_create_table' => ':group',
'Export/sql_if_not_exists',
'Export/sql_auto_increment',
':group:end',
'Export/sql_create_view' => ':group',
'Export/sql_view_current_user',
'Export/sql_or_replace_view',
':group:end',
'Export/sql_procedure_function',
'Export/sql_create_trigger',
'Export/sql_backquotes',
':group:end',
':group:' . __('Data'),
'Export/sql_delayed',
'Export/sql_ignore',
'Export/sql_type',
'Export/sql_insert_syntax',
'Export/sql_max_query_size',
'Export/sql_hex_for_binary',
'Export/sql_utc_time'
'Export/sql_delayed',
'Export/sql_ignore',
'Export/sql_type',
'Export/sql_insert_syntax',
'Export/sql_max_query_size',
'Export/sql_hex_for_binary',
'Export/sql_utc_time'
],
'CodeGen' => [
'Export/codegen_format'
],
'Csv' => [
':group:' . __('CSV'),
'Export/csv_separator',
'Export/csv_enclosed',
'Export/csv_escaped',
'Export/csv_terminated',
'Export/csv_null',
'Export/csv_removeCRLF',
'Export/csv_columns',
':group:end',
'Export/csv_separator',
'Export/csv_enclosed',
'Export/csv_escaped',
'Export/csv_terminated',
'Export/csv_null',
'Export/csv_removeCRLF',
'Export/csv_columns',
':group:end',
':group:' . __('CSV for MS Excel'),
'Export/excel_null',
'Export/excel_removeCRLF',
'Export/excel_columns',
'Export/excel_edition'
],
'Export/excel_null',
'Export/excel_removeCRLF',
'Export/excel_columns',
'Export/excel_edition'
],
'Latex' => [
'Export/latex_caption',
'Export/latex_structure_or_data',
':group:' . __('Structure'),
'Export/latex_structure_caption',
'Export/latex_structure_continued_caption',
'Export/latex_structure_label',
'Export/latex_relation',
'Export/latex_comments',
'Export/latex_mime',
':group:end',
'Export/latex_structure_caption',
'Export/latex_structure_continued_caption',
'Export/latex_structure_label',
'Export/latex_relation',
'Export/latex_comments',
'Export/latex_mime',
':group:end',
':group:' . __('Data'),
'Export/latex_columns',
'Export/latex_data_caption',
'Export/latex_data_continued_caption',
'Export/latex_data_label',
'Export/latex_null'
'Export/latex_columns',
'Export/latex_data_caption',
'Export/latex_data_continued_caption',
'Export/latex_data_label',
'Export/latex_null'
],
'Microsoft_Office' => [
':group:' . __('Microsoft Word 2000'),
'Export/htmlword_structure_or_data',
'Export/htmlword_null',
'Export/htmlword_columns'],
'Export/htmlword_structure_or_data',
'Export/htmlword_null',
'Export/htmlword_columns'
],
'Open_Document' => [
':group:' . __('OpenDocument Spreadsheet'),
'Export/ods_columns',
'Export/ods_null',
':group:end',
'Export/ods_columns',
'Export/ods_null',
':group:end',
':group:' . __('OpenDocument Text'),
'Export/odt_structure_or_data',
':group:' . __('Structure'),
'Export/odt_relation',
'Export/odt_comments',
'Export/odt_mime',
':group:end',
':group:' . __('Data'),
'Export/odt_columns',
'Export/odt_null'
'Export/odt_structure_or_data',
':group:' . __('Structure'),
'Export/odt_relation',
'Export/odt_comments',
'Export/odt_mime',
':group:end',
':group:' . __('Data'),
'Export/odt_columns',
'Export/odt_null'
],
'Texy' => [
'Export/texytext_structure_or_data',
':group:' . __('Data'),
'Export/texytext_null',
'Export/texytext_columns'
'Export/texytext_null',
'Export/texytext_columns'
],
];
}

View File

@ -37,27 +37,27 @@ class ImportForm extends BaseForm
],
'Csv' => [
':group:' . __('CSV'),
'Import/csv_replace',
'Import/csv_ignore',
'Import/csv_terminated',
'Import/csv_enclosed',
'Import/csv_escaped',
'Import/csv_col_names',
':group:end',
'Import/csv_replace',
'Import/csv_ignore',
'Import/csv_terminated',
'Import/csv_enclosed',
'Import/csv_escaped',
'Import/csv_col_names',
':group:end',
':group:' . __('CSV using LOAD DATA'),
'Import/ldi_replace',
'Import/ldi_ignore',
'Import/ldi_terminated',
'Import/ldi_enclosed',
'Import/ldi_escaped',
'Import/ldi_local_option'
'Import/ldi_replace',
'Import/ldi_ignore',
'Import/ldi_terminated',
'Import/ldi_enclosed',
'Import/ldi_escaped',
'Import/ldi_local_option'
],
'Open_Document' => [
':group:' . __('OpenDocument Spreadsheet'),
'Import/ods_col_names',
'Import/ods_empty_rows',
'Import/ods_recognize_percentages',
'Import/ods_recognize_currency'
'Import/ods_col_names',
'Import/ods_empty_rows',
'Import/ods_recognize_percentages',
'Import/ods_recognize_currency'
],
];

View File

@ -585,9 +585,11 @@ class Validator
public static function validateUpperBound($path, array $values, $maxValue)
{
$result = $values[$path] <= $maxValue;
return [$path => ($result ? '' : sprintf(
__('Value must be equal or lower than %s!'),
$maxValue
))];
return [
$path => $result ? '' : sprintf(
__('Value must be equal or lower than %s!'),
$maxValue
)
];
}
}

View File

@ -187,7 +187,8 @@ class DatabaseStructureController extends DatabaseController
$this->response->addHTML('<div id="tableslistcontainer">');
$_url_params = [
'pos' => $this->_pos,
'db' => $this->db];
'db' => $this->db
];
// Add the sort options if they exists
if (isset($_REQUEST['sort'])) {

View File

@ -293,10 +293,7 @@ class TableStructureController extends TableController
*/
if (isset($_POST['do_save_data'])) {
$regenerate = $this->updateColumns();
if ($regenerate) {
// This happens when updating failed
// @todo: do something appropriate
} else {
if (! $regenerate) {
// continue to show the table's structure
unset($_POST['selected']);
}

View File

@ -3445,13 +3445,13 @@ class Results
) {
$_url_params = [
'db' => $this->__get('db'),
'table' => $this->__get('table'),
'where_clause' => $where_clause,
'clause_is_unique' => $clause_is_unique,
'sql_query' => $url_sql_query,
'goto' => 'sql.php',
];
'db' => $this->__get('db'),
'table' => $this->__get('table'),
'where_clause' => $where_clause,
'clause_is_unique' => $clause_is_unique,
'sql_query' => $url_sql_query,
'goto' => 'sql.php',
];
$edit_url = 'tbl_change.php'
. Url::getCommon(
@ -3525,12 +3525,12 @@ class Results
($clause_is_unique ? '' : ' LIMIT 1');
$_url_params = [
'db' => $this->__get('db'),
'table' => $this->__get('table'),
'sql_query' => $del_query,
'message_to_show' => __('The row has been deleted.'),
'goto' => $lnk_goto,
];
'db' => $this->__get('db'),
'table' => $this->__get('table'),
'sql_query' => $del_query,
'message_to_show' => __('The row has been deleted.'),
'goto' => $lnk_goto,
];
$del_url = 'sql.php' . Url::getCommon($_url_params);
$js_conf = 'DELETE FROM ' . Sanitize::jsFormat($this->__get('table'))
@ -3540,21 +3540,21 @@ class Results
$del_str = $this->_getActionLinkContent('b_drop', __('Delete'));
} elseif ($del_lnk == self::KILL_PROCESS) { // kill process case
$_url_params = [
'db' => $this->__get('db'),
'table' => $this->__get('table'),
'sql_query' => $url_sql_query,
'goto' => 'index.php',
];
'db' => $this->__get('db'),
'table' => $this->__get('table'),
'sql_query' => $url_sql_query,
'goto' => 'index.php',
];
$lnk_goto = 'sql.php' . Url::getCommonRaw($_url_params);
$kill = $GLOBALS['dbi']->getKillQuery($row[0]);
$_url_params = [
'db' => 'mysql',
'sql_query' => $kill,
'goto' => $lnk_goto,
];
'db' => 'mysql',
'sql_query' => $kill,
'goto' => $lnk_goto,
];
$del_url = 'sql.php' . Url::getCommon($_url_params);
$js_conf = $kill;
@ -4236,9 +4236,7 @@ class Results
} elseif (isset($_REQUEST['display_options_form'])) {
// we know that the checkbox was unchecked
unset($query['display_binary']);
} elseif (isset($_REQUEST['full_text_button'])) {
// do nothing to keep the value that is there in the session
} else {
} elseif (! isset($_REQUEST['full_text_button'])) {
// selected by default because some operations like OPTIMIZE TABLE
// and all queries involving functions return "binary" contents,
// according to low-level field flags
@ -5165,11 +5163,11 @@ class Results
. __('Query results operations') . '</legend>';
$_url_params = [
'db' => $this->__get('db'),
'table' => $this->__get('table'),
'printview' => '1',
'sql_query' => $this->__get('sql_query'),
];
'db' => $this->__get('db'),
'table' => $this->__get('table'),
'printview' => '1',
'sql_query' => $this->__get('sql_query'),
];
$url_query = Url::getCommon($_url_params);
if (!$header_shown) {

View File

@ -1261,8 +1261,8 @@ class Import
$num_tables = count($tables);
for ($i = 0; $i < $num_tables; ++$i) {
$params = [
'db' => (string) $db_name,
'table' => (string) $tables[$i][self::TBL_NAME]
'db' => (string) $db_name,
'table' => (string) $tables[$i][self::TBL_NAME]
];
$tbl_url = 'sql.php' . Url::getCommon($params);
$tbl_struct_url = 'tbl_structure.php' . Url::getCommon($params);

View File

@ -1457,16 +1457,17 @@ class InsertEdit
$the_class = 'textfield';
// verify True_Type which does not contain the parentheses and length
if ($readOnly) {
//NOOP. Disable date/timepicker
} elseif ($column['True_Type'] === 'date') {
$the_class .= ' datefield';
} elseif ($column['True_Type'] === 'time') {
$the_class .= ' timefield';
} elseif ($column['True_Type'] === 'datetime'
|| $column['True_Type'] === 'timestamp'
) {
$the_class .= ' datetimefield';
if (! $readOnly) {
if ($column['True_Type'] === 'date') {
$the_class .= ' datefield';
} elseif ($column['True_Type'] === 'time') {
$the_class .= ' timefield';
} elseif (
$column['True_Type'] === 'datetime'
|| $column['True_Type'] === 'timestamp'
) {
$the_class .= ' datetimefield';
}
}
$input_min_max = false;
if (in_array($column['True_Type'], $this->dbi->types->getIntegerTypes())) {
@ -1668,14 +1669,6 @@ class InsertEdit
$html_output .= '<input type="hidden" name="fields_type'
. $column_name_appendix . '" value="bit">';
}
if ($column['pma_type'] == 'date'
|| $column['pma_type'] == 'datetime'
|| substr($column['pma_type'], 0, 9) == 'timestamp'
) {
// the _3 suffix points to the date field
// the _2 suffix points to the corresponding NULL checkbox
// in dateFormat, 'yy' means the year with 4 digits
}
}
return $html_output;
}
@ -2646,13 +2639,13 @@ class InsertEdit
$query_values[]
= Util::backquote($multi_edit_columns_name[$key])
. ' = ' . $current_value_as_an_array;
} elseif (empty($multi_edit_funcs[$key])
} elseif (
! (empty($multi_edit_funcs[$key])
&& isset($multi_edit_columns_prev[$key])
&& (("'" . $this->dbi->escapeString($multi_edit_columns_prev[$key]) . "'" === $current_value)
|| ('0x' . $multi_edit_columns_prev[$key] === $current_value))
|| ('0x' . $multi_edit_columns_prev[$key] === $current_value)))
&& ! empty($current_value)
) {
// No change for this column and no MySQL function is used -> next column
} elseif (! empty($current_value)) {
// avoid setting a field to NULL when it's already NULL
// (field had the null checkbox before the update
// field still has the null checkbox)

View File

@ -880,9 +880,10 @@ class Normalization
$htmlOutput .= '<h3>' . __('Select up to what step you want to normalize')
. '</h3>';
$choices = [
'1nf' => __('First step of normalization (1NF)'),
'2nf' => __('Second step of normalization (1NF+2NF)'),
'3nf' => __('Third step of normalization (1NF+2NF+3NF)')];
'1nf' => __('First step of normalization (1NF)'),
'2nf' => __('Second step of normalization (1NF+2NF)'),
'3nf' => __('Third step of normalization (1NF+2NF+3NF)')
];
$htmlOutput .= Util::getRadioFields(
'normalizeTo',

View File

@ -1265,16 +1265,16 @@ class Operations
'PAGE' => 'PAGE'
],
'MYISAM' => [
'FIXED' => 'FIXED',
'DYNAMIC' => 'DYNAMIC'
'FIXED' => 'FIXED',
'DYNAMIC' => 'DYNAMIC'
],
'PBXT' => [
'FIXED' => 'FIXED',
'DYNAMIC' => 'DYNAMIC'
'FIXED' => 'FIXED',
'DYNAMIC' => 'DYNAMIC'
],
'INNODB' => [
'COMPACT' => 'COMPACT',
'REDUNDANT' => 'REDUNDANT'
'COMPACT' => 'COMPACT',
'REDUNDANT' => 'REDUNDANT'
]
];
@ -2200,12 +2200,6 @@ class Operations
$new = Util::backquote($_POST['target_db']) . '.'
. Util::backquote($new_name);
$message->addParam($new);
/* Check: Work on new table or on old table? */
if (isset($_POST['submit_move'])
|| Core::isValid($_POST['switch_to_new'])
) {
}
}
} else {
/**

View File

@ -131,11 +131,17 @@ class AuthenticationCookie extends AuthenticationPlugin
// wrap the login form in a div which overlays the whole page.
if ($session_expired) {
echo $this->template->render('login/header', ['theme' => $GLOBALS['PMA_Theme'],
'add_class' => ' modal_form', 'session_expired' => 1]);
echo $this->template->render('login/header', [
'theme' => $GLOBALS['PMA_Theme'],
'add_class' => ' modal_form',
'session_expired' => 1
]);
} else {
echo $this->template->render('login/header', ['theme' => $GLOBALS['PMA_Theme'],
'add_class' => '', 'session_expired' => 0]);
echo $this->template->render('login/header', [
'theme' => $GLOBALS['PMA_Theme'],
'add_class' => '',
'session_expired' => 0
]);
}
if ($GLOBALS['cfg']['DBG']['demo']) {
@ -770,8 +776,9 @@ class AuthenticationCookie extends AuthenticationPlugin
public function cleanSSLErrors()
{
if (function_exists('openssl_error_string')) {
while (($ssl_err = openssl_error_string()) !== false) {
}
do {
$hasSslErrors = openssl_error_string();
} while ($hasSslErrors !== false);
}
}

View File

@ -299,9 +299,7 @@ class ImportCsv extends AbstractImportCsv
// subtract data we didn't handle yet and stop processing
$GLOBALS['offset'] -= strlen($buffer);
break;
} elseif ($data === true) {
// Handle rest of buffer
} else {
} elseif ($data !== true) {
// Append new data to buffer
$buffer .= $data;
unset($data);

View File

@ -102,9 +102,7 @@ class ImportMediawiki extends ImportPlugin
// Subtract data we didn't handle yet and stop processing
$GLOBALS['offset'] -= mb_strlen($buffer);
break;
} elseif ($data === true) {
// Handle rest of buffer
} else {
} elseif ($data !== true) {
// Append new data to buffer
$buffer = $data;
unset($data);

View File

@ -121,9 +121,7 @@ class ImportOds extends ImportPlugin
/* subtract data we didn't handle yet and stop processing */
$GLOBALS['offset'] -= strlen($buffer);
break;
} elseif ($data === true) {
/* Handle rest of buffer */
} else {
} elseif ($data !== true) {
/* Append new data to buffer */
$buffer .= $data;
unset($data);

View File

@ -78,9 +78,7 @@ class ImportXml extends ImportPlugin
/* subtract data we didn't handle yet and stop processing */
$GLOBALS['offset'] -= strlen($buffer);
break;
} elseif ($data === true) {
/* Handle rest of buffer */
} else {
} elseif ($data !== true) {
/* Append new data to buffer */
$buffer .= $data;
unset($data);

View File

@ -356,8 +356,11 @@ class RecentFavoriteTable
$cfgRelation = $this->relation->getRelationsParam();
// Not to show this once list is synchronized.
if ($cfgRelation['favoritework'] && ! isset($_SESSION['tmpval']['favorites_synced'][$server_id])) {
$params = ['ajax_request' => true, 'favorite_table' => true,
'sync_favorite_tables' => true];
$params = [
'ajax_request' => true,
'favorite_table' => true,
'sync_favorite_tables' => true
];
$url = 'db_structure.php' . Url::getCommon($params);
$retval = '<a class="hide" id="sync_favorite_tables"';
$retval .= ' href="' . $url . '"></a>';

View File

@ -753,10 +753,12 @@ class Relation
);
$this->dbi->tryMultiQuery($query, DatabaseInterface::CONNECT_CONTROL);
// skips result sets of query as we are not interested in it
while ($this->dbi->moreResults(DatabaseInterface::CONNECT_CONTROL)
&& $this->dbi->nextResult(DatabaseInterface::CONNECT_CONTROL)
) {
}
do {
$hasResult = (
$this->dbi->moreResults(DatabaseInterface::CONNECT_CONTROL)
&& $this->dbi->nextResult(DatabaseInterface::CONNECT_CONTROL)
);
} while ($hasResult);
$error = $this->dbi->getError(DatabaseInterface::CONNECT_CONTROL);
// return true if no error exists otherwise false
return empty($error);

View File

@ -475,7 +475,7 @@ class ReplicationGui
'maxlength' => 6,
'value' => '3306',
'required' => 'required'
]
]
);
$html .= ' </fieldset>';
@ -592,7 +592,8 @@ class ReplicationGui
$variables_wrap = [
'Replicate_Do_DB', 'Replicate_Ignore_DB',
'Replicate_Do_Table', 'Replicate_Ignore_Table',
'Replicate_Wild_Do_Table', 'Replicate_Wild_Ignore_Table'];
'Replicate_Wild_Do_Table', 'Replicate_Wild_Ignore_Table'
];
if (in_array($variable, $variables_wrap)) {
$html .= htmlspecialchars(str_replace(
',',

View File

@ -317,18 +317,20 @@ class Events
public function getDataFromRequest()
{
$retval = [];
$indices = ['item_name',
'item_original_name',
'item_status',
'item_execute_at',
'item_interval_value',
'item_interval_field',
'item_starts',
'item_ends',
'item_definition',
'item_preserve',
'item_comment',
'item_definer'];
$indices = [
'item_name',
'item_original_name',
'item_status',
'item_execute_at',
'item_interval_value',
'item_interval_field',
'item_starts',
'item_ends',
'item_definition',
'item_preserve',
'item_comment',
'item_definer'
];
foreach ($indices as $index) {
$retval[$index] = isset($_POST[$index]) ? $_POST[$index] : '';
}
@ -412,17 +414,17 @@ class Events
// Escape special characters
$need_escape = [
'item_original_name',
'item_name',
'item_type',
'item_execute_at',
'item_interval_value',
'item_starts',
'item_ends',
'item_definition',
'item_definer',
'item_comment'
];
'item_original_name',
'item_name',
'item_type',
'item_execute_at',
'item_interval_value',
'item_starts',
'item_ends',
'item_definition',
'item_definer',
'item_comment'
];
foreach ($need_escape as $index) {
$item[$index] = htmlentities((string) $item[$index], ENT_QUOTES);
}

View File

@ -122,17 +122,17 @@ class Footer
);
$es_state = mb_strtolower($es_state);
$options = [
0 => [
'label' => __('OFF'),
'value' => "SET GLOBAL event_scheduler=\"OFF\"",
'selected' => ($es_state != 'on')
],
1 => [
'label' => __('ON'),
'value' => "SET GLOBAL event_scheduler=\"ON\"",
'selected' => ($es_state == 'on')
]
];
0 => [
'label' => __('OFF'),
'value' => "SET GLOBAL event_scheduler=\"OFF\"",
'selected' => ($es_state != 'on')
],
1 => [
'label' => __('ON'),
'value' => "SET GLOBAL event_scheduler=\"ON\"",
'selected' => ($es_state == 'on')
]
];
// Generate output
$retval = "<!-- FOOTER LINKS START -->\n";
$retval .= "<div class='doubleFieldset'>\n";

View File

@ -528,14 +528,16 @@ class Routines
global $param_directions, $param_sqldataaccess;
$retval = [];
$indices = ['item_name',
'item_original_name',
'item_returnlength',
'item_returnopts_num',
'item_returnopts_text',
'item_definition',
'item_comment',
'item_definer'];
$indices = [
'item_name',
'item_original_name',
'item_returnlength',
'item_returnopts_num',
'item_returnopts_text',
'item_definition',
'item_comment',
'item_definer'
];
foreach ($indices as $index) {
$retval[$index] = isset($_POST[$index]) ? $_POST[$index] : '';
}

View File

@ -295,13 +295,15 @@ class Triggers
public function getDataFromRequest()
{
$retval = [];
$indices = ['item_name',
'item_table',
'item_original_name',
'item_action_timing',
'item_event_manipulation',
'item_definition',
'item_definer'];
$indices = [
'item_name',
'item_table',
'item_original_name',
'item_action_timing',
'item_event_manipulation',
'item_definition',
'item_definer'
];
foreach ($indices as $index) {
$retval[$index] = isset($_POST[$index]) ? $_POST[$index] : '';
}
@ -362,11 +364,11 @@ class Triggers
// Escape special characters
$need_escape = [
'item_original_name',
'item_name',
'item_definition',
'item_definer'
];
'item_original_name',
'item_name',
'item_definition',
'item_definer'
];
foreach ($need_escape as $key => $index) {
$item[$index] = htmlentities($item[$index], ENT_QUOTES, 'UTF-8');
}

View File

@ -31,13 +31,13 @@ class Words
switch ($_PMA_RTE) {
case 'RTN':
$words = [
'add' => __('Add routine'),
'docu' => 'STORED_ROUTINES',
'export' => __('Export of routine %s'),
'human' => __('routine'),
'no_create' => __(
'You do not have the necessary privileges to create a routine.'
),
'add' => __('Add routine'),
'docu' => 'STORED_ROUTINES',
'export' => __('Export of routine %s'),
'human' => __('routine'),
'no_create' => __(
'You do not have the necessary privileges to create a routine.'
),
'no_edit' => __(
'No routine with name %1$s found in database %2$s. '
. 'You might be lacking the necessary privileges to edit this routine.'
@ -53,13 +53,13 @@ class Words
break;
case 'TRI':
$words = [
'add' => __('Add trigger'),
'docu' => 'TRIGGERS',
'export' => __('Export of trigger %s'),
'human' => __('trigger'),
'no_create' => __(
'You do not have the necessary privileges to create a trigger.'
),
'add' => __('Add trigger'),
'docu' => 'TRIGGERS',
'export' => __('Export of trigger %s'),
'human' => __('trigger'),
'no_create' => __(
'You do not have the necessary privileges to create a trigger.'
),
'not_found' => __('No trigger with name %1$s found in database %2$s.'),
'nothing' => __('There are no triggers to display.'),
'title' => __('Triggers'),
@ -67,13 +67,13 @@ class Words
break;
case 'EVN':
$words = [
'add' => __('Add event'),
'docu' => 'EVENTS',
'export' => __('Export of event %s'),
'human' => __('event'),
'no_create' => __(
'You do not have the necessary privileges to create an event.'
),
'add' => __('Add event'),
'docu' => 'EVENTS',
'export' => __('Export of event %s'),
'human' => __('event'),
'no_create' => __(
'You do not have the necessary privileges to create an event.'
),
'not_found' => __('No event with name %1$s found in database %2$s.'),
'nothing' => __('There are no events to display.'),
'title' => __('Events'),

View File

@ -235,9 +235,9 @@ class Sql
//Handle the case when number of values
//is more than $cfg['ForeignKeyMaxLimit']
$_url_params = [
'db' => $db,
'table' => $table,
'field' => $column
'db' => $db,
'table' => $table,
'field' => $column
];
$dropdown = '<span class="curr_value">'

View File

@ -591,9 +591,11 @@ class Tracker
}
$statement = rtrim(mb_strstr($log_entry, "\n"));
$ddlog[] = [ 'date' => $date,
'username' => $username,
'statement' => $statement ];
$ddlog[] = [
'date' => $date,
'username' => $username,
'statement' => $statement
];
}
}
@ -621,9 +623,11 @@ class Tracker
}
$statement = rtrim(mb_strstr($log_entry, "\n"));
$dmlog[] = [ 'date' => $date,
'username' => $username,
'statement' => $statement ];
$dmlog[] = [
'date' => $date,
'username' => $username,
'statement' => $statement
];
}
}
@ -719,8 +723,7 @@ class Tracker
$result['tablename'] = $statement->body[3]->value == '.' ? $statement->body[4]->value
: $statement->body[2]->value ;
}
} // Parse ALTER statement
elseif ($statement instanceof AlterStatement) {
} elseif ($statement instanceof AlterStatement) { // Parse ALTER statement
if (empty($options) || !isset($options[3])) {
return $result;
}
@ -734,8 +737,7 @@ class Tracker
$GLOBALS['db'] = $statement->table->table ;
}
} // Parse DROP statement
elseif ($statement instanceof DropStatement) {
} elseif ($statement instanceof DropStatement) { // Parse DROP statement
if (empty($options) || !isset($options[1])) {
return $result;
}
@ -752,8 +754,7 @@ class Tracker
$result['identifier'] = 'DROP INDEX' ;
$result['tablename'] = $statement->table->table;
}
} // Prase RENAME statement
elseif ($statement instanceof RenameStatement) {
} elseif ($statement instanceof RenameStatement) { // Parse RENAME statement
$result['identifier'] = 'RENAME TABLE';
$result['tablename'] = $statement->renames[0]->old->table;
$result['tablename_after_rename'] = $statement->renames[0]->new->table;

View File

@ -38,7 +38,7 @@ class I18nExtension extends TwigI18nExtension
public function getFilters()
{
return [
new TwigFilter('trans', '_gettext'),
new TwigFilter('trans', '_gettext'),
];
}
}

View File

@ -478,40 +478,40 @@ class Types
switch ($class) {
case 'CHAR':
$ret = [
'AES_DECRYPT',
'AES_ENCRYPT',
'BIN',
'CHAR',
'COMPRESS',
'CURRENT_USER',
'DATABASE',
'DAYNAME',
'DES_DECRYPT',
'DES_ENCRYPT',
'ENCRYPT',
'HEX',
'INET6_NTOA',
'INET_NTOA',
'LOAD_FILE',
'LOWER',
'LTRIM',
'MD5',
'MONTHNAME',
'OLD_PASSWORD',
'PASSWORD',
'QUOTE',
'REVERSE',
'RTRIM',
'SHA1',
'SOUNDEX',
'SPACE',
'TRIM',
'UNCOMPRESS',
'UNHEX',
'UPPER',
'USER',
'UUID',
'VERSION',
'AES_DECRYPT',
'AES_ENCRYPT',
'BIN',
'CHAR',
'COMPRESS',
'CURRENT_USER',
'DATABASE',
'DAYNAME',
'DES_DECRYPT',
'DES_ENCRYPT',
'ENCRYPT',
'HEX',
'INET6_NTOA',
'INET_NTOA',
'LOAD_FILE',
'LOWER',
'LTRIM',
'MD5',
'MONTHNAME',
'OLD_PASSWORD',
'PASSWORD',
'QUOTE',
'REVERSE',
'RTRIM',
'SHA1',
'SOUNDEX',
'SPACE',
'TRIM',
'UNCOMPRESS',
'UNHEX',
'UPPER',
'USER',
'UUID',
'VERSION',
];
if (($isMariaDB && $serverVersion < 100012)
@ -523,77 +523,77 @@ class Types
case 'DATE':
return [
'CURRENT_DATE',
'CURRENT_TIME',
'DATE',
'FROM_DAYS',
'FROM_UNIXTIME',
'LAST_DAY',
'NOW',
'SEC_TO_TIME',
'SYSDATE',
'TIME',
'TIMESTAMP',
'UTC_DATE',
'UTC_TIME',
'UTC_TIMESTAMP',
'YEAR',
'CURRENT_DATE',
'CURRENT_TIME',
'DATE',
'FROM_DAYS',
'FROM_UNIXTIME',
'LAST_DAY',
'NOW',
'SEC_TO_TIME',
'SYSDATE',
'TIME',
'TIMESTAMP',
'UTC_DATE',
'UTC_TIME',
'UTC_TIMESTAMP',
'YEAR',
];
case 'NUMBER':
$ret = [
'ABS',
'ACOS',
'ASCII',
'ASIN',
'ATAN',
'BIT_LENGTH',
'BIT_COUNT',
'CEILING',
'CHAR_LENGTH',
'CONNECTION_ID',
'COS',
'COT',
'CRC32',
'DAYOFMONTH',
'DAYOFWEEK',
'DAYOFYEAR',
'DEGREES',
'EXP',
'FLOOR',
'HOUR',
'INET6_ATON',
'INET_ATON',
'LENGTH',
'LN',
'LOG',
'LOG2',
'LOG10',
'MICROSECOND',
'MINUTE',
'MONTH',
'OCT',
'ORD',
'PI',
'QUARTER',
'RADIANS',
'RAND',
'ROUND',
'SECOND',
'SIGN',
'SIN',
'SQRT',
'TAN',
'TO_DAYS',
'TO_SECONDS',
'TIME_TO_SEC',
'UNCOMPRESSED_LENGTH',
'UNIX_TIMESTAMP',
'UUID_SHORT',
'WEEK',
'WEEKDAY',
'WEEKOFYEAR',
'YEARWEEK',
'ABS',
'ACOS',
'ASCII',
'ASIN',
'ATAN',
'BIT_LENGTH',
'BIT_COUNT',
'CEILING',
'CHAR_LENGTH',
'CONNECTION_ID',
'COS',
'COT',
'CRC32',
'DAYOFMONTH',
'DAYOFWEEK',
'DAYOFYEAR',
'DEGREES',
'EXP',
'FLOOR',
'HOUR',
'INET6_ATON',
'INET_ATON',
'LENGTH',
'LN',
'LOG',
'LOG2',
'LOG10',
'MICROSECOND',
'MINUTE',
'MONTH',
'OCT',
'ORD',
'PI',
'QUARTER',
'RADIANS',
'RAND',
'ROUND',
'SECOND',
'SIGN',
'SIN',
'SQRT',
'TAN',
'TO_DAYS',
'TO_SECONDS',
'TIME_TO_SEC',
'UNCOMPRESSED_LENGTH',
'UNIX_TIMESTAMP',
'UUID_SHORT',
'WEEK',
'WEEKDAY',
'WEEKOFYEAR',
'YEARWEEK',
];
if (($isMariaDB && $serverVersion < 100012)
|| $serverVersion < 50603
@ -604,24 +604,24 @@ class Types
case 'SPATIAL':
return [
'GeomFromText',
'GeomFromWKB',
'GeomFromText',
'GeomFromWKB',
'GeomCollFromText',
'LineFromText',
'MLineFromText',
'PointFromText',
'MPointFromText',
'PolyFromText',
'MPolyFromText',
'GeomCollFromText',
'LineFromText',
'MLineFromText',
'PointFromText',
'MPointFromText',
'PolyFromText',
'MPolyFromText',
'GeomCollFromWKB',
'LineFromWKB',
'MLineFromWKB',
'PointFromWKB',
'MPointFromWKB',
'PolyFromWKB',
'MPolyFromWKB',
'GeomCollFromWKB',
'LineFromWKB',
'MLineFromWKB',
'PointFromWKB',
'MPointFromWKB',
'PolyFromWKB',
'MPolyFromWKB',
];
}
return [];
@ -760,7 +760,7 @@ class Types
if (($isMariaDB && $serverVersion > 100207)
|| (!$isMariaDB && $serverVersion >= 50708)) {
$ret['JSON'] = [
'JSON',
'JSON',
];
}

View File

@ -83,12 +83,14 @@ class UserPreferences
if (! isset($_SESSION['userconfig'])) {
$_SESSION['userconfig'] = [
'db' => [],
'ts' => time()];
'ts' => time()
];
}
return [
'config_data' => $_SESSION['userconfig']['db'],
'mtime' => $_SESSION['userconfig']['ts'],
'type' => 'session'];
'type' => 'session'
];
}
// load configuration from pmadb
$query_table = Util::backquote($cfgRelation['db']) . '.'
@ -103,7 +105,8 @@ class UserPreferences
return [
'config_data' => $row ? json_decode($row['config_data'], true) : [],
'mtime' => $row ? $row['ts'] : time(),
'type' => 'db'];
'type' => 'db'
];
}
/**
@ -124,7 +127,8 @@ class UserPreferences
// no pmadb table, use session storage
$_SESSION['userconfig'] = [
'db' => $config_array,
'ts' => time()];
'ts' => time()
];
if (isset($_SESSION['cache'][$cache_key]['userprefs'])) {
unset($_SESSION['cache'][$cache_key]['userprefs']);
}

View File

@ -1554,7 +1554,8 @@ class Util
/* l10n: Short month name */
__('Nov'),
/* l10n: Short month name */
__('Dec')];
__('Dec')
];
$day_of_week = [
/* l10n: Short week day name */
_pgettext('Short week day name', 'Sun'),
@ -1569,7 +1570,8 @@ class Util
/* l10n: Short week day name */
__('Fri'),
/* l10n: Short week day name */
__('Sat')];
__('Sat')
];
if ($format == '') {
/* l10n: See https://secure.php.net/manual/en/function.strftime.php */
@ -2420,8 +2422,6 @@ class Util
if (self::showIcons('TableNavigationLinksMode')) {
$caption3 .= ' &gt;';
$caption4 .= ' &gt;&gt;';
if (! self::showText('TableNavigationLinksMode')) {
}
}
$title3 = ' title="' . _pgettext('Next page', 'Next') . '"';
$title4 = ' title="' . _pgettext('Last page', 'End') . '"';
@ -3255,7 +3255,7 @@ class Util
'@TABLE@' => $vars['table'],
'__TABLE__' => $vars['table'],
'@PHPMYADMIN@' => $vars['phpmyadmin_version'],
];
];
/* Optional escaping */
if (! is_null($escape)) {
@ -3609,8 +3609,6 @@ class Util
if ($geom_type == 'point') {
$funcs['X'] = ['params' => 1, 'type' => 'float'];
$funcs['Y'] = ['params' => 1, 'type' => 'float'];
} elseif ($geom_type == 'multipoint') {
// no functions here
} elseif ($geom_type == 'linestring') {
$funcs['EndPoint'] = ['params' => 1, 'type' => 'point'];
$funcs['GLength'] = ['params' => 1, 'type' => 'float'];
@ -4477,15 +4475,7 @@ class Util
// (needed for proper working of the MaxTableList feature)
$tables = $GLOBALS['dbi']->getTables($db);
$total_num_tables = count($tables);
if (isset($sub_part) && $sub_part == '_export') {
// (don't fetch only a subset if we are coming from
// db_export.php, because I think it's too risky to display only
// a subset of the table names when exporting a db)
/**
*
* @todo Page selector for table names?
*/
} else {
if (! (isset($sub_part) && $sub_part == '_export')) {
// fetch the details for a possible limited subset
$limit_offset = $pos;
$limit_count = true;

View File

@ -146,16 +146,12 @@ if (! empty($submit_mult)
);
break;
} // end switch
} elseif (isset($selected_fld) && !empty($selected_fld)) {
// coming from table structure view - do something with
// selected columns
// handled in StructrueController
} else {
} elseif (! (isset($selected_fld) && !empty($selected_fld))) {
// coming from browsing - do something with selected rows
$what = 'row_delete';
$selected = $_REQUEST['rows_to_delete'];
}
} // end if
}
if (empty($db)) {
$db = '';

View File

@ -64,7 +64,8 @@ if ($action == 'tbl_create.php') {
$form_params = array_merge(
$form_params,
[
'field_where' => Util::getValueByKey($_POST, 'field_where')]
'field_where' => Util::getValueByKey($_POST, 'field_where')
]
);
if (isset($_POST['field_where'])) {
$form_params['after_field'] = $_POST['after_field'];

View File

@ -208,7 +208,8 @@ echo '<table width="100%" cellspacing="0">';
$opts = [
'doc' => $form_display->getDocLink('DefaultLang'),
'values' => [],
'values_escaped' => true];
'values_escaped' => true
];
foreach ($all_languages as $each_lang) {
$opts['values'][$each_lang->getCode()] = $each_lang->getName();
}
@ -226,7 +227,8 @@ echo $formDisplayTemplate->displayInput(
$opts = [
'doc' => $form_display->getDocLink('ServerDefault'),
'values' => [],
'values_disabled' => []];
'values_disabled' => []
];
if ($cf->getServerCount() > 0) {
$opts['values']['0'] = __('let the user choose');
$opts['values']['-'] = '------------------------------';
@ -256,8 +258,10 @@ echo $formDisplayTemplate->displayInput(
$opts = [
'values' => [
'unix' => 'UNIX / Linux (\n)',
'win' => 'Windows (\r\n)'],
'values_escaped' => true];
'win' => 'Windows (\r\n)'
],
'values_escaped' => true
];
$eol = Core::ifSetOr($_SESSION['eol'], (PMA_IS_WINDOWS ? 'win' : 'unix'));
echo $formDisplayTemplate->displayInput(
'eol',

View File

@ -32,9 +32,7 @@ if ($mode == 'edit' && $server_exists) {
$cf->removeServer($id);
header('Location: index.php' . Url::getCommonRaw());
exit;
} elseif ($mode == 'revert' && $server_exists) {
// handled by process_formset()
} else {
} elseif (! ($mode == 'revert' && $server_exists)) {
$page_title = __('Add a new server');
$id = 0;
}

View File

@ -58,7 +58,8 @@ class Index
'fresh' => $fresh,
'active' => true,
'title' => $title,
'message' => $message];
'message' => $message
];
}
/**

View File

@ -61,7 +61,7 @@ class AdvisorTest extends PmaTestCase
['%s%', '%s%%'],
['80% foo', '80%% foo'],
['%s% foo', '%s%% foo'],
];
];
}
/**

View File

@ -474,8 +474,8 @@ class CentralColumnsTest extends TestCase
$result
);
$header_cells = [
__('Name'), __('Type'), __('Length/Values'), __('Default'),
__('Collation'), __('Attributes'), __('Null'), __('A_I')
__('Name'), __('Type'), __('Length/Values'), __('Default'),
__('Collation'), __('Attributes'), __('Null'), __('A_I')
];
$this->assertContains(
$this->callProtectedMethod(

View File

@ -97,7 +97,8 @@ class ConfigFileTest extends PmaTestCase
$default_config = [
self::SIMPLE_KEY_WITH_DEFAULT_VALUE => $default_simple_value,
'Servers/1/host' => $default_host,
'Servers/2/host' => $default_host];
'Servers/2/host' => $default_host
];
/**
* Case 1: set default value, key should not be persisted
@ -185,11 +186,15 @@ class ConfigFileTest extends PmaTestCase
$this->object->updateWithGlobalConfig(['Servers/value1' => 3]);
$this->assertEquals(
['Servers' => [
1 => [
'passthrough1' => 1,
'passthrough2' => 2,
'value1' => 3]]],
[
'Servers' => [
1 => [
'passthrough1' => 1,
'passthrough2' => 2,
'value1' => 3
]
]
],
$this->object->getConfig()
);
$this->assertEquals(

View File

@ -552,7 +552,7 @@ class ConfigTest extends PmaTestCase
'PMA_USR_OS',
'PMA_USR_BROWSER_VER',
'PMA_USR_BROWSER_AGENT'
];
];
foreach ($defines as $define) {
$this->assertTrue(defined($define));

View File

@ -149,12 +149,12 @@ class ServerBinlogControllerTest extends PmaTestCase
]
];
$value = [
'Info' => "index1_Info",
'Log_name' => "index1_Log_name",
'Pos' => "index1_Pos",
'Event_type' => "index1_Event_type",
'End_log_pos' => "index1_End_log_pos",
'Server_id' => "index1_Server_id",
'Info' => "index1_Info",
'Log_name' => "index1_Log_name",
'Pos' => "index1_Pos",
'Event_type' => "index1_Event_type",
'End_log_pos' => "index1_End_log_pos",
'Server_id' => "index1_Server_id",
];
$count = 3;

View File

@ -483,9 +483,11 @@ class CoreTest extends PmaTestCase
{
return [
['https://wiki.phpmyadmin.net',
'./url.php?url=https%3A%2F%2Fwiki.phpmyadmin.net'],
'./url.php?url=https%3A%2F%2Fwiki.phpmyadmin.net'
],
['https://wiki.phpmyadmin.net',
'./url.php?url=https%3A%2F%2Fwiki.phpmyadmin.net'],
'./url.php?url=https%3A%2F%2Fwiki.phpmyadmin.net'
],
['wiki.phpmyadmin.net', 'wiki.phpmyadmin.net'],
['index.php?db=phpmyadmin', 'index.php?db=phpmyadmin']
];
@ -703,7 +705,8 @@ class CoreTest extends PmaTestCase
[[], false, null],
[[1, 2, 3], false, null],
[true, false, null],
[false, false, null]];
[false, false, null]
];
}
/**

View File

@ -60,11 +60,14 @@ class CreateAddFieldTest extends TestCase
{
return [
['', []],
[' PARTITION BY HASH (EXPR()) PARTITIONS 2', [
'partition_by' => 'HASH',
'partition_expr' => 'EXPR()',
'partition_count' => '2',
]],
[
' PARTITION BY HASH (EXPR()) PARTITIONS 2',
[
'partition_by' => 'HASH',
'partition_expr' => 'EXPR()',
'partition_count' => '2',
]
],
];
}
@ -95,14 +98,17 @@ class CreateAddFieldTest extends TestCase
public function providerGetTableCreationQuery()
{
return [
['CREATE TABLE `db`.`table` ();', 'db', 'table', [
'field_name' => [],
'primary_indexes' => '{}',
'indexes' => '{}',
'unique_indexes' => '{}',
'fulltext_indexes' => '{}',
'spatial_indexes' => '{}',
]],
[
'CREATE TABLE `db`.`table` ();', 'db', 'table',
[
'field_name' => [],
'primary_indexes' => '{}',
'indexes' => '{}',
'unique_indexes' => '{}',
'fulltext_indexes' => '{}',
'spatial_indexes' => '{}',
]
],
];
}

View File

@ -155,7 +155,7 @@ class SearchTest extends PmaTestCase
'select_count' => 'SELECT COUNT(*) AS `count` FROM `pma`.`table1` ' .
'WHERE FALSE',
'delete' => 'DELETE FROM `pma`.`table1` WHERE FALSE'
],
],
$this->callProtectedFunction(
'getSearchSqls',
['table1']

View File

@ -182,7 +182,7 @@ class InnodbTest extends PmaTestCase
[
'Bufferpool' => 'Buffer Pool',
'Status' => 'InnoDB Status'
],
],
$this->object->getInfoPages()
);
}

View File

@ -59,9 +59,9 @@ class MemoryTest extends PmaTestCase
$this->object->getVariables(),
[
'max_heap_table_size' => [
'type' => 1,
]
'type' => 1,
]
]
);
}
}

View File

@ -197,24 +197,24 @@ class PbxtTest extends PmaTestCase
return [
[
'8MB',
[
[
0 => '8,192',
1 => 'KiB'
]
]
],
[
'10mb',
[
[
0 => '-1',
1 => 'B'
]
]
],
[
'A4',
[
[
0 => '0',
1 => 'B'
]
]
]
];
}

View File

@ -38,18 +38,27 @@ class IndexTest extends PmaTestCase
$this->_params['Packed'] = "PMA_Packed";
//test add columns
$column1 = ["Column_name" => "column1","Seq_in_index" => "index1",
"Collation" => "Collation1","Cardinality" => "Cardinality1",
"Null" => "null1"
];
$column2 = ["Column_name" => "column2","Seq_in_index" => "index2",
"Collation" => "Collation2","Cardinality" => "Cardinality2",
"Null" => "null2"
];
$column3 = ["Column_name" => "column3","Seq_in_index" => "index3",
"Collation" => "Collation3","Cardinality" => "Cardinality3",
"Null" => "null3"
];
$column1 = [
"Column_name" => "column1",
"Seq_in_index" => "index1",
"Collation" => "Collation1",
"Cardinality" => "Cardinality1",
"Null" => "null1"
];
$column2 = [
"Column_name" => "column2",
"Seq_in_index" => "index2",
"Collation" => "Collation2",
"Cardinality" => "Cardinality2",
"Null" => "null2"
];
$column3 = [
"Column_name" => "column3",
"Seq_in_index" => "index3",
"Collation" => "Collation3",
"Cardinality" => "Cardinality3",
"Null" => "null3"
];
$this->_params['columns'][] = $column1;
$this->_params['columns'][] = $column2;
$this->_params['columns'][] = $column3;

View File

@ -72,18 +72,21 @@ class NormalizationTest extends TestCase
->method('getColumnNames')
->will($this->returnValue(["id", "col1", "col2"]));
$map = [
['PMA_db', 'PMA_table1', DatabaseInterface::CONNECT_USER, []],
[
'PMA_db', 'PMA_table', DatabaseInterface::CONNECT_USER,
[['Key_name' => 'PRIMARY', 'Column_name' => 'id']]
],
[
'PMA_db', 'PMA_table2', DatabaseInterface::CONNECT_USER,
[
['Key_name' => 'PRIMARY', 'Column_name' => 'id'],
['Key_name' => 'PRIMARY', 'Column_name' => 'col1']
]
],
[
'PMA_db', 'PMA_table1', DatabaseInterface::CONNECT_USER,
[]
],
[
'PMA_db', 'PMA_table', DatabaseInterface::CONNECT_USER,
[['Key_name' => 'PRIMARY', 'Column_name' => 'id']]
],
[
'PMA_db', 'PMA_table2', DatabaseInterface::CONNECT_USER,
[
['Key_name' => 'PRIMARY', 'Column_name' => 'id'],
['Key_name' => 'PRIMARY', 'Column_name' => 'col1']
]
],
];
$dbi->expects($this->any())
->method('getTableIndexes')
@ -366,7 +369,7 @@ class NormalizationTest extends TestCase
'html' => '',
'success' => true,
'newTables' => []
],
],
$result
);
$tables = ["PMA_table" => ['col1', 'PMA_table']];
@ -508,7 +511,8 @@ class NormalizationTest extends TestCase
$choices = [
'1nf' => __('First step of normalization (1NF)'),
'2nf' => __('Second step of normalization (1NF+2NF)'),
'3nf' => __('Third step of normalization (1NF+2NF+3NF)')];
'3nf' => __('Third step of normalization (1NF+2NF+3NF)')
];
$htmlTmp = Util::getRadioFields(
'normalizeTo',

View File

@ -58,10 +58,10 @@ class AuthenticationHttpTest extends PmaTestCase
}
/**
* @param mixed $set_minimal set minimal
* @param mixed $body_id body id
* @param mixed $set_title set title
* @param mixed[] ... $headers headers
* @param mixed $set_minimal set minimal
* @param mixed $body_id body id
* @param mixed $set_title set title
* @param mixed[] ... $headers headers
*
* @return void
*/

View File

@ -218,16 +218,16 @@ class RelationTest extends TestCase
->getMock();
$getColumnsResult = [
[
'Field' => 'field1',
'Type' => 'int(11)',
'Comment' => 'Comment1'
],
[
'Field' => 'field2',
'Type' => 'text',
'Comment' => 'Comment1'
]
[
'Field' => 'field1',
'Type' => 'int(11)',
'Comment' => 'Comment1'
],
[
'Field' => 'field2',
'Type' => 'text',
'Comment' => 'Comment1'
]
];
$dbi->expects($this->any())->method('getColumns')
->will($this->returnValue($getColumnsResult));
@ -301,10 +301,10 @@ class RelationTest extends TestCase
{
$foreigners = [
'value' => [
'master_field' => 'value',
'foreign_db' => 'GSoC14',
'foreign_table' => 'test',
'foreign_field' => 'value'
'master_field' => 'value',
'foreign_db' => 'GSoC14',
'foreign_table' => 'test',
'foreign_field' => 'value'
],
'foreign_keys_data' => [
0 => [

View File

@ -256,8 +256,8 @@ class SanitizeTest extends TestCase
['\r\n\\\'<scrIpt></\' + \'script>', "\r\n'<scrIpt></sCRIPT>"],
['\\\';[XSS]', '\';[XSS]'],
[
'</\' + \'script></head><body>[HTML]',
'</SCRIPT></head><body>[HTML]'
'</\' + \'script></head><body>[HTML]',
'</SCRIPT></head><body>[HTML]'
],
['\"\\\'\\\\\\\'\"', '"\'\\\'"'],
["\\\\\'\'\'\'\'\'\'\'\'\'\'\'\\\\", "\\''''''''''''\\"]

View File

@ -45,7 +45,7 @@ class FormProcessingTest extends PmaTestCase
['status: 303 See Other'],
['Location: index.php?lang=en'],
303
]
]
);
// case 1

View File

@ -628,17 +628,17 @@ class TrackerTest extends PmaTestCase
'date_from' => '20-03-2013 23:33:58',
'date_to' => '20-03-2013 23:39:58',
'ddlog' => [
[
'date' => '20-03-2013 23:33:58',
'username' => 'user1',
'statement' => "\nstat1"
],
[
'date' => '20-03-2013 23:39:58',
'username' => 'user2',
'statement' => ""
]
],
[
'date' => '20-03-2013 23:33:58',
'username' => 'user1',
'statement' => "\nstat1"
],
[
'date' => '20-03-2013 23:39:58',
'username' => 'user2',
'statement' => ""
]
],
'dmlog' => [],
"schema_snapshot" => "dataschema",
"tracking" => "SELECT, DELETE"
@ -658,29 +658,29 @@ class TrackerTest extends PmaTestCase
'date_from' => '20-03-2012 23:33:58',
'date_to' => '20-03-2013 23:39:58',
'ddlog' => [
[
'date' => '20-03-2012 23:33:58',
'username' => 'user1',
'statement' => ""
],
[
'date' => '20-03-2012 23:39:58',
'username' => 'user2',
'statement' => ""
]
],
[
'date' => '20-03-2012 23:33:58',
'username' => 'user1',
'statement' => ""
],
[
'date' => '20-03-2012 23:39:58',
'username' => 'user2',
'statement' => ""
]
],
'dmlog' => [
[
'date' => '20-03-2013 23:33:58',
'username' => 'user3',
'statement' => ""
],
[
'date' => '20-03-2013 23:39:58',
'username' => 'user4',
'statement' => ""
]
],
[
'date' => '20-03-2013 23:33:58',
'username' => 'user3',
'statement' => ""
],
[
'date' => '20-03-2013 23:39:58',
'username' => 'user4',
'statement' => ""
]
],
"schema_snapshot" => "dataschema",
"tracking" => "SELECT, DELETE"
];

View File

@ -123,7 +123,7 @@ class TransformationsTest extends TestCase
16 => 'Text/Plain: Longtoipv4',
17 => 'Text/Plain: PreApPend',
18 => 'Text/Plain: Substring',
],
],
'transformation_file' => [
0 => 'Output/Application_Octetstream_Download.php',
1 => 'Output/Application_Octetstream_Hex.php',
@ -171,7 +171,7 @@ class TransformationsTest extends TestCase
'Text_Plain_PreApPend.php',
'Text_Plain_Substring.php',
],
],
],
$this->transformations->getAvailableMimeTypes()
);
}

View File

@ -263,7 +263,8 @@ class TwoFactorTest extends PmaTestCase
'challenge' => 'fEnc9oV79EaBgK5BoNERU5gPKM2XGYWrz4fUjgc0Q7g',
'keyHandle' => 'CTUayZo8hCBeC-sGQJChC0wW-bBg99bmOlGCgw8XGq4dLsxO3yWh9mRYArZxocP5hBB1pEGB3bbJYiM-5acc5w',
'appId' => 'http://demo.example.com'
])];
])
];
$this->assertFalse($object->check(true));
$_POST['u2f_authentication_response'] = '{ "signatureData": "AQAAAAQwRQIhAI6FSrMD3KUUtkpiP0jpIEakql-HNhwWFngyw553pS1CAiAKLjACPOhxzZXuZsVO8im-HStEcYGC50PKhsGp_SUAng==", "clientData": "eyAiY2hhbGxlbmdlIjogImZFbmM5b1Y3OUVhQmdLNUJvTkVSVTVnUEtNMlhHWVdyejRmVWpnYzBRN2ciLCAib3JpZ2luIjogImh0dHA6XC9cL2RlbW8uZXhhbXBsZS5jb20iLCAidHlwIjogIm5hdmlnYXRvci5pZC5nZXRBc3NlcnRpb24iIH0=", "keyHandle": "CTUayZo8hCBeC-sGQJChC0wW-bBg99bmOlGCgw8XGq4dLsxO3yWh9mRYArZxocP5hBB1pEGB3bbJYiM-5acc5w", "errorCode": 0 }';
$this->assertTrue($object->check(true));

View File

@ -711,7 +711,7 @@ class TypesTest extends PmaTestCase
'TINYINT',
'SMALLINT',
'MEDIUMINT',
'INT',
'INT',
'BIGINT',
'-',
'DECIMAL',
@ -732,10 +732,10 @@ class TypesTest extends PmaTestCase
],
'String' => [
'CHAR',
'VARCHAR',
'VARCHAR',
'-',
'TINYTEXT',
'TEXT',
'TEXT',
'MEDIUMTEXT',
'LONGTEXT',
'-',