Split Util class regarding the responsabilities (#15567)
PhpMyAdmin\Util is a very huge class with a lot of responsabilities. There is a lot of work to split it, but this may be just a small start, waiting for a more normalized code. * Split Util class regarding the responsabilities * Split the buttonOrImage function Signed-off-by: Hugues Peccatte <hugues.peccatte@gmail.com>
This commit is contained in:
parent
3b0eff7035
commit
3255e4ad7b
@ -10,6 +10,7 @@ namespace PhpMyAdmin;
|
||||
|
||||
use PhpMyAdmin\Charsets\Charset;
|
||||
use PhpMyAdmin\Charsets\Collation;
|
||||
use PhpMyAdmin\Html\Generator;
|
||||
use PhpMyAdmin\Message;
|
||||
|
||||
/**
|
||||
@ -934,14 +935,14 @@ class CentralColumns
|
||||
'text_dir' => $text_dir,
|
||||
'form_name' => 'tableslistcontainer',
|
||||
]);
|
||||
$html_output .= Util::getButtonOrImage(
|
||||
$html_output .= Generator::getButtonOrImage(
|
||||
'edit_central_columns',
|
||||
'mult_submit change_central_columns',
|
||||
__('Edit'),
|
||||
'b_edit',
|
||||
'edit central columns'
|
||||
);
|
||||
$html_output .= Util::getButtonOrImage(
|
||||
$html_output .= Generator::getButtonOrImage(
|
||||
'delete_central_columns',
|
||||
'mult_submit',
|
||||
__('Delete'),
|
||||
|
||||
@ -16,6 +16,7 @@ declare(strict_types=1);
|
||||
namespace PhpMyAdmin\Config;
|
||||
|
||||
use PhpMyAdmin\Config\Forms\User\UserFormList;
|
||||
use PhpMyAdmin\Html\MySQLDocumentation;
|
||||
use PhpMyAdmin\Sanitize;
|
||||
use PhpMyAdmin\Util;
|
||||
|
||||
@ -785,7 +786,7 @@ class FormDisplay
|
||||
if ($test == 'Import' || $test == 'Export') {
|
||||
return '';
|
||||
}
|
||||
return Util::getDocuLink(
|
||||
return MySQLDocumentation::getDocumentationLink(
|
||||
'config',
|
||||
'cfg_' . $this->_getOptName($path)
|
||||
);
|
||||
|
||||
@ -9,6 +9,7 @@ declare(strict_types=1);
|
||||
namespace PhpMyAdmin\Config;
|
||||
|
||||
use PhpMyAdmin\Config;
|
||||
use PhpMyAdmin\Html\Generator;
|
||||
use PhpMyAdmin\Sanitize;
|
||||
use PhpMyAdmin\Template;
|
||||
use PhpMyAdmin\Url;
|
||||
@ -229,7 +230,7 @@ class FormDisplayTemplate
|
||||
} else {
|
||||
// In this case we just use getImage() because it's available
|
||||
foreach ($iconInit as $k => $v) {
|
||||
$icons[$k] = Util::getImage(
|
||||
$icons[$k] = Generator::getImage(
|
||||
$v[0],
|
||||
$v[1]
|
||||
);
|
||||
|
||||
@ -139,7 +139,7 @@ class Console
|
||||
$GLOBALS['cfg']['Server']['user']
|
||||
);
|
||||
|
||||
$image = Util::getImage('console', __('SQL Query Console'));
|
||||
$image = Html\Generator::getImage('console', __('SQL Query Console'));
|
||||
$_sql_history = $this->relation->getHistory(
|
||||
$GLOBALS['cfg']['Server']['user']
|
||||
);
|
||||
|
||||
@ -8,6 +8,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\Controllers\Database;
|
||||
|
||||
use PhpMyAdmin\Html\Generator;
|
||||
use PhpMyAdmin\Rte\Routines;
|
||||
use PhpMyAdmin\Util;
|
||||
|
||||
|
||||
@ -13,6 +13,7 @@ use PhpMyAdmin\Config\PageSettings;
|
||||
use PhpMyAdmin\Core;
|
||||
use PhpMyAdmin\DatabaseInterface;
|
||||
use PhpMyAdmin\Display\CreateTable;
|
||||
use PhpMyAdmin\Html\Generator;
|
||||
use PhpMyAdmin\Message;
|
||||
use PhpMyAdmin\RecentFavoriteTable;
|
||||
use PhpMyAdmin\Relation;
|
||||
@ -97,17 +98,8 @@ class StructureController extends AbstractController
|
||||
*/
|
||||
private function getDatabaseInfo(string $subPart): void
|
||||
{
|
||||
list(
|
||||
$tables,
|
||||
$numTables,
|
||||
$totalNumTables,
|
||||
,
|
||||
$isShowStats,
|
||||
$dbIsSystemSchema,
|
||||
,
|
||||
,
|
||||
$position
|
||||
) = Util::getDbInfo($this->db, $subPart);
|
||||
[$tables, $numTables, $totalNumTables,, $isShowStats, $dbIsSystemSchema,,, $position]
|
||||
= Util::getDbInfo($this->db, $subPart);
|
||||
|
||||
$this->tables = $tables;
|
||||
$this->numTables = $numTables;
|
||||
@ -171,7 +163,7 @@ class StructureController extends AbstractController
|
||||
if (isset($parameters['sort_order'])) {
|
||||
$urlParams['sort_order'] = $parameters['sort_order'];
|
||||
}
|
||||
$listNavigator = Util::getListNavigator(
|
||||
$listNavigator = Generator::getListNavigator(
|
||||
$this->totalNumTables,
|
||||
$this->position,
|
||||
$urlParams,
|
||||
@ -395,13 +387,20 @@ class StructureController extends AbstractController
|
||||
];
|
||||
// do not list the previous table's size info for a view
|
||||
|
||||
list($current_table, $formatted_size, $unit, $formatted_overhead,
|
||||
$overhead_unit, $overhead_size, $table_is_view, $sum_size)
|
||||
= $this->getStuffForEngineTypeTable(
|
||||
$current_table,
|
||||
$sum_size,
|
||||
$overhead_size
|
||||
);
|
||||
[
|
||||
$current_table,
|
||||
$formatted_size,
|
||||
$unit,
|
||||
$formatted_overhead,
|
||||
$overhead_unit,
|
||||
$overhead_size,
|
||||
$table_is_view,
|
||||
$sum_size,
|
||||
] = $this->getStuffForEngineTypeTable(
|
||||
$current_table,
|
||||
$sum_size,
|
||||
$overhead_size
|
||||
);
|
||||
|
||||
$curTable = $this->dbi
|
||||
->getTable($this->db, $current_table['TABLE_NAME']);
|
||||
@ -544,12 +543,12 @@ class StructureController extends AbstractController
|
||||
$structure_table_rows = [];
|
||||
}
|
||||
|
||||
list($approx_rows, $show_superscript) = $this->isRowCountApproximated(
|
||||
[$approx_rows, $show_superscript] = $this->isRowCountApproximated(
|
||||
$current_table,
|
||||
$table_is_view
|
||||
);
|
||||
|
||||
list($do, $ignored) = $this->getReplicationStatus($truename);
|
||||
[$do, $ignored] = $this->getReplicationStatus($truename);
|
||||
|
||||
$structure_table_rows[] = [
|
||||
'table_name_hash' => md5($current_table['TABLE_NAME']),
|
||||
@ -739,7 +738,7 @@ class StructureController extends AbstractController
|
||||
&& $current_table['TABLE_ROWS'] >= $GLOBALS['cfg']['MaxExactCountViews']
|
||||
) {
|
||||
$approx_rows = true;
|
||||
$show_superscript = Util::showHint(
|
||||
$show_superscript = Generator::showHint(
|
||||
Sanitize::sanitizeMessage(
|
||||
sprintf(
|
||||
__(
|
||||
@ -928,9 +927,15 @@ class StructureController extends AbstractController
|
||||
case 'ARCHIVE':
|
||||
case 'Aria':
|
||||
case 'Maria':
|
||||
list($current_table, $formatted_size, $unit, $formatted_overhead,
|
||||
$overhead_unit, $overhead_size, $sum_size)
|
||||
= $this->getValuesForAriaTable(
|
||||
[
|
||||
$current_table,
|
||||
$formatted_size,
|
||||
$unit,
|
||||
$formatted_overhead,
|
||||
$overhead_unit,
|
||||
$overhead_size,
|
||||
$sum_size,
|
||||
] = $this->getValuesForAriaTable(
|
||||
$current_table,
|
||||
$sum_size,
|
||||
$overhead_size,
|
||||
@ -946,7 +951,7 @@ class StructureController extends AbstractController
|
||||
// InnoDB table: Row count is not accurate but data and index sizes are.
|
||||
// PBMS table in Drizzle: TABLE_ROWS is taken from table cache,
|
||||
// so it may be unavailable
|
||||
list($current_table, $formatted_size, $unit, $sum_size)
|
||||
[$current_table, $formatted_size, $unit, $sum_size]
|
||||
= $this->getValuesForInnodbTable(
|
||||
$current_table,
|
||||
$sum_size
|
||||
@ -1033,7 +1038,7 @@ class StructureController extends AbstractController
|
||||
$tblsize = $current_table['Data_length']
|
||||
+ $current_table['Index_length'];
|
||||
$sum_size += $tblsize;
|
||||
list($formatted_size, $unit) = Util::formatByteDown(
|
||||
[$formatted_size, $unit] = Util::formatByteDown(
|
||||
$tblsize,
|
||||
3,
|
||||
$tblsize > 0 ? 1 : 0
|
||||
@ -1041,7 +1046,7 @@ class StructureController extends AbstractController
|
||||
if (isset($current_table['Data_free'])
|
||||
&& $current_table['Data_free'] > 0
|
||||
) {
|
||||
list($formatted_overhead, $overhead_unit)
|
||||
[$formatted_overhead, $overhead_unit]
|
||||
= Util::formatByteDown(
|
||||
$current_table['Data_free'],
|
||||
3,
|
||||
@ -1091,7 +1096,7 @@ class StructureController extends AbstractController
|
||||
$tblsize = $current_table['Data_length']
|
||||
+ $current_table['Index_length'];
|
||||
$sum_size += $tblsize;
|
||||
list($formatted_size, $unit) = Util::formatByteDown(
|
||||
[$formatted_size, $unit] = Util::formatByteDown(
|
||||
$tblsize,
|
||||
3,
|
||||
($tblsize > 0 ? 1 : 0)
|
||||
|
||||
@ -15,6 +15,7 @@ use PhpMyAdmin\CheckUserPrivileges;
|
||||
use PhpMyAdmin\Config;
|
||||
use PhpMyAdmin\DatabaseInterface;
|
||||
use PhpMyAdmin\Display\GitRevision;
|
||||
use PhpMyAdmin\Html\Generator;
|
||||
use PhpMyAdmin\LanguageManager;
|
||||
use PhpMyAdmin\Message;
|
||||
use PhpMyAdmin\RecentFavoriteTable;
|
||||
@ -84,7 +85,7 @@ class HomeController extends AbstractController
|
||||
$languageManager = LanguageManager::getInstance();
|
||||
|
||||
if (! empty($message)) {
|
||||
$displayMessage = Util::getMessage($message);
|
||||
$displayMessage = Generator::getMessage($message);
|
||||
unset($message);
|
||||
}
|
||||
if (isset($_SESSION['partial_logout'])) {
|
||||
@ -114,7 +115,7 @@ class HomeController extends AbstractController
|
||||
|
||||
if (($cfg['Server']['auth_type'] != 'config') && $cfg['ShowChgPassword']) {
|
||||
$changePassword = $this->template->render('list/item', [
|
||||
'content' => Util::getImage('s_passwd') . ' ' . __(
|
||||
'content' => Generator::getImage('s_passwd') . ' ' . __(
|
||||
'Change password'
|
||||
),
|
||||
'id' => 'li_change_password',
|
||||
@ -151,7 +152,7 @@ class HomeController extends AbstractController
|
||||
}
|
||||
|
||||
$userPreferences = $this->template->render('list/item', [
|
||||
'content' => Util::getImage('b_tblops') . ' ' . __(
|
||||
'content' => Generator::getImage('b_tblops') . ' ' . __(
|
||||
'More settings'
|
||||
),
|
||||
'id' => 'li_user_preferences',
|
||||
@ -197,7 +198,7 @@ class HomeController extends AbstractController
|
||||
$databaseServer = [
|
||||
'host' => $hostInfo,
|
||||
'type' => Util::getServerType(),
|
||||
'connection' => Util::getServerSSL(),
|
||||
'connection' => Generator::getServerSSL(),
|
||||
'version' => $this->dbi->getVersionString() . ' - ' . $this->dbi->getVersionComment(),
|
||||
'protocol' => $this->dbi->getProtoInfo(),
|
||||
'user' => $this->dbi->fetchValue('SELECT USER();'),
|
||||
|
||||
@ -10,6 +10,7 @@ namespace PhpMyAdmin\Controllers\Server;
|
||||
|
||||
use PhpMyAdmin\Controllers\AbstractController;
|
||||
use PhpMyAdmin\DatabaseInterface;
|
||||
use PhpMyAdmin\Html\Generator;
|
||||
use PhpMyAdmin\Message;
|
||||
use PhpMyAdmin\Response;
|
||||
use PhpMyAdmin\Template;
|
||||
@ -112,7 +113,7 @@ class BinlogController extends AbstractController
|
||||
'url_params' => $urlParams,
|
||||
'binary_logs' => $this->binaryLogs,
|
||||
'log' => $params['log'],
|
||||
'sql_message' => Util::getMessage(Message::success(), $sqlQuery),
|
||||
'sql_message' => Generator::getMessage(Message::success(), $sqlQuery),
|
||||
'values' => $values,
|
||||
'has_previous' => $position > 0,
|
||||
'has_next' => $numRows >= $cfg['MaxRows'],
|
||||
|
||||
@ -14,6 +14,7 @@ use PhpMyAdmin\Charsets\Collation;
|
||||
use PhpMyAdmin\CheckUserPrivileges;
|
||||
use PhpMyAdmin\Controllers\AbstractController;
|
||||
use PhpMyAdmin\DatabaseInterface;
|
||||
use PhpMyAdmin\Html\Generator;
|
||||
use PhpMyAdmin\Message;
|
||||
use PhpMyAdmin\Response;
|
||||
use PhpMyAdmin\Template;
|
||||
@ -192,7 +193,7 @@ class DatabasesController extends AbstractController
|
||||
*/
|
||||
$sqlQuery = 'CREATE DATABASE ' . Util::backquote($params['new_db']);
|
||||
if (! empty($params['db_collation'])) {
|
||||
list($databaseCharset) = explode('_', $params['db_collation']);
|
||||
[$databaseCharset] = explode('_', $params['db_collation']);
|
||||
$charsets = Charsets::getCharsets(
|
||||
$this->dbi,
|
||||
$cfg['Server']['DisableIS']
|
||||
@ -233,7 +234,7 @@ class DatabasesController extends AbstractController
|
||||
|
||||
$json = [
|
||||
'message' => $message,
|
||||
'sql_query' => Util::getMessage(null, $sqlQuery, 'success'),
|
||||
'sql_query' => Generator::getMessage(null, $sqlQuery, 'success'),
|
||||
'url_query' => $scriptName . Url::getCommon(
|
||||
['db' => $params['new_db']],
|
||||
strpos($scriptName, '?') === false ? '?' : '&'
|
||||
|
||||
@ -8,6 +8,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\Controllers\Server\Status;
|
||||
|
||||
use PhpMyAdmin\Html\Generator;
|
||||
use PhpMyAdmin\Message;
|
||||
use PhpMyAdmin\Util;
|
||||
|
||||
@ -237,7 +238,7 @@ class ProcessesController extends AbstractController
|
||||
'time' => $process['Time'],
|
||||
'state' => ! empty($process['State']) ? $process['State'] : '---',
|
||||
'progress' => ! empty($process['Progress']) ? $process['Progress'] : '---',
|
||||
'info' => ! empty($process['Info']) ? Util::formatSql(
|
||||
'info' => ! empty($process['Info']) ? Generator::formatSql(
|
||||
$process['Info'],
|
||||
! $showFullSql
|
||||
) : '---',
|
||||
|
||||
@ -8,6 +8,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\Controllers\Server\Status;
|
||||
|
||||
use PhpMyAdmin\Html\Generator;
|
||||
use PhpMyAdmin\Util;
|
||||
|
||||
/**
|
||||
@ -79,7 +80,7 @@ class VariablesController extends AbstractController
|
||||
// Fields containing % are calculated,
|
||||
// they can not be described in MySQL documentation
|
||||
if (mb_strpos($name, '%') === false) {
|
||||
$variables[$name]['doc'] = Util::linkToVarDocumentation(
|
||||
$variables[$name]['doc'] = Generator::linkToVarDocumentation(
|
||||
$name,
|
||||
$this->dbi->isMariaDB()
|
||||
);
|
||||
|
||||
@ -9,6 +9,7 @@ declare(strict_types=1);
|
||||
namespace PhpMyAdmin\Controllers\Server;
|
||||
|
||||
use PhpMyAdmin\Controllers\AbstractController;
|
||||
use PhpMyAdmin\Html\Generator;
|
||||
use PhpMyAdmin\Util;
|
||||
use Williamdes\MariaDBMySQLKBS\KBException;
|
||||
use Williamdes\MariaDBMySQLKBS\Search as KBSearch;
|
||||
@ -54,15 +55,17 @@ class VariablesController extends AbstractController
|
||||
foreach ($serverVars as $name => $value) {
|
||||
$hasSessionValue = isset($serverVarsSession[$name])
|
||||
&& $serverVarsSession[$name] !== $value;
|
||||
$docLink = Util::linkToVarDocumentation(
|
||||
$docLink = Generator::linkToVarDocumentation(
|
||||
$name,
|
||||
$this->dbi->isMariaDB(),
|
||||
str_replace('_', ' ', $name)
|
||||
);
|
||||
|
||||
list($formattedValue, $isEscaped) = $this->formatVariable($name, $value);
|
||||
[$formattedValue, $isEscaped] = $this->formatVariable($name, $value);
|
||||
if ($hasSessionValue) {
|
||||
list($sessionFormattedValue, ) = $this->formatVariable(
|
||||
[
|
||||
$sessionFormattedValue,
|
||||
] = $this->formatVariable(
|
||||
$name,
|
||||
$serverVarsSession[$name]
|
||||
);
|
||||
@ -187,7 +190,7 @@ class VariablesController extends AbstractController
|
||||
. '";',
|
||||
'NUM'
|
||||
);
|
||||
list($formattedValue, $isHtmlFormatted) = $this->formatVariable(
|
||||
[$formattedValue, $isHtmlFormatted] = $this->formatVariable(
|
||||
$params['varName'],
|
||||
$varValue[1]
|
||||
);
|
||||
|
||||
@ -9,6 +9,7 @@ declare(strict_types=1);
|
||||
namespace PhpMyAdmin\Controllers\Table;
|
||||
|
||||
use PhpMyAdmin\DatabaseInterface;
|
||||
use PhpMyAdmin\Html\Generator;
|
||||
use PhpMyAdmin\Index;
|
||||
use PhpMyAdmin\Message;
|
||||
use PhpMyAdmin\Response;
|
||||
@ -158,7 +159,7 @@ class IndexesController extends AbstractController
|
||||
$message->addParam($this->table);
|
||||
$this->response->addJSON(
|
||||
'message',
|
||||
Util::getMessage($message, $sql_query, 'success')
|
||||
Generator::getMessage($message, $sql_query, 'success')
|
||||
);
|
||||
$this->response->addJSON(
|
||||
'index_table',
|
||||
|
||||
@ -10,6 +10,7 @@ namespace PhpMyAdmin\Controllers\Table;
|
||||
|
||||
use PhpMyAdmin\Core;
|
||||
use PhpMyAdmin\DatabaseInterface;
|
||||
use PhpMyAdmin\Html\Generator;
|
||||
use PhpMyAdmin\Index;
|
||||
use PhpMyAdmin\Relation;
|
||||
use PhpMyAdmin\Response;
|
||||
@ -230,7 +231,7 @@ class RelationController extends AbstractController
|
||||
)
|
||||
) {
|
||||
$this->response->addHTML(
|
||||
Util::getMessage(
|
||||
Generator::getMessage(
|
||||
__('Display column was successfully updated.'),
|
||||
'',
|
||||
'success'
|
||||
@ -256,7 +257,7 @@ class RelationController extends AbstractController
|
||||
// foreign db is not the same)
|
||||
if (isset($_POST['destination_foreign_db'], $_POST['destination_foreign_table'])
|
||||
&& isset($_POST['destination_foreign_column'])) {
|
||||
list($html, $preview_sql_data, $display_query, $seen_error)
|
||||
[$html, $preview_sql_data, $display_query, $seen_error]
|
||||
= $this->upd_query->updateForeignKeys(
|
||||
$_POST['destination_foreign_db'],
|
||||
$multi_edit_columns_name,
|
||||
@ -279,7 +280,7 @@ class RelationController extends AbstractController
|
||||
if (! empty($display_query) && ! $seen_error) {
|
||||
$GLOBALS['display_query'] = $display_query;
|
||||
$this->response->addHTML(
|
||||
Util::getMessage(
|
||||
Generator::getMessage(
|
||||
__('Your SQL query has been executed successfully.'),
|
||||
null,
|
||||
'success'
|
||||
@ -309,7 +310,7 @@ class RelationController extends AbstractController
|
||||
)
|
||||
) {
|
||||
$this->response->addHTML(
|
||||
Util::getMessage(
|
||||
Generator::getMessage(
|
||||
__('Internal relationships were successfully updated.'),
|
||||
'',
|
||||
'success'
|
||||
|
||||
@ -9,6 +9,7 @@ declare(strict_types=1);
|
||||
namespace PhpMyAdmin\Controllers\Table;
|
||||
|
||||
use PhpMyAdmin\DatabaseInterface;
|
||||
use PhpMyAdmin\Html\Generator;
|
||||
use PhpMyAdmin\Relation;
|
||||
use PhpMyAdmin\Response;
|
||||
use PhpMyAdmin\Sql;
|
||||
@ -375,7 +376,7 @@ class SearchController extends AbstractController
|
||||
|
||||
//Displays form for point data and scatter plot
|
||||
$titles = [
|
||||
'Browse' => Util::getIcon(
|
||||
'Browse' => Generator::getIcon(
|
||||
'b_browse',
|
||||
__('Browse foreign values')
|
||||
),
|
||||
@ -629,7 +630,7 @@ class SearchController extends AbstractController
|
||||
$this->_connectionCharSet
|
||||
);
|
||||
$this->response->addHTML(
|
||||
Util::getMessage(
|
||||
Generator::getMessage(
|
||||
__('Your SQL query has been executed successfully.'),
|
||||
null,
|
||||
'success'
|
||||
@ -933,7 +934,7 @@ class SearchController extends AbstractController
|
||||
$entered_value = (isset($_POST['criteriaValues'])
|
||||
? $_POST['criteriaValues'] : '');
|
||||
$titles = [
|
||||
'Browse' => Util::getIcon(
|
||||
'Browse' => Generator::getIcon(
|
||||
'b_browse',
|
||||
__('Browse foreign values')
|
||||
),
|
||||
|
||||
@ -16,6 +16,7 @@ use PhpMyAdmin\Core;
|
||||
use PhpMyAdmin\CreateAddField;
|
||||
use PhpMyAdmin\DatabaseInterface;
|
||||
use PhpMyAdmin\Engines\Innodb;
|
||||
use PhpMyAdmin\Html\Generator;
|
||||
use PhpMyAdmin\Index;
|
||||
use PhpMyAdmin\Message;
|
||||
use PhpMyAdmin\ParseAnalyze;
|
||||
@ -252,16 +253,18 @@ class StructureController extends AbstractController
|
||||
// handle confirmation of deleting multiple columns
|
||||
$action = Url::getFromRoute('/table/structure');
|
||||
$GLOBALS['selected'] = $_POST['selected_fld'];
|
||||
list(
|
||||
$what_ret, $query_type_ret, $is_unset_submit_mult,
|
||||
$mult_btn_ret, $centralColsError
|
||||
)
|
||||
= $this->getDataForSubmitMult(
|
||||
$submit_mult,
|
||||
$_POST['selected_fld'],
|
||||
$action,
|
||||
$containerBuilder
|
||||
);
|
||||
[
|
||||
$what_ret,
|
||||
$query_type_ret,
|
||||
$is_unset_submit_mult,
|
||||
$mult_btn_ret,
|
||||
$centralColsError,
|
||||
] = $this->getDataForSubmitMult(
|
||||
$submit_mult,
|
||||
$_POST['selected_fld'],
|
||||
$action,
|
||||
$containerBuilder
|
||||
);
|
||||
//update the existing variables
|
||||
// todo: refactor mult_submits.inc.php such as
|
||||
// below globals are not needed anymore
|
||||
@ -289,7 +292,7 @@ class StructureController extends AbstractController
|
||||
$message = Message::success();
|
||||
}
|
||||
$this->response->addHTML(
|
||||
Util::getMessage($message, $sql_query)
|
||||
Generator::getMessage($message, $sql_query)
|
||||
);
|
||||
}
|
||||
} else {
|
||||
@ -777,7 +780,7 @@ class StructureController extends AbstractController
|
||||
);
|
||||
$message->addParam($this->table);
|
||||
$this->response->addHTML(
|
||||
Util::getMessage($message, $sql_query, 'success')
|
||||
Generator::getMessage($message, $sql_query, 'success')
|
||||
);
|
||||
} else {
|
||||
$this->response->setRequestStatus(false);
|
||||
@ -852,10 +855,10 @@ class StructureController extends AbstractController
|
||||
|
||||
// Parse and analyze the query
|
||||
$db = &$this->db;
|
||||
list(
|
||||
[
|
||||
$analyzed_sql_results,
|
||||
$db,
|
||||
) = ParseAnalyze::sqlQuery($sql_query, $db);
|
||||
] = ParseAnalyze::sqlQuery($sql_query, $db);
|
||||
// @todo: possibly refactor
|
||||
extract($analyzed_sql_results);
|
||||
|
||||
@ -965,7 +968,7 @@ class StructureController extends AbstractController
|
||||
// To allow replication, we first select the db to use
|
||||
// and then run queries on this db.
|
||||
if (! $this->dbi->selectDb($this->db)) {
|
||||
Util::mysqlDie(
|
||||
Generator::mysqlDie(
|
||||
$this->dbi->getError(),
|
||||
'USE ' . Util::backquote($this->db) . ';',
|
||||
false,
|
||||
@ -1044,7 +1047,7 @@ class StructureController extends AbstractController
|
||||
$message->addParam($this->table);
|
||||
|
||||
$this->response->addHTML(
|
||||
Util::getMessage($message, $sql_query, 'success')
|
||||
Generator::getMessage($message, $sql_query, 'success')
|
||||
);
|
||||
} else {
|
||||
// An error happened while inserting/updating a table definition
|
||||
@ -1265,20 +1268,20 @@ class StructureController extends AbstractController
|
||||
$columns_list = [];
|
||||
|
||||
$titles = [
|
||||
'Change' => Util::getIcon('b_edit', __('Change')),
|
||||
'Drop' => Util::getIcon('b_drop', __('Drop')),
|
||||
'NoDrop' => Util::getIcon('b_drop', __('Drop')),
|
||||
'Primary' => Util::getIcon('b_primary', __('Primary')),
|
||||
'Index' => Util::getIcon('b_index', __('Index')),
|
||||
'Unique' => Util::getIcon('b_unique', __('Unique')),
|
||||
'Spatial' => Util::getIcon('b_spatial', __('Spatial')),
|
||||
'IdxFulltext' => Util::getIcon('b_ftext', __('Fulltext')),
|
||||
'NoPrimary' => Util::getIcon('bd_primary', __('Primary')),
|
||||
'NoIndex' => Util::getIcon('bd_index', __('Index')),
|
||||
'NoUnique' => Util::getIcon('bd_unique', __('Unique')),
|
||||
'NoSpatial' => Util::getIcon('bd_spatial', __('Spatial')),
|
||||
'NoIdxFulltext' => Util::getIcon('bd_ftext', __('Fulltext')),
|
||||
'DistinctValues' => Util::getIcon('b_browse', __('Distinct values')),
|
||||
'Change' => Generator::getIcon('b_edit', __('Change')),
|
||||
'Drop' => Generator::getIcon('b_drop', __('Drop')),
|
||||
'NoDrop' => Generator::getIcon('b_drop', __('Drop')),
|
||||
'Primary' => Generator::getIcon('b_primary', __('Primary')),
|
||||
'Index' => Generator::getIcon('b_index', __('Index')),
|
||||
'Unique' => Generator::getIcon('b_unique', __('Unique')),
|
||||
'Spatial' => Generator::getIcon('b_spatial', __('Spatial')),
|
||||
'IdxFulltext' => Generator::getIcon('b_ftext', __('Fulltext')),
|
||||
'NoPrimary' => Generator::getIcon('bd_primary', __('Primary')),
|
||||
'NoIndex' => Generator::getIcon('bd_index', __('Index')),
|
||||
'NoUnique' => Generator::getIcon('bd_unique', __('Unique')),
|
||||
'NoSpatial' => Generator::getIcon('bd_spatial', __('Spatial')),
|
||||
'NoIdxFulltext' => Generator::getIcon('bd_ftext', __('Fulltext')),
|
||||
'DistinctValues' => Generator::getIcon('b_browse', __('Distinct values')),
|
||||
];
|
||||
|
||||
/**
|
||||
@ -1329,12 +1332,12 @@ class StructureController extends AbstractController
|
||||
|
||||
if ($primary_index && $primary_index->hasColumn($field['Field'])) {
|
||||
$displayed_fields[$rownum]->icon .=
|
||||
Util::getImage('b_primary', __('Primary'));
|
||||
Generator::getImage('b_primary', __('Primary'));
|
||||
}
|
||||
|
||||
if (in_array($field['Field'], $columns_with_index)) {
|
||||
$displayed_fields[$rownum]->icon .=
|
||||
Util::getImage('bd_primary', __('Index'));
|
||||
Generator::getImage('bd_primary', __('Index'));
|
||||
}
|
||||
|
||||
$collation = Charsets::findCollationByName(
|
||||
@ -1426,25 +1429,25 @@ class StructureController extends AbstractController
|
||||
// this is to display for example 261.2 MiB instead of 268k KiB
|
||||
$max_digits = 3;
|
||||
$decimals = 1;
|
||||
list($data_size, $data_unit) = Util::formatByteDown(
|
||||
[$data_size, $data_unit] = Util::formatByteDown(
|
||||
$this->_showtable['Data_length'],
|
||||
$max_digits,
|
||||
$decimals
|
||||
);
|
||||
if ($mergetable === false) {
|
||||
list($index_size, $index_unit) = Util::formatByteDown(
|
||||
[$index_size, $index_unit] = Util::formatByteDown(
|
||||
$this->_showtable['Index_length'],
|
||||
$max_digits,
|
||||
$decimals
|
||||
);
|
||||
}
|
||||
if (isset($this->_showtable['Data_free'])) {
|
||||
list($free_size, $free_unit) = Util::formatByteDown(
|
||||
[$free_size, $free_unit] = Util::formatByteDown(
|
||||
$this->_showtable['Data_free'],
|
||||
$max_digits,
|
||||
$decimals
|
||||
);
|
||||
list($effect_size, $effect_unit) = Util::formatByteDown(
|
||||
[$effect_size, $effect_unit] = Util::formatByteDown(
|
||||
$this->_showtable['Data_length']
|
||||
+ $this->_showtable['Index_length']
|
||||
- $this->_showtable['Data_free'],
|
||||
@ -1452,20 +1455,20 @@ class StructureController extends AbstractController
|
||||
$decimals
|
||||
);
|
||||
} else {
|
||||
list($effect_size, $effect_unit) = Util::formatByteDown(
|
||||
[$effect_size, $effect_unit] = Util::formatByteDown(
|
||||
$this->_showtable['Data_length']
|
||||
+ $this->_showtable['Index_length'],
|
||||
$max_digits,
|
||||
$decimals
|
||||
);
|
||||
}
|
||||
list($tot_size, $tot_unit) = Util::formatByteDown(
|
||||
[$tot_size, $tot_unit] = Util::formatByteDown(
|
||||
$this->_showtable['Data_length'] + $this->_showtable['Index_length'],
|
||||
$max_digits,
|
||||
$decimals
|
||||
);
|
||||
if ($this->_table_info_num_rows > 0) {
|
||||
list($avg_size, $avg_unit) = Util::formatByteDown(
|
||||
[$avg_size, $avg_unit] = Util::formatByteDown(
|
||||
($this->_showtable['Data_length']
|
||||
+ $this->_showtable['Index_length'])
|
||||
/ $this->_showtable['Rows'],
|
||||
|
||||
@ -813,10 +813,10 @@ class Core
|
||||
$retval .= __('No change');
|
||||
} elseif (is_array($query_data)) {
|
||||
foreach ($query_data as $query) {
|
||||
$retval .= Util::formatSql($query);
|
||||
$retval .= Html\Generator::formatSql($query);
|
||||
}
|
||||
} else {
|
||||
$retval .= Util::formatSql($query_data);
|
||||
$retval .= Html\Generator::formatSql($query_data);
|
||||
}
|
||||
$retval .= '</div>';
|
||||
$response = Response::getInstance();
|
||||
|
||||
@ -8,6 +8,8 @@ declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin;
|
||||
|
||||
use PhpMyAdmin\Html\Generator;
|
||||
|
||||
/**
|
||||
* Set of functions for /table/create and /table/addfield
|
||||
*
|
||||
@ -285,14 +287,14 @@ class CreateAddField
|
||||
private function getColumnCreationStatements(bool $isCreateTable = true): string
|
||||
{
|
||||
$sqlStatement = "";
|
||||
list(
|
||||
[
|
||||
$fieldCount,
|
||||
$fieldPrimary,
|
||||
$fieldIndex,
|
||||
$fieldUnique,
|
||||
$fieldFullText,
|
||||
$fieldSpatial
|
||||
) = $this->getIndexedColumns();
|
||||
$fieldSpatial,
|
||||
] = $this->getIndexedColumns();
|
||||
$definitions = $this->buildColumnCreationStatement(
|
||||
$fieldCount,
|
||||
$isCreateTable
|
||||
@ -533,7 +535,7 @@ class CreateAddField
|
||||
// To allow replication, we first select the db to use and then run queries
|
||||
// on this db.
|
||||
if (! $this->dbi->selectDb($db)) {
|
||||
Util::mysqlDie(
|
||||
Generator::mysqlDie(
|
||||
$this->dbi->getError(),
|
||||
'USE ' . Util::backquote($db),
|
||||
false,
|
||||
|
||||
@ -10,6 +10,7 @@ namespace PhpMyAdmin\Database;
|
||||
|
||||
use PhpMyAdmin\Core;
|
||||
use PhpMyAdmin\DatabaseInterface;
|
||||
use PhpMyAdmin\Html\Generator;
|
||||
use PhpMyAdmin\Message;
|
||||
use PhpMyAdmin\Relation;
|
||||
use PhpMyAdmin\SavedSearches;
|
||||
@ -363,7 +364,7 @@ class Qbe
|
||||
exit;
|
||||
}
|
||||
// The tables list gets from MySQL
|
||||
while (list($table) = $this->dbi->fetchRow($all_tables)) {
|
||||
while ([$table] = $this->dbi->fetchRow($all_tables)) {
|
||||
$columns = $this->dbi->getColumns($this->_db, $table);
|
||||
|
||||
if (empty($this->_criteriaTables[$table])
|
||||
@ -1310,7 +1311,7 @@ class Qbe
|
||||
$unique_columns = $indexes['unique'];
|
||||
$index_columns = $indexes['index'];
|
||||
|
||||
list($candidate_columns, $needsort)
|
||||
[$candidate_columns, $needsort]
|
||||
= $this->_getLeftJoinColumnCandidatesBest(
|
||||
$search_tables,
|
||||
$where_clause_columns,
|
||||
@ -1805,7 +1806,7 @@ class Qbe
|
||||
$html_output .= '<legend>'
|
||||
. sprintf(
|
||||
__('SQL query on database <b>%s</b>:'),
|
||||
Util::getDbLink($this->_db)
|
||||
Generator::getDbLink($this->_db)
|
||||
);
|
||||
$html_output .= '</legend>';
|
||||
$text_dir = 'ltr';
|
||||
|
||||
@ -9,6 +9,8 @@ declare(strict_types=1);
|
||||
namespace PhpMyAdmin\Database;
|
||||
|
||||
use PhpMyAdmin\DatabaseInterface;
|
||||
use PhpMyAdmin\Html\MySQLDocumentation;
|
||||
use PhpMyAdmin\Html\Generator;
|
||||
use PhpMyAdmin\Template;
|
||||
use PhpMyAdmin\Util;
|
||||
|
||||
@ -321,16 +323,16 @@ class Search
|
||||
{
|
||||
$choices = [
|
||||
'1' => $this->searchTypes[1] . ' '
|
||||
. Util::showHint(
|
||||
. Generator::showHint(
|
||||
__('Words are separated by a space character (" ").')
|
||||
),
|
||||
'2' => $this->searchTypes[2] . ' '
|
||||
. Util::showHint(
|
||||
. Generator::showHint(
|
||||
__('Words are separated by a space character (" ").')
|
||||
),
|
||||
'3' => $this->searchTypes[3],
|
||||
'4' => $this->searchTypes[4],
|
||||
'5' => $this->searchTypes[5] . ' ' . Util::showMySQLDocu('Regexp'),
|
||||
'5' => $this->searchTypes[5] . ' ' . MySQLDocumentation::show('Regexp'),
|
||||
];
|
||||
return $this->template->render('database/search/main', [
|
||||
'db' => $this->db,
|
||||
|
||||
@ -12,6 +12,8 @@ use mysqli_result;
|
||||
use PhpMyAdmin\Database\DatabaseList;
|
||||
use PhpMyAdmin\Dbi\DbiExtension;
|
||||
use PhpMyAdmin\Dbi\DbiMysqli;
|
||||
use PhpMyAdmin\Html\Generator;
|
||||
use PhpMyAdmin\Html\MySQLDocumentation;
|
||||
use PhpMyAdmin\SqlParser\Context;
|
||||
|
||||
/**
|
||||
@ -159,7 +161,7 @@ class DatabaseInterface
|
||||
bool $cache_affected_rows = true
|
||||
) {
|
||||
$res = $this->tryQuery($query, $link, $options, $cache_affected_rows)
|
||||
or Util::mysqlDie($this->getError($link), $query);
|
||||
or Generator::mysqlDie($this->getError($link), $query);
|
||||
|
||||
return $res;
|
||||
}
|
||||
@ -950,7 +952,7 @@ class DatabaseInterface
|
||||
|
||||
$mysql_error = $this->getError($link);
|
||||
if (! count($databases) && $GLOBALS['errno']) {
|
||||
Util::mysqlDie($mysql_error, $sql);
|
||||
Generator::mysqlDie($mysql_error, $sql);
|
||||
}
|
||||
|
||||
// display only databases also in official database list
|
||||
@ -2337,12 +2339,12 @@ class DatabaseInterface
|
||||
if ($type === 'super') {
|
||||
$query = 'SELECT 1 FROM mysql.user LIMIT 1';
|
||||
} elseif ($type === 'create') {
|
||||
list($user, $host) = $this->getCurrentUserAndHost();
|
||||
[$user, $host] = $this->getCurrentUserAndHost();
|
||||
$query = "SELECT 1 FROM `INFORMATION_SCHEMA`.`USER_PRIVILEGES` "
|
||||
. "WHERE `PRIVILEGE_TYPE` = 'CREATE USER' AND "
|
||||
. "'''" . $user . "''@''" . $host . "''' LIKE `GRANTEE` LIMIT 1";
|
||||
} elseif ($type === 'grant') {
|
||||
list($user, $host) = $this->getCurrentUserAndHost();
|
||||
[$user, $host] = $this->getCurrentUserAndHost();
|
||||
$query = "SELECT 1 FROM ("
|
||||
. "SELECT `GRANTEE`, `IS_GRANTABLE` FROM "
|
||||
. "`INFORMATION_SCHEMA`.`COLUMN_PRIVILEGES` UNION "
|
||||
@ -2591,7 +2593,7 @@ class DatabaseInterface
|
||||
*/
|
||||
public function connect(int $mode, ?array $server = null, ?int $target = null)
|
||||
{
|
||||
list($user, $password, $server) = $this->getConnectionParams($mode, $server);
|
||||
[$user, $password, $server] = $this->getConnectionParams($mode, $server);
|
||||
|
||||
if ($target === null) {
|
||||
$target = $mode;
|
||||
@ -3144,7 +3146,7 @@ class DatabaseInterface
|
||||
}
|
||||
|
||||
if (! self::checkDbExtension('mysqli')) {
|
||||
$docUrl = Util::getDocuLink('faq', 'faqmysql');
|
||||
$docUrl = MySQLDocumentation::getDocumentationLink('faq', 'faqmysql');
|
||||
$docLink = sprintf(
|
||||
__('See %sour documentation%s for more information.'),
|
||||
'[a@' . $docUrl . '@documentation]',
|
||||
|
||||
@ -8,6 +8,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\Display;
|
||||
|
||||
use PhpMyAdmin\Html\MySQLDocumentation;
|
||||
use PhpMyAdmin\Message;
|
||||
use PhpMyAdmin\Relation;
|
||||
use PhpMyAdmin\RelationCleanup;
|
||||
@ -151,7 +152,7 @@ class ChangePassword
|
||||
. 'or an \'<i>unencrypted connection that encrypts the '
|
||||
. 'password using RSA</i>\'; while connecting to the server.'
|
||||
)
|
||||
. Util::showMySQLDocu(
|
||||
. MySQLDocumentation::show(
|
||||
'sha256-authentication-plugin'
|
||||
)
|
||||
)
|
||||
|
||||
@ -11,6 +11,7 @@ namespace PhpMyAdmin\Display;
|
||||
use PhpMyAdmin\Core;
|
||||
use PhpMyAdmin\DatabaseInterface;
|
||||
use PhpMyAdmin\Encoding;
|
||||
use PhpMyAdmin\Html\MySQLDocumentation;
|
||||
use PhpMyAdmin\Message;
|
||||
use PhpMyAdmin\Plugins;
|
||||
use PhpMyAdmin\Plugins\ExportPlugin;
|
||||
@ -362,7 +363,7 @@ class Export
|
||||
);
|
||||
$msg->addParamHtml('</a>');
|
||||
$msg->addParam($trans);
|
||||
$docUrl = Util::getDocuLink('faq', 'faq6-27');
|
||||
$docUrl = MySQLDocumentation::getDocumentationLink('faq', 'faq6-27');
|
||||
$msg->addParamHtml(
|
||||
'<a href="' . $docUrl . '" target="documentation">'
|
||||
);
|
||||
|
||||
@ -11,6 +11,7 @@ namespace PhpMyAdmin\Display;
|
||||
use PhpMyAdmin\Config\SpecialSchemaLinks;
|
||||
use PhpMyAdmin\Core;
|
||||
use PhpMyAdmin\DatabaseInterface;
|
||||
use PhpMyAdmin\Html\Generator;
|
||||
use PhpMyAdmin\Index;
|
||||
use PhpMyAdmin\Message;
|
||||
use PhpMyAdmin\Plugins\Transformations\Output\Text_Octetstream_Sql;
|
||||
@ -878,10 +879,10 @@ class Results
|
||||
$pageSelector = '';
|
||||
$numberTotalPage = 1;
|
||||
if (! $isShowingAll) {
|
||||
list(
|
||||
[
|
||||
$pageSelector,
|
||||
$numberTotalPage
|
||||
) = $this->_getHtmlPageSelector();
|
||||
$numberTotalPage,
|
||||
] = $this->_getHtmlPageSelector();
|
||||
}
|
||||
|
||||
// Move to the next page or to the last one
|
||||
@ -1068,7 +1069,7 @@ class Results
|
||||
// ($GLOBALS['cfg']['ShowBrowseComments']).
|
||||
$comments_map = $this->_getTableCommentsArray($analyzed_sql_results);
|
||||
|
||||
list($col_order, $col_visib) = $this->_getColumnParams(
|
||||
[$col_order, $col_visib] = $this->_getColumnParams(
|
||||
$analyzed_sql_results
|
||||
);
|
||||
|
||||
@ -1095,7 +1096,7 @@ class Results
|
||||
$display_params = $this->__get('display_params');
|
||||
|
||||
if (($displayParts['sort_lnk'] == '1') && ! $is_limited_display) {
|
||||
list($order_link, $sorted_header_html)
|
||||
[$order_link, $sorted_header_html]
|
||||
= $this->_getOrderLinkAndSortedHeaderHtml(
|
||||
$fields_meta[$i],
|
||||
$sort_expression,
|
||||
@ -1193,7 +1194,7 @@ class Results
|
||||
|
||||
// 1. Set $colspan and generate html with full/partial
|
||||
// text button or link
|
||||
list($colspan, $buttonHtml) = $this->_getFieldVisibilityParams(
|
||||
[$colspan, $buttonHtml] = $this->_getFieldVisibilityParams(
|
||||
$displayParts,
|
||||
$fullOrPartialTextLink
|
||||
);
|
||||
@ -1518,7 +1519,7 @@ class Results
|
||||
return '';
|
||||
}
|
||||
|
||||
list($columnOrder, $columnVisibility) = $this->_getColumnParams(
|
||||
[$columnOrder, $columnVisibility] = $this->_getColumnParams(
|
||||
$analyzedSqlResults
|
||||
);
|
||||
|
||||
@ -1609,7 +1610,7 @@ class Results
|
||||
. $tmp_txt . '" title="' . $tmp_txt . '">';
|
||||
$tmp_url = Url::getFromRoute('/sql', $url_params_full_text);
|
||||
|
||||
return Util::linkOrButton($tmp_url, $tmp_image);
|
||||
return Generator::linkOrButton($tmp_url, $tmp_image);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1687,7 +1688,7 @@ class Results
|
||||
|
||||
// Generates the orderby clause part of the query which is part
|
||||
// of URL
|
||||
list($single_sort_order, $multi_sort_order, $order_img)
|
||||
[$single_sort_order, $multi_sort_order, $order_img]
|
||||
= $this->_getSingleAndMultiSortUrls(
|
||||
$sort_expression,
|
||||
$sort_expression_nodirection,
|
||||
@ -1854,7 +1855,7 @@ class Results
|
||||
) . ' ';
|
||||
}
|
||||
if ($is_in_sort) {
|
||||
list($single_sort_order, $order_img)
|
||||
[$single_sort_order, $order_img]
|
||||
= $this->_getSortingUrlParams(
|
||||
$sort_direction,
|
||||
$single_sort_order,
|
||||
@ -1866,7 +1867,7 @@ class Results
|
||||
}
|
||||
if ($current_name == $name_to_use_in_sort && $is_in_sort) {
|
||||
// We need to generate the arrow button and related html
|
||||
list($sort_order, $order_img) = $this->_getSortingUrlParams(
|
||||
[$sort_order, $order_img] = $this->_getSortingUrlParams(
|
||||
$sort_direction,
|
||||
$sort_order,
|
||||
$index
|
||||
@ -1992,40 +1993,40 @@ class Results
|
||||
{
|
||||
if (strtoupper(trim($sort_direction[$index])) == self::DESCENDING_SORT_DIR) {
|
||||
$sort_order .= ' ASC';
|
||||
$order_img = ' ' . Util::getImage(
|
||||
's_desc',
|
||||
__('Descending'),
|
||||
[
|
||||
'class' => "soimg",
|
||||
'title' => '',
|
||||
]
|
||||
);
|
||||
$order_img .= ' ' . Util::getImage(
|
||||
's_asc',
|
||||
__('Ascending'),
|
||||
[
|
||||
'class' => "soimg hide",
|
||||
'title' => '',
|
||||
]
|
||||
);
|
||||
$order_img = ' ' . Generator::getImage(
|
||||
's_desc',
|
||||
__('Descending'),
|
||||
[
|
||||
'class' => "soimg",
|
||||
'title' => '',
|
||||
]
|
||||
);
|
||||
$order_img .= ' ' . Generator::getImage(
|
||||
's_asc',
|
||||
__('Ascending'),
|
||||
[
|
||||
'class' => "soimg hide",
|
||||
'title' => '',
|
||||
]
|
||||
);
|
||||
} else {
|
||||
$sort_order .= ' DESC';
|
||||
$order_img = ' ' . Util::getImage(
|
||||
's_asc',
|
||||
__('Ascending'),
|
||||
[
|
||||
'class' => "soimg",
|
||||
'title' => '',
|
||||
]
|
||||
);
|
||||
$order_img .= ' ' . Util::getImage(
|
||||
's_desc',
|
||||
__('Descending'),
|
||||
[
|
||||
'class' => "soimg hide",
|
||||
'title' => '',
|
||||
]
|
||||
);
|
||||
$order_img = ' ' . Generator::getImage(
|
||||
's_asc',
|
||||
__('Ascending'),
|
||||
[
|
||||
'class' => "soimg",
|
||||
'title' => '',
|
||||
]
|
||||
);
|
||||
$order_img .= ' ' . Generator::getImage(
|
||||
's_desc',
|
||||
__('Descending'),
|
||||
[
|
||||
'class' => "soimg hide",
|
||||
'title' => '',
|
||||
]
|
||||
);
|
||||
}
|
||||
return [
|
||||
$sort_order,
|
||||
@ -2061,7 +2062,7 @@ class Results
|
||||
$inner_link_content = $order_link_content . $order_img
|
||||
. '<input type="hidden" value="' . $multi_order_url . '">';
|
||||
|
||||
return Util::linkOrButton(
|
||||
return Generator::linkOrButton(
|
||||
$order_url,
|
||||
$inner_link_content,
|
||||
$order_link_params
|
||||
@ -2468,7 +2469,7 @@ class Results
|
||||
}
|
||||
|
||||
// prepare to get the column order, if available
|
||||
list($col_order, $col_visib) = $this->_getColumnParams(
|
||||
[$col_order, $col_visib] = $this->_getColumnParams(
|
||||
$analyzed_sql_results
|
||||
);
|
||||
|
||||
@ -2525,7 +2526,7 @@ class Results
|
||||
* with only one field and it's a BLOB; in this case,
|
||||
* avoid to display the delete and edit links
|
||||
*/
|
||||
list($where_clause, $clause_is_unique, $condition_array)
|
||||
[$where_clause, $clause_is_unique, $condition_array]
|
||||
= Util::getUniqueCondition(
|
||||
$dt_result, // handle
|
||||
$this->__get('fields_cnt'), // fields_cnt
|
||||
@ -2542,8 +2543,13 @@ class Results
|
||||
|
||||
// 1.2.1 Modify link(s) - update row case
|
||||
if ($displayParts['edit_lnk'] == self::UPDATE_ROW) {
|
||||
list($edit_url, $copy_url, $edit_str, $copy_str,
|
||||
$edit_anchor_class)
|
||||
[
|
||||
$edit_url,
|
||||
$copy_url,
|
||||
$edit_str,
|
||||
$copy_str,
|
||||
$edit_anchor_class,
|
||||
]
|
||||
= $this->_getModifiedLinks(
|
||||
$where_clause,
|
||||
$clause_is_unique,
|
||||
@ -2552,7 +2558,7 @@ class Results
|
||||
} // end if (1.2.1)
|
||||
|
||||
// 1.2.2 Delete/Kill link(s)
|
||||
list($del_url, $del_str, $js_conf)
|
||||
[$del_url, $del_str, $js_conf]
|
||||
= $this->_getDeleteAndKillLinks(
|
||||
$where_clause,
|
||||
$clause_is_unique,
|
||||
@ -3349,7 +3355,7 @@ class Results
|
||||
|
||||
$del_url = Url::getFromRoute('/sql', $_url_params);
|
||||
$js_conf = $kill;
|
||||
$del_str = Util::getIcon(
|
||||
$del_str = Generator::getIcon(
|
||||
'b_drop',
|
||||
__('Kill')
|
||||
);
|
||||
@ -3385,7 +3391,7 @@ class Results
|
||||
&& $GLOBALS['cfg']['RowActionType'] == self::ACTION_LINK_CONTENT_ICONS
|
||||
) {
|
||||
$linkContent .= '<span class="nowrap">'
|
||||
. Util::getImage(
|
||||
. Generator::getImage(
|
||||
$icon,
|
||||
$display_text
|
||||
)
|
||||
@ -3395,7 +3401,7 @@ class Results
|
||||
) {
|
||||
$linkContent .= '<span class="nowrap">' . $display_text . '</span>';
|
||||
} else {
|
||||
$linkContent .= Util::getIcon(
|
||||
$linkContent .= Generator::getIcon(
|
||||
$icon,
|
||||
$display_text
|
||||
);
|
||||
@ -3670,11 +3676,11 @@ class Results
|
||||
|
||||
// Convert to WKT format
|
||||
$wktval = Util::asWKT($column);
|
||||
list(
|
||||
[
|
||||
$is_field_truncated,
|
||||
$displayedColumn,
|
||||
// skip 3rd param
|
||||
) = $this->_getPartialText($wktval);
|
||||
] = $this->_getPartialText($wktval);
|
||||
|
||||
$cell = $this->_getRowData(
|
||||
$class,
|
||||
@ -3701,11 +3707,11 @@ class Results
|
||||
$where_comparison = ' = ' . $column;
|
||||
|
||||
$wkbval = substr(bin2hex($column), 8);
|
||||
list(
|
||||
[
|
||||
$is_field_truncated,
|
||||
$displayedColumn,
|
||||
// skip 3rd param
|
||||
) = $this->_getPartialText($wkbval);
|
||||
] = $this->_getPartialText($wkbval);
|
||||
|
||||
$cell = $this->_getRowData(
|
||||
$class,
|
||||
@ -3832,11 +3838,11 @@ class Results
|
||||
&& strpos($transformation_plugin->getName(), 'Link') !== false)
|
||||
&& false === stripos($field_flags, self::BINARY_FIELD)
|
||||
) {
|
||||
list(
|
||||
[
|
||||
$is_field_truncated,
|
||||
$column,
|
||||
$original_length
|
||||
) = $this->_getPartialText($column);
|
||||
$original_length,
|
||||
] = $this->_getPartialText($column);
|
||||
}
|
||||
|
||||
$formatted = false;
|
||||
@ -4134,7 +4140,7 @@ class Results
|
||||
$sql = new Sql();
|
||||
if ($is_innodb && $sql->isJustBrowsing($analyzed_sql_results, true)) {
|
||||
$pre_count = '~';
|
||||
$after_count = Util::showHint(
|
||||
$after_count = Generator::showHint(
|
||||
Sanitize::sanitizeMessage(
|
||||
__('May be approximate. See [doc@faq3-11]FAQ 3.11[/doc].')
|
||||
)
|
||||
@ -4149,16 +4155,16 @@ class Results
|
||||
// 1.1 Gets the information about which functionalities should be
|
||||
// displayed
|
||||
|
||||
list(
|
||||
[
|
||||
$displayParts,
|
||||
$total
|
||||
) = $this->_setDisplayPartsAndTotal($displayParts);
|
||||
$total,
|
||||
] = $this->_setDisplayPartsAndTotal($displayParts);
|
||||
|
||||
// 1.2 Defines offsets for the next and previous pages
|
||||
$pos_next = null;
|
||||
$pos_prev = null;
|
||||
if ($displayParts['nav_bar'] == '1') {
|
||||
list($pos_next, $pos_prev) = $this->_getOffsets();
|
||||
[$pos_next, $pos_prev] = $this->_getOffsets();
|
||||
} // end if
|
||||
|
||||
// 1.3 Extract sorting expressions.
|
||||
@ -4205,13 +4211,13 @@ class Results
|
||||
$after_count
|
||||
);
|
||||
|
||||
$sqlQueryMessage = Util::getMessage(
|
||||
$sqlQueryMessage = Generator::getMessage(
|
||||
$message,
|
||||
$this->__get('sql_query'),
|
||||
'success'
|
||||
);
|
||||
} elseif ((! isset($printview) || ($printview != '1')) && ! $is_limited_display) {
|
||||
$sqlQueryMessage = Util::getMessage(
|
||||
$sqlQueryMessage = Generator::getMessage(
|
||||
__('Your SQL query has been executed successfully.'),
|
||||
$this->__get('sql_query'),
|
||||
'success'
|
||||
@ -4233,7 +4239,7 @@ class Results
|
||||
// can the result be sorted?
|
||||
if ($displayParts['sort_lnk'] == '1' && $analyzed_sql_results['statement'] !== null) {
|
||||
// At this point, $sort_expression is an array
|
||||
list($unsorted_sql_query, $sort_by_key_html)
|
||||
[$unsorted_sql_query, $sort_by_key_html]
|
||||
= $this->_getUnsortedSqlAndSortByKeyDropDown(
|
||||
$analyzed_sql_results,
|
||||
$sort_expression
|
||||
@ -4388,7 +4394,7 @@ class Results
|
||||
$sort_table = $this->__get('table');
|
||||
$sort_column = $sort_expression_nodirection;
|
||||
} else {
|
||||
list($sort_table, $sort_column)
|
||||
[$sort_table, $sort_column]
|
||||
= explode('.', $sort_expression_nodirection);
|
||||
}
|
||||
|
||||
@ -4546,7 +4552,7 @@ class Results
|
||||
|
||||
$message->addParam('[doc@cfg_MaxExactCount]');
|
||||
$message->addParam('[/doc]');
|
||||
$message_view_warning = Util::showHint($message);
|
||||
$message_view_warning = Generator::showHint($message);
|
||||
} else {
|
||||
$message_view_warning = false;
|
||||
}
|
||||
@ -4686,7 +4692,7 @@ class Results
|
||||
'form_name' => 'resultsForm_' . $this->__get('unique_id'),
|
||||
]);
|
||||
|
||||
$links_html .= Util::getButtonOrImage(
|
||||
$links_html .= Generator::getButtonOrImage(
|
||||
'submit_mult',
|
||||
'mult_submit',
|
||||
__('Edit'),
|
||||
@ -4694,7 +4700,7 @@ class Results
|
||||
'edit'
|
||||
);
|
||||
|
||||
$links_html .= Util::getButtonOrImage(
|
||||
$links_html .= Generator::getButtonOrImage(
|
||||
'submit_mult',
|
||||
'mult_submit',
|
||||
__('Copy'),
|
||||
@ -4702,7 +4708,7 @@ class Results
|
||||
'copy'
|
||||
);
|
||||
|
||||
$links_html .= Util::getButtonOrImage(
|
||||
$links_html .= Generator::getButtonOrImage(
|
||||
'submit_mult',
|
||||
'mult_submit',
|
||||
$delete_text,
|
||||
@ -4711,7 +4717,7 @@ class Results
|
||||
);
|
||||
|
||||
if ($analyzed_sql_results['querytype'] == 'SELECT') {
|
||||
$links_html .= Util::getButtonOrImage(
|
||||
$links_html .= Generator::getButtonOrImage(
|
||||
'submit_mult',
|
||||
'mult_submit',
|
||||
__('Export'),
|
||||
@ -4742,7 +4748,7 @@ class Results
|
||||
|
||||
// $clause_is_unique is needed by getTable() to generate the proper param
|
||||
// in the multi-edit and multi-delete form
|
||||
list($where_clause, $clause_is_unique, $condition_array)
|
||||
[$where_clause, $clause_is_unique, $condition_array]
|
||||
= Util::getUniqueCondition(
|
||||
$dt_result, // handle
|
||||
$this->__get('fields_cnt'), // fields_cnt
|
||||
@ -4782,9 +4788,9 @@ class Results
|
||||
$results_operations_html = '';
|
||||
if (empty($analyzed_sql_results['procedure'])) {
|
||||
$results_operations_html .= '<span>'
|
||||
. Util::linkOrButton(
|
||||
. Generator::linkOrButton(
|
||||
Url::getFromRoute('/view/create', $params),
|
||||
Util::getIcon(
|
||||
Generator::getIcon(
|
||||
'b_view_add',
|
||||
__('Create view'),
|
||||
true
|
||||
@ -4828,9 +4834,9 @@ class Results
|
||||
*/
|
||||
private function _getCopytoclipboardLinks()
|
||||
{
|
||||
return Util::linkOrButton(
|
||||
return Generator::linkOrButton(
|
||||
'#',
|
||||
Util::getIcon(
|
||||
Generator::getIcon(
|
||||
'b_insrow',
|
||||
__('Copy to clipboard'),
|
||||
true
|
||||
@ -4848,9 +4854,9 @@ class Results
|
||||
*/
|
||||
private function _getPrintviewLinks()
|
||||
{
|
||||
return Util::linkOrButton(
|
||||
return Generator::linkOrButton(
|
||||
'#',
|
||||
Util::getIcon(
|
||||
Generator::getIcon(
|
||||
'b_print',
|
||||
__('Print'),
|
||||
true
|
||||
@ -4956,25 +4962,25 @@ class Results
|
||||
}
|
||||
}
|
||||
|
||||
$results_operations_html .= Util::linkOrButton(
|
||||
Url::getFromRoute('/table/export', $_url_params),
|
||||
Util::getIcon(
|
||||
'b_tblexport',
|
||||
__('Export'),
|
||||
true
|
||||
$results_operations_html .= Generator::linkOrButton(
|
||||
Url::getFromRoute('/table/export', $_url_params),
|
||||
Generator::getIcon(
|
||||
'b_tblexport',
|
||||
__('Export'),
|
||||
true
|
||||
)
|
||||
)
|
||||
)
|
||||
. "\n";
|
||||
|
||||
// prepare chart
|
||||
$results_operations_html .= Util::linkOrButton(
|
||||
Url::getFromRoute('/table/chart', $_url_params),
|
||||
Util::getIcon(
|
||||
'b_chart',
|
||||
__('Display chart'),
|
||||
true
|
||||
$results_operations_html .= Generator::linkOrButton(
|
||||
Url::getFromRoute('/table/chart', $_url_params),
|
||||
Generator::getIcon(
|
||||
'b_chart',
|
||||
__('Display chart'),
|
||||
true
|
||||
)
|
||||
)
|
||||
)
|
||||
. "\n";
|
||||
|
||||
// prepare GIS chart
|
||||
@ -4989,9 +4995,9 @@ class Results
|
||||
|
||||
if ($geometry_found) {
|
||||
$results_operations_html
|
||||
.= Util::linkOrButton(
|
||||
.= Generator::linkOrButton(
|
||||
Url::getFromRoute('/table/gis_visualization', $_url_params),
|
||||
Util::getIcon(
|
||||
Generator::getIcon(
|
||||
'b_globe',
|
||||
__('Visualize GIS data'),
|
||||
true
|
||||
@ -5119,11 +5125,11 @@ class Results
|
||||
} else {
|
||||
$result = '0x' . bin2hex($content);
|
||||
}
|
||||
list(
|
||||
[
|
||||
$is_truncated,
|
||||
$result,
|
||||
// skip 3rd param
|
||||
) = $this->_getPartialText($result);
|
||||
] = $this->_getPartialText($result);
|
||||
}
|
||||
|
||||
/* Create link to download */
|
||||
@ -5173,7 +5179,7 @@ class Results
|
||||
);
|
||||
|
||||
if ($dispresult && $GLOBALS['dbi']->numRows($dispresult) > 0) {
|
||||
list($dispval) = $GLOBALS['dbi']->fetchRow($dispresult, 0);
|
||||
[$dispval] = $GLOBALS['dbi']->fetchRow($dispresult, 0);
|
||||
} else {
|
||||
$dispval = __('Link not found!');
|
||||
}
|
||||
@ -5340,7 +5346,7 @@ class Results
|
||||
if (strpos($class, 'grid_edit') !== false) {
|
||||
$tag_params['class'] = 'ajax';
|
||||
}
|
||||
$result .= Util::linkOrButton(
|
||||
$result .= Generator::linkOrButton(
|
||||
Url::getFromRoute('/sql', $_url_params),
|
||||
$displayedData,
|
||||
$tag_params
|
||||
@ -5437,7 +5443,7 @@ class Results
|
||||
if (! empty($edit_url)) {
|
||||
$ret .= '<td class="' . $class . ' text-center print_ignore">'
|
||||
. '<span class="nowrap">'
|
||||
. Util::linkOrButton($edit_url, $edit_str);
|
||||
. Generator::linkOrButton($edit_url, $edit_str);
|
||||
/*
|
||||
* Where clause for selecting this row uniquely is provided as
|
||||
* a hidden input. Used by jQuery scripts for handling grid editing
|
||||
@ -5482,7 +5488,7 @@ class Results
|
||||
}
|
||||
|
||||
$ret .= 'text-center print_ignore"><span class="nowrap">'
|
||||
. Util::linkOrButton($copy_url, $copy_str);
|
||||
. Generator::linkOrButton($copy_url, $copy_str);
|
||||
|
||||
/*
|
||||
* Where clause for selecting this row uniquely is provided as
|
||||
@ -5526,7 +5532,7 @@ class Results
|
||||
}
|
||||
$ajax = Response::getInstance()->isAjax() ? ' ajax' : '';
|
||||
$ret .= 'text-center print_ignore">'
|
||||
. Util::linkOrButton(
|
||||
. Generator::linkOrButton(
|
||||
$del_url,
|
||||
$del_str,
|
||||
['class' => 'delete_row requireConfirm' . $ajax]
|
||||
|
||||
@ -214,7 +214,7 @@ class Footer
|
||||
$retval .= '<a href="' . htmlspecialchars($url) . '"'
|
||||
. ' title="' . __('Open new phpMyAdmin window') . '" target="_blank" rel="noopener noreferrer">';
|
||||
if (Util::showIcons('TabsMode')) {
|
||||
$retval .= Util::getImage(
|
||||
$retval .= Html\Generator::getImage(
|
||||
'window-new',
|
||||
__('Open new phpMyAdmin window')
|
||||
);
|
||||
|
||||
@ -8,6 +8,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin;
|
||||
|
||||
use PhpMyAdmin\Html\Generator;
|
||||
use PhpMyAdmin\Navigation\Navigation;
|
||||
|
||||
/**
|
||||
@ -506,7 +507,7 @@ class Header
|
||||
if (isset($GLOBALS['buffer_message'])) {
|
||||
$buffer_message = $GLOBALS['buffer_message'];
|
||||
}
|
||||
$retval .= Util::getMessage($message);
|
||||
$retval .= Generator::getMessage($message);
|
||||
if (isset($buffer_message)) {
|
||||
$GLOBALS['buffer_message'] = $buffer_message;
|
||||
}
|
||||
|
||||
@ -0,0 +1,36 @@
|
||||
<?php
|
||||
/**
|
||||
* Interface for links (image, text, …)
|
||||
*
|
||||
* @package PhpMyAdmin
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\Html\ActionLinksModes;
|
||||
|
||||
/**
|
||||
* Interface for links (image, text, …)
|
||||
*
|
||||
* @package PhpMyAdmin
|
||||
*/
|
||||
interface ActionLinksModesInterface
|
||||
{
|
||||
/**
|
||||
* Generate the link in the right form
|
||||
*
|
||||
* @param string $name Name of the generated element
|
||||
* @param string $class Class of the generated element, if image mode
|
||||
* @param string $text Text of the generated element
|
||||
* @param string $image Image of the generated element, if image mode
|
||||
* @param string $value Value of the generated element
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function generate(
|
||||
string $name,
|
||||
string $class,
|
||||
string $text,
|
||||
string $image,
|
||||
string $value = ''
|
||||
): string;
|
||||
}
|
||||
32
libraries/classes/Html/ActionLinksModes/Factory.php
Normal file
32
libraries/classes/Html/ActionLinksModes/Factory.php
Normal file
@ -0,0 +1,32 @@
|
||||
<?php
|
||||
/**
|
||||
* ActionLinksModesInterface builder
|
||||
*
|
||||
* @package PhpMyAdmin
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\Html\ActionLinksModes;
|
||||
|
||||
/**
|
||||
* ActionLinksModesInterface builder
|
||||
*
|
||||
* @package PhpMyAdmin
|
||||
*/
|
||||
class Factory
|
||||
{
|
||||
/**
|
||||
* Build an ActionLinksModesInterface to generate the HTML element
|
||||
*
|
||||
* @param string $mode Mode (text, image)
|
||||
*
|
||||
* @return ActionLinksModesInterface
|
||||
*/
|
||||
public static function build(string $mode): ActionLinksModesInterface
|
||||
{
|
||||
if ('text' === $mode) {
|
||||
return new Text();
|
||||
}
|
||||
return new Image();
|
||||
}
|
||||
}
|
||||
47
libraries/classes/Html/ActionLinksModes/Image.php
Normal file
47
libraries/classes/Html/ActionLinksModes/Image.php
Normal file
@ -0,0 +1,47 @@
|
||||
<?php
|
||||
/**
|
||||
* Image link generator
|
||||
*
|
||||
* @package PhpMyAdmin
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\Html\ActionLinksModes;
|
||||
|
||||
use PhpMyAdmin\Html\Generator;
|
||||
|
||||
/**
|
||||
* Image link generator
|
||||
*
|
||||
* @package PhpMyAdmin
|
||||
*/
|
||||
class Image implements ActionLinksModesInterface
|
||||
{
|
||||
/**
|
||||
* Generate the link in the right form
|
||||
*
|
||||
* @param string $name Name of the generated element
|
||||
* @param string $class Class of the generated element, if image mode
|
||||
* @param string $text Text of the generated element
|
||||
* @param string $image Image of the generated element, if image mode
|
||||
* @param string $value Value of the generated element
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function generate(
|
||||
string $name,
|
||||
string $class,
|
||||
string $text,
|
||||
string $image,
|
||||
string $value = ''
|
||||
): string {
|
||||
if (empty($value)) {
|
||||
$value = $text;
|
||||
}
|
||||
return '<button class="btn btn-link ' . $class . '" type="submit"'
|
||||
. ' name="' . $name . '" value="' . htmlspecialchars($value)
|
||||
. '" title="' . htmlspecialchars($text) . '">' . "\n"
|
||||
. Generator::getIcon($image, $text)
|
||||
. '</button>' . "\n";
|
||||
}
|
||||
}
|
||||
43
libraries/classes/Html/ActionLinksModes/Text.php
Normal file
43
libraries/classes/Html/ActionLinksModes/Text.php
Normal file
@ -0,0 +1,43 @@
|
||||
<?php
|
||||
/**
|
||||
* Text link generator
|
||||
*
|
||||
* @package PhpMyAdmin
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\Html\ActionLinksModes;
|
||||
|
||||
/**
|
||||
* Text link generator
|
||||
*
|
||||
* @package PhpMyAdmin
|
||||
*/
|
||||
class Text implements ActionLinksModesInterface
|
||||
{
|
||||
/**
|
||||
* Generate the link in the right form
|
||||
*
|
||||
* @param string $name Name of the generated element
|
||||
* @param string $class Class of the generated element, if image mode
|
||||
* @param string $text Text of the generated element
|
||||
* @param string $image Image of the generated element, if image mode
|
||||
* @param string $value Value of the generated element
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function generate(
|
||||
string $name,
|
||||
string $class,
|
||||
string $text,
|
||||
string $image,
|
||||
string $value = ''
|
||||
): string {
|
||||
if (empty($value)) {
|
||||
$value = $text;
|
||||
}
|
||||
return ' <input class="btn btn-link" type="submit" name="' . $name . '"'
|
||||
. ' value="' . htmlspecialchars($value) . '"'
|
||||
. ' title="' . htmlspecialchars($text) . '">' . "\n";
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,50 @@
|
||||
<?php
|
||||
/**
|
||||
* HTML Generator for "browse"
|
||||
*
|
||||
* @package PhpMyAdmin
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\Html\Forms\Fields;
|
||||
|
||||
use PhpMyAdmin\Html\Forms;
|
||||
use PhpMyAdmin\Util;
|
||||
|
||||
/**
|
||||
* HTML Generator for "browse"
|
||||
*
|
||||
* @package PhpMyAdmin
|
||||
*/
|
||||
class BrowseUploadFileBlock implements FieldGenerator
|
||||
{
|
||||
|
||||
/**
|
||||
* Prepare the form used to browse anywhere on the local server for a file to
|
||||
* import
|
||||
*
|
||||
* @param string $max_upload_size maximum upload size
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function generate(string $max_upload_size): string
|
||||
{
|
||||
$block_html = '';
|
||||
|
||||
if ($GLOBALS['is_upload'] && ! empty($GLOBALS['cfg']['UploadDir'])) {
|
||||
$block_html .= '<label for="radio_import_file">';
|
||||
} else {
|
||||
$block_html .= '<label for="input_import_file">';
|
||||
}
|
||||
|
||||
$block_html .= __('Browse your computer:') . '</label>'
|
||||
. '<div id="upload_form_status" class="hide"></div>'
|
||||
. '<div id="upload_form_status_info" class="hide"></div>'
|
||||
. '<input type="file" name="import_file" id="input_import_file">'
|
||||
. Util::getFormattedMaximumUploadSize($max_upload_size) . "\n"
|
||||
// some browsers should respect this :)
|
||||
. Forms\Fields\MaxFileSize::generate($max_upload_size) . "\n";
|
||||
|
||||
return $block_html;
|
||||
}
|
||||
}
|
||||
80
libraries/classes/Html/Forms/Fields/DropDown.php
Normal file
80
libraries/classes/Html/Forms/Fields/DropDown.php
Normal file
@ -0,0 +1,80 @@
|
||||
<?php
|
||||
/**
|
||||
* HTML Generator for drop down
|
||||
*
|
||||
* @package PhpMyAdmin
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\Html\Forms\Fields;
|
||||
|
||||
use PhpMyAdmin\Template;
|
||||
use Throwable;
|
||||
use Twig_Error_Loader;
|
||||
use Twig_Error_Runtime;
|
||||
use Twig_Error_Syntax;
|
||||
|
||||
/**
|
||||
* HTML Generator for drop down
|
||||
*
|
||||
* @package PhpMyAdmin
|
||||
*/
|
||||
class DropDown implements FieldGenerator
|
||||
{
|
||||
|
||||
/**
|
||||
* Generates and returns an HTML dropdown
|
||||
*
|
||||
* @param string $select_name name for the select element
|
||||
* @param array $choices choices values
|
||||
* @param string $active_choice the choice to select by default
|
||||
* @param string $id id of the select element; can be different in
|
||||
* case the dropdown is present more than once
|
||||
* on the page
|
||||
* @param string $class class for the select element
|
||||
* @param string $placeholder Placeholder for dropdown if nothing else
|
||||
* is selected
|
||||
*
|
||||
* @return string html content
|
||||
*
|
||||
* @throws Throwable
|
||||
* @throws Twig_Error_Loader
|
||||
* @throws Twig_Error_Runtime
|
||||
* @throws Twig_Error_Syntax
|
||||
* @todo support titles
|
||||
*/
|
||||
public static function generate(
|
||||
$select_name,
|
||||
array $choices,
|
||||
$active_choice,
|
||||
$id,
|
||||
$class = '',
|
||||
$placeholder = null
|
||||
): string {
|
||||
$template = new Template();
|
||||
$resultOptions = [];
|
||||
$selected = false;
|
||||
|
||||
foreach ($choices as $one_choice_value => $one_choice_label) {
|
||||
$resultOptions[$one_choice_value]['value'] = $one_choice_value;
|
||||
$resultOptions[$one_choice_value]['selected'] = false;
|
||||
|
||||
if ($one_choice_value == $active_choice) {
|
||||
$resultOptions[$one_choice_value]['selected'] = true;
|
||||
$selected = true;
|
||||
}
|
||||
$resultOptions[$one_choice_value]['label'] = $one_choice_label;
|
||||
}
|
||||
return $template->render(
|
||||
'dropdown',
|
||||
[
|
||||
'select_name' => $select_name,
|
||||
'id' => $id,
|
||||
'class' => $class,
|
||||
'placeholder' => $placeholder,
|
||||
'selected' => $selected,
|
||||
'result_options' => $resultOptions,
|
||||
]
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,86 @@
|
||||
<?php
|
||||
/**
|
||||
* HTML Generator for drop down for file upload
|
||||
*
|
||||
* @package PhpMyAdmin
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\Html\Forms\Fields;
|
||||
|
||||
use PhpMyAdmin\FileListing;
|
||||
use PhpMyAdmin\Message;
|
||||
use PhpMyAdmin\Plugins\ImportPlugin;
|
||||
use PhpMyAdmin\Util;
|
||||
|
||||
/**
|
||||
* * HTML Generator for drop down for file upload
|
||||
*
|
||||
* @package PhpMyAdmin
|
||||
*/
|
||||
class DropDownUploadFileBlock implements FieldGenerator
|
||||
{
|
||||
|
||||
/**
|
||||
* Prepare the form used to select a file to import from the server upload
|
||||
* directory
|
||||
*
|
||||
* @param ImportPlugin[] $import_list array of import plugins
|
||||
* @param string $uploaddir upload directory
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function generate($import_list, $uploaddir): string
|
||||
{
|
||||
$fileListing = new FileListing();
|
||||
|
||||
$block_html = '';
|
||||
$block_html .= '<label for="radio_local_import_file">'
|
||||
. sprintf(
|
||||
__('Select from the web server upload directory <b>%s</b>:'),
|
||||
htmlspecialchars(Util::userDir($uploaddir))
|
||||
)
|
||||
. '</label>';
|
||||
|
||||
$extensions = '';
|
||||
foreach ($import_list as $import_plugin) {
|
||||
if (! empty($extensions)) {
|
||||
$extensions .= '|';
|
||||
}
|
||||
$extensions .= $import_plugin->getProperties()
|
||||
->getExtension();
|
||||
}
|
||||
|
||||
$matcher = '@\.(' . $extensions . ')(\.('
|
||||
. $fileListing->supportedDecompressions() . '))?$@';
|
||||
|
||||
$active = (isset($GLOBALS['timeout_passed'], $GLOBALS['local_import_file']) && $GLOBALS['timeout_passed'])
|
||||
? $GLOBALS['local_import_file']
|
||||
: '';
|
||||
|
||||
$files = $fileListing->getFileSelectOptions(
|
||||
Util::userDir($uploaddir),
|
||||
$matcher,
|
||||
$active
|
||||
);
|
||||
|
||||
if ($files === false) {
|
||||
Message::error(
|
||||
__('The directory you set for upload work cannot be reached.')
|
||||
)
|
||||
->display();
|
||||
} elseif (! empty($files)) {
|
||||
$block_html .= "\n"
|
||||
. ' <select style="margin: 5px" size="1" '
|
||||
. 'name="local_import_file" '
|
||||
. 'id="select_local_import_file">' . "\n"
|
||||
. ' <option value=""> </option>' . "\n"
|
||||
. $files
|
||||
. ' </select>' . "\n";
|
||||
} elseif (empty($files)) {
|
||||
$block_html .= '<i>' . __('There are no files to upload!') . '</i>';
|
||||
}
|
||||
|
||||
return $block_html;
|
||||
}
|
||||
}
|
||||
45
libraries/classes/Html/Forms/Fields/FKCheckbox.php
Normal file
45
libraries/classes/Html/Forms/Fields/FKCheckbox.php
Normal file
@ -0,0 +1,45 @@
|
||||
<?php
|
||||
/**
|
||||
* HTML Generator for checkbox for foreign keys
|
||||
*
|
||||
* @package PhpMyAdmin
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\Html\Forms\Fields;
|
||||
|
||||
use PhpMyAdmin\Template;
|
||||
use PhpMyAdmin\Util;
|
||||
use Throwable;
|
||||
use Twig_Error_Loader;
|
||||
use Twig_Error_Runtime;
|
||||
use Twig_Error_Syntax;
|
||||
|
||||
/**
|
||||
* HTML Generator for checkbox for foreign keys
|
||||
*
|
||||
* @package PhpMyAdmin
|
||||
*/
|
||||
class FKCheckbox implements FieldGenerator
|
||||
{
|
||||
|
||||
/**
|
||||
* Get HTML for Foreign key check checkbox
|
||||
*
|
||||
* @return string HTML for checkbox
|
||||
* @throws Throwable
|
||||
* @throws Twig_Error_Loader
|
||||
* @throws Twig_Error_Runtime
|
||||
* @throws Twig_Error_Syntax
|
||||
*/
|
||||
public static function generate(): string
|
||||
{
|
||||
$template = new Template();
|
||||
return $template->render(
|
||||
'fk_checkbox',
|
||||
[
|
||||
'checked' => Util::isForeignKeyCheck(),
|
||||
]
|
||||
);
|
||||
}
|
||||
}
|
||||
19
libraries/classes/Html/Forms/Fields/FieldGenerator.php
Normal file
19
libraries/classes/Html/Forms/Fields/FieldGenerator.php
Normal file
@ -0,0 +1,19 @@
|
||||
<?php
|
||||
/**
|
||||
* Field generator interface
|
||||
*
|
||||
* @package PhpMyAdmin
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\Html\Forms\Fields;
|
||||
|
||||
/**
|
||||
* Field generator interface
|
||||
*
|
||||
* @package PhpMyAdmin
|
||||
*/
|
||||
interface FieldGenerator
|
||||
{
|
||||
|
||||
}
|
||||
33
libraries/classes/Html/Forms/Fields/MaxFileSize.php
Normal file
33
libraries/classes/Html/Forms/Fields/MaxFileSize.php
Normal file
@ -0,0 +1,33 @@
|
||||
<?php
|
||||
/**
|
||||
* HTML Generator for hidden "max file size" field
|
||||
*
|
||||
* @package PhpMyAdmin
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\Html\Forms\Fields;
|
||||
|
||||
/**
|
||||
* HTML Generator for hidden "max file size" field
|
||||
*
|
||||
* @package PhpMyAdmin
|
||||
*/
|
||||
class MaxFileSize implements FieldGenerator
|
||||
{
|
||||
|
||||
/**
|
||||
* Generates a hidden field which should indicate to the browser
|
||||
* the maximum size for upload
|
||||
*
|
||||
* @param integer $max_size the size
|
||||
*
|
||||
* @return string the INPUT field
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
public static function generate($max_size): string
|
||||
{
|
||||
return '<input type="hidden" name="MAX_FILE_SIZE" value="' . $max_size . '">';
|
||||
}
|
||||
}
|
||||
83
libraries/classes/Html/Forms/Fields/RadioList.php
Normal file
83
libraries/classes/Html/Forms/Fields/RadioList.php
Normal file
@ -0,0 +1,83 @@
|
||||
<?php
|
||||
/**
|
||||
* HTML Generator for radio buttons list
|
||||
*
|
||||
* @package PhpMyAdmin
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\Html\Forms\Fields;
|
||||
|
||||
use PhpMyAdmin\Template;
|
||||
use Throwable;
|
||||
use Twig_Error_Loader;
|
||||
use Twig_Error_Runtime;
|
||||
use Twig_Error_Syntax;
|
||||
|
||||
/**
|
||||
* HTML Generator for radio buttons list
|
||||
*
|
||||
* @package PhpMyAdmin
|
||||
*/
|
||||
class RadioList implements FieldGenerator
|
||||
{
|
||||
|
||||
/**
|
||||
* Generates a set of radio HTML fields
|
||||
*
|
||||
* @param string $html_field_name the radio HTML field
|
||||
* @param array $choices the choices values and labels
|
||||
* @param string $checked_choice the choice to check by default
|
||||
* @param boolean $line_break whether to add HTML line break after a choice
|
||||
* @param boolean $escape_label whether to use htmlspecialchars() on label
|
||||
* @param string $class enclose each choice with a div of this class
|
||||
* @param string $id_prefix prefix for the id attribute, name will be
|
||||
* used if this is not supplied
|
||||
*
|
||||
* @return string set of html radio fields
|
||||
* @throws Throwable
|
||||
* @throws Twig_Error_Loader
|
||||
* @throws Twig_Error_Runtime
|
||||
* @throws Twig_Error_Syntax
|
||||
*/
|
||||
public static function generate(
|
||||
$html_field_name,
|
||||
array $choices,
|
||||
$checked_choice = '',
|
||||
$line_break = true,
|
||||
$escape_label = true,
|
||||
$class = '',
|
||||
$id_prefix = ''
|
||||
): string {
|
||||
$template = new Template();
|
||||
$radio_html = '';
|
||||
|
||||
foreach ($choices as $choice_value => $choice_label) {
|
||||
if (! $id_prefix) {
|
||||
$id_prefix = $html_field_name;
|
||||
}
|
||||
$html_field_id = $id_prefix . '_' . $choice_value;
|
||||
|
||||
if ($choice_value == $checked_choice) {
|
||||
$checked = 1;
|
||||
} else {
|
||||
$checked = 0;
|
||||
}
|
||||
$radio_html .= $template->render(
|
||||
'radio_fields',
|
||||
[
|
||||
'class' => $class,
|
||||
'html_field_name' => $html_field_name,
|
||||
'html_field_id' => $html_field_id,
|
||||
'choice_value' => $choice_value,
|
||||
'is_line_break' => $line_break,
|
||||
'choice_label' => $choice_label,
|
||||
'escape_label' => $escape_label,
|
||||
'checked' => $checked,
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
return $radio_html;
|
||||
}
|
||||
}
|
||||
1624
libraries/classes/Html/Generator.php
Normal file
1624
libraries/classes/Html/Generator.php
Normal file
File diff suppressed because it is too large
Load Diff
101
libraries/classes/Html/MySQLDocumentation.php
Normal file
101
libraries/classes/Html/MySQLDocumentation.php
Normal file
@ -0,0 +1,101 @@
|
||||
<?php
|
||||
/**
|
||||
* Generate HTML for MySQL Documentation
|
||||
*
|
||||
* @package PhpMyAdmin
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\Html;
|
||||
|
||||
use PhpMyAdmin\Core;
|
||||
use PhpMyAdmin\Util;
|
||||
|
||||
/**
|
||||
* Generate HTML for MySQL Documentation
|
||||
*
|
||||
* @package PhpMyAdmin
|
||||
*/
|
||||
class MySQLDocumentation
|
||||
{
|
||||
/**
|
||||
* Displays a link to the official MySQL documentation
|
||||
*
|
||||
* @param string $link contains name of page/anchor that is being linked
|
||||
* @param bool $bigIcon whether to use big icon (like in left frame)
|
||||
* @param string|null $url href attribute
|
||||
* @param string|null $text text of link
|
||||
* @param string $anchor anchor to page part
|
||||
*
|
||||
* @return string the html link
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
public static function show(
|
||||
$link,
|
||||
bool $bigIcon = false,
|
||||
$url = null,
|
||||
$text = null,
|
||||
$anchor = ''
|
||||
): string {
|
||||
if ($url === null) {
|
||||
$url = Util::getMySQLDocuURL($link, $anchor);
|
||||
}
|
||||
$openLink = '<a href="' . htmlspecialchars($url) . '" target="mysql_doc">';
|
||||
$closeLink = '</a>';
|
||||
|
||||
if ($bigIcon) {
|
||||
$html = $openLink .
|
||||
Generator::getImage('b_sqlhelp', __('Documentation'))
|
||||
. $closeLink;
|
||||
} elseif ($text !== null) {
|
||||
$html = $openLink . $text . $closeLink;
|
||||
} else {
|
||||
$html = Generator::showDocumentationLink($url, 'mysql_doc');
|
||||
}
|
||||
|
||||
return $html;
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays a link to the phpMyAdmin documentation
|
||||
*
|
||||
* @param string $page Page in documentation
|
||||
* @param string $anchor Optional anchor in page
|
||||
* @param boolean $bbcode Optional flag indicating whether to output bbcode
|
||||
*
|
||||
* @return string the html link
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
public static function showDocumentation($page, $anchor = '', $bbcode = false): string
|
||||
{
|
||||
return Generator::showDocumentationLink(self::getDocumentationLink($page, $anchor), 'documentation', $bbcode);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns link to documentation.
|
||||
*
|
||||
* @param string $page Page in documentation
|
||||
* @param string $anchor Optional anchor in page
|
||||
*
|
||||
* @return string URL
|
||||
*/
|
||||
public static function getDocumentationLink($page, $anchor = ''): string
|
||||
{
|
||||
/* Construct base URL */
|
||||
$url = $page . '.html';
|
||||
if (! empty($anchor)) {
|
||||
$url .= '#' . $anchor;
|
||||
}
|
||||
|
||||
/* Check if we have built local documentation, however
|
||||
* provide consistent URL for testsuite
|
||||
*/
|
||||
if (! defined('TESTSUITE') && @file_exists(ROOT_PATH . 'doc/html/index.html')) {
|
||||
return 'doc/html/' . $url;
|
||||
}
|
||||
|
||||
return Core::linkURL('https://docs.phpmyadmin.net/en/latest/' . $url);
|
||||
}
|
||||
}
|
||||
@ -1451,7 +1451,7 @@ class Import
|
||||
$matched_rows_url = Url::getFromRoute('/sql', $_url_params);
|
||||
|
||||
return [
|
||||
'sql_query' => Util::formatSql($analyzed_sql_results['query']),
|
||||
'sql_query' => Html\Generator::formatSql($analyzed_sql_results['query']),
|
||||
'matched_rows' => $matched_rows,
|
||||
'matched_rows_url' => $matched_rows_url,
|
||||
];
|
||||
|
||||
@ -8,6 +8,9 @@ declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin;
|
||||
|
||||
use PhpMyAdmin\Html\Generator;
|
||||
use PhpMyAdmin\Html\MySQLDocumentation;
|
||||
|
||||
/**
|
||||
* Index manipulation class
|
||||
*
|
||||
@ -533,7 +536,7 @@ class Index
|
||||
$types[$type] = $type;
|
||||
}
|
||||
|
||||
return Util::getDropdown(
|
||||
return Html\Forms\Fields\DropDown::generate(
|
||||
"index[Index_type]",
|
||||
$types,
|
||||
$this->_type,
|
||||
@ -689,7 +692,7 @@ class Index
|
||||
if (! $print_mode) {
|
||||
$r = '<fieldset class="index_info">';
|
||||
$r .= '<legend id="index_header">' . __('Indexes');
|
||||
$r .= Util::showMySQLDocu('optimizing-database-structure');
|
||||
$r .= MySQLDocumentation::show('optimizing-database-structure');
|
||||
|
||||
$r .= '</legend>';
|
||||
$r .= $no_indexes;
|
||||
@ -738,7 +741,7 @@ class Index
|
||||
. ' <a class="';
|
||||
$r .= 'ajax';
|
||||
$r .= '" href="' . Url::getFromRoute('/table/indexes') . '" data-post="' . Url::getCommon($this_params, '')
|
||||
. '">' . Util::getIcon('b_edit', __('Edit')) . '</a>'
|
||||
. '">' . Generator::getIcon('b_edit', __('Edit')) . '</a>'
|
||||
. '</td>' . "\n";
|
||||
$this_params = $GLOBALS['url_params'];
|
||||
if ($index->getName() == 'PRIMARY') {
|
||||
@ -762,9 +765,9 @@ class Index
|
||||
$r .= '<td ' . $row_span . ' class="print_ignore">';
|
||||
$r .= '<input type="hidden" class="drop_primary_key_index_msg"'
|
||||
. ' value="' . $js_msg . '">';
|
||||
$r .= Util::linkOrButton(
|
||||
$r .= Generator::linkOrButton(
|
||||
Url::getFromRoute('/sql', $this_params),
|
||||
Util::getIcon('b_drop', __('Drop')),
|
||||
Generator::getIcon('b_drop', __('Drop')),
|
||||
['class' => 'drop_primary_key_index_anchor ajax']
|
||||
);
|
||||
$r .= '</td>' . "\n";
|
||||
|
||||
@ -8,6 +8,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin;
|
||||
|
||||
use PhpMyAdmin\Html\Generator;
|
||||
use PhpMyAdmin\Plugins\TransformationsPlugin;
|
||||
|
||||
/**
|
||||
@ -188,7 +189,7 @@ class InsertEdit
|
||||
if (! $rows[$key_id]) {
|
||||
unset($rows[$key_id], $where_clause_array[$key_id]);
|
||||
Response::getInstance()->addHTML(
|
||||
Util::getMessage(
|
||||
Generator::getMessage(
|
||||
__('MySQL returned an empty result set (i.e. zero rows).'),
|
||||
$local_query
|
||||
)
|
||||
@ -200,7 +201,7 @@ class InsertEdit
|
||||
} else {// end if (no row returned)
|
||||
$meta = $this->dbi->getFieldsMeta($result[$key_id]);
|
||||
|
||||
list($unique_condition, $tmp_clause_is_unique)
|
||||
[$unique_condition, $tmp_clause_is_unique]
|
||||
= Util::getUniqueCondition(
|
||||
$result[$key_id], // handle
|
||||
count($meta), // fields_cnt
|
||||
@ -372,7 +373,7 @@ class InsertEdit
|
||||
]
|
||||
);
|
||||
|
||||
list($column['pma_type'], $column['wrap'], $column['first_timestamp'])
|
||||
[$column['pma_type'], $column['wrap'], $column['first_timestamp']]
|
||||
= $this->getEnumSetAndTimestampColumns($column, $timestamp_seen);
|
||||
|
||||
return $column;
|
||||
@ -490,7 +491,7 @@ class InsertEdit
|
||||
$insert_mode,
|
||||
$readOnly,
|
||||
array $foreignData
|
||||
) {
|
||||
): string {
|
||||
$html_output = '';
|
||||
if (($GLOBALS['cfg']['ProtectBinary'] === 'blob'
|
||||
&& $column['is_blob'] && ! $is_upload)
|
||||
@ -513,7 +514,7 @@ class InsertEdit
|
||||
. ' ' . $onChangeClause
|
||||
. ' tabindex="' . ($tabindex + $tabindex_for_function) . '"'
|
||||
. ' id="field_' . $idindex . '_1">';
|
||||
$html_output .= Util::getFunctionsForField(
|
||||
$html_output .= Generator::getFunctionsForField(
|
||||
$column,
|
||||
$insert_mode,
|
||||
$foreignData
|
||||
@ -867,7 +868,7 @@ class InsertEdit
|
||||
array $titles,
|
||||
$readOnly
|
||||
) {
|
||||
list($table, $db) = $paramTableDbArray;
|
||||
[$table, $db] = $paramTableDbArray;
|
||||
$html_output = '';
|
||||
$html_output .= $backup_field . "\n";
|
||||
|
||||
@ -1264,7 +1265,7 @@ class InsertEdit
|
||||
$data,
|
||||
$readOnly
|
||||
) {
|
||||
list($column_set_values, $select_size) = $this->getColumnSetValueAndSelectSize(
|
||||
[$column_set_values, $select_size] = $this->getColumnSetValueAndSelectSize(
|
||||
$column,
|
||||
$extracted_columnspec
|
||||
);
|
||||
@ -1436,7 +1437,9 @@ class InsertEdit
|
||||
. ' name="fields_upload' . $vkey . '[' . $column['Field_md5'] . ']"'
|
||||
. ' class="textfield noDragDrop" id="field_' . $idindex . '_3" size="10"'
|
||||
. ' ' . $onChangeClause . '> ';
|
||||
list($html_out,) = $this->getMaxUploadSize(
|
||||
[
|
||||
$html_out,
|
||||
] = $this->getMaxUploadSize(
|
||||
$column,
|
||||
$biggest_max_file_size
|
||||
);
|
||||
@ -1741,9 +1744,9 @@ class InsertEdit
|
||||
*/
|
||||
private function getHtmlForGisDataTypes()
|
||||
{
|
||||
$edit_str = Util::getIcon('b_edit', __('Edit/Insert'));
|
||||
$edit_str = Generator::getIcon('b_edit', __('Edit/Insert'));
|
||||
return '<span class="open_gis_editor">'
|
||||
. Util::linkOrButton(
|
||||
. Generator::linkOrButton(
|
||||
'#',
|
||||
$edit_str,
|
||||
[],
|
||||
@ -1921,21 +1924,21 @@ class InsertEdit
|
||||
private function getSubmitAndResetButtonForActionsPanel($tabindex, $tabindex_for_value)
|
||||
{
|
||||
return '<td>'
|
||||
. Util::showHint(
|
||||
__(
|
||||
'Use TAB key to move from value to value,'
|
||||
. ' or CTRL+arrows to move anywhere.'
|
||||
. Generator::showHint(
|
||||
__(
|
||||
'Use TAB key to move from value to value,'
|
||||
. ' or CTRL+arrows to move anywhere.'
|
||||
)
|
||||
)
|
||||
)
|
||||
. '</td>'
|
||||
. '<td colspan="3" class="right vmiddle">'
|
||||
. '<input type="button" class="btn btn-secondary preview_sql" value="' . __('Preview SQL') . '"'
|
||||
. ' tabindex="' . ($tabindex + $tabindex_for_value + 6) . '">'
|
||||
. '<input type="reset" class="btn btn-secondary control_at_footer" value="' . __('Reset') . '"'
|
||||
. ' tabindex="' . ($tabindex + $tabindex_for_value + 7) . '">'
|
||||
. '<input type="submit" class="btn btn-primary control_at_footer" value="' . __('Go') . '"'
|
||||
. ' tabindex="' . ($tabindex + $tabindex_for_value + 8) . '" id="buttonYes">'
|
||||
. '</td>';
|
||||
. '</td>'
|
||||
. '<td colspan="3" class="right vmiddle">'
|
||||
. '<input type="button" class="btn btn-secondary preview_sql" value="' . __('Preview SQL') . '"'
|
||||
. ' tabindex="' . ($tabindex + $tabindex_for_value + 6) . '">'
|
||||
. '<input type="reset" class="btn btn-secondary control_at_footer" value="' . __('Reset') . '"'
|
||||
. ' tabindex="' . ($tabindex + $tabindex_for_value + 7) . '">'
|
||||
. '<input type="submit" class="btn btn-primary control_at_footer" value="' . __('Go') . '"'
|
||||
. ' tabindex="' . ($tabindex + $tabindex_for_value + 8) . '" id="buttonYes">'
|
||||
. '</td>';
|
||||
}
|
||||
|
||||
/**
|
||||
@ -2217,7 +2220,7 @@ class InsertEdit
|
||||
$meta = $this->dbi->getFieldsMeta($res);
|
||||
// must find a unique condition based on unique key,
|
||||
// not a combination of all fields
|
||||
list($unique_condition, $clause_is_unique)
|
||||
[$unique_condition, $clause_is_unique]
|
||||
= Util::getUniqueCondition(
|
||||
$res, // handle
|
||||
count($meta), // fields_cnt
|
||||
@ -2441,7 +2444,7 @@ class InsertEdit
|
||||
DatabaseInterface::QUERY_STORE
|
||||
);
|
||||
if ($dispresult && $this->dbi->numRows($dispresult) > 0) {
|
||||
list($dispval) = $this->dbi->fetchRow($dispresult);
|
||||
[$dispval] = $this->dbi->fetchRow($dispresult);
|
||||
} else {
|
||||
$dispval = '';
|
||||
}
|
||||
@ -2928,7 +2931,7 @@ class InsertEdit
|
||||
// we are editing
|
||||
$insert_mode = false;
|
||||
$where_clause_array = $this->getWhereClauseArray($where_clause);
|
||||
list($where_clauses, $result, $rows, $found_unique_key)
|
||||
[$where_clauses, $result, $rows, $found_unique_key]
|
||||
= $this->analyzeWhereClauses(
|
||||
$where_clause_array,
|
||||
$table,
|
||||
@ -2938,7 +2941,7 @@ class InsertEdit
|
||||
// we are inserting
|
||||
$insert_mode = true;
|
||||
$where_clause = null;
|
||||
list($result, $rows) = $this->loadFirstRow($table, $db);
|
||||
[$result, $rows] = $this->loadFirstRow($table, $db);
|
||||
$where_clauses = null;
|
||||
$where_clause_array = [];
|
||||
$found_unique_key = false;
|
||||
@ -3226,10 +3229,13 @@ class InsertEdit
|
||||
$special_chars_encoded = '';
|
||||
if (! empty($current_row)) {
|
||||
// (we are editing)
|
||||
list(
|
||||
$real_null_value, $special_chars_encoded, $special_chars,
|
||||
$data, $backup_field
|
||||
)
|
||||
[
|
||||
$real_null_value,
|
||||
$special_chars_encoded,
|
||||
$special_chars,
|
||||
$data,
|
||||
$backup_field,
|
||||
]
|
||||
= $this->getSpecialCharsAndBackupFieldForExistingRow(
|
||||
$current_row,
|
||||
$column,
|
||||
@ -3246,9 +3252,13 @@ class InsertEdit
|
||||
if (isset($repopulate[$column['Field_md5']])) {
|
||||
$tmp['Default'] = $repopulate[$column['Field_md5']];
|
||||
}
|
||||
list($real_null_value, $data, $special_chars, $backup_field,
|
||||
$special_chars_encoded
|
||||
)
|
||||
[
|
||||
$real_null_value,
|
||||
$data,
|
||||
$special_chars,
|
||||
$backup_field,
|
||||
$special_chars_encoded,
|
||||
]
|
||||
= $this->getSpecialCharsAndBackupFieldForInsertingMode(
|
||||
$tmp,
|
||||
$real_null_value
|
||||
|
||||
@ -9,6 +9,7 @@ declare(strict_types=1);
|
||||
namespace PhpMyAdmin;
|
||||
|
||||
use PhpMyAdmin\Core;
|
||||
use PhpMyAdmin\Html\MySQLDocumentation;
|
||||
use PhpMyAdmin\Language;
|
||||
use PhpMyAdmin\Template;
|
||||
use PhpMyAdmin\Url;
|
||||
@ -952,7 +953,7 @@ class LanguageManager
|
||||
$language_title = __('Language')
|
||||
. (__('Language') != 'Language' ? ' - <em>Language</em>' : '');
|
||||
if ($show_doc) {
|
||||
$language_title .= Util::showDocu('faq', 'faq7-2');
|
||||
$language_title .= MySQLDocumentation::showDocumentation('faq', 'faq7-2');
|
||||
}
|
||||
|
||||
$available_languages = $this->sortedLanguages();
|
||||
|
||||
@ -8,6 +8,8 @@ declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin;
|
||||
|
||||
use PhpMyAdmin\Html\Generator;
|
||||
|
||||
/**
|
||||
* Class for generating the top menu
|
||||
*
|
||||
@ -113,7 +115,7 @@ class Menu
|
||||
unset($tabs[$key]);
|
||||
}
|
||||
}
|
||||
return Util::getHtmlTabs($tabs, $url_params, 'topmenu', true);
|
||||
return Generator::getHtmlTabs($tabs, $url_params, 'topmenu', true);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -190,7 +192,7 @@ class Menu
|
||||
$retval .= "<div id='floating_menubar'></div>";
|
||||
$retval .= "<div id='serverinfo'>";
|
||||
if (Util::showIcons('TabsMode')) {
|
||||
$retval .= Util::getImage(
|
||||
$retval .= Generator::getImage(
|
||||
's_host',
|
||||
'',
|
||||
['class' => 'item']
|
||||
@ -211,7 +213,7 @@ class Menu
|
||||
if (strlen($this->_db) > 0) {
|
||||
$retval .= $separator;
|
||||
if (Util::showIcons('TabsMode')) {
|
||||
$retval .= Util::getImage(
|
||||
$retval .= Generator::getImage(
|
||||
's_db',
|
||||
'',
|
||||
['class' => 'item']
|
||||
@ -247,7 +249,7 @@ class Menu
|
||||
$retval .= $separator;
|
||||
if (Util::showIcons('TabsMode')) {
|
||||
$icon = $tbl_is_view ? 'b_views' : 's_tbl';
|
||||
$retval .= Util::getImage(
|
||||
$retval .= Generator::getImage(
|
||||
$icon,
|
||||
'',
|
||||
['class' => 'item']
|
||||
|
||||
@ -817,7 +817,7 @@ class Message
|
||||
} else {
|
||||
$image = 's_notice';
|
||||
}
|
||||
$message = self::notice(Util::getImage($image)) . " " . $message;
|
||||
$message = self::notice(Html\Generator::getImage($image)) . " " . $message;
|
||||
return $message;
|
||||
}
|
||||
}
|
||||
|
||||
@ -10,6 +10,8 @@ declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin;
|
||||
|
||||
use PhpMyAdmin\Html\Forms\Fields\FKCheckbox;
|
||||
|
||||
/**
|
||||
* Functions for multi submit forms
|
||||
*
|
||||
@ -523,7 +525,7 @@ class MultSubmits
|
||||
// Display option to disable foreign key checks while dropping tables
|
||||
if ($what === 'drop_tbl' || $what === 'empty_tbl' || $what === 'row_delete') {
|
||||
$html .= '<div id="foreignkeychk">';
|
||||
$html .= Util::getFKCheckbox();
|
||||
$html .= FKCheckbox::generate();
|
||||
$html .= '</div>';
|
||||
}
|
||||
$html .= '<input id="buttonYes" class="btn btn-secondary" type="submit" name="mult_btn" value="'
|
||||
|
||||
@ -10,6 +10,7 @@ namespace PhpMyAdmin\Navigation;
|
||||
|
||||
use PhpMyAdmin\CheckUserPrivileges;
|
||||
use PhpMyAdmin\DatabaseInterface;
|
||||
use PhpMyAdmin\Html\Generator;
|
||||
use PhpMyAdmin\Navigation\Nodes\Node;
|
||||
use PhpMyAdmin\Navigation\Nodes\NodeDatabase;
|
||||
use PhpMyAdmin\Navigation\Nodes\NodeTable;
|
||||
@ -789,7 +790,7 @@ class NavigationTree
|
||||
);
|
||||
$groups[$key]->separator = $node->separator;
|
||||
$groups[$key]->separatorDepth = $node->separatorDepth - 1;
|
||||
$groups[$key]->icon = Util::getImage(
|
||||
$groups[$key]->icon = Generator::getImage(
|
||||
'b_group',
|
||||
__('Groups')
|
||||
);
|
||||
@ -1278,7 +1279,7 @@ class NavigationTree
|
||||
$this->tree->isGroup = false;
|
||||
|
||||
// Provide for pagination in database select
|
||||
$listNavigator = Util::getListNavigator(
|
||||
$listNavigator = Generator::getListNavigator(
|
||||
$this->tree->getPresence('databases', ''),
|
||||
$this->pos,
|
||||
['server' => $GLOBALS['server']],
|
||||
@ -1443,7 +1444,7 @@ class NavigationTree
|
||||
$retval = '<!-- CONTROLS START -->';
|
||||
$retval .= '<li id="navigation_controls_outer">';
|
||||
$retval .= '<div id="navigation_controls">';
|
||||
$retval .= Util::getNavigationLink(
|
||||
$retval .= Generator::getNavigationLink(
|
||||
'#',
|
||||
$showText,
|
||||
__('Collapse all'),
|
||||
@ -1457,7 +1458,7 @@ class NavigationTree
|
||||
$syncImage = 's_link';
|
||||
$title = __('Unlink from main panel');
|
||||
}
|
||||
$retval .= Util::getNavigationLink(
|
||||
$retval .= Generator::getNavigationLink(
|
||||
'#',
|
||||
$showText,
|
||||
$title,
|
||||
@ -1484,7 +1485,7 @@ class NavigationTree
|
||||
{
|
||||
$retval = '';
|
||||
if ($node === $this->tree) {
|
||||
$retval .= Util::getListNavigator(
|
||||
$retval .= Generator::getListNavigator(
|
||||
$this->tree->getPresence('databases', $this->searchClause),
|
||||
$this->pos,
|
||||
['server' => $GLOBALS['server']],
|
||||
@ -1518,7 +1519,7 @@ class NavigationTree
|
||||
$node->realName,
|
||||
$this->searchClause2
|
||||
);
|
||||
$retval .= Util::getListNavigator(
|
||||
$retval .= Generator::getListNavigator(
|
||||
$num,
|
||||
$pos,
|
||||
$urlParams,
|
||||
|
||||
@ -9,6 +9,7 @@ declare(strict_types=1);
|
||||
namespace PhpMyAdmin\Navigation\Nodes;
|
||||
|
||||
use PhpMyAdmin\DatabaseInterface;
|
||||
use PhpMyAdmin\Html\Generator;
|
||||
use PhpMyAdmin\Relation;
|
||||
use PhpMyAdmin\Util;
|
||||
|
||||
@ -801,10 +802,10 @@ class Node
|
||||
} elseif ($match) {
|
||||
$this->visible = true;
|
||||
|
||||
return Util::getImage('b_minus');
|
||||
return Generator::getImage('b_minus');
|
||||
}
|
||||
|
||||
return Util::getImage('b_plus', __('Expand/Collapse'));
|
||||
return Generator::getImage('b_plus', __('Expand/Collapse'));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -8,6 +8,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\Navigation\Nodes;
|
||||
|
||||
use PhpMyAdmin\Html\Generator;
|
||||
use PhpMyAdmin\Url;
|
||||
use PhpMyAdmin\Util;
|
||||
|
||||
@ -31,7 +32,7 @@ class NodeColumn extends Node
|
||||
$this->displayName = $this->getDisplayName($item);
|
||||
|
||||
parent::__construct($item['name'], $type, $isGroup);
|
||||
$this->icon = Util::getImage($this->getColumnIcon($item['key']), __('Column'));
|
||||
$this->icon = Generator::getImage($this->getColumnIcon($item['key']), __('Column'));
|
||||
$this->links = [
|
||||
'text' => Url::getFromRoute('/table/structure', [
|
||||
'server' => $GLOBALS['server'],
|
||||
|
||||
@ -8,6 +8,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\Navigation\Nodes;
|
||||
|
||||
use PhpMyAdmin\Html\Generator;
|
||||
use PhpMyAdmin\Navigation\NodeFactory;
|
||||
use PhpMyAdmin\Url;
|
||||
use PhpMyAdmin\Util;
|
||||
@ -25,7 +26,7 @@ class NodeColumnContainer extends Node
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct(__('Columns'), Node::CONTAINER);
|
||||
$this->icon = Util::getImage('pause', __('Columns'));
|
||||
$this->icon = Generator::getImage('pause', __('Columns'));
|
||||
$this->links = [
|
||||
'text' => Url::getFromRoute('/table/structure', [
|
||||
'server' => $GLOBALS['server'],
|
||||
@ -46,7 +47,7 @@ class NodeColumnContainer extends Node
|
||||
$newLabel
|
||||
);
|
||||
$new->isNew = true;
|
||||
$new->icon = Util::getImage('b_column_add', $newLabel);
|
||||
$new->icon = Generator::getImage('b_column_add', $newLabel);
|
||||
$new->links = [
|
||||
'text' => Url::getFromRoute('/table/addfield', [
|
||||
'server' => $GLOBALS['server'],
|
||||
|
||||
@ -8,6 +8,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\Navigation\Nodes;
|
||||
|
||||
use PhpMyAdmin\Html\Generator;
|
||||
use PhpMyAdmin\Relation;
|
||||
use PhpMyAdmin\Url;
|
||||
use PhpMyAdmin\Util;
|
||||
@ -37,7 +38,7 @@ class NodeDatabase extends Node
|
||||
public function __construct($name, $type = Node::OBJECT, $isGroup = false)
|
||||
{
|
||||
parent::__construct($name, $type, $isGroup);
|
||||
$this->icon = Util::getImage(
|
||||
$this->icon = Generator::getImage(
|
||||
's_db',
|
||||
__('Database operations')
|
||||
);
|
||||
@ -682,7 +683,7 @@ class NodeDatabase extends Node
|
||||
. '<a href="' . Url::getFromRoute('/navigation') . '" data-post="'
|
||||
. Url::getCommon($params, '') . '"'
|
||||
. ' class="showUnhide ajax">'
|
||||
. Util::getImage(
|
||||
. Generator::getImage(
|
||||
'show',
|
||||
__('Show hidden items')
|
||||
)
|
||||
|
||||
@ -8,6 +8,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\Navigation\Nodes;
|
||||
|
||||
use PhpMyAdmin\Html\Generator;
|
||||
use PhpMyAdmin\Relation;
|
||||
use PhpMyAdmin\Url;
|
||||
use PhpMyAdmin\Util;
|
||||
@ -52,7 +53,7 @@ abstract class NodeDatabaseChild extends Node
|
||||
. '<a href="' . Url::getFromRoute('/navigation') . '" data-post="'
|
||||
. Url::getCommon($params, '') . '"'
|
||||
. ' class="hideNavItem ajax">'
|
||||
. Util::getImage('hide', __('Hide'))
|
||||
. Generator::getImage('hide', __('Hide'))
|
||||
. '</a></span>';
|
||||
}
|
||||
|
||||
|
||||
@ -9,6 +9,7 @@ declare(strict_types=1);
|
||||
namespace PhpMyAdmin\Navigation\Nodes;
|
||||
|
||||
use PhpMyAdmin\CheckUserPrivileges;
|
||||
use PhpMyAdmin\Html\Generator;
|
||||
use PhpMyAdmin\Navigation\NodeFactory;
|
||||
use PhpMyAdmin\Url;
|
||||
use PhpMyAdmin\Util;
|
||||
@ -40,7 +41,7 @@ class NodeDatabaseContainer extends Node
|
||||
_pgettext('Create new database', 'New')
|
||||
);
|
||||
$new->isNew = true;
|
||||
$new->icon = Util::getImage('b_newdb', '');
|
||||
$new->icon = Generator::getImage('b_newdb', '');
|
||||
$new->links = [
|
||||
'text' => Url::getFromRoute('/server/databases', ['server' => $GLOBALS['server']]),
|
||||
'icon' => Url::getFromRoute('/server/databases', ['server' => $GLOBALS['server']]),
|
||||
|
||||
@ -8,6 +8,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\Navigation\Nodes;
|
||||
|
||||
use PhpMyAdmin\Html\Generator;
|
||||
use PhpMyAdmin\Url;
|
||||
use PhpMyAdmin\Util;
|
||||
|
||||
@ -29,7 +30,7 @@ class NodeEvent extends NodeDatabaseChild
|
||||
public function __construct($name, $type = Node::OBJECT, $isGroup = false)
|
||||
{
|
||||
parent::__construct($name, $type, $isGroup);
|
||||
$this->icon = Util::getImage('b_events');
|
||||
$this->icon = Generator::getImage('b_events');
|
||||
$this->links = [
|
||||
'text' => Url::getFromRoute('/database/events', [
|
||||
'server' => $GLOBALS['server'],
|
||||
|
||||
@ -8,6 +8,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\Navigation\Nodes;
|
||||
|
||||
use PhpMyAdmin\Html\Generator;
|
||||
use PhpMyAdmin\Navigation\NodeFactory;
|
||||
use PhpMyAdmin\Url;
|
||||
use PhpMyAdmin\Util;
|
||||
@ -25,7 +26,7 @@ class NodeEventContainer extends NodeDatabaseChildContainer
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct(__('Events'), Node::CONTAINER);
|
||||
$this->icon = Util::getImage('b_events', '');
|
||||
$this->icon = Generator::getImage('b_events', '');
|
||||
$this->links = [
|
||||
'text' => Url::getFromRoute('/database/events', [
|
||||
'server' => $GLOBALS['server'],
|
||||
@ -41,7 +42,7 @@ class NodeEventContainer extends NodeDatabaseChildContainer
|
||||
_pgettext('Create new event', 'New')
|
||||
);
|
||||
$new->isNew = true;
|
||||
$new->icon = Util::getImage('b_event_add', '');
|
||||
$new->icon = Generator::getImage('b_event_add', '');
|
||||
$new->links = [
|
||||
'text' => Url::getFromRoute('/database/events', [
|
||||
'server' => $GLOBALS['server'],
|
||||
|
||||
@ -8,6 +8,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\Navigation\Nodes;
|
||||
|
||||
use PhpMyAdmin\Html\Generator;
|
||||
use PhpMyAdmin\Url;
|
||||
use PhpMyAdmin\Util;
|
||||
|
||||
@ -29,7 +30,7 @@ class NodeFunction extends NodeDatabaseChild
|
||||
public function __construct($name, $type = Node::OBJECT, $isGroup = false)
|
||||
{
|
||||
parent::__construct($name, $type, $isGroup);
|
||||
$this->icon = Util::getImage('b_routines', __('Function'));
|
||||
$this->icon = Generator::getImage('b_routines', __('Function'));
|
||||
$this->links = [
|
||||
'text' => Url::getFromRoute('/database/routines', [
|
||||
'server' => $GLOBALS['server'],
|
||||
|
||||
@ -8,6 +8,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\Navigation\Nodes;
|
||||
|
||||
use PhpMyAdmin\Html\Generator;
|
||||
use PhpMyAdmin\Navigation\NodeFactory;
|
||||
use PhpMyAdmin\Url;
|
||||
use PhpMyAdmin\Util;
|
||||
@ -25,7 +26,7 @@ class NodeFunctionContainer extends NodeDatabaseChildContainer
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct(__('Functions'), Node::CONTAINER);
|
||||
$this->icon = Util::getImage('b_routines', __('Functions'));
|
||||
$this->icon = Generator::getImage('b_routines', __('Functions'));
|
||||
$this->links = [
|
||||
'text' => Url::getFromRoute('/database/routines', [
|
||||
'server' => $GLOBALS['server'],
|
||||
@ -44,7 +45,7 @@ class NodeFunctionContainer extends NodeDatabaseChildContainer
|
||||
$newLabel
|
||||
);
|
||||
$new->isNew = true;
|
||||
$new->icon = Util::getImage('b_routine_add', $newLabel);
|
||||
$new->icon = Generator::getImage('b_routine_add', $newLabel);
|
||||
$new->links = [
|
||||
'text' => Url::getFromRoute('/database/routines', [
|
||||
'server' => $GLOBALS['server'],
|
||||
|
||||
@ -8,6 +8,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\Navigation\Nodes;
|
||||
|
||||
use PhpMyAdmin\Html\Generator;
|
||||
use PhpMyAdmin\Url;
|
||||
use PhpMyAdmin\Util;
|
||||
|
||||
@ -29,7 +30,7 @@ class NodeIndex extends Node
|
||||
public function __construct($name, $type = Node::OBJECT, $isGroup = false)
|
||||
{
|
||||
parent::__construct($name, $type, $isGroup);
|
||||
$this->icon = Util::getImage('b_index', __('Index'));
|
||||
$this->icon = Generator::getImage('b_index', __('Index'));
|
||||
$this->links = [
|
||||
'text' => Url::getFromRoute('/table/indexes', [
|
||||
'server' => $GLOBALS['server'],
|
||||
|
||||
@ -8,6 +8,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\Navigation\Nodes;
|
||||
|
||||
use PhpMyAdmin\Html\Generator;
|
||||
use PhpMyAdmin\Navigation\NodeFactory;
|
||||
use PhpMyAdmin\Url;
|
||||
use PhpMyAdmin\Util;
|
||||
@ -25,7 +26,7 @@ class NodeIndexContainer extends Node
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct(__('Indexes'), Node::CONTAINER);
|
||||
$this->icon = Util::getImage('b_index', __('Indexes'));
|
||||
$this->icon = Generator::getImage('b_index', __('Indexes'));
|
||||
$this->links = [
|
||||
'text' => Url::getFromRoute('/table/structure', [
|
||||
'server' => $GLOBALS['server'],
|
||||
@ -46,7 +47,7 @@ class NodeIndexContainer extends Node
|
||||
$newLabel
|
||||
);
|
||||
$new->isNew = true;
|
||||
$new->icon = Util::getImage('b_index_add', $newLabel);
|
||||
$new->icon = Generator::getImage('b_index_add', $newLabel);
|
||||
$new->links = [
|
||||
'text' => Url::getFromRoute('/table/indexes', [
|
||||
'server' => $GLOBALS['server'],
|
||||
|
||||
@ -8,6 +8,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\Navigation\Nodes;
|
||||
|
||||
use PhpMyAdmin\Html\Generator;
|
||||
use PhpMyAdmin\Url;
|
||||
use PhpMyAdmin\Util;
|
||||
|
||||
@ -29,7 +30,7 @@ class NodeProcedure extends NodeDatabaseChild
|
||||
public function __construct($name, $type = Node::OBJECT, $isGroup = false)
|
||||
{
|
||||
parent::__construct($name, $type, $isGroup);
|
||||
$this->icon = Util::getImage('b_routines', __('Procedure'));
|
||||
$this->icon = Generator::getImage('b_routines', __('Procedure'));
|
||||
$this->links = [
|
||||
'text' => Url::getFromRoute('/database/routines', [
|
||||
'server' => $GLOBALS['server'],
|
||||
|
||||
@ -8,6 +8,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\Navigation\Nodes;
|
||||
|
||||
use PhpMyAdmin\Html\Generator;
|
||||
use PhpMyAdmin\Navigation\NodeFactory;
|
||||
use PhpMyAdmin\Url;
|
||||
use PhpMyAdmin\Util;
|
||||
@ -25,7 +26,7 @@ class NodeProcedureContainer extends NodeDatabaseChildContainer
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct(__('Procedures'), Node::CONTAINER);
|
||||
$this->icon = Util::getImage('b_routines', __('Procedures'));
|
||||
$this->icon = Generator::getImage('b_routines', __('Procedures'));
|
||||
$this->links = [
|
||||
'text' => Url::getFromRoute('/database/routines', [
|
||||
'server' => $GLOBALS['server'],
|
||||
@ -44,7 +45,7 @@ class NodeProcedureContainer extends NodeDatabaseChildContainer
|
||||
$newLabel
|
||||
);
|
||||
$new->isNew = true;
|
||||
$new->icon = Util::getImage('b_routine_add', $newLabel);
|
||||
$new->icon = Generator::getImage('b_routine_add', $newLabel);
|
||||
$new->links = [
|
||||
'text' => Url::getFromRoute('/database/routines', [
|
||||
'server' => $GLOBALS['server'],
|
||||
|
||||
@ -8,6 +8,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\Navigation\Nodes;
|
||||
|
||||
use PhpMyAdmin\Html\Generator;
|
||||
use PhpMyAdmin\Url;
|
||||
use PhpMyAdmin\Util;
|
||||
|
||||
@ -293,19 +294,19 @@ class NodeTable extends NodeDatabaseChild
|
||||
|
||||
switch ($page) {
|
||||
case Url::getFromRoute('/table/structure'):
|
||||
$this->icon[] = Util::getImage('b_props', __('Structure'));
|
||||
$this->icon[] = Generator::getImage('b_props', __('Structure'));
|
||||
break;
|
||||
case Url::getFromRoute('/table/search'):
|
||||
$this->icon[] = Util::getImage('b_search', __('Search'));
|
||||
$this->icon[] = Generator::getImage('b_search', __('Search'));
|
||||
break;
|
||||
case Url::getFromRoute('/table/change'):
|
||||
$this->icon[] = Util::getImage('b_insrow', __('Insert'));
|
||||
$this->icon[] = Generator::getImage('b_insrow', __('Insert'));
|
||||
break;
|
||||
case Url::getFromRoute('/table/sql'):
|
||||
$this->icon[] = Util::getImage('b_sql', __('SQL'));
|
||||
$this->icon[] = Generator::getImage('b_sql', __('SQL'));
|
||||
break;
|
||||
case Url::getFromRoute('/sql'):
|
||||
$this->icon[] = Util::getImage('b_browse', __('Browse'));
|
||||
$this->icon[] = Generator::getImage('b_browse', __('Browse'));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -8,6 +8,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\Navigation\Nodes;
|
||||
|
||||
use PhpMyAdmin\Html\Generator;
|
||||
use PhpMyAdmin\Navigation\NodeFactory;
|
||||
use PhpMyAdmin\Url;
|
||||
use PhpMyAdmin\Util;
|
||||
@ -25,7 +26,7 @@ class NodeTableContainer extends NodeDatabaseChildContainer
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct(__('Tables'), Node::CONTAINER);
|
||||
$this->icon = Util::getImage('b_browse', __('Tables'));
|
||||
$this->icon = Generator::getImage('b_browse', __('Tables'));
|
||||
$this->links = [
|
||||
'text' => Url::getFromRoute('/database/structure', [
|
||||
'server' => $GLOBALS['server'],
|
||||
@ -47,7 +48,7 @@ class NodeTableContainer extends NodeDatabaseChildContainer
|
||||
$newLabel
|
||||
);
|
||||
$new->isNew = true;
|
||||
$new->icon = Util::getImage('b_table_add', $newLabel);
|
||||
$new->icon = Generator::getImage('b_table_add', $newLabel);
|
||||
$new->links = [
|
||||
'text' => Url::getFromRoute('/table/create', [
|
||||
'server' => $GLOBALS['server'],
|
||||
|
||||
@ -8,6 +8,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\Navigation\Nodes;
|
||||
|
||||
use PhpMyAdmin\Html\Generator;
|
||||
use PhpMyAdmin\Url;
|
||||
use PhpMyAdmin\Util;
|
||||
|
||||
@ -29,7 +30,7 @@ class NodeTrigger extends Node
|
||||
public function __construct($name, $type = Node::OBJECT, $isGroup = false)
|
||||
{
|
||||
parent::__construct($name, $type, $isGroup);
|
||||
$this->icon = Util::getImage('b_triggers');
|
||||
$this->icon = Generator::getImage('b_triggers');
|
||||
$this->links = [
|
||||
'text' => Url::getFromRoute('/database/triggers', [
|
||||
'server' => $GLOBALS['server'],
|
||||
|
||||
@ -8,6 +8,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\Navigation\Nodes;
|
||||
|
||||
use PhpMyAdmin\Html\Generator;
|
||||
use PhpMyAdmin\Navigation\NodeFactory;
|
||||
use PhpMyAdmin\Url;
|
||||
use PhpMyAdmin\Util;
|
||||
@ -25,7 +26,7 @@ class NodeTriggerContainer extends Node
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct(__('Triggers'), Node::CONTAINER);
|
||||
$this->icon = Util::getImage('b_triggers');
|
||||
$this->icon = Generator::getImage('b_triggers');
|
||||
$this->links = [
|
||||
'text' => Url::getFromRoute('/database/triggers', [
|
||||
'server' => $GLOBALS['server'],
|
||||
@ -41,7 +42,7 @@ class NodeTriggerContainer extends Node
|
||||
_pgettext('Create new trigger', 'New')
|
||||
);
|
||||
$new->isNew = true;
|
||||
$new->icon = Util::getImage('b_trigger_add', '');
|
||||
$new->icon = Generator::getImage('b_trigger_add', '');
|
||||
$new->links = [
|
||||
'text' => Url::getFromRoute('/database/triggers', [
|
||||
'server' => $GLOBALS['server'],
|
||||
|
||||
@ -8,6 +8,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\Navigation\Nodes;
|
||||
|
||||
use PhpMyAdmin\Html\Generator;
|
||||
use PhpMyAdmin\Url;
|
||||
use PhpMyAdmin\Util;
|
||||
|
||||
@ -29,7 +30,7 @@ class NodeView extends NodeDatabaseChild
|
||||
public function __construct($name, $type = Node::OBJECT, $isGroup = false)
|
||||
{
|
||||
parent::__construct($name, $type, $isGroup);
|
||||
$this->icon = Util::getImage('b_props', __('View'));
|
||||
$this->icon = Generator::getImage('b_props', __('View'));
|
||||
$this->links = [
|
||||
'text' => Url::getFromRoute('/sql')
|
||||
. '&server=' . $GLOBALS['server']
|
||||
|
||||
@ -8,6 +8,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\Navigation\Nodes;
|
||||
|
||||
use PhpMyAdmin\Html\Generator;
|
||||
use PhpMyAdmin\Navigation\NodeFactory;
|
||||
use PhpMyAdmin\Url;
|
||||
use PhpMyAdmin\Util;
|
||||
@ -25,7 +26,7 @@ class NodeViewContainer extends NodeDatabaseChildContainer
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct(__('Views'), Node::CONTAINER);
|
||||
$this->icon = Util::getImage('b_views', __('Views'));
|
||||
$this->icon = Generator::getImage('b_views', __('Views'));
|
||||
$this->links = [
|
||||
'text' => Url::getFromRoute('/database/structure', [
|
||||
'server' => $GLOBALS['server'],
|
||||
@ -47,7 +48,7 @@ class NodeViewContainer extends NodeDatabaseChildContainer
|
||||
$newLabel
|
||||
);
|
||||
$new->isNew = true;
|
||||
$new->icon = Util::getImage('b_view_add', $newLabel);
|
||||
$new->icon = Generator::getImage('b_view_add', $newLabel);
|
||||
$new->links = [
|
||||
'text' => Url::getFromRoute('/view/create', [
|
||||
'server' => $GLOBALS['server'],
|
||||
|
||||
@ -10,6 +10,7 @@ namespace PhpMyAdmin;
|
||||
|
||||
use PhpMyAdmin\Charsets\Charset;
|
||||
use PhpMyAdmin\Charsets\Collation;
|
||||
use PhpMyAdmin\Html\Generator;
|
||||
|
||||
/**
|
||||
* Set of functions used for normalization
|
||||
@ -279,7 +280,7 @@ class Normalization
|
||||
. "(or combination of columns) that uniquely identify all rows."
|
||||
);
|
||||
$subText = '<a href="#" id="createPrimaryKey">'
|
||||
. Util::getIcon(
|
||||
. Generator::getIcon(
|
||||
'b_index_add',
|
||||
__(
|
||||
'Add a primary key on existing column(s)'
|
||||
@ -920,7 +921,7 @@ class Normalization
|
||||
'3nf' => __('Third step of normalization (1NF+2NF+3NF)'),
|
||||
];
|
||||
|
||||
$htmlOutput .= Util::getRadioFields(
|
||||
$htmlOutput .= Html\Forms\Fields\RadioList::generate(
|
||||
'normalizeTo',
|
||||
$choices,
|
||||
'1nf',
|
||||
|
||||
@ -11,6 +11,10 @@ namespace PhpMyAdmin;
|
||||
use PhpMyAdmin\Charsets\Charset;
|
||||
use PhpMyAdmin\Charsets\Collation;
|
||||
use PhpMyAdmin\Engines\Innodb;
|
||||
use PhpMyAdmin\Html\Forms\Fields\DropDown;
|
||||
use PhpMyAdmin\Html\Forms\Fields\RadioList;
|
||||
use PhpMyAdmin\Html\Generator;
|
||||
use PhpMyAdmin\Html\MySQLDocumentation;
|
||||
use PhpMyAdmin\Plugins\Export\ExportSql;
|
||||
|
||||
/**
|
||||
@ -59,7 +63,7 @@ class Operations
|
||||
. '<fieldset>'
|
||||
. '<legend>';
|
||||
if (Util::showIcons('ActionLinksMode')) {
|
||||
$html_output .= Util::getImage('b_comment') . ' ';
|
||||
$html_output .= Generator::getImage('b_comment') . ' ';
|
||||
}
|
||||
$html_output .= __('Database comment');
|
||||
$html_output .= '</legend>';
|
||||
@ -103,7 +107,7 @@ class Operations
|
||||
. '<legend>';
|
||||
|
||||
if (Util::showIcons('ActionLinksMode')) {
|
||||
$html_output .= Util::getImage('b_edit') . ' ';
|
||||
$html_output .= Generator::getImage('b_edit') . ' ';
|
||||
}
|
||||
$html_output .= __('Rename database to')
|
||||
. '</legend>';
|
||||
@ -128,7 +132,7 @@ class Operations
|
||||
}
|
||||
|
||||
$html_output .= '<label for="checkbox_adjust_privileges">'
|
||||
. __('Adjust privileges') . Util::showDocu('faq', 'faq6-39')
|
||||
. __('Adjust privileges') . MySQLDocumentation::showDocumentation('faq', 'faq6-39')
|
||||
. '</label><br>';
|
||||
|
||||
$html_output .= ''
|
||||
@ -169,7 +173,7 @@ class Operations
|
||||
. '<fieldset class="caution">';
|
||||
$html_output .= '<legend>';
|
||||
if (Util::showIcons('ActionLinksMode')) {
|
||||
$html_output .= Util::getImage('b_deltbl') . ' ';
|
||||
$html_output .= Generator::getImage('b_deltbl') . ' ';
|
||||
}
|
||||
$html_output .= __('Remove database')
|
||||
. '</legend>';
|
||||
@ -221,13 +225,13 @@ class Operations
|
||||
. '<legend>';
|
||||
|
||||
if (Util::showIcons('ActionLinksMode')) {
|
||||
$html_output .= Util::getImage('b_edit') . ' ';
|
||||
$html_output .= Generator::getImage('b_edit') . ' ';
|
||||
}
|
||||
$html_output .= __('Copy database to')
|
||||
. '</legend>'
|
||||
. '<input type="text" maxlength="64" name="newname" '
|
||||
. 'class="textfield" required="required"><br>'
|
||||
. Util::getRadioFields(
|
||||
. RadioList::generate(
|
||||
'what',
|
||||
$choices,
|
||||
'data',
|
||||
@ -269,7 +273,7 @@ class Operations
|
||||
. '" disabled>';
|
||||
}
|
||||
$html_output .= '<label for="checkbox_privileges">'
|
||||
. __('Adjust privileges') . Util::showDocu('faq', 'faq6-39')
|
||||
. __('Adjust privileges') . MySQLDocumentation::showDocumentation('faq', 'faq6-39')
|
||||
. '</label><br>';
|
||||
|
||||
$html_output .= '<input type="checkbox" name="switch_to_new" value="true"'
|
||||
@ -307,7 +311,7 @@ class Operations
|
||||
$html_output .= '<fieldset>' . "\n"
|
||||
. ' <legend>';
|
||||
if (Util::showIcons('ActionLinksMode')) {
|
||||
$html_output .= Util::getImage('s_asci') . ' ';
|
||||
$html_output .= Generator::getImage('s_asci') . ' ';
|
||||
}
|
||||
$html_output .= '<label for="select_db_collation">' . __('Collation')
|
||||
. '</label>' . "\n"
|
||||
@ -925,7 +929,7 @@ class Operations
|
||||
. '" disabled>';
|
||||
}
|
||||
$html_output .= '<label for="checkbox_privileges_tables_move">'
|
||||
. __('Adjust privileges') . Util::showDocu('faq', 'faq6-39')
|
||||
. __('Adjust privileges') . MySQLDocumentation::showDocumentation('faq', 'faq6-39')
|
||||
. '</label><br>';
|
||||
|
||||
$html_output .= '</fieldset><fieldset class="tblFooters">'
|
||||
@ -1028,7 +1032,7 @@ class Operations
|
||||
}
|
||||
$html_output .= '<label for="checkbox_privileges_table_options">'
|
||||
. __('Adjust privileges') . ' '
|
||||
. Util::showDocu('faq', 'faq6-39') . '</label>';
|
||||
. MySQLDocumentation::showDocumentation('faq', 'faq6-39') . '</label>';
|
||||
|
||||
$html_output .= '</td></tr>';
|
||||
return $html_output;
|
||||
@ -1126,7 +1130,7 @@ class Operations
|
||||
|
||||
//Storage engine
|
||||
$html_output .= '<tr><td class="vmiddle">' . __('Storage Engine')
|
||||
. ' ' . Util::showMySQLDocu('Storage_engines')
|
||||
. ' ' . MySQLDocumentation::show('Storage_engines')
|
||||
. '</td>'
|
||||
. '<td>'
|
||||
. StorageEngine::getHtmlSelect(
|
||||
@ -1228,7 +1232,7 @@ class Operations
|
||||
$html_output .= '<tr><td class="vmiddle">'
|
||||
. '<label for="new_row_format">ROW_FORMAT</label></td>'
|
||||
. '<td>';
|
||||
$html_output .= Util::getDropdown(
|
||||
$html_output .= DropDown::generate(
|
||||
'new_row_format',
|
||||
$possible_row_formats[$tbl_storage_engine],
|
||||
$current_row_format,
|
||||
@ -1367,7 +1371,7 @@ class Operations
|
||||
'dataonly' => __('Data only'),
|
||||
];
|
||||
|
||||
$html_output .= Util::getRadioFields(
|
||||
$html_output .= RadioList::generate(
|
||||
'what',
|
||||
$choices,
|
||||
'data',
|
||||
@ -1409,7 +1413,7 @@ class Operations
|
||||
. '" disabled>';
|
||||
}
|
||||
$html_output .= '<label for="checkbox_adjust_privileges">'
|
||||
. __('Adjust privileges') . Util::showDocu('faq', 'faq6-39')
|
||||
. __('Adjust privileges') . MySQLDocumentation::showDocumentation('faq', 'faq6-39')
|
||||
. '</label><br>';
|
||||
|
||||
$pma_switch_to_new = isset($_SESSION['pma_switch_to_new']) && $_SESSION['pma_switch_to_new'];
|
||||
@ -1588,12 +1592,12 @@ class Operations
|
||||
private function getMaintainActionlink($action_message, array $params, array $url_params, $link)
|
||||
{
|
||||
return '<li>'
|
||||
. Util::linkOrButton(
|
||||
. Generator::linkOrButton(
|
||||
Url::getFromRoute('/sql', array_merge($url_params, $params)),
|
||||
$action_message,
|
||||
['class' => 'maintain_action ajax']
|
||||
)
|
||||
. Util::showMySQLDocu($link)
|
||||
. MySQLDocumentation::show($link)
|
||||
. '</li>';
|
||||
}
|
||||
|
||||
@ -1648,15 +1652,15 @@ class Operations
|
||||
*/
|
||||
public function getDeleteDataOrTablelink(array $url_params, $syntax, $link, $htmlId)
|
||||
{
|
||||
return '<li>' . Util::linkOrButton(
|
||||
Url::getFromRoute('/sql', $url_params),
|
||||
$link,
|
||||
[
|
||||
'id' => $htmlId,
|
||||
'class' => 'ajax',
|
||||
]
|
||||
)
|
||||
. Util::showMySQLDocu($syntax)
|
||||
return '<li>' . Generator::linkOrButton(
|
||||
Url::getFromRoute('/sql', $url_params),
|
||||
$link,
|
||||
[
|
||||
'id' => $htmlId,
|
||||
'class' => 'ajax',
|
||||
]
|
||||
)
|
||||
. MySQLDocumentation::show($syntax)
|
||||
. '</li>';
|
||||
}
|
||||
|
||||
@ -1701,7 +1705,7 @@ class Operations
|
||||
. '<fieldset>'
|
||||
. '<legend>'
|
||||
. __('Partition maintenance')
|
||||
. Util::showMySQLDocu('partitioning_maintenance')
|
||||
. MySQLDocumentation::show('partitioning_maintenance')
|
||||
. '</legend>';
|
||||
|
||||
$html_select = '<select id="partition_name" name="partition_name[]"'
|
||||
@ -1720,7 +1724,7 @@ class Operations
|
||||
$html_output .= sprintf(__('Partition %s'), $html_select);
|
||||
|
||||
$html_output .= '<div class="clearfloat">';
|
||||
$html_output .= Util::getRadioFields(
|
||||
$html_output .= RadioList::generate(
|
||||
'partition_operation',
|
||||
$choices,
|
||||
'ANALYZE',
|
||||
@ -2128,7 +2132,7 @@ class Operations
|
||||
. Util::backquote($table)
|
||||
. ' CONVERT TO';
|
||||
|
||||
list($charset) = explode('_', $tbl_collation);
|
||||
[$charset] = explode('_', $tbl_collation);
|
||||
|
||||
$change_all_collations_query .= ' CHARACTER SET ' . $charset
|
||||
. ($charset == $tbl_collation ? '' : ' COLLATE ' . $tbl_collation);
|
||||
|
||||
@ -8,6 +8,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin;
|
||||
|
||||
use PhpMyAdmin\Html\MySQLDocumentation;
|
||||
use PhpMyAdmin\Properties\Options\Groups\OptionsPropertySubgroup;
|
||||
use PhpMyAdmin\Properties\Options\Items\BoolPropertyItem;
|
||||
use PhpMyAdmin\Properties\Options\Items\DocPropertyItem;
|
||||
@ -374,7 +375,7 @@ class Plugins
|
||||
$doc = $propertyGroup->getDoc();
|
||||
if ($doc != null) {
|
||||
if (count($doc) === 3) {
|
||||
$ret .= Util::showMySQLDocu(
|
||||
$ret .= MySQLDocumentation::show(
|
||||
$doc[1],
|
||||
false,
|
||||
null,
|
||||
@ -382,9 +383,9 @@ class Plugins
|
||||
$doc[2]
|
||||
);
|
||||
} elseif (count($doc) === 1) {
|
||||
$ret .= Util::showDocu('faq', $doc[0]);
|
||||
$ret .= MySQLDocumentation::showDocumentation('faq', $doc[0]);
|
||||
} else {
|
||||
$ret .= Util::showMySQLDocu(
|
||||
$ret .= MySQLDocumentation::show(
|
||||
$doc[1]
|
||||
);
|
||||
}
|
||||
|
||||
@ -9,6 +9,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\Plugins\Auth;
|
||||
|
||||
use PhpMyAdmin\Html\Generator;
|
||||
use PhpMyAdmin\Plugins\AuthenticationPlugin;
|
||||
use PhpMyAdmin\Response;
|
||||
use PhpMyAdmin\Server\Select;
|
||||
@ -132,7 +133,7 @@ class AuthenticationConfig extends AuthenticationPlugin
|
||||
E_USER_WARNING
|
||||
);
|
||||
}
|
||||
echo Util::mysqlDie(
|
||||
echo Generator::mysqlDie(
|
||||
$conn_error,
|
||||
'',
|
||||
true,
|
||||
|
||||
@ -10,6 +10,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\Plugins\Import;
|
||||
|
||||
use PhpMyAdmin\Html\Generator;
|
||||
use PhpMyAdmin\Import;
|
||||
use PhpMyAdmin\Message;
|
||||
use PhpMyAdmin\Properties\Options\Items\BoolPropertyItem;
|
||||
@ -114,7 +115,7 @@ class ImportCsv extends AbstractImportCsv
|
||||
);
|
||||
$leaf = new TextPropertyItem(
|
||||
"columns",
|
||||
__('Column names:') . ' ' . Util::showHint($hint)
|
||||
__('Column names:') . ' ' . Generator::showHint($hint)
|
||||
);
|
||||
$generalOptions->addProperty($leaf);
|
||||
}
|
||||
@ -203,7 +204,7 @@ class ImportCsv extends AbstractImportCsv
|
||||
// If there is an error in the parameters entered,
|
||||
// indicate that immediately.
|
||||
if ($param_error) {
|
||||
Util::mysqlDie(
|
||||
Generator::mysqlDie(
|
||||
$message->getMessage(),
|
||||
'',
|
||||
false,
|
||||
@ -742,7 +743,7 @@ class ImportCsv extends AbstractImportCsv
|
||||
}
|
||||
$newDb = 'CSV_DB ' . (count($result) + 1);
|
||||
}
|
||||
list($db_name, $options) = $this->getDbnameAndOptions($db, $newDb);
|
||||
[$db_name, $options] = $this->getDbnameAndOptions($db, $newDb);
|
||||
|
||||
/* Non-applicable parameters */
|
||||
$create = null;
|
||||
|
||||
@ -9,6 +9,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\Plugins\Transformations\Abs;
|
||||
|
||||
use PhpMyAdmin\Html\Generator;
|
||||
use PhpMyAdmin\Plugins\TransformationsPlugin;
|
||||
use PhpMyAdmin\Util;
|
||||
use stdClass;
|
||||
@ -43,7 +44,7 @@ abstract class SQLTransformationsPlugin extends TransformationsPlugin
|
||||
*/
|
||||
public function applyTransformation($buffer, array $options = [], ?stdClass $meta = null)
|
||||
{
|
||||
return Util::formatSql($buffer);
|
||||
return Generator::formatSql($buffer);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -8,6 +8,8 @@ declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin;
|
||||
|
||||
use PhpMyAdmin\Html\Generator;
|
||||
|
||||
/**
|
||||
* Handles the recently used and favorite tables.
|
||||
*
|
||||
@ -212,7 +214,7 @@ class RecentFavoriteTable
|
||||
. '" data-favtargetn="'
|
||||
. md5($table['db'] . "." . $table['table'])
|
||||
. '" >'
|
||||
. Util::getIcon('b_favorite')
|
||||
. Generator::getIcon('b_favorite')
|
||||
. '</a>';
|
||||
|
||||
$table_url = Url::getFromRoute('/table/recent_favorite', [
|
||||
|
||||
@ -8,6 +8,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin;
|
||||
|
||||
use PhpMyAdmin\Html\MySQLDocumentation;
|
||||
use PhpMyAdmin\SqlParser\Parser;
|
||||
use PhpMyAdmin\SqlParser\Statements\CreateStatement;
|
||||
use PhpMyAdmin\SqlParser\Utils\Table as TableUtils;
|
||||
@ -131,7 +132,7 @@ class Relation
|
||||
if (strlen((string) $cfgRelation['db']) == 0) {
|
||||
$retval .= __('Configuration of pmadb…') . ' '
|
||||
. $messages['error']
|
||||
. Util::showDocu('setup', 'linked-tables')
|
||||
. MySQLDocumentation::showDocumentation('setup', 'linked-tables')
|
||||
. '<br>' . "\n"
|
||||
. __('General relation features')
|
||||
. ' <font color="green">' . __('Disabled')
|
||||
@ -224,7 +225,7 @@ class Relation
|
||||
'Please see the documentation on how to'
|
||||
. ' update your column_info table.'
|
||||
);
|
||||
$retval .= Util::showDocu(
|
||||
$retval .= MySQLDocumentation::showDocumentation(
|
||||
'config',
|
||||
'cfg_Servers_column_info'
|
||||
);
|
||||
@ -392,14 +393,14 @@ class Relation
|
||||
. '<code>%screate_tables.sql</code>.'
|
||||
),
|
||||
htmlspecialchars(SQL_DIR)
|
||||
) . ' ' . Util::showDocu('setup', 'linked-tables');
|
||||
) . ' ' . MySQLDocumentation::showDocumentation('setup', 'linked-tables');
|
||||
$items[] = __('Create a pma user and give access to these tables.') . ' '
|
||||
. Util::showDocu('config', 'cfg_Servers_controluser');
|
||||
. MySQLDocumentation::showDocumentation('config', 'cfg_Servers_controluser');
|
||||
$items[] = __(
|
||||
'Enable advanced features in configuration file '
|
||||
. '(<code>config.inc.php</code>), for example by '
|
||||
. 'starting from <code>config.sample.inc.php</code>.'
|
||||
) . ' ' . Util::showDocu('setup', 'quick-install');
|
||||
) . ' ' . MySQLDocumentation::showDocumentation('setup', 'quick-install');
|
||||
$items[] = __(
|
||||
'Re-login to phpMyAdmin to load the updated configuration file.'
|
||||
);
|
||||
@ -466,7 +467,7 @@ class Relation
|
||||
} else {
|
||||
$retval .= sprintf(
|
||||
$messages['error'],
|
||||
Util::getDocuLink('config', 'cfg_Servers_' . $docAnchor)
|
||||
MySQLDocumentation::getDocumentationLink('config', 'cfg_Servers_' . $docAnchor)
|
||||
);
|
||||
}
|
||||
$retval .= '</td></tr>' . "\n";
|
||||
|
||||
@ -9,6 +9,7 @@ declare(strict_types=1);
|
||||
namespace PhpMyAdmin\Rte;
|
||||
|
||||
use PhpMyAdmin\DatabaseInterface;
|
||||
use PhpMyAdmin\Html\Generator;
|
||||
use PhpMyAdmin\Message;
|
||||
use PhpMyAdmin\Response;
|
||||
use PhpMyAdmin\Url;
|
||||
@ -241,7 +242,7 @@ class Events
|
||||
$message->addHtml('</ul>');
|
||||
}
|
||||
|
||||
$output = Util::getMessage($message, $sql_query);
|
||||
$output = Generator::getMessage($message, $sql_query);
|
||||
$response = Response::getInstance();
|
||||
if ($response->isAjax()) {
|
||||
if ($message->isSuccess()) {
|
||||
|
||||
@ -9,6 +9,8 @@ declare(strict_types=1);
|
||||
namespace PhpMyAdmin\Rte;
|
||||
|
||||
use PhpMyAdmin\DatabaseInterface;
|
||||
use PhpMyAdmin\Html\MySQLDocumentation;
|
||||
use PhpMyAdmin\Html\Generator;
|
||||
use PhpMyAdmin\Url;
|
||||
use PhpMyAdmin\Util;
|
||||
|
||||
@ -77,14 +79,14 @@ class Footer
|
||||
]);
|
||||
$retval .= '" onclick="$.datepicker.initialized = false;">';
|
||||
$icon = 'b_' . $icon;
|
||||
$retval .= Util::getIcon($icon);
|
||||
$retval .= Generator::getIcon($icon);
|
||||
$retval .= $this->words->get('add') . "</a>\n";
|
||||
} else {
|
||||
$icon = 'bd_' . $icon;
|
||||
$retval .= Util::getIcon($icon);
|
||||
$retval .= Generator::getIcon($icon);
|
||||
$retval .= $this->words->get('add') . "\n";
|
||||
}
|
||||
$retval .= " " . Util::showMySQLDocu($docu) . "\n";
|
||||
$retval .= " " . MySQLDocumentation::show($docu) . "\n";
|
||||
$retval .= " </div>\n";
|
||||
$retval .= "</fieldset>\n";
|
||||
$retval .= "<!-- ADD " . $name . " FORM END -->\n\n";
|
||||
@ -155,12 +157,15 @@ class Footer
|
||||
$retval .= " </legend>\n";
|
||||
$retval .= " <div class='wrap'>\n";
|
||||
// show the toggle button
|
||||
$retval .= Util::toggleButton(
|
||||
Url::getFromRoute('/sql', [
|
||||
'db' => $db,
|
||||
'table' => $table,
|
||||
'goto' => Url::getFromRoute('/database/events', ['db' => $db]),
|
||||
]),
|
||||
$retval .= Generator::toggleButton(
|
||||
Url::getFromRoute(
|
||||
'/sql',
|
||||
[
|
||||
'db' => $db,
|
||||
'table' => $table,
|
||||
'goto' => Url::getFromRoute('/database/events', ['db' => $db]),
|
||||
]
|
||||
),
|
||||
'sql_query',
|
||||
$options,
|
||||
'Functions.slidingMessage(data.sql_query);'
|
||||
|
||||
@ -12,6 +12,8 @@ use PhpMyAdmin\Charsets;
|
||||
use PhpMyAdmin\Charsets\Charset;
|
||||
use PhpMyAdmin\Core;
|
||||
use PhpMyAdmin\DatabaseInterface;
|
||||
use PhpMyAdmin\Html\MySQLDocumentation;
|
||||
use PhpMyAdmin\Html\Generator;
|
||||
use PhpMyAdmin\Message;
|
||||
use PhpMyAdmin\Response;
|
||||
use PhpMyAdmin\SqlParser\Parser;
|
||||
@ -301,7 +303,7 @@ class Routines
|
||||
. '<br>'
|
||||
. __('MySQL said: ') . $this->dbi->getError();
|
||||
} else {
|
||||
list($newErrors, $message) = $this->create(
|
||||
[$newErrors, $message] = $this->create(
|
||||
$routine_query,
|
||||
$create_routine,
|
||||
$privilegesBackup
|
||||
@ -350,7 +352,7 @@ class Routines
|
||||
$message->addHtml('</ul>');
|
||||
}
|
||||
|
||||
$output = Util::getMessage($message, $sql_query);
|
||||
$output = Generator::getMessage($message, $sql_query);
|
||||
$response = Response::getInstance();
|
||||
if (! $response->isAjax()) {
|
||||
return $errors;
|
||||
@ -1047,7 +1049,7 @@ class Routines
|
||||
) {
|
||||
$retval .= "<tr>";
|
||||
$retval .= " <td>" . __('Adjust privileges');
|
||||
$retval .= Util::showDocu('faq', 'faq6-39');
|
||||
$retval .= MySQLDocumentation::showDocumentation('faq', 'faq6-39');
|
||||
$retval .= "</td>";
|
||||
if ($GLOBALS['proc_priv']
|
||||
&& $GLOBALS['is_reload_priv']
|
||||
@ -1439,7 +1441,7 @@ class Routines
|
||||
$nbResultsetToDisplay = 0;
|
||||
if ($outcome) {
|
||||
// Pass the SQL queries through the "pretty printer"
|
||||
$output = Util::formatSql(implode("\n", $queries));
|
||||
$output = Generator::formatSql(implode("\n", $queries));
|
||||
|
||||
// Display results
|
||||
$output .= "<fieldset><legend>";
|
||||
@ -1684,7 +1686,7 @@ class Routines
|
||||
];
|
||||
$retval .= "<select name='funcs["
|
||||
. $routine['item_param_name'][$i] . "]'>";
|
||||
$retval .= Util::getFunctionsForField($field, false, []);
|
||||
$retval .= Generator::getFunctionsForField($field, false, []);
|
||||
$retval .= "</select>";
|
||||
}
|
||||
$retval .= "</td>\n";
|
||||
|
||||
@ -9,6 +9,8 @@ declare(strict_types=1);
|
||||
namespace PhpMyAdmin\Rte;
|
||||
|
||||
use PhpMyAdmin\DatabaseInterface;
|
||||
use PhpMyAdmin\Html\MySQLDocumentation;
|
||||
use PhpMyAdmin\Html\Generator;
|
||||
use PhpMyAdmin\Response;
|
||||
use PhpMyAdmin\SqlParser\Parser;
|
||||
use PhpMyAdmin\SqlParser\Statements\CreateStatement;
|
||||
@ -101,7 +103,7 @@ class RteList
|
||||
$retval .= " <legend>\n";
|
||||
$retval .= " " . $this->words->get('title') . "\n";
|
||||
$retval .= " "
|
||||
. Util::showMySQLDocu($this->words->get('docu')) . "\n";
|
||||
. MySQLDocumentation::show($this->words->get('docu')) . "\n";
|
||||
$retval .= " </legend>\n";
|
||||
$retval .= " <div class='$class1' id='nothing2display'>\n";
|
||||
$retval .= " " . $this->words->get('nothing') . "\n";
|
||||
@ -186,14 +188,14 @@ class RteList
|
||||
'text_dir' => $GLOBALS['text_dir'],
|
||||
'form_name' => 'rteListForm',
|
||||
]);
|
||||
$retval .= Util::getButtonOrImage(
|
||||
$retval .= Generator::getButtonOrImage(
|
||||
'submit_mult',
|
||||
'mult_submit',
|
||||
__('Export'),
|
||||
'b_export',
|
||||
'export'
|
||||
);
|
||||
$retval .= Util::getButtonOrImage(
|
||||
$retval .= Generator::getButtonOrImage(
|
||||
'submit_mult',
|
||||
'mult_submit',
|
||||
__('Drop'),
|
||||
@ -351,13 +353,16 @@ class RteList
|
||||
}
|
||||
$retval .= " </td>\n";
|
||||
$retval .= " <td>\n";
|
||||
$retval .= Util::linkOrButton(
|
||||
Url::getFromRoute('/sql', [
|
||||
'db' => $db,
|
||||
'table' => $table,
|
||||
'sql_query' => $sql_drop,
|
||||
'goto' => Url::getFromRoute('/database/routines', ['db' => $db]),
|
||||
]),
|
||||
$retval .= Generator::linkOrButton(
|
||||
Url::getFromRoute(
|
||||
'/sql',
|
||||
[
|
||||
'db' => $db,
|
||||
'table' => $table,
|
||||
'sql_query' => $sql_drop,
|
||||
'goto' => Url::getFromRoute('/database/routines', ['db' => $db]),
|
||||
]
|
||||
),
|
||||
$titles['Drop'],
|
||||
['class' => 'ajax drop_anchor']
|
||||
);
|
||||
@ -435,13 +440,16 @@ class RteList
|
||||
$retval .= " </td>\n";
|
||||
$retval .= " <td>\n";
|
||||
if (Util::currentUserHasPrivilege('TRIGGER', $db)) {
|
||||
$retval .= Util::linkOrButton(
|
||||
Url::getFromRoute('/sql', [
|
||||
'db' => $db,
|
||||
'table' => $table,
|
||||
'sql_query' => $trigger['drop'],
|
||||
'goto' => Url::getFromRoute('/database/triggers', ['db' => $db]),
|
||||
]),
|
||||
$retval .= Generator::linkOrButton(
|
||||
Url::getFromRoute(
|
||||
'/sql',
|
||||
[
|
||||
'db' => $db,
|
||||
'table' => $table,
|
||||
'sql_query' => $trigger['drop'],
|
||||
'goto' => Url::getFromRoute('/database/triggers', ['db' => $db]),
|
||||
]
|
||||
),
|
||||
$titles['Drop'],
|
||||
['class' => 'ajax drop_anchor']
|
||||
);
|
||||
@ -518,13 +526,16 @@ class RteList
|
||||
$retval .= " </td>\n";
|
||||
$retval .= " <td>\n";
|
||||
if (Util::currentUserHasPrivilege('EVENT', $db)) {
|
||||
$retval .= Util::linkOrButton(
|
||||
Url::getFromRoute('/sql', [
|
||||
'db' => $db,
|
||||
'table' => $table,
|
||||
'sql_query' => $sql_drop,
|
||||
'goto' => Url::getFromRoute('/database/events', ['db' => $db]),
|
||||
]),
|
||||
$retval .= Generator::linkOrButton(
|
||||
Url::getFromRoute(
|
||||
'/sql',
|
||||
[
|
||||
'db' => $db,
|
||||
'table' => $table,
|
||||
'sql_query' => $sql_drop,
|
||||
'goto' => Url::getFromRoute('/database/events', ['db' => $db]),
|
||||
]
|
||||
),
|
||||
$titles['Drop'],
|
||||
['class' => 'ajax drop_anchor']
|
||||
);
|
||||
|
||||
@ -9,6 +9,7 @@ declare(strict_types=1);
|
||||
namespace PhpMyAdmin\Rte;
|
||||
|
||||
use PhpMyAdmin\DatabaseInterface;
|
||||
use PhpMyAdmin\Html\Generator;
|
||||
use PhpMyAdmin\Message;
|
||||
use PhpMyAdmin\Response;
|
||||
use PhpMyAdmin\Url;
|
||||
@ -213,7 +214,7 @@ class Triggers
|
||||
$message->addHtml('</ul>');
|
||||
}
|
||||
|
||||
$output = Util::getMessage($message, $sql_query);
|
||||
$output = Generator::getMessage($message, $sql_query);
|
||||
$response = Response::getInstance();
|
||||
if ($response->isAjax()) {
|
||||
if ($message->isSuccess()) {
|
||||
|
||||
@ -9,6 +9,7 @@ declare(strict_types=1);
|
||||
namespace PhpMyAdmin;
|
||||
|
||||
use PhpMyAdmin\Core;
|
||||
use PhpMyAdmin\Html\MySQLDocumentation;
|
||||
use PhpMyAdmin\Util;
|
||||
|
||||
/**
|
||||
@ -124,7 +125,7 @@ class Sanitize
|
||||
$page = 'setup';
|
||||
}
|
||||
}
|
||||
$link = Util::getDocuLink($page, $anchor);
|
||||
$link = MySQLDocumentation::getDocumentationLink($page, $anchor);
|
||||
return '<a href="' . $link . '" target="documentation">';
|
||||
}
|
||||
|
||||
@ -170,7 +171,7 @@ class Sanitize
|
||||
// used in common.inc.php:
|
||||
'[conferr]' => '<iframe src="show_config_errors.php"><a href="show_config_errors.php">show_config_errors.php</a></iframe>',
|
||||
// used in libraries/Util.php
|
||||
'[dochelpicon]' => Util::getImage('b_help', __('Documentation')),
|
||||
'[dochelpicon]' => Html\Generator::getImage('b_help', __('Documentation')),
|
||||
];
|
||||
|
||||
$message = strtr($message, $replace_pairs);
|
||||
|
||||
@ -11,6 +11,10 @@ namespace PhpMyAdmin\Server;
|
||||
use PhpMyAdmin\Core;
|
||||
use PhpMyAdmin\DatabaseInterface;
|
||||
use PhpMyAdmin\Display\ChangePassword;
|
||||
use PhpMyAdmin\Html\Forms;
|
||||
use PhpMyAdmin\Html\Forms\Fields\DropDown;
|
||||
use PhpMyAdmin\Html\MySQLDocumentation;
|
||||
use PhpMyAdmin\Html\Generator;
|
||||
use PhpMyAdmin\Message;
|
||||
use PhpMyAdmin\Relation;
|
||||
use PhpMyAdmin\RelationCleanup;
|
||||
@ -802,7 +806,7 @@ class Privileges
|
||||
];
|
||||
}
|
||||
|
||||
$html_output = Util::getDropdown(
|
||||
$html_output = DropDown::generate(
|
||||
'authentication_plugin',
|
||||
$active_auth_plugins,
|
||||
$orig_auth_plugin,
|
||||
@ -858,7 +862,7 @@ class Privileges
|
||||
) {
|
||||
global $pred_username, $pred_hostname, $username, $hostname, $new_username;
|
||||
|
||||
list($usernameLength, $hostnameLength) = $this->getUsernameAndHostnameLength();
|
||||
[$usernameLength, $hostnameLength] = $this->getUsernameAndHostnameLength();
|
||||
|
||||
if (isset($username) && strlen($username) === 0) {
|
||||
$pred_username = 'any';
|
||||
@ -997,7 +1001,7 @@ class Privileges
|
||||
$authentication_plugin = $row['plugin'];
|
||||
}
|
||||
} elseif ($mode == 'change') {
|
||||
list($username, $hostname) = $this->dbi->getCurrentUserAndHost();
|
||||
[$username, $hostname] = $this->dbi->getCurrentUserAndHost();
|
||||
|
||||
$row = $this->dbi->fetchSingleRow(
|
||||
'SELECT `plugin` FROM `mysql`.`user` WHERE '
|
||||
@ -1153,7 +1157,7 @@ class Privileges
|
||||
|
||||
// Update the plugin for the user
|
||||
if (! $this->dbi->tryQuery($update_plugin_query)) {
|
||||
Util::mysqlDie(
|
||||
Generator::mysqlDie(
|
||||
$this->dbi->getError(),
|
||||
$update_plugin_query,
|
||||
false,
|
||||
@ -1187,7 +1191,7 @@ class Privileges
|
||||
}
|
||||
|
||||
if (! $this->dbi->tryQuery($local_query)) {
|
||||
Util::mysqlDie(
|
||||
Generator::mysqlDie(
|
||||
$this->dbi->getError(),
|
||||
$sql_query,
|
||||
false,
|
||||
@ -1642,13 +1646,13 @@ class Privileges
|
||||
|
||||
switch ($linktype) {
|
||||
case 'edit':
|
||||
$html .= Util::getIcon('b_usredit', __('Edit privileges'));
|
||||
$html .= Generator::getIcon('b_usredit', __('Edit privileges'));
|
||||
break;
|
||||
case 'revoke':
|
||||
$html .= Util::getIcon('b_usrdrop', __('Revoke'));
|
||||
$html .= Generator::getIcon('b_usrdrop', __('Revoke'));
|
||||
break;
|
||||
case 'export':
|
||||
$html .= Util::getIcon('b_tblexport', __('Export'));
|
||||
$html .= Generator::getIcon('b_tblexport', __('Export'));
|
||||
break;
|
||||
}
|
||||
$html .= '</a>';
|
||||
@ -1748,7 +1752,7 @@ class Privileges
|
||||
|
||||
$extra_data = [];
|
||||
if (strlen($sql_query) > 0) {
|
||||
$extra_data['sql_query'] = Util::getMessage(null, $sql_query);
|
||||
$extra_data['sql_query'] = Generator::getMessage(null, $sql_query);
|
||||
}
|
||||
|
||||
if (isset($_POST['change_copy'])) {
|
||||
@ -2237,7 +2241,7 @@ class Privileges
|
||||
DatabaseInterface::QUERY_STORE
|
||||
);
|
||||
if ($initials) {
|
||||
while (list($tmp_initial) = $this->dbi->fetchRow($initials)) {
|
||||
while ([$tmp_initial] = $this->dbi->fetchRow($initials)) {
|
||||
$array_initials[$tmp_initial] = true;
|
||||
}
|
||||
}
|
||||
@ -2527,7 +2531,7 @@ class Privileges
|
||||
}
|
||||
|
||||
foreach ($selected_usr as $each_user) {
|
||||
list($this_user, $this_host) = explode('&#27;', $each_user);
|
||||
[$this_user, $this_host] = explode('&#27;', $each_user);
|
||||
$queries[] = '# '
|
||||
. sprintf(
|
||||
__('Deleting %s'),
|
||||
@ -2672,7 +2676,7 @@ class Privileges
|
||||
];
|
||||
}
|
||||
|
||||
list(
|
||||
[
|
||||
$create_user_real,
|
||||
$create_user_show,
|
||||
$real_sql_query,
|
||||
@ -2680,8 +2684,8 @@ class Privileges
|
||||
$password_set_real,
|
||||
$password_set_show,
|
||||
$alter_real_sql_query,
|
||||
$alter_sql_query
|
||||
) = $this->getSqlQueriesForDisplayAndAddUser(
|
||||
$alter_sql_query,
|
||||
] = $this->getSqlQueriesForDisplayAndAddUser(
|
||||
$username,
|
||||
$hostname,
|
||||
(isset($password) ? $password : '')
|
||||
@ -2705,7 +2709,7 @@ class Privileges
|
||||
$sql_query = $create_user_show . $sql_query;
|
||||
}
|
||||
|
||||
list($sql_query, $message) = $this->addUserAndCreateDatabase(
|
||||
[$sql_query, $message] = $this->addUserAndCreateDatabase(
|
||||
$_error,
|
||||
$real_sql_query,
|
||||
$sql_query,
|
||||
@ -3087,7 +3091,7 @@ class Privileges
|
||||
. 'from connecting if the host part of their account '
|
||||
. 'allows a connection from any (%) host.'
|
||||
)
|
||||
. Util::showMySQLDocu('problems-connecting')
|
||||
. MySQLDocumentation::show('problems-connecting')
|
||||
)->getDisplay();
|
||||
break 2;
|
||||
}
|
||||
@ -3148,7 +3152,7 @@ class Privileges
|
||||
. 'the privileges have to be reloaded but currently, you '
|
||||
. 'don\'t have the RELOAD privilege.'
|
||||
)
|
||||
. Util::showMySQLDocu(
|
||||
. MySQLDocumentation::show(
|
||||
'privileges-provided',
|
||||
false,
|
||||
null,
|
||||
|
||||
@ -8,6 +8,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\Server;
|
||||
|
||||
use PhpMyAdmin\Html\Generator;
|
||||
use PhpMyAdmin\Relation;
|
||||
use PhpMyAdmin\Url;
|
||||
use PhpMyAdmin\Util;
|
||||
@ -120,7 +121,7 @@ class UserGroups
|
||||
''
|
||||
)
|
||||
. '">'
|
||||
. Util::getIcon('b_usrlist', __('View users'))
|
||||
. Generator::getIcon('b_usrlist', __('View users'))
|
||||
. '</a>';
|
||||
$html_output .= ' ';
|
||||
$html_output .= '<a class="" href="' . Url::getFromRoute('/server/user_groups') . '" data-post="'
|
||||
@ -132,7 +133,7 @@ class UserGroups
|
||||
''
|
||||
)
|
||||
. '">'
|
||||
. Util::getIcon('b_edit', __('Edit')) . '</a>';
|
||||
. Generator::getIcon('b_edit', __('Edit')) . '</a>';
|
||||
$html_output .= ' ';
|
||||
$html_output .= '<a class="deleteUserGroup ajax"'
|
||||
. ' href="' . Url::getFromRoute('/server/user_groups') . '" data-post="'
|
||||
@ -144,7 +145,7 @@ class UserGroups
|
||||
''
|
||||
)
|
||||
. '">'
|
||||
. Util::getIcon('b_drop', __('Delete')) . '</a>';
|
||||
. Generator::getIcon('b_drop', __('Delete')) . '</a>';
|
||||
$html_output .= '</td>';
|
||||
|
||||
$html_output .= '</tr>';
|
||||
@ -158,7 +159,7 @@ class UserGroups
|
||||
|
||||
$html_output .= '<div class="row"><fieldset id="fieldset_add_user_group">';
|
||||
$html_output .= '<a href="' . Url::getFromRoute('/server/user_groups', ['addUserGroup' => 1]) . '">'
|
||||
. Util::getIcon('b_usradd')
|
||||
. Generator::getIcon('b_usradd')
|
||||
. __('Add user group') . '</a>';
|
||||
$html_output .= '</fieldset></div>';
|
||||
|
||||
|
||||
@ -12,6 +12,8 @@ use PhpMyAdmin\Bookmark;
|
||||
use PhpMyAdmin\Core;
|
||||
use PhpMyAdmin\DatabaseInterface;
|
||||
use PhpMyAdmin\Display\Results as DisplayResults;
|
||||
use PhpMyAdmin\Html\Generator;
|
||||
use PhpMyAdmin\Html\MySQLDocumentation;
|
||||
use PhpMyAdmin\Index;
|
||||
use PhpMyAdmin\Message;
|
||||
use PhpMyAdmin\Operations;
|
||||
@ -87,7 +89,9 @@ class Sql
|
||||
if ($db === null && isset($GLOBALS['db']) && strlen($GLOBALS['db'])) {
|
||||
$db = $GLOBALS['db'];
|
||||
}
|
||||
list($analyzed_sql_results,,) = ParseAnalyze::sqlQuery($sql_query, $db);
|
||||
[
|
||||
$analyzed_sql_results,,
|
||||
] = ParseAnalyze::sqlQuery($sql_query, $db);
|
||||
return $analyzed_sql_results;
|
||||
}
|
||||
|
||||
@ -291,11 +295,11 @@ class Sql
|
||||
if (! empty($profilingResults)) {
|
||||
$urlQuery = isset($urlQuery) ? $urlQuery : Url::getCommon(['db' => $database]);
|
||||
|
||||
list(
|
||||
[
|
||||
$detailedTable,
|
||||
$chartJson,
|
||||
$profilingStats
|
||||
) = $this->analyzeAndGetTableHtmlForProfilingResults($profilingResults);
|
||||
$profilingStats,
|
||||
] = $this->analyzeAndGetTableHtmlForProfilingResults($profilingResults);
|
||||
|
||||
return $this->template->render('sql/profiling_chart', [
|
||||
'url_query' => $urlQuery,
|
||||
@ -831,7 +835,7 @@ class Sql
|
||||
);
|
||||
$GLOBALS['using_bookmark_message']->addParam($table);
|
||||
$GLOBALS['using_bookmark_message']->addHtml(
|
||||
Util::showDocu('faq', 'faq6-22')
|
||||
MySQLDocumentation::showDocumentation('faq', 'faq6-22')
|
||||
);
|
||||
$sql_query = $bookmark->getQuery();
|
||||
} else {
|
||||
@ -884,7 +888,7 @@ class Sql
|
||||
$response->setRequestStatus(false);
|
||||
$response->addJSON('message', $message);
|
||||
} else {
|
||||
Util::mysqlDie($error, $full_sql_query, '', '');
|
||||
Generator::mysqlDie($error, $full_sql_query, '', '');
|
||||
}
|
||||
exit;
|
||||
}
|
||||
@ -1171,10 +1175,10 @@ class Sql
|
||||
$GLOBALS['dbi']->query('SET PROFILING=1;');
|
||||
}
|
||||
|
||||
list(
|
||||
[
|
||||
$result,
|
||||
$GLOBALS['querytime']
|
||||
) = $this->executeQueryAndMeasureTime($full_sql_query);
|
||||
$GLOBALS['querytime'],
|
||||
] = $this->executeQueryAndMeasureTime($full_sql_query);
|
||||
|
||||
// Displays an error message if required and stop parsing the script
|
||||
$error = $GLOBALS['dbi']->getError();
|
||||
@ -1417,7 +1421,7 @@ class Sql
|
||||
}
|
||||
|
||||
$html_output = '';
|
||||
$html_message = Util::getMessage(
|
||||
$html_message = Generator::getMessage(
|
||||
$message,
|
||||
$GLOBALS['sql_query'],
|
||||
'success'
|
||||
@ -1696,7 +1700,7 @@ class Sql
|
||||
): string {
|
||||
$output = '';
|
||||
if (isset($displayQuery) && ($showSql === true) && empty($sqlData)) {
|
||||
$output = Util::getMessage(
|
||||
$output = Generator::getMessage(
|
||||
$displayMessage,
|
||||
$displayQuery,
|
||||
'success'
|
||||
@ -1727,7 +1731,7 @@ class Sql
|
||||
. ' Grid edit, checkbox, Edit, Copy and Delete features'
|
||||
. ' are not available. %s'
|
||||
),
|
||||
Util::showDocu(
|
||||
MySQLDocumentation::showDocumentation(
|
||||
'config',
|
||||
'cfg_RowActionLinksWithoutUnique'
|
||||
)
|
||||
@ -1741,7 +1745,7 @@ class Sql
|
||||
. ' Grid edit, Edit, Copy and Delete features may result in'
|
||||
. ' undesired behavior. %s'
|
||||
),
|
||||
Util::showDocu(
|
||||
MySQLDocumentation::showDocumentation(
|
||||
'config',
|
||||
'cfg_RowActionLinksWithoutUnique'
|
||||
)
|
||||
@ -1932,7 +1936,7 @@ class Sql
|
||||
$scripts->addFile('sql.js');
|
||||
if (isset($message)) {
|
||||
$message = Message::success($message);
|
||||
$tableMaintenanceHtml = Util::getMessage(
|
||||
$tableMaintenanceHtml = Generator::getMessage(
|
||||
$message,
|
||||
$GLOBALS['sql_query'],
|
||||
'success'
|
||||
@ -2081,11 +2085,11 @@ class Sql
|
||||
) {
|
||||
if ($analyzed_sql_results == null) {
|
||||
// Parse and analyze the query
|
||||
list(
|
||||
[
|
||||
$analyzed_sql_results,
|
||||
$db,
|
||||
$table_from_sql
|
||||
) = ParseAnalyze::sqlQuery($sql_query, $db);
|
||||
$table_from_sql,
|
||||
] = ParseAnalyze::sqlQuery($sql_query, $db);
|
||||
// @todo: possibly refactor
|
||||
extract($analyzed_sql_results);
|
||||
|
||||
@ -2206,13 +2210,13 @@ class Sql
|
||||
$GLOBALS['reload'] = $this->hasCurrentDbChanged($db);
|
||||
$GLOBALS['dbi']->selectDb($db);
|
||||
|
||||
list(
|
||||
[
|
||||
$result,
|
||||
$num_rows,
|
||||
$unlim_num_rows,
|
||||
$profiling_results,
|
||||
$extra_data
|
||||
) = $this->executeTheQuery(
|
||||
$extra_data,
|
||||
] = $this->executeTheQuery(
|
||||
$analyzed_sql_results,
|
||||
$full_sql_query,
|
||||
$is_gotofile,
|
||||
|
||||
@ -13,6 +13,8 @@ declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin;
|
||||
|
||||
use PhpMyAdmin\Html\MySQLDocumentation;
|
||||
|
||||
/**
|
||||
* PhpMyAdmin\SqlQueryForm class
|
||||
*
|
||||
@ -80,7 +82,7 @@ class SqlQueryForm
|
||||
}
|
||||
|
||||
if ($display_tab === 'full' || $display_tab === 'sql') {
|
||||
list($legend, $query, $columns_list) = $this->init($query);
|
||||
[$legend, $query, $columns_list] = $this->init($query);
|
||||
}
|
||||
|
||||
$cfgBookmark = Bookmark::getParams($GLOBALS['cfg']['Server']['user']);
|
||||
@ -190,7 +192,7 @@ class SqlQueryForm
|
||||
);
|
||||
}
|
||||
}
|
||||
$legend .= ': ' . Util::showMySQLDocu('SELECT');
|
||||
$legend .= ': ' . MySQLDocumentation::show('SELECT');
|
||||
|
||||
return [
|
||||
$legend,
|
||||
|
||||
@ -20,6 +20,7 @@ use PhpMyAdmin\Engines\Myisam;
|
||||
use PhpMyAdmin\Engines\Ndbcluster;
|
||||
use PhpMyAdmin\Engines\Pbxt;
|
||||
use PhpMyAdmin\Engines\PerformanceSchema;
|
||||
use PhpMyAdmin\Html\Generator;
|
||||
use PhpMyAdmin\Util;
|
||||
|
||||
/**
|
||||
@ -253,7 +254,7 @@ class StorageEngine
|
||||
. ' <td>' . "\n";
|
||||
if (! empty($details['desc'])) {
|
||||
$ret .= ' '
|
||||
. Util::showHint($details['desc'])
|
||||
. Generator::showHint($details['desc'])
|
||||
. "\n";
|
||||
}
|
||||
$ret .= ' </td>' . "\n"
|
||||
|
||||
@ -9,6 +9,8 @@ declare(strict_types=1);
|
||||
namespace PhpMyAdmin;
|
||||
|
||||
use PhpMyAdmin\DatabaseInterface;
|
||||
use PhpMyAdmin\Html\Generator;
|
||||
use PhpMyAdmin\Html\MySQLDocumentation;
|
||||
use PhpMyAdmin\Index;
|
||||
use PhpMyAdmin\Message;
|
||||
use PhpMyAdmin\Plugins;
|
||||
@ -1889,7 +1891,7 @@ class Table
|
||||
'Failed to cleanup table UI preferences (see ' .
|
||||
'$cfg[\'Servers\'][$i][\'MaxTableUiprefs\'] %s)'
|
||||
),
|
||||
Util::showDocu('config', 'cfg_Servers_MaxTableUiprefs')
|
||||
MySQLDocumentation::showDocumentation('config', 'cfg_Servers_MaxTableUiprefs')
|
||||
)
|
||||
);
|
||||
$message->addMessage(
|
||||
@ -2492,7 +2494,7 @@ class Table
|
||||
|
||||
if (! empty($tmp_error_drop)) {
|
||||
$seen_error = true;
|
||||
$html_output .= Util::mysqlDie(
|
||||
$html_output .= Generator::mysqlDie(
|
||||
$tmp_error_drop,
|
||||
$drop_query,
|
||||
false,
|
||||
@ -2538,7 +2540,7 @@ class Table
|
||||
$message->addParam(implode(', ', $master_field));
|
||||
$html_output .= $message->getDisplay();
|
||||
} else {
|
||||
$html_output .= Util::mysqlDie(
|
||||
$html_output .= Generator::mysqlDie(
|
||||
$tmp_error_create,
|
||||
$create_query,
|
||||
false,
|
||||
@ -2546,9 +2548,9 @@ class Table
|
||||
false
|
||||
);
|
||||
}
|
||||
$html_output .= Util::showMySQLDocu(
|
||||
'InnoDB_foreign_key_constraints'
|
||||
) . "\n";
|
||||
$html_output .= MySQLDocumentation::show(
|
||||
'InnoDB_foreign_key_constraints'
|
||||
) . "\n";
|
||||
}
|
||||
} else {
|
||||
$preview_sql_data .= $create_query . "\n";
|
||||
|
||||
@ -8,6 +8,8 @@ declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin;
|
||||
|
||||
use PhpMyAdmin\Html\Generator;
|
||||
|
||||
/**
|
||||
* PhpMyAdmin\Tracking class
|
||||
*
|
||||
@ -246,7 +248,7 @@ class Tracking
|
||||
. htmlspecialchars($data['tracking']) . '</small><br>';
|
||||
$html .= '<br>';
|
||||
|
||||
list($str1, $str2, $str3, $str4, $str5) = $this->getHtmlForElementsOfTrackingReport(
|
||||
[$str1, $str2, $str3, $str4, $str5] = $this->getHtmlForElementsOfTrackingReport(
|
||||
$selection_schema,
|
||||
$selection_data,
|
||||
$selection_both
|
||||
@ -255,7 +257,7 @@ class Tracking
|
||||
// Prepare delete link content here
|
||||
$drop_image_or_text = '';
|
||||
if (Util::showIcons('ActionLinksMode')) {
|
||||
$drop_image_or_text .= Util::getImage(
|
||||
$drop_image_or_text .= Generator::getImage(
|
||||
'b_drop',
|
||||
__('Delete tracking data row from report')
|
||||
);
|
||||
@ -399,7 +401,7 @@ class Tracking
|
||||
);
|
||||
|
||||
if ($selection_schema || $selection_both && count($data['ddlog']) > 0) {
|
||||
list($temp, $ddlog_count) = $this->getHtmlForDataDefinitionStatements(
|
||||
[$temp, $ddlog_count] = $this->getHtmlForDataDefinitionStatements(
|
||||
$data,
|
||||
$filter_users,
|
||||
$filter_ts_from,
|
||||
@ -517,7 +519,9 @@ class Tracking
|
||||
$drop_image_or_text
|
||||
) {
|
||||
// no need for the secondth returned parameter
|
||||
list($html,) = $this->getHtmlForDataStatements(
|
||||
[
|
||||
$html,
|
||||
] = $this->getHtmlForDataStatements(
|
||||
$data,
|
||||
$filter_users,
|
||||
$filter_ts_from,
|
||||
@ -553,7 +557,7 @@ class Tracking
|
||||
array $url_params,
|
||||
$drop_image_or_text
|
||||
) {
|
||||
list($html, $line_number) = $this->getHtmlForDataStatements(
|
||||
[$html, $line_number] = $this->getHtmlForDataStatements(
|
||||
$data,
|
||||
$filter_users,
|
||||
$filter_ts_from,
|
||||
@ -609,7 +613,7 @@ class Tracking
|
||||
&& (in_array('*', $filterUsers)
|
||||
|| in_array($entry['username'], $filterUsers))
|
||||
) {
|
||||
$entry['formated_statement'] = Util::formatSql($entry['statement'], true);
|
||||
$entry['formated_statement'] = Generator::formatSql($entry['statement'], true);
|
||||
$deleteParam = 'delete_' . $whichLog;
|
||||
$entry['url_params'] = Url::getCommon($urlParams + [
|
||||
'report' => 'true',
|
||||
@ -662,7 +666,7 @@ class Tracking
|
||||
$drop_create_statements .= $data['ddlog'][1]['statement'];
|
||||
}
|
||||
// Print SQL code
|
||||
$html .= Util::getMessage(
|
||||
$html .= Generator::getMessage(
|
||||
sprintf(
|
||||
__('Version %s snapshot (SQL code)'),
|
||||
htmlspecialchars($_POST['version'])
|
||||
@ -1172,7 +1176,7 @@ class Tracking
|
||||
&& $GLOBALS['dbi']->numRows($allTablesResult) > 0;
|
||||
if ($headVersionExists) {
|
||||
while ($oneResult = $GLOBALS['dbi']->fetchArray($allTablesResult)) {
|
||||
list($tableName, $versionNumber) = $oneResult;
|
||||
[$tableName, $versionNumber] = $oneResult;
|
||||
$tableQuery = ' SELECT * FROM ' .
|
||||
Util::backquote($cfgRelation['db']) . '.' .
|
||||
Util::backquote($cfgRelation['tracking']) .
|
||||
@ -1278,7 +1282,7 @@ class Tracking
|
||||
'version' => $versionData['version'],
|
||||
], $params));
|
||||
|
||||
return Util::toggleButton(
|
||||
return Generator::toggleButton(
|
||||
$link,
|
||||
'toggle_activation',
|
||||
$options,
|
||||
|
||||
@ -33,7 +33,7 @@ class UtilExtension extends AbstractExtension
|
||||
),
|
||||
new TwigFunction(
|
||||
'get_browse_upload_file_block',
|
||||
'PhpMyAdmin\Util::getBrowseUploadFileBlock',
|
||||
'\PhpMyAdmin\Html\Forms\Fields\BrowseUploadFileBlock::generate',
|
||||
['is_safe' => ['html']]
|
||||
),
|
||||
new TwigFunction(
|
||||
@ -50,37 +50,37 @@ class UtilExtension extends AbstractExtension
|
||||
),
|
||||
new TwigFunction(
|
||||
'format_sql',
|
||||
'PhpMyAdmin\Util::formatSql',
|
||||
'\PhpMyAdmin\Html\Generator::formatSql',
|
||||
['is_safe' => ['html']]
|
||||
),
|
||||
new TwigFunction(
|
||||
'get_button_or_image',
|
||||
'PhpMyAdmin\Util::getButtonOrImage',
|
||||
'\PhpMyAdmin\Html\Generator::getButtonOrImage',
|
||||
['is_safe' => ['html']]
|
||||
),
|
||||
new TwigFunction(
|
||||
'get_docu_link',
|
||||
'PhpMyAdmin\Util::getDocuLink',
|
||||
'\PhpMyAdmin\Html\MySQLDocumentation::getDocumentationLink',
|
||||
['is_safe' => ['html']]
|
||||
),
|
||||
new TwigFunction(
|
||||
'get_list_navigator',
|
||||
'PhpMyAdmin\Util::getListNavigator',
|
||||
'\PhpMyAdmin\Html\Generator::getListNavigator',
|
||||
['is_safe' => ['html']]
|
||||
),
|
||||
new TwigFunction(
|
||||
'show_docu',
|
||||
'PhpMyAdmin\Util::showDocu',
|
||||
'\PhpMyAdmin\Html\MySQLDocumentation::showDocumentation',
|
||||
['is_safe' => ['html']]
|
||||
),
|
||||
new TwigFunction(
|
||||
'get_dropdown',
|
||||
'PhpMyAdmin\Util::getDropdown',
|
||||
'\PhpMyAdmin\Html\Forms\Fields\DropDown::generate',
|
||||
['is_safe' => ['html']]
|
||||
),
|
||||
new TwigFunction(
|
||||
'get_fk_checkbox',
|
||||
'PhpMyAdmin\Util::getFKCheckbox',
|
||||
'\PhpMyAdmin\Html\Forms\Fields\FKCheckbox::generate',
|
||||
['is_safe' => ['html']]
|
||||
),
|
||||
new TwigFunction(
|
||||
@ -93,27 +93,27 @@ class UtilExtension extends AbstractExtension
|
||||
),
|
||||
new TwigFunction(
|
||||
'get_html_tab',
|
||||
'PhpMyAdmin\Util::getHtmlTab',
|
||||
'\PhpMyAdmin\Html\Generator::getHtmlTab',
|
||||
['is_safe' => ['html']]
|
||||
),
|
||||
new TwigFunction(
|
||||
'get_icon',
|
||||
'PhpMyAdmin\Util::getIcon',
|
||||
'\PhpMyAdmin\Html\Generator::getIcon',
|
||||
['is_safe' => ['html']]
|
||||
),
|
||||
new TwigFunction(
|
||||
'get_image',
|
||||
'PhpMyAdmin\Util::getImage',
|
||||
'\PhpMyAdmin\Html\Generator::getImage',
|
||||
['is_safe' => ['html']]
|
||||
),
|
||||
new TwigFunction(
|
||||
'get_radio_fields',
|
||||
'PhpMyAdmin\Util::getRadioFields',
|
||||
'\PhpMyAdmin\Html\Forms\Fields\RadioList::generate',
|
||||
['is_safe' => ['html']]
|
||||
),
|
||||
new TwigFunction(
|
||||
'get_select_upload_file_block',
|
||||
'PhpMyAdmin\Util::getSelectUploadFileBlock',
|
||||
'\PhpMyAdmin\Html\Forms\Fields\DropDownUploadFileBlock::generate',
|
||||
['is_safe' => ['html']]
|
||||
),
|
||||
new TwigFunction(
|
||||
@ -146,7 +146,7 @@ class UtilExtension extends AbstractExtension
|
||||
),
|
||||
new TwigFunction(
|
||||
'show_hint',
|
||||
'PhpMyAdmin\Util::showHint',
|
||||
'\PhpMyAdmin\Html\Generator::showHint',
|
||||
['is_safe' => ['html']]
|
||||
),
|
||||
new TwigFunction(
|
||||
@ -155,7 +155,7 @@ class UtilExtension extends AbstractExtension
|
||||
),
|
||||
new TwigFunction(
|
||||
'show_mysql_docu',
|
||||
'PhpMyAdmin\Util::showMySQLDocu',
|
||||
'\PhpMyAdmin\Html\MySQLDocumentation::show',
|
||||
['is_safe' => ['html']]
|
||||
),
|
||||
new TwigFunction(
|
||||
@ -165,7 +165,7 @@ class UtilExtension extends AbstractExtension
|
||||
),
|
||||
new TwigFunction(
|
||||
'show_php_docu',
|
||||
'PhpMyAdmin\Util::showPHPDocu',
|
||||
'\PhpMyAdmin\Html\Generator::showPHPDocumentation',
|
||||
['is_safe' => ['html']]
|
||||
),
|
||||
new TwigFunction(
|
||||
@ -179,7 +179,7 @@ class UtilExtension extends AbstractExtension
|
||||
),
|
||||
new TwigFunction(
|
||||
'generate_hidden_max_file_size',
|
||||
'PhpMyAdmin\Util::generateHiddenMaxFileSize',
|
||||
'\PhpMyAdmin\Html\Forms\Fields\MaxFileSize::generate',
|
||||
['is_safe' => ['html']]
|
||||
),
|
||||
];
|
||||
|
||||
@ -9,6 +9,7 @@ declare(strict_types=1);
|
||||
namespace PhpMyAdmin;
|
||||
|
||||
use PhpMyAdmin\Core;
|
||||
use PhpMyAdmin\Html\Generator;
|
||||
use PhpMyAdmin\Message;
|
||||
use PhpMyAdmin\Response;
|
||||
use PhpMyAdmin\Server\Privileges;
|
||||
@ -56,7 +57,7 @@ class UserPassword
|
||||
$response->addJSON('message', $change_password_message['msg']);
|
||||
$response->setRequestStatus(false);
|
||||
} else {
|
||||
$sql_query = Util::getMessage(
|
||||
$sql_query = Generator::getMessage(
|
||||
$change_password_message['msg'],
|
||||
$sql_query,
|
||||
'success'
|
||||
@ -112,7 +113,7 @@ class UserPassword
|
||||
|
||||
$hashing_function = $this->changePassHashingFunction();
|
||||
|
||||
list($username, $hostname) = $GLOBALS['dbi']->getCurrentUserAndHost();
|
||||
[$username, $hostname] = $GLOBALS['dbi']->getCurrentUserAndHost();
|
||||
|
||||
$serverType = Util::getServerType();
|
||||
$serverVersion = $GLOBALS['dbi']->getVersion();
|
||||
@ -249,7 +250,7 @@ class UserPassword
|
||||
. $GLOBALS['dbi']->escapeString($password) . '\')');
|
||||
}
|
||||
if (! @$GLOBALS['dbi']->tryQuery($local_query)) {
|
||||
Util::mysqlDie(
|
||||
Generator::mysqlDie(
|
||||
$GLOBALS['dbi']->getError(),
|
||||
$sql_query,
|
||||
false,
|
||||
@ -272,7 +273,7 @@ class UserPassword
|
||||
private function changePassDisplayPage($message, $sql_query)
|
||||
{
|
||||
echo '<h1>' , __('Change password') , '</h1>' , "\n\n";
|
||||
echo Util::getMessage(
|
||||
echo Generator::getMessage(
|
||||
$message,
|
||||
$sql_query,
|
||||
'success'
|
||||
|
||||
@ -9,6 +9,7 @@ declare(strict_types=1);
|
||||
namespace PhpMyAdmin;
|
||||
|
||||
use PhpMyAdmin\Config\Forms\User\UserFormList;
|
||||
use PhpMyAdmin\Html\Generator;
|
||||
use Throwable;
|
||||
use Twig_Error_Loader;
|
||||
use Twig_Error_Runtime;
|
||||
@ -54,21 +55,21 @@ class UserPreferencesHeader
|
||||
global $route;
|
||||
|
||||
// build user preferences menu
|
||||
$content = Util::getHtmlTab(
|
||||
[
|
||||
'link' => 'index.php?route=/preferences/manage',
|
||||
'text' => __('Manage your settings'),
|
||||
'active' => $route === '/preferences/manage',
|
||||
]
|
||||
) . "\n";
|
||||
$content = Generator::getHtmlTab(
|
||||
[
|
||||
'link' => 'index.php?route=/preferences/manage',
|
||||
'text' => __('Manage your settings'),
|
||||
'active' => $route === '/preferences/manage',
|
||||
]
|
||||
) . "\n";
|
||||
/* Second authentication factor */
|
||||
$content .= Util::getHtmlTab(
|
||||
[
|
||||
'link' => 'index.php?route=/preferences/twofactor',
|
||||
'text' => __('Two-factor authentication'),
|
||||
'active' => $route === '/preferences/twofactor',
|
||||
]
|
||||
) . "\n";
|
||||
$content .= Generator::getHtmlTab(
|
||||
[
|
||||
'link' => 'index.php?route=/preferences/twofactor',
|
||||
'text' => __('Two-factor authentication'),
|
||||
'active' => $route === '/preferences/twofactor',
|
||||
]
|
||||
) . "\n";
|
||||
|
||||
$content .= self::displayTabsWithIcon();
|
||||
|
||||
@ -107,7 +108,7 @@ class UserPreferencesHeader
|
||||
'icon' => $tabs_icons[$formset],
|
||||
'active' => $route === '/preferences/forms' && $formset === $form_param,
|
||||
];
|
||||
$content .= Util::getHtmlTab($tab, ['form' => $formset]) . "\n";
|
||||
$content .= Generator::getHtmlTab($tab, ['form' => $formset]) . "\n";
|
||||
}
|
||||
return $content;
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -15,6 +15,7 @@ declare(strict_types=1);
|
||||
use PhpMyAdmin\CheckUserPrivileges;
|
||||
use PhpMyAdmin\DatabaseInterface;
|
||||
use PhpMyAdmin\Display\CreateTable;
|
||||
use PhpMyAdmin\Html\Generator;
|
||||
use PhpMyAdmin\Message;
|
||||
use PhpMyAdmin\Operations;
|
||||
use PhpMyAdmin\Plugins;
|
||||
@ -216,7 +217,7 @@ if (strlen($db) > 0
|
||||
$response->addJSON('newname', $_POST['newname']);
|
||||
$response->addJSON(
|
||||
'sql_query',
|
||||
Util::getMessage(null, $sql_query)
|
||||
Generator::getMessage(null, $sql_query)
|
||||
);
|
||||
$response->addJSON('db', $db);
|
||||
exit;
|
||||
@ -244,7 +245,7 @@ $url_query .= Url::getCommon($url_params, '&');
|
||||
// Gets the database structure
|
||||
$sub_part = '_structure';
|
||||
|
||||
list(
|
||||
[
|
||||
$tables,
|
||||
$num_tables,
|
||||
$total_num_tables,
|
||||
@ -253,13 +254,13 @@ list(
|
||||
$db_is_system_schema,
|
||||
$tooltip_truename,
|
||||
$tooltip_aliasname,
|
||||
$pos
|
||||
) = Util::getDbInfo($db, $sub_part === null ? '' : $sub_part);
|
||||
$pos,
|
||||
] = Util::getDbInfo($db, $sub_part === null ? '' : $sub_part);
|
||||
|
||||
echo "\n";
|
||||
|
||||
if (isset($message)) {
|
||||
echo Util::getMessage($message, $sql_query);
|
||||
echo Generator::getMessage($message, $sql_query);
|
||||
unset($message);
|
||||
}
|
||||
|
||||
|
||||
@ -10,6 +10,7 @@ declare(strict_types=1);
|
||||
|
||||
use PhpMyAdmin\Database\Search;
|
||||
use PhpMyAdmin\DatabaseInterface;
|
||||
use PhpMyAdmin\Html\Generator;
|
||||
use PhpMyAdmin\Response;
|
||||
use PhpMyAdmin\Template;
|
||||
use PhpMyAdmin\Url;
|
||||
@ -41,7 +42,7 @@ require ROOT_PATH . 'libraries/db_common.inc.php';
|
||||
|
||||
// If config variable $GLOBALS['cfg']['UseDbSearch'] is on false : exit.
|
||||
if (! $GLOBALS['cfg']['UseDbSearch']) {
|
||||
Util::mysqlDie(
|
||||
Generator::mysqlDie(
|
||||
__('Access denied!'),
|
||||
'',
|
||||
false,
|
||||
@ -56,7 +57,7 @@ $db_search = new Search($dbi, $db, $template);
|
||||
|
||||
// Display top links if we are not in an Ajax request
|
||||
if (! $response->isAjax()) {
|
||||
list(
|
||||
[
|
||||
$tables,
|
||||
$num_tables,
|
||||
$total_num_tables,
|
||||
@ -65,8 +66,8 @@ if (! $response->isAjax()) {
|
||||
$db_is_system_schema,
|
||||
$tooltip_truename,
|
||||
$tooltip_aliasname,
|
||||
$pos
|
||||
) = Util::getDbInfo($db, isset($sub_part) ? $sub_part : '');
|
||||
$pos,
|
||||
] = Util::getDbInfo($db, isset($sub_part) ? $sub_part : '');
|
||||
}
|
||||
|
||||
// Main search form has been submitted, get results
|
||||
|
||||
@ -7,6 +7,7 @@
|
||||
declare(strict_types=1);
|
||||
|
||||
use PhpMyAdmin\Display\CreateTable;
|
||||
use PhpMyAdmin\Html\Generator;
|
||||
use PhpMyAdmin\Message;
|
||||
use PhpMyAdmin\Response;
|
||||
use PhpMyAdmin\Template;
|
||||
@ -46,7 +47,7 @@ $url_query .= Url::getCommon($url_params, '&');
|
||||
// Get the database structure
|
||||
$sub_part = '_structure';
|
||||
|
||||
list(
|
||||
[
|
||||
$tables,
|
||||
$num_tables,
|
||||
$total_num_tables,
|
||||
@ -55,8 +56,8 @@ list(
|
||||
$db_is_system_schema,
|
||||
$tooltip_truename,
|
||||
$tooltip_aliasname,
|
||||
$pos
|
||||
) = Util::getDbInfo($db, $sub_part === null ? '' : $sub_part);
|
||||
$pos,
|
||||
] = Util::getDbInfo($db, $sub_part === null ? '' : $sub_part);
|
||||
|
||||
if (isset($_POST['delete_tracking'], $_POST['table'])) {
|
||||
Tracker::deleteTracking($db, $_POST['table']);
|
||||
@ -130,5 +131,5 @@ if (count($data['ddlog']) > 0) {
|
||||
$log .= '# ' . $entry['date'] . ' ' . $entry['username'] . "\n"
|
||||
. $entry['statement'] . "\n";
|
||||
}
|
||||
echo Util::getMessage(__('Database Log'), $log);
|
||||
echo Generator::getMessage(__('Database Log'), $log);
|
||||
}
|
||||
|
||||
@ -11,6 +11,7 @@ use PhpMyAdmin\Core;
|
||||
use PhpMyAdmin\DatabaseInterface;
|
||||
use PhpMyAdmin\Encoding;
|
||||
use PhpMyAdmin\File;
|
||||
use PhpMyAdmin\Html\Generator;
|
||||
use PhpMyAdmin\Import;
|
||||
use PhpMyAdmin\ParseAnalyze;
|
||||
use PhpMyAdmin\Plugins;
|
||||
@ -666,11 +667,11 @@ if (isset($message)) {
|
||||
// can choke on it so avoid parsing)
|
||||
$sqlLength = mb_strlen($sql_query);
|
||||
if ($sqlLength <= $GLOBALS['cfg']['MaxCharactersInDisplayedSQL']) {
|
||||
list(
|
||||
[
|
||||
$analyzed_sql_results,
|
||||
$db,
|
||||
$table_from_sql
|
||||
) = ParseAnalyze::sqlQuery($sql_query, $db);
|
||||
$table_from_sql,
|
||||
] = ParseAnalyze::sqlQuery($sql_query, $db);
|
||||
// @todo: possibly refactor
|
||||
extract($analyzed_sql_results);
|
||||
|
||||
@ -682,7 +683,7 @@ if ($sqlLength <= $GLOBALS['cfg']['MaxCharactersInDisplayedSQL']) {
|
||||
// There was an error?
|
||||
if (isset($my_die)) {
|
||||
foreach ($my_die as $key => $die) {
|
||||
PhpMyAdmin\Util::mysqlDie(
|
||||
Generator::mysqlDie(
|
||||
$die['error'],
|
||||
$die['sql'],
|
||||
false,
|
||||
@ -704,11 +705,11 @@ if ($go_sql) {
|
||||
|
||||
foreach ($sql_queries as $sql_query) {
|
||||
// parse sql query
|
||||
list(
|
||||
[
|
||||
$analyzed_sql_results,
|
||||
$db,
|
||||
$table_from_sql
|
||||
) = ParseAnalyze::sqlQuery($sql_query, $db);
|
||||
$table_from_sql,
|
||||
] = ParseAnalyze::sqlQuery($sql_query, $db);
|
||||
// @todo: possibly refactor
|
||||
extract($analyzed_sql_results);
|
||||
|
||||
@ -718,7 +719,7 @@ if ($go_sql) {
|
||||
$cfg['AllowUserDropDatabase'],
|
||||
$dbi->isSuperuser()
|
||||
)) {
|
||||
PhpMyAdmin\Util::mysqlDie(
|
||||
Generator::mysqlDie(
|
||||
__('"DROP DATABASE" statements are disabled.'),
|
||||
'',
|
||||
false,
|
||||
@ -787,7 +788,7 @@ if ($go_sql) {
|
||||
$response->addJSON('message', PhpMyAdmin\Message::success($msg));
|
||||
$response->addJSON(
|
||||
'sql_query',
|
||||
PhpMyAdmin\Util::getMessage($msg, $sql_query, 'success')
|
||||
Generator::getMessage($msg, $sql_query, 'success')
|
||||
);
|
||||
} elseif ($result === false) {
|
||||
$response->setRequestStatus(false);
|
||||
|
||||
@ -11,6 +11,7 @@ use PhpMyAdmin\Controllers\Database\PrivilegesController as DatabaseController;
|
||||
use PhpMyAdmin\Controllers\Table\PrivilegesController as TableController;
|
||||
use PhpMyAdmin\Core;
|
||||
use PhpMyAdmin\DatabaseInterface;
|
||||
use PhpMyAdmin\Html\Generator;
|
||||
use PhpMyAdmin\Message;
|
||||
use PhpMyAdmin\Relation;
|
||||
use PhpMyAdmin\RelationCleanup;
|
||||
@ -169,10 +170,15 @@ $_add_user_error = false;
|
||||
* Get DB information: username, hostname, dbname,
|
||||
* tablename, db_and_table, dbname_is_wildcard
|
||||
*/
|
||||
list(
|
||||
$username, $hostname, $dbname, $tablename, $routinename,
|
||||
$db_and_table, $dbname_is_wildcard
|
||||
) = $serverPrivileges->getDataForDBInfo();
|
||||
[
|
||||
$username,
|
||||
$hostname,
|
||||
$dbname,
|
||||
$tablename,
|
||||
$routinename,
|
||||
$db_and_table,
|
||||
$dbname_is_wildcard,
|
||||
] = $serverPrivileges->getDataForDBInfo();
|
||||
|
||||
/**
|
||||
* Checks if the user is allowed to do what they try to...
|
||||
@ -221,13 +227,13 @@ if (isset($_POST['change_copy']) && $username == $_POST['old_username']
|
||||
/**
|
||||
* Changes / copies a user, part I
|
||||
*/
|
||||
list($queries, $password) = $serverPrivileges->getDataForChangeOrCopyUser();
|
||||
[$queries, $password] = $serverPrivileges->getDataForChangeOrCopyUser();
|
||||
|
||||
/**
|
||||
* Adds a user
|
||||
* (Changes / copies a user, part II)
|
||||
*/
|
||||
list($ret_message, $ret_queries, $queries_for_display, $sql_query, $_add_user_error)
|
||||
[$ret_message, $ret_queries, $queries_for_display, $sql_query, $_add_user_error]
|
||||
= $serverPrivileges->addUser(
|
||||
isset($dbname) ? $dbname : null,
|
||||
isset($username) ? $username : null,
|
||||
@ -267,7 +273,7 @@ if (! empty($routinename)) {
|
||||
if (! empty($_POST['update_privs'])) {
|
||||
if (is_array($dbname)) {
|
||||
foreach ($dbname as $key => $db_name) {
|
||||
list($sql_query[$key], $message) = $serverPrivileges->updatePrivileges(
|
||||
[$sql_query[$key], $message] = $serverPrivileges->updatePrivileges(
|
||||
(isset($username) ? $username : ''),
|
||||
(isset($hostname) ? $hostname : ''),
|
||||
(isset($tablename)
|
||||
@ -280,7 +286,7 @@ if (! empty($_POST['update_privs'])) {
|
||||
|
||||
$sql_query = implode("\n", $sql_query);
|
||||
} else {
|
||||
list($sql_query, $message) = $serverPrivileges->updatePrivileges(
|
||||
[$sql_query, $message] = $serverPrivileges->updatePrivileges(
|
||||
(isset($username) ? $username : ''),
|
||||
(isset($hostname) ? $hostname : ''),
|
||||
(isset($tablename)
|
||||
@ -306,7 +312,7 @@ if (! empty($_POST['changeUserGroup']) && $cfgRelation['menuswork']
|
||||
* Revokes Privileges
|
||||
*/
|
||||
if (isset($_POST['revokeall'])) {
|
||||
list ($message, $sql_query) = $serverPrivileges->getMessageAndSqlQueryForPrivilegesRevoke(
|
||||
[$message, $sql_query] = $serverPrivileges->getMessageAndSqlQueryForPrivilegesRevoke(
|
||||
(isset($dbname) ? $dbname : ''),
|
||||
(isset($tablename)
|
||||
? $tablename
|
||||
@ -337,7 +343,7 @@ if (isset($_POST['delete'])
|
||||
) {
|
||||
$queries = $serverPrivileges->getDataForDeleteUsers($queries);
|
||||
if (empty($_POST['change_copy'])) {
|
||||
list($sql_query, $message) = $serverPrivileges->deleteUser($queries);
|
||||
[$sql_query, $message] = $serverPrivileges->deleteUser($queries);
|
||||
}
|
||||
}
|
||||
|
||||
@ -402,7 +408,7 @@ if (isset($_GET['viewing_mode']) && $_GET['viewing_mode'] == 'db') {
|
||||
$sub_part = '_structure';
|
||||
ob_start();
|
||||
|
||||
list(
|
||||
[
|
||||
$tables,
|
||||
$num_tables,
|
||||
$total_num_tables,
|
||||
@ -411,13 +417,13 @@ if (isset($_GET['viewing_mode']) && $_GET['viewing_mode'] == 'db') {
|
||||
$db_is_system_schema,
|
||||
$tooltip_truename,
|
||||
$tooltip_aliasname,
|
||||
$pos
|
||||
) = PhpMyAdmin\Util::getDbInfo($db, $sub_part === null ? '' : $sub_part);
|
||||
$pos,
|
||||
] = PhpMyAdmin\Util::getDbInfo($db, $sub_part === null ? '' : $sub_part);
|
||||
|
||||
$content = ob_get_clean();
|
||||
$response->addHTML($content . "\n");
|
||||
} elseif (! empty($GLOBALS['message'])) {
|
||||
$response->addHTML(PhpMyAdmin\Util::getMessage($GLOBALS['message']));
|
||||
$response->addHTML(Generator::getMessage($GLOBALS['message']));
|
||||
unset($GLOBALS['message']);
|
||||
}
|
||||
|
||||
@ -435,7 +441,7 @@ $response->addHTML(
|
||||
if (isset($_GET['export'])
|
||||
|| (isset($_POST['submit_mult']) && $_POST['submit_mult'] == 'export')
|
||||
) {
|
||||
list($title, $export) = $serverPrivileges->getListForExportUserDefinition(
|
||||
[$title, $export] = $serverPrivileges->getListForExportUserDefinition(
|
||||
isset($username) ? $username : null,
|
||||
isset($hostname) ? $hostname : null
|
||||
);
|
||||
|
||||
@ -11,6 +11,7 @@ declare(strict_types=1);
|
||||
use PhpMyAdmin\CheckUserPrivileges;
|
||||
use PhpMyAdmin\Config\PageSettings;
|
||||
use PhpMyAdmin\DatabaseInterface;
|
||||
use PhpMyAdmin\Html\Generator;
|
||||
use PhpMyAdmin\ParseAnalyze;
|
||||
use PhpMyAdmin\Response;
|
||||
use PhpMyAdmin\Sql;
|
||||
@ -159,11 +160,11 @@ if (empty($sql_query) && strlen($table) > 0 && strlen($db) > 0) {
|
||||
/**
|
||||
* Parse and analyze the query
|
||||
*/
|
||||
list(
|
||||
[
|
||||
$analyzed_sql_results,
|
||||
$db,
|
||||
$table_from_sql
|
||||
) = ParseAnalyze::sqlQuery($sql_query, $db);
|
||||
$table_from_sql,
|
||||
] = ParseAnalyze::sqlQuery($sql_query, $db);
|
||||
// @todo: possibly refactor
|
||||
extract($analyzed_sql_results);
|
||||
|
||||
@ -184,7 +185,7 @@ if ($sql->hasNoRightsToDropDatabase(
|
||||
$cfg['AllowUserDropDatabase'],
|
||||
$dbi->isSuperuser()
|
||||
)) {
|
||||
Util::mysqlDie(
|
||||
Generator::mysqlDie(
|
||||
__('"DROP DATABASE" statements are disabled.'),
|
||||
'',
|
||||
false,
|
||||
|
||||
@ -9,6 +9,7 @@ declare(strict_types=1);
|
||||
use PhpMyAdmin\Config;
|
||||
use PhpMyAdmin\CreateAddField;
|
||||
use PhpMyAdmin\DatabaseInterface;
|
||||
use PhpMyAdmin\Html\Generator;
|
||||
use PhpMyAdmin\Message;
|
||||
use PhpMyAdmin\Response;
|
||||
use PhpMyAdmin\Transformations;
|
||||
@ -87,7 +88,7 @@ if (isset($_POST['do_save_data'])) {
|
||||
|
||||
$createAddField = new CreateAddField($dbi);
|
||||
|
||||
list($result, $sql_query) = $createAddField->tryColumnCreationQuery($db, $table, $err_url);
|
||||
[$result, $sql_query] = $createAddField->tryColumnCreationQuery($db, $table, $err_url);
|
||||
|
||||
if ($result === true) {
|
||||
// Update comment table for mime types [MIME]
|
||||
@ -120,11 +121,11 @@ if (isset($_POST['do_save_data'])) {
|
||||
$message->addParam($table);
|
||||
$response->addJSON(
|
||||
'message',
|
||||
Util::getMessage($message, $sql_query, 'success')
|
||||
Generator::getMessage($message, $sql_query, 'success')
|
||||
);
|
||||
exit;
|
||||
} else {
|
||||
$error_message_html = Util::mysqlDie(
|
||||
$error_message_html = Generator::mysqlDie(
|
||||
'',
|
||||
'',
|
||||
false,
|
||||
|
||||
@ -8,11 +8,12 @@ declare(strict_types=1);
|
||||
|
||||
use PhpMyAdmin\Config\PageSettings;
|
||||
use PhpMyAdmin\DatabaseInterface;
|
||||
use PhpMyAdmin\Html\Forms\Fields\MaxFileSize;
|
||||
use PhpMyAdmin\Html\Generator;
|
||||
use PhpMyAdmin\InsertEdit;
|
||||
use PhpMyAdmin\Relation;
|
||||
use PhpMyAdmin\Response;
|
||||
use PhpMyAdmin\Url;
|
||||
use PhpMyAdmin\Util;
|
||||
|
||||
if (! defined('PHPMYADMIN')) {
|
||||
exit;
|
||||
@ -44,10 +45,16 @@ $insertEdit = $containerBuilder->get('insert_edit');
|
||||
/**
|
||||
* Determine whether Insert or Edit and set global variables
|
||||
*/
|
||||
list(
|
||||
$insert_mode, $where_clause, $where_clause_array, $where_clauses,
|
||||
$result, $rows, $found_unique_key, $after_insert
|
||||
) = $insertEdit->determineInsertOrEdit(
|
||||
[
|
||||
$insert_mode,
|
||||
$where_clause,
|
||||
$where_clause_array,
|
||||
$where_clauses,
|
||||
$result,
|
||||
$rows,
|
||||
$found_unique_key,
|
||||
$after_insert,
|
||||
] = $insertEdit->determineInsertOrEdit(
|
||||
isset($where_clause) ? $where_clause : null,
|
||||
$db,
|
||||
$table
|
||||
@ -96,7 +103,7 @@ $scripts->addFile('gis_data_editor.js');
|
||||
* $disp_message come from /table/replace
|
||||
*/
|
||||
if (! empty($disp_message)) {
|
||||
$response->addHTML(Util::getMessage($disp_message, null));
|
||||
$response->addHTML(Generator::getMessage($disp_message, null));
|
||||
}
|
||||
|
||||
$table_columns = $insertEdit->getTableColumns($db, $table);
|
||||
@ -166,7 +173,7 @@ $html_output .= $insertEdit->getHtmlForInsertEditFormHeader($has_blob_field, $is
|
||||
|
||||
$html_output .= Url::getHiddenInputs($_form_params);
|
||||
|
||||
$titles['Browse'] = Util::getIcon('b_browse', __('Browse foreign values'));
|
||||
$titles['Browse'] = Generator::getIcon('b_browse', __('Browse foreign values'));
|
||||
|
||||
// user can toggle the display of Function column and column types
|
||||
// (currently does not work for multi-edits)
|
||||
@ -251,7 +258,7 @@ $html_output .= $insertEdit->getActionsPanel(
|
||||
|
||||
if ($biggest_max_file_size > 0) {
|
||||
$html_output .= ' '
|
||||
. Util::generateHiddenMaxFileSize(
|
||||
. MaxFileSize::generate(
|
||||
$biggest_max_file_size
|
||||
) . "\n";
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user