Use short array syntax instead of long array syntax

Replaces array() with [].

Signed-off-by: Maurício Meneghini Fauth <mauriciofauth@gmail.com>
This commit is contained in:
Maurício Meneghini Fauth 2018-05-30 01:42:21 -03:00
parent 93bf3d0d17
commit b9c0463d96
498 changed files with 11419 additions and 11419 deletions

View File

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

View File

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

View File

@ -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_])@'
=> '<a href="url.php?url=\\1">\\1</a>',
@ -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');
?>

View File

@ -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'],

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -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 '<a href="server_variables.php' . Url::getCommon(array('filter' => $matches[1]))
return '<a href="server_variables.php' . Url::getCommon(['filter' => $matches[1]])
. '">' . htmlspecialchars($matches[1]) . '</a>';
}
@ -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];
}
/**

View File

@ -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 [];
}
/**

View File

@ -144,7 +144,7 @@ class BrowseForeigners
$output .= '</tr>';
return array($output, $horizontal_count, $indexByDescription);
return [$output, $horizontal_count, $indexByDescription];
}
/**
@ -226,8 +226,8 @@ class BrowseForeigners
. '<tfoot>' . $header . '</tfoot>' . "\n"
. '<tbody>' . "\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];
}
/**

View File

@ -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
. '<input name="orig_col_name[' . $row_num . ']" type="hidden" '
. 'value="' . htmlspecialchars($row['col_name']) . '">'
. '<td name="col_name" class="nowrap">'
. 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,
))
])
. '</td>';
$tableHtml .=
'<td name = "col_type" class="nowrap">'
. 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' => []
]
)
. '</td>';
$tableHtml .=
'<td class="nowrap" name="col_length">'
. 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']
)
]
)
. '</td>';
$meta = array();
$meta = [];
if (!isset($row['col_default']) || $row['col_default'] == '') {
$meta['DefaultType'] = 'NONE';
} else {
@ -1006,14 +1006,14 @@ class CentralColumns
'<td class="nowrap" name="col_default">'
. 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,
)
]
)
. '</td>';
$tableHtml .=
@ -1029,43 +1029,43 @@ class CentralColumns
'<td class="nowrap" name="col_attribute">'
. 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(),
)
]
)
. '</td>';
$tableHtml .=
'<td class="nowrap" name="col_isNull">'
. 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']
)
)
]
]
)
. '</td>';
$tableHtml .=
'<td class="nowrap" name="col_extra">'
. 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']]
]
)
. '</td>';
$tableHtml .= '</tr>';
@ -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 .= '<tr>'
. '<td></td>'
. '<td name="col_name" class="nowrap">'
. 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,
))
])
. '</td>'
. '<td name = "col_type" class="nowrap">'
. Template::get('columns_definitions/column_type')
->render(
array(
[
'column_number' => 0,
'ci' => 1,
'ci_offset' => 0,
'type_upper' => '',
'column_meta' => array()
)
'column_meta' => []
]
)
. '</td>'
. '<td class="nowrap" name="col_length">'
. Template::get('columns_definitions/column_length')->render(
array(
[
'column_number' => 0,
'ci' => 2,
'ci_offset' => 0,
'length_values_input_size' => 8,
'length_to_display' => ''
)
]
)
. '</td>'
. '<td class="nowrap" name="col_default">'
. 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,
)
]
)
. '</td>'
. '<td name="collation" class="nowrap">'
@ -1279,36 +1279,36 @@ class CentralColumns
. '<td class="nowrap" name="col_attribute">'
. 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(),
)
]
)
. '</td>'
. '<td class="nowrap" name="col_isNull">'
. Template::get('columns_definitions/column_null')
->render(
array(
[
'column_number' => 0,
'ci' => 6,
'ci_offset' => 0,
'column_meta' => array()
)
'column_meta' => []
]
)
. '</td>'
. '<td class="nowrap" name="col_extra">'
. Template::get('columns_definitions/column_extra')->render(
array(
[
'column_number' => 0,
'ci' => 7,
'ci_offset' => 0,
'column_meta' => array()
)
'column_meta' => []
]
)
. '</td>'
. ' <td>'
@ -1330,12 +1330,12 @@ class CentralColumns
public function getHtmlForEditingPage(array $selected_fld, string $selected_db): string
{
$html = '<form id="multi_edit_central_columns">';
$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);
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -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, '/')),

View File

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

View File

@ -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 .= '<br />';
$htmlOutput .= '<div class="tabs_contents">';
@ -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 .= '<select class="all85" ' . $name_id . $field_class . '>';
$escape = !(isset($opts['values_escaped']) && $opts['values_escaped']);
$values_disabled = isset($opts['values_disabled'])
? array_flip($opts['values_disabled']) : array();
? array_flip($opts['values_disabled']) : [];
foreach ($opts['values'] as $opt_value_key => $opt_value) {
// set names for boolean values
if (is_bool($opt_value)) {
@ -450,7 +450,7 @@ class FormDisplayTemplate
$validator = (array)$validator;
$v_name = array_shift($validator);
$v_name = "PMA_" . $v_name;
$v_args = array();
$v_args = [];
foreach ($validator as $arg) {
$v_args[] = Sanitize::escapeJsString($arg);
}
@ -473,7 +473,7 @@ class FormDisplayTemplate
}
return Template::get('javascript/display')->render(
array('js_array' => $js_array,)
['js_array' => $js_array,]
);
}

View File

@ -56,7 +56,7 @@ abstract class BaseForm extends FormDisplay
*/
public static function getForms()
{
return array();
return [];
}
/**

View File

@ -20,7 +20,7 @@ class BaseFormList
/**
* List of all forms
*/
protected static $all = array();
protected static $all = [];
/**
* @var string
@ -68,7 +68,7 @@ class BaseFormList
*/
public function __construct(ConfigFile $cf)
{
$this->_forms = array();
$this->_forms = [];
foreach (static::$all as $form) {
$class = static::get($form);
$this->_forms[] = new $class($cf);

View File

@ -20,7 +20,7 @@ class PageFormList extends BaseFormList
/**
* @var array
*/
protected static $all = array(
protected static $all = [
'Browse',
'DbStructure',
'Edit',
@ -29,7 +29,7 @@ class PageFormList extends BaseFormList
'Navi',
'Sql',
'TableStructure',
);
];
/**
* @var string
*/

View File

@ -22,11 +22,11 @@ class ConfigForm extends BaseForm
*/
public static function getForms()
{
return array(
'Config' => array(
return [
'Config' => [
'DefaultLang',
'ServerDefault'
),
);
],
];
}
}

View File

@ -27,7 +27,7 @@ class FeaturesForm extends \PhpMyAdmin\Config\Forms\User\FeaturesForm
['Servers/1/only_db', 'Servers/1/hide_db']
);
/* Following are not available to user */
$result['Import_export'] = array(
$result['Import_export'] = [
'UploadDir',
'SaveDir',
'RecodingEngine' => ':group',
@ -37,8 +37,8 @@ class FeaturesForm extends \PhpMyAdmin\Config\Forms\User\FeaturesForm
'GZipDump',
'BZipDump',
'CompressOnFly'
);
$result['Security'] = array(
];
$result['Security'] = [
'blowfish_secret',
'CheckConfigurationPermissions',
'TrustedProxies',
@ -50,12 +50,12 @@ class FeaturesForm extends \PhpMyAdmin\Config\Forms\User\FeaturesForm
'LoginCookieDeleteAll',
'CaptchaLoginPublicKey',
'CaptchaLoginPrivateKey'
);
$result['Developer'] = array(
];
$result['Developer'] = [
'UserprefsDeveloperTab',
'DBG/sql',
);
$result['Other_core_settings'] = array(
];
$result['Other_core_settings'] = [
'OBGzip',
'PersistentConnections',
'ExecTimeLimit',
@ -66,7 +66,7 @@ class FeaturesForm extends \PhpMyAdmin\Config\Forms\User\FeaturesForm
'ProxyPass',
'AllowThirdPartyFraming',
'ZeroConf',
);
];
return $result;
}
}

View File

@ -22,15 +22,15 @@ class ServersForm extends BaseForm
*/
public static function getForms()
{
return array(
'Server' => array('Servers' => array(1 => array(
return [
'Server' => ['Servers' => [1 => [
'verbose',
'host',
'port',
'socket',
'ssl',
'compress'))),
'Server_auth' => array('Servers' => array(1 => array(
'compress']]],
'Server_auth' => ['Servers' => [1 => [
'auth_type',
':group:' . __('Config authentication'),
'user',
@ -42,8 +42,8 @@ class ServersForm extends BaseForm
':group:' . __('Signon authentication'),
'SignonSession',
'SignonURL',
'LogoutURL'))),
'Server_config' => array('Servers' => array(1 => array(
'LogoutURL']]],
'Server_config' => ['Servers' => [1 => [
'only_db',
'hide_db',
'AllowRoot',
@ -51,8 +51,8 @@ class ServersForm extends BaseForm
'DisableIS',
'AllowDeny/order',
'AllowDeny/rules',
'SessionTimeZone'))),
'Server_pmadb' => array('Servers' => array(1 => array(
'SessionTimeZone']]],
'Server_pmadb' => ['Servers' => [1 => [
'pmadb' => 'phpmyadmin',
'controlhost',
'controlport',
@ -77,14 +77,14 @@ class ServersForm extends BaseForm
'central_columns' => 'pma__central_columns',
'designer_settings' => 'pma__designer_settings',
'export_templates' => 'pma__export_templates',
'MaxTableUiprefs' => 100))),
'Server_tracking' => array('Servers' => array(1 => array(
'MaxTableUiprefs' => 100]]],
'Server_tracking' => ['Servers' => [1 => [
'tracking_version_auto_create',
'tracking_default_statements',
'tracking_add_drop_view',
'tracking_add_drop_table',
'tracking_add_drop_database',
))),
);
]]],
];
}
}

View File

@ -20,7 +20,7 @@ class SetupFormList extends BaseFormList
/**
* @var array
*/
protected static $all = array(
protected static $all = [
'Config',
'Export',
'Features',
@ -29,7 +29,7 @@ class SetupFormList extends BaseFormList
'Navi',
'Servers',
'Sql',
);
];
/**
* @var string
*/

View File

@ -22,8 +22,8 @@ class ExportForm extends BaseForm
*/
public static function getForms()
{
return array(
'Export_defaults' => array(
return [
'Export_defaults' => [
'Export/method',
':group:' . __('Quick'),
'Export/quick_export_onserver',
@ -42,8 +42,8 @@ class ExportForm extends BaseForm
'Export/file_template_table',
'Export/file_template_database',
'Export/file_template_server'
),
'Sql' => array(
],
'Sql' => [
'Export/sql_include_comments' => ':group',
'Export/sql_dates',
'Export/sql_relation',
@ -76,11 +76,11 @@ class ExportForm extends BaseForm
'Export/sql_max_query_size',
'Export/sql_hex_for_binary',
'Export/sql_utc_time'
),
'CodeGen' => array(
],
'CodeGen' => [
'Export/codegen_format'
),
'Csv' => array(
],
'Csv' => [
':group:' . __('CSV'),
'Export/csv_separator',
'Export/csv_enclosed',
@ -95,8 +95,8 @@ class ExportForm extends BaseForm
'Export/excel_removeCRLF',
'Export/excel_columns',
'Export/excel_edition'
),
'Latex' => array(
],
'Latex' => [
'Export/latex_caption',
'Export/latex_structure_or_data',
':group:' . __('Structure'),
@ -113,13 +113,13 @@ class ExportForm extends BaseForm
'Export/latex_data_continued_caption',
'Export/latex_data_label',
'Export/latex_null'
),
'Microsoft_Office' => array(
],
'Microsoft_Office' => [
':group:' . __('Microsoft Word 2000'),
'Export/htmlword_structure_or_data',
'Export/htmlword_null',
'Export/htmlword_columns'),
'Open_Document' => array(
'Export/htmlword_columns'],
'Open_Document' => [
':group:' . __('OpenDocument Spreadsheet'),
'Export/ods_columns',
'Export/ods_null',
@ -134,14 +134,14 @@ class ExportForm extends BaseForm
':group:' . __('Data'),
'Export/odt_columns',
'Export/odt_null'
),
'Texy' => array(
],
'Texy' => [
'Export/texytext_structure_or_data',
':group:' . __('Data'),
'Export/texytext_null',
'Export/texytext_columns'
),
);
],
];
}
/**

View File

@ -22,8 +22,8 @@ class FeaturesForm extends BaseForm
*/
public static function getForms()
{
$result = array(
'General' => array(
$result = [
'General' => [
'VersionCheck',
'NaturalOrder',
'InitialSlidersState',
@ -33,15 +33,15 @@ class FeaturesForm extends BaseForm
'SendErrorReports',
'ConsoleEnterExecutes',
'DisableShortcutKeys',
),
'Databases' => array(
],
'Databases' => [
'Servers/1/only_db', // saves to Server/only_db
'Servers/1/hide_db', // saves to Server/hide_db
'MaxDbList',
'MaxTableList',
'DefaultConnectionCollation',
),
'Text_fields' => array(
],
'Text_fields' => [
'CharEditing',
'MinSizeForInputField',
'MaxSizeForInputField',
@ -50,20 +50,20 @@ class FeaturesForm extends BaseForm
'TextareaCols',
'TextareaRows',
'LongtextDoubleTextarea'
),
'Page_titles' => array(
],
'Page_titles' => [
'TitleDefault',
'TitleTable',
'TitleDatabase',
'TitleServer'
),
'Warnings' => array(
],
'Warnings' => [
'PmaNoRelation_DisableWarning',
'SuhosinDisableWarning',
'LoginCookieValidityDisableWarning',
'ReservedWordDisableWarning'
),
'Console' => array(
],
'Console' => [
'Console/Mode',
'Console/StartHistory',
'Console/AlwaysExpand',
@ -74,13 +74,13 @@ class FeaturesForm extends BaseForm
'Console/GroupQueries',
'Console/OrderBy',
'Console/Order',
),
);
],
];
// skip Developer form if no setting is available
if ($GLOBALS['cfg']['UserprefsDeveloperTab']) {
$result['Developer'] = array(
$result['Developer'] = [
'DBG/sql'
);
];
}
return $result;
}

View File

@ -22,19 +22,19 @@ class ImportForm extends BaseForm
*/
public static function getForms()
{
return array(
'Import_defaults' => array(
return [
'Import_defaults' => [
'Import/format',
'Import/charset',
'Import/allow_interrupt',
'Import/skip_queries'
),
'Sql' => array(
],
'Sql' => [
'Import/sql_compatibility',
'Import/sql_no_auto_value_on_zero',
'Import/sql_read_as_multibytes'
),
'Csv' => array(
],
'Csv' => [
':group:' . __('CSV'),
'Import/csv_replace',
'Import/csv_ignore',
@ -50,16 +50,16 @@ class ImportForm extends BaseForm
'Import/ldi_enclosed',
'Import/ldi_escaped',
'Import/ldi_local_option'
),
'Open_Document' => array(
],
'Open_Document' => [
':group:' . __('OpenDocument Spreadsheet'),
'Import/ods_col_names',
'Import/ods_empty_rows',
'Import/ods_recognize_percentages',
'Import/ods_recognize_currency'
),
],
);
];
}
/**

View File

@ -22,20 +22,20 @@ class MainForm extends BaseForm
*/
public static function getForms()
{
return array(
'Startup' => array(
return [
'Startup' => [
'ShowCreateDb',
'ShowStats',
'ShowServerInfo'
),
'DbStructure' => array(
],
'DbStructure' => [
'ShowDbStructureCharset',
'ShowDbStructureComment',
'ShowDbStructureCreation',
'ShowDbStructureLastUpdate',
'ShowDbStructureLastCheck'
),
'TableStructure' => array(
],
'TableStructure' => [
'HideStructureActions',
'ShowColumnComments',
':group:' . __('Default transformations'),
@ -49,8 +49,8 @@ class MainForm extends BaseForm
'DefaultTransformations/TextImageLink',
'DefaultTransformations/TextLink',
':group:end'
),
'Browse' => array(
],
'Browse' => [
'TableNavigationLinksMode',
'ActionLinksMode',
'ShowAll',
@ -67,25 +67,25 @@ class MainForm extends BaseForm
'TablePrimaryKeyOrder',
'RememberSorting',
'RelationalDisplay'
),
'Edit' => array(
],
'Edit' => [
'ProtectBinary',
'ShowFunctionFields',
'ShowFieldTypesInDataEditView',
'InsertRows',
'ForeignKeyDropdownOrder',
'ForeignKeyMaxLimit'
),
'Tabs' => array(
],
'Tabs' => [
'TabsMode',
'DefaultTabServer',
'DefaultTabDatabase',
'DefaultTabTable'
),
'DisplayRelationalSchema' => array(
],
'DisplayRelationalSchema' => [
'PDFDefaultPageSize'
),
);
],
];
}
/**

View File

@ -22,8 +22,8 @@ class NaviForm extends BaseForm
*/
public static function getForms()
{
return array(
'Navi_panel' => array(
return [
'Navi_panel' => [
'ShowDatabasesNavigationAsTree',
'NavigationLinkWithMainPanel',
'NavigationDisplayLogo',
@ -35,8 +35,8 @@ class NaviForm extends BaseForm
'NumRecentTables',
'NumFavoriteTables',
'NavigationWidth',
),
'Navi_tree' => array(
],
'Navi_tree' => [
'MaxNavigationItems',
'NavigationTreeEnableGrouping',
'NavigationTreeEnableExpansion',
@ -45,22 +45,22 @@ class NaviForm extends BaseForm
'NavigationTreeShowFunctions',
'NavigationTreeShowProcedures',
'NavigationTreeShowEvents'
),
'Navi_servers' => array(
],
'Navi_servers' => [
'NavigationDisplayServers',
'DisplayServersList',
),
'Navi_databases' => array(
],
'Navi_databases' => [
'NavigationTreeDisplayDbFilterMinimum',
'NavigationTreeDbSeparator'
),
'Navi_tables' => array(
],
'Navi_tables' => [
'NavigationTreeDefaultTabTable',
'NavigationTreeDefaultTabTable2',
'NavigationTreeTableSeparator',
'NavigationTreeTableLevel',
),
);
],
];
}
/**

View File

@ -22,8 +22,8 @@ class SqlForm extends BaseForm
*/
public static function getForms()
{
return array(
'Sql_queries' => array(
return [
'Sql_queries' => [
'ShowSQL',
'Confirm',
'QueryHistoryMax',
@ -34,14 +34,14 @@ class SqlForm extends BaseForm
'LintEnable',
'EnableAutocompleteForTablesAndColumns',
'DefaultForeignKeyChecks',
),
'Sql_box' => array(
],
'Sql_box' => [
'SQLQuery/Edit',
'SQLQuery/Explain',
'SQLQuery/ShowAsPHP',
'SQLQuery/Refresh',
),
);
],
];
}
/**

View File

@ -20,14 +20,14 @@ class UserFormList extends BaseFormList
/**
* @var array
*/
protected static $all = array(
protected static $all = [
'Features',
'Sql',
'Navi',
'Main',
'Import',
'Export',
);
];
/**
* @var string
*/

View File

@ -172,9 +172,9 @@ class PageSettings
true,
false,
$response->getFooter()->getSelfUrl(),
array(
[
'submit_save' => $this->_groupName
)
]
);
$retval .= '</div>';
$retval .= '</div>';

View File

@ -77,11 +77,11 @@ class ServerConfigChecks
. 'reliable if your IP belongs to an ISP where thousands of users, '
. 'including you, are connected to.'
),
'[a@' . Url::getCommon(array('page' => 'form', 'formset' => 'Features')) . '#tab_Security]',
'[a@' . Url::getCommon(['page' => 'form', 'formset' => 'Features']) . '#tab_Security]',
'[/a]',
'[a@' . Url::getCommon(array('page' => 'form', 'formset' => 'Features')) . '#tab_Security]',
'[a@' . Url::getCommon(['page' => 'form', 'formset' => 'Features']) . '#tab_Security]',
'[/a]',
'[a@' . Url::getCommon(array('page' => 'form', 'formset' => 'Features')) . '#tab_Security]',
'[a@' . Url::getCommon(['page' => 'form', 'formset' => 'Features']) . '#tab_Security]',
'[/a]'
);
SetupIndex::messagesSet(
@ -180,9 +180,9 @@ class ServerConfigChecks
. 'However, IP-based protection may not be reliable if your IP belongs '
. 'to an ISP where thousands of users, including you, are connected to.'
),
'[a@' . Url::getCommon(array('page' => 'servers', 'mode' => 'edit', 'id' => $i)) . '#tab_Server_config]',
'[a@' . Url::getCommon(['page' => 'servers', 'mode' => 'edit', 'id' => $i]) . '#tab_Server_config]',
'[/a]',
'[a@' . Url::getCommon(array('page' => 'form', 'formset' => 'Features')) . '#tab_Security]',
'[a@' . Url::getCommon(['page' => 'form', 'formset' => 'Features']) . '#tab_Security]',
'[/a]'
));
@ -208,7 +208,7 @@ class ServerConfigChecks
. 'URL can directly access your phpMyAdmin panel. Set %1$sauthentication '
. 'type%2$s to [kbd]cookie[/kbd] or [kbd]http[/kbd].'
),
'[a@' . Url::getCommon(array('page' => 'servers', 'mode' => 'edit', 'id' => $i)) . '#tab_Server]',
'[a@' . Url::getCommon(['page' => 'servers', 'mode' => 'edit', 'id' => $i]) . '#tab_Server]',
'[/a]'
))
. ' ' . $sSecurityInfoMsg
@ -234,7 +234,7 @@ class ServerConfigChecks
);
}
}
return array($cookieAuthUsed, $blowfishSecret, $blowfishSecretSet);
return [$cookieAuthUsed, $blowfishSecret, $blowfishSecretSet];
}
/**
@ -253,7 +253,7 @@ class ServerConfigChecks
$blowfishSecretSet = true;
$this->cfg->set('blowfish_secret', Util::generateRandom(32));
}
return array($blowfishSecret, $blowfishSecretSet);
return [$blowfishSecret, $blowfishSecretSet];
}
/**
@ -305,7 +305,7 @@ class ServerConfigChecks
'%sZip decompression%s requires functions (%s) which are unavailable '
. 'on this system.'
),
'[a@' . Url::getCommon(array('page' => 'form', 'formset' => 'Features')) . '#tab_Import_export]',
'[a@' . Url::getCommon(['page' => 'form', 'formset' => 'Features']) . '#tab_Import_export]',
'[/a]',
'zip_open'
))
@ -326,7 +326,7 @@ class ServerConfigChecks
'%sZip compression%s requires functions (%s) which are unavailable on '
. 'this system.'
),
'[a@' . Url::getCommon(array('page' => 'form', 'formset' => 'Features')) . '#tab_Import_export]',
'[a@' . Url::getCommon(['page' => 'form', 'formset' => 'Features']) . '#tab_Import_export]',
'[/a]',
'gzcompress'
))
@ -366,7 +366,7 @@ class ServerConfigChecks
))
);
} else {
$blowfishWarnings = array();
$blowfishWarnings = [];
// check length
if (strlen($blowfishSecret) < 32) {
// too short key
@ -421,7 +421,7 @@ class ServerConfigChecks
. 'cause random session invalidation (currently session.gc_maxlifetime '
. 'is %5$d).'
),
'[a@' . Url::getCommon(array('page' => 'form', 'formset' => 'Features')) . '#tab_Security]',
'[a@' . Url::getCommon(['page' => 'form', 'formset' => 'Features']) . '#tab_Security]',
'[/a]',
'[a@' . Core::getPHPDocLink('session.configuration.php#ini.session.gc-maxlifetime') . ']',
'[/a]',
@ -445,7 +445,7 @@ class ServerConfigChecks
. 'at most. Values larger than 1800 may pose a security risk such as '
. 'impersonation.'
),
'[a@' . Url::getCommon(array('page' => 'form', 'formset' => 'Features')) . '#tab_Security]',
'[a@' . Url::getCommon(['page' => 'form', 'formset' => 'Features']) . '#tab_Security]',
'[/a]'
))
);
@ -469,9 +469,9 @@ class ServerConfigChecks
. 'is not 0, %sLogin cookie validity%s must be set to a value less or '
. 'equal to it.'
),
'[a@' . Url::getCommon(array('page' => 'form', 'formset' => 'Features')) . '#tab_Security]',
'[a@' . Url::getCommon(['page' => 'form', 'formset' => 'Features']) . '#tab_Security]',
'[/a]',
'[a@' . Url::getCommon(array('page' => 'form', 'formset' => 'Features')) . '#tab_Security]',
'[a@' . Url::getCommon(['page' => 'form', 'formset' => 'Features']) . '#tab_Security]',
'[/a]'
))
);
@ -508,7 +508,7 @@ class ServerConfigChecks
'%1$sBzip2 compression and decompression%2$s requires functions (%3$s) which '
. 'are unavailable on this system.'
),
'[a@' . Url::getCommon(array('page' => 'form', 'formset' => 'Features')) . '#tab_Import_export]',
'[a@' . Url::getCommon(['page' => 'form', 'formset' => 'Features']) . '#tab_Import_export]',
'[/a]',
$functions
)
@ -540,7 +540,7 @@ class ServerConfigChecks
'%1$sGZip compression and decompression%2$s requires functions (%3$s) which '
. 'are unavailable on this system.'
),
'[a@' . Url::getCommon(array('page' => 'form', 'formset' => 'Features')) . '#tab_Import_export]',
'[a@' . Url::getCommon(['page' => 'form', 'formset' => 'Features']) . '#tab_Import_export]',
'[/a]',
'gzencode'
))

View File

@ -45,7 +45,7 @@ class Validator
return $validators;
}
$validators = $cf->getDbEntry('_validators', array());
$validators = $cf->getDbEntry('_validators', []);
if ($GLOBALS['PMA_Config']->get('is_setup')) {
return $validators;
}
@ -54,7 +54,7 @@ class Validator
// preferences we need original config values not overwritten
// by user preferences, creating a new PhpMyAdmin\Config instance is a
// better idea than hacking into its code
$uvs = $cf->getDbEntry('_userValidators', array());
$uvs = $cf->getDbEntry('_userValidators', []);
foreach ($uvs as $field => $uv_list) {
$uv_list = (array)$uv_list;
foreach ($uv_list as &$uv) {
@ -100,7 +100,7 @@ class Validator
// find validators
$validator_id = (array) $validator_id;
$validators = static::getValidators($cf);
$vids = array();
$vids = [];
foreach ($validator_id as &$vid) {
$vid = $cf->getCanonicalPath($vid);
if (isset($validators[$vid])) {
@ -112,8 +112,8 @@ class Validator
}
// create argument list with canonical paths and remember path mapping
$arguments = array();
$key_map = array();
$arguments = [];
$key_map = [];
foreach ($values as $k => $v) {
$k2 = $isPostSource ? str_replace('-', '/', $k) : $k;
$k2 = mb_strpos($k2, '/')
@ -124,14 +124,14 @@ class Validator
}
// validate
$result = array();
$result = [];
foreach ($vids as $vid) {
// call appropriate validation functions
foreach ((array)$validators[$vid] as $validator) {
$vdef = (array) $validator;
$vname = array_shift($vdef);
$vname = 'PhpMyAdmin\Config\Validator::' . $vname;
$args = array_merge(array($vid, &$arguments), $vdef);
$args = array_merge([$vid, &$arguments], $vdef);
$r = call_user_func_array($vname, $args);
// merge results
@ -145,7 +145,7 @@ class Validator
continue;
}
if (! isset($result[$key])) {
$result[$key] = array();
$result[$key] = [];
}
$result[$key] = array_merge(
$result[$key], (array)$error_list
@ -155,7 +155,7 @@ class Validator
}
// restore original paths
$new_result = array();
$new_result = [];
foreach ($result as $k => $v) {
$k2 = isset($key_map[$k]) ? $key_map[$k] : $k;
$new_result[$k2] = $v;
@ -224,7 +224,7 @@ class Validator
if (! is_null($error)) {
$error .= ' - ' . error_get_last();
}
return is_null($error) ? true : array($error_key => $error);
return is_null($error) ? true : [$error_key => $error];
}
/**
@ -239,12 +239,12 @@ class Validator
*/
public static function validateServer($path, array $values)
{
$result = array(
$result = [
'Server' => '',
'Servers/1/user' => '',
'Servers/1/SignonSession' => '',
'Servers/1/SignonURL' => ''
);
];
$error = false;
if (empty($values['Servers/1/auth_type'])) {
$values['Servers/1/auth_type'] = '';
@ -311,18 +311,18 @@ class Validator
*/
public static function validatePMAStorage($path, array $values)
{
$result = array(
$result = [
'Server_pmadb' => '',
'Servers/1/controluser' => '',
'Servers/1/controlpass' => ''
);
];
$error = false;
if (empty($values['Servers/1/pmadb'])) {
return $result;
}
$result = array();
$result = [];
if (empty($values['Servers/1/controluser'])) {
$result['Servers/1/controluser'] = __(
'Empty phpMyAdmin control user while using phpMyAdmin configuration '
@ -364,7 +364,7 @@ class Validator
*/
public static function validateRegex($path, array $values)
{
$result = array($path => '');
$result = [$path => ''];
if (empty($values[$path])) {
return $result;
@ -381,7 +381,7 @@ class Validator
$last_error = error_get_last();
}
$matches = array();
$matches = [];
// in libraries/ListDatabase.php _checkHideDatabase(),
// a '/' is used as the delimiter for hide_db
@preg_match('/' . Util::requestString($values[$path]) . '/', '', $matches);
@ -390,7 +390,7 @@ class Validator
if ($current_error !== $last_error) {
$error = preg_replace('/^preg_match\(\): /', '', $current_error['message']);
return array($path => $error);
return [$path => $error];
}
return $result;
@ -406,7 +406,7 @@ class Validator
*/
public static function validateTrustedProxies($path, array $values)
{
$result = array($path => array());
$result = [$path => []];
if (empty($values[$path])) {
return $result;
@ -414,7 +414,7 @@ class Validator
if (is_array($values[$path]) || is_object($values[$path])) {
// value already processed by FormDisplay::save
$lines = array();
$lines = [];
foreach ($values[$path] as $ip => $v) {
$v = Util::requestString($v);
$lines[] = preg_match('/^-\d+$/', $ip)
@ -427,7 +427,7 @@ class Validator
}
foreach ($lines as $line) {
$line = trim($line);
$matches = array();
$matches = [];
// we catch anything that may (or may not) be an IP
if (!preg_match("/^(.+):(?:[ ]?)\\w+$/", $line, $matches)) {
$result[$path][] = __('Incorrect value:') . ' '
@ -494,7 +494,7 @@ class Validator
*/
public static function validatePortNumber($path, array $values)
{
return array(
return [
$path => static::validateNumber(
$path,
$values,
@ -503,7 +503,7 @@ class Validator
65535,
__('Not a valid port number!')
)
);
];
}
/**
@ -516,7 +516,7 @@ class Validator
*/
public static function validatePositiveNumber($path, array $values)
{
return array(
return [
$path => static::validateNumber(
$path,
$values,
@ -525,7 +525,7 @@ class Validator
PHP_INT_MAX,
__('Not a positive number!')
)
);
];
}
/**
@ -538,7 +538,7 @@ class Validator
*/
public static function validateNonNegativeNumber($path, array $values)
{
return array(
return [
$path => static::validateNumber(
$path,
$values,
@ -547,7 +547,7 @@ class Validator
PHP_INT_MAX,
__('Not a non-negative number!')
)
);
];
}
/**
@ -566,7 +566,7 @@ class Validator
return '';
}
$result = preg_match($regex, Util::requestString($values[$path]));
return array($path => ($result ? '' : __('Incorrect value!')));
return [$path => ($result ? '' : __('Incorrect value!'))];
}
/**
@ -581,7 +581,7 @@ class Validator
public static function validateUpperBound($path, array $values, $max_value)
{
$result = $values[$path] <= $max_value;
return array($path => ($result ? ''
: sprintf(__('Value must be equal or lower than %s!'), $max_value)));
return [$path => ($result ? ''
: sprintf(__('Value must be equal or lower than %s!'), $max_value))];
}
}

View File

@ -104,10 +104,10 @@ class Console
unset($count_bookmarks, $private_message, $shared_message);
return Template::get('console/bookmark_content')
->render(
array(
[
'welcome_message' => $welcomeMessage,
'bookmarks' => $bookmarks,
)
]
);
}
return '';
@ -120,7 +120,7 @@ class Console
*/
public function getScripts(): array
{
return array('console.js');
return ['console.js'];
}
/**

View File

@ -143,10 +143,10 @@ class DatabaseStructureController extends DatabaseController
}
$this->response->getHeader()->getScripts()->addFiles(
array(
[
'db_structure.js',
'tbl_change.js',
)
]
);
// Gets the database structure
@ -156,11 +156,11 @@ class DatabaseStructureController extends DatabaseController
// If there are no tables, the user is redirected to the last page
// having any.
if ($this->_total_num_tables > 0 && $this->_pos > $this->_total_num_tables) {
$uri = './db_structure.php' . Url::getCommonRaw(array(
$uri = './db_structure.php' . Url::getCommonRaw([
'db' => $this->db,
'pos' => max(0, $this->_total_num_tables - $GLOBALS['cfg']['MaxTableList']),
'reload' => 1
));
]);
Core::sendHeaderLocation($uri);
}
@ -185,9 +185,9 @@ class DatabaseStructureController extends DatabaseController
* Displays the tables list
*/
$this->response->addHTML('<div id="tableslistcontainer">');
$_url_params = array(
$_url_params = [
'pos' => $this->_pos,
'db' => $this->db);
'db' => $this->db];
// Add the sort options if they exists
if (isset($_REQUEST['sort'])) {
@ -225,12 +225,12 @@ class DatabaseStructureController extends DatabaseController
/* Printable view of a table */
$this->response->addHTML(
Template::get('database/structure/print_view_data_dictionary_link')
->render(array('url_query' => Url::getCommon(
array(
->render(['url_query' => Url::getCommon(
[
'db' => $this->db,
'goto' => 'db_structure.php',
)
)))
]
)])
);
if (empty($this->_db_is_system_schema)) {
@ -249,7 +249,7 @@ class DatabaseStructureController extends DatabaseController
if (isset($_REQUEST['favorite_tables'])) {
$favorite_tables = json_decode($_REQUEST['favorite_tables'], true);
} else {
$favorite_tables = array();
$favorite_tables = [];
}
// Required to keep each user's preferences separate.
$user = sha1($GLOBALS['cfg']['Server']['user']);
@ -293,35 +293,35 @@ class DatabaseStructureController extends DatabaseController
'message',
Template::get('components/error_message')
->render(
array(
[
'msg' => __("Favorite List is full!")
)
]
)
);
return;
}
// Check if current table is already in favorite list.
$favParams = array('db' => $this->db,
$favParams = ['db' => $this->db,
'ajax_request' => true,
'favorite_table' => $favorite_table,
(($already_favorite ? 'remove' : 'add') . '_favorite') => true
);
];
$this->response->addJSON(
array(
[
'user' => $user,
'favorite_tables' => json_encode($favorite_tables),
'list' => $fav_instance->getHtmlList(),
'anchor' => Template::get('database/structure/favorite_anchor')
->render(
array(
[
'table_name_hash' => md5($favorite_table),
'db_table_name_hash' => md5($this->db . "." . $favorite_table),
'fav_params' => $favParams,
'already_favorite' => $already_favorite,
'titles' => $titles,
)
]
)
)
]
);
}
@ -346,16 +346,16 @@ class DatabaseStructureController extends DatabaseController
}
// Array to store the results.
$real_row_count_all = array();
$real_row_count_all = [];
// Iterate over each table and fetch real row count.
foreach ($this->_tables as $table) {
$row_count = $this->dbi
->getTable($this->db, $table['TABLE_NAME'])
->getRealRowCountTable();
$real_row_count_all[] = array(
$real_row_count_all[] = [
'table' => $table['TABLE_NAME'],
'row_count' => $row_count
);
];
}
$ajax_response->addJSON(
@ -373,7 +373,7 @@ class DatabaseStructureController extends DatabaseController
{
$action = 'db_structure.php';
$err_url = 'db_structure.php' . Url::getCommon(
array('db' => $this->db)
['db' => $this->db]
);
// see bug #2794840; in this case, code path is:
@ -397,7 +397,7 @@ class DatabaseStructureController extends DatabaseController
{
// filtering
$this->response->addHTML(
Template::get('filter')->render(array('filter_value' => ''))
Template::get('filter')->render(['filter_value' => ''])
);
// table form
$this->response->addHTML(
@ -428,7 +428,7 @@ class DatabaseStructureController extends DatabaseController
$sum_size = 0;
$overhead_size = 0;
$hidden_fields = array();
$hidden_fields = [];
$overall_approx_rows = false;
foreach ($this->_tables as $keyname => $current_table) {
// Get valid statistics whatever is the table type
@ -441,7 +441,7 @@ class DatabaseStructureController extends DatabaseController
$table_is_view = false;
// Sets parameters for links
$tbl_url_query = Url::getCommon(
array('db' => $this->db, 'table' => $current_table['TABLE_NAME'])
['db' => $this->db, 'table' => $current_table['TABLE_NAME']]
);
// do not list the previous table's size info for a view
@ -548,33 +548,33 @@ class DatabaseStructureController extends DatabaseController
$browse_table = Template::get('database/structure/browse_table')
->render(
array(
[
'tbl_url_query' => $tbl_url_query,
'title' => $may_have_rows ? $titles['Browse']
: $titles['NoBrowse'],
)
]
);
$search_table = Template::get('database/structure/search_table')
->render(
array(
[
'tbl_url_query' => $tbl_url_query,
'title' => $may_have_rows ? $titles['Search']
: $titles['NoSearch'],
)
]
);
$browse_table_label = Template::get(
'database/structure/browse_table_label'
)
->render(
array(
[
'tbl_url_query' => $tbl_url_query,
'title' => htmlspecialchars(
$current_table['TABLE_COMMENT']
),
'truename' => $truename,
)
]
);
$empty_table = '';
@ -583,7 +583,7 @@ class DatabaseStructureController extends DatabaseController
if (!$table_is_view) {
$empty_table = Template::get('database/structure/empty_table')
->render(
array(
[
'tbl_url_query' => $tbl_url_query,
'sql_query' => urlencode(
'TRUNCATE ' . Util::backquote(
@ -600,7 +600,7 @@ class DatabaseStructureController extends DatabaseController
),
'title' => $may_have_rows ? $titles['Empty']
: $titles['NoEmpty'],
)
]
);
}
$drop_query = sprintf(
@ -658,7 +658,7 @@ class DatabaseStructureController extends DatabaseController
$this->response->addHTML(
Template::get('database/structure/structure_table_row')
->render(
array(
[
'table_name_hash' => md5($current_table['TABLE_NAME']),
'db_table_name_hash' => md5($this->db . '.' . $current_table['TABLE_NAME']),
'db' => $this->db,
@ -705,7 +705,7 @@ class DatabaseStructureController extends DatabaseController
'show_creation' => $GLOBALS['cfg']['ShowDbStructureCreation'],
'show_last_update' => $GLOBALS['cfg']['ShowDbStructureLastUpdate'],
'show_last_check' => $GLOBALS['cfg']['ShowDbStructureLastCheck'],
)
]
)
);
@ -720,7 +720,7 @@ class DatabaseStructureController extends DatabaseController
// Show Summary
$this->response->addHTML(
Template::get('database/structure/body_for_table_summary')->render(
array(
[
'num_tables' => $this->_num_tables,
'server_slave_status' => $GLOBALS['replication_info']['slave']['status'],
'db_is_system_schema' => $this->_db_is_system_schema,
@ -743,7 +743,7 @@ class DatabaseStructureController extends DatabaseController
'show_creation' => $GLOBALS['cfg']['ShowDbStructureCreation'],
'show_last_update' => $GLOBALS['cfg']['ShowDbStructureLastUpdate'],
'show_last_check' => $GLOBALS['cfg']['ShowDbStructureLastCheck'],
)
]
)
);
$this->response->addHTML('</table>');
@ -782,11 +782,11 @@ class DatabaseStructureController extends DatabaseController
'database/structure/tracking_icon'
)
->render(
array(
[
'db' => $this->db,
'table' => $table,
'is_tracked' => $is_tracked,
)
]
);
}
}
@ -816,7 +816,7 @@ class DatabaseStructureController extends DatabaseController
) {
// InnoDB/TokuDB table: we did not get an accurate row count
$approx_rows = !$table_is_view
&& in_array($current_table['ENGINE'], array('InnoDB', 'TokuDB'))
&& in_array($current_table['ENGINE'], ['InnoDB', 'TokuDB'])
&& !$current_table['COUNTED'];
if ($table_is_view
@ -837,7 +837,7 @@ class DatabaseStructureController extends DatabaseController
}
}
return array($approx_rows, $show_superscript);
return [$approx_rows, $show_superscript];
}
/**
@ -889,7 +889,7 @@ class DatabaseStructureController extends DatabaseController
);
}
return array($do, $ignored);
return [$do, $ignored];
}
/**
@ -919,10 +919,10 @@ class DatabaseStructureController extends DatabaseController
$favorite_tables[$user] = $fav_instance->getTables();
$this->response->addJSON(
array(
[
'favorite_tables' => json_encode($favorite_tables),
'list' => $fav_instance->getHtmlList()
)
]
);
$server_id = $GLOBALS['server'];
// Set flag when localStorage and pmadb(if present) are in sync.
@ -1058,9 +1058,9 @@ class DatabaseStructureController extends DatabaseController
$table_is_view = true;
}
return array($current_table, $formatted_size, $unit, $formatted_overhead,
return [$current_table, $formatted_size, $unit, $formatted_overhead,
$overhead_unit, $overhead_size, $table_is_view, $sum_size
);
];
}
/**
@ -1104,9 +1104,9 @@ class DatabaseStructureController extends DatabaseController
$overhead_size += $current_table['Data_free'];
}
}
return array($current_table, $formatted_size, $unit, $formatted_overhead,
return [$current_table, $formatted_size, $unit, $formatted_overhead,
$overhead_unit, $overhead_size, $sum_size
);
];
}
/**
@ -1122,7 +1122,7 @@ class DatabaseStructureController extends DatabaseController
) {
$formatted_size = $unit = '';
if ((in_array($current_table['ENGINE'], array('InnoDB', 'TokuDB'))
if ((in_array($current_table['ENGINE'], ['InnoDB', 'TokuDB'])
&& $current_table['TABLE_ROWS'] < $GLOBALS['cfg']['MaxExactCount'])
|| !isset($current_table['TABLE_ROWS'])
) {
@ -1143,6 +1143,6 @@ class DatabaseStructureController extends DatabaseController
);
}
return array($current_table, $formatted_size, $unit, $sum_size);
return [$current_table, $formatted_size, $unit, $sum_size];
}
}

View File

@ -59,7 +59,7 @@ class ServerBinlogController extends Controller
*/
include_once 'libraries/server_common.inc.php';
$url_params = array();
$url_params = [];
if (! isset($_REQUEST['log'])
|| ! array_key_exists($_REQUEST['log'], $this->binary_logs)
) {
@ -91,11 +91,11 @@ class ServerBinlogController extends Controller
private function _getLogSelector(array $url_params)
{
return Template::get('server/binlog/log_selector')->render(
array(
[
'url_params' => $url_params,
'binary_logs' => $this->binary_logs,
'log' => $_REQUEST['log'],
)
]
);
}
@ -257,10 +257,10 @@ class ServerBinlogController extends Controller
$html = "";
while ($value = $this->dbi->fetchAssoc($result)) {
$html .= Template::get('server/binlog/log_row')->render(
array(
[
'value' => $value,
'dontlimitchars' => $dontlimitchars,
)
]
);
}
return $html;

View File

@ -68,12 +68,12 @@ class ServerCollationsController extends Controller
array $mysqlDftCollations
): string {
return Template::get('server/collations/charsets')->render(
array(
[
'mysql_charsets' => $mysqlCharsets,
'mysql_collations' => $mysqlCollations,
'mysql_charsets_desc' => $mysqlCharsetsDesc,
'mysql_dft_collations' => $mysqlDftCollations,
)
]
);
}
}

View File

@ -173,7 +173,7 @@ class ServerDatabasesController extends Controller
Util::getScriptNameForOption(
$GLOBALS['cfg']['DefaultTabDatabase'], 'database'
)
. Url::getCommon(array('db' => $_POST['new_db']))
. Url::getCommon(['db' => $_POST['new_db']])
);
}
}
@ -225,7 +225,7 @@ class ServerDatabasesController extends Controller
if (empty($_REQUEST['sort_by'])) {
$this->_sort_by = 'SCHEMA_NAME';
} else {
$sort_by_whitelist = array(
$sort_by_whitelist = [
'SCHEMA_NAME',
'DEFAULT_COLLATION_NAME',
'SCHEMA_TABLES',
@ -234,7 +234,7 @@ class ServerDatabasesController extends Controller
'SCHEMA_INDEX_LENGTH',
'SCHEMA_LENGTH',
'SCHEMA_DATA_FREE'
);
];
if (in_array($_REQUEST['sort_by'], $sort_by_whitelist)) {
$this->_sort_by = $_REQUEST['sort_by'];
} else {
@ -275,8 +275,8 @@ class ServerDatabasesController extends Controller
}
}
$values = array();
$units = array();
$values = [];
$units = [];
foreach ($column_order as $stat_name => $stat) {
if (array_key_exists($stat_name,$first_database)) {
if ($stat['format'] == 'byte') {
@ -291,12 +291,12 @@ class ServerDatabasesController extends Controller
}
}
$_url_params = array(
$_url_params = [
'pos' => $this->_pos,
'dbstats' => $this->_dbstats,
'sort_by' => $this->_sort_by,
'sort_order' => $this->_sort_order,
);
];
$html = Template::get('server/databases/databases_header')->render([
'database_count' => $this->_database_count,
@ -340,43 +340,43 @@ class ServerDatabasesController extends Controller
*/
private function _getColumnOrder()
{
$column_order = array();
$column_order['DEFAULT_COLLATION_NAME'] = array(
$column_order = [];
$column_order['DEFAULT_COLLATION_NAME'] = [
'disp_name' => __('Collation'),
'description_function' => array(Charsets::class, 'getCollationDescr'),
'description_function' => [Charsets::class, 'getCollationDescr'],
'format' => 'string',
'footer' => $this->dbi->getServerCollation(),
);
$column_order['SCHEMA_TABLES'] = array(
];
$column_order['SCHEMA_TABLES'] = [
'disp_name' => __('Tables'),
'format' => 'number',
'footer' => 0,
);
$column_order['SCHEMA_TABLE_ROWS'] = array(
];
$column_order['SCHEMA_TABLE_ROWS'] = [
'disp_name' => __('Rows'),
'format' => 'number',
'footer' => 0,
);
$column_order['SCHEMA_DATA_LENGTH'] = array(
];
$column_order['SCHEMA_DATA_LENGTH'] = [
'disp_name' => __('Data'),
'format' => 'byte',
'footer' => 0,
);
$column_order['SCHEMA_INDEX_LENGTH'] = array(
];
$column_order['SCHEMA_INDEX_LENGTH'] = [
'disp_name' => __('Indexes'),
'format' => 'byte',
'footer' => 0,
);
$column_order['SCHEMA_LENGTH'] = array(
];
$column_order['SCHEMA_LENGTH'] = [
'disp_name' => __('Total'),
'format' => 'byte',
'footer' => 0,
);
$column_order['SCHEMA_DATA_FREE'] = array(
];
$column_order['SCHEMA_DATA_FREE'] = [
'disp_name' => __('Overhead'),
'format' => 'byte',
'footer' => 0,
);
];
return $column_order;
}
@ -466,8 +466,8 @@ class ServerDatabasesController extends Controller
}
}
$values = array();
$units = array();
$values = [];
$units = [];
foreach ($column_order as $stat_name => $stat) {
if (array_key_exists($stat_name,$current)) {
if ($stat['format'] == 'byte') {

View File

@ -65,7 +65,7 @@ class ServerEnginesController extends Controller
private function _getHtmlForAllServerEngines()
{
return Template::get('server/engines/engines')->render(
array('engines' => StorageEngine::getStorageEngines())
['engines' => StorageEngine::getStorageEngines()]
);
}
@ -85,7 +85,7 @@ class ServerEnginesController extends Controller
* Displays details about a given Storage Engine
*/
return Template::get('server/engines/engine')->render(
array(
[
'title' => $engine->getTitle(),
'help_page' => $engine->getMysqlHelpPage(),
'comment' => $engine->getComment(),
@ -95,7 +95,7 @@ class ServerEnginesController extends Controller
'page_output' => $pageOutput,
'page' => $page,
'engine' => $_REQUEST['engine'],
)
]
);
}
}

View File

@ -81,7 +81,7 @@ class ServerPluginsController extends Controller
ORDER BY plugin_type, plugin_name";
$res = $this->dbi->query($sql);
$this->plugins = array();
$this->plugins = [];
while ($row = $this->dbi->fetchAssoc($res)) {
$this->plugins[$row['plugin_type']][] = $row;
}
@ -96,7 +96,7 @@ class ServerPluginsController extends Controller
*/
private function _getPluginsHtml()
{
$plugins_type_clean = array();
$plugins_type_clean = [];
$keys = array_keys($this->plugins);
foreach ($keys as $plugin_type) {
$plugins_type_clean[$plugin_type] = preg_replace(
@ -105,19 +105,19 @@ class ServerPluginsController extends Controller
}
$html = '<div id="plugins_plugins">';
$html .= Template::get('server/plugins/section_links')
->render(array(
->render([
'plugins' => $this->plugins,
'plugins_type_clean' => $plugins_type_clean,
));
]);
foreach ($this->plugins as $plugin_type => $plugin_list) {
$html .= Template::get('server/plugins/section')
->render(
array(
[
'plugin_type' => $plugin_type,
'plugin_type_clean' => $plugins_type_clean[$plugin_type],
'plugin_list' => $plugin_list,
)
]
);
}
$html .= '</div>';

View File

@ -93,7 +93,7 @@ class TableChartController extends TableController
}
$this->response->getHeader()->getScripts()->addFiles(
array(
[
'chart.js',
'tbl_chart.js',
'vendor/jqplot/jquery.jqplot.js',
@ -106,7 +106,7 @@ class TableChartController extends TableController
'vendor/jqplot/plugins/jqplot.pieRenderer.js',
'vendor/jqplot/plugins/jqplot.enhancedPieLegendRenderer.js',
'vendor/jqplot/plugins/jqplot.highlighter.js'
)
]
);
/**
@ -115,7 +115,7 @@ class TableChartController extends TableController
*/
$db = &$this->db;
$table = &$this->table;
$url_params = array();
$url_params = [];
/**
* Runs common work
@ -141,7 +141,7 @@ class TableChartController extends TableController
include 'libraries/server_common.inc.php';
}
$data = array();
$data = [];
$result = $this->dbi->tryQuery($this->sql_query);
$fields_meta = $this->dbi->getFieldsMeta($result);
@ -151,7 +151,7 @@ class TableChartController extends TableController
$keys = array_keys($data[0]);
$numeric_types = array('int', 'real');
$numeric_types = ['int', 'real'];
$numeric_column_count = 0;
foreach ($keys as $idx => $key) {
if (in_array($fields_meta[$idx]->type, $numeric_types)) {
@ -176,7 +176,7 @@ class TableChartController extends TableController
*/
$this->response->addHTML(
Template::get('table/chart/tbl_chart')->render(
array(
[
'url_query' => $this->url_query,
'url_params' => $url_params,
'keys' => $keys,
@ -184,7 +184,7 @@ class TableChartController extends TableController
'numeric_types' => $numeric_types,
'numeric_column_count' => $numeric_column_count,
'sql_query' => $this->sql_query
)
]
)
);
}
@ -223,7 +223,7 @@ class TableChartController extends TableController
}
$sql_with_limit = $statement->build();
$data = array();
$data = [];
$result = $this->dbi->tryQuery($sql_with_limit);
while ($row = $this->dbi->fetchAssoc($result)) {
$data[] = $row;
@ -234,10 +234,10 @@ class TableChartController extends TableController
$this->response->addJSON('message', __('No data to display'));
return;
}
$sanitized_data = array();
$sanitized_data = [];
foreach ($data as $data_row_number => $data_row) {
$tmp_row = array();
$tmp_row = [];
foreach ($data_row as $data_column => $data_value) {
$tmp_row[htmlspecialchars($data_column)] = htmlspecialchars(
$data_value

View File

@ -114,8 +114,8 @@ class TableGisVisualizationController extends TableController
$meta = $this->dbi->getFieldsMeta($result);
// Find the candidate fields for label column and spatial column
$labelCandidates = array();
$spatialCandidates = array();
$labelCandidates = [];
$spatialCandidates = [];
foreach ($meta as $column_meta) {
if ($column_meta->type == 'geometry') {
$spatialCandidates[] = $column_meta->name;
@ -165,11 +165,11 @@ class TableGisVisualizationController extends TableController
}
$this->response->getHeader()->getScripts()->addFiles(
array(
[
'vendor/openlayers/OpenLayers.js',
'vendor/jquery/jquery.svg.js',
'tbl_gis_visualization.js',
)
]
);
// If all the rows contain SRID, use OpenStreetMaps on the initial loading.
@ -197,15 +197,15 @@ class TableGisVisualizationController extends TableController
$downloadUrl = 'tbl_gis_visualization.php' . Url::getCommon(
array_merge(
$this->url_params,
array(
[
'saveToFile' => true,
'session_max_rows' => $rows,
'pos' => $pos
)
]
)
);
$html = Template::get('table/gis_visualization/gis_visualization')->render(
array(
[
'url_params' => $this->url_params,
'download_url' => $downloadUrl,
'label_candidates' => $labelCandidates,
@ -215,7 +215,7 @@ class TableGisVisualizationController extends TableController
'visualization' => $this->visualization->toImage('svg'),
'draw_ol' => $this->visualization->asOl(),
'pma_theme_image' => $GLOBALS['pmaThemeImage']
)
]
);
$this->response->addHTML($html);

View File

@ -89,10 +89,10 @@ class TableIndexesController extends TableController
// Get fields and stores their name/type
if (isset($_REQUEST['create_edit_table'])) {
$fields = json_decode($_REQUEST['columns'], true);
$index_params = array(
$index_params = [
'Non_unique' => ($_REQUEST['index']['Index_choice'] == 'UNIQUE')
? '0' : '1',
);
];
$this->index->set($index_params);
$add_fields = count($fields);
} else {
@ -100,10 +100,10 @@ class TableIndexesController extends TableController
->getNameAndTypeOfTheColumns();
}
$form_params = array(
$form_params = [
'db' => $this->db,
'table' => $this->table,
);
];
if (isset($_REQUEST['create_index'])) {
$form_params['create_index'] = 1;
@ -117,13 +117,13 @@ class TableIndexesController extends TableController
$this->response->addHTML(
Template::get('table/index_form')->render(
array(
[
'fields' => $fields,
'index' => $this->index,
'form_params' => $form_params,
'add_fields' => $add_fields,
'create_edit_table' => isset($_REQUEST['create_edit_table'])
)
]
)
);
}
@ -149,9 +149,9 @@ class TableIndexesController extends TableController
'sql_data',
Template::get('preview_sql')
->render(
array(
[
'query_data' => $sql_query
)
]
)
);
} elseif (!$error) {

View File

@ -119,10 +119,10 @@ class TableRelationController extends TableController
}
$this->response->getHeader()->getScripts()->addFiles(
array(
[
'tbl_relation.js',
'indexes.js'
)
]
);
// Set the database
@ -162,14 +162,14 @@ class TableRelationController extends TableController
$this->response->addHTML(
Template::get('table/secondary_tabs')->render(
array(
'url_params' => array(
[
'url_params' => [
'db' => $GLOBALS['db'],
'table' => $GLOBALS['table']
),
],
'is_foreign_key_supported' => Util::isForeignKeySupported($engine),
'cfg_relation' => $this->relation->getRelationsParam(),
)
]
)
);
$this->response->addHTML('<div id="structure_content">');
@ -182,8 +182,8 @@ class TableRelationController extends TableController
// in mysqli
$columns = $this->dbi->getColumns($this->db, $this->table);
$column_array = array();
$column_hash_array = array();
$column_array = [];
$column_hash_array = [];
$column_array[''] = '';
foreach ($columns as $column) {
if (strtoupper($this->tbl_storage_engine) == 'INNODB'
@ -204,9 +204,9 @@ class TableRelationController extends TableController
'table' => $this->table,
'cfg_relation' => $this->cfgRelation,
'tbl_storage_engine' => $this->tbl_storage_engine,
'existrel' => isset($this->existrel) ? $this->existrel : array(),
'existrel' => isset($this->existrel) ? $this->existrel : [],
'existrel_foreign' => isset($this->existrel_foreign)
? $this->existrel_foreign['foreign_keys_data'] : array(),
? $this->existrel_foreign['foreign_keys_data'] : [],
'options_array' => $this->options_array,
'column_array' => $column_array,
'column_hash_array' => $column_hash_array,
@ -330,7 +330,7 @@ class TableRelationController extends TableController
} else {
$columnList = $table_obj->getIndexedColumns(false, false);
}
$columns = array();
$columns = [];
foreach ($columnList as $column) {
$columns[] = htmlspecialchars($column);
}
@ -356,7 +356,7 @@ class TableRelationController extends TableController
*/
public function getDropdownValueForDbAction()
{
$tables = array();
$tables = [];
$foreign = isset($_REQUEST['foreign']) && $_REQUEST['foreign'] === 'true';
if ($foreign) {

View File

@ -109,12 +109,12 @@ class TableSearchController extends TableController
$this->url_query = $url_query;
$this->_searchType = $searchType;
$this->_columnNames = array();
$this->_columnNullFlags = array();
$this->_columnTypes = array();
$this->_columnCollations = array();
$this->_columnNames = [];
$this->_columnNullFlags = [];
$this->_columnTypes = [];
$this->_columnCollations = [];
$this->_geomColumnFlag = false;
$this->_foreigners = array();
$this->_foreigners = [];
$this->relation = new Relation();
// Loads table's information
$this->_loadTableInfo();
@ -208,14 +208,14 @@ class TableSearchController extends TableController
$this->response->getHeader()
->getScripts()
->addFiles(
array(
[
'makegrid.js',
'sql.js',
'tbl_select.js',
'tbl_change.js',
'vendor/jquery/jquery.uitablefilter.js',
'gis_data_editor.js',
)
]
);
if (isset($_REQUEST['range_search'])) {
@ -240,7 +240,7 @@ class TableSearchController extends TableController
$this->response->getHeader()
->getScripts()
->addFiles(
array(
[
'makegrid.js',
'sql.js',
'vendor/jqplot/jquery.jqplot.js',
@ -251,7 +251,7 @@ class TableSearchController extends TableController
'vendor/jqplot/plugins/jqplot.cursor.js',
'tbl_zoom_plot_jqplot.js',
'tbl_change.js',
)
]
);
/**
@ -331,11 +331,11 @@ class TableSearchController extends TableController
DatabaseInterface::QUERY_STORE
);
$fields_meta = $this->dbi->getFieldsMeta($result);
$data = array();
$data = [];
while ($row = $this->dbi->fetchAssoc($result)) {
//Need a row with indexes as 0,1,2 for the getUniqueCondition
// hence using a temporary array
$tmpRow = array();
$tmpRow = [];
foreach ($row as $val) {
$tmpRow[] = $val;
}
@ -352,25 +352,25 @@ class TableSearchController extends TableController
//Append it to row array as where_clause
$row['where_clause'] = $uniqueCondition[0];
$tmpData = array(
$tmpData = [
$_POST['criteriaColumnNames'][0] =>
$row[$_POST['criteriaColumnNames'][0]],
$_POST['criteriaColumnNames'][1] =>
$row[$_POST['criteriaColumnNames'][1]],
'where_clause' => $uniqueCondition[0]
);
];
$tmpData[$dataLabel] = ($dataLabel) ? $row[$dataLabel] : '';
$data[] = $tmpData;
}
unset($tmpData);
//Displays form for point data and scatter plot
$titles = array(
$titles = [
'Browse' => Util::getIcon(
'b_browse',
__('Browse foreign values')
)
);
];
$column_names_hashes = [];
foreach ($this->_columnNames as $columnName) {
@ -432,7 +432,7 @@ class TableSearchController extends TableController
*/
public function getDataRowAction()
{
$extra_data = array();
$extra_data = [];
$row_info_query = 'SELECT * FROM `' . $_REQUEST['db'] . '`.`'
. $_REQUEST['table'] . '` WHERE ' . $_REQUEST['where_clause'];
$result = $this->dbi->query(
@ -516,19 +516,19 @@ class TableSearchController extends TableController
$this->response->addHTML(
Template::get('secondary_tabs')
->render(
array(
'url_params' => array(
[
'url_params' => [
'db' => $this->db,
'table' => $this->table,
),
],
'sub_tabs' => $this->_getSubTabs(),
)
]
)
);
$column_names = $this->_columnNames;
$column_types = $this->_columnTypes;
$types = array();
$types = [];
if ($this->_searchType == 'replace') {
$num_cols = count($column_names);
for ($i= 0; $i < $num_cols; $i++) {
@ -537,7 +537,7 @@ class TableSearchController extends TableController
}
$criteria_column_names = isset($_POST['criteriaColumnNames']) ? $_POST['criteriaColumnNames'] : null;
$keys = array();
$keys = [];
for ($i= 0; $i < 4; $i++) {
if (isset($criteria_column_names[$i])) {
if ($criteria_column_names[$i] != 'pma_null') {
@ -547,7 +547,7 @@ class TableSearchController extends TableController
}
$this->response->addHTML(
Template::get('table/search/selection_form')->render(array(
Template::get('table/search/selection_form')->render([
'search_type' => $this->_searchType,
'db' => $this->db,
'table' => $this->table,
@ -567,7 +567,7 @@ class TableSearchController extends TableController
'max_plot_limit' => ((! empty($_POST['maxPlotLimit']))
? intval($_POST['maxPlotLimit'])
: intval($GLOBALS['cfg']['maxRowPlotLimit'])),
))
])
);
}
@ -665,7 +665,7 @@ class TableSearchController extends TableController
}
return Template::get('table/search/replace_preview')->render(
array(
[
'db' => $this->db,
'table' => $this->table,
'column_index' => $columnIndex,
@ -673,7 +673,7 @@ class TableSearchController extends TableController
'replace_with' => $replaceWith,
'use_regex' => $useRegex,
'result' => $result
)
]
);
}
@ -709,7 +709,7 @@ class TableSearchController extends TableController
if (is_array($result)) {
/* Iterate over possible delimiters to get one */
$delimiters = array('/', '@', '#', '~', '!', '$', '%', '^', '&', '_');
$delimiters = ['/', '@', '#', '~', '!', '$', '%', '^', '&', '_'];
$found = false;
for ($i = 0, $l = count($delimiters); $i < $l; $i++) {
if (strpos($find, $delimiters[$i]) === false) {
@ -816,7 +816,7 @@ class TableSearchController extends TableController
*/
private function _getSubTabs()
{
$subtabs = array();
$subtabs = [];
$subtabs['search']['icon'] = 'b_search';
$subtabs['search']['text'] = __('Table search');
$subtabs['search']['link'] = 'tbl_select.php';
@ -892,11 +892,11 @@ class TableSearchController extends TableController
? $_POST['criteriaColumnOperators'][$search_index] : '');
$entered_value = (isset($_POST['criteriaValues'])
? $_POST['criteriaValues'] : '');
$titles = array(
$titles = [
'Browse' => Util::getIcon(
'b_browse', __('Browse foreign values')
)
);
];
//Gets column's type and collation
$type = $this->_columnTypes[$column_index];
$collation = $this->_columnCollations[$column_index];
@ -906,17 +906,17 @@ class TableSearchController extends TableController
$this->_columnNullFlags[$column_index], $selected_operator
);
$func = Template::get('table/search/column_comparison_operators')->render(
array(
[
'search_index' => $search_index,
'type_operators' => $typeOperators
)
]
);
//Gets link to browse foreign data(if any) and criteria inputbox
$foreignData = $this->relation->getForeignData(
$this->_foreigners, $this->_columnNames[$column_index], false, '', ''
);
$value = Template::get('table/search/input_box')->render(
array(
[
'str' => '',
'column_type' => (string) $type,
'column_id' => 'fieldID_',
@ -932,14 +932,14 @@ class TableSearchController extends TableController
'db' => $this->db,
'titles' => $titles,
'in_fbs' => true
)
]
);
return array(
return [
'type' => $type,
'collation' => $collation,
'func' => $func,
'value' => $value
);
];
}
/**
@ -965,7 +965,7 @@ class TableSearchController extends TableController
}
// else continue to form the where clause from column criteria values
$fullWhereClause = array();
$fullWhereClause = [];
foreach ($_POST['criteriaColumnOperators'] as $column_index => $operator) {
$unaryFlag = $this->dbi->types->isUnaryOperator($operator);
$tmp_geom_func = isset($_POST['geom_func'][$column_index])
@ -1044,12 +1044,12 @@ class TableSearchController extends TableController
private function _getGeomWhereClause($criteriaValues, $names,
$func_type, $types, $geom_func = null
) {
$geom_unary_functions = array(
$geom_unary_functions = [
'IsEmpty' => 1,
'IsSimple' => 1,
'IsRing' => 1,
'IsClosed' => 1,
);
];
$where = '';
// Get details about the geometry functions
@ -1183,7 +1183,7 @@ class TableSearchController extends TableController
if (false !== $emptyKey) {
unset($values[$emptyKey]);
}
$wheres = array();
$wheres = [];
if (!empty($values)) {
$wheres[] = $backquoted_name . ' ' . $func_type
. ' (' . implode(',', $values) . ')';

View File

@ -126,7 +126,7 @@ class TableStructureController extends TableController
parent::__construct($response, $dbi, $db, $table);
$this->_db_is_system_schema = $db_is_system_schema;
$this->_url_query = Url::getCommonRaw(array('db' => $db, 'table' => $table));
$this->_url_query = Url::getCommonRaw(['db' => $db, 'table' => $table]);
$this->_tbl_is_view = $tbl_is_view;
$this->_tbl_storage_engine = $tbl_storage_engine;
$this->_table_info_num_rows = $table_info_num_rows;
@ -154,10 +154,10 @@ class TableStructureController extends TableController
include_once 'libraries/check_user_privileges.inc.php';
$this->response->getHeader()->getScripts()->addFiles(
array(
[
'tbl_structure.js',
'indexes.js'
)
]
);
/**
@ -177,7 +177,7 @@ class TableStructureController extends TableController
if (isset($_REQUEST['reserved_word_check'])) {
if ($GLOBALS['cfg']['ReservedWordDisableWarning'] === false) {
$columns_names = $_REQUEST['field_name'];
$reserved_keywords_names = array();
$reserved_keywords_names = [];
foreach ($columns_names as $column) {
if (Context::isKeyword(trim($column), true)) {
$reserved_keywords_names[] = trim($column);
@ -288,14 +288,14 @@ class TableStructureController extends TableController
$engine = $this->table_obj->getStorageEngine();
$this->response->addHTML(
Template::get('table/secondary_tabs')->render(
array(
'url_params' => array(
[
'url_params' => [
'db' => $this->db,
'table' => $this->table
),
],
'is_foreign_key_supported' => Util::isForeignKeySupported($engine),
'cfg_relation' => $this->relation->getRelationsParam(),
)
]
)
);
$this->response->addHTML('<div id="structure_content">');
@ -350,15 +350,15 @@ class TableStructureController extends TableController
// got to be eliminated in long run
$db = &$this->db;
$table = &$this->table;
$url_params = array();
$url_params = [];
include_once 'libraries/tbl_common.inc.php';
$this->_db_is_system_schema = $db_is_system_schema;
$this->_url_query = Url::getCommonRaw(array(
$this->_url_query = Url::getCommonRaw([
'db' => $db,
'table' => $table,
'goto' => 'tbl_structure.php',
'back' => 'tbl_structure.php',
));
]);
/* The url_params array is initialized in above include */
$url_params['goto'] = 'tbl_structure.php';
$url_params['back'] = 'tbl_structure.php';
@ -406,7 +406,7 @@ class TableStructureController extends TableController
*/
$columns = $this->dbi->getColumnsFull($this->db, $this->table);
$column_names = array_keys($columns);
$changes = array();
$changes = [];
// move columns from first to last
for ($i = 0, $l = count($_REQUEST['move_columns']); $i < $l; $i++) {
@ -440,9 +440,9 @@ class TableStructureController extends TableController
$default_type = 'USER_DEFINED';
}
$virtual = array(
$virtual = [
'VIRTUAL', 'PERSISTENT', 'VIRTUAL GENERATED', 'STORED GENERATED'
);
];
$data['Virtuality'] = '';
$data['Expression'] = '';
if (isset($data['Extra']) && in_array($data['Extra'], $virtual)) {
@ -494,9 +494,9 @@ class TableStructureController extends TableController
'sql_data',
Template::get('preview_sql')
->render(
array(
[
'query_data' => $sql_query
)
]
)
);
} else { // move column
@ -537,7 +537,7 @@ class TableStructureController extends TableController
/**
* @todo optimize in case of multiple fields to modify
*/
$fields_meta = array();
$fields_meta = [];
for ($i = 0; $i < $selected_cnt; $i++) {
$value = $this->dbi->getColumns(
$this->db, $this->table, $selected[$i], true
@ -584,11 +584,11 @@ class TableStructureController extends TableController
$this->response->addHTML(
Template::get('table/structure/partition_definition_form')
->render(
array(
[
'db' => $this->db,
'table' => $this->table,
'partition_details' => $partitionDetails,
)
]
)
);
}
@ -611,7 +611,7 @@ class TableStructureController extends TableController
*/
$stmt = $parser->statements[0];
$partitionDetails = array();
$partitionDetails = [];
$partitionDetails['partition_by'] = '';
$partitionDetails['partition_expr'] = '';
@ -668,12 +668,12 @@ class TableStructureController extends TableController
|| $partitionDetails['partition_by'] == 'LIST'
|| $partitionDetails['partition_by'] == 'LIST COLUMNS');
$partitionDetails['partitions'] = array();
$partitionDetails['partitions'] = [];
for ($i = 0; $i < intval($partitionDetails['partition_count']); $i++) {
if (! isset($stmt->partitions[$i])) {
$partitionDetails['partitions'][$i] = array(
$partitionDetails['partitions'][$i] = [
'name' => 'p' . $i,
'value_type' => '',
'value' => '',
@ -685,7 +685,7 @@ class TableStructureController extends TableController
'min_rows' => '',
'tablespace' => '',
'node_group' => '',
);
];
} else {
$p = $stmt->partitions[$i];
$type = $p->type;
@ -694,7 +694,7 @@ class TableStructureController extends TableController
$type .= ' MAXVALUE';
$expr = '';
}
$partitionDetails['partitions'][$i] = array(
$partitionDetails['partitions'][$i] = [
'name' => $p->name,
'value_type' => $type,
'value' => $expr,
@ -706,7 +706,7 @@ class TableStructureController extends TableController
'min_rows' => $p->options->has('MIN_ROWS', true),
'tablespace' => $p->options->has('TABLESPACE', true),
'node_group' => $p->options->has('NODEGROUP', true),
);
];
}
$partition =& $partitionDetails['partitions'][$i];
@ -714,11 +714,11 @@ class TableStructureController extends TableController
if ($partitionDetails['subpartition_count'] > 1) {
$partition['subpartition_count'] = $partitionDetails['subpartition_count'];
$partition['subpartitions'] = array();
$partition['subpartitions'] = [];
for ($j = 0; $j < intval($partitionDetails['subpartition_count']); $j++) {
if (! isset($stmt->partitions[$i]->subpartitions[$j])) {
$partition['subpartitions'][$j] = array(
$partition['subpartitions'][$j] = [
'name' => $partition['name'] . '_s' . $j,
'engine' => '',
'comment' => '',
@ -728,10 +728,10 @@ class TableStructureController extends TableController
'min_rows' => '',
'tablespace' => '',
'node_group' => '',
);
];
} else {
$sp = $stmt->partitions[$i]->subpartitions[$j];
$partition['subpartitions'][$j] = array(
$partition['subpartitions'][$j] = [
'name' => $sp->name,
'engine' => $sp->options->has('ENGINE', true),
'comment' => trim($sp->options->has('COMMENT', true), "'"),
@ -741,7 +741,7 @@ class TableStructureController extends TableController
'min_rows' => $sp->options->has('MIN_ROWS', true),
'tablespace' => $sp->options->has('TABLESPACE', true),
'node_group' => $sp->options->has('NODEGROUP', true),
);
];
}
$subpartition =& $partition['subpartitions'][$j];
@ -793,11 +793,11 @@ class TableStructureController extends TableController
*/
protected function getMultipleFieldCommandType()
{
$types = array(
$types = [
'change', 'drop', 'primary',
'index', 'unique', 'spatial',
'fulltext', 'browse'
);
];
foreach ($types as $type) {
if (isset($_REQUEST['submit_mult_' . $type . '_x'])) {
@ -830,7 +830,7 @@ class TableStructureController extends TableController
protected function displayTableBrowseForSelectedColumns($goto, $pmaThemeImage)
{
$GLOBALS['active_page'] = 'sql.php';
$fields = array();
$fields = [];
foreach ($_REQUEST['selected_fld'] as $sval) {
$fields[] = Util::backquote($sval);
}
@ -884,14 +884,14 @@ class TableStructureController extends TableController
protected function updateColumns()
{
$err_url = 'tbl_structure.php' . Url::getCommon(
array(
[
'db' => $this->db, 'table' => $this->table
)
]
);
$regenerate = false;
$field_cnt = count($_REQUEST['field_name']);
$changes = array();
$adjust_privileges = array();
$changes = [];
$adjust_privileges = [];
for ($i = 0; $i < $field_cnt; $i++) {
if (!$this->columnNeedsAlterTable($i)) {
@ -975,7 +975,7 @@ class TableStructureController extends TableController
| Index::SPATIAL | Index::FULLTEXT
);
$changedToBlob = array();
$changedToBlob = [];
// While changing the Column Collation
// First change to BLOB
for ($i = 0; $i < $field_cnt; $i++ ) {
@ -1029,7 +1029,7 @@ class TableStructureController extends TableController
// Save the Original Error
$orig_error = $this->dbi->getError();
$changes_revert = array();
$changes_revert = [];
// Change back to Original Collation and data type
for ($i = 0; $i < $field_cnt; $i++) {
@ -1177,11 +1177,11 @@ class TableStructureController extends TableController
return true;
}
$fields = array(
$fields = [
'field_attribute', 'field_collation', 'field_comments',
'field_default_value', 'field_default_type', 'field_extra',
'field_length', 'field_null', 'field_type'
);
];
foreach ($fields as $field) {
if ($_REQUEST[$field][$i] != $_REQUEST[$field . '_orig'][$i]) {
return true;
@ -1209,8 +1209,8 @@ class TableStructureController extends TableController
$primary_index, array $fields, array $columns_with_index
) {
// prepare comments
$comments_map = array();
$mime_map = array();
$comments_map = [];
$mime_map = [];
if ($GLOBALS['cfg']['ShowPropertyComments']) {
$comments_map = $this->relation->getComments($this->db, $this->table);
@ -1223,9 +1223,9 @@ class TableStructureController extends TableController
$this->db,
$this->table
);
$columns_list = array();
$columns_list = [];
$titles = array(
$titles = [
'Change' => Util::getIcon('b_edit', __('Change')),
'Drop' => Util::getIcon('b_drop', __('Drop')),
'NoDrop' => Util::getIcon('b_drop', __('Drop')),
@ -1240,7 +1240,7 @@ class TableStructureController extends TableController
'NoSpatial' => Util::getIcon('bd_spatial', __('Spatial')),
'NoIdxFulltext' => Util::getIcon('bd_ftext', __('Fulltext')),
'DistinctValues' => Util::getIcon('b_browse', __('Distinct values')),
);
];
/**
* Work on the table
@ -1265,7 +1265,7 @@ class TableStructureController extends TableController
$parts = explode(" ", substr($createView, 17));
$item['ALGORITHM'] = $parts[0];
$view = array(
$view = [
'operation' => 'alter',
'definer' => $item['DEFINER'],
'sql_security' => $item['SECURITY_TYPE'],
@ -1273,7 +1273,7 @@ class TableStructureController extends TableController
'as' => $item['VIEW_DEFINITION'],
'with' => $item['CHECK_OPTION'],
'algorithm' => $item['ALGORITHM'],
);
];
$edit_view_url = 'view_create.php'
. Url::getCommon($url_params) . '&amp;'
@ -1310,12 +1310,12 @@ class TableStructureController extends TableController
// logic removed from Template
$rownum = 0;
$columns_list = array();
$attributes = array();
$displayed_field_names = array();
$displayed_field_names_replaced = array();
$row_comments = array();
$extracted_columnspecs = array();
$columns_list = [];
$attributes = [];
$displayed_field_names = [];
$displayed_field_names_replaced = [];
$row_comments = [];
$extracted_columnspecs = [];
foreach ($fields as $field) {
$rownum += 1;
$columns_list[] = $field['Field'];
@ -1328,10 +1328,10 @@ class TableStructureController extends TableController
if (isset($field['Default'])) {
if ($field['Null'] == 'Yes') {
$field = array_merge($field, array('Default' => '<em>NULL</em>'));
$field = array_merge($field, ['Default' => '<em>NULL</em>']);
}
} else {
$field = array_merge($field, array('Default' => $field['Default']));
$field = array_merge($field, ['Default' => $field['Default']]);
}
$displayed_field_names[$rownum] = $field['Field'];
@ -1361,7 +1361,7 @@ class TableStructureController extends TableController
}
return Template::get('table/structure/display_structure')->render(
array(
[
'hide_structure_actions' => $hideStructureActions,
'db' => $this->db,
'table' => $this->table,
@ -1398,7 +1398,7 @@ class TableStructureController extends TableController
'displayed_field_names' => $displayed_field_names,
'displayed_field_names_replaced' => $displayed_field_names_replaced,
'row_comments' => $row_comments,
)
]
);
}
@ -1475,7 +1475,7 @@ class TableStructureController extends TableController
}
return Template::get('table/structure/display_table_stats')->render(
array(
[
'showtable' => $this->_showtable,
'table_info_num_rows' => $this->_table_info_num_rows,
'tbl_is_view' => $this->_tbl_is_view,
@ -1498,7 +1498,7 @@ class TableStructureController extends TableController
'tot_size' => $tot_size,
'tot_unit' => $tot_unit,
'table' => $GLOBALS['table']
)
]
);
}
@ -1600,9 +1600,9 @@ class TableStructureController extends TableController
// this should already be handled by tbl_structure.php
}
return array(
return [
$what, $query_type, $is_unset_submit_mult, $mult_btn,
$centralColsError
);
];
}
}

View File

@ -30,7 +30,7 @@ class Core
* the whitelist for goto parameter
* @static array $goto_whitelist
*/
public static $goto_whitelist = array(
public static $goto_whitelist = [
'db_datadict.php',
'db_sql.php',
'db_events.php',
@ -79,7 +79,7 @@ class Core
'transformation_overview.php',
'transformation_wrapper.php',
'user_password.php',
);
];
/**
* checks given $var and returns it if valid, or $default of not valid
@ -291,13 +291,13 @@ class Core
// Generate JSON manually
self::headerJSON();
echo json_encode(
array(
[
'success' => false,
'message' => Message::error($error_message)->getDisplay(),
)
]
);
} else {
$error_message = strtr($error_message, array('<br />' => '[br]'));
$error_message = strtr($error_message, ['<br />' => '[br]']);
$error_header = __('Error');
$lang = isset($GLOBALS['lang']) ? $GLOBALS['lang'] : 'en';
$dir = isset($GLOBALS['text_dir']) ? $GLOBALS['text_dir'] : 'ltr';
@ -322,9 +322,9 @@ class Core
public static function getPHPDocLink(string $target): string
{
/* List of PHP documentation translations */
$php_doc_languages = array(
$php_doc_languages = [
'pt_BR', 'zh', 'fr', 'de', 'it', 'ja', 'pl', 'ro', 'ru', 'fa', 'es', 'tr'
);
];
$lang = 'en';
if (in_array($GLOBALS['lang'], $php_doc_languages)) {
@ -419,7 +419,7 @@ class Core
return 0;
}
$binaryprefixes = array(
$binaryprefixes = [
'T' => 1099511627776,
't' => 1099511627776,
'G' => 1073741824,
@ -428,7 +428,7 @@ class Core
'm' => 1048576,
'K' => 1024,
'k' => 1024,
);
];
if (preg_match('/^([0-9]+)([KMGT])/i', $size, $matches)) {
return $matches[1] * $binaryprefixes[$matches[2]];
@ -528,7 +528,7 @@ class Core
Response::getInstance()->disable();
echo Template::get('header_location')
->render(array('uri' => $uri));
->render(['uri' => $uri]);
return;
}
@ -686,7 +686,7 @@ class Core
$a =& $array;
foreach ($keys as $key) {
if (! isset($a[$key])) {
$a[$key] = array();
$a[$key] = [];
}
$a =& $a[$key];
}
@ -705,7 +705,7 @@ class Core
{
$keys = explode('/', $path);
$keys_last = array_pop($keys);
$path = array();
$path = [];
$depth = 0;
$path[0] =& $array;
@ -748,14 +748,14 @@ class Core
return $url;
}
$params = array();
$params = [];
$params['url'] = $url;
$url = Url::getCommon($params);
//strip off token and such sensitive information. Just keep url.
$arr = parse_url($url);
parse_str($arr["query"], $vars);
$query = http_build_query(array("url" => $vars["url"]));
$query = http_build_query(["url" => $vars["url"]]);
if (!is_null($GLOBALS['PMA_Config']) && $GLOBALS['PMA_Config']->get('is_setup')) {
$url = '../url.php?' . $query;
@ -783,14 +783,14 @@ class Core
return false;
}
// We do not want these to be present
$blocked = array('user', 'pass', 'port');
$blocked = ['user', 'pass', 'port'];
foreach ($blocked as $part) {
if (isset($arr[$part]) && strlen((string) $arr[$part]) != 0) {
return false;
}
}
$domain = $arr["host"];
$domainWhiteList = array(
$domainWhiteList = [
/* Include current domain */
$_SERVER['SERVER_NAME'],
/* phpMyAdmin domains */
@ -812,7 +812,7 @@ class Core
'www.percona.com',
/* Following are doubtful ones. */
'mysqldatabaseadministration.blogspot.com',
);
];
return in_array($domain, $domainWhiteList);
}
@ -1267,18 +1267,18 @@ class Core
): void {
echo Template::get('list/item')
->render(
array(
[
'content' => $name,
'id' => $listId,
'class' => $class,
'url' => array(
'url' => [
'href' => $url,
'target' => $target,
'id' => $a_id,
'class' => $a_class,
),
],
'mysql_help_page' => $mysql_help_page,
)
]
);
}

View File

@ -329,7 +329,7 @@ class Designer
array $tables_pk_or_unique_keys
) {
$table_names = $GLOBALS['designer']['TABLE_NAME'];
$columns_type = array();
$columns_type = [];
foreach ($table_names as $table_name) {
$limit = count($tab_column[$table_name]['COLUMN_ID']);
for ($j = 0; $j < $limit; $j++) {

View File

@ -50,11 +50,11 @@ class Common
*/
public function getTablesInfo()
{
$retval = array();
$retval = [];
$GLOBALS['designer']['TABLE_NAME'] = array();// that foreach no error
$GLOBALS['designer']['OWNER'] = array();
$GLOBALS['designer']['TABLE_NAME_SMALL'] = array();
$GLOBALS['designer']['TABLE_NAME'] = [];// that foreach no error
$GLOBALS['designer']['OWNER'] = [];
$GLOBALS['designer']['TABLE_NAME_SMALL'] = [];
$tables = $this->dbi->getTablesFull($GLOBALS['db']);
// seems to be needed later
@ -107,7 +107,7 @@ class Common
public function getColumnsInfo()
{
$this->dbi->selectDb($GLOBALS['db']);
$tab_column = array();
$tab_column = [];
for ($i = 0, $cnt = count($GLOBALS['designer']["TABLE_NAME"]); $i < $cnt; $i++) {
$fields_rs = $this->dbi->query(
$this->dbi->getColumnsSql(
@ -140,8 +140,8 @@ class Common
public function getScriptContr()
{
$this->dbi->selectDb($GLOBALS['db']);
$con = array();
$con["C_NAME"] = array();
$con = [];
$con["C_NAME"] = [];
$i = 0;
$alltab_rs = $this->dbi->query(
'SHOW TABLES FROM ' . Util::backquote($GLOBALS['db']),
@ -184,20 +184,20 @@ class Common
}
$ti = 0;
$retval = array();
$retval = [];
for ($i = 0, $cnt = count($con["C_NAME"]); $i < $cnt; $i++) {
$c_name_i = $con['C_NAME'][$i];
$dtn_i = $con['DTN'][$i];
$retval[$ti] = array();
$retval[$ti][$c_name_i] = array();
$retval[$ti] = [];
$retval[$ti][$c_name_i] = [];
if (in_array($dtn_i, $GLOBALS['designer_url']["TABLE_NAME"])
&& in_array($con['STN'][$i], $GLOBALS['designer_url']["TABLE_NAME"])
) {
$retval[$ti][$c_name_i][$dtn_i] = array();
$retval[$ti][$c_name_i][$dtn_i][$con['DCN'][$i]] = array(
$retval[$ti][$c_name_i][$dtn_i] = [];
$retval[$ti][$c_name_i][$dtn_i][$con['DCN'][$i]] = [
0 => $con['STN'][$i],
1 => $con['SCN'][$i]
);
];
}
$ti++;
}
@ -223,7 +223,7 @@ class Common
*/
public function getAllKeys($unique_only = false)
{
$keys = array();
$keys = [];
foreach ($GLOBALS['designer']['TABLE_NAME_SMALL'] as $I => $table) {
$schema = $GLOBALS['designer']['OWNER'][$I];
@ -248,10 +248,10 @@ class Common
*/
public function getScriptTabs()
{
$retval = array(
'j_tabs' => array(),
'h_tabs' => array()
);
$retval = [
'j_tabs' => [],
'h_tabs' => []
];
for ($i = 0, $cnt = count($GLOBALS['designer']['TABLE_NAME']); $i < $cnt; $i++) {
$j = 0;
@ -570,7 +570,7 @@ class Common
if ($foreigner
&& isset($foreigner['constraint'])
) {
return array(false, __('Error: relationship already exists.'));
return [false, __('Error: relationship already exists.')];
}
// note: in InnoDB, the index does not requires to be on a PRIMARY
// or UNIQUE key
@ -581,7 +581,7 @@ class Common
);
// will be use to emphasis prim. keys in the table view
$index_array1 = array();
$index_array1 = [];
while ($row = $this->dbi->fetchAssoc($result)) {
$index_array1[$row['Column_name']] = 1;
}
@ -592,7 +592,7 @@ class Common
. '.' . Util::backquote($T2) . ';'
);
// will be used to emphasis prim. keys in the table view
$index_array2 = array();
$index_array2 = [];
while ($row = $this->dbi->fetchAssoc($result)) {
$index_array2[$row['Column_name']] = 1;
}
@ -616,23 +616,23 @@ class Common
}
$upd_query .= ';';
if ($this->dbi->tryQuery($upd_query)) {
return array(true, __('FOREIGN KEY relationship has been added.'));
return [true, __('FOREIGN KEY relationship has been added.')];
}
$error = $this->dbi->getError();
return array(
return [
false,
__('Error: FOREIGN KEY relationship could not be added!')
. "<br/>" . $error
);
];
}
return array(false, __('Error: Missing index on column(s).'));
return [false, __('Error: Missing index on column(s).')];
}
// internal (pmadb) relation
if ($GLOBALS['cfgRelation']['relwork'] == false) {
return array(false, __('Error: Relational features are disabled!'));
return [false, __('Error: Relational features are disabled!')];
}
// no need to recheck if the keys are primary or unique at this point,
@ -654,15 +654,15 @@ class Common
if ($this->relation->queryAsControlUser($q, false, DatabaseInterface::QUERY_STORE)
) {
return array(true, __('Internal relationship has been added.'));
return [true, __('Internal relationship has been added.')];
}
$error = $this->dbi->getError(DatabaseInterface::CONNECT_CONTROL);
return array(
return [
false,
__('Error: Internal relationship could not be added!')
. "<br/>" . $error
);
];
}
/**
@ -698,15 +698,15 @@ class Common
. '.' . Util::backquote($T2) . ' DROP FOREIGN KEY '
. Util::backquote($foreigner['constraint']) . ';';
if ($this->dbi->query($upd_query)) {
return array(true, __('FOREIGN KEY relationship has been removed.'));
return [true, __('FOREIGN KEY relationship has been removed.')];
}
$error = $this->dbi->getError();
return array(
return [
false,
__('Error: FOREIGN KEY relationship could not be removed!')
. "<br/>" . $error
);
];
}
}
@ -729,13 +729,13 @@ class Common
if (!$result) {
$error = $this->dbi->getError(DatabaseInterface::CONNECT_CONTROL);
return array(
return [
false,
__('Error: Internal relationship could not be removed!') . "<br/>" . $error
);
];
}
return array(true, __('Internal relationship has been removed.'));
return [true, __('Internal relationship has been removed.')];
}
/**
@ -749,11 +749,11 @@ class Common
public function saveSetting($index, $value)
{
$cfgRelation = $this->relation->getRelationsParam();
$cfgDesigner = array(
$cfgDesigner = [
'user' => $GLOBALS['cfg']['Server']['user'],
'db' => $cfgRelation['db'],
'table' => $cfgRelation['designer_settings']
);
];
$success = true;
if ($GLOBALS['cfgRelation']['designersettingswork']) {
@ -782,7 +782,7 @@ class Common
$success = $this->relation->queryAsControlUser($save_query);
} else {
$save_data = array($index => $value);
$save_data = [$index => $value];
$query = "INSERT INTO "
. Util::backquote($cfgDesigner['db'])

View File

@ -236,7 +236,7 @@ class Qbe
public function __construct(
$dbi,
$dbname,
array $savedSearchList = array(),
array $savedSearchList = [],
$currentSearch = null
) {
$this->_db = $dbname;
@ -302,7 +302,7 @@ class Qbe
$this->_prev_criteria = isset($_REQUEST['prev_criteria'])
? $_REQUEST['prev_criteria']
: array();
: [];
$this->_criteria = isset($_REQUEST['criteria'])
? $_REQUEST['criteria']
: array_fill(0, $criteriaColumnCount, '');
@ -321,12 +321,12 @@ class Qbe
: array_fill(0, $criteriaColumnCount, '');
// sets minimum width
$this->_form_column_width = 12;
$this->_formColumns = array();
$this->_formSorts = array();
$this->_formShows = array();
$this->_formCriterions = array();
$this->_formAndOrRows = array();
$this->_formAndOrCols = array();
$this->_formColumns = [];
$this->_formSorts = [];
$this->_formShows = [];
$this->_formCriterions = [];
$this->_formAndOrRows = [];
$this->_formAndOrCols = [];
}
/**
@ -912,7 +912,7 @@ class Qbe
$this->_formAndOrCols[$new_column_count]
= $this->_criteriaAndOrColumn[$column_index];
}
$checked_options = array();
$checked_options = [];
if (isset($this->_criteriaAndOrColumn[$column_index])
&& $this->_criteriaAndOrColumn[$column_index] == 'or'
) {
@ -1048,7 +1048,7 @@ class Qbe
{
$html_output = '';
$new_row_count = 0;
$checked_options = array();
$checked_options = [];
for (
$row_index = 0;
$row_index <= $this->_criteria_row_count;
@ -1109,7 +1109,7 @@ class Qbe
private function _getSelectClause()
{
$select_clause = '';
$select_clauses = array();
$select_clauses = [];
for (
$column_index = 0;
$column_index < $this->_criteria_column_count;
@ -1172,7 +1172,7 @@ class Qbe
}
// OR rows ${'cur' . $or}[$column_index]
if (! isset($this->_formAndOrRows)) {
$this->_formAndOrRows = array();
$this->_formAndOrRows = [];
}
for (
$row_index = 0;
@ -1236,7 +1236,7 @@ class Qbe
private function _getOrderByClause()
{
$orderby_clause = '';
$orderby_clauses = array();
$orderby_clauses = [];
// Create copy of instance variables
$columns = $this->_formColumns;
@ -1292,8 +1292,8 @@ class Qbe
private function _getIndexes(array $search_tables, array $search_columns,
array $where_clause_columns
) {
$unique_columns = array();
$index_columns = array();
$unique_columns = [];
$index_columns = [];
foreach ($search_tables as $table) {
$indexes = $this->dbi->getTableIndexes($this->_db, $table);
@ -1317,10 +1317,10 @@ class Qbe
} // end while (each index of a table)
} // end while (each table)
return array(
return [
'unique' => $unique_columns,
'index' => $index_columns
);
];
}
/**
@ -1360,8 +1360,8 @@ class Qbe
return $candidate_columns;
}
$very_good = array();
$still_good = array();
$very_good = [];
$still_good = [];
foreach ($candidate_columns as $column => $is_where) {
$table = explode('.', $column);
$table = $table[0];
@ -1413,7 +1413,7 @@ class Qbe
// Generally, we need to display all the rows of foreign (referenced)
// table, whether they have any matching row in child table or not.
// So we select candidate tables which are foreign tables.
$foreign_tables = array();
$foreign_tables = [];
foreach ($candidate_columns as $one_table) {
$foreigners = $this->relation->getForeigners($this->_db, $one_table);
foreach ($foreigners as $key => $foreigner) {
@ -1448,7 +1448,7 @@ class Qbe
// Of course we only want to check each table once
$checked_tables = $candidate_columns;
$tsize = array();
$tsize = [];
$maxsize = -1;
$result = '';
foreach ($candidate_columns as $table) {
@ -1473,8 +1473,8 @@ class Qbe
*/
private function _getWhereClauseTablesAndColumns()
{
$where_clause_columns = array();
$where_clause_tables = array();
$where_clause_columns = [];
$where_clause_tables = [];
// Now we need all tables that we have in the where clause
for (
@ -1500,10 +1500,10 @@ class Qbe
}
} // end if
} // end for
return array(
return [
'where_clause_tables' => $where_clause_tables,
'where_clause_columns' => $where_clause_columns
);
];
}
/**
@ -1521,7 +1521,7 @@ class Qbe
}
// Initialize some variables
$search_tables = $search_columns = array();
$search_tables = $search_columns = [];
// We only start this if we have fields, otherwise it would be dumb
foreach ($formColumns as $value) {
@ -1545,7 +1545,7 @@ class Qbe
if (empty($from_clause)) {
// Create cartesian product
$from_clause = implode(
", ", array_map(array('PhpMyAdmin\Util', 'backquote'), $search_tables)
", ", array_map(['PhpMyAdmin\Util', 'backquote'], $search_tables)
);
}
@ -1563,7 +1563,7 @@ class Qbe
private function _getJoinForFromClause(array $searchTables, array $searchColumns)
{
// $relations[master_table][foreign_table] => clause
$relations = array();
$relations = [];
// Fill $relations with inter table relationship data
foreach ($searchTables as $oneTable) {
@ -1583,7 +1583,7 @@ class Qbe
// Will include master tables and all tables that can be combined into
// a cluster by their relation
$finalized = array();
$finalized = [];
if (strlen($master) > 0) {
// Add master tables
$finalized[$master] = '';
@ -1651,7 +1651,7 @@ class Qbe
if (count($unfinalized) > 0) {
// Add these tables as cartesian product before joined tables
$join .= implode(
', ', array_map(array('PhpMyAdmin\Util', 'backquote'), $unfinalized)
', ', array_map(['PhpMyAdmin\Util', 'backquote'], $unfinalized)
);
}
}
@ -1685,14 +1685,14 @@ class Qbe
*/
private function _loadRelationsForTable(array &$relations, $oneTable)
{
$relations[$oneTable] = array();
$relations[$oneTable] = [];
$foreigners = $this->relation->getForeigners($GLOBALS['db'], $oneTable);
foreach ($foreigners as $field => $foreigner) {
// Foreign keys data
if ($field == 'foreign_keys_data') {
foreach ($foreigner as $oneKey) {
$clauses = array();
$clauses = [];
// There may be multiple column relations
foreach ($oneKey['index_list'] as $index => $oneField) {
$clauses[]
@ -1811,7 +1811,7 @@ class Qbe
$html_output .= $this->_getModifyColumnsRow();
$html_output .= '</table>';
$this->_new_row_count--;
$url_params = array();
$url_params = [];
$url_params['db'] = $this->_db;
$url_params['criteriaColumnCount'] = $this->_new_column_count;
$url_params['rows'] = $this->_new_row_count;
@ -1825,7 +1825,7 @@ class Qbe
$html_output .= $this->_getTablesList();
$html_output .= '</form>';
$html_output .= '<form action="db_qbe.php" method="post" class="lock-page">';
$html_output .= Url::getHiddenInputs(array('db' => $this->_db));
$html_output .= Url::getHiddenInputs(['db' => $this->_db]);
// get SQL query
$html_output .= '<div class="floatleft desktop50">';
$html_output .= '<fieldset>';
@ -1841,7 +1841,7 @@ class Qbe
. ' dir="' . $text_dir . '">';
if (empty($this->_formColumns)) {
$this->_formColumns = array();
$this->_formColumns = [];
}
$html_output .= $this->_getSQLQuery($this->_formColumns);
@ -1954,19 +1954,19 @@ class Qbe
if (isset($unique_columns) && count($unique_columns) > 0) {
$candidate_columns = $unique_columns;
$needsort = 1;
return array($candidate_columns, $needsort);
return [$candidate_columns, $needsort];
} elseif (isset($index_columns) && count($index_columns) > 0) {
$candidate_columns = $index_columns;
$needsort = 1;
return array($candidate_columns, $needsort);
return [$candidate_columns, $needsort];
} elseif (isset($where_clause_columns) && count($where_clause_columns) > 0) {
$candidate_columns = $where_clause_columns;
$needsort = 0;
return array($candidate_columns, $needsort);
return [$candidate_columns, $needsort];
}
$candidate_columns = $search_tables;
$needsort = 0;
return array($candidate_columns, $needsort);
return [$candidate_columns, $needsort];
}
}

View File

@ -99,13 +99,13 @@ class Search
{
$this->db = $db;
$this->dbi = $dbi;
$this->searchTypes = array(
$this->searchTypes = [
'1' => __('at least one of the words'),
'2' => __('all of the words'),
'3' => __('the exact phrase as substring'),
'4' => __('the exact phrase as whole field'),
'5' => __('as regular expression'),
);
];
// Sets criteria parameters
$this->setSearchParams();
}
@ -143,7 +143,7 @@ class Search
$this->criteriaSearchString = $_REQUEST['criteriaSearchString'];
}
$this->criteriaTables = array();
$this->criteriaTables = [];
if (empty($_REQUEST['criteriaTables'])
|| ! is_array($_REQUEST['criteriaTables'])
) {
@ -193,7 +193,7 @@ class Search
// Gets where clause for the query
$where_clause = $this->getWhereClause($table);
// Builds complete queries
$sql = array();
$sql = [];
$sql['select_columns'] = $sqlstr_select . ' * ' . $sqlstr_from
. $where_clause;
// here, I think we need to still use the COUNT clause, even for
@ -216,7 +216,7 @@ class Search
{
// Columns to select
$allColumns = $this->dbi->getColumns($GLOBALS['db'], $table);
$likeClauses = array();
$likeClauses = [];
// Based on search type, decide like/regex & '%'/''
$like_or_regex = (($this->criteriaSearchType == 5) ? 'REGEXP' : 'LIKE');
$automatic_wildcard = (($this->criteriaSearchType < 4) ? '%' : '');
@ -228,7 +228,7 @@ class Search
);
// Extract search words or pattern
$search_words = (($this->criteriaSearchType > 2)
? array($criteriaSearchStringEscaped)
? [$criteriaSearchStringEscaped]
: explode(' ', $criteriaSearchStringEscaped));
foreach ($search_words as $search_word) {
@ -236,7 +236,7 @@ class Search
if (strlen($search_word) === 0) {
continue;
}
$likeClausesPerColumn = array();
$likeClausesPerColumn = [];
// for each column in the table
foreach ($allColumns as $column) {
if (! isset($this->criteriaColumnName)
@ -312,7 +312,7 @@ class Search
*/
public function getSelectionForm()
{
$choices = array(
$choices = [
'1' => $this->searchTypes[1] . ' '
. Util::showHint(
__('Words are separated by a space character (" ").')
@ -324,7 +324,7 @@ class Search
'3' => $this->searchTypes[3],
'4' => $this->searchTypes[4],
'5' => $this->searchTypes[5] . ' ' . Util::showMySQLDocu('Regexp')
);
];
return Template::get('database/search/selection_form')->render([
'db' => $this->db,
'choices' => $choices,

View File

@ -131,13 +131,13 @@ class DatabaseInterface
public function __construct(DbiExtension $ext)
{
$this->_extension = $ext;
$this->_links = array();
$this->_links = [];
if (defined('TESTSUITE')) {
$this->_links[DatabaseInterface::CONNECT_USER] = 1;
$this->_links[DatabaseInterface::CONNECT_CONTROL] = 2;
}
$this->_table_cache = array();
$this->_current_user = array();
$this->_table_cache = [];
$this->_current_user = [];
$this->types = new Types($this);
$this->relation = new Relation();
}
@ -213,7 +213,7 @@ class DatabaseInterface
// final values at the correct depth. Then we'll keep digging into the
// array.
if (!isset($loc[$key]) || !is_array($loc[$key])) {
$loc[$key] = array();
$loc[$key] = [];
}
$loc = &$loc[$key];
}
@ -228,7 +228,7 @@ class DatabaseInterface
*/
public function clearTableCache(): void
{
$this->_table_cache = array();
$this->_table_cache = [];
}
/**
@ -278,7 +278,7 @@ class DatabaseInterface
*/
private function _dbgQuery(string $query, $link, $result, $time): void
{
$dbgInfo = array();
$dbgInfo = [];
$error_message = $this->getError($link);
if ($result == false && is_string($error_message)) {
$dbgInfo['error']
@ -423,7 +423,7 @@ class DatabaseInterface
. implode(
'\', \'',
array_map(
array($this, 'escapeString'),
[$this, 'escapeString'],
$table
)
)
@ -538,12 +538,12 @@ class DatabaseInterface
}
// prepare and check parameters
if (! is_array($database)) {
$databases = array($database);
$databases = [$database];
} else {
$databases = $database;
}
$tables = array();
$tables = [];
if (! $GLOBALS['cfg']['Server']['DisableIS']) {
$sql_where_table = $this->_getTableCondition(
@ -558,7 +558,7 @@ class DatabaseInterface
// comparison (if we are looking for the db Aa we don't want
// to find the db aa)
$this_databases = array_map(
array($this, 'escapeString'),
[$this, 'escapeString'],
$databases
);
@ -572,7 +572,7 @@ class DatabaseInterface
}
$tables = $this->fetchResult(
$sql, array('TABLE_SCHEMA', 'TABLE_NAME'), null, $link
$sql, ['TABLE_SCHEMA', 'TABLE_NAME'], null, $link
);
if ($sort_by == 'Name' && $GLOBALS['cfg']['NaturalOrder']) {
@ -623,7 +623,7 @@ class DatabaseInterface
. implode(
'\', \'',
array_map(
array($this, 'escapeString'),
[$this, 'escapeString'],
$table,
$link
)
@ -807,7 +807,7 @@ class DatabaseInterface
public function getVirtualTables(string $db): array
{
$tables_full = $this->getTablesFull($db);
$views = array();
$views = [];
foreach ($tables_full as $table=>$tmp) {
@ -932,7 +932,7 @@ class DatabaseInterface
unset($databases[$drop]);
}
} else {
$databases = array();
$databases = [];
foreach ($GLOBALS['dblist']->databases as $database_name) {
// Compatibility with INFORMATION_SCHEMA output
$databases[$database_name]['SCHEMA_NAME'] = $database_name;
@ -997,7 +997,7 @@ class DatabaseInterface
$GLOBALS['callback_sort_by'] = $sort_by;
usort(
$databases,
array(self::class, '_usortComparisonCallback')
[self::class, '_usortComparisonCallback']
);
unset($GLOBALS['callback_sort_order'], $GLOBALS['callback_sort_by']);
@ -1051,12 +1051,12 @@ class DatabaseInterface
*
* @return array
*/
public function getColumnMapFromSql(string $sql_query, array $view_columns = array()): array
public function getColumnMapFromSql(string $sql_query, array $view_columns = []): array
{
$result = $this->tryQuery($sql_query);
if ($result === false) {
return array();
return [];
}
$meta = $this->getFieldsMeta(
@ -1065,15 +1065,15 @@ class DatabaseInterface
$nbFields = count($meta);
if ($nbFields <= 0) {
return array();
return [];
}
$column_map = array();
$column_map = [];
$nbColumns = count($view_columns);
for ($i=0; $i < $nbFields; $i++) {
$map = array();
$map = [];
$map['table_name'] = $meta[$i]->table;
$map['refering_column'] = $meta[$i]->name;
@ -1105,8 +1105,8 @@ class DatabaseInterface
$link = DatabaseInterface::CONNECT_USER
): array {
if (! $GLOBALS['cfg']['Server']['DisableIS']) {
$sql_wheres = array();
$array_keys = array();
$sql_wheres = [];
$array_keys = [];
// get columns information from information_schema
if (null !== $database) {
@ -1149,7 +1149,7 @@ class DatabaseInterface
return $this->fetchResult($sql, $array_keys, null, $link);
}
$columns = array();
$columns = [];
if (null === $database) {
foreach ($GLOBALS['dblist']->databases as $database) {
$columns[$database] = $this->getColumnsFull(
@ -1284,7 +1284,7 @@ class DatabaseInterface
$sql = $this->getColumnsSql($database, $table, $column, $full);
$fields = $this->fetchResult($sql, 'Field', null, $link);
if (! is_array($fields) || count($fields) == 0) {
return array();
return [];
}
// Check if column is a part of multiple-column index and set its 'Key'.
$indexes = Index::getFromTable($table, $database);
@ -1377,7 +1377,7 @@ class DatabaseInterface
$indexes = $this->fetchResult($sql, null, null, $link);
if (! is_array($indexes) || count($indexes) < 1) {
return array();
return [];
}
return $indexes;
}
@ -1799,7 +1799,7 @@ class DatabaseInterface
$link = DatabaseInterface::CONNECT_USER,
int $options = 0
) {
$resultrows = array();
$resultrows = [];
$result = $this->tryQuery($query, $link, $options, false);
@ -1836,7 +1836,7 @@ class DatabaseInterface
}
if (! isset($result_target[$row[$key_index]])) {
$result_target[$row[$key_index]] = array();
$result_target[$row[$key_index]] = [];
}
$result_target =& $result_target[$row[$key_index]];
}
@ -1860,7 +1860,7 @@ class DatabaseInterface
*/
public function getCompatibilities(): array
{
$compats = array('NONE');
$compats = ['NONE'];
$compats[] = 'ANSI';
$compats[] = 'DB2';
$compats[] = 'MAXDB';
@ -1905,7 +1905,7 @@ class DatabaseInterface
$shows = $this->fetchResult(
'SHOW ' . $which . ' STATUS;', null, null, $link
);
$result = array();
$result = [];
foreach ($shows as $one_show) {
if ($one_show['Db'] == $db && $one_show['Type'] == $which) {
$result[] = $one_show['Name'];
@ -1930,12 +1930,12 @@ class DatabaseInterface
string $name,
$link = DatabaseInterface::CONNECT_USER
): string {
$returned_field = array(
$returned_field = [
'PROCEDURE' => 'Create Procedure',
'FUNCTION' => 'Create Function',
'EVENT' => 'Create Event',
'VIEW' => 'Create View'
);
];
$query = 'SHOW CREATE ' . $which . ' '
. Util::backquote($db) . '.'
. Util::backquote($name);
@ -1957,7 +1957,7 @@ class DatabaseInterface
?string $which = null,
string $name = ''
): array {
$routines = array();
$routines = [];
if (! $GLOBALS['cfg']['Server']['DisableIS']) {
$query = "SELECT"
. " `ROUTINE_SCHEMA` AS `Db`,"
@ -1975,7 +1975,7 @@ class DatabaseInterface
. " FROM `information_schema`.`ROUTINES`"
. " WHERE `ROUTINE_SCHEMA` " . Util::getCollateForIS()
. " = '" . $GLOBALS['dbi']->escapeString($db) . "'";
if (Core::isValid($which, array('FUNCTION','PROCEDURE'))) {
if (Core::isValid($which, ['FUNCTION','PROCEDURE'])) {
$query .= " AND `ROUTINE_TYPE` = '" . $which . "'";
}
if (! empty($name)) {
@ -2013,9 +2013,9 @@ class DatabaseInterface
}
}
$ret = array();
$ret = [];
foreach ($routines as $routine) {
$one_result = array();
$one_result = [];
$one_result['db'] = $routine['Db'];
$one_result['name'] = $routine['Name'];
$one_result['type'] = $routine['Type'];
@ -2026,7 +2026,7 @@ class DatabaseInterface
}
// Sort results by name
$name = array();
$name = [];
foreach ($ret as $value) {
$name[] = $value['name'];
}
@ -2077,10 +2077,10 @@ class DatabaseInterface
}
}
$result = array();
$result = [];
if ($events = $this->fetchResult($query)) {
foreach ($events as $event) {
$one_result = array();
$one_result = [];
$one_result['name'] = $event['Name'];
$one_result['type'] = $event['Type'];
$one_result['status'] = $event['Status'];
@ -2089,7 +2089,7 @@ class DatabaseInterface
}
// Sort results by name
$name = array();
$name = [];
foreach ($result as $value) {
$name[] = $value['name'];
}
@ -2109,7 +2109,7 @@ class DatabaseInterface
*/
public function getTriggers(string $db, string $table = '', $delimiter = '//')
{
$result = array();
$result = [];
if (! $GLOBALS['cfg']['Server']['DisableIS']) {
$query = 'SELECT TRIGGER_SCHEMA, TRIGGER_NAME, EVENT_MANIPULATION'
. ', EVENT_OBJECT_TABLE, ACTION_TIMING, ACTION_STATEMENT'
@ -2139,7 +2139,7 @@ class DatabaseInterface
$trigger['ACTION_STATEMENT'] = $trigger['Statement'];
$trigger['DEFINER'] = $trigger['Definer'];
}
$one_result = array();
$one_result = [];
$one_result['name'] = $trigger['TRIGGER_NAME'];
$one_result['table'] = $trigger['EVENT_OBJECT_TABLE'];
$one_result['action_timing'] = $trigger['ACTION_TIMING'];
@ -2167,7 +2167,7 @@ class DatabaseInterface
}
// Sort results by name
$name = array();
$name = [];
foreach ($result as $value) {
$name[] = $value['name'];
}
@ -2222,7 +2222,7 @@ class DatabaseInterface
$error .= ' - ' . $error_message .
' (<a href="server_engines.php' .
Url::getCommon(
array('engine' => 'InnoDB', 'page' => 'Status')
['engine' => 'InnoDB', 'page' => 'Status']
) . '">' . __('Details…') . '</a>)';
}
} else {
@ -2389,10 +2389,10 @@ class DatabaseInterface
*/
public function getSystemSchemas(): array
{
$schemas = array(
$schemas = [
'information_schema', 'performance_schema', 'mysql', 'sys'
);
$systemSchemas = array();
];
$systemSchemas = [];
foreach ($schemas as $schema) {
if ($this->isSystemSchema($schema, true)) {
$systemSchemas[] = $schema;
@ -2445,7 +2445,7 @@ class DatabaseInterface
$user = $cfg['Server']['controluser'];
$password = $cfg['Server']['controlpass'];
$server = array();
$server = [];
if (! empty($cfg['Server']['controlhost'])) {
$server['host'] = $cfg['Server']['controlhost'];
@ -2454,11 +2454,11 @@ class DatabaseInterface
}
// Share the settings if the host is same
if ($server['host'] == $cfg['Server']['host']) {
$shared = array(
$shared = [
'port', 'socket', 'compress',
'ssl', 'ssl_key', 'ssl_cert', 'ssl_ca',
'ssl_ca_path', 'ssl_ciphers', 'ssl_verify',
);
];
foreach ($shared as $item) {
if (isset($cfg['Server'][$item])) {
$server[$item] = $cfg['Server'][$item];
@ -2477,7 +2477,7 @@ class DatabaseInterface
}
} else {
if (is_null($server)) {
return array(null, null, null);
return [null, null, null];
}
if (isset($server['user'])) {
$user = $server['user'];
@ -2506,7 +2506,7 @@ class DatabaseInterface
$server['compress'] = false;
}
return array($user, $password, $server);
return [$user, $password, $server];
}
/**

File diff suppressed because it is too large Load Diff

View File

@ -23,7 +23,7 @@ class DbiMysqli implements DbiExtension
/**
* @var array
*/
private static $pma_mysqli_flag_names = array(
private static $pma_mysqli_flag_names = [
MYSQLI_NUM_FLAG => 'num',
MYSQLI_PART_KEY_FLAG => 'part_key',
MYSQLI_SET_FLAG => 'set',
@ -37,7 +37,7 @@ class DbiMysqli implements DbiExtension
MYSQLI_UNIQUE_KEY_FLAG => 'unique_key',
MYSQLI_PRI_KEY_FLAG => 'primary_key',
MYSQLI_NOT_NULL_FLAG => 'not_null',
);
];
/**
* connects to the database server
@ -394,7 +394,7 @@ class DbiMysqli implements DbiExtension
public function getFieldsMeta($result)
{
// Build an associative array for a type look up
$typeAr = array();
$typeAr = [];
$typeAr[MYSQLI_TYPE_DECIMAL] = 'real';
$typeAr[MYSQLI_TYPE_NEWDECIMAL] = 'real';
$typeAr[MYSQLI_TYPE_BIT] = 'int';
@ -524,7 +524,7 @@ class DbiMysqli implements DbiExtension
$type = $fieldDefinition->type;
$charsetNumber = $fieldDefinition->charsetnr;
$fieldDefinitionFlags = $fieldDefinition->flags;
$flags = array();
$flags = [];
foreach (self::$pma_mysqli_flag_names as $flag => $name) {
if ($fieldDefinitionFlags & $flag) {
$flags[] = $name;

View File

@ -41,7 +41,7 @@ class AliasItem implements Item
* @param array $params Parameters
* @return mixed
*/
public function get(array $params = array())
public function get(array $params = [])
{
return $this->container->get($this->target, $params);
}

View File

@ -21,7 +21,7 @@ class Container implements ContainerInterface
/**
* @var Item[] $content
*/
protected $content = array();
protected $content = [];
/**
* @var Container
@ -54,7 +54,7 @@ class Container implements ContainerInterface
*
* @return mixed
*/
public function get($name, array $params = array())
public function get($name, array $params = [])
{
if (!$this->has($name)) {
throw new NotFoundException("No entry was found for $name identifier.");

View File

@ -24,7 +24,7 @@ class FactoryItem extends ReflectorItem
*
* @return mixed
*/
public function get(array $params = array())
public function get(array $params = [])
{
return $this->invoke($params);
}

View File

@ -23,5 +23,5 @@ interface Item
* @param array $params Parameters
* @return mixed
*/
public function get(array $params = array());
public function get(array $params = []);
}

View File

@ -41,9 +41,9 @@ abstract class ReflectorItem implements Item
* @param array $params Parameters
* @return mixed
*/
protected function invoke(array $params = array())
protected function invoke(array $params = [])
{
$args = array();
$args = [];
$reflector = $this->_reflector;
if ($reflector instanceof \ReflectionClass) {
$constructor = $reflector->getConstructor();
@ -76,9 +76,9 @@ abstract class ReflectorItem implements Item
*
*@return array
*/
private function _resolveArgs($required, array $params = array())
private function _resolveArgs($required, array $params = [])
{
$args = array();
$args = [];
foreach ($required as $param) {
$name = $param->getName();
$type = $param->getClass();

View File

@ -26,7 +26,7 @@ class ServiceItem extends ReflectorItem
* @param array $params Parameters
* @return mixed
*/
public function get(array $params = array())
public function get(array $params = [])
{
if (!isset($this->instance)) {
$this->instance = $this->invoke();

View File

@ -36,7 +36,7 @@ class ValueItem implements Item
* @param array $params Parameters
* @return mixed
*/
public function get(array $params = array())
public function get(array $params = [])
{
return $this->value;
}

View File

@ -49,7 +49,7 @@ class CreateTable
public static function getHtml($db)
{
return Template::get('database/create_table')->render(
array('db' => $db)
['db' => $db]
);
}
}

View File

@ -577,44 +577,44 @@ class Export
if (isset($_SESSION['tmpval']['aliases'])) {
foreach ($_SESSION['tmpval']['aliases'] as $db => $dbData) {
if (isset($dbData['alias'])) {
$result .= $template->render(array(
$result .= $template->render([
'type' => _pgettext('Alias', 'Database'),
'name' => $db,
'field' => 'aliases[' . $db . '][alias]',
'value' => $dbData['alias'],
));
]);
}
if (! isset($dbData['tables'])) {
continue;
}
foreach ($dbData['tables'] as $table => $tableData) {
if (isset($tableData['alias'])) {
$result .= $template->render(array(
$result .= $template->render([
'type' => _pgettext('Alias', 'Table'),
'name' => $db . '.' . $table,
'field' => 'aliases[' . $db . '][tables][' . $table . '][alias]',
'value' => $tableData['alias'],
));
]);
}
if (! isset($tableData['columns'])) {
continue;
}
foreach ($tableData['columns'] as $column => $columnName) {
$result .= $template->render(array(
$result .= $template->render([
'type' => _pgettext('Alias', 'Column'),
'name' => $db . '.' . $table . '.'. $column,
'field' => 'aliases[' . $db . '][tables][' . $table . '][colums][' . $column . ']',
'value' => $columnName,
));
]);
}
}
}
}
// Empty row for javascript manipulations
$result .= '</tbody><tfoot class="hide">' . $template->render(array(
$result .= '</tbody><tfoot class="hide">' . $template->render([
'type' => '', 'name' => '', 'field' => 'aliases_new', 'value' => ''
)) . '</tfoot>';
]) . '</tfoot>';
return $result . '</table>';
}
@ -669,10 +669,10 @@ class Export
$exportList = Plugins::getPlugins(
"export",
'libraries/classes/Plugins/Export/',
array(
[
'export_type' => $exportType,
'single_table' => isset($GLOBALS['single_table'])
)
]
);
/* Fail if we didn't find any plugin */

View File

@ -74,7 +74,7 @@ class Import
}
// zip, gzip and bzip2 encode features
$compressions = array();
$compressions = [];
if ($cfg['GZipDump'] && function_exists('gzopen')) {
$compressions[] = 'gzip';
}

View File

@ -43,13 +43,13 @@ class ImportAjax
/**
* list of available plugins
*/
$plugins = array(
$plugins = [
// PHP 5.4 session-based upload progress is problematic, see bug 3964
//"session",
"progress",
"apc",
"noplugin"
);
];
// select available plugin
foreach ($plugins as $plugin) {
@ -63,7 +63,7 @@ class ImportAjax
break;
}
}
return array($SESSION_KEY, $upload_id, $plugins);
return [$SESSION_KEY, $upload_id, $plugins];
}
/**

View File

@ -89,7 +89,7 @@ class Results
// Declare global fields
/** array with properties of the class */
private $_property_array = array(
private $_property_array = [
/** string Database name */
'db' => null,
@ -176,8 +176,8 @@ class Results
'unique_id' => null,
/** where clauses for each row, each table in the row */
'whereClauseMap' => array(),
);
'whereClauseMap' => [],
];
/**
* This variable contains the column transformation information
@ -257,125 +257,125 @@ class Results
*/
private function _setDefaultTransformations()
{
$json_highlighting_data = array(
$json_highlighting_data = [
'libraries/classes/Plugins/Transformations/Output/Text_Plain_Json.php',
'PhpMyAdmin\Plugins\Transformations\Output\Text_Plain_Json',
'Text_Plain'
);
$sql_highlighting_data = array(
];
$sql_highlighting_data = [
'libraries/classes/Plugins/Transformations/Output/Text_Plain_Sql.php',
'PhpMyAdmin\Plugins\Transformations\Output\Text_Plain_Sql',
'Text_Plain'
);
$blob_sql_highlighting_data = array(
];
$blob_sql_highlighting_data = [
'libraries/classes/Plugins/Transformations/Output/Text_Octetstream_Sql.php',
'PhpMyAdmin\Plugins\Transformations\Output\Text_Octetstream_Sql',
'Text_Octetstream'
);
$link_data = array(
];
$link_data = [
'libraries/classes/Plugins/Transformations/Text_Plain_Link.php',
'PhpMyAdmin\Plugins\Transformations\Text_Plain_Link',
'Text_Plain'
);
$this->transformation_info = array(
'information_schema' => array(
'events' => array(
];
$this->transformation_info = [
'information_schema' => [
'events' => [
'event_definition' => $sql_highlighting_data
),
'processlist' => array(
],
'processlist' => [
'info' => $sql_highlighting_data
),
'routines' => array(
],
'routines' => [
'routine_definition' => $sql_highlighting_data
),
'triggers' => array(
],
'triggers' => [
'action_statement' => $sql_highlighting_data
),
'views' => array(
],
'views' => [
'view_definition' => $sql_highlighting_data
)
),
'mysql' => array(
'event' => array(
]
],
'mysql' => [
'event' => [
'body' => $blob_sql_highlighting_data,
'body_utf8' => $blob_sql_highlighting_data
),
'general_log' => array(
],
'general_log' => [
'argument' => $sql_highlighting_data
),
'help_category' => array(
],
'help_category' => [
'url' => $link_data
),
'help_topic' => array(
],
'help_topic' => [
'example' => $sql_highlighting_data,
'url' => $link_data
),
'proc' => array(
],
'proc' => [
'param_list' => $blob_sql_highlighting_data,
'returns' => $blob_sql_highlighting_data,
'body' => $blob_sql_highlighting_data,
'body_utf8' => $blob_sql_highlighting_data
),
'slow_log' => array(
],
'slow_log' => [
'sql_text' => $sql_highlighting_data
)
)
);
]
]
];
$cfgRelation = $this->relation->getRelationsParam();
if ($cfgRelation['db']) {
$this->transformation_info[$cfgRelation['db']] = array();
$this->transformation_info[$cfgRelation['db']] = [];
$relDb = &$this->transformation_info[$cfgRelation['db']];
if (! empty($cfgRelation['history'])) {
$relDb[$cfgRelation['history']] = array(
$relDb[$cfgRelation['history']] = [
'sqlquery' => $sql_highlighting_data
);
];
}
if (! empty($cfgRelation['bookmark'])) {
$relDb[$cfgRelation['bookmark']] = array(
$relDb[$cfgRelation['bookmark']] = [
'query' => $sql_highlighting_data
);
];
}
if (! empty($cfgRelation['tracking'])) {
$relDb[$cfgRelation['tracking']] = array(
$relDb[$cfgRelation['tracking']] = [
'schema_sql' => $sql_highlighting_data,
'data_sql' => $sql_highlighting_data
);
];
}
if (! empty($cfgRelation['favorite'])) {
$relDb[$cfgRelation['favorite']] = array(
$relDb[$cfgRelation['favorite']] = [
'tables' => $json_highlighting_data
);
];
}
if (! empty($cfgRelation['recent'])) {
$relDb[$cfgRelation['recent']] = array(
$relDb[$cfgRelation['recent']] = [
'tables' => $json_highlighting_data
);
];
}
if (! empty($cfgRelation['savedsearches'])) {
$relDb[$cfgRelation['savedsearches']] = array(
$relDb[$cfgRelation['savedsearches']] = [
'search_data' => $json_highlighting_data
);
];
}
if (! empty($cfgRelation['designer_settings'])) {
$relDb[$cfgRelation['designer_settings']] = array(
$relDb[$cfgRelation['designer_settings']] = [
'settings_data' => $json_highlighting_data
);
];
}
if (! empty($cfgRelation['table_uiprefs'])) {
$relDb[$cfgRelation['table_uiprefs']] = array(
$relDb[$cfgRelation['table_uiprefs']] = [
'prefs' => $json_highlighting_data
);
];
}
if (! empty($cfgRelation['userconfig'])) {
$relDb[$cfgRelation['userconfig']] = array(
$relDb[$cfgRelation['userconfig']] = [
'config_data' => $json_highlighting_data
);
];
}
if (! empty($cfgRelation['export_templates'])) {
$relDb[$cfgRelation['export_templates']] = array(
$relDb[$cfgRelation['export_templates']] = [
'template_data' => $json_highlighting_data
);
];
}
}
}
@ -685,7 +685,7 @@ class Results
}
} // end if (3)
return array($displayParts, $the_total);
return [$displayParts, $the_total];
} // end of the 'setDisplayPartsAndTotal()' function
@ -800,13 +800,13 @@ class Results
if ($nbTotalPage > 1) {
$table_navigation_html .= '<td>';
$_url_params = array(
$_url_params = [
'db' => $this->__get('db'),
'table' => $this->__get('table'),
'sql_query' => $this->__get('sql_query'),
'goto' => $this->__get('goto'),
'is_browse_distinct' => $this->__get('is_browse_distinct'),
);
];
//<form> to keep the form alignment of button < and <<
// and also to know what to execute when the selector changes
@ -822,7 +822,7 @@ class Results
$table_navigation_html .= '</form>'
. '</td>';
}
return array($table_navigation_html, $nbTotalPage);
return [$table_navigation_html, $nbTotalPage];
}
/**
@ -1122,13 +1122,13 @@ class Results
$numberOfRowsPlaceholder = __('All');
}
$numberOfRowsChoices = array(
$numberOfRowsChoices = [
'25' => 25,
'50' => 50,
'100' => 100,
'250' => 250,
'500' => 500
);
];
return Template::get('display/results/additional_fields')->render([
'goto' => $this->__get('goto'),
@ -1269,8 +1269,8 @@ class Results
*/
private function _getTableHeaders(
array &$displayParts, array $analyzed_sql_results, $unsorted_sql_query,
array $sort_expression = array(), $sort_expression_nodirection = '',
array $sort_direction = array(), $is_limited_display = false
array $sort_expression = [], $sort_expression_nodirection = '',
array $sort_direction = [], $is_limited_display = false
) {
$table_headers_html = '';
@ -1390,7 +1390,7 @@ class Results
}
}
return array($unsorted_sql_query, $drop_down_html);
return [$unsorted_sql_query, $drop_down_html];
} // end of the '_getUnsortedSqlAndSortByKeyDropDown()' function
@ -1418,7 +1418,7 @@ class Results
. Url::getHiddenInputs(
$this->__get('db'), $this->__get('table')
)
. Url::getHiddenFields(array('sort_by_key' => '1'), '', true)
. Url::getHiddenFields(['sort_by_key' => '1'], '', true)
. __('Sort by key')
. ': <select name="sql_query" class="autosubmit">' . "\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 = '<th';
$th_class = array();
$th_class = [];
$th_class[] = 'draggable';
$this->_getClassForNumericColumnType($fields_meta, $th_class);
if ($col_visib && !$col_visib_j) {
@ -2266,7 +2266,7 @@ class Results
) {
$draggable_html = '<th';
$th_class = array();
$th_class = [];
$th_class[] = 'draggable';
$this->_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']
)
. '</span>' . "\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 = '<fieldset class="print_ignore" ><legend>'
. __('Query results operations') . '</legend>';
$_url_params = array(
$_url_params = [
'db' => $this->__get('db'),
'table' => $this->__get('table'),
'printview' => '1',
'sql_query' => $this->__get('sql_query'),
);
];
$url_query = Url::getCommon($_url_params);
if (!$header_shown) {
@ -5081,7 +5081,7 @@ class Results
*/
private function _handleNonPrintableContents(
$category, $content, $transformation_plugin, $transform_options,
$default_function, $meta, array $url_params = array(), &$is_truncated = null
$default_function, $meta, array $url_params = [], &$is_truncated = null
) {
$is_truncated = false;
@ -5131,7 +5131,7 @@ class Results
return($result);
}
$result = $default_function($result, array(), $meta);
$result = $default_function($result, [], $meta);
if (($_SESSION['tmpval']['display_binary']
&& $meta->type === self::STRING_FIELD)
|| ($_SESSION['tmpval']['display_blob']
@ -5316,7 +5316,7 @@ class Results
$title = htmlspecialchars($data);
}
$_url_params = array(
$_url_params = [
'db' => $map[$meta->name][3],
'table' => $map[$meta->name][0],
'pos' => '0',
@ -5326,7 +5326,7 @@ class Results
. ' WHERE '
. Util::backquote($map[$meta->name][1])
. $where_comparison,
);
];
if ($transformation_plugin != $default_function) {
// always apply a transformation on the real data,
@ -5351,7 +5351,7 @@ class Results
}
$tag_params = array('title' => $title);
$tag_params = ['title' => $title];
if (strpos($class, 'grid_edit') !== false) {
$tag_params['class'] = 'ajax';
}
@ -5546,7 +5546,7 @@ class Results
. Util::linkOrButton(
$del_url,
$del_str,
array('class' => 'delete_row requireConfirm' . $ajax)
['class' => 'delete_row requireConfirm' . $ajax]
)
. '<div class="hide">' . $js_conf . '</div>'
. '</td>';
@ -5664,6 +5664,6 @@ class Results
$truncated = false;
}
return array($truncated, $str, $original_length);
return [$truncated, $str, $original_length];
}
}

View File

@ -66,21 +66,21 @@ class Encoding
*
* @var array
*/
private static $_enginemap = array(
'iconv' => array('iconv', self::ENGINE_ICONV, 'iconv'),
'recode' => array('recode_string', self::ENGINE_RECODE, 'recode'),
'mb' => array('mb_convert_encoding', self::ENGINE_MB, 'mbstring'),
'none' => array('isset', self::ENGINE_NONE, ''),
);
private static $_enginemap = [
'iconv' => ['iconv', self::ENGINE_ICONV, 'iconv'],
'recode' => ['recode_string', self::ENGINE_RECODE, 'recode'],
'mb' => ['mb_convert_encoding', self::ENGINE_MB, 'mbstring'],
'none' => ['isset', self::ENGINE_NONE, ''],
];
/**
* Order of automatic detection of engines
*
* @var array
*/
private static $_engineorder = array(
private static $_engineorder = [
'iconv', 'mb', 'recode',
);
];
/**
* Kanji encodings list

View File

@ -25,31 +25,31 @@ class Bdb extends StorageEngine
*/
public function getVariables()
{
return array(
'version_bdb' => array(
return [
'version_bdb' => [
'title' => __('Version information'),
),
'bdb_cache_size' => array(
],
'bdb_cache_size' => [
'type' => PMA_ENGINE_DETAILS_TYPE_SIZE,
),
'bdb_home' => array(),
'bdb_log_buffer_size' => array(
],
'bdb_home' => [],
'bdb_log_buffer_size' => [
'type' => PMA_ENGINE_DETAILS_TYPE_SIZE,
),
'bdb_logdir' => array(),
'bdb_max_lock' => array(
],
'bdb_logdir' => [],
'bdb_max_lock' => [
'type' => PMA_ENGINE_DETAILS_TYPE_NUMERIC,
),
'bdb_shared_data' => array(),
'bdb_tmpdir' => array(),
'bdb_data_direct' => array(),
'bdb_lock_detect' => array(),
'bdb_log_direct' => array(),
'bdb_no_recover' => array(),
'bdb_no_sync' => array(),
'skip_sync_bdb_logs' => array(),
'sync_bdb_logs' => array(),
);
],
'bdb_shared_data' => [],
'bdb_tmpdir' => [],
'bdb_data_direct' => [],
'bdb_lock_detect' => [],
'bdb_log_direct' => [],
'bdb_no_recover' => [],
'bdb_no_sync' => [],
'skip_sync_bdb_logs' => [],
'sync_bdb_logs' => [],
];
}
/**

View File

@ -26,94 +26,94 @@ class Innodb extends StorageEngine
*/
public function getVariables()
{
return array(
'innodb_data_home_dir' => array(
return [
'innodb_data_home_dir' => [
'title' => __('Data home directory'),
'desc' => __(
'The common part of the directory path for all InnoDB data '
. 'files.'
),
),
'innodb_data_file_path' => array(
],
'innodb_data_file_path' => [
'title' => __('Data files'),
),
'innodb_autoextend_increment' => array(
],
'innodb_autoextend_increment' => [
'title' => __('Autoextend increment'),
'desc' => __(
'The increment size for extending the size of an autoextending '
. 'tablespace when it becomes full.'
),
'type' => PMA_ENGINE_DETAILS_TYPE_NUMERIC,
),
'innodb_buffer_pool_size' => array(
],
'innodb_buffer_pool_size' => [
'title' => __('Buffer pool size'),
'desc' => __(
'The size of the memory buffer InnoDB uses to cache data and '
. 'indexes of its tables.'
),
'type' => PMA_ENGINE_DETAILS_TYPE_SIZE,
),
'innodb_additional_mem_pool_size' => array(
],
'innodb_additional_mem_pool_size' => [
'title' => 'innodb_additional_mem_pool_size',
'type' => PMA_ENGINE_DETAILS_TYPE_SIZE,
),
'innodb_buffer_pool_awe_mem_mb' => array(
],
'innodb_buffer_pool_awe_mem_mb' => [
'type' => PMA_ENGINE_DETAILS_TYPE_SIZE,
),
'innodb_checksums' => array(),
'innodb_commit_concurrency' => array(),
'innodb_concurrency_tickets' => array(
],
'innodb_checksums' => [],
'innodb_commit_concurrency' => [],
'innodb_concurrency_tickets' => [
'type' => PMA_ENGINE_DETAILS_TYPE_NUMERIC,
),
'innodb_doublewrite' => array(),
'innodb_fast_shutdown' => array(),
'innodb_file_io_threads' => array(
],
'innodb_doublewrite' => [],
'innodb_fast_shutdown' => [],
'innodb_file_io_threads' => [
'type' => PMA_ENGINE_DETAILS_TYPE_NUMERIC,
),
'innodb_file_per_table' => array(),
'innodb_flush_log_at_trx_commit' => array(),
'innodb_flush_method' => array(),
'innodb_force_recovery' => array(),
'innodb_lock_wait_timeout' => array(
],
'innodb_file_per_table' => [],
'innodb_flush_log_at_trx_commit' => [],
'innodb_flush_method' => [],
'innodb_force_recovery' => [],
'innodb_lock_wait_timeout' => [
'type' => PMA_ENGINE_DETAILS_TYPE_NUMERIC,
),
'innodb_locks_unsafe_for_binlog' => array(),
'innodb_log_arch_dir' => array(),
'innodb_log_archive' => array(),
'innodb_log_buffer_size' => array(
],
'innodb_locks_unsafe_for_binlog' => [],
'innodb_log_arch_dir' => [],
'innodb_log_archive' => [],
'innodb_log_buffer_size' => [
'type' => PMA_ENGINE_DETAILS_TYPE_SIZE,
),
'innodb_log_file_size' => array(
],
'innodb_log_file_size' => [
'type' => PMA_ENGINE_DETAILS_TYPE_SIZE,
),
'innodb_log_files_in_group' => array(
],
'innodb_log_files_in_group' => [
'type' => PMA_ENGINE_DETAILS_TYPE_NUMERIC,
),
'innodb_log_group_home_dir' => array(),
'innodb_max_dirty_pages_pct' => array(
],
'innodb_log_group_home_dir' => [],
'innodb_max_dirty_pages_pct' => [
'type' => PMA_ENGINE_DETAILS_TYPE_NUMERIC,
),
'innodb_max_purge_lag' => array(),
'innodb_mirrored_log_groups' => array(
],
'innodb_max_purge_lag' => [],
'innodb_mirrored_log_groups' => [
'type' => PMA_ENGINE_DETAILS_TYPE_NUMERIC,
),
'innodb_open_files' => array(
],
'innodb_open_files' => [
'type' => PMA_ENGINE_DETAILS_TYPE_NUMERIC,
),
'innodb_support_xa' => array(),
'innodb_sync_spin_loops' => array(
],
'innodb_support_xa' => [],
'innodb_sync_spin_loops' => [
'type' => PMA_ENGINE_DETAILS_TYPE_NUMERIC,
),
'innodb_table_locks' => array(
],
'innodb_table_locks' => [
'type' => PMA_ENGINE_DETAILS_TYPE_BOOLEAN,
),
'innodb_thread_concurrency' => array(
],
'innodb_thread_concurrency' => [
'type' => PMA_ENGINE_DETAILS_TYPE_NUMERIC,
),
'innodb_thread_sleep_delay' => array(
],
'innodb_thread_sleep_delay' => [
'type' => PMA_ENGINE_DETAILS_TYPE_NUMERIC,
),
);
],
];
}
/**
@ -135,9 +135,9 @@ class Innodb extends StorageEngine
public function getInfoPages()
{
if ($this->support < PMA_ENGINE_SUPPORT_YES) {
return array();
return [];
}
$pages = array();
$pages = [];
$pages['Bufferpool'] = __('Buffer Pool');
$pages['Status'] = __('InnoDB Status');

View File

@ -25,11 +25,11 @@ class Memory extends StorageEngine
*/
public function getVariables()
{
return array(
'max_heap_table_size' => array(
return [
'max_heap_table_size' => [
'type' => PMA_ENGINE_DETAILS_TYPE_SIZE,
),
);
],
];
}
}

View File

@ -25,23 +25,23 @@ class Myisam extends StorageEngine
*/
public function getVariables()
{
return array(
'myisam_data_pointer_size' => array(
return [
'myisam_data_pointer_size' => [
'title' => __('Data pointer size'),
'desc' => __(
'The default pointer size in bytes, to be used by CREATE TABLE '
. 'for MyISAM tables when no MAX_ROWS option is specified.'
),
'type' => PMA_ENGINE_DETAILS_TYPE_SIZE,
),
'myisam_recover_options' => array(
],
'myisam_recover_options' => [
'title' => __('Automatic recovery mode'),
'desc' => __(
'The mode for automatic recovery of crashed MyISAM tables, as '
. 'set via the --myisam-recover server startup option.'
),
),
'myisam_max_sort_file_size' => array(
],
'myisam_max_sort_file_size' => [
'title' => __('Maximum size for temporary sort files'),
'desc' => __(
'The maximum size of the temporary file MySQL is allowed to use '
@ -49,8 +49,8 @@ class Myisam extends StorageEngine
. 'TABLE, or LOAD DATA INFILE).'
),
'type' => PMA_ENGINE_DETAILS_TYPE_SIZE,
),
'myisam_max_extra_sort_file_size' => array(
],
'myisam_max_extra_sort_file_size' => [
'title' => __('Maximum size for temporary files on index creation'),
'desc' => __(
'If the temporary file used for fast MyISAM index creation '
@ -58,8 +58,8 @@ class Myisam extends StorageEngine
. 'specified here, prefer the key cache method.'
),
'type' => PMA_ENGINE_DETAILS_TYPE_SIZE,
),
'myisam_repair_threads' => array(
],
'myisam_repair_threads' => [
'title' => __('Repair threads'),
'desc' => __(
'If this value is greater than 1, MyISAM table indexes are '
@ -67,8 +67,8 @@ class Myisam extends StorageEngine
. 'the repair by sorting process.'
),
'type' => PMA_ENGINE_DETAILS_TYPE_NUMERIC,
),
'myisam_sort_buffer_size' => array(
],
'myisam_sort_buffer_size' => [
'title' => __('Sort buffer size'),
'desc' => __(
'The buffer that is allocated when sorting MyISAM indexes '
@ -76,14 +76,14 @@ class Myisam extends StorageEngine
. 'INDEX or ALTER TABLE.'
),
'type' => PMA_ENGINE_DETAILS_TYPE_SIZE,
),
'myisam_stats_method' => array(),
'delay_key_write' => array(),
'bulk_insert_buffer_size' => array(
],
'myisam_stats_method' => [],
'delay_key_write' => [],
'bulk_insert_buffer_size' => [
'type' => PMA_ENGINE_DETAILS_TYPE_SIZE,
),
'skip_external_locking' => array(),
);
],
'skip_external_locking' => [],
];
}
}

View File

@ -25,9 +25,9 @@ class Ndbcluster extends StorageEngine
*/
public function getVariables()
{
return array(
'ndb_connectstring' => array(),
);
return [
'ndb_connectstring' => [],
];
}
/**

View File

@ -27,8 +27,8 @@ class Pbxt extends StorageEngine
*/
public function getVariables()
{
return array(
'pbxt_index_cache_size' => array(
return [
'pbxt_index_cache_size' => [
'title' => __('Index cache size'),
'desc' => __(
'This is the amount of memory allocated to the'
@ -36,8 +36,8 @@ class Pbxt extends StorageEngine
. ' allocated here is used only for caching index pages.'
),
'type' => PMA_ENGINE_DETAILS_TYPE_SIZE,
),
'pbxt_record_cache_size' => array(
],
'pbxt_record_cache_size' => [
'title' => __('Record cache size'),
'desc' => __(
'This is the amount of memory allocated to the'
@ -46,8 +46,8 @@ class Pbxt extends StorageEngine
. ' the handle data (.xtd) and row pointer (.xtr) files.'
),
'type' => PMA_ENGINE_DETAILS_TYPE_SIZE,
),
'pbxt_log_cache_size' => array(
],
'pbxt_log_cache_size' => [
'title' => __('Log cache size'),
'desc' => __(
'The amount of memory allocated to the'
@ -55,16 +55,16 @@ class Pbxt extends StorageEngine
. ' data. The default is 16MB.'
),
'type' => PMA_ENGINE_DETAILS_TYPE_SIZE,
),
'pbxt_log_file_threshold' => array(
],
'pbxt_log_file_threshold' => [
'title' => __('Log file threshold'),
'desc' => __(
'The size of a transaction log before rollover,'
. ' and a new log is created. The default value is 16MB.'
),
'type' => PMA_ENGINE_DETAILS_TYPE_SIZE,
),
'pbxt_transaction_buffer_size' => array(
],
'pbxt_transaction_buffer_size' => [
'title' => __('Transaction buffer size'),
'desc' => __(
'The size of the global transaction log buffer'
@ -72,8 +72,8 @@ class Pbxt extends StorageEngine
. ' The default is 1MB.'
),
'type' => PMA_ENGINE_DETAILS_TYPE_SIZE,
),
'pbxt_checkpoint_frequency' => array(
],
'pbxt_checkpoint_frequency' => [
'title' => __('Checkpoint frequency'),
'desc' => __(
'The amount of data written to the transaction'
@ -81,8 +81,8 @@ class Pbxt extends StorageEngine
. ' The default value is 24MB.'
),
'type' => PMA_ENGINE_DETAILS_TYPE_SIZE,
),
'pbxt_data_log_threshold' => array(
],
'pbxt_data_log_threshold' => [
'title' => __('Data log threshold'),
'desc' => __(
'The maximum size of a data log file. The default'
@ -92,8 +92,8 @@ class Pbxt extends StorageEngine
. ' amount of data that can be stored in the database.'
),
'type' => PMA_ENGINE_DETAILS_TYPE_SIZE,
),
'pbxt_garbage_threshold' => array(
],
'pbxt_garbage_threshold' => [
'title' => __('Garbage threshold'),
'desc' => __(
'The percentage of garbage in a data log file'
@ -101,8 +101,8 @@ class Pbxt extends StorageEngine
. ' 99. The default is 50.'
),
'type' => PMA_ENGINE_DETAILS_TYPE_NUMERIC,
),
'pbxt_log_buffer_size' => array(
],
'pbxt_log_buffer_size' => [
'title' => __('Log buffer size'),
'desc' => __(
'The size of the buffer used when writing a data'
@ -111,18 +111,18 @@ class Pbxt extends StorageEngine
. ' to write a data log.'
),
'type' => PMA_ENGINE_DETAILS_TYPE_SIZE,
),
'pbxt_data_file_grow_size' => array(
],
'pbxt_data_file_grow_size' => [
'title' => __('Data file grow size'),
'desc' => __('The grow size of the handle data (.xtd) files.'),
'type' => PMA_ENGINE_DETAILS_TYPE_SIZE,
),
'pbxt_row_file_grow_size' => array(
],
'pbxt_row_file_grow_size' => [
'title' => __('Row file grow size'),
'desc' => __('The grow size of the row pointer (.xtr) files.'),
'type' => PMA_ENGINE_DETAILS_TYPE_SIZE,
),
'pbxt_log_file_count' => array(
],
'pbxt_log_file_count' => [
'title' => __('Log file count'),
'desc' => __(
'This is the number of transaction log files'
@ -132,8 +132,8 @@ class Pbxt extends StorageEngine
. ' highest number.'
),
'type' => PMA_ENGINE_DETAILS_TYPE_NUMERIC,
),
);
],
];
}
/**
@ -165,7 +165,7 @@ class Pbxt extends StorageEngine
*/
public function getInfoPages()
{
$pages = array();
$pages = [];
$pages['Documentation'] = __('Documentation');
return $pages;

View File

@ -24,7 +24,7 @@ class Error extends Message
*
* @var array
*/
public static $errortype = array (
public static $errortype = [
0 => 'Internal error',
E_ERROR => 'Error',
E_WARNING => 'Warning',
@ -40,14 +40,14 @@ class Error extends Message
E_STRICT => 'Runtime Notice',
E_DEPRECATED => 'Deprecation Notice',
E_RECOVERABLE_ERROR => 'Catchable Fatal Error',
);
];
/**
* Error levels
*
* @var array
*/
public static $errorlevel = array (
public static $errorlevel = [
0 => 'error',
E_ERROR => 'error',
E_WARNING => 'error',
@ -63,7 +63,7 @@ class Error extends Message
E_STRICT => 'notice',
E_DEPRECATED => 'notice',
E_RECOVERABLE_ERROR => 'error',
);
];
/**
* The file in which the error occurred
@ -84,7 +84,7 @@ class Error extends Message
*
* @var array
*/
protected $backtrace = array();
protected $backtrace = [];
/**
* Hide location of errors
@ -113,7 +113,7 @@ class Error extends Message
// debug_backtrace(), handleError() and addError()
$backtrace = array_slice($backtrace, 3);
} else {
$backtrace = array();
$backtrace = [];
}
$this->setBacktrace($backtrace);
@ -128,13 +128,13 @@ class Error extends Message
*/
public static function processBacktrace(array $backtrace): array
{
$result = array();
$result = [];
$members = array('line', 'function', 'class', 'type');
$members = ['line', 'function', 'class', 'type'];
foreach ($backtrace as $idx => $step) {
/* Create new backtrace entry */
$result[$idx] = array();
$result[$idx] = [];
/* Make path relative */
if (isset($step['file'])) {
@ -402,20 +402,20 @@ class Error extends Message
public static function getArg($arg, string $function): string
{
$retval = '';
$include_functions = array(
$include_functions = [
'include',
'include_once',
'require',
'require_once',
);
$connect_functions = array(
];
$connect_functions = [
'mysql_connect',
'mysql_pconnect',
'mysqli_connect',
'mysqli_real_connect',
'connect',
'_realConnect'
);
];
if (in_array($function, $include_functions)) {
$retval .= self::relPath($arg);

View File

@ -25,7 +25,7 @@ class ErrorHandler
*
* @var Error[]
*/
protected $errors = array();
protected $errors = [];
/**
* Hide location of errors
@ -50,7 +50,7 @@ class ErrorHandler
* rely on PHPUnit doing it's own error handling which we break here.
*/
if (!defined('TESTSUITE')) {
set_error_handler(array($this, 'handleError'));
set_error_handler([$this, 'handleError']);
}
$this->error_reporting = error_reporting();
}
@ -65,7 +65,7 @@ class ErrorHandler
{
if (isset($_SESSION)) {
if (! isset($_SESSION['errors'])) {
$_SESSION['errors'] = array();
$_SESSION['errors'] = [];
}
// remember only not displayed errors
@ -363,10 +363,10 @@ class ErrorHandler
$retval .= ' class="hide"';
}
$retval .= '>';
$retval .= Url::getHiddenFields(array(
$retval .= Url::getHiddenFields([
'exception_type' => 'php',
'send_error_report' => '1',
));
]);
$retval .= '<input type="submit" value="'
. __('Report')
. '" id="pma_report_errors" class="floatright">'
@ -417,7 +417,7 @@ class ErrorHandler
}
// delete stored errors
$_SESSION['errors'] = array();
$_SESSION['errors'] = [];
unset($_SESSION['errors']);
}
}

View File

@ -332,7 +332,7 @@ class Export
$filename .= '.zip';
$mime_type = 'application/zip';
}
return array($filename, $mime_type);
return [$filename, $mime_type];
}
/**
@ -380,7 +380,7 @@ class Export
);
$message->addParam($save_filename);
}
return array($save_filename, $message, $file_handle);
return [$save_filename, $message, $file_handle];
}
/**
@ -407,13 +407,13 @@ class Export
$message = new Message(
__('Insufficient space to save the file %s.'),
Message::ERROR,
array($save_filename)
[$save_filename]
);
} else {
$message = new Message(
__('Dump has been saved to file %s.'),
Message::SUCCESS,
array($save_filename)
[$save_filename]
);
}
return $message;
@ -491,12 +491,12 @@ class Export
if ($export_type == 'server') {
$back_button .= 'server_export.php' . Url::getCommon();
} elseif ($export_type == 'database') {
$back_button .= 'db_export.php' . Url::getCommon(array('db' => $db));
$back_button .= 'db_export.php' . Url::getCommon(['db' => $db]);
} else {
$back_button .= 'tbl_export.php' . Url::getCommon(
array(
[
'db' => $db, 'table' => $table
)
]
);
}
@ -549,7 +549,7 @@ class Export
. '<textarea name="sqldump" cols="50" rows="30" '
. 'id="textSQLDUMP" wrap="OFF">';
return array($html, $back_button, $refreshButton);
return [$html, $back_button, $refreshButton];
}
/**
@ -669,7 +669,7 @@ class Export
}
}
$views = array();
$views = [];
foreach ($tables as $table) {
$_table = new Table($table, $db);
@ -1059,7 +1059,7 @@ class Export
*/
public function lockTables(string $db, array $tables, string $lockType = "WRITE")
{
$locks = array();
$locks = [];
foreach ($tables as $table) {
$locks[] = Util::backquote($db) . "."
. Util::backquote($table) . " " . $lockType;
@ -1086,7 +1086,7 @@ class Export
*/
public function getMetadataTypes(): array
{
return array(
return [
'column_info',
'table_uiprefs',
'tracking',
@ -1097,7 +1097,7 @@ class Export
'savedsearches',
'central_columns',
'export_templates',
);
];
}
/**

View File

@ -360,13 +360,13 @@ class File
string $rownumber,
string $key
): array {
$new_file = array(
$new_file = [
'name' => $file['name']['multi_edit'][$rownumber][$key],
'type' => $file['type']['multi_edit'][$rownumber][$key],
'size' => $file['size']['multi_edit'][$rownumber][$key],
'tmp_name' => $file['tmp_name']['multi_edit'][$rownumber][$key],
'error' => $file['error']['multi_edit'][$rownumber][$key],
);
];
return $new_file;
}

View File

@ -30,7 +30,7 @@ class FileListing
return false;
}
$result = array();
$result = [];
if (substr($dir, -1) != '/') {
$dir .= '/';
}

View File

@ -25,51 +25,51 @@ class Font
public function getCharLists(): array
{
// list of characters and their width modifiers
$charLists = array();
$charLists = [];
//ijl
$charLists[] = array("chars" => array("i", "j", "l"), "modifier" => 0.23);
$charLists[] = ["chars" => ["i", "j", "l"], "modifier" => 0.23];
//f
$charLists[] = array("chars" => array("f"), "modifier" => 0.27);
$charLists[] = ["chars" => ["f"], "modifier" => 0.27];
//tI
$charLists[] = array("chars" => array("t", "I"), "modifier" => 0.28);
$charLists[] = ["chars" => ["t", "I"], "modifier" => 0.28];
//r
$charLists[] = array("chars" => array("r"), "modifier" => 0.34);
$charLists[] = ["chars" => ["r"], "modifier" => 0.34];
//1
$charLists[] = array("chars" => array("1"), "modifier" => 0.49);
$charLists[] = ["chars" => ["1"], "modifier" => 0.49];
//cksvxyzJ
$charLists[] = array(
"chars" => array("c", "k", "s", "v", "x", "y", "z", "J"),
$charLists[] = [
"chars" => ["c", "k", "s", "v", "x", "y", "z", "J"],
"modifier" => 0.5
);
];
//abdeghnopquL023456789
$charLists[] = array(
"chars" => array(
$charLists[] = [
"chars" => [
"a", "b", "d", "e", "g", "h", "n", "o", "p", "q", "u", "L",
"0", "2", "3", "4", "5", "6", "7", "8", "9"
),
],
"modifier" => 0.56
);
];
//FTZ
$charLists[] = array("chars" => array("F", "T", "Z"), "modifier" => 0.61);
$charLists[] = ["chars" => ["F", "T", "Z"], "modifier" => 0.61];
//ABEKPSVXY
$charLists[] = array(
"chars" => array("A", "B", "E", "K", "P", "S", "V", "X", "Y"),
$charLists[] = [
"chars" => ["A", "B", "E", "K", "P", "S", "V", "X", "Y"],
"modifier" => 0.67
);
];
//wCDHNRU
$charLists[] = array(
"chars" => array("w", "C", "D", "H", "N", "R", "U"),
$charLists[] = [
"chars" => ["w", "C", "D", "H", "N", "R", "U"],
"modifier" => 0.73
);
];
//GOQ
$charLists[] = array("chars" => array("G", "O", "Q"), "modifier" => 0.78);
$charLists[] = ["chars" => ["G", "O", "Q"], "modifier" => 0.78];
//mM
$charLists[] = array("chars" => array("m", "M"), "modifier" => 0.84);
$charLists[] = ["chars" => ["m", "M"], "modifier" => 0.84];
//W
$charLists[] = array("chars" => array("W"), "modifier" => 0.95);
$charLists[] = ["chars" => ["W"], "modifier" => 0.95];
//" "
$charLists[] = array("chars" => array(" "), "modifier" => 0.28);
$charLists[] = ["chars" => [" "], "modifier" => 0.28];
return $charLists;
}

View File

@ -106,7 +106,7 @@ class Footer
*
* @return object Reference passed object
*/
private static function _removeRecursion(&$object, array $stack = array())
private static function _removeRecursion(&$object, array $stack = [])
{
if ((is_object($object) || is_array($object)) && $object) {
if ($object instanceof Traversable) {
@ -139,10 +139,10 @@ class Footer
self::_removeRecursion($_SESSION['debug']);
$retval = JSON_encode($_SESSION['debug']);
$_SESSION['debug'] = array();
$_SESSION['debug'] = [];
return json_last_error() ? '\'false\'' : $retval;
}
$_SESSION['debug'] = array();
$_SESSION['debug'] = [];
return $retval;
}
@ -156,15 +156,15 @@ class Footer
$db = isset($GLOBALS['db']) && strlen($GLOBALS['db']) ? $GLOBALS['db'] : '';
$table = isset($GLOBALS['table']) && strlen($GLOBALS['table']) ? $GLOBALS['table'] : '';
$target = isset($_REQUEST['target']) && strlen($_REQUEST['target']) ? $_REQUEST['target'] : '';
$params = array(
$params = [
'db' => $db,
'table' => $table,
'server' => $GLOBALS['server'],
'target' => $target
);
];
// needed for server privileges tabs
if (isset($_REQUEST['viewing_mode'])
&& in_array($_REQUEST['viewing_mode'], array('server', 'db', 'table'))
&& in_array($_REQUEST['viewing_mode'], ['server', 'db', 'table'])
) {
$params['viewing_mode'] = $_REQUEST['viewing_mode'];
}
@ -187,7 +187,7 @@ class Footer
$params['checkprivstable'] = $_REQUEST['checkprivstable'];
}
if (isset($_REQUEST['single_table'])
&& in_array($_REQUEST['single_table'], array(true, false))
&& in_array($_REQUEST['single_table'], [true, false])
) {
$params['single_table'] = $_REQUEST['single_table'];
}

View File

@ -199,7 +199,7 @@ abstract class GisGeometry
$wkt = $value;
}
return array('srid' => $srid, 'wkt' => $wkt);
return ['srid' => $srid, 'wkt' => $wkt];
}
/**
@ -214,7 +214,7 @@ abstract class GisGeometry
*/
protected function extractPoints($point_set, $scale_data, $linear = false)
{
$points_arr = array();
$points_arr = [];
// Separate each point
$points = explode(",", $point_set);
@ -241,7 +241,7 @@ abstract class GisGeometry
}
if (!$linear) {
$points_arr[] = array($x, $y);
$points_arr[] = [$x, $y];
} else {
$points_arr[] = $x;
$points_arr[] = $y;

Some files were not shown because too many files have changed in this diff Show More