Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

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...
commit 49f7886f41d9780b54da439c999cfeaa5ec5ae3e 1 parent 766caa4
jakubvrana authored

Showing 3 changed files with 15 additions and 10 deletions. Show diff stats Hide diff stats

  1. +7 5 design.inc.php
  2. +6 4 functions.inc.php
  3. +2 1  index.php
12 design.inc.php
@@ -76,16 +76,18 @@ function page_footer($missing = false) {
76 76 </form>
77 77 <form action="">
78 78 <p><?php if (strlen($_GET["server"])) { ?><input type="hidden" name="server" value="<?php echo htmlspecialchars($_GET["server"]); ?>" /><?php } ?>
79   -<select name="db" onchange="this.form.submit();"><option value="">(<?php echo lang('database'); ?>)</option>
80   -<?php
81   - echo optionlist(get_databases(), $_GET["db"]);
82   - ?>
83   -</select>
  79 +<?php if (get_databases()) { ?>
  80 +<select name="db" onchange="this.form.submit();"><option value="">(<?php echo lang('database'); ?>)</option><?php echo optionlist(get_databases(), $_GET["db"]); ?></select>
  81 +<?php } else { ?>
  82 +<input name="db" value="<?php echo htmlspecialchars($_GET["db"]); ?>" /> <input type="submit" value="<?php echo lang('Use'); ?>" />
  83 +<?php } ?>
84 84 <?php if (isset($_GET["sql"])) { ?><input type="hidden" name="sql" value="" /><?php } ?>
85 85 <?php if (isset($_GET["schema"])) { ?><input type="hidden" name="schema" value="" /><?php } ?>
86 86 <?php if (isset($_GET["dump"])) { ?><input type="hidden" name="dump" value="" /><?php } ?>
87 87 </p>
  88 +<?php if (get_databases()) { ?>
88 89 <noscript><p><input type="submit" value="<?php echo lang('Use'); ?>" /></p></noscript>
  90 +<?php } ?>
89 91 </form>
90 92 <?php
91 93 if ($missing != "db" && strlen($_GET["db"])) {
10 functions.inc.php
@@ -31,12 +31,14 @@ function optionlist($options, $selected = array()) {
31 31
32 32 function get_vals($query) {
33 33 global $mysql;
34   - $result = $mysql->query($query);
35 34 $return = array();
36   - while ($row = $result->fetch_row()) {
37   - $return[] = $row[0];
  35 + $result = $mysql->query($query);
  36 + if ($result) {
  37 + while ($row = $result->fetch_row()) {
  38 + $return[] = $row[0];
  39 + }
  40 + $result->free();
38 41 }
39   - $result->free();
40 42 return $return;
41 43 }
42 44
3  index.php
@@ -166,7 +166,8 @@
166 166 }
167 167 echo "</table>\n";
168 168 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";
169   - 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";
  169 + $db = (isset($_POST["target"]) ? $_POST["target"] : $_GET["db"]);
  170 + 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";
170 171 echo "</form>\n";
171 172 }
172 173 $result->free();

0 comments on commit 49f7886

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