// 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 = mb_strpos($type, 'character set'); if ($tmp) { $type = mb_substr($type, 0, $tmp - 1); } // rtrim the type, for cases like "float unsigned" $type = rtrim($type); if (isset($submit_length) && $submit_length != false) { $length = $submit_length; } // Variable tell if current column is bound in a foreign key constraint or not. if (isset($columnMeta['Field']) && isset($_form_params['table'])) { $columnMeta['column_status'] = PMA_checkChildForeignReferences($_form_params['db'], $_form_params['table'], $columnMeta['Field'], $foreigners, $child_references); } // old column attributes if ($is_backup) { $_form_params = PMA_getFormParamsForOldColumn($columnMeta, $length, $_form_params, $columnNumber, $type, $extracted_columnspec); } $content_cells[$columnNumber] = PMA_getHtmlForColumnAttributes($columnNumber, isset($columnMeta) ? $columnMeta : array(), mb_strtoupper($type), $length_values_input_size, $length, isset($default_current_timestamp) ? $default_current_timestamp : null, isset($extracted_columnspec) ? $extracted_columnspec : null, isset($submit_attribute) ? $submit_attribute : null, isset($analyzed_sql) ? $analyzed_sql : null, isset($submit_default_current_timestamp) ? $submit_default_current_timestamp : null, $comments_map, isset($fields_meta) ? $fields_meta : null, $is_backup, isset($move_columns) ? $move_columns : array(), $cfgRelation, isset($available_mime) ? $available_mime : array(), isset($mime_map) ? $mime_map : array()); } // end for $html = PMA_getHtmlForTableCreateOrAddField($action, $_form_params, $content_cells, $header_cells); unset($_form_params); $response = PMA_Response::getInstance(); $header = $response->getHeader(); $scripts = $header->getScripts(); $scripts->addFile('jquery/jquery.uitablefilter.js'); $scripts->addFile('indexes.js'); $response->addHTML($html);
/** * Test for PMA_getHtmlForTableCreateOrAddField * * @return void */ public function testGetHtmlForTableCreateOrAddField() { $dbi = $this->getMockBuilder('PMA_DatabaseInterface')->disableOriginalConstructor()->getMock(); $dbi->expects($this->any())->method('fetchResult')->will($this->returnValue(array())); $GLOBALS['dbi'] = $dbi; $result = PMA_getHtmlForTableCreateOrAddField("tbl_create.php", array('a' => 'b'), array(array('c1')), array('h1')); $this->assertContains('<form method="post" action="tbl_create.php" ' . 'class="create_table_form ajax lock-page">', $result); $this->assertContains('<input type="hidden" name="a" value="b"', $result); $this->assertContains('<select lang="en" dir="ltr" name="tbl_collation">', $result); $this->assertContains('<input type="submit" name="do_save_data" value="Save"', $result); $this->assertContains('<input type="text" name="table"', $result); }