mirror of
https://github.com/vrana/adminer.git
synced 2025-08-08 15:47:00 +02:00
More separation
git-svn-id: https://adminer.svn.sourceforge.net/svnroot/adminer/trunk@785 7c3ca157-0c34-0410-bff1-cbf682f78f5c
This commit is contained in:
@@ -77,7 +77,7 @@ if ($_POST) {
|
||||
if (strlen($_GET["db"])) {
|
||||
echo "<input type='submit' name='drop' value='" . lang('Drop') . "'$confirm />\n";
|
||||
} elseif (!$_POST["add_x"]) {
|
||||
echo "<input type='image' name='add' src='plus.gif' alt='+' title='" . lang('Add next') . "' />\n";
|
||||
echo "<input type='image' name='add' src='../adminer/plus.gif' alt='+' title='" . lang('Add next') . "' />\n";
|
||||
}
|
||||
?>
|
||||
</p>
|
||||
|
@@ -1,6 +1,22 @@
|
||||
<?php
|
||||
class AdminerBase {
|
||||
|
||||
function name() {
|
||||
return lang('Adminer');
|
||||
}
|
||||
|
||||
function server() {
|
||||
return $_GET["server"];
|
||||
}
|
||||
|
||||
function username() {
|
||||
return $_SESSION["usernames"][$_GET["server"]];
|
||||
}
|
||||
|
||||
function password() {
|
||||
return $_SESSION["passwords"][$_GET["server"]];
|
||||
}
|
||||
|
||||
function table_list($row) {
|
||||
global $SELF;
|
||||
echo '<a href="' . htmlspecialchars($SELF) . 'select=' . urlencode($row["Name"]) . '">' . lang('select') . '</a> ';
|
||||
@@ -16,3 +32,5 @@ class AdminerBase {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$adminer = (class_exists("Adminer") ? new Adminer : new AdminerBase);
|
||||
|
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
function page_header($title, $error = "", $breadcrumb = array(), $title2 = "") {
|
||||
global $SELF, $LANG, $VERSION;
|
||||
global $SELF, $LANG, $VERSION, $adminer;
|
||||
header("Content-Type: text/html; charset=utf-8");
|
||||
?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
@@ -9,16 +9,16 @@ function page_header($title, $error = "", $breadcrumb = array(), $title2 = "") {
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
||||
<meta name="robots" content="noindex" />
|
||||
<title><?php echo $title . (strlen($title2) ? ": " . htmlspecialchars($title2) : "") . (strlen($_GET["server"]) && $_GET["server"] != "localhost" ? htmlspecialchars("- $_GET[server]") : "") . " - " . lang('Adminer'); ?></title>
|
||||
<title><?php echo $title . (strlen($title2) ? ": " . htmlspecialchars($title2) : "") . (strlen($_GET["server"]) && $_GET["server"] != "localhost" ? htmlspecialchars("- $_GET[server]") : "") . " - " . $adminer->name(); ?></title>
|
||||
<link rel="shortcut icon" type="image/x-icon" href="favicon.ico" />
|
||||
<link rel="stylesheet" type="text/css" href="default.css<?php // Ondrej Valka, http://valka.info ?>" />
|
||||
<link rel="stylesheet" type="text/css" href="../adminer/default.css<?php // Ondrej Valka, http://valka.info ?>" />
|
||||
<?php if (file_exists("adminer.css")) { ?>
|
||||
<link rel="stylesheet" type="text/css" href="adminer.css" />
|
||||
<?php } ?>
|
||||
</head>
|
||||
|
||||
<body onload="load_jush();<?php echo (isset($_COOKIE["adminer_version"]) ? "" : " verify_version('$VERSION');"); ?>">
|
||||
<script type="text/javascript" src="functions.js"></script>
|
||||
<script type="text/javascript" src="../adminer/functions.js"></script>
|
||||
|
||||
<div id="content">
|
||||
<?php
|
||||
@@ -62,7 +62,7 @@ function page_footer($missing = false) {
|
||||
|
||||
<?php switch_lang(); ?>
|
||||
<div id="menu">
|
||||
<h1><a href="http://www.adminer.org/" class="h1"><?php echo lang('Adminer'); ?></a> <?php echo $VERSION; ?>
|
||||
<h1><a href="http://www.adminer.org/" class="h1"><?php echo $adminer->name(); ?></a> <?php echo $VERSION; ?>
|
||||
<a href='http://www.adminer.org/#download' id="version"><?php echo (version_compare($VERSION, $_COOKIE["adminer_version"]) < 0 ? htmlspecialchars($_COOKIE["adminer_version"]) : ""); ?></a>
|
||||
</h1>
|
||||
<?php if ($missing != "auth") { ?>
|
||||
|
@@ -158,7 +158,7 @@ function edit_fields($fields, $collations, $type = "TABLE", $allowed = 0, $forei
|
||||
<td><input type="radio" name="auto_increment_col" value="" /><?php echo lang('Auto Increment'); ?></td>
|
||||
<td<?php echo ($column_comments ? "" : " class='hidden'"); ?>><?php echo lang('Comment'); ?></td>
|
||||
<?php } ?>
|
||||
<td><?php echo "<input type='image' name='add[0]' src='plus.gif' alt='+' title='" . lang("Add next") . "' />"; ?><script type="text/javascript">row_count = <?php echo count($fields); ?>;</script></td>
|
||||
<td><?php echo "<input type='image' name='add[0]' src='../adminer/plus.gif' alt='+' title='" . lang("Add next") . "' />"; ?><script type="text/javascript">row_count = <?php echo count($fields); ?>;</script></td>
|
||||
</tr></thead>
|
||||
<?php
|
||||
foreach ($fields as $i => $field) {
|
||||
@@ -175,10 +175,10 @@ function edit_fields($fields, $collations, $type = "TABLE", $allowed = 0, $forei
|
||||
<td<?php echo ($column_comments ? "" : " class='hidden'"); ?>><input name="fields[<?php echo $i; ?>][comment]" value="<?php echo htmlspecialchars($field["comment"]); ?>" maxlength="255" /></td>
|
||||
<?php } ?>
|
||||
<?php
|
||||
echo "<td class='nowrap'><input type='image' name='add[$i]' src='plus.gif' alt='+' title='" . lang('Add next') . "' onclick='var x = editing_add_row(this, $allowed); if (x) { x.focus(); x.onchange = function () { }; } return !x;' />";
|
||||
echo " <input type='image' name='drop_col[$i]' src='cross.gif' alt='x' title='" . lang('Remove') . "' onclick='return !editing_remove_row(this);' />";
|
||||
echo " <input type='image' name='up[$i]' src='up.gif' alt='^' title='" . lang('Move up') . "' />";
|
||||
echo " <input type='image' name='down[$i]' src='down.gif' alt='v' title='" . lang('Move down') . "' />";
|
||||
echo "<td class='nowrap'><input type='image' name='add[$i]' src='../adminer/plus.gif' alt='+' title='" . lang('Add next') . "' onclick='var x = editing_add_row(this, $allowed); if (x) { x.focus(); x.onchange = function () { }; } return !x;' />";
|
||||
echo " <input type='image' name='drop_col[$i]' src='../adminer/cross.gif' alt='x' title='" . lang('Remove') . "' onclick='return !editing_remove_row(this);' />";
|
||||
echo " <input type='image' name='up[$i]' src='../adminer/up.gif' alt='^' title='" . lang('Move up') . "' />";
|
||||
echo " <input type='image' name='down[$i]' src='../adminer/down.gif' alt='v' title='" . lang('Move down') . "' />";
|
||||
echo "</td>\n</tr>\n";
|
||||
}
|
||||
return $column_comments;
|
||||
|
@@ -204,8 +204,9 @@ $types = array(
|
||||
$unsigned = array("unsigned", "zerofill", "unsigned zerofill");
|
||||
|
||||
function connect() {
|
||||
global $adminer;
|
||||
$dbh = new Min_DB;
|
||||
if ($dbh->connect($_GET["server"], $_SESSION["usernames"][$_GET["server"]], $_SESSION["passwords"][$_GET["server"]])) {
|
||||
if ($dbh->connect($adminer->server(), $adminer->username(), $adminer->password())) {
|
||||
$dbh->query("SET SQL_QUOTE_SHOW_CREATE=1");
|
||||
$dbh->query("SET NAMES utf8");
|
||||
return $dbh;
|
||||
|
@@ -23,7 +23,6 @@ include "./include/connect.inc.php";
|
||||
include "./include/editing.inc.php";
|
||||
include "./include/export.inc.php";
|
||||
|
||||
$adminer = (class_exists("Adminer") ? new Adminer : new AdminerBase);
|
||||
$on_actions = array("RESTRICT", "CASCADE", "SET NULL", "NO ACTION");
|
||||
$enum_length = '\'(?:\'\'|[^\'\\\\]+|\\\\.)*\'|"(?:""|[^"\\\\]+|\\\\.)*"';
|
||||
$inout = array("IN", "OUT", "INOUT");
|
||||
|
@@ -91,7 +91,7 @@ foreach ($schema as $name => $table) {
|
||||
$left1 = $left - $table_pos[$name][1];
|
||||
$i = 0;
|
||||
foreach ($columns as $target) {
|
||||
echo '<div class="references" title="' . htmlspecialchars($target_name) . "\" id='refd$left-" . ($i++) . "' style='left: $left1" . "em; top: " . $table["fields"][$target]["pos"] . "em; height: 1.25em; background: url(arrow.gif) no-repeat right center;'><div style='height: .5em; border-bottom: 1px solid Gray; width: " . (-$left1) . "em;'></div></div>\n";
|
||||
echo '<div class="references" title="' . htmlspecialchars($target_name) . "\" id='refd$left-" . ($i++) . "' style='left: $left1" . "em; top: " . $table["fields"][$target]["pos"] . "em; height: 1.25em; background: url(../adminer/arrow.gif) no-repeat right center;'><div style='height: .5em; border-bottom: 1px solid Gray; width: " . (-$left1) . "em;'></div></div>\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user