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

📄 tbl_properties.inc.php

📁 phpMyAdmin图形界面化操作,我已经配置好了,只要把解要压缩后的文件放到站点下就可以用了
💻 PHP
📖 第 1 页 / 共 2 页
字号:
<?php/* vim: set expandtab sw=4 ts=4 sts=4: *//** * Display form for changing/adding table fields/columns * * included by tbl_addfield.php, -_alter.php, -_create.php * @version $Id: tbl_properties.inc.php 12150 2008-12-19 21:29:41Z lem9 $ */if (! defined('PHPMYADMIN')) {    exit;}/** * Check parameters */require_once './libraries/common.inc.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/StorageEngine.class.php';/** * Class for partition management */require_once './libraries/Partition.class.php';if (is_int($cfg['DefaultPropDisplay'])) {    if ($num_fields <= $cfg['DefaultPropDisplay']) {        $display_type = 'vertical';    } else {        $display_type = 'horizontal';    }} else {    $display_type = $cfg['DefaultPropDisplay'];}if ('horizontal' == $display_type) {    $length_values_input_size = 8;} else {    $length_values_input_size = 30;}$_form_params = array(    'db' => $db,    'table' => $table,);if ($action == 'tbl_create.php') {    $_form_params['reload'] = 1;} elseif ($action == 'tbl_addfield.php') {    $_form_params['field_where'] = $_REQUEST['field_where'];    $_form_params['after_field'] = $_REQUEST['after_field'];}if (isset($num_fields)) {    $_form_params['orig_num_fields'] = $num_fields;}if (isset($_REQUEST['field_where'])) {    $_form_params['orig_field_where'] = $_REQUEST['field_where'];}if (isset($_REQUEST['after_field'])) {    $_form_params['orig_after_field'] = $_REQUEST['after_field'];}if (isset($selected) && is_array($selected)) {    foreach ($selected as $o_fld_nr => $o_fld_val) {        $_form_params['selected[' . $o_fld_nr . ']'] = $o_fld_val;        if (! isset($true_selected)) {            $_form_params['true_selected[' . $o_fld_nr . ']'] = $o_fld_val;        }    }    if (isset($true_selected) && is_array($true_selected)) {        foreach ($true_selected as $o_fld_nr => $o_fld_val) {            $_form_params['true_selected[' . $o_fld_nr . ']'] = $o_fld_val;        }    }} elseif (isset($_REQUEST['field'])) {    $_form_params['orig_field'] = $_REQUEST['field'];    if (isset($orig_field)) {        $_form_params['true_selected[]'] = $orig_field;    } else {        $_form_params['true_selected[]'] = $_REQUEST['field'];    }}$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', 'data-types')         : '<br /><span style="font-weight: normal">' . PMA_showMySQLDocu('SQL-Syntax', 'data-types')     . '</span>');$header_cells[] = $strLengthSet . PMA_showHint($strSetEnumVal);$header_cells[] = $strDefault . PMA_showHint($strDefaultValueHelp);$header_cells[] = $strCollation;$header_cells[] = $strAttr;$header_cells[] = $strNull;// 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[] = $strIndex;}$header_cells[] = '<abbr title="AUTO_INCREMENT">A_I</abbr>';require_once './libraries/relation.lib.php';require_once './libraries/transformations.lib.php';$cfgRelation = PMA_getRelationsParam();$comments_map = array();$mime_map = array();$available_mime = array();$comments_map = PMA_getComments($db, $table);$header_cells[] = $strComments;if ($cfgRelation['mimework'] && $cfg['BrowseMIME']) {    $mime_map = PMA_getMIME($db, $table);    $available_mime = PMA_getAvailableMIMEtypes();    $hint = '<br />' .        sprintf($strMIME_transformation_note,            '<a href="transformation_overview.php?'            . PMA_generate_common_url($db, $table) . '" target="_blank">',            '</a>');    $header_cells[] = $strMIME_MIMEtype;    $header_cells[] = $strMIME_transformation;    $header_cells[] = $strMIME_transformation_options         . PMA_showHint($strMIME_transformation_options_note . $hint);}// 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++) {    if (! empty($regenerate)) {        // An error happened with previous inputs, so we will restore the data        // to embed it once again in this form.        $row['Field']     = (isset($_REQUEST['field_name'][$i]) ? $_REQUEST['field_name'][$i] : false);        $row['Type']      = (isset($_REQUEST['field_type'][$i]) ? $_REQUEST['field_type'][$i] : false);        $row['Collation'] = (isset($_REQUEST['field_collation'][$i]) ? $_REQUEST['field_collation'][$i] : '');        $row['Null']      = (isset($_REQUEST['field_null'][$i]) ? $_REQUEST['field_null'][$i] : '');        if (isset($_REQUEST['field_key'][$i]) && $_REQUEST['field_key'][$i] == 'primary_' . $i) {            $row['Key'] = 'PRI';        } elseif (isset($_REQUEST['field_key'][$i]) && $_REQUEST['field_key'][$i] == 'index_' . $i) {            $row['Key'] = 'MUL';        } elseif (isset($_REQUEST['field_key'][$i]) && $_REQUEST['field_key'][$i] == 'unique_' . $i) {            $row['Key'] = 'UNI';        } elseif (isset($_REQUEST['field_key'][$i]) && $_REQUEST['field_key'][$i] == 'fulltext_' . $i) {            $row['Key'] = 'FULLTEXT';        } else {            $row['Key'] = '';        }        // put None in the drop-down for Default, when someone adds a field         $row['DefaultType']  = (isset($_REQUEST['field_default_type'][$i]) ? $_REQUEST['field_default_type'][$i] : 'NONE');        $row['DefaultValue'] = (isset($_REQUEST['field_default_value'][$i]) ? $_REQUEST['field_default_value'][$i] : '');        switch ($row['DefaultType']) {            case 'NONE' :                $row['Default'] = null;                break;            case 'USER_DEFINED' :                $row['Default'] = $row['DefaultValue'];                break;            case 'NULL' :            case 'CURRENT_TIMESTAMP' :                $row['Default'] = $row['DefaultType'];                break;        }                $row['Extra']     = (isset($_REQUEST['field_extra'][$i]) ? $_REQUEST['field_extra'][$i] : false);        $row['Comment']   = (isset($submit_fulltext[$i]) && ($submit_fulltext[$i] == $i) ? 'FULLTEXT' : false);        $submit_length    = (isset($_REQUEST['field_length'][$i]) ? $_REQUEST['field_length'][$i] : false);        $submit_attribute = (isset($_REQUEST['field_attribute'][$i]) ? $_REQUEST['field_attribute'][$i] : false);        $submit_default_current_timestamp = (isset($_REQUEST['field_default_current_timestamp'][$i]) ? true : false);        if (isset($_REQUEST['field_comments'][$i])) {            $comments_map[$row['Field']] = $_REQUEST['field_comments'][$i];        }        if (isset($_REQUEST['field_mimetype'][$i])) {            $mime_map[$row['Field']]['mimetype'] = $_REQUEST['field_mimetype'][$i];        }        if (isset($_REQUEST['field_transformation'][$i])) {            $mime_map[$row['Field']]['transformation'] = $_REQUEST['field_transformation'][$i];        }        if (isset($_REQUEST['field_transformation_options'][$i])) {            $mime_map[$row['Field']]['transformation_options'] = $_REQUEST['field_transformation_options'][$i];        }    } elseif (isset($fields_meta[$i])) {        $row = $fields_meta[$i];        switch ($row['Default']) {            case null:                if ($row['Null'] == 'YES') {                    $row['DefaultType']  = 'NULL';                } else {                    $row['DefaultType']  = 'NONE';                }                $row['DefaultValue'] = '';                break;            case 'CURRENT_TIMESTAMP':                $row['DefaultType']  = 'CURRENT_TIMESTAMP';                $row['DefaultValue'] = '';                break;            default:                $row['DefaultType']  = 'USER_DEFINED';                $row['DefaultValue'] = $row['Default'];                break;        }    }    if (isset($row['Type'])) {        $extracted_fieldspec = PMA_extractFieldSpec($row['Type']);        if ($extracted_fieldspec['type'] == 'bit') {            $row['Default'] = PMA_printable_bit_value($row['Default'], $extracted_fieldspec['spec_in_brackets']);        }    }    // Cell index: If certain fields get left out, the counter shouldn't change.    $ci = 0;    // Everytime a cell shall be left out the STRG-jumping feature, $ci_offset    // has to be incremented ($ci_offset++)    $ci_offset = -1;    // old column name    if ($is_backup) {        if (! empty($true_selected[$i])) {            $_form_params['field_orig[' . $i . ']'] = $true_selected[$i];        } elseif (isset($row['Field'])) {            $_form_params['field_orig[' . $i . ']'] = $row['Field'];        } else {            $_form_params['field_orig[' . $i . ']'] = '';        }    }    // column name    $content_cells[$i][$ci] = '<input id="field_' . $i . '_' . ($ci - $ci_offset) . '"'        . ' type="text" name="field_name[' . $i . ']"'        . ' maxlength="64" class="textfield" title="' . $strField . '"'        . ' size="' . ($GLOBALS['cfg']['DefaultPropDisplay'] == 'horizontal' ? '10' : '30') . '"'        . ' value="' . (isset($row['Field']) ? htmlspecialchars($row['Field']) : '') . '"'        . ' />';    $ci++;        // column type    $content_cells[$i][$ci] = '<select name="field_type[' . $i . ']"'        .' id="field_' . $i . '_' . ($ci - $ci_offset) . '" >';    if (empty($row['Type'])) {        // creating a column        $row['Type'] = '';        $type        = '';    } else {        $type        = $row['Type'];    }    if (! empty($row['Type'])) {        $type = $extracted_fieldspec['type'];        if ('set' == $extracted_fieldspec['type'] || 'enum' == $extracted_fieldspec['type']) {            $length = $extracted_fieldspec['spec_in_brackets'];        } 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);            $length = $extracted_fieldspec['spec_in_brackets'];        } // end if else    } else {        // creating a column        $length = '';    }    // 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.    $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);    foreach ($cfg['ColumnTypes'] as $col_goup => $column_type) {        if (is_array($column_type)) {            $content_cells[$i][$ci] .= '<optgroup label="' . htmlspecialchars($col_goup) . '">';            foreach ($column_type as $col_group_type) {                $content_cells[$i][$ci] .= '<option value="'. $col_group_type . '"';                if ($type_upper == strtoupper($col_group_type)) {                    $content_cells[$i][$ci] .= ' selected="selected"';                }                $content_cells[$i][$ci] .= '>' . $col_group_type . '</option>';            }            $content_cells[$i][$ci] .= '</optgroup>';            continue;        }        $content_cells[$i][$ci] .= '<option value="'. $column_type . '"';        if ($type_upper == strtoupper($column_type)) {            $content_cells[$i][$ci] .= ' selected="selected"';        }        $content_cells[$i][$ci] .= '>' . $column_type . '</option>';    } // end for    $content_cells[$i][$ci] .= '    </select>';    $ci++;    // old column length    if ($is_backup) {        $_form_params['field_length_orig[' . $i . ']'] = $length;    }    // column length    if (isset($extracted_fieldspec) && ('set' == $extracted_fieldspec['type'] || 'enum' == $extracted_fieldspec['type'])) {        $binary           = 0;        $unsigned         = 0;        $zerofill         = 0;        $length_to_display = htmlspecialchars($length);    } else {        $length_to_display = $length;        $binary           = false;        $unsigned         = stristr($row['Type'], 'unsigned');        $zerofill         = stristr($row['Type'], 'zerofill');    }    $content_cells[$i][$ci] = '<input id="field_' . $i . '_' . ($ci - $ci_offset) . '"'        . ' type="text" name="field_length[' . $i . ']" size="' . $length_values_input_size . '"'        . ' value="' . htmlspecialchars($length_to_display) . '"'        . ' class="textfield" />';    $ci++;    // column default    /**     * having NULL enabled does not implicit having Default with NULL     *    if (isset($row)      && !isset($row['Default']) && isset($row['Null']) && $row['Null'] == 'YES') {        $row['Default'] = 'NULL';    }     */    // old column default    if ($is_backup) {        $_form_params['field_default_orig[' . $i . ']'] =             (isset($row['Default']) ? $row['Default'] : '');     }        // here we put 'NONE' as the default value of drop-down; otherwise    // users would have problems if they forget to enter the default    // value (example, for an INT)

⌨️ 快捷键说明

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