/** * An error happened with previous inputs, so we will restore the data * to embed it once again in this form. * * @param int $columnNumber column number * @param array $submit_fulltext submit full text * @param array $comments_map comments map * @param array $mime_map mime map * * @return array */ function PMA_handleRegeneration($columnNumber, $submit_fulltext, $comments_map, $mime_map) { $columnMeta = PMA_getRowDataForRegeneration($columnNumber, isset($submit_fulltext) ? $submit_fulltext : null); list($submit_length, $submit_attribute, $submit_default_current_timestamp) = PMA_getSubmitPropertiesForRegeneration($columnNumber); if (isset($_REQUEST['field_comments'][$columnNumber])) { $comments_map[$columnMeta['Field']] = $_REQUEST['field_comments'][$columnNumber]; } if (isset($_REQUEST['field_mimetype'][$columnNumber])) { $mime_map[$columnMeta['Field']]['mimetype'] = $_REQUEST['field_mimetype'][$columnNumber]; } if (isset($_REQUEST['field_transformation'][$columnNumber])) { $mime_map[$columnMeta['Field']]['transformation'] = $_REQUEST['field_transformation'][$columnNumber]; } if (isset($_REQUEST['field_transformation_options'][$columnNumber])) { $mime_map[$columnMeta['Field']]['transformation_options'] = $_REQUEST['field_transformation_options'][$columnNumber]; } return array($columnMeta, $submit_length, $submit_attribute, $submit_default_current_timestamp, $comments_map, $mime_map); }
/** * Test for PMA_getRowDataForRegeneration * * @return void */ public function testGetRowDataForRegeneration() { $_REQUEST = array('field_name' => array(1 => 'name'), 'field_type' => array(1 => 'type'), 'field_collation' => array(1 => 'colltn'), 'field_null' => array(1 => true), 'field_key' => array(1 => "fulltext_1"), 'field_default_type' => array(1 => 'USER_DEFINED'), 'field_default_value' => array(1 => 'DEF'), 'field_extra' => array(1 => 'extra')); $submit_fulltext = array(1 => 1); $result = PMA_getRowDataForRegeneration(1, $submit_fulltext); $this->assertEquals(array('Field' => 'name', 'Type' => 'type', 'Collation' => 'colltn', 'Null' => true, 'Key' => 'FULLTEXT', 'DefaultType' => 'USER_DEFINED', 'DefaultValue' => 'DEF', 'Default' => 'DEF', 'Extra' => 'extra', 'Comment' => 'FULLTEXT'), $result); }