$db, 'sql_query' => $_REQUEST['sql_query'] ); if (preg_match('@^tbl_@', $GLOBALS['goto'])) { $_url_params['table'] = $table; } $err_url = $GLOBALS['goto'] . PMA_generate_common_url($_url_params); unset($_url_params); /** * Sets parameters for links * where is this variable used? * replace by PMA_generate_common_url($url_params); */ $url_query = PMA_generate_common_url($url_params, 'html', ''); /** * get table information * @todo should be done by a Table object */ require_once 'libraries/tbl_info.inc.php'; /** * Get comments for table fileds/columns */ $comments_map = array(); if ($GLOBALS['cfg']['ShowPropertyComments']) { $comments_map = PMA_getComments($db, $table); } /** * START REGULAR OUTPUT */ /** * Load JavaScript files */ $response = PMA_Response::getInstance(); $header = $response->getHeader(); $scripts = $header->getScripts(); $scripts->addFile('functions.js'); $scripts->addFile('tbl_change.js'); $scripts->addFile('jquery/jquery-ui-timepicker-addon.js'); $scripts->addFile('gis_data_editor.js'); /** * Displays the query submitted and its result * * @todo where does $disp_message and $disp_query come from??? */ if (! empty($disp_message)) { if (! isset($disp_query)) { $disp_query = null; } $response->addHTML(PMA_Util::getMessage($disp_message, $disp_query)); } /** * Get the analysis of SHOW CREATE TABLE for this table */ $analyzed_sql = PMA_Table::analyzeStructure($db, $table); /** * Get the list of the fields of the current table */ PMA_DBI_select_db($db); $table_fields = array_values(PMA_DBI_get_columns($db, $table)); $paramTableDbArray = array($table, $db); /** * Determine what to do, edit or insert? */ if (isset($where_clause)) { // we are editing $insert_mode = false; $where_clause_array = PMA_getWhereClauseArray($where_clause); list($where_clauses, $result, $rows, $found_unique_key) = PMA_analyzeWhereClauses($where_clause_array, $table, $db); } else { // we are inserting $insert_mode = true; $where_clause = null; list($result, $rows) = PMA_loadFirstRow($table, $db); $where_clauses = null; $where_clause_array = null; $found_unique_key = false; } // Copying a row - fetched data will be inserted as a new row, // therefore the where clause is needless. if (isset($_REQUEST['default_action']) && $_REQUEST['default_action'] === 'insert') { $where_clause = $where_clauses = null; } // retrieve keys into foreign fields, if any $foreigners = PMA_getForeigners($db, $table); // Retrieve form parameters for insert/edit form $_form_params = PMA_getFormParametersForInsertForm( $db, $table, $where_clauses, $where_clause_array, $err_url ); /** * Displays the form */ // autocomplete feature of IE kills the "onchange" event handler and it // must be replaced by the "onpropertychange" one in this case $chg_evt_handler = (PMA_USR_BROWSER_AGENT == 'IE' && PMA_USR_BROWSER_VER >= 5 && PMA_USR_BROWSER_VER < 7 ) ? 'onpropertychange' : 'onchange'; // Had to put the URI because when hosted on an https server, // some browsers send wrongly this form to the http server. $html_output = ''; // Set if we passed the first timestamp field $timestamp_seen = false; $columns_cnt = count($table_fields); $tabindex = 0; $tabindex_for_function = +3000; $tabindex_for_null = +6000; $tabindex_for_value = 0; $o_rows = 0; $biggest_max_file_size = 0; $url_params['db'] = $db; $url_params['table'] = $table; $url_params = PMA_urlParamsInEditMode( $url_params, $where_clause_array, $where_clause ); //Insert/Edit form //If table has blob fields we have to disable ajax. $has_blob_field = false; foreach ($table_fields as $column) { if (PMA_isColumnBlob($column)) { $has_blob_field = true; break; } } $html_output .='
'; // end Insert/Edit form if ($insert_mode) { //Continue insertion form $html_output .= PMA_getContinueInsertionForm( $table, $db, $where_clause_array, $err_url ); } $response->addHTML($html_output); ?>