Skip to content
Browse files

SHOW DATABASES can be revoked

git-svn-id: https://adminer.svn.sourceforge.net/svnroot/adminer/trunk@506 7c3ca157-0c34-0410-bff1-cbf682f78f5c
  • Loading branch information...
1 parent 766caa4 commit 49f7886f41d9780b54da439c999cfeaa5ec5ae3e jakubvrana committed Sep 30, 2008
Showing with 15 additions and 10 deletions.
  1. +7 −5 design.inc.php
  2. +6 −4 functions.inc.php
  3. +2 −1 index.php
View
12 design.inc.php
@@ -76,16 +76,18 @@ function page_footer($missing = false) {
</form>
<form action="">
<p><?php if (strlen($_GET["server"])) { ?><input type="hidden" name="server" value="<?php echo htmlspecialchars($_GET["server"]); ?>" /><?php } ?>
-<select name="db" onchange="this.form.submit();"><option value="">(<?php echo lang('database'); ?>)</option>
-<?php
- echo optionlist(get_databases(), $_GET["db"]);
- ?>
-</select>
+<?php if (get_databases()) { ?>
+<select name="db" onchange="this.form.submit();"><option value="">(<?php echo lang('database'); ?>)</option><?php echo optionlist(get_databases(), $_GET["db"]); ?></select>
+<?php } else { ?>
+<input name="db" value="<?php echo htmlspecialchars($_GET["db"]); ?>" /> <input type="submit" value="<?php echo lang('Use'); ?>" />
+<?php } ?>
<?php if (isset($_GET["sql"])) { ?><input type="hidden" name="sql" value="" /><?php } ?>
<?php if (isset($_GET["schema"])) { ?><input type="hidden" name="schema" value="" /><?php } ?>
<?php if (isset($_GET["dump"])) { ?><input type="hidden" name="dump" value="" /><?php } ?>
</p>
+<?php if (get_databases()) { ?>
<noscript><p><input type="submit" value="<?php echo lang('Use'); ?>" /></p></noscript>
+<?php } ?>
</form>
<?php
if ($missing != "db" && strlen($_GET["db"])) {
View
10 functions.inc.php
@@ -31,12 +31,14 @@ function optionlist($options, $selected = array()) {
function get_vals($query) {
global $mysql;
- $result = $mysql->query($query);
$return = array();
- while ($row = $result->fetch_row()) {
- $return[] = $row[0];
+ $result = $mysql->query($query);
+ if ($result) {
+ while ($row = $result->fetch_row()) {
+ $return[] = $row[0];
+ }
+ $result->free();
}
- $result->free();
return $return;
}
View
3 index.php
@@ -166,7 +166,8 @@
}
echo "</table>\n";
echo "<p><input type='hidden' name='token' value='$token' /><input type='submit' value='" . lang('Analyze') . "' /> <input type='submit' name='optimize' value='" . lang('Optimize') . "' /> <input type='submit' name='check' value='" . lang('Check') . "' /> <input type='submit' name='repair' value='" . lang('Repair') . "' /> <input type='submit' name='truncate' value='" . lang('Truncate') . "' onclick=\"return confirm('" . lang('Are you sure?') . "');\" /> <input type='submit' name='drop' value='" . lang('Drop') . "' onclick=\"return confirm('" . lang('Are you sure?') . "');\" /></p>\n";
- echo "<p>" . lang('Move to other database') . ": <select name='target'>" . optionlist(get_databases(), (isset($_POST["target"]) ? $_POST["target"] : $_GET["db"])) . "</select> <input type='submit' name='move' value='" . lang('Move') . "' /></p>\n";
+ $db = (isset($_POST["target"]) ? $_POST["target"] : $_GET["db"]);
+ echo "<p>" . lang('Move to other database') . (get_databases() ? ": <select name='target'>" . optionlist(get_databases(), $db) . "</select>" : ': <input name="target" value="' . htmlspecialchars($db) . '" />') . " <input type='submit' name='move' value='" . lang('Move') . "' /></p>\n";
echo "</form>\n";
}
$result->free();

0 comments on commit 49f7886

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