3 // vim: expandtab sw=4 ts=4 sts=4:
7 * Get the variables sent or posted to this script and displays the header
9 require_once('./libraries/grab_globals.lib.php');
10 $js_to_run = 'tbl_change.js';
11 require_once('./header.inc.php');
12 require_once('./libraries/relation.lib.php'); // foreign keys
16 * Displays the query submitted and its result
18 if (!empty($disp_message)) {
21 $goto = 'tbl_properties.php?'
22 . PMA_generate_common_url($db, $table)
23 . '&$show_query=1'
24 . '&sql_query=' . (isset($disp_query) ?
urlencode($disp_query) : '');
28 if (isset($sql_query)) {
29 $sql_query_cpy = $sql_query;
32 if (isset($disp_query)) {
33 $sql_query = $disp_query;
35 PMA_showMessage($disp_message);
36 if (isset($goto_cpy)) {
40 if (isset($sql_query_cpy)) {
41 $sql_query = $sql_query_cpy;
42 unset($sql_query_cpy);
48 * Defines the url to return to in case of error in a sql statement
51 $goto = 'db_details.php';
53 if (!preg_match('@^(db_details|tbl_properties|tbl_select)@', $goto)) {
54 $err_url = $goto . "?" . PMA_generate_common_url($db) . "&sql_query=" . urlencode($sql_query);
56 $err_url = $goto . '?'
57 . PMA_generate_common_url($db)
58 . ((preg_match('@^(tbl_properties|tbl_select)@', $goto)) ?
'&table=' . urlencode($table) : '');
63 * Ensures db and table are valid, else moves to the "parent" script
65 require('./libraries/db_table_exists.lib.php');
69 * Sets parameters for links and displays top menu
71 $url_query = PMA_generate_common_url($db, $table)
72 . '&goto=tbl_properties.php';
74 require('./tbl_properties_table_info.php');
79 * Get the list of the fields of the current table
81 PMA_mysql_select_db($db);
82 $table_def = PMA_mysql_query('SHOW FIELDS FROM ' . PMA_backquote($table));
83 if (isset($primary_key)) {
84 if (is_array($primary_key)) {
85 $primary_key_array = $primary_key;
87 $primary_key_array = array(0 => $primary_key);
92 foreach($primary_key_array AS $rowcount => $primary_key) {
93 $local_query = 'SELECT * FROM ' . PMA_backquote($table) . ' WHERE ' . $primary_key;
94 $result[$rowcount] = PMA_mysql_query($local_query) or PMA_mysqlDie('', $local_query, '', $err_url);
95 $row[$rowcount] = PMA_mysql_fetch_array($result[$rowcount]);
96 $primary_keys[$rowcount] = $primary_key;
99 if (!$row[$rowcount]) {
100 unset($row[$rowcount]);
101 unset($primary_key_array[$rowcount]);
103 $goto = 'tbl_properties.php?'
104 . PMA_generate_common_url($db, $table)
105 . '&$show_query=1'
106 . '&sql_query=' . urlencode($local_query);
107 if (isset($sql_query)) {
108 $sql_query_cpy = $sql_query;
111 $sql_query = $local_query;
112 PMA_showMessage($strEmptyResultSet);
115 if (isset($sql_query_cpy)) {
116 $sql_query = $sql_query_cpy;
117 unset($sql_query_cpy);
119 } // end if (no record returned)
122 $local_query = 'SELECT * FROM ' . PMA_backquote($table) . ' LIMIT 1';
123 $result = PMA_mysql_query($local_query) or PMA_mysqlDie('', $local_query, '', $err_url);
128 // retrieve keys into foreign fields, if any
129 $cfgRelation = PMA_getRelationsParam();
130 $foreigners = ($cfgRelation['relwork'] ?
PMA_getForeigners($db, $table) : FALSE);
136 // loic1: autocomplete feature of IE kills the "onchange" event handler and it
137 // must be replaced by the "onpropertychange" one in this case
138 $chg_evt_handler = (PMA_USR_BROWSER_AGENT
== 'IE' && PMA_USR_BROWSER_VER
>= 5)
141 // Had to put the URI because when hosted on an https server,
142 // some browsers send wrongly this form to the http server.
145 <?php
if ($cfg['CtrlArrowsMoving']) { ?
>
146 <!-- Set on key handler
for moving using by Ctrl+arrows
-->
147 <script type
="text/javascript" language
="javascript">
149 document
.onkeydown
= onKeyDownArrowsHandler
;
154 <!-- Change table properties form
-->
155 <form method
="post" action
="tbl_replace.php" name
="insertForm" <?php
if ($is_upload) echo ' enctype="multipart/form-data"'; ?
>>
156 <?php
echo PMA_generate_common_hidden_inputs($db, $table); ?
>
157 <input type
="hidden" name
="goto" value
="<?php echo $goto; ?>" />
158 <input type
="hidden" name
="pos" value
="<?php echo isset($pos) ? $pos : 0; ?>" />
159 <input type
="hidden" name
="session_max_rows" value
="<?php echo isset($session_max_rows) ? $session_max_rows : ''; ?>" />
160 <input type
="hidden" name
="disp_direction" value
="<?php echo isset($disp_direction) ? $disp_direction : ''; ?>" />
161 <input type
="hidden" name
="repeat_cells" value
="<?php echo isset($repeat_cells) ? $repeat_cells : ''; ?>" />
162 <input type
="hidden" name
="dontlimitchars" value
="<?php echo (isset($dontlimitchars) ? $dontlimitchars : 0); ?>" />
163 <input type
="hidden" name
="err_url" value
="<?php echo urlencode($err_url); ?>" />
164 <input type
="hidden" name
="sql_query" value
="<?php echo isset($sql_query) ? urlencode($sql_query) : ''; ?>" />
166 if (isset($primary_key_array)) {
167 foreach($primary_key_array AS $primary_key) {
169 <input type
="hidden" name
="primary_key[]" value
="<?php echo urlencode($primary_key); ?>" />
175 if ($cfg['PropertiesIconic'] == true) {
176 // We need to copy the value or else the == 'both' check will always return true
177 $propicon = (string)$cfg['PropertiesIconic'];
179 if ($propicon == 'both') {
180 $iconic_spacer = '<nobr>';
185 $titles['Browse'] = $iconic_spacer . '<img width="12" height="13" src="images/button_browse.png" alt="' . $strBrowseForeignValues . '" title="' . $strBrowseForeignValues . '" border="0" />';
187 if ($propicon == 'both') {
188 $titles['Browse'] .= ' ' . $strBrowseForeignValues . '</nobr>';
191 $titles['Browse'] = $strBrowseForeignValues;
194 // Set if we passed the first timestamp field
196 $fields_cnt = mysql_num_rows($table_def);
198 // Set a flag here because the 'if' would not be valid in the loop
199 // if we set a value in some field
200 $insert_mode = (!isset($row) ?
TRUE : FALSE);
201 $loop_array = (isset($row) ?
$row : array(0 => FALSE));
203 while ($trow = PMA_mysql_fetch_array($table_def)) {
204 $trow_table_def[] = $trow;
208 foreach($loop_array AS $vrowcount => $vrow) {
209 if ($vrow === FALSE) {
213 $vresult = (isset($result) && is_array($result) && isset($result[$vrowcount]) ?
$result[$vrowcount] : $result);
215 <table border
="<?php echo $cfg['Border']; ?>">
217 <th
><?php
echo $strField; ?
></th
>
218 <th
><?php
echo $strType; ?
></th
>
220 if ($cfg['ShowFunctionFields']) {
221 echo ' <th>' . $strFunction . '</th>' . "\n";
224 <th
><?php
echo $strNull; ?
></th
>
225 <th
><?php
echo $strValue; ?
></th
>
231 $browse_foreigners_uri = '';
233 $vkey = '[multi_edit][' . urlencode($primary_keys[$vrowcount]) . ']';
234 $browse_foreigners_uri = '&pk=' . urlencode($primary_keys[$vrowcount]);
237 // garvin: For looping on multiple rows, we need to reset any variable used inside the loop to indicate sth.
239 unset($first_timestamp);
241 // Sets a multiplier used for input-field counts (as zero cannot be used, advance the counter plus one)
242 $m_rows = $o_rows +
1;
244 for ($i = 0; $i < $fields_cnt; $i++
) {
245 // Display the submit button after every 15 lines --swix
246 // (wanted to use an <a href="#bottom"> and <a name> instead,
247 // but it didn't worked because of the <base href>)
249 if ((($i %
15) == 0) && ($i != 0)) {
252 <th colspan
="5" align
="right">
253 <input type
="submit" value
="<?php echo $strGo; ?>" /> 
;
260 $row_table_def = $trow_table_def[$i];
261 $row_table_def['True_Type'] = preg_replace('@\(.*@s', '', $row_table_def['Type']);
263 $field = $row_table_def['Field'];
265 // garvin: possible workaround. If current field is numerical, do not try to
266 // access the result-array with its 'associative' key but with its numerical
268 if (is_numeric($field)) {
276 // loic1: current date should not be set as default if the field is NULL
277 // for the current row
278 // lem9: but do not put here the current datetime if there is a default
279 // value (the real default value will be set in the
280 // Default value logic below)
281 if ($row_table_def['Type'] == 'datetime'
282 && (!isset($row_table_def['Default']))) {
286 $vrow[$rowfield] = date('Y-m-d H:i:s', time());
288 $vrow = array($rowfield => date('Y-m-d H:i:s', time()));
291 // UPDATE case with an empty and not NULL value under PHP4
292 else if (empty($vrow[$rowfield]) && is_null($vrow[$rowfield])) {
293 $vrow[$rowfield] = date('Y-m-d H:i:s', time());
294 } // end if... else if...
296 $len = (preg_match('@float|double@', $row_table_def['Type']))
298 : @mysql_field_len
($vresult, $i);
299 $first_timestamp = 0;
301 $bgcolor = ($i %
2) ?
$cfg['BgcolorOne'] : $cfg['BgcolorTwo'];
304 <td
<?php
echo ($cfg['LongtextDoubleTextarea'] && strstr($row_table_def['True_Type'], 'longtext') ?
'rowspan="2"' : ''); ?
> align
="center" bgcolor
="<?php echo $bgcolor; ?>"><?php
echo htmlspecialchars($field); ?
></td
>
309 $is_binary = stristr($row_table_def['Type'], ' binary');
310 $is_blob = stristr($row_table_def['Type'], 'blob');
311 $is_char = stristr($row_table_def['Type'], 'char');
312 switch ($row_table_def['True_Type']) {
322 if (!$timestamp_seen) { // can only occur once per table
324 $first_timestamp = 1;
326 $type = $row_table_def['Type'];
327 $type_nowrap = ' nowrap="nowrap"';
331 $type = $row_table_def['Type'];
332 $type_nowrap = ' nowrap="nowrap"';
336 <td align
="center" bgcolor
="<?php echo $bgcolor; ?>"<?php
echo $type_nowrap; ?
>>
342 // Prepares the field value
343 $real_null_value = FALSE;
345 if (!isset($vrow[$rowfield])
346 ||
(function_exists('is_null') && is_null($vrow[$rowfield]))) {
347 $real_null_value = TRUE;
348 $vrow[$rowfield] = '';
350 $data = $vrow[$rowfield];
352 // loic1: special binary "characters"
353 if ($is_binary ||
$is_blob) {
354 $vrow[$rowfield] = str_replace("\x00", '\0', $vrow[$rowfield]);
355 $vrow[$rowfield] = str_replace("\x08", '\b', $vrow[$rowfield]);
356 $vrow[$rowfield] = str_replace("\x0a", '\n', $vrow[$rowfield]);
357 $vrow[$rowfield] = str_replace("\x0d", '\r', $vrow[$rowfield]);
358 $vrow[$rowfield] = str_replace("\x1a", '\Z', $vrow[$rowfield]);
360 $special_chars = htmlspecialchars($vrow[$rowfield]);
361 $data = $vrow[$rowfield];
362 } // end if... else...
363 // loic1: if a timestamp field value is not included in an update
364 // statement MySQL auto-update it to the current timestamp
365 $backup_field = ($row_table_def['True_Type'] == 'timestamp')
367 : '<input type="hidden" name="fields_prev' . $vkey . '[' . urlencode($field) . ']" value="' . urlencode($vrow[$rowfield]) . '" />';
369 // loic1: display default values
370 if (!isset($row_table_def['Default'])) {
371 $row_table_def['Default'] = '';
372 $real_null_value = TRUE;
376 $data = $row_table_def['Default'];
378 $special_chars = htmlspecialchars($row_table_def['Default']);
382 // The function column
383 // -------------------
384 // Change by Bernard M. Piller <bernard@bmpsystems.com>
385 // We don't want binary data to be destroyed
386 // Note: from the MySQL manual: "BINARY doesn't affect how the column is
387 // stored or retrieved" so it does not mean that the contents is
389 if ($cfg['ShowFunctionFields']) {
390 if (($cfg['ProtectBinary'] && $is_blob)
391 ||
($cfg['ProtectBinary'] == 'all' && $is_binary)) {
392 echo ' <td align="center" bgcolor="'. $bgcolor . '">' . $strBinary . '</td>' . "\n";
393 } else if (strstr($row_table_def['True_Type'], 'enum') ||
strstr($row_table_def['True_Type'], 'set')) {
394 echo ' <td align="center" bgcolor="'. $bgcolor . '">--</td>' . "\n";
397 <td bgcolor
="<?php echo $bgcolor; ?>">
398 <select name
="funcs<?php echo $vkey; ?>[<?php echo urlencode($field); ?>]" <?php
echo $chg_evt_handler; ?
>="return unNullify('<?php echo urlencode($field); ?>', '<?php echo $vkey; ?>')" tabindex
="<?php echo ($fields_cnt + ($i * $m_rows) + 1); ?>" id
="field_<?php echo $i * $m_rows; ?>_1">
404 // garvin: Find the current type in the RestrictColumnTypes. Will result in 'FUNC_CHAR'
405 // or something similar. Then directly look up the entry in the RestrictFunctions array,
406 // which will then reveal the available dropdown options
407 if (isset($cfg['RestrictFunctions']) && isset($cfg['RestrictColumnTypes']) && isset($cfg['RestrictColumnTypes'][strtoupper($row_table_def['True_Type'])]) && isset($cfg['RestrictFunctions'][$cfg['RestrictColumnTypes'][strtoupper($row_table_def['True_Type'])]])) {
408 $current_func_type = $cfg['RestrictColumnTypes'][strtoupper($row_table_def['True_Type'])];
409 $dropdown = $cfg['RestrictFunctions'][$current_func_type];
410 $default_function = $cfg['DefaultFunctions'][$current_func_type];
415 $dropdown_built = array();
416 $op_spacing_needed = FALSE;
418 // garvin: loop on the dropdown array and print all available options for that field.
419 $cnt_dropdown = count($dropdown);
420 for ($j = 0; $j < $cnt_dropdown; $j++
) {
421 // Is current function defined as default?
422 $selected = ($first_timestamp && $dropdown[$j] == $cfg['DefaultFunctions']['first_timestamp'])
423 ||
(!$first_timestamp && $dropdown[$j] == $default_function)
424 ?
' selected="selected"'
427 echo '<option' . $selected . '>' . $dropdown[$j] . '</option>' . "\n";
428 $dropdown_built[$dropdown[$j]] = 'TRUE';
429 $op_spacing_needed = TRUE;
432 // garvin: For compatibility's sake, do not let out all other functions. Instead
433 // print a seperator (blank) and then show ALL functions which weren't shown
435 $cnt_functions = count($cfg['Functions']);
436 for ($j = 0; $j < $cnt_functions; $j++
) {
437 if (!isset($dropdown_built[$cfg['Functions'][$j]]) ||
$dropdown_built[$cfg['Functions'][$j]] != 'TRUE') {
438 // Is current function defined as default?
439 $selected = ($first_timestamp && $cfg['Functions'][$j] == $cfg['DefaultFunctions']['first_timestamp'])
440 ||
(!$first_timestamp && $cfg['Functions'][$j] == $default_function)
441 ?
' selected="selected"'
443 if ($op_spacing_needed == TRUE) {
445 echo '<option value="">--------</option>' . "\n";
446 $op_spacing_needed = FALSE;
450 echo '<option' . $selected . '>' . $cfg['Functions'][$j] . '</option>' . "\n";
459 } // end if ($cfg['ShowFunctionFields'])
464 echo ' <td bgcolor="' . $bgcolor . '">' . "\n";
465 if (!(($cfg['ProtectBinary'] && $is_blob) ||
($cfg['ProtectBinary'] == 'all' && $is_binary))
466 && $row_table_def['Null'] == 'YES') {
467 echo ' <input type="checkbox" tabindex="' . ((2 * $fields_cnt) +
($i * $m_rows) +
1) . '"'
468 . ' name="fields_null' . $vkey . '[' . urlencode($field) . ']"';
469 //if ($data == 'NULL' && !$first_timestamp) {
470 if ($real_null_value && !$first_timestamp) {
471 echo ' checked="checked"';
473 echo ' id="field_' . ($i * $m_rows) . '_2"';
474 $onclick = ' onclick="if (this.checked) {nullify(';
475 if (strstr($row_table_def['True_Type'], 'enum')) {
476 if (strlen($row_table_def['Type']) > 20) {
481 } else if (strstr($row_table_def['True_Type'], 'set')) {
483 } else if ($foreigners && isset($foreigners[$field])) {
488 $onclick .= '\'' . urlencode($field) . '\', \'' . md5($field) . '\', \'' . $vkey . '\'); this.checked = true}; return true" />' . "\n";
491 echo ' ' . "\n";
493 echo ' </td>' . "\n";
495 // The value column (depends on type)
498 require('./libraries/get_foreign.lib.php');
500 if (isset($foreign_link) && $foreign_link == true) {
502 <td bgcolor
="<?php echo $bgcolor; ?>">
503 <?php
echo $backup_field . "\n"; ?
>
504 <input type
="hidden" name
="fields_type<?php echo $vkey; ?>[<?php echo urlencode($field); ?>]" value
="foreign" />
505 <input type
="hidden" name
="fields<?php echo $vkey; ?>[<?php echo urlencode($field); ?>]" value
="" id
="field_<?php echo ($i * $m_rows); ?>_1" />
506 <input type
="text" name
="field_<?php echo md5($field); ?><?php echo $vkey; ?>[]" class="textfield" <?php
echo $chg_evt_handler; ?
>="return unNullify('<?php echo urlencode($field); ?>', '<?php echo $vkey; ?>')" tabindex
="<?php echo (($i * $m_rows) + 1); ?>" id
="field_<?php echo ($i * $mrows); ?>_3" value
="<?php echo htmlspecialchars($data); ?>" />
507 <script type
="text/javascript" language
="javascript">
508 document
.writeln('<a target="_blank" onclick="window.open(this.href, \'foreigners\', \'width=640,height=240,scrollbars=yes\'); return false" href="browse_foreigners.php?<?php echo PMA_generate_common_url($db, $table); ?>&field=<?php echo urlencode($field) . $browse_foreigners_uri; ?>"><?php echo str_replace("'", "\'
", $titles['Browse']); ?></a>');
512 } else if (isset($disp) && $disp) {
514 <td bgcolor="<?php
echo $bgcolor; ?
>">
515 <?php echo $backup_field . "\n
"; ?>
516 <input type="hidden
" name="fields_type
<?php
echo $vkey; ?
>[<?php
echo urlencode($field); ?
>]" value="foreign
" />
517 <input type="hidden
" name="fields
<?php
echo $vkey; ?
>[<?php
echo urlencode($field); ?
>]" value="" id="field_
<?php
echo $i; ?
>_1
" />
518 <select name="field_
<?php
echo md5($field); ?
><?php
echo $vkey; ?
>[]" <?php echo $chg_evt_handler; ?>="return unNullify('<?php echo urlencode($field); ?>', '<?php echo $vkey; ?>')" tabindex="<?php
echo (($i * $m_rows) +
1); ?
>" id="field_
<?php
echo ($i * $m_rows); ?
>_3
">
519 <?php echo PMA_foreignDropdown($disp, $foreign_field, $foreign_display, $data, 100); ?>
525 else if ($cfg['LongtextDoubleTextarea'] && strstr($type, 'longtext')) {
527 <td bgcolor="<?php
echo $bgcolor; ?
>"> </td>
530 <td colspan="4" align="right
" bgcolor="<?php
echo $bgcolor; ?
>">
531 <?php echo $backup_field . "\n
"; ?>
532 <textarea name="fields
<?php
echo $vkey; ?
>[<?php
echo urlencode($field); ?
>]" rows="<?php
echo ($cfg['TextareaRows']*2); ?
>" cols="<?php
echo ($cfg['TextareaCols']*2); ?
>" wrap="virtual
" dir="<?php
echo $text_dir; ?
>" id="field_
<?php
echo ($i * $m_rows); ?
>_3
"
533 <?php echo $chg_evt_handler; ?>="return unNullify('<?php echo urlencode($field); ?>', '<?php echo $vkey; ?>')" tabindex="<?php
echo (($i * $m_rows) +
1); ?
>"><?php echo $special_chars; ?></textarea>
537 else if (strstr($type, 'text')) {
539 <td bgcolor="<?php
echo $bgcolor; ?
>">
540 <?php echo $backup_field . "\n
"; ?>
541 <textarea name="fields
<?php
echo $vkey; ?
>[<?php
echo urlencode($field); ?
>]" rows="<?php
echo $cfg['TextareaRows']; ?
>" cols="<?php
echo $cfg['TextareaCols']; ?
>" wrap="virtual
" dir="<?php
echo $text_dir; ?
>" id="field_
<?php
echo ($i * $m_rows); ?
>_3
"
542 <?php echo $chg_evt_handler; ?>="return unNullify('<?php echo urlencode($field); ?>', '<?php echo $vkey; ?>')" tabindex="<?php
echo (($i * $m_rows) +
1); ?
>"><?php echo $special_chars; ?></textarea>
546 if (strlen($special_chars) > 32000) {
547 echo ' <td bgcolor="' . $bgcolor . '">' . $strTextAreaLength . '</td>' . "\n
";
550 else if ($type == 'enum') {
551 $enum = PMA_getEnumSetOptions($row_table_def['Type']);
552 $enum_cnt = count($enum);
554 <td bgcolor="<?php
echo $bgcolor; ?
>">
555 <input type="hidden
" name="fields_type
<?php
echo $vkey; ?
>[<?php
echo urlencode($field); ?
>]" value="enum
" />
556 <input type="hidden
" name="fields
<?php
echo $vkey; ?
>[<?php
echo urlencode($field); ?
>]" value="" />
558 echo "\n
" . ' ' . $backup_field;
560 // show dropdown or radio depend on length
561 if (strlen($row_table_def['Type']) > 20) {
564 <select name="field_
<?php
echo md5($field); ?
><?php
echo $vkey; ?
>[]" <?php echo $chg_evt_handler; ?>="return unNullify('<?php echo urlencode($field); ?>', '<?php echo $vkey; ?>')" tabindex="<?php
echo (($i * $m_rows) +
1); ?
>" id="field_
<?php
echo ($i * $m_rows); ?
>_3
">
565 <option value=""></option>
569 for ($j = 0; $j < $enum_cnt; $j++) {
570 // Removes automatic MySQL escape format
571 $enum_atom = str_replace('\'\'', '\'', str_replace('\\\\', '\\', $enum[$j]));
573 echo '<option value="' . htmlspecialchars($enum_atom) . '"';
574 if ($data == $enum_atom
575 || ($data == '' && (!isset($primary_key) || $row_table_def['Null'] != 'YES')
576 && isset($row_table_def['Default']) && $enum_atom == $row_table_def['Default'])) {
577 echo ' selected="selected
"';
579 echo '>' . htmlspecialchars($enum_atom) . '</option>' . "\n
";
588 for ($j = 0; $j < $enum_cnt; $j++) {
589 // Removes automatic MySQL escape format
590 $enum_atom = str_replace('\'\'', '\'', str_replace('\\\\', '\\', $enum[$j]));
592 echo '<input type="radio
" name="field_
' . md5($field) . $vkey . '[]" value="' . urlencode($enum_atom) . '" id="field_
' . ($i*$m_rows) . '_3_
' . $j . '" onclick="if (typeof(document
.forms
[\'insertForm\'
].elements
[\'fields_null
' . str_replace('"', '\"', $vkey) . '[' . urlencode($field) . ']\']) != \'undefined\') {document.forms[\'insertForm\'].elements[\'fields_null' . str_replace('"', '\"
', $vkey) . '[' . urlencode($field) .']\'].checked
= false}"';
593 if ($data == $enum_atom
594 || ($data == '' && (!isset($primary_key) || $row_table_def['Null'] != 'YES')
595 && isset($row_table_def['Default']) && $enum_atom == $row_table_def['Default'])) {
596 echo ' checked="checked
"';
598 echo 'tabindex="' . (($i * $m_rows) + 1) . '" />' . "\n
";
599 echo ' <label for="field_
' . ($i * $m_rows) . '_3_
' . $j . '">' . htmlspecialchars($enum_atom) . '</label>' . "\n
";
609 else if ($type == 'set') {
610 $set = PMA_getEnumSetOptions($row_table_def['Type']);
615 for ($vals = explode(',', $data); list($t, $k) = each($vals);) {
618 $countset = count($set);
619 $size = min(4, $countset);
621 <td bgcolor="<?php
echo $bgcolor; ?
>">
622 <?php echo $backup_field . "\n
"; ?>
623 <input type="hidden
" name="fields_type
<?php
echo $vkey; ?
>[<?php
echo urlencode($field); ?
>]" value="set
" />
624 <input type="hidden
" name="fields
<?php
echo $vkey; ?
>[<?php
echo urlencode($field); ?
>]" value="" />
625 <select name="field_
<?php
echo md5($field); ?
><?php
echo $vkey; ?
>[]" size="<?php
echo $size; ?
>" multiple="multiple
" <?php echo $chg_evt_handler; ?>="return unNullify('<?php echo urlencode($field); ?>', '<?php echo $vkey; ?>')" tabindex="<?php
echo (($i * $m_rows) +
1); ?
>" id="field_
<?php
echo ($i * $m_rows); ?
>_3
">
628 for ($j = 0; $j < $countset; $j++) {
630 echo '<option value="'. htmlspecialchars($set[$j]) . '"';
631 if (isset($vset[$set[$j]]) && $vset[$set[$j]]) {
632 echo ' selected="selected
"';
634 echo '>' . htmlspecialchars($set[$j]) . '</option>' . "\n
";
641 // Change by Bernard M. Piller <bernard@bmpsystems.com>
642 // We don't want binary data destroyed
643 else if ($is_binary || $is_blob) {
644 if (($cfg['ProtectBinary'] && $is_blob)
645 || ($cfg['ProtectBinary'] == 'all' && $is_binary)) {
648 <td align="center
" bgcolor="<?php
echo $bgcolor; ?
>">
650 echo $strBinaryDoNotEdit;
652 $data_size = PMA_formatByteDown(strlen(stripslashes($data)), 3, 1);
653 echo ' ('. $data_size [0] . ' ' . $data_size[1] . ')';
658 <input type="hidden
" name="fields_type
<?php
echo $vkey; ?
>[<?php
echo urlencode($field); ?
>]" value="protected" />
659 <input type="hidden
" name="fields
<?php
echo $vkey; ?
>[<?php
echo urlencode($field); ?
>]" value="" />
661 } else if ($is_blob) {
664 <td bgcolor="<?php
echo $bgcolor; ?
>">
665 <?php echo $backup_field . "\n
"; ?>
666 <textarea name="fields
<?php
echo $vkey; ?
>[<?php
echo urlencode($field); ?
>]" rows="<?php
echo $cfg['TextareaRows']; ?
>" cols="<?php
echo $cfg['TextareaCols']; ?
>" wrap="virtual
" dir="<?php
echo $text_dir; ?
>" id="field_
<?php
echo ($i*$m_rows); ?
>_3
"
667 <?php echo $chg_evt_handler; ?>="return unNullify('<?php echo urlencode($field); ?>', '<?php echo $vkey; ?>')" tabindex="<?php
echo (($i * $m_rows) +
1); ?
>" ><?php echo $special_chars; ?></textarea>
672 $fieldsize = $maxlength = 4;
674 $fieldsize = (($len > 40) ? 40 : $len);
679 <td bgcolor="<?php
echo $bgcolor; ?
>">
680 <?php echo $backup_field . "\n
"; ?>
681 <input type="text
" name="fields
<?php
echo $vkey; ?
>[<?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); ?>', '<?php echo $vkey; ?>')" tabindex="<?php
echo (($i * $m_rows) +
1); ?
>" id="field_
<?php
echo ($i * $m_rows); ?
>_3
" />
683 } // end if...elseif...else
685 // Upload choice (only for BLOBs because the binary
686 // attribute does not imply binary contents)
687 // (displayed whatever value the ProtectBinary has)
689 if ($is_upload && $is_blob) {
690 echo '<input type="file
" name="fields_upload_
' . urlencode($field) . $vkey . '" class="textfield
" id="field_
' . ($i * $m_rows) . '_3
" />';
693 if (!empty($cfg['UploadDir'])) {
694 if (substr($cfg['UploadDir'], -1) != '/') {
695 $cfg['UploadDir'] .= '/';
697 if ($handle = @opendir($cfg['UploadDir'])) {
699 while ($file = @readdir($handle)) {
700 if (is_file($cfg['UploadDir'] . $file) && !PMA_checkFileExtensions($file, '.sql')) {
701 if ($is_first == 0) {
703 echo ' <i>' . $strOr . '</i>' . ' ' . $strWebServerUploadDirectory . ' :<br />' . "\n
";
704 echo ' <select size="1" name="fields_uploadlocal_
' . urlencode($field) . $vkey . '">' . "\n
";
705 echo ' <option value="" selected="selected
"></option>' . "\n
";
706 } // end if (is_first)
707 echo ' <option value="' . htmlspecialchars($file) . '">' . htmlspecialchars($file) . '</option>' . "\n
";
709 } // end if (is_file)
712 echo ' </select>' . "\n
";
713 } // end if (isfirst > 0)
716 echo ' <font color="red
">' . $strError . '</font><br />' . "\n
";
717 echo ' ' . $strWebServerUploadDirectoryError . "\n
";
719 } // end if (web-server upload directory)
723 } // end else if ( binary or blob)
725 // For char or varchar, respect the maximum length (M); for other
726 // types (int or float), the length is not a limit on the values that
727 // can be entered, so let's be generous (20) (we could also use the
728 // real limits for each numeric type)
730 $fieldsize = (($len > 40) ? 40 : $len);
734 $fieldsize = $maxlength = 20;
735 } // end if... else...
738 <td bgcolor="<?php
echo $bgcolor; ?
>">
739 <?php echo $backup_field . "\n
"; ?>
741 if ($is_char && isset($cfg['CharEditing']) && ($cfg['CharEditing'] == 'textarea')) {
744 <textarea name="fields
<?php
echo $vkey; ?
>[<?php
echo urlencode($field); ?
>]" rows="<?php
echo $cfg['CharTextareaRows']; ?
>" cols="<?php
echo $cfg['CharTextareaCols']; ?
>" wrap="virtual
" dir="<?php
echo $text_dir; ?
>" id="field_
<?php
echo ($i * $m_rows); ?
>_3
"
745 <?php echo $chg_evt_handler; ?>="return unNullify('<?php echo urlencode($field); ?>', '<?php echo $vkey; ?>')" tabindex="<?php
echo (($i * $m_rows) +
1); ?
>" ><?php echo $special_chars; ?></textarea>
750 <input type="text
" name="fields
<?php
echo $vkey; ?
>[<?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); ?>', '<?php echo $vkey; ?>')" tabindex="<?php
echo (($i * $m_rows) +
1); ?
>" id="field_
<?php
echo ($i * $m_rows); ?
>_3
" />
765 echo ' </table><br />';
766 } // end foreach on multi-edit
770 <table cellpadding="5">
772 <td valign="middle
" nowrap="nowrap
">
774 if (isset($primary_key)) {
776 <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 />
777 <?php echo $strOr; ?><br />
778 <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>
783 <input type="hidden
" name="submit_type
" value="<?php
echo $strInsertAsNewRow; ?
>" />
785 echo ' ' . $strInsertAsNewRow . "\n
";
789 // Defines whether "insert a
new row after the current insert
" should be
790 // checked or not (keep this choice sticky)
791 // but do not check both radios, because Netscape 4.8 would display both checked
792 if (!empty($disp_message)) {
793 $checked_after_insert_new_insert = ' checked="checked
"';
794 $checked_after_insert_back = '';
796 $checked_after_insert_back = ' checked="checked
"';
797 $checked_after_insert_new_insert = '';
802 <b>-- <?php echo $strAnd; ?> --</b>
804 <td valign="middle
" nowrap="nowrap
">
805 <input type="radio
" name="after_insert
" value="back
" id="radio_after_insert_back
" <?php echo $checked_after_insert_back; ?> tabindex="<?php
echo ((3 * $fields_cnt) +
3); ?
>" /><label for="radio_after_insert_back
"><?php echo $strAfterInsertBack; ?></label><br />
806 <?php echo $strOr; ?><br />
807 <input type="radio
" name="after_insert
" value="new_insert
" id="radio_after_insert_new_insert
"<?php echo $checked_after_insert_new_insert; ?> tabindex="<?php
echo ((3 * $fields_cnt) +
4); ?
>" /><label for="radio_after_insert_new_insert
"><?php echo $strAfterInsertNewInsert; ?></label>
812 <td colspan="3" align="right
" valign="middle
">
813 <input type="submit
" value="<?php
echo $strGo; ?
>" tabindex="<?php
echo ((3 * $fields_cnt) +
5); ?
>" />
814 <input type="reset
" value="<?php
echo $strReset; ?
>" tabindex="<?php
echo ((3 * $fields_cnt) +
6); ?
>" />
824 * Displays the footer
827 require_once('./footer.inc.php');