Skip to content
Browse files

Extensibility basics

git-svn-id: https://adminer.svn.sourceforge.net/svnroot/adminer/trunk@782 7c3ca157-0c34-0410-bff1-cbf682f78f5c
  • Loading branch information...
1 parent ac4f130 commit 2c445a86c15ca4c5bfe0ec34e44bb61254afe27f jakubvrana committed Jul 3, 2009
Showing with 24 additions and 5 deletions.
  1. +18 −0 adminer/include/adminer.inc.php
  2. +2 −3 adminer/include/design.inc.php
  3. +2 −0 adminer/index.php
  4. +2 −2 adminer/select.inc.php
View
18 adminer/include/adminer.inc.php
@@ -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);
+ }
+
+}
View
5 adminer/include/design.inc.php
@@ -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";
}
View
2 adminer/index.php
@@ -87,6 +87,7 @@ function save_coverage() {
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 @@ function save_coverage() {
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");
View
4 adminer/select.inc.php
@@ -143,7 +143,7 @@
$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 (!$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";
}

0 comments on commit 2c445a8

Please sign in to comment.
Something went wrong with that request. Please try again.