home *** CD-ROM | disk | FTP | other *** search
/ Enter 2004 June / ENTER.ISO / files / xampp-win32-1.4.5-installer.exe / xampp / tbl_properties.inc.php < prev    next >
Encoding:
PHP Script  |  2003-11-26  |  26.3 KB  |  672 lines

  1. <?php
  2. /* $Id: tbl_properties.inc.php,v 2.3 2003/11/26 22:52:24 rabus Exp $ */
  3. // vim: expandtab sw=4 ts=4 sts=4:
  4.  
  5. // Check parameters
  6. require_once('./libraries/common.lib.php');
  7. PMA_checkParameters(array('db','table','action','num_fields'));
  8.  
  9.  
  10. // Get available character sets
  11. require_once('./libraries/mysql_charsets.lib.php');
  12.  
  13. ?>
  14. <?php if ($cfg['CtrlArrowsMoving']) { ?>
  15. <!-- Set on key handler for moving using by Ctrl+arrows -->
  16. <script type="text/javascript" language="javascript">
  17. <!--
  18. document.onkeydown = onKeyDownArrowsHandler;
  19. // -->
  20. </script>
  21. <?php } ?>
  22.  
  23. <form method="post" action="<?php echo $action; ?>" onsubmit="return checkTableEditForm(this, <?php echo $num_fields; ?>)" >
  24. <?php
  25. echo PMA_generate_common_hidden_inputs($db, $table);
  26. if ($action == 'tbl_create.php') {
  27.     ?>
  28.     <input type="hidden" name="reload" value="1" />
  29.     <?php
  30. }
  31. else if ($action == 'tbl_addfield.php') {
  32.     echo "\n";
  33.     ?>
  34.     <input type="hidden" name="after_field" value="<?php echo $after_field; ?>" />
  35.     <?php
  36. }
  37. echo "\n";
  38.  
  39. if (isset($num_fields)) {
  40.     ?>
  41.     <input type="hidden" name="orig_num_fields" value="<?php echo $num_fields; ?>" />
  42.     <?php
  43. }
  44.  
  45. if (isset($after_field)) {
  46.     ?>
  47.     <input type="hidden" name="orig_after_field" value="<?php echo $after_field; ?>" />
  48.     <?php
  49. }
  50.  
  51. if (isset($selected) && is_array($selected)) {
  52.     foreach($selected AS $o_fld_nr => $o_fld_val) {
  53.     ?>
  54.     <input type="hidden" name="selected[<?php echo $o_fld_nr; ?>]" value="<?php echo urlencode($o_fld_val); ?>" />
  55.     <?php
  56.         if (!isset($true_selected)) {
  57.             ?>
  58.     <input type="hidden" name="true_selected[<?php echo $o_fld_nr; ?>]" value="<?php echo urlencode($o_fld_val); ?>" />
  59.             <?php
  60.         }
  61.  
  62.     }
  63.  
  64.     if (isset($true_selected) && is_array($true_selected)) {
  65.         foreach($true_selected AS $o_fld_nr => $o_fld_val) {
  66.         ?>
  67.         <input type="hidden" name="true_selected[<?php echo $o_fld_nr; ?>]" value="<?php echo urlencode($o_fld_val); ?>" />
  68.         <?php
  69.         }
  70.     }
  71.  
  72. } elseif (isset($field)) {
  73.     ?>
  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
  77. }
  78.  
  79. $is_backup = ($action != 'tbl_create.php' && $action != 'tbl_addfield.php');
  80.  
  81. $header_cells = array();
  82. $content_cells = array();
  83.  
  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;
  89. }
  90. $header_cells[] = $strAttr;
  91. $header_cells[] = $strNull;
  92. $header_cells[] = $strDefault . '**';
  93. $header_cells[] = $strExtra;
  94.  
  95. require_once('./libraries/relation.lib.php');
  96. require_once('./libraries/transformations.lib.php');
  97. $cfgRelation = PMA_getRelationsParam();
  98.  
  99. $comments_map = array();
  100. $mime_map = array();
  101. $available_mime = array();
  102.  
  103. if ($cfgRelation['commwork']) {
  104.     $comments_map = PMA_getComments($db, $table);
  105.     $header_cells[] = $strComments;
  106.  
  107.     if ($cfgRelation['mimework'] && $cfg['BrowseMIME']) {
  108.         $mime_map = PMA_getMIME($db, $table);
  109.         $available_mime = PMA_getAvailableMIMEtypes();
  110.  
  111.         $header_cells[] = $strMIME_MIMEtype;
  112.         $header_cells[] = $strMIME_transformation;
  113.         $header_cells[] = $strMIME_transformation_options . '***';
  114.     }
  115. }
  116.  
  117.  
  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.
  121.  
  122. if (!$is_backup) {
  123.     $header_cells[] = $strPrimary;
  124.     $header_cells[] = $strIndex;
  125.     $header_cells[] = $strUnique;
  126.     $header_cells[] = '---';
  127.     $header_cells[] = $strIdxFulltext;
  128. }
  129.  
  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.     foreach($field_fulltext AS $fulltext_nr => $fulltext_indexkey) {
  135.         $submit_fulltext[$fulltext_indexkey] = $fulltext_indexkey;
  136.     }
  137. }
  138.  
  139. for ($i = 0 ; $i < $num_fields; $i++) {
  140.     $submit_null = FALSE;
  141.     if (isset($regenerate) && $regenerate == TRUE) {
  142.         // An error happened with previous inputs, so we will restore the data
  143.         // to embed it once again in this form.
  144.  
  145.         $row['Field']     = (isset($field_name) && isset($field_name[$i]) ? $field_name[$i] : FALSE);
  146.         $row['Type']      = (isset($field_type) && isset($field_type[$i]) ? $field_type[$i] : FALSE);
  147.         $row['Null']      = (isset($field_null) && isset($field_null[$i]) ? $field_null[$i] : '');
  148.         if ($row['Null'] == '') {
  149.             $submit_null = TRUE;
  150.         }
  151.  
  152.         if (isset(${'field_key_' . $i}) && ${'field_key_' . $i} == 'primary_' . $i) {
  153.             $row['Key'] = 'PRI';
  154.         } elseif (isset(${'field_key_' . $i}) && ${'field_key_' . $i} == 'index_' . $i) {
  155.             $row['Key'] = 'MUL';
  156.         } elseif (isset(${'field_key_' . $i}) && ${'field_key_' . $i} == 'unique_' . $i) {
  157.             $row['Key'] = 'UNI';
  158.         } else {
  159.             $row['Key'] = '';
  160.         }
  161.  
  162.         $row['Default']   = (isset($field_default) && isset($field_default[$i]) ? $field_default[$i] : FALSE);
  163.         $row['Extra']     = (isset($field_extra) && isset($field_extra[$i]) ? $field_extra[$i] : FALSE);
  164.         $row['Comment']   = (isset($submit_fulltext) && isset($submit_fulltext[$i]) && ($submit_fulltext[$i] == $i) ? 'FULLTEXT' : FALSE);
  165.  
  166.         $submit_length    = (isset($field_length) && isset($field_length[$i]) ? $field_length[$i] : FALSE);
  167.         $submit_attribute = (isset($field_attribute) && isset($field_attribute[$i]) ? $field_attribute[$i] : FALSE);
  168.  
  169.         if (isset($field_comments) && isset($field_comments[$i])) {
  170.             $comments_map[$row['Field']] = $field_comments[$i];
  171.         }
  172.  
  173.         if (isset($field_mimetype) && isset($field_mimetype[$i])) {
  174.             $mime_map[$row['Field']]['mimetype'] = $field_mimetype[$i];
  175.         }
  176.  
  177.         if (isset($field_transformation) && isset($field_transformation[$i])) {
  178.             $mime_map[$row['Field']]['transformation'] = $field_transformation[$i];
  179.         }
  180.  
  181.         if (isset($field_transformation_options) && isset($field_transformation_options[$i])) {
  182.             $mime_map[$row['Field']]['transformation_options'] = $field_transformation_options[$i];
  183.         }
  184.  
  185.     } elseif (isset($fields_meta)) {
  186.         $row = $fields_meta[$i];
  187.     }
  188.  
  189.     $bgcolor = ($i % 2) ? $cfg['BgcolorOne'] : $cfg['BgcolorTwo'];
  190.  
  191.     // Cell index: If certain fields get left out, the counter shouldn't chage.
  192.     $ci = 0;
  193.     // Everytime a cell shall be left out the STRG-jumping feature, $ci_offset
  194.     // has to be incremented ($ci_offset++)
  195.     $ci_offset = -1;
  196.  
  197.     if ($is_backup) {
  198.         $backup_field = (isset($true_selected) && $true_selected[$i] ? $true_selected[$i] : (isset($row) && isset($row['Field']) ? urlencode($row['Field']) : ''));
  199.         $content_cells[$i][$ci] = "\n" . '<input type="hidden" name="field_orig[]" value="' . $backup_field . '" />' . "\n";
  200.     } else {
  201.         $content_cells[$i][$ci] = '';
  202.     }
  203.  
  204.     $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('"', '"', $row['Field']) : '') . '" class="textfield" />';
  205.     $ci++;
  206.     $content_cells[$i][$ci] = '<select name="field_type[]" id="field_' . $i . '_' . ($ci - $ci_offset) . '">' . "\n";
  207.  
  208.     if (empty($row['Type'])) {
  209.         $row['Type'] = '';
  210.         $type        = '';
  211.     }
  212.     else {
  213.         $type        = $row['Type'];
  214.     }
  215.     // set or enum types: slashes single quotes inside options
  216.     if (preg_match('@^(set|enum)\((.+)\)$@i', $type, $tmp)) {
  217.         $type   = $tmp[1];
  218.         $length = substr(preg_replace('@([^,])\'\'@', '\\1\\\'', ',' . $tmp[2]), 1);
  219.     } else {
  220.         $type   = preg_replace('@BINARY@i', '', $type);
  221.         $type   = preg_replace('@ZEROFILL@i', '', $type);
  222.         $type   = preg_replace('@UNSIGNED@i', '', $type);
  223.  
  224.         if (strpos($type, '(')) {
  225.             $length = chop(substr($type, (strpos($type, '(') + 1), (strpos($type, ')') - strpos($type, '(') - 1)));
  226.             $type = chop(substr($type, 0, strpos($type, '(')));
  227.         } else {
  228.             $length = '';
  229.         }
  230.     } // end if else
  231.  
  232.     // some types, for example longtext, are reported as
  233.     // "longtext character set latin7" when not latin1
  234.     if (PMA_MYSQL_INT_VERSION >= 40100) {
  235.         $tmp = strpos($type, 'character set');
  236.         if ($tmp) {
  237.             $type = substr($type, 0, $tmp-1);
  238.         }
  239.     }
  240.  
  241.     if (isset($submit_length) && $submit_length != FALSE) {
  242.         $length = $submit_length;
  243.     }
  244.  
  245.     $cnt_column_types = count($cfg['ColumnTypes']);
  246.     for ($j = 0; $j < $cnt_column_types; $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"';
  250.         }
  251.         $content_cells[$i][$ci] .= '>' . $cfg['ColumnTypes'][$j] . '</option>' . "\n";
  252.     } // end for
  253.  
  254.     $content_cells[$i][$ci] .= '    </select>';
  255.     $ci++;
  256.  
  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] = '';
  261.     }
  262.  
  263.     $content_cells[$i][$ci] .= "\n" . '<input id="field_' . $i . '_' . ($ci - $ci_offset) . '" type="text" name="field_length[]" size="8" value="' . str_replace('"', '"', $length) . '" class="textfield" />' . "\n";
  264.     $ci++;
  265.  
  266.     if (preg_match('@^(set|enum)$@i', $type)) {
  267.         $binary           = 0;
  268.         $unsigned         = 0;
  269.         $zerofill         = 0;
  270.     } else {
  271.         $binary           = stristr($row['Type'], 'binary');
  272.         $unsigned         = stristr($row['Type'], 'unsigned');
  273.         $zerofill         = stristr($row['Type'], 'zerofill');
  274.     }
  275.  
  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 = '';
  292.         }
  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";
  295.         }
  296.         unset($j);
  297.         unset($real_charset);
  298.         $content_cells[$i][$ci] .= '</select>' . "\n";
  299.         $ci++;
  300.     }
  301.  
  302.     $content_cells[$i][$ci] = '<select name="field_attribute[]" id="field_' . $i . '_' . ($ci - $ci_offset) . '">' . "\n";
  303.  
  304.     $strAttribute     = '';
  305.     if ($binary) {
  306.         $strAttribute = 'BINARY';
  307.     }
  308.     if ($unsigned) {
  309.         $strAttribute = 'UNSIGNED';
  310.     }
  311.     if ($zerofill) {
  312.         $strAttribute = 'UNSIGNED ZEROFILL';
  313.     }
  314.  
  315.     if (isset($submit_attribute) && $submit_attribute != FALSE) {
  316.         $strAttribute = $submit_attribute;
  317.     }
  318.  
  319.     $cnt_attribute_types = count($cfg['AttributeTypes']);
  320.     for ($j = 0;$j < $cnt_attribute_types; $j++) {
  321.         $content_cells[$i][$ci] .= '                <option value="'. $cfg['AttributeTypes'][$j] . '"';
  322.         if (strtoupper($strAttribute) == strtoupper($cfg['AttributeTypes'][$j])) {
  323.             $content_cells[$i][$ci] .= ' selected="selected"';
  324.         }
  325.         $content_cells[$i][$ci] .= '>' . $cfg['AttributeTypes'][$j] . '</option>' . "\n";
  326.     }
  327.  
  328.     $content_cells[$i][$ci] .= '</select>';
  329.     $ci++;
  330.  
  331.     $content_cells[$i][$ci] = '<select name="field_null[]" id="field_' . $i . '_' . ($ci - $ci_offset) . '">';
  332.  
  333.     if ((!isset($row) || empty($row['Null']) || $row['Null'] == 'NOT NULL') && $submit_null == FALSE) {
  334.         $content_cells[$i][$ci] .= "\n";
  335.         $content_cells[$i][$ci] .= '    <option value="NOT NULL">not null</option>' . "\n";
  336.         $content_cells[$i][$ci] .= '    <option value="">null</option>' . "\n";
  337.     } else {
  338.         $content_cells[$i][$ci] .= "\n";
  339.         $content_cells[$i][$ci] .= '    <option value="">null</option>' . "\n";
  340.         $content_cells[$i][$ci] .= '    <option value="NOT NULL">not null</option>' . "\n";
  341.     }
  342.  
  343.     $content_cells[$i][$ci] .= "\n" . '</select>';
  344.     $ci++;
  345.  
  346.     if (isset($row)
  347.         && !isset($row['Default']) && !empty($row['Null'])) {
  348.         $row['Default'] = 'NULL';
  349.     }
  350.  
  351.     if ($is_backup) {
  352.         $content_cells[$i][$ci] = "\n" . '<input type="hidden" name="field_default_orig[]" size="8" value="' . (isset($row) && isset($row['Default']) ? urlencode($row['Default']) : '') . '" />';
  353.     } else {
  354.         $content_cells[$i][$ci] = "\n";
  355.     }
  356.  
  357.     $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('"', '"', $row['Default']) : '') . '" class="textfield" />';
  358.     $ci++;
  359.  
  360.     $content_cells[$i][$ci] = '<select name="field_extra[]" id="field_' . $i . '_' . ($ci - $ci_offset) . '">';
  361.  
  362.     if(!isset($row) || empty($row['Extra'])) {
  363.         $content_cells[$i][$ci] .= "\n";
  364.         $content_cells[$i][$ci] .= '<option value=""></option>' . "\n";
  365.         $content_cells[$i][$ci] .= '<option value="AUTO_INCREMENT">auto_increment</option>' . "\n";
  366.     } else {
  367.         $content_cells[$i][$ci] .= "\n";
  368.         $content_cells[$i][$ci] .= '<option value="AUTO_INCREMENT">auto_increment</option>' . "\n";
  369.         $content_cells[$i][$ci] .= '<option value=""></option>' . "\n";
  370.     }
  371.  
  372.     $content_cells[$i][$ci] .= "\n" . '</select>';
  373.     $ci++;
  374.  
  375.     // garvin: comments
  376.     if ($cfgRelation['commwork']) {
  377.         $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" />';
  378.         $ci++;
  379.     }
  380.  
  381.     // garvin: MIME-types
  382.     if ($cfgRelation['mimework'] && $cfg['BrowseMIME'] && $cfgRelation['commwork']) {
  383.         $content_cells[$i][$ci] = '<select id="field_' . $i . '_' . ($ci - $ci_offset) . '" size="1" name="field_mimetype[]">' . "\n";
  384.         $content_cells[$i][$ci] .= '    <option value=""></option>' . "\n";
  385.         $content_cells[$i][$ci] .= '    <option value="auto">auto-detect</option>' . "\n";
  386.  
  387.         if (is_array($available_mime['mimetype'])) {
  388.             foreach($available_mime['mimetype'] AS $mimekey => $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>';
  391.             }
  392.         }
  393.  
  394.         $content_cells[$i][$ci] .= '</select>';
  395.         $ci++;
  396.  
  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.             foreach($available_mime['transformation'] AS $mimekey => $transform) {
  401.                 $checked = (isset($row) && isset($row['Field']) && isset($mime_map[$row['Field']]['transformation']) && (preg_match('@' . preg_quote($available_mime['transformation_file'][$mimekey]) . '3?@i', $mime_map[$row['Field']]['transformation'])) ? 'selected ' : '');
  402.                 $tooltip = 'strTransformation_' . strtolower(preg_replace('@(\.inc\.php3?)$@', '', $available_mime['transformation_file'][$mimekey]));
  403.                 $tooltip = isset($$tooltip) ? $$tooltip : sprintf(str_replace('<br />', ' ', $strMIME_nodescription), 'PMA_transformation_' . $tooltip . '()');
  404.                 $content_cells[$i][$ci] .= '<option value="' . $available_mime['transformation_file'][$mimekey] . '" ' . $checked . ' title="' . htmlspecialchars($tooltip) . '">' . htmlspecialchars($transform) . '</option>' . "\n";
  405.             }
  406.         }
  407.  
  408.         $content_cells[$i][$ci] .= '</select>';
  409.         $ci++;
  410.  
  411.         $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" />';
  412.         $ci++;
  413.     }
  414.  
  415.     // lem9: See my other comment about removing this 'if'.
  416.     if (!$is_backup) {
  417.         if (isset($row) && isset($row['Key']) && $row['Key'] == 'PRI') {
  418.             $checked_primary = ' checked="checked"';
  419.         } else {
  420.             $checked_primary = '';
  421.         }
  422.         if (isset($row) && isset($row['Key']) && $row['Key'] == 'MUL') {
  423.             $checked_index   = ' checked="checked"';
  424.         } else {
  425.             $checked_index   = '';
  426.         }
  427.         if (isset($row) && isset($row['Key']) && $row['Key'] == 'UNI') {
  428.             $checked_unique   = ' checked="checked"';
  429.         } else {
  430.             $checked_unique   = '';
  431.         }
  432.         if (empty($checked_primary)
  433.             && empty($checked_index)
  434.             && empty($checked_unique)) {
  435.             $checked_none = ' checked="checked"';
  436.         } else {
  437.             $checked_none = '';
  438.         }
  439.  
  440.         if ((isset($row) && isset($row['Comment']) && $row['Comment'] == 'FULLTEXT')) {
  441.             $checked_fulltext = ' checked="checked"';
  442.         } else {
  443.             $checked_fulltext = '';
  444.         }
  445.  
  446.         $content_cells[$i][$ci] = "\n" . '<input type="radio" name="field_key_' . $i . '" value="primary_' . $i . '"' . $checked_primary . ' />';
  447.         $ci++;
  448.  
  449.         $content_cells[$i][$ci] = "\n" . '<input type="radio" name="field_key_' . $i . '" value="index_' . $i . '"' .  $checked_index . ' />';
  450.         $ci++;
  451.  
  452.         $content_cells[$i][$ci] = "\n" . '<input type="radio" name="field_key_' . $i . '" value="unique_' . $i . '"' .  $checked_unique . ' />';
  453.         $ci++;
  454.  
  455.         $content_cells[$i][$ci] = "\n" . '<input type="radio" name="field_key_' . $i . '" value="none_' . $i . '"' .  $checked_none . ' />';
  456.         $ci++;
  457.  
  458.         $content_cells[$i][$ci] = '<input type="checkbox" name="field_fulltext[]" value="' . $i . '"' . $checked_fulltext . ' />';
  459.     } // end if ($action ==...)
  460. } // end for
  461.  
  462. if ($cfg['DefaultPropDisplay'] == 'horizontal') {
  463. ?>
  464.     <table border="<?php echo $cfg['Border']; ?>">
  465.     <tr>
  466. <?php
  467.     if (is_array($header_cells)) {
  468.         foreach($header_cells AS $header_nr => $header_val) {
  469. ?>
  470.         <th><?php echo $header_val; ?></th>
  471. <?php
  472.         }
  473.     }
  474. ?>
  475.     </tr>
  476. <?php
  477.     if (is_array($content_cells)) {
  478.         $i = 0;
  479.         foreach($content_cells AS $content_nr => $content_row) {
  480.             $i++;
  481.             echo "\n" . '<tr>' . "\n";
  482.  
  483.             $bgcolor = ($i % 2) ? $cfg['BgcolorOne'] : $cfg['BgcolorTwo'];
  484.  
  485.             if (is_array($content_row)) {
  486.                 foreach($content_row AS $content_row_nr => $content_row_val) {
  487. ?>
  488.         <td bgcolor="<?php echo $bgcolor; ?>"><?php echo $content_row_val; ?></td>
  489. <?php
  490.                 }
  491.             }
  492.  
  493.             echo "\n" . '</tr>' . "\n";
  494.         }
  495.     }
  496. ?>
  497.     </table>
  498.     <br />
  499. <?php
  500. } else {
  501. ?>
  502.     <table border="<?php echo $cfg['Border']; ?>">
  503. <?php
  504.     if (is_array($header_cells)) {
  505.         $i = 0;
  506.         foreach($header_cells AS $header_nr => $header_val) {
  507.             echo "\n" . '<tr>' . "\n";
  508. ?>
  509.         <th align="right"><?php echo $header_val; ?></th>
  510. <?php
  511.     $cnt_content_cells = count($content_cells);
  512.     for ($j = 0; $j < $cnt_content_cells; $j++) {
  513.         if (isset($content_cells[$j][$i]) && $content_cells[$j][$i] != '') {
  514.             $bgcolor = ($j % 2) ? $cfg['BgcolorOne'] : $cfg['BgcolorTwo'];
  515.     ?>
  516.         <td bgcolor="<?php echo $bgcolor; ?>"><?php echo $content_cells[$j][$i]; ?></td>
  517.     <?php
  518.         }
  519.     }
  520.  
  521.     echo "\n" . '</tr>' . "\n";
  522.     $i++;
  523.         }
  524.     }
  525. ?>
  526.     </table>
  527.     <br />
  528. <?php
  529. }
  530.  
  531. if ($action == 'tbl_create.php') {
  532.     echo "\n";
  533.     ?>
  534.     <table>
  535.     <tr valign="top">
  536.         <td><?php echo $strTableComments; ?> :</td>
  537.     <?php
  538.     if ($action == 'tbl_create.php') {
  539.         echo "\n";
  540.         ?>
  541.         <td width="25"> </td>
  542.         <td><?php echo $strTableType; ?> :</td>
  543.         <?php
  544.         if (PMA_MYSQL_INT_VERSION >= 40100) {
  545.             echo '        <td width="25"> </td>' . "\n"
  546.                . '        <td>' . $strCharset . ' :</td>' . "\n";
  547.         }
  548.     }
  549.     echo "\n";
  550.     ?>
  551.     </tr>
  552.     <tr>
  553.         <td>
  554.             <input type="text" name="comment" size="40" maxlength="80" value="<?php echo (isset($comment) ? $comment : ''); ?>" class="textfield" />
  555.         </td>
  556.     <?php
  557.     // BEGIN - Table Type - 2 May 2001 - Robbat2
  558.     // change by staybyte - 11 June 2001
  559.     if ($action == 'tbl_create.php') {
  560.         // find mysql capability - staybyte - 11. June 2001
  561.         $query = 'SHOW VARIABLES LIKE \'have_%\'';
  562.         $result = PMA_mysql_query($query);
  563.         if ($result != FALSE && mysql_num_rows($result) > 0) {
  564.             while ($tmp = PMA_mysql_fetch_array($result)) {
  565.                 if (isset($tmp['Variable_name'])) {
  566.                     switch ($tmp['Variable_name']) {
  567.                         case 'have_bdb':
  568.                             if (isset($tmp['Variable_name']) && $tmp['Value'] == 'YES') {
  569.                                 $tbl_bdb    = TRUE;
  570.                             }
  571.                             break;
  572.                         case 'have_gemini':
  573.                             if (isset($tmp['Variable_name']) && $tmp['Value'] == 'YES') {
  574.                                 $tbl_gemini = TRUE;
  575.                             }
  576.                             break;
  577.                         case 'have_innodb':
  578.                             if (isset($tmp['Variable_name']) && $tmp['Value'] == 'YES') {
  579.                                 $tbl_innodb = TRUE;
  580.                             }
  581.                             break;
  582.                         case 'have_isam':
  583.                             if (isset($tmp['Variable_name']) && $tmp['Value'] == 'YES') {
  584.                                 $tbl_isam   = TRUE;
  585.                             }
  586.                             break;
  587.                     } // end switch
  588.                 } // end if
  589.             } // end while
  590.         } // end if
  591.         mysql_free_result($result);
  592.  
  593.         echo "\n";
  594.         ?>
  595.         <td width="25"> </td>
  596.         <td>
  597.             <select name="tbl_type">
  598.                 <option <?php echo (isset($tbl_type) && $tbl_type == 'Default' ? 'selected="checked"' : ''); ?> value="Default"><?php echo $strDefault; ?></option>
  599.                 <option <?php echo (isset($tbl_type) && $tbl_type == 'MYISAM' ? 'selected="checked"' : ''); ?> value="MYISAM">MyISAM</option>
  600.                 <option <?php echo (isset($tbl_type) && $tbl_type == 'HEAP' ? 'selected="checked"' : ''); ?> value="HEAP">Heap</option>
  601.                 <option <?php echo (isset($tbl_type) && $tbl_type == 'MERGE' ? 'selected="checked"' : ''); ?> value="MERGE">Merge</option>
  602.                 <?php if (isset($tbl_bdb)) { ?><option <?php echo (isset($tbl_type) && $tbl_type == 'BDB' ? 'selected="checked"' : ''); ?> value="BDB">Berkeley DB</option><?php } ?>
  603.                 <?php if (isset($tbl_gemini)) { ?><option <?php echo (isset($tbl_type) && $tbl_type == 'GEMINI' ? 'selected="checked"' : ''); ?> value="GEMINI">Gemini</option><?php } ?>
  604.                 <?php if (isset($tbl_innodb)) { ?><option <?php echo (isset($tbl_type) && $tbl_type == 'INNO DB' ? 'selected="checked"' : ''); ?> value="InnoDB">INNO DB</option><?php } ?>
  605.                 <?php if (isset($tbl_isam)) { ?><option <?php echo (isset($tbl_type) && $tbl_type == 'ISAM' ? 'selected="checked"' : ''); ?> value="ISAM">ISAM</option><?php } ?>
  606.             </select>
  607.         </td>
  608.         <?php
  609.         if (PMA_MYSQL_INT_VERSION >= 40100) {
  610.             echo '        <td width="25"> </td>' . "\n"
  611.                . '        <td>' . "\n"
  612.                . '            <select name="tbl_charset">' . "\n";
  613.             for ($i = 0; isset($mysql_charsets[$i]); $i++) {
  614.                 echo '                <option value="' . $mysql_charsets[$i] . '"' . ($mysql_charsets[$i] == 'latin1' ? ' selected="selected"' : '') . '>' . $mysql_charsets[$i] . '</option>' . "\n";
  615.             }
  616.             unset($i);
  617.             echo '            </select>' . "\n"
  618.                . '        </td>' . "\n";
  619.         }
  620.     }
  621.     echo "\n";
  622.     ?>
  623.         </tr>
  624.     </table>
  625.     <br />
  626.     <?php
  627. }
  628. echo "\n";
  629. // END - Table Type - 2 May 2001 - Robbat2
  630. ?>
  631.  
  632. <input type="submit" name="submit" value="<?php echo $strSave; ?>" />
  633. </form>
  634.  
  635. <table>
  636. <tr>
  637.     <td valign="top">* </td>
  638.     <td>
  639.         <?php echo $strSetEnumVal . "\n"; ?>
  640.     </td>
  641. </tr>
  642. <tr>
  643.     <td valign="top">** </td>
  644.     <td>
  645.         <?php echo $strDefaultValueHelp . "\n"; ?>
  646.     </td>
  647. </tr>
  648.  
  649. <?php
  650. if ($cfgRelation['commwork'] && $cfgRelation['mimework'] && $cfg['BrowseMIME']) {
  651. ?>
  652. <tr>
  653.     <td valign="top" rowspan="2">*** </td>
  654.     <td>
  655.         <?php echo $strMIME_transformation_options_note  . "\n"; ?>
  656.     </td>
  657. </tr>
  658.  
  659. <tr>
  660.     <td>
  661.         <?php echo sprintf($strMIME_transformation_note, '<a href="libraries/transformations/overview.php?' . PMA_generate_common_url($db, $table) . '" target="_blank">', '</a>') . "\n"; ?>
  662.     </td>
  663. </tr>
  664. <?php
  665. }
  666. ?>
  667.  
  668. </table>
  669. <br />
  670.  
  671. <center><?php echo PMA_showMySQLDocu('Reference', 'CREATE_TABLE'); ?></center>
  672.