3 // vim: expandtab sw=4 ts=4 sts=4:
7 <form method
="post" action
="<?php echo $action; ?>">
8 <input type
="hidden" name
="server" value
="<?php echo $server; ?>" />
9 <input type
="hidden" name
="lang" value
="<?php echo $lang; ?>" />
10 <input type
="hidden" name
="convcharset" value
="<?php echo $convcharset; ?>" />
11 <input type
="hidden" name
="db" value
="<?php echo htmlspecialchars($db); ?>" />
12 <input type
="hidden" name
="table" value
="<?php echo htmlspecialchars($table); ?>" />
14 if ($action == 'tbl_create.php3') {
16 <input type
="hidden" name
="reload" value
="1" />
19 else if ($action == 'tbl_addfield.php3') {
22 <input type
="hidden" name
="after_field" value
="<?php echo $after_field; ?>" />
26 $is_backup = ($action != 'tbl_create.php3' && $action != 'tbl_addfield.php3');
29 <table border
="<?php echo $cfg['Border']; ?>">
31 <th
><?php
echo $strField; ?
></th
>
32 <th
><?php
echo $strType . '<br /><span style="font-weight: normal">' . PMA_showMySQLDocu('Reference', 'Column_types'); ?
></span
></th
>
33 <th
><?php
echo $strLengthSet; ?
></th
>
34 <th
><?php
echo $strAttr; ?
></th
>
35 <th
><?php
echo $strNull; ?
></th
>
36 <th
><?php
echo $strDefault; ?
></th
>
37 <th
><?php
echo $strExtra; ?
></th
>
39 // lem9: We could remove this 'if' and let the key information be shown and
40 // editable. However, for this to work, tbl_alter must be modified to use the
41 // key fields, as tbl_addfield does.
44 echo " <th>$strPrimary</th>\n";
45 echo " <th>$strIndex</th>\n";
46 echo " <th>$strUnique</th>\n";
47 echo " <th>---</th>\n";
48 echo " <th>$strIdxFulltext</th>\n";
54 for ($i = 0 ; $i < $num_fields; $i++
) {
55 if (isset($fields_meta)) {
56 $row = $fields_meta[$i];
58 $bgcolor = ($i %
2) ?
$cfg['BgcolorOne'] : $cfg['BgcolorTwo'];
61 <td bgcolor
="<?php echo $bgcolor; ?>">
66 <input type
="hidden" name
="field_orig[]" value
="<?php if (isset($row) && isset($row['Field'])) echo urlencode($row['Field']); ?>" />
71 <input type
="text" name
="field_name[]" size
="10" maxlength
="64" value
="<?php if (isset($row) && isset($row['Field'])) echo str_replace('"', '"
;', $row['Field
']); ?>" class="textfield" />
73 <td bgcolor="<?php echo $bgcolor; ?>">
74 <select name="field_type[]">
77 if (empty($row['Type
'])) {
81 else if (get_magic_quotes_gpc()) {
82 $type = stripslashes($row['Type
']);
87 $type = eregi_replace('BINARY
', '', $type);
88 $type = eregi_replace('ZEROFILL
', '', $type);
89 $type = eregi_replace('UNSIGNED
', '', $type);
90 // set or enum types: slashes single quotes inside options
91 if (eregi('^
(set|enum
)\
((.+
)\
)$
', $type, $tmp)) {
93 $length = substr(ereg_replace('([^
,])\'\'', '\\
1\\\'', ',' . $tmp[2]), 1);
96 $type = chop(eregi_replace('\\
(.*\\)', '', $type));
98 $length = eregi_replace("^$type\(", '', $length);
99 $length = eregi_replace('\
)$
', '', trim($length));
101 if ($length == $type) {
106 for ($j = 0; $j < count($cfg['ColumnTypes
']); $j++) {
107 echo ' <option value
="'. $cfg['ColumnTypes'][$j] . '"';
108 if (strtoupper($type) == strtoupper($cfg['ColumnTypes
'][$j])) {
109 echo ' selected
="selected"';
111 echo '>' . $cfg['ColumnTypes
'][$j] . '</option
>' . "\n";
116 <td bgcolor="<?php echo $bgcolor; ?>">
121 <input type="hidden" name="field_length_orig[]" value="<?php echo urlencode($length); ?>" />
126 <input type="text" name="field_length[]" size="8" value="<?php echo str_replace('"', '"', $length); ?>" class="textfield" />
128 <td bgcolor
="<?php echo $bgcolor; ?>">
129 <select name
="field_attribute[]">
132 $binary = eregi('BINARY', $row['Type'], $test_attribute1);
133 $unsigned = eregi('UNSIGNED', $row['Type'], $test_attribute2);
134 $zerofill = eregi('ZEROFILL', $row['Type'], $test_attribute3);
137 $strAttribute = 'BINARY';
140 $strAttribute = 'UNSIGNED';
143 $strAttribute = 'UNSIGNED ZEROFILL';
145 for ($j = 0;$j < count($cfg['AttributeTypes']); $j++
) {
146 echo ' <option value="'. $cfg['AttributeTypes'][$j] . '"';
147 if (strtoupper($strAttribute) == strtoupper($cfg['AttributeTypes'][$j])) {
148 echo ' selected="selected"';
150 echo '>' . $cfg['AttributeTypes'][$j] . '</option>' . "\n";
155 <td bgcolor
="<?php echo $bgcolor; ?>">
156 <select name
="field_null[]">
158 if (!isset($row) ||
empty($row['Null'])) {
161 <option value
="NOT NULL">not
null</option
>
162 <option value
="">null</option
>
167 <option value
="">null</option
>
168 <option value
="NOT NULL">not
null</option
>
177 && !isset($row['Default']) && !empty($row['Null'])) {
178 $row['Default'] = 'NULL';
182 <td bgcolor
="<?php echo $bgcolor; ?>">
187 <input type
="hidden" name
="field_default_orig[]" size
="8" value
="<?php if(isset($row) && isset($row['Default'])) echo urlencode($row['Default']); ?>" />
192 <input type
="text" name
="field_default[]" size
="8" value
="<?php if(isset($row) && isset($row['Default'])) echo str_replace('"', '"
;', $row['Default']); ?>" class="textfield" />
194 <td bgcolor="<?php echo $bgcolor; ?>">
195 <select name="field_extra[]">
197 if(!isset($row) || empty($row['Extra
'])) {
200 <option value=""></option>
201 <option value="AUTO_INCREMENT">auto_increment</option>
206 <option value="AUTO_INCREMENT">auto_increment</option>
207 <option value=""></option>
215 // lem9: See my other comment about removing this 'if'.
217 if (isset($row) && isset($row['Key
']) && $row['Key
'] == 'PRI
') {
218 $checked_primary = ' checked
="checked"';
220 $checked_primary = '';
222 if (isset($row) && isset($row['Key
']) && $row['Key
'] == 'MUL
') {
223 $checked_index = ' checked
="checked"';
227 if (isset($row) && isset($row['Key
']) && $row['Key
'] == 'UNI
') {
228 $checked_unique = ' checked
="checked"';
230 $checked_unique = '';
232 if (empty($checked_primary)
233 && empty($checked_index)
234 && empty($checked_unique)) {
235 $checked_none = ' checked
="checked"';
237 if (PMA_MYSQL_INT_VERSION >= 32323
238 &&(isset($row) && isset($row['Comment
']) && $row['Comment
'] == 'FULLTEXT
')) {
239 $checked_fulltext = ' checked
="checked"';
241 $checked_fulltext = '';
245 <td align="center" bgcolor="<?php echo $bgcolor; ?>">
246 <input type="radio" name="field_key_<?php echo $i; ?>" value="primary_<?php echo $i; ?>"<?php echo $checked_primary; ?> />
248 <td align="center" bgcolor="<?php echo $bgcolor; ?>">
249 <input type="radio" name="field_key_<?php echo $i; ?>" value="index_<?php echo $i; ?>"<?php echo $checked_index; ?> />
251 <td align="center" bgcolor="<?php echo $bgcolor; ?>">
252 <input type="radio" name="field_key_<?php echo $i; ?>" value="unique_<?php echo $i; ?>"<?php echo $checked_unique; ?> />
254 <td align="center" bgcolor="<?php echo $bgcolor; ?>">
255 <input type="radio" name="field_key_<?php echo $i; ?>" value="none_<?php echo $i; ?>"<?php echo $checked_none; ?> />
258 if (PMA_MYSQL_INT_VERSION >= 32323) {
261 <td bgcolor="<?php echo $bgcolor; ?>" nowrap="nowrap">
262 <input type="checkbox" name="field_fulltext[]" value="<?php echo $i; ?>"<?php echo $checked_fulltext; ?> />
265 } // end if (PMA_MYSQL_INT_VERSION >= 32323)
267 } // end if ($action ==...)
279 if ($action == 'tbl_create
.php3
' && PMA_MYSQL_INT_VERSION >= 32300) {
284 <td><?php echo $strTableComments; ?> :</td>
286 if ($action == 'tbl_create
.php3
') {
289 <td width="25"> </td>
290 <td><?php echo $strTableType; ?> :</td>
298 <input type="text" name="comment" size="40" maxlength="80" class="textfield" />
301 // BEGIN - Table Type - 2 May 2001 - Robbat2
302 // change by staybyte - 11 June 2001
303 if ($action == 'tbl_create
.php3
') {
304 // find mysql capability - staybyte - 11. June 2001
305 $query = 'SHOW VARIABLES LIKE \'have_%\'
';
306 $result = PMA_mysql_query($query);
307 if ($result != FALSE && mysql_num_rows($result) > 0) {
308 while ($tmp = PMA_mysql_fetch_array($result)) {
309 if (isset($tmp['Variable_name
'])) {
310 switch ($tmp['Variable_name
']) {
312 if (isset($tmp['Variable_name
']) && $tmp['Value
'] == 'YES
') {
317 if (isset($tmp['Variable_name
']) && $tmp['Value
'] == 'YES
') {
322 if (isset($tmp['Variable_name
']) && $tmp['Value
'] == 'YES
') {
327 if (isset($tmp['Variable_name
']) && $tmp['Value
'] == 'YES
') {
335 mysql_free_result($result);
339 <td width="25"> </td>
341 <select name="tbl_type">
342 <option value="Default"><?php echo $strDefault; ?></option>
343 <option value="MYISAM">MyISAM</option>
344 <option value="HEAP">Heap</option>
345 <option value="MERGE">Merge</option>
346 <?php if (isset($tbl_bdb)) { ?><option value="BDB">Berkeley DB</option><?php } ?>
347 <?php if (isset($tbl_gemini)) { ?><option value="GEMINI">Gemini</option><?php } ?>
348 <?php if (isset($tbl_innodb)) { ?><option value="InnoDB">INNO DB</option><?php } ?>
349 <?php if (isset($tbl_isam)) { ?><option value="ISAM">ISAM</option><?php } ?>
362 // END - Table Type - 2 May 2001 - Robbat2
365 <input type="submit" name="submit" value="<?php echo $strSave; ?>" />
370 <td valign="top">* </td>
372 <?php echo $strSetEnumVal . "\n"; ?>
378 <center><?php echo PMA_showMySQLDocu('Reference
', 'CREATE_TABLE
'); ?></center>