Revert initial commit
[phpmyadmin/blinky.git] / tbl_change.php
blob5c0088586c8dabb5bd4d4939ff5b1775b8dc91ff
1 <?php
2 /* vim: set expandtab sw=4 ts=4 sts=4: */
3 /**
4 * Displays form for editing and inserting new table rows
6 * register_globals_save (mark this file save for disabling register globals)
8 * @version $Id$
9 * @package phpMyAdmin
12 /**
13 * Gets the variables sent or posted to this script and displays the header
15 require_once './libraries/common.inc.php';
17 /**
18 * Ensures db and table are valid, else moves to the "parent" script
20 require_once './libraries/db_table_exists.lib.php';
22 /**
23 * Sets global variables.
24 * Here it's better to use a if, instead of the '?' operator
25 * to avoid setting a variable to '' when it's not present in $_REQUEST
27 if (isset($_REQUEST['where_clause'])) {
28 $where_clause = $_REQUEST['where_clause'];
30 if (isset($_REQUEST['clause_is_unique'])) {
31 $clause_is_unique = $_REQUEST['clause_is_unique'];
33 if (isset($_SESSION['edit_next'])) {
34 $where_clause = $_SESSION['edit_next'];
35 unset($_SESSION['edit_next']);
36 $after_insert = 'edit_next';
38 if (isset($_REQUEST['sql_query'])) {
39 $sql_query = $_REQUEST['sql_query'];
41 if (isset($_REQUEST['ShowFunctionFields'])) {
42 $cfg['ShowFunctionFields'] = $_REQUEST['ShowFunctionFields'];
44 if (isset($_REQUEST['ShowFieldTypesInDataEditView'])) {
45 $cfg['ShowFieldTypesInDataEditView'] = $_REQUEST['ShowFieldTypesInDataEditView'];
48 /**
49 * load relation data, foreign keys
51 require_once './libraries/relation.lib.php';
53 /**
54 * file listing
56 require_once './libraries/file_listing.php';
59 /**
60 * Defines the url to return to in case of error in a sql statement
61 * (at this point, $GLOBALS['goto'] will be set but could be empty)
63 if (empty($GLOBALS['goto'])) {
64 if (strlen($table)) {
65 // avoid a problem (see bug #2202709)
66 $GLOBALS['goto'] = 'tbl_sql.php';
67 } else {
68 $GLOBALS['goto'] = 'db_sql.php';
71 /**
72 * @todo check if we could replace by "db_|tbl_" - please clarify!?
74 $_url_params = array(
75 'db' => $db,
76 'sql_query' => $sql_query
79 if (preg_match('@^tbl_@', $GLOBALS['goto'])) {
80 $_url_params['table'] = $table;
83 $err_url = $GLOBALS['goto'] . PMA_generate_common_url($_url_params);
84 unset($_url_params);
87 /**
88 * Sets parameters for links
89 * where is this variable used?
90 * replace by PMA_generate_common_url($url_params);
92 $url_query = PMA_generate_common_url($url_params, 'html', '');
94 /**
95 * get table information
96 * @todo should be done by a Table object
98 require_once './libraries/tbl_info.inc.php';
101 * Get comments for table fileds/columns
103 $comments_map = array();
105 if ($GLOBALS['cfg']['ShowPropertyComments']) {
106 $comments_map = PMA_getComments($db, $table);
110 * START REGULAR OUTPUT
114 * used in ./libraries/header.inc.php to load JavaScript library file
116 $GLOBALS['js_include'][] = 'tbl_change.js';
117 $GLOBALS['js_include'][] = 'jquery/jquery-ui-1.8.custom.js';
118 $GLOBALS['js_include'][] = 'jquery/timepicker.js';
120 * HTTP and HTML headers
122 require_once './libraries/header.inc.php';
125 * Displays the query submitted and its result
127 * @todo where does $disp_message and $disp_query come from???
129 if (! empty($disp_message)) {
130 if (! isset($disp_query)) {
131 $disp_query = null;
133 PMA_showMessage($disp_message, $disp_query);
137 * Displays top menu links
139 require_once './libraries/tbl_links.inc.php';
143 * Get the analysis of SHOW CREATE TABLE for this table
144 * @todo should be handled by class Table
146 $show_create_table = PMA_DBI_fetch_value(
147 'SHOW CREATE TABLE ' . PMA_backquote($db) . '.' . PMA_backquote($table),
148 0, 1);
149 $analyzed_sql = PMA_SQP_analyze(PMA_SQP_parse($show_create_table));
150 unset($show_create_table);
153 * Get the list of the fields of the current table
155 PMA_DBI_select_db($db);
156 $table_fields = PMA_DBI_fetch_result('SHOW FIELDS FROM ' . PMA_backquote($table) . ';',
157 null, null, null, PMA_DBI_QUERY_STORE);
158 $rows = array();
159 if (isset($where_clause)) {
160 // when in edit mode load all selected rows from table
161 $insert_mode = false;
162 if (is_array($where_clause)) {
163 $where_clause_array = $where_clause;
164 } else {
165 $where_clause_array = array(0 => $where_clause);
168 $result = array();
169 $found_unique_key = false;
170 $where_clauses = array();
172 foreach ($where_clause_array as $key_id => $where_clause) {
173 $local_query = 'SELECT * FROM ' . PMA_backquote($db) . '.' . PMA_backquote($table) . ' WHERE ' . $where_clause . ';';
174 $result[$key_id] = PMA_DBI_query($local_query, null, PMA_DBI_QUERY_STORE);
175 $rows[$key_id] = PMA_DBI_fetch_assoc($result[$key_id]);
176 $where_clauses[$key_id] = str_replace('\\', '\\\\', $where_clause);
178 // No row returned
179 if (! $rows[$key_id]) {
180 unset($rows[$key_id], $where_clause_array[$key_id]);
181 PMA_showMessage(__('MySQL returned an empty result set (i.e. zero rows).'), $local_query);
182 echo "\n";
183 require_once './libraries/footer.inc.php';
184 } else { // end if (no row returned)
185 $meta = PMA_DBI_get_fields_meta($result[$key_id]);
186 list($unique_condition, $tmp_clause_is_unique) = PMA_getUniqueCondition($result[$key_id], count($meta), $meta, $rows[$key_id], true);
187 if (! empty($unique_condition)) {
188 $found_unique_key = true;
190 unset($unique_condition, $tmp_clause_is_unique);
193 } else {
194 // no primary key given, just load first row - but what happens if table is empty?
195 $insert_mode = true;
196 $result = PMA_DBI_query('SELECT * FROM ' . PMA_backquote($db) . '.' . PMA_backquote($table) . ' LIMIT 1;', null, PMA_DBI_QUERY_STORE);
197 $rows = array_fill(0, $cfg['InsertRows'], false);
200 // <markus@noga.de>
201 // retrieve keys into foreign fields, if any
202 $foreigners = PMA_getForeigners($db, $table);
206 * Displays the form
208 // autocomplete feature of IE kills the "onchange" event handler and it
209 // must be replaced by the "onpropertychange" one in this case
210 $chg_evt_handler = (PMA_USR_BROWSER_AGENT == 'IE' && PMA_USR_BROWSER_VER >= 5 && PMA_USR_BROWSER_VER < 7)
211 ? 'onpropertychange'
212 : 'onchange';
213 // Had to put the URI because when hosted on an https server,
214 // some browsers send wrongly this form to the http server.
216 if ($cfg['CtrlArrowsMoving']) {
218 <!-- Set on key handler for moving using by Ctrl+arrows -->
219 <script src="./js/keyhandler.js" type="text/javascript"></script>
220 <script type="text/javascript">
221 //<![CDATA[
222 var switch_movement = 0;
223 document.onkeydown = onKeyDownArrowsHandler;
224 //]]>
225 </script>
226 <?php
229 $_form_params = array(
230 'db' => $db,
231 'table' => $table,
232 'goto' => $GLOBALS['goto'],
233 'err_url' => $err_url,
234 'sql_query' => $sql_query,
236 if (isset($where_clauses)) {
237 foreach ($where_clause_array as $key_id => $where_clause) {
238 $_form_params['where_clause[' . $key_id . ']'] = trim($where_clause);
241 if (isset($clause_is_unique)) {
242 $_form_params['clause_is_unique'] = $clause_is_unique;
247 <!-- Insert/Edit form -->
248 <form method="post" action="tbl_replace.php" name="insertForm" <?php if ($is_upload) { echo ' enctype="multipart/form-data"'; } ?>>
249 <?php
250 echo PMA_generate_common_hidden_inputs($_form_params);
252 $titles['Browse'] = PMA_getIcon('b_browse.png', __('Browse foreign values'));
254 // Set if we passed the first timestamp field
255 $timestamp_seen = 0;
256 $fields_cnt = count($table_fields);
258 $tabindex = 0;
259 $tabindex_for_function = +3000;
260 $tabindex_for_null = +6000;
261 $tabindex_for_value = 0;
262 $o_rows = 0;
263 $biggest_max_file_size = 0;
265 // user can toggle the display of Function column
266 // (currently does not work for multi-edits)
267 $url_params['db'] = $db;
268 $url_params['table'] = $table;
269 if (isset($where_clause)) {
270 $url_params['where_clause'] = trim($where_clause);
272 if (! empty($sql_query)) {
273 $url_params['sql_query'] = $sql_query;
276 if (! $cfg['ShowFunctionFields'] || ! $cfg['ShowFieldTypesInDataEditView']) {
277 echo __('Show');
279 if (! $cfg['ShowFunctionFields']) {
280 $this_url_params = array_merge($url_params,
281 array('ShowFunctionFields' => 1, 'ShowFieldTypesInDataEditView' => $cfg['ShowFieldTypesInDataEditView'], 'goto' => 'sql.php'));
282 echo ' : <a href="tbl_change.php' . PMA_generate_common_url($this_url_params) . '">' . __('Function') . '</a>' . "\n";
284 if (! $cfg['ShowFieldTypesInDataEditView']) {
285 $this_other_url_params = array_merge($url_params,
286 array('ShowFieldTypesInDataEditView' => 1, 'ShowFunctionFields' => $cfg['ShowFunctionFields'], 'goto' => 'sql.php'));
287 echo ' : <a href="tbl_change.php' . PMA_generate_common_url($this_other_url_params) . '">' . __('Type') . '</a>' . "\n";
290 foreach ($rows as $row_id => $vrow) {
291 if ($vrow === false) {
292 unset($vrow);
295 $jsvkey = $row_id;
296 $browse_foreigners_uri = '&amp;pk=' . $row_id;
297 $vkey = '[multi_edit][' . $jsvkey . ']';
299 $vresult = (isset($result) && is_array($result) && isset($result[$row_id]) ? $result[$row_id] : $result);
300 if ($insert_mode && $row_id > 0) {
301 echo '<input type="checkbox" checked="checked" name="insert_ignore_' . $row_id . '" id="insert_ignore_check_' . $row_id . '" />';
302 echo '<label for="insert_ignore_check_' . $row_id . '">' . __('Ignore') . '</label><br />' . "\n";
305 <table>
306 <thead>
307 <tr>
308 <th><?php echo __('Field'); ?></th>
310 <?php
311 if ($cfg['ShowFieldTypesInDataEditView']) {
312 $this_url_params = array_merge($url_params,
313 array('ShowFieldTypesInDataEditView' => 0, 'ShowFunctionFields' => $cfg['ShowFunctionFields'], 'goto' => 'sql.php'));
314 echo ' <th><a href="tbl_change.php' . PMA_generate_common_url($this_url_params) . '" title="' . __('Hide') . '">' . __('Type') . '</a></th>' . "\n";
317 if ($cfg['ShowFunctionFields']) {
318 $this_url_params = array_merge($url_params,
319 array('ShowFunctionFields' => 0, 'ShowFieldTypesInDataEditView' => $cfg['ShowFieldTypesInDataEditView'], 'goto' => 'sql.php'));
320 echo ' <th><a href="tbl_change.php' . PMA_generate_common_url($this_url_params) . '" title="' . __('Hide') . '">' . __('Function') . '</a></th>' . "\n";
323 <th><?php echo __('Null'); ?></th>
324 <th><?php echo __('Value'); ?></th>
325 </tr>
326 </thead>
327 <tfoot>
328 <tr>
329 <th colspan="5" align="right" class="tblFooters">
330 <input type="submit" value="<?php echo __('Go'); ?>" />
331 </th>
332 </tr>
333 </tfoot>
334 <tbody>
335 <?php
336 // Sets a multiplier used for input-field counts (as zero cannot be used, advance the counter plus one)
337 $m_rows = $o_rows + 1;
339 $odd_row = true;
340 for ($i = 0; $i < $fields_cnt; $i++) {
341 if (! isset($table_fields[$i]['processed'])) {
342 $table_fields[$i]['Field_html'] = htmlspecialchars($table_fields[$i]['Field']);
343 $table_fields[$i]['Field_md5'] = md5($table_fields[$i]['Field']);
344 // True_Type contains only the type (stops at first bracket)
345 $table_fields[$i]['True_Type'] = preg_replace('@\(.*@s', '', $table_fields[$i]['Type']);
347 // d a t e t i m e
349 // Current date should not be set as default if the field is NULL
350 // for the current row, but do not put here the current datetime
351 // if there is a default value (the real default value will be set
352 // in the Default value logic below)
354 // Note: (tested in MySQL 4.0.16): when lang is some UTF-8,
355 // $field['Default'] is not set if it contains NULL:
356 // Array ([Field] => d [Type] => datetime [Null] => YES [Key] => [Extra] => [True_Type] => datetime)
357 // but, look what we get if we switch to iso: (Default is NULL)
358 // Array ([Field] => d [Type] => datetime [Null] => YES [Key] => [Default] => [Extra] => [True_Type] => datetime)
359 // so I force a NULL into it (I don't think it's possible
360 // to have an empty default value for DATETIME)
361 // then, the "if" after this one will work
362 if ($table_fields[$i]['Type'] == 'datetime'
363 && ! isset($table_fields[$i]['Default'])
364 && isset($table_fields[$i]['Null'])
365 && $table_fields[$i]['Null'] == 'YES') {
366 $table_fields[$i]['Default'] = null;
369 $table_fields[$i]['len'] =
370 preg_match('@float|double@', $table_fields[$i]['Type']) ? 100 : -1;
373 if (isset($comments_map[$table_fields[$i]['Field']])) {
374 $table_fields[$i]['Field_title'] = '<span style="border-bottom: 1px dashed black;" title="'
375 . htmlspecialchars($comments_map[$table_fields[$i]['Field']]) . '">'
376 . $table_fields[$i]['Field_html'] . '</span>';
377 } else {
378 $table_fields[$i]['Field_title'] = $table_fields[$i]['Field_html'];
381 // The type column
382 $table_fields[$i]['is_binary'] = stristr($table_fields[$i]['Type'], 'binary');
383 $table_fields[$i]['is_blob'] = stristr($table_fields[$i]['Type'], 'blob');
384 $table_fields[$i]['is_char'] = stristr($table_fields[$i]['Type'], 'char');
385 $table_fields[$i]['first_timestamp'] = false;
386 switch ($table_fields[$i]['True_Type']) {
387 case 'set':
388 $table_fields[$i]['pma_type'] = 'set';
389 $table_fields[$i]['wrap'] = '';
390 break;
391 case 'enum':
392 $table_fields[$i]['pma_type'] = 'enum';
393 $table_fields[$i]['wrap'] = '';
394 break;
395 case 'timestamp':
396 if (!$timestamp_seen) { // can only occur once per table
397 $timestamp_seen = 1;
398 $table_fields[$i]['first_timestamp'] = true;
400 $table_fields[$i]['pma_type'] = $table_fields[$i]['Type'];
401 $table_fields[$i]['wrap'] = ' nowrap="nowrap"';
402 break;
404 default:
405 $table_fields[$i]['pma_type'] = $table_fields[$i]['Type'];
406 $table_fields[$i]['wrap'] = ' nowrap="nowrap"';
407 break;
410 $field = $table_fields[$i];
411 $extracted_fieldspec = PMA_extractFieldSpec($field['Type']);
413 if (-1 === $field['len']) {
414 $field['len'] = PMA_DBI_field_len($vresult, $i);
416 //Call validation when the form submited...
417 $unnullify_trigger = $chg_evt_handler . "=\"return Validator('". PMA_escapeJsString($field['Field_md5']) . "', '"
418 . PMA_escapeJsString($jsvkey) . "','".$field['pma_type']."')\"";
420 // Use an MD5 as an array index to avoid having special characters in the name atttibute (see bug #1746964 )
421 $field_name_appendix = $vkey . '[' . $field['Field_md5'] . ']';
422 $field_name_appendix_md5 = $field['Field_md5'] . $vkey . '[]';
425 if ($field['Type'] == 'datetime'
426 && ! isset($field['Default'])
427 && ! is_null($field['Default'])
428 && ($insert_mode || ! isset($vrow[$field['Field']]))) {
429 // INSERT case or
430 // UPDATE case with an NULL value
431 $vrow[$field['Field']] = date('Y-m-d H:i:s', time());
434 <tr class="<?php echo $odd_row ? 'odd' : 'even'; ?>">
435 <td <?php echo ($cfg['LongtextDoubleTextarea'] && strstr($field['True_Type'], 'longtext') ? 'rowspan="2"' : ''); ?> align="center">
436 <?php echo $field['Field_title']; ?>
437 <input type="hidden" name="fields_name<?php echo $field_name_appendix; ?>" value="<?php echo $field['Field_html']; ?>"/>
438 </td>
439 <?php if ($cfg['ShowFieldTypesInDataEditView']) { ?>
440 <td align="center"<?php echo $field['wrap']; ?>>
441 <?php echo $field['pma_type']; ?>
442 </td>
444 <?php } //End if
446 // Prepares the field value
447 $real_null_value = FALSE;
448 $special_chars_encoded = '';
449 if (isset($vrow)) {
450 // (we are editing)
451 if (is_null($vrow[$field['Field']])) {
452 $real_null_value = TRUE;
453 $vrow[$field['Field']] = '';
454 $special_chars = '';
455 $data = $vrow[$field['Field']];
456 } elseif ($field['True_Type'] == 'bit') {
457 $special_chars = PMA_printable_bit_value($vrow[$field['Field']], $extracted_fieldspec['spec_in_brackets']);
458 } else {
459 // special binary "characters"
460 if ($field['is_binary'] || $field['is_blob']) {
461 if ($_SESSION['tmp_user_values']['display_binary_as_hex'] && $cfg['ShowFunctionFields']) {
462 $vrow[$field['Field']] = bin2hex($vrow[$field['Field']]);
463 $field['display_binary_as_hex'] = true;
464 } else {
465 $vrow[$field['Field']] = PMA_replace_binary_contents($vrow[$field['Field']]);
467 } // end if
468 $special_chars = htmlspecialchars($vrow[$field['Field']]);
470 //We need to duplicate the first \n or otherwise we will lose the first newline entered in a VARCHAR or TEXT column
471 $special_chars_encoded = PMA_duplicateFirstNewline($special_chars);
473 $data = $vrow[$field['Field']];
474 } // end if... else...
475 // If a timestamp field value is not included in an update
476 // statement MySQL auto-update it to the current timestamp;
477 // however, things have changed since MySQL 4.1, so
478 // it's better to set a fields_prev in this situation
479 $backup_field = '<input type="hidden" name="fields_prev'
480 . $field_name_appendix . '" value="'
481 . htmlspecialchars($vrow[$field['Field']]) . '" />';
482 } else {
483 // (we are inserting)
484 // display default values
485 if (!isset($field['Default'])) {
486 $field['Default'] = '';
487 $real_null_value = TRUE;
488 $data = '';
489 } else {
490 $data = $field['Default'];
492 if ($field['True_Type'] == 'bit') {
493 $special_chars = PMA_convert_bit_default_value($field['Default']);
494 } else {
495 $special_chars = htmlspecialchars($field['Default']);
497 $backup_field = '';
498 $special_chars_encoded = PMA_duplicateFirstNewline($special_chars);
499 // this will select the UNHEX function while inserting
500 if (($field['is_binary'] || ($field['is_blob'] && ! $cfg['ProtectBinary'])) && $_SESSION['tmp_user_values']['display_binary_as_hex'] && $cfg['ShowFunctionFields']) {
501 $field['display_binary_as_hex'] = true;
505 $idindex = ($o_rows * $fields_cnt) + $i + 1;
506 $tabindex = (($idindex - 1) * 3) + 1;
508 // The function column
509 // -------------------
510 // Change by Bernard M. Piller <bernard@bmpsystems.com>
511 // We don't want binary data to be destroyed
512 // Note: from the MySQL manual: "BINARY doesn't affect how the column is
513 // stored or retrieved" so it does not mean that the contents is
514 // binary
515 if ($cfg['ShowFunctionFields']) {
516 if (($cfg['ProtectBinary'] && $field['is_blob'] && !$is_upload)
517 || ($cfg['ProtectBinary'] == 'all' && $field['is_binary'])) {
518 echo ' <td align="center">' . __('Binary') . '</td>' . "\n";
519 } elseif (strstr($field['True_Type'], 'enum') || strstr($field['True_Type'], 'set')) {
520 echo ' <td align="center">--</td>' . "\n";
521 } else {
523 <td>
524 <select name="funcs<?php echo $field_name_appendix; ?>" <?php echo $unnullify_trigger; ?> tabindex="<?php echo ($tabindex + $tabindex_for_function); ?>" id="field_<?php echo $idindex; ?>_1">
525 <option></option>
526 <?php
527 $selected = '';
529 // Find the current type in the RestrictColumnTypes. Will result in 'FUNC_CHAR'
530 // or something similar. Then directly look up the entry in the RestrictFunctions array,
531 // which will then reveal the available dropdown options
532 if (isset($cfg['RestrictColumnTypes'][strtoupper($field['True_Type'])])
533 && isset($cfg['RestrictFunctions'][$cfg['RestrictColumnTypes'][strtoupper($field['True_Type'])]])) {
534 $current_func_type = $cfg['RestrictColumnTypes'][strtoupper($field['True_Type'])];
535 $dropdown = $cfg['RestrictFunctions'][$current_func_type];
536 $default_function = $cfg['DefaultFunctions'][$current_func_type];
537 } else {
538 $dropdown = array();
539 $default_function = '';
542 $dropdown_built = array();
543 $op_spacing_needed = FALSE;
545 // what function defined as default?
546 // for the first timestamp we don't set the default function
547 // if there is a default value for the timestamp
548 // (not including CURRENT_TIMESTAMP)
549 // and the column does not have the
550 // ON UPDATE DEFAULT TIMESTAMP attribute.
552 if ($field['True_Type'] == 'timestamp'
553 && empty($field['Default'])
554 && ! isset($analyzed_sql[0]['create_table_fields'][$field['Field']]['on_update_current_timestamp'])) {
555 $default_function = $cfg['DefaultFunctions']['first_timestamp'];
558 // For primary keys of type char(36) or varchar(36) UUID if the default function
559 // Only applies to insert mode, as it would silently trash data on updates.
560 if ($insert_mode
561 && $field['Key'] == 'PRI'
562 && ($field['Type'] == 'char(36)' || $field['Type'] == 'varchar(36)')
564 $default_function = $cfg['DefaultFunctions']['pk_char36'];
567 // this is set only when appropriate and is always true
568 if (isset($field['display_binary_as_hex'])) {
569 $default_function = 'UNHEX';
572 // loop on the dropdown array and print all available options for that field.
573 foreach ($dropdown as $each_dropdown){
574 echo '<option';
575 if ($default_function === $each_dropdown) {
576 echo ' selected="selected"';
578 echo '>' . $each_dropdown . '</option>' . "\n";
579 $dropdown_built[$each_dropdown] = 'TRUE';
580 $op_spacing_needed = TRUE;
583 // For compatibility's sake, do not let out all other functions. Instead
584 // print a separator (blank) and then show ALL functions which weren't shown
585 // yet.
586 $cnt_functions = count($cfg['Functions']);
587 for ($j = 0; $j < $cnt_functions; $j++) {
588 if (!isset($dropdown_built[$cfg['Functions'][$j]]) || $dropdown_built[$cfg['Functions'][$j]] != 'TRUE') {
589 // Is current function defined as default?
590 $selected = ($field['first_timestamp'] && $cfg['Functions'][$j] == $cfg['DefaultFunctions']['first_timestamp'])
591 || (!$field['first_timestamp'] && $cfg['Functions'][$j] == $default_function)
592 ? ' selected="selected"'
593 : '';
594 if ($op_spacing_needed == TRUE) {
595 echo ' ';
596 echo '<option value="">--------</option>' . "\n";
597 $op_spacing_needed = FALSE;
600 echo ' ';
601 echo '<option' . $selected . '>' . $cfg['Functions'][$j] . '</option>' . "\n";
603 } // end for
604 unset($selected);
606 </select>
607 </td>
608 <?php
610 } // end if ($cfg['ShowFunctionFields'])
613 // The null column
614 // ---------------
615 $foreignData = PMA_getForeignData($foreigners, $field['Field'], false, '', '');
616 echo ' <td>' . "\n";
617 if ($field['Null'] == 'YES') {
618 echo ' <input type="hidden" name="fields_null_prev' . $field_name_appendix . '"';
619 if ($real_null_value && !$field['first_timestamp']) {
620 echo ' value="on"';
622 echo ' />' . "\n";
624 echo ' <input type="checkbox" tabindex="' . ($tabindex + $tabindex_for_null) . '"'
625 . ' name="fields_null' . $field_name_appendix . '"';
626 if ($real_null_value && !$field['first_timestamp']) {
627 echo ' checked="checked"';
629 echo ' id="field_' . ($idindex) . '_2"';
630 $onclick = ' onclick="if (this.checked) {nullify(';
631 if (strstr($field['True_Type'], 'enum')) {
632 if (strlen($field['Type']) > 20) {
633 $onclick .= '1, ';
634 } else {
635 $onclick .= '2, ';
637 } elseif (strstr($field['True_Type'], 'set')) {
638 $onclick .= '3, ';
639 } elseif ($foreigners && isset($foreigners[$field['Field']]) && $foreignData['foreign_link'] == false) {
640 // foreign key in a drop-down
641 $onclick .= '4, ';
642 } elseif ($foreigners && isset($foreigners[$field['Field']]) && $foreignData['foreign_link'] == true) {
643 // foreign key with a browsing icon
644 $onclick .= '6, ';
645 } else {
646 $onclick .= '5, ';
648 $onclick .= '\'' . PMA_escapeJsString($field['Field_html']) . '\', \'' . $field['Field_md5'] . '\', \'' . PMA_escapeJsString($vkey) . '\'); this.checked = true}; return true" />' . "\n";
649 echo $onclick;
651 echo ' </td>' . "\n";
653 // The value column (depends on type)
654 // ----------------
655 // See bug #1667887 for the reason why we don't use the maxlength
656 // HTML attribute
658 echo ' <td>' . "\n";
659 if ($foreignData['foreign_link'] == true) {
660 echo $backup_field . "\n";
662 <input type="hidden" name="fields_type<?php echo $field_name_appendix; ?>"
663 value="foreign" />
664 <input type="hidden" name="fields<?php echo $field_name_appendix; ?>"
665 value="" id="field_<?php echo ($idindex); ?>_3A" />
666 <input type="text" name="field_<?php echo $field_name_appendix_md5; ?>"
667 class="textfield" <?php echo $unnullify_trigger; ?>
668 tabindex="<?php echo ($tabindex + $tabindex_for_value); ?>"
669 id="field_<?php echo ($idindex); ?>_3"
670 value="<?php echo htmlspecialchars($data); ?>" />
671 <script type="text/javascript">
672 //<![CDATA[
673 document.writeln('<a target="_blank" onclick="window.open(this.href, \'foreigners\', \'width=640,height=240,scrollbars=yes,resizable=yes\'); return false"');
674 document.write(' href="browse_foreigners.php?');
675 document.write('<?php echo PMA_generate_common_url($db, $table); ?>');
676 document.writeln('&amp;field=<?php echo PMA_escapeJsString(urlencode($field['Field']) . $browse_foreigners_uri); ?>">');
677 document.writeln('<?php echo str_replace("'", "\'", $titles['Browse']); ?></a>');
678 //]]>
679 </script>
680 <?php
681 } elseif (is_array($foreignData['disp_row'])) {
682 echo $backup_field . "\n";
684 <input type="hidden" name="fields_type<?php echo $field_name_appendix; ?>"
685 value="foreign" />
686 <input type="hidden" name="fields<?php echo $field_name_appendix; ?>"
687 value="" id="field_<?php echo $idindex; ?>_3A" />
688 <select name="field_<?php echo $field_name_appendix_md5; ?>"
689 <?php echo $unnullify_trigger; ?>
690 tabindex="<?php echo ($tabindex + $tabindex_for_value); ?>"
691 id="field_<?php echo ($idindex); ?>_3">
692 <?php echo PMA_foreignDropdown($foreignData['disp_row'], $foreignData['foreign_field'], $foreignData['foreign_display'], $data, $cfg['ForeignKeyMaxLimit']); ?>
693 </select>
694 <?php
695 // still needed? :
696 unset($foreignData['disp_row']);
697 } elseif ($cfg['LongtextDoubleTextarea'] && strstr($field['pma_type'], 'longtext')) {
699 &nbsp;</td>
700 </tr>
701 <tr class="<?php echo $odd_row ? 'odd' : 'even'; ?>">
702 <td colspan="5" align="right">
703 <?php echo $backup_field . "\n"; ?>
704 <textarea name="fields<?php echo $field_name_appendix; ?>"
705 rows="<?php echo ($cfg['TextareaRows']*2); ?>"
706 cols="<?php echo ($cfg['TextareaCols']*2); ?>"
707 dir="<?php echo $text_dir; ?>"
708 id="field_<?php echo ($idindex); ?>_3"
709 <?php echo $unnullify_trigger; ?>
710 tabindex="<?php echo ($tabindex + $tabindex_for_value); ?>"
711 ><?php echo $special_chars_encoded; ?></textarea>
712 <?php
713 } elseif (strstr($field['pma_type'], 'text')) {
714 echo $backup_field . "\n";
716 <textarea name="fields<?php echo $field_name_appendix; ?>"
717 rows="<?php echo $cfg['TextareaRows']; ?>"
718 cols="<?php echo $cfg['TextareaCols']; ?>"
719 dir="<?php echo $text_dir; ?>"
720 id="field_<?php echo ($idindex); ?>_3"
721 <?php echo $unnullify_trigger; ?>
722 tabindex="<?php echo ($tabindex + $tabindex_for_value); ?>"
723 ><?php echo $special_chars_encoded; ?></textarea>
724 <?php
725 echo "\n";
726 if (strlen($special_chars) > 32000) {
727 echo " </td>\n";
728 echo ' <td>' . __(' Because of its length,<br /> this field might not be editable ');
730 } elseif ($field['pma_type'] == 'enum') {
731 if (! isset($table_fields[$i]['values'])) {
732 $table_fields[$i]['values'] = array();
733 foreach ($extracted_fieldspec['enum_set_values'] as $val) {
734 // Removes automatic MySQL escape format
735 $val = str_replace('\'\'', '\'', str_replace('\\\\', '\\', $val));
736 $table_fields[$i]['values'][] = array(
737 'plain' => $val,
738 'html' => htmlspecialchars($val),
742 $field_enum_values = $table_fields[$i]['values'];
744 <input type="hidden" name="fields_type<?php echo $field_name_appendix; ?>" value="enum" />
745 <input type="hidden" name="fields<?php echo $field_name_appendix; ?>" value="" />
746 <?php
747 echo "\n" . ' ' . $backup_field . "\n";
749 // show dropdown or radio depend on length
750 if (strlen($field['Type']) > 20) {
752 <select name="field_<?php echo $field_name_appendix_md5; ?>"
753 <?php echo $unnullify_trigger; ?>
754 tabindex="<?php echo ($tabindex + $tabindex_for_value); ?>"
755 id="field_<?php echo ($idindex); ?>_3">
756 <option value="">&nbsp;</option>
757 <?php
758 echo "\n";
760 foreach ($field_enum_values as $enum_value) {
761 echo ' ';
762 echo '<option value="' . $enum_value['html'] . '"';
763 if ($data == $enum_value['plain']
764 || ($data == ''
765 && (! isset($where_clause) || $field['Null'] != 'YES')
766 && isset($field['Default'])
767 && $enum_value['plain'] == $field['Default'])) {
768 echo ' selected="selected"';
770 echo '>' . $enum_value['html'] . '</option>' . "\n";
771 } // end for
774 </select>
775 <?php
776 } else {
777 $j = 0;
778 foreach ($field_enum_values as $enum_value) {
779 echo ' ';
780 echo '<input type="radio" name="field_' . $field_name_appendix_md5 . '"';
781 echo ' value="' . $enum_value['html'] . '"';
782 echo ' id="field_' . ($idindex) . '_3_' . $j . '"';
783 echo $unnullify_trigger;
784 if ($data == $enum_value['plain']
785 || ($data == ''
786 && (! isset($where_clause) || $field['Null'] != 'YES')
787 && isset($field['Default'])
788 && $enum_value['plain'] == $field['Default'])) {
789 echo ' checked="checked"';
791 echo ' tabindex="' . ($tabindex + $tabindex_for_value) . '" />';
792 echo '<label for="field_' . $idindex . '_3_' . $j . '">'
793 . $enum_value['html'] . '</label>' . "\n";
794 $j++;
795 } // end for
796 } // end else
797 } elseif ($field['pma_type'] == 'set') {
798 if (! isset($table_fields[$i]['values'])) {
799 $table_fields[$i]['values'] = array();
800 foreach ($extracted_fieldspec['enum_set_values'] as $val) {
801 $table_fields[$i]['values'][] = array(
802 'plain' => $val,
803 'html' => htmlspecialchars($val),
806 $table_fields[$i]['select_size'] = min(4, count($table_fields[$i]['values']));
808 $field_set_values = $table_fields[$i]['values'];
809 $select_size = $table_fields[$i]['select_size'];
811 $vset = array_flip(explode(',', $data));
812 echo $backup_field . "\n";
814 <input type="hidden" name="fields_type<?php echo $field_name_appendix; ?>" value="set" />
815 <input type="hidden" name="fields<?php echo $field_name_appendix; ?>" value="" />
816 <select name="field_<?php echo $field_name_appendix_md5; ?>"
817 size="<?php echo $select_size; ?>"
818 multiple="multiple" <?php echo $unnullify_trigger; ?>
819 tabindex="<?php echo ($tabindex + $tabindex_for_value); ?>"
820 id="field_<?php echo ($idindex); ?>_3">
821 <?php
822 foreach ($field_set_values as $field_set_value) {
823 echo ' ';
824 echo '<option value="' . $field_set_value['html'] . '"';
825 if (isset($vset[$field_set_value['plain']])) {
826 echo ' selected="selected"';
828 echo '>' . $field_set_value['html'] . '</option>' . "\n";
829 } // end for
831 </select>
832 <?php
834 // Change by Bernard M. Piller <bernard@bmpsystems.com>
835 // We don't want binary data destroyed
836 elseif ($field['is_binary'] || $field['is_blob']) {
837 if (($cfg['ProtectBinary'] && $field['is_blob'])
838 || ($cfg['ProtectBinary'] == 'all' && $field['is_binary'])) {
839 echo "\n";
840 // for blobstreaming
841 $bs_reference_exists = FALSE;
843 if (isset ($tbl_type) && strlen ($tbl_type) > 0)
845 // load PMA_Config
846 $PMA_Config = $GLOBALS['PMA_Config'];
848 if (!empty($PMA_Config))
850 $requiredTblType = $PMA_Config->get('PBXT_NAME');
852 if ($requiredTblType == strtolower ($tbl_type))
854 $pluginsExist = $PMA_Config->get('BLOBSTREAMING_PLUGINS_EXIST');
856 // check if blobstreaming plugins exist
857 if ($pluginsExist)
859 $bs_tables = $PMA_Config->get('BLOBSTREAMABLE_DATABASES');
861 if (!empty($bs_tables) && strlen($db) > 0)
863 $bs_tables = $bs_tables[$db];
865 if (isset($bs_tables))
867 $allBSTablesExist = TRUE;
869 foreach ($bs_tables as $table_key=>$bs_tbl)
870 if (!$bs_tables[$table_key]['Exists'])
872 $allBSTablesExist = FALSE;
873 break;
876 if ($allBSTablesExist)
877 $bs_reference_exists = PMA_BS_ReferenceExists($data, $db);
878 } // end if (isset($bs_tables))
879 } // end if (!empty($bs_tables) && strlen($db) > 0)
880 } // end if ($pluginsExist)
881 } // end if ($requiredTblType == strtolower ($tbl_type))
882 } // end if (!empty($PMA_Config))
883 } // end if (isset ($tbl_type) && strlen ($tbl_type) > 0)
885 if ($bs_reference_exists)
887 echo '<input type="hidden" name="remove_blob_ref_' . $field['Field_md5'] . $vkey . '" value="' . $data . '" />';
888 echo '<input type="checkbox" name="remove_blob_repo_' . $field['Field_md5'] . $vkey . '" /> ' . __('Remove BLOB Repository Reference') . "<br />";
889 echo PMA_BS_CreateReferenceLink($data, $db);
890 echo "<br />";
892 else
894 echo __('Binary - do not edit');
895 if (isset($data)) {
896 $data_size = PMA_formatByteDown(strlen(stripslashes($data)), 3, 1);
897 echo ' ('. $data_size [0] . ' ' . $data_size[1] . ')';
898 unset($data_size);
900 echo "\n";
901 } // end if ($bs_reference_exists)
903 <input type="hidden" name="fields_type<?php echo $field_name_appendix; ?>" value="protected" />
904 <input type="hidden" name="fields<?php echo $field_name_appendix; ?>" value="" />
905 <?php
906 } elseif ($field['is_blob']) {
907 echo "\n";
908 echo $backup_field . "\n";
910 <textarea name="fields<?php echo $field_name_appendix; ?>"
911 rows="<?php echo $cfg['TextareaRows']; ?>"
912 cols="<?php echo $cfg['TextareaCols']; ?>"
913 dir="<?php echo $text_dir; ?>"
914 id="field_<?php echo ($idindex); ?>_3"
915 <?php echo $unnullify_trigger; ?>
916 tabindex="<?php echo ($tabindex + $tabindex_for_value); ?>"
917 ><?php echo $special_chars_encoded; ?></textarea>
918 <?php
920 } else {
921 // field size should be at least 4 and max 40
922 $fieldsize = min(max($field['len'], 4), 40);
923 echo "\n";
924 echo $backup_field . "\n";
926 <input type="text" name="fields<?php echo $field_name_appendix; ?>"
927 value="<?php echo $special_chars; ?>" size="<?php echo $fieldsize; ?>"
928 class="textfield" <?php echo $unnullify_trigger; ?>
929 tabindex="<?php echo ($tabindex + $tabindex_for_value); ?>"
930 id="field_<?php echo ($idindex); ?>_3" />
931 <?php
932 } // end if...elseif...else
934 // Upload choice (only for BLOBs because the binary
935 // attribute does not imply binary contents)
936 // (displayed whatever value the ProtectBinary has)
938 if ($is_upload && $field['is_blob']) {
939 // check if field type is of longblob
940 if ($field['pma_type'] == "longblob")
942 if (isset ($tbl_type) && strlen ($tbl_type) > 0)
944 // load PMA Config
945 $PMA_Config = $GLOBALS['PMA_Config'];
947 // is PMA_Config's data loaded? continue only if it is
948 if (!empty($PMA_Config))
950 $requiredTblType = $PMA_Config->get('PBXT_NAME');
952 if ($requiredTblType == strtolower ($tbl_type))
954 $pluginsExist = $PMA_Config->get('BLOBSTREAMING_PLUGINS_EXIST');
956 // check if blobstreaming plugins exist
957 if ($pluginsExist)
959 $curlExists = $PMA_Config->get('CURL_EXISTS');
961 // check if CURL exists
962 if ($curlExists)
964 $bs_tables = $PMA_Config->get('BLOBSTREAMABLE_DATABASES');
966 // check for BLOBStreamable databases and if current database name is provided
967 if (!empty($bs_tables) && strlen($db) > 0)
969 $bs_tables = $bs_tables[$db];
971 // check if reference to BLOBStreaming tables exists
972 if (isset($bs_tables))
974 $allBSTablesExist = TRUE;
976 foreach ($bs_tables as $table_key=>$bs_tbl)
977 if (!$bs_tables[$table_key]['Exists'])
979 $allBSTablesExist = FALSE;
980 break;
983 // check if necessary BLOBStreaming tables exist
984 if ($allBSTablesExist)
986 echo '<br />';
987 echo '<input type="checkbox" name="upload_blob_repo_' . $field['Field_md5'] . $vkey . '" /> ' . __('Upload to BLOB repository');
988 } // end if ($allBSTablesExist)
989 } // end if (isset($bs_tables)
990 } // end if (!empty($bs_tables) && strlen ($db) > 0)
991 } // end if ($curlExists)
992 } // end if ($pluginsExist)
993 } // end if ($requiredTblType == strtolower ($tbl_type))
994 } // end if (!empty($PMA_Config))
995 } // end if (isset ($tbl_type) && strlen ($tbl_type) > 0)
998 echo '<br />';
999 echo '<input type="file" name="fields_upload_' . $field['Field_md5'] . $vkey . '" class="textfield" id="field_' . $idindex . '_3" size="10" ' . $unnullify_trigger . '/>&nbsp;';
1001 // find maximum upload size, based on field type
1003 * @todo with functions this is not so easy, as you can basically
1004 * process any data with function like MD5
1006 $max_field_sizes = array(
1007 'tinyblob' => '256',
1008 'blob' => '65536',
1009 'mediumblob' => '16777216',
1010 'longblob' => '4294967296'); // yeah, really
1012 $this_field_max_size = $max_upload_size; // from PHP max
1013 if ($this_field_max_size > $max_field_sizes[$field['pma_type']]) {
1014 $this_field_max_size = $max_field_sizes[$field['pma_type']];
1016 echo PMA_displayMaximumUploadSize($this_field_max_size) . "\n";
1017 // do not generate here the MAX_FILE_SIZE, because we should
1018 // put only one in the form to accommodate the biggest field
1019 if ($this_field_max_size > $biggest_max_file_size) {
1020 $biggest_max_file_size = $this_field_max_size;
1024 if (!empty($cfg['UploadDir'])) {
1025 $files = PMA_getFileSelectOptions(PMA_userDir($cfg['UploadDir']));
1026 if ($files === FALSE) {
1027 echo ' <font color="red">' . __('Error') . '</font><br />' . "\n";
1028 echo ' ' . __('The directory you set for upload work cannot be reached') . "\n";
1029 } elseif (!empty($files)) {
1030 echo "<br />\n";
1031 echo ' <i>' . __('Or') . '</i>' . ' ' . __('web server upload directory') . ':<br />' . "\n";
1032 echo ' <select size="1" name="fields_uploadlocal_' . $field['Field_md5'] . $vkey . '">' . "\n";
1033 echo ' <option value="" selected="selected"></option>' . "\n";
1034 echo $files;
1035 echo ' </select>' . "\n";
1037 } // end if (web-server upload directory)
1038 } // end elseif (binary or blob)
1039 else {
1040 // field size should be at least 4 and max 40
1041 $fieldsize = min(max($field['len'], 4), 40);
1042 echo $backup_field . "\n";
1043 if ($field['is_char'] && ($cfg['CharEditing'] == 'textarea' || strpos($data, "\n") !== FALSE)) {
1044 echo "\n";
1046 <textarea name="fields<?php echo $field_name_appendix; ?>"
1047 rows="<?php echo $cfg['CharTextareaRows']; ?>"
1048 cols="<?php echo $cfg['CharTextareaCols']; ?>"
1049 dir="<?php echo $text_dir; ?>"
1050 id="field_<?php echo ($idindex); ?>_3"
1051 <?php echo $unnullify_trigger; ?>
1052 tabindex="<?php echo ($tabindex + $tabindex_for_value); ?>"
1053 ><?php echo $special_chars_encoded; ?></textarea>
1054 <?php
1055 } else {
1057 <input type="text" name="fields<?php echo $field_name_appendix; ?>"
1058 value="<?php echo $special_chars; ?>" size="<?php echo $fieldsize; ?>"
1059 class="textfield" <?php echo $unnullify_trigger; ?>
1060 tabindex="<?php echo ($tabindex + $tabindex_for_value); ?>"
1061 id="field_<?php echo ($idindex); ?>_3" />
1062 <?php
1063 if ($field['Extra'] == 'auto_increment') {
1065 <input type="hidden" name="auto_increment<?php echo $field_name_appendix; ?>" value="1" />
1066 <?php
1067 } // end if
1068 if (substr($field['pma_type'], 0, 9) == 'timestamp') {
1070 <input type="hidden" name="fields_type<?php echo $field_name_appendix; ?>" value="timestamp" />
1071 <?php
1073 if (substr($field['pma_type'], 0, 8) == 'datetime') {
1075 <input type="hidden" name="fields_type<?php echo $field_name_appendix; ?>" value="datetime" />
1076 <?php
1078 if ($field['True_Type'] == 'bit') {
1080 <input type="hidden" name="fields_type<?php echo $field_name_appendix; ?>" value="bit" />
1081 <?php
1083 if ($field['pma_type'] == 'date' || $field['pma_type'] == 'datetime' || substr($field['pma_type'], 0, 9) == 'timestamp') {
1084 // the _3 suffix points to the date field
1085 // the _2 suffix points to the corresponding NULL checkbox
1087 <script type="text/javascript">
1088 //<![CDATA[
1089 $(function() {
1090 $('#field_<?php echo ($idindex); ?>_3').datepicker({
1091 duration: '',
1092 time24h: true,
1093 stepMinutes: 1,
1094 stepHours: 1,
1095 <?php echo ($field['pma_type'] == 'date' ? "showTime: false,":"showTime: true,"); ?>
1096 altTimeField: '',
1097 constrainInput: false
1100 //]]>
1101 </script>
1102 <?php
1107 </td>
1108 </tr>
1109 <?php
1110 $odd_row = !$odd_row;
1111 } // end for
1112 $o_rows++;
1113 echo ' </tbody></table><br />';
1114 } // end foreach on multi-edit
1116 <br />
1118 <fieldset>
1119 <table border="0" cellpadding="5" cellspacing="0">
1120 <tr>
1121 <td valign="middle" nowrap="nowrap">
1122 <select name="submit_type" tabindex="<?php echo ($tabindex + $tabindex_for_value + 1); ?>">
1123 <?php
1124 if (isset($where_clause)) {
1126 <option value="save"><?php echo __('Save'); ?></option>
1127 <?php
1130 <option value="insert"><?php echo __('Insert as new row'); ?></option>
1131 <option value="insertignore"><?php echo __('Insert as new row and ignore errors'); ?></option>
1132 <option value="showinsert"><?php echo __('Show insert query'); ?></option>
1133 </select>
1134 <?php
1135 echo "\n";
1137 if (!isset($after_insert)) {
1138 $after_insert = 'back';
1141 </td>
1142 <td valign="middle">
1143 &nbsp;&nbsp;&nbsp;<strong><?php echo __('and then'); ?></strong>&nbsp;&nbsp;&nbsp;
1144 </td>
1145 <td valign="middle" nowrap="nowrap">
1146 <select name="after_insert">
1147 <option value="back" <?php echo ($after_insert == 'back' ? 'selected="selected"' : ''); ?>><?php echo __('Go back to previous page'); ?></option>
1148 <option value="new_insert" <?php echo ($after_insert == 'new_insert' ? 'selected="selected"' : ''); ?>><?php echo __('Insert another new row'); ?></option>
1149 <?php
1150 if (isset($where_clause)) {
1152 <option value="same_insert" <?php echo ($after_insert == 'same_insert' ? 'selected="selected"' : ''); ?>><?php echo __('Go back to this page'); ?></option>
1153 <?php
1154 // If we have just numeric primary key, we can also edit next
1155 // in 2.8.2, we were looking for `field_name` = numeric_value
1156 //if (preg_match('@^[\s]*`[^`]*` = [0-9]+@', $where_clause)) {
1157 // in 2.9.0, we are looking for `table_name`.`field_name` = numeric_value
1158 if ($found_unique_key && preg_match('@^[\s]*`[^`]*`[\.]`[^`]*` = [0-9]+@', $where_clause)) {
1160 <option value="edit_next" <?php echo ($after_insert == 'edit_next' ? 'selected="selected"' : ''); ?>><?php echo __('Edit next row'); ?></option>
1161 <?php
1165 </select>
1166 </td>
1167 </tr>
1169 <tr>
1170 <td>
1171 <?php echo PMA_showHint(__('Use TAB key to move from value to value, or CTRL+arrows to move anywhere')); ?>
1172 </td>
1173 <td colspan="3" align="right" valign="middle">
1174 <input type="submit" value="<?php echo __('Go'); ?>" tabindex="<?php echo ($tabindex + $tabindex_for_value + 6); ?>" id="buttonYes" />
1175 <input type="reset" value="<?php echo __('Reset'); ?>" tabindex="<?php echo ($tabindex + $tabindex_for_value + 7); ?>" />
1176 </td>
1177 </tr>
1178 </table>
1179 </fieldset>
1180 <?php if ($biggest_max_file_size > 0) {
1181 echo ' ' . PMA_generateHiddenMaxFileSize($biggest_max_file_size) . "\n";
1182 } ?>
1183 </form>
1184 <?php
1185 if ($insert_mode) {
1187 <!-- Restart insertion form -->
1188 <form method="post" action="tbl_replace.php" name="restartForm" >
1189 <?php echo PMA_generate_common_hidden_inputs($db, $table); ?>
1190 <input type="hidden" name="goto" value="<?php echo htmlspecialchars($GLOBALS['goto']); ?>" />
1191 <input type="hidden" name="err_url" value="<?php echo htmlspecialchars($err_url); ?>" />
1192 <input type="hidden" name="sql_query" value="<?php echo htmlspecialchars($sql_query); ?>" />
1193 <?php
1194 if (isset($where_clauses)) {
1195 foreach ($where_clause_array as $key_id => $where_clause) {
1196 echo '<input type="hidden" name="where_clause[' . $key_id . ']" value="' . htmlspecialchars(trim($where_clause)) . '" />'. "\n";
1199 $tmp = '<select name="insert_rows" id="insert_rows" onchange="this.form.submit();" >' . "\n";
1200 $option_values = array(1,2,5,10,15,20,30,40);
1201 foreach ($option_values as $value) {
1202 $tmp .= '<option value="' . $value . '"';
1203 if ($value == $cfg['InsertRows']) {
1204 $tmp .= ' selected="selected"';
1206 $tmp .= '>' . $value . '</option>' . "\n";
1208 $tmp .= '</select>' . "\n";
1209 echo "\n" . sprintf(__('Restart insertion with %s rows'), $tmp);
1210 unset($tmp);
1211 echo '<noscript><input type="submit" value="' . __('Go') . '" /></noscript>' . "\n";
1212 echo '</form>' . "\n";
1216 * Displays the footer
1218 require_once './libraries/footer.inc.php';