$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">
<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" />
?>
<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
}
}
}
-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;
row.parentNode.insertBefore(row2, row);
tags[0].focus();
added += '0';
+ row_count++;
return true;
}
function remove_row(button) {
}
}
}
-for (var i=1; <?php echo $count; ?> >= i; i++) {
- document.getElementById('form')['fields[' + i + '][type]'].onchange();
-}
-</script>
+// ]]></script>
<?php
}
'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)',
);