diff --git a/ajax.php b/ajax.php index 1e098f4b0e..f0c8f74877 100644 --- a/ajax.php +++ b/ajax.php @@ -27,19 +27,19 @@ switch ($_POST['type']) { $response->addJSON('databases', $GLOBALS['dblist']->databases); break; case 'list-tables': - Util::checkParameters(array('db'), true); + Util::checkParameters(['db'], true); $response->addJSON('tables', $GLOBALS['dbi']->getTables($_REQUEST['db'])); break; case 'list-columns': - Util::checkParameters(array('db', 'table'), true); + Util::checkParameters(['db', 'table'], true); $response->addJSON('columns', $GLOBALS['dbi']->getColumnNames($_REQUEST['db'], $_REQUEST['table'])); break; case 'config-get': - Util::checkParameters(array('key'), true); + Util::checkParameters(['key'], true); $response->addJSON('value', $GLOBALS['PMA_Config']->get($_REQUEST['key'])); break; case 'config-set': - Util::checkParameters(array('key', 'value'), true); + Util::checkParameters(['key', 'value'], true); $result = $GLOBALS['PMA_Config']->setUserValue(null, $_REQUEST['key'], json_decode($_REQUEST['value'])); if ($result !== true) { $response = Response::getInstance(); diff --git a/browse_foreigners.php b/browse_foreigners.php index ea585d4065..33b474cc8e 100644 --- a/browse_foreigners.php +++ b/browse_foreigners.php @@ -17,10 +17,10 @@ require_once 'libraries/common.inc.php'; /** * Sets globals from $_REQUEST */ -$request_params = array( +$request_params = [ 'data', 'field' -); +]; foreach ($request_params as $one_request_param) { if (isset($_REQUEST[$one_request_param])) { @@ -28,7 +28,7 @@ foreach ($request_params as $one_request_param) { } } -Util::checkParameters(array('db', 'table', 'field')); +Util::checkParameters(['db', 'table', 'field']); $response = Response::getInstance(); $response->getFooter()->setMinimal(); diff --git a/changelog.php b/changelog.php index 502ce4f114..a76c4dc423 100644 --- a/changelog.php +++ b/changelog.php @@ -55,7 +55,7 @@ $changelog = htmlspecialchars($changelog); $github_url = 'https://github.com/phpmyadmin/phpmyadmin/'; $faq_url = 'https://docs.phpmyadmin.net/en/latest/faq.html'; -$replaces = array( +$replaces = [ '@(https?://[./a-zA-Z0-9.-_-]*[/a-zA-Z0-9_])@' => '\\1', @@ -96,7 +96,7 @@ $replaces = array( // Links target and rel '/a href="/' => 'a target="_blank" rel="noopener noreferrer" href="' -); +]; header('Content-type: text/html; charset=utf-8'); ?> diff --git a/db_central_columns.php b/db_central_columns.php index 78c29c574e..ee3e06efb9 100644 --- a/db_central_columns.php +++ b/db_central_columns.php @@ -65,7 +65,7 @@ if (isset($_POST['getColumnList'])) { exit; } if (isset($_POST['add_column'])) { - $selected_col = array(); + $selected_col = []; $selected_tbl = $_POST['table-select']; $selected_col[] = $_POST['column-select']; $tmp_msg = $centralColumns->syncUniqueColumns( @@ -103,7 +103,7 @@ if (isset($_POST['multi_edit_central_column_save'])) { } } if (isset($_POST['delete_save'])) { - $col_name = array(); + $col_name = []; parse_str($_POST['col_name'], $col_name); $tmp_msg = $centralColumns->deleteColumnsFromList( $col_name['selected_fld'], diff --git a/db_datadict.php b/db_datadict.php index 0edf628eeb..78df150404 100644 --- a/db_datadict.php +++ b/db_datadict.php @@ -47,12 +47,12 @@ $cfgRelation = $relation->getRelationsParam(); /** * Check parameters */ -PhpMyAdmin\Util::checkParameters(array('db')); +PhpMyAdmin\Util::checkParameters(['db']); /** * Defines the url to return to in case of error in a sql statement */ -$err_url = 'db_sql.php' . Url::getCommon(array('db' => $db)); +$err_url = 'db_sql.php' . Url::getCommon(['db' => $db]); if ($cfgRelation['commwork']) { $comment = $relation->getDbComment($db); diff --git a/db_designer.php b/db_designer.php index c555dec1d1..1584a0cd35 100644 --- a/db_designer.php +++ b/db_designer.php @@ -39,15 +39,15 @@ if (isset($_REQUEST['dialog'])) { $req_key = array_search($required, $GLOBALS['designer']['TABLE_NAME']); - $GLOBALS['designer']['TABLE_NAME'] = array($GLOBALS['designer']['TABLE_NAME'][$req_key]); - $GLOBALS['designer_url']['TABLE_NAME_SMALL'] = array($GLOBALS['designer_url']['TABLE_NAME_SMALL'][$req_key]); - $GLOBALS['designer']['TABLE_NAME_SMALL'] = array($GLOBALS['designer']['TABLE_NAME_SMALL'][$req_key]); - $GLOBALS['designer_out']['TABLE_NAME_SMALL'] = array($GLOBALS['designer_out']['TABLE_NAME_SMALL'][$req_key]); - $GLOBALS['designer']['TABLE_TYPE'] = array($GLOBALS['designer_url']['TABLE_TYPE'][$req_key]); - $GLOBALS['designer_out']['OWNER'] = array($GLOBALS['designer_out']['OWNER'][$req_key]); + $GLOBALS['designer']['TABLE_NAME'] = [$GLOBALS['designer']['TABLE_NAME'][$req_key]]; + $GLOBALS['designer_url']['TABLE_NAME_SMALL'] = [$GLOBALS['designer_url']['TABLE_NAME_SMALL'][$req_key]]; + $GLOBALS['designer']['TABLE_NAME_SMALL'] = [$GLOBALS['designer']['TABLE_NAME_SMALL'][$req_key]]; + $GLOBALS['designer_out']['TABLE_NAME_SMALL'] = [$GLOBALS['designer_out']['TABLE_NAME_SMALL'][$req_key]]; + $GLOBALS['designer']['TABLE_TYPE'] = [$GLOBALS['designer_url']['TABLE_TYPE'][$req_key]]; + $GLOBALS['designer_out']['OWNER'] = [$GLOBALS['designer_out']['OWNER'][$req_key]]; $html = $databaseDesigner->getDatabaseTables( - array(), -1, $tab_column, + [], -1, $tab_column, $tables_all_keys, $tables_pk_or_unique_keys ); } @@ -135,7 +135,7 @@ if ($display_page != -1) { $tab_pos = $designerCommon->getTablePositions($display_page); $script_contr = $designerCommon->getScriptContr(); -$params = array('lang' => $GLOBALS['lang']); +$params = ['lang' => $GLOBALS['lang']]; if (isset($_GET['db'])) { $params['db'] = $_GET['db']; } diff --git a/db_export.php b/db_export.php index cfad2ce5d0..47f812744e 100644 --- a/db_export.php +++ b/db_export.php @@ -90,7 +90,7 @@ if (!empty($_POST['selected_tbl']) && empty($table_select)) { // Check if the selected tables are defined in $_GET // (from clicking Back button on export.php) -foreach (array('table_select', 'table_structure', 'table_data') as $one_key) { +foreach (['table_select', 'table_structure', 'table_data'] as $one_key) { if (isset($_GET[$one_key])) { $_GET[$one_key] = urldecode($_GET[$one_key]); $_GET[$one_key] = explode(",", $_GET[$one_key]); diff --git a/db_operations.php b/db_operations.php index 3ef7546a73..99a4942000 100644 --- a/db_operations.php +++ b/db_operations.php @@ -95,10 +95,10 @@ if (strlen($GLOBALS['db']) > 0 "export", "sql", 'libraries/classes/Plugins/Export/', - array( + [ 'single_table' => isset($single_table), 'export_type' => 'database' - ) + ] ); // create stand-in tables for views diff --git a/db_qbe.php b/db_qbe.php index a3359065c9..f162b2de7b 100644 --- a/db_qbe.php +++ b/db_qbe.php @@ -27,7 +27,7 @@ $response = Response::getInstance(); $relation = new Relation(); $cfgRelation = $relation->getRelationsParam(); -$savedSearchList = array(); +$savedSearchList = []; $savedSearch = null; $currentSearchId = null; if ($cfgRelation['savedsearcheswork']) { @@ -60,14 +60,14 @@ if ($cfgRelation['savedsearcheswork']) { $savedSearch = new SavedSearches($GLOBALS); $savedSearch->setUsername($GLOBALS['cfg']['Server']['user']) ->setDbname($_REQUEST['db']); - $_REQUEST = array(); + $_REQUEST = []; } elseif ('load' === $_REQUEST['action']) { if (empty($_REQUEST['searchId'])) { //when not loading a search, reset the object. $savedSearch = new SavedSearches($GLOBALS); $savedSearch->setUsername($GLOBALS['cfg']['Server']['user']) ->setDbname($_REQUEST['db']); - $_REQUEST = array(); + $_REQUEST = []; } else { $loadResult = $savedSearch->load(); } @@ -143,7 +143,7 @@ $db_qbe = new Qbe($GLOBALS['dbi'], $GLOBALS['db'], $savedSearchList, $savedSearc $url = 'db_designer.php' . Url::getCommon( array_merge( $url_params, - array('query' => 1) + ['query' => 1] ) ); $response->addHTML( diff --git a/db_sql_autocomplete.php b/db_sql_autocomplete.php index dae9fa3fa1..2d852c23ba 100644 --- a/db_sql_autocomplete.php +++ b/db_sql_autocomplete.php @@ -13,7 +13,7 @@ require_once 'libraries/common.inc.php'; if ($GLOBALS['cfg']['EnableAutocompleteForTablesAndColumns']) { $db = isset($_POST['db']) ? $_POST['db'] : $GLOBALS['db']; - $sql_autocomplete = array(); + $sql_autocomplete = []; if ($db) { $tableNames = $GLOBALS['dbi']->getTables($db); foreach ($tableNames as $tableName) { diff --git a/db_structure.php b/db_structure.php index 42413134cd..edb1229691 100644 --- a/db_structure.php +++ b/db_structure.php @@ -27,9 +27,9 @@ $container->set('PhpMyAdmin\Response', Response::getInstance()); $container->alias('response', 'PhpMyAdmin\Response'); /* Define dependencies for the concerned controller */ -$dependency_definitions = array( +$dependency_definitions = [ 'db' => $db, -); +]; /** @var DatabaseStructureController $controller */ $controller = $container->get( diff --git a/error_report.php b/error_report.php index eca909e61a..61a641c78d 100644 --- a/error_report.php +++ b/error_report.php @@ -16,7 +16,7 @@ use PhpMyAdmin\Utils\HttpRequest; require_once 'libraries/common.inc.php'; if (!isset($_REQUEST['exception_type']) - ||!in_array($_REQUEST['exception_type'], array('js', 'php')) + ||!in_array($_REQUEST['exception_type'], ['js', 'php']) ) { die('Oops, something went wrong!!'); } diff --git a/examples/config.manyhosts.inc.php b/examples/config.manyhosts.inc.php index 49877db689..fac52633fd 100644 --- a/examples/config.manyhosts.inc.php +++ b/examples/config.manyhosts.inc.php @@ -11,12 +11,12 @@ declare(strict_types=1); $i=0; -$hosts = array ( +$hosts = [ "foo.example.com", "bar.example.com", "baz.example.com", "quux.example.com", -); +]; foreach ($hosts as $host) { $i++; diff --git a/examples/openid.php b/examples/openid.php index 3347c3d799..1c93c204b5 100644 --- a/examples/openid.php +++ b/examples/openid.php @@ -27,12 +27,12 @@ $secure_cookie = false; /** * Map of authenticated users to MySQL user/password pairs. */ -$AUTH_MAP = array( - 'https://launchpad.net/~username' => array( +$AUTH_MAP = [ + 'https://launchpad.net/~username' => [ 'user' => 'root', 'password' => '', - ), - ); + ], + ]; /** * Simple function to show HTML page with given content. diff --git a/examples/signon-script.php b/examples/signon-script.php index 6eea629bee..fd0aadd459 100644 --- a/examples/signon-script.php +++ b/examples/signon-script.php @@ -25,11 +25,11 @@ function get_login_credentials($user) { /* Optionally we can use passed username */ if (!empty($user)) { - return array($user, 'password'); + return [$user, 'password']; } /* Here we would retrieve the credentials */ - $credentials = array('root', ''); + $credentials = ['root', '']; return $credentials; } diff --git a/examples/signon.php b/examples/signon.php index c925722352..b1e95207f9 100644 --- a/examples/signon.php +++ b/examples/signon.php @@ -33,7 +33,7 @@ if (isset($_POST['user'])) { $_SESSION['PMA_single_signon_host'] = $_POST['host']; $_SESSION['PMA_single_signon_port'] = $_POST['port']; /* Update another field of server configuration */ - $_SESSION['PMA_single_signon_cfgupdate'] = array('verbose' => 'Signon test'); + $_SESSION['PMA_single_signon_cfgupdate'] = ['verbose' => 'Signon test']; $id = session_id(); /* Close that session */ @session_write_close(); diff --git a/export.php b/export.php index bcac58936f..3710a3d5a3 100644 --- a/export.php +++ b/export.php @@ -58,7 +58,7 @@ if (isset($_GET['check_time_out'])) { * TODO: this should be removed to avoid passing user input to GLOBALS * without checking */ -$post_params = array( +$post_params = [ 'db', 'table', 'what', @@ -174,7 +174,7 @@ $post_params = array( 'latex_data_label', 'latex_null', 'aliases' -); +]; foreach ($post_params as $one_post_param) { if (isset($_POST[$one_post_param])) { @@ -184,7 +184,7 @@ foreach ($post_params as $one_post_param) { $table = $GLOBALS['table']; -PhpMyAdmin\Util::checkParameters(array('what', 'export_type')); +PhpMyAdmin\Util::checkParameters(['what', 'export_type']); // sanitize this parameter which will be used below in a file inclusion $what = Core::securePath($_POST['what']); @@ -195,10 +195,10 @@ $export_plugin = Plugins::getPlugin( "export", $what, 'libraries/classes/Plugins/Export/', - array( + [ 'export_type' => $export_type, 'single_table' => isset($single_table) - ) + ] ); // Check export type @@ -209,10 +209,10 @@ if (empty($export_plugin)) { /** * valid compression methods */ -$compression_methods = array( +$compression_methods = [ 'zip', 'gzip' -); +]; /** * init and variable checking @@ -273,18 +273,18 @@ if ($_REQUEST['output_format'] == 'astext') { if ($export_type == 'server') { $err_url = 'server_export.php' . Url::getCommon(); } elseif ($export_type == 'database' && strlen($db) > 0) { - $err_url = 'db_export.php' . Url::getCommon(array('db' => $db)); + $err_url = 'db_export.php' . Url::getCommon(['db' => $db]); // Check if we have something to export if (isset($table_select)) { $tables = $table_select; } else { - $tables = array(); + $tables = []; } } elseif ($export_type == 'table' && strlen($db) > 0 && strlen($table) > 0) { $err_url = 'tbl_export.php' . Url::getCommon( - array( + [ 'db' => $db, 'table' => $table - ) + ] ); } else { Core::fatalError(__('Bad parameters!')); @@ -294,7 +294,7 @@ if ($export_type == 'server') { // export page, Export page aliases are given more // preference over SQL Query aliases. $parser = new \PhpMyAdmin\SqlParser\Parser($sql_query); -$aliases = array(); +$aliases = []; if ((!empty($parser->statements[0])) && ($parser->statements[0] instanceof \PhpMyAdmin\SqlParser\Statements\SelectStatement) ) { @@ -318,7 +318,7 @@ $dump_buffer = ''; $dump_buffer_len = 0; // Array of dump_buffers - used in separate file exports -$dump_buffer_objects = array(); +$dump_buffer_objects = []; // We send fake headers to avoid browser timeout when buffering $time_start = time(); @@ -444,10 +444,10 @@ do { ); } elseif ($export_type == 'database') { if (!isset($table_structure) || !is_array($table_structure)) { - $table_structure = array(); + $table_structure = []; } if (!isset($table_data) || !is_array($table_data)) { - $table_data = array(); + $table_data = []; } if (!empty($_REQUEST['structure_or_data_forced'])) { $table_structure = $tables; @@ -486,7 +486,7 @@ do { } if (isset($lock_tables)) { try { - $export->lockTables($db, array($table), "READ"); + $export->lockTables($db, [$table], "READ"); $export->exportTable( $db, $table, $whatStrucOrData, $export_plugin, $crlf, $err_url, $export_type, $do_relation, $do_comments, diff --git a/gis_data_editor.php b/gis_data_editor.php index 190a802c10..feff662da7 100644 --- a/gis_data_editor.php +++ b/gis_data_editor.php @@ -29,16 +29,16 @@ function escape($variable) require_once 'libraries/common.inc.php'; if (! isset($_REQUEST['field'])) { - PhpMyAdmin\Util::checkParameters(array('field')); + PhpMyAdmin\Util::checkParameters(['field']); } // Get data if any posted -$gis_data = array(); +$gis_data = []; if (Core::isValid($_REQUEST['gis_data'], 'array')) { $gis_data = $_REQUEST['gis_data']; } -$gis_types = array( +$gis_types = [ 'POINT', 'MULTIPOINT', 'LINESTRING', @@ -46,7 +46,7 @@ $gis_types = array( 'POLYGON', 'MULTIPOLYGON', 'GEOMETRYCOLLECTION' -); +]; // Extract type from the initial call and make sure that it's a valid one. // Extract from field's values if available, if not use the column type passed. @@ -86,12 +86,12 @@ $wkt_with_zero = $gis_obj->generateWkt($gis_data, 0, '0'); $result = "'" . $wkt . "'," . $srid; // Generate SVG based visualization -$visualizationSettings = array( +$visualizationSettings = [ 'width' => 450, 'height' => 300, 'spatialColumn' => 'wkt' -); -$data = array(array('wkt' => $wkt_with_zero, 'srid' => $srid)); +]; +$data = [['wkt' => $wkt_with_zero, 'srid' => $srid]]; $visualization = GisVisualization::getByData($data, $visualizationSettings) ->toImage('svg'); @@ -100,11 +100,11 @@ $open_layers = GisVisualization::getByData($data, $visualizationSettings) // If the call is to update the WKT and visualization make an AJAX response if (isset($_REQUEST['generate']) && $_REQUEST['generate'] == true) { - $extra_data = array( + $extra_data = [ 'result' => $result, 'visualization' => $visualization, 'openLayers' => $open_layers, - ); + ]; $response = Response::getInstance(); $response->addJSON($extra_data); exit; diff --git a/import.php b/import.php index f5b963a558..2e65fad477 100644 --- a/import.php +++ b/import.php @@ -59,12 +59,12 @@ if (isset($_REQUEST['console_bookmark_add'])) { && isset($_REQUEST['bookmark_query']) && isset($_REQUEST['shared']) ) { $cfgBookmark = Bookmark::getParams($GLOBALS['cfg']['Server']['user']); - $bookmarkFields = array( + $bookmarkFields = [ 'bkm_database' => $_REQUEST['db'], 'bkm_user' => $cfgBookmark['user'], 'bkm_sql_query' => $_REQUEST['bookmark_query'], 'bkm_label' => $_REQUEST['label'] - ); + ]; $isShared = ($_REQUEST['shared'] == 'true' ? true : false); $bookmark = Bookmark::createBookmark( $GLOBALS['dbi'], @@ -91,7 +91,7 @@ $format = ''; /** * Sets globals from $_POST */ -$post_params = array( +$post_params = [ 'charset_of_file', 'format', 'import_type', @@ -101,7 +101,7 @@ $post_params = array( 'noplugin', 'skip_queries', 'local_import_file' -); +]; foreach ($post_params as $one_post_param) { if (isset($_POST[$one_post_param])) { @@ -121,7 +121,7 @@ if (!isset($_SESSION['is_multi_query'])) { $_SESSION['is_multi_query'] = false; } -$ajax_reload = array(); +$ajax_reload = []; // Are we just executing plain query or sql file? // (eg. non import, but query box/window run) if (! empty($sql_query)) { @@ -202,7 +202,7 @@ if (! empty($sql_query)) { // If we didn't get any parameters, either user called this directly, or // upload limit has been reached, let's assume the second possibility. -if ($_POST == array() && $_GET == array()) { +if ($_POST == [] && $_GET == []) { $message = PhpMyAdmin\Message::error( __( 'You probably tried to upload a file that is too large. Please refer ' . @@ -234,7 +234,7 @@ if (isset($_POST['console_message_id'])) { if (! in_array( $format, - array( + [ 'csv', 'ldi', 'mediawiki', @@ -242,7 +242,7 @@ if (! in_array( 'shp', 'sql', 'xml' - ) + ] ) ) { // this should not happen for a normal user @@ -250,25 +250,25 @@ if (! in_array( Core::fatalError('Incorrect format parameter'); } -$post_patterns = array( +$post_patterns = [ '/^force_file_/', '/^' . $format . '_/' -); +]; Core::setPostAsGlobal($post_patterns); // Check needed parameters -PhpMyAdmin\Util::checkParameters(array('import_type', 'format')); +PhpMyAdmin\Util::checkParameters(['import_type', 'format']); // We don't want anything special in format $format = Core::securePath($format); if (strlen($table) > 0 && strlen($db) > 0) { - $urlparams = array('db' => $db, 'table' => $table); + $urlparams = ['db' => $db, 'table' => $table]; } elseif (strlen($db) > 0) { - $urlparams = array('db' => $db); + $urlparams = ['db' => $db]; } else { - $urlparams = array(); + $urlparams = []; } // Create error and goto url @@ -535,7 +535,7 @@ if (! $error && isset($_POST['skip'])) { // This array contain the data like numberof valid sql queries in the statement // and complete valid sql statement (which affected for rows) -$sql_data = array('valid_sql' => array(), 'valid_queries' => 0); +$sql_data = ['valid_sql' => [], 'valid_queries' => 0]; if (! $error) { /* @var $import_plugin ImportPlugin */ @@ -685,7 +685,7 @@ if ($go_sql) { $_SESSION['is_multi_query'] = true; $sql_queries = $sql_data['valid_sql']; } else { - $sql_queries = array($sql_query); + $sql_queries = [$sql_query]; } $html_output = ''; diff --git a/index.php b/index.php index 25e30cdd9f..f49a22c00d 100644 --- a/index.php +++ b/index.php @@ -30,13 +30,13 @@ require_once 'libraries/common.inc.php'; /** * pass variables to child pages */ -$drops = array( +$drops = [ 'lang', 'server', 'collation_connection', 'db', 'table' -); +]; foreach ($drops as $each_drop) { if (array_key_exists($each_drop, $_GET)) { unset($_GET[$each_drop]); @@ -49,9 +49,9 @@ unset($drops, $each_drop); * Such scripts must not be loaded on home page. * */ -$target_blacklist = array ( +$target_blacklist = [ 'import.php', 'export.php' -); +]; // If we have a valid target, let's load that script instead if (! empty($_REQUEST['target']) diff --git a/js/messages.php b/js/messages.php index bc7d17e4d2..380e56605c 100644 --- a/js/messages.php +++ b/js/messages.php @@ -789,7 +789,7 @@ Sanitize::printJsValue( Sanitize::printJsValue("$.datepicker.regional['']['currentText']", __('Today')); Sanitize::printJsValue( "$.datepicker.regional['']['monthNames']", - array( + [ __('January'), __('February'), __('March'), @@ -802,11 +802,11 @@ Sanitize::printJsValue( __('October'), __('November'), __('December') - ) + ] ); Sanitize::printJsValue( "$.datepicker.regional['']['monthNamesShort']", - array( + [ /* l10n: Short month name */ __('Jan'), /* l10n: Short month name */ @@ -831,11 +831,11 @@ Sanitize::printJsValue( __('Nov'), /* l10n: Short month name */ __('Dec') - ) + ] ); Sanitize::printJsValue( "$.datepicker.regional['']['dayNames']", - array( + [ __('Sunday'), __('Monday'), __('Tuesday'), @@ -843,11 +843,11 @@ Sanitize::printJsValue( __('Thursday'), __('Friday'), __('Saturday') - ) + ] ); Sanitize::printJsValue( "$.datepicker.regional['']['dayNamesShort']", - array( + [ /* l10n: Short week day name */ __('Sun'), /* l10n: Short week day name */ @@ -862,11 +862,11 @@ Sanitize::printJsValue( __('Fri'), /* l10n: Short week day name */ __('Sat') - ) + ] ); Sanitize::printJsValue( "$.datepicker.regional['']['dayNamesMin']", - array( + [ /* l10n: Minimal week day name */ __('Su'), /* l10n: Minimal week day name */ @@ -881,7 +881,7 @@ Sanitize::printJsValue( __('Fr'), /* l10n: Minimal week day name */ __('Sa') - ) + ] ); /* l10n: Column header for week of the year in calendar */ Sanitize::printJsValue("$.datepicker.regional['']['weekHeader']", __('Wk')); diff --git a/libraries/check_user_privileges.inc.php b/libraries/check_user_privileges.inc.php index 589c3863d6..4e913765ae 100644 --- a/libraries/check_user_privileges.inc.php +++ b/libraries/check_user_privileges.inc.php @@ -20,7 +20,7 @@ if ($username === '') { // MySQL is started with --skip-grant-tables $GLOBALS['is_create_db_priv'] = true; $GLOBALS['is_reload_priv'] = true; $GLOBALS['db_to_create'] = ''; - $GLOBALS['dbs_where_create_table_allowed'] = array('*'); + $GLOBALS['dbs_where_create_table_allowed'] = ['*']; $GLOBALS['dbs_to_test'] = false; $GLOBALS['db_priv'] = true; $GLOBALS['col_priv'] = true; diff --git a/libraries/classes/Advisor.php b/libraries/classes/Advisor.php index 0244830d46..336b778e09 100644 --- a/libraries/classes/Advisor.php +++ b/libraries/classes/Advisor.php @@ -107,9 +107,9 @@ class Advisor } ); /* Some global variables for advisor */ - $this->globals = array( + $this->globals = [ 'PMA_MYSQL_INT_VERSION' => $this->dbi->getVersion(), - ); + ]; } @@ -229,10 +229,10 @@ class Advisor // $runResult $this->runRules(); - return array( - 'parse' => array('errors' => $this->parseResult['errors']), + return [ + 'parse' => ['errors' => $this->parseResult['errors']], 'run' => $this->runResult - ); + ]; } /** @@ -261,12 +261,12 @@ class Advisor public function runRules(): bool { $this->setRunResult( - array( - 'fired' => array(), - 'notfired' => array(), - 'unchecked' => array(), - 'errors' => array(), - ) + [ + 'fired' => [], + 'notfired' => [], + 'unchecked' => [], + 'errors' => [], + ] ); foreach ($this->parseResult['rules'] as $rule) { @@ -353,7 +353,7 @@ class Advisor if (! is_null($param)) { $params = $this->ruleExprEvaluate('[' . $param . ']'); } else { - $params = array(); + $params = []; } return vsprintf($string, $params); } @@ -369,9 +369,9 @@ class Advisor { $jst = preg_split('/\s*\|\s*/', $rule['justification'], 2); if (count($jst) > 1) { - return array($jst[0], $jst[1]); + return [$jst[0], $jst[1]]; } - return array($rule['justification']); + return [$rule['justification']]; } /** @@ -415,14 +415,14 @@ class Advisor // linking to server_variables.php $rule['recommendation'] = preg_replace_callback( '/\{([a-z_0-9]+)\}/Ui', - array($this, 'replaceVariable'), + [$this, 'replaceVariable'], $this->translate($rule['recommendation']) ); // Replaces external Links with Core::linkURL() generated links $rule['recommendation'] = preg_replace_callback( '#href=("|\')(https?://[^\1]+)\1#i', - array($this, 'replaceLinkURL'), + [$this, 'replaceLinkURL'], $rule['recommendation'] ); break; @@ -452,7 +452,7 @@ class Advisor */ private function replaceVariable(array $matches): string { - return ' $matches[1]]) . '">' . htmlspecialchars($matches[1]) . ''; } @@ -489,21 +489,21 @@ class Advisor $filename = 'libraries/advisory_rules.txt'; $file = file($filename, FILE_IGNORE_NEW_LINES); - $errors = array(); - $rules = array(); - $lines = array(); + $errors = []; + $rules = []; + $lines = []; if ($file === false) { $errors[] = sprintf( __('Error in reading file: The file \'%s\' does not exist or is not readable!'), $filename ); - return array('rules' => $rules, 'lines' => $lines, 'errors' => $errors); + return ['rules' => $rules, 'lines' => $lines, 'errors' => $errors]; } - $ruleSyntax = array( + $ruleSyntax = [ 'name', 'formula', 'test', 'issue', 'recommendation', 'justification' - ); + ]; $numRules = count($ruleSyntax); $numLines = count($file); $ruleNo = -1; @@ -531,8 +531,8 @@ class Advisor if (preg_match("/rule\s'(.*)'( \[(.*)\])?$/", $line, $match)) { $ruleLine = 1; $ruleNo++; - $rules[$ruleNo] = array('name' => $match[1]); - $lines[$ruleNo] = array('name' => $i + 1); + $rules[$ruleNo] = ['name' => $match[1]]; + $lines[$ruleNo] = ['name' => $i + 1]; if (isset($match[3])) { $rules[$ruleNo]['precondition'] = $match[3]; $lines[$ruleNo]['precondition'] = $i + 1; @@ -583,7 +583,7 @@ class Advisor } } - return array('rules' => $rules, 'lines' => $lines, 'errors' => $errors); + return ['rules' => $rules, 'lines' => $lines, 'errors' => $errors]; } /** diff --git a/libraries/classes/Bookmark.php b/libraries/classes/Bookmark.php index 3886892fae..c9e0ef9494 100644 --- a/libraries/classes/Bookmark.php +++ b/libraries/classes/Bookmark.php @@ -176,7 +176,7 @@ class Bookmark */ public function getVariableCount(): int { - $matches = array(); + $matches = []; preg_match_all("/\[VARIABLE[0-9]*\]/", $this->_query, $matches, PREG_SET_ORDER); return count($matches); } @@ -231,11 +231,11 @@ class Bookmark $relation = new Relation(); $cfgRelation = $relation->getRelationsParam(); if ($cfgRelation['bookmarkwork']) { - $cfgBookmark = array( + $cfgBookmark = [ 'user' => $user, 'db' => $cfgRelation['db'], 'table' => $cfgRelation['bookmark'], - ); + ]; } else { $cfgBookmark = false; } @@ -296,7 +296,7 @@ class Bookmark ): array { $cfgBookmark = self::getParams($user); if (empty($cfgBookmark)) { - return array(); + return []; } $query = "SELECT * FROM " . Util::backquote($cfgBookmark['db']) @@ -317,7 +317,7 @@ class Bookmark ); if (! empty($result)) { - $bookmarks = array(); + $bookmarks = []; foreach ($result as $row) { $bookmark = new Bookmark($dbi, $user); $bookmark->_id = $row['id']; @@ -331,7 +331,7 @@ class Bookmark return $bookmarks; } - return array(); + return []; } /** diff --git a/libraries/classes/BrowseForeigners.php b/libraries/classes/BrowseForeigners.php index 7fbec3b871..01542349a8 100644 --- a/libraries/classes/BrowseForeigners.php +++ b/libraries/classes/BrowseForeigners.php @@ -144,7 +144,7 @@ class BrowseForeigners $output .= ''; - return array($output, $horizontal_count, $indexByDescription); + return [$output, $horizontal_count, $indexByDescription]; } /** @@ -226,8 +226,8 @@ class BrowseForeigners . '' . $header . '' . "\n" . '' . "\n"; - $descriptions = array(); - $keys = array(); + $descriptions = []; + $keys = []; foreach ($foreignData['disp_row'] as $relrow) { if ($foreignData['foreign_display'] != false) { $descriptions[] = $relrow[$foreignData['foreign_display']]; @@ -291,7 +291,7 @@ class BrowseForeigners . '...' ); } - return array($description, $descriptionTitle); + return [$description, $descriptionTitle]; } /** diff --git a/libraries/classes/CentralColumns.php b/libraries/classes/CentralColumns.php index 117042dd14..ef3c59ba28 100644 --- a/libraries/classes/CentralColumns.php +++ b/libraries/classes/CentralColumns.php @@ -98,11 +98,11 @@ class CentralColumns $cfgRelation = $this->relation->getRelationsParam(); if ($cfgRelation['centralcolumnswork']) { - $cfgCentralColumns = array( + $cfgCentralColumns = [ 'user' => $this->user, 'db' => $cfgRelation['db'], 'table' => $cfgRelation['central_columns'], - ); + ]; } else { $cfgCentralColumns = false; } @@ -125,7 +125,7 @@ class CentralColumns { $cfgCentralColumns = $this->getParams(); if (empty($cfgCentralColumns)) { - return array(); + return []; } $pmadb = $cfgCentralColumns['db']; $this->dbi->selectDb($pmadb, DatabaseInterface::CONNECT_CONTROL); @@ -192,7 +192,7 @@ class CentralColumns ): array { $cfgCentralColumns = $this->getParams(); if (empty($cfgCentralColumns)) { - return array(); + return []; } $pmadb = $cfgCentralColumns['db']; $this->dbi->selectDb($pmadb, DatabaseInterface::CONNECT_CONTROL); @@ -274,7 +274,7 @@ class CentralColumns . '\'' . $this->dbi->escapeString((string) $length) . '\',\'' . $this->dbi->escapeString($collation) . '\',' . '\'' . $this->dbi->escapeString($isNull) . '\',' - . '\'' . implode(',', array($extra, $attribute)) + . '\'' . implode(',', [$extra, $attribute]) . '\',\'' . $this->dbi->escapeString($default) . '\');'; return $insQuery; } @@ -305,10 +305,10 @@ class CentralColumns $pmadb = $cfgCentralColumns['db']; $central_list_table = $cfgCentralColumns['table']; $this->dbi->selectDb($db); - $existingCols = array(); + $existingCols = []; $cols = ""; - $insQuery = array(); - $fields = array(); + $insQuery = []; + $fields = []; $message = true; if ($isTable) { foreach ($field_select as $table) { @@ -413,8 +413,8 @@ class CentralColumns $central_list_table = $cfgCentralColumns['table']; $this->dbi->selectDb($db); $message = true; - $colNotExist = array(); - $fields = array(); + $colNotExist = []; + $fields = []; if ($isTable) { $cols = ''; foreach ($field_select as $table) { @@ -565,7 +565,7 @@ class CentralColumns ): array { $cfgCentralColumns = $this->getParams(); if (empty($cfgCentralColumns)) { - return array(); + return []; } $this->dbi->selectDb($db); $fields = (array) $this->dbi->getColumnNames( @@ -581,7 +581,7 @@ class CentralColumns return (array)$has_list; } - return array(); + return []; } /** @@ -619,7 +619,7 @@ class CentralColumns $centralTable = $cfgCentralColumns['table']; $this->dbi->selectDb($cfgCentralColumns['db'], DatabaseInterface::CONNECT_CONTROL); if ($orig_col_name == "") { - $def = array(); + $def = []; $def['Type'] = $col_type; if ($col_length) { $def['Type'] .= '(' . $col_length . ')'; @@ -638,7 +638,7 @@ class CentralColumns . ', col_isNull = ' . $col_isNull . ', col_collation = \'' . $this->dbi->escapeString($collation) . '\'' . ', col_extra = \'' - . implode(',', array($col_extra, $col_attribute)) . '\'' + . implode(',', [$col_extra, $col_attribute]) . '\'' . ', col_default = \'' . $this->dbi->escapeString($col_default) . '\'' . ' WHERE db_name = \'' . $this->dbi->escapeString($db) . '\' ' . 'AND col_name = \'' . $this->dbi->escapeString($orig_col_name) @@ -667,8 +667,8 @@ class CentralColumns $col_attribute = $_POST['field_attribute']; $col_type = $_POST['field_type']; $collation = $_POST['field_collation']; - $col_isNull = array(); - $col_extra = array(); + $col_isNull = []; + $col_extra = []; $num_central_fields = count($orig_col_name); for ($i = 0; $i < $num_central_fields ; $i++) { $col_isNull[$i] = isset($_POST['field_null'][$i]) ? 1 : 0; @@ -712,14 +712,14 @@ class CentralColumns $page_selector = ($nbTotalPage > 1)?(Util::pageselector( 'pos', $this->maxRows, $pageNow, $nbTotalPage )):''; - return Template::get('database/central_columns/table_navigation')->render(array( + return Template::get('database/central_columns/table_navigation')->render([ "pos" => $pos, "max_rows" => $this->maxRows, "db" => $db, "total_rows" => $total_rows, "nb_total_page" => $nbTotalPage, "page_selector" => $page_selector, - )); + ]); } /** @@ -736,11 +736,11 @@ class CentralColumns string $title = '', int $actionCount = 0 ): string { - return Template::get('database/central_columns/table_header')->render(array( + return Template::get('database/central_columns/table_header')->render([ "class" => $class, "title" => $title, "actionCount" => $actionCount, - )); + ]); } /** @@ -826,12 +826,12 @@ class CentralColumns string $db ): string { $table_drop_down = $this->getHtmlForTableDropdown($db); - return Template::get('database/central_columns/add_column')->render(array( + return Template::get('database/central_columns/add_column')->render([ 'pos' => $pos, 'db' => $db, 'total_rows' => $total_rows, 'table_drop_down' => $table_drop_down, - )); + ]); } /** @@ -845,7 +845,7 @@ class CentralColumns */ public function getHtmlForTableRow(array $row, int $row_num, string $db): string { - $meta = array(); + $meta = []; if (!isset($row['col_default']) || $row['col_default'] == '') { $meta['DefaultType'] = 'NONE'; } else { @@ -860,65 +860,65 @@ class CentralColumns $meta['DefaultValue'] = $row['col_default']; } } - $column_name = Template::get('columns_definitions/column_name')->render(array( + $column_name = Template::get('columns_definitions/column_name')->render([ 'column_number' => $row_num, 'ci' => 0, 'ci_offset' => 0, - 'column_meta' => array( + 'column_meta' => [ 'Field'=>$row['col_name'] - ), - 'cfg_relation' => array( + ], + 'cfg_relation' => [ 'centralcolumnswork' => false - ), + ], 'max_rows' => $this->maxRows, - )); - $column_type = Template::get('columns_definitions/column_type')->render(array( + ]); + $column_type = Template::get('columns_definitions/column_type')->render([ 'column_number' => $row_num, 'ci' => 1, 'ci_offset' => 0, 'type_upper' => mb_strtoupper($row['col_type']), - 'column_meta' => array() - )); - $column_length = Template::get('columns_definitions/column_length')->render(array( + 'column_meta' => [] + ]); + $column_length = Template::get('columns_definitions/column_length')->render([ 'column_number' => $row_num, 'ci' => 2, 'ci_offset' => 0, 'length_values_input_size' => 8, 'length_to_display' => $row['col_length'] - )); - $column_default = Template::get('columns_definitions/column_default')->render(array( + ]); + $column_default = Template::get('columns_definitions/column_default')->render([ 'column_number' => $row_num, 'ci' => 3, 'ci_offset' => 0, 'type_upper' => mb_strtoupper($row['col_type']), 'column_meta' => $meta, 'char_editing' => $this->charEditing, - )); - $column_attribute = Template::get('columns_definitions/column_attribute')->render(array( + ]); + $column_attribute = Template::get('columns_definitions/column_attribute')->render([ 'column_number' => $row_num, 'ci' => 5, 'ci_offset' => 0, - 'extracted_columnspec' => array(), + 'extracted_columnspec' => [], 'column_meta' => $row['col_attribute'], 'submit_attribute' => false, 'attribute_types' => $this->dbi->types->getAttributes(), - )); - $column_null = Template::get('columns_definitions/column_null')->render(array( + ]); + $column_null = Template::get('columns_definitions/column_null')->render([ 'column_number' => $row_num, 'ci' => 6, 'ci_offset' => 0, - 'column_meta' => array( + 'column_meta' => [ 'Null' => $row['col_isNull'] - ) - )); - $column_extra = Template::get('columns_definitions/column_extra')->render(array( + ] + ]); + $column_extra = Template::get('columns_definitions/column_extra')->render([ 'column_number' => $row_num, 'ci' => 7, 'ci_offset' => 0, - 'column_meta' => array('Extra'=>$row['col_extra']) - )); + 'column_meta' => ['Extra'=>$row['col_extra']] + ]); - return Template::get('database/central_columns/table_row')->render(array( + return Template::get('database/central_columns/table_row')->render([ 'column_name' => $column_name, 'column_type' => $column_type, 'column_length' => $column_length, @@ -931,7 +931,7 @@ class CentralColumns 'db' => $db, 'dbi' => $this->dbi, 'disableIs' => $this->disableIs, - )); + ]); } /** @@ -949,45 +949,45 @@ class CentralColumns . '' . '' - . Template::get('columns_definitions/column_name')->render(array( + . Template::get('columns_definitions/column_name')->render([ 'column_number' => $row_num, 'ci' => 0, 'ci_offset' => 0, - 'column_meta' => array( + 'column_meta' => [ 'Field' => $row['col_name'] - ), - 'cfg_relation' => array( + ], + 'cfg_relation' => [ 'centralcolumnswork' => false - ), + ], 'max_rows' => $this->maxRows, - )) + ]) . ''; $tableHtml .= '' . Template::get('columns_definitions/column_type') ->render( - array( + [ 'column_number' => $row_num, 'ci' => 1, 'ci_offset' => 0, 'type_upper' => mb_strtoupper($row['col_type']), - 'column_meta' => array() - ) + 'column_meta' => [] + ] ) . ''; $tableHtml .= '' . Template::get('columns_definitions/column_length')->render( - array( + [ 'column_number' => $row_num, 'ci' => 2, 'ci_offset' => 0, 'length_values_input_size' => 8, 'length_to_display' => $row['col_length'] - ) + ] ) . ''; - $meta = array(); + $meta = []; if (!isset($row['col_default']) || $row['col_default'] == '') { $meta['DefaultType'] = 'NONE'; } else { @@ -1006,14 +1006,14 @@ class CentralColumns '' . Template::get('columns_definitions/column_default') ->render( - array( + [ 'column_number' => $row_num, 'ci' => 3, 'ci_offset' => 0, 'type_upper' => mb_strtoupper((string) $row['col_default']), 'column_meta' => $meta, 'char_editing' => $this->charEditing, - ) + ] ) . ''; $tableHtml .= @@ -1029,43 +1029,43 @@ class CentralColumns '' . Template::get('columns_definitions/column_attribute') ->render( - array( + [ 'column_number' => $row_num, 'ci' => 5, 'ci_offset' => 0, - 'extracted_columnspec' => array( + 'extracted_columnspec' => [ 'attribute' => $row['col_attribute'] - ), - 'column_meta' => array(), + ], + 'column_meta' => [], 'submit_attribute' => false, 'attribute_types' => $this->dbi->types->getAttributes(), - ) + ] ) . ''; $tableHtml .= '' . Template::get('columns_definitions/column_null') ->render( - array( + [ 'column_number' => $row_num, 'ci' => 6, 'ci_offset' => 0, - 'column_meta' => array( + 'column_meta' => [ 'Null' => $row['col_isNull'] - ) - ) + ] + ] ) . ''; $tableHtml .= '' . Template::get('columns_definitions/column_extra')->render( - array( + [ 'column_number' => $row_num, 'ci' => 7, 'ci_offset' => 0, - 'column_meta' => array('Extra' => $row['col_extra']) - ) + 'column_meta' => ['Extra' => $row['col_extra']] + ] ) . ''; $tableHtml .= ''; @@ -1086,7 +1086,7 @@ class CentralColumns { $cfgCentralColumns = $this->getParams(); if (empty($cfgCentralColumns)) { - return json_encode(array()); + return json_encode([]); } $centralTable = $cfgCentralColumns['table']; if (empty($table) || $table == '') { @@ -1129,11 +1129,11 @@ class CentralColumns { $html_output = Template::get('select_all') ->render( - array( + [ 'pma_theme_image' => $pmaThemeImage, 'text_dir' => $text_dir, 'form_name' => 'tableslistcontainer', - ) + ] ); $html_output .= Util::getButtonOrImage( 'edit_central_columns', 'mult_submit change_central_columns', @@ -1221,51 +1221,51 @@ class CentralColumns $addNewColumn .= '' . '' . '' - . Template::get('columns_definitions/column_name')->render(array( + . Template::get('columns_definitions/column_name')->render([ 'column_number' => 0, 'ci' => 0, 'ci_offset' => 0, - 'column_meta' => array(), - 'cfg_relation' => array( + 'column_meta' => [], + 'cfg_relation' => [ 'centralcolumnswork' => false - ), + ], 'max_rows' => $this->maxRows, - )) + ]) . '' . '' . Template::get('columns_definitions/column_type') ->render( - array( + [ 'column_number' => 0, 'ci' => 1, 'ci_offset' => 0, 'type_upper' => '', - 'column_meta' => array() - ) + 'column_meta' => [] + ] ) . '' . '' . Template::get('columns_definitions/column_length')->render( - array( + [ 'column_number' => 0, 'ci' => 2, 'ci_offset' => 0, 'length_values_input_size' => 8, 'length_to_display' => '' - ) + ] ) . '' . '' . Template::get('columns_definitions/column_default') ->render( - array( + [ 'column_number' => 0, 'ci' => 3, 'ci_offset' => 0, 'type_upper' => '', - 'column_meta' => array(), + 'column_meta' => [], 'char_editing' => $this->charEditing, - ) + ] ) . '' . '' @@ -1279,36 +1279,36 @@ class CentralColumns . '' . Template::get('columns_definitions/column_attribute') ->render( - array( + [ 'column_number' => 0, 'ci' => 5, 'ci_offset' => 0, - 'extracted_columnspec' => array(), - 'column_meta' => array(), + 'extracted_columnspec' => [], + 'column_meta' => [], 'submit_attribute' => false, 'attribute_types' => $this->dbi->types->getAttributes(), - ) + ] ) . '' . '' . Template::get('columns_definitions/column_null') ->render( - array( + [ 'column_number' => 0, 'ci' => 6, 'ci_offset' => 0, - 'column_meta' => array() - ) + 'column_meta' => [] + ] ) . '' . '' . Template::get('columns_definitions/column_extra')->render( - array( + [ 'column_number' => 0, 'ci' => 7, 'ci_offset' => 0, - 'column_meta' => array() - ) + 'column_meta' => [] + ] ) . '' . ' ' @@ -1330,12 +1330,12 @@ class CentralColumns public function getHtmlForEditingPage(array $selected_fld, string $selected_db): string { $html = '
'; - $header_cells = array( + $header_cells = [ __('Name'), __('Type'), __('Length/Values'), __('Default'), __('Collation'), __('Attributes'), __('Null'), __('A_I') - ); + ]; $html .= $this->getEditTableHeader($header_cells); - $selected_fld_safe = array(); + $selected_fld_safe = []; foreach ($selected_fld as $key) { $selected_fld_safe[] = $this->dbi->escapeString($key); } diff --git a/libraries/classes/Charsets.php b/libraries/classes/Charsets.php index 93cd33474b..b706143a9d 100644 --- a/libraries/classes/Charsets.php +++ b/libraries/classes/Charsets.php @@ -24,7 +24,7 @@ class Charsets * * @var array */ - public static $mysql_charset_map = array( + public static $mysql_charset_map = [ 'big5' => 'big5', 'cp-866' => 'cp866', 'euc-jp' => 'ujis', @@ -48,12 +48,12 @@ class Charsets 'windows-1252' => 'latin1', 'windows-1256' => 'cp1256', 'windows-1257' => 'cp1257', - ); + ]; - private static $_charsets = array(); - private static $_charsets_descriptions = array(); - private static $_collations = array(); - private static $_default_collations = array(); + private static $_charsets = []; + private static $_charsets_descriptions = []; + private static $_collations = []; + private static $_default_collations = []; /** * Loads charset data from the MySQL server. @@ -79,7 +79,7 @@ class Charsets } $res = $dbi->query($sql); - self::$_charsets = array(); + self::$_charsets = []; while ($row = $dbi->fetchAssoc($res)) { $name = $row['Charset']; self::$_charsets[] = $name; @@ -311,7 +311,7 @@ class Charsets $name = __('Unknown'); $variant = null; - $suffixes = array(); + $suffixes = []; $unicode = false; $unknown = false; diff --git a/libraries/classes/CheckUserPrivileges.php b/libraries/classes/CheckUserPrivileges.php index fef595bbad..8f9a3505cf 100644 --- a/libraries/classes/CheckUserPrivileges.php +++ b/libraries/classes/CheckUserPrivileges.php @@ -67,11 +67,11 @@ class CheckUserPrivileges ); $show_grants_tblname = Util::unQuote($show_grants_tblname, '`'); - return array( + return [ $show_grants_str, $show_grants_dbname, $show_grants_tblname - ); + ]; } /** @@ -198,7 +198,7 @@ class CheckUserPrivileges $GLOBALS['is_create_db_priv'] = false; $GLOBALS['is_reload_priv'] = false; $GLOBALS['db_to_create'] = ''; - $GLOBALS['dbs_where_create_table_allowed'] = array(); + $GLOBALS['dbs_where_create_table_allowed'] = []; $GLOBALS['dbs_to_test'] = $this->dbi->getSystemSchemas(); $GLOBALS['proc_priv'] = false; $GLOBALS['db_priv'] = false; diff --git a/libraries/classes/Config.php b/libraries/classes/Config.php index 40a1b16a34..579ddb8ed2 100644 --- a/libraries/classes/Config.php +++ b/libraries/classes/Config.php @@ -39,17 +39,17 @@ class Config /** * @var array default configuration settings */ - public $default = array(); + public $default = []; /** * @var array configuration settings, without user preferences applied */ - public $base_settings = array(); + public $base_settings = []; /** * @var array configuration settings */ - public $settings = array(); + public $settings = []; /** * @var string config source @@ -76,7 +76,7 @@ class Config /** * @var array */ - public $default_server = array(); + public $default_server = []; /** * @var boolean whether init is done or not @@ -97,7 +97,7 @@ class Config */ public function __construct(?string $source = null) { - $this->settings = array('is_setup' => false); + $this->settings = ['is_setup' => false]; // functions need to refresh in case of config file changed goes in // PhpMyAdmin\Config::load() @@ -389,7 +389,7 @@ class Config } } elseif (is_file($git)) { $contents = file_get_contents($git); - $gitmatch = array(); + $gitmatch = []; // Matches expected format if (! preg_match('/^gitdir: (.*)$/', $contents, $gitmatch)) { @@ -498,7 +498,7 @@ class Config $commit = explode("\n", $commit[1]); $_SESSION['PMA_VERSION_COMMITDATA_' . $hash] = $commit; } else { - $pack_names = array(); + $pack_names = []; // work with packed data $packs_file = $git_folder . '/objects/info/packs'; if (@file_exists($packs_file) @@ -693,20 +693,20 @@ class Config } if ($commit !== false) { - $author = array('name' => '', 'email' => '', 'date' => ''); - $committer = array('name' => '', 'email' => '', 'date' => ''); + $author = ['name' => '', 'email' => '', 'date' => '']; + $committer = ['name' => '', 'email' => '', 'date' => '']; do { $dataline = array_shift($commit); $datalinearr = explode(' ', $dataline, 2); $linetype = $datalinearr[0]; - if (in_array($linetype, array('author', 'committer'))) { + if (in_array($linetype, ['author', 'committer'])) { $user = $datalinearr[1]; preg_match('/([^<]+)<([^>]+)> ([0-9]+)( [^ ]+)?/', $user, $user); - $user2 = array( + $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]; } @@ -716,14 +716,14 @@ class Config $message = trim(implode(' ', $commit)); } elseif (isset($commit_json) && isset($commit_json->author) && isset($commit_json->committer)) { - $author = array( + $author = [ 'name' => $commit_json->author->name, 'email' => $commit_json->author->email, - 'date' => $commit_json->author->date); - $committer = array( + '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 { return; @@ -746,7 +746,7 @@ class Config */ public function loadDefaults(): bool { - $cfg = array(); + $cfg = []; if (! @file_exists($this->default_source)) { $this->error_config_default_file = true; return false; @@ -797,7 +797,7 @@ class Config return false; } - $cfg = array(); + $cfg = []; /** * Parses the configuration file, we throw away any errors or @@ -1380,7 +1380,7 @@ class Config $GLOBALS['max_upload_size'] = $this->get('max_upload_size'); $GLOBALS['is_https'] = $this->get('is_https'); - $defines = array( + $defines = [ 'PMA_VERSION', 'PMA_MAJOR_VERSION', 'PMA_THEME_VERSION', @@ -1390,7 +1390,7 @@ class Config 'PMA_USR_OS', 'PMA_USR_BROWSER_VER', 'PMA_USR_BROWSER_AGENT' - ); + ]; foreach ($defines as $define) { if (! defined($define)) { @@ -1570,7 +1570,7 @@ class Config */ public function getTempDir(string $name): ?string { - static $temp_dir = array(); + static $temp_dir = []; if (isset($temp_dir[$name]) && !defined('TESTSUITE')) { return $temp_dir[$name]; @@ -1602,11 +1602,11 @@ class Config { // First try configured temp dir // Fallback to PHP upload_tmp_dir - $dirs = array( + $dirs = [ $this->getTempDir('upload'), ini_get('upload_tmp_dir'), sys_get_temp_dir(), - ); + ]; foreach ($dirs as $dir) { if (! empty($dir) && @is_writable($dir)) { @@ -1666,7 +1666,7 @@ class Config $this->settings['Server'] = $this->settings['Servers'][$server]; } else { $server = 0; - $this->settings['Server'] = array(); + $this->settings['Server'] = []; } } @@ -1683,10 +1683,10 @@ class Config // Do we have some server? if (! isset($this->settings['Servers']) || count($this->settings['Servers']) == 0) { // No server => create one with defaults - $this->settings['Servers'] = array(1 => $this->default_server); + $this->settings['Servers'] = [1 => $this->default_server]; } else { // We have server(s) => apply default configuration - $new_servers = array(); + $new_servers = []; foreach ($this->settings['Servers'] as $server_index => $each_server) { @@ -1717,5 +1717,5 @@ class Config } if (!defined('TESTSUITE')) { - register_shutdown_function(array('PhpMyAdmin\Config', 'fatalErrorHandler')); + register_shutdown_function(['PhpMyAdmin\Config', 'fatalErrorHandler']); } diff --git a/libraries/classes/Config/ConfigFile.php b/libraries/classes/Config/ConfigFile.php index 918bbc4450..ec5863f877 100644 --- a/libraries/classes/Config/ConfigFile.php +++ b/libraries/classes/Config/ConfigFile.php @@ -48,14 +48,14 @@ class ConfigFile * Keys which will be always written to config file * @var array */ - private $_persistKeys = array(); + private $_persistKeys = []; /** * Changes keys while updating config in {@link updateWithGlobalConfig()} * or reading by {@link getConfig()} or {@link getConfigArray()} * @var array */ - private $_cfgUpdateReadMapping = array(); + private $_cfgUpdateReadMapping = []; /** * Key filter for {@link set()} @@ -104,7 +104,7 @@ class ConfigFile $this->_isInSetup = is_null($base_config); $this->_id = 'ConfigFile' . $GLOBALS['server']; if (!isset($_SESSION[$this->_id])) { - $_SESSION[$this->_id] = array(); + $_SESSION[$this->_id] = []; } } @@ -174,7 +174,7 @@ class ConfigFile */ public function resetConfigData() { - $_SESSION[$this->_id] = array(); + $_SESSION[$this->_id] = []; } /** @@ -258,7 +258,7 @@ class ConfigFile // no recursion for numeric arrays if (is_array($value) && !isset($value[0])) { $prefix .= $key . '/'; - array_walk($value, array($this, '_flattenArray'), $prefix); + array_walk($value, [$this, '_flattenArray'], $prefix); } else { $this->_flattenArrayResult[$prefix . $key] = $value; } @@ -271,8 +271,8 @@ class ConfigFile */ public function getFlatDefaultConfig() { - $this->_flattenArrayResult = array(); - array_walk($this->_defaultCfg, array($this, '_flattenArray'), ''); + $this->_flattenArrayResult = []; + array_walk($this->_defaultCfg, [$this, '_flattenArray'], ''); $flat_cfg = $this->_flattenArrayResult; $this->_flattenArrayResult = null; return $flat_cfg; @@ -289,8 +289,8 @@ class ConfigFile public function updateWithGlobalConfig(array $cfg) { // load config array and flatten it - $this->_flattenArrayResult = array(); - array_walk($cfg, array($this, '_flattenArray'), ''); + $this->_flattenArrayResult = []; + array_walk($cfg, [$this, '_flattenArray'], ''); $flat_cfg = $this->_flattenArrayResult; $this->_flattenArrayResult = null; @@ -507,8 +507,8 @@ class ConfigFile */ public function getConfigArray() { - $this->_flattenArrayResult = array(); - array_walk($_SESSION[$this->_id], array($this, '_flattenArray'), ''); + $this->_flattenArrayResult = []; + array_walk($_SESSION[$this->_id], [$this, '_flattenArray'], ''); $c = $this->_flattenArrayResult; $this->_flattenArrayResult = null; diff --git a/libraries/classes/Config/Descriptions.php b/libraries/classes/Config/Descriptions.php index 58c9f4f2c6..d5cb446f03 100644 --- a/libraries/classes/Config/Descriptions.php +++ b/libraries/classes/Config/Descriptions.php @@ -31,8 +31,8 @@ class Descriptions public static function get($path, $type = 'name') { $key = str_replace( - array('Servers/1/', '/'), - array('Servers/', '_'), + ['Servers/1/', '/'], + ['Servers/', '_'], $path ); $value = self::getString($key, $type); diff --git a/libraries/classes/Config/Form.php b/libraries/classes/Config/Form.php index a9b724294d..c1f9bfc151 100644 --- a/libraries/classes/Config/Form.php +++ b/libraries/classes/Config/Form.php @@ -104,11 +104,11 @@ class Form $value = $this->_configFile->getDbEntry($option_path); if ($value === null) { trigger_error("$option_path - select options not defined", E_USER_ERROR); - return array(); + return []; } if (!is_array($value)) { trigger_error("$option_path - not a static value list", E_USER_ERROR); - return array(); + return []; } // convert array('#', 'a', 'b') to array('a', 'b') if (isset($value[0]) && $value[0] === '#') { @@ -120,7 +120,7 @@ class Form // convert value list array('a', 'b') to array('a' => 'a', 'b' => 'b') $has_string_keys = false; - $keys = array(); + $keys = []; for ($i = 0, $nb = count($value); $i < $nb; $i++) { if (!isset($value[$i])) { $has_string_keys = true; @@ -152,7 +152,7 @@ class Form if (is_array($value)) { $prefix .= $key . '/'; - array_walk($value, array($this, '_readFormPathsCallback'), $prefix); + array_walk($value, [$this, '_readFormPathsCallback'], $prefix); return; } @@ -177,13 +177,13 @@ class Form protected function readFormPaths(array $form) { // flatten form fields' paths and save them to $fields - $this->fields = array(); - array_walk($form, array($this, '_readFormPathsCallback'), ''); + $this->fields = []; + array_walk($form, [$this, '_readFormPathsCallback'], ''); // $this->fields is an array of the form: [0..n] => 'field path' // change numeric indexes to contain field names (last part of the path) $paths = $this->fields; - $this->fields = array(); + $this->fields = []; foreach ($paths as $path) { $key = ltrim( mb_substr($path, (int) mb_strrpos($path, '/')), diff --git a/libraries/classes/Config/FormDisplay.php b/libraries/classes/Config/FormDisplay.php index 981f771f86..24e68eb271 100644 --- a/libraries/classes/Config/FormDisplay.php +++ b/libraries/classes/Config/FormDisplay.php @@ -42,7 +42,7 @@ class FormDisplay * Form list * @var Form[] */ - private $_forms = array(); + private $_forms = []; /** * Stores validation errors, indexed by paths @@ -50,27 +50,27 @@ class FormDisplay * [path] is a string storing error associated with single field * @var array */ - private $_errors = array(); + private $_errors = []; /** * Paths changed so that they can be used as HTML ids, indexed by paths * @var array */ - private $_translatedPaths = array(); + private $_translatedPaths = []; /** * Server paths change indexes so we define maps from current server * path to the first one, indexed by work path * @var array */ - private $_systemPaths = array(); + private $_systemPaths = []; /** * Language strings which will be sent to PMA_messages JS variable * Will be looked up in $GLOBALS: str{value} or strSetup{value} * @var array */ - private $_jsLangStrings = array(); + private $_jsLangStrings = []; /** * Tells whether forms have been validated @@ -97,12 +97,12 @@ class FormDisplay */ public function __construct(ConfigFile $cf) { - $this->_jsLangStrings = array( + $this->_jsLangStrings = [ 'error_nan_p' => __('Not a positive number!'), '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); @@ -175,8 +175,8 @@ class FormDisplay return; } - $paths = array(); - $values = array(); + $paths = []; + $values = []; foreach ($this->_forms as $form) { /* @var $form Form */ $paths[] = $form->name; @@ -195,7 +195,7 @@ class FormDisplay // change error keys from canonical paths to work paths if (is_array($errors) && count($errors) > 0) { - $this->_errors = array(); + $this->_errors = []; foreach ($errors as $path => $error_list) { $work_path = array_search($path, $this->_systemPaths); // field error @@ -235,7 +235,7 @@ class FormDisplay Descriptions::get("Form_{$form->name}"), Descriptions::get("Form_{$form->name}", 'desc'), $form_errors, - array('id' => $form->name) + ['id' => $form->name] ); foreach ($form->fields as $field => $path) { @@ -291,13 +291,13 @@ class FormDisplay $htmlOutput = ''; - $js = array(); - $js_default = array(); + $js = []; + $js_default = []; $htmlOutput .= FormDisplayTemplate::displayFormTop($form_action, 'post', $hidden_fields); if ($tabbed_form) { - $tabs = array(); + $tabs = []; foreach ($this->_forms as $form) { $tabs[$form->name] = Descriptions::get("Form_$form->name"); } @@ -333,7 +333,7 @@ class FormDisplay // if not already done, send strings used for validation to JavaScript if (! $js_lang_sent) { $js_lang_sent = true; - $js_lang = array(); + $js_lang = []; foreach ($this->_jsLangStrings as $strName => $strValue) { $js_lang[] = "'$strName': '" . Sanitize::jsFormat($strValue, false) . '\''; } @@ -382,12 +382,12 @@ class FormDisplay $value_is_default = true; } - $opts = array( + $opts = [ 'doc' => $this->getDocLink($system_path), 'show_restore_default' => $show_restore_default, 'userprefs_allow' => $userprefs_allow, 'userprefs_comment' => Descriptions::get($system_path, 'cmt') - ); + ]; if (isset($form->default[$system_path])) { $opts['setvalue'] = $form->default[$system_path]; } @@ -578,14 +578,14 @@ class FormDisplay $result = true; $forms = (array) $forms; - $values = array(); - $to_save = array(); + $values = []; + $to_save = []; $is_setup_script = $GLOBALS['PMA_Config']->get('is_setup'); if ($is_setup_script) { $this->_loadUserprefsInfo(); } - $this->_errors = array(); + $this->_errors = []; foreach ($forms as $form_name) { /* @var $form Form */ if (isset($this->_forms[$form_name])) { @@ -669,7 +669,7 @@ class FormDisplay $post_values = is_array($_POST[$key]) ? $_POST[$key] : explode("\n", $_POST[$key]); - $_POST[$key] = array(); + $_POST[$key] = []; $this->_fillPostArrayParameters($post_values, $key); break; } @@ -696,10 +696,10 @@ class FormDisplay foreach ($to_save as $work_path => $path) { // TrustedProxies requires changes before saving if ($path == 'TrustedProxies') { - $proxies = array(); + $proxies = []; $i = 0; foreach ($values[$path] as $value) { - $matches = array(); + $matches = []; $match = preg_match( "/^(.+):(?:[ ]?)(\\w+)$/", $value, $matches ); @@ -769,7 +769,7 @@ class FormDisplay */ private function _getOptName($path) { - return str_replace(array('Servers/1/', '/'), array('Servers/', '_'), $path); + return str_replace(['Servers/1/', '/'], ['Servers/', '_'], $path); } /** @@ -786,7 +786,7 @@ class FormDisplay $this->_userprefsKeys = array_flip(UserFormList::getFields()); // read real config for user preferences display $userprefs_disallow = $GLOBALS['PMA_Config']->get('is_setup') - ? $this->_configFile->get('UserprefsDisallow', array()) + ? $this->_configFile->get('UserprefsDisallow', []) : $GLOBALS['cfg']['UserprefsDisallow']; $this->_userprefsDisallow = array_flip($userprefs_disallow); } @@ -827,10 +827,10 @@ class FormDisplay || $system_path == 'BZipDump' ) { $comment = ''; - $funcs = array( - 'ZipDump' => array('zip_open', 'gzcompress'), - 'GZipDump' => array('gzopen', 'gzencode'), - 'BZipDump' => array('bzopen', 'bzcompress')); + $funcs = [ + 'ZipDump' => ['zip_open', 'gzcompress'], + 'GZipDump' => ['gzopen', 'gzencode'], + 'BZipDump' => ['bzopen', 'bzcompress']]; if (!function_exists($funcs[$system_path][0])) { $comment = sprintf( __( diff --git a/libraries/classes/Config/FormDisplayTemplate.php b/libraries/classes/Config/FormDisplayTemplate.php index 20068ff2fe..7a648782b7 100644 --- a/libraries/classes/Config/FormDisplayTemplate.php +++ b/libraries/classes/Config/FormDisplayTemplate.php @@ -65,21 +65,21 @@ class FormDisplayTemplate */ public static function displayTabsTop(array $tabs) { - $items = array(); + $items = []; foreach ($tabs as $tab_id => $tab_name) { - $items[] = array( + $items[] = [ 'content' => htmlspecialchars($tab_name), - 'url' => array( + 'url' => [ 'href' => '#' . $tab_id, - ), - ); + ], + ]; } $htmlOutput = Template::get('list/unordered')->render( - array( + [ 'class' => 'tabs responsivetable', 'items' => $items, - ) + ] ); $htmlOutput .= '
'; $htmlOutput .= '
'; @@ -100,13 +100,13 @@ class FormDisplayTemplate $title = '', $description = '', $errors = null, - array $attributes = array() + array $attributes = [] ) { global $_FormDisplayGroup; $_FormDisplayGroup = 0; - $attributes = array_merge(array('class' => 'optbox'), $attributes); + $attributes = array_merge(['class' => 'optbox'], $attributes); return Template::get('config/form_display/fieldset_top')->render([ 'attributes' => $attributes, @@ -156,17 +156,17 @@ class FormDisplayTemplate $is_setup_script = $GLOBALS['PMA_Config']->get('is_setup'); if ($icons === null) { // if the static variables have not been initialised - $icons = array(); + $icons = []; // Icon definitions: // The same indexes will be used in the $icons array. // The first element contains the filename and the second // element is used for the "alt" and "title" attributes. - $icon_init = array( - 'edit' => array('b_edit', ''), - 'help' => array('b_help', __('Documentation')), - 'reload' => array('s_reload', ''), - 'tblops' => array('b_tblops', '') - ); + $icon_init = [ + 'edit' => ['b_edit', ''], + 'help' => ['b_help', __('Documentation')], + 'reload' => ['s_reload', ''], + 'tblops' => ['b_tblops', ''] + ]; if ($is_setup_script) { // When called from the setup script, we don't have access to the // sprite-aware getImage() function because the PMA_theme class @@ -275,7 +275,7 @@ class FormDisplayTemplate $htmlOutput .= '' . "\n"; @@ -1558,7 +1558,7 @@ class Results $this->__set('display_params', $display_params); - return array($colspan, $button_html); + return [$colspan, $button_html]; } // end of the '_getFieldVisibilityParams()' function @@ -1579,10 +1579,10 @@ class Results if ((!$GLOBALS['cfg']['ShowBrowseComments']) || (empty($analyzed_sql_results['statement']->from)) ) { - return array(); + return []; } - $ret = array(); + $ret = []; foreach ($analyzed_sql_results['statement']->from as $field) { if (empty($field->table)) { continue; @@ -1611,7 +1611,7 @@ class Results */ private function _setHighlightedColumnGlobalField(array $analyzed_sql_results) { - $highlight_columns = array(); + $highlight_columns = []; if (!empty($analyzed_sql_results['statement']->where)) { foreach ($analyzed_sql_results['statement']->where as $expr) { @@ -1721,13 +1721,13 @@ class Results private function _getFullOrPartialTextButtonOrLink() { - $url_params_full_text = array( + $url_params_full_text = [ 'db' => $this->__get('db'), 'table' => $this->__get('table'), 'sql_query' => $this->__get('sql_query'), 'goto' => $this->__get('goto'), 'full_text_button' => 1 - ); + ]; if ($_SESSION['tmpval']['pftext'] == self::DISPLAY_FULL_TEXT) { // currently in fulltext mode so show the opposite link @@ -1858,21 +1858,21 @@ class Results $multi_sorted_sql_query = $unsorted_sql_query . $multi_sort_order; } - $_single_url_params = array( + $_single_url_params = [ 'db' => $this->__get('db'), 'table' => $this->__get('table'), 'sql_query' => $single_sorted_sql_query, 'session_max_rows' => $session_max_rows, 'is_browse_distinct' => $this->__get('is_browse_distinct'), - ); + ]; - $_multi_url_params = array( + $_multi_url_params = [ 'db' => $this->__get('db'), 'table' => $this->__get('table'), 'sql_query' => $multi_sorted_sql_query, 'session_max_rows' => $session_max_rows, 'is_browse_distinct' => $this->__get('is_browse_distinct'), - ); + ]; $single_order_url = 'sql.php' . Url::getCommon($_single_url_params); $multi_order_url = 'sql.php' . Url::getCommon($_multi_url_params); @@ -1887,7 +1887,7 @@ class Results $fields_meta, $order_link, $comments ); - return array($order_link, $sorted_header_html); + return [$order_link, $sorted_header_html]; } // end of the '_getOrderLinkAndSortedHeaderHtml()' function @@ -2023,7 +2023,7 @@ class Results if (empty($order_img)) { $order_img = ''; } - return array($single_sort_order, $sort_order, $order_img); + return [$single_sort_order, $sort_order, $order_img]; } /** @@ -2123,24 +2123,24 @@ class Results $sort_order .= ' ASC'; $order_img = ' ' . Util::getImage( 's_desc', __('Descending'), - array('class' => "soimg", 'title' => '') + ['class' => "soimg", 'title' => ''] ); $order_img .= ' ' . Util::getImage( 's_asc', __('Ascending'), - array('class' => "soimg hide", 'title' => '') + ['class' => "soimg hide", 'title' => ''] ); } else { $sort_order .= ' DESC'; $order_img = ' ' . Util::getImage( 's_asc', __('Ascending'), - array('class' => "soimg", 'title' => '') + ['class' => "soimg", 'title' => ''] ); $order_img .= ' ' . Util::getImage( 's_desc', __('Descending'), - array('class' => "soimg hide", 'title' => '') + ['class' => "soimg hide", 'title' => ''] ); } - return array($sort_order, $order_img); + return [$sort_order, $order_img]; } // end of the '_getSortingUrlParams()' function @@ -2161,9 +2161,9 @@ class Results private function _getSortOrderLink( $order_img, $fields_meta, $order_url, $multi_order_url ) { - $order_link_params = array( + $order_link_params = [ 'class' => 'sortlink' - ); + ]; $order_link_content = htmlspecialchars($fields_meta->name); $inner_link_content = $order_link_content . $order_img @@ -2218,7 +2218,7 @@ class Results ) { $draggable_html = '_getClassForNumericColumnType($fields_meta, $th_class); if ($col_visib && !$col_visib_j) { @@ -2266,7 +2266,7 @@ class Results ) { $draggable_html = '_getClassForNumericColumnType($fields_meta, $th_class); if ($col_visib && !$col_visib_j) { @@ -2454,10 +2454,10 @@ class Results $class, $condition_field, $meta, $nowrap, $is_field_truncated = false, $transformation_plugin = '', $default_function = '' ) { - $classes = array( + $classes = [ $class, $nowrap, - ); + ]; if (isset($meta->mimetype)) { $classes[] = preg_replace('/\//', '_', $meta->mimetype); @@ -2481,11 +2481,11 @@ class Results } // Define classes to be added to this data field based on the type of data - $matches = array( + $matches = [ 'enum' => 'enum', 'set' => 'set', 'binary' => 'hex', - ); + ]; foreach ($matches as $key => $value) { if (mb_strpos($meta->flags, $key) !== false) { @@ -2536,15 +2536,15 @@ class Results $display_params = $this->__get('display_params'); if (! is_array($map)) { - $map = array(); + $map = []; } $row_no = 0; - $display_params['edit'] = array(); - $display_params['copy'] = array(); - $display_params['delete'] = array(); - $display_params['data'] = array(); - $display_params['row_delete'] = array(); + $display_params['edit'] = []; + $display_params['copy'] = []; + $display_params['delete'] = []; + $display_params['data'] = []; + $display_params['row_delete'] = []; $this->__set('display_params', $display_params); // name of the class added to all grid editable elements; @@ -2597,7 +2597,7 @@ class Results ); } - $tr_class = array(); + $tr_class = []; if ($GLOBALS['cfg']['BrowsePointerEnable'] != true) { $tr_class[] = 'nopointer'; } @@ -2739,8 +2739,8 @@ class Results private function _setMimeMap() { $fields_meta = $this->__get('fields_meta'); - $mimeMap = array(); - $added = array(); + $mimeMap = []; + $added = []; for ($currentColumn = 0; $currentColumn < $this->__get('fields_cnt'); @@ -2778,20 +2778,20 @@ class Results $str = ' ' . strtoupper($which[1]); $isShowProcessList = strpos($str, 'PROCESSLIST') > 0; if ($isShowProcessList) { - $mimeMap['..Info'] = array( + $mimeMap['..Info'] = [ 'mimetype' => 'Text_Plain', 'transformation' => 'output/Text_Plain_Sql.php', - ); + ]; } $isShowCreateTable = preg_match( '@CREATE[[:space:]]+TABLE@i', $this->__get('sql_query') ); if ($isShowCreateTable) { - $mimeMap['..Create Table'] = array( + $mimeMap['..Create Table'] = [ 'mimetype' => 'Text_Plain', 'transformation' => 'output/Text_Plain_Sql.php', - ); + ]; } } } @@ -2886,7 +2886,7 @@ class Results // Wrap MIME-transformations. [MIME] $default_function = [Core::class, 'mimeDefaultFunction']; // default_function $transformation_plugin = $default_function; - $transform_options = array(); + $transform_options = []; if ($GLOBALS['cfgRelation']['mimework'] && $GLOBALS['cfg']['BrowseMIME'] @@ -2969,10 +2969,10 @@ class Results ); $transformation_plugin = new Text_Plain_Link(); - $transform_options = array( + $transform_options = [ 0 => $linking_url, 2 => true - ); + ]; $meta->mimetype = str_replace( '_', '/', @@ -3001,12 +3001,12 @@ class Results $whereClauseMap[$row_no][$meta->orgtable] = $unique_conditions[0]; } - $_url_params = array( + $_url_params = [ 'db' => $this->__get('db'), 'table' => $meta->orgtable, 'where_clause' => $whereClauseMap[$row_no][$meta->orgtable], 'transform_key' => $meta->orgname - ); + ]; if (! empty($sql_query)) { $_url_params['sql_query'] = $url_sql_query; @@ -3111,7 +3111,7 @@ class Results private function _getSpecialLinkUrl($column_value, array $row_info, $field_name) { - $linking_url_params = array(); + $linking_url_params = []; $link_relations = $GLOBALS['special_schema_links'] [mb_strtolower($this->__get('db'))] [mb_strtolower($this->__get('table'))] @@ -3170,7 +3170,7 @@ class Results private function _getRowInfoForSpecialLinks(array $row, $col_order) { - $row_info = array(); + $row_info = []; $fields_meta = $this->__get('fields_meta'); for ($n = 0; $n < $this->__get('fields_cnt'); ++$n) { @@ -3255,7 +3255,7 @@ class Results $col_visib = false; } - return array($col_order, $col_visib); + return [$col_order, $col_visib]; } // end of the '_getColumnParams()' function @@ -3320,23 +3320,23 @@ class Results $where_clause, $clause_is_unique, $url_sql_query ) { - $_url_params = array( + $_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', - ); + ]; $edit_url = 'tbl_change.php' . Url::getCommon( - $_url_params + array('default_action' => 'update') + $_url_params + ['default_action' => 'update'] ); $copy_url = 'tbl_change.php' . Url::getCommon( - $_url_params + array('default_action' => 'insert') + $_url_params + ['default_action' => 'insert'] ); $edit_str = $this->_getActionLinkContent( @@ -3352,7 +3352,7 @@ class Results $edit_anchor_class .= ' nonunique'; } - return array($edit_url, $copy_url, $edit_str, $copy_str, $edit_anchor_class); + return [$edit_url, $copy_url, $edit_str, $copy_str, $edit_anchor_class]; } // end of the '_getModifiedLinks()' function @@ -3381,13 +3381,13 @@ class Results if ($del_lnk == self::DELETE_ROW) { // delete row case - $_url_params = array( + $_url_params = [ 'db' => $this->__get('db'), 'table' => $this->__get('table'), 'sql_query' => $url_sql_query, 'message_to_show' => __('The row has been deleted.'), 'goto' => (empty($goto) ? 'tbl_sql.php' : $goto), - ); + ]; $lnk_goto = 'sql.php' . Url::getCommonRaw($_url_params); @@ -3396,13 +3396,13 @@ class Results . ' WHERE ' . $where_clause . ($clause_is_unique ? '' : ' LIMIT 1'); - $_url_params = array( + $_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, - ); + ]; $del_url = 'sql.php' . Url::getCommon($_url_params); $js_conf = 'DELETE FROM ' . Sanitize::jsFormat($this->__get('table')) @@ -3413,22 +3413,22 @@ class Results } elseif ($del_lnk == self::KILL_PROCESS) { // kill process case - $_url_params = array( + $_url_params = [ '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 = array( + $_url_params = [ 'db' => 'mysql', 'sql_query' => $kill, 'goto' => $lnk_goto, - ); + ]; $del_url = 'sql.php' . Url::getCommon($_url_params); $js_conf = $kill; @@ -3439,7 +3439,7 @@ class Results $del_url = $del_str = $js_conf = null; } - return array($del_url, $del_str, $js_conf); + return [$del_url, $del_str, $js_conf]; } // end of the '_getDeleteAndKillLinks()' function @@ -3935,7 +3935,7 @@ class Results { $sql_md5 = md5($this->__get('sql_query')); - $query = array(); + $query = []; if (isset($_SESSION['tmpval']['query'][$sql_md5])) { $query = $_SESSION['tmpval']['query'][$sql_md5]; } @@ -3967,9 +3967,9 @@ class Results if (Core::isValid( $_REQUEST['pftext'], - array( + [ self::DISPLAY_PARTIAL_TEXT, self::DISPLAY_FULL_TEXT - ) + ] ) ) { $query['pftext'] = $_REQUEST['pftext']; @@ -3980,9 +3980,9 @@ class Results if (Core::isValid( $_REQUEST['relational_display'], - array( + [ self::RELATIONAL_KEY, self::RELATIONAL_DISPLAY_COLUMN - ) + ] ) ) { $query['relational_display'] = $_REQUEST['relational_display']; @@ -3996,10 +3996,10 @@ class Results if (Core::isValid( $_REQUEST['geoOption'], - array( + [ self::GEOMETRY_DISP_WKT, self::GEOMETRY_DISP_WKB, self::GEOMETRY_DISP_GEOM - ) + ] ) ) { $query['geoOption'] = $_REQUEST['geoOption']; @@ -4151,9 +4151,9 @@ class Results // 1.3 Extract sorting expressions. // we need $sort_expression and $sort_expression_nodirection // even if there are many table references - $sort_expression = array(); - $sort_expression_nodirection = array(); - $sort_direction = array(); + $sort_expression = []; + $sort_expression_nodirection = []; + $sort_direction = []; if (!is_null($statement) && !empty($statement->order)) { foreach ($statement->order as $o) { @@ -4244,9 +4244,9 @@ class Results // (see the 'relation' configuration variable) // initialize map - $map = array(); + $map = []; - $target = array(); + $target = []; if (!is_null($statement) && !empty($statement->from)) { foreach ($statement->from as $field) { if (!empty($field->table)) { @@ -4262,12 +4262,12 @@ class Results // Coming from 'Distinct values' action of structure page // We manipulate relations mechanism to show a link to related rows. if ($this->__get('is_browse_distinct')) { - $map[$fields_meta[1]->name] = array( + $map[$fields_meta[1]->name] = [ $this->__get('table'), $fields_meta[1]->name, '', $this->__get('db') - ); + ]; } } // end if // end 2b @@ -4365,7 +4365,7 @@ class Results } } - return array($pos_next, $pos_prev); + return [$pos_next, $pos_prev]; } // end of the '_getOffsets()' function @@ -4427,7 +4427,7 @@ class Results // initializing default arguments $default_function = [Core::class, 'mimeDefaultFunction']; $transformation_plugin = $default_function; - $transform_options = array(); + $transform_options = []; // check for non printable sorted row data $meta = $fields_meta[$sorted_column_index]; @@ -4631,12 +4631,12 @@ class Results $display_field = $this->relation->getDisplayField( $rel['foreign_db'], $rel['foreign_table'] ); - $map[$master_field] = array( + $map[$master_field] = [ $rel['foreign_table'], $rel['foreign_field'], $display_field, $rel['foreign_db'] - ); + ]; } else { foreach ($rel as $key => $one_key) { foreach ($one_key['index_list'] as $index => $one_field) { @@ -4647,14 +4647,14 @@ class Results $one_key['ref_table_name'] ); - $map[$one_field] = array( + $map[$one_field] = [ $one_key['ref_table_name'], $one_key['ref_index_list'][$index], $display_field, isset($one_key['ref_db_name']) ? $one_key['ref_db_name'] : $GLOBALS['db'] - ); + ]; } } } @@ -4822,7 +4822,7 @@ class Results Util::getIcon( 'b_view_add', __('Create view'), true ), - array('class' => 'create_view ajax') + ['class' => 'create_view ajax'] ) . '' . "\n"; } @@ -4847,7 +4847,7 @@ class Results //calling to _getResultOperations with a fake $displayParts //and setting only_view parameter to be true to generate just view $results_operations_html .= $this->_getResultsOperations( - array(), + [], $analyzed_sql_results, true ); @@ -4868,7 +4868,7 @@ class Results Util::getIcon( 'b_insrow', __('Copy to clipboard'), true ), - array('id' => 'copyToClipBoard') + ['id' => 'copyToClipBoard'] ); return $html; @@ -4888,7 +4888,7 @@ class Results Util::getIcon( 'b_print', __('Print'), true ), - array('id' => 'printView'), + ['id' => 'printView'], 'print_view' ); @@ -4919,12 +4919,12 @@ class Results $header = '