update
[phpmyadmin/crack.git] / tbl_change.php3
blob808cb575177b421b3749e1dd30c26ad61d5798e5
1 <?php
2 /* $Id$ */
3 // vim: expandtab sw=4 ts=4 sts=4:
6 /**
7 * Get the variables sent or posted to this script and displays the header
8 */
9 require('./libraries/grab_globals.lib.php3');
10 $js_to_run = 'tbl_change.js';
11 require('./header.inc.php3');
12 require('./libraries/relation.lib.php3'); // foreign keys
15 /**
16 * Displays the query submitted and its result
18 if (!empty($message)) {
19 if (isset($goto)) {
20 $goto_cpy = $goto;
21 $goto = 'tbl_properties.php3'
22 . '?lang=' . $lang
23 . '&amp;convcharset=' . $convcharset
24 . '&amp;server=' . $server
25 . '&amp;db=' . urlencode($db)
26 . '&amp;table=' . urlencode($table)
27 . '&amp;$show_query=1'
28 . '&amp;sql_query=' . urlencode($disp_query);
29 } else {
30 $show_query = '1';
32 if (isset($sql_query)) {
33 $sql_query_cpy = $sql_query;
34 unset($sql_query);
36 if (isset($disp_query)) {
37 $sql_query = (get_magic_quotes_gpc() ? stripslashes($disp_query) : $disp_query);
39 PMA_showMessage($message);
40 if (isset($goto_cpy)) {
41 $goto = $goto_cpy;
42 unset($goto_cpy);
44 if (isset($sql_query_cpy)) {
45 $sql_query = $sql_query_cpy;
46 unset($sql_query_cpy);
49 if (get_magic_quotes_gpc()) {
50 if (!empty($sql_query)) {
51 $sql_query = stripslashes($sql_query);
53 if (!empty($primary_key)) {
54 $primary_key = stripslashes($primary_key);
56 } // end if
59 /**
60 * Defines the url to return to in case of error in a sql statement
62 if (!isset($goto)) {
63 $goto = 'db_details.php3';
65 //if ($goto != 'db_details.php3' && $goto != 'tbl_properties.php3') {
66 if (!ereg('^(db_details|tbl_properties|tbl_select)', $goto)) {
67 $err_url = $goto;
68 } else {
69 $err_url = $goto
70 . '?lang=' . $lang
71 . '&amp;convcharset=' . $convcharset
72 . '&amp;server=' . $server
73 . '&amp;db=' . urlencode($db)
74 //. (($goto == 'tbl_properties.php3') ? '&amp;table=' . urlencode($table) : '');
75 . ((ereg('^(tbl_properties|tbl_select)', $goto)) ? '&amp;table=' . urlencode($table) : '');
79 /**
80 * Ensures db and table are valid, else moves to the "parent" script
82 require('./libraries/db_table_exists.lib.php3');
85 /**
86 * Sets parameters for links and displays top menu
88 $url_query = 'lang=' . $lang
89 . '&amp;convcharset=' . $convcharset
90 . '&amp;server=' . $server
91 . '&amp;db=' . urlencode($db)
92 . '&amp;table=' . urlencode($table)
93 . '&amp;goto=tbl_properties.php3';
95 require('./tbl_properties_table_info.php3');
96 echo '<br />';
99 /**
100 * Get the list of the fields of the current table
102 PMA_mysql_select_db($db);
103 $table_def = PMA_mysql_query('SHOW FIELDS FROM ' . PMA_backquote($table));
104 if (isset($primary_key)) {
105 $local_query = 'SELECT * FROM ' . PMA_backquote($table) . ' WHERE ' . $primary_key;
106 $result = PMA_mysql_query($local_query) or PMA_mysqlDie('', $local_query, '', $err_url);
107 $row = PMA_mysql_fetch_array($result);
108 // No row returned
109 if (!$row) {
110 unset($row);
111 unset($primary_key);
112 $goto_cpy = $goto;
113 $goto = 'tbl_properties.php3'
114 . '?lang=' . $lang
115 . '&amp;convcharset=' . $convcharset
116 . '&amp;server=' . $server
117 . '&amp;db=' . urlencode($db)
118 . '&amp;table=' . urlencode($table)
119 . '&amp;$show_query=1'
120 . '&amp;sql_query=' . urlencode($local_query);
121 if (isset($sql_query)) {
122 $sql_query_cpy = $sql_query;
123 unset($sql_query);
125 $sql_query = $local_query;
126 PMA_showMessage($strEmptyResultSet);
127 $goto = $goto_cpy;
128 unset($goto_cpy);
129 if (isset($sql_query_cpy)) {
130 $sql_query = $sql_query_cpy;
131 unset($sql_query_cpy);
133 } // end if (no record returned)
135 else
137 $local_query = 'SELECT * FROM ' . PMA_backquote($table) . ' LIMIT 1';
138 $result = PMA_mysql_query($local_query) or PMA_mysqlDie('', $local_query, '', $err_url);
139 unset($row);
142 // <markus@noga.de>
143 // retrieve keys into foreign fields, if any
144 $cfgRelation = PMA_getRelationsParam();
145 $foreigners = ($cfgRelation['relwork'] ? PMA_getForeigners($db, $table) : FALSE);
149 * Displays the form
151 // loic1: autocomplete feature of IE kills the "onchange" event handler and it
152 // must be replaced by the "onpropertychange" one in this case
153 $chg_evt_handler = (PMA_USR_BROWSER_AGENT == 'IE' && PMA_USR_BROWSER_VER >= 5)
154 ? 'onpropertychange'
155 : 'onchange';
156 // Had to put the URI because when hosted on an https server,
157 // some browsers send wrongly this form to the http server.
160 <!-- Change table properties form -->
161 <form method="post" action="tbl_replace.php3" name="insertForm">
162 <input type="hidden" name="lang" value="<?php echo $lang; ?>" />
163 <input type="hidden" name="convcharset" value="<?php echo $convcharset; ?>" />
164 <input type="hidden" name="server" value="<?php echo $server; ?>" />
165 <input type="hidden" name="db" value="<?php echo htmlspecialchars($db); ?>" />
166 <input type="hidden" name="table" value="<?php echo $table; ?>" />
167 <input type="hidden" name="goto" value="<?php echo $goto; ?>" />
168 <input type="hidden" name="pos" value="<?php echo isset($pos) ? $pos : 0; ?>" />
169 <input type="hidden" name="session_max_rows" value="<?php echo isset($session_max_rows) ? $session_max_rows : ''; ?>" />
170 <input type="hidden" name="disp_direction" value="<?php echo isset($disp_direction) ? $disp_direction : ''; ?>" />
171 <input type="hidden" name="repeat_cells" value="<?php echo isset($repeat_cells) ? $repeat_cells : ''; ?>" />
172 <input type="hidden" name="dontlimitchars" value="<?php echo (isset($dontlimitchars) ? $dontlimitchars : 0); ?>" />
173 <input type="hidden" name="err_url" value="<?php echo urlencode($err_url); ?>" />
174 <input type="hidden" name="sql_query" value="<?php echo isset($sql_query) ? urlencode($sql_query) : ''; ?>" />
175 <?php
176 if (isset($primary_key)) {
178 <input type="hidden" name="primary_key" value="<?php echo urlencode($primary_key); ?>" />
179 <?php
181 echo "\n";
184 <table border="<?php echo $cfg['Border']; ?>">
185 <tr>
186 <th><?php echo $strField; ?></th>
187 <th><?php echo $strType; ?></th>
188 <?php
189 if ($cfg['ShowFunctionFields']) {
190 echo ' <th>' . $strFunction . '</th>' . "\n";
193 <th><?php echo $strNull; ?></th>
194 <th><?php echo $strValue; ?></th>
195 </tr>
197 <?php
198 // Set if we passed the first timestamp field
199 $timestamp_seen = 0;
200 $fields_cnt = mysql_num_rows($table_def);
202 // Set a flag here because the 'if' would not be valid in the loop
203 // if we set a value in some field
204 $insert_mode = (!isset($row) ? TRUE : FALSE);
206 for ($i = 0; $i < $fields_cnt; $i++) {
207 // Display the submit button after every 15 lines --swix
208 // (wanted to use an <a href="#bottom"> and <a name> instead,
209 // but it didn't worked because of the <base href>)
211 if ((($i % 15) == 0) && ($i != 0)) {
213 <tr>
214 <th colspan="5" align="right">
215 <input type="submit" value="<?php echo $strGo; ?>" />&nbsp;
216 </th>
217 </tr>
218 <?php
219 } // end if
220 echo "\n";
222 $row_table_def = PMA_mysql_fetch_array($table_def);
223 $field = $row_table_def['Field'];
224 // loic1: current date should not be set as default if the field is NULL
225 // for the current row
226 // lem9: but do not put here the current datetime if there is a default
227 // value (the real default value will be set in the
228 // Default value logic below)
229 if ($row_table_def['Type'] == 'datetime'
230 && (!isset($row_table_def['Default']))) {
231 // INSERT case
232 if ($insert_mode) {
233 $row[$field] = date('Y-m-d H:i:s', time());
235 // UPDATE case with an empty and not NULL value under PHP4
236 else if (empty($row[$field]) && function_exists('is_null')) {
237 $row[$field] = (is_null($row[$field]) ? $row[$field] : date('Y-m-d H:i:s', time()));
239 // UPDATE case with an empty value under PHP3
240 else if (empty($row[$field])) {
241 $row[$field] = date('Y-m-d H:i:s', time());
242 } // end if... else if... else if...
244 $len = (eregi('float|double', $row_table_def['Type']))
245 ? 100
246 : @mysql_field_len($result, $i);
247 $first_timestamp = 0;
249 $bgcolor = ($i % 2) ? $cfg['BgcolorOne'] : $cfg['BgcolorTwo'];
251 <tr>
252 <td align="center" bgcolor="<?php echo $bgcolor; ?>"><?php echo htmlspecialchars($field); ?></td>
253 <?php
254 echo "\n";
256 // The type column
257 $is_binary = eregi(' binary', $row_table_def['Type']);
258 $is_blob = eregi('blob', $row_table_def['Type']);
259 $is_char = eregi('char', $row_table_def['Type']);
260 $row_table_def['True_Type'] = ereg_replace('\\(.*', '', $row_table_def['Type']);
261 switch ($row_table_def['True_Type']) {
262 case 'set':
263 $type = 'set';
264 $type_nowrap = '';
265 break;
266 case 'enum':
267 $type = 'enum';
268 $type_nowrap = '';
269 break;
270 case 'timestamp':
271 if (!$timestamp_seen) { // can only occur once per table
272 $timestamp_seen = 1;
273 $first_timestamp = 1;
275 $type = $row_table_def['Type'];
276 $type_nowrap = ' nowrap="nowrap"';
277 break;
279 default:
280 $type = $row_table_def['Type'];
281 $type_nowrap = ' nowrap="nowrap"';
282 break;
285 <td align="center" bgcolor="<?php echo $bgcolor; ?>"<?php echo $type_nowrap; ?>><?php echo $type; ?></td>
286 <?php
287 echo "\n";
289 // Prepares the field value
290 if (isset($row)) {
291 // loic1: null field value
292 if (!isset($row[$field])) {
293 $row[$field] = 'NULL';
294 $special_chars = '';
295 $data = $row[$field];
296 } else {
297 // loic1: special binary "characters"
298 if ($is_binary || $is_blob) {
299 $row[$field] = str_replace("\x00", '\0', $row[$field]);
300 $row[$field] = str_replace("\x08", '\b', $row[$field]);
301 $row[$field] = str_replace("\x0a", '\n', $row[$field]);
302 $row[$field] = str_replace("\x0d", '\r', $row[$field]);
303 $row[$field] = str_replace("\x1a", '\Z', $row[$field]);
304 } // end if
305 $special_chars = htmlspecialchars($row[$field]);
306 $data = $row[$field];
307 } // end if... else...
308 // loic1: if a timestamp field value is not included in an update
309 // statement MySQL auto-update it to the current timestamp
310 $backup_field = ($row_table_def['True_Type'] == 'timestamp')
311 ? ''
312 : '<input type="hidden" name="fields_prev[' . urlencode($field) . ']" value="' . urlencode($row[$field]) . '" />';
313 } else {
314 // loic1: display default values
315 if (!isset($row_table_def['Default'])) {
316 $row_table_def['Default'] = '';
317 $data = 'NULL';
318 } else {
319 $data = $row_table_def['Default'];
321 $special_chars = htmlspecialchars($row_table_def['Default']);
322 $backup_field = '';
325 // The function column
326 // -------------------
327 // Change by Bernard M. Piller <bernard@bmpsystems.com>
328 // We don't want binary data to be destroyed
329 // Note: from the MySQL manual: "BINARY doesn't affect how the column is
330 // stored or retrieved" so it does not mean that the contents is
331 // binary
332 if ($cfg['ShowFunctionFields']) {
333 if (($cfg['ProtectBinary'] && $is_blob)
334 || ($cfg['ProtectBinary'] == 'all' && $is_binary)) {
335 echo ' <td align="center" bgcolor="'. $bgcolor . '">' . $strBinary . '</td>' . "\n";
336 } else if (strstr($row_table_def['True_Type'], 'enum') || strstr($row_table_def['True_Type'], 'set')) {
337 echo ' <td align="center" bgcolor="'. $bgcolor . '">--</td>' . "\n";
338 } else {
340 <td bgcolor="<?php echo $bgcolor; ?>">
341 <select name="funcs[<?php echo urlencode($field); ?>]" <?php echo $chg_evt_handler; ?>="return unNullify('<?php echo urlencode($field); ?>')" tabindex="<?php echo ($fields_cnt + $i + 1); ?>">
342 <option></option>
343 <?php
344 echo "\n";
345 $selected = '';
346 for ($j = 0; $j < count($cfg['Functions']); $j++) {
347 // for default function = NOW() on first timestamp field
348 // -- swix/18jul01
349 $selected = ($first_timestamp && $cfg['Functions'][$j] == 'NOW')
350 ? ' selected="selected"'
351 : '';
352 echo ' ';
353 echo '<option' . $selected . '>' . $cfg['Functions'][$j] . '</option>' . "\n";
354 } // end for
355 unset($selected);
357 </select>
358 </td>
359 <?php
361 } // end if ($cfg['ShowFunctionFields'])
362 echo "\n";
364 // The null column
365 // ---------------
366 echo ' <td bgcolor="' . $bgcolor . '">' . "\n";
367 if (!(($cfg['ProtectBinary'] && $is_blob) || ($cfg['ProtectBinary'] == 'all' && $is_binary))
368 && $row_table_def['Null'] == 'YES') {
369 echo ' <input type="checkbox" tabindex="' . ((2 * $fields_cnt) + $i + 1) . '"'
370 . ' name="fields_null[' . urlencode($field) . ']"';
371 if ($data == 'NULL' && !$first_timestamp) {
372 echo ' checked="checked"';
374 $onclick = ' onclick="if (this.checked) {nullify(';
375 if (strstr($row_table_def['True_Type'], 'enum')) {
376 if (strlen($row_table_def['Type']) > 20) {
377 $onclick .= '1, ';
378 } else {
379 $onclick .= '2, ';
381 } else if (strstr($row_table_def['True_Type'], 'set')) {
382 $onclick .= '3, ';
383 } else if ($foreigners && isset($foreigners[$field])) {
384 $onclick .= '4, ';
385 } else {
386 $onclick .= '5, ';
388 $onclick .= '\'' . urlencode($field) . '\', \'' . md5($field) . '\'); this.checked = true}; return true" />' . "\n";
389 echo $onclick;
390 } else {
391 echo ' &nbsp;' . "\n";
393 echo ' </td>' . "\n";
395 // The value column (depends on type)
396 // ----------------
398 include('./libraries/get_foreign.lib.php3');
400 if (isset($disp) && $disp) {
402 <td bgcolor="<?php echo $bgcolor; ?>">
403 <?php echo $backup_field . "\n"; ?>
404 <input type="hidden" name="fields[<?php echo urlencode($field); ?>]" value="$foreign$" />
405 <select name="field_<?php echo md5($field); ?>[]" <?php echo $chg_evt_handler; ?>="return unNullify('<?php echo urlencode($field); ?>')" tabindex="<?php echo ($i + 1); ?>">
406 <option value=""></option>
407 <?php
408 echo "\n";
409 while ($relrow = @PMA_mysql_fetch_array($disp)) {
410 $key = $relrow[$foreign_field];
411 $value = (($foreign_display != FALSE) ? '&nbsp;-&nbsp;' . htmlspecialchars($relrow[$foreign_display]) : '');
412 echo ' <option value="' . htmlspecialchars($key) . '"';
413 if ($key == $data) {
414 echo ' selected="selected"';
415 } // end if
416 echo '>' . htmlspecialchars($key) . $value . '</option>' . "\n";
417 } // end while
418 echo ' </select>' . "\n";
419 echo ' </td>' . "\n";
420 unset($disp);
422 else if (strstr($row_table_def['True_Type'], 'text')) {
424 <td bgcolor="<?php echo $bgcolor; ?>">
425 <?php echo $backup_field . "\n"; ?>
426 <textarea name="fields[<?php echo urlencode($field); ?>]" rows="<?php echo $cfg['TextareaRows']; ?>" cols="<?php echo $cfg['TextareaCols']; ?>" wrap="virtual" dir="<?php echo $text_dir; ?>"
427 <?php echo $chg_evt_handler; ?>="return unNullify('<?php echo urlencode($field); ?>')" tabindex="<?php echo ($i + 1); ?>"><?php echo $special_chars; ?></textarea>
428 </td>
429 <?php
430 echo "\n";
431 if (strlen($special_chars) > 32000) {
432 echo ' <td bgcolor="' . $bgcolor . '">' . $strTextAreaLength . '</td>' . "\n";
435 else if (strstr($row_table_def['True_Type'], 'enum')) {
436 $enum = str_replace('enum(', '', $row_table_def['Type']);
437 $enum = ereg_replace('\\)$', '', $enum);
438 $enum = explode('\',\'', substr($enum, 1, -1));
439 $enum_cnt = count($enum);
441 <td bgcolor="<?php echo $bgcolor; ?>">
442 <input type="hidden" name="fields[<?php echo urlencode($field); ?>]" value="$enum$" />
443 <?php
444 echo "\n" . ' ' . $backup_field;
446 // show dropdown or radio depend on length
447 if (strlen($row_table_def['Type']) > 20) {
448 echo "\n";
450 <select name="field_<?php echo md5($field); ?>[]" <?php echo $chg_evt_handler; ?>="return unNullify('<?php echo urlencode($field); ?>')" tabindex="<?php echo ($i + 1); ?>">
451 <option value=""></option>
452 <?php
453 echo "\n";
455 for ($j = 0; $j < $enum_cnt; $j++) {
456 // Removes automatic MySQL escape format
457 $enum_atom = str_replace('\'\'', '\'', str_replace('\\\\', '\\', $enum[$j]));
458 echo ' ';
459 echo '<option value="' . urlencode($enum_atom) . '"';
460 if ($data == $enum_atom
461 || ($data == '' && (!isset($primary_key) || $row_table_def['Null'] != 'YES')
462 && isset($row_table_def['Default']) && $enum_atom == $row_table_def['Default'])) {
463 echo ' selected="selected"';
465 echo '>' . htmlspecialchars($enum_atom) . '</option>' . "\n";
466 } // end for
469 </select>
470 <?php
471 } // end if
472 else {
473 echo "\n";
474 for ($j = 0; $j < $enum_cnt; $j++) {
475 // Removes automatic MySQL escape format
476 $enum_atom = str_replace('\'\'', '\'', str_replace('\\\\', '\\', $enum[$j]));
477 echo ' ';
478 echo '<input type="radio" name="field_' . md5($field) . '[]" value="' . urlencode($enum_atom) . '" id="radio_field_' . $j . '" onclick="if (typeof(document.forms[\'insertForm\'].elements[\'fields_null[' . urlencode($field) . ']\']) != \'undefined\') {document.forms[\'insertForm\'].elements[\'fields_null[' . urlencode($field) .']\'].checked = false}"';
479 if ($data == $enum_atom
480 || ($data == '' && (!isset($primary_key) || $row_table_def['Null'] != 'YES')
481 && isset($row_table_def['Default']) && $enum_atom == $row_table_def['Default'])) {
482 echo ' checked="checked"';
484 echo 'tabindex="' . ($i + 1) . '" />' . "\n";
485 echo ' <label for="radio_field_' . $j . '">' . htmlspecialchars($enum_atom) . '</label>' . "\n";
486 } // end for
488 } // end else
489 echo "\n";
491 </td>
492 <?php
493 echo "\n";
495 else if (strstr($row_table_def['Type'], 'set')) {
496 $set = str_replace('set(', '', $row_table_def['Type']);
497 $set = ereg_replace('\)$', '', $set);
498 $set = explode(',', $set);
500 if (isset($vset)) {
501 unset($vset);
503 for ($vals = explode(',', $data); list($t, $k) = each($vals);) {
504 $vset[$k] = 1;
506 $size = min(4, count($set));
508 <td bgcolor="<?php echo $bgcolor; ?>">
509 <?php echo $backup_field . "\n"; ?>
510 <input type="hidden" name="fields[<?php echo urlencode($field); ?>]" value="$set$" />
511 <select name="field_<?php echo md5($field); ?>[]" size="<?php echo $size; ?>" multiple="multiple" <?php echo $chg_evt_handler; ?>="return unNullify('<?php echo urlencode($field); ?>')" tabindex="<?php echo ($i + 1); ?>" >
512 <?php
513 echo "\n";
514 $countset = count($set);
515 for ($j = 0; $j < $countset;$j++) {
516 $subset = substr($set[$j], 1, -1);
517 // Removes automatic MySQL escape format
518 $subset = str_replace('\'\'', '\'', str_replace('\\\\', '\\', $subset));
519 echo ' ';
520 echo '<option value="'. urlencode($subset) . '"';
521 if (isset($vset[$subset]) && $vset[$subset]) {
522 echo ' selected="selected"';
524 echo '>' . htmlspecialchars($subset) . '</option>' . "\n";
525 } // end for
527 </select>
528 </td>
529 <?php
531 // Change by Bernard M. Piller <bernard@bmpsystems.com>
532 // We don't want binary data destroyed
533 else if ($is_binary || $is_blob) {
534 if (($cfg['ProtectBinary'] && $is_blob)
535 || ($cfg['ProtectBinary'] == 'all' && $is_binary)) {
536 echo "\n";
538 <td align="center" bgcolor="<?php echo $bgcolor; ?>">
539 <?php echo $strBinaryDoNotEdit . "\n"; ?>
540 </td>
541 <?php
542 } else if ($is_blob) {
543 echo "\n";
545 <td bgcolor="<?php echo $bgcolor; ?>">
546 <?php echo $backup_field . "\n"; ?>
547 <textarea name="fields[<?php echo urlencode($field); ?>]" rows="<?php echo $cfg['TextareaRows']; ?>" cols="<?php echo $cfg['TextareaCols']; ?>" wrap="virtual" dir="<?php echo $text_dir; ?>"
548 <?php echo $chg_evt_handler; ?>="return unNullify('<?php echo urlencode($field); ?>')" tabindex="<?php echo ($i + 1); ?>" ><?php echo $special_chars; ?></textarea>
549 </td>
550 <?php
551 } else {
552 if ($len < 4) {
553 $fieldsize = $maxlength = 4;
554 } else {
555 $fieldsize = (($len > 40) ? 40 : $len);
556 $maxlength = $len;
558 echo "\n";
560 <td bgcolor="<?php echo $bgcolor; ?>">
561 <?php echo $backup_field . "\n"; ?>
562 <input type="text" name="fields[<?php echo urlencode($field); ?>]" value="<?php echo $special_chars; ?>" size="<?php echo $fieldsize; ?>" maxlength="<?php echo $maxlength; ?>" class="textfield" <?php echo $chg_evt_handler; ?>="return unNullify('<?php echo urlencode($field); ?>')" tabindex="<?php echo ($i + 1); ?>" />
563 </td>
564 <?php
565 } // end if...elseif...else
566 } // end else if
567 else {
568 // For char or varchar, respect the maximum length (M); for other
569 // types (int or float), the length is not a limit on the values that
570 // can be entered, so let's be generous (20) (we could also use the
571 // real limits for each numeric type)
572 if ($is_char) {
573 $fieldsize = (($len > 40) ? 40 : $len);
574 $maxlength = $len;
576 else {
577 $fieldsize = $maxlength = 20;
578 } // end if... else...
579 echo "\n";
581 <td bgcolor="<?php echo $bgcolor; ?>">
582 <?php echo $backup_field . "\n"; ?>
583 <?php
584 if ($is_char && isset($cfg['CharEditing']) && ($cfg['CharEditing'] == 'textarea')) {
585 echo "\n";
587 <textarea name="fields[<?php echo urlencode($field); ?>]" rows="<?php echo $cfg['CharTextareaRows']; ?>" cols="<?php echo $cfg['CharTextareaCols']; ?>" wrap="virtual" dir="<?php echo $text_dir; ?>"
588 <?php echo $chg_evt_handler; ?>="return unNullify('<?php echo urlencode($field); ?>')" tabindex="<?php echo ($i + 1); ?>" ><?php echo $special_chars; ?></textarea>
589 <?php
590 } else {
591 echo "\n";
593 <input type="text" name="fields[<?php echo urlencode($field); ?>]" value="<?php echo $special_chars; ?>" size="<?php echo $fieldsize; ?>" maxlength="<?php echo $maxlength; ?>" class="textfield" <?php echo $chg_evt_handler; ?>="return unNullify('<?php echo urlencode($field); ?>')" tabindex="<?php echo ($i + 1); ?>" />
594 <?php
596 echo "\n";
598 </td>
599 <?php
601 echo "\n";
603 </tr>
604 <?php
605 echo "\n";
606 } // end for
608 </table>
609 <br />
611 <table cellpadding="5">
612 <tr>
613 <td valign="middle" nowrap="nowrap">
614 <?php
615 if (isset($primary_key)) {
617 <input type="radio" name="submit_type" value="<?php echo $strSave; ?>" id="radio_submit_type_save" checked="checked" tabindex="<?php echo ((3 * $fields_cnt) + 1); ?>" /><label for="radio_submit_type_save"><?php echo $strSave; ?></label><br />
618 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<?php echo $strOr; ?><br />
619 <input type="radio" name="submit_type" value="<?php echo $strInsertAsNewRow; ?>" id="radio_submit_type_insert_as_new_row" tabindex="<?php echo ((3 * $fields_cnt) + 2); ?>" /><label for="radio_submit_type_insert_as_new_row"><?php echo $strInsertAsNewRow; ?></label>
620 <?php
621 } else {
622 echo "\n";
624 <input type="hidden" name="submit_type" value="<?php echo $strInsertAsNewRow; ?>" />
625 <?php
626 echo ' ' . $strInsertAsNewRow . "\n";
628 echo "\n";
630 // Defines whether "insert a new row after the current insert" should be
631 // checked or not (keep this choice sticky)
632 $checked = (!empty($message)) ? ' checked="checked"' : '';
634 </td>
635 <td valign="middle">
636 &nbsp;&nbsp;&nbsp;<b>-- <?php echo $strAnd; ?> --</b>&nbsp;&nbsp;&nbsp;
637 </td>
638 <td valign="middle" nowrap="nowrap">
639 <input type="radio" name="after_insert" value="back" id="radio_after_insert_back" checked="checked" tabindex="<?php echo ((3 * $fields_cnt) + 3); ?>" /><label for="radio_after_insert_back"><?php echo $strAfterInsertBack; ?></label><br />
640 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<?php echo $strOr; ?><br />
641 <input type="radio" name="after_insert" value="new_insert" id="radio_after_insert_new_insert"<?php echo $checked; ?> tabindex="<?php echo ((3 * $fields_cnt) + 4); ?>" /><label for="radio_after_insert_new_insert"><?php echo $strAfterInsertNewInsert; ?></label>
642 </td>
643 </tr>
645 <tr>
646 <td colspan="3" align="center" valign="middle">
647 <input type="submit" value="<?php echo $strGo; ?>" tabindex="<?php echo ((3 * $fields_cnt) + 5); ?>" />
648 </td>
649 </tr>
650 </table>
652 </form>
655 <?php
657 * Displays the footer
659 echo "\n";
660 require('./footer.inc.php3');