path disclosure
[phpmyadmin/crack.git] / tbl_properties.inc.php3
blob5a805d33ed71d81852a0e9fb0bf9505fab6a1570
1 <?php
2 /* $Id$ */
3 // vim: expandtab sw=4 ts=4 sts=4:
6 // Get available character sets (MySQL >= 4.1)
7 if (PMA_MYSQL_INT_VERSION >= 40100 && !defined('PMA_MYSQL_CHARSETS_LIB_INCLUDED')) {
8 include('./libraries/mysql_charsets.lib.php3');
12 <?php if ($cfg['CtrlArrowsMoving']) { ?>
13 <!-- Set on key handler for moving using by Ctrl+arrows -->
14 <script type="text/javascript" language="javascript">
15 <!--
16 document.onkeydown = onKeyDownArrowsHandler;
17 // -->
18 </script>
19 <?php } ?>
21 <form method="post" action="<?php echo $action; ?>" onsubmit="return checkTableEditForm(this, <?php echo $num_fields; ?>)" >
22 <?php
23 echo PMA_generate_common_hidden_inputs($db, $table);
24 if ($action == 'tbl_create.php3') {
26 <input type="hidden" name="reload" value="1" />
27 <?php
29 else if ($action == 'tbl_addfield.php3') {
30 echo "\n";
32 <input type="hidden" name="after_field" value="<?php echo $after_field; ?>" />
33 <?php
35 echo "\n";
37 if (isset($num_fields)) {
39 <input type="hidden" name="orig_num_fields" value="<?php echo $num_fields; ?>" />
40 <?php
43 if (isset($after_field)) {
45 <input type="hidden" name="orig_after_field" value="<?php echo $after_field; ?>" />
46 <?php
49 if (isset($selected) && is_array($selected)) {
50 @reset($selected);
51 while(list($o_fld_nr, $o_fld_val) = each($selected)) {
53 <input type="hidden" name="selected[<?php echo $o_fld_nr; ?>]" value="<?php echo urlencode($o_fld_val); ?>" />
54 <?php
55 if (!isset($true_selected)) {
57 <input type="hidden" name="true_selected[<?php echo $o_fld_nr; ?>]" value="<?php echo urlencode($o_fld_val); ?>" />
58 <?php
63 if (isset($true_selected) && is_array($true_selected)) {
64 @reset($true_selected);
65 while(list($o_fld_nr, $o_fld_val) = each($true_selected)) {
67 <input type="hidden" name="true_selected[<?php echo $o_fld_nr; ?>]" value="<?php echo urlencode($o_fld_val); ?>" />
68 <?php
72 } elseif (isset($field)) {
74 <input type="hidden" name="orig_field" value="<?php echo urlencode($field); ?>" />
75 <input type="hidden" name="true_selected[] value="<?php echo (isset($orig_field) ? $orig_field : urlencode($field)); ?>" />
76 <?php
79 $is_backup = ($action != 'tbl_create.php3' && $action != 'tbl_addfield.php3');
81 $header_cells = array();
82 $content_cells = array();
84 $header_cells[] = $strField;
85 $header_cells[] = $strType . '<br /><span style="font-weight: normal">' . PMA_showMySQLDocu('Reference', 'Column_types') . '</span>';
86 $header_cells[] = $strLengthSet;
87 if (PMA_MYSQL_INT_VERSION >= 40100) {
88 $header_cells[] = $strCharset;
90 $header_cells[] = $strAttr;
91 $header_cells[] = $strNull;
92 $header_cells[] = $strDefault . '**';
93 $header_cells[] = $strExtra;
95 require('./libraries/relation.lib.php3');
96 require('./libraries/transformations.lib.php3');
97 $cfgRelation = PMA_getRelationsParam();
99 $comments_map = array();
100 $mime_map = array();
101 $available_mime = array();
103 if ($cfgRelation['commwork']) {
104 $comments_map = PMA_getComments($db, $table);
105 $header_cells[] = $strComments;
107 if ($cfgRelation['mimework'] && $cfg['BrowseMIME']) {
108 $mime_map = PMA_getMIME($db, $table);
109 $available_mime = PMA_getAvailableMIMEtypes();
111 $header_cells[] = $strMIME_MIMEtype;
112 $header_cells[] = $strMIME_transformation;
113 $header_cells[] = $strMIME_transformation_options . '***';
118 // lem9: We could remove this 'if' and let the key information be shown and
119 // editable. However, for this to work, tbl_alter must be modified to use the
120 // key fields, as tbl_addfield does.
122 if (!$is_backup) {
123 $header_cells[] = $strPrimary;
124 $header_cells[] = $strIndex;
125 $header_cells[] = $strUnique;
126 $header_cells[] = '---';
127 $header_cells[] = $strIdxFulltext;
130 // garvin: workaround for field_fulltext, because its submitted indizes contain
131 // the index as a value, not a key. Inserted here for easier maintaineance
132 // and less code to change in existing files.
133 if (isset($field_fulltext) && is_array($field_fulltext)) {
134 @reset($field_fulltext);
135 while(list($fulltext_nr, $fulltext_indexkey) = each($field_fulltext)) {
136 $submit_fulltext[$fulltext_indexkey] = $fulltext_indexkey;
140 for ($i = 0 ; $i < $num_fields; $i++) {
141 $submit_null = FALSE;
142 if (isset($regenerate) && $regenerate == TRUE) {
143 // An error happened with previous inputs, so we will restore the data
144 // to embed it once again in this form.
146 $row['Field'] = (isset($field_name) && isset($field_name[$i]) ? $field_name[$i] : FALSE);
147 $row['Type'] = (isset($field_type) && isset($field_type[$i]) ? $field_type[$i] : FALSE);
148 $row['Null'] = (isset($field_null) && isset($field_null[$i]) ? $field_null[$i] : '');
149 if ($row['Null'] == '') {
150 $submit_null = TRUE;
153 if (isset(${'field_key_' . $i}) && ${'field_key_' . $i} == 'primary_' . $i) {
154 $row['Key'] = 'PRI';
155 } elseif (isset(${'field_key_' . $i}) && ${'field_key_' . $i} == 'index_' . $i) {
156 $row['Key'] = 'MUL';
157 } elseif (isset(${'field_key_' . $i}) && ${'field_key_' . $i} == 'unique_' . $i) {
158 $row['Key'] = 'UNI';
159 } else {
160 $row['Key'] = '';
163 $row['Default'] = (isset($field_default) && isset($field_default[$i]) ? $field_default[$i] : FALSE);
164 $row['Extra'] = (isset($field_extra) && isset($field_extra[$i]) ? $field_extra[$i] : FALSE);
165 $row['Comment'] = (isset($submit_fulltext) && isset($submit_fulltext[$i]) && ($submit_fulltext[$i] == $i) ? 'FULLTEXT' : FALSE);
167 $submit_length = (isset($field_length) && isset($field_length[$i]) ? $field_length[$i] : FALSE);
168 $submit_attribute = (isset($field_attribute) && isset($field_attribute[$i]) ? $field_attribute[$i] : FALSE);
170 if (isset($field_comments) && isset($field_comments[$i])) {
171 $comments_map[$row['Field']] = $field_comments[$i];
174 if (isset($field_mimetype) && isset($field_mimetype[$i])) {
175 $mime_map[$row['Field']]['mimetype'] = $field_mimetype[$i];
178 if (isset($field_transformation) && isset($field_transformation[$i])) {
179 $mime_map[$row['Field']]['transformation'] = $field_transformation[$i];
182 if (isset($field_transformation_options) && isset($field_transformation_options[$i])) {
183 $mime_map[$row['Field']]['transformation_options'] = $field_transformation_options[$i];
186 } elseif (isset($fields_meta)) {
187 $row = $fields_meta[$i];
190 $bgcolor = ($i % 2) ? $cfg['BgcolorOne'] : $cfg['BgcolorTwo'];
192 // Cell index: If certain fields get left out, the counter shouldn't chage.
193 $ci = 0;
194 // Everytime a cell shall be left out the STRG-jumping feature, $ci_offset
195 // has to be incremented ($ci_offset++)
196 $ci_offset = -1;
198 if ($is_backup) {
199 $backup_field = (isset($true_selected) && $true_selected[$i] ? $true_selected[$i] : (isset($row) && isset($row['Field']) ? urlencode($row['Field']) : ''));
200 $content_cells[$i][$ci] = "\n" . '<input type="hidden" name="field_orig[]" value="' . $backup_field . '" />' . "\n";
201 } else {
202 $content_cells[$i][$ci] = '';
205 $content_cells[$i][$ci] .= "\n" . '<input id="field_' . $i . '_' . ($ci - $ci_offset) . '" type="text" name="field_name[]" size="10" maxlength="64" value="' . (isset($row) && isset($row['Field']) ? str_replace('"', '&quot;', $row['Field']) : '') . '" class="textfield" />';
206 $ci++;
207 $content_cells[$i][$ci] = '<select name="field_type[]" id="field_' . $i . '_' . ($ci - $ci_offset) . '">' . "\n";
209 if (empty($row['Type'])) {
210 $row['Type'] = '';
211 $type = '';
213 else {
214 $type = $row['Type'];
216 // set or enum types: slashes single quotes inside options
217 if (eregi('^(set|enum)\((.+)\)$', $type, $tmp)) {
218 $type = $tmp[1];
219 $length = substr(ereg_replace('([^,])\'\'', '\\1\\\'', ',' . $tmp[2]), 1);
220 } else {
221 $type = eregi_replace('BINARY', '', $type);
222 $type = eregi_replace('ZEROFILL', '', $type);
223 $type = eregi_replace('UNSIGNED', '', $type);
225 if (strpos($type, '(')) {
226 $length = chop(substr($type, (strpos($type, '(') + 1), (strpos($type, ')') - strpos($type, '(') - 1)));
227 $type = chop(substr($type, 0, strpos($type, '(')));
228 } else {
229 $length = '';
231 } // end if else
233 // some types, for example longtext, are reported as
234 // "longtext character set latin7" when not latin1
235 if (PMA_MYSQL_INT_VERSION >= 40100) {
236 $tmp = strpos($type, 'character set');
237 if ($tmp) {
238 $type = substr($type,0,$tmp-1);
242 if (isset($submit_length) && $submit_length != FALSE) {
243 $length = $submit_length;
246 for ($j = 0; $j < count($cfg['ColumnTypes']); $j++) {
247 $content_cells[$i][$ci] .= ' <option value="'. $cfg['ColumnTypes'][$j] . '"';
248 if (strtoupper($type) == strtoupper($cfg['ColumnTypes'][$j])) {
249 $content_cells[$i][$ci] .= ' selected="selected"';
251 $content_cells[$i][$ci] .= '>' . $cfg['ColumnTypes'][$j] . '</option>' . "\n";
252 } // end for
254 $content_cells[$i][$ci] .= ' </select>';
255 $ci++;
257 if ($is_backup) {
258 $content_cells[$i][$ci] = "\n" . '<input type="hidden" name="field_length_orig[]" value="' . urlencode($length) . '" />';
259 } else {
260 $content_cells[$i][$ci] = '';
263 $content_cells[$i][$ci] .= "\n" . '<input id="field_' . $i . '_' . ($ci - $ci_offset) . '" type="text" name="field_length[]" size="8" value="' . str_replace('"', '&quot;', $length) . '" class="textfield" />' . "\n";
264 $ci++;
266 if (eregi('^(set|enum)$', $type)) {
267 $binary = 0;
268 $unsigned = 0;
269 $zerofill = 0;
270 } else {
271 $binary = eregi('BINARY', $row['Type'], $test_attribute1);
272 $unsigned = eregi('UNSIGNED', $row['Type'], $test_attribute2);
273 $zerofill = eregi('ZEROFILL', $row['Type'], $test_attribute3);
276 if (PMA_MYSQL_INT_VERSION >= 40100) {
277 $content_cells[$i][$ci] = '<select name="field_charset[]" id="field_' . $i . '_' . ($ci - $ci_offset) . '">' . "\n"
278 . ' <option value=""></option>' . "\n";
279 if (!empty($row['Collation']) && (
280 strtolower(substr($type, 0, 4)) == 'char'
281 || strtolower(substr($type, 0, 7)) == 'varchar'
282 || strtolower(substr($type, 0, 4)) == 'text'
283 || strtolower(substr($type, 0, 8)) == 'tinytext'
284 || strtolower(substr($type, 0, 10)) == 'mediumtext'
285 || strtolower(substr($type, 0, 8)) == 'longtext'
286 || strtolower(substr($type, 0, 3)) == 'set'
287 || strtolower(substr($type, 0, 4)) == 'enum'
288 ) && !$binary) {
289 $real_charset = strpos($row['Collation'], '_') ? substr($row['Collation'], 0, strpos($row['Collation'], '_')) : $row['Collation'];
290 } else {
291 $real_charset = '';
293 for ($j = 0; isset($mysql_charsets[$j]); $j++) {
294 $content_cells[$i][$ci] .= ' <option value="' . $mysql_charsets[$j] . '"' . ($mysql_charsets[$j] == $real_charset ? ' selected="selected"' : '') . '>' . $mysql_charsets[$j] . '</option>' . "\n";
296 unset($j);
297 unset($real_charset);
298 $content_cells[$i][$ci] .= '</select>' . "\n";
299 $ci++;
302 $content_cells[$i][$ci] = '<select name="field_attribute[]" id="field_' . $i . '_' . ($ci - $ci_offset) . '">' . "\n";
304 $strAttribute = '';
305 if ($binary) {
306 $strAttribute = 'BINARY';
308 if ($unsigned) {
309 $strAttribute = 'UNSIGNED';
311 if ($zerofill) {
312 $strAttribute = 'UNSIGNED ZEROFILL';
315 if (isset($submit_attribute) && $submit_attribute != FALSE) {
316 $strAttribute = $submit_attribute;
319 for ($j = 0;$j < count($cfg['AttributeTypes']); $j++) {
320 $content_cells[$i][$ci] .= ' <option value="'. $cfg['AttributeTypes'][$j] . '"';
321 if (strtoupper($strAttribute) == strtoupper($cfg['AttributeTypes'][$j])) {
322 $content_cells[$i][$ci] .= ' selected="selected"';
324 $content_cells[$i][$ci] .= '>' . $cfg['AttributeTypes'][$j] . '</option>' . "\n";
327 $content_cells[$i][$ci] .= '</select>';
328 $ci++;
330 $content_cells[$i][$ci] = '<select name="field_null[]" id="field_' . $i . '_' . ($ci - $ci_offset) . '">';
332 if ((!isset($row) || empty($row['Null']) || $row['Null'] == 'NOT NULL') && $submit_null == FALSE) {
333 $content_cells[$i][$ci] .= "\n";
334 $content_cells[$i][$ci] .= ' <option value="NOT NULL">not null</option>' . "\n";
335 $content_cells[$i][$ci] .= ' <option value="">null</option>' . "\n";
336 } else {
337 $content_cells[$i][$ci] .= "\n";
338 $content_cells[$i][$ci] .= ' <option value="">null</option>' . "\n";
339 $content_cells[$i][$ci] .= ' <option value="NOT NULL">not null</option>' . "\n";
342 $content_cells[$i][$ci] .= "\n" . '</select>';
343 $ci++;
345 if (isset($row)
346 && !isset($row['Default']) && !empty($row['Null'])) {
347 $row['Default'] = 'NULL';
350 if ($is_backup) {
351 $content_cells[$i][$ci] = "\n" . '<input type="hidden" name="field_default_orig[]" size="8" value="' . (isset($row) && isset($row['Default']) ? urlencode($row['Default']) : '') . '" />';
352 } else {
353 $content_cells[$i][$ci] = "\n";
356 $content_cells[$i][$ci] .= '<input id="field_' . $i . '_' . ($ci - $ci_offset) . '" type="text" name="field_default[]" size="8" value="' . (isset($row) && isset($row['Default']) ? str_replace('"', '&quot;', $row['Default']) : '') . '" class="textfield" />';
357 $ci++;
359 $content_cells[$i][$ci] = '<select name="field_extra[]" id="field_' . $i . '_' . ($ci - $ci_offset) . '">';
361 if(!isset($row) || empty($row['Extra'])) {
362 $content_cells[$i][$ci] .= "\n";
363 $content_cells[$i][$ci] .= '<option value=""></option>' . "\n";
364 $content_cells[$i][$ci] .= '<option value="AUTO_INCREMENT">auto_increment</option>' . "\n";
365 } else {
366 $content_cells[$i][$ci] .= "\n";
367 $content_cells[$i][$ci] .= '<option value="AUTO_INCREMENT">auto_increment</option>' . "\n";
368 $content_cells[$i][$ci] .= '<option value=""></option>' . "\n";
371 $content_cells[$i][$ci] .= "\n" . '</select>';
372 $ci++;
374 // garvin: comments
375 if ($cfgRelation['commwork']) {
376 $content_cells[$i][$ci] = '<input id="field_' . $i . '_' . ($ci - $ci_offset) . '" type="text" name="field_comments[]" size="8" value="' . (isset($row) && isset($row['Field']) && is_array($comments_map) && isset($comments_map[$row['Field']]) ? htmlspecialchars($comments_map[$row['Field']]) : '') . '" class="textfield" />';
377 $ci++;
380 // garvin: MIME-types
381 if ($cfgRelation['mimework'] && $cfg['BrowseMIME'] && $cfgRelation['commwork']) {
382 $content_cells[$i][$ci] = '<select id="field_' . $i . '_' . ($ci - $ci_offset) . '" size="1" name="field_mimetype[]">' . "\n";
383 $content_cells[$i][$ci] .= ' <option value=""></option>' . "\n";
384 $content_cells[$i][$ci] .= ' <option value="auto">auto-detect</option>' . "\n";
386 if (is_array($available_mime['mimetype'])) {
387 @reset($available_mime['mimetype']);
388 while(list($mimekey, $mimetype) = each($available_mime['mimetype'])) {
389 $checked = (isset($row) && isset($row['Field']) && isset($mime_map[$row['Field']]['mimetype']) && ($mime_map[$row['Field']]['mimetype'] == str_replace('/', '_', $mimetype)) ? 'selected ' : '');
390 $content_cells[$i][$ci] .= ' <option value="' . str_replace('/', '_', $mimetype) . '" ' . $checked . '>' . htmlspecialchars($mimetype) . '</option>';
394 $content_cells[$i][$ci] .= '</select>';
395 $ci++;
397 $content_cells[$i][$ci] = '<select id="field_' . $i . '_' . ($ci - $ci_offset) . '" size="1" name="field_transformation[]">' . "\n";
398 $content_cells[$i][$ci] .= ' <option value="" title="' . $strNone . '"></option>' . "\n";
399 if (is_array($available_mime['transformation'])) {
400 @reset($available_mime['transformation']);
401 while(list($mimekey, $transform) = each($available_mime['transformation'])) {
402 $checked = (isset($row) && isset($row['Field']) && isset($mime_map[$row['Field']]['transformation']) && ($mime_map[$row['Field']]['transformation'] == $available_mime['transformation_file'][$mimekey]) ? 'selected ' : '');
403 $tooltip = 'strTransformation_' . strtolower(str_replace('.inc.php3', '', $available_mime['transformation_file'][$mimekey]));
404 $tooltip = isset($$tooltip) ? $$tooltip : sprintf(str_replace('<br />', ' ', $strMIME_nodescription), 'PMA_transformation_' . $tooltip . '()');
405 $content_cells[$i][$ci] .= '<option value="' . $available_mime['transformation_file'][$mimekey] . '" ' . $checked . ' title="' . $tooltip . '">' . htmlspecialchars($transform) . '</option>' . "\n";
409 $content_cells[$i][$ci] .= '</select>';
410 $ci++;
412 $content_cells[$i][$ci] = '<input id="field_' . $i . '_' . ($ci - $ci_offset) . '" type="text" name="field_transformation_options[]" size="8" value="' . (isset($row) && isset($row['Field']) && isset($mime_map[$row['Field']]['transformation_options']) ? htmlspecialchars($mime_map[$row['Field']]['transformation_options']) : '') . '" class="textfield" />';
413 $ci++;
416 // lem9: See my other comment about removing this 'if'.
417 if (!$is_backup) {
418 if (isset($row) && isset($row['Key']) && $row['Key'] == 'PRI') {
419 $checked_primary = ' checked="checked"';
420 } else {
421 $checked_primary = '';
423 if (isset($row) && isset($row['Key']) && $row['Key'] == 'MUL') {
424 $checked_index = ' checked="checked"';
425 } else {
426 $checked_index = '';
428 if (isset($row) && isset($row['Key']) && $row['Key'] == 'UNI') {
429 $checked_unique = ' checked="checked"';
430 } else {
431 $checked_unique = '';
433 if (empty($checked_primary)
434 && empty($checked_index)
435 && empty($checked_unique)) {
436 $checked_none = ' checked="checked"';
437 } else {
438 $checked_none = '';
441 if (PMA_MYSQL_INT_VERSION >= 32323
442 &&(isset($row) && isset($row['Comment']) && $row['Comment'] == 'FULLTEXT')) {
443 $checked_fulltext = ' checked="checked"';
444 } else {
445 $checked_fulltext = '';
448 $content_cells[$i][$ci] = "\n" . '<input type="radio" name="field_key_' . $i . '" value="primary_' . $i . '"' . $checked_primary . ' />';
449 $ci++;
451 $content_cells[$i][$ci] = "\n" . '<input type="radio" name="field_key_' . $i . '" value="index_' . $i . '"' . $checked_index . ' />';
452 $ci++;
454 $content_cells[$i][$ci] = "\n" . '<input type="radio" name="field_key_' . $i . '" value="unique_' . $i . '"' . $checked_unique . ' />';
455 $ci++;
457 $content_cells[$i][$ci] = "\n" . '<input type="radio" name="field_key_' . $i . '" value="none_' . $i . '"' . $checked_none . ' />';
458 $ci++;
460 if (PMA_MYSQL_INT_VERSION >= 32323) {
461 $content_cells[$i][$ci] = '<input type="checkbox" name="field_fulltext[]" value="' . $i . '"' . $checked_fulltext . ' />';
462 } // end if (PMA_MYSQL_INT_VERSION >= 32323)
463 } // end if ($action ==...)
464 } // end for
466 if ($cfg['DefaultPropDisplay'] == 'horizontal') {
468 <table border="<?php echo $cfg['Border']; ?>">
469 <tr>
470 <?php
471 @reset($header_cells);
472 while(@list($header_nr, $header_val) = @each($header_cells)) {
474 <th><?php echo $header_val; ?></th>
475 <?php
478 </tr>
479 <?php
480 @reset($content_cells);
481 $i = 0;
482 while(@list($content_nr, $content_row) = @each($content_cells)) {
483 $i++;
484 echo "\n" . '<tr>' . "\n";
486 $bgcolor = ($i % 2) ? $cfg['BgcolorOne'] : $cfg['BgcolorTwo'];
488 while(list($content_row_nr, $content_row_val) = @each($content_row)) {
490 <td bgcolor="<?php echo $bgcolor; ?>"><?php echo $content_row_val; ?></td>
491 <?php
493 echo "\n" . '</tr>' . "\n";
496 </table>
497 <br />
498 <?php
499 } else {
501 <table border="<?php echo $cfg['Border']; ?>">
502 <?php
503 @reset($header_cells);
504 $i = 0;
505 while(@list($header_nr, $header_val) = @each($header_cells)) {
506 echo "\n" . '<tr>' . "\n";
508 <th align="right"><?php echo $header_val; ?></th>
509 <?php
510 for ($j = 0; $j < count($content_cells); $j++) {
511 if (isset($content_cells[$j][$i]) && $content_cells[$j][$i] != '') {
512 $bgcolor = ($j % 2) ? $cfg['BgcolorOne'] : $cfg['BgcolorTwo'];
514 <td bgcolor="<?php echo $bgcolor; ?>"><?php echo $content_cells[$j][$i]; ?></td>
515 <?php
519 echo "\n" . '</tr>' . "\n";
520 $i++;
523 </table>
524 <br />
525 <?php
528 if ($action == 'tbl_create.php3' && PMA_MYSQL_INT_VERSION >= 32300) {
529 echo "\n";
531 <table>
532 <tr valign="top">
533 <td><?php echo $strTableComments; ?>&nbsp;:</td>
534 <?php
535 if ($action == 'tbl_create.php3') {
536 echo "\n";
538 <td width="25">&nbsp;</td>
539 <td><?php echo $strTableType; ?>&nbsp;:</td>
540 <?php
541 if (PMA_MYSQL_INT_VERSION >= 40100) {
542 echo ' <td width="25">&nbsp;</td>' . "\n"
543 . ' <td>' . $strCharset . '&nbsp;:</td>' . "\n";
546 echo "\n";
548 </tr>
549 <tr>
550 <td>
551 <input type="text" name="comment" size="40" maxlength="80" value="<?php echo (isset($comment) ? $comment : ''); ?>" class="textfield" />
552 </td>
553 <?php
554 // BEGIN - Table Type - 2 May 2001 - Robbat2
555 // change by staybyte - 11 June 2001
556 if ($action == 'tbl_create.php3') {
557 // find mysql capability - staybyte - 11. June 2001
558 $query = 'SHOW VARIABLES LIKE \'have_%\'';
559 $result = PMA_mysql_query($query);
560 if ($result != FALSE && mysql_num_rows($result) > 0) {
561 while ($tmp = PMA_mysql_fetch_array($result)) {
562 if (isset($tmp['Variable_name'])) {
563 switch ($tmp['Variable_name']) {
564 case 'have_bdb':
565 if (isset($tmp['Variable_name']) && $tmp['Value'] == 'YES') {
566 $tbl_bdb = TRUE;
568 break;
569 case 'have_gemini':
570 if (isset($tmp['Variable_name']) && $tmp['Value'] == 'YES') {
571 $tbl_gemini = TRUE;
573 break;
574 case 'have_innodb':
575 if (isset($tmp['Variable_name']) && $tmp['Value'] == 'YES') {
576 $tbl_innodb = TRUE;
578 break;
579 case 'have_isam':
580 if (isset($tmp['Variable_name']) && $tmp['Value'] == 'YES') {
581 $tbl_isam = TRUE;
583 break;
584 } // end switch
585 } // end if
586 } // end while
587 } // end if
588 mysql_free_result($result);
590 echo "\n";
592 <td width="25">&nbsp;</td>
593 <td>
594 <select name="tbl_type">
595 <option <?php echo (isset($tbl_type) && $tbl_type == 'Default' ? 'selected="checked"' : ''); ?> value="Default"><?php echo $strDefault; ?></option>
596 <option <?php echo (isset($tbl_type) && $tbl_type == 'MYISAM' ? 'selected="checked"' : ''); ?> value="MYISAM">MyISAM</option>
597 <option <?php echo (isset($tbl_type) && $tbl_type == 'HEAP' ? 'selected="checked"' : ''); ?> value="HEAP">Heap</option>
598 <option <?php echo (isset($tbl_type) && $tbl_type == 'MERGE' ? 'selected="checked"' : ''); ?> value="MERGE">Merge</option>
599 <?php if (isset($tbl_bdb)) { ?><option <?php echo (isset($tbl_type) && $tbl_type == 'BDB' ? 'selected="checked"' : ''); ?> value="BDB">Berkeley DB</option><?php } ?>
600 <?php if (isset($tbl_gemini)) { ?><option <?php echo (isset($tbl_type) && $tbl_type == 'GEMINI' ? 'selected="checked"' : ''); ?> value="GEMINI">Gemini</option><?php } ?>
601 <?php if (isset($tbl_innodb)) { ?><option <?php echo (isset($tbl_type) && $tbl_type == 'INNO DB' ? 'selected="checked"' : ''); ?> value="InnoDB">INNO DB</option><?php } ?>
602 <?php if (isset($tbl_isam)) { ?><option <?php echo (isset($tbl_type) && $tbl_type == 'ISAM' ? 'selected="checked"' : ''); ?> value="ISAM">ISAM</option><?php } ?>
603 </select>
604 </td>
605 <?php
606 if (PMA_MYSQL_INT_VERSION >= 40100) {
607 echo ' <td width="25">&nbsp;</td>' . "\n"
608 . ' <td>' . "\n"
609 . ' <select name="tbl_charset">' . "\n";
610 for ($i = 0; isset($mysql_charsets[$i]); $i++) {
611 echo ' <option value="' . $mysql_charsets[$i] . '"' . ($mysql_charsets[$i] == 'latin1' ? ' selected="selected"' : '') . '>' . $mysql_charsets[$i] . '</option>' . "\n";
613 unset($i);
614 echo ' </select>' . "\n"
615 . ' </td>' . "\n";
618 echo "\n";
620 </tr>
621 </table>
622 <br />
623 <?php
625 echo "\n";
626 // END - Table Type - 2 May 2001 - Robbat2
629 <input type="submit" name="submit" value="<?php echo $strSave; ?>" />
630 </form>
632 <table>
633 <tr>
634 <td valign="top">*&nbsp;</td>
635 <td>
636 <?php echo $strSetEnumVal . "\n"; ?>
637 </td>
638 </tr>
639 <tr>
640 <td valign="top">**&nbsp;</td>
641 <td>
642 <?php echo $strDefaultValueHelp . "\n"; ?>
643 </td>
644 </tr>
646 <?php
647 if ($cfgRelation['commwork'] && $cfgRelation['mimework'] && $cfg['BrowseMIME']) {
649 <tr>
650 <td valign="top" rowspan="2">***&nbsp;</td>
651 <td>
652 <?php echo $strMIME_transformation_options_note . "\n"; ?>
653 </td>
654 </tr>
656 <tr>
657 <td>
658 <?php echo sprintf($strMIME_transformation_note, '<a href="libraries/transformations/overview.php3?' . PMA_generate_common_url($db, $table) . '" target="_blank">', '</a>') . "\n"; ?>
659 </td>
660 </tr>
661 <?php
665 </table>
666 <br />
668 <center><?php echo PMA_showMySQLDocu('Reference', 'CREATE_TABLE'); ?></center>