Merge branch 'QA_3_3'
[phpmyadmin/bananer.git] / tbl_change.php
blob835ccf6a8d018ed363f97361df22263d296041fa
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';
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($strEmptyResultSet, $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 // <markus@noga.de>
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;
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', $strBrowseForeignValues);
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 $strShow;
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) . '">' . $strFunction . '</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) . '">' . $strType . '</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 . '">' . $strIgnore . '</label><br />' . "\n";
303 <table>
304 <thead>
305 <tr>
306 <th><?php echo $strField; ?></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="' . $strHide . '">' . $strType . '</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="' . $strHide . '">' . $strFunction . '</a></th>' . "\n";
321 <th><?php echo $strNull; ?></th>
322 <th><?php echo $strValue; ?></th>
323 </tr>
324 </thead>
325 <tfoot>
326 <tr>
327 <th colspan="5" align="right" class="tblFooters">
328 <input type="submit" value="<?php echo $strGo; ?>" />
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);
415 $unnullify_trigger = $chg_evt_handler . "=\"return unNullify('"
416 . PMA_escapeJsString($field['Field_md5']) . "', '"
417 . PMA_escapeJsString($jsvkey) . "')\"";
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']) {
460 if ($_SESSION['tmp_user_values']['display_binary_as_hex'] && $cfg['ShowFunctionFields'] && !$cfg['ProtectBinary']) {
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']) && $_SESSION['tmp_user_values']['display_binary_as_hex'] && $cfg['ShowFunctionFields'] && ! $cfg['ProtectBinary']) {
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 // Change by Bernard M. Piller <bernard@bmpsystems.com>
510 // We don't want binary data to be destroyed
511 // Note: from the MySQL manual: "BINARY doesn't affect how the column is
512 // stored or retrieved" so it does not mean that the contents is
513 // binary
514 if ($cfg['ShowFunctionFields']) {
515 if (($cfg['ProtectBinary'] && $field['is_blob'] && !$is_upload)
516 || ($cfg['ProtectBinary'] == 'all' && $field['is_binary'])) {
517 echo ' <td align="center">' . $strBinary . '</td>' . "\n";
518 } elseif (strstr($field['True_Type'], 'enum') || strstr($field['True_Type'], 'set')) {
519 echo ' <td align="center">--</td>' . "\n";
520 } else {
522 <td>
523 <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">
524 <option></option>
525 <?php
526 $selected = '';
528 // Find the current type in the RestrictColumnTypes. Will result in 'FUNC_CHAR'
529 // or something similar. Then directly look up the entry in the RestrictFunctions array,
530 // which will then reveal the available dropdown options
531 if (isset($cfg['RestrictColumnTypes'][strtoupper($field['True_Type'])])
532 && isset($cfg['RestrictFunctions'][$cfg['RestrictColumnTypes'][strtoupper($field['True_Type'])]])) {
533 $current_func_type = $cfg['RestrictColumnTypes'][strtoupper($field['True_Type'])];
534 $dropdown = $cfg['RestrictFunctions'][$current_func_type];
535 $default_function = $cfg['DefaultFunctions'][$current_func_type];
536 } else {
537 $dropdown = array();
538 $default_function = '';
541 $dropdown_built = array();
542 $op_spacing_needed = FALSE;
544 // what function defined as default?
545 // for the first timestamp we don't set the default function
546 // if there is a default value for the timestamp
547 // (not including CURRENT_TIMESTAMP)
548 // and the column does not have the
549 // ON UPDATE DEFAULT TIMESTAMP attribute.
551 if ($field['True_Type'] == 'timestamp'
552 && empty($field['Default'])
553 && ! isset($analyzed_sql[0]['create_table_fields'][$field['Field']]['on_update_current_timestamp'])) {
554 $default_function = $cfg['DefaultFunctions']['first_timestamp'];
557 // For primary keys of type char(36) or varchar(36) UUID if the default function
558 // Only applies to insert mode, as it would silently trash data on updates.
559 if ($insert_mode
560 && $field['Key'] == 'PRI'
561 && ($field['Type'] == 'char(36)' || $field['Type'] == 'varchar(36)')
563 $default_function = $cfg['DefaultFunctions']['pk_char36'];
566 // this is set only when appropriate and is always true
567 if (isset($field['display_binary_as_hex'])) {
568 $default_function = 'UNHEX';
571 // loop on the dropdown array and print all available options for that field.
572 foreach ($dropdown as $each_dropdown){
573 echo '<option';
574 if ($default_function === $each_dropdown) {
575 echo ' selected="selected"';
577 echo '>' . $each_dropdown . '</option>' . "\n";
578 $dropdown_built[$each_dropdown] = 'TRUE';
579 $op_spacing_needed = TRUE;
582 // For compatibility's sake, do not let out all other functions. Instead
583 // print a separator (blank) and then show ALL functions which weren't shown
584 // yet.
585 $cnt_functions = count($cfg['Functions']);
586 for ($j = 0; $j < $cnt_functions; $j++) {
587 if (!isset($dropdown_built[$cfg['Functions'][$j]]) || $dropdown_built[$cfg['Functions'][$j]] != 'TRUE') {
588 // Is current function defined as default?
589 $selected = ($field['first_timestamp'] && $cfg['Functions'][$j] == $cfg['DefaultFunctions']['first_timestamp'])
590 || (!$field['first_timestamp'] && $cfg['Functions'][$j] == $default_function)
591 ? ' selected="selected"'
592 : '';
593 if ($op_spacing_needed == TRUE) {
594 echo ' ';
595 echo '<option value="">--------</option>' . "\n";
596 $op_spacing_needed = FALSE;
599 echo ' ';
600 echo '<option' . $selected . '>' . $cfg['Functions'][$j] . '</option>' . "\n";
602 } // end for
603 unset($selected);
605 </select>
606 </td>
607 <?php
609 } // end if ($cfg['ShowFunctionFields'])
612 // The null column
613 // ---------------
614 $foreignData = PMA_getForeignData($foreigners, $field['Field'], false, '', '');
615 echo ' <td>' . "\n";
616 if ($field['Null'] == 'YES') {
617 echo ' <input type="hidden" name="fields_null_prev' . $field_name_appendix . '"';
618 if ($real_null_value && !$field['first_timestamp']) {
619 echo ' value="on"';
621 echo ' />' . "\n";
623 echo ' <input type="checkbox" tabindex="' . ($tabindex + $tabindex_for_null) . '"'
624 . ' name="fields_null' . $field_name_appendix . '"';
625 if ($real_null_value && !$field['first_timestamp']) {
626 echo ' checked="checked"';
628 echo ' id="field_' . ($idindex) . '_2"';
629 $onclick = ' onclick="if (this.checked) {nullify(';
630 if (strstr($field['True_Type'], 'enum')) {
631 if (strlen($field['Type']) > 20) {
632 $onclick .= '1, ';
633 } else {
634 $onclick .= '2, ';
636 } elseif (strstr($field['True_Type'], 'set')) {
637 $onclick .= '3, ';
638 } elseif ($foreigners && isset($foreigners[$field['Field']]) && $foreignData['foreign_link'] == false) {
639 // foreign key in a drop-down
640 $onclick .= '4, ';
641 } elseif ($foreigners && isset($foreigners[$field['Field']]) && $foreignData['foreign_link'] == true) {
642 // foreign key with a browsing icon
643 $onclick .= '6, ';
644 } else {
645 $onclick .= '5, ';
647 $onclick .= '\'' . PMA_escapeJsString($field['Field_html']) . '\', \'' . $field['Field_md5'] . '\', \'' . PMA_escapeJsString($vkey) . '\'); this.checked = true}; return true" />' . "\n";
648 echo $onclick;
650 echo ' </td>' . "\n";
652 // The value column (depends on type)
653 // ----------------
654 // See bug #1667887 for the reason why we don't use the maxlength
655 // HTML attribute
657 echo ' <td>' . "\n";
658 if ($foreignData['foreign_link'] == true) {
659 echo $backup_field . "\n";
661 <input type="hidden" name="fields_type<?php echo $field_name_appendix; ?>"
662 value="foreign" />
663 <input type="hidden" name="fields<?php echo $field_name_appendix; ?>"
664 value="" id="field_<?php echo ($idindex); ?>_3A" />
665 <input type="text" name="field_<?php echo $field_name_appendix_md5; ?>"
666 class="textfield" <?php echo $unnullify_trigger; ?>
667 tabindex="<?php echo ($tabindex + $tabindex_for_value); ?>"
668 id="field_<?php echo ($idindex); ?>_3"
669 value="<?php echo htmlspecialchars($data); ?>" />
670 <script type="text/javascript">
671 //<![CDATA[
672 document.writeln('<a target="_blank" onclick="window.open(this.href, \'foreigners\', \'width=640,height=240,scrollbars=yes,resizable=yes\'); return false"');
673 document.write(' href="browse_foreigners.php?');
674 document.write('<?php echo PMA_generate_common_url($db, $table); ?>');
675 document.writeln('&amp;field=<?php echo PMA_escapeJsString(urlencode($field['Field']) . $browse_foreigners_uri); ?>">');
676 document.writeln('<?php echo str_replace("'", "\'", $titles['Browse']); ?></a>');
677 //]]>
678 </script>
679 <?php
680 } elseif (is_array($foreignData['disp_row'])) {
681 echo $backup_field . "\n";
683 <input type="hidden" name="fields_type<?php echo $field_name_appendix; ?>"
684 value="foreign" />
685 <input type="hidden" name="fields<?php echo $field_name_appendix; ?>"
686 value="" id="field_<?php echo $idindex; ?>_3A" />
687 <select name="field_<?php echo $field_name_appendix_md5; ?>"
688 <?php echo $unnullify_trigger; ?>
689 tabindex="<?php echo ($tabindex + $tabindex_for_value); ?>"
690 id="field_<?php echo ($idindex); ?>_3">
691 <?php echo PMA_foreignDropdown($foreignData['disp_row'], $foreignData['foreign_field'], $foreignData['foreign_display'], $data, $cfg['ForeignKeyMaxLimit']); ?>
692 </select>
693 <?php
694 // still needed? :
695 unset($foreignData['disp_row']);
696 } elseif ($cfg['LongtextDoubleTextarea'] && strstr($field['pma_type'], 'longtext')) {
698 &nbsp;</td>
699 </tr>
700 <tr class="<?php echo $odd_row ? 'odd' : 'even'; ?>">
701 <td colspan="5" align="right">
702 <?php echo $backup_field . "\n"; ?>
703 <textarea name="fields<?php echo $field_name_appendix; ?>"
704 rows="<?php echo ($cfg['TextareaRows']*2); ?>"
705 cols="<?php echo ($cfg['TextareaCols']*2); ?>"
706 dir="<?php echo $text_dir; ?>"
707 id="field_<?php echo ($idindex); ?>_3"
708 <?php echo $unnullify_trigger; ?>
709 tabindex="<?php echo ($tabindex + $tabindex_for_value); ?>"
710 ><?php echo $special_chars_encoded; ?></textarea>
711 <?php
712 } elseif (strstr($field['pma_type'], 'text')) {
713 echo $backup_field . "\n";
715 <textarea name="fields<?php echo $field_name_appendix; ?>"
716 rows="<?php echo $cfg['TextareaRows']; ?>"
717 cols="<?php echo $cfg['TextareaCols']; ?>"
718 dir="<?php echo $text_dir; ?>"
719 id="field_<?php echo ($idindex); ?>_3"
720 <?php echo $unnullify_trigger; ?>
721 tabindex="<?php echo ($tabindex + $tabindex_for_value); ?>"
722 ><?php echo $special_chars_encoded; ?></textarea>
723 <?php
724 echo "\n";
725 if (strlen($special_chars) > 32000) {
726 echo " </td>\n";
727 echo ' <td>' . $strTextAreaLength;
729 } elseif ($field['pma_type'] == 'enum') {
730 if (! isset($table_fields[$i]['values'])) {
731 $table_fields[$i]['values'] = array();
732 foreach ($extracted_fieldspec['enum_set_values'] as $val) {
733 // Removes automatic MySQL escape format
734 $val = str_replace('\'\'', '\'', str_replace('\\\\', '\\', $val));
735 $table_fields[$i]['values'][] = array(
736 'plain' => $val,
737 'html' => htmlspecialchars($val),
741 $field_enum_values = $table_fields[$i]['values'];
743 <input type="hidden" name="fields_type<?php echo $field_name_appendix; ?>" value="enum" />
744 <input type="hidden" name="fields<?php echo $field_name_appendix; ?>" value="" />
745 <?php
746 echo "\n" . ' ' . $backup_field . "\n";
748 // show dropdown or radio depend on length
749 if (strlen($field['Type']) > 20) {
751 <select name="field_<?php echo $field_name_appendix_md5; ?>"
752 <?php echo $unnullify_trigger; ?>
753 tabindex="<?php echo ($tabindex + $tabindex_for_value); ?>"
754 id="field_<?php echo ($idindex); ?>_3">
755 <option value="">&nbsp;</option>
756 <?php
757 echo "\n";
759 foreach ($field_enum_values as $enum_value) {
760 echo ' ';
761 echo '<option value="' . $enum_value['html'] . '"';
762 if ($data == $enum_value['plain']
763 || ($data == ''
764 && (! isset($where_clause) || $field['Null'] != 'YES')
765 && isset($field['Default'])
766 && $enum_value['plain'] == $field['Default'])) {
767 echo ' selected="selected"';
769 echo '>' . $enum_value['html'] . '</option>' . "\n";
770 } // end for
773 </select>
774 <?php
775 } else {
776 $j = 0;
777 foreach ($field_enum_values as $enum_value) {
778 echo ' ';
779 echo '<input type="radio" name="field_' . $field_name_appendix_md5 . '"';
780 echo ' value="' . $enum_value['html'] . '"';
781 echo ' id="field_' . ($idindex) . '_3_' . $j . '"';
782 echo $unnullify_trigger;
783 if ($data == $enum_value['plain']
784 || ($data == ''
785 && (! isset($where_clause) || $field['Null'] != 'YES')
786 && isset($field['Default'])
787 && $enum_value['plain'] == $field['Default'])) {
788 echo ' checked="checked"';
790 echo ' tabindex="' . ($tabindex + $tabindex_for_value) . '" />';
791 echo '<label for="field_' . $idindex . '_3_' . $j . '">'
792 . $enum_value['html'] . '</label>' . "\n";
793 $j++;
794 } // end for
795 } // end else
796 } elseif ($field['pma_type'] == 'set') {
797 if (! isset($table_fields[$i]['values'])) {
798 $table_fields[$i]['values'] = array();
799 foreach ($extracted_fieldspec['enum_set_values'] as $val) {
800 $table_fields[$i]['values'][] = array(
801 'plain' => $val,
802 'html' => htmlspecialchars($val),
805 $table_fields[$i]['select_size'] = min(4, count($table_fields[$i]['values']));
807 $field_set_values = $table_fields[$i]['values'];
808 $select_size = $table_fields[$i]['select_size'];
810 $vset = array_flip(explode(',', $data));
811 echo $backup_field . "\n";
813 <input type="hidden" name="fields_type<?php echo $field_name_appendix; ?>" value="set" />
814 <input type="hidden" name="fields<?php echo $field_name_appendix; ?>" value="" />
815 <select name="field_<?php echo $field_name_appendix_md5; ?>"
816 size="<?php echo $select_size; ?>"
817 multiple="multiple" <?php echo $unnullify_trigger; ?>
818 tabindex="<?php echo ($tabindex + $tabindex_for_value); ?>"
819 id="field_<?php echo ($idindex); ?>_3">
820 <?php
821 foreach ($field_set_values as $field_set_value) {
822 echo ' ';
823 echo '<option value="' . $field_set_value['html'] . '"';
824 if (isset($vset[$field_set_value['plain']])) {
825 echo ' selected="selected"';
827 echo '>' . $field_set_value['html'] . '</option>' . "\n";
828 } // end for
830 </select>
831 <?php
833 // Change by Bernard M. Piller <bernard@bmpsystems.com>
834 // We don't want binary data destroyed
835 elseif ($field['is_binary'] || $field['is_blob']) {
836 if (($cfg['ProtectBinary'] && $field['is_blob'])
837 || ($cfg['ProtectBinary'] == 'all' && $field['is_binary'])) {
838 echo "\n";
839 // for blobstreaming
840 $bs_reference_exists = FALSE;
842 if (isset ($tbl_type) && strlen ($tbl_type) > 0)
844 // load PMA_Config
845 $PMA_Config = $GLOBALS['PMA_Config'];
847 if (!empty($PMA_Config))
849 $requiredTblType = $PMA_Config->get('PBXT_NAME');
851 if ($requiredTblType == strtolower ($tbl_type))
853 $pluginsExist = $PMA_Config->get('BLOBSTREAMING_PLUGINS_EXIST');
855 // check if blobstreaming plugins exist
856 if ($pluginsExist)
858 $bs_tables = $PMA_Config->get('BLOBSTREAMABLE_DATABASES');
860 if (!empty($bs_tables) && strlen($db) > 0)
862 $bs_tables = $bs_tables[$db];
864 if (isset($bs_tables))
866 $allBSTablesExist = TRUE;
868 foreach ($bs_tables as $table_key=>$bs_tbl)
869 if (!$bs_tables[$table_key]['Exists'])
871 $allBSTablesExist = FALSE;
872 break;
875 if ($allBSTablesExist)
876 $bs_reference_exists = PMA_BS_ReferenceExists($data, $db);
877 } // end if (isset($bs_tables))
878 } // end if (!empty($bs_tables) && strlen($db) > 0)
879 } // end if ($pluginsExist)
880 } // end if ($requiredTblType == strtolower ($tbl_type))
881 } // end if (!empty($PMA_Config))
882 } // end if (isset ($tbl_type) && strlen ($tbl_type) > 0)
884 if ($bs_reference_exists)
886 echo '<input type="hidden" name="remove_blob_ref_' . $field['Field_md5'] . $vkey . '" value="' . $data . '" />';
887 echo '<input type="checkbox" name="remove_blob_repo_' . $field['Field_md5'] . $vkey . '" /> ' . $strBLOBRepositoryRemove . "<br />";
888 echo PMA_BS_CreateReferenceLink($data, $db);
889 echo "<br />";
891 else
893 echo $strBinaryDoNotEdit;
894 if (isset($data)) {
895 $data_size = PMA_formatByteDown(strlen(stripslashes($data)), 3, 1);
896 echo ' ('. $data_size [0] . ' ' . $data_size[1] . ')';
897 unset($data_size);
899 echo "\n";
900 } // end if ($bs_reference_exists)
902 <input type="hidden" name="fields_type<?php echo $field_name_appendix; ?>" value="protected" />
903 <input type="hidden" name="fields<?php echo $field_name_appendix; ?>" value="" />
904 <?php
905 } elseif ($field['is_blob']) {
906 echo "\n";
907 echo $backup_field . "\n";
909 <textarea name="fields<?php echo $field_name_appendix; ?>"
910 rows="<?php echo $cfg['TextareaRows']; ?>"
911 cols="<?php echo $cfg['TextareaCols']; ?>"
912 dir="<?php echo $text_dir; ?>"
913 id="field_<?php echo ($idindex); ?>_3"
914 <?php echo $unnullify_trigger; ?>
915 tabindex="<?php echo ($tabindex + $tabindex_for_value); ?>"
916 ><?php echo $special_chars_encoded; ?></textarea>
917 <?php
919 } else {
920 // field size should be at least 4 and max 40
921 $fieldsize = min(max($field['len'], 4), 40);
922 echo "\n";
923 echo $backup_field . "\n";
925 <input type="text" name="fields<?php echo $field_name_appendix; ?>"
926 value="<?php echo $special_chars; ?>" size="<?php echo $fieldsize; ?>"
927 class="textfield" <?php echo $unnullify_trigger; ?>
928 tabindex="<?php echo ($tabindex + $tabindex_for_value); ?>"
929 id="field_<?php echo ($idindex); ?>_3" />
930 <?php
931 } // end if...elseif...else
933 // Upload choice (only for BLOBs because the binary
934 // attribute does not imply binary contents)
935 // (displayed whatever value the ProtectBinary has)
937 if ($is_upload && $field['is_blob']) {
938 // check if field type is of longblob
939 if ($field['pma_type'] == "longblob")
941 if (isset ($tbl_type) && strlen ($tbl_type) > 0)
943 // load PMA Config
944 $PMA_Config = $GLOBALS['PMA_Config'];
946 // is PMA_Config's data loaded? continue only if it is
947 if (!empty($PMA_Config))
949 $requiredTblType = $PMA_Config->get('PBXT_NAME');
951 if ($requiredTblType == strtolower ($tbl_type))
953 $pluginsExist = $PMA_Config->get('BLOBSTREAMING_PLUGINS_EXIST');
955 // check if blobstreaming plugins exist
956 if ($pluginsExist)
958 $curlExists = $PMA_Config->get('CURL_EXISTS');
960 // check if CURL exists
961 if ($curlExists)
963 $bs_tables = $PMA_Config->get('BLOBSTREAMABLE_DATABASES');
965 // check for BLOBStreamable databases and if current database name is provided
966 if (!empty($bs_tables) && strlen($db) > 0)
968 $bs_tables = $bs_tables[$db];
970 // check if reference to BLOBStreaming tables exists
971 if (isset($bs_tables))
973 $allBSTablesExist = TRUE;
975 foreach ($bs_tables as $table_key=>$bs_tbl)
976 if (!$bs_tables[$table_key]['Exists'])
978 $allBSTablesExist = FALSE;
979 break;
982 // check if necessary BLOBStreaming tables exist
983 if ($allBSTablesExist)
985 echo '<br />';
986 echo '<input type="checkbox" name="upload_blob_repo_' . $field['Field_md5'] . $vkey . '" /> ' . $strBLOBRepositoryUpload;
987 } // end if ($allBSTablesExist)
988 } // end if (isset($bs_tables)
989 } // end if (!empty($bs_tables) && strlen ($db) > 0)
990 } // end if ($curlExists)
991 } // end if ($pluginsExist)
992 } // end if ($requiredTblType == strtolower ($tbl_type))
993 } // end if (!empty($PMA_Config))
994 } // end if (isset ($tbl_type) && strlen ($tbl_type) > 0)
997 echo '<br />';
998 echo '<input type="file" name="fields_upload_' . $field['Field_md5'] . $vkey . '" class="textfield" id="field_' . $idindex . '_3" size="10" ' . $unnullify_trigger . '/>&nbsp;';
1000 // find maximum upload size, based on field type
1002 * @todo with functions this is not so easy, as you can basically
1003 * process any data with function like MD5
1005 $max_field_sizes = array(
1006 'tinyblob' => '256',
1007 'blob' => '65536',
1008 'mediumblob' => '16777216',
1009 'longblob' => '4294967296'); // yeah, really
1011 $this_field_max_size = $max_upload_size; // from PHP max
1012 if ($this_field_max_size > $max_field_sizes[$field['pma_type']]) {
1013 $this_field_max_size = $max_field_sizes[$field['pma_type']];
1015 echo PMA_displayMaximumUploadSize($this_field_max_size) . "\n";
1016 // do not generate here the MAX_FILE_SIZE, because we should
1017 // put only one in the form to accommodate the biggest field
1018 if ($this_field_max_size > $biggest_max_file_size) {
1019 $biggest_max_file_size = $this_field_max_size;
1023 if (!empty($cfg['UploadDir'])) {
1024 $files = PMA_getFileSelectOptions(PMA_userDir($cfg['UploadDir']));
1025 if ($files === FALSE) {
1026 echo ' <font color="red">' . $strError . '</font><br />' . "\n";
1027 echo ' ' . $strWebServerUploadDirectoryError . "\n";
1028 } elseif (!empty($files)) {
1029 echo "<br />\n";
1030 echo ' <i>' . $strOr . '</i>' . ' ' . $strWebServerUploadDirectory . ':<br />' . "\n";
1031 echo ' <select size="1" name="fields_uploadlocal_' . $field['Field_md5'] . $vkey . '">' . "\n";
1032 echo ' <option value="" selected="selected"></option>' . "\n";
1033 echo $files;
1034 echo ' </select>' . "\n";
1036 } // end if (web-server upload directory)
1037 } // end elseif (binary or blob)
1038 else {
1039 // field size should be at least 4 and max 40
1040 $fieldsize = min(max($field['len'], 4), 40);
1041 echo $backup_field . "\n";
1042 if ($field['is_char'] && ($cfg['CharEditing'] == 'textarea' || strpos($data, "\n") !== FALSE)) {
1043 echo "\n";
1045 <textarea name="fields<?php echo $field_name_appendix; ?>"
1046 rows="<?php echo $cfg['CharTextareaRows']; ?>"
1047 cols="<?php echo $cfg['CharTextareaCols']; ?>"
1048 dir="<?php echo $text_dir; ?>"
1049 id="field_<?php echo ($idindex); ?>_3"
1050 <?php echo $unnullify_trigger; ?>
1051 tabindex="<?php echo ($tabindex + $tabindex_for_value); ?>"
1052 ><?php echo $special_chars_encoded; ?></textarea>
1053 <?php
1054 } else {
1056 <input type="text" name="fields<?php echo $field_name_appendix; ?>"
1057 value="<?php echo $special_chars; ?>" size="<?php echo $fieldsize; ?>"
1058 class="textfield" <?php echo $unnullify_trigger; ?>
1059 tabindex="<?php echo ($tabindex + $tabindex_for_value); ?>"
1060 id="field_<?php echo ($idindex); ?>_3" />
1061 <?php
1062 if ($field['Extra'] == 'auto_increment') {
1064 <input type="hidden" name="auto_increment<?php echo $field_name_appendix; ?>" value="1" />
1065 <?php
1066 } // end if
1067 if (substr($field['pma_type'], 0, 9) == 'timestamp') {
1069 <input type="hidden" name="fields_type<?php echo $field_name_appendix; ?>" value="timestamp" />
1070 <?php
1072 if ($field['True_Type'] == 'bit') {
1074 <input type="hidden" name="fields_type<?php echo $field_name_appendix; ?>" value="bit" />
1075 <?php
1077 if ($field['pma_type'] == 'date' || $field['pma_type'] == 'datetime' || substr($field['pma_type'], 0, 9) == 'timestamp') {
1078 // the _3 suffix points to the date field
1079 // the _2 suffix points to the corresponding NULL checkbox
1081 <script type="text/javascript">
1082 //<![CDATA[
1083 document.write('<a title="<?php echo $strCalendar;?>"');
1084 document.write(' href="javascript:openCalendar(\'<?php echo PMA_generate_common_url();?>\', \'insertForm\', \'field_<?php echo ($idindex); ?>_3\', \'<?php echo (substr($field['pma_type'], 0, 9) == 'timestamp') ? 'datetime' : substr($field['pma_type'], 0, 9); ?>\', \'field_<?php echo ($idindex); ?>_2\')">');
1085 document.write('<img class="calendar"');
1086 document.write(' src="<?php echo $pmaThemeImage; ?>b_calendar.png"');
1087 document.write(' alt="<?php echo $strCalendar; ?>"/></a>');
1088 //]]>
1089 </script>
1090 <?php
1095 </td>
1096 </tr>
1097 <?php
1098 $odd_row = !$odd_row;
1099 } // end for
1100 $o_rows++;
1101 echo ' </tbody></table><br />';
1102 } // end foreach on multi-edit
1104 <br />
1106 <fieldset>
1107 <table border="0" cellpadding="5" cellspacing="0">
1108 <tr>
1109 <td valign="middle" nowrap="nowrap">
1110 <select name="submit_type" tabindex="<?php echo ($tabindex + $tabindex_for_value + 1); ?>">
1111 <?php
1112 if (isset($where_clause)) {
1114 <option value="save"><?php echo $strSave; ?></option>
1115 <?php
1118 <option value="insert"><?php echo $strInsertAsNewRow; ?></option>
1119 <option value="insertignore"><?php echo $strInsertIgnoreAsNewRow; ?></option>
1120 <option value="showinsert"><?php echo $strShowInsert; ?></option>
1121 </select>
1122 <?php
1123 echo "\n";
1125 if (!isset($after_insert)) {
1126 $after_insert = 'back';
1129 </td>
1130 <td valign="middle">
1131 &nbsp;&nbsp;&nbsp;<strong><?php echo $strAndThen; ?></strong>&nbsp;&nbsp;&nbsp;
1132 </td>
1133 <td valign="middle" nowrap="nowrap">
1134 <select name="after_insert">
1135 <option value="back" <?php echo ($after_insert == 'back' ? 'selected="selected"' : ''); ?>><?php echo $strAfterInsertBack; ?></option>
1136 <option value="new_insert" <?php echo ($after_insert == 'new_insert' ? 'selected="selected"' : ''); ?>><?php echo $strAfterInsertNewInsert; ?></option>
1137 <?php
1138 if (isset($where_clause)) {
1140 <option value="same_insert" <?php echo ($after_insert == 'same_insert' ? 'selected="selected"' : ''); ?>><?php echo $strAfterInsertSame; ?></option>
1141 <?php
1142 // If we have just numeric primary key, we can also edit next
1143 // in 2.8.2, we were looking for `field_name` = numeric_value
1144 //if (preg_match('@^[\s]*`[^`]*` = [0-9]+@', $where_clause)) {
1145 // in 2.9.0, we are looking for `table_name`.`field_name` = numeric_value
1146 if ($found_unique_key && preg_match('@^[\s]*`[^`]*`[\.]`[^`]*` = [0-9]+@', $where_clause)) {
1148 <option value="edit_next" <?php echo ($after_insert == 'edit_next' ? 'selected="selected"' : ''); ?>><?php echo $strAfterInsertNext; ?></option>
1149 <?php
1153 </select>
1154 </td>
1155 </tr>
1157 <tr>
1158 <td>
1159 <?php echo PMA_showHint($strUseTabKey); ?>
1160 </td>
1161 <td colspan="3" align="right" valign="middle">
1162 <input type="submit" value="<?php echo $strGo; ?>" tabindex="<?php echo ($tabindex + $tabindex_for_value + 6); ?>" id="buttonYes" />
1163 <input type="reset" value="<?php echo $strReset; ?>" tabindex="<?php echo ($tabindex + $tabindex_for_value + 7); ?>" />
1164 </td>
1165 </tr>
1166 </table>
1167 </fieldset>
1168 <?php if ($biggest_max_file_size > 0) {
1169 echo ' ' . PMA_generateHiddenMaxFileSize($biggest_max_file_size) . "\n";
1170 } ?>
1171 </form>
1172 <?php
1173 if ($insert_mode) {
1175 <!-- Restart insertion form -->
1176 <form method="post" action="tbl_replace.php" name="restartForm" >
1177 <?php echo PMA_generate_common_hidden_inputs($db, $table); ?>
1178 <input type="hidden" name="goto" value="<?php echo htmlspecialchars($GLOBALS['goto']); ?>" />
1179 <input type="hidden" name="err_url" value="<?php echo htmlspecialchars($err_url); ?>" />
1180 <input type="hidden" name="sql_query" value="<?php echo htmlspecialchars($sql_query); ?>" />
1181 <?php
1182 if (isset($where_clauses)) {
1183 foreach ($where_clause_array as $key_id => $where_clause) {
1184 echo '<input type="hidden" name="where_clause[' . $key_id . ']" value="' . htmlspecialchars(trim($where_clause)) . '" />'. "\n";
1187 $tmp = '<select name="insert_rows" id="insert_rows" onchange="this.form.submit();" >' . "\n";
1188 $option_values = array(1,2,5,10,15,20,30,40);
1189 foreach ($option_values as $value) {
1190 $tmp .= '<option value="' . $value . '"';
1191 if ($value == $cfg['InsertRows']) {
1192 $tmp .= ' selected="selected"';
1194 $tmp .= '>' . $value . '</option>' . "\n";
1196 $tmp .= '</select>' . "\n";
1197 echo "\n" . sprintf($strRestartInsertion, $tmp);
1198 unset($tmp);
1199 echo '<noscript><input type="submit" value="' . $strGo . '" /></noscript>' . "\n";
1200 echo '</form>' . "\n";
1204 * Displays the footer
1206 require_once './libraries/footer.inc.php';