/** * get the html of the form to add the new column to given table * * @param integer $num_fields number of columns to add * @param string $db current database * @param string $table current table * @param array $columnMeta array containing default values for the fields * * @return string HTML */ function PMA_getHtmlForCreateNewColumn($num_fields, $db, $table, $columnMeta = array()) { $cfgRelation = PMA_getRelationsParam(); $content_cells = array(); $available_mime = array(); $mime_map = array(); if ($cfgRelation['mimework'] && $GLOBALS['cfg']['BrowseMIME']) { $mime_map = PMA_getMIME($db, $table); $available_mime = PMA_getAvailableMIMEtypes(); } $comments_map = PMA_getComments($db, $table); for ($columnNumber = 0; $columnNumber < $num_fields; $columnNumber++) { $content_cells[$columnNumber] = array('columnNumber' => $columnNumber, 'columnMeta' => $columnMeta, 'type_upper' => '', 'length_values_input_size' => 8, 'length' => '', 'extracted_columnspec' => array(), 'submit_attribute' => null, 'comments_map' => $comments_map, 'fields_meta' => null, 'is_backup' => true, 'move_columns' => array(), 'cfgRelation' => $cfgRelation, 'available_mime' => isset($available_mime) ? $available_mime : array(), 'mime_map' => $mime_map); } return PMA\libraries\Template::get('columns_definitions/table_fields_definitions')->render(array('is_backup' => true, 'fields_meta' => null, 'mimework' => $cfgRelation['mimework'], 'content_cells' => $content_cells)); }
/** * get the html of the form to add the new column to given table * * @param integer $num_fields number of columns to add * @param string $db current database * @param string $table current table * @param array $columnMeta array containing default values for the fields * * @return HTML */ function PMA_getHtmlForCreateNewColumn($num_fields, $db, $table, $columnMeta = array()) { $cfgRelation = PMA_getRelationsParam(); $content_cells = array(); $available_mime = array(); $mime_map = array(); $header_cells = PMA_getHeaderCells(true, null, $cfgRelation['mimework'], $db, $table); if ($cfgRelation['mimework'] && $GLOBALS['cfg']['BrowseMIME']) { $mime_map = PMA_getMIME($db, $table); $available_mime = PMA_getAvailableMIMEtypes(); } $comments_map = PMA_getComments($db, $table); for ($columnNumber = 0; $columnNumber < $num_fields; $columnNumber++) { $content_cells[$columnNumber] = PMA_getHtmlForColumnAttributes($columnNumber, $columnMeta, '', 8, '', null, array(), null, null, null, $comments_map, null, true, array(), $cfgRelation, isset($available_mime) ? $available_mime : array(), $mime_map); } return PMA_getHtmlForTableFieldDefinitions($header_cells, $content_cells); }
require_once './libraries/Partition.class.php'; require_once './libraries/tbl_columns_definition_form.lib.php'; /** @var PMA_String $pmaString */ $pmaString = $GLOBALS['PMA_String']; $length_values_input_size = 8; $_form_params = PMA_getFormsParameters($server, $db, $table, $action, isset($num_fields) ? $num_fields : null, isset($selected) ? $selected : null); $is_backup = $action != 'tbl_create.php' && $action != 'tbl_addfield.php'; require_once './libraries/transformations.lib.php'; $cfgRelation = PMA_getRelationsParam(); $comments_map = PMA_getComments($db, $table); if (isset($fields_meta)) { $move_columns = PMA_getMoveColumns($db, $table); } if ($cfgRelation['mimework'] && $GLOBALS['cfg']['BrowseMIME']) { $mime_map = PMA_getMIME($db, $table); $available_mime = PMA_getAvailableMIMEtypes(); } $header_cells = PMA_getHeaderCells($is_backup, isset($fields_meta) ? $fields_meta : null, $cfgRelation['mimework'], $db, $table); // workaround for field_fulltext, because its submitted indices contain // the index as a value, not a key. Inserted here for easier maintenance // 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; } } if (isset($_REQUEST['submit_num_fields'])) { //if adding new fields, set regenerate to keep the original values $regenerate = 1; } $foreigners = PMA_getForeigners($db, $table, '', 'foreign');
/** * Test for getting available types. * * @return void */ public function testGetTypes() { $this->assertEquals(array('mimetype' => array('Application/Octetstream' => 'Application/Octetstream', 'Image/JPEG' => 'Image/JPEG', 'Image/PNG' => 'Image/PNG', 'Text/Plain' => 'Text/Plain', 'Text/Octetstream' => 'Text/Octetstream'), 'transformation' => array(0 => 'Application/Octetstream: Download', 1 => 'Application/Octetstream: Hex', 2 => 'Image/JPEG: Inline', 3 => 'Image/JPEG: Link', 4 => 'Image/PNG: Inline', 5 => 'Text/Octetstream: Sql', 6 => 'Text/Plain: Binarytoip', 7 => 'Text/Plain: Bool2text', 8 => 'Text/Plain: Dateformat', 9 => 'Text/Plain: External', 10 => 'Text/Plain: Formatted', 11 => 'Text/Plain: Imagelink', 12 => 'Text/Plain: Json', 13 => 'Text/Plain: Sql', 14 => 'Text/Plain: Xml', 15 => 'Text/Plain: Link', 16 => 'Text/Plain: Longtoipv4', 17 => 'Text/Plain: Preappend', 18 => 'Text/Plain: Substring'), 'transformation_file' => array(0 => 'output/Application_Octetstream_Download.class.php', 1 => 'output/Application_Octetstream_Hex.class.php', 2 => 'output/Image_JPEG_Inline.class.php', 3 => 'output/Image_JPEG_Link.class.php', 4 => 'output/Image_PNG_Inline.class.php', 5 => 'output/Text_Octetstream_Sql.class.php', 6 => 'output/Text_Plain_Binarytoip.class.php', 7 => 'output/Text_Plain_Bool2text.class.php', 8 => 'output/Text_Plain_Dateformat.class.php', 9 => 'output/Text_Plain_External.class.php', 10 => 'output/Text_Plain_Formatted.class.php', 11 => 'output/Text_Plain_Imagelink.class.php', 12 => 'output/Text_Plain_Json.class.php', 13 => 'output/Text_Plain_Sql.class.php', 14 => 'output/Text_Plain_Xml.class.php', 15 => 'Text_Plain_Link.class.php', 16 => 'Text_Plain_Longtoipv4.class.php', 17 => 'Text_Plain_Preappend.class.php', 18 => 'Text_Plain_Substring.class.php'), 'input_transformation' => array('Image/JPEG: Upload', 'Text/Plain: Fileupload', 'Text/Plain: Iptobinary', 'Text/Plain: JsonEditor', 'Text/Plain: Regexvalidation', 'Text/Plain: SqlEditor', 'Text/Plain: XmlEditor', 'Text/Plain: Link', 'Text/Plain: Longtoipv4', 'Text/Plain: Preappend', 'Text/Plain: Substring'), 'input_transformation_file' => array('input/Image_JPEG_Upload.class.php', 'input/Text_Plain_Fileupload.class.php', 'input/Text_Plain_Iptobinary.class.php', 'input/Text_Plain_JsonEditor.class.php', 'input/Text_Plain_Regexvalidation.class.php', 'input/Text_Plain_SqlEditor.class.php', 'input/Text_Plain_XmlEditor.class.php', 'Text_Plain_Link.class.php', 'Text_Plain_Longtoipv4.class.php', 'Text_Plain_Preappend.class.php', 'Text_Plain_Substring.class.php')), PMA_getAvailableMIMEtypes()); }
*/ /** * Don't display the page heading * @ignore */ define('PMA_DISPLAY_HEADING', 0); /** * Gets some core libraries and displays a top message if required */ require_once './libraries/common.inc.php'; require_once './libraries/header.inc.php'; require_once './libraries/transformations.lib.php'; $types = PMA_getAvailableMIMEtypes(); ?> <h2><?php echo __('Available MIME types'); ?></h2> <?php foreach ($types['mimetype'] as $key => $mimetype) { if (isset($types['empty_mimetype'][$mimetype])) { echo '<i>' . $mimetype . '</i><br />'; } else { echo $mimetype . '<br />'; } } ?> <br />
/** * Test for getting available types. * * @return void */ public function testGetTypes() { $this->assertEquals(array('mimetype' => array('Application/Octetstream' => 'Application/Octetstream', 'Image/JPEG' => 'Image/JPEG', 'Image/PNG' => 'Image/PNG', 'Text/Plain' => 'Text/Plain'), 'transformation' => array(0 => 'Application/Octetstream: Download', 1 => 'Application/Octetstream: Hex', 2 => 'Image/JPEG: Inline', 3 => 'Image/JPEG: Link', 4 => 'Image/PNG: Inline', 5 => 'Text/Plain: Bool2text', 6 => 'Text/Plain: Dateformat', 7 => 'Text/Plain: External', 8 => 'Text/Plain: Formatted', 9 => 'Text/Plain: Imagelink', 10 => 'Text/Plain: Link', 11 => 'Text/Plain: Longtoipv4', 12 => 'Text/Plain: Preappend', 13 => 'Text/Plain: Sql', 14 => 'Text/Plain: Substring'), 'transformation_file' => array(0 => 'Application_Octetstream_Download.class.php', 1 => 'Application_Octetstream_Hex.class.php', 2 => 'Image_JPEG_Inline.class.php', 3 => 'Image_JPEG_Link.class.php', 4 => 'Image_PNG_Inline.class.php', 5 => 'Text_Plain_Bool2text.class.php', 6 => 'Text_Plain_Dateformat.class.php', 7 => 'Text_Plain_External.class.php', 8 => 'Text_Plain_Formatted.class.php', 9 => 'Text_Plain_Imagelink.class.php', 10 => 'Text_Plain_Link.class.php', 11 => 'Text_Plain_Longtoipv4.class.php', 12 => 'Text_Plain_Preappend.class.php', 13 => 'Text_Plain_Sql.class.php', 14 => 'Text_Plain_Substring.class.php')), PMA_getAvailableMIMEtypes()); }