not_vals in optionlist() is always true
git-svn-id: https://adminer.svn.sourceforge.net/svnroot/adminer/trunk@147 7c3ca157-0c34-0410-bff1-cbf682f78f5c
This commit is contained in:
parent
65d2cc3637
commit
61fa06641f
|
@ -86,8 +86,8 @@ $collations = collations();
|
|||
<form action="" method="post" id="form">
|
||||
<p>
|
||||
<?php echo lang('Table name'); ?>: <input name="name" maxlength="64" value="<?php echo htmlspecialchars($row["name"]); ?>" />
|
||||
<select name="Engine"><option value="">(<?php echo lang('engine'); ?>)</option><?php echo optionlist(engines(), $row["Engine"], "not_vals"); ?></select>
|
||||
<select name="Collation"><option value="">(<?php echo lang('collation'); ?>)</option><?php echo optionlist($collations, $row["Collation"], "not_vals"); ?></select>
|
||||
<select name="Engine"><option value="">(<?php echo lang('engine'); ?>)</option><?php echo optionlist(engines(), $row["Engine"]); ?></select>
|
||||
<select name="Collation"><option value="">(<?php echo lang('collation'); ?>)</option><?php echo optionlist($collations, $row["Collation"]); ?></select>
|
||||
<input type="submit" value="<?php echo lang('Save'); ?>" />
|
||||
</p>
|
||||
<table border="0" cellspacing="0" cellpadding="2">
|
||||
|
@ -99,9 +99,9 @@ foreach ($row["fields"] as $i => $field) {
|
|||
?>
|
||||
<tr>
|
||||
<th><input type="hidden" name="fields[<?php echo $i; ?>][orig]" value="<?php echo htmlspecialchars($field[($_POST ? "orig" : "field")]); ?>" /><input name="fields[<?php echo $i; ?>][field]" value="<?php echo htmlspecialchars($field["field"]); ?>" maxlength="64" /></th>
|
||||
<td><select name="fields[<?php echo $i; ?>][type]" onchange="type_change(this);"><?php echo optionlist(array_keys($types), $field["type"], "not_vals"); ?></select></td>
|
||||
<td><select name="fields[<?php echo $i; ?>][type]" onchange="type_change(this);"><?php echo optionlist(array_keys($types), $field["type"]); ?></select></td>
|
||||
<td><input name="fields[<?php echo $i; ?>][length]" value="<?php echo htmlspecialchars($field["length"]); ?>" size="3" /></td>
|
||||
<td><select name="fields[<?php echo $i; ?>][collation]"><option value="">(<?php echo lang('collation'); ?>)</option><?php echo optionlist($collations, $field["collation"], "not_vals"); ?></select> <select name="fields[<?php echo $i; ?>][unsigned]"><?php echo optionlist($unsigned, $field["unsigned"], "not_vals"); ?></select></td>
|
||||
<td><select name="fields[<?php echo $i; ?>][collation]"><option value="">(<?php echo lang('collation'); ?>)</option><?php echo optionlist($collations, $field["collation"]); ?></select> <select name="fields[<?php echo $i; ?>][unsigned]"><?php echo optionlist($unsigned, $field["unsigned"]); ?></select></td>
|
||||
<td><input type="checkbox" name="fields[<?php echo $i; ?>][null]" value="1"<?php if ($field["null"]) { ?> checked="checked"<?php } ?> /></td>
|
||||
<td><input type="radio" name="auto_increment" value="<?php echo $i; ?>"<?php if ($field["auto_increment"]) { ?> checked="checked"<?php } ?> /></td>
|
||||
<td id="comment-<?php echo $i; ?>"><input name="fields[<?php echo $i; ?>][comment]" value="<?php echo htmlspecialchars($field["comment"]); ?>" maxlength="255" /></td>
|
||||
|
|
|
@ -48,7 +48,7 @@ if ($_POST) {
|
|||
<form action="" method="post">
|
||||
<p>
|
||||
<input name="name" value="<?php echo htmlspecialchars($name); ?>" maxlength="64" />
|
||||
<select name="collation"><option value="">(<?php echo lang('collation'); ?>)</option><?php echo optionlist(collations(), $collate, "not_vals"); ?></select>
|
||||
<select name="collation"><option value="">(<?php echo lang('collation'); ?>)</option><?php echo optionlist(collations(), $collate); ?></select>
|
||||
<input type="hidden" name="token" value="<?php echo $token; ?>" />
|
||||
<input type="submit" value="<?php echo lang('Save'); ?>" />
|
||||
<?php if (strlen($_GET["db"])) { ?><input type="submit" name="drop" value="<?php echo lang('Drop'); ?>" /><?php } ?>
|
||||
|
|
|
@ -49,7 +49,7 @@ function page_footer($missing = false) {
|
|||
<select name="db" onchange="this.form.submit();"><option value="">(<?php echo lang('database'); ?>)</option>
|
||||
<?php
|
||||
flush();
|
||||
echo optionlist(get_vals("SHOW DATABASES"), $_GET["db"], "not_vals");
|
||||
echo optionlist(get_vals("SHOW DATABASES"), $_GET["db"]);
|
||||
?>
|
||||
</select><?php if (isset($_GET["sql"])) { ?><input type="hidden" name="sql" value="" /><?php } ?></p>
|
||||
<noscript><p><input type="submit" value="<?php echo lang('Use'); ?>" /></p></noscript>
|
||||
|
|
|
@ -12,15 +12,15 @@ function bracket_escape($idf, $back = false) {
|
|||
return strtr($idf, ($back ? array_flip($trans) : $trans));
|
||||
}
|
||||
|
||||
function optionlist($options, $selected = array(), $not_vals = false) {
|
||||
function optionlist($options, $selected = array()) {
|
||||
$return = "";
|
||||
foreach ($options as $k => $v) {
|
||||
if (is_array($v)) {
|
||||
$return .= '<optgroup label="' . htmlspecialchars($k) . '">';
|
||||
}
|
||||
foreach ((is_array($v) ? $v : array($k => $v)) as $key => $val) {
|
||||
$checked = in_array(($not_vals ? $val : $key), (array) $selected, true);
|
||||
$return .= '<option' . ($not_vals ? '' : ' value="' . htmlspecialchars($key) . '"') . ($checked ? ' selected="selected"' : '') . '>' . htmlspecialchars($val) . '</option>';
|
||||
$checked = in_array($val, (array) $selected, true);
|
||||
$return .= '<option' . ($checked ? ' selected="selected"' : '') . '>' . htmlspecialchars($val) . '</option>';
|
||||
}
|
||||
if (is_array($v)) {
|
||||
$return .= '</optgroup>';
|
||||
|
|
|
@ -50,14 +50,14 @@ if ($_POST) {
|
|||
$j = 0;
|
||||
foreach ($row["indexes"] as $index) {
|
||||
if ($index["type"] || array_filter($index["columns"], 'strlen')) {
|
||||
echo "<tr><td><select name='indexes[$j][type]'><option></option>" . optionlist($index_types, $index["type"], "not_vals") . "</select></td><td>";
|
||||
echo "<tr><td><select name='indexes[$j][type]'><option></option>" . optionlist($index_types, $index["type"]) . "</select></td><td>";
|
||||
ksort($index["columns"]);
|
||||
foreach ($index["columns"] as $i => $column) {
|
||||
if (strlen($column)) {
|
||||
echo "<select name='indexes[$j][columns][$i]'><option></option>" . optionlist($fields, $column, "not_vals") . "</select>";
|
||||
echo "<select name='indexes[$j][columns][$i]'><option></option>" . optionlist($fields, $column) . "</select>";
|
||||
}
|
||||
}
|
||||
echo "<select name='indexes[$j][columns][" . ($i+1) . "]'><option></option>" . optionlist($fields, array(), "not_vals") . "</select>";
|
||||
echo "<select name='indexes[$j][columns][" . ($i+1) . "]'><option></option>" . optionlist($fields, array()) . "</select>";
|
||||
//! indexes from substring
|
||||
echo "</td></tr>\n";
|
||||
$j++;
|
||||
|
@ -65,7 +65,7 @@ foreach ($row["indexes"] as $index) {
|
|||
}
|
||||
//! JavaScript for adding more indexes and columns
|
||||
?>
|
||||
<tr><td><select name="indexes[<?php echo $j; ?>][type]"><option></option><?php echo optionlist($index_types, array(), "not_vals"); ?></select></td><td><select name="indexes[<?php echo $j; ?>][columns][1]"><option></option><?php echo optionlist($fields, array(), "not_vals"); ?></select></td></tr>
|
||||
<tr><td><select name="indexes[<?php echo $j; ?>][type]"><option></option><?php echo optionlist($index_types, array()); ?></select></td><td><select name="indexes[<?php echo $j; ?>][columns][1]"><option></option><?php echo optionlist($fields, array()); ?></select></td></tr>
|
||||
</table>
|
||||
<p>
|
||||
<input type="hidden" name="token" value="<?php echo $token; ?>" />
|
||||
|
|
|
@ -43,8 +43,8 @@ if (!$columns) {
|
|||
foreach ((array) $_GET["where"] as $val) {
|
||||
if (strlen($val["col"]) && in_array($val["op"], $operators)) {
|
||||
$where[] = idf_escape($val["col"]) . " $val[op]" . ($val["op"] != "IS NULL" ? " '" . $mysql->escape_string($val["val"]) . "'" : "");
|
||||
echo "<div><select name='where[$i][col]'><option></option>" . optionlist($columns, $val["col"], "not_vals") . "</select>";
|
||||
echo "<select name='where[$i][op]' onchange=\"where_change(this);\">" . optionlist($operators, $val["op"], "not_vals") . "</select>";
|
||||
echo "<div><select name='where[$i][col]'><option></option>" . optionlist($columns, $val["col"]) . "</select>";
|
||||
echo "<select name='where[$i][op]' onchange=\"where_change(this);\">" . optionlist($operators, $val["op"]) . "</select>";
|
||||
echo "<input name='where[$i][val]' value=\"" . htmlspecialchars($val["val"]) . "\" /></div>\n";
|
||||
$i++;
|
||||
}
|
||||
|
@ -61,8 +61,8 @@ for (var i=0; <?php echo $i; ?> > i; i++) {
|
|||
<?php } ?>
|
||||
</script>
|
||||
<?php
|
||||
echo "<div><select name='where[$i][col]'><option></option>" . optionlist($columns, array(), "not_vals") . "</select>";
|
||||
echo "<select name='where[$i][op]' onchange=\"where_change(this);\">" . optionlist($operators, array(), "not_vals") . "</select>";
|
||||
echo "<div><select name='where[$i][col]'><option></option>" . optionlist($columns, array()) . "</select>";
|
||||
echo "<select name='where[$i][op]' onchange=\"where_change(this);\">" . optionlist($operators, array()) . "</select>";
|
||||
echo "<input name='where[$i][val]' /></div>\n"; //! JavaScript for adding next
|
||||
echo "</fieldset>\n";
|
||||
|
||||
|
@ -72,12 +72,12 @@ for (var i=0; <?php echo $i; ?> > i; i++) {
|
|||
foreach ((array) $_GET["order"] as $key => $val) {
|
||||
if (in_array($val, $columns, true)) {
|
||||
$order[] = idf_escape($val) . (isset($_GET["desc"][$key]) ? " DESC" : "");
|
||||
echo "<div><select name='order[$i]'><option></option>" . optionlist($columns, $val, "not_vals") . "</select>";
|
||||
echo "<div><select name='order[$i]'><option></option>" . optionlist($columns, $val) . "</select>";
|
||||
echo "<label for='desc-$i'><input type='checkbox' name='desc[$i]' value='1' id='desc-$i'" . (isset($_GET["desc"][$key]) ? " checked='checked'" : "") . " />" . lang('DESC') . "</label></div>\n";
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
echo "<div><select name='order[$i]'><option></option>" . optionlist($columns, array(), "not_vals") . "</select>";
|
||||
echo "<div><select name='order[$i]'><option></option>" . optionlist($columns, array()) . "</select>";
|
||||
echo "<label for='desc-$i'><input type='checkbox' name='desc[$i]' value='1' id='desc-$i' />" . lang('DESC') . "</label></div>\n";
|
||||
echo "</fieldset>\n";
|
||||
|
||||
|
|
Loading…
Reference in a new issue