]> git.joonet.de Git - adminer.git/commitdiff
Extensibility basics
authorjakubvrana <jakubvrana@7c3ca157-0c34-0410-bff1-cbf682f78f5c>
Fri, 3 Jul 2009 04:40:48 +0000 (04:40 +0000)
committerjakubvrana <jakubvrana@7c3ca157-0c34-0410-bff1-cbf682f78f5c>
Fri, 3 Jul 2009 04:40:48 +0000 (04:40 +0000)
git-svn-id: https://adminer.svn.sourceforge.net/svnroot/adminer/trunk@782 7c3ca157-0c34-0410-bff1-cbf682f78f5c

adminer/include/adminer.inc.php [new file with mode: 0644]
adminer/include/design.inc.php
adminer/index.php
adminer/select.inc.php

diff --git a/adminer/include/adminer.inc.php b/adminer/include/adminer.inc.php
new file mode 100644 (file)
index 0000000..7aaf2d6
--- /dev/null
@@ -0,0 +1,18 @@
+<?php
+class AdminerBase {
+       
+       function table_list($row) {
+               global $SELF;
+               echo '<a href="' . htmlspecialchars($SELF) . 'select=' . urlencode($row["Name"]) . '">' . lang('select') . '</a> ';
+               echo '<a href="' . htmlspecialchars($SELF) . (isset($row["Rows"]) ? 'table' : 'view') . '=' . urlencode($row["Name"]) . '">' . $this->table_name($row) . "</a><br />\n";
+       }
+       
+       function table_name($row) {
+               return htmlspecialchars($row["Name"]);
+       }
+       
+       function field_name($fields, $key) {
+               return htmlspecialchars($key);
+       }
+       
+}
index 0fd0676f9283a03ecb02a0caa6890a3b41d5dadc..402bd30b2f206dd59e54fd537862089a9df033fb 100644 (file)
@@ -56,7 +56,7 @@ function page_header($title, $error = "", $breadcrumb = array(), $title2 = "") {
 }
 
 function page_footer($missing = false) {
-       global $SELF, $VERSION, $dbh;
+       global $SELF, $VERSION, $dbh, $adminer;
        ?>
 </div>
 
@@ -95,8 +95,7 @@ function page_footer($missing = false) {
                        } else {
                                echo "<p>\n";
                                foreach ($table_status as $row) {
-                                       echo '<a href="' . htmlspecialchars($SELF) . 'select=' . urlencode($row["Name"]) . '">' . lang('select') . '</a> ';
-                                       echo '<a href="' . htmlspecialchars($SELF) . (isset($row["Rows"]) ? 'table' : 'view') . '=' . urlencode($row["Name"]) . '">' . htmlspecialchars($row["Name"]) . "</a><br />\n";
+                                       $adminer->table_list($row);
                                }
                                echo "</p>\n";
                        }
index e78ade13d4181f3a610d1946a1ee71069fcc1ba2..9d5fd898269d6d9d7a62249d4ba5ec4b51e54f7a 100644 (file)
@@ -87,6 +87,7 @@ include "./include/version.inc.php";
 include "./include/functions.inc.php";
 include "./include/lang.inc.php";
 include "./lang/$LANG.inc.php";
+include "./include/adminer.inc.php";
 include "./include/design.inc.php";
 if (isset($_GET["coverage"])) {
        include "./coverage.inc.php";
@@ -98,6 +99,7 @@ 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 e54b4f28cb20fea2dc79371c6f4ec2c0fe9abc3c..2d6b3f47a8463d8539ee9391d183f70e8cae0023 100644 (file)
@@ -143,7 +143,7 @@ if ($_POST && !$error) {
                $error = lang('Unable to upload a file.');
        }
 }
-page_header(lang('Select') . ": " . htmlspecialchars($_GET["select"]), $error);
+page_header(lang('Select') . ": " . $adminer->table_name($table_status), $error);
 
 echo "<p>";
 if (isset($rights["insert"])) {
@@ -250,7 +250,7 @@ if (!$columns) {
                                if (!$j) {
                                        echo '<thead><tr><td><input type="checkbox" id="all-page" onclick="form_check(this, /check/);" /></td>';
                                        foreach ($row as $key => $val) {
-                                               echo '<th><a href="' . htmlspecialchars(remove_from_uri('(order|desc)[^=]*') . '&order%5B0%5D=' . urlencode($key) . ($_GET["order"] == array($key) && !$_GET["desc"][0] ? '&desc%5B0%5D=1' : '')) . '">' . htmlspecialchars($key) . '</a></th>';
+                                               echo '<th><a href="' . htmlspecialchars(remove_from_uri('(order|desc)[^=]*') . '&order%5B0%5D=' . urlencode($key) . ($_GET["order"] == array($key) && !$_GET["desc"][0] ? '&desc%5B0%5D=1' : '')) . '">' . $adminer->field_name($fields, $key) . '</a></th>';
                                        }
                                        echo "</tr></thead>\n";
                                }