]> git.joonet.de Git - adminer.git/commitdiff
More separation
authorjakubvrana <jakubvrana@7c3ca157-0c34-0410-bff1-cbf682f78f5c>
Fri, 3 Jul 2009 05:44:44 +0000 (05:44 +0000)
committerjakubvrana <jakubvrana@7c3ca157-0c34-0410-bff1-cbf682f78f5c>
Fri, 3 Jul 2009 05:44:44 +0000 (05:44 +0000)
git-svn-id: https://adminer.svn.sourceforge.net/svnroot/adminer/trunk@785 7c3ca157-0c34-0410-bff1-cbf682f78f5c

adminer/database.inc.php
adminer/include/adminer.inc.php
adminer/include/design.inc.php
adminer/include/editing.inc.php
adminer/include/mysql.inc.php
adminer/index.php
adminer/schema.inc.php

index 759c6ea3184d0976f2f104ed808a4a718f3db580..5f9780c707283dfae9c42e98e008b7776dcee286 100644 (file)
@@ -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>
index 7aaf2d67d1d95ef91d617ac5c05e4ed9c5a2192a..640478d4b19dbcdb98f86a70a0c85b8507224b34 100644 (file)
@@ -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);
index 402bd30b2f206dd59e54fd537862089a9df033fb..a7ed615703d494b73966dd698ce6221be24d45e8 100644 (file)
@@ -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> &nbsp; <?php echo $VERSION; ?> &nbsp;
+<h1><a href="http://www.adminer.org/" class="h1"><?php echo $adminer->name(); ?></a> &nbsp; <?php echo $VERSION; ?> &nbsp;
 <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") { ?>
index 416ee346a7171187dddfd075da99c225038ff0a0..4d99278746ce945d3c2ace972920c93c0f7e3ebe 100644 (file)
@@ -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 "&nbsp;<input type='image' name='drop_col[$i]' src='cross.gif' alt='x' title='" . lang('Remove') . "' onclick='return !editing_remove_row(this);' />";
-               echo "&nbsp;<input type='image' name='up[$i]' src='up.gif' alt='^' title='" . lang('Move up') . "' />";
-               echo "&nbsp;<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 "&nbsp;<input type='image' name='drop_col[$i]' src='../adminer/cross.gif' alt='x' title='" . lang('Remove') . "' onclick='return !editing_remove_row(this);' />";
+               echo "&nbsp;<input type='image' name='up[$i]' src='../adminer/up.gif' alt='^' title='" . lang('Move up') . "' />";
+               echo "&nbsp;<input type='image' name='down[$i]' src='../adminer/down.gif' alt='v' title='" . lang('Move down') . "' />";
                echo "</td>\n</tr>\n";
        }
        return $column_comments;
index eb4dc9de61c6ef07b5de3843973f565a66b02c66..b44feaa39279e881f333e8813de6e972201d6e57 100644 (file)
@@ -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;
index 657ce11dc6a0c9c31de80cac0cd908562da5ad85..2614cd8c909a929497790695d29a3f748a800449 100644 (file)
@@ -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");
index 8dac8189414c1dd39e338b199668e4798df11cfe..7194309baf4fdd253c93b0a0da69dfdd8fee5282 100644 (file)
@@ -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";
                        }
                }
        }