Translation update done using Pootle.
[phpmyadmin/crack.git] / tbl_change.php
blob051b1fc236273e23305b309d397d124589427474
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 // retrieve keys into foreign fields, if any
201 $foreigners = PMA_getForeigners($db, $table);
205 * Displays the form
207 // autocomplete feature of IE kills the "onchange" event handler and it
208 // must be replaced by the "onpropertychange" one in this case
209 $chg_evt_handler = (PMA_USR_BROWSER_AGENT == 'IE' && PMA_USR_BROWSER_VER >= 5 && PMA_USR_BROWSER_VER < 7)
210 ? 'onpropertychange'
211 : 'onchange';
212 // Had to put the URI because when hosted on an https server,
213 // some browsers send wrongly this form to the http server.
215 if ($cfg['CtrlArrowsMoving']) {
217 <!-- Set on key handler for moving using by Ctrl+arrows -->
218 <script src="./js/keyhandler.js" type="text/javascript"></script>
219 <script type="text/javascript">
220 //<![CDATA[
221 var switch_movement = 0;
222 document.onkeydown = onKeyDownArrowsHandler;
223 //]]>
224 </script>
225 <?php
228 $_form_params = array(
229 'db' => $db,
230 'table' => $table,
231 'goto' => $GLOBALS['goto'],
232 'err_url' => $err_url,
233 'sql_query' => $sql_query,
235 if (isset($where_clauses)) {
236 foreach ($where_clause_array as $key_id => $where_clause) {
237 $_form_params['where_clause[' . $key_id . ']'] = trim($where_clause);
240 if (isset($clause_is_unique)) {
241 $_form_params['clause_is_unique'] = $clause_is_unique;
246 <!-- Insert/Edit form -->
247 <form method="post" action="tbl_replace.php" name="insertForm" <?php if ($is_upload) { echo ' enctype="multipart/form-data"'; } ?>>
248 <?php
249 echo PMA_generate_common_hidden_inputs($_form_params);
251 $titles['Browse'] = PMA_getIcon('b_browse.png', __('Browse foreign values'));
253 // Set if we passed the first timestamp field
254 $timestamp_seen = 0;
255 $fields_cnt = count($table_fields);
257 $tabindex = 0;
258 $tabindex_for_function = +3000;
259 $tabindex_for_null = +6000;
260 $tabindex_for_value = 0;
261 $o_rows = 0;
262 $biggest_max_file_size = 0;
264 // user can toggle the display of Function column
265 // (currently does not work for multi-edits)
266 $url_params['db'] = $db;
267 $url_params['table'] = $table;
268 if (isset($where_clause)) {
269 $url_params['where_clause'] = trim($where_clause);
271 if (! empty($sql_query)) {
272 $url_params['sql_query'] = $sql_query;
275 if (! $cfg['ShowFunctionFields'] || ! $cfg['ShowFieldTypesInDataEditView']) {
276 echo __('Show');
278 if (! $cfg['ShowFunctionFields']) {
279 $this_url_params = array_merge($url_params,
280 array('ShowFunctionFields' => 1, 'ShowFieldTypesInDataEditView' => $cfg['ShowFieldTypesInDataEditView'], 'goto' => 'sql.php'));
281 echo ' : <a href="tbl_change.php' . PMA_generate_common_url($this_url_params) . '">' . __('Function') . '</a>' . "\n";
283 if (! $cfg['ShowFieldTypesInDataEditView']) {
284 $this_other_url_params = array_merge($url_params,
285 array('ShowFieldTypesInDataEditView' => 1, 'ShowFunctionFields' => $cfg['ShowFunctionFields'], 'goto' => 'sql.php'));
286 echo ' : <a href="tbl_change.php' . PMA_generate_common_url($this_other_url_params) . '">' . __('Type') . '</a>' . "\n";
289 foreach ($rows as $row_id => $vrow) {
290 if ($vrow === false) {
291 unset($vrow);
294 $jsvkey = $row_id;
295 $browse_foreigners_uri = '&amp;pk=' . $row_id;
296 $vkey = '[multi_edit][' . $jsvkey . ']';
298 $vresult = (isset($result) && is_array($result) && isset($result[$row_id]) ? $result[$row_id] : $result);
299 if ($insert_mode && $row_id > 0) {
300 echo '<input type="checkbox" checked="checked" name="insert_ignore_' . $row_id . '" id="insert_ignore_check_' . $row_id . '" />';
301 echo '<label for="insert_ignore_check_' . $row_id . '">' . __('Ignore') . '</label><br />' . "\n";
304 <table>
305 <thead>
306 <tr>
307 <th><?php echo __('Column'); ?></th>
309 <?php
310 if ($cfg['ShowFieldTypesInDataEditView']) {
311 $this_url_params = array_merge($url_params,
312 array('ShowFieldTypesInDataEditView' => 0, 'ShowFunctionFields' => $cfg['ShowFunctionFields'], 'goto' => 'sql.php'));
313 echo ' <th><a href="tbl_change.php' . PMA_generate_common_url($this_url_params) . '" title="' . __('Hide') . '">' . __('Type') . '</a></th>' . "\n";
316 if ($cfg['ShowFunctionFields']) {
317 $this_url_params = array_merge($url_params,
318 array('ShowFunctionFields' => 0, 'ShowFieldTypesInDataEditView' => $cfg['ShowFieldTypesInDataEditView'], 'goto' => 'sql.php'));
319 echo ' <th><a href="tbl_change.php' . PMA_generate_common_url($this_url_params) . '" title="' . __('Hide') . '">' . __('Function') . '</a></th>' . "\n";
322 <th><?php echo __('Null'); ?></th>
323 <th><?php echo __('Value'); ?></th>
324 </tr>
325 </thead>
326 <tfoot>
327 <tr>
328 <th colspan="5" align="right" class="tblFooters">
329 <input type="submit" value="<?php echo __('Go'); ?>" />
330 </th>
331 </tr>
332 </tfoot>
333 <tbody>
334 <?php
335 // Sets a multiplier used for input-field counts (as zero cannot be used, advance the counter plus one)
336 $m_rows = $o_rows + 1;
338 $odd_row = true;
339 for ($i = 0; $i < $fields_cnt; $i++) {
340 if (! isset($table_fields[$i]['processed'])) {
341 $table_fields[$i]['Field_html'] = htmlspecialchars($table_fields[$i]['Field']);
342 $table_fields[$i]['Field_md5'] = md5($table_fields[$i]['Field']);
343 // True_Type contains only the type (stops at first bracket)
344 $table_fields[$i]['True_Type'] = preg_replace('@\(.*@s', '', $table_fields[$i]['Type']);
346 // d a t e t i m e
348 // Current date should not be set as default if the field is NULL
349 // for the current row, but do not put here the current datetime
350 // if there is a default value (the real default value will be set
351 // in the Default value logic below)
353 // Note: (tested in MySQL 4.0.16): when lang is some UTF-8,
354 // $field['Default'] is not set if it contains NULL:
355 // Array ([Field] => d [Type] => datetime [Null] => YES [Key] => [Extra] => [True_Type] => datetime)
356 // but, look what we get if we switch to iso: (Default is NULL)
357 // Array ([Field] => d [Type] => datetime [Null] => YES [Key] => [Default] => [Extra] => [True_Type] => datetime)
358 // so I force a NULL into it (I don't think it's possible
359 // to have an empty default value for DATETIME)
360 // then, the "if" after this one will work
361 if ($table_fields[$i]['Type'] == 'datetime'
362 && ! isset($table_fields[$i]['Default'])
363 && isset($table_fields[$i]['Null'])
364 && $table_fields[$i]['Null'] == 'YES') {
365 $table_fields[$i]['Default'] = null;
368 $table_fields[$i]['len'] =
369 preg_match('@float|double@', $table_fields[$i]['Type']) ? 100 : -1;
372 if (isset($comments_map[$table_fields[$i]['Field']])) {
373 $table_fields[$i]['Field_title'] = '<span style="border-bottom: 1px dashed black;" title="'
374 . htmlspecialchars($comments_map[$table_fields[$i]['Field']]) . '">'
375 . $table_fields[$i]['Field_html'] . '</span>';
376 } else {
377 $table_fields[$i]['Field_title'] = $table_fields[$i]['Field_html'];
380 // The type column
381 $table_fields[$i]['is_binary'] = stristr($table_fields[$i]['Type'], 'binary');
382 $table_fields[$i]['is_blob'] = stristr($table_fields[$i]['Type'], 'blob');
383 $table_fields[$i]['is_char'] = stristr($table_fields[$i]['Type'], 'char');
384 $table_fields[$i]['first_timestamp'] = false;
385 switch ($table_fields[$i]['True_Type']) {
386 case 'set':
387 $table_fields[$i]['pma_type'] = 'set';
388 $table_fields[$i]['wrap'] = '';
389 break;
390 case 'enum':
391 $table_fields[$i]['pma_type'] = 'enum';
392 $table_fields[$i]['wrap'] = '';
393 break;
394 case 'timestamp':
395 if (!$timestamp_seen) { // can only occur once per table
396 $timestamp_seen = 1;
397 $table_fields[$i]['first_timestamp'] = true;
399 $table_fields[$i]['pma_type'] = $table_fields[$i]['Type'];
400 $table_fields[$i]['wrap'] = ' nowrap="nowrap"';
401 break;
403 default:
404 $table_fields[$i]['pma_type'] = $table_fields[$i]['Type'];
405 $table_fields[$i]['wrap'] = ' nowrap="nowrap"';
406 break;
409 $field = $table_fields[$i];
410 $extracted_fieldspec = PMA_extractFieldSpec($field['Type']);
412 if (-1 === $field['len']) {
413 $field['len'] = PMA_DBI_field_len($vresult, $i);
415 //Call validation when the form submited...
416 $unnullify_trigger = $chg_evt_handler . "=\"return Validator('". PMA_escapeJsString($field['Field_md5']) . "', '"
417 . PMA_escapeJsString($jsvkey) . "','".$field['pma_type']."')\"";
419 // Use an MD5 as an array index to avoid having special characters in the name atttibute (see bug #1746964 )
420 $field_name_appendix = $vkey . '[' . $field['Field_md5'] . ']';
421 $field_name_appendix_md5 = $field['Field_md5'] . $vkey . '[]';
424 if ($field['Type'] == 'datetime'
425 && ! isset($field['Default'])
426 && ! is_null($field['Default'])
427 && ($insert_mode || ! isset($vrow[$field['Field']]))) {
428 // INSERT case or
429 // UPDATE case with an NULL value
430 $vrow[$field['Field']] = date('Y-m-d H:i:s', time());
433 <tr class="<?php echo $odd_row ? 'odd' : 'even'; ?>">
434 <td <?php echo ($cfg['LongtextDoubleTextarea'] && strstr($field['True_Type'], 'longtext') ? 'rowspan="2"' : ''); ?> align="center">
435 <?php echo $field['Field_title']; ?>
436 <input type="hidden" name="fields_name<?php echo $field_name_appendix; ?>" value="<?php echo $field['Field_html']; ?>"/>
437 </td>
438 <?php if ($cfg['ShowFieldTypesInDataEditView']) { ?>
439 <td align="center"<?php echo $field['wrap']; ?>>
440 <?php echo $field['pma_type']; ?>
441 </td>
443 <?php } //End if
445 // Prepares the field value
446 $real_null_value = FALSE;
447 $special_chars_encoded = '';
448 if (isset($vrow)) {
449 // (we are editing)
450 if (is_null($vrow[$field['Field']])) {
451 $real_null_value = TRUE;
452 $vrow[$field['Field']] = '';
453 $special_chars = '';
454 $data = $vrow[$field['Field']];
455 } elseif ($field['True_Type'] == 'bit') {
456 $special_chars = PMA_printable_bit_value($vrow[$field['Field']], $extracted_fieldspec['spec_in_brackets']);
457 } else {
458 // special binary "characters"
459 if ($field['is_binary'] || ($field['is_blob'] && ! $cfg['ProtectBinary'])) {
460 if ($_SESSION['tmp_user_values']['display_binary_as_hex'] && $cfg['ShowFunctionFields']) {
461 $vrow[$field['Field']] = bin2hex($vrow[$field['Field']]);
462 $field['display_binary_as_hex'] = true;
463 } else {
464 $vrow[$field['Field']] = PMA_replace_binary_contents($vrow[$field['Field']]);
466 } // end if
467 $special_chars = htmlspecialchars($vrow[$field['Field']]);
469 //We need to duplicate the first \n or otherwise we will lose the first newline entered in a VARCHAR or TEXT column
470 $special_chars_encoded = PMA_duplicateFirstNewline($special_chars);
472 $data = $vrow[$field['Field']];
473 } // end if... else...
474 // If a timestamp field value is not included in an update
475 // statement MySQL auto-update it to the current timestamp;
476 // however, things have changed since MySQL 4.1, so
477 // it's better to set a fields_prev in this situation
478 $backup_field = '<input type="hidden" name="fields_prev'
479 . $field_name_appendix . '" value="'
480 . htmlspecialchars($vrow[$field['Field']]) . '" />';
481 } else {
482 // (we are inserting)
483 // display default values
484 if (!isset($field['Default'])) {
485 $field['Default'] = '';
486 $real_null_value = TRUE;
487 $data = '';
488 } else {
489 $data = $field['Default'];
491 if ($field['True_Type'] == 'bit') {
492 $special_chars = PMA_convert_bit_default_value($field['Default']);
493 } else {
494 $special_chars = htmlspecialchars($field['Default']);
496 $backup_field = '';
497 $special_chars_encoded = PMA_duplicateFirstNewline($special_chars);
498 // this will select the UNHEX function while inserting
499 if (($field['is_binary'] || ($field['is_blob'] && ! $cfg['ProtectBinary'])) && $_SESSION['tmp_user_values']['display_binary_as_hex'] && $cfg['ShowFunctionFields']) {
500 $field['display_binary_as_hex'] = true;
504 $idindex = ($o_rows * $fields_cnt) + $i + 1;
505 $tabindex = (($idindex - 1) * 3) + 1;
507 // The function column
508 // -------------------
509 // We don't want binary data to be destroyed
510 // Note: from the MySQL manual: "BINARY doesn't affect how the column is
511 // stored or retrieved" so it does not mean that the contents is
512 // binary
513 if ($cfg['ShowFunctionFields']) {
514 if (($cfg['ProtectBinary'] && $field['is_blob'] && !$is_upload)
515 || ($cfg['ProtectBinary'] == 'all' && $field['is_binary'])) {
516 echo ' <td align="center">' . __('Binary') . '</td>' . "\n";
517 } elseif (strstr($field['True_Type'], 'enum') || strstr($field['True_Type'], 'set')) {
518 echo ' <td align="center">--</td>' . "\n";
519 } else {
521 <td>
522 <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">
523 <option></option>
524 <?php
525 $selected = '';
527 // Find the current type in the RestrictColumnTypes. Will result in 'FUNC_CHAR'
528 // or something similar. Then directly look up the entry in the RestrictFunctions array,
529 // which will then reveal the available dropdown options
530 if (isset($cfg['RestrictColumnTypes'][strtoupper($field['True_Type'])])
531 && isset($cfg['RestrictFunctions'][$cfg['RestrictColumnTypes'][strtoupper($field['True_Type'])]])) {
532 $current_func_type = $cfg['RestrictColumnTypes'][strtoupper($field['True_Type'])];
533 $dropdown = $cfg['RestrictFunctions'][$current_func_type];
534 $default_function = $cfg['DefaultFunctions'][$current_func_type];
535 } else {
536 $dropdown = array();
537 $default_function = '';
540 $dropdown_built = array();
541 $op_spacing_needed = FALSE;
543 // what function defined as default?
544 // for the first timestamp we don't set the default function
545 // if there is a default value for the timestamp
546 // (not including CURRENT_TIMESTAMP)
547 // and the column does not have the
548 // ON UPDATE DEFAULT TIMESTAMP attribute.
550 if ($field['True_Type'] == 'timestamp'
551 && empty($field['Default'])
552 && ! isset($analyzed_sql[0]['create_table_fields'][$field['Field']]['on_update_current_timestamp'])) {
553 $default_function = $cfg['DefaultFunctions']['first_timestamp'];
556 // For primary keys of type char(36) or varchar(36) UUID if the default function
557 // Only applies to insert mode, as it would silently trash data on updates.
558 if ($insert_mode
559 && $field['Key'] == 'PRI'
560 && ($field['Type'] == 'char(36)' || $field['Type'] == 'varchar(36)')
562 $default_function = $cfg['DefaultFunctions']['pk_char36'];
565 // this is set only when appropriate and is always true
566 if (isset($field['display_binary_as_hex'])) {
567 $default_function = 'UNHEX';
570 // loop on the dropdown array and print all available options for that field.
571 foreach ($dropdown as $each_dropdown){
572 echo '<option';
573 if ($default_function === $each_dropdown) {
574 echo ' selected="selected"';
576 echo '>' . $each_dropdown . '</option>' . "\n";
577 $dropdown_built[$each_dropdown] = 'TRUE';
578 $op_spacing_needed = TRUE;
581 // For compatibility's sake, do not let out all other functions. Instead
582 // print a separator (blank) and then show ALL functions which weren't shown
583 // yet.
584 $cnt_functions = count($cfg['Functions']);
585 for ($j = 0; $j < $cnt_functions; $j++) {
586 if (!isset($dropdown_built[$cfg['Functions'][$j]]) || $dropdown_built[$cfg['Functions'][$j]] != 'TRUE') {
587 // Is current function defined as default?
588 $selected = ($field['first_timestamp'] && $cfg['Functions'][$j] == $cfg['DefaultFunctions']['first_timestamp'])
589 || (!$field['first_timestamp'] && $cfg['Functions'][$j] == $default_function)
590 ? ' selected="selected"'
591 : '';
592 if ($op_spacing_needed == TRUE) {
593 echo ' ';
594 echo '<option value="">--------</option>' . "\n";
595 $op_spacing_needed = FALSE;
598 echo ' ';
599 echo '<option' . $selected . '>' . $cfg['Functions'][$j] . '</option>' . "\n";
601 } // end for
602 unset($selected);
604 </select>
605 </td>
606 <?php
608 } // end if ($cfg['ShowFunctionFields'])
611 // The null column
612 // ---------------
613 $foreignData = PMA_getForeignData($foreigners, $field['Field'], false, '', '');
614 echo ' <td>' . "\n";
615 if ($field['Null'] == 'YES') {
616 echo ' <input type="hidden" name="fields_null_prev' . $field_name_appendix . '"';
617 if ($real_null_value && !$field['first_timestamp']) {
618 echo ' value="on"';
620 echo ' />' . "\n";
622 echo ' <input type="checkbox" tabindex="' . ($tabindex + $tabindex_for_null) . '"'
623 . ' name="fields_null' . $field_name_appendix . '"';
624 if ($real_null_value && !$field['first_timestamp']) {
625 echo ' checked="checked"';
627 echo ' id="field_' . ($idindex) . '_2"';
628 $onclick = ' onclick="if (this.checked) {nullify(';
629 if (strstr($field['True_Type'], 'enum')) {
630 if (strlen($field['Type']) > 20) {
631 $onclick .= '1, ';
632 } else {
633 $onclick .= '2, ';
635 } elseif (strstr($field['True_Type'], 'set')) {
636 $onclick .= '3, ';
637 } elseif ($foreigners && isset($foreigners[$field['Field']]) && $foreignData['foreign_link'] == false) {
638 // foreign key in a drop-down
639 $onclick .= '4, ';
640 } elseif ($foreigners && isset($foreigners[$field['Field']]) && $foreignData['foreign_link'] == true) {
641 // foreign key with a browsing icon
642 $onclick .= '6, ';
643 } else {
644 $onclick .= '5, ';
646 $onclick .= '\'' . PMA_escapeJsString($field['Field_html']) . '\', \'' . $field['Field_md5'] . '\', \'' . PMA_escapeJsString($vkey) . '\'); this.checked = true}; return true" />' . "\n";
647 echo $onclick;
649 echo ' </td>' . "\n";
651 // The value column (depends on type)
652 // ----------------
653 // See bug #1667887 for the reason why we don't use the maxlength
654 // HTML attribute
656 echo ' <td>' . "\n";
657 if ($foreignData['foreign_link'] == true) {
658 echo $backup_field . "\n";
660 <input type="hidden" name="fields_type<?php echo $field_name_appendix; ?>"
661 value="foreign" />
662 <input type="hidden" name="fields<?php echo $field_name_appendix; ?>"
663 value="" id="field_<?php echo ($idindex); ?>_3A" />
664 <input type="text" name="field_<?php echo $field_name_appendix_md5; ?>"
665 class="textfield" <?php echo $unnullify_trigger; ?>
666 tabindex="<?php echo ($tabindex + $tabindex_for_value); ?>"
667 id="field_<?php echo ($idindex); ?>_3"
668 value="<?php echo htmlspecialchars($data); ?>" />
669 <script type="text/javascript">
670 //<![CDATA[
671 document.writeln('<a target="_blank" onclick="window.open(this.href, \'foreigners\', \'width=640,height=240,scrollbars=yes,resizable=yes\'); return false"');
672 document.write(' href="browse_foreigners.php?');
673 document.write('<?php echo PMA_generate_common_url($db, $table); ?>');
674 document.writeln('&amp;field=<?php echo PMA_escapeJsString(urlencode($field['Field']) . $browse_foreigners_uri); ?>">');
675 document.writeln('<?php echo str_replace("'", "\'", $titles['Browse']); ?></a>');
676 //]]>
677 </script>
678 <?php
679 } elseif (is_array($foreignData['disp_row'])) {
680 echo $backup_field . "\n";
682 <input type="hidden" name="fields_type<?php echo $field_name_appendix; ?>"
683 value="foreign" />
684 <input type="hidden" name="fields<?php echo $field_name_appendix; ?>"
685 value="" id="field_<?php echo $idindex; ?>_3A" />
686 <select name="field_<?php echo $field_name_appendix_md5; ?>"
687 <?php echo $unnullify_trigger; ?>
688 tabindex="<?php echo ($tabindex + $tabindex_for_value); ?>"
689 id="field_<?php echo ($idindex); ?>_3">
690 <?php echo PMA_foreignDropdown($foreignData['disp_row'], $foreignData['foreign_field'], $foreignData['foreign_display'], $data, $cfg['ForeignKeyMaxLimit']); ?>
691 </select>
692 <?php
693 // still needed? :
694 unset($foreignData['disp_row']);
695 } elseif ($cfg['LongtextDoubleTextarea'] && strstr($field['pma_type'], 'longtext')) {
697 &nbsp;</td>
698 </tr>
699 <tr class="<?php echo $odd_row ? 'odd' : 'even'; ?>">
700 <td colspan="5" align="right">
701 <?php echo $backup_field . "\n"; ?>
702 <textarea name="fields<?php echo $field_name_appendix; ?>"
703 rows="<?php echo ($cfg['TextareaRows']*2); ?>"
704 cols="<?php echo ($cfg['TextareaCols']*2); ?>"
705 dir="<?php echo $text_dir; ?>"
706 id="field_<?php echo ($idindex); ?>_3"
707 <?php echo $unnullify_trigger; ?>
708 tabindex="<?php echo ($tabindex + $tabindex_for_value); ?>"
709 ><?php echo $special_chars_encoded; ?></textarea>
710 <?php
711 } elseif (strstr($field['pma_type'], 'text')) {
712 echo $backup_field . "\n";
714 <textarea name="fields<?php echo $field_name_appendix; ?>"
715 rows="<?php echo $cfg['TextareaRows']; ?>"
716 cols="<?php echo $cfg['TextareaCols']; ?>"
717 dir="<?php echo $text_dir; ?>"
718 id="field_<?php echo ($idindex); ?>_3"
719 <?php echo $unnullify_trigger; ?>
720 tabindex="<?php echo ($tabindex + $tabindex_for_value); ?>"
721 ><?php echo $special_chars_encoded; ?></textarea>
722 <?php
723 echo "\n";
724 if (strlen($special_chars) > 32000) {
725 echo " </td>\n";
726 echo ' <td>' . __(' Because of its length,<br /> this column might not be editable ');
728 } elseif ($field['pma_type'] == 'enum') {
729 if (! isset($table_fields[$i]['values'])) {
730 $table_fields[$i]['values'] = array();
731 foreach ($extracted_fieldspec['enum_set_values'] as $val) {
732 // Removes automatic MySQL escape format
733 $val = str_replace('\'\'', '\'', str_replace('\\\\', '\\', $val));
734 $table_fields[$i]['values'][] = array(
735 'plain' => $val,
736 'html' => htmlspecialchars($val),
740 $field_enum_values = $table_fields[$i]['values'];
742 <input type="hidden" name="fields_type<?php echo $field_name_appendix; ?>" value="enum" />
743 <input type="hidden" name="fields<?php echo $field_name_appendix; ?>" value="" />
744 <?php
745 echo "\n" . ' ' . $backup_field . "\n";
747 // show dropdown or radio depend on length
748 if (strlen($field['Type']) > 20) {
750 <select name="field_<?php echo $field_name_appendix_md5; ?>"
751 <?php echo $unnullify_trigger; ?>
752 tabindex="<?php echo ($tabindex + $tabindex_for_value); ?>"
753 id="field_<?php echo ($idindex); ?>_3">
754 <option value="">&nbsp;</option>
755 <?php
756 echo "\n";
758 foreach ($field_enum_values as $enum_value) {
759 echo ' ';
760 echo '<option value="' . $enum_value['html'] . '"';
761 if ($data == $enum_value['plain']
762 || ($data == ''
763 && (! isset($where_clause) || $field['Null'] != 'YES')
764 && isset($field['Default'])
765 && $enum_value['plain'] == $field['Default'])) {
766 echo ' selected="selected"';
768 echo '>' . $enum_value['html'] . '</option>' . "\n";
769 } // end for
772 </select>
773 <?php
774 } else {
775 $j = 0;
776 foreach ($field_enum_values as $enum_value) {
777 echo ' ';
778 echo '<input type="radio" name="field_' . $field_name_appendix_md5 . '"';
779 echo ' value="' . $enum_value['html'] . '"';
780 echo ' id="field_' . ($idindex) . '_3_' . $j . '"';
781 echo $unnullify_trigger;
782 if ($data == $enum_value['plain']
783 || ($data == ''
784 && (! isset($where_clause) || $field['Null'] != 'YES')
785 && isset($field['Default'])
786 && $enum_value['plain'] == $field['Default'])) {
787 echo ' checked="checked"';
789 echo ' tabindex="' . ($tabindex + $tabindex_for_value) . '" />';
790 echo '<label for="field_' . $idindex . '_3_' . $j . '">'
791 . $enum_value['html'] . '</label>' . "\n";
792 $j++;
793 } // end for
794 } // end else
795 } elseif ($field['pma_type'] == 'set') {
796 if (! isset($table_fields[$i]['values'])) {
797 $table_fields[$i]['values'] = array();
798 foreach ($extracted_fieldspec['enum_set_values'] as $val) {
799 $table_fields[$i]['values'][] = array(
800 'plain' => $val,
801 'html' => htmlspecialchars($val),
804 $table_fields[$i]['select_size'] = min(4, count($table_fields[$i]['values']));
806 $field_set_values = $table_fields[$i]['values'];
807 $select_size = $table_fields[$i]['select_size'];
809 $vset = array_flip(explode(',', $data));
810 echo $backup_field . "\n";
812 <input type="hidden" name="fields_type<?php echo $field_name_appendix; ?>" value="set" />
813 <input type="hidden" name="fields<?php echo $field_name_appendix; ?>" value="" />
814 <select name="field_<?php echo $field_name_appendix_md5; ?>"
815 size="<?php echo $select_size; ?>"
816 multiple="multiple" <?php echo $unnullify_trigger; ?>
817 tabindex="<?php echo ($tabindex + $tabindex_for_value); ?>"
818 id="field_<?php echo ($idindex); ?>_3">
819 <?php
820 foreach ($field_set_values as $field_set_value) {
821 echo ' ';
822 echo '<option value="' . $field_set_value['html'] . '"';
823 if (isset($vset[$field_set_value['plain']])) {
824 echo ' selected="selected"';
826 echo '>' . $field_set_value['html'] . '</option>' . "\n";
827 } // end for
829 </select>
830 <?php
832 // We don't want binary data destroyed
833 elseif ($field['is_binary'] || $field['is_blob']) {
834 if (($cfg['ProtectBinary'] && $field['is_blob'])
835 || ($cfg['ProtectBinary'] == 'all' && $field['is_binary'])) {
836 echo "\n";
837 // for blobstreaming
838 $bs_reference_exists = FALSE;
840 if (isset ($tbl_type) && strlen ($tbl_type) > 0)
842 // load PMA_Config
843 $PMA_Config = $GLOBALS['PMA_Config'];
845 if (!empty($PMA_Config))
847 $requiredTblType = $PMA_Config->get('PBXT_NAME');
849 if ($requiredTblType == strtolower ($tbl_type))
851 $pluginsExist = $PMA_Config->get('BLOBSTREAMING_PLUGINS_EXIST');
853 // check if blobstreaming plugins exist
854 if ($pluginsExist)
856 $bs_tables = $PMA_Config->get('BLOBSTREAMABLE_DATABASES');
858 if (!empty($bs_tables) && strlen($db) > 0)
860 $bs_tables = $bs_tables[$db];
862 if (isset($bs_tables))
864 $allBSTablesExist = TRUE;
866 foreach ($bs_tables as $table_key=>$bs_tbl)
867 if (!$bs_tables[$table_key]['Exists'])
869 $allBSTablesExist = FALSE;
870 break;
873 if ($allBSTablesExist)
874 $bs_reference_exists = PMA_BS_ReferenceExists($data, $db);
875 } // end if (isset($bs_tables))
876 } // end if (!empty($bs_tables) && strlen($db) > 0)
877 } // end if ($pluginsExist)
878 } // end if ($requiredTblType == strtolower ($tbl_type))
879 } // end if (!empty($PMA_Config))
880 } // end if (isset ($tbl_type) && strlen ($tbl_type) > 0)
882 if ($bs_reference_exists)
884 echo '<input type="hidden" name="remove_blob_ref_' . $field['Field_md5'] . $vkey . '" value="' . $data . '" />';
885 echo '<input type="checkbox" name="remove_blob_repo_' . $field['Field_md5'] . $vkey . '" /> ' . __('Remove BLOB Repository Reference') . "<br />";
886 echo PMA_BS_CreateReferenceLink($data, $db);
887 echo "<br />";
889 else
891 echo __('Binary - do not edit');
892 if (isset($data)) {
893 $data_size = PMA_formatByteDown(strlen(stripslashes($data)), 3, 1);
894 echo ' ('. $data_size [0] . ' ' . $data_size[1] . ')';
895 unset($data_size);
897 echo "\n";
898 } // end if ($bs_reference_exists)
900 <input type="hidden" name="fields_type<?php echo $field_name_appendix; ?>" value="protected" />
901 <input type="hidden" name="fields<?php echo $field_name_appendix; ?>" value="" />
902 <?php
903 } elseif ($field['is_blob']) {
904 echo "\n";
905 echo $backup_field . "\n";
907 <textarea name="fields<?php echo $field_name_appendix; ?>"
908 rows="<?php echo $cfg['TextareaRows']; ?>"
909 cols="<?php echo $cfg['TextareaCols']; ?>"
910 dir="<?php echo $text_dir; ?>"
911 id="field_<?php echo ($idindex); ?>_3"
912 <?php echo $unnullify_trigger; ?>
913 tabindex="<?php echo ($tabindex + $tabindex_for_value); ?>"
914 ><?php echo $special_chars_encoded; ?></textarea>
915 <?php
917 } else {
918 // field size should be at least 4 and max 40
919 $fieldsize = min(max($field['len'], 4), 40);
920 echo "\n";
921 echo $backup_field . "\n";
923 <input type="text" name="fields<?php echo $field_name_appendix; ?>"
924 value="<?php echo $special_chars; ?>" size="<?php echo $fieldsize; ?>"
925 class="textfield" <?php echo $unnullify_trigger; ?>
926 tabindex="<?php echo ($tabindex + $tabindex_for_value); ?>"
927 id="field_<?php echo ($idindex); ?>_3" />
928 <?php
929 } // end if...elseif...else
931 // Upload choice (only for BLOBs because the binary
932 // attribute does not imply binary contents)
933 // (displayed whatever value the ProtectBinary has)
935 if ($is_upload && $field['is_blob']) {
936 // check if field type is of longblob
937 if ($field['pma_type'] == "longblob")
939 if (isset ($tbl_type) && strlen ($tbl_type) > 0)
941 // load PMA Config
942 $PMA_Config = $GLOBALS['PMA_Config'];
944 // is PMA_Config's data loaded? continue only if it is
945 if (!empty($PMA_Config))
947 $requiredTblType = $PMA_Config->get('PBXT_NAME');
949 if ($requiredTblType == strtolower ($tbl_type))
951 $pluginsExist = $PMA_Config->get('BLOBSTREAMING_PLUGINS_EXIST');
953 // check if blobstreaming plugins exist
954 if ($pluginsExist)
956 $curlExists = $PMA_Config->get('CURL_EXISTS');
958 // check if CURL exists
959 if ($curlExists)
961 $bs_tables = $PMA_Config->get('BLOBSTREAMABLE_DATABASES');
963 // check for BLOBStreamable databases and if current database name is provided
964 if (!empty($bs_tables) && strlen($db) > 0)
966 $bs_tables = $bs_tables[$db];
968 // check if reference to BLOBStreaming tables exists
969 if (isset($bs_tables))
971 $allBSTablesExist = TRUE;
973 foreach ($bs_tables as $table_key=>$bs_tbl)
974 if (!$bs_tables[$table_key]['Exists'])
976 $allBSTablesExist = FALSE;
977 break;
980 // check if necessary BLOBStreaming tables exist
981 if ($allBSTablesExist)
983 echo '<br />';
984 echo '<input type="checkbox" name="upload_blob_repo_' . $field['Field_md5'] . $vkey . '" /> ' . __('Upload to BLOB repository');
985 } // end if ($allBSTablesExist)
986 } // end if (isset($bs_tables)
987 } // end if (!empty($bs_tables) && strlen ($db) > 0)
988 } // end if ($curlExists)
989 } // end if ($pluginsExist)
990 } // end if ($requiredTblType == strtolower ($tbl_type))
991 } // end if (!empty($PMA_Config))
992 } // end if (isset ($tbl_type) && strlen ($tbl_type) > 0)
995 echo '<br />';
996 echo '<input type="file" name="fields_upload_' . $field['Field_md5'] . $vkey . '" class="textfield" id="field_' . $idindex . '_3" size="10" ' . $unnullify_trigger . '/>&nbsp;';
998 // find maximum upload size, based on field type
1000 * @todo with functions this is not so easy, as you can basically
1001 * process any data with function like MD5
1003 $max_field_sizes = array(
1004 'tinyblob' => '256',
1005 'blob' => '65536',
1006 'mediumblob' => '16777216',
1007 'longblob' => '4294967296'); // yeah, really
1009 $this_field_max_size = $max_upload_size; // from PHP max
1010 if ($this_field_max_size > $max_field_sizes[$field['pma_type']]) {
1011 $this_field_max_size = $max_field_sizes[$field['pma_type']];
1013 echo PMA_displayMaximumUploadSize($this_field_max_size) . "\n";
1014 // do not generate here the MAX_FILE_SIZE, because we should
1015 // put only one in the form to accommodate the biggest field
1016 if ($this_field_max_size > $biggest_max_file_size) {
1017 $biggest_max_file_size = $this_field_max_size;
1021 if (!empty($cfg['UploadDir'])) {
1022 $files = PMA_getFileSelectOptions(PMA_userDir($cfg['UploadDir']));
1023 if ($files === FALSE) {
1024 echo ' <font color="red">' . __('Error') . '</font><br />' . "\n";
1025 echo ' ' . __('The directory you set for upload work cannot be reached') . "\n";
1026 } elseif (!empty($files)) {
1027 echo "<br />\n";
1028 echo ' <i>' . __('Or') . '</i>' . ' ' . __('web server upload directory') . ':<br />' . "\n";
1029 echo ' <select size="1" name="fields_uploadlocal_' . $field['Field_md5'] . $vkey . '">' . "\n";
1030 echo ' <option value="" selected="selected"></option>' . "\n";
1031 echo $files;
1032 echo ' </select>' . "\n";
1034 } // end if (web-server upload directory)
1035 } // end elseif (binary or blob)
1036 else {
1037 // field size should be at least 4 and max 40
1038 $fieldsize = min(max($field['len'], 4), 40);
1039 echo $backup_field . "\n";
1040 if ($field['is_char'] && ($cfg['CharEditing'] == 'textarea' || strpos($data, "\n") !== FALSE)) {
1041 echo "\n";
1043 <textarea name="fields<?php echo $field_name_appendix; ?>"
1044 rows="<?php echo $cfg['CharTextareaRows']; ?>"
1045 cols="<?php echo $cfg['CharTextareaCols']; ?>"
1046 dir="<?php echo $text_dir; ?>"
1047 id="field_<?php echo ($idindex); ?>_3"
1048 <?php echo $unnullify_trigger; ?>
1049 tabindex="<?php echo ($tabindex + $tabindex_for_value); ?>"
1050 ><?php echo $special_chars_encoded; ?></textarea>
1051 <?php
1052 } else {
1054 <input type="text" name="fields<?php echo $field_name_appendix; ?>"
1055 value="<?php echo $special_chars; ?>" size="<?php echo $fieldsize; ?>"
1056 class="textfield" <?php echo $unnullify_trigger; ?>
1057 tabindex="<?php echo ($tabindex + $tabindex_for_value); ?>"
1058 id="field_<?php echo ($idindex); ?>_3" />
1059 <?php
1060 if ($field['Extra'] == 'auto_increment') {
1062 <input type="hidden" name="auto_increment<?php echo $field_name_appendix; ?>" value="1" />
1063 <?php
1064 } // end if
1065 if (substr($field['pma_type'], 0, 9) == 'timestamp') {
1067 <input type="hidden" name="fields_type<?php echo $field_name_appendix; ?>" value="timestamp" />
1068 <?php
1070 if (substr($field['pma_type'], 0, 8) == 'datetime') {
1072 <input type="hidden" name="fields_type<?php echo $field_name_appendix; ?>" value="datetime" />
1073 <?php
1075 if ($field['True_Type'] == 'bit') {
1077 <input type="hidden" name="fields_type<?php echo $field_name_appendix; ?>" value="bit" />
1078 <?php
1080 if ($field['pma_type'] == 'date' || $field['pma_type'] == 'datetime' || substr($field['pma_type'], 0, 9) == 'timestamp') {
1081 // the _3 suffix points to the date field
1082 // the _2 suffix points to the corresponding NULL checkbox
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 altTimeField: '',
1094 constrainInput: false
1097 //]]>
1098 </script>
1099 <?php
1104 </td>
1105 </tr>
1106 <?php
1107 $odd_row = !$odd_row;
1108 } // end for
1109 $o_rows++;
1110 echo ' </tbody></table><br />';
1111 } // end foreach on multi-edit
1113 <br />
1115 <fieldset>
1116 <table border="0" cellpadding="5" cellspacing="0">
1117 <tr>
1118 <td valign="middle" nowrap="nowrap">
1119 <select name="submit_type" tabindex="<?php echo ($tabindex + $tabindex_for_value + 1); ?>">
1120 <?php
1121 if (isset($where_clause)) {
1123 <option value="save"><?php echo __('Save'); ?></option>
1124 <?php
1127 <option value="insert"><?php echo __('Insert as new row'); ?></option>
1128 <option value="insertignore"><?php echo __('Insert as new row and ignore errors'); ?></option>
1129 <option value="showinsert"><?php echo __('Show insert query'); ?></option>
1130 </select>
1131 <?php
1132 echo "\n";
1134 if (!isset($after_insert)) {
1135 $after_insert = 'back';
1138 </td>
1139 <td valign="middle">
1140 &nbsp;&nbsp;&nbsp;<strong><?php echo __('and then'); ?></strong>&nbsp;&nbsp;&nbsp;
1141 </td>
1142 <td valign="middle" nowrap="nowrap">
1143 <select name="after_insert">
1144 <option value="back" <?php echo ($after_insert == 'back' ? 'selected="selected"' : ''); ?>><?php echo __('Go back to previous page'); ?></option>
1145 <option value="new_insert" <?php echo ($after_insert == 'new_insert' ? 'selected="selected"' : ''); ?>><?php echo __('Insert another new row'); ?></option>
1146 <?php
1147 if (isset($where_clause)) {
1149 <option value="same_insert" <?php echo ($after_insert == 'same_insert' ? 'selected="selected"' : ''); ?>><?php echo __('Go back to this page'); ?></option>
1150 <?php
1151 // If we have just numeric primary key, we can also edit next
1152 // in 2.8.2, we were looking for `field_name` = numeric_value
1153 //if (preg_match('@^[\s]*`[^`]*` = [0-9]+@', $where_clause)) {
1154 // in 2.9.0, we are looking for `table_name`.`field_name` = numeric_value
1155 if ($found_unique_key && preg_match('@^[\s]*`[^`]*`[\.]`[^`]*` = [0-9]+@', $where_clause)) {
1157 <option value="edit_next" <?php echo ($after_insert == 'edit_next' ? 'selected="selected"' : ''); ?>><?php echo __('Edit next row'); ?></option>
1158 <?php
1162 </select>
1163 </td>
1164 </tr>
1166 <tr>
1167 <td>
1168 <?php echo PMA_showHint(__('Use TAB key to move from value to value, or CTRL+arrows to move anywhere')); ?>
1169 </td>
1170 <td colspan="3" align="right" valign="middle">
1171 <input type="submit" value="<?php echo __('Go'); ?>" tabindex="<?php echo ($tabindex + $tabindex_for_value + 6); ?>" id="buttonYes" />
1172 <input type="reset" value="<?php echo __('Reset'); ?>" tabindex="<?php echo ($tabindex + $tabindex_for_value + 7); ?>" />
1173 </td>
1174 </tr>
1175 </table>
1176 </fieldset>
1177 <?php if ($biggest_max_file_size > 0) {
1178 echo ' ' . PMA_generateHiddenMaxFileSize($biggest_max_file_size) . "\n";
1179 } ?>
1180 </form>
1181 <?php
1182 if ($insert_mode) {
1184 <!-- Restart insertion form -->
1185 <form method="post" action="tbl_replace.php" name="restartForm" >
1186 <?php echo PMA_generate_common_hidden_inputs($db, $table); ?>
1187 <input type="hidden" name="goto" value="<?php echo htmlspecialchars($GLOBALS['goto']); ?>" />
1188 <input type="hidden" name="err_url" value="<?php echo htmlspecialchars($err_url); ?>" />
1189 <input type="hidden" name="sql_query" value="<?php echo htmlspecialchars($sql_query); ?>" />
1190 <?php
1191 if (isset($where_clauses)) {
1192 foreach ($where_clause_array as $key_id => $where_clause) {
1193 echo '<input type="hidden" name="where_clause[' . $key_id . ']" value="' . htmlspecialchars(trim($where_clause)) . '" />'. "\n";
1196 $tmp = '<select name="insert_rows" id="insert_rows" onchange="this.form.submit();" >' . "\n";
1197 $option_values = array(1,2,5,10,15,20,30,40);
1198 foreach ($option_values as $value) {
1199 $tmp .= '<option value="' . $value . '"';
1200 if ($value == $cfg['InsertRows']) {
1201 $tmp .= ' selected="selected"';
1203 $tmp .= '>' . $value . '</option>' . "\n";
1205 $tmp .= '</select>' . "\n";
1206 echo "\n" . sprintf(__('Restart insertion with %s rows'), $tmp);
1207 unset($tmp);
1208 echo '<noscript><input type="submit" value="' . __('Go') . '" /></noscript>' . "\n";
1209 echo '</form>' . "\n";
1213 * Displays the footer
1215 require_once './libraries/footer.inc.php';