mirror of
https://github.com/vrana/adminer.git
synced 2025-08-11 17:14:07 +02:00
Create information_schema function
git-svn-id: https://adminer.svn.sourceforge.net/svnroot/adminer/trunk@751 7c3ca157-0c34-0410-bff1-cbf682f78f5c
This commit is contained in:
@@ -196,7 +196,7 @@ if (strlen($_GET["db"])) {
|
||||
} else {
|
||||
echo "<thead><tr><th align='left'><label><input type='checkbox' id='check-databases' checked='checked' onclick='form_check(this, /^databases\\[/);' />" . lang('Database') . "</label></th></tr></thead>\n";
|
||||
foreach (get_databases() as $db) {
|
||||
if ($db != "information_schema" || $dbh->server_info < 5) {
|
||||
if (!information_schema($db)) {
|
||||
echo '<tr><td><label><input type="checkbox" name="databases[]" value="' . htmlspecialchars($db) . '" checked="checked" onclick="form_uncheck(\'check-databases\');" />' . htmlspecialchars($db) . "</label></td></tr>\n";
|
||||
}
|
||||
}
|
||||
|
@@ -331,3 +331,8 @@ function table_comment(&$row) {
|
||||
$row["Comment"] = preg_replace('~(?:(.+); )?InnoDB free: .*~', '\\1', $row["Comment"]);
|
||||
}
|
||||
}
|
||||
|
||||
function information_schema($db) {
|
||||
global $dbh;
|
||||
return ($dbh->server_info >= 5 && $db == "information_schema");
|
||||
}
|
||||
|
@@ -79,7 +79,6 @@ if ($_POST && !$error) {
|
||||
// where may not be unique so OR can't be used
|
||||
$union[] = "(SELECT $from " . ($where ? "AND " : "WHERE ") . implode(" AND ", where_check($val)) . $group_by . " LIMIT 1)";
|
||||
}
|
||||
print_r($union);
|
||||
dump_data($_GET["select"], "INSERT", implode(" UNION ALL ", $union));
|
||||
} else {
|
||||
dump_data($_GET["select"], "INSERT", "SELECT $from$group_by");
|
||||
@@ -256,7 +255,7 @@ if (!$columns) {
|
||||
echo "</tr></thead>\n";
|
||||
}
|
||||
$unique_idf = implode('&', unique_idf($row, $indexes)); //! don't use aggregation functions
|
||||
echo '<tr' . odd() . '><td><input type="checkbox" name="check[]" value="' . $unique_idf . '" onclick="this.form[\'all\'].checked = false; form_uncheck(\'all-page\');" />' . (count($select) == count($group) && $_GET["db"] != "information_schema" ? ' <a href="' . htmlspecialchars($SELF) . 'edit=' . urlencode($_GET['select']) . '&' . $unique_idf . '">' . lang('edit') . '</a></td>' : '');
|
||||
echo '<tr' . odd() . '><td><input type="checkbox" name="check[]" value="' . $unique_idf . '" onclick="this.form[\'all\'].checked = false; form_uncheck(\'all-page\');" />' . (count($select) != count($group) || information_schema($_GET["db"]) ? '' : ' <a href="' . htmlspecialchars($SELF) . 'edit=' . urlencode($_GET['select']) . '&' . $unique_idf . '">' . lang('edit') . '</a>') . '</td>';
|
||||
foreach ($row as $key => $val) {
|
||||
if (!isset($val)) {
|
||||
$val = "<i>NULL</i>";
|
||||
@@ -315,7 +314,7 @@ if (!$columns) {
|
||||
}
|
||||
echo " (" . lang('%d row(s)', $found_rows) . ') <label><input type="checkbox" name="all" value="1" />' . lang('whole result') . "</label></p>\n";
|
||||
|
||||
echo ($_GET["db"] != "information_schema" ? "<fieldset><legend>" . lang('Edit') . "</legend><div><input type='submit' value='" . lang('Edit') . "' /> <input type='submit' name='clone' value='" . lang('Clone') . "' /> <input type='submit' name='delete' value='" . lang('Delete') . "'$confirm /></div></fieldset>\n" : "");
|
||||
echo (information_schema($_GET["db"]) ? "" : "<fieldset><legend>" . lang('Edit') . "</legend><div><input type='submit' value='" . lang('Edit') . "' /> <input type='submit' name='clone' value='" . lang('Clone') . "' /> <input type='submit' name='delete' value='" . lang('Delete') . "'$confirm /></div></fieldset>\n");
|
||||
echo "<fieldset><legend>" . lang('Export') . "</legend><div>$dump_output $dump_format <input type='submit' name='export' value='" . lang('Export') . "' /></div></fieldset>\n";
|
||||
}
|
||||
$result->free();
|
||||
|
@@ -35,7 +35,7 @@ if ($_POST) {
|
||||
}
|
||||
$grants = array();
|
||||
$old_pass = "";
|
||||
if (isset($_GET["host"]) && ($result = $dbh->query("SHOW GRANTS FOR " . $dbh->quote($_GET["user"]) . "@" . $dbh->quote($_GET["host"])))) { //! Use information_schema for MySQL 5 - column names in column privileges are not escaped
|
||||
if (isset($_GET["host"]) && ($result = $dbh->query("SHOW GRANTS FOR " . $dbh->quote($_GET["user"]) . "@" . $dbh->quote($_GET["host"])))) { //! use information_schema for MySQL 5 - column names in column privileges are not escaped
|
||||
while ($row = $result->fetch_row()) {
|
||||
if (preg_match('~GRANT (.*) ON (.*) TO ~', $row[0], $match) && preg_match_all('~ *([^(,]*[^ ,(])( *\\([^)]+\\))?~', $match[1], $matches, PREG_SET_ORDER)) { //! escape the part between ON and TO
|
||||
foreach ($matches as $val) {
|
||||
|
Reference in New Issue
Block a user