1
0
mirror of https://github.com/vrana/adminer.git synced 2025-08-16 11:34:10 +02:00

E-mail sending

Change Adminer class to adminer_ functions.inc.php
Unify includes
Unify adminer_credentials()
Don't use JUSH in Editor
Separate identifier and description in breadcrumb
Simplify where()

git-svn-id: https://adminer.svn.sourceforge.net/svnroot/adminer/trunk@800 7c3ca157-0c34-0410-bff1-cbf682f78f5c
This commit is contained in:
jakubvrana
2009-07-11 19:45:57 +00:00
parent 1ae22acb55
commit c16c57b1b1
27 changed files with 350 additions and 206 deletions

View File

@@ -1,2 +1,2 @@
<?php
page_header(lang('Database') . ": " . htmlspecialchars($_GET["db"]), $error, false);
page_header(lang('Database'), "", null);

View File

@@ -1 +1,4 @@
// Editor specific functions
function body_load() {
}

View File

@@ -1,34 +1,59 @@
<?php
class AdminerBase {
function name() {
return lang('Editor');
function adminer_name() {
return call_adminer('name', lang('Editor'));
}
function adminer_credentials() {
return call_adminer('credentials', array()); // default INI settings
}
function adminer_database() {
$dbs = get_databases();
return call_adminer('database', (count($dbs) == 1 ? $dbs[0] : (count($dbs) == 2 && information_schema($dbs[0]) ? $dbs[1] : 'test')));
}
function adminer_table_name($row) {
return call_adminer('table_name', htmlspecialchars(strlen($row["Comment"]) ? $row["Comment"] : $row["Name"]), $row);
}
function adminer_field_name($fields, $key) {
return call_adminer('field_name', htmlspecialchars(strlen($fields[$key]["comment"]) ? $fields[$key]["comment"] : $key), $fields, $key);
}
function adminer_select_links($table_status) {
return call_adminer('select_links', "", $table_status);
}
function adminer_select_query($query) {
$join = "";
$i = 1;
foreach (foreign_keys($_GET["select"]) as $foreign_key) {
$on = array();
foreach ($foreign_key["source"] as $key => $val) {
$on[] = "`t0`." . idf_escape($val) . " = `t$i`." . idf_escape($foreign_key["target"][$key]);
}
//~ $join .= "\nLEFT JOIN " . idf_escape($foreign_key["table"]) . " AS `t$i` ON " . implode(" AND ", $on);
//! use in select
$i++;
}
function server() {
return "";
$query = preg_replace("~((?:[^'`]*|'(?:[^'\\\\]*|\\\\.)+')+)(`((?:[^`]+|``)*)`)~", '\\1`t0`.\\2', $query); // don't match ` inside ''
$query = preg_replace('~ FROM `t0`.(`((?:[^`]+|``)*)`) ?~', "\nFROM \\1 AS `t0`" . addcslashes($join, '\\$') . "\n", $query);
$return = call_adminer('select_query', "", $query);
if (!$return) {
echo "<!-- " . str_replace("--", " --><!-- ", $query) . " -->\n";
return $query;
}
function username() {
return "";
}
function password() {
return "";
}
function table_name($row) {
return htmlspecialchars(strlen($row["Comment"]) ? $row["Comment"] : $row["Name"]);
}
function field_name($fields, $key) {
return htmlspecialchars(strlen($fields[$key]["comment"]) ? $fields[$key]["comment"] : $key);
}
function navigation($missing) {
global $SELF;
if ($missing != "auth") {
?>
return $return;
}
function adminer_message_query($query) {
return call_adminer('message_query', "<!-- " . str_replace("--", " --><!-- ", $query) . " -->", $query);
}
function adminer_navigation($missing) {
global $SELF;
if (call_adminer('navigation', true, $missing) && $missing != "auth") {
?>
<form action="" method="post">
<p>
<input type="hidden" name="token" value="<?php echo $_SESSION["tokens"][$_GET["server"]]; ?>" />
@@ -36,20 +61,19 @@ class AdminerBase {
</p>
</form>
<?php
if ($missing != "db" && strlen($_GET["db"])) {
$table_status = table_status();
if (!$table_status) {
echo "<p class='message'>" . lang('No tables.') . "</p>\n";
} else {
echo "<p>\n";
foreach ($table_status as $row) {
echo '<a href="' . htmlspecialchars($SELF) . 'select=' . urlencode($row["Name"]) . '">' . $this->table_name($row) . "</a><br />\n";
if ($missing != "db") {
$table_status = table_status();
if (!$table_status) {
echo "<p class='message'>" . lang('No tables.') . "</p>\n";
} else {
echo "<p>\n";
foreach ($table_status as $row) {
if (isset($row["Engine"])) { // ignore views
echo '<a href="' . htmlspecialchars($SELF) . 'select=' . urlencode($row["Name"]) . '">' . adminer_table_name($row) . "</a><br />\n";
}
echo "</p>\n";
}
echo "</p>\n";
}
}
}
}
$adminer = (class_exists("Adminer") ? new Adminer : new AdminerBase);

View File

@@ -1,3 +1,3 @@
<?php
$_GET["db"] = "test";
$dbh->select_db($_GET["db"]);
$_GET["db"] = ""; // used here and there by Adminer
$dbh->select_db(adminer_database());

View File

@@ -0,0 +1 @@
<?php

View File

@@ -24,4 +24,4 @@ function dump_headers($identifier, $multi_table = false) {
}
$dump_output = "";
$dump_format = "";
$dump_format = "CSV";

View File

@@ -7,20 +7,6 @@
*/
include "../adminer/include/bootstrap.inc.php";
include "../adminer/include/version.inc.php";
include "../adminer/include/functions.inc.php";
include "../adminer/include/lang.inc.php";
include "./lang/$LANG.inc.php";
include "./include/adminer.inc.php";
include "../adminer/include/design.inc.php";
if (isset($_GET["coverage"])) {
include "../adminer/coverage.inc.php";
}
include "../adminer/include/pdo.inc.php";
include "../adminer/include/mysql.inc.php";
include "./include/auth.inc.php";
include "./include/connect.inc.php";
include "./include/export.inc.php";
$confirm = " onclick=\"return confirm('" . lang('Are you sure?') . "');\"";
$error = "";
@@ -37,7 +23,7 @@ if (isset($_GET["download"])) {
// posted form with no data means exceeded post_max_size because Adminer always sends token at least
$error = lang('Too big POST data. Reduce the data or increase the "post_max_size" configuration directive.');
}
if (isset($_GET["select"]) && $_POST && (!$_POST["delete"] && !$_POST["export"] && !$_POST["import"] && !$_POST["save"])) {
if (isset($_GET["select"]) && $_POST && (!$_POST["delete"] && !$_POST["export"] && !$_POST["import"] && !$_POST["save"] && !$_POST["email"])) {
// POST form on select page is used to edit or clone data
$_GET["edit"] = $_GET["select"];
}

View File

@@ -4,4 +4,5 @@ $translations = array(
'%d row(s)' => array('%d row', '%d rows'),
'%d item(s) have been affected.' => array('%d item have been affected.', '%d items have been affected.'),
'%d row(s) has been imported.' => array('%d row has been imported.', '%d rows has been imported.'),
'%d e-mail(s) have been sent.' => array('%d e-mail has been sent.', '%d e-mails have been sent.'),
);