⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 tbl_properties.inc.php

📁 一个用PHP编写的
💻 PHP
📖 第 1 页 / 共 2 页
字号:
<?php/* $Id: tbl_properties.inc.php,v 1.5.2.1 2006/03/26 11:09:13 lem9 Exp $ */// vim: expandtab sw=4 ts=4 sts=4:// Check parametersrequire_once('./libraries/common.lib.php');PMA_checkParameters(array('db', 'table', 'action', 'num_fields'));// Get available character sets and storage enginesrequire_once('./libraries/mysql_charsets.lib.php');require_once('./libraries/storage_engines.lib.php');if ($cfg['CtrlArrowsMoving']) {    ?><script src="./js/keyhandler.js" type="text/javascript" language="javascript"></script><script type="text/javascript" language="javascript"><!--var switch_movement = <?php echo $cfg['DefaultPropDisplay'] == 'horizontal' ? '0' : '1'; ?>;document.onkeydown = onKeyDownArrowsHandler;// --></script>    <?php}// here, the div_x_7 represents a div id which contains// the default CURRENT TIMESTAMP checkbox and label// and, field_x_7a represents the checkbox itselfif (PMA_MYSQL_INT_VERSION >= 40102) {    ?><script type="text/javascript" language="javascript"><!--function display_field_options(field_type, i) {    if (field_type == 'TIMESTAMP') {        getElement('div_' + i + '_7').style.display = 'block';    } else {        getElement('div_' + i + '_7').style.display = 'none';        getElement('field_' + i + '_7a').checked = false;    }    return true;}// --></script><?php } ?><form method="post" action="<?php echo $action; ?>" onsubmit="return checkTableEditForm(this, <?php echo $num_fields; ?>)" ><?phpecho PMA_generate_common_hidden_inputs($db, $table);if ($action == 'tbl_create.php') {    ?>    <input type="hidden" name="reload" value="1" />    <?php} elseif ($action == 'tbl_addfield.php') {    ?>    <input type="hidden" name="field_where" value="<?php echo $field_where; ?>" />    <input type="hidden" name="after_field" value="<?php echo $after_field; ?>" />    <?php}if (isset($num_fields)) {    ?>    <input type="hidden" name="orig_num_fields" value="<?php echo $num_fields; ?>" />    <?php}if (isset($field_where)) {    ?>    <input type="hidden" name="orig_field_where" value="<?php echo $field_where; ?>" />    <?php}if (isset($after_field)) {    ?>    <input type="hidden" name="orig_after_field" value="<?php echo $after_field; ?>" />    <?php}if (isset($selected) && is_array($selected)) {    foreach ($selected AS $o_fld_nr => $o_fld_val) {        ?>    <input type="hidden" name="selected[<?php echo $o_fld_nr; ?>]" value="<?php echo urlencode($o_fld_val); ?>" />        <?php        if (!isset($true_selected)) {            ?>    <input type="hidden" name="true_selected[<?php echo $o_fld_nr; ?>]" value="<?php echo urlencode($o_fld_val); ?>" />            <?php        }    }    if (isset($true_selected) && is_array($true_selected)) {        foreach ($true_selected AS $o_fld_nr => $o_fld_val) {            ?>        <input type="hidden" name="true_selected[<?php echo $o_fld_nr; ?>]" value="<?php echo urlencode($o_fld_val); ?>" />            <?php        }    }} elseif (isset($field)) {    ?>    <input type="hidden" name="orig_field" value="<?php echo urlencode($field); ?>" />    <input type="hidden" name="true_selected[] value="<?php echo (isset($orig_field) ? $orig_field : urlencode($field)); ?>" />    <?php}$is_backup = ($action != 'tbl_create.php' && $action != 'tbl_addfield.php');$header_cells = array();$content_cells = array();$header_cells[] = $strField;$header_cells[] = $strType . ($GLOBALS['cfg']['ReplaceHelpImg'] ? PMA_showMySQLDocu('SQL-Syntax', 'Column_types') : '<br /><span style="font-weight: normal">' . PMA_showMySQLDocu('SQL-Syntax', 'Column_types') . '</span>');$header_cells[] = $strLengthSet . '<sup>1</sup>';if (PMA_MYSQL_INT_VERSION >= 40100) {    $header_cells[] = $strCollation;}$header_cells[] = $strAttr;$header_cells[] = $strNull;$header_cells[] = $strDefault . '<sup>2</sup>';$header_cells[] = $strExtra;// lem9: We could remove this 'if' and let the key information be shown and// editable. However, for this to work, tbl_alter must be modified to use the// key fields, as tbl_addfield does.if (!$is_backup) {    $header_cells[] = $cfg['PropertiesIconic'] ? '<img class="icon" src="' . $pmaThemeImage . 'b_primary.png" width="16" height="16" alt="' . $strPrimary . '" title="' . $strPrimary . '" />' : $strPrimary;    $header_cells[] = $cfg['PropertiesIconic'] ? '<img class="icon" src="' . $pmaThemeImage . 'b_index.png" width="16" height="16" alt="' . $strIndex . '" title="' . $strIndex . '" />' : $strIndex;    $header_cells[] = $cfg['PropertiesIconic'] ? '<img class="icon" src="' . $pmaThemeImage . 'b_unique.png" width="16" height="16" alt="' . $strUnique . '" title="' . $strUnique . '" />' : $strUnique;    $header_cells[] = '---';    $header_cells[] = $cfg['PropertiesIconic'] ? '<img class="icon" src="' . $pmaThemeImage . 'b_ftext.png" width="16" height="16" alt="' . $strIdxFulltext . '" title="' . $strIdxFulltext . '" />' : $strIdxFulltext;}require_once('./libraries/relation.lib.php');require_once('./libraries/transformations.lib.php');$cfgRelation = PMA_getRelationsParam();$comments_map = array();$mime_map = array();$available_mime = array();if ($cfgRelation['commwork'] || PMA_MYSQL_INT_VERSION >= 40100) {    $comments_map = PMA_getComments($db, $table);    $header_cells[] = $strComments;    if ($cfgRelation['mimework'] && $cfg['BrowseMIME']) {        $mime_map = PMA_getMIME($db, $table);        $available_mime = PMA_getAvailableMIMEtypes();        $header_cells[] = $strMIME_MIMEtype;        $header_cells[] = $strMIME_transformation;        $header_cells[] = $strMIME_transformation_options . '<sup>3</sup>';    }}// garvin: workaround for field_fulltext, because its submitted indizes contain//         the index as a value, not a key. Inserted here for easier maintaineance//         and less code to change in existing files.if (isset($field_fulltext) && is_array($field_fulltext)) {    foreach ($field_fulltext AS $fulltext_nr => $fulltext_indexkey) {        $submit_fulltext[$fulltext_indexkey] = $fulltext_indexkey;    }}for ( $i = 0 ; $i <= $num_fields; $i++ ) {    $submit_null = FALSE;    if (isset($regenerate) && $regenerate == TRUE) {        // An error happened with previous inputs, so we will restore the data        // to embed it once again in this form.        $row['Field']     = (isset($field_name) && isset($field_name[$i]) ? $field_name[$i] : FALSE);        $row['Type']      = (isset($field_type) && isset($field_type[$i]) ? $field_type[$i] : FALSE);        if (PMA_MYSQL_INT_VERSION >= 40100) {            $row['Collation']      = (isset($field_collation) && isset($field_collation[$i]) ? $field_collation[$i] : '');        }        $row['Null']      = (isset($field_null) && isset($field_null[$i]) ? $field_null[$i] : '');        if (isset($field_type[$i]) && $row['Null'] == '') {            $submit_null = TRUE;        }        if (isset(${'field_key_' . $i}) && ${'field_key_' . $i} == 'primary_' . $i) {            $row['Key'] = 'PRI';        } elseif (isset(${'field_key_' . $i}) && ${'field_key_' . $i} == 'index_' . $i) {            $row['Key'] = 'MUL';        } elseif (isset(${'field_key_' . $i}) && ${'field_key_' . $i} == 'unique_' . $i) {            $row['Key'] = 'UNI';        } else {            $row['Key'] = '';        }        $row['Default']   = (isset($field_default) && isset($field_default[$i]) ? $field_default[$i] : FALSE);        $row['Extra']     = (isset($field_extra) && isset($field_extra[$i]) ? $field_extra[$i] : FALSE);        $row['Comment']   = (isset($submit_fulltext) && isset($submit_fulltext[$i]) && ($submit_fulltext[$i] == $i) ? 'FULLTEXT' : FALSE);        $submit_length    = (isset($field_length) && isset($field_length[$i]) ? $field_length[$i] : FALSE);        $submit_attribute = (isset($field_attribute) && isset($field_attribute[$i]) ? $field_attribute[$i] : FALSE);        $submit_default_current_timestamp = (isset($field_default_current_timestamp) && isset($field_default_current_timestamp[$i]) ? TRUE : FALSE);        if (isset($field_comments) && isset($field_comments[$i])) {            $comments_map[$row['Field']] = $field_comments[$i];        }        if (isset($field_mimetype) && isset($field_mimetype[$i])) {            $mime_map[$row['Field']]['mimetype'] = $field_mimetype[$i];        }        if (isset($field_transformation) && isset($field_transformation[$i])) {            $mime_map[$row['Field']]['transformation'] = $field_transformation[$i];        }        if (isset($field_transformation_options) && isset($field_transformation_options[$i])) {            $mime_map[$row['Field']]['transformation_options'] = $field_transformation_options[$i];        }    } elseif (isset($fields_meta) && isset($fields_meta[$i])) {        $row = $fields_meta[$i];    }    // Cell index: If certain fields get left out, the counter shouldn't chage.    $ci = 0;    // Everytime a cell shall be left out the STRG-jumping feature, $ci_offset    // has to be incremented ($ci_offset++)    $ci_offset = -1;    if ($is_backup) {        $backup_field = (isset($true_selected) && isset($true_selected[$i]) && $true_selected[$i] ? $true_selected[$i] : (isset($row) && isset($row['Field']) ? urlencode($row['Field']) : ''));        $content_cells[$i][$ci] = "\n" . '<input type="hidden" name="field_orig[]" value="' . $backup_field . '" />' . "\n";    } else {        $content_cells[$i][$ci] = '';    }    $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" title="' . $strField . '" />';    $ci++;    $content_cells[$i][$ci] = '<select name="field_type[]" id="field_' . $i . '_' . ($ci - $ci_offset) . '" ';    if (PMA_MYSQL_INT_VERSION >= 40102) {        $content_cells[$i][$ci] .= 'onchange="display_field_options(this.options[this.selectedIndex].value,' . $i .')" ';    }    $content_cells[$i][$ci] .= '>' . "\n";    if (empty($row['Type'])) {        $row['Type'] = '';        $type        = '';    } else {        $type        = $row['Type'];    }    // set or enum types: slashes single quotes inside options    if (preg_match('@^(set|enum)\((.+)\)$@i', $type, $tmp)) {        $type   = $tmp[1];        $length = substr(preg_replace('@([^,])\'\'@', '\\1\\\'', ',' . $tmp[2]), 1);    } else {        // strip the "BINARY" attribute, except if we find "BINARY(" because        // this would be a BINARY or VARBINARY field type        $type   = preg_replace('@BINARY([^\(])@i', '', $type);        $type   = preg_replace('@ZEROFILL@i', '', $type);        $type   = preg_replace('@UNSIGNED@i', '', $type);        if (strpos($type, '(')) {            $length = chop(substr($type, (strpos($type, '(') + 1), (strpos($type, ')') - strpos($type, '(') - 1)));            $type = chop(substr($type, 0, strpos($type, '(')));        } else {            $length = '';        }    } // end if else    // some types, for example longtext, are reported as    // "longtext character set latin7" when their charset and / or collation    // differs from the ones of the corresponding database.    if (PMA_MYSQL_INT_VERSION >= 40100) {        $tmp = strpos($type, 'character set');        if ($tmp) {            $type = substr($type, 0, $tmp-1);        }    }    if (isset($submit_length) && $submit_length != FALSE) {        $length = $submit_length;    }    // rtrim the type, for cases like "float unsigned"    $type = rtrim($type);    $type_upper = strtoupper($type);    $cnt_column_types = count($cfg['ColumnTypes']);    for ($j = 0; $j < $cnt_column_types; $j++) {        $content_cells[$i][$ci] .= '                <option value="'. $cfg['ColumnTypes'][$j] . '"';        if ($type_upper == strtoupper($cfg['ColumnTypes'][$j])) {            $content_cells[$i][$ci] .= ' selected="selected"';        }        $content_cells[$i][$ci] .= '>' . $cfg['ColumnTypes'][$j] . '</option>' . "\n";    } // end for    $content_cells[$i][$ci] .= '    </select>';    $ci++;    if ($is_backup) {        $content_cells[$i][$ci] = "\n" . '<input type="hidden" name="field_length_orig[]" value="' . urlencode($length) . '" />';    } else {        $content_cells[$i][$ci] = '';    }    if (preg_match('@^(set|enum)$@i', $type)) {        $binary           = 0;        $unsigned         = 0;        $zerofill         = 0;        $length_to_display = htmlspecialchars($length);    } else {        $length_to_display = $length;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -