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 . '' . '