diff --git a/adminer/include/adminer.inc.php b/adminer/include/adminer.inc.php index 3aa970ba..ef6989ab 100644 --- a/adminer/include/adminer.inc.php +++ b/adminer/include/adminer.inc.php @@ -111,15 +111,15 @@ class Adminer { /** Print login form */ function loginForm(): void { - global $drivers; + global $drivers, $adminer; echo "
' . lang('System') . ' | ', html_select("auth[driver]", $drivers, DRIVER, "loginDriver(this);")); - echo $this->loginFormField('server', ' |
---|---|
' . lang('Server') . ' | ', ''); + echo $adminer->loginFormField('driver', ' |
' . lang('System') . ' | ', html_select("auth[driver]", $drivers, DRIVER, "loginDriver(this);")); + echo $adminer->loginFormField('server', ' |
' . lang('Server') . ' | ', ''); // this is matched by compile.php - echo $this->loginFormField('username', ' |
' . lang('Username') . ' | ', '' . script("qs('#username').form['auth[driver]'].onchange();")); - echo $this->loginFormField('password', ' |
' . lang('Password') . ' | ', ''); - echo $this->loginFormField('db', ' |
' . lang('Database') . ' | ', ''); + echo $adminer->loginFormField('username', ' |
' . lang('Username') . ' | ', '' . script("qs('#username').form['auth[driver]'].onchange();")); + echo $adminer->loginFormField('password', ' |
' . lang('Password') . ' | ', ''); + echo $adminer->loginFormField('db', ' |
' . lang('Database') . ' | ', ''); echo " |
\n";
echo checkbox("auth[permanent]", 1, $_COOKIE["adminer_permanent"], lang('Permanent login')) . "\n";
@@ -519,7 +519,7 @@ class Adminer {
* @return list \n" . implode("\n", $actions) . "\n" : "");
if ($in_db) {
if ($tables) {
- $this->tablesPrint($tables);
+ $adminer->tablesPrint($tables);
} else {
echo " \n";
echo checkbox("auth[permanent]", 1, $_COOKIE["adminer_permanent"], lang('Permanent login')) . "\n";
@@ -115,19 +116,20 @@ class Adminer {
}
function backwardKeys($table, $tableName) {
+ global $adminer;
$return = array();
foreach (
get_rows("SELECT TABLE_NAME, CONSTRAINT_NAME, COLUMN_NAME, REFERENCED_COLUMN_NAME
FROM information_schema.KEY_COLUMN_USAGE
-WHERE TABLE_SCHEMA = " . q($this->database()) . "
-AND REFERENCED_TABLE_SCHEMA = " . q($this->database()) . "
+WHERE TABLE_SCHEMA = " . q($adminer->database()) . "
+AND REFERENCED_TABLE_SCHEMA = " . q($adminer->database()) . "
AND REFERENCED_TABLE_NAME = " . q($table) . "
ORDER BY ORDINAL_POSITION", null, "") as $row
) {
$return[$row["TABLE_NAME"]]["keys"][$row["CONSTRAINT_NAME"]][$row["COLUMN_NAME"]] = $row["REFERENCED_COLUMN_NAME"];
}
foreach ($return as $key => $val) {
- $name = $this->tableName(table_status1($key, true));
+ $name = $adminer->tableName(table_status1($key, true));
if ($name != "") {
$search = preg_quote($tableName);
$separator = "(:|\\s*-)?\\s+";
@@ -350,7 +352,7 @@ ORDER BY ORDINAL_POSITION", null, "") as $row
}
function selectSearchProcess($fields, $indexes) {
- global $driver;
+ global $driver, $adminer;
$return = array();
foreach ((array) $_GET["where"] as $key => $where) {
$col = $where["col"];
@@ -365,7 +367,7 @@ ORDER BY ORDINAL_POSITION", null, "") as $row
$conds[] = (in_array(0, $val) ? "$name IS NULL OR " : "") . "$name IN (" . implode(", ", array_map('intval', $val)) . ")";
} else {
$text_type = preg_match('~char|text|enum|set~', $field["type"]);
- $value = $this->processInput($field, (!$op && $text_type && preg_match('~^[^%]+$~', $val) ? "%$val%" : $val));
+ $value = $adminer->processInput($field, (!$op && $text_type && preg_match('~^[^%]+$~', $val) ? "%$val%" : $val));
$conds[] = $driver->convertSearch($name, $where, $field) . ($value == "NULL" ? " IS" . ($op == ">=" ? " NOT" : "") . " $value"
: (in_array($op, $this->operators) || $op == "=" ? " $op $value"
: ($text_type ? " LIKE $value"
@@ -420,6 +422,7 @@ ORDER BY ORDINAL_POSITION", null, "") as $row
}
function selectEmailProcess($where, $foreignKeys) {
+ global $adminer;
if ($_POST["email_append"]) {
return true;
}
@@ -437,10 +440,10 @@ ORDER BY ORDINAL_POSITION", null, "") as $row
. ($_POST["all"] ? "" : " AND ((" . implode(") OR (", array_map('Adminer\where_check', (array) $_POST["check"])) . "))")
);
$fields = fields($_GET["select"]);
- foreach ($this->rowDescriptions($rows, $foreignKeys) as $row) {
+ foreach ($adminer->rowDescriptions($rows, $foreignKeys) as $row) {
$replace = array('{\\' => '{'); // allow literal {$name}
foreach ($matches[1] as $val) {
- $replace['{$' . "$val}"] = $this->editVal($row[$val], $fields[$val]);
+ $replace['{$' . "$val}"] = $adminer->editVal($row[$val], $fields[$val]);
}
$email = $row[$_POST["email_field"]];
if (is_mail($email) && send_mail($email, strtr($subject, $replace), strtr($message, $replace), $_POST["email_from"], $_FILES["email_files"])) {
@@ -589,8 +592,8 @@ ORDER BY ORDINAL_POSITION", null, "") as $row
}
function navigation($missing) {
- global $VERSION;
- echo "" . $this->name() . " $VERSION";
+ global $VERSION, $drivers, $connection, $adminer;
+ echo "
" . $adminer->name() . " $VERSION";
$new_version = $_COOKIE["adminer_version"];
echo " " . (version_compare($VERSION, $new_version) < 0 ? h($new_version) : "") . "";
echo "
\n";
@@ -954,7 +954,7 @@ class Adminer {
if ($password !== null) {
$dbs = $_SESSION["db"][$vendor][$server][$username];
foreach (($dbs ? array_keys($dbs) : array("")) as $db) {
- $output .= "" . script("mixin(qs('#tables'), {onmouseover: menuOver, onmouseout: menuOut});");
foreach ($tables as $table => $status) {
- $name = $this->tableName($status);
+ $name = $adminer->tableName($status);
if ($name != "") {
echo '
\n";
- echo $this->loginFormField('username', '
\n";
echo "' . lang('Username') . ' ', input_hidden("auth[driver]", "server") . '');
- echo $this->loginFormField('password', ' ' . lang('Password') . ' ', '');
+ echo $adminer->loginFormField('username', ' ' . lang('Username') . ' ', input_hidden("auth[driver]", "server") . '');
+ echo $adminer->loginFormField('password', ' ' . lang('Password') . ' ', '');
echo " " . $this->name() . " $VERSION";
+ global $VERSION, $adminer;
+ echo "
" . $adminer->name() . " $VERSION";
$new_version = $_COOKIE["adminer_version"];
echo " " . (version_compare($VERSION, $new_version) < 0 ? h($new_version) : "") . "";
echo "
\n";
@@ -610,13 +613,13 @@ ORDER BY ORDINAL_POSITION", null, "") as $row
}
}
} else {
- $this->databasesPrint($missing);
+ $adminer->databasesPrint($missing);
if ($missing != "db" && $missing != "ns") {
$table_status = table_status('', true);
if (!$table_status) {
echo "";
echo script("mixin(qs('#tables'), {onmouseover: menuOver, onmouseout: menuOut});");
foreach ($tables as $row) {
echo '