2009-07-03 06:26:01 +00:00
|
|
|
<?php
|
2009-07-11 19:45:57 +00:00
|
|
|
function adminer_name() {
|
|
|
|
return call_adminer('name', lang('Editor'));
|
|
|
|
}
|
|
|
|
|
|
|
|
function adminer_credentials() {
|
|
|
|
return call_adminer('credentials', array()); // default INI settings
|
|
|
|
}
|
|
|
|
|
|
|
|
function adminer_database() {
|
2009-07-16 17:00:33 +00:00
|
|
|
$dbs = get_databases(false);
|
2009-07-11 19:45:57 +00:00
|
|
|
return call_adminer('database', (count($dbs) == 1 ? $dbs[0] : (count($dbs) == 2 && information_schema($dbs[0]) ? $dbs[1] : 'test')));
|
|
|
|
}
|
|
|
|
|
|
|
|
function adminer_table_name($row) {
|
2009-07-16 09:07:04 +00:00
|
|
|
table_comment($row);
|
2009-07-11 19:45:57 +00:00
|
|
|
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) {
|
2009-07-11 19:52:48 +00:00
|
|
|
return call_adminer('select_query', "<!-- " . str_replace("--", "--><!--", $query) . " -->\n", $query);
|
2009-07-11 19:45:57 +00:00
|
|
|
}
|
|
|
|
|
2009-07-14 10:06:35 +00:00
|
|
|
function adminer_select_val($val, $link) {
|
|
|
|
return call_adminer('select_val', ($link ? '<a href="' . $link . '">' . $val . '</a>' : $val), $val, $link);
|
|
|
|
}
|
|
|
|
|
2009-07-11 19:45:57 +00:00
|
|
|
function adminer_message_query($query) {
|
2009-07-11 19:52:48 +00:00
|
|
|
return call_adminer('message_query', "<!-- " . str_replace("--", "--><!--", $query) . " -->", $query);
|
2009-07-11 19:45:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function adminer_navigation($missing) {
|
|
|
|
global $SELF;
|
|
|
|
if (call_adminer('navigation', true, $missing) && $missing != "auth") {
|
|
|
|
?>
|
2009-07-03 06:26:01 +00:00
|
|
|
<form action="" method="post">
|
|
|
|
<p>
|
2009-07-11 20:30:40 +00:00
|
|
|
<input type="hidden" name="token" value="<?php echo $_SESSION["tokens"][$_GET["server"]]; ?>">
|
|
|
|
<input type="submit" name="logout" value="<?php echo lang('Logout'); ?>">
|
2009-07-14 11:09:39 +00:00
|
|
|
</p>
|
2009-07-03 06:26:01 +00:00
|
|
|
</form>
|
|
|
|
<?php
|
2009-07-11 19:45:57 +00:00
|
|
|
if ($missing != "db") {
|
|
|
|
$table_status = table_status();
|
|
|
|
if (!$table_status) {
|
2009-07-11 20:30:40 +00:00
|
|
|
echo "<p class='message'>" . lang('No tables.') . "\n";
|
2009-07-11 19:45:57 +00:00
|
|
|
} else {
|
|
|
|
echo "<p>\n";
|
|
|
|
foreach ($table_status as $row) {
|
|
|
|
if (isset($row["Engine"])) { // ignore views
|
2009-07-11 20:30:40 +00:00
|
|
|
echo '<a href="' . htmlspecialchars($SELF) . 'select=' . urlencode($row["Name"]) . '">' . adminer_table_name($row) . "</a><br>\n";
|
2009-07-03 06:26:01 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|