<?php
function adminer_object() {
- class AdminerCds extends Adminer {
+ class AdminerCds extends Adminer\Adminer {
function name() {
// custom name in title and heading
function head() {
if (file_exists(self::FILENAME)) {
- echo script_src(self::FILENAME . "?v=" . crc32(file_get_contents(self::FILENAME))), "\n";
+ echo Adminer\script_src(self::FILENAME . "?v=" . crc32(file_get_contents(self::FILENAME))), "\n";
}
}
}
}
function headers() {
- if (isset($_POST["design"]) && verify_token()) {
- restart_session();
+ if (isset($_POST["design"]) && Adminer\verify_token()) {
+ Adminer\restart_session();
$_SESSION["design"] = $_POST["design"];
- redirect($_SERVER["REQUEST_URI"]);
+ Adminer\redirect($_SERVER["REQUEST_URI"]);
}
}
function navigation($missing) {
echo "<form action='' method='post' style='position: fixed; bottom: .5em; right: .5em;'>";
- echo html_select("design", array("" => "(design)") + $this->designs, $_SESSION["design"], "this.form.submit();");
- echo '<input type="hidden" name="token" value="' . get_token() . '">';
+ echo Adminer\html_select("design", array("" => "(design)") + $this->designs, $_SESSION["design"], "this.form.submit();");
+ echo '<input type="hidden" name="token" value="' . Adminer\get_token() . '">';
echo "</form>\n";
}
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") . ";";
} 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 '';
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]";
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
}
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()"));
}
}
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";
echo ($first ? "" : ", ");
$first = false;
foreach ($row as $key => $val) {
- json_row($key, $val);
+ Adminer\json_row($key, $val);
}
- json_row("");
+ Adminer\json_row("");
}
echo "]";
}
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()) {
if ($_POST["format"] == "xml") {
if (!$this->database) {
$this->database = true;
- echo "<database name='" . h(DB) . "'>\n";
+ echo "<database name='" . Adminer\h(DB) . "'>\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<table name='" . h($table) . "'>\n";
+ echo "\t<table name='" . Adminer\h($table) . "'>\n";
foreach ($row as $key => $val) {
- echo "\t\t<column name='" . h($key) . "'" . (isset($val) ? "" : " null='null'") . ">" . h($val) . "</column>\n";
+ echo "\t\t<column name='" . Adminer\h($key) . "'" . (isset($val) ? "" : " null='null'") . ">" . Adminer\h($val) . "</column>\n";
}
echo "\t</table>\n";
}
function __construct($prepend = null, $langPath = "jquery-ui/i18n/jquery.ui.datepicker-%s.js") {
if ($prepend === null) {
$prepend = "<link rel='stylesheet' type='text/css' href='jquery-ui/jquery-ui.css'>\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;
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']); });");
}
}
}
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 "<input id='fields-" . h($field["field"]) . "' value='" . h($value) . "'" . (@+$field["length"] ? " data-maxlength='" . (+$field["length"]) . "'" : "") . "$attrs>" . script(
- "jQuery('#fields-" . js_escape($field["field"]) . "')."
+ return "<input id='fields-" . Adminer\h($field["field"]) . "' value='" . Adminer\h($value) . "'" . (@+$field["length"] ? " data-maxlength='" . (+$field["length"]) . "'" : "") . "$attrs>" . Adminer\script(
+ "jQuery('#fields-" . Adminer\js_escape($field["field"]) . "')."
. ($field["type"] == "time" ? "timepicker({ $timeFormat })"
: (preg_match("~time~", $field["type"]) ? "datetimepicker({ $dateFormat, $timeFormat })"
: "datepicker({ $dateFormat })"
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) {
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 "<select$attrs>" . optionlist($options, $value) . "</select>";
+ return "<select$attrs>" . Adminer\optionlist($options, $value) . "</select>";
}
}
}
function editInput($table, $field, $attrs, $value) {
if (preg_match('~char~', $field["type"])) {
- return "<textarea cols='30' rows='1' style='height: 1.2em;'$attrs>" . h($value) . '</textarea>';
+ return "<textarea cols='30' rows='1' style='height: 1.2em;'$attrs>" . Adminer\h($value) . '</textarea>';
}
}
function selectEmailPrint($emailFields, $columns) {
if ($emailFields) {
- print_fieldset("email", ('E-mail'));
+ Adminer\print_fieldset("email", ('E-mail'));
echo "<div>\n";
- echo script("qsl('div').onkeydown = partial(bodyKeydown, 'email');");
- echo "<p>" . ('From') . ": <input name='email_from' value='" . h($_POST ? $_POST["email_from"] : $_COOKIE["adminer_email"]) . "'>\n";
- echo ('Subject') . ": <select name='email_id'><option>" . optionlist(get_key_vals("SELECT $this->id, $this->title FROM $this->table ORDER BY $this->title"), $_POST["email_id"], true) . "</select>\n";
+ echo Adminer\script("qsl('div').onkeydown = partial(bodyKeydown, 'email');");
+ echo "<p>" . ('From') . ": <input name='email_from' value='" . Adminer\h($_POST ? $_POST["email_from"] : $_COOKIE["adminer_email"]) . "'>\n";
+ echo ('Subject') . ": <select name='email_id'><option>" . Adminer\optionlist(Adminer\get_key_vals("SELECT $this->id, $this->title FROM $this->table ORDER BY $this->title"), $_POST["email_id"], true) . "</select>\n";
echo "<p>" . ('Attachments') . ": <input type='file' name='email_files[]'>";
- 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 "<p>" . (count($emailFields) == 1 ? '<input type="hidden" name="email_field" value="' . h(key($emailFields)) . '">' : html_select("email_field", $emailFields));
- echo "<input type='submit' name='email' value='" . ('Send') . "'>" . confirm();
+ echo "<p>" . (count($emailFields) == 1 ? '<input type="hidden" name="email_field" value="' . Adminer\h(key($emailFields)) . '">' : Adminer\html_select("email_field", $emailFields));
+ echo "<input type='submit' name='email' value='" . ('Send') . "'>" . Adminer\confirm();
echo "</div>\n";
echo "</div></fieldset>\n";
return true;
}
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];
$options = array();
$selected = $value;
if (isset($_GET["select"])) {
- $options[-1] = lang('original');
+ $options[-1] = Adminer\lang('original');
if ($selected === null) {
$selected = -1;
}
$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));
$selected = $i + 1;
}
}
- return "<select$attrs>" . optionlist($options, (string) $selected, 1) . "</select>"; // 1 - use keys
+ return "<select$attrs>" . Adminer\optionlist($options, (string) $selected, 1) . "</select>"; // 1 - use keys
}
}
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;
}
$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;
}
}
}
if (isset($_GET["select"])) {
- $options = array("" => array(-1 => lang('original'))) + $options;
+ $options = array("" => array(-1 => Adminer\lang('original'))) + $options;
}
- return "<select$attrs>" . optionlist($options, (string) $selected, 1) . "</select>";
+ return "<select$attrs>" . Adminer\optionlist($options, (string) $selected, 1) . "</select>";
}
}
if (!move_uploaded_file($_FILES[$name]["tmp_name"], "$this->uploadPath$table/$regs[1]-$filename")) {
return false;
}
- return q($filename);
+ return Adminer\q($filename);
}
}
echo '<table style="margin:2px; font-size:100%;">';
foreach ($json as $key => $val) {
echo '<tr>';
- echo '<th>' . h($key) . '</th>';
+ echo '<th>' . Adminer\h($key) . '</th>';
echo '<td>';
if (is_scalar($val) || $val === null) {
if (is_bool($val)) {
} elseif ($val === null) {
$val = 'null';
} elseif (!is_numeric($val)) {
- $val = '"' . h(addcslashes($val, "\r\n\"")) . '"';
+ $val = '"' . Adminer\h(addcslashes($val, "\r\n\"")) . '"';
}
echo '<code class="jush-js">' . $val . '</code>';
} else {
if ($name == 'password') {
return $heading . $value . "\n"
. "<tr><th><acronym title='One Time Password' lang='en'>OTP</acronym>"
- . "<td><input type='number' name='auth[otp]' value='" . h($_SESSION["otp"]) . "' size='6' autocomplete='one-time-code' inputmode='numeric' maxlength='6' pattern='\d{6}'>\n"
+ . "<td><input type='number' name='auth[otp]' value='" . Adminer\h($_SESSION["otp"]) . "' size='6' autocomplete='one-time-code' inputmode='numeric' maxlength='6' pattern='\d{6}'>\n"
;
}
}
$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;
}
}
}
function credentials() {
- $password = get_password();
+ $password = Adminer\get_password();
return array(SERVER, $_GET["username"], (password_verify($password, $this->password_hash) ? "" : $password));
}
}
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) {
if ($name == 'driver') {
return '';
} elseif ($name == 'server') {
- return $heading . "<select name='auth[server]'>" . optionlist(array_keys($this->servers), SERVER) . "</select>\n";
+ return $heading . "<select name='auth[server]'>" . Adminer\optionlist(array_keys($this->servers), SERVER) . "</select>\n";
}
}
}
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)));
}
}
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();
}
}
* @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;
}
$slug = $slugify[$field["field"]];
if ($slug !== null) {
- return "<input value='" . h($value) . "' data-maxlength='$field[length]' size='40'$attrs>"
- . script("qsl('input').onchange = function () {
+ return "<input value='" . Adminer\h($value) . "' data-maxlength='$field[length]' size='40'$attrs>"
+ . Adminer\script("qsl('input').onchange = function () {
var find = '$this->from';
var repl = '$this->to';
this.form['fields[$slug]'].value = this.value.toLowerCase()
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");
class AdminerStructComments {
function fieldName(&$field, $order = 0) {
- return '<span title="' . h($field["full_type"]) . (!empty($field["comment"]) ? ': ' . $field["comment"] : '') . '">' . h($field["field"]) . '</span>';
+ return '<span title="' . Adminer\h($field["full_type"]) . (!empty($field["comment"]) ? ': ' . $field["comment"] : '') . '">' . Adminer\h($field["field"]) . '</span>';
}
}
*/
function tableIndexesPrint($indexes) {
echo "<table>\n";
- echo "<thead><tr><th>" . lang('Name') . "<th>" . lang('Type') . "<th>" . lang('Columns') . "</thead>\n";
+ echo "<thead><tr><th>" . Adminer\lang('Name') . "<th>" . Adminer\lang('Type') . "<th>" . Adminer\lang('Columns') . "</thead>\n";
foreach ($indexes as $name => $index) {
- echo "<tr><th>" . h($name) . "<td>" . $index['type'];
+ echo "<tr><th>" . Adminer\h($name) . "<td>" . $index['type'];
ksort($index["columns"]); // enforce correct columns order
$print = array();
foreach ($index["columns"] as $key => $val) {
- $print[] = "<i>" . h($val) . "</i>"
+ $print[] = "<i>" . Adminer\h($val) . "</i>"
. ($index["lengths"][$key] ? "(" . $index["lengths"][$key] . ")" : "")
. ($index["descs"][$key] ? " DESC" : "")
;
function tableStructurePrint($fields) {
echo "<div class='scrollable'>\n";
echo "<table class='nowrap odds'>\n";
- echo "<thead><tr><th>" . lang('Column') . "<th>" . lang('Type') . "<th>" . lang('Collation') . "<th>" . lang('Nullable') . "<th>" . lang('Default') . (support("comment") ? "<th>" . lang('Comment') : "") . "</thead>\n";
+ echo "<thead><tr><th>" . Adminer\lang('Column') . "<th>" . Adminer\lang('Type') . "<th>" . Adminer\lang('Collation') . "<th>" . Adminer\lang('Nullable') . "<th>" . Adminer\lang('Default') . (support("comment") ? "<th>" . Adminer\lang('Comment') : "") . "</thead>\n";
foreach ($fields as $field) {
- echo "<tr><th>" . h($field["field"]) . ($field["primary"] ? " (PRIMARY)" : "");
- echo "<td><span>" . h($field["full_type"]) . "</span>";
- echo ($field["auto_increment"] ? " <i>" . lang('Auto Increment') . "</i>" : "");
- echo "<td>" . ($field["collation"] ? " <i>" . h($field["collation"]) . "</i>" : "");
- echo "<td>" . ($field["null"] ? lang('Yes') : lang('No'));
- echo "<td>" . h($field["default"]);
- echo (support("comment") ? "<td>" . h($field["comment"]) : "");
+ echo "<tr><th>" . Adminer\h($field["field"]) . ($field["primary"] ? " (PRIMARY)" : "");
+ echo "<td><span>" . Adminer\h($field["full_type"]) . "</span>";
+ echo ($field["auto_increment"] ? " <i>" . Adminer\lang('Auto Increment') . "</i>" : "");
+ echo "<td>" . ($field["collation"] ? " <i>" . Adminer\h($field["collation"]) . "</i>" : "");
+ echo "<td>" . ($field["null"] ? Adminer\lang('Yes') : Adminer\lang('No'));
+ echo "<td>" . Adminer\h($field["default"]);
+ echo (support("comment") ? "<td>" . Adminer\h($field["comment"]) : "");
echo "\n";
}
echo "</table>\n";
class AdminerTablesFilter {
function tablesPrint($tables) {
?>
-<script<?php echo nonce(); ?>>
+<script<?php echo Adminer\nonce(); ?>>
var tablesFilterTimeout = null;
var tablesFilterValue = '';
sessionStorage.setItem('adminer_tables_filter_db', db);
});
</script>
-<p class="jsonly"><input id="filter-field" autocomplete="off" type="search"><?php echo script("qs('#filter-field').oninput = tablesFilterInput;"); ?>
+<p class="jsonly"><input id="filter-field" autocomplete="off" type="search"><?php echo Adminer\script("qs('#filter-field').oninput = tablesFilterInput;"); ?>
<?php
}
}
}
function head() {
- $lang = get_lang();
+ $lang = Adminer\get_lang();
$lang = ($lang == "zh" ? "zh-cn" : ($lang == "zh-tw" ? "zh" : $lang));
if (!file_exists(dirname($this->path) . "/langs/$lang.js")) {
$lang = "en";
}
- echo script_src($this->path);
+ echo Adminer\script_src($this->path);
?>
-<script<?php echo nonce(); ?>>
+<script<?php echo Adminer\nonce(); ?>>
tinyMCE.init({
entity_encoding: 'raw',
language: '<?php echo $lang; ?>'
function editInput($table, $field, $attrs, $value) {
if (preg_match("~text~", $field["type"]) && preg_match("~_html~", $field["field"])) {
- return "<textarea$attrs id='fields-" . h($field["field"]) . "' rows='12' cols='50'>" . h($value) . "</textarea>" . script("
-tinyMCE.remove(tinyMCE.get('fields-" . js_escape($field["field"]) . "') || { });
-tinyMCE.EditorManager.execCommand('mceAddControl', true, 'fields-" . js_escape($field["field"]) . "');
+ return "<textarea$attrs id='fields-" . Adminer\h($field["field"]) . "' rows='12' cols='50'>" . Adminer\h($value) . "</textarea>" . 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();
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;
}
class AdminerVersionNoverify {
function head() {
- echo script("verifyVersion = function () {};");
+ echo Adminer\script("verifyVersion = function () {};");
}
}
function head() {
foreach ($this->scripts as $script) {
- echo script_src($script);
+ echo Adminer\script_src($script);
}
}
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 "<textarea$attrs id='fields-" . h($field["field"]) . "' rows='12' cols='50'>" . h($value) . "</textarea>" . script("
-jQuery('#fields-" . js_escape($field["field"]) . "').wymeditor({ updateSelector: '#form [type=\"submit\"]', lang: '$lang'" . ($this->options ? ", $this->options" : "") . " });
+ return "<textarea$attrs id='fields-" . Adminer\h($field["field"]) . "' rows='12' cols='50'>" . Adminer\h($value) . "</textarea>" . Adminer\script("
+jQuery('#fields-" . Adminer\js_escape($field["field"]) . "').wymeditor({ updateSelector: '#form [type=\"submit\"]', lang: '$lang'" . ($this->options ? ", $this->options" : "") . " });
");
}
}