From 50e7a65e6efaa822a9ce1d0b1d3735584d5ef6c8 Mon Sep 17 00:00:00 2001 From: Jakub Vrana Date: Wed, 5 Mar 2025 11:40:56 +0100 Subject: [PATCH] Use namespaces in plugins --- editor/example.php | 2 +- plugins/adminer.js.php | 2 +- plugins/designs.php | 10 +++++----- plugins/dump-alter.php | 24 ++++++++++++------------ plugins/dump-date.php | 4 ++-- plugins/dump-json.php | 6 +++--- plugins/dump-php.php | 2 +- plugins/dump-xml.php | 8 ++++---- plugins/edit-calendar.php | 16 ++++++++-------- plugins/edit-foreign.php | 6 +++--- plugins/edit-textarea.php | 2 +- plugins/email-table.php | 18 +++++++++--------- plugins/enum-option.php | 6 +++--- plugins/enum-types.php | 8 ++++---- plugins/file-upload.php | 2 +- plugins/json-column.php | 4 ++-- plugins/login-otp.php | 6 +++--- plugins/login-password-less.php | 2 +- plugins/login-servers.php | 4 ++-- plugins/login-table.php | 4 ++-- plugins/master-slave.php | 8 ++++---- plugins/plugin.php | 2 +- plugins/slugify.php | 4 ++-- plugins/sql-log.php | 2 +- plugins/struct-comments.php | 2 +- plugins/table-indexes-structure.php | 6 +++--- plugins/table-structure.php | 16 ++++++++-------- plugins/tables-filter.php | 4 ++-- plugins/tinymce.php | 12 ++++++------ plugins/translation.php | 8 ++++---- plugins/version-noverify.php | 2 +- plugins/wymeditor.php | 8 ++++---- 32 files changed, 105 insertions(+), 105 deletions(-) diff --git a/editor/example.php b/editor/example.php index 9874536d..ce752ff6 100644 --- a/editor/example.php +++ b/editor/example.php @@ -1,7 +1,7 @@ "; - echo html_select("design", array("" => "(design)") + $this->designs, $_SESSION["design"], "this.form.submit();"); - echo ''; + echo Adminer\html_select("design", array("" => "(design)") + $this->designs, $_SESSION["design"], "this.form.submit();"); + echo ''; echo "\n"; } diff --git a/plugins/dump-alter.php b/plugins/dump-alter.php index 65ecead6..3ebdf8ba 100644 --- a/plugins/dump-alter.php +++ b/plugins/dump-alter.php @@ -29,10 +29,10 @@ CREATE PROCEDURE adminer_alter (INOUT alter_command text) BEGIN FETCH tables INTO _table_name, _engine, _table_collation, _table_comment; IF NOT done THEN CASE _table_name"; - foreach (get_rows($query) as $row) { - $comment = q($row["ENGINE"] == "InnoDB" ? preg_replace('~(?:(.+); )?InnoDB free: .*~', '\1', $row["TABLE_COMMENT"]) : $row["TABLE_COMMENT"]); + foreach (Adminer\get_rows($query) as $row) { + $comment = Adminer\q($row["ENGINE"] == "InnoDB" ? preg_replace('~(?:(.+); )?InnoDB free: .*~', '\1', $row["TABLE_COMMENT"]) : $row["TABLE_COMMENT"]); echo " - WHEN " . q($row["TABLE_NAME"]) . " THEN + WHEN " . Adminer\q($row["TABLE_NAME"]) . " THEN " . (isset($row["ENGINE"]) ? "IF _engine != '$row[ENGINE]' OR _table_collation != '$row[TABLE_COLLATION]' OR _table_comment != $comment THEN ALTER TABLE " . idf_escape($row["TABLE_NAME"]) . " ENGINE=$row[ENGINE] COLLATE=$row[TABLE_COLLATION] COMMENT=$comment; END IF" : "BEGIN END") . ";"; @@ -75,7 +75,7 @@ SELECT @adminer_alter; } else { echo substr_replace($create, " IF NOT EXISTS", 12, 0) . ";\n\n"; // create procedure which iterates over original columns and adds new and removes old - $query = "SELECT COLUMN_NAME, COLUMN_DEFAULT, IS_NULLABLE, COLLATION_NAME, COLUMN_TYPE, EXTRA, COLUMN_COMMENT FROM information_schema.COLUMNS WHERE TABLE_SCHEMA = DATABASE() AND TABLE_NAME = " . q($table) . " ORDER BY ORDINAL_POSITION"; + $query = "SELECT COLUMN_NAME, COLUMN_DEFAULT, IS_NULLABLE, COLLATION_NAME, COLUMN_TYPE, EXTRA, COLUMN_COMMENT FROM information_schema.COLUMNS WHERE TABLE_SCHEMA = DATABASE() AND TABLE_NAME = " . Adminer\q($table) . " ORDER BY ORDINAL_POSITION"; echo "DELIMITER ;; CREATE PROCEDURE adminer_alter (INOUT alter_command text) BEGIN DECLARE _column_name, _collation_name, after varchar(64) DEFAULT ''; @@ -87,17 +87,17 @@ CREATE PROCEDURE adminer_alter (INOUT alter_command text) BEGIN DECLARE add_columns text DEFAULT '"; $fields = array(); $after = ""; - foreach (get_rows($query) as $row) { + foreach (Adminer\get_rows($query) as $row) { $default = $row["COLUMN_DEFAULT"]; - $row["default"] = ($default !== null ? q($default) : "NULL"); - $row["after"] = q($after); //! rgt AFTER lft, lft AFTER id doesn't work - $row["alter"] = escape_string(idf_escape($row["COLUMN_NAME"]) + $row["default"] = ($default !== null ? Adminer\q($default) : "NULL"); + $row["after"] = Adminer\q($after); //! rgt AFTER lft, lft AFTER id doesn't work + $row["alter"] = Adminer\escape_string(idf_escape($row["COLUMN_NAME"]) . " $row[COLUMN_TYPE]" . ($row["COLLATION_NAME"] ? " COLLATE $row[COLLATION_NAME]" : "") . ($default !== null ? " DEFAULT " . ($default == "CURRENT_TIMESTAMP" ? $default : $row["default"]) : "") . ($row["IS_NULLABLE"] == "YES" ? "" : " NOT NULL") . ($row["EXTRA"] ? " $row[EXTRA]" : "") - . ($row["COLUMN_COMMENT"] ? " COMMENT " . q($row["COLUMN_COMMENT"]) : "") + . ($row["COLUMN_COMMENT"] ? " COMMENT " . Adminer\q($row["COLUMN_COMMENT"]) : "") . ($after ? " AFTER " . idf_escape($after) : " FIRST") ); echo ", ADD $row[alter]"; @@ -116,14 +116,14 @@ CREATE PROCEDURE adminer_alter (INOUT alter_command text) BEGIN CASE _column_name"; foreach ($fields as $row) { echo " - WHEN " . q($row["COLUMN_NAME"]) . " THEN + WHEN " . Adminer\q($row["COLUMN_NAME"]) . " THEN SET add_columns = REPLACE(add_columns, ', ADD $row[alter]', IF( _column_default <=> $row[default] AND _is_nullable = '$row[IS_NULLABLE]' AND _collation_name <=> " . (isset($row["COLLATION_NAME"]) ? "'$row[COLLATION_NAME]'" : "NULL") . " - AND _column_type = " . q($row["COLUMN_TYPE"]) . " + AND _column_type = " . Adminer\q($row["COLUMN_TYPE"]) . " AND _extra = '$row[EXTRA]' - AND _column_comment = " . q($row["COLUMN_COMMENT"]) . " + AND _column_comment = " . Adminer\q($row["COLUMN_COMMENT"]) . " AND after = $row[after] , '', ', MODIFY $row[alter]'));"; //! don't replace in comment } diff --git a/plugins/dump-date.php b/plugins/dump-date.php index a5cf3afb..4c540af1 100644 --- a/plugins/dump-date.php +++ b/plugins/dump-date.php @@ -9,8 +9,8 @@ class AdminerDumpDate { function dumpFilename($identifier) { - $connection = connection(); - return friendly_url(($identifier != "" ? $identifier : (SERVER != "" ? SERVER : "localhost")) . "-" . $connection->result("SELECT NOW()")); + $connection = Adminer\connection(); + return Adminer\friendly_url(($identifier != "" ? $identifier : (SERVER != "" ? SERVER : "localhost")) . "-" . $connection->result("SELECT NOW()")); } } diff --git a/plugins/dump-json.php b/plugins/dump-json.php index 35316a6f..127a1c2e 100644 --- a/plugins/dump-json.php +++ b/plugins/dump-json.php @@ -33,7 +33,7 @@ class AdminerDumpJson { echo "{\n"; register_shutdown_function(array($this, '_database')); } - $connection = connection(); + $connection = Adminer\connection(); $result = $connection->query($query, 1); if ($result) { echo '"' . addcslashes($table, "\r\n\"\\") . "\": [\n"; @@ -42,9 +42,9 @@ class AdminerDumpJson { echo ($first ? "" : ", "); $first = false; foreach ($row as $key => $val) { - json_row($key, $val); + Adminer\json_row($key, $val); } - json_row(""); + Adminer\json_row(""); } echo "]"; } diff --git a/plugins/dump-php.php b/plugins/dump-php.php index 1c13fabf..e0ef30fa 100644 --- a/plugins/dump-php.php +++ b/plugins/dump-php.php @@ -33,7 +33,7 @@ class AdminerDumpPhp { function dumpData($table, $style, $query) { if ($_POST['format'] == 'php') { - $connection = connection(); + $connection = Adminer\connection(); $result = $connection->query($query, 1); if ($result) { while ($row = $result->fetch_assoc()) { diff --git a/plugins/dump-xml.php b/plugins/dump-xml.php index cd07a3ac..da2d6939 100644 --- a/plugins/dump-xml.php +++ b/plugins/dump-xml.php @@ -28,16 +28,16 @@ class AdminerDumpXml { if ($_POST["format"] == "xml") { if (!$this->database) { $this->database = true; - echo "\n"; + echo "\n"; register_shutdown_function(array($this, '_database')); } - $connection = connection(); + $connection = Adminer\connection(); $result = $connection->query($query, 1); if ($result) { while ($row = $result->fetch_assoc()) { - echo "\t\n"; + echo "\t
\n"; foreach ($row as $key => $val) { - echo "\t\t" . h($val) . "\n"; + echo "\t\t" . Adminer\h($val) . "\n"; } echo "\t
\n"; } diff --git a/plugins/edit-calendar.php b/plugins/edit-calendar.php index 1e757412..78901438 100644 --- a/plugins/edit-calendar.php +++ b/plugins/edit-calendar.php @@ -19,9 +19,9 @@ class AdminerEditCalendar { function __construct($prepend = null, $langPath = "jquery-ui/i18n/jquery.ui.datepicker-%s.js") { if ($prepend === null) { $prepend = "\n" - . script_src("jquery-ui/jquery.js") - . script_src("jquery-ui/jquery-ui.js") - . script_src("jquery-ui/jquery-ui-timepicker-addon.js") + . Adminer\script_src("jquery-ui/jquery.js") + . Adminer\script_src("jquery-ui/jquery-ui.js") + . Adminer\script_src("jquery-ui/jquery-ui-timepicker-addon.js") ; } $this->prepend = $prepend; @@ -31,11 +31,11 @@ class AdminerEditCalendar { function head() { echo $this->prepend; if ($this->langPath) { - $lang = get_lang(); + $lang = Adminer\get_lang(); $lang = ($lang == "zh" ? "zh-CN" : ($lang == "zh-tw" ? "zh-TW" : $lang)); if ($lang != "en" && file_exists(sprintf($this->langPath, $lang))) { - echo script_src(sprintf($this->langPath, $lang)); - echo script("jQuery(function () { jQuery.timepicker.setDefaults(jQuery.datepicker.regional['$lang']); });"); + echo Adminer\script_src(sprintf($this->langPath, $lang)); + echo Adminer\script("jQuery(function () { jQuery.timepicker.setDefaults(jQuery.datepicker.regional['$lang']); });"); } } } @@ -44,8 +44,8 @@ class AdminerEditCalendar { if (preg_match("~date|time~", $field["type"])) { $dateFormat = "changeYear: true, dateFormat: 'yy-mm-dd'"; //! yy-mm-dd regional $timeFormat = "showSecond: true, timeFormat: 'HH:mm:ss', timeInput: true"; - return "" . script( - "jQuery('#fields-" . js_escape($field["field"]) . "')." + return "" . Adminer\script( + "jQuery('#fields-" . Adminer\js_escape($field["field"]) . "')." . ($field["type"] == "time" ? "timepicker({ $timeFormat })" : (preg_match("~time~", $field["type"]) ? "datetimepicker({ $dateFormat, $timeFormat })" : "datepicker({ $dateFormat })" diff --git a/plugins/edit-foreign.php b/plugins/edit-foreign.php index 365cb7be..90655bac 100644 --- a/plugins/edit-foreign.php +++ b/plugins/edit-foreign.php @@ -18,7 +18,7 @@ class AdminerEditForeign { static $values = array(); $foreignKeys = &$foreignTables[$table]; if ($foreignKeys === null) { - $foreignKeys = column_foreign_keys($table); + $foreignKeys = Adminer\column_foreign_keys($table); } foreach ((array) $foreignKeys[$field["field"]] as $foreignKey) { if (count($foreignKey["source"]) == 1) { @@ -30,12 +30,12 @@ class AdminerEditForeign { if (preg_match('~binary~', $field["type"])) { $column = "HEX($column)"; } - $options = array("" => "") + get_vals("SELECT $column FROM " . table($target) . " ORDER BY 1" . ($this->_limit ? " LIMIT " . ($this->_limit + 1) : "")); + $options = array("" => "") + Adminer\get_vals("SELECT $column FROM " . table($target) . " ORDER BY 1" . ($this->_limit ? " LIMIT " . ($this->_limit + 1) : "")); if ($this->_limit && count($options) - 1 > $this->_limit) { return; } } - return "" . optionlist($options, $value) . ""; + return "" . Adminer\optionlist($options, $value) . ""; } } } diff --git a/plugins/edit-textarea.php b/plugins/edit-textarea.php index 5dbe31e6..45aa11f9 100644 --- a/plugins/edit-textarea.php +++ b/plugins/edit-textarea.php @@ -10,7 +10,7 @@ class AdminerEditTextarea { function editInput($table, $field, $attrs, $value) { if (preg_match('~char~', $field["type"])) { - return "'; + return "'; } } diff --git a/plugins/email-table.php b/plugins/email-table.php index 1f145957..f6f25906 100644 --- a/plugins/email-table.php +++ b/plugins/email-table.php @@ -27,20 +27,20 @@ class AdminerEmailTable { function selectEmailPrint($emailFields, $columns) { if ($emailFields) { - print_fieldset("email", ('E-mail')); + Adminer\print_fieldset("email", ('E-mail')); echo "
\n"; - echo script("qsl('div').onkeydown = partial(bodyKeydown, 'email');"); - echo "

" . ('From') . ": \n"; - echo ('Subject') . ": \n"; + echo Adminer\script("qsl('div').onkeydown = partial(bodyKeydown, 'email');"); + echo "

" . ('From') . ": \n"; + echo ('Subject') . ": \n"; echo "

" . ('Attachments') . ": "; - echo script("qsl('input').onchange = function () { + echo Adminer\script("qsl('input').onchange = function () { this.onchange = function () { }; var el = this.cloneNode(true); el.value = ''; this.parentNode.appendChild(el); };"); - echo "

" . (count($emailFields) == 1 ? '' : html_select("email_field", $emailFields)); - echo "" . confirm(); + echo "

" . (count($emailFields) == 1 ? '' : Adminer\html_select("email_field", $emailFields)); + echo "" . Adminer\confirm(); echo "

\n"; echo "\n"; return true; @@ -48,9 +48,9 @@ class AdminerEmailTable { } function selectEmailProcess($where, $foreignKeys) { - $connection = connection(); + $connection = Adminer\connection(); if ($_POST["email_id"]) { - $result = $connection->query("SELECT $this->subject, $this->message FROM $this->table WHERE $this->id = " . q($_POST["email_id"])); + $result = $connection->query("SELECT $this->subject, $this->message FROM $this->table WHERE $this->id = " . Adminer\q($_POST["email_id"])); $row = $result->fetch_row(); $_POST["email_subject"] = $row[0]; $_POST["email_message"] = $row[1]; diff --git a/plugins/enum-option.php b/plugins/enum-option.php index bcede826..65917ff1 100644 --- a/plugins/enum-option.php +++ b/plugins/enum-option.php @@ -13,7 +13,7 @@ class AdminerEnumOption { $options = array(); $selected = $value; if (isset($_GET["select"])) { - $options[-1] = lang('original'); + $options[-1] = Adminer\lang('original'); if ($selected === null) { $selected = -1; } @@ -24,7 +24,7 @@ class AdminerEnumOption { $selected = ""; } } - $options[0] = lang('empty'); + $options[0] = Adminer\lang('empty'); preg_match_all("~'((?:[^']|'')*)'~", $field["length"], $matches); foreach ($matches[1] as $i => $val) { $val = stripcslashes(str_replace("''", "'", $val)); @@ -33,7 +33,7 @@ class AdminerEnumOption { $selected = $i + 1; } } - return "" . optionlist($options, (string) $selected, 1) . ""; // 1 - use keys + return "" . Adminer\optionlist($options, (string) $selected, 1) . ""; // 1 - use keys } } diff --git a/plugins/enum-types.php b/plugins/enum-types.php index 15a8fc24..0a72ef8d 100644 --- a/plugins/enum-types.php +++ b/plugins/enum-types.php @@ -11,7 +11,7 @@ class AdminerEnumTypes { function editInput($table, $field, $attrs, $value) { // PostgreSQL only - if (!in_array(strtolower(connection()->extension), array('pgsql', 'pdo_pgsql'))) { + if (!in_array(strtolower(Adminer\connection()->extension), array('pgsql', 'pdo_pgsql'))) { return; } @@ -21,7 +21,7 @@ class AdminerEnumTypes { $this->_types = array(); foreach ($types as $type) { - $values = get_vals("SELECT unnest(enum_range(NULL::$type))::text AS value"); + $values = Adminer\get_vals("SELECT unnest(enum_range(NULL::$type))::text AS value"); if (!empty($values) && is_array($values)) { $this->_types[$type] = $values; } @@ -40,10 +40,10 @@ class AdminerEnumTypes { } } if (isset($_GET["select"])) { - $options = array("" => array(-1 => lang('original'))) + $options; + $options = array("" => array(-1 => Adminer\lang('original'))) + $options; } - return "" . optionlist($options, (string) $selected, 1) . ""; + return "" . Adminer\optionlist($options, (string) $selected, 1) . ""; } } diff --git a/plugins/file-upload.php b/plugins/file-upload.php index 6c40f624..e1a2b17b 100644 --- a/plugins/file-upload.php +++ b/plugins/file-upload.php @@ -40,7 +40,7 @@ class AdminerFileUpload { if (!move_uploaded_file($_FILES[$name]["tmp_name"], "$this->uploadPath$table/$regs[1]-$filename")) { return false; } - return q($filename); + return Adminer\q($filename); } } diff --git a/plugins/json-column.php b/plugins/json-column.php index d0af98bb..4d145fcb 100644 --- a/plugins/json-column.php +++ b/plugins/json-column.php @@ -19,7 +19,7 @@ class AdminerJsonColumn { echo ''; foreach ($json as $key => $val) { echo ''; - echo ''; + echo ''; echo '
' . h($key) . '' . Adminer\h($key) . ''; if (is_scalar($val) || $val === null) { if (is_bool($val)) { @@ -27,7 +27,7 @@ class AdminerJsonColumn { } elseif ($val === null) { $val = 'null'; } elseif (!is_numeric($val)) { - $val = '"' . h(addcslashes($val, "\r\n\"")) . '"'; + $val = '"' . Adminer\h(addcslashes($val, "\r\n\"")) . '"'; } echo '' . $val . ''; } else { diff --git a/plugins/login-otp.php b/plugins/login-otp.php index 7000df9e..b25ea1d9 100644 --- a/plugins/login-otp.php +++ b/plugins/login-otp.php @@ -24,7 +24,7 @@ class AdminerLoginOtp { if ($name == 'password') { return $heading . $value . "\n" . "
OTP" - . "\n" + . "\n" ; } } @@ -34,9 +34,9 @@ class AdminerLoginOtp { $timeSlot = floor(time() / 30); foreach (array(0, -1, 1) as $skew) { if ($_SESSION["otp"] == $this->getOtp($timeSlot + $skew)) { - restart_session(); + Adminer\restart_session(); unset($_SESSION["otp"]); - stop_session(); + Adminer\stop_session(); return; } } diff --git a/plugins/login-password-less.php b/plugins/login-password-less.php index f501b3e9..ee67d9e1 100644 --- a/plugins/login-password-less.php +++ b/plugins/login-password-less.php @@ -18,7 +18,7 @@ class AdminerLoginPasswordLess { } function credentials() { - $password = get_password(); + $password = Adminer\get_password(); return array(SERVER, $_GET["username"], (password_verify($password, $this->password_hash) ? "" : $password)); } diff --git a/plugins/login-servers.php b/plugins/login-servers.php index d8ee2ca0..d2650a46 100644 --- a/plugins/login-servers.php +++ b/plugins/login-servers.php @@ -22,7 +22,7 @@ class AdminerLoginServers { } function credentials() { - return array($this->servers[SERVER]["server"], $_GET["username"], get_password()); + return array($this->servers[SERVER]["server"], $_GET["username"], Adminer\get_password()); } function login($login, $password) { @@ -35,7 +35,7 @@ class AdminerLoginServers { if ($name == 'driver') { return ''; } elseif ($name == 'server') { - return $heading . "\n"; + return $heading . "\n"; } } diff --git a/plugins/login-table.php b/plugins/login-table.php index efc6e358..e46f7144 100644 --- a/plugins/login-table.php +++ b/plugins/login-table.php @@ -27,8 +27,8 @@ class AdminerLoginTable { } function login($login, $password) { - $connection = connection(); - return (bool) $connection->result("SELECT COUNT(*) FROM " . idf_escape($this->database) . ".login WHERE login = " . q($login) . " AND password_sha1 = " . q(sha1($password))); + $connection = Adminer\connection(); + return (bool) $connection->result("SELECT COUNT(*) FROM " . idf_escape($this->database) . ".login WHERE login = " . Adminer\q($login) . " AND password_sha1 = " . Adminer\q(sha1($password))); } } diff --git a/plugins/master-slave.php b/plugins/master-slave.php index e76bb047..90524da8 100644 --- a/plugins/master-slave.php +++ b/plugins/master-slave.php @@ -24,18 +24,18 @@ class AdminerMasterSlave { function login($login, $password) { if (!$_POST && ($master = &$_SESSION["master"])) { - $connection = connection(); - $connection->query("DO MASTER_POS_WAIT('" . q($master['File']) . "', $master[Position])"); + $connection = Adminer\connection(); + $connection->query("DO MASTER_POS_WAIT('" . Adminer\q($master['File']) . "', $master[Position])"); $master = null; } } function messageQuery($query, $time, $failed = false) { //! doesn't work with sql.inc.php - $connection = connection(); + $connection = Adminer\connection(); $result = $connection->query('SHOW MASTER STATUS'); if ($result) { - restart_session(); + Adminer\restart_session(); $_SESSION["master"] = $result->fetch_assoc(); } } diff --git a/plugins/plugin.php b/plugins/plugin.php index 03f6b5fd..8f71a030 100644 --- a/plugins/plugin.php +++ b/plugins/plugin.php @@ -6,7 +6,7 @@ * @license https://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0 * @license https://www.gnu.org/licenses/gpl-2.0.html GNU General Public License, version 2 (one or other) */ -class AdminerPlugin extends Adminer { +class AdminerPlugin extends Adminer\Adminer { /** @access protected */ var $plugins; diff --git a/plugins/slugify.php b/plugins/slugify.php index 094d4d1e..13ad7a8c 100644 --- a/plugins/slugify.php +++ b/plugins/slugify.php @@ -34,8 +34,8 @@ class AdminerSlugify { } $slug = $slugify[$field["field"]]; if ($slug !== null) { - return "" - . script("qsl('input').onchange = function () { + return "" + . Adminer\script("qsl('input').onchange = function () { var find = '$this->from'; var repl = '$this->to'; this.form['fields[$slug]'].value = this.value.toLowerCase() diff --git a/plugins/sql-log.php b/plugins/sql-log.php index d4891d81..1babed22 100644 --- a/plugins/sql-log.php +++ b/plugins/sql-log.php @@ -27,7 +27,7 @@ class AdminerSqlLog { function _log($query) { if ($this->filename == "") { - $adminer = adminer(); + $adminer = Adminer\adminer(); $this->filename = $adminer->database() . ".sql"; // no database goes to ".sql" to avoid collisions } $fp = fopen($this->filename, "a"); diff --git a/plugins/struct-comments.php b/plugins/struct-comments.php index 05380ca8..80c216df 100644 --- a/plugins/struct-comments.php +++ b/plugins/struct-comments.php @@ -9,6 +9,6 @@ class AdminerStructComments { function fieldName(&$field, $order = 0) { - return '' . h($field["field"]) . ''; + return '' . Adminer\h($field["field"]) . ''; } } diff --git a/plugins/table-indexes-structure.php b/plugins/table-indexes-structure.php index e0d2b714..e00e0404 100644 --- a/plugins/table-indexes-structure.php +++ b/plugins/table-indexes-structure.php @@ -14,13 +14,13 @@ class AdminerTableIndexesStructure { */ function tableIndexesPrint($indexes) { echo "\n"; - echo "\n"; + echo "\n"; foreach ($indexes as $name => $index) { - echo "
" . lang('Name') . "" . lang('Type') . "" . lang('Columns') . "
" . Adminer\lang('Name') . "" . Adminer\lang('Type') . "" . Adminer\lang('Columns') . "
" . h($name) . "" . $index['type']; + echo "
" . Adminer\h($name) . "" . $index['type']; ksort($index["columns"]); // enforce correct columns order $print = array(); foreach ($index["columns"] as $key => $val) { - $print[] = "" . h($val) . "" + $print[] = "" . Adminer\h($val) . "" . ($index["lengths"][$key] ? "(" . $index["lengths"][$key] . ")" : "") . ($index["descs"][$key] ? " DESC" : "") ; diff --git a/plugins/table-structure.php b/plugins/table-structure.php index 1db0b0d6..e75c3eb0 100644 --- a/plugins/table-structure.php +++ b/plugins/table-structure.php @@ -15,15 +15,15 @@ class AdminerTableStructure { function tableStructurePrint($fields) { echo "
\n"; echo "\n"; - echo "\n"; + echo "\n"; foreach ($fields as $field) { - echo "
" . lang('Column') . "" . lang('Type') . "" . lang('Collation') . "" . lang('Nullable') . "" . lang('Default') . (support("comment") ? "" . lang('Comment') : "") . "
" . Adminer\lang('Column') . "" . Adminer\lang('Type') . "" . Adminer\lang('Collation') . "" . Adminer\lang('Nullable') . "" . Adminer\lang('Default') . (support("comment") ? "" . Adminer\lang('Comment') : "") . "
" . h($field["field"]) . ($field["primary"] ? " (PRIMARY)" : ""); - echo "" . h($field["full_type"]) . ""; - echo ($field["auto_increment"] ? " " . lang('Auto Increment') . "" : ""); - echo "" . ($field["collation"] ? " " . h($field["collation"]) . "" : ""); - echo "" . ($field["null"] ? lang('Yes') : lang('No')); - echo "" . h($field["default"]); - echo (support("comment") ? "" . h($field["comment"]) : ""); + echo "
" . Adminer\h($field["field"]) . ($field["primary"] ? " (PRIMARY)" : ""); + echo "" . Adminer\h($field["full_type"]) . ""; + echo ($field["auto_increment"] ? " " . Adminer\lang('Auto Increment') . "" : ""); + echo "" . ($field["collation"] ? " " . Adminer\h($field["collation"]) . "" : ""); + echo "" . ($field["null"] ? Adminer\lang('Yes') : Adminer\lang('No')); + echo "" . Adminer\h($field["default"]); + echo (support("comment") ? "" . Adminer\h($field["comment"]) : ""); echo "\n"; } echo "
\n"; diff --git a/plugins/tables-filter.php b/plugins/tables-filter.php index 879a3924..5d353799 100644 --- a/plugins/tables-filter.php +++ b/plugins/tables-filter.php @@ -9,7 +9,7 @@ class AdminerTablesFilter { function tablesPrint($tables) { ?> -> +> var tablesFilterTimeout = null; var tablesFilterValue = ''; @@ -64,7 +64,7 @@ sessionStorage && document.addEventListener('DOMContentLoaded', function () { sessionStorage.setItem('adminer_tables_filter_db', db); }); -

+

path) . "/langs/$lang.js")) { $lang = "en"; } - echo script_src($this->path); + echo Adminer\script_src($this->path); ?> -> +> tinyMCE.init({ entity_encoding: 'raw', language: '' @@ -59,9 +59,9 @@ tinyMCE.init({ function editInput($table, $field, $attrs, $value) { if (preg_match("~text~", $field["type"]) && preg_match("~_html~", $field["field"])) { - return "" . h($value) . "" . script(" -tinyMCE.remove(tinyMCE.get('fields-" . js_escape($field["field"]) . "') || { }); -tinyMCE.EditorManager.execCommand('mceAddControl', true, 'fields-" . js_escape($field["field"]) . "'); + return "" . Adminer\h($value) . "" . Adminer\script(" +tinyMCE.remove(tinyMCE.get('fields-" . Adminer\js_escape($field["field"]) . "') || { }); +tinyMCE.EditorManager.execCommand('mceAddControl', true, 'fields-" . Adminer\js_escape($field["field"]) . "'); qs('#form').onsubmit = function () { tinyMCE.each(tinyMCE.editors, function (ed) { ed.remove(); diff --git a/plugins/translation.php b/plugins/translation.php index e4824342..b25f9e26 100644 --- a/plugins/translation.php +++ b/plugins/translation.php @@ -21,19 +21,19 @@ class AdminerTranslation { function _translate($idf) { static $translations, $lang; if ($lang === null) { - $lang = get_lang(); + $lang = Adminer\get_lang(); } if ($idf == "" || $lang == "en") { return $idf; } if ($translations === null) { - $translations = get_key_vals("SELECT idf, translation FROM translation WHERE language_id = " . q($lang)); + $translations = Adminer\get_key_vals("SELECT idf, translation FROM translation WHERE language_id = " . Adminer\q($lang)); } $return = &$translations[$idf]; if ($return === null) { $return = $idf; - $connection = connection(); - $connection->query("INSERT INTO translation (language_id, idf, translation) VALUES (" . q($lang) . ", " . q($idf) . ", " . q($idf) . ")"); + $connection = Adminer\connection(); + $connection->query("INSERT INTO translation (language_id, idf, translation) VALUES (" . Adminer\q($lang) . ", " . Adminer\q($idf) . ", " . Adminer\q($idf) . ")"); } return $return; } diff --git a/plugins/version-noverify.php b/plugins/version-noverify.php index cbf79d8e..154ec6db 100644 --- a/plugins/version-noverify.php +++ b/plugins/version-noverify.php @@ -9,7 +9,7 @@ class AdminerVersionNoverify { function head() { - echo script("verifyVersion = function () {};"); + echo Adminer\script("verifyVersion = function () {};"); } } diff --git a/plugins/wymeditor.php b/plugins/wymeditor.php index b8c82af7..5a3b3d3a 100644 --- a/plugins/wymeditor.php +++ b/plugins/wymeditor.php @@ -22,7 +22,7 @@ class AdminerWymeditor { function head() { foreach ($this->scripts as $script) { - echo script_src($script); + echo Adminer\script_src($script); } } @@ -52,10 +52,10 @@ class AdminerWymeditor { function editInput($table, $field, $attrs, $value) { static $lang = ""; if (!$lang && preg_match("~text~", $field["type"]) && preg_match("~_html~", $field["field"])) { - $lang = get_lang(); + $lang = Adminer\get_lang(); $lang = ($lang == "zh" || $lang == "zh-tw" ? "zh_cn" : $lang); - return "" . h($value) . "" . script(" -jQuery('#fields-" . js_escape($field["field"]) . "').wymeditor({ updateSelector: '#form [type=\"submit\"]', lang: '$lang'" . ($this->options ? ", $this->options" : "") . " }); + return "" . Adminer\h($value) . "" . Adminer\script(" +jQuery('#fields-" . Adminer\js_escape($field["field"]) . "').wymeditor({ updateSelector: '#form [type=\"submit\"]', lang: '$lang'" . ($this->options ? ", $this->options" : "") . " }); "); } } -- 2.39.5