Translation update done using Pootle.
[phpmyadmin/crack.git] / tbl_change.php
blobf8734904a910213ccdcfdc1021c85f5cf2294899
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 * @package phpMyAdmin
9 */
11 /**
12 * Gets the variables sent or posted to this script and displays the header
14 require_once './libraries/common.inc.php';
16 /**
17 * Ensures db and table are valid, else moves to the "parent" script
19 require_once './libraries/db_table_exists.lib.php';
21 /**
22 * Sets global variables.
23 * Here it's better to use a if, instead of the '?' operator
24 * to avoid setting a variable to '' when it's not present in $_REQUEST
26 if (isset($_REQUEST['where_clause'])) {
27 $where_clause = $_REQUEST['where_clause'];
29 if (isset($_REQUEST['clause_is_unique'])) {
30 $clause_is_unique = $_REQUEST['clause_is_unique'];
32 if (isset($_SESSION['edit_next'])) {
33 $where_clause = $_SESSION['edit_next'];
34 unset($_SESSION['edit_next']);
35 $after_insert = 'edit_next';
37 if (isset($_REQUEST['sql_query'])) {
38 $sql_query = $_REQUEST['sql_query'];
40 if (isset($_REQUEST['ShowFunctionFields'])) {
41 $cfg['ShowFunctionFields'] = $_REQUEST['ShowFunctionFields'];
43 if (isset($_REQUEST['ShowFieldTypesInDataEditView'])) {
44 $cfg['ShowFieldTypesInDataEditView'] = $_REQUEST['ShowFieldTypesInDataEditView'];
47 /**
48 * load relation data, foreign keys
50 require_once './libraries/relation.lib.php';
52 /**
53 * file listing
55 require_once './libraries/file_listing.php';
58 /**
59 * Defines the url to return to in case of error in a sql statement
60 * (at this point, $GLOBALS['goto'] will be set but could be empty)
62 if (empty($GLOBALS['goto'])) {
63 if (strlen($table)) {
64 // avoid a problem (see bug #2202709)
65 $GLOBALS['goto'] = 'tbl_sql.php';
66 } else {
67 $GLOBALS['goto'] = 'db_sql.php';
70 /**
71 * @todo check if we could replace by "db_|tbl_" - please clarify!?
73 $_url_params = array(
74 'db' => $db,
75 'sql_query' => $sql_query
78 if (preg_match('@^tbl_@', $GLOBALS['goto'])) {
79 $_url_params['table'] = $table;
82 $err_url = $GLOBALS['goto'] . PMA_generate_common_url($_url_params);
83 unset($_url_params);
86 /**
87 * Sets parameters for links
88 * where is this variable used?
89 * replace by PMA_generate_common_url($url_params);
91 $url_query = PMA_generate_common_url($url_params, 'html', '');
93 /**
94 * get table information
95 * @todo should be done by a Table object
97 require_once './libraries/tbl_info.inc.php';
99 /**
100 * Get comments for table fileds/columns
102 $comments_map = array();
104 if ($GLOBALS['cfg']['ShowPropertyComments']) {
105 $comments_map = PMA_getComments($db, $table);
109 * START REGULAR OUTPUT
113 * used in ./libraries/header.inc.php to load JavaScript library file
115 $GLOBALS['js_include'][] = 'tbl_change.js';
116 $GLOBALS['js_include'][] = 'jquery/jquery-ui-1.8.custom.js';
117 $GLOBALS['js_include'][] = 'jquery/timepicker.js';
119 * HTTP and HTML headers
121 require_once './libraries/header.inc.php';
124 * Displays the query submitted and its result
126 * @todo where does $disp_message and $disp_query come from???
128 if (! empty($disp_message)) {
129 if (! isset($disp_query)) {
130 $disp_query = null;
132 PMA_showMessage($disp_message, $disp_query);
136 * Displays top menu links
138 require_once './libraries/tbl_links.inc.php';
142 * Get the analysis of SHOW CREATE TABLE for this table
143 * @todo should be handled by class Table
145 $show_create_table = PMA_DBI_fetch_value(
146 'SHOW CREATE TABLE ' . PMA_backquote($db) . '.' . PMA_backquote($table),
147 0, 1);
148 $analyzed_sql = PMA_SQP_analyze(PMA_SQP_parse($show_create_table));
149 unset($show_create_table);
152 * Get the list of the fields of the current table
154 PMA_DBI_select_db($db);
155 $table_fields = PMA_DBI_fetch_result('SHOW FIELDS FROM ' . PMA_backquote($table) . ';',
156 null, null, null, PMA_DBI_QUERY_STORE);
157 $rows = array();
158 if (isset($where_clause)) {
159 // when in edit mode load all selected rows from table
160 $insert_mode = false;
161 if (is_array($where_clause)) {
162 $where_clause_array = $where_clause;
163 } else {
164 $where_clause_array = array(0 => $where_clause);
167 $result = array();
168 $found_unique_key = false;
169 $where_clauses = array();
171 foreach ($where_clause_array as $key_id => $where_clause) {
172 $local_query = 'SELECT * FROM ' . PMA_backquote($db) . '.' . PMA_backquote($table) . ' WHERE ' . $where_clause . ';';
173 $result[$key_id] = PMA_DBI_query($local_query, null, PMA_DBI_QUERY_STORE);
174 $rows[$key_id] = PMA_DBI_fetch_assoc($result[$key_id]);
175 $where_clauses[$key_id] = str_replace('\\', '\\\\', $where_clause);
177 // No row returned
178 if (! $rows[$key_id]) {
179 unset($rows[$key_id], $where_clause_array[$key_id]);
180 PMA_showMessage(__('MySQL returned an empty result set (i.e. zero rows).'), $local_query);
181 echo "\n";
182 require_once './libraries/footer.inc.php';
183 } else { // end if (no row returned)
184 $meta = PMA_DBI_get_fields_meta($result[$key_id]);
185 list($unique_condition, $tmp_clause_is_unique) = PMA_getUniqueCondition($result[$key_id], count($meta), $meta, $rows[$key_id], true);
186 if (! empty($unique_condition)) {
187 $found_unique_key = true;
189 unset($unique_condition, $tmp_clause_is_unique);
192 } else {
193 // no primary key given, just load first row - but what happens if table is empty?
194 $insert_mode = true;
195 $result = PMA_DBI_query('SELECT * FROM ' . PMA_backquote($db) . '.' . PMA_backquote($table) . ' LIMIT 1;', null, PMA_DBI_QUERY_STORE);
196 $rows = array_fill(0, $cfg['InsertRows'], false);
199 // retrieve keys into foreign fields, if any
200 $foreigners = PMA_getForeigners($db, $table);
204 * Displays the form
206 // autocomplete feature of IE kills the "onchange" event handler and it
207 // must be replaced by the "onpropertychange" one in this case
208 $chg_evt_handler = (PMA_USR_BROWSER_AGENT == 'IE' && PMA_USR_BROWSER_VER >= 5 && PMA_USR_BROWSER_VER < 7)
209 ? 'onpropertychange'
210 : 'onchange';
211 // Had to put the URI because when hosted on an https server,
212 // some browsers send wrongly this form to the http server.
214 if ($cfg['CtrlArrowsMoving']) {
216 <!-- Set on key handler for moving using by Ctrl+arrows -->
217 <script src="./js/keyhandler.js" type="text/javascript"></script>
218 <script type="text/javascript">
219 //<![CDATA[
220 var switch_movement = 0;
221 document.onkeydown = onKeyDownArrowsHandler;
222 //]]>
223 </script>
224 <?php
227 $_form_params = array(
228 'db' => $db,
229 'table' => $table,
230 'goto' => $GLOBALS['goto'],
231 'err_url' => $err_url,
232 'sql_query' => $sql_query,
234 if (isset($where_clauses)) {
235 foreach ($where_clause_array as $key_id => $where_clause) {
236 $_form_params['where_clause[' . $key_id . ']'] = trim($where_clause);
239 if (isset($clause_is_unique)) {
240 $_form_params['clause_is_unique'] = $clause_is_unique;
245 <!-- Insert/Edit form -->
246 <form method="post" action="tbl_replace.php" name="insertForm" <?php if ($is_upload) { echo ' enctype="multipart/form-data"'; } ?>>
247 <?php
248 echo PMA_generate_common_hidden_inputs($_form_params);
250 $titles['Browse'] = PMA_getIcon('b_browse.png', __('Browse foreign values'));
252 // Set if we passed the first timestamp field
253 $timestamp_seen = 0;
254 $fields_cnt = count($table_fields);
256 $tabindex = 0;
257 $tabindex_for_function = +3000;
258 $tabindex_for_null = +6000;
259 $tabindex_for_value = 0;
260 $o_rows = 0;
261 $biggest_max_file_size = 0;
263 // user can toggle the display of Function column
264 // (currently does not work for multi-edits)
265 $url_params['db'] = $db;
266 $url_params['table'] = $table;
267 if (isset($where_clause)) {
268 $url_params['where_clause'] = trim($where_clause);
270 if (! empty($sql_query)) {
271 $url_params['sql_query'] = $sql_query;
274 if (! $cfg['ShowFunctionFields'] || ! $cfg['ShowFieldTypesInDataEditView']) {
275 echo __('Show');
277 if (! $cfg['ShowFunctionFields']) {
278 $this_url_params = array_merge($url_params,
279 array('ShowFunctionFields' => 1, 'ShowFieldTypesInDataEditView' => $cfg['ShowFieldTypesInDataEditView'], 'goto' => 'sql.php'));
280 echo ' : <a href="tbl_change.php' . PMA_generate_common_url($this_url_params) . '">' . __('Function') . '</a>' . "\n";
282 if (! $cfg['ShowFieldTypesInDataEditView']) {
283 $this_other_url_params = array_merge($url_params,
284 array('ShowFieldTypesInDataEditView' => 1, 'ShowFunctionFields' => $cfg['ShowFunctionFields'], 'goto' => 'sql.php'));
285 echo ' : <a href="tbl_change.php' . PMA_generate_common_url($this_other_url_params) . '">' . __('Type') . '</a>' . "\n";
288 foreach ($rows as $row_id => $vrow) {
289 if ($vrow === false) {
290 unset($vrow);
293 $jsvkey = $row_id;
294 $browse_foreigners_uri = '&amp;pk=' . $row_id;
295 $vkey = '[multi_edit][' . $jsvkey . ']';
297 $vresult = (isset($result) && is_array($result) && isset($result[$row_id]) ? $result[$row_id] : $result);
298 if ($insert_mode && $row_id > 0) {
299 echo '<input type="checkbox" checked="checked" name="insert_ignore_' . $row_id . '" id="insert_ignore_check_' . $row_id . '" />';
300 echo '<label for="insert_ignore_check_' . $row_id . '">' . __('Ignore') . '</label><br />' . "\n";
303 <table>
304 <thead>
305 <tr>
306 <th><?php echo __('Column'); ?></th>
308 <?php
309 if ($cfg['ShowFieldTypesInDataEditView']) {
310 $this_url_params = array_merge($url_params,
311 array('ShowFieldTypesInDataEditView' => 0, 'ShowFunctionFields' => $cfg['ShowFunctionFields'], 'goto' => 'sql.php'));
312 echo ' <th><a href="tbl_change.php' . PMA_generate_common_url($this_url_params) . '" title="' . __('Hide') . '">' . __('Type') . '</a></th>' . "\n";
315 if ($cfg['ShowFunctionFields']) {
316 $this_url_params = array_merge($url_params,
317 array('ShowFunctionFields' => 0, 'ShowFieldTypesInDataEditView' => $cfg['ShowFieldTypesInDataEditView'], 'goto' => 'sql.php'));
318 echo ' <th><a href="tbl_change.php' . PMA_generate_common_url($this_url_params) . '" title="' . __('Hide') . '">' . __('Function') . '</a></th>' . "\n";
321 <th><?php echo __('Null'); ?></th>
322 <th><?php echo __('Value'); ?></th>
323 </tr>
324 </thead>
325 <tfoot>
326 <tr>
327 <th colspan="5" align="right" class="tblFooters">
328 <input type="submit" value="<?php echo __('Go'); ?>" />
329 </th>
330 </tr>
331 </tfoot>
332 <tbody>
333 <?php
334 // Sets a multiplier used for input-field counts (as zero cannot be used, advance the counter plus one)
335 $m_rows = $o_rows + 1;
337 $odd_row = true;
338 for ($i = 0; $i < $fields_cnt; $i++) {
339 if (! isset($table_fields[$i]['processed'])) {
340 $table_fields[$i]['Field_html'] = htmlspecialchars($table_fields[$i]['Field']);
341 $table_fields[$i]['Field_md5'] = md5($table_fields[$i]['Field']);
342 // True_Type contains only the type (stops at first bracket)
343 $table_fields[$i]['True_Type'] = preg_replace('@\(.*@s', '', $table_fields[$i]['Type']);
345 // d a t e t i m e
347 // Current date should not be set as default if the field is NULL
348 // for the current row, but do not put here the current datetime
349 // if there is a default value (the real default value will be set
350 // in the Default value logic below)
352 // Note: (tested in MySQL 4.0.16): when lang is some UTF-8,
353 // $field['Default'] is not set if it contains NULL:
354 // Array ([Field] => d [Type] => datetime [Null] => YES [Key] => [Extra] => [True_Type] => datetime)
355 // but, look what we get if we switch to iso: (Default is NULL)
356 // Array ([Field] => d [Type] => datetime [Null] => YES [Key] => [Default] => [Extra] => [True_Type] => datetime)
357 // so I force a NULL into it (I don't think it's possible
358 // to have an empty default value for DATETIME)
359 // then, the "if" after this one will work
360 if ($table_fields[$i]['Type'] == 'datetime'
361 && ! isset($table_fields[$i]['Default'])
362 && isset($table_fields[$i]['Null'])
363 && $table_fields[$i]['Null'] == 'YES') {
364 $table_fields[$i]['Default'] = null;
367 $table_fields[$i]['len'] =
368 preg_match('@float|double@', $table_fields[$i]['Type']) ? 100 : -1;
371 if (isset($comments_map[$table_fields[$i]['Field']])) {
372 $table_fields[$i]['Field_title'] = '<span style="border-bottom: 1px dashed black;" title="'
373 . htmlspecialchars($comments_map[$table_fields[$i]['Field']]) . '">'
374 . $table_fields[$i]['Field_html'] . '</span>';
375 } else {
376 $table_fields[$i]['Field_title'] = $table_fields[$i]['Field_html'];
379 // The type column
380 $table_fields[$i]['is_binary'] = stristr($table_fields[$i]['Type'], 'binary');
381 $table_fields[$i]['is_blob'] = stristr($table_fields[$i]['Type'], 'blob');
382 $table_fields[$i]['is_char'] = stristr($table_fields[$i]['Type'], 'char');
383 $table_fields[$i]['first_timestamp'] = false;
384 switch ($table_fields[$i]['True_Type']) {
385 case 'set':
386 $table_fields[$i]['pma_type'] = 'set';
387 $table_fields[$i]['wrap'] = '';
388 break;
389 case 'enum':
390 $table_fields[$i]['pma_type'] = 'enum';
391 $table_fields[$i]['wrap'] = '';
392 break;
393 case 'timestamp':
394 if (!$timestamp_seen) { // can only occur once per table
395 $timestamp_seen = 1;
396 $table_fields[$i]['first_timestamp'] = true;
398 $table_fields[$i]['pma_type'] = $table_fields[$i]['Type'];
399 $table_fields[$i]['wrap'] = ' nowrap="nowrap"';
400 break;
402 default:
403 $table_fields[$i]['pma_type'] = $table_fields[$i]['Type'];
404 $table_fields[$i]['wrap'] = ' nowrap="nowrap"';
405 break;
408 $field = $table_fields[$i];
409 $extracted_fieldspec = PMA_extractFieldSpec($field['Type']);
411 if (-1 === $field['len']) {
412 $field['len'] = PMA_DBI_field_len($vresult, $i);
414 //Call validation when the form submited...
415 $unnullify_trigger = $chg_evt_handler . "=\"return Validator('". PMA_escapeJsString($field['Field_md5']) . "', '"
416 . PMA_escapeJsString($jsvkey) . "','".$field['pma_type']."')\"";
418 // Use an MD5 as an array index to avoid having special characters in the name atttibute (see bug #1746964 )
419 $field_name_appendix = $vkey . '[' . $field['Field_md5'] . ']';
420 $field_name_appendix_md5 = $field['Field_md5'] . $vkey . '[]';
423 if ($field['Type'] == 'datetime'
424 && ! isset($field['Default'])
425 && ! is_null($field['Default'])
426 && ($insert_mode || ! isset($vrow[$field['Field']]))) {
427 // INSERT case or
428 // UPDATE case with an NULL value
429 $vrow[$field['Field']] = date('Y-m-d H:i:s', time());
432 <tr class="<?php echo $odd_row ? 'odd' : 'even'; ?>">
433 <td <?php echo ($cfg['LongtextDoubleTextarea'] && strstr($field['True_Type'], 'longtext') ? 'rowspan="2"' : ''); ?> align="center">
434 <?php echo $field['Field_title']; ?>
435 <input type="hidden" name="fields_name<?php echo $field_name_appendix; ?>" value="<?php echo $field['Field_html']; ?>"/>
436 </td>
437 <?php if ($cfg['ShowFieldTypesInDataEditView']) { ?>
438 <td align="center"<?php echo $field['wrap']; ?>>
439 <?php echo $field['pma_type']; ?>
440 </td>
442 <?php } //End if
444 // Prepares the field value
445 $real_null_value = FALSE;
446 $special_chars_encoded = '';
447 if (isset($vrow)) {
448 // (we are editing)
449 if (is_null($vrow[$field['Field']])) {
450 $real_null_value = TRUE;
451 $vrow[$field['Field']] = '';
452 $special_chars = '';
453 $data = $vrow[$field['Field']];
454 } elseif ($field['True_Type'] == 'bit') {
455 $special_chars = PMA_printable_bit_value($vrow[$field['Field']], $extracted_fieldspec['spec_in_brackets']);
456 } else {
457 // special binary "characters"
458 if ($field['is_binary'] || ($field['is_blob'] && ! $cfg['ProtectBinary'])) {
459 if ($_SESSION['tmp_user_values']['display_binary_as_hex'] && $cfg['ShowFunctionFields']) {
460 $vrow[$field['Field']] = bin2hex($vrow[$field['Field']]);
461 $field['display_binary_as_hex'] = true;
462 } else {
463 $vrow[$field['Field']] = PMA_replace_binary_contents($vrow[$field['Field']]);
465 } // end if
466 $special_chars = htmlspecialchars($vrow[$field['Field']]);
468 //We need to duplicate the first \n or otherwise we will lose the first newline entered in a VARCHAR or TEXT column
469 $special_chars_encoded = PMA_duplicateFirstNewline($special_chars);
471 $data = $vrow[$field['Field']];
472 } // end if... else...
473 // If a timestamp field value is not included in an update
474 // statement MySQL auto-update it to the current timestamp;
475 // however, things have changed since MySQL 4.1, so
476 // it's better to set a fields_prev in this situation
477 $backup_field = '<input type="hidden" name="fields_prev'
478 . $field_name_appendix . '" value="'
479 . htmlspecialchars($vrow[$field['Field']]) . '" />';
480 } else {
481 // (we are inserting)
482 // display default values
483 if (!isset($field['Default'])) {
484 $field['Default'] = '';
485 $real_null_value = TRUE;
486 $data = '';
487 } else {
488 $data = $field['Default'];
490 if ($field['True_Type'] == 'bit') {
491 $special_chars = PMA_convert_bit_default_value($field['Default']);
492 } else {
493 $special_chars = htmlspecialchars($field['Default']);
495 $backup_field = '';
496 $special_chars_encoded = PMA_duplicateFirstNewline($special_chars);
497 // this will select the UNHEX function while inserting
498 if (($field['is_binary'] || ($field['is_blob'] && ! $cfg['ProtectBinary'])) && $_SESSION['tmp_user_values']['display_binary_as_hex'] && $cfg['ShowFunctionFields']) {
499 $field['display_binary_as_hex'] = true;
503 $idindex = ($o_rows * $fields_cnt) + $i + 1;
504 $tabindex = (($idindex - 1) * 3) + 1;
506 // The function column
507 // -------------------
508 // We don't want binary data to be destroyed
509 // Note: from the MySQL manual: "BINARY doesn't affect how the column is
510 // stored or retrieved" so it does not mean that the contents is
511 // binary
512 if ($cfg['ShowFunctionFields']) {
513 if (($cfg['ProtectBinary'] && $field['is_blob'] && !$is_upload)
514 || ($cfg['ProtectBinary'] == 'all' && $field['is_binary'])) {
515 echo ' <td align="center">' . __('Binary') . '</td>' . "\n";
516 } elseif (strstr($field['True_Type'], 'enum') || strstr($field['True_Type'], 'set')) {
517 echo ' <td align="center">--</td>' . "\n";
518 } else {
520 <td>
521 <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">
522 <option></option>
523 <?php
524 $selected = '';
526 // Find the current type in the RestrictColumnTypes. Will result in 'FUNC_CHAR'
527 // or something similar. Then directly look up the entry in the RestrictFunctions array,
528 // which will then reveal the available dropdown options
529 if (isset($cfg['RestrictColumnTypes'][strtoupper($field['True_Type'])])
530 && isset($cfg['RestrictFunctions'][$cfg['RestrictColumnTypes'][strtoupper($field['True_Type'])]])) {
531 $current_func_type = $cfg['RestrictColumnTypes'][strtoupper($field['True_Type'])];
532 $dropdown = $cfg['RestrictFunctions'][$current_func_type];
533 $default_function = $cfg['DefaultFunctions'][$current_func_type];
534 } else {
535 $dropdown = array();
536 $default_function = '';
539 $dropdown_built = array();
540 $op_spacing_needed = FALSE;
542 // what function defined as default?
543 // for the first timestamp we don't set the default function
544 // if there is a default value for the timestamp
545 // (not including CURRENT_TIMESTAMP)
546 // and the column does not have the
547 // ON UPDATE DEFAULT TIMESTAMP attribute.
549 if ($field['True_Type'] == 'timestamp'
550 && empty($field['Default'])
551 && ! isset($analyzed_sql[0]['create_table_fields'][$field['Field']]['on_update_current_timestamp'])) {
552 $default_function = $cfg['DefaultFunctions']['first_timestamp'];
555 // For primary keys of type char(36) or varchar(36) UUID if the default function
556 // Only applies to insert mode, as it would silently trash data on updates.
557 if ($insert_mode
558 && $field['Key'] == 'PRI'
559 && ($field['Type'] == 'char(36)' || $field['Type'] == 'varchar(36)')
561 $default_function = $cfg['DefaultFunctions']['pk_char36'];
564 // this is set only when appropriate and is always true
565 if (isset($field['display_binary_as_hex'])) {
566 $default_function = 'UNHEX';
569 // loop on the dropdown array and print all available options for that field.
570 foreach ($dropdown as $each_dropdown){
571 echo '<option';
572 if ($default_function === $each_dropdown) {
573 echo ' selected="selected"';
575 echo '>' . $each_dropdown . '</option>' . "\n";
576 $dropdown_built[$each_dropdown] = 'TRUE';
577 $op_spacing_needed = TRUE;
580 // For compatibility's sake, do not let out all other functions. Instead
581 // print a separator (blank) and then show ALL functions which weren't shown
582 // yet.
583 $cnt_functions = count($cfg['Functions']);
584 for ($j = 0; $j < $cnt_functions; $j++) {
585 if (!isset($dropdown_built[$cfg['Functions'][$j]]) || $dropdown_built[$cfg['Functions'][$j]] != 'TRUE') {
586 // Is current function defined as default?
587 $selected = ($field['first_timestamp'] && $cfg['Functions'][$j] == $cfg['DefaultFunctions']['first_timestamp'])
588 || (!$field['first_timestamp'] && $cfg['Functions'][$j] == $default_function)
589 ? ' selected="selected"'
590 : '';
591 if ($op_spacing_needed == TRUE) {
592 echo ' ';
593 echo '<option value="">--------</option>' . "\n";
594 $op_spacing_needed = FALSE;
597 echo ' ';
598 echo '<option' . $selected . '>' . $cfg['Functions'][$j] . '</option>' . "\n";
600 } // end for
601 unset($selected);
603 </select>
604 </td>
605 <?php
607 } // end if ($cfg['ShowFunctionFields'])
610 // The null column
611 // ---------------
612 $foreignData = PMA_getForeignData($foreigners, $field['Field'], false, '', '');
613 echo ' <td>' . "\n";
614 if ($field['Null'] == 'YES') {
615 echo ' <input type="hidden" name="fields_null_prev' . $field_name_appendix . '"';
616 if ($real_null_value && !$field['first_timestamp']) {
617 echo ' value="on"';
619 echo ' />' . "\n";
621 echo ' <input type="checkbox" tabindex="' . ($tabindex + $tabindex_for_null) . '"'
622 . ' name="fields_null' . $field_name_appendix . '"';
623 if ($real_null_value && !$field['first_timestamp']) {
624 echo ' checked="checked"';
626 echo ' id="field_' . ($idindex) . '_2"';
627 $onclick = ' onclick="if (this.checked) {nullify(';
628 if (strstr($field['True_Type'], 'enum')) {
629 if (strlen($field['Type']) > 20) {
630 $onclick .= '1, ';
631 } else {
632 $onclick .= '2, ';
634 } elseif (strstr($field['True_Type'], 'set')) {
635 $onclick .= '3, ';
636 } elseif ($foreigners && isset($foreigners[$field['Field']]) && $foreignData['foreign_link'] == false) {
637 // foreign key in a drop-down
638 $onclick .= '4, ';
639 } elseif ($foreigners && isset($foreigners[$field['Field']]) && $foreignData['foreign_link'] == true) {
640 // foreign key with a browsing icon
641 $onclick .= '6, ';
642 } else {
643 $onclick .= '5, ';
645 $onclick .= '\'' . PMA_escapeJsString($field['Field_html']) . '\', \'' . $field['Field_md5'] . '\', \'' . PMA_escapeJsString($vkey) . '\'); this.checked = true}; return true" />' . "\n";
646 echo $onclick;
648 echo ' </td>' . "\n";
650 // The value column (depends on type)
651 // ----------------
652 // See bug #1667887 for the reason why we don't use the maxlength
653 // HTML attribute
655 echo ' <td>' . "\n";
656 if ($foreignData['foreign_link'] == true) {
657 echo $backup_field . "\n";
659 <input type="hidden" name="fields_type<?php echo $field_name_appendix; ?>"
660 value="foreign" />
661 <input type="hidden" name="fields<?php echo $field_name_appendix; ?>"
662 value="" id="field_<?php echo ($idindex); ?>_3A" />
663 <input type="text" name="field_<?php echo $field_name_appendix_md5; ?>"
664 class="textfield" <?php echo $unnullify_trigger; ?>
665 tabindex="<?php echo ($tabindex + $tabindex_for_value); ?>"
666 id="field_<?php echo ($idindex); ?>_3"
667 value="<?php echo htmlspecialchars($data); ?>" />
668 <script type="text/javascript">
669 //<![CDATA[
670 document.writeln('<a target="_blank" onclick="window.open(this.href, \'foreigners\', \'width=640,height=240,scrollbars=yes,resizable=yes\'); return false"');
671 document.write(' href="browse_foreigners.php?');
672 document.write('<?php echo PMA_generate_common_url($db, $table); ?>');
673 document.writeln('&amp;field=<?php echo PMA_escapeJsString(urlencode($field['Field']) . $browse_foreigners_uri); ?>">');
674 document.writeln('<?php echo str_replace("'", "\'", $titles['Browse']); ?></a>');
675 //]]>
676 </script>
677 <?php
678 } elseif (is_array($foreignData['disp_row'])) {
679 echo $backup_field . "\n";
681 <input type="hidden" name="fields_type<?php echo $field_name_appendix; ?>"
682 value="foreign" />
683 <input type="hidden" name="fields<?php echo $field_name_appendix; ?>"
684 value="" id="field_<?php echo $idindex; ?>_3A" />
685 <select name="field_<?php echo $field_name_appendix_md5; ?>"
686 <?php echo $unnullify_trigger; ?>
687 tabindex="<?php echo ($tabindex + $tabindex_for_value); ?>"
688 id="field_<?php echo ($idindex); ?>_3">
689 <?php echo PMA_foreignDropdown($foreignData['disp_row'], $foreignData['foreign_field'], $foreignData['foreign_display'], $data, $cfg['ForeignKeyMaxLimit']); ?>
690 </select>
691 <?php
692 // still needed? :
693 unset($foreignData['disp_row']);
694 } elseif ($cfg['LongtextDoubleTextarea'] && strstr($field['pma_type'], 'longtext')) {
696 &nbsp;</td>
697 </tr>
698 <tr class="<?php echo $odd_row ? 'odd' : 'even'; ?>">
699 <td colspan="5" align="right">
700 <?php echo $backup_field . "\n"; ?>
701 <textarea name="fields<?php echo $field_name_appendix; ?>"
702 rows="<?php echo ($cfg['TextareaRows']*2); ?>"
703 cols="<?php echo ($cfg['TextareaCols']*2); ?>"
704 dir="<?php echo $text_dir; ?>"
705 id="field_<?php echo ($idindex); ?>_3"
706 <?php echo $unnullify_trigger; ?>
707 tabindex="<?php echo ($tabindex + $tabindex_for_value); ?>"
708 ><?php echo $special_chars_encoded; ?></textarea>
709 <?php
710 } elseif (strstr($field['pma_type'], 'text')) {
711 echo $backup_field . "\n";
713 <textarea name="fields<?php echo $field_name_appendix; ?>"
714 rows="<?php echo $cfg['TextareaRows']; ?>"
715 cols="<?php echo $cfg['TextareaCols']; ?>"
716 dir="<?php echo $text_dir; ?>"
717 id="field_<?php echo ($idindex); ?>_3"
718 <?php echo $unnullify_trigger; ?>
719 tabindex="<?php echo ($tabindex + $tabindex_for_value); ?>"
720 ><?php echo $special_chars_encoded; ?></textarea>
721 <?php
722 echo "\n";
723 if (strlen($special_chars) > 32000) {
724 echo " </td>\n";
725 echo ' <td>' . __(' Because of its length,<br /> this column might not be editable ');
727 } elseif ($field['pma_type'] == 'enum') {
728 if (! isset($table_fields[$i]['values'])) {
729 $table_fields[$i]['values'] = array();
730 foreach ($extracted_fieldspec['enum_set_values'] as $val) {
731 // Removes automatic MySQL escape format
732 $val = str_replace('\'\'', '\'', str_replace('\\\\', '\\', $val));
733 $table_fields[$i]['values'][] = array(
734 'plain' => $val,
735 'html' => htmlspecialchars($val),
739 $field_enum_values = $table_fields[$i]['values'];
741 <input type="hidden" name="fields_type<?php echo $field_name_appendix; ?>" value="enum" />
742 <input type="hidden" name="fields<?php echo $field_name_appendix; ?>" value="" />
743 <?php
744 echo "\n" . ' ' . $backup_field . "\n";
746 // show dropdown or radio depend on length
747 if (strlen($field['Type']) > 20) {
749 <select name="field_<?php echo $field_name_appendix_md5; ?>"
750 <?php echo $unnullify_trigger; ?>
751 tabindex="<?php echo ($tabindex + $tabindex_for_value); ?>"
752 id="field_<?php echo ($idindex); ?>_3">
753 <option value="">&nbsp;</option>
754 <?php
755 echo "\n";
757 foreach ($field_enum_values as $enum_value) {
758 echo ' ';
759 echo '<option value="' . $enum_value['html'] . '"';
760 if ($data == $enum_value['plain']
761 || ($data == ''
762 && (! isset($where_clause) || $field['Null'] != 'YES')
763 && isset($field['Default'])
764 && $enum_value['plain'] == $field['Default'])) {
765 echo ' selected="selected"';
767 echo '>' . $enum_value['html'] . '</option>' . "\n";
768 } // end for
771 </select>
772 <?php
773 } else {
774 $j = 0;
775 foreach ($field_enum_values as $enum_value) {
776 echo ' ';
777 echo '<input type="radio" name="field_' . $field_name_appendix_md5 . '"';
778 echo ' value="' . $enum_value['html'] . '"';
779 echo ' id="field_' . ($idindex) . '_3_' . $j . '"';
780 echo $unnullify_trigger;
781 if ($data == $enum_value['plain']
782 || ($data == ''
783 && (! isset($where_clause) || $field['Null'] != 'YES')
784 && isset($field['Default'])
785 && $enum_value['plain'] == $field['Default'])) {
786 echo ' checked="checked"';
788 echo ' tabindex="' . ($tabindex + $tabindex_for_value) . '" />';
789 echo '<label for="field_' . $idindex . '_3_' . $j . '">'
790 . $enum_value['html'] . '</label>' . "\n";
791 $j++;
792 } // end for
793 } // end else
794 } elseif ($field['pma_type'] == 'set') {
795 if (! isset($table_fields[$i]['values'])) {
796 $table_fields[$i]['values'] = array();
797 foreach ($extracted_fieldspec['enum_set_values'] as $val) {
798 $table_fields[$i]['values'][] = array(
799 'plain' => $val,
800 'html' => htmlspecialchars($val),
803 $table_fields[$i]['select_size'] = min(4, count($table_fields[$i]['values']));
805 $field_set_values = $table_fields[$i]['values'];
806 $select_size = $table_fields[$i]['select_size'];
808 $vset = array_flip(explode(',', $data));
809 echo $backup_field . "\n";
811 <input type="hidden" name="fields_type<?php echo $field_name_appendix; ?>" value="set" />
812 <input type="hidden" name="fields<?php echo $field_name_appendix; ?>" value="" />
813 <select name="field_<?php echo $field_name_appendix_md5; ?>"
814 size="<?php echo $select_size; ?>"
815 multiple="multiple" <?php echo $unnullify_trigger; ?>
816 tabindex="<?php echo ($tabindex + $tabindex_for_value); ?>"
817 id="field_<?php echo ($idindex); ?>_3">
818 <?php
819 foreach ($field_set_values as $field_set_value) {
820 echo ' ';
821 echo '<option value="' . $field_set_value['html'] . '"';
822 if (isset($vset[$field_set_value['plain']])) {
823 echo ' selected="selected"';
825 echo '>' . $field_set_value['html'] . '</option>' . "\n";
826 } // end for
828 </select>
829 <?php
831 // We don't want binary data destroyed
832 elseif ($field['is_binary'] || $field['is_blob']) {
833 if (($cfg['ProtectBinary'] && $field['is_blob'])
834 || ($cfg['ProtectBinary'] == 'all' && $field['is_binary'])) {
835 echo "\n";
836 // for blobstreaming
837 $bs_reference_exists = FALSE;
839 if (isset ($tbl_type) && strlen ($tbl_type) > 0)
841 // load PMA_Config
842 $PMA_Config = $GLOBALS['PMA_Config'];
844 if (!empty($PMA_Config))
846 $requiredTblType = $PMA_Config->get('PBXT_NAME');
848 if ($requiredTblType == strtolower ($tbl_type))
850 $pluginsExist = $PMA_Config->get('BLOBSTREAMING_PLUGINS_EXIST');
852 // check if blobstreaming plugins exist
853 if ($pluginsExist)
855 $bs_tables = $PMA_Config->get('BLOBSTREAMABLE_DATABASES');
857 if (!empty($bs_tables) && strlen($db) > 0)
859 $bs_tables = $bs_tables[$db];
861 if (isset($bs_tables))
863 $allBSTablesExist = TRUE;
865 foreach ($bs_tables as $table_key=>$bs_tbl)
866 if (!$bs_tables[$table_key]['Exists'])
868 $allBSTablesExist = FALSE;
869 break;
872 if ($allBSTablesExist)
873 $bs_reference_exists = PMA_BS_ReferenceExists($data, $db);
874 } // end if (isset($bs_tables))
875 } // end if (!empty($bs_tables) && strlen($db) > 0)
876 } // end if ($pluginsExist)
877 } // end if ($requiredTblType == strtolower ($tbl_type))
878 } // end if (!empty($PMA_Config))
879 } // end if (isset ($tbl_type) && strlen ($tbl_type) > 0)
881 if ($bs_reference_exists)
883 echo '<input type="hidden" name="remove_blob_ref_' . $field['Field_md5'] . $vkey . '" value="' . $data . '" />';
884 echo '<input type="checkbox" name="remove_blob_repo_' . $field['Field_md5'] . $vkey . '" /> ' . __('Remove BLOB Repository Reference') . "<br />";
885 echo PMA_BS_CreateReferenceLink($data, $db);
886 echo "<br />";
888 else
890 echo __('Binary - do not edit');
891 if (isset($data)) {
892 $data_size = PMA_formatByteDown(strlen(stripslashes($data)), 3, 1);
893 echo ' ('. $data_size [0] . ' ' . $data_size[1] . ')';
894 unset($data_size);
896 echo "\n";
897 } // end if ($bs_reference_exists)
899 <input type="hidden" name="fields_type<?php echo $field_name_appendix; ?>" value="protected" />
900 <input type="hidden" name="fields<?php echo $field_name_appendix; ?>" value="" />
901 <?php
902 } elseif ($field['is_blob']) {
903 echo "\n";
904 echo $backup_field . "\n";
906 <textarea name="fields<?php echo $field_name_appendix; ?>"
907 rows="<?php echo $cfg['TextareaRows']; ?>"
908 cols="<?php echo $cfg['TextareaCols']; ?>"
909 dir="<?php echo $text_dir; ?>"
910 id="field_<?php echo ($idindex); ?>_3"
911 <?php echo $unnullify_trigger; ?>
912 tabindex="<?php echo ($tabindex + $tabindex_for_value); ?>"
913 ><?php echo $special_chars_encoded; ?></textarea>
914 <?php
916 } else {
917 // field size should be at least 4 and max 40
918 $fieldsize = min(max($field['len'], 4), 40);
919 echo "\n";
920 echo $backup_field . "\n";
922 <input type="text" name="fields<?php echo $field_name_appendix; ?>"
923 value="<?php echo $special_chars; ?>" size="<?php echo $fieldsize; ?>"
924 class="textfield" <?php echo $unnullify_trigger; ?>
925 tabindex="<?php echo ($tabindex + $tabindex_for_value); ?>"
926 id="field_<?php echo ($idindex); ?>_3" />
927 <?php
928 } // end if...elseif...else
930 // Upload choice (only for BLOBs because the binary
931 // attribute does not imply binary contents)
932 // (displayed whatever value the ProtectBinary has)
934 if ($is_upload && $field['is_blob']) {
935 // check if field type is of longblob
936 if ($field['pma_type'] == "longblob")
938 if (isset ($tbl_type) && strlen ($tbl_type) > 0)
940 // load PMA Config
941 $PMA_Config = $GLOBALS['PMA_Config'];
943 // is PMA_Config's data loaded? continue only if it is
944 if (!empty($PMA_Config))
946 $requiredTblType = $PMA_Config->get('PBXT_NAME');
948 if ($requiredTblType == strtolower ($tbl_type))
950 $pluginsExist = $PMA_Config->get('BLOBSTREAMING_PLUGINS_EXIST');
952 // check if blobstreaming plugins exist
953 if ($pluginsExist)
955 $curlExists = $PMA_Config->get('CURL_EXISTS');
957 // check if CURL exists
958 if ($curlExists)
960 $bs_tables = $PMA_Config->get('BLOBSTREAMABLE_DATABASES');
962 // check for BLOBStreamable databases and if current database name is provided
963 if (!empty($bs_tables) && strlen($db) > 0)
965 $bs_tables = $bs_tables[$db];
967 // check if reference to BLOBStreaming tables exists
968 if (isset($bs_tables))
970 $allBSTablesExist = TRUE;
972 foreach ($bs_tables as $table_key=>$bs_tbl)
973 if (!$bs_tables[$table_key]['Exists'])
975 $allBSTablesExist = FALSE;
976 break;
979 // check if necessary BLOBStreaming tables exist
980 if ($allBSTablesExist)
982 echo '<br />';
983 echo '<input type="checkbox" name="upload_blob_repo_' . $field['Field_md5'] . $vkey . '" /> ' . __('Upload to BLOB repository');
984 } // end if ($allBSTablesExist)
985 } // end if (isset($bs_tables)
986 } // end if (!empty($bs_tables) && strlen ($db) > 0)
987 } // end if ($curlExists)
988 } // end if ($pluginsExist)
989 } // end if ($requiredTblType == strtolower ($tbl_type))
990 } // end if (!empty($PMA_Config))
991 } // end if (isset ($tbl_type) && strlen ($tbl_type) > 0)
994 echo '<br />';
995 echo '<input type="file" name="fields_upload_' . $field['Field_md5'] . $vkey . '" class="textfield" id="field_' . $idindex . '_3" size="10" ' . $unnullify_trigger . '/>&nbsp;';
997 // find maximum upload size, based on field type
999 * @todo with functions this is not so easy, as you can basically
1000 * process any data with function like MD5
1002 $max_field_sizes = array(
1003 'tinyblob' => '256',
1004 'blob' => '65536',
1005 'mediumblob' => '16777216',
1006 'longblob' => '4294967296'); // yeah, really
1008 $this_field_max_size = $max_upload_size; // from PHP max
1009 if ($this_field_max_size > $max_field_sizes[$field['pma_type']]) {
1010 $this_field_max_size = $max_field_sizes[$field['pma_type']];
1012 echo PMA_displayMaximumUploadSize($this_field_max_size) . "\n";
1013 // do not generate here the MAX_FILE_SIZE, because we should
1014 // put only one in the form to accommodate the biggest field
1015 if ($this_field_max_size > $biggest_max_file_size) {
1016 $biggest_max_file_size = $this_field_max_size;
1020 if (!empty($cfg['UploadDir'])) {
1021 $files = PMA_getFileSelectOptions(PMA_userDir($cfg['UploadDir']));
1022 if ($files === FALSE) {
1023 echo ' <font color="red">' . __('Error') . '</font><br />' . "\n";
1024 echo ' ' . __('The directory you set for upload work cannot be reached') . "\n";
1025 } elseif (!empty($files)) {
1026 echo "<br />\n";
1027 echo ' <i>' . __('Or') . '</i>' . ' ' . __('web server upload directory') . ':<br />' . "\n";
1028 echo ' <select size="1" name="fields_uploadlocal_' . $field['Field_md5'] . $vkey . '">' . "\n";
1029 echo ' <option value="" selected="selected"></option>' . "\n";
1030 echo $files;
1031 echo ' </select>' . "\n";
1033 } // end if (web-server upload directory)
1034 } // end elseif (binary or blob)
1035 else {
1036 // field size should be at least 4 and max 40
1037 $fieldsize = min(max($field['len'], 4), 40);
1038 echo $backup_field . "\n";
1039 if ($field['is_char'] && ($cfg['CharEditing'] == 'textarea' || strpos($data, "\n") !== FALSE)) {
1040 echo "\n";
1042 <textarea name="fields<?php echo $field_name_appendix; ?>"
1043 rows="<?php echo $cfg['CharTextareaRows']; ?>"
1044 cols="<?php echo $cfg['CharTextareaCols']; ?>"
1045 dir="<?php echo $text_dir; ?>"
1046 id="field_<?php echo ($idindex); ?>_3"
1047 <?php echo $unnullify_trigger; ?>
1048 tabindex="<?php echo ($tabindex + $tabindex_for_value); ?>"
1049 ><?php echo $special_chars_encoded; ?></textarea>
1050 <?php
1051 } else {
1053 <input type="text" name="fields<?php echo $field_name_appendix; ?>"
1054 value="<?php echo $special_chars; ?>" size="<?php echo $fieldsize; ?>"
1055 class="textfield" <?php echo $unnullify_trigger; ?>
1056 tabindex="<?php echo ($tabindex + $tabindex_for_value); ?>"
1057 id="field_<?php echo ($idindex); ?>_3" />
1058 <?php
1059 if ($field['Extra'] == 'auto_increment') {
1061 <input type="hidden" name="auto_increment<?php echo $field_name_appendix; ?>" value="1" />
1062 <?php
1063 } // end if
1064 if (substr($field['pma_type'], 0, 9) == 'timestamp') {
1066 <input type="hidden" name="fields_type<?php echo $field_name_appendix; ?>" value="timestamp" />
1067 <?php
1069 if (substr($field['pma_type'], 0, 8) == 'datetime') {
1071 <input type="hidden" name="fields_type<?php echo $field_name_appendix; ?>" value="datetime" />
1072 <?php
1074 if ($field['True_Type'] == 'bit') {
1076 <input type="hidden" name="fields_type<?php echo $field_name_appendix; ?>" value="bit" />
1077 <?php
1079 if ($field['pma_type'] == 'date' || $field['pma_type'] == 'datetime' || substr($field['pma_type'], 0, 9) == 'timestamp') {
1080 // the _3 suffix points to the date field
1081 // the _2 suffix points to the corresponding NULL checkbox
1082 // in dateFormat, 'yy' means the year with 4 digits
1084 <script type="text/javascript">
1085 //<![CDATA[
1086 $(function() {
1087 $('#field_<?php echo ($idindex); ?>_3').datepicker({
1088 duration: '',
1089 time24h: true,
1090 stepMinutes: 1,
1091 stepHours: 1,
1092 <?php echo ($field['pma_type'] == 'date' ? "showTime: false,":"showTime: true,"); ?>
1093 dateFormat: 'yy-mm-dd',
1094 altTimeField: '',
1095 constrainInput: false
1098 //]]>
1099 </script>
1100 <?php
1105 </td>
1106 </tr>
1107 <?php
1108 $odd_row = !$odd_row;
1109 } // end for
1110 $o_rows++;
1111 echo ' </tbody></table><br />';
1112 } // end foreach on multi-edit
1114 <br />
1116 <fieldset>
1117 <table border="0" cellpadding="5" cellspacing="0">
1118 <tr>
1119 <td valign="middle" nowrap="nowrap">
1120 <select name="submit_type" tabindex="<?php echo ($tabindex + $tabindex_for_value + 1); ?>">
1121 <?php
1122 if (isset($where_clause)) {
1124 <option value="save"><?php echo __('Save'); ?></option>
1125 <?php
1128 <option value="insert"><?php echo __('Insert as new row'); ?></option>
1129 <option value="insertignore"><?php echo __('Insert as new row and ignore errors'); ?></option>
1130 <option value="showinsert"><?php echo __('Show insert query'); ?></option>
1131 </select>
1132 <?php
1133 echo "\n";
1135 if (!isset($after_insert)) {
1136 $after_insert = 'back';
1139 </td>
1140 <td valign="middle">
1141 &nbsp;&nbsp;&nbsp;<strong><?php echo __('and then'); ?></strong>&nbsp;&nbsp;&nbsp;
1142 </td>
1143 <td valign="middle" nowrap="nowrap">
1144 <select name="after_insert">
1145 <option value="back" <?php echo ($after_insert == 'back' ? 'selected="selected"' : ''); ?>><?php echo __('Go back to previous page'); ?></option>
1146 <option value="new_insert" <?php echo ($after_insert == 'new_insert' ? 'selected="selected"' : ''); ?>><?php echo __('Insert another new row'); ?></option>
1147 <?php
1148 if (isset($where_clause)) {
1150 <option value="same_insert" <?php echo ($after_insert == 'same_insert' ? 'selected="selected"' : ''); ?>><?php echo __('Go back to this page'); ?></option>
1151 <?php
1152 // If we have just numeric primary key, we can also edit next
1153 // in 2.8.2, we were looking for `field_name` = numeric_value
1154 //if (preg_match('@^[\s]*`[^`]*` = [0-9]+@', $where_clause)) {
1155 // in 2.9.0, we are looking for `table_name`.`field_name` = numeric_value
1156 if ($found_unique_key && preg_match('@^[\s]*`[^`]*`[\.]`[^`]*` = [0-9]+@', $where_clause)) {
1158 <option value="edit_next" <?php echo ($after_insert == 'edit_next' ? 'selected="selected"' : ''); ?>><?php echo __('Edit next row'); ?></option>
1159 <?php
1163 </select>
1164 </td>
1165 </tr>
1167 <tr>
1168 <td>
1169 <?php echo PMA_showHint(__('Use TAB key to move from value to value, or CTRL+arrows to move anywhere')); ?>
1170 </td>
1171 <td colspan="3" align="right" valign="middle">
1172 <input type="submit" value="<?php echo __('Go'); ?>" tabindex="<?php echo ($tabindex + $tabindex_for_value + 6); ?>" id="buttonYes" />
1173 <input type="reset" value="<?php echo __('Reset'); ?>" tabindex="<?php echo ($tabindex + $tabindex_for_value + 7); ?>" />
1174 </td>
1175 </tr>
1176 </table>
1177 </fieldset>
1178 <?php if ($biggest_max_file_size > 0) {
1179 echo ' ' . PMA_generateHiddenMaxFileSize($biggest_max_file_size) . "\n";
1180 } ?>
1181 </form>
1182 <?php
1183 if ($insert_mode) {
1185 <!-- Restart insertion form -->
1186 <form method="post" action="tbl_replace.php" name="restartForm" >
1187 <?php echo PMA_generate_common_hidden_inputs($db, $table); ?>
1188 <input type="hidden" name="goto" value="<?php echo htmlspecialchars($GLOBALS['goto']); ?>" />
1189 <input type="hidden" name="err_url" value="<?php echo htmlspecialchars($err_url); ?>" />
1190 <input type="hidden" name="sql_query" value="<?php echo htmlspecialchars($sql_query); ?>" />
1191 <?php
1192 if (isset($where_clauses)) {
1193 foreach ($where_clause_array as $key_id => $where_clause) {
1194 echo '<input type="hidden" name="where_clause[' . $key_id . ']" value="' . htmlspecialchars(trim($where_clause)) . '" />'. "\n";
1197 $tmp = '<select name="insert_rows" id="insert_rows" onchange="this.form.submit();" >' . "\n";
1198 $option_values = array(1,2,5,10,15,20,30,40);
1199 foreach ($option_values as $value) {
1200 $tmp .= '<option value="' . $value . '"';
1201 if ($value == $cfg['InsertRows']) {
1202 $tmp .= ' selected="selected"';
1204 $tmp .= '>' . $value . '</option>' . "\n";
1206 $tmp .= '</select>' . "\n";
1207 echo "\n" . sprintf(__('Restart insertion with %s rows'), $tmp);
1208 unset($tmp);
1209 echo '<noscript><input type="submit" value="' . __('Go') . '" /></noscript>' . "\n";
1210 echo '</form>' . "\n";
1214 * Displays the footer
1216 require_once './libraries/footer.inc.php';