Merge pull request #15604 from mauriciofauth/double-quote-usage

Defines rules for double quote usage
This commit is contained in:
Maurício Meneghini Fauth 2019-12-03 13:04:28 -03:00 committed by GitHub
commit 12db01bfc3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
330 changed files with 4058 additions and 4048 deletions

View File

@ -12,10 +12,10 @@ declare(strict_types=1);
$i = 0;
$hosts = [
"foo.example.com",
"bar.example.com",
"baz.example.com",
"quux.example.com",
'foo.example.com',
'bar.example.com',
'baz.example.com',
'quux.example.com',
];
foreach ($hosts as $host) {

View File

@ -76,7 +76,7 @@ function Show_page($contents)
function Die_error($e)
{
$contents = "<div class='relyingparty_results'>\n";
$contents .= "<pre>" . htmlspecialchars($e->getMessage()) . "</pre>\n";
$contents .= '<pre>' . htmlspecialchars($e->getMessage()) . "</pre>\n";
$contents .= "</div class='relyingparty_results'>";
Show_page($contents);
exit;
@ -143,7 +143,7 @@ if (isset($_POST['start'])) {
$url = $authRequest->getAuthorizeURL();
header("Location: $url");
header('Location: ' . $url);
exit;
} else {
/* Grab query string */

View File

@ -25,7 +25,7 @@ list(
global $containerBuilder;
// $_GET["message"] is used for asking for an import message
if (isset($_GET["message"]) && $_GET["message"]) {
if (isset($_GET['message']) && $_GET['message']) {
// AJAX requests can't be cached!
Core::noCacheHeader();
@ -62,5 +62,5 @@ if (isset($_GET["message"]) && $_GET["message"]) {
'go_back_url' => $_SESSION['Import_message']['go_back_url'],
]);
} else {
ImportAjax::status($_GET["id"]);
ImportAjax::status($_GET['id']);
}

View File

@ -456,7 +456,7 @@ $js_messages['strPrimaryKeyAdded'] = __('Primary key added.');
$js_messages['strToNextStep'] = __('Taking you to next step…');
$js_messages['strFinishMsg']
= __("The first step of normalization is complete for table '%s'.");
$js_messages['strEndStep'] = __("End of step");
$js_messages['strEndStep'] = __('End of step');
$js_messages['str2NFNormalization'] = __('Second step of normalization (2NF)');
$js_messages['strDone'] = __('Done');
$js_messages['strConfirmPd'] = __('Confirm partial dependencies');
@ -685,22 +685,22 @@ $js_messages['strUpToDate'] = __('up to date');
$js_messages['strCreateView'] = __('Create view');
/* Error Reporting */
$js_messages['strSendErrorReport'] = __("Send error report");
$js_messages['strSubmitErrorReport'] = __("Submit error report");
$js_messages['strSendErrorReport'] = __('Send error report');
$js_messages['strSubmitErrorReport'] = __('Submit error report');
$js_messages['strErrorOccurred'] = __(
"A fatal JavaScript error has occurred. Would you like to send an error report?"
'A fatal JavaScript error has occurred. Would you like to send an error report?'
);
$js_messages['strChangeReportSettings'] = __("Change report settings");
$js_messages['strShowReportDetails'] = __("Show report details");
$js_messages['strIgnore'] = __("Ignore");
$js_messages['strChangeReportSettings'] = __('Change report settings');
$js_messages['strShowReportDetails'] = __('Show report details');
$js_messages['strIgnore'] = __('Ignore');
$js_messages['strTimeOutError'] = __(
"Your export is incomplete, due to a low execution time limit at the PHP level!"
'Your export is incomplete, due to a low execution time limit at the PHP level!'
);
$js_messages['strTooManyInputs'] = __(
"Warning: a form on this page has more than %d fields. On submission, "
'Warning: a form on this page has more than %d fields. On submission, '
. "some of the fields might be ignored, due to PHP's "
. "max_input_vars configuration."
. 'max_input_vars configuration.'
);
$js_messages['phpErrorsFound'] = '<div class="alert alert-danger" role="alert">'
@ -768,7 +768,7 @@ $js_messages['strStructure'] = __('Structure');
echo "var Messages = [];\n";
foreach ($js_messages as $name => $js_message) {
Sanitize::printJsValue("Messages." . $name . "", $js_message);
Sanitize::printJsValue('Messages.' . $name . '', $js_message);
}
/* Calendar */

View File

@ -565,7 +565,7 @@ class Advisor
for ($i = 0; $i < $numLines; $i++) {
$line = $file[$i];
if ($line == "" || $line[0] == '#') {
if ($line == '' || $line[0] == '#') {
continue;
}
@ -671,7 +671,7 @@ class Advisor
$num = '<' . pow(10, -$precision);
}
return "$num $per";
return $num . ' ' . $per;
}
/**

View File

@ -134,9 +134,9 @@ class Bookmark
return false;
}
$query = "INSERT INTO " . Util::backquote($cfgBookmark['db'])
. "." . Util::backquote($cfgBookmark['table'])
. " (id, dbase, user, query, label) VALUES (NULL, "
$query = 'INSERT INTO ' . Util::backquote($cfgBookmark['db'])
. '.' . Util::backquote($cfgBookmark['table'])
. ' (id, dbase, user, query, label) VALUES (NULL, '
. "'" . $this->dbi->escapeString($this->_database) . "', "
. "'" . $this->dbi->escapeString($this->_user) . "', "
. "'" . $this->dbi->escapeString($this->_query) . "', "
@ -158,9 +158,9 @@ class Bookmark
return false;
}
$query = "DELETE FROM " . Util::backquote($cfgBookmark['db'])
. "." . Util::backquote($cfgBookmark['table'])
. " WHERE id = " . $this->_id;
$query = 'DELETE FROM ' . Util::backquote($cfgBookmark['db'])
. '.' . Util::backquote($cfgBookmark['table'])
. ' WHERE id = ' . $this->_id;
return $this->dbi->tryQuery($query, DatabaseInterface::CONNECT_CONTROL);
}
@ -172,7 +172,7 @@ class Bookmark
public function getVariableCount(): int
{
$matches = [];
preg_match_all("/\[VARIABLE[0-9]*\]/", $this->_query, $matches, PREG_SET_ORDER);
preg_match_all('/\[VARIABLE[0-9]*\]/', $this->_query, $matches, PREG_SET_ORDER);
return count($matches);
}
@ -314,14 +314,14 @@ class Bookmark
return [];
}
$query = "SELECT * FROM " . Util::backquote($cfgBookmark['db'])
. "." . Util::backquote($cfgBookmark['table'])
$query = 'SELECT * FROM ' . Util::backquote($cfgBookmark['db'])
. '.' . Util::backquote($cfgBookmark['table'])
. " WHERE ( `user` = ''"
. " OR `user` = '" . $dbi->escapeString($cfgBookmark['user']) . "' )";
if ($db !== false) {
$query .= " AND dbase = '" . $dbi->escapeString($db) . "'";
}
$query .= " ORDER BY label ASC";
$query .= ' ORDER BY label ASC';
$result = $dbi->fetchResult(
$query,
@ -374,8 +374,8 @@ class Bookmark
return null;
}
$query = "SELECT * FROM " . Util::backquote($cfgBookmark['db'])
. "." . Util::backquote($cfgBookmark['table'])
$query = 'SELECT * FROM ' . Util::backquote($cfgBookmark['db'])
. '.' . Util::backquote($cfgBookmark['table'])
. " WHERE dbase = '" . $dbi->escapeString($db) . "'";
if (! $action_bookmark_all) {
$query .= " AND (user = '"
@ -383,9 +383,9 @@ class Bookmark
if (! $exact_user_match) {
$query .= " OR user = ''";
}
$query .= ")";
$query .= ')';
}
$query .= " AND " . Util::backquote($id_field)
$query .= ' AND ' . Util::backquote($id_field)
. " = '" . $dbi->escapeString((string) $id) . "' LIMIT 1";
$result = $dbi->fetchSingleRow($query, 'ASSOC', DatabaseInterface::CONNECT_CONTROL);

View File

@ -264,9 +264,9 @@ class CentralColumns
string $db,
string $central_list_table
): string {
$type = "";
$type = '';
$length = 0;
$attribute = "";
$attribute = '';
if (isset($def['Type'])) {
$extracted_columnspec = Util::extractColumnSpec($def['Type']);
$attribute = trim($extracted_columnspec['attribute']);
@ -276,10 +276,10 @@ class CentralColumns
if (isset($def['Attribute'])) {
$attribute = $def['Attribute'];
}
$collation = isset($def['Collation']) ? $def['Collation'] : "";
$isNull = $def['Null'] == "NO" ? '0' : '1';
$extra = isset($def['Extra']) ? $def['Extra'] : "";
$default = isset($def['Default']) ? $def['Default'] : "";
$collation = isset($def['Collation']) ? $def['Collation'] : '';
$isNull = $def['Null'] == 'NO' ? '0' : '1';
$extra = isset($def['Extra']) ? $def['Extra'] : '';
$default = isset($def['Default']) ? $def['Default'] : '';
return 'INSERT INTO '
. Util::backquote($central_list_table) . ' '
. 'VALUES ( \'' . $this->dbi->escapeString($db) . '\' ,'
@ -319,7 +319,7 @@ class CentralColumns
$central_list_table = $cfgCentralColumns['table'];
$this->dbi->selectDb($db);
$existingCols = [];
$cols = "";
$cols = '';
$insQuery = [];
$fields = [];
$message = true;
@ -381,7 +381,7 @@ class CentralColumns
}
}
if (! empty($existingCols)) {
$existingCols = implode(",", array_unique($existingCols));
$existingCols = implode(',', array_unique($existingCols));
$message = Message::notice(
sprintf(
__(
@ -392,8 +392,8 @@ class CentralColumns
);
$message->addMessage(
Message::notice(
"Please remove them first "
. "from central list if you want to update above columns"
'Please remove them first '
. 'from central list if you want to update above columns'
)
);
}
@ -475,7 +475,7 @@ class CentralColumns
}
}
if (! empty($colNotExist)) {
$colNotExist = implode(",", array_unique($colNotExist));
$colNotExist = implode(',', array_unique($colNotExist));
$message = Message::notice(
sprintf(
__(
@ -559,7 +559,7 @@ class CentralColumns
$query .= ',';
}
}
$query = trim($query, " ,") . ";";
$query = trim($query, ' ,') . ';';
if (! $this->dbi->tryQuery($query)) {
if ($message === true) {
$message = Message::error(
@ -648,7 +648,7 @@ class CentralColumns
}
$centralTable = $cfgCentralColumns['table'];
$this->dbi->selectDb($cfgCentralColumns['db'], DatabaseInterface::CONNECT_CONTROL);
if ($orig_col_name == "") {
if ($orig_col_name == '') {
$def = [];
$def['Type'] = $col_type;
if ($col_length) {
@ -1098,7 +1098,7 @@ class CentralColumns
$db,
$selected_tbl
);
$selectColHtml = "";
$selectColHtml = '';
foreach ($columns as $column) {
if (! in_array($column, $existing_cols)) {
$selectColHtml .= '<option value="' . htmlspecialchars($column) . '">'
@ -1187,20 +1187,20 @@ class CentralColumns
}
return $this->template->render('database/central_columns/main', [
"db" => $db,
"total_rows" => $total_rows,
"max_rows" => $max_rows,
"pos" => $pos,
"char_editing" => $this->charEditing,
"attribute_types" => $attribute_types,
"tn_nbTotalPage" => $tn_nbTotalPage,
"tn_page_selector" => $tn_page_selector,
"tables" => $tables,
"rows_list" => $rows_list,
"rows_meta" => $rows_meta,
"types_upper" => $types_upper,
"pmaThemeImage" => $pmaThemeImage,
"text_dir" => $text_dir,
'db' => $db,
'total_rows' => $total_rows,
'max_rows' => $max_rows,
'pos' => $pos,
'char_editing' => $this->charEditing,
'attribute_types' => $attribute_types,
'tn_nbTotalPage' => $tn_nbTotalPage,
'tn_page_selector' => $tn_page_selector,
'tables' => $tables,
'rows_list' => $rows_list,
'rows_meta' => $rows_meta,
'types_upper' => $types_upper,
'pmaThemeImage' => $pmaThemeImage,
'text_dir' => $text_dir,
'charsets' => $charsetsList,
]);
}

View File

@ -129,19 +129,19 @@ class CheckUserPrivileges
// Ex. '... ALL PRIVILEGES on `mysql`.`columns_priv` .. '
if ($show_grants_dbname == 'mysql') {
switch ($show_grants_tblname) {
case "columns_priv":
case 'columns_priv':
$GLOBALS['col_priv'] = true;
break;
case "db":
case 'db':
$GLOBALS['db_priv'] = true;
break;
case "procs_priv":
case 'procs_priv':
$GLOBALS['proc_priv'] = true;
break;
case "tables_priv":
case 'tables_priv':
$GLOBALS['table_priv'] = true;
break;
case "*":
case '*':
$GLOBALS['col_priv'] = true;
$GLOBALS['db_priv'] = true;
$GLOBALS['proc_priv'] = true;

View File

@ -305,7 +305,7 @@ class Config
if (function_exists('gd_info')) {
$gd_nfo = gd_info();
if (mb_strstr($gd_nfo["GD Version"], '2.')) {
if (mb_strstr($gd_nfo['GD Version'], '2.')) {
$this->set('PMA_IS_GD2', 1);
} else {
$this->set('PMA_IS_GD2', 0);
@ -573,7 +573,7 @@ class Config
}
// parse fanout table
$fanout = unpack(
"N*",
'N*',
substr($index_data, 8, 256 * 4)
);
@ -1283,7 +1283,7 @@ class Config
public function checkUploadSize(): void
{
if (! $filesize = ini_get('upload_max_filesize')) {
$filesize = "5M";
$filesize = '5M';
}
if ($postsize = ini_get('post_max_size')) {

View File

@ -414,21 +414,21 @@ class ConfigFile
$path = 'Servers/' . $server;
$dsn = 'mysqli://';
if ($this->getValue("$path/auth_type") == 'config') {
$dsn .= $this->getValue("$path/user");
if (! empty($this->getValue("$path/password"))) {
if ($this->getValue($path . '/auth_type') == 'config') {
$dsn .= $this->getValue($path . '/user');
if (! empty($this->getValue($path . '/password'))) {
$dsn .= ':***';
}
$dsn .= '@';
}
if ($this->getValue("$path/host") != 'localhost') {
$dsn .= $this->getValue("$path/host");
$port = $this->getValue("$path/port");
if ($this->getValue($path . '/host') != 'localhost') {
$dsn .= $this->getValue($path . '/host');
$port = $this->getValue($path . '/port');
if ($port) {
$dsn .= ':' . $port;
}
} else {
$dsn .= $this->getValue("$path/socket");
$dsn .= $this->getValue($path . '/socket');
}
return $dsn;
}
@ -445,11 +445,11 @@ class ConfigFile
if (! isset($_SESSION[$this->_id]['Servers'][$id])) {
return '';
}
$verbose = $this->get("Servers/$id/verbose");
$verbose = $this->get('Servers/' . $id . '/verbose');
if (! empty($verbose)) {
return $verbose;
}
$host = $this->get("Servers/$id/host");
$host = $this->get('Servers/' . $id . '/host');
return empty($host) ? 'localhost' : $host;
}

View File

@ -105,11 +105,11 @@ class Form
{
$value = $this->_configFile->getDbEntry($optionPath);
if ($value === null) {
trigger_error("$optionPath - select options not defined", E_USER_ERROR);
trigger_error($optionPath . ' - select options not defined', E_USER_ERROR);
return [];
}
if (! is_array($value)) {
trigger_error("$optionPath - not a static value list", E_USER_ERROR);
trigger_error($optionPath . ' - not a static value list', E_USER_ERROR);
return [];
}
// convert array('#', 'a', 'b') to array('a', 'b')

View File

@ -141,7 +141,7 @@ class FormDisplay
foreach ($this->_forms[$formName]->fields as $path) {
$workPath = $serverId === null
? $path
: str_replace('Servers/1/', "Servers/$serverId/", $path);
: str_replace('Servers/1/', 'Servers/' . $serverId . '/', $path);
$this->_systemPaths[$workPath] = $path;
$this->_translatedPaths[$workPath] = str_replace('/', '-', $workPath);
}
@ -243,8 +243,8 @@ class FormDisplay
$formErrors = isset($this->_errors[$form->name])
? $this->_errors[$form->name] : null;
$htmlOutput .= $this->formDisplayTemplate->displayFieldsetTop(
Descriptions::get("Form_{$form->name}"),
Descriptions::get("Form_{$form->name}", 'desc'),
Descriptions::get('Form_' . $form->name),
Descriptions::get('Form_' . $form->name, 'desc'),
$formErrors,
['id' => $form->name]
);
@ -310,7 +310,7 @@ class FormDisplay
if ($tabbedForm) {
$tabs = [];
foreach ($this->_forms as $form) {
$tabs[$form->name] = Descriptions::get("Form_$form->name");
$tabs[$form->name] = Descriptions::get('Form_' . $form->name);
}
$htmlOutput .= $this->formDisplayTemplate->displayTabsTop($tabs);
}
@ -349,7 +349,7 @@ class FormDisplay
$jsLangSent = true;
$jsLang = [];
foreach ($this->_jsLangStrings as $strName => $strValue) {
$jsLang[] = "'$strName': '" . Sanitize::jsFormat($strValue, false) . '\'';
$jsLang[] = "'" . $strName . "': '" . Sanitize::jsFormat($strValue, false) . '\'';
}
$js[] = "$.extend(Messages, {\n\t"
. implode(",\n\t", $jsLang) . '})';
@ -452,7 +452,7 @@ class FormDisplay
}
return $htmlOutput;
case 'NULL':
trigger_error("Field $systemPath has no type", E_USER_WARNING);
trigger_error('Field ' . $systemPath . ' has no type', E_USER_WARNING);
return null;
}
@ -707,8 +707,8 @@ class FormDisplay
$values[$systemPath] = $_POST[$key];
if ($changeIndex !== false) {
$workPath = str_replace(
"Servers/$form->index/",
"Servers/$changeIndex/",
'Servers/' . $form->index . '/',
'Servers/' . $changeIndex . '/',
$workPath
);
}
@ -731,7 +731,7 @@ class FormDisplay
foreach ($values[$path] as $value) {
$matches = [];
$match = preg_match(
"/^(.+):(?:[ ]?)(\\w+)$/",
'/^(.+):(?:[ ]?)(\\w+)$/',
$value,
$matches
);
@ -741,7 +741,7 @@ class FormDisplay
$proxies[$ip] = trim($matches[2]);
} else {
// save also incorrect values
$proxies["-$i"] = $value;
$proxies['-' . $i] = $value;
$i++;
}
}
@ -846,7 +846,7 @@ class FormDisplay
}
if (! function_exists('recode_string')) {
$opts['values']['recode'] .= ' (' . __('unavailable') . ')';
$comment .= ($comment ? ", " : '') . sprintf(
$comment .= ($comment ? ', ' : '') . sprintf(
__('"%s" requires %s extension'),
'recode',
'recode'

View File

@ -223,7 +223,7 @@ class FormDisplayTemplate
$icons[$k] = sprintf(
'<img alt="%s" src="%s"%s>',
$v[1],
"../themes/pmahomme/img/{$v[0]}.png",
'../themes/pmahomme/img/' . $v[0] . '.png',
$title
);
}
@ -279,7 +279,7 @@ class FormDisplayTemplate
$htmlOutput .= __(
'This setting is disabled, it will not be applied to your configuration.'
);
$htmlOutput .= '">' . __('Disabled') . "</span>";
$htmlOutput .= '">' . __('Disabled') . '</span>';
}
if (! empty($description)) {
@ -371,7 +371,7 @@ class FormDisplayTemplate
}
if (isset($opts['setvalue']) && $opts['setvalue']) {
$htmlOutput .= '<a class="set-value hide" href="#'
. htmlspecialchars("$path={$opts['setvalue']}") . '" title="'
. htmlspecialchars($path . '=' . $opts['setvalue']) . '" title="'
. sprintf(__('Set value: %s'), htmlspecialchars($opts['setvalue']))
. '">' . $icons['edit'] . '</a>';
}
@ -491,7 +491,7 @@ class FormDisplayTemplate
$vArgs[] = Sanitize::escapeJsString($arg);
}
$vArgs = $vArgs ? ", ['" . implode("', '", $vArgs) . "']" : '';
$jsArray[] = "registerFieldValidator('$fieldId', '$vName', true$vArgs)";
$jsArray[] = "registerFieldValidator('" . $fieldId . "', '" . $vName . "', true" . $vArgs . ')';
}
}

View File

@ -148,7 +148,7 @@ class ServerConfigChecks
$serverCnt = $this->cfg->getServerCount();
for ($i = 1; $i <= $serverCnt; $i++) {
$cookieAuthServer
= ($this->cfg->getValue("Servers/$i/auth_type") == 'cookie');
= ($this->cfg->getValue('Servers/' . $i . '/auth_type') == 'cookie');
$cookieAuthUsed |= $cookieAuthServer;
$serverName = $this->performConfigChecksServersGetServerName(
$this->cfg->getServerName($i),
@ -167,11 +167,11 @@ class ServerConfigChecks
// $cfg['Servers'][$i]['ssl']
// should be enabled if possible
//
if (! $this->cfg->getValue("Servers/$i/ssl")) {
$title = Descriptions::get('Servers/1/ssl') . " ($serverName)";
if (! $this->cfg->getValue('Servers/' . $i . '/ssl')) {
$title = Descriptions::get('Servers/1/ssl') . ' (' . $serverName . ')';
SetupIndex::messagesSet(
'notice',
"Servers/$i/ssl",
'Servers/' . $i . '/ssl',
$title,
__(
'You should use SSL connections if your database server '
@ -196,15 +196,15 @@ class ServerConfigChecks
// $cfg['Servers'][$i]['auth_type']
// warn about full user credentials if 'auth_type' is 'config'
//
if ($this->cfg->getValue("Servers/$i/auth_type") == 'config'
&& $this->cfg->getValue("Servers/$i/user") != ''
&& $this->cfg->getValue("Servers/$i/password") != ''
if ($this->cfg->getValue('Servers/' . $i . '/auth_type') == 'config'
&& $this->cfg->getValue('Servers/' . $i . '/user') != ''
&& $this->cfg->getValue('Servers/' . $i . '/password') != ''
) {
$title = Descriptions::get('Servers/1/auth_type')
. " ($serverName)";
. ' (' . $serverName . ')';
SetupIndex::messagesSet(
'notice',
"Servers/$i/auth_type",
'Servers/' . $i . '/auth_type',
$title,
Sanitize::sanitizeMessage(sprintf(
__(
@ -226,14 +226,14 @@ class ServerConfigChecks
// $cfg['Servers'][$i]['AllowNoPassword']
// serious security flaw
//
if ($this->cfg->getValue("Servers/$i/AllowRoot")
&& $this->cfg->getValue("Servers/$i/AllowNoPassword")
if ($this->cfg->getValue('Servers/' . $i . '/AllowRoot')
&& $this->cfg->getValue('Servers/' . $i . '/AllowNoPassword')
) {
$title = Descriptions::get('Servers/1/AllowNoPassword')
. " ($serverName)";
. ' (' . $serverName . ')';
SetupIndex::messagesSet(
'notice',
"Servers/$i/AllowNoPassword",
'Servers/' . $i . '/AllowNoPassword',
$title,
__('You allow for connecting to the server without a password.')
. ' ' . $sSecurityInfoMsg
@ -284,7 +284,7 @@ class ServerConfigChecks
$serverId
) {
if ($serverName == 'localhost') {
$serverName .= " [$serverId]";
$serverName .= ' [' . $serverId . ']';
return $serverName;
}
return $serverName;

View File

@ -431,7 +431,7 @@ class Validator
$line = trim($line);
$matches = [];
// we catch anything that may (or may not) be an IP
if (! preg_match("/^(.+):(?:[ ]?)\\w+$/", $line, $matches)) {
if (! preg_match('/^(.+):(?:[ ]?)\\w+$/', $line, $matches)) {
$result[$path][] = __('Incorrect value:') . ' '
. htmlspecialchars($line);
continue;

View File

@ -109,7 +109,7 @@ class QueryByExampleController extends AbstractController
*/
$message_to_display = false;
if (isset($_POST['submit_sql']) && ! empty($sql_query)) {
if (0 !== stripos($sql_query, "SELECT")) {
if (0 !== stripos($sql_query, 'SELECT')) {
$message_to_display = true;
} else {
$goto = Url::getFromRoute('/database/sql');

View File

@ -253,7 +253,7 @@ class StructureController extends AbstractController
$json['changes'] = $changes;
if (! $changes) {
$json['message'] = $this->template->render('components/error_message', [
'msg' => __("Favorite List is full!"),
'msg' => __('Favorite List is full!'),
]);
return $json;
}
@ -270,7 +270,7 @@ class StructureController extends AbstractController
$json['list'] = $favoriteInstance->getHtmlList();
$json['anchor'] = $this->template->render('database/structure/favorite_anchor', [
'table_name_hash' => md5($favoriteTable),
'db_table_name_hash' => md5($this->db . "." . $favoriteTable),
'db_table_name_hash' => md5($this->db . '.' . $favoriteTable),
'fav_params' => $favoriteParams,
'already_favorite' => $alreadyFavorite,
'titles' => $titles,

View File

@ -95,13 +95,13 @@ class ErrorReportController extends AbstractController
} else {
$decoded_response = json_decode($server_response, true);
$success = ! empty($decoded_response) ?
$decoded_response["success"] : false;
$decoded_response['success'] : false;
}
/* Message to show to the user */
if ($success) {
if ((isset($_POST['automatic'])
&& $_POST['automatic'] === "true")
&& $_POST['automatic'] === 'true')
|| $cfg['SendErrorReports'] == 'always'
) {
$msg = __(
@ -152,10 +152,10 @@ class ErrorReportController extends AbstractController
/* Persist always send settings */
if (isset($_POST['always_send'])
&& $_POST['always_send'] === "true"
&& $_POST['always_send'] === 'true'
) {
$userPreferences = new UserPreferences();
$userPreferences->persistOption("SendErrorReports", "always", "ask");
$userPreferences->persistOption('SendErrorReports', 'always', 'ask');
}
}
} elseif (! empty($_POST['get_settings'])) {

View File

@ -56,7 +56,7 @@ class GisDataEditorController extends AbstractController
$gis_data['gis_type'] = mb_substr(
$_POST['value'],
$start,
mb_strpos($_POST['value'], "(") - $start
mb_strpos($_POST['value'], '(') - $start
);
}
if (! isset($gis_data['gis_type'])

View File

@ -357,14 +357,14 @@ class DatabasesController extends AbstractController
foreach ($replicationTypes as $type) {
if ($replication_info[$type]['status']) {
$key = array_search(
$database["SCHEMA_NAME"],
$database['SCHEMA_NAME'],
$replication_info[$type]['Ignore_DB']
);
if (strlen((string) $key) > 0) {
$replication[$type]['is_replicated'] = false;
} else {
$key = array_search(
$database["SCHEMA_NAME"],
$database['SCHEMA_NAME'],
$replication_info[$type]['Do_DB']
);

View File

@ -123,7 +123,7 @@ class VariablesController extends AbstractController
Util::formatByteDown($varValue[1], 3, 3)
);
} else {
throw new KBException("Not a type=byte");
throw new KBException('Not a type=byte');
}
} catch (KBException $e) {
$json['message'] = $varValue[1];
@ -167,7 +167,7 @@ class VariablesController extends AbstractController
$exp[mb_strtolower($matches[3])]
);
} else {
throw new KBException("Not a type=byte or regex not matching");
throw new KBException('Not a type=byte or regex not matching');
}
} catch (KBException $e) {
$value = $this->dbi->escapeString($value);
@ -178,7 +178,7 @@ class VariablesController extends AbstractController
}
$json = [];
if (! preg_match("/[^a-zA-Z0-9_]+/", $params['varName'])
if (! preg_match('/[^a-zA-Z0-9_]+/', $params['varName'])
&& $this->dbi->query(
'SET GLOBAL ' . $params['varName'] . ' = ' . $value
)
@ -236,7 +236,7 @@ class VariablesController extends AbstractController
)
);
} else {
throw new KBException("Not a type=byte or regex not matching");
throw new KBException('Not a type=byte or regex not matching');
}
} catch (KBException $e) {
$formattedValue = Util::formatNumber($value, 0);

View File

@ -137,7 +137,7 @@ class HomeController extends AbstractController
$servers[$id] = [
'id' => $id,
'name' => $this->config->getServerName($id),
'auth_type' => $this->config->getValue("Servers/$id/auth_type"),
'auth_type' => $this->config->getValue('Servers/' . $id . '/auth_type'),
'dsn' => $this->config->getServerDSN($id),
'params' => [
'token' => $_SESSION[' PMA_token '],
@ -153,7 +153,7 @@ class HomeController extends AbstractController
],
],
];
$serverDefaultOptions['values'][(string) $id] = $this->config->getServerName($id) . " [$id]";
$serverDefaultOptions['values'][(string) $id] = $this->config->getServerName($id) . ' [' . $id . ']';
}
} else {
$serverDefaultOptions['values']['1'] = __('- none -');

View File

@ -27,7 +27,7 @@ class ServersController extends AbstractController
$pages = $this->getPages();
$id = Core::isValid($params['id'], 'numeric') ? (int) $params['id'] : null;
$hasServer = ! empty($id) && $this->config->get("Servers/$id") !== null;
$hasServer = ! empty($id) && $this->config->get('Servers/' . $id) !== null;
if (! $hasServer && ($params['mode'] !== 'revert' && $params['mode'] !== 'edit')) {
$id = 0;
@ -56,7 +56,7 @@ class ServersController extends AbstractController
{
$id = Core::isValid($params['id'], 'numeric') ? (int) $params['id'] : null;
$hasServer = ! empty($id) && $this->config->get("Servers/$id") !== null;
$hasServer = ! empty($id) && $this->config->get('Servers/' . $id) !== null;
if ($hasServer) {
$this->config->removeServer($id);

View File

@ -124,7 +124,7 @@ class SearchController extends AbstractController
// Loads table's information
$this->_loadTableInfo();
$this->_connectionCharSet = $this->dbi->fetchValue(
"SELECT @@character_set_connection"
'SELECT @@character_set_connection'
);
}
@ -164,10 +164,10 @@ class SearchController extends AbstractController
// strip the "BINARY" attribute, except if we find "BINARY(" because
// this would be a BINARY or VARBINARY column type
if (! preg_match('@BINARY[\(]@i', $type)) {
$type = str_ireplace("BINARY", '', $type);
$type = str_ireplace('BINARY', '', $type);
}
$type = str_ireplace("ZEROFILL", '', $type);
$type = str_ireplace("UNSIGNED", '', $type);
$type = str_ireplace('ZEROFILL', '', $type);
$type = str_ireplace('UNSIGNED', '', $type);
$type = mb_strtolower($type);
}
if (empty($type)) {
@ -336,7 +336,7 @@ class SearchController extends AbstractController
//Query execution part
$result = $this->dbi->query(
$sql_query . ";",
$sql_query . ';',
DatabaseInterface::CONNECT_USER,
DatabaseInterface::QUERY_STORE
);
@ -447,7 +447,7 @@ class SearchController extends AbstractController
$row_info_query = 'SELECT * FROM `' . $_POST['db'] . '`.`'
. $_POST['table'] . '` WHERE ' . $_POST['where_clause'];
$result = $this->dbi->query(
$row_info_query . ";",
$row_info_query . ';',
DatabaseInterface::CONNECT_USER,
DatabaseInterface::QUERY_STORE
);
@ -665,22 +665,22 @@ class SearchController extends AbstractController
$charSet
);
} else {
$sql_query = "SELECT "
. Util::backquote($column) . ","
. " REPLACE("
$sql_query = 'SELECT '
. Util::backquote($column) . ','
. ' REPLACE('
. Util::backquote($column) . ", '" . $find . "', '"
. $replaceWith
. "'),"
. " COUNT(*)"
. " FROM " . Util::backquote($this->db)
. "." . Util::backquote($this->table)
. " WHERE " . Util::backquote($column)
. " LIKE '%" . $find . "%' COLLATE " . $charSet . "_bin"; // here we
. ' COUNT(*)'
. ' FROM ' . Util::backquote($this->db)
. '.' . Util::backquote($this->table)
. ' WHERE ' . Util::backquote($column)
. " LIKE '%" . $find . "%' COLLATE " . $charSet . '_bin'; // here we
// change the collation of the 2nd operand to a case sensitive
// binary collation to make sure that the comparison
// is case sensitive
$sql_query .= " GROUP BY " . Util::backquote($column)
. " ORDER BY " . Util::backquote($column) . " ASC";
$sql_query .= ' GROUP BY ' . Util::backquote($column)
. ' ORDER BY ' . Util::backquote($column) . ' ASC';
$result = $this->dbi->fetchResult($sql_query, 0);
}
@ -713,19 +713,19 @@ class SearchController extends AbstractController
$charSet
) {
$column = $this->_columnNames[$columnIndex];
$sql_query = "SELECT "
. Util::backquote($column) . ","
. " 1," // to add an extra column that will have replaced value
. " COUNT(*)"
. " FROM " . Util::backquote($this->db)
. "." . Util::backquote($this->table)
. " WHERE " . Util::backquote($column)
$sql_query = 'SELECT '
. Util::backquote($column) . ','
. ' 1,' // to add an extra column that will have replaced value
. ' COUNT(*)'
. ' FROM ' . Util::backquote($this->db)
. '.' . Util::backquote($this->table)
. ' WHERE ' . Util::backquote($column)
. " RLIKE '" . $this->dbi->escapeString($find) . "' COLLATE "
. $charSet . "_bin"; // here we
. $charSet . '_bin'; // here we
// change the collation of the 2nd operand to a case sensitive
// binary collation to make sure that the comparison is case sensitive
$sql_query .= " GROUP BY " . Util::backquote($column)
. " ORDER BY " . Util::backquote($column) . " ASC";
$sql_query .= ' GROUP BY ' . Util::backquote($column)
. ' ORDER BY ' . Util::backquote($column) . ' ASC';
$result = $this->dbi->fetchResult($sql_query, 0);
@ -791,8 +791,8 @@ class SearchController extends AbstractController
$replaceWith,
$charSet
);
$sql_query = "UPDATE " . Util::backquote($this->table)
. " SET " . Util::backquote($column) . " = CASE";
$sql_query = 'UPDATE ' . Util::backquote($this->table)
. ' SET ' . Util::backquote($column) . ' = CASE';
if (is_array($toReplace)) {
foreach ($toReplace as $row) {
$sql_query .= "\n WHEN " . Util::backquote($column)
@ -800,22 +800,22 @@ class SearchController extends AbstractController
. "' THEN '" . $this->dbi->escapeString($row[1]) . "'";
}
}
$sql_query .= " END"
. " WHERE " . Util::backquote($column)
$sql_query .= ' END'
. ' WHERE ' . Util::backquote($column)
. " RLIKE '" . $this->dbi->escapeString($find) . "' COLLATE "
. $charSet . "_bin"; // here we
. $charSet . '_bin'; // here we
// change the collation of the 2nd operand to a case sensitive
// binary collation to make sure that the comparison
// is case sensitive
} else {
$sql_query = "UPDATE " . Util::backquote($this->table)
. " SET " . Util::backquote($column) . " ="
. " REPLACE("
$sql_query = 'UPDATE ' . Util::backquote($this->table)
. ' SET ' . Util::backquote($column) . ' ='
. ' REPLACE('
. Util::backquote($column) . ", '" . $find . "', '"
. $replaceWith
. "')"
. " WHERE " . Util::backquote($column)
. " LIKE '%" . $find . "%' COLLATE " . $charSet . "_bin"; // here we
. ' WHERE ' . Util::backquote($column)
. " LIKE '%" . $find . "%' COLLATE " . $charSet . '_bin'; // here we
// change the collation of the 2nd operand to a case sensitive
// binary collation to make sure that the comparison
// is case sensitive
@ -1101,8 +1101,8 @@ class SearchController extends AbstractController
$geom_funcs = Util::getGISFunctions($types, true, false);
// If the function takes multiple parameters
if (strpos($func_type, "IS NULL") !== false || strpos($func_type, "IS NOT NULL") !== false) {
return Util::backquote($names) . " " . $func_type;
if (strpos($func_type, 'IS NULL') !== false || strpos($func_type, 'IS NOT NULL') !== false) {
return Util::backquote($names) . ' ' . $func_type;
} elseif ($geom_funcs[$geom_func]['params'] > 1) {
// create gis data from the criteria input
$gis_data = Util::createGISData($criteriaValues, $this->dbi->getVersion());
@ -1125,9 +1125,9 @@ class SearchController extends AbstractController
) {
// create gis data from the criteria input
$gis_data = Util::createGISData($criteriaValues, $this->dbi->getVersion());
$where = $geom_function_applied . " " . $func_type . " " . $gis_data;
$where = $geom_function_applied . ' ' . $func_type . ' ' . $gis_data;
} elseif (strlen($criteriaValues) > 0) {
$where = $geom_function_applied . " "
$where = $geom_function_applied . ' '
. $func_type . " '" . $criteriaValues . "'";
}
return $where;

View File

@ -626,8 +626,8 @@ class StructureController extends AbstractController
$partitionDetails['partition_count'] = '';
if (! empty($stmt->partitionBy)) {
$openPos = strpos($stmt->partitionBy, "(");
$closePos = strrpos($stmt->partitionBy, ")");
$openPos = strpos($stmt->partitionBy, '(');
$closePos = strrpos($stmt->partitionBy, ')');
$partitionDetails['partition_by']
= trim(substr($stmt->partitionBy, 0, $openPos));
@ -646,8 +646,8 @@ class StructureController extends AbstractController
$partitionDetails['subpartition_count'] = '';
if (! empty($stmt->subpartitionBy)) {
$openPos = strpos($stmt->subpartitionBy, "(");
$closePos = strrpos($stmt->subpartitionBy, ")");
$openPos = strpos($stmt->subpartitionBy, '(');
$closePos = strrpos($stmt->subpartitionBy, ')');
$partitionDetails['subpartition_by']
= trim(substr($stmt->subpartitionBy, 0, $openPos));
@ -768,7 +768,7 @@ class StructureController extends AbstractController
*/
protected function updatePartitioning()
{
$sql_query = "ALTER TABLE " . Util::backquote($this->table) . " "
$sql_query = 'ALTER TABLE ' . Util::backquote($this->table) . ' '
. $this->createAddField->getPartitionsDefinition();
// Execute alter query
@ -1176,7 +1176,7 @@ class StructureController extends AbstractController
if ($changed) {
// Finally FLUSH the new privileges
$this->dbi->query("FLUSH PRIVILEGES;");
$this->dbi->query('FLUSH PRIVILEGES;');
}
}
@ -1322,7 +1322,7 @@ class StructureController extends AbstractController
$displayed_fields[$rownum] = new stdClass();
$displayed_fields[$rownum]->text = $field['Field'];
$displayed_fields[$rownum]->icon = "";
$displayed_fields[$rownum]->icon = '';
$row_comments[$rownum] = '';
if (isset($comments_map[$field['Field']])) {

View File

@ -715,8 +715,8 @@ class Core
$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(["url" => $vars["url"]]);
parse_str($arr['query'], $vars);
$query = http_build_query(['url' => $vars['url']]);
if ($GLOBALS['PMA_Config'] !== null && $GLOBALS['PMA_Config']->get('is_setup')) {
$url = '../url.php?' . $query;
@ -754,7 +754,7 @@ class Core
return false;
}
}
$domain = $arr["host"];
$domain = $arr['host'];
$domainWhiteList = [
/* Include current domain */
$_SERVER['SERVER_NAME'],
@ -1214,7 +1214,7 @@ class Core
public static function checkRequest(): void
{
if (isset($_REQUEST['GLOBALS']) || isset($_FILES['GLOBALS'])) {
self::fatalError(__("GLOBALS overwrite attempt"));
self::fatalError(__('GLOBALS overwrite attempt'));
}
/**

View File

@ -201,7 +201,7 @@ class CreateAddField
$keyBlockSizes = $index['Key_block_size'];
if (! empty($keyBlockSizes)) {
$sqlQuery .= " KEY_BLOCK_SIZE = "
$sqlQuery .= ' KEY_BLOCK_SIZE = '
. $this->dbi->escapeString($keyBlockSizes);
}
@ -216,7 +216,7 @@ class CreateAddField
$parser = $index['Parser'];
if ($index['Index_choice'] == 'FULLTEXT' && ! empty($parser)) {
$sqlQuery .= " WITH PARSER " . $this->dbi->escapeString($parser);
$sqlQuery .= ' WITH PARSER ' . $this->dbi->escapeString($parser);
}
$comment = $index['Index_comment'];
@ -240,7 +240,7 @@ class CreateAddField
*/
private function getStatementPrefix(bool $isCreateTable = true): string
{
$sqlPrefix = " ";
$sqlPrefix = ' ';
if (! $isCreateTable) {
$sqlPrefix = ' ADD ';
}
@ -267,7 +267,7 @@ class CreateAddField
foreach ($indexedColumns as $index) {
$statements = $this->buildIndexStatements(
$index,
" " . $indexKeyword . " ",
' ' . $indexKeyword . ' ',
$isCreateTable
);
$definitions = array_merge($definitions, $statements);
@ -286,7 +286,7 @@ class CreateAddField
*/
private function getColumnCreationStatements(bool $isCreateTable = true): string
{
$sqlStatement = "";
$sqlStatement = '';
[
$fieldCount,
$fieldPrimary,
@ -303,7 +303,7 @@ class CreateAddField
// Builds the PRIMARY KEY statements
$primaryKeyStatements = $this->buildIndexStatements(
isset($fieldPrimary[0]) ? $fieldPrimary[0] : [],
" PRIMARY KEY ",
' PRIMARY KEY ',
$isCreateTable
);
$definitions = array_merge($definitions, $primaryKeyStatements);
@ -313,7 +313,7 @@ class CreateAddField
$definitions,
$isCreateTable,
$fieldIndex,
"INDEX"
'INDEX'
);
// Builds the UNIQUE statements
@ -321,7 +321,7 @@ class CreateAddField
$definitions,
$isCreateTable,
$fieldUnique,
"UNIQUE"
'UNIQUE'
);
// Builds the FULLTEXT statements
@ -329,7 +329,7 @@ class CreateAddField
$definitions,
$isCreateTable,
$fieldFullText,
"FULLTEXT"
'FULLTEXT'
);
// Builds the SPATIAL statements
@ -337,7 +337,7 @@ class CreateAddField
$definitions,
$isCreateTable,
$fieldSpatial,
"SPATIAL"
'SPATIAL'
);
if (count($definitions)) {
@ -353,15 +353,15 @@ class CreateAddField
*/
public function getPartitionsDefinition(): string
{
$sqlQuery = "";
$sqlQuery = '';
if (! empty($_POST['partition_by'])
&& ! empty($_POST['partition_expr'])
&& ! empty($_POST['partition_count'])
&& $_POST['partition_count'] > 1
) {
$sqlQuery .= " PARTITION BY " . $_POST['partition_by']
. " (" . $_POST['partition_expr'] . ")"
. " PARTITIONS " . $_POST['partition_count'];
$sqlQuery .= ' PARTITION BY ' . $_POST['partition_by']
. ' (' . $_POST['partition_expr'] . ')'
. ' PARTITIONS ' . $_POST['partition_count'];
}
if (! empty($_POST['subpartition_by'])
@ -369,9 +369,9 @@ class CreateAddField
&& ! empty($_POST['subpartition_count'])
&& $_POST['subpartition_count'] > 1
) {
$sqlQuery .= " SUBPARTITION BY " . $_POST['subpartition_by']
. " (" . $_POST['subpartition_expr'] . ")"
. " SUBPARTITIONS " . $_POST['subpartition_count'];
$sqlQuery .= ' SUBPARTITION BY ' . $_POST['subpartition_by']
. ' (' . $_POST['subpartition_expr'] . ')'
. ' SUBPARTITIONS ' . $_POST['subpartition_count'];
}
if (! empty($_POST['partitions'])) {
@ -379,7 +379,7 @@ class CreateAddField
foreach ($_POST['partitions'] as $partition) {
$partitions[] = $this->getPartitionDefinition($partition);
}
$sqlQuery .= " (" . implode(", ", $partitions) . ")";
$sqlQuery .= ' (' . implode(', ', $partitions) . ')';
}
return $sqlQuery;
@ -397,19 +397,19 @@ class CreateAddField
array $partition,
bool $isSubPartition = false
): string {
$sqlQuery = " " . ($isSubPartition ? "SUB" : "") . "PARTITION ";
$sqlQuery = ' ' . ($isSubPartition ? 'SUB' : '') . 'PARTITION ';
$sqlQuery .= $partition['name'];
if (! empty($partition['value_type'])) {
$sqlQuery .= " VALUES " . $partition['value_type'];
$sqlQuery .= ' VALUES ' . $partition['value_type'];
if ($partition['value_type'] != 'LESS THAN MAXVALUE') {
$sqlQuery .= " (" . $partition['value'] . ")";
$sqlQuery .= ' (' . $partition['value'] . ')';
}
}
if (! empty($partition['engine'])) {
$sqlQuery .= " ENGINE = " . $partition['engine'];
$sqlQuery .= ' ENGINE = ' . $partition['engine'];
}
if (! empty($partition['comment'])) {
$sqlQuery .= " COMMENT = '" . $partition['comment'] . "'";
@ -421,16 +421,16 @@ class CreateAddField
$sqlQuery .= " INDEX_DIRECTORY = '" . $partition['index_directory'] . "'";
}
if (! empty($partition['max_rows'])) {
$sqlQuery .= " MAX_ROWS = " . $partition['max_rows'];
$sqlQuery .= ' MAX_ROWS = ' . $partition['max_rows'];
}
if (! empty($partition['min_rows'])) {
$sqlQuery .= " MIN_ROWS = " . $partition['min_rows'];
$sqlQuery .= ' MIN_ROWS = ' . $partition['min_rows'];
}
if (! empty($partition['tablespace'])) {
$sqlQuery .= " TABLESPACE = " . $partition['tablespace'];
$sqlQuery .= ' TABLESPACE = ' . $partition['tablespace'];
}
if (! empty($partition['node_group'])) {
$sqlQuery .= " NODEGROUP = " . $partition['node_group'];
$sqlQuery .= ' NODEGROUP = ' . $partition['node_group'];
}
if (! empty($partition['subpartitions'])) {
@ -441,7 +441,7 @@ class CreateAddField
true
);
}
$sqlQuery .= " (" . implode(", ", $subpartitions) . ")";
$sqlQuery .= ' (' . implode(', ', $subpartitions) . ')';
}
return $sqlQuery;

View File

@ -105,11 +105,11 @@ class Designer
return $result;
}
$page_query = "SELECT `page_nr`, `page_descr` FROM "
. Util::backquote($cfgRelation['db']) . "."
$page_query = 'SELECT `page_nr`, `page_descr` FROM '
. Util::backquote($cfgRelation['db']) . '.'
. Util::backquote($cfgRelation['pdf_pages'])
. " WHERE db_name = '" . $this->dbi->escapeString($db) . "'"
. " ORDER BY `page_descr`";
. ' ORDER BY `page_descr`';
$page_rs = $this->relation->queryAsControlUser(
$page_query,
false,
@ -135,7 +135,7 @@ class Designer
/* Scan for schema plugins */
/** @var SchemaPlugin[] $export_list */
$export_list = Plugins::getPlugins(
"schema",
'schema',
'libraries/classes/Plugins/Schema/',
null
);

View File

@ -127,7 +127,7 @@ class Common
{
$this->dbi->selectDb($GLOBALS['db']);
$con = [];
$con["C_NAME"] = [];
$con['C_NAME'] = [];
$i = 0;
$alltab_rs = $this->dbi->query(
'SHOW TABLES FROM ' . Util::backquote($GLOBALS['db']),
@ -140,10 +140,10 @@ class Common
if ($row !== false) {
foreach ($row as $field => $value) {
$con['C_NAME'][$i] = '';
$con['DTN'][$i] = rawurlencode($GLOBALS['db'] . "." . $val[0]);
$con['DTN'][$i] = rawurlencode($GLOBALS['db'] . '.' . $val[0]);
$con['DCN'][$i] = rawurlencode($field);
$con['STN'][$i] = rawurlencode(
$value['foreign_db'] . "." . $value['foreign_table']
$value['foreign_db'] . '.' . $value['foreign_table']
);
$con['SCN'][$i] = rawurlencode($value['foreign_field']);
$i++;
@ -156,12 +156,12 @@ class Common
foreach ($row['foreign_keys_data'] as $one_key) {
foreach ($one_key['index_list'] as $index => $one_field) {
$con['C_NAME'][$i] = rawurlencode($one_key['constraint']);
$con['DTN'][$i] = rawurlencode($GLOBALS['db'] . "." . $val[0]);
$con['DTN'][$i] = rawurlencode($GLOBALS['db'] . '.' . $val[0]);
$con['DCN'][$i] = rawurlencode($one_field);
$con['STN'][$i] = rawurlencode(
(isset($one_key['ref_db_name']) ?
$one_key['ref_db_name'] : $GLOBALS['db'])
. "." . $one_key['ref_table_name']
. '.' . $one_key['ref_table_name']
);
$con['SCN'][$i] = rawurlencode($one_key['ref_index_list'][$index]);
$i++;
@ -177,7 +177,7 @@ class Common
$ti = 0;
$retval = [];
for ($i = 0, $cnt = count($con["C_NAME"]); $i < $cnt; $i++) {
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] = [];
@ -277,8 +277,8 @@ class Common
1 AS `V`,
1 AS `H`
FROM " . Util::backquote($cfgRelation['db'])
. "." . Util::backquote($cfgRelation['table_coords']) . "
WHERE pdf_page_number = " . intval($pg);
. '.' . Util::backquote($cfgRelation['table_coords']) . '
WHERE pdf_page_number = ' . intval($pg);
return $this->dbi->fetchResult(
$query,
@ -303,10 +303,10 @@ class Common
return null;
}
$query = "SELECT `page_descr`"
. " FROM " . Util::backquote($cfgRelation['db'])
. "." . Util::backquote($cfgRelation['pdf_pages'])
. " WHERE " . Util::backquote('page_nr') . " = " . intval($pg);
$query = 'SELECT `page_descr`'
. ' FROM ' . Util::backquote($cfgRelation['db'])
. '.' . Util::backquote($cfgRelation['pdf_pages'])
. ' WHERE ' . Util::backquote('page_nr') . ' = ' . intval($pg);
$page_name = $this->dbi->fetchResult(
$query,
null,
@ -331,9 +331,9 @@ class Common
return false;
}
$query = "DELETE FROM " . Util::backquote($cfgRelation['db'])
. "." . Util::backquote($cfgRelation['table_coords'])
. " WHERE " . Util::backquote('pdf_page_number') . " = " . intval($pg);
$query = 'DELETE FROM ' . Util::backquote($cfgRelation['db'])
. '.' . Util::backquote($cfgRelation['table_coords'])
. ' WHERE ' . Util::backquote('pdf_page_number') . ' = ' . intval($pg);
$success = $this->relation->queryAsControlUser(
$query,
true,
@ -341,9 +341,9 @@ class Common
);
if ($success) {
$query = "DELETE FROM " . Util::backquote($cfgRelation['db'])
. "." . Util::backquote($cfgRelation['pdf_pages'])
. " WHERE " . Util::backquote('page_nr') . " = " . intval($pg);
$query = 'DELETE FROM ' . Util::backquote($cfgRelation['db'])
. '.' . Util::backquote($cfgRelation['pdf_pages'])
. ' WHERE ' . Util::backquote('page_nr') . ' = ' . intval($pg);
$success = $this->relation->queryAsControlUser(
$query,
true,
@ -369,9 +369,9 @@ class Common
return -1;
}
$query = "SELECT `page_nr`"
. " FROM " . Util::backquote($cfgRelation['db'])
. "." . Util::backquote($cfgRelation['pdf_pages'])
$query = 'SELECT `page_nr`'
. ' FROM ' . Util::backquote($cfgRelation['db'])
. '.' . Util::backquote($cfgRelation['pdf_pages'])
. " WHERE `db_name` = '" . $this->dbi->escapeString($db) . "'"
. " AND `page_descr` = '" . $this->dbi->escapeString($db) . "'";
@ -410,9 +410,9 @@ class Common
if ($default_page_no != -1) {
$page_no = $default_page_no;
} else {
$query = "SELECT MIN(`page_nr`)"
. " FROM " . Util::backquote($cfgRelation['db'])
. "." . Util::backquote($cfgRelation['pdf_pages'])
$query = 'SELECT MIN(`page_nr`)'
. ' FROM ' . Util::backquote($cfgRelation['db'])
. '.' . Util::backquote($cfgRelation['pdf_pages'])
. " WHERE `db_name` = '" . $this->dbi->escapeString($db) . "'";
$min_page_no = $this->dbi->fetchResult(
@ -466,9 +466,9 @@ class Common
return false;
}
$query = "DELETE FROM "
$query = 'DELETE FROM '
. Util::backquote($cfgRelation['db'])
. "." . Util::backquote(
. '.' . Util::backquote(
$cfgRelation['table_coords']
)
. " WHERE `pdf_page_number` = '" . $pageId . "'";
@ -490,11 +490,11 @@ class Common
continue;
}
$query = "INSERT INTO "
. Util::backquote($cfgRelation['db']) . "."
$query = 'INSERT INTO '
. Util::backquote($cfgRelation['db']) . '.'
. Util::backquote($cfgRelation['table_coords'])
. " (`db_name`, `table_name`, `pdf_page_number`, `x`, `y`)"
. " VALUES ("
. ' (`db_name`, `table_name`, `pdf_page_number`, `x`, `y`)'
. ' VALUES ('
. "'" . $this->dbi->escapeString($DB) . "', "
. "'" . $this->dbi->escapeString($TAB) . "', "
. "'" . $pageId . "', "
@ -634,7 +634,7 @@ class Common
return [
false,
__('Error: FOREIGN KEY relationship could not be added!')
. "<br>" . $error,
. '<br>' . $error,
];
}
@ -655,13 +655,13 @@ class Common
// no need to recheck if the keys are primary or unique at this point,
// this was checked on the interface part
$q = "INSERT INTO "
$q = 'INSERT INTO '
. Util::backquote($GLOBALS['cfgRelation']['db'])
. "."
. '.'
. Util::backquote($GLOBALS['cfgRelation']['relation'])
. "(master_db, master_table, master_field, "
. "foreign_db, foreign_table, foreign_field)"
. " values("
. '(master_db, master_table, master_field, '
. 'foreign_db, foreign_table, foreign_field)'
. ' values('
. "'" . $this->dbi->escapeString($DB2) . "', "
. "'" . $this->dbi->escapeString($T2) . "', "
. "'" . $this->dbi->escapeString($F2) . "', "
@ -681,7 +681,7 @@ class Common
return [
false,
__('Error: Internal relationship could not be added!')
. "<br>" . $error,
. '<br>' . $error,
];
}
@ -697,8 +697,8 @@ class Common
*/
public function removeRelation($T1, $F1, $T2, $F2)
{
list($DB1, $T1) = explode(".", $T1);
list($DB2, $T2) = explode(".", $T2);
list($DB1, $T1) = explode('.', $T1);
list($DB2, $T2) = explode('.', $T2);
$tables = $this->dbi->getTablesFull($DB1, $T1);
$type_T1 = mb_strtoupper($tables[$T1]['ENGINE']);
@ -728,15 +728,15 @@ class Common
return [
false,
__('Error: FOREIGN KEY relationship could not be removed!')
. "<br>" . $error,
. '<br>' . $error,
];
}
}
// internal relations
$delete_query = "DELETE FROM "
. Util::backquote($GLOBALS['cfgRelation']['db']) . "."
. $GLOBALS['cfgRelation']['relation'] . " WHERE "
$delete_query = 'DELETE FROM '
. Util::backquote($GLOBALS['cfgRelation']['db']) . '.'
. $GLOBALS['cfgRelation']['relation'] . ' WHERE '
. "master_db = '" . $this->dbi->escapeString($DB2) . "'"
. " AND master_table = '" . $this->dbi->escapeString($T2) . "'"
. " AND master_field = '" . $this->dbi->escapeString($F2) . "'"
@ -754,7 +754,7 @@ class Common
$error = $this->dbi->getError(DatabaseInterface::CONNECT_CONTROL);
return [
false,
__('Error: Internal relationship could not be removed!') . "<br>" . $error,
__('Error: Internal relationship could not be removed!') . '<br>' . $error,
];
}
@ -783,9 +783,9 @@ class Common
'table' => $cfgRelation['designer_settings'],
];
$orig_data_query = "SELECT settings_data"
. " FROM " . Util::backquote($cfgDesigner['db'])
. "." . Util::backquote($cfgDesigner['table'])
$orig_data_query = 'SELECT settings_data'
. ' FROM ' . Util::backquote($cfgDesigner['db'])
. '.' . Util::backquote($cfgDesigner['table'])
. " WHERE username = '"
. $this->dbi->escapeString($cfgDesigner['user']) . "';";
@ -800,9 +800,9 @@ class Common
$orig_data[$index] = $value;
$orig_data = json_encode($orig_data);
$save_query = "UPDATE "
$save_query = 'UPDATE '
. Util::backquote($cfgDesigner['db'])
. "." . Util::backquote($cfgDesigner['table'])
. '.' . Util::backquote($cfgDesigner['table'])
. " SET settings_data = '" . $orig_data . "'"
. " WHERE username = '"
. $this->dbi->escapeString($cfgDesigner['user']) . "';";
@ -811,10 +811,10 @@ class Common
} else {
$save_data = [$index => $value];
$query = "INSERT INTO "
$query = 'INSERT INTO '
. Util::backquote($cfgDesigner['db'])
. "." . Util::backquote($cfgDesigner['table'])
. " (username, settings_data)"
. '.' . Util::backquote($cfgDesigner['table'])
. ' (username, settings_data)'
. " VALUES('" . $this->dbi->escapeString($cfgDesigner['user'])
. "', '" . json_encode($save_data) . "');";

View File

@ -791,8 +791,8 @@ class Qbe
private function _getTableFooters()
{
$html_output = '<fieldset class="tblFooters">';
$html_output .= $this->_getFootersOptions("row");
$html_output .= $this->_getFootersOptions("column");
$html_output .= $this->_getFootersOptions('row');
$html_output .= $this->_getFootersOptions('column');
$html_output .= '<div class="floatleft">';
$html_output .= '<input class="btn btn-secondary" type="submit" name="modify"'
. ' value="' . __('Update Query') . '">';
@ -1099,7 +1099,7 @@ class Qbe
) {
$select = $this->_formColumns[$column_index];
if (! empty($this->_formAliases[$column_index])) {
$select .= " AS "
$select .= ' AS '
. Util::backquote($this->_formAliases[$column_index]);
}
$select_clauses[] = $select;
@ -1107,7 +1107,7 @@ class Qbe
} // end for
if (! empty($select_clauses)) {
$select_clause = 'SELECT '
. htmlspecialchars(implode(", ", $select_clauses)) . "\n";
. htmlspecialchars(implode(', ', $select_clauses)) . "\n";
}
return $select_clause;
}
@ -1236,7 +1236,7 @@ class Qbe
} // end for
if (! empty($orderby_clauses)) {
$orderby_clause = 'ORDER BY '
. htmlspecialchars(implode(", ", $orderby_clauses)) . "\n";
. htmlspecialchars(implode(', ', $orderby_clauses)) . "\n";
}
return $orderby_clause;
}
@ -1635,14 +1635,14 @@ class Qbe
foreach ($finalized as $table => $clause) {
if ($first) {
if (! empty($join)) {
$join .= ", ";
$join .= ', ';
}
$join .= Util::backquote($table);
$first = false;
} else {
$join .= "\n LEFT JOIN " . Util::backquote(
$table
) . " ON " . $clause;
) . ' ON ' . $clause;
}
}
@ -1670,20 +1670,20 @@ class Qbe
// There may be multiple column relations
foreach ($oneKey['index_list'] as $index => $oneField) {
$clauses[]
= Util::backquote($oneTable) . "."
. Util::backquote($oneField) . " = "
. Util::backquote($oneKey['ref_table_name']) . "."
= Util::backquote($oneTable) . '.'
. Util::backquote($oneField) . ' = '
. Util::backquote($oneKey['ref_table_name']) . '.'
. Util::backquote($oneKey['ref_index_list'][$index]);
}
// Combine multiple column relations with AND
$relations[$oneTable][$oneKey['ref_table_name']]
= implode(" AND ", $clauses);
= implode(' AND ', $clauses);
}
} else { // Internal relations
$relations[$oneTable][$foreigner['foreign_table']]
= Util::backquote($oneTable) . "."
. Util::backquote($field) . " = "
. Util::backquote($foreigner['foreign_table']) . "."
= Util::backquote($oneTable) . '.'
. Util::backquote($field) . ' = '
. Util::backquote($foreigner['foreign_table']) . '.'
. Util::backquote($foreigner['foreign_field']);
}
}

View File

@ -410,16 +410,16 @@ class DatabaseInterface
$tablesListForQuery = rtrim($tablesListForQuery, ',');
$foreignKeyConstrains = $this->fetchResult(
"SELECT"
. " TABLE_NAME,"
. " COLUMN_NAME,"
. " REFERENCED_TABLE_NAME,"
. " REFERENCED_COLUMN_NAME"
. " FROM information_schema.key_column_usage"
. " WHERE referenced_table_name IS NOT NULL"
'SELECT'
. ' TABLE_NAME,'
. ' COLUMN_NAME,'
. ' REFERENCED_TABLE_NAME,'
. ' REFERENCED_COLUMN_NAME'
. ' FROM information_schema.key_column_usage'
. ' WHERE referenced_table_name IS NOT NULL'
. " AND TABLE_SCHEMA = '" . $this->escapeString($database) . "'"
. " AND TABLE_NAME IN (" . $tablesListForQuery . ")"
. " AND REFERENCED_TABLE_NAME IN (" . $tablesListForQuery . ");",
. ' AND TABLE_NAME IN (' . $tablesListForQuery . ')'
. ' AND REFERENCED_TABLE_NAME IN (' . $tablesListForQuery . ');',
null,
null,
$link,
@ -594,7 +594,7 @@ class DatabaseInterface
$sql = $this->_getSqlForTablesFull($this_databases, $sql_where_table);
// Sort the tables
$sql .= " ORDER BY $sort_by $sort_order";
$sql .= ' ORDER BY ' . $sort_by . ' ' . $sort_order;
if ($limit_count) {
$sql .= ' LIMIT ' . $limit_count . ' OFFSET ' . $limit_offset;
@ -675,7 +675,7 @@ class DatabaseInterface
}
if (! empty($table_type)) {
if ($needAnd) {
$sql .= " AND";
$sql .= ' AND';
}
if ($table_type == 'view') {
$sql .= " `Comment` = 'VIEW'";
@ -1478,7 +1478,7 @@ class DatabaseInterface
return true;
}
return $this->query("SET " . $var . " = " . $value . ';', $link);
return $this->query('SET ' . $var . ' = ' . $value . ';', $link);
}
/**
@ -1531,7 +1531,7 @@ class DatabaseInterface
$GLOBALS['collation_connection'] = $default_collation;
$GLOBALS['charset_connection'] = $default_charset;
$this->query(
"SET NAMES '$default_charset' COLLATE '$default_collation';",
sprintf('SET NAMES \'%s\' COLLATE \'%s\';', $default_charset, $default_collation),
DatabaseInterface::CONNECT_USER,
self::QUERY_STORE
);
@ -2006,27 +2006,27 @@ class DatabaseInterface
): array {
$routines = [];
if (! $GLOBALS['cfg']['Server']['DisableIS']) {
$query = "SELECT"
. " `ROUTINE_SCHEMA` AS `Db`,"
. " `SPECIFIC_NAME` AS `Name`,"
. " `ROUTINE_TYPE` AS `Type`,"
. " `DEFINER` AS `Definer`,"
. " `LAST_ALTERED` AS `Modified`,"
. " `CREATED` AS `Created`,"
. " `SECURITY_TYPE` AS `Security_type`,"
. " `ROUTINE_COMMENT` AS `Comment`,"
. " `CHARACTER_SET_CLIENT` AS `character_set_client`,"
. " `COLLATION_CONNECTION` AS `collation_connection`,"
. " `DATABASE_COLLATION` AS `Database Collation`,"
. " `DTD_IDENTIFIER`"
. " FROM `information_schema`.`ROUTINES`"
. " WHERE `ROUTINE_SCHEMA` " . Util::getCollateForIS()
$query = 'SELECT'
. ' `ROUTINE_SCHEMA` AS `Db`,'
. ' `SPECIFIC_NAME` AS `Name`,'
. ' `ROUTINE_TYPE` AS `Type`,'
. ' `DEFINER` AS `Definer`,'
. ' `LAST_ALTERED` AS `Modified`,'
. ' `CREATED` AS `Created`,'
. ' `SECURITY_TYPE` AS `Security_type`,'
. ' `ROUTINE_COMMENT` AS `Comment`,'
. ' `CHARACTER_SET_CLIENT` AS `character_set_client`,'
. ' `COLLATION_CONNECTION` AS `collation_connection`,'
. ' `DATABASE_COLLATION` AS `Database Collation`,'
. ' `DTD_IDENTIFIER`'
. ' FROM `information_schema`.`ROUTINES`'
. ' WHERE `ROUTINE_SCHEMA` ' . Util::getCollateForIS()
. " = '" . $this->escapeString($db) . "'";
if (Core::isValid($which, ['FUNCTION', 'PROCEDURE'])) {
$query .= " AND `ROUTINE_TYPE` = '" . $which . "'";
}
if (! empty($name)) {
$query .= " AND `SPECIFIC_NAME`"
$query .= ' AND `SPECIFIC_NAME`'
. " = '" . $this->escapeString($name) . "'";
}
$result = $this->fetchResult($query);
@ -2035,7 +2035,7 @@ class DatabaseInterface
}
} else {
if ($which == 'FUNCTION' || $which == null) {
$query = "SHOW FUNCTION STATUS"
$query = 'SHOW FUNCTION STATUS'
. " WHERE `Db` = '" . $this->escapeString($db) . "'";
if (! empty($name)) {
$query .= " AND `Name` = '"
@ -2047,7 +2047,7 @@ class DatabaseInterface
}
}
if ($which == 'PROCEDURE' || $which == null) {
$query = "SHOW PROCEDURE STATUS"
$query = 'SHOW PROCEDURE STATUS'
. " WHERE `Db` = '" . $this->escapeString($db) . "'";
if (! empty($name)) {
$query .= " AND `Name` = '"
@ -2068,7 +2068,7 @@ class DatabaseInterface
$one_result['type'] = $routine['Type'];
$one_result['definer'] = $routine['Definer'];
$one_result['returns'] = isset($routine['DTD_IDENTIFIER'])
? $routine['DTD_IDENTIFIER'] : "";
? $routine['DTD_IDENTIFIER'] : '';
$ret[] = $one_result;
}
@ -2093,31 +2093,31 @@ class DatabaseInterface
public function getEvents(string $db, string $name = ''): array
{
if (! $GLOBALS['cfg']['Server']['DisableIS']) {
$query = "SELECT"
. " `EVENT_SCHEMA` AS `Db`,"
. " `EVENT_NAME` AS `Name`,"
. " `DEFINER` AS `Definer`,"
. " `TIME_ZONE` AS `Time zone`,"
. " `EVENT_TYPE` AS `Type`,"
. " `EXECUTE_AT` AS `Execute at`,"
. " `INTERVAL_VALUE` AS `Interval value`,"
. " `INTERVAL_FIELD` AS `Interval field`,"
. " `STARTS` AS `Starts`,"
. " `ENDS` AS `Ends`,"
. " `STATUS` AS `Status`,"
. " `ORIGINATOR` AS `Originator`,"
. " `CHARACTER_SET_CLIENT` AS `character_set_client`,"
. " `COLLATION_CONNECTION` AS `collation_connection`, "
. "`DATABASE_COLLATION` AS `Database Collation`"
. " FROM `information_schema`.`EVENTS`"
. " WHERE `EVENT_SCHEMA` " . Util::getCollateForIS()
$query = 'SELECT'
. ' `EVENT_SCHEMA` AS `Db`,'
. ' `EVENT_NAME` AS `Name`,'
. ' `DEFINER` AS `Definer`,'
. ' `TIME_ZONE` AS `Time zone`,'
. ' `EVENT_TYPE` AS `Type`,'
. ' `EXECUTE_AT` AS `Execute at`,'
. ' `INTERVAL_VALUE` AS `Interval value`,'
. ' `INTERVAL_FIELD` AS `Interval field`,'
. ' `STARTS` AS `Starts`,'
. ' `ENDS` AS `Ends`,'
. ' `STATUS` AS `Status`,'
. ' `ORIGINATOR` AS `Originator`,'
. ' `CHARACTER_SET_CLIENT` AS `character_set_client`,'
. ' `COLLATION_CONNECTION` AS `collation_connection`, '
. '`DATABASE_COLLATION` AS `Database Collation`'
. ' FROM `information_schema`.`EVENTS`'
. ' WHERE `EVENT_SCHEMA` ' . Util::getCollateForIS()
. " = '" . $this->escapeString($db) . "'";
if (! empty($name)) {
$query .= " AND `EVENT_NAME`"
$query .= ' AND `EVENT_NAME`'
. " = '" . $this->escapeString($name) . "'";
}
} else {
$query = "SHOW EVENTS FROM " . Util::backquote($db);
$query = 'SHOW EVENTS FROM ' . Util::backquote($db);
if (! empty($name)) {
$query .= " AND `Name` = '"
. $this->escapeString($name) . "'";
@ -2166,11 +2166,11 @@ class DatabaseInterface
. ' \'' . $this->escapeString($db) . '\'';
if (! empty($table)) {
$query .= " AND EVENT_OBJECT_TABLE " . Util::getCollateForIS()
$query .= ' AND EVENT_OBJECT_TABLE ' . Util::getCollateForIS()
. " = '" . $this->escapeString($table) . "';";
}
} else {
$query = "SHOW TRIGGERS FROM " . Util::backquote($db);
$query = 'SHOW TRIGGERS FROM ' . Util::backquote($db);
if (! empty($table)) {
$query .= " LIKE '" . $this->escapeString($table) . "';";
}
@ -2340,20 +2340,20 @@ class DatabaseInterface
$query = 'SELECT 1 FROM mysql.user LIMIT 1';
} elseif ($type === 'create') {
[$user, $host] = $this->getCurrentUserAndHost();
$query = "SELECT 1 FROM `INFORMATION_SCHEMA`.`USER_PRIVILEGES` "
$query = 'SELECT 1 FROM `INFORMATION_SCHEMA`.`USER_PRIVILEGES` '
. "WHERE `PRIVILEGE_TYPE` = 'CREATE USER' AND "
. "'''" . $user . "''@''" . $host . "''' LIKE `GRANTEE` LIMIT 1";
} elseif ($type === 'grant') {
[$user, $host] = $this->getCurrentUserAndHost();
$query = "SELECT 1 FROM ("
. "SELECT `GRANTEE`, `IS_GRANTABLE` FROM "
. "`INFORMATION_SCHEMA`.`COLUMN_PRIVILEGES` UNION "
. "SELECT `GRANTEE`, `IS_GRANTABLE` FROM "
. "`INFORMATION_SCHEMA`.`TABLE_PRIVILEGES` UNION "
. "SELECT `GRANTEE`, `IS_GRANTABLE` FROM "
. "`INFORMATION_SCHEMA`.`SCHEMA_PRIVILEGES` UNION "
. "SELECT `GRANTEE`, `IS_GRANTABLE` FROM "
. "`INFORMATION_SCHEMA`.`USER_PRIVILEGES`) t "
$query = 'SELECT 1 FROM ('
. 'SELECT `GRANTEE`, `IS_GRANTABLE` FROM '
. '`INFORMATION_SCHEMA`.`COLUMN_PRIVILEGES` UNION '
. 'SELECT `GRANTEE`, `IS_GRANTABLE` FROM '
. '`INFORMATION_SCHEMA`.`TABLE_PRIVILEGES` UNION '
. 'SELECT `GRANTEE`, `IS_GRANTABLE` FROM '
. '`INFORMATION_SCHEMA`.`SCHEMA_PRIVILEGES` UNION '
. 'SELECT `GRANTEE`, `IS_GRANTABLE` FROM '
. '`INFORMATION_SCHEMA`.`USER_PRIVILEGES`) t '
. "WHERE `IS_GRANTABLE` = 'YES' AND "
. "'''" . $user . "''@''" . $host . "''' LIKE `GRANTEE` LIMIT 1";
}
@ -2371,7 +2371,7 @@ class DatabaseInterface
} else {
$is = false;
$grants = $this->fetchResult(
"SHOW GRANTS FOR CURRENT_USER();",
'SHOW GRANTS FOR CURRENT_USER();',
null,
null,
self::CONNECT_USER,
@ -2380,14 +2380,14 @@ class DatabaseInterface
if ($grants) {
foreach ($grants as $grant) {
if ($type === 'create') {
if (strpos($grant, "ALL PRIVILEGES ON *.*") !== false
|| strpos($grant, "CREATE USER") !== false
if (strpos($grant, 'ALL PRIVILEGES ON *.*') !== false
|| strpos($grant, 'CREATE USER') !== false
) {
$is = true;
break;
}
} elseif ($type === 'grant') {
if (strpos($grant, "WITH GRANT OPTION") !== false) {
if (strpos($grant, 'WITH GRANT OPTION') !== false) {
$is = true;
break;
}
@ -2415,7 +2415,7 @@ class DatabaseInterface
'',
];
} else {
$this->_current_user = explode("@", $user);
$this->_current_user = explode('@', $user);
}
}
return $this->_current_user;
@ -2430,7 +2430,7 @@ class DatabaseInterface
{
if ($this->_lower_case_table_names === null) {
$this->_lower_case_table_names = $this->fetchValue(
"SELECT @@lower_case_table_names"
'SELECT @@lower_case_table_names'
);
}
return $this->_lower_case_table_names;

View File

@ -78,7 +78,7 @@ class Export
// (from clicking Back button on /export page)
if (isset($_POST['db_select'])) {
$_POST['db_select'] = urldecode($_POST['db_select']);
$_POST['db_select'] = explode(",", $_POST['db_select']);
$_POST['db_select'] = explode(',', $_POST['db_select']);
}
$databases = [];
@ -166,13 +166,13 @@ class Export
// Get the relation settings
$cfgRelation = $this->relation->getRelationsParam();
$query = "SELECT `id`, `template_name` FROM "
$query = 'SELECT `id`, `template_name` FROM '
. Util::backquote($cfgRelation['db']) . '.'
. Util::backquote($cfgRelation['export_templates'])
. " WHERE `username` = "
. ' WHERE `username` = '
. "'" . $GLOBALS['dbi']->escapeString($GLOBALS['cfg']['Server']['user'])
. "' AND `export_type` = '" . $GLOBALS['dbi']->escapeString($exportType) . "'"
. " ORDER BY `template_name`;";
. ' ORDER BY `template_name`;';
$result = $this->relation->queryAsControlUser($query);
@ -689,7 +689,7 @@ class Export
/* Scan for plugins */
/** @var ExportPlugin[] $exportList */
$exportList = Plugins::getPlugins(
"export",
'export',
'libraries/classes/Plugins/Export/',
[
'export_type' => $exportType,
@ -767,10 +767,10 @@ class Export
switch ($_POST['templateAction']) {
case 'create':
$query = "INSERT INTO " . $templateTable . "("
. " `username`, `export_type`,"
. " `template_name`, `template_data`"
. ") VALUES ("
$query = 'INSERT INTO ' . $templateTable . '('
. ' `username`, `export_type`,'
. ' `template_name`, `template_data`'
. ') VALUES ('
. "'" . $user . "', "
. "'" . $GLOBALS['dbi']->escapeString($_POST['exportType'])
. "', '" . $GLOBALS['dbi']->escapeString($_POST['templateName'])
@ -778,17 +778,17 @@ class Export
. "');";
break;
case 'load':
$query = "SELECT `template_data` FROM " . $templateTable
. " WHERE `id` = " . $id . " AND `username` = '" . $user . "'";
$query = 'SELECT `template_data` FROM ' . $templateTable
. ' WHERE `id` = ' . $id . " AND `username` = '" . $user . "'";
break;
case 'update':
$query = "UPDATE " . $templateTable . " SET `template_data` = "
$query = 'UPDATE ' . $templateTable . ' SET `template_data` = '
. "'" . $GLOBALS['dbi']->escapeString($_POST['templateData']) . "'"
. " WHERE `id` = " . $id . " AND `username` = '" . $user . "'";
. ' WHERE `id` = ' . $id . " AND `username` = '" . $user . "'";
break;
case 'delete':
$query = "DELETE FROM " . $templateTable
. " WHERE `id` = " . $id . " AND `username` = '" . $user . "'";
$query = 'DELETE FROM ' . $templateTable
. ' WHERE `id` = ' . $id . " AND `username` = '" . $user . "'";
break;
default:
$query = '';

View File

@ -50,7 +50,7 @@ class Import
/* Scan for plugins */
/** @var ImportPlugin[] $importList */
$importList = Plugins::getPlugins(
"import",
'import',
'libraries/classes/Plugins/Import/',
$importType
);
@ -101,7 +101,7 @@ class Import
return $template->render('display/import/import', [
'upload_id' => $uploadId,
'handler' => $_SESSION[$SESSION_KEY]["handler"],
'handler' => $_SESSION[$SESSION_KEY]['handler'],
'id_key' => $_SESSION[$SESSION_KEY]['handler']::getIdKey(),
'pma_theme_image' => $GLOBALS['pmaThemeImage'],
'import_type' => $importType,

View File

@ -32,12 +32,12 @@ class ImportAjax
/**
* sets default plugin for handling the import process
*/
$_SESSION[$SESSION_KEY]["handler"] = "";
$_SESSION[$SESSION_KEY]['handler'] = '';
/**
* unique ID for each upload
*/
$upload_id = uniqid("");
$upload_id = uniqid('');
/**
* list of available plugins
@ -45,20 +45,20 @@ class ImportAjax
$plugins = [
// PHP 5.4 session-based upload progress is problematic, see bug 3964
//"session",
"progress",
"apc",
"noplugin",
'progress',
'apc',
'noplugin',
];
// select available plugin
foreach ($plugins as $plugin) {
$check = $plugin . "Check";
$check = $plugin . 'Check';
if (self::$check()) {
$upload_class = 'PhpMyAdmin\Plugins\Import\Upload\Upload' . ucwords(
$plugin
);
$_SESSION[$SESSION_KEY]["handler"] = $upload_class;
$_SESSION[$SESSION_KEY]['handler'] = $upload_class;
break;
}
}
@ -95,7 +95,7 @@ class ImportAjax
*/
public static function progressCheck()
{
return function_exists("uploadprogress_get_info")
return function_exists('uploadprogress_get_info')
&& function_exists('getallheaders');
}

View File

@ -1780,7 +1780,7 @@ class Results
array $sort_direction,
$fields_meta
) {
$sort_order = "";
$sort_order = '';
// Check if the current column is in the order by clause
$is_in_sort = $this->_isInSorted(
$sort_expression,
@ -1829,13 +1829,13 @@ class Results
// If this the first column name in the order by clause add
// order by clause to the column name
$query_head = $is_first_clause ? "\nORDER BY " : "";
$query_head = $is_first_clause ? "\nORDER BY " : '';
// Again a check to see if the given column is a aggregate column
if (mb_strpos($name_to_use_in_sort, '(') !== false) {
$sort_order .= $query_head . $name_to_use_in_sort . ' ' ;
} else {
if (strlen($sort_tbl_new) > 0) {
$sort_tbl_new .= ".";
$sort_tbl_new .= '.';
}
$sort_order .= $query_head . $sort_tbl_new
. Util::backquote(
@ -1845,7 +1845,7 @@ class Results
// For a special case where the code generates two dots between
// column name and table name.
$sort_order = preg_replace("/\.\./", ".", $sort_order);
$sort_order = preg_replace('/\.\./', '.', $sort_order);
// Incase this is the current column save $single_sort_order
if ($current_name == $name_to_use_in_sort) {
if (mb_strpos($current_name, '(') !== false) {
@ -1874,12 +1874,12 @@ class Results
$sort_order,
$index
);
$order_img .= " <small>" . ($index + 1) . "</small>";
$order_img .= ' <small>' . ($index + 1) . '</small>';
} else {
$sort_order .= strtoupper($sort_direction[$index]);
}
// Separate columns by a comma
$sort_order .= ", ";
$sort_order .= ', ';
}
// remove the comma from the last column name in the newly
// constructed clause
@ -1924,7 +1924,7 @@ class Results
foreach ($sort_expression_nodirection as $index => $clause) {
if (mb_strpos($clause, '.') !== false) {
$fragments = explode('.', $clause);
$clause2 = $fragments[0] . "." . str_replace('`', '', $fragments[1]);
$clause2 = $fragments[0] . '.' . str_replace('`', '', $fragments[1]);
} else {
$clause2 = $sort_tbl . str_replace('`', '', $clause);
}
@ -1999,7 +1999,7 @@ class Results
's_desc',
__('Descending'),
[
'class' => "soimg",
'class' => 'soimg',
'title' => '',
]
);
@ -2007,7 +2007,7 @@ class Results
's_asc',
__('Ascending'),
[
'class' => "soimg hide",
'class' => 'soimg hide',
'title' => '',
]
);
@ -2017,7 +2017,7 @@ class Results
's_asc',
__('Ascending'),
[
'class' => "soimg",
'class' => 'soimg',
'title' => '',
]
);
@ -2025,7 +2025,7 @@ class Results
's_desc',
__('Descending'),
[
'class' => "soimg hide",
'class' => 'soimg hide',
'title' => '',
]
);
@ -3267,7 +3267,7 @@ class Results
);
// Class definitions required for grid editing jQuery scripts
$edit_anchor_class = "edit_row_anchor";
$edit_anchor_class = 'edit_row_anchor';
if ($clause_is_unique == 0) {
$edit_anchor_class .= ' nonunique';
}
@ -4957,7 +4957,7 @@ class Results
* the script it calls do not fail
*/
if (empty($_url_params['table']) && ! empty($_url_params['db'])) {
$_url_params['table'] = $GLOBALS['dbi']->fetchValue("SHOW TABLES");
$_url_params['table'] = $GLOBALS['dbi']->fetchValue('SHOW TABLES');
/* No result (probably no database selected) */
if ($_url_params['table'] === false) {
unset($_url_params['table']);
@ -5095,7 +5095,7 @@ class Results
) {
// Applying Transformations on hex string of binary data
// seems more appropriate
$result = pack("H*", bin2hex($content));
$result = pack('H*', bin2hex($content));
}
}

View File

@ -95,16 +95,16 @@ class ErrorReport
$relParams = $this->relation->getRelationsParam();
// common params for both, php & js exceptions
$report = [
"pma_version" => PMA_VERSION,
"browser_name" => PMA_USR_BROWSER_AGENT,
"browser_version" => PMA_USR_BROWSER_VER,
"user_os" => PMA_USR_OS,
"server_software" => $_SERVER['SERVER_SOFTWARE'],
"user_agent_string" => $_SERVER['HTTP_USER_AGENT'],
"locale" => $PMA_Config->getCookie('pma_lang'),
"configuration_storage" =>
$relParams['db'] === null ? "disabled" : "enabled",
"php_version" => PHP_VERSION,
'pma_version' => PMA_VERSION,
'browser_name' => PMA_USR_BROWSER_AGENT,
'browser_version' => PMA_USR_BROWSER_VER,
'user_os' => PMA_USR_OS,
'server_software' => $_SERVER['SERVER_SOFTWARE'],
'user_agent_string' => $_SERVER['HTTP_USER_AGENT'],
'locale' => $PMA_Config->getCookie('pma_lang'),
'configuration_storage' =>
$relParams['db'] === null ? 'disabled' : 'enabled',
'php_version' => PHP_VERSION,
];
if ($exceptionType == 'js') {
@ -112,26 +112,26 @@ class ErrorReport
return [];
}
$exception = $_POST['exception'];
$exception["stack"] = $this->translateStacktrace($exception["stack"]);
$exception['stack'] = $this->translateStacktrace($exception['stack']);
if (isset($exception["url"])) {
list($uri, $scriptName) = $this->sanitizeUrl($exception["url"]);
$exception["uri"] = $uri;
$report["script_name"] = $scriptName;
unset($exception["url"]);
} elseif (isset($_POST["url"])) {
list($uri, $scriptName) = $this->sanitizeUrl($_POST["url"]);
$exception["uri"] = $uri;
$report["script_name"] = $scriptName;
unset($_POST["url"]);
if (isset($exception['url'])) {
list($uri, $scriptName) = $this->sanitizeUrl($exception['url']);
$exception['uri'] = $uri;
$report['script_name'] = $scriptName;
unset($exception['url']);
} elseif (isset($_POST['url'])) {
list($uri, $scriptName) = $this->sanitizeUrl($_POST['url']);
$exception['uri'] = $uri;
$report['script_name'] = $scriptName;
unset($_POST['url']);
} else {
$report["script_name"] = null;
$report['script_name'] = null;
}
$report["exception_type"] = 'js';
$report["exception"] = $exception;
$report['exception_type'] = 'js';
$report['exception'] = $exception;
if (isset($_POST['microhistory'])) {
$report["microhistory"] = $_POST['microhistory'];
$report['microhistory'] = $_POST['microhistory'];
}
if (! empty($_POST['description'])) {
@ -153,12 +153,12 @@ class ErrorReport
&& $errorObj->getNumber() != E_USER_WARNING
) {
$errors[$i++] = [
"lineNum" => $errorObj->getLine(),
"file" => $errorObj->getFile(),
"type" => $errorObj->getType(),
"msg" => $errorObj->getOnlyMessage(),
"stackTrace" => $errorObj->getBacktrace(5),
"stackhash" => $errorObj->getHash(),
'lineNum' => $errorObj->getLine(),
'file' => $errorObj->getFile(),
'type' => $errorObj->getType(),
'msg' => $errorObj->getOnlyMessage(),
'stackTrace' => $errorObj->getBacktrace(5),
'stackhash' => $errorObj->getHash(),
];
}
}
@ -167,8 +167,8 @@ class ErrorReport
if ($i == 0) {
return []; // then return empty array
}
$report["exception_type"] = 'php';
$report["errors"] = $errors;
$report['exception_type'] = 'php';
$report['errors'] = $errors;
} else {
return [];
}
@ -191,16 +191,16 @@ class ErrorReport
private function sanitizeUrl(string $url): array
{
$components = parse_url($url);
if (isset($components["fragment"])
&& preg_match("<PMAURL-\d+:>", $components["fragment"], $matches)
if (isset($components['fragment'])
&& preg_match('<PMAURL-\d+:>', $components['fragment'], $matches)
) {
$uri = str_replace($matches[0], "", $components["fragment"]);
$url = "https://example.com/" . $uri;
$uri = str_replace($matches[0], '', $components['fragment']);
$url = 'https://example.com/' . $uri;
$components = parse_url($url);
}
// get script name
preg_match("<([a-zA-Z\-_\d\.]*\.php|js\/[a-zA-Z\-_\d\/\.]*\.js)$>", $components["path"], $matches);
preg_match('<([a-zA-Z\-_\d\.]*\.php|js\/[a-zA-Z\-_\d\/\.]*\.js)$>', $components['path'], $matches);
if (count($matches) < 2) {
$scriptName = 'index.php';
} else {
@ -208,15 +208,15 @@ class ErrorReport
}
// remove deployment specific details to make uri more generic
if (isset($components["query"])) {
parse_str($components["query"], $queryArray);
unset($queryArray["db"], $queryArray["table"], $queryArray["token"], $queryArray["server"]);
if (isset($components['query'])) {
parse_str($components['query'], $queryArray);
unset($queryArray['db'], $queryArray['table'], $queryArray['token'], $queryArray['server']);
$query = http_build_query($queryArray);
} else {
$query = '';
}
$uri = $scriptName . "?" . $query;
$uri = $scriptName . '?' . $query;
return [
$uri,
$scriptName,
@ -234,10 +234,10 @@ class ErrorReport
{
return $this->httpRequest->create(
$this->submissionUrl,
"POST",
'POST',
false,
json_encode($report),
"Content-Type: application/json"
'Content-Type: application/json'
);
}
@ -252,15 +252,15 @@ class ErrorReport
private function translateStacktrace(array $stack): array
{
foreach ($stack as &$level) {
foreach ($level["context"] as &$line) {
foreach ($level['context'] as &$line) {
if (mb_strlen($line) > 80) {
$line = mb_substr($line, 0, 75) . "//...";
$line = mb_substr($line, 0, 75) . '//...';
}
}
list($uri, $scriptName) = $this->sanitizeUrl($level["url"]);
$level["uri"] = $uri;
$level["scriptname"] = $scriptName;
unset($level["url"]);
list($uri, $scriptName) = $this->sanitizeUrl($level['url']);
$level['uri'] = $uri;
$level['scriptname'] = $scriptName;
unset($level['url']);
}
unset($level);
return $stack;

View File

@ -40,7 +40,7 @@ class Export
public function shutdown(): void
{
$error = error_get_last();
if ($error != null && mb_strpos($error['message'], "execution time")) {
if ($error != null && mb_strpos($error['message'], 'execution time')) {
//set session variable to check if there was error while exporting
$_SESSION['pma_export_error'] = $error['message'];
}
@ -314,7 +314,7 @@ class Export
$extension_start_pos,
mb_strlen($filename)
);
$required_extension = "." . $export_plugin->getProperties()->getExtension();
$required_extension = '.' . $export_plugin->getProperties()->getExtension();
if (mb_strtolower($user_extension) != $required_extension) {
$filename .= $required_extension;
}
@ -1125,15 +1125,15 @@ class Export
*
* @return mixed result of the query
*/
public function lockTables(string $db, array $tables, string $lockType = "WRITE")
public function lockTables(string $db, array $tables, string $lockType = 'WRITE')
{
$locks = [];
foreach ($tables as $table) {
$locks[] = Util::backquote($db) . "."
. Util::backquote($table) . " " . $lockType;
$locks[] = Util::backquote($db) . '.'
. Util::backquote($table) . ' ' . $lockType;
}
$sql = "LOCK TABLES " . implode(", ", $locks);
$sql = 'LOCK TABLES ' . implode(', ', $locks);
return $this->dbi->tryQuery($sql);
}
@ -1144,7 +1144,7 @@ class Export
*/
public function unlockTables()
{
return $this->dbi->tryQuery("UNLOCK TABLES");
return $this->dbi->tryQuery('UNLOCK TABLES');
}
/**
@ -1208,7 +1208,7 @@ class Export
// get the specific plugin
/** @var SchemaPlugin $export_plugin */
$export_plugin = Plugins::getPlugin(
"schema",
'schema',
$export_type,
'libraries/classes/Plugins/Schema/'
);

View File

@ -28,135 +28,135 @@ class Font
//ijl
$charLists[] = [
"chars" => [
"i",
"j",
"l",
], "modifier" => 0.23,
'chars' => [
'i',
'j',
'l',
], 'modifier' => 0.23,
];
//f
$charLists[] = [
"chars" => ["f"],
"modifier" => 0.27,
'chars' => ['f'],
'modifier' => 0.27,
];
//tI
$charLists[] = [
"chars" => [
"t",
"I",
], "modifier" => 0.28,
'chars' => [
't',
'I',
], 'modifier' => 0.28,
];
//r
$charLists[] = [
"chars" => ["r"],
"modifier" => 0.34,
'chars' => ['r'],
'modifier' => 0.34,
];
//1
$charLists[] = [
"chars" => ["1"],
"modifier" => 0.49,
'chars' => ['1'],
'modifier' => 0.49,
];
//cksvxyzJ
$charLists[] = [
"chars" => [
"c",
"k",
"s",
"v",
"x",
"y",
"z",
"J",
'chars' => [
'c',
'k',
's',
'v',
'x',
'y',
'z',
'J',
],
"modifier" => 0.5,
'modifier' => 0.5,
];
//abdeghnopquL023456789
$charLists[] = [
"chars" => [
"a",
"b",
"d",
"e",
"g",
"h",
"n",
"o",
"p",
"q",
"u",
"L",
"0",
"2",
"3",
"4",
"5",
"6",
"7",
"8",
"9",
'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,
'modifier' => 0.56,
];
//FTZ
$charLists[] = [
"chars" => [
"F",
"T",
"Z",
], "modifier" => 0.61,
'chars' => [
'F',
'T',
'Z',
], 'modifier' => 0.61,
];
//ABEKPSVXY
$charLists[] = [
"chars" => [
"A",
"B",
"E",
"K",
"P",
"S",
"V",
"X",
"Y",
'chars' => [
'A',
'B',
'E',
'K',
'P',
'S',
'V',
'X',
'Y',
],
"modifier" => 0.67,
'modifier' => 0.67,
];
//wCDHNRU
$charLists[] = [
"chars" => [
"w",
"C",
"D",
"H",
"N",
"R",
"U",
'chars' => [
'w',
'C',
'D',
'H',
'N',
'R',
'U',
],
"modifier" => 0.73,
'modifier' => 0.73,
];
//GOQ
$charLists[] = [
"chars" => [
"G",
"O",
"Q",
], "modifier" => 0.78,
'chars' => [
'G',
'O',
'Q',
], 'modifier' => 0.78,
];
//mM
$charLists[] = [
"chars" => [
"m",
"M",
], "modifier" => 0.84,
'chars' => [
'm',
'M',
], 'modifier' => 0.84,
];
//W
$charLists[] = [
"chars" => ["W"],
"modifier" => 0.95,
'chars' => ['W'],
'modifier' => 0.95,
];
//" "
$charLists[] = [
"chars" => [" "],
"modifier" => 0.28,
'chars' => [' '],
'modifier' => 0.28,
];
return $charLists;
@ -182,8 +182,8 @@ class Font
int $fontSize,
?array $charLists = null
): int {
if (! isset($charLists[0]["chars"], $charLists[0]["modifier"]) || empty($charLists)
|| ! is_array($charLists[0]["chars"])
if (! isset($charLists[0]['chars'], $charLists[0]['modifier']) || empty($charLists)
|| ! is_array($charLists[0]['chars'])
) {
$charLists = $this->getCharLists();
}
@ -195,13 +195,13 @@ class Font
foreach ($charLists as $charList) {
$count += ((mb_strlen($text)
- mb_strlen(str_replace($charList["chars"], "", $text))
) * $charList["modifier"]);
- mb_strlen(str_replace($charList['chars'], '', $text))
) * $charList['modifier']);
}
$text = str_replace(" ", "", $text);//remove the " "'s
$text = str_replace(' ', '', $text);//remove the " "'s
//all other chars
$count += (mb_strlen(preg_replace("/[a-z0-9]/i", "", $text)) * 0.3);
$count += (mb_strlen(preg_replace('/[a-z0-9]/i', '', $text)) * 0.3);
$modifier = 1;
$font = mb_strtolower($font);

View File

@ -111,14 +111,14 @@ class Footer
{
if ((is_object($object) || is_array($object)) && $object) {
if ($object instanceof Traversable) {
$object = "***ITERATOR***";
$object = '***ITERATOR***';
} elseif (! in_array($object, $stack, true)) {
$stack[] = $object;
foreach ($object as &$subobject) {
self::_removeRecursion($subobject, $stack);
}
} else {
$object = "***RECURSION***";
$object = '***RECURSION***';
}
}
return $object;

View File

@ -148,11 +148,11 @@ abstract class GisGeometry
protected function setMinMax($point_set, array $min_max)
{
// Separate each point
$points = explode(",", $point_set);
$points = explode(',', $point_set);
foreach ($points as $point) {
// Extract coordinates of the point
$cordinates = explode(" ", $point);
$cordinates = explode(' ', $point);
$x = (float) $cordinates[0];
if (! isset($min_max['maxX']) || $x > $min_max['maxX']) {
@ -191,10 +191,10 @@ abstract class GisGeometry
$wkt = '';
if (preg_match("/^'" . $geom_types . "\(.*\)',[0-9]*$/i", $value)) {
$last_comma = mb_strripos($value, ",");
$last_comma = mb_strripos($value, ',');
$srid = trim(mb_substr($value, $last_comma + 1));
$wkt = trim(mb_substr($value, 1, $last_comma - 2));
} elseif (preg_match("/^" . $geom_types . "\(.*\)$/i", $value)) {
} elseif (preg_match('/^' . $geom_types . '\(.*\)$/i', $value)) {
$wkt = $value;
}
@ -219,12 +219,12 @@ abstract class GisGeometry
$points_arr = [];
// Separate each point
$points = explode(",", $point_set);
$points = explode(',', $point_set);
foreach ($points as $point) {
$point = str_replace(['(', ')'], '', $point);
// Extract coordinates of the point
$cordinates = explode(" ", $point);
$cordinates = explode(' ', $point);
if (isset($cordinates[0], $cordinates[1]) && trim($cordinates[0]) != '' && trim($cordinates[1]) != '') {
if ($scale_data != null) {
@ -267,7 +267,7 @@ abstract class GisGeometry
{
$ol_array = 'new Array(';
foreach ($polygons as $polygon) {
$rings = explode("),(", $polygon);
$rings = explode('),(', $polygon);
$ol_array .= $this->getPolygonForOpenLayers($rings, $srid) . ', ';
}

View File

@ -64,7 +64,7 @@ class GisMultiLineString extends GisGeometry
mb_strlen($spatial) - 19
);
// Separate each linestring
$linestirngs = explode("),(", $multilinestirng);
$linestirngs = explode('),(', $multilinestirng);
foreach ($linestirngs as $linestring) {
$min_max = $this->setMinMax($linestring, $min_max);
@ -107,7 +107,7 @@ class GisMultiLineString extends GisGeometry
mb_strlen($spatial) - 19
);
// Separate each linestring
$linestirngs = explode("),(", $multilinestirng);
$linestirngs = explode('),(', $multilinestirng);
$first_line = true;
foreach ($linestirngs as $linestring) {
@ -181,7 +181,7 @@ class GisMultiLineString extends GisGeometry
mb_strlen($spatial) - 19
);
// Separate each linestring
$linestirngs = explode("),(", $multilinestirng);
$linestirngs = explode('),(', $multilinestirng);
$first_line = true;
foreach ($linestirngs as $linestring) {
@ -243,7 +243,7 @@ class GisMultiLineString extends GisGeometry
mb_strlen($spatial) - 19
);
// Separate each linestring
$linestirngs = explode("),(", $multilinestirng);
$linestirngs = explode('),(', $multilinestirng);
$row = '';
foreach ($linestirngs as $linestring) {
@ -298,7 +298,7 @@ class GisMultiLineString extends GisGeometry
mb_strlen($spatial) - 19
);
// Separate each linestring
$linestirngs = explode("),(", $multilinestirng);
$linestirngs = explode('),(', $multilinestirng);
$row .= 'vectorLayer.addFeatures(new OpenLayers.Feature.Vector('
. 'new OpenLayers.Geometry.MultiLineString('
@ -428,7 +428,7 @@ class GisMultiLineString extends GisGeometry
mb_strlen($wkt) - 19
);
// Separate each linestring
$linestirngs = explode("),(", $multilinestirng);
$linestirngs = explode('),(', $multilinestirng);
$params[$index]['MULTILINESTRING']['no_of_lines'] = count($linestirngs);
$j = 0;

View File

@ -64,15 +64,15 @@ class GisMultiPolygon extends GisGeometry
mb_strlen($spatial) - 18
);
// Separate each polygon
$polygons = explode(")),((", $multipolygon);
$polygons = explode(')),((', $multipolygon);
foreach ($polygons as $polygon) {
// If the polygon doesn't have an inner ring, use polygon itself
if (mb_strpos($polygon, "),(") === false) {
if (mb_strpos($polygon, '),(') === false) {
$ring = $polygon;
} else {
// Separate outer ring and use it to determine min-max
$parts = explode("),(", $polygon);
$parts = explode('),(', $polygon);
$ring = $parts[0];
}
$min_max = $this->setMinMax($ring, $min_max);
@ -115,17 +115,17 @@ class GisMultiPolygon extends GisGeometry
mb_strlen($spatial) - 18
);
// Separate each polygon
$polygons = explode(")),((", $multipolygon);
$polygons = explode(')),((', $multipolygon);
$first_poly = true;
$points_arr = [];
foreach ($polygons as $polygon) {
// If the polygon doesn't have an inner polygon
if (mb_strpos($polygon, "),(") === false) {
if (mb_strpos($polygon, '),(') === false) {
$points_arr = $this->extractPoints($polygon, $scale_data, true);
} else {
// Separate outer and inner polygons
$parts = explode("),(", $polygon);
$parts = explode('),(', $polygon);
$outer = $parts[0];
$inner = array_slice($parts, 1);
@ -196,16 +196,16 @@ class GisMultiPolygon extends GisGeometry
mb_strlen($spatial) - 18
);
// Separate each polygon
$polygons = explode(")),((", $multipolygon);
$polygons = explode(')),((', $multipolygon);
$first_poly = true;
foreach ($polygons as $polygon) {
// If the polygon doesn't have an inner polygon
if (mb_strpos($polygon, "),(") === false) {
if (mb_strpos($polygon, '),(') === false) {
$points_arr = $this->extractPoints($polygon, $scale_data, true);
} else {
// Separate outer and inner polygons
$parts = explode("),(", $polygon);
$parts = explode('),(', $polygon);
$outer = $parts[0];
$inner = array_slice($parts, 1);
@ -273,17 +273,17 @@ class GisMultiPolygon extends GisGeometry
mb_strlen($spatial) - 18
);
// Separate each polygon
$polygons = explode(")),((", $multipolygon);
$polygons = explode(')),((', $multipolygon);
foreach ($polygons as $polygon) {
$row .= '<path d="';
// If the polygon doesn't have an inner polygon
if (mb_strpos($polygon, "),(") === false) {
if (mb_strpos($polygon, '),(') === false) {
$row .= $this->_drawPath($polygon, $scale_data);
} else {
// Separate outer and inner polygons
$parts = explode("),(", $polygon);
$parts = explode('),(', $polygon);
$outer = $parts[0];
$inner = array_slice($parts, 1);
@ -340,7 +340,7 @@ class GisMultiPolygon extends GisGeometry
mb_strlen($spatial) - 18
);
// Separate each polygon
$polygons = explode(")),((", $multipolygon);
$polygons = explode(')),((', $multipolygon);
$row .= 'vectorLayer.addFeatures(new OpenLayers.Feature.Vector('
. 'new OpenLayers.Geometry.MultiPolygon('
@ -575,7 +575,7 @@ class GisMultiPolygon extends GisGeometry
mb_strlen($wkt) - 18
);
// Separate each polygon
$polygons = explode(")),((", $multipolygon);
$polygons = explode(')),((', $multipolygon);
$param_row =& $params[$index]['MULTIPOLYGON'];
$param_row['no_of_polygons'] = count($polygons);
@ -583,7 +583,7 @@ class GisMultiPolygon extends GisGeometry
$k = 0;
foreach ($polygons as $polygon) {
// If the polygon doesn't have an inner polygon
if (mb_strpos($polygon, "),(") === false) {
if (mb_strpos($polygon, '),(') === false) {
$param_row[$k]['no_of_lines'] = 1;
$points_arr = $this->extractPoints($polygon, null);
$no_of_points = count($points_arr);
@ -594,7 +594,7 @@ class GisMultiPolygon extends GisGeometry
}
} else {
// Separate outer and inner polygons
$parts = explode("),(", $polygon);
$parts = explode('),(', $polygon);
$param_row[$k]['no_of_lines'] = count($parts);
$j = 0;
foreach ($parts as $ring) {

View File

@ -62,11 +62,11 @@ class GisPolygon extends GisGeometry
);
// If the polygon doesn't have an inner ring, use polygon itself
if (mb_strpos($polygon, "),(") === false) {
if (mb_strpos($polygon, '),(') === false) {
$ring = $polygon;
} else {
// Separate outer ring and use it to determine min-max
$parts = explode("),(", $polygon);
$parts = explode('),(', $polygon);
$ring = $parts[0];
}
@ -107,11 +107,11 @@ class GisPolygon extends GisGeometry
);
// If the polygon doesn't have an inner polygon
if (mb_strpos($polygon, "),(") === false) {
if (mb_strpos($polygon, '),(') === false) {
$points_arr = $this->extractPoints($polygon, $scale_data, true);
} else {
// Separate outer and inner polygons
$parts = explode("),(", $polygon);
$parts = explode('),(', $polygon);
$outer = $parts[0];
$inner = array_slice($parts, 1);
@ -174,11 +174,11 @@ class GisPolygon extends GisGeometry
);
// If the polygon doesn't have an inner polygon
if (mb_strpos($polygon, "),(") === false) {
if (mb_strpos($polygon, '),(') === false) {
$points_arr = $this->extractPoints($polygon, $scale_data, true);
} else {
// Separate outer and inner polygons
$parts = explode("),(", $polygon);
$parts = explode('),(', $polygon);
$outer = $parts[0];
$inner = array_slice($parts, 1);
@ -239,11 +239,11 @@ class GisPolygon extends GisGeometry
$row = '<path d="';
// If the polygon doesn't have an inner polygon
if (mb_strpos($polygon, "),(") === false) {
if (mb_strpos($polygon, '),(') === false) {
$row .= $this->_drawPath($polygon, $scale_data);
} else {
// Separate outer and inner polygons
$parts = explode("),(", $polygon);
$parts = explode('),(', $polygon);
$outer = $parts[0];
$inner = array_slice($parts, 1);
@ -301,7 +301,7 @@ class GisPolygon extends GisGeometry
);
// Separate outer and inner polygons
$parts = explode("),(", $polygon);
$parts = explode('),(', $polygon);
$row .= 'vectorLayer.addFeatures(new OpenLayers.Feature.Vector('
. $this->getPolygonForOpenLayers($parts, $srid)
. ', null, ' . json_encode($style_options) . '));';
@ -597,7 +597,7 @@ class GisPolygon extends GisGeometry
mb_strlen($wkt) - 11
);
// Separate each linestring
$linerings = explode("),(", $polygon);
$linerings = explode('),(', $polygon);
$params[$index]['POLYGON']['no_of_lines'] = count($linerings);
$j = 0;

View File

@ -268,7 +268,7 @@ class GisVisualization
$extension_start_pos,
mb_strlen($file_name)
);
$required_extension = "." . $ext;
$required_extension = '.' . $ext;
if (mb_strtolower($user_extension) != $required_extension) {
$file_name .= $required_extension;
}

View File

@ -563,25 +563,25 @@ class Header
. "style-src 'self' 'unsafe-inline' "
. $captcha_url
. $GLOBALS['cfg']['CSPAllow']
. ";"
. ';'
. "img-src 'self' data: "
. $GLOBALS['cfg']['CSPAllow']
. $map_tile_urls
. $captcha_url
. ";"
. ';'
. "object-src 'none';"
);
header(
"X-Content-Security-Policy: default-src 'self' "
. $captcha_url
. $GLOBALS['cfg']['CSPAllow'] . ';'
. "options inline-script eval-script;"
. "referrer no-referrer;"
. 'options inline-script eval-script;'
. 'referrer no-referrer;'
. "img-src 'self' data: "
. $GLOBALS['cfg']['CSPAllow']
. $map_tile_urls
. $captcha_url
. ";"
. ';'
. "object-src 'none';"
);
header(
@ -592,7 +592,7 @@ class Header
. $captcha_url
. $GLOBALS['cfg']['CSPAllow']
. " 'unsafe-inline' 'unsafe-eval';"
. "referrer no-referrer;"
. 'referrer no-referrer;'
. "style-src 'self' 'unsafe-inline' "
. $captcha_url
. ';'
@ -600,7 +600,7 @@ class Header
. $GLOBALS['cfg']['CSPAllow']
. $map_tile_urls
. $captcha_url
. ";"
. ';'
. "object-src 'none';"
);
// Re-enable possible disabled XSS filters
@ -698,6 +698,6 @@ class Header
*/
public static function getVersionParameter(): string
{
return "v=" . urlencode(PMA_VERSION);
return 'v=' . urlencode(PMA_VERSION);
}
}

View File

@ -351,7 +351,7 @@ class Generator
{
$template = new Template();
// Do the logic first
$link = "$action&amp;" . urlencode($select_name) . '=';
$link = $action . '&amp;' . urlencode($select_name) . '=';
$link_on = $link . urlencode($options[1]['value']);
$link_off = $link . urlencode($options[0]['value']);
@ -1021,7 +1021,7 @@ class Generator
public static function showDocumentationLink($link, $target = 'documentation', $bbcode = false): string
{
if ($bbcode) {
return "[a@$link@$target][dochelpicon][/a]";
return '[a@' . $link . '@' . $target . '][dochelpicon][/a]';
}
return '<a href="' . $link . '" target="' . $target . '">'
@ -1257,16 +1257,16 @@ class Generator
$alternate = htmlspecialchars($alternate);
if (isset($attributes['class'])) {
$attributes['class'] = "icon ic_$image " . $attributes['class'];
$attributes['class'] = 'icon ic_' . $image . ' ' . $attributes['class'];
} else {
$attributes['class'] = "icon ic_$image";
$attributes['class'] = 'icon ic_' . $image;
}
// set all other attributes
$attr_str = '';
foreach ($attributes as $key => $value) {
if (! in_array($key, ['alt', 'title'])) {
$attr_str .= " $key=\"$value\"";
$attr_str .= ' ' . $key . '="' . $value . '"';
}
}

View File

@ -96,7 +96,7 @@ class Import
// USE query changes the database, son need to track
// while running multiple queries
$is_use_query = mb_stripos($sql, "use ") !== false;
$is_use_query = mb_stripos($sql, 'use ') !== false;
$msg = '# ';
if ($result === false) { // execution failed
@ -451,7 +451,7 @@ class Import
public function getColumnAlphaName(int $num): string
{
$A = 65; // ASCII value for capital "A"
$col_name = "";
$col_name = '';
if ($num > 26) {
$div = (int) ($num / 26);
@ -535,7 +535,7 @@ class Import
return (int) substr(
$last_cumulative_size,
0,
strpos($last_cumulative_size, ",")
strpos($last_cumulative_size, ',')
);
}
@ -552,8 +552,8 @@ class Import
{
return (int) substr(
$last_cumulative_size,
strpos($last_cumulative_size, ",") + 1,
strlen($last_cumulative_size) - strpos($last_cumulative_size, ",")
strpos($last_cumulative_size, ',') + 1,
strlen($last_cumulative_size) - strpos($last_cumulative_size, ',')
);
}
@ -569,7 +569,7 @@ class Import
public function getDecimalSize(string $cell): array
{
$curr_size = mb_strlen($cell);
$decPos = mb_strpos($cell, ".");
$decPos = mb_strpos($cell, '.');
$decPrecision = ($curr_size - 1) - $decPos;
$m = $curr_size - 1;
@ -578,7 +578,7 @@ class Import
return [
$m,
$d,
$m . "," . $d,
$m . ',' . $d,
];
}
@ -687,7 +687,7 @@ class Import
if ($size[self::M] > $oldM || $size[self::D] > $oldD) {
/* Take the largest of both types */
return (string) ((($size[self::M] > $oldM) ? $size[self::M] : $oldM)
. "," . (($size[self::D] > $oldD) ? $size[self::D] : $oldD));
. ',' . (($size[self::D] > $oldD) ? $size[self::D] : $oldD));
}
return $last_cumulative_size;
@ -702,7 +702,7 @@ class Import
return $size[self::FULL];
}
return ($last_cumulative_size . "," . $size[self::D]);
return ($last_cumulative_size . ',' . $size[self::D]);
} elseif (! isset($last_cumulative_type) || $last_cumulative_type == self::NONE) {
/**
* This is the first row to be analyzed
@ -750,7 +750,7 @@ class Import
}
/* Use $newInt + $oldD as new M */
return (($newInt + $oldD) . "," . $oldD);
return (($newInt + $oldD) . ',' . $oldD);
} elseif ($last_cumulative_type == self::BIGINT || $last_cumulative_type == self::INT) {
/**
* The last cumulative type was BIGINT or INT
@ -819,8 +819,8 @@ class Import
}
if ($cell == (string) (float) $cell
&& mb_strpos($cell, ".") !== false
&& mb_substr_count($cell, ".") === 1
&& mb_strpos($cell, '.') !== false
&& mb_substr_count($cell, '.') === 1
) {
return self::DECIMAL;
}
@ -968,13 +968,13 @@ class Import
if (isset($options['db_collation']) && $options['db_collation'] !== null) {
$collation = $options['db_collation'];
} else {
$collation = "utf8_general_ci";
$collation = 'utf8_general_ci';
}
if (isset($options['db_charset']) && $options['db_charset'] !== null) {
$charset = $options['db_charset'];
} else {
$charset = "utf8";
$charset = 'utf8';
}
if (isset($options['create_db'])) {
@ -987,9 +987,9 @@ class Import
$sql = [];
if ($create_db) {
$sql[] = "CREATE DATABASE IF NOT EXISTS " . Util::backquote($db_name)
. " DEFAULT CHARACTER SET " . $charset . " COLLATE " . $collation
. ";";
$sql[] = 'CREATE DATABASE IF NOT EXISTS ' . Util::backquote($db_name)
. ' DEFAULT CHARACTER SET ' . $charset . ' COLLATE ' . $collation
. ';';
}
/**
@ -1043,11 +1043,11 @@ class Import
if ($analyses != null) {
$type_array = [
self::NONE => "NULL",
self::VARCHAR => "varchar",
self::INT => "int",
self::DECIMAL => "decimal",
self::BIGINT => "bigint",
self::NONE => 'NULL',
self::VARCHAR => 'varchar',
self::INT => 'int',
self::DECIMAL => 'decimal',
self::BIGINT => 'bigint',
self::GEOMETRY => 'geometry',
];
@ -1060,9 +1060,9 @@ class Import
$num_tables = count($tables);
for ($i = 0; $i < $num_tables; ++$i) {
$num_cols = count($tables[$i][self::COL_NAMES]);
$tempSQLStr = "CREATE TABLE IF NOT EXISTS "
$tempSQLStr = 'CREATE TABLE IF NOT EXISTS '
. Util::backquote($db_name)
. '.' . Util::backquote($tables[$i][self::TBL_NAME]) . " (";
. '.' . Util::backquote($tables[$i][self::TBL_NAME]) . ' (';
for ($j = 0; $j < $num_cols; ++$j) {
$size = $analyses[$i][self::SIZES][$j];
if ((int) $size == 0) {
@ -1071,18 +1071,18 @@ class Import
$tempSQLStr .= Util::backquote(
$tables[$i][self::COL_NAMES][$j]
) . " "
) . ' '
. $type_array[$analyses[$i][self::TYPES][$j]];
if ($analyses[$i][self::TYPES][$j] != self::GEOMETRY) {
$tempSQLStr .= "(" . $size . ")";
$tempSQLStr .= '(' . $size . ')';
}
if ($j != (count($tables[$i][self::COL_NAMES]) - 1)) {
$tempSQLStr .= ", ";
$tempSQLStr .= ', ';
}
}
$tempSQLStr .= ") DEFAULT CHARACTER SET " . $charset
. " COLLATE " . $collation . ";";
$tempSQLStr .= ') DEFAULT CHARACTER SET ' . $charset
. ' COLLATE ' . $collation . ';';
/**
* Each SQL statement is executed immediately
@ -1098,28 +1098,28 @@ class Import
*
* Only one insert query is formed for each table
*/
$tempSQLStr = "";
$tempSQLStr = '';
$col_count = 0;
$num_tables = count($tables);
for ($i = 0; $i < $num_tables; ++$i) {
$num_cols = count($tables[$i][self::COL_NAMES]);
$num_rows = count($tables[$i][self::ROWS]);
$tempSQLStr = "INSERT INTO " . Util::backquote($db_name) . '.'
. Util::backquote($tables[$i][self::TBL_NAME]) . " (";
$tempSQLStr = 'INSERT INTO ' . Util::backquote($db_name) . '.'
. Util::backquote($tables[$i][self::TBL_NAME]) . ' (';
for ($m = 0; $m < $num_cols; ++$m) {
$tempSQLStr .= Util::backquote($tables[$i][self::COL_NAMES][$m]);
if ($m != ($num_cols - 1)) {
$tempSQLStr .= ", ";
$tempSQLStr .= ', ';
}
}
$tempSQLStr .= ") VALUES ";
$tempSQLStr .= ') VALUES ';
for ($j = 0; $j < $num_rows; ++$j) {
$tempSQLStr .= "(";
$tempSQLStr .= '(';
for ($k = 0; $k < $num_cols; ++$k) {
// If fully formatted SQL, no need to enclose
@ -1141,15 +1141,15 @@ class Import
$is_varchar = false;
}
$tempSQLStr .= $is_varchar ? "'" : "";
$tempSQLStr .= $is_varchar ? "'" : '';
$tempSQLStr .= $GLOBALS['dbi']->escapeString(
(string) $tables[$i][self::ROWS][$j][$k]
);
$tempSQLStr .= $is_varchar ? "'" : "";
$tempSQLStr .= $is_varchar ? "'" : '';
}
if ($k != ($num_cols - 1)) {
$tempSQLStr .= ", ";
$tempSQLStr .= ', ';
}
if ($col_count == ($num_cols - 1)) {
@ -1162,7 +1162,7 @@ class Import
unset($tables[$i][self::ROWS][$j][$k]);
}
$tempSQLStr .= ")";
$tempSQLStr .= ')';
if ($j != ($num_rows - 1)) {
$tempSQLStr .= ",\n ";
@ -1173,7 +1173,7 @@ class Import
unset($tables[$i][self::ROWS][$j]);
}
$tempSQLStr .= ";";
$tempSQLStr .= ';';
/**
* Each SQL statement is executed immediately

View File

@ -531,16 +531,16 @@ class Index
*/
public function generateIndexTypeSelector()
{
$types = ["" => "--"];
$types = ['' => '--'];
foreach (Index::getIndexTypes() as $type) {
$types[$type] = $type;
}
return Html\Forms\Fields\DropDown::generate(
"index[Index_type]",
'index[Index_type]',
$types,
$this->_type,
"select_index_type"
'select_index_type'
);
}
@ -685,7 +685,7 @@ class Index
$indexes = Index::getFromTable($table, $schema);
$no_indexes_class = count($indexes) > 0 ? ' hide' : '';
$no_indexes = "<div class='no_indexes_defined$no_indexes_class'>";
$no_indexes = "<div class='no_indexes_defined" . $no_indexes_class . "'>";
$no_indexes .= Message::notice(__('No index defined!'))->getDisplay();
$no_indexes .= '</div>';

View File

@ -2020,7 +2020,7 @@ class InsertEdit
} elseif ((substr($column['True_Type'], 0, 9) == 'timestamp'
|| $column['True_Type'] == 'datetime'
|| $column['True_Type'] == 'time')
&& (mb_strpos($current_row[$column['Field']], ".") !== false)
&& (mb_strpos($current_row[$column['Field']], '.') !== false)
) {
$current_row[$column['Field']] = $as_is
? $current_row[$column['Field']]
@ -2613,12 +2613,12 @@ class InsertEdit
&& in_array($multi_edit_funcs[$key], $func_optional_param))
) {
if ((isset($multi_edit_salt[$key])
&& ($multi_edit_funcs[$key] == "AES_ENCRYPT"
|| $multi_edit_funcs[$key] == "AES_DECRYPT"))
&& ($multi_edit_funcs[$key] == 'AES_ENCRYPT'
|| $multi_edit_funcs[$key] == 'AES_DECRYPT'))
|| (! empty($multi_edit_salt[$key])
&& ($multi_edit_funcs[$key] == "DES_ENCRYPT"
|| $multi_edit_funcs[$key] == "DES_DECRYPT"
|| $multi_edit_funcs[$key] == "ENCRYPT"))
&& ($multi_edit_funcs[$key] == 'DES_ENCRYPT'
|| $multi_edit_funcs[$key] == 'DES_DECRYPT'
|| $multi_edit_funcs[$key] == 'ENCRYPT'))
) {
return $multi_edit_funcs[$key] . '(' . $current_value . ",'"
. $this->dbi->escapeString($multi_edit_salt[$key]) . "')";
@ -3319,7 +3319,7 @@ class InsertEdit
//add data attributes "no of decimals" and "data type"
$no_decimals = 0;
$type = current(explode("(", $column['pma_type']));
$type = current(explode('(', $column['pma_type']));
if (preg_match('/\(([^()]+)\)/', $column['pma_type'], $match)) {
$match[0] = trim($match[0], '()');
$no_decimals = $match[0];

View File

@ -230,7 +230,7 @@ class IpAllowDeny
*/
public function allow()
{
return $this->allowDeny("allow");
return $this->allowDeny('allow');
}
/**
@ -244,7 +244,7 @@ class IpAllowDeny
*/
public function deny()
{
return $this->allowDeny("deny");
return $this->allowDeny('deny');
}
/**

View File

@ -710,8 +710,8 @@ class LanguageManager
$path = LOCALE_PATH
. '/' . $file
. '/LC_MESSAGES/phpmyadmin.mo';
if ($file != "."
&& $file != ".."
if ($file != '.'
&& $file != '..'
&& @file_exists($path)
) {
$result[] = $file;

View File

@ -66,15 +66,15 @@ class ListDatabase extends ListAbstract
protected function retrieve($like_db_name = null)
{
$database_list = [];
$command = "";
$command = '';
if (! $GLOBALS['cfg']['Server']['DisableIS']) {
$command .= "SELECT `SCHEMA_NAME` FROM `INFORMATION_SCHEMA`.`SCHEMATA`";
$command .= 'SELECT `SCHEMA_NAME` FROM `INFORMATION_SCHEMA`.`SCHEMATA`';
if (null !== $like_db_name) {
$command .= " WHERE `SCHEMA_NAME` LIKE '" . $like_db_name . "'";
}
} else {
if ($GLOBALS['dbs_to_test'] === false || null !== $like_db_name) {
$command .= "SHOW DATABASES";
$command .= 'SHOW DATABASES';
if (null !== $like_db_name) {
$command .= " LIKE '" . $like_db_name . "'";
}

View File

@ -142,15 +142,15 @@ class Menu
$cfgRelation = $this->relation->getRelationsParam();
if ($cfgRelation['menuswork']) {
$groupTable = Util::backquote($cfgRelation['db'])
. "."
. '.'
. Util::backquote($cfgRelation['usergroups']);
$userTable = Util::backquote($cfgRelation['db'])
. "." . Util::backquote($cfgRelation['users']);
. '.' . Util::backquote($cfgRelation['users']);
$sql_query = "SELECT `tab` FROM " . $groupTable
$sql_query = 'SELECT `tab` FROM ' . $groupTable
. " WHERE `allowed` = 'N'"
. " AND `tab` LIKE '" . $level . "%'"
. " AND `usergroup` = (SELECT usergroup FROM "
. ' AND `usergroup` = (SELECT usergroup FROM '
. $userTable . " WHERE `username` = '"
. $GLOBALS['dbi']->escapeString($GLOBALS['cfg']['Server']['user']) . "')";

View File

@ -817,7 +817,7 @@ class Message
} else {
$image = 's_notice';
}
$message = self::notice(Html\Generator::getImage($image)) . " " . $message;
$message = self::notice(Html\Generator::getImage($image)) . ' ' . $message;
return $message;
}
}

View File

@ -154,15 +154,15 @@ class Navigation
$tableName = null
) {
$navTable = Util::backquote($GLOBALS['cfgRelation']['db'])
. "." . Util::backquote($GLOBALS['cfgRelation']['navigationhiding']);
$sqlQuery = "INSERT INTO " . $navTable
. "(`username`, `item_name`, `item_type`, `db_name`, `table_name`)"
. " VALUES ("
. '.' . Util::backquote($GLOBALS['cfgRelation']['navigationhiding']);
$sqlQuery = 'INSERT INTO ' . $navTable
. '(`username`, `item_name`, `item_type`, `db_name`, `table_name`)'
. ' VALUES ('
. "'" . $this->dbi->escapeString($GLOBALS['cfg']['Server']['user']) . "',"
. "'" . $this->dbi->escapeString($itemName) . "',"
. "'" . $this->dbi->escapeString($itemType) . "',"
. "'" . $this->dbi->escapeString($dbName) . "',"
. "'" . (! empty($tableName) ? $this->dbi->escapeString($tableName) : "" )
. "'" . (! empty($tableName) ? $this->dbi->escapeString($tableName) : '' )
. "')";
$this->relation->queryAsControlUser($sqlQuery, false);
}
@ -185,9 +185,9 @@ class Navigation
$tableName = null
) {
$navTable = Util::backquote($GLOBALS['cfgRelation']['db'])
. "." . Util::backquote($GLOBALS['cfgRelation']['navigationhiding']);
$sqlQuery = "DELETE FROM " . $navTable
. " WHERE"
. '.' . Util::backquote($GLOBALS['cfgRelation']['navigationhiding']);
$sqlQuery = 'DELETE FROM ' . $navTable
. ' WHERE'
. " `username`='"
. $this->dbi->escapeString($GLOBALS['cfg']['Server']['user']) . "'"
. " AND `item_name`='" . $this->dbi->escapeString($itemName) . "'"
@ -195,7 +195,7 @@ class Navigation
. " AND `db_name`='" . $this->dbi->escapeString($dbName) . "'"
. (! empty($tableName)
? " AND `table_name`='" . $this->dbi->escapeString($tableName) . "'"
: ""
: ''
);
$this->relation->queryAsControlUser($sqlQuery, false);
}
@ -239,8 +239,8 @@ class Navigation
private function getHiddenItems(string $database, ?string $table): array
{
$navTable = Util::backquote($GLOBALS['cfgRelation']['db'])
. "." . Util::backquote($GLOBALS['cfgRelation']['navigationhiding']);
$sqlQuery = "SELECT `item_name`, `item_type` FROM " . $navTable
. '.' . Util::backquote($GLOBALS['cfgRelation']['navigationhiding']);
$sqlQuery = 'SELECT `item_name`, `item_type` FROM ' . $navTable
. " WHERE `username`='"
. $this->dbi->escapeString($GLOBALS['cfg']['Server']['user']) . "'"
. " AND `db_name`='" . $this->dbi->escapeString($database) . "'"

View File

@ -200,14 +200,14 @@ class NavigationTree
$dbSeparator = $this->dbi->escapeString(
$GLOBALS['cfg']['NavigationTreeDbSeparator']
);
$query = "SELECT (COUNT(DB_first_level) DIV %d) * %d ";
$query .= "from ( ";
$query .= " SELECT distinct SUBSTRING_INDEX(SCHEMA_NAME, ";
$query = 'SELECT (COUNT(DB_first_level) DIV %d) * %d ';
$query .= 'from ( ';
$query .= ' SELECT distinct SUBSTRING_INDEX(SCHEMA_NAME, ';
$query .= " '%s', 1) ";
$query .= " DB_first_level ";
$query .= " FROM INFORMATION_SCHEMA.SCHEMATA ";
$query .= ' DB_first_level ';
$query .= ' FROM INFORMATION_SCHEMA.SCHEMATA ';
$query .= " WHERE `SCHEMA_NAME` < '%s' ";
$query .= ") t ";
$query .= ') t ';
$retval = $this->dbi->fetchValue(
sprintf(
@ -224,7 +224,7 @@ class NavigationTree
$prefixMap = [];
if ($GLOBALS['dbs_to_test'] === false) {
$handle = $this->dbi->tryQuery("SHOW DATABASES");
$handle = $this->dbi->tryQuery('SHOW DATABASES');
if ($handle !== false) {
while ($arr = $this->dbi->fetchArray($handle)) {
if (strcasecmp($arr[0], $GLOBALS['db']) >= 0) {
@ -854,7 +854,7 @@ class NavigationTree
}
foreach ($prefixes as $key => $value) {
$this->groupNode($groups[$key]);
$groups[$key]->classes = "navGroup";
$groups[$key]->classes = 'navGroup';
}
}
}
@ -997,18 +997,18 @@ class NavigationTree
if (isset($paths['aPath_clean'][2])) {
$retval .= "<span class='hide pos2_name'>";
$retval .= $paths['aPath_clean'][2];
$retval .= "</span>";
$retval .= '</span>';
$retval .= "<span class='hide pos2_value'>";
$retval .= htmlspecialchars((string) $node->pos2);
$retval .= "</span>";
$retval .= '</span>';
}
if (isset($paths['aPath_clean'][4])) {
$retval .= "<span class='hide pos3_name'>";
$retval .= $paths['aPath_clean'][4];
$retval .= "</span>";
$retval .= '</span>';
$retval .= "<span class='hide pos3_value'>";
$retval .= htmlspecialchars((string) $node->pos3);
$retval .= "</span>";
$retval .= '</span>';
}
return $retval;
@ -1089,9 +1089,9 @@ class NavigationTree
if ($class == 'first') {
$iClass = " class='first'";
}
$retval .= "<i$iClass></i>";
$retval .= '<i' . $iClass . '></i>';
if (strpos($class, 'last') === false) {
$retval .= "<b></b>";
$retval .= '<b></b>';
}
$match = $this->findTreeMatch(
@ -1103,13 +1103,13 @@ class NavigationTree
$retval .= " href='#'>";
$retval .= "<span class='hide aPath'>";
$retval .= $paths['aPath'];
$retval .= "</span>";
$retval .= '</span>';
$retval .= "<span class='hide vPath'>";
$retval .= $paths['vPath'];
$retval .= "</span>";
$retval .= '</span>';
$retval .= "<span class='hide pos'>";
$retval .= $this->pos;
$retval .= "</span>";
$retval .= '</span>';
$retval .= $this->getPaginationParamsHtml($node);
if ($GLOBALS['cfg']['ShowDatabasesNavigationAsTree']
|| $parentName != 'root'
@ -1117,17 +1117,17 @@ class NavigationTree
$retval .= $node->getIcon($match);
}
$retval .= "</a>";
$retval .= "</div>";
$retval .= '</a>';
$retval .= '</div>';
} else {
$retval .= "<div class='block'>";
$iClass = '';
if ($class == 'first') {
$iClass = " class='first'";
}
$retval .= "<i$iClass></i>";
$retval .= '<i' . $iClass . '></i>';
$retval .= $this->getPaginationParamsHtml($node);
$retval .= "</div>";
$retval .= '</div>';
}
$linkClass = '';
@ -1147,7 +1147,7 @@ class NavigationTree
}
if ($node->type == Node::CONTAINER) {
$retval .= "<i>";
$retval .= '<i>';
}
$divClass = '';
@ -1178,16 +1178,16 @@ class NavigationTree
foreach ($icons as $key => $icon) {
$link = vsprintf($iconLinks[$key], $args);
if ($linkClass != '') {
$retval .= "<a class='$linkClass' href='$link'>";
$retval .= "{$icon}</a>";
$retval .= "<a class='" . $linkClass . "' href='" . $link . "'>";
$retval .= '' . $icon . '</a>';
} else {
$retval .= "<a href='$link'>{$icon}</a>";
$retval .= "<a href='" . $link . "'>" . $icon . '</a>';
}
}
} else {
$retval .= "<u>{$node->icon}</u>";
$retval .= '<u>' . $node->icon . '</u>';
}
$retval .= "</div>";
$retval .= '</div>';
if (isset($node->links['text'])) {
$args = [];
@ -1197,21 +1197,21 @@ class NavigationTree
$link = vsprintf($node->links['text'], $args);
$title = isset($node->links['title']) ? $node->links['title'] : '';
if ($node->type == Node::CONTAINER) {
$retval .= "&nbsp;<a class='hover_show_full' href='$link'>";
$retval .= "&nbsp;<a class='hover_show_full' href='" . $link . "'>";
$retval .= htmlspecialchars($node->name);
$retval .= "</a>";
$retval .= '</a>';
} else {
$retval .= "<a class='hover_show_full$linkClass' href='$link'";
$retval .= " title='$title'>";
$retval .= "<a class='hover_show_full" . $linkClass . "' href='" . $link . "'";
$retval .= " title='" . $title . "'>";
$retval .= htmlspecialchars($node->displayName ?? $node->realName);
$retval .= "</a>";
$retval .= '</a>';
}
} else {
$retval .= "&nbsp;{$node->name}";
$retval .= '&nbsp;' . $node->name . '';
}
$retval .= $node->getHtmlForControlButtons();
if ($node->type == Node::CONTAINER) {
$retval .= "</i>";
$retval .= '</i>';
}
$retval .= '<div class="clearfloat"></div>';
$wrap = true;
@ -1248,18 +1248,18 @@ class NavigationTree
}
if (! empty($buffer)) {
if ($wrap) {
$retval .= "<div$hide class='list_container'><ul>";
$retval .= '<div' . $hide . " class='list_container'><ul>";
}
$retval .= $this->fastFilterHtml($node);
$retval .= $this->getPageSelector($node);
$retval .= $buffer;
if ($wrap) {
$retval .= "</ul></div>";
$retval .= '</ul></div>';
}
}
}
if ($node->hasSiblings()) {
$retval .= "</li>";
$retval .= '</li>';
}
return $retval;
@ -1388,11 +1388,11 @@ class NavigationTree
$retval .= '<input class="searchClause" type="text"';
$retval .= ' name="searchClause" accesskey="q"';
$retval .= " placeholder='"
. __("Type to filter these, Enter to search all");
. __('Type to filter these, Enter to search all');
$retval .= "'>";
$retval .= '<span title="' . __('Clear fast filter') . '">X</span>';
$retval .= "</form>";
$retval .= "</li>";
$retval .= '</form>';
$retval .= '</li>';
return $retval;
}
@ -1420,10 +1420,10 @@ class NavigationTree
$retval .= "<input class='searchClause' type='text'";
$retval .= " name='searchClause2'";
$retval .= " placeholder='"
. __("Type to filter these, Enter to search all") . "'>";
. __('Type to filter these, Enter to search all') . "'>";
$retval .= "<span title='" . __('Clear fast filter') . "'>X</span>";
$retval .= "</form>";
$retval .= "</li>";
$retval .= '</form>';
$retval .= '</li>';
}
return $retval;

View File

@ -32,12 +32,12 @@ class Node
* @var string A non-unique identifier for the node
* This may be trimmed when grouping nodes
*/
public $name = "";
public $name = '';
/**
* @var string A non-unique identifier for the node
* This will never change after being assigned
*/
public $realName = "";
public $realName = '';
/**
* @var int May be one of CONTAINER or OBJECT
*/
@ -372,11 +372,11 @@ class Node
if (isset($GLOBALS['cfg']['Server']['DisableIS'])
&& ! $GLOBALS['cfg']['Server']['DisableIS']
) {
$query = "SELECT `SCHEMA_NAME` ";
$query .= "FROM `INFORMATION_SCHEMA`.`SCHEMATA` ";
$query = 'SELECT `SCHEMA_NAME` ';
$query .= 'FROM `INFORMATION_SCHEMA`.`SCHEMATA` ';
$query .= $this->getWhereClause('SCHEMA_NAME', $searchClause);
$query .= "ORDER BY `SCHEMA_NAME` ";
$query .= "LIMIT $pos, $maxItems";
$query .= 'ORDER BY `SCHEMA_NAME` ';
$query .= 'LIMIT ' . $pos . ', ' . $maxItems;
$retval = $GLOBALS['dbi']->fetchResult($query);
return $retval;
@ -384,7 +384,7 @@ class Node
if ($GLOBALS['dbs_to_test'] === false) {
$retval = [];
$query = "SHOW DATABASES ";
$query = 'SHOW DATABASES ';
$query .= $this->getWhereClause('Database', $searchClause);
$handle = $GLOBALS['dbi']->tryQuery($query);
if ($handle === false) {
@ -441,33 +441,33 @@ class Node
if (isset($GLOBALS['cfg']['Server']['DisableIS'])
&& ! $GLOBALS['cfg']['Server']['DisableIS']
) {
$query = "SELECT `SCHEMA_NAME` ";
$query .= "FROM `INFORMATION_SCHEMA`.`SCHEMATA`, ";
$query .= "(";
$query .= "SELECT DB_first_level ";
$query .= "FROM ( ";
$query .= "SELECT DISTINCT SUBSTRING_INDEX(SCHEMA_NAME, ";
$query = 'SELECT `SCHEMA_NAME` ';
$query .= 'FROM `INFORMATION_SCHEMA`.`SCHEMATA`, ';
$query .= '(';
$query .= 'SELECT DB_first_level ';
$query .= 'FROM ( ';
$query .= 'SELECT DISTINCT SUBSTRING_INDEX(SCHEMA_NAME, ';
$query .= "'" . $GLOBALS['dbi']->escapeString($dbSeparator) . "', 1) ";
$query .= "DB_first_level ";
$query .= "FROM INFORMATION_SCHEMA.SCHEMATA ";
$query .= 'DB_first_level ';
$query .= 'FROM INFORMATION_SCHEMA.SCHEMATA ';
$query .= $this->getWhereClause('SCHEMA_NAME', $searchClause);
$query .= ") t ";
$query .= "ORDER BY DB_first_level ASC ";
$query .= "LIMIT $pos, $maxItems";
$query .= ") t2 ";
$query .= ') t ';
$query .= 'ORDER BY DB_first_level ASC ';
$query .= 'LIMIT ' . $pos . ', ' . $maxItems;
$query .= ') t2 ';
$query .= $this->getWhereClause('SCHEMA_NAME', $searchClause);
$query .= "AND 1 = LOCATE(CONCAT(DB_first_level, ";
$query .= 'AND 1 = LOCATE(CONCAT(DB_first_level, ';
$query .= "'" . $GLOBALS['dbi']->escapeString($dbSeparator) . "'), ";
$query .= "CONCAT(SCHEMA_NAME, ";
$query .= 'CONCAT(SCHEMA_NAME, ';
$query .= "'" . $GLOBALS['dbi']->escapeString($dbSeparator) . "')) ";
$query .= "ORDER BY SCHEMA_NAME ASC";
$query .= 'ORDER BY SCHEMA_NAME ASC';
$retval = $GLOBALS['dbi']->fetchResult($query);
return $retval;
}
if ($GLOBALS['dbs_to_test'] === false) {
$query = "SHOW DATABASES ";
$query = 'SHOW DATABASES ';
$query .= $this->getWhereClause('Database', $searchClause);
$handle = $GLOBALS['dbi']->tryQuery($query);
$prefixes = [];
@ -487,9 +487,9 @@ class Node
$prefixes = array_slice(array_keys($prefixMap), (int) $pos);
}
$query = "SHOW DATABASES ";
$query = 'SHOW DATABASES ';
$query .= $this->getWhereClause('Database', $searchClause);
$query .= "AND (";
$query .= 'AND (';
$subClauses = [];
foreach ($prefixes as $prefix) {
$subClauses[] = " LOCATE('"
@ -497,7 +497,7 @@ class Node
. "', "
. "CONCAT(`Database`, '" . $dbSeparator . "')) = 1 ";
}
$query .= implode("OR", $subClauses) . ")";
$query .= implode('OR', $subClauses) . ')';
$retval = $GLOBALS['dbi']->fetchResult($query);
return $retval;
@ -579,8 +579,8 @@ class Node
if (isset($GLOBALS['cfg']['Server']['DisableIS'])
&& ! $GLOBALS['cfg']['Server']['DisableIS']
) {
$query = "SELECT COUNT(*) ";
$query .= "FROM INFORMATION_SCHEMA.SCHEMATA ";
$query = 'SELECT COUNT(*) ';
$query .= 'FROM INFORMATION_SCHEMA.SCHEMATA ';
$query .= $this->getWhereClause('SCHEMA_NAME', $searchClause);
$retval = (int) $GLOBALS['dbi']->fetchValue($query);
@ -588,7 +588,7 @@ class Node
}
if ($GLOBALS['dbs_to_test'] === false) {
$query = "SHOW DATABASES ";
$query = 'SHOW DATABASES ';
$query .= $this->getWhereClause('Database', $searchClause);
$retval = $GLOBALS['dbi']->numRows(
$GLOBALS['dbi']->tryQuery($query)
@ -610,14 +610,14 @@ class Node
$dbSeparator = $GLOBALS['cfg']['NavigationTreeDbSeparator'];
if (! $GLOBALS['cfg']['Server']['DisableIS']) {
$query = "SELECT COUNT(*) ";
$query .= "FROM ( ";
$query .= "SELECT DISTINCT SUBSTRING_INDEX(SCHEMA_NAME, ";
$query .= "'$dbSeparator', 1) ";
$query .= "DB_first_level ";
$query .= "FROM INFORMATION_SCHEMA.SCHEMATA ";
$query = 'SELECT COUNT(*) ';
$query .= 'FROM ( ';
$query .= 'SELECT DISTINCT SUBSTRING_INDEX(SCHEMA_NAME, ';
$query .= "'" . $dbSeparator . "', 1) ";
$query .= 'DB_first_level ';
$query .= 'FROM INFORMATION_SCHEMA.SCHEMATA ';
$query .= $this->getWhereClause('SCHEMA_NAME', $searchClause);
$query .= ") t ";
$query .= ') t ';
$retval = (int) $GLOBALS['dbi']->fetchValue($query);
return $retval;
@ -649,7 +649,7 @@ class Node
}
$prefixMap = [];
$query = "SHOW DATABASES ";
$query = 'SHOW DATABASES ';
$query .= $this->getWhereClause('Database', $searchClause);
$handle = $GLOBALS['dbi']->tryQuery($query);
if ($handle !== false) {
@ -694,7 +694,7 @@ class Node
$databases = [];
if (! empty($searchClause)) {
$databases = [
"%" . $GLOBALS['dbi']->escapeString($searchClause) . "%",
'%' . $GLOBALS['dbi']->escapeString($searchClause) . '%',
];
} elseif (! empty($GLOBALS['cfg']['Server']['only_db'])) {
$databases = $GLOBALS['cfg']['Server']['only_db'];
@ -717,16 +717,16 @@ class Node
*/
private function getWhereClause($columnName, $searchClause = '')
{
$whereClause = "WHERE TRUE ";
$whereClause = 'WHERE TRUE ';
if (! empty($searchClause)) {
$whereClause .= "AND " . Util::backquote($columnName)
$whereClause .= 'AND ' . Util::backquote($columnName)
. " LIKE '%";
$whereClause .= $GLOBALS['dbi']->escapeString($searchClause);
$whereClause .= "%' ";
}
if (! empty($GLOBALS['cfg']['Server']['hide_db'])) {
$whereClause .= "AND " . Util::backquote($columnName)
$whereClause .= 'AND ' . Util::backquote($columnName)
. " NOT REGEXP '"
. $GLOBALS['dbi']->escapeString($GLOBALS['cfg']['Server']['hide_db'])
. "' ";
@ -738,14 +738,14 @@ class Node
$GLOBALS['cfg']['Server']['only_db'],
];
}
$whereClause .= "AND (";
$whereClause .= 'AND (';
$subClauses = [];
foreach ($GLOBALS['cfg']['Server']['only_db'] as $eachOnlyDb) {
$subClauses[] = " " . Util::backquote($columnName)
$subClauses[] = ' ' . Util::backquote($columnName)
. " LIKE '"
. $GLOBALS['dbi']->escapeString($eachOnlyDb) . "' ";
}
$whereClause .= implode("OR", $subClauses) . ") ";
$whereClause .= implode('OR', $subClauses) . ') ';
}
return $whereClause;
@ -818,15 +818,15 @@ class Node
$cfgRelation = $this->relation->getRelationsParam();
if ($cfgRelation['navwork']) {
$navTable = Util::backquote($cfgRelation['db'])
. "." . Util::backquote(
. '.' . Util::backquote(
$cfgRelation['navigationhiding']
);
$sqlQuery = "SELECT `db_name`, COUNT(*) AS `count` FROM " . $navTable
$sqlQuery = 'SELECT `db_name`, COUNT(*) AS `count` FROM ' . $navTable
. " WHERE `username`='"
. $GLOBALS['dbi']->escapeString(
$GLOBALS['cfg']['Server']['user']
) . "'"
. " GROUP BY `db_name`";
. ' GROUP BY `db_name`';
$counts = $GLOBALS['dbi']->fetchResult(
$sqlQuery,
'db_name',

View File

@ -121,12 +121,12 @@ class NodeDatabase extends Node
if (! $GLOBALS['cfg']['Server']['DisableIS']) {
$db = $GLOBALS['dbi']->escapeString($db);
$query = "SELECT COUNT(*) ";
$query .= "FROM `INFORMATION_SCHEMA`.`TABLES` ";
$query .= "WHERE `TABLE_SCHEMA`='$db' ";
$query .= "AND `TABLE_TYPE`" . $condition . "('BASE TABLE', 'SYSTEM VERSIONED') ";
$query = 'SELECT COUNT(*) ';
$query .= 'FROM `INFORMATION_SCHEMA`.`TABLES` ';
$query .= "WHERE `TABLE_SCHEMA`='" . $db . "' ";
$query .= 'AND `TABLE_TYPE`' . $condition . "('BASE TABLE', 'SYSTEM VERSIONED') ";
if (! empty($searchClause)) {
$query .= "AND " . $this->getWhereClauseForSearch(
$query .= 'AND ' . $this->getWhereClauseForSearch(
$searchClause,
$singleItem,
'TABLE_NAME'
@ -134,11 +134,11 @@ class NodeDatabase extends Node
}
$retval = (int) $GLOBALS['dbi']->fetchValue($query);
} else {
$query = "SHOW FULL TABLES FROM ";
$query = 'SHOW FULL TABLES FROM ';
$query .= Util::backquote($db);
$query .= " WHERE `Table_type`" . $condition . "('BASE TABLE', 'SYSTEM VERSIONED') ";
$query .= ' WHERE `Table_type`' . $condition . "('BASE TABLE', 'SYSTEM VERSIONED') ";
if (! empty($searchClause)) {
$query .= "AND " . $this->getWhereClauseForSearch(
$query .= 'AND ' . $this->getWhereClauseForSearch(
$searchClause,
$singleItem,
'Tables_in_' . $db
@ -205,13 +205,13 @@ class NodeDatabase extends Node
$db = $this->realName;
if (! $GLOBALS['cfg']['Server']['DisableIS']) {
$db = $GLOBALS['dbi']->escapeString($db);
$query = "SELECT COUNT(*) ";
$query .= "FROM `INFORMATION_SCHEMA`.`ROUTINES` ";
$query .= "WHERE `ROUTINE_SCHEMA` "
. Util::getCollateForIS() . "='$db'";
$query = 'SELECT COUNT(*) ';
$query .= 'FROM `INFORMATION_SCHEMA`.`ROUTINES` ';
$query .= 'WHERE `ROUTINE_SCHEMA` '
. Util::getCollateForIS() . "='" . $db . "'";
$query .= "AND `ROUTINE_TYPE`='PROCEDURE' ";
if (! empty($searchClause)) {
$query .= "AND " . $this->getWhereClauseForSearch(
$query .= 'AND ' . $this->getWhereClauseForSearch(
$searchClause,
$singleItem,
'ROUTINE_NAME'
@ -220,9 +220,9 @@ class NodeDatabase extends Node
$retval = (int) $GLOBALS['dbi']->fetchValue($query);
} else {
$db = $GLOBALS['dbi']->escapeString($db);
$query = "SHOW PROCEDURE STATUS WHERE `Db`='$db' ";
$query = "SHOW PROCEDURE STATUS WHERE `Db`='" . $db . "' ";
if (! empty($searchClause)) {
$query .= "AND " . $this->getWhereClauseForSearch(
$query .= 'AND ' . $this->getWhereClauseForSearch(
$searchClause,
$singleItem,
'Name'
@ -251,13 +251,13 @@ class NodeDatabase extends Node
$db = $this->realName;
if (! $GLOBALS['cfg']['Server']['DisableIS']) {
$db = $GLOBALS['dbi']->escapeString($db);
$query = "SELECT COUNT(*) ";
$query .= "FROM `INFORMATION_SCHEMA`.`ROUTINES` ";
$query .= "WHERE `ROUTINE_SCHEMA` "
. Util::getCollateForIS() . "='$db' ";
$query = 'SELECT COUNT(*) ';
$query .= 'FROM `INFORMATION_SCHEMA`.`ROUTINES` ';
$query .= 'WHERE `ROUTINE_SCHEMA` '
. Util::getCollateForIS() . "='" . $db . "' ";
$query .= "AND `ROUTINE_TYPE`='FUNCTION' ";
if (! empty($searchClause)) {
$query .= "AND " . $this->getWhereClauseForSearch(
$query .= 'AND ' . $this->getWhereClauseForSearch(
$searchClause,
$singleItem,
'ROUTINE_NAME'
@ -266,9 +266,9 @@ class NodeDatabase extends Node
$retval = (int) $GLOBALS['dbi']->fetchValue($query);
} else {
$db = $GLOBALS['dbi']->escapeString($db);
$query = "SHOW FUNCTION STATUS WHERE `Db`='$db' ";
$query = "SHOW FUNCTION STATUS WHERE `Db`='" . $db . "' ";
if (! empty($searchClause)) {
$query .= "AND " . $this->getWhereClauseForSearch(
$query .= 'AND ' . $this->getWhereClauseForSearch(
$searchClause,
$singleItem,
'Name'
@ -297,12 +297,12 @@ class NodeDatabase extends Node
$db = $this->realName;
if (! $GLOBALS['cfg']['Server']['DisableIS']) {
$db = $GLOBALS['dbi']->escapeString($db);
$query = "SELECT COUNT(*) ";
$query .= "FROM `INFORMATION_SCHEMA`.`EVENTS` ";
$query .= "WHERE `EVENT_SCHEMA` "
. Util::getCollateForIS() . "='$db' ";
$query = 'SELECT COUNT(*) ';
$query .= 'FROM `INFORMATION_SCHEMA`.`EVENTS` ';
$query .= 'WHERE `EVENT_SCHEMA` '
. Util::getCollateForIS() . "='" . $db . "' ";
if (! empty($searchClause)) {
$query .= "AND " . $this->getWhereClauseForSearch(
$query .= 'AND ' . $this->getWhereClauseForSearch(
$searchClause,
$singleItem,
'EVENT_NAME'
@ -311,9 +311,9 @@ class NodeDatabase extends Node
$retval = (int) $GLOBALS['dbi']->fetchValue($query);
} else {
$db = Util::backquote($db);
$query = "SHOW EVENTS FROM $db ";
$query = 'SHOW EVENTS FROM ' . $db . ' ';
if (! empty($searchClause)) {
$query .= "WHERE " . $this->getWhereClauseForSearch(
$query .= 'WHERE ' . $this->getWhereClauseForSearch(
$searchClause,
$singleItem,
'Name'
@ -343,10 +343,10 @@ class NodeDatabase extends Node
) {
$query = '';
if ($singleItem) {
$query .= Util::backquote($columnName) . " = ";
$query .= Util::backquote($columnName) . ' = ';
$query .= "'" . $GLOBALS['dbi']->escapeString($searchClause) . "'";
} else {
$query .= Util::backquote($columnName) . " LIKE ";
$query .= Util::backquote($columnName) . ' LIKE ';
$query .= "'%" . $GLOBALS['dbi']->escapeString($searchClause)
. "%'";
}
@ -419,8 +419,8 @@ class NodeDatabase extends Node
return [];
}
$navTable = Util::backquote($cfgRelation['db'])
. "." . Util::backquote($cfgRelation['navigationhiding']);
$sqlQuery = "SELECT `item_name` FROM " . $navTable
. '.' . Util::backquote($cfgRelation['navigationhiding']);
$sqlQuery = 'SELECT `item_name` FROM ' . $navTable
. " WHERE `username`='" . $cfgRelation['user'] . "'"
. " AND `item_type`='" . $type
. "' AND `db_name`='" . $GLOBALS['dbi']->escapeString($db)
@ -458,25 +458,25 @@ class NodeDatabase extends Node
$db = $this->realName;
if (! $GLOBALS['cfg']['Server']['DisableIS']) {
$escdDb = $GLOBALS['dbi']->escapeString($db);
$query = "SELECT `TABLE_NAME` AS `name` ";
$query .= "FROM `INFORMATION_SCHEMA`.`TABLES` ";
$query .= "WHERE `TABLE_SCHEMA`='$escdDb' ";
$query .= "AND `TABLE_TYPE`" . $condition . "('BASE TABLE', 'SYSTEM VERSIONED') ";
$query = 'SELECT `TABLE_NAME` AS `name` ';
$query .= 'FROM `INFORMATION_SCHEMA`.`TABLES` ';
$query .= "WHERE `TABLE_SCHEMA`='" . $escdDb . "' ";
$query .= 'AND `TABLE_TYPE`' . $condition . "('BASE TABLE', 'SYSTEM VERSIONED') ";
if (! empty($searchClause)) {
$query .= "AND `TABLE_NAME` LIKE '%";
$query .= $GLOBALS['dbi']->escapeString($searchClause);
$query .= "%'";
}
$query .= "ORDER BY `TABLE_NAME` ASC ";
$query .= "LIMIT " . intval($pos) . ", $maxItems";
$query .= 'ORDER BY `TABLE_NAME` ASC ';
$query .= 'LIMIT ' . intval($pos) . ', ' . $maxItems;
$retval = $GLOBALS['dbi']->fetchResult($query);
} else {
$query = " SHOW FULL TABLES FROM ";
$query = ' SHOW FULL TABLES FROM ';
$query .= Util::backquote($db);
$query .= " WHERE `Table_type`" . $condition . "('BASE TABLE', 'SYSTEM VERSIONED') ";
$query .= ' WHERE `Table_type`' . $condition . "('BASE TABLE', 'SYSTEM VERSIONED') ";
if (! empty($searchClause)) {
$query .= "AND " . Util::backquote(
"Tables_in_" . $db
$query .= 'AND ' . Util::backquote(
'Tables_in_' . $db
);
$query .= " LIKE '%" . $GLOBALS['dbi']->escapeString(
$searchClause
@ -544,22 +544,22 @@ class NodeDatabase extends Node
$db = $this->realName;
if (! $GLOBALS['cfg']['Server']['DisableIS']) {
$escdDb = $GLOBALS['dbi']->escapeString($db);
$query = "SELECT `ROUTINE_NAME` AS `name` ";
$query .= "FROM `INFORMATION_SCHEMA`.`ROUTINES` ";
$query .= "WHERE `ROUTINE_SCHEMA` "
. Util::getCollateForIS() . "='$escdDb'";
$query = 'SELECT `ROUTINE_NAME` AS `name` ';
$query .= 'FROM `INFORMATION_SCHEMA`.`ROUTINES` ';
$query .= 'WHERE `ROUTINE_SCHEMA` '
. Util::getCollateForIS() . "='" . $escdDb . "'";
$query .= "AND `ROUTINE_TYPE`='" . $routineType . "' ";
if (! empty($searchClause)) {
$query .= "AND `ROUTINE_NAME` LIKE '%";
$query .= $GLOBALS['dbi']->escapeString($searchClause);
$query .= "%'";
}
$query .= "ORDER BY `ROUTINE_NAME` ASC ";
$query .= "LIMIT " . intval($pos) . ", $maxItems";
$query .= 'ORDER BY `ROUTINE_NAME` ASC ';
$query .= 'LIMIT ' . intval($pos) . ', ' . $maxItems;
$retval = $GLOBALS['dbi']->fetchResult($query);
} else {
$escdDb = $GLOBALS['dbi']->escapeString($db);
$query = "SHOW " . $routineType . " STATUS WHERE `Db`='$escdDb' ";
$query = 'SHOW ' . $routineType . " STATUS WHERE `Db`='" . $escdDb . "' ";
if (! empty($searchClause)) {
$query .= "AND `Name` LIKE '%";
$query .= $GLOBALS['dbi']->escapeString($searchClause);
@ -625,21 +625,21 @@ class NodeDatabase extends Node
$db = $this->realName;
if (! $GLOBALS['cfg']['Server']['DisableIS']) {
$escdDb = $GLOBALS['dbi']->escapeString($db);
$query = "SELECT `EVENT_NAME` AS `name` ";
$query .= "FROM `INFORMATION_SCHEMA`.`EVENTS` ";
$query .= "WHERE `EVENT_SCHEMA` "
. Util::getCollateForIS() . "='$escdDb' ";
$query = 'SELECT `EVENT_NAME` AS `name` ';
$query .= 'FROM `INFORMATION_SCHEMA`.`EVENTS` ';
$query .= 'WHERE `EVENT_SCHEMA` '
. Util::getCollateForIS() . "='" . $escdDb . "' ";
if (! empty($searchClause)) {
$query .= "AND `EVENT_NAME` LIKE '%";
$query .= $GLOBALS['dbi']->escapeString($searchClause);
$query .= "%'";
}
$query .= "ORDER BY `EVENT_NAME` ASC ";
$query .= "LIMIT " . intval($pos) . ", $maxItems";
$query .= 'ORDER BY `EVENT_NAME` ASC ';
$query .= 'LIMIT ' . intval($pos) . ', ' . $maxItems;
$retval = $GLOBALS['dbi']->fetchResult($query);
} else {
$escdDb = Util::backquote($db);
$query = "SHOW EVENTS FROM $escdDb ";
$query = 'SHOW EVENTS FROM ' . $escdDb . ' ';
if (! empty($searchClause)) {
$query .= "WHERE `Name` LIKE '%";
$query .= $GLOBALS['dbi']->escapeString($searchClause);

View File

@ -99,15 +99,15 @@ class NodeTable extends NodeDatabaseChild
if (! $GLOBALS['cfg']['Server']['DisableIS']) {
$db = $GLOBALS['dbi']->escapeString($db);
$table = $GLOBALS['dbi']->escapeString($table);
$query = "SELECT COUNT(*) ";
$query .= "FROM `INFORMATION_SCHEMA`.`COLUMNS` ";
$query .= "WHERE `TABLE_NAME`='$table' ";
$query .= "AND `TABLE_SCHEMA`='$db'";
$query = 'SELECT COUNT(*) ';
$query .= 'FROM `INFORMATION_SCHEMA`.`COLUMNS` ';
$query .= "WHERE `TABLE_NAME`='" . $table . "' ";
$query .= "AND `TABLE_SCHEMA`='" . $db . "'";
$retval = (int) $GLOBALS['dbi']->fetchValue($query);
} else {
$db = Util::backquote($db);
$table = Util::backquote($table);
$query = "SHOW COLUMNS FROM $table FROM $db";
$query = 'SHOW COLUMNS FROM ' . $table . ' FROM ' . $db . '';
$retval = (int) $GLOBALS['dbi']->numRows(
$GLOBALS['dbi']->tryQuery($query)
);
@ -116,7 +116,7 @@ class NodeTable extends NodeDatabaseChild
case 'indexes':
$db = Util::backquote($db);
$table = Util::backquote($table);
$query = "SHOW INDEXES FROM $table FROM $db";
$query = 'SHOW INDEXES FROM ' . $table . ' FROM ' . $db;
$retval = (int) $GLOBALS['dbi']->numRows(
$GLOBALS['dbi']->tryQuery($query)
);
@ -125,17 +125,17 @@ class NodeTable extends NodeDatabaseChild
if (! $GLOBALS['cfg']['Server']['DisableIS']) {
$db = $GLOBALS['dbi']->escapeString($db);
$table = $GLOBALS['dbi']->escapeString($table);
$query = "SELECT COUNT(*) ";
$query .= "FROM `INFORMATION_SCHEMA`.`TRIGGERS` ";
$query .= "WHERE `EVENT_OBJECT_SCHEMA` "
. Util::getCollateForIS() . "='$db' ";
$query .= "AND `EVENT_OBJECT_TABLE` "
. Util::getCollateForIS() . "='$table'";
$query = 'SELECT COUNT(*) ';
$query .= 'FROM `INFORMATION_SCHEMA`.`TRIGGERS` ';
$query .= 'WHERE `EVENT_OBJECT_SCHEMA` '
. Util::getCollateForIS() . "='" . $db . "' ";
$query .= 'AND `EVENT_OBJECT_TABLE` '
. Util::getCollateForIS() . "='" . $table . "'";
$retval = (int) $GLOBALS['dbi']->fetchValue($query);
} else {
$db = Util::backquote($db);
$table = $GLOBALS['dbi']->escapeString($table);
$query = "SHOW TRIGGERS FROM $db WHERE `Table` = '$table'";
$query = 'SHOW TRIGGERS FROM ' . $db . " WHERE `Table` = '" . $table . "'";
$retval = (int) $GLOBALS['dbi']->numRows(
$GLOBALS['dbi']->tryQuery($query)
);
@ -171,23 +171,23 @@ class NodeTable extends NodeDatabaseChild
if (! $GLOBALS['cfg']['Server']['DisableIS']) {
$db = $GLOBALS['dbi']->escapeString($db);
$table = $GLOBALS['dbi']->escapeString($table);
$query = "SELECT `COLUMN_NAME` AS `name` ";
$query .= ",`COLUMN_KEY` AS `key` ";
$query .= ",`DATA_TYPE` AS `type` ";
$query .= ",`COLUMN_DEFAULT` AS `default` ";
$query = 'SELECT `COLUMN_NAME` AS `name` ';
$query .= ',`COLUMN_KEY` AS `key` ';
$query .= ',`DATA_TYPE` AS `type` ';
$query .= ',`COLUMN_DEFAULT` AS `default` ';
$query .= ",IF (`IS_NULLABLE` = 'NO', '', 'nullable') AS `nullable` ";
$query .= "FROM `INFORMATION_SCHEMA`.`COLUMNS` ";
$query .= "WHERE `TABLE_NAME`='$table' ";
$query .= "AND `TABLE_SCHEMA`='$db' ";
$query .= "ORDER BY `COLUMN_NAME` ASC ";
$query .= "LIMIT " . intval($pos) . ", $maxItems";
$query .= 'FROM `INFORMATION_SCHEMA`.`COLUMNS` ';
$query .= "WHERE `TABLE_NAME`='" . $table . "' ";
$query .= "AND `TABLE_SCHEMA`='" . $db . "' ";
$query .= 'ORDER BY `COLUMN_NAME` ASC ';
$query .= 'LIMIT ' . intval($pos) . ', ' . $maxItems;
$retval = $GLOBALS['dbi']->fetchResult($query);
break;
}
$db = Util::backquote($db);
$table = Util::backquote($table);
$query = "SHOW COLUMNS FROM $table FROM $db";
$query = 'SHOW COLUMNS FROM ' . $table . ' FROM ' . $db;
$handle = $GLOBALS['dbi']->tryQuery($query);
if ($handle === false) {
break;
@ -208,7 +208,7 @@ class NodeTable extends NodeDatabaseChild
case 'indexes':
$db = Util::backquote($db);
$table = Util::backquote($table);
$query = "SHOW INDEXES FROM $table FROM $db";
$query = 'SHOW INDEXES FROM ' . $table . ' FROM ' . $db;
$handle = $GLOBALS['dbi']->tryQuery($query);
if ($handle === false) {
break;
@ -230,21 +230,21 @@ class NodeTable extends NodeDatabaseChild
if (! $GLOBALS['cfg']['Server']['DisableIS']) {
$db = $GLOBALS['dbi']->escapeString($db);
$table = $GLOBALS['dbi']->escapeString($table);
$query = "SELECT `TRIGGER_NAME` AS `name` ";
$query .= "FROM `INFORMATION_SCHEMA`.`TRIGGERS` ";
$query .= "WHERE `EVENT_OBJECT_SCHEMA` "
. Util::getCollateForIS() . "='$db' ";
$query .= "AND `EVENT_OBJECT_TABLE` "
. Util::getCollateForIS() . "='$table' ";
$query .= "ORDER BY `TRIGGER_NAME` ASC ";
$query .= "LIMIT " . intval($pos) . ", $maxItems";
$query = 'SELECT `TRIGGER_NAME` AS `name` ';
$query .= 'FROM `INFORMATION_SCHEMA`.`TRIGGERS` ';
$query .= 'WHERE `EVENT_OBJECT_SCHEMA` '
. Util::getCollateForIS() . "='" . $db . "' ";
$query .= 'AND `EVENT_OBJECT_TABLE` '
. Util::getCollateForIS() . "='" . $table . "' ";
$query .= 'ORDER BY `TRIGGER_NAME` ASC ';
$query .= 'LIMIT ' . intval($pos) . ', ' . $maxItems;
$retval = $GLOBALS['dbi']->fetchResult($query);
break;
}
$db = Util::backquote($db);
$table = $GLOBALS['dbi']->escapeString($table);
$query = "SHOW TRIGGERS FROM $db WHERE `Table` = '$table'";
$query = 'SHOW TRIGGERS FROM ' . $db . " WHERE `Table` = '" . $table . "'";
$handle = $GLOBALS['dbi']->tryQuery($query);
if ($handle === false) {
break;

View File

@ -87,8 +87,8 @@ class Normalization
null,
true
);
$type = "";
$selectColHtml = "";
$type = '';
$selectColHtml = '';
foreach ($columns as $column => $def) {
if (isset($def['Type'])) {
$extractedColumnSpec = Util::extractColumnSpec($def['Type']);
@ -213,11 +213,11 @@ class Normalization
$step = 1;
$stepTxt = __('Make all columns atomic');
$html = "<h3 class='text-center'>"
. __('First step of normalization (1NF)') . "</h3>";
. __('First step of normalization (1NF)') . '</h3>';
$html .= "<div id='mainContent' data-normalizeto='" . $normalizedTo . "'>" .
"<fieldset>" .
"<legend>" . __('Step 1.') . $step . " " . $stepTxt . "</legend>" .
"<h4>" . __(
'<fieldset>' .
'<legend>' . __('Step 1.') . $step . ' ' . $stepTxt . '</legend>' .
'<h4>' . __(
'Do you have any column which can be split into more than'
. ' one column? '
. 'For example: address can be split into street, city, country and zip.'
@ -226,30 +226,30 @@ class Normalization
. "data-pick=false href='#'> "
. __(
'Show me the central list of columns that are not already in this table'
) . " </a>)</h4>"
) . ' </a>)</h4>'
. "<p class='cm-em'>" . __(
'Select a column which can be split into more '
. 'than one (on select of \'no such column\', it\'ll move to next step).'
)
. "</p>"
. '</p>'
. "<div id='extra'>"
. "<select id='selectNonAtomicCol' name='makeAtomic'>"
. '<option selected="selected" disabled="disabled">'
. __('Select one…') . "</option>"
. "<option value='no_such_col'>" . __('No such column') . "</option>"
. __('Select one…') . '</option>'
. "<option value='no_such_col'>" . __('No such column') . '</option>'
. $this->getHtmlForColumnsList(
$db,
$table,
_pgettext('string types', 'String')
)
. "</select>"
. "<span>" . __('split into ')
. '</select>'
. '<span>' . __('split into ')
. "</span><input id='numField' type='number' value='2'>"
. "<input type='submit' id='splitGo' value='" . __('Go') . "'></div>"
. "<div id='newCols'></div>"
. "</fieldset><fieldset class='tblFooters'>"
. "</fieldset>"
. "</div>";
. '</fieldset>'
. '</div>';
return $html;
}
@ -266,18 +266,18 @@ class Normalization
$step = 2;
$stepTxt = __('Have a primary key');
$primary = Index::getPrimary($table, $db);
$hasPrimaryKey = "0";
$legendText = __('Step 1.') . $step . " " . $stepTxt;
$hasPrimaryKey = '0';
$legendText = __('Step 1.') . $step . ' ' . $stepTxt;
$extra = '';
if ($primary) {
$headText = __("Primary key already exists.");
$subText = __("Taking you to next step…");
$hasPrimaryKey = "1";
$headText = __('Primary key already exists.');
$subText = __('Taking you to next step…');
$hasPrimaryKey = '1';
} else {
$headText = __(
"There is no primary key; please add one.<br>"
. "Hint: A primary key is a column "
. "(or combination of columns) that uniquely identify all rows."
'There is no primary key; please add one.<br>'
. 'Hint: A primary key is a column '
. '(or combination of columns) that uniquely identify all rows.'
);
$subText = '<a href="#" id="createPrimaryKey">'
. Generator::getIcon(
@ -289,8 +289,8 @@ class Normalization
. '</a>';
$extra = __(
"If it's not possible to make existing "
. "column combinations as primary key"
) . "<br>"
. 'column combinations as primary key'
) . '<br>'
. '<a href="#" id="addNewPrimary">'
. __('+ Add a new primary key column') . '</a>';
}
@ -315,18 +315,18 @@ class Normalization
{
$step = 4;
$stepTxt = __('Remove redundant columns');
$legendText = __('Step 1.') . $step . " " . $stepTxt;
$legendText = __('Step 1.') . $step . ' ' . $stepTxt;
$headText = __(
"Do you have a group of columns which on combining gives an existing"
. " column? For example, if you have first_name, last_name and"
. " full_name then combining first_name and last_name gives full_name"
. " which is redundant."
'Do you have a group of columns which on combining gives an existing'
. ' column? For example, if you have first_name, last_name and'
. ' full_name then combining first_name and last_name gives full_name'
. ' which is redundant.'
);
$subText = __(
"Check the columns which are redundant and click on remove. "
'Check the columns which are redundant and click on remove. '
. "If no redundant column, click on 'No redundant column'"
);
$extra = $this->getHtmlForColumnsList($db, $table, 'all', "checkbox") . "<br>"
$extra = $this->getHtmlForColumnsList($db, $table, 'all', 'checkbox') . '<br>'
. '<input class="btn btn-secondary" type="submit" id="removeRedundant" value="'
. __('Remove selected') . '">'
. '<input class="btn btn-secondary" type="submit" value="' . __('No redundant column')
@ -351,20 +351,20 @@ class Normalization
{
$step = 3;
$stepTxt = __('Move repeating groups');
$legendText = __('Step 1.') . $step . " " . $stepTxt;
$legendText = __('Step 1.') . $step . ' ' . $stepTxt;
$headText = __(
"Do you have a group of two or more columns that are closely "
. "related and are all repeating the same attribute? For example, "
. "a table that holds data on books might have columns such as book_id, "
. "author1, author2, author3 and so on which form a "
. "repeating group. In this case a new table (book_id, author) should "
. "be created."
'Do you have a group of two or more columns that are closely '
. 'related and are all repeating the same attribute? For example, '
. 'a table that holds data on books might have columns such as book_id, '
. 'author1, author2, author3 and so on which form a '
. 'repeating group. In this case a new table (book_id, author) should '
. 'be created.'
);
$subText = __(
"Check the columns which form a repeating group. "
'Check the columns which form a repeating group. '
. "If no such group, click on 'No repeating group'"
);
$extra = $this->getHtmlForColumnsList($db, $table, 'all', "checkbox") . "<br>"
$extra = $this->getHtmlForColumnsList($db, $table, 'all', 'checkbox') . '<br>'
. '<input class="btn btn-secondary" type="submit" id="moveRepeatingGroup" value="'
. __('Done') . '">'
. '<input class="btn btn-secondary" type="submit" value="' . __('No repeating group')
@ -394,13 +394,13 @@ class Normalization
*/
public function getHtmlFor2NFstep1($db, $table)
{
$legendText = __('Step 2.') . "1 " . __('Find partial dependencies');
$legendText = __('Step 2.') . '1 ' . __('Find partial dependencies');
$primary = Index::getPrimary($table, $db);
$primarycols = $primary->getColumns();
$pk = [];
$subText = '';
$selectPkForm = "";
$extra = "";
$selectPkForm = '';
$extra = '';
foreach ($primarycols as $col) {
$pk[] = $col->getName();
$selectPkForm .= '<input type="checkbox" name="pd" value="'
@ -450,10 +450,10 @@ class Normalization
foreach ($columns as $column) {
if (! in_array($column, $pk)) {
$cnt++;
$extra .= "<b>" . sprintf(
$extra .= '<b>' . sprintf(
__('\'%1$s\' depends on:'),
htmlspecialchars($column)
) . "</b><br>";
) . '</b><br>';
$extra .= '<form id="pk_' . $cnt . '" data-colname="'
. htmlspecialchars($column) . '" class="smallIndent">'
. $selectPkForm . '</form><br><br>';
@ -600,7 +600,7 @@ class Normalization
*/
public function getHtmlForNewTables3NF($dependencies, array $tables, $db)
{
$html = "";
$html = '';
$i = 1;
$newTables = [];
foreach ($tables as $table => $arrDependson) {
@ -639,8 +639,8 @@ class Normalization
. (count($dependents) > 0 ? ', ' : '')
. htmlspecialchars(implode(', ', $dependents)) . ' )';
$newTables[$table][$tableName] = [
"pk" => $key,
"nonpk" => implode(', ', $dependents),
'pk' => $key,
'nonpk' => implode(', ', $dependents),
];
$i++;
$tableName = 'table' . $i;
@ -827,8 +827,8 @@ class Normalization
*/
public function getHtmlFor3NFstep1($db, array $tables)
{
$legendText = __('Step 3.') . "1 " . __('Find transitive dependencies');
$extra = "";
$legendText = __('Step 3.') . '1 ' . __('Find transitive dependencies');
$extra = '';
$headText = __(
'Please answer the following question(s) '
. 'carefully to obtain a correct normalization.'
@ -845,7 +845,7 @@ class Normalization
foreach ($tables as $table) {
$primary = Index::getPrimary($table, $db);
$primarycols = $primary->getColumns();
$selectTdForm = "";
$selectTdForm = '';
$pk = [];
foreach ($primarycols as $col) {
$pk[] = $col->getName();
@ -868,11 +868,11 @@ class Normalization
foreach ($columns as $column) {
if (! in_array($column, $pk)) {
$cnt++;
$extra .= "<b>" . sprintf(
$extra .= '<b>' . sprintf(
__('\'%1$s\' depends on:'),
htmlspecialchars($column)
)
. "</b><br>";
. '</b><br>';
$extra .= '<form id="td_' . $cnt . '" data-colname="'
. htmlspecialchars($column) . '" data-tablename="'
. htmlspecialchars($table) . '" class="smallIndent">'
@ -881,13 +881,13 @@ class Normalization
}
}
}
if ($extra == "") {
if ($extra == '') {
$headText = __(
"No Transitive dependencies possible as the table "
'No Transitive dependencies possible as the table '
. "doesn't have any non primary key columns"
);
$subText = "";
$extra = "<h3>" . __("Table is already in Third normal form!") . "</h3>";
$subText = '';
$extra = '<h3>' . __('Table is already in Third normal form!') . '</h3>';
}
return [
'legendText' => $legendText,
@ -931,7 +931,7 @@ class Normalization
. "<span class='floatleft'>" . __(
'Hint: Please follow the procedure carefully in order '
. 'to obtain correct normalization'
) . "</span>"
) . '</span>'
. '<input class="btn btn-primary" type="submit" name="submit_normalize" value="' . __('Go') . '">'
. '</fieldset>'
. '</form>'

View File

@ -645,8 +645,8 @@ class Operations
&& $GLOBALS['is_reload_priv']
) {
$this->dbi->selectDb('mysql');
$newname = str_replace("_", "\_", $newname);
$oldDb = str_replace("_", "\_", $oldDb);
$newname = str_replace('_', '\_', $newname);
$oldDb = str_replace('_', '\_', $oldDb);
// For Db specific privileges
$query_db_specific = 'UPDATE ' . Util::backquote('db')
@ -673,7 +673,7 @@ class Operations
$this->dbi->query($query_proc_specific);
// Finally FLUSH the new privileges
$flush_query = "FLUSH PRIVILEGES;";
$flush_query = 'FLUSH PRIVILEGES;';
$this->dbi->query($flush_query);
}
}
@ -693,8 +693,8 @@ class Operations
&& $GLOBALS['is_reload_priv']
) {
$this->dbi->selectDb('mysql');
$newname = str_replace("_", "\_", $newname);
$oldDb = str_replace("_", "\_", $oldDb);
$newname = str_replace('_', '\_', $newname);
$oldDb = str_replace('_', '\_', $oldDb);
$query_db_specific_old = 'SELECT * FROM '
. Util::backquote('db') . ' WHERE '
@ -777,7 +777,7 @@ class Operations
}
// Finally FLUSH the new privileges
$flush_query = "FLUSH PRIVILEGES;";
$flush_query = 'FLUSH PRIVILEGES;';
$this->dbi->query($flush_query);
}
}
@ -2047,7 +2047,7 @@ class Operations
$this->dbi->query($query_col_specific);
// Finally FLUSH the new privileges
$flush_query = "FLUSH PRIVILEGES;";
$flush_query = 'FLUSH PRIVILEGES;';
$this->dbi->query($flush_query);
}
}
@ -2110,7 +2110,7 @@ class Operations
}
// Finally FLUSH the new privileges
$flush_query = "FLUSH PRIVILEGES;";
$flush_query = 'FLUSH PRIVILEGES;';
$this->dbi->query($flush_query);
}
}

View File

@ -155,7 +155,7 @@ class Partition extends SubPartition
{
if (Partition::havePartitioning()) {
$result = $GLOBALS['dbi']->fetchResult(
"SELECT * FROM `information_schema`.`PARTITIONS`"
'SELECT * FROM `information_schema`.`PARTITIONS`'
. " WHERE `TABLE_SCHEMA` = '" . $GLOBALS['dbi']->escapeString($db)
. "' AND `TABLE_NAME` = '" . $GLOBALS['dbi']->escapeString($table) . "'"
);
@ -196,7 +196,7 @@ class Partition extends SubPartition
{
if (Partition::havePartitioning()) {
return $GLOBALS['dbi']->fetchResult(
"SELECT DISTINCT `PARTITION_NAME` FROM `information_schema`.`PARTITIONS`"
'SELECT DISTINCT `PARTITION_NAME` FROM `information_schema`.`PARTITIONS`'
. " WHERE `TABLE_SCHEMA` = '" . $GLOBALS['dbi']->escapeString($db)
. "' AND `TABLE_NAME` = '" . $GLOBALS['dbi']->escapeString($table) . "'"
);
@ -217,10 +217,10 @@ class Partition extends SubPartition
{
if (Partition::havePartitioning()) {
$partition_method = $GLOBALS['dbi']->fetchResult(
"SELECT `PARTITION_METHOD` FROM `information_schema`.`PARTITIONS`"
'SELECT `PARTITION_METHOD` FROM `information_schema`.`PARTITIONS`'
. " WHERE `TABLE_SCHEMA` = '" . $GLOBALS['dbi']->escapeString($db) . "'"
. " AND `TABLE_NAME` = '" . $GLOBALS['dbi']->escapeString($table) . "'"
. " LIMIT 1"
. ' LIMIT 1'
);
if (! empty($partition_method)) {
return $partition_method[0];
@ -246,7 +246,7 @@ class Partition extends SubPartition
if (! $already_checked) {
if ($GLOBALS['dbi']->getVersion() < 50600) {
if ($GLOBALS['dbi']->fetchValue(
"SELECT @@have_partitioning;"
'SELECT @@have_partitioning;'
)) {
$have_partitioning = true;
}
@ -254,7 +254,7 @@ class Partition extends SubPartition
$have_partitioning = true;
} else {
// see https://dev.mysql.com/doc/refman/5.6/en/partitioning.html
$plugins = $GLOBALS['dbi']->fetchResult("SHOW PLUGINS");
$plugins = $GLOBALS['dbi']->fetchResult('SHOW PLUGINS');
foreach ($plugins as $value) {
if ($value['Name'] == 'partition') {
$have_partitioning = true;

View File

@ -53,7 +53,7 @@ class Plugins
. mb_strtolower(mb_substr($plugin_type, 1))
. mb_strtoupper($plugin_format[0])
. mb_strtolower(mb_substr($plugin_format, 1));
$file = $class_name . ".php";
$file = $class_name . '.php';
if (is_file($plugins_dir . $file)) {
//include_once $plugins_dir . $file;
$fqnClass = 'PhpMyAdmin\\' . str_replace('/', '\\', mb_substr($plugins_dir, 18)) . $class_name;
@ -292,7 +292,7 @@ class Plugins
$properties = null;
if (! $is_subgroup) {
// for subgroup headers
if (mb_strpos(get_class($propertyGroup), "PropertyItem")) {
if (mb_strpos(get_class($propertyGroup), 'PropertyItem')) {
$properties = [$propertyGroup];
} else {
// for main groups
@ -323,7 +323,7 @@ class Plugins
foreach ($properties as $propertyItem) {
$property_class = get_class($propertyItem);
// if the property is a subgroup, we deal with it recursively
if (mb_strpos($property_class, "Subgroup")) {
if (mb_strpos($property_class, 'Subgroup')) {
// for subgroups
// each subgroup can have a header, which may also be a form element
/** @var OptionsPropertyItem $subgroup_header */
@ -371,7 +371,7 @@ class Plugins
}
}
if (method_exists($propertyGroup, "getDoc")) {
if (method_exists($propertyGroup, 'getDoc')) {
$doc = $propertyGroup->getDoc();
if ($doc != null) {
if (count($doc) === 3) {

View File

@ -249,7 +249,7 @@ class AuthenticationCookie extends AuthenticationPlugin
if (! empty($GLOBALS['cfg']['CaptchaLoginPrivateKey'])
&& ! empty($GLOBALS['cfg']['CaptchaLoginPublicKey'])
) {
if (! empty($_POST["g-recaptcha-response"])) {
if (! empty($_POST['g-recaptcha-response'])) {
if (function_exists('curl_init')) {
$reCaptcha = new ReCaptcha\ReCaptcha(
$GLOBALS['cfg']['CaptchaLoginPrivateKey'],
@ -269,7 +269,7 @@ class AuthenticationCookie extends AuthenticationPlugin
// verify captcha status.
$resp = $reCaptcha->verify(
$_POST["g-recaptcha-response"],
$_POST['g-recaptcha-response'],
Core::getIp()
);

View File

@ -60,15 +60,15 @@ class ExportCodegen extends ExportPlugin
{
$this->_setCgFormats(
[
"NHibernate C# DO",
"NHibernate XML",
'NHibernate C# DO',
'NHibernate XML',
]
);
$this->_setCgHandlers(
[
"_handleNHibernateCSBody",
"_handleNHibernateXMLBody",
'_handleNHibernateCSBody',
'_handleNHibernateXMLBody',
]
);
}
@ -90,16 +90,16 @@ class ExportCodegen extends ExportPlugin
// $exportPluginProperties
// this will be shown as "Format specific options"
$exportSpecificOptions = new OptionsPropertyRootGroup(
"Format Specific Options"
'Format Specific Options'
);
// general options main group
$generalOptions = new OptionsPropertyMainGroup("general_opts");
$generalOptions = new OptionsPropertyMainGroup('general_opts');
// create primary items and add them to the group
$leaf = new HiddenPropertyItem("structure_or_data");
$leaf = new HiddenPropertyItem('structure_or_data');
$generalOptions->addProperty($leaf);
$leaf = new SelectPropertyItem(
"format",
'format',
__('Format:')
);
$leaf->setValues($this->_getCgFormats());
@ -203,7 +203,7 @@ class ExportCodegen extends ExportPlugin
);
}
return $this->export->outputHandler(sprintf("%s is not supported.", $format));
return $this->export->outputHandler(sprintf('%s is not supported.', $format));
}
/**
@ -357,7 +357,7 @@ class ExportCodegen extends ExportPlugin
. 'table="' . ExportCodegen::cgMakeIdentifier($table_alias) . '">';
$result = $GLOBALS['dbi']->query(
sprintf(
"DESC %s.%s",
'DESC %s.%s',
Util::backquote($db),
Util::backquote($table)
)

View File

@ -54,29 +54,29 @@ class ExportCsv extends ExportPlugin
// $exportPluginProperties
// this will be shown as "Format specific options"
$exportSpecificOptions = new OptionsPropertyRootGroup(
"Format Specific Options"
'Format Specific Options'
);
// general options main group
$generalOptions = new OptionsPropertyMainGroup("general_opts");
$generalOptions = new OptionsPropertyMainGroup('general_opts');
// create leaf items and add them to the group
$leaf = new TextPropertyItem(
"separator",
'separator',
__('Columns separated with:')
);
$generalOptions->addProperty($leaf);
$leaf = new TextPropertyItem(
"enclosed",
'enclosed',
__('Columns enclosed with:')
);
$generalOptions->addProperty($leaf);
$leaf = new TextPropertyItem(
"escaped",
'escaped',
__('Columns escaped with:')
);
$generalOptions->addProperty($leaf);
$leaf = new TextPropertyItem(
"terminated",
'terminated',
__('Lines terminated with:')
);
$generalOptions->addProperty($leaf);
@ -296,7 +296,7 @@ class ExportCsv extends ExportPlugin
"\r",
"\n",
],
"",
'',
$row[$j]
);
}

View File

@ -42,11 +42,11 @@ class ExportExcel extends ExportCsv
// $exportPluginProperties
// this will be shown as "Format specific options"
$exportSpecificOptions = new OptionsPropertyRootGroup(
"Format Specific Options"
'Format Specific Options'
);
// general options main group
$generalOptions = new OptionsPropertyMainGroup("general_opts");
$generalOptions = new OptionsPropertyMainGroup('general_opts');
// create primary items and add them to the group
$leaf = new TextPropertyItem(
'null',

View File

@ -57,16 +57,16 @@ class ExportHtmlword extends ExportPlugin
// $exportPluginProperties
// this will be shown as "Format specific options"
$exportSpecificOptions = new OptionsPropertyRootGroup(
"Format Specific Options"
'Format Specific Options'
);
// what to dump (structure/data/both)
$dumpWhat = new OptionsPropertyMainGroup(
"dump_what",
'dump_what',
__('Dump table')
);
// create primary items and add them to the group
$leaf = new RadioPropertyItem("structure_or_data");
$leaf = new RadioPropertyItem('structure_or_data');
$leaf->setValues(
[
'structure' => __('structure'),
@ -80,18 +80,18 @@ class ExportHtmlword extends ExportPlugin
// data options main group
$dataOptions = new OptionsPropertyMainGroup(
"dump_what",
'dump_what',
__('Data dump options')
);
$dataOptions->setForce('structure');
// create primary items and add them to the group
$leaf = new TextPropertyItem(
"null",
'null',
__('Replace NULL with:')
);
$dataOptions->addProperty($leaf);
$leaf = new BoolPropertyItem(
"columns",
'columns',
__('Put columns names in the first row')
);
$dataOptions->addProperty($leaf);

View File

@ -77,13 +77,13 @@ class ExportJson extends ExportPlugin
// $exportPluginProperties
// this will be shown as "Format specific options"
$exportSpecificOptions = new OptionsPropertyRootGroup(
"Format Specific Options"
'Format Specific Options'
);
// general options main group
$generalOptions = new OptionsPropertyMainGroup("general_opts");
$generalOptions = new OptionsPropertyMainGroup('general_opts');
// create primary items and add them to the group
$leaf = new HiddenPropertyItem("structure_or_data");
$leaf = new HiddenPropertyItem('structure_or_data');
$generalOptions->addProperty($leaf);
$leaf = new BoolPropertyItem(
@ -227,7 +227,7 @@ class ExportJson extends ExportPlugin
'type' => 'table',
'name' => $table_alias,
'database' => $db_alias,
'data' => "@@DATA@@",
'data' => '@@DATA@@',
]
);
list($header, $footer) = explode('"@@DATA@@"', $buffer);

View File

@ -79,14 +79,14 @@ class ExportLatex extends ExportPlugin
// $exportPluginProperties
// this will be shown as "Format specific options"
$exportSpecificOptions = new OptionsPropertyRootGroup(
"Format Specific Options"
'Format Specific Options'
);
// general options main group
$generalOptions = new OptionsPropertyMainGroup("general_opts");
$generalOptions = new OptionsPropertyMainGroup('general_opts');
// create primary items and add them to the group
$leaf = new BoolPropertyItem(
"caption",
'caption',
__('Include table caption')
);
$generalOptions->addProperty($leaf);
@ -95,11 +95,11 @@ class ExportLatex extends ExportPlugin
// what to dump (structure/data/both) main group
$dumpWhat = new OptionsPropertyMainGroup(
"dump_what",
'dump_what',
__('Dump table')
);
// create primary items and add them to the group
$leaf = new RadioPropertyItem("structure_or_data");
$leaf = new RadioPropertyItem('structure_or_data');
$leaf->setValues(
[
'structure' => __('structure'),
@ -114,44 +114,44 @@ class ExportLatex extends ExportPlugin
// structure options main group
if (! $hide_structure) {
$structureOptions = new OptionsPropertyMainGroup(
"structure",
'structure',
__('Object creation options')
);
$structureOptions->setForce('data');
// create primary items and add them to the group
$leaf = new TextPropertyItem(
"structure_caption",
'structure_caption',
__('Table caption:')
);
$leaf->setDoc('faq6-27');
$structureOptions->addProperty($leaf);
$leaf = new TextPropertyItem(
"structure_continued_caption",
'structure_continued_caption',
__('Table caption (continued):')
);
$leaf->setDoc('faq6-27');
$structureOptions->addProperty($leaf);
$leaf = new TextPropertyItem(
"structure_label",
'structure_label',
__('Label key:')
);
$leaf->setDoc('faq6-27');
$structureOptions->addProperty($leaf);
if (! empty($GLOBALS['cfgRelation']['relation'])) {
$leaf = new BoolPropertyItem(
"relation",
'relation',
__('Display foreign key relationships')
);
$structureOptions->addProperty($leaf);
}
$leaf = new BoolPropertyItem(
"comments",
'comments',
__('Display comments')
);
$structureOptions->addProperty($leaf);
if (! empty($GLOBALS['cfgRelation']['mimework'])) {
$leaf = new BoolPropertyItem(
"mime",
'mime',
__('Display media types')
);
$structureOptions->addProperty($leaf);
@ -162,30 +162,30 @@ class ExportLatex extends ExportPlugin
// data options main group
$dataOptions = new OptionsPropertyMainGroup(
"data",
'data',
__('Data dump options')
);
$dataOptions->setForce('structure');
// create primary items and add them to the group
$leaf = new BoolPropertyItem(
"columns",
'columns',
__('Put columns names in the first row:')
);
$dataOptions->addProperty($leaf);
$leaf = new TextPropertyItem(
"data_caption",
'data_caption',
__('Table caption:')
);
$leaf->setDoc('faq6-27');
$dataOptions->addProperty($leaf);
$leaf = new TextPropertyItem(
"data_continued_caption",
'data_continued_caption',
__('Table caption (continued):')
);
$leaf->setDoc('faq6-27');
$dataOptions->addProperty($leaf);
$leaf = new TextPropertyItem(
"data_label",
'data_label',
__('Label key:')
);
$leaf->setDoc('faq6-27');
@ -425,7 +425,7 @@ class ExportLatex extends ExportPlugin
if ($i == ($columns_cnt - 1)) {
$buffer .= $column_value;
} else {
$buffer .= $column_value . " & ";
$buffer .= $column_value . ' & ';
}
}
$buffer .= ' \\\\ \\hline ' . $crlf;

View File

@ -54,19 +54,19 @@ class ExportMediawiki extends ExportPlugin
// $exportPluginProperties
// this will be shown as "Format specific options"
$exportSpecificOptions = new OptionsPropertyRootGroup(
"Format Specific Options"
'Format Specific Options'
);
// general options main group
$generalOptions = new OptionsPropertyMainGroup(
"general_opts",
'general_opts',
__('Dump table')
);
// what to dump (structure/data/both)
$subgroup = new OptionsPropertySubgroup(
"dump_table",
__("Dump table")
'dump_table',
__('Dump table')
);
$leaf = new RadioPropertyItem('structure_or_data');
$leaf->setValues(
@ -81,14 +81,14 @@ class ExportMediawiki extends ExportPlugin
// export table name
$leaf = new BoolPropertyItem(
"caption",
'caption',
__('Export table names')
);
$generalOptions->addProperty($leaf);
// export table headers
$leaf = new BoolPropertyItem(
"headers",
'headers',
__('Export table headers')
);
$generalOptions->addProperty($leaf);
@ -208,12 +208,12 @@ class ExportMediawiki extends ExportPlugin
// Print structure comment
$output = $this->_exportComment(
"Table structure for "
'Table structure for '
. Util::backquote($table_alias)
);
// Begin the table construction
$output .= "{| class=\"wikitable\" style=\"text-align:center;\""
$output .= '{| class="wikitable" style="text-align:center;"'
. $this->_exportCRLF();
// Add the table name
@ -223,8 +223,8 @@ class ExportMediawiki extends ExportPlugin
// Add the table headers
if (isset($GLOBALS['mediawiki_headers'])) {
$output .= "|- style=\"background:#ffdead;\"" . $this->_exportCRLF();
$output .= "! style=\"background:#ffffff\" | "
$output .= '|- style="background:#ffdead;"' . $this->_exportCRLF();
$output .= '! style="background:#ffffff" | '
. $this->_exportCRLF();
for ($i = 0; $i < $row_cnt; ++$i) {
$col_as = $columns[$i]['Field'];
@ -233,36 +233,36 @@ class ExportMediawiki extends ExportPlugin
$col_as
= $aliases[$db]['tables'][$table]['columns'][$col_as];
}
$output .= " | " . $col_as . $this->_exportCRLF();
$output .= ' | ' . $col_as . $this->_exportCRLF();
}
}
// Add the table structure
$output .= "|-" . $this->_exportCRLF();
$output .= "! Type" . $this->_exportCRLF();
$output .= '|-' . $this->_exportCRLF();
$output .= '! Type' . $this->_exportCRLF();
for ($i = 0; $i < $row_cnt; ++$i) {
$output .= " | " . $columns[$i]['Type'] . $this->_exportCRLF();
$output .= ' | ' . $columns[$i]['Type'] . $this->_exportCRLF();
}
$output .= "|-" . $this->_exportCRLF();
$output .= "! Null" . $this->_exportCRLF();
$output .= '|-' . $this->_exportCRLF();
$output .= '! Null' . $this->_exportCRLF();
for ($i = 0; $i < $row_cnt; ++$i) {
$output .= " | " . $columns[$i]['Null'] . $this->_exportCRLF();
$output .= ' | ' . $columns[$i]['Null'] . $this->_exportCRLF();
}
$output .= "|-" . $this->_exportCRLF();
$output .= "! Default" . $this->_exportCRLF();
$output .= '|-' . $this->_exportCRLF();
$output .= '! Default' . $this->_exportCRLF();
for ($i = 0; $i < $row_cnt; ++$i) {
$output .= " | " . $columns[$i]['Default'] . $this->_exportCRLF();
$output .= ' | ' . $columns[$i]['Default'] . $this->_exportCRLF();
}
$output .= "|-" . $this->_exportCRLF();
$output .= "! Extra" . $this->_exportCRLF();
$output .= '|-' . $this->_exportCRLF();
$output .= '! Extra' . $this->_exportCRLF();
for ($i = 0; $i < $row_cnt; ++$i) {
$output .= " | " . $columns[$i]['Extra'] . $this->_exportCRLF();
$output .= ' | ' . $columns[$i]['Extra'] . $this->_exportCRLF();
}
$output .= "|}" . str_repeat($this->_exportCRLF(), 2);
$output .= '|}' . str_repeat($this->_exportCRLF(), 2);
break;
} // end switch
@ -295,13 +295,13 @@ class ExportMediawiki extends ExportPlugin
// Print data comment
$output = $this->_exportComment(
"Table data for " . Util::backquote($table_alias)
'Table data for ' . Util::backquote($table_alias)
);
// Begin the table construction
// Use the "wikitable" class for style
// Use the "sortable" class for allowing tables to be sorted by column
$output .= "{| class=\"wikitable sortable\" style=\"text-align:center;\""
$output .= '{| class="wikitable sortable" style="text-align:center;"'
. $this->_exportCRLF();
// Add the table name
@ -317,7 +317,7 @@ class ExportMediawiki extends ExportPlugin
// Add column names as table headers
if ($column_names !== null) {
// Use '|-' for separating rows
$output .= "|-" . $this->_exportCRLF();
$output .= '|-' . $this->_exportCRLF();
// Use '!' for separating table headers
foreach ($column_names as $column) {
@ -326,7 +326,7 @@ class ExportMediawiki extends ExportPlugin
$column
= $aliases[$db]['tables'][$table]['columns'][$column];
}
$output .= " ! " . $column . "" . $this->_exportCRLF();
$output .= ' ! ' . $column . '' . $this->_exportCRLF();
}
}
}
@ -340,16 +340,16 @@ class ExportMediawiki extends ExportPlugin
$fields_cnt = $GLOBALS['dbi']->numFields($result);
while ($row = $GLOBALS['dbi']->fetchRow($result)) {
$output .= "|-" . $this->_exportCRLF();
$output .= '|-' . $this->_exportCRLF();
// Use '|' for separating table columns
for ($i = 0; $i < $fields_cnt; ++$i) {
$output .= " | " . $row[$i] . "" . $this->_exportCRLF();
$output .= ' | ' . $row[$i] . '' . $this->_exportCRLF();
}
}
// End table construction
$output .= "|}" . str_repeat($this->_exportCRLF(), 2);
$output .= '|}' . str_repeat($this->_exportCRLF(), 2);
return $this->export->outputHandler($output);
}

View File

@ -58,23 +58,23 @@ class ExportOds extends ExportPlugin
// $exportPluginProperties
// this will be shown as "Format specific options"
$exportSpecificOptions = new OptionsPropertyRootGroup(
"Format Specific Options"
'Format Specific Options'
);
// general options main group
$generalOptions = new OptionsPropertyMainGroup("general_opts");
$generalOptions = new OptionsPropertyMainGroup('general_opts');
// create primary items and add them to the group
$leaf = new TextPropertyItem(
"null",
'null',
__('Replace NULL with:')
);
$generalOptions->addProperty($leaf);
$leaf = new BoolPropertyItem(
"columns",
'columns',
__('Put columns names in the first row')
);
$generalOptions->addProperty($leaf);
$leaf = new HiddenPropertyItem("structure_or_data");
$leaf = new HiddenPropertyItem('structure_or_data');
$generalOptions->addProperty($leaf);
// add the main group to the root group
$exportSpecificOptions->addProperty($generalOptions);
@ -282,31 +282,31 @@ class ExportOds extends ExportPlugin
.= '<table:table-cell office:value-type="string">'
. '<text:p></text:p>'
. '</table:table-cell>';
} elseif ($fields_meta[$j]->type == "date") {
} elseif ($fields_meta[$j]->type == 'date') {
$GLOBALS['ods_buffer']
.= '<table:table-cell office:value-type="date"'
. ' office:date-value="'
. date("Y-m-d", strtotime($row[$j]))
. date('Y-m-d', strtotime($row[$j]))
. '" table:style-name="DateCell">'
. '<text:p>'
. htmlspecialchars($row[$j])
. '</text:p>'
. '</table:table-cell>';
} elseif ($fields_meta[$j]->type == "time") {
} elseif ($fields_meta[$j]->type == 'time') {
$GLOBALS['ods_buffer']
.= '<table:table-cell office:value-type="time"'
. ' office:time-value="'
. date("\P\TH\Hi\Ms\S", strtotime($row[$j]))
. date('\P\TH\Hi\Ms\S', strtotime($row[$j]))
. '" table:style-name="TimeCell">'
. '<text:p>'
. htmlspecialchars($row[$j])
. '</text:p>'
. '</table:table-cell>';
} elseif ($fields_meta[$j]->type == "datetime") {
} elseif ($fields_meta[$j]->type == 'datetime') {
$GLOBALS['ods_buffer']
.= '<table:table-cell office:value-type="date"'
. ' office:date-value="'
. date("Y-m-d\TH:i:s", strtotime($row[$j]))
. date('Y-m-d\TH:i:s', strtotime($row[$j]))
. '" table:style-name="DateTimeCell">'
. '<text:p>'
. htmlspecialchars($row[$j])

View File

@ -68,16 +68,16 @@ class ExportOdt extends ExportPlugin
// $exportPluginProperties
// this will be shown as "Format specific options"
$exportSpecificOptions = new OptionsPropertyRootGroup(
"Format Specific Options"
'Format Specific Options'
);
// what to dump (structure/data/both) main group
$dumpWhat = new OptionsPropertyMainGroup(
"general_opts",
'general_opts',
__('Dump table')
);
// create primary items and add them to the group
$leaf = new RadioPropertyItem("structure_or_data");
$leaf = new RadioPropertyItem('structure_or_data');
$leaf->setValues(
[
'structure' => __('structure'),
@ -92,26 +92,26 @@ class ExportOdt extends ExportPlugin
// structure options main group
if (! $hide_structure) {
$structureOptions = new OptionsPropertyMainGroup(
"structure",
'structure',
__('Object creation options')
);
$structureOptions->setForce('data');
// create primary items and add them to the group
if (! empty($GLOBALS['cfgRelation']['relation'])) {
$leaf = new BoolPropertyItem(
"relation",
'relation',
__('Display foreign key relationships')
);
$structureOptions->addProperty($leaf);
}
$leaf = new BoolPropertyItem(
"comments",
'comments',
__('Display comments')
);
$structureOptions->addProperty($leaf);
if (! empty($GLOBALS['cfgRelation']['mimework'])) {
$leaf = new BoolPropertyItem(
"mime",
'mime',
__('Display media types')
);
$structureOptions->addProperty($leaf);
@ -122,13 +122,13 @@ class ExportOdt extends ExportPlugin
// data options main group
$dataOptions = new OptionsPropertyMainGroup(
"data",
'data',
__('Data dump options')
);
$dataOptions->setForce('structure');
// create primary items and add them to the group
$leaf = new BoolPropertyItem(
"columns",
'columns',
__('Put columns names in the first row')
);
$dataOptions->addProperty($leaf);

View File

@ -92,14 +92,14 @@ class ExportPdf extends ExportPlugin
// $exportPluginProperties
// this will be shown as "Format specific options"
$exportSpecificOptions = new OptionsPropertyRootGroup(
"Format Specific Options"
'Format Specific Options'
);
// general options main group
$generalOptions = new OptionsPropertyMainGroup("general_opts");
$generalOptions = new OptionsPropertyMainGroup('general_opts');
// create primary items and add them to the group
$leaf = new TextPropertyItem(
"report_title",
'report_title',
__('Report title:')
);
$generalOptions->addProperty($leaf);
@ -108,10 +108,10 @@ class ExportPdf extends ExportPlugin
// what to dump (structure/data/both) main group
$dumpWhat = new OptionsPropertyMainGroup(
"dump_what",
'dump_what',
__('Dump table')
);
$leaf = new RadioPropertyItem("structure_or_data");
$leaf = new RadioPropertyItem('structure_or_data');
$leaf->setValues(
[
'structure' => __('structure'),

View File

@ -52,13 +52,13 @@ class ExportPhparray extends ExportPlugin
// $exportPluginProperties
// this will be shown as "Format specific options"
$exportSpecificOptions = new OptionsPropertyRootGroup(
"Format Specific Options"
'Format Specific Options'
);
// general options main group
$generalOptions = new OptionsPropertyMainGroup("general_opts");
$generalOptions = new OptionsPropertyMainGroup('general_opts');
// create primary items and add them to the group
$leaf = new HiddenPropertyItem("structure_or_data");
$leaf = new HiddenPropertyItem('structure_or_data');
$generalOptions->addProperty($leaf);
// add the main group to the root group
$exportSpecificOptions->addProperty($generalOptions);
@ -239,7 +239,7 @@ class ExportPhparray extends ExportPlugin
for ($i = 0; $i < $columns_cnt; $i++) {
$buffer .= var_export($columns[$i], true)
. " => " . var_export($record[$i], true)
. ' => ' . var_export($record[$i], true)
. (($i + 1 >= $columns_cnt) ? '' : ',');
}

View File

@ -88,14 +88,14 @@ class ExportSql extends ExportPlugin
// $exportPluginProperties
// this will be shown as "Format specific options"
$exportSpecificOptions = new OptionsPropertyRootGroup(
"Format Specific Options"
'Format Specific Options'
);
// general options main group
$generalOptions = new OptionsPropertyMainGroup("general_opts");
$generalOptions = new OptionsPropertyMainGroup('general_opts');
// comments
$subgroup = new OptionsPropertySubgroup("include_comments");
$subgroup = new OptionsPropertySubgroup('include_comments');
$leaf = new BoolPropertyItem(
'include_comments',
__(
@ -136,7 +136,7 @@ class ExportSql extends ExportPlugin
// enclose in a transaction
$leaf = new BoolPropertyItem(
"use_transaction",
'use_transaction',
__('Enclose export in a transaction')
);
$leaf->setDoc(
@ -150,7 +150,7 @@ class ExportSql extends ExportPlugin
// disable foreign key checks
$leaf = new BoolPropertyItem(
"disable_fk",
'disable_fk',
__('Disable foreign key checks')
);
$leaf->setDoc(
@ -164,14 +164,14 @@ class ExportSql extends ExportPlugin
// export views as tables
$leaf = new BoolPropertyItem(
"views_as_tables",
'views_as_tables',
__('Export views as tables')
);
$generalOptions->addProperty($leaf);
// export metadata
$leaf = new BoolPropertyItem(
"metadata",
'metadata',
__('Export metadata')
);
$generalOptions->addProperty($leaf);
@ -185,7 +185,7 @@ class ExportSql extends ExportPlugin
}
$leaf = new SelectPropertyItem(
"compatibility",
'compatibility',
__(
'Database system or older MySQL server to maximize output'
. ' compatibility with:'
@ -205,8 +205,8 @@ class ExportSql extends ExportPlugin
// what to dump (structure/data/both)
$subgroup = new OptionsPropertySubgroup(
"dump_table",
__("Dump table")
'dump_table',
__('Dump table')
);
$leaf = new RadioPropertyItem('structure_or_data');
$leaf->setValues(
@ -225,7 +225,7 @@ class ExportSql extends ExportPlugin
// structure options main group
if (! $hide_structure) {
$structureOptions = new OptionsPropertyMainGroup(
"structure",
'structure',
__('Object creation options')
);
$structureOptions->setForce('data');
@ -241,7 +241,7 @@ class ExportSql extends ExportPlugin
// server export options
if ($plugin_param['export_type'] == 'server') {
$leaf = new BoolPropertyItem(
"drop_database",
'drop_database',
sprintf(__('Add %s statement'), '<code>DROP DATABASE IF EXISTS</code>')
);
$subgroup->addProperty($leaf);
@ -343,7 +343,7 @@ class ExportSql extends ExportPlugin
$structureOptions->addProperty($subgroup);
$leaf = new BoolPropertyItem(
"backquotes",
'backquotes',
__(
'Enclose table and column names with backquotes '
. '<i>(Protects column and table names formed with'
@ -359,12 +359,12 @@ class ExportSql extends ExportPlugin
// begin Data options
$dataOptions = new OptionsPropertyMainGroup(
"data",
'data',
__('Data creation options')
);
$dataOptions->setForce('structure');
$leaf = new BoolPropertyItem(
"truncate",
'truncate',
__('Truncate table before insert')
);
$dataOptions->addProperty($leaf);
@ -377,7 +377,7 @@ class ExportSql extends ExportPlugin
$subgroup->setSubgroupHeader($leaf);
$leaf = new BoolPropertyItem(
"delayed",
'delayed',
__('<code>INSERT DELAYED</code> statements')
);
$leaf->setDoc(
@ -389,7 +389,7 @@ class ExportSql extends ExportPlugin
$subgroup->addProperty($leaf);
$leaf = new BoolPropertyItem(
"ignore",
'ignore',
__('<code>INSERT IGNORE</code> statements')
);
$leaf->setDoc(
@ -403,7 +403,7 @@ class ExportSql extends ExportPlugin
// Function to use when dumping dat
$leaf = new SelectPropertyItem(
"type",
'type',
__('Function to use when dumping data:')
);
$leaf->setValues(
@ -423,7 +423,7 @@ class ExportSql extends ExportPlugin
);
$subgroup->setSubgroupHeader($leaf);
$leaf = new RadioPropertyItem(
"insert_syntax",
'insert_syntax',
__('<code>INSERT IGNORE</code> statements')
);
$leaf->setValues(
@ -454,14 +454,14 @@ class ExportSql extends ExportPlugin
// Max length of query
$leaf = new NumberPropertyItem(
"max_query_size",
'max_query_size',
__('Maximal length of created query')
);
$dataOptions->addProperty($leaf);
// Dump binary columns in hexadecimal
$leaf = new BoolPropertyItem(
"hex_for_binary",
'hex_for_binary',
__(
'Dump binary columns in hexadecimal notation'
. ' <i>(for example, "abc" becomes 0x616263)</i>'
@ -471,7 +471,7 @@ class ExportSql extends ExportPlugin
// Dump time in UTC
$leaf = new BoolPropertyItem(
"utc_time",
'utc_time',
__(
'Dump TIMESTAMP columns in UTC <i>(enables TIMESTAMP columns'
. ' to be dumped and reloaded between servers in different'
@ -972,14 +972,14 @@ class ExportSql extends ExportPlugin
$delimiter = '$$';
$event_names = $GLOBALS['dbi']->fetchResult(
"SELECT EVENT_NAME FROM information_schema.EVENTS WHERE"
'SELECT EVENT_NAME FROM information_schema.EVENTS WHERE'
. " EVENT_SCHEMA= '" . $GLOBALS['dbi']->escapeString($db)
. "';"
);
if ($event_names) {
$text .= $crlf
. "DELIMITER " . $delimiter . $crlf;
. 'DELIMITER ' . $delimiter . $crlf;
$text .= $this->_exportComment()
. $this->_exportComment(__('Events'))
@ -987,7 +987,7 @@ class ExportSql extends ExportPlugin
foreach ($event_names as $event_name) {
if (! empty($GLOBALS['sql_drop_table'])) {
$text .= "DROP EVENT "
$text .= 'DROP EVENT '
. Util::backquote($event_name)
. $delimiter . $crlf;
}
@ -995,7 +995,7 @@ class ExportSql extends ExportPlugin
. $delimiter . $crlf . $crlf;
}
$text .= "DELIMITER ;" . $crlf;
$text .= 'DELIMITER ;' . $crlf;
}
if (! empty($text)) {
@ -1120,10 +1120,10 @@ class ExportSql extends ExportPlugin
if (in_array($type, $metadataTypes) && isset($cfgRelation[$type])) {
// special case, designer pages and their coordinates
if ($type == 'pdf_pages') {
$sql_query = "SELECT `page_nr`, `page_descr` FROM "
$sql_query = 'SELECT `page_nr`, `page_descr` FROM '
. Util::backquote($cfgRelation['db'])
. "." . Util::backquote($cfgRelation[$type])
. " WHERE " . Util::backquote($dbNameColumn)
. '.' . Util::backquote($cfgRelation[$type])
. ' WHERE ' . Util::backquote($dbNameColumn)
. " = '" . $GLOBALS['dbi']->escapeString($db) . "'";
$result = $GLOBALS['dbi']->fetchResult(
@ -1134,12 +1134,12 @@ class ExportSql extends ExportPlugin
foreach ($result as $page => $name) {
// insert row for pdf_page
$sql_query_row = "SELECT `db_name`, `page_descr` FROM "
$sql_query_row = 'SELECT `db_name`, `page_descr` FROM '
. Util::backquote($cfgRelation['db'])
. "." . Util::backquote(
. '.' . Util::backquote(
$cfgRelation[$type]
)
. " WHERE " . Util::backquote(
. ' WHERE ' . Util::backquote(
$dbNameColumn
)
. " = '" . $GLOBALS['dbi']->escapeString($db) . "'"
@ -1158,16 +1158,16 @@ class ExportSql extends ExportPlugin
}
$lastPage = $GLOBALS['crlf']
. "SET @LAST_PAGE = LAST_INSERT_ID();"
. 'SET @LAST_PAGE = LAST_INSERT_ID();'
. $GLOBALS['crlf'];
if (! $this->export->outputHandler($lastPage)) {
return false;
}
$sql_query_coords = "SELECT `db_name`, `table_name`, "
$sql_query_coords = 'SELECT `db_name`, `table_name`, '
. "'@LAST_PAGE' AS `pdf_page_number`, `x`, `y` FROM "
. Util::backquote($cfgRelation['db'])
. "." . Util::backquote(
. '.' . Util::backquote(
$cfgRelation['table_coords']
)
. " WHERE `pdf_page_number` = '" . $page . "'";
@ -1193,21 +1193,21 @@ class ExportSql extends ExportPlugin
// remove auto_incrementing id field for some tables
if ($type == 'bookmark') {
$sql_query = "SELECT `dbase`, `user`, `label`, `query` FROM ";
$sql_query = 'SELECT `dbase`, `user`, `label`, `query` FROM ';
} elseif ($type == 'column_info') {
$sql_query = "SELECT `db_name`, `table_name`, `column_name`,"
. " `comment`, `mimetype`, `transformation`,"
. " `transformation_options`, `input_transformation`,"
. " `input_transformation_options` FROM";
$sql_query = 'SELECT `db_name`, `table_name`, `column_name`,'
. ' `comment`, `mimetype`, `transformation`,'
. ' `transformation_options`, `input_transformation`,'
. ' `input_transformation_options` FROM';
} elseif ($type == 'savedsearches') {
$sql_query = "SELECT `username`, `db_name`, `search_name`,"
. " `search_data` FROM";
$sql_query = 'SELECT `username`, `db_name`, `search_name`,'
. ' `search_data` FROM';
} else {
$sql_query = "SELECT * FROM ";
$sql_query = 'SELECT * FROM ';
}
$sql_query .= Util::backquote($cfgRelation['db'])
. '.' . Util::backquote($cfgRelation[$type])
. " WHERE " . Util::backquote($dbNameColumn)
. ' WHERE ' . Util::backquote($dbNameColumn)
. " = '" . $GLOBALS['dbi']->escapeString($db) . "'";
if (isset($table)) {
$sql_query .= " AND `table_name` = '"
@ -1298,11 +1298,11 @@ class ExportSql extends ExportPlugin
$db_alias = $db;
$view_alias = $view;
$this->initAlias($aliases, $db_alias, $view_alias);
$create_query = "CREATE TABLE";
$create_query = 'CREATE TABLE';
if (isset($GLOBALS['sql_if_not_exists'])) {
$create_query .= " IF NOT EXISTS ";
$create_query .= ' IF NOT EXISTS ';
}
$create_query .= Util::backquote($view_alias) . "(" . $crlf;
$create_query .= Util::backquote($view_alias) . '(' . $crlf;
$columns = $GLOBALS['dbi']->getColumns($db, $view, null, true);
@ -1317,24 +1317,24 @@ class ExportSql extends ExportPlugin
);
if (! $firstCol) {
$create_query .= "," . $crlf;
$create_query .= ',' . $crlf;
}
$create_query .= " " . Util::backquote($col_alias);
$create_query .= " " . $column['Type'];
$create_query .= ' ' . Util::backquote($col_alias);
$create_query .= ' ' . $column['Type'];
if ($extracted_columnspec['can_contain_collation']
&& ! empty($column['Collation'])
) {
$create_query .= " COLLATE " . $column['Collation'];
$create_query .= ' COLLATE ' . $column['Collation'];
}
if ($column['Null'] == 'NO') {
$create_query .= " NOT NULL";
$create_query .= ' NOT NULL';
}
if (isset($column['Default'])) {
$create_query .= " DEFAULT '"
. $GLOBALS['dbi']->escapeString($column['Default']) . "'";
} else {
if ($column['Null'] == 'YES') {
$create_query .= " DEFAULT NULL";
$create_query .= ' DEFAULT NULL';
}
}
if (! empty($column['Comment'])) {
@ -1343,7 +1343,7 @@ class ExportSql extends ExportPlugin
}
$firstCol = false;
}
$create_query .= $crlf . ")" . ($add_semicolon ? ';' : '') . $crlf;
$create_query .= $crlf . ')' . ($add_semicolon ? ';' : '') . $crlf;
if (isset($GLOBALS['sql_compatibility'])) {
$compat = $GLOBALS['sql_compatibility'];
@ -1516,7 +1516,7 @@ class ExportSql extends ExportPlugin
// an error can happen, for example the table is crashed
$tmp_error = $GLOBALS['dbi']->getError();
if ($tmp_error) {
$message = sprintf(__('Error reading structure for table %s:'), "$db.$table");
$message = sprintf(__('Error reading structure for table %s:'), $db . '.' . $table);
$message .= ' ' . $tmp_error;
if (! defined('TESTSUITE')) {
trigger_error($message, E_USER_ERROR);
@ -2250,7 +2250,7 @@ class ExportSql extends ExportPlugin
// a possible error: the table has crashed
$tmp_error = $GLOBALS['dbi']->getError();
if ($tmp_error) {
$message = sprintf(__('Error reading data for table %s:'), "$db.$table");
$message = sprintf(__('Error reading data for table %s:'), $db . '.' . $table);
$message .= ' ' . $tmp_error;
if (! defined('TESTSUITE')) {
trigger_error($message, E_USER_ERROR);
@ -2333,7 +2333,7 @@ class ExportSql extends ExportPlugin
$table_alias,
$compat,
$sql_backquotes
) . ";";
) . ';';
$truncatehead = $this->_possibleCRLF()
. $this->_exportComment()
. $this->_exportComment(
@ -2590,7 +2590,7 @@ class ExportSql extends ExportPlugin
// 6. DOUBLE field doesn't exists, we will use FLOAT instead
$create_query = preg_replace(
"/^CREATE TABLE IF NOT EXISTS/",
'/^CREATE TABLE IF NOT EXISTS/',
'CREATE TABLE',
$create_query
);

View File

@ -56,16 +56,16 @@ class ExportTexytext extends ExportPlugin
// $exportPluginProperties
// this will be shown as "Format specific options"
$exportSpecificOptions = new OptionsPropertyRootGroup(
"Format Specific Options"
'Format Specific Options'
);
// what to dump (structure/data/both) main group
$dumpWhat = new OptionsPropertyMainGroup(
"general_opts",
'general_opts',
__('Dump table')
);
// create primary items and add them to the group
$leaf = new RadioPropertyItem("structure_or_data");
$leaf = new RadioPropertyItem('structure_or_data');
$leaf->setValues(
[
'structure' => __('structure'),
@ -79,13 +79,13 @@ class ExportTexytext extends ExportPlugin
// data options main group
$dataOptions = new OptionsPropertyMainGroup(
"data",
'data',
__('Data dump options')
);
$dataOptions->setForce('structure');
// create primary items and add them to the group
$leaf = new BoolPropertyItem(
"columns",
'columns',
__('Put columns names in the first row')
);
$dataOptions->addProperty($leaf);

View File

@ -87,51 +87,51 @@ class ExportXml extends ExportPlugin
// $exportPluginProperties
// this will be shown as "Format specific options"
$exportSpecificOptions = new OptionsPropertyRootGroup(
"Format Specific Options"
'Format Specific Options'
);
// general options main group
$generalOptions = new OptionsPropertyMainGroup("general_opts");
$generalOptions = new OptionsPropertyMainGroup('general_opts');
// create primary items and add them to the group
$leaf = new HiddenPropertyItem("structure_or_data");
$leaf = new HiddenPropertyItem('structure_or_data');
$generalOptions->addProperty($leaf);
// add the main group to the root group
$exportSpecificOptions->addProperty($generalOptions);
// export structure main group
$structure = new OptionsPropertyMainGroup(
"structure",
'structure',
__('Object creation options (all are recommended)')
);
// create primary items and add them to the group
$leaf = new BoolPropertyItem(
"export_events",
'export_events',
__('Events')
);
$structure->addProperty($leaf);
$leaf = new BoolPropertyItem(
"export_functions",
'export_functions',
__('Functions')
);
$structure->addProperty($leaf);
$leaf = new BoolPropertyItem(
"export_procedures",
'export_procedures',
__('Procedures')
);
$structure->addProperty($leaf);
$leaf = new BoolPropertyItem(
"export_tables",
'export_tables',
__('Tables')
);
$structure->addProperty($leaf);
$leaf = new BoolPropertyItem(
"export_triggers",
'export_triggers',
__('Triggers')
);
$structure->addProperty($leaf);
$leaf = new BoolPropertyItem(
"export_views",
'export_views',
__('Views')
);
$structure->addProperty($leaf);
@ -139,12 +139,12 @@ class ExportXml extends ExportPlugin
// data main group
$data = new OptionsPropertyMainGroup(
"data",
'data',
__('Data dump options')
);
// create primary items and add them to the group
$leaf = new BoolPropertyItem(
"export_contents",
'export_contents',
__('Export contents')
);
$data->addProperty($leaf);
@ -200,7 +200,7 @@ class ExportXml extends ExportPlugin
$sql = htmlspecialchars(rtrim($sql));
$sql = str_replace("\n", "\n ", $sql);
$head .= " " . $sql . $crlf;
$head .= ' ' . $sql . $crlf;
$head .= ' </pma:' . $type . '>' . $crlf;
}
}
@ -311,7 +311,7 @@ class ExportXml extends ExportPlugin
$head .= ' <pma:' . $type . ' name="' . htmlspecialchars($table) . '">'
. $crlf;
$tbl = " " . htmlspecialchars($tbl);
$tbl = ' ' . htmlspecialchars($tbl);
$tbl = str_replace("\n", "\n ", $tbl);
$head .= $tbl . ';' . $crlf;
@ -330,7 +330,7 @@ class ExportXml extends ExportPlugin
// Do some formatting
$code = mb_substr(rtrim($code), 0, -3);
$code = " " . htmlspecialchars($code);
$code = ' ' . htmlspecialchars($code);
$code = str_replace("\n", "\n ", $code);
$head .= $code . $crlf;
@ -359,7 +359,7 @@ class ExportXml extends ExportPlugin
) {
// Export events
$events = $GLOBALS['dbi']->fetchResult(
"SELECT EVENT_NAME FROM information_schema.EVENTS "
'SELECT EVENT_NAME FROM information_schema.EVENTS '
. "WHERE EVENT_SCHEMA='" . $GLOBALS['dbi']->escapeString($db)
. "'"
);

View File

@ -52,13 +52,13 @@ class ExportYaml extends ExportPlugin
// $exportPluginProperties
// this will be shown as "Format specific options"
$exportSpecificOptions = new OptionsPropertyRootGroup(
"Format Specific Options"
'Format Specific Options'
);
// general options main group
$generalOptions = new OptionsPropertyMainGroup("general_opts");
$generalOptions = new OptionsPropertyMainGroup('general_opts');
// create primary items and add them to the group
$leaf = new HiddenPropertyItem("structure_or_data");
$leaf = new HiddenPropertyItem('structure_or_data');
$generalOptions->addProperty($leaf);
// add the main group to the root group
$exportSpecificOptions->addProperty($generalOptions);

View File

@ -83,7 +83,7 @@ class TableProperty
*/
public function getPureType()
{
$pos = mb_strpos($this->type, "(");
$pos = mb_strpos($this->type, '(');
if ($pos > 0) {
return mb_substr($this->type, 0, $pos);
}
@ -97,7 +97,7 @@ class TableProperty
*/
public function isNotNull()
{
return $this->nullable === "NO" ? "true" : "false";
return $this->nullable === 'NO' ? 'true' : 'false';
}
/**
@ -107,7 +107,7 @@ class TableProperty
*/
public function isUnique(): string
{
return ($this->key === "PRI" || $this->key === "UNI") ? "true" : "false";
return ($this->key === 'PRI' || $this->key === 'UNI') ? 'true' : 'false';
}
/**
@ -117,31 +117,31 @@ class TableProperty
*/
public function getDotNetPrimitiveType()
{
if (mb_strpos($this->type, "int") === 0) {
return "int";
if (mb_strpos($this->type, 'int') === 0) {
return 'int';
}
if (mb_strpos($this->type, "longtext") === 0) {
return "string";
if (mb_strpos($this->type, 'longtext') === 0) {
return 'string';
}
if (mb_strpos($this->type, "long") === 0) {
return "long";
if (mb_strpos($this->type, 'long') === 0) {
return 'long';
}
if (mb_strpos($this->type, "char") === 0) {
return "string";
if (mb_strpos($this->type, 'char') === 0) {
return 'string';
}
if (mb_strpos($this->type, "varchar") === 0) {
return "string";
if (mb_strpos($this->type, 'varchar') === 0) {
return 'string';
}
if (mb_strpos($this->type, "text") === 0) {
return "string";
if (mb_strpos($this->type, 'text') === 0) {
return 'string';
}
if (mb_strpos($this->type, "tinyint") === 0) {
return "bool";
if (mb_strpos($this->type, 'tinyint') === 0) {
return 'bool';
}
if (mb_strpos($this->type, "datetime") === 0) {
return "DateTime";
if (mb_strpos($this->type, 'datetime') === 0) {
return 'DateTime';
}
return "unknown";
return 'unknown';
}
/**
@ -151,31 +151,31 @@ class TableProperty
*/
public function getDotNetObjectType()
{
if (mb_strpos($this->type, "int") === 0) {
return "Int32";
if (mb_strpos($this->type, 'int') === 0) {
return 'Int32';
}
if (mb_strpos($this->type, "longtext") === 0) {
return "String";
if (mb_strpos($this->type, 'longtext') === 0) {
return 'String';
}
if (mb_strpos($this->type, "long") === 0) {
return "Long";
if (mb_strpos($this->type, 'long') === 0) {
return 'Long';
}
if (mb_strpos($this->type, "char") === 0) {
return "String";
if (mb_strpos($this->type, 'char') === 0) {
return 'String';
}
if (mb_strpos($this->type, "varchar") === 0) {
return "String";
if (mb_strpos($this->type, 'varchar') === 0) {
return 'String';
}
if (mb_strpos($this->type, "text") === 0) {
return "String";
if (mb_strpos($this->type, 'text') === 0) {
return 'String';
}
if (mb_strpos($this->type, "tinyint") === 0) {
return "Boolean";
if (mb_strpos($this->type, 'tinyint') === 0) {
return 'Boolean';
}
if (mb_strpos($this->type, "datetime") === 0) {
return "DateTime";
if (mb_strpos($this->type, 'datetime') === 0) {
return 'DateTime';
}
return "Unknown";
return 'Unknown';
}
/**
@ -186,11 +186,11 @@ class TableProperty
public function getIndexName()
{
if (strlen($this->key) > 0) {
return "index=\""
return 'index="'
. htmlspecialchars($this->name, ENT_COMPAT, 'UTF-8')
. "\"";
. '"';
}
return "";
return '';
}
/**
@ -200,7 +200,7 @@ class TableProperty
*/
public function isPK(): bool
{
return $this->key === "PRI";
return $this->key === 'PRI';
}
/**

View File

@ -39,15 +39,15 @@ abstract class AbstractImportCsv extends ImportPlugin
// $importPluginProperties
// this will be shown as "Format specific options"
$importSpecificOptions = new OptionsPropertyRootGroup(
"Format Specific Options"
'Format Specific Options'
);
// general options main group
$generalOptions = new OptionsPropertyMainGroup("general_opts");
$generalOptions = new OptionsPropertyMainGroup('general_opts');
// create common items and add them to the group
$leaf = new BoolPropertyItem(
"replace",
'replace',
__(
'Update data when duplicate keys found on import (add ON DUPLICATE '
. 'KEY UPDATE)'
@ -55,27 +55,27 @@ abstract class AbstractImportCsv extends ImportPlugin
);
$generalOptions->addProperty($leaf);
$leaf = new TextPropertyItem(
"terminated",
'terminated',
__('Columns separated with:')
);
$leaf->setSize(2);
$generalOptions->addProperty($leaf);
$leaf = new TextPropertyItem(
"enclosed",
'enclosed',
__('Columns enclosed with:')
);
$leaf->setSize(2);
$leaf->setLen(2);
$generalOptions->addProperty($leaf);
$leaf = new TextPropertyItem(
"escaped",
'escaped',
__('Columns escaped with:')
);
$leaf->setSize(2);
$leaf->setLen(2);
$generalOptions->addProperty($leaf);
$leaf = new TextPropertyItem(
"new_line",
'new_line',
__('Lines terminated with:')
);
$leaf->setSize(2);

View File

@ -62,7 +62,7 @@ class ImportCsv extends AbstractImportCsv
if ($GLOBALS['plugin_param'] !== 'table') {
$leaf = new TextPropertyItem(
"new_tbl_name",
'new_tbl_name',
__(
'Name of the new table (optional):'
)
@ -71,7 +71,7 @@ class ImportCsv extends AbstractImportCsv
if ($GLOBALS['plugin_param'] === 'server') {
$leaf = new TextPropertyItem(
"new_db_name",
'new_db_name',
__(
'Name of the new database (optional):'
)
@ -80,7 +80,7 @@ class ImportCsv extends AbstractImportCsv
}
$leaf = new NumberPropertyItem(
"partial_import",
'partial_import',
__(
'Import these many number of rows (optional):'
)
@ -88,7 +88,7 @@ class ImportCsv extends AbstractImportCsv
$generalOptions->addProperty($leaf);
$leaf = new BoolPropertyItem(
"col_names",
'col_names',
__(
'The first line of the file contains the table column names'
. ' <i>(if this is unchecked, the first line will become part'
@ -98,7 +98,7 @@ class ImportCsv extends AbstractImportCsv
$generalOptions->addProperty($leaf);
} else {
$leaf = new NumberPropertyItem(
"partial_import",
'partial_import',
__(
'Import these many number of rows (optional):'
)
@ -114,14 +114,14 @@ class ImportCsv extends AbstractImportCsv
)
);
$leaf = new TextPropertyItem(
"columns",
'columns',
__('Column names:') . ' ' . Generator::showHint($hint)
);
$generalOptions->addProperty($leaf);
}
$leaf = new BoolPropertyItem(
"ignore",
'ignore',
__('Do not abort on INSERT error')
);
$generalOptions->addProperty($leaf);
@ -142,9 +142,9 @@ class ImportCsv extends AbstractImportCsv
// but we use directly from $_POST
global $error, $timeout_passed, $finished, $message;
$import_file_name = basename($import_file_name, ".csv");
$import_file_name = basename($import_file_name, '.csv');
$import_file_name = mb_strtolower($import_file_name);
$import_file_name = preg_replace("/[^a-zA-Z0-9_]/", "_", $import_file_name);
$import_file_name = preg_replace('/[^a-zA-Z0-9_]/', '_', $import_file_name);
$replacements = [
'\\n' => "\n",
@ -611,13 +611,13 @@ class ImportCsv extends AbstractImportCsv
}
$sql .= ')';
if (isset($_POST['csv_replace'])) {
$sql .= " ON DUPLICATE KEY UPDATE ";
$sql .= ' ON DUPLICATE KEY UPDATE ';
foreach ($fields as $field) {
$fieldName = Util::backquote(
$field['Field']
);
$sql .= $fieldName . " = VALUES(" . $fieldName
. "), ";
$sql .= $fieldName . ' = VALUES(' . $fieldName
. '), ';
}
$sql = rtrim($sql, ', ');
}
@ -690,14 +690,14 @@ class ImportCsv extends AbstractImportCsv
$tbl_name = $import_file_name;
} else {
// check to see if {filename} as table exist
$name_array = preg_grep("/{$import_file_name}/isU", $result);
$name_array = preg_grep('/' . $import_file_name . '/isU', $result);
// if no use filename as table name
if (count($name_array) === 0) {
$tbl_name = $import_file_name;
} else {
// check if {filename}_ as table exist
$name_array = preg_grep("/{$import_file_name}_/isU", $result);
$tbl_name = $import_file_name . "_" . (count($name_array) + 1);
$name_array = preg_grep('/' . $import_file_name . '_/isU', $result);
$tbl_name = $import_file_name . '_' . (count($name_array) + 1);
}
}
} else {

View File

@ -69,19 +69,19 @@ class ImportLdi extends AbstractImportCsv
$this->properties->setExtension('ldi');
$leaf = new TextPropertyItem(
"columns",
'columns',
__('Column names: ')
);
$generalOptions->addProperty($leaf);
$leaf = new BoolPropertyItem(
"ignore",
'ignore',
__('Do not abort on INSERT error')
);
$generalOptions->addProperty($leaf);
$leaf = new BoolPropertyItem(
"local_option",
'local_option',
__('Use LOCAL keyword')
);
$generalOptions->addProperty($leaf);

View File

@ -92,7 +92,7 @@ class ImportMediawiki extends ImportPlugin
$mediawiki_new_line = "\n";
// Initialize the name of the current table
$cur_table_name = "";
$cur_table_name = '';
$cur_temp_table_headers = [];
$cur_temp_table = [];
@ -145,12 +145,12 @@ class ImportMediawiki extends ImportPlugin
$matches = [];
// Check beginning of comment
if (! strcmp(mb_substr($cur_buffer_line, 0, 4), "<!--")) {
if (! strcmp(mb_substr($cur_buffer_line, 0, 4), '<!--')) {
$inside_comment = true;
continue;
} elseif ($inside_comment) {
// Check end of comment
if (! strcmp(mb_substr($cur_buffer_line, 0, 4), "-->")
if (! strcmp(mb_substr($cur_buffer_line, 0, 4), '-->')
) {
// Only data comments are closed. The structure comments
// will be closed when a data comment begins (in order to
@ -167,7 +167,7 @@ class ImportMediawiki extends ImportPlugin
// Check table name
$match_table_name = [];
if (preg_match(
"/^Table data for `(.*)`$/",
'/^Table data for `(.*)`$/',
$cur_buffer_line,
$match_table_name
)
@ -180,7 +180,7 @@ class ImportMediawiki extends ImportPlugin
$inside_structure_comment
);
} elseif (preg_match(
"/^Table structure for `(.*)`$/",
'/^Table structure for `(.*)`$/',
$cur_buffer_line,
$match_table_name
)
@ -242,7 +242,7 @@ class ImportMediawiki extends ImportPlugin
$this->_importDataOneTable($current_table, $sql_data);
// Reset table name
$cur_table_name = "";
$cur_table_name = '';
}
// What's after the row tag is now only attributes
} elseif (($first_character === '|') || ($first_character === '!')) {
@ -266,8 +266,8 @@ class ImportMediawiki extends ImportPlugin
// Delete the beginning of the column, if there is one
$cell = trim($cell);
$col_start_chars = [
"|",
"!",
'|',
'!',
];
foreach ($col_start_chars as $col_start_char) {
$cell = $this->_getCellContent($cell, $col_start_char);
@ -420,7 +420,7 @@ class ImportMediawiki extends ImportPlugin
private function _delimiterReplace($replace, $subject)
{
// String that will be returned
$cleaned = "";
$cleaned = '';
// Possible states of current character
$inside_tag = false;
$inside_attribute = false;
@ -458,7 +458,7 @@ class ImportMediawiki extends ImportPlugin
// not '|', but the previous one was, it means that the single '|'
// was not appended, so we append it now
if ($partial_separator && $inside_attribute) {
$cleaned .= "|";
$cleaned .= '|';
}
// If the char is different from "|", no separator can be formed
$partial_separator = false;
@ -504,7 +504,7 @@ class ImportMediawiki extends ImportPlugin
*/
private function _explodeMarkup($text)
{
$separator = "||";
$separator = '||';
$placeholder = "\x00";
// Remove placeholder instances

View File

@ -54,14 +54,14 @@ class ImportOds extends ImportPlugin
// $importPluginProperties
// this will be shown as "Format specific options"
$importSpecificOptions = new OptionsPropertyRootGroup(
"Format Specific Options"
'Format Specific Options'
);
// general options main group
$generalOptions = new OptionsPropertyMainGroup("general_opts");
$generalOptions = new OptionsPropertyMainGroup('general_opts');
// create primary items and add them to the group
$leaf = new BoolPropertyItem(
"col_names",
'col_names',
__(
'The first line of the file contains the table column names'
. ' <i>(if this is unchecked, the first line will become part'
@ -70,19 +70,19 @@ class ImportOds extends ImportPlugin
);
$generalOptions->addProperty($leaf);
$leaf = new BoolPropertyItem(
"empty_rows",
'empty_rows',
__('Do not import empty rows')
);
$generalOptions->addProperty($leaf);
$leaf = new BoolPropertyItem(
"recognize_percentages",
'recognize_percentages',
__(
'Import percentages as proper decimals <i>(ex. 12.00% to .12)</i>'
)
);
$generalOptions->addProperty($leaf);
$leaf = new BoolPropertyItem(
"recognize_currency",
'recognize_currency',
__('Import currencies <i>(ex. $5.00 to 5.00)</i>')
);
$generalOptions->addProperty($leaf);
@ -108,7 +108,7 @@ class ImportOds extends ImportPlugin
$i = 0;
$len = 0;
$buffer = "";
$buffer = '';
/**
* Read in the file via Import::getNextChunk so that
@ -141,7 +141,7 @@ class ImportOds extends ImportPlugin
* result in increased performance without the need to
* alter the code in any way. It's basically a freebee.
*/
$xml = @simplexml_load_string($buffer, "SimpleXMLElement", LIBXML_COMPACT);
$xml = @simplexml_load_string($buffer, 'SimpleXMLElement', LIBXML_COMPACT);
unset($buffer);

View File

@ -159,7 +159,7 @@ class ImportShp extends ImportPlugin
// Load data
$shp->loadFromFile('');
if ($shp->lastError != "") {
if ($shp->lastError != '') {
$error = true;
$message = Message::error(
__('There was an error importing the ESRI shape file: "%s".')

View File

@ -60,14 +60,14 @@ class ImportSql extends ImportPlugin
// $importPluginProperties
// this will be shown as "Format specific options"
$importSpecificOptions = new OptionsPropertyRootGroup(
"Format Specific Options"
'Format Specific Options'
);
// general options main group
$generalOptions = new OptionsPropertyMainGroup("general_opts");
$generalOptions = new OptionsPropertyMainGroup('general_opts');
// create primary items and add them to the group
$leaf = new SelectPropertyItem(
"compatibility",
'compatibility',
__('SQL compatibility mode:')
);
$leaf->setValues($values);
@ -79,7 +79,7 @@ class ImportSql extends ImportPlugin
);
$generalOptions->addProperty($leaf);
$leaf = new BoolPropertyItem(
"no_auto_value_on_zero",
'no_auto_value_on_zero',
__('Do not use <code>AUTO_INCREMENT</code> for zero values')
);
$leaf->setDoc(

View File

@ -65,7 +65,7 @@ class ImportXml extends ImportPlugin
$i = 0;
$len = 0;
$buffer = "";
$buffer = '';
/**
* Read in the file via Import::getNextChunk so that
@ -98,7 +98,7 @@ class ImportXml extends ImportPlugin
* result in increased performance without the need to
* alter the code in any way. It's basically a freebee.
*/
$xml = @simplexml_load_string($buffer, "SimpleXMLElement", LIBXML_COMPACT);
$xml = @simplexml_load_string($buffer, 'SimpleXMLElement', LIBXML_COMPACT);
unset($buffer);
@ -208,16 +208,16 @@ class ImportXml extends ImportPlugin
* into another database.
*/
$attrs = $val2->attributes();
$create[] = "USE "
$create[] = 'USE '
. Util::backquote(
$attrs["name"]
$attrs['name']
);
foreach ($val2 as $val3) {
/**
* Remove the extra cosmetic spacing
*/
$val3 = str_replace(" ", "", (string) $val3);
$val3 = str_replace(' ', '', (string) $val3);
$create[] = $val3;
}
}

View File

@ -41,7 +41,7 @@ class UploadApc implements UploadInterface
{
global $SESSION_KEY;
if (trim($id) == "") {
if (trim($id) == '') {
return null;
}
if (! array_key_exists($id, $_SESSION[$SESSION_KEY])) {

View File

@ -41,7 +41,7 @@ class UploadNoplugin implements UploadInterface
{
global $SESSION_KEY;
if (trim($id) == "") {
if (trim($id) == '') {
return null;
}
if (! array_key_exists($id, $_SESSION[$SESSION_KEY])) {

View File

@ -41,7 +41,7 @@ class UploadProgress implements UploadInterface
{
global $SESSION_KEY;
if (trim($id) == "") {
if (trim($id) == '') {
return null;
}

View File

@ -71,7 +71,7 @@ class TableStatsDia extends TableStats
{
ExportRelationSchema::dieSchema(
$this->pageNumber,
"DIA",
'DIA',
sprintf(__('The %s table doesn\'t exist!'), $this->tableName)
);
}

View File

@ -36,7 +36,7 @@ class Eps
*/
public function __construct()
{
$this->stringCommands = "";
$this->stringCommands = '';
$this->stringCommands .= "%!PS-Adobe-3.0 EPSF-3.0 \n";
}
@ -86,11 +86,11 @@ class Eps
public function setOrientation($orientation)
{
$this->stringCommands .= "%%PageOrder: Ascend \n";
if ($orientation == "L") {
$orientation = "Landscape";
if ($orientation == 'L') {
$orientation = 'Landscape';
$this->stringCommands .= '%%Orientation: ' . $orientation . "\n";
} else {
$orientation = "Portrait";
$orientation = 'Portrait';
$this->stringCommands .= '%%Orientation: ' . $orientation . "\n";
}
$this->stringCommands .= "%%EndComments \n";
@ -112,9 +112,9 @@ class Eps
{
$this->font = $value;
$this->fontSize = $size;
$this->stringCommands .= "/" . $value . " findfont % Get the basic font\n";
$this->stringCommands .= ""
. $size . " scalefont % Scale the font to $size points\n";
$this->stringCommands .= '/' . $value . " findfont % Get the basic font\n";
$this->stringCommands .= ''
. $size . ' scalefont % Scale the font to ' . $size . " points\n";
$this->stringCommands
.= "setfont % Make it the current font\n";
}
@ -192,10 +192,10 @@ class Eps
{
$this->stringCommands .= $lineWidth . " setlinewidth \n";
$this->stringCommands .= "newpath \n";
$this->stringCommands .= $x_from . " " . $y_from . " moveto \n";
$this->stringCommands .= "0 " . $y_to . " rlineto \n";
$this->stringCommands .= $x_from . ' ' . $y_from . " moveto \n";
$this->stringCommands .= '0 ' . $y_to . " rlineto \n";
$this->stringCommands .= $x_to . " 0 rlineto \n";
$this->stringCommands .= "0 -" . $y_to . " rlineto \n";
$this->stringCommands .= '0 -' . $y_to . " rlineto \n";
$this->stringCommands .= "closepath \n";
$this->stringCommands .= "stroke \n";
}

View File

@ -69,7 +69,7 @@ class EpsRelationSchema extends ExportRelationSchema
)
);
$this->diagram->setAuthor('phpMyAdmin ' . PMA_VERSION);
$this->diagram->setDate(date("j F Y, g:i a"));
$this->diagram->setDate(date('j F Y, g:i a'));
$this->diagram->setOrientation($this->orientation);
$this->diagram->setFont('Verdana', '10');

View File

@ -89,7 +89,7 @@ class TableStatsEps extends TableStats
{
ExportRelationSchema::dieSchema(
$this->pageNumber,
"EPS",
'EPS',
sprintf(__('The %s table doesn\'t exist!'), $this->tableName)
);
}

View File

@ -293,7 +293,7 @@ class ExportRelationSchema
*/
public static function dieSchema($pageNumber, $type = '', $error_message = '')
{
echo "<p><strong>" , __("SCHEMA ERROR: ") , $type , "</strong></p>" , "\n";
echo '<p><strong>' , __('SCHEMA ERROR: ') , $type , '</strong></p>' , "\n";
if (! empty($error_message)) {
$error_message = htmlspecialchars($error_message);
}

View File

@ -259,7 +259,7 @@ class Pdf extends PdfLib
// This function must be named "Header" to work with the TCPDF library
if ($this->_withDoc) {
if ($this->_offline || $this->_pageNumber == -1) {
$pg_name = __("PDF export page");
$pg_name = __('PDF export page');
} else {
$test_query = 'SELECT * FROM '
. Util::backquote($GLOBALS['cfgRelation']['db']) . '.'

View File

@ -501,7 +501,7 @@ class PdfRelationSchema extends ExportRelationSchema
$this->diagram->Cell(
0,
6,
__('Page number:') . ' {' . sprintf("%02d", $i) . '}',
__('Page number:') . ' {' . sprintf('%02d', $i) . '}',
0,
0,
'R',
@ -563,7 +563,7 @@ class PdfRelationSchema extends ExportRelationSchema
$this->diagram->AddPage($this->orientation);
$this->diagram->Bookmark($table);
$this->diagram->setAlias(
'{' . sprintf("%02d", $z) . '}',
'{' . sprintf('%02d', $z) . '}',
$this->diagram->PageNo()
);
$this->diagram->PMA_links['RT'][$table]['-']

View File

@ -91,7 +91,7 @@ class TableStatsPdf extends TableStats
{
ExportRelationSchema::dieSchema(
$this->pageNumber,
"PDF",
'PDF',
sprintf(__('The %s table doesn\'t exist!'), $this->tableName)
);
}

View File

@ -48,16 +48,16 @@ class SchemaDia extends SchemaPlugin
// $schemaPluginProperties
// this will be shown as "Format specific options"
$exportSpecificOptions = new OptionsPropertyRootGroup(
"Format Specific Options"
'Format Specific Options'
);
// specific options main group
$specificOptions = new OptionsPropertyMainGroup("general_opts");
$specificOptions = new OptionsPropertyMainGroup('general_opts');
// add options common to all plugins
$this->addCommonOptions($specificOptions);
$leaf = new SelectPropertyItem(
"orientation",
'orientation',
__('Orientation')
);
$leaf->setValues(
@ -69,7 +69,7 @@ class SchemaDia extends SchemaPlugin
$specificOptions->addProperty($leaf);
$leaf = new SelectPropertyItem(
"paper",
'paper',
__('Paper size')
);
$leaf->setValues($this->getPaperSizeArray());

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