mirror of
https://github.com/vrana/adminer.git
synced 2026-01-04 14:50:56 +01:00
Suhosin compatibility (thanks to Klemens Hackel)
git-svn-id: https://adminer.svn.sourceforge.net/svnroot/adminer/trunk@559 7c3ca157-0c34-0410-bff1-cbf682f78f5c
This commit is contained in:
@@ -106,6 +106,11 @@ if ($_POST) {
|
||||
$row = array("fields" => array(array("field" => "")), "partition_names" => array());
|
||||
}
|
||||
$collations = collations();
|
||||
|
||||
$suhosin = floor(extension_loaded("suhosin") ? (min(ini_get("suhosin.request.max_vars"), ini_get("suhosin.post.max_vars")) - 13) / 8 : 0);
|
||||
if ($suhosin && count($row["fields"]) > $suhosin) {
|
||||
echo "<p class='error'>" . htmlspecialchars(lang('Maximum number of allowed fields exceeded. Please increase %s and %s.', 'suhosin.post.max_vars', 'suhosin.request.max_vars')) . "</p>\n";
|
||||
}
|
||||
?>
|
||||
|
||||
<form action="" method="post" id="form">
|
||||
@@ -118,7 +123,7 @@ $collations = collations();
|
||||
<table border="0" cellspacing="0" cellpadding="2">
|
||||
<?php $column_comments = edit_fields($row["fields"], $collations); ?>
|
||||
</table>
|
||||
<?php echo type_change(count($row["fields"])); ?>
|
||||
<?php echo type_change(count($row["fields"]), $suhosin); ?>
|
||||
<p>
|
||||
<?php echo lang('Auto Increment'); ?>: <input name="Auto_increment" size="4" value="<?php echo intval($row["Auto_increment"]); ?>" />
|
||||
<?php echo lang('Comment'); ?>: <input name="Comment" value="<?php echo htmlspecialchars($row["Comment"]); ?>" maxlength="60" />
|
||||
|
||||
@@ -90,7 +90,7 @@ function edit_type($key, $field, $collations) {
|
||||
?>
|
||||
<td><select name="<?php echo $key; ?>[type]" onchange="type_change(this);"><?php echo optionlist(array_keys($types), $field["type"]); ?></select></td>
|
||||
<td><input name="<?php echo $key; ?>[length]" value="<?php echo htmlspecialchars($field["length"]); ?>" size="3" /></td>
|
||||
<td><select name="<?php echo $key; ?>[collation]"><option value="">(<?php echo lang('collation'); ?>)</option><?php echo optionlist($collations, $field["collation"]); ?></select> <select name="<?php echo $key; ?>[unsigned]"><?php echo optionlist($unsigned, $field["unsigned"]); ?></select></td>
|
||||
<td><select name="<?php echo $key; ?>[collation]"<?php echo (preg_match('~char|text|enum|set~', $field["type"]) ? "" : " class='hidden'"); ?>><option value="">(<?php echo lang('collation'); ?>)</option><?php echo optionlist($collations, $field["collation"]); ?></select> <select name="<?php echo $key; ?>[unsigned]"<?php echo (!$field["type"] || preg_match('~int|float|double|decimal~', $field["type"]) ? "" : " class='hidden'"); ?>><?php echo optionlist($unsigned, $field["unsigned"]); ?></select></td>
|
||||
<?php
|
||||
}
|
||||
|
||||
@@ -186,11 +186,15 @@ function process_fields(&$fields) {
|
||||
}
|
||||
}
|
||||
|
||||
function type_change($count) {
|
||||
function type_change($count, $allowed = 0) {
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
<script type="text/javascript">// <![CDATA[
|
||||
var added = '.';
|
||||
var row_count = <?php echo $count; ?>;
|
||||
function add_row(button) {
|
||||
if (<?php echo $allowed; ?> && row_count >= <?php echo $allowed; ?>) {
|
||||
return false;
|
||||
}
|
||||
var match = /([0-9]+)(\.[0-9]+)?/.exec(button.name)
|
||||
var x = match[0] + (match[2] ? added.substr(match[2].length) : added) + '1';
|
||||
var row = button.parentNode.parentNode;
|
||||
@@ -215,6 +219,7 @@ function add_row(button) {
|
||||
row.parentNode.insertBefore(row2, row);
|
||||
tags[0].focus();
|
||||
added += '0';
|
||||
row_count++;
|
||||
return true;
|
||||
}
|
||||
function remove_row(button) {
|
||||
@@ -235,10 +240,7 @@ function type_change(type) {
|
||||
}
|
||||
}
|
||||
}
|
||||
for (var i=1; <?php echo $count; ?> >= i; i++) {
|
||||
document.getElementById('form')['fields[' + i + '][type]'].onchange();
|
||||
}
|
||||
</script>
|
||||
// ]]></script>
|
||||
<?php
|
||||
}
|
||||
|
||||
|
||||
@@ -214,4 +214,6 @@ $translations = array(
|
||||
'Table structure' => 'Struktura tabulky',
|
||||
'Select table' => 'Vypsat tabulku',
|
||||
'Stop on error' => 'Zastavit při chybě',
|
||||
'Maximum number of allowed fields exceeded. Please increase %s and %s.' => 'Byl překročen maximální povolený počet polí. Zvyšte prosím %s a %s.',
|
||||
'(anywhere)' => '(kdekoliv)',
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user