Ignore tables and fields with empty name
git-svn-id: https://adminer.svn.sourceforge.net/svnroot/adminer/trunk@861 7c3ca157-0c34-0410-bff1-cbf682f78f5c
This commit is contained in:
parent
2faa08cd15
commit
116c873671
|
@ -3,7 +3,7 @@ $where = (isset($_GET["select"]) ? (count($_POST["check"]) == 1 ? where_check($_
|
||||||
$update = ($where && !$_POST["clone"]);
|
$update = ($where && !$_POST["clone"]);
|
||||||
$fields = fields($_GET["edit"]);
|
$fields = fields($_GET["edit"]);
|
||||||
foreach ($fields as $name => $field) {
|
foreach ($fields as $name => $field) {
|
||||||
if (isset($_GET["default"]) ? $field["auto_increment"] || ereg('text|blob', $field["type"]) : !isset($field["privileges"][$update ? "update" : "insert"])) {
|
if ((isset($_GET["default"]) ? $field["auto_increment"] || ereg('text|blob', $field["type"]) : !isset($field["privileges"][$update ? "update" : "insert"])) || !strlen(adminer_field_name($fields, $name))) {
|
||||||
unset($fields[$name]);
|
unset($fields[$name]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,8 +18,9 @@ $rights = array(); // privilege => 0
|
||||||
$columns = array(); // selectable columns
|
$columns = array(); // selectable columns
|
||||||
unset($text_length);
|
unset($text_length);
|
||||||
foreach ($fields as $key => $field) {
|
foreach ($fields as $key => $field) {
|
||||||
if (isset($field["privileges"]["select"])) {
|
$name = adminer_field_name($fields, $key);
|
||||||
$columns[$key] = html_entity_decode(strip_tags(adminer_field_name($fields, $key))); //! numeric $key is problematic in optionlist()
|
if (isset($field["privileges"]["select"]) && strlen($name)) {
|
||||||
|
$columns[$key] = html_entity_decode(strip_tags($name)); //! numeric $key is problematic in optionlist()
|
||||||
if (ereg('text|blob', $field["type"])) {
|
if (ereg('text|blob', $field["type"])) {
|
||||||
$text_length = (isset($_GET["text_length"]) ? $_GET["text_length"] : "100");
|
$text_length = (isset($_GET["text_length"]) ? $_GET["text_length"] : "100");
|
||||||
}
|
}
|
||||||
|
@ -304,13 +305,17 @@ if (!$columns) {
|
||||||
echo "<table cellspacing='0' class='nowrap'>\n";
|
echo "<table cellspacing='0' class='nowrap'>\n";
|
||||||
echo "<thead><tr><td><input type='checkbox' id='all-page' onclick='form_check(this, /check/);'>";
|
echo "<thead><tr><td><input type='checkbox' id='all-page' onclick='form_check(this, /check/);'>";
|
||||||
foreach ($rows[0] as $key => $val) {
|
foreach ($rows[0] as $key => $val) {
|
||||||
echo '<th><a href="' . htmlspecialchars(remove_from_uri('(order|desc)[^=]*') . '&order%5B0%5D=' . urlencode($key) . ($_GET["order"] == array($key) && !$_GET["desc"][0] ? '&desc%5B0%5D=1' : '')) . '">' . adminer_field_name($fields, $key) . '</a>';
|
$name = adminer_field_name($fields, $key);
|
||||||
|
if (strlen($name)) {
|
||||||
|
echo '<th><a href="' . htmlspecialchars(remove_from_uri('(order|desc)[^=]*') . '&order%5B0%5D=' . urlencode($key) . ($_GET["order"] == array($key) && !$_GET["desc"][0] ? '&desc%5B0%5D=1' : '')) . "\">$name</a>";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
echo ($backward_keys ? "<th>" . lang('Relations') : "") . "</thead>\n";
|
echo ($backward_keys ? "<th>" . lang('Relations') : "") . "</thead>\n";
|
||||||
foreach ($descriptions as $n => $row) {
|
foreach ($descriptions as $n => $row) {
|
||||||
$unique_idf = implode('&', unique_idf($row, $indexes)); //! don't use aggregation functions
|
$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) || information_schema($_GET["db"]) ? '' : ' <a href="' . htmlspecialchars($SELF) . 'edit=' . urlencode($_GET['select']) . '&' . $unique_idf . '">' . lang('edit') . '</a>');
|
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>');
|
||||||
foreach ($row as $key => $val) {
|
foreach ($row as $key => $val) {
|
||||||
|
if (strlen(adminer_field_name($fields, $key))) {
|
||||||
if (strlen($val) && (!isset($email_fields[$key]) || $email_fields[$key])) {
|
if (strlen($val) && (!isset($email_fields[$key]) || $email_fields[$key])) {
|
||||||
$email_fields[$key] = is_email($val); //! filled e-mails may be contained on other pages
|
$email_fields[$key] = is_email($val); //! filled e-mails may be contained on other pages
|
||||||
}
|
}
|
||||||
|
@ -345,6 +350,7 @@ if (!$columns) {
|
||||||
}
|
}
|
||||||
echo "<td>$val";
|
echo "<td>$val";
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if ($backward_keys) {
|
if ($backward_keys) {
|
||||||
echo "<td>";
|
echo "<td>";
|
||||||
foreach ($backward_keys as $table => $keys) {
|
foreach ($backward_keys as $table => $keys) {
|
||||||
|
|
|
@ -108,8 +108,9 @@ function adminer_navigation($missing) {
|
||||||
} else {
|
} else {
|
||||||
echo "<p>\n";
|
echo "<p>\n";
|
||||||
foreach ($table_status as $row) {
|
foreach ($table_status as $row) {
|
||||||
if (isset($row["Engine"])) { // ignore views
|
$name = adminer_table_name($row);
|
||||||
echo '<a href="' . htmlspecialchars($SELF) . 'select=' . urlencode($row["Name"]) . '">' . adminer_table_name($row) . "</a><br>\n";
|
if (isset($row["Engine"]) && strlen($name)) { // ignore views and tables without name
|
||||||
|
echo '<a href="' . htmlspecialchars($SELF) . 'select=' . urlencode($row["Name"]) . "\">$name</a><br>\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,6 @@ $translations = array(
|
||||||
'Invalid credentials.' => 'Neplatné přihlašovací údaje.',
|
'Invalid credentials.' => 'Neplatné přihlašovací údaje.',
|
||||||
'Server' => 'Server',
|
'Server' => 'Server',
|
||||||
'Save' => 'Uložit',
|
'Save' => 'Uložit',
|
||||||
'SQL command' => 'SQL příkaz',
|
|
||||||
'Logout' => 'Odhlásit',
|
'Logout' => 'Odhlásit',
|
||||||
'Use' => 'Vybrat',
|
'Use' => 'Vybrat',
|
||||||
'No tables.' => 'Žádné tabulky.',
|
'No tables.' => 'Žádné tabulky.',
|
||||||
|
@ -53,7 +52,6 @@ $translations = array(
|
||||||
'%d row(s) has been imported.' => array('Byl importován %d záznam.', 'Byly importovány %d záznamy.', 'Bylo importováno %d záznamů.'),
|
'%d row(s) has been imported.' => array('Byl importován %d záznam.', 'Byly importovány %d záznamy.', 'Bylo importováno %d záznamů.'),
|
||||||
'CSV Import' => 'Import CSV',
|
'CSV Import' => 'Import CSV',
|
||||||
'Import' => 'Import',
|
'Import' => 'Import',
|
||||||
'Table structure' => 'Struktura tabulky',
|
|
||||||
'(anywhere)' => '(kdekoliv)',
|
'(anywhere)' => '(kdekoliv)',
|
||||||
'Editor' => 'Editor',
|
'Editor' => 'Editor',
|
||||||
'E-mail' => 'E-mail',
|
'E-mail' => 'E-mail',
|
||||||
|
@ -61,4 +59,11 @@ $translations = array(
|
||||||
'Subject' => 'Předmět',
|
'Subject' => 'Předmět',
|
||||||
'Send' => 'Odeslat',
|
'Send' => 'Odeslat',
|
||||||
'%d e-mail(s) have been sent.' => array('Byl odeslán %d e-mail.', 'Byly odeslány %d e-maily.', 'Bylo odesláno %d e-mailů.'),
|
'%d e-mail(s) have been sent.' => array('Byl odeslán %d e-mail.', 'Byly odeslány %d e-maily.', 'Bylo odesláno %d e-mailů.'),
|
||||||
|
'Relations' => 'Vztahy',
|
||||||
|
'Maximum allowed file size is %sB.' => 'Maximální povolená velikost souboru je %sB.',
|
||||||
|
'Username' => 'Uživatel',
|
||||||
|
'Password' => 'Heslo',
|
||||||
|
'Logout successful.' => 'Odhlášení proběhlo v pořádku.',
|
||||||
|
'Sessions must be enabled.' => 'Session proměnné musí být povolené.',
|
||||||
|
'Session expired, please login again.' => 'Session vypršela, přihlašte se prosím znovu.',
|
||||||
);
|
);
|
||||||
|
|
|
@ -23,6 +23,14 @@ class Adminer {
|
||||||
return ($login == 'admin');
|
return ($login == 'admin');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function table_name($row) {
|
||||||
|
return htmlspecialchars($row["Comment"]);
|
||||||
|
}
|
||||||
|
|
||||||
|
function field_name($fields, $key) {
|
||||||
|
return htmlspecialchars($fields[$key]["comment"]);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
include "./editor.php";
|
include "./editor.php";
|
||||||
|
|
Loading…
Reference in a new issue