00001 <?php
00002
00003
00004 error_reporting(E_ALL);
00005
00009 require_once('./libraries/grab_globals.lib.php');
00010 $js_to_run = 'tbl_change.js';
00011 require_once('./header.inc.php');
00012 require_once('./libraries/relation.lib.php');
00013
00014
00018 if (!empty($disp_message)) {
00019 if (isset($goto)) {
00020 $goto_cpy = $goto;
00021 $goto = 'tbl_properties.php?'
00022 . PMA_generate_common_url($db, $table)
00023 . '&$show_query=1'
00024 . '&sql_query=' . (isset($disp_query) ? urlencode($disp_query) : '');
00025 } else {
00026 $show_query = '1';
00027 }
00028 if (isset($sql_query)) {
00029 $sql_query_cpy = $sql_query;
00030 unset($sql_query);
00031 }
00032 if (isset($disp_query)) {
00033 $sql_query = $disp_query;
00034 }
00035 PMA_showMessage($disp_message);
00036 if (isset($goto_cpy)) {
00037 $goto = $goto_cpy;
00038 unset($goto_cpy);
00039 }
00040 if (isset($sql_query_cpy)) {
00041 $sql_query = $sql_query_cpy;
00042 unset($sql_query_cpy);
00043 }
00044 }
00045
00046
00050 if (!isset($goto)) {
00051 $goto = 'db_details.php';
00052 }
00053 if (!preg_match('@^(db_details|tbl_properties|tbl_select|ldi_table)@', $goto)) {
00054 $err_url = $goto . "?" . PMA_generate_common_url($db) . "&sql_query=" . urlencode($sql_query);
00055 } else {
00056 $err_url = $goto . '?'
00057 . PMA_generate_common_url($db)
00058 . ((preg_match('@^(tbl_properties|tbl_select)@', $goto)) ? '&table=' . urlencode($table) : '');
00059 }
00060
00061
00065 require('./libraries/db_table_exists.lib.php');
00066
00067
00071 $url_query = PMA_generate_common_url($db, $table)
00072 . '&goto=tbl_properties.php';
00073
00074 require('./tbl_properties_table_info.php');
00075
00079 require('./tbl_properties_links.php');
00080
00084 PMA_DBI_select_db($db);
00085 $table_def = PMA_DBI_query('SHOW FIELDS FROM ' . PMA_backquote($table) . ';', NULL, PMA_DBI_QUERY_STORE);
00086 if (isset($primary_key)) {
00087 if (is_array($primary_key)) {
00088 $primary_key_array = $primary_key;
00089 } else {
00090 $primary_key_array = array(0 => $primary_key);
00091 }
00092
00093 $row = array();
00094 $result = array();
00095 foreach ($primary_key_array AS $rowcount => $primary_key) {
00096 $local_query = 'SELECT * FROM ' . PMA_backquote($table) . ' WHERE ' . $primary_key . ';';
00097 $result[$rowcount] = PMA_DBI_query($local_query, NULL, PMA_DBI_QUERY_STORE);
00098 $row[$rowcount] = PMA_DBI_fetch_assoc($result[$rowcount]);
00099 $primary_keys[$rowcount] = $primary_key;
00100
00101
00102 if (!$row[$rowcount]) {
00103 unset($row[$rowcount]);
00104 unset($primary_key_array[$rowcount]);
00105 $goto_cpy = $goto;
00106 $goto = 'tbl_properties.php?'
00107 . PMA_generate_common_url($db, $table)
00108 . '&$show_query=1'
00109 . '&sql_query=' . urlencode($local_query);
00110 if (isset($sql_query)) {
00111 $sql_query_cpy = $sql_query;
00112 unset($sql_query);
00113 }
00114 $sql_query = $local_query;
00115 PMA_showMessage($strEmptyResultSet);
00116 $goto = $goto_cpy;
00117 unset($goto_cpy);
00118 if (isset($sql_query_cpy)) {
00119 $sql_query = $sql_query_cpy;
00120 unset($sql_query_cpy);
00121 }
00122 echo "\n";
00123 require_once('./footer.inc.php');
00124 }
00125 }
00126 } else {
00127 $result = PMA_DBI_query('SELECT * FROM ' . PMA_backquote($table) . ' LIMIT 1;', NULL, PMA_DBI_QUERY_STORE);
00128 unset($row);
00129 }
00130
00131
00132
00133 $cfgRelation = PMA_getRelationsParam();
00134 $foreigners = ($cfgRelation['relwork'] ? PMA_getForeigners($db, $table) : FALSE);
00135
00136
00140
00141
00142 $chg_evt_handler = (PMA_USR_BROWSER_AGENT == 'IE' && PMA_USR_BROWSER_VER >= 5)
00143 ? 'onpropertychange'
00144 : 'onchange';
00145
00146
00147 ?>
00148
00149 <?php if ($cfg['CtrlArrowsMoving']) { ?>
00150 <!-- Set on key handler for moving using by Ctrl+arrows -->
00151 <script src="libraries/keyhandler.js" type="text/javascript" language="javascript"></script>
00152 <script type="text/javascript" language="javascript">
00153 <!--
00154 var switch_movement = 0;
00155 document.onkeydown = onKeyDownArrowsHandler;
00156
00157 </script>
00158 <?php } ?>
00159
00160 <!-- Change table properties form -->
00161 <form method="post" action="tbl_replace.php" name="insertForm" <?php if ($is_upload) echo ' enctype="multipart/form-data"'; ?>>
00162 <?php echo PMA_generate_common_hidden_inputs($db, $table); ?>
00163 <input type="hidden" name="goto" value="<?php echo $goto; ?>" />
00164 <input type="hidden" name="pos" value="<?php echo isset($pos) ? $pos : 0; ?>" />
00165 <input type="hidden" name="session_max_rows" value="<?php echo isset($session_max_rows) ? $session_max_rows : ''; ?>" />
00166 <input type="hidden" name="disp_direction" value="<?php echo isset($disp_direction) ? $disp_direction : ''; ?>" />
00167 <input type="hidden" name="repeat_cells" value="<?php echo isset($repeat_cells) ? $repeat_cells : ''; ?>" />
00168 <input type="hidden" name="dontlimitchars" value="<?php echo (isset($dontlimitchars) ? $dontlimitchars : 0); ?>" />
00169 <input type="hidden" name="err_url" value="<?php echo urlencode($err_url); ?>" />
00170 <input type="hidden" name="sql_query" value="<?php echo isset($sql_query) ? urlencode($sql_query) : ''; ?>" />
00171 <?php
00172 if (isset($primary_key_array)) {
00173 foreach ($primary_key_array AS $primary_key) {
00174 ?>
00175 <input type="hidden" name="primary_key[]" value="<?php echo urlencode($primary_key); ?>" />
00176 <?php
00177 }
00178 }
00179 echo "\n";
00180
00181 if ($cfg['PropertiesIconic'] == true) {
00182
00183 $propicon = (string)$cfg['PropertiesIconic'];
00184
00185 if ($propicon == 'both') {
00186 $iconic_spacer = '<div class="nowrap">';
00187 } else {
00188 $iconic_spacer = '';
00189 }
00190
00191 $titles['Browse'] = $iconic_spacer . '<img width="16" height="16" src="' . $pmaThemeImage . 'b_browse.png" alt="' . $strBrowseForeignValues . '" title="' . $strBrowseForeignValues . '" border="0" />';
00192
00193 if ($propicon == 'both') {
00194 $titles['Browse'] .= ' ' . $strBrowseForeignValues . '</div>';
00195 }
00196 } else {
00197 $titles['Browse'] = $strBrowseForeignValues;
00198 }
00199
00200
00201 $timestamp_seen = 0;
00202 $fields_cnt = PMA_DBI_num_rows($table_def);
00203
00204
00205
00206 $insert_mode = (!isset($row) ? TRUE : FALSE);
00207 if ($insert_mode) {
00208 $loop_array = array();
00209 for ($i = 0; $i < $cfg['InsertRows']; $i++) $loop_array[] = FALSE;
00210 } else {
00211 $loop_array = $row;
00212 }
00213
00214 while ($trow = PMA_DBI_fetch_assoc($table_def)) {
00215 $trow_table_def[] = $trow;
00216 }
00217
00218 $tabindex = 0;
00219 $tabindex_for_function = +1000;
00220 $tabindex_for_null = +2000;
00221 $tabindex_for_value = 0;
00222 $o_rows = 0;
00223 foreach ($loop_array AS $vrowcount => $vrow) {
00224 if ($vrow === FALSE) {
00225 unset($vrow);
00226 }
00227
00228 if ($insert_mode) {
00229 $jsvkey = $vrowcount;
00230 $browse_foreigners_uri = '&pk=' . $vrowcount;
00231 } else {
00232 $jsvkey = urlencode($primary_keys[$vrowcount]);
00233 $browse_foreigners_uri = '&pk=' . urlencode($primary_keys[$vrowcount]);
00234 }
00235 $vkey = '[multi_edit][' . $jsvkey . ']';
00236
00237 $vresult = (isset($result) && is_array($result) && isset($result[$vrowcount]) ? $result[$vrowcount] : $result);
00238 if ($insert_mode && $vrowcount > 0) {
00239 echo '<input type="checkbox" checked="checked" name="insert_ignore_' . $vrowcount . '" id="insert_ignore_check_' . $vrowcount . '">';
00240 echo '<label for="insert_ignore_check_' . $vrowcount . '">' . $strIgnore . '</label><br />' . "\n";
00241 }
00242 ?>
00243 <table border="<?php echo $cfg['Border']; ?>" cellpadding="2" cellspacing="1">
00244 <tr>
00245 <th><?php echo $strField; ?></th>
00246 <th><?php echo $strType; ?></th>
00247 <?php
00248 if ($cfg['ShowFunctionFields']) {
00249 echo ' <th>' . $strFunction . '</th>' . "\n";
00250 }
00251 ?>
00252 <th><?php echo $strNull; ?></th>
00253 <th><?php echo $strValue; ?></th>
00254 </tr>
00255 <?php
00256
00257
00258 $timestamp_seen = 0;
00259 unset($first_timestamp);
00260
00261
00262 $m_rows = $o_rows + 1;
00263
00264 for ($i = 0; $i < $fields_cnt; $i++) {
00265
00266
00267
00268
00269 if ((($o_rows * $fields_cnt + $i) % 15 == 0) && ($i + $o_rows != 0)) {
00270 ?>
00271 <tr>
00272 <th colspan="5" align="right" class="tblFooters">
00273 <input type="submit" value="<?php echo $strGo; ?>" />
00274 </th>
00275 </tr>
00276 <?php
00277 }
00278 echo "\n";
00279
00280 $row_table_def = $trow_table_def[$i];
00281 $row_table_def['True_Type'] = preg_replace('@\(.*@s', '', $row_table_def['Type']);
00282
00283 $field = $row_table_def['Field'];
00284
00285
00286
00287 $rowfield = $field;
00288
00289
00290
00291
00292
00293
00294
00295
00296
00297
00298
00299
00300
00301
00302
00303
00304
00305 if ($row_table_def['Type'] == 'datetime'
00306 && !isset($row_table_def['Default'])
00307 && isset($row_table_def['Null'])
00308 && $row_table_def['Null'] == 'YES') {
00309 $row_table_def['Default'] = NULL;
00310 }
00311
00312 if ($row_table_def['Type'] == 'datetime'
00313 && (!isset($row_table_def['Default']))
00314 && (!is_null($row_table_def['Default']))) {
00315
00316 if ($insert_mode) {
00317 if (isset($vrow)) {
00318 $vrow[$rowfield] = date('Y-m-d H:i:s', time());
00319 } else {
00320 $vrow = array($rowfield => date('Y-m-d H:i:s', time()));
00321 }
00322 }
00323
00324 else if (empty($vrow[$rowfield]) && is_null($vrow[$rowfield])) {
00325 $vrow[$rowfield] = date('Y-m-d H:i:s', time());
00326 }
00327 }
00328 $len = (preg_match('@float|double@', $row_table_def['Type']))
00329 ? 100
00330 : PMA_DBI_field_len($vresult, $i);
00331 $first_timestamp = 0;
00332
00333 $bgcolor = ($i % 2) ? $cfg['BgcolorOne'] : $cfg['BgcolorTwo'];
00334 ?>
00335 <tr>
00336 <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>
00337 <?php
00338 echo "\n";
00339
00340
00341 $is_binary = stristr($row_table_def['Type'], ' binary');
00342 $is_blob = stristr($row_table_def['Type'], 'blob');
00343 $is_char = stristr($row_table_def['Type'], 'char');
00344 switch ($row_table_def['True_Type']) {
00345 case 'set':
00346 $type = 'set';
00347 $type_nowrap = '';
00348 break;
00349 case 'enum':
00350 $type = 'enum';
00351 $type_nowrap = '';
00352 break;
00353 case 'timestamp':
00354 if (!$timestamp_seen) {
00355 $timestamp_seen = 1;
00356 $first_timestamp = 1;
00357 }
00358 $type = $row_table_def['Type'];
00359 $type_nowrap = ' nowrap="nowrap"';
00360 break;
00361
00362 default:
00363 $type = $row_table_def['Type'];
00364 $type_nowrap = ' nowrap="nowrap"';
00365 break;
00366 }
00367 ?>
00368 <td align="center" bgcolor="<?php echo $bgcolor; ?>"<?php echo $type_nowrap; ?>>
00369 <?php echo $type; ?>
00370 </td>
00371 <?php
00372 echo "\n";
00373
00374
00375 $real_null_value = FALSE;
00376 if (isset($vrow)) {
00377 if (!isset($vrow[$rowfield])
00378 || (function_exists('is_null') && is_null($vrow[$rowfield]))) {
00379 $real_null_value = TRUE;
00380 $vrow[$rowfield] = '';
00381 $special_chars = '';
00382 $data = $vrow[$rowfield];
00383 } else {
00384
00385 if ($is_binary || $is_blob) {
00386 $vrow[$rowfield] = str_replace("\x00", '\0', $vrow[$rowfield]);
00387 $vrow[$rowfield] = str_replace("\x08", '\b', $vrow[$rowfield]);
00388 $vrow[$rowfield] = str_replace("\x0a", '\n', $vrow[$rowfield]);
00389 $vrow[$rowfield] = str_replace("\x0d", '\r', $vrow[$rowfield]);
00390 $vrow[$rowfield] = str_replace("\x1a", '\Z', $vrow[$rowfield]);
00391 }
00392 $special_chars = htmlspecialchars($vrow[$rowfield]);
00393 $data = $vrow[$rowfield];
00394 }
00395
00396
00397 $backup_field = ($row_table_def['True_Type'] == 'timestamp')
00398 ? ''
00399 : '<input type="hidden" name="fields_prev' . $vkey . '[' . urlencode($field) . ']" value="' . urlencode($vrow[$rowfield]) . '" />';
00400 } else {
00401
00402 if (!isset($row_table_def['Default'])) {
00403 $row_table_def['Default'] = '';
00404 $real_null_value = TRUE;
00405 $data = '';
00406 } else {
00407 $data = $row_table_def['Default'];
00408 }
00409 $special_chars = htmlspecialchars($row_table_def['Default']);
00410 $backup_field = '';
00411 }
00412
00413 $idindex = ($o_rows * $fields_cnt) + $i + 1;
00414 $tabindex = (($idindex - 1) * 3) + 1;
00415
00416
00417
00418
00419
00420
00421
00422
00423 if ($cfg['ShowFunctionFields']) {
00424 if (($cfg['ProtectBinary'] && $is_blob)
00425 || ($cfg['ProtectBinary'] == 'all' && $is_binary)) {
00426 echo ' <td align="center" bgcolor="'. $bgcolor . '">' . $strBinary . '</td>' . "\n";
00427 } else if (strstr($row_table_def['True_Type'], 'enum') || strstr($row_table_def['True_Type'], 'set')) {
00428 echo ' <td align="center" bgcolor="'. $bgcolor . '">--</td>' . "\n";
00429 } else {
00430 ?>
00431 <td bgcolor="<?php echo $bgcolor; ?>">
00432 <select name="funcs<?php echo $vkey; ?>[<?php echo urlencode($field); ?>]" <?php echo $chg_evt_handler; ?>="return unNullify('<?php echo urlencode($field); ?>', '<?php echo $jsvkey; ?>')" tabindex="<?php echo ($tabindex + $tabindex_for_function); ?>" id="field_<?php echo $idindex; ?>_1">
00433 <option></option>
00434 <?php
00435 echo "\n";
00436 $selected = '';
00437
00438
00439
00440
00441 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'])]])) {
00442 $current_func_type = $cfg['RestrictColumnTypes'][strtoupper($row_table_def['True_Type'])];
00443 $dropdown = $cfg['RestrictFunctions'][$current_func_type];
00444 $default_function = $cfg['DefaultFunctions'][$current_func_type];
00445 } else {
00446 $dropdown = array();
00447 $default_function = '';
00448 }
00449
00450 $dropdown_built = array();
00451 $op_spacing_needed = FALSE;
00452
00453
00454 $cnt_dropdown = count($dropdown);
00455 for ($j = 0; $j < $cnt_dropdown; $j++) {
00456
00457 $selected = ($first_timestamp && $dropdown[$j] == $cfg['DefaultFunctions']['first_timestamp'])
00458 || (!$first_timestamp && $dropdown[$j] == $default_function)
00459 ? ' selected="selected"'
00460 : '';
00461 echo ' ';
00462 echo '<option' . $selected . '>' . $dropdown[$j] . '</option>' . "\n";
00463 $dropdown_built[$dropdown[$j]] = 'TRUE';
00464 $op_spacing_needed = TRUE;
00465 }
00466
00467
00468
00469
00470 $cnt_functions = count($cfg['Functions']);
00471 for ($j = 0; $j < $cnt_functions; $j++) {
00472 if (!isset($dropdown_built[$cfg['Functions'][$j]]) || $dropdown_built[$cfg['Functions'][$j]] != 'TRUE') {
00473
00474 $selected = ($first_timestamp && $cfg['Functions'][$j] == $cfg['DefaultFunctions']['first_timestamp'])
00475 || (!$first_timestamp && $cfg['Functions'][$j] == $default_function)
00476 ? ' selected="selected"'
00477 : '';
00478 if ($op_spacing_needed == TRUE) {
00479 echo ' ';
00480 echo '<option value="">--------</option>' . "\n";
00481 $op_spacing_needed = FALSE;
00482 }
00483
00484 echo ' ';
00485 echo '<option' . $selected . '>' . $cfg['Functions'][$j] . '</option>' . "\n";
00486 }
00487 }
00488 unset($selected);
00489 ?>
00490 </select>
00491 </td>
00492 <?php
00493 }
00494 }
00495 echo "\n";
00496
00497
00498
00499 echo ' <td bgcolor="' . $bgcolor . '">' . "\n";
00500 if (!(($cfg['ProtectBinary'] && $is_blob) || ($cfg['ProtectBinary'] == 'all' && $is_binary))
00501 && $row_table_def['Null'] == 'YES') {
00502 echo ' <input type="checkbox" tabindex="' . ($tabindex + $tabindex_for_null) . '"'
00503 . ' name="fields_null' . $vkey . '[' . urlencode($field) . ']"';
00504 if ($real_null_value && !$first_timestamp) {
00505 echo ' checked="checked"';
00506 }
00507 echo ' id="field_' . ($idindex) . '_2"';
00508 $onclick = ' onclick="if (this.checked) {nullify(';
00509 if (strstr($row_table_def['True_Type'], 'enum')) {
00510 if (strlen($row_table_def['Type']) > 20) {
00511 $onclick .= '1, ';
00512 } else {
00513 $onclick .= '2, ';
00514 }
00515 } else if (strstr($row_table_def['True_Type'], 'set')) {
00516 $onclick .= '3, ';
00517 } else if ($foreigners && isset($foreigners[$field])) {
00518 $onclick .= '4, ';
00519 } else {
00520 $onclick .= '5, ';
00521 }
00522 $onclick .= '\'' . urlencode($field) . '\', \'' . md5($field) . '\', \'' . $vkey . '\'); this.checked = true}; return true" />' . "\n";
00523 echo $onclick;
00524 } else {
00525 echo ' ' . "\n";
00526 }
00527 echo ' </td>' . "\n";
00528
00529
00530
00531
00532 require('./libraries/get_foreign.lib.php');
00533
00534 if (isset($foreign_link) && $foreign_link == true) {
00535 ?>
00536 <td bgcolor="<?php echo $bgcolor; ?>">
00537 <?php echo $backup_field . "\n"; ?>
00538 <input type="hidden" name="fields_type<?php echo $vkey; ?>[<?php echo urlencode($field); ?>]" value="foreign" />
00539 <input type="hidden" name="fields<?php echo $vkey; ?>[<?php echo urlencode($field); ?>]" value="" id="field_<?php echo ($idindex); ?>_1" />
00540 <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 $jsvkey; ?>')" tabindex="<?php echo ($tabindex + $tabindex_for_value); ?>" id="field_<?php echo ($idindex); ?>_3" value="<?php echo htmlspecialchars($data); ?>" />
00541 <script type="text/javascript" language="javascript">
00542 document.writeln('<a target="_blank" onclick="window.open(this.href, \'foreigners\', \'width=640,height=240,scrollbars=yes,resizable=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>');
00543 </script>
00544 </td>
00545 <?php
00546 } else if (isset($disp_row) && is_array($disp_row)) {
00547 ?>
00548 <td bgcolor="<?php echo $bgcolor; ?>">
00549 <?php echo $backup_field . "\n"; ?>
00550 <input type="hidden" name="fields_type<?php echo $vkey; ?>[<?php echo urlencode($field); ?>]" value="foreign" />
00551 <input type="hidden" name="fields<?php echo $vkey; ?>[<?php echo urlencode($field); ?>]" value="" id="field_<?php echo $idindex; ?>_1" />
00552 <select name="field_<?php echo md5($field); ?><?php echo $vkey; ?>[]" <?php echo $chg_evt_handler; ?>="return unNullify('<?php echo urlencode($field); ?>', '<?php echo $jsvkey; ?>')" tabindex="<?php echo ($tabindex + $tabindex_for_value); ?>" id="field_<?php echo ($idindex); ?>_3">
00553 <?php echo PMA_foreignDropdown($disp_row, $foreign_field, $foreign_display, $data, 100); ?>
00554 </select>
00555 </td>
00556 <?php
00557 unset($disp_row);
00558 }
00559 else if ($cfg['LongtextDoubleTextarea'] && strstr($type, 'longtext')) {
00560 ?>
00561 <td bgcolor="<?php echo $bgcolor; ?>"> </td>
00562 </tr>
00563 <tr>
00564 <td colspan="4" align="right" bgcolor="<?php echo $bgcolor; ?>">
00565 <?php echo $backup_field . "\n"; ?>
00566 <textarea name="fields<?php echo $vkey; ?>[<?php echo urlencode($field); ?>]" rows="<?php echo ($cfg['TextareaRows']*2); ?>" cols="<?php echo ($cfg['TextareaCols']*2); ?>" dir="<?php echo $text_dir; ?>" id="field_<?php echo ($idindex); ?>_3"
00567 <?php echo $chg_evt_handler; ?>="return unNullify('<?php echo urlencode($field); ?>', '<?php echo $jsvkey; ?>')" tabindex="<?php echo ($tabindex + $tabindex_for_value); ?>"><?php echo $special_chars; ?></textarea>
00568 </td>
00569 <?php
00570 }
00571 else if (strstr($type, 'text')) {
00572 ?>
00573 <td bgcolor="<?php echo $bgcolor; ?>">
00574 <?php echo $backup_field . "\n"; ?>
00575 <textarea name="fields<?php echo $vkey; ?>[<?php echo urlencode($field); ?>]" rows="<?php echo $cfg['TextareaRows']; ?>" cols="<?php echo $cfg['TextareaCols']; ?>" dir="<?php echo $text_dir; ?>" id="field_<?php echo ($idindex); ?>_3"
00576 <?php echo $chg_evt_handler; ?>="return unNullify('<?php echo urlencode($field); ?>', '<?php echo $jsvkey; ?>')" tabindex="<?php echo ($tabindex + $tabindex_for_value); ?>"><?php echo $special_chars; ?></textarea>
00577 </td>
00578 <?php
00579 echo "\n";
00580 if (strlen($special_chars) > 32000) {
00581 echo ' <td bgcolor="' . $bgcolor . '">' . $strTextAreaLength . '</td>' . "\n";
00582 }
00583 }
00584 else if ($type == 'enum') {
00585 $enum = PMA_getEnumSetOptions($row_table_def['Type']);
00586 $enum_cnt = count($enum);
00587 ?>
00588 <td bgcolor="<?php echo $bgcolor; ?>">
00589 <input type="hidden" name="fields_type<?php echo $vkey; ?>[<?php echo urlencode($field); ?>]" value="enum" />
00590 <input type="hidden" name="fields<?php echo $vkey; ?>[<?php echo urlencode($field); ?>]" value="" />
00591 <?php
00592 echo "\n" . ' ' . $backup_field;
00593
00594
00595 if (strlen($row_table_def['Type']) > 20) {
00596 echo "\n";
00597 ?>
00598 <select name="field_<?php echo md5($field); ?><?php echo $vkey; ?>[]" <?php echo $chg_evt_handler; ?>="return unNullify('<?php echo urlencode($field); ?>', '<?php echo $jsvkey; ?>')" tabindex="<?php echo ($tabindex + $tabindex_for_value); ?>" id="field_<?php echo ($idindex); ?>_3">
00599 <option value=""></option>
00600 <?php
00601 echo "\n";
00602
00603 for ($j = 0; $j < $enum_cnt; $j++) {
00604
00605 $enum_atom = str_replace('\'\'', '\'', str_replace('\\\\', '\\', $enum[$j]));
00606 echo ' ';
00607
00608 echo '<option value="' . urlencode($enum_atom) . '"';
00609 if ($data == $enum_atom
00610 || ($data == '' && (!isset($primary_key) || $row_table_def['Null'] != 'YES')
00611 && isset($row_table_def['Default']) && $enum_atom == $row_table_def['Default'])) {
00612 echo ' selected="selected"';
00613 }
00614 echo '>' . htmlspecialchars($enum_atom) . '</option>' . "\n";
00615 }
00616
00617 ?>
00618 </select>
00619 <?php
00620 }
00621 else {
00622 echo "\n";
00623 for ($j = 0; $j < $enum_cnt; $j++) {
00624
00625 $enum_atom = str_replace('\'\'', '\'', str_replace('\\\\', '\\', $enum[$j]));
00626 echo ' ';
00627 echo '<input type="radio" name="field_' . md5($field) . $vkey . '[]" value="' . urlencode($enum_atom) . '" id="field_' . ($idindex) . '_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}"';
00628 if ($data == $enum_atom
00629 || ($data == '' && (!isset($primary_key) || $row_table_def['Null'] != 'YES')
00630 && isset($row_table_def['Default']) && $enum_atom == $row_table_def['Default'])) {
00631 echo ' checked="checked"';
00632 }
00633 echo 'tabindex="' . ($tabindex + $tabindex_for_value) . '" />';
00634 echo '<label for="field_' . ($tabindex + $tabindex_for_value) . '_3_' . $j . '">' . htmlspecialchars($enum_atom) . '</label>' . "\n";
00635 } // end for
00636
00637 } // end else
00638 echo "\n";
00639 ?>
00640 </td>
00641 <?php
00642 echo "\n";
00643 }
00644 else if ($type == 'set') {
00645 $set = PMA_getEnumSetOptions($row_table_def['Type']);
00646
00647 if (isset($vset)) {
00648 unset($vset);
00649 }
00650 for ($vals = explode(',', $data); list($t, $k) = each($vals);) {
00651 $vset[$k] = 1;
00652 }
00653 $countset = count($set);
00654 $size = min(4, $countset);
00655 ?>
00656 <td bgcolor="<?php echo $bgcolor; ?>">
00657 <?php echo $backup_field . "\n"; ?>
00658 <input type="hidden" name="fields_type<?php echo $vkey; ?>[<?php echo urlencode($field); ?>]" value="set" />
00659 <input type="hidden" name="fields<?php echo $vkey; ?>[<?php echo urlencode($field); ?>]" value="" />
00660 <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 $jsvkey; ?>')" tabindex="<?php echo ($tabindex + $tabindex_for_value); ?>" id="field_<?php echo ($idindex); ?>_3">
00661 <?php
00662 echo "\n";
00663 for ($j = 0; $j < $countset; $j++) {
00664 echo ' ';
00665 //echo '<option value="'. htmlspecialchars($set[$j]) . '"';
00666 echo '<option value="'. urlencode($set[$j]) . '"';
00667 if (isset($vset[$set[$j]]) && $vset[$set[$j]]) {
00668 echo ' selected="selected"';
00669 }
00670 echo '>' . htmlspecialchars($set[$j]) . '</option>' . "\n";
00671 }
00672 ?>
00673 </select>
00674 </td>
00675 <?php
00676 }
00677
00678
00679 else if ($is_binary || $is_blob) {
00680 if (($cfg['ProtectBinary'] && $is_blob)
00681 || ($cfg['ProtectBinary'] == 'all' && $is_binary)) {
00682 echo "\n";
00683 ?>
00684 <td bgcolor="<?php echo $bgcolor; ?>">
00685 <?php
00686 echo $strBinaryDoNotEdit;
00687 if (isset($data)) {
00688 $data_size = PMA_formatByteDown(strlen(stripslashes($data)), 3, 1);
00689 echo ' ('. $data_size [0] . ' ' . $data_size[1] . ')';
00690 unset($data_size);
00691 }
00692 echo "\n";
00693 ?>
00694 <input type="hidden" name="fields_type<?php echo $vkey; ?>[<?php echo urlencode($field); ?>]" value="protected" />
00695 <input type="hidden" name="fields<?php echo $vkey; ?>[<?php echo urlencode($field); ?>]" value="" />
00696 <?php
00697 } else if ($is_blob) {
00698 echo "\n";
00699 ?>
00700 <td bgcolor="<?php echo $bgcolor; ?>">
00701 <?php echo $backup_field . "\n"; ?>
00702 <textarea name="fields<?php echo $vkey; ?>[<?php echo urlencode($field); ?>]" rows="<?php echo $cfg['TextareaRows']; ?>" cols="<?php echo $cfg['TextareaCols']; ?>" dir="<?php echo $text_dir; ?>" id="field_<?php echo ($idindex); ?>_3"
00703 <?php echo $chg_evt_handler; ?>="return unNullify('<?php echo urlencode($field); ?>', '<?php echo $jsvkey; ?>')" tabindex="<?php echo ($tabindex + $tabindex_for_value); ?>" ><?php echo $special_chars; ?></textarea>
00704 <?php
00705
00706 } else {
00707 if ($len < 4) {
00708 $fieldsize = $maxlength = 4;
00709 } else {
00710 $fieldsize = (($len > 40) ? 40 : $len);
00711 $maxlength = $len;
00712 }
00713 echo "\n";
00714 ?>
00715 <td bgcolor="<?php echo $bgcolor; ?>">
00716 <?php echo $backup_field . "\n"; ?>
00717 <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 $jsvkey; ?>')" tabindex="<?php echo ($tabindex + $tabindex_for_value); ?>" id="field_<?php echo ($idindex); ?>_3" />
00718 <?php
00719 }
00720
00721
00722
00723
00724
00725 if ($is_upload && $is_blob) {
00726 echo '<input type="file" name="fields_upload_' . urlencode($field) . $vkey . '" class="textfield" id="field_' . ($idindex) . '_3" size="10" /> ';
00727
00728
00729 $max_field_sizes = array(
00730 'tinyblob' => '256',
00731 'blob' => '65536',
00732 'mediumblob' => '16777216',
00733 'longblob' => '4294967296');
00734
00735 $this_field_max_size = $max_upload_size;
00736 if ($this_field_max_size > $max_field_sizes[$type]) {
00737 $this_field_max_size = $max_field_sizes[$type];
00738 }
00739 echo PMA_displayMaximumUploadSize($this_field_max_size) . "\n";
00740 echo ' ' . PMA_generateHiddenMaxFileSize($this_field_max_size) . "\n";
00741 }
00742
00743 if (!empty($cfg['UploadDir'])) {
00744 if (substr($cfg['UploadDir'], -1) != '/') {
00745 $cfg['UploadDir'] .= '/';
00746 }
00747 if ($handle = @opendir($cfg['UploadDir'])) {
00748 $is_first = 0;
00749 while ($file = @readdir($handle)) {
00750 if (is_file($cfg['UploadDir'] . $file) && !PMA_checkFileExtensions($file, '.sql')) {
00751 if ($is_first == 0) {
00752 echo "<br />\n";
00753 echo ' <i>' . $strOr . '</i>' . ' ' . $strWebServerUploadDirectory . ':<br />' . "\n";
00754 echo ' <select size="1" name="fields_uploadlocal_' . urlencode($field) . $vkey . '">' . "\n";
00755 echo ' <option value="" selected="selected"></option>' . "\n";
00756 }
00757 echo ' <option value="' . htmlspecialchars($file) . '">' . htmlspecialchars($file) . '</option>' . "\n";
00758 $is_first++;
00759 }
00760 }
00761 if ($is_first > 0) {
00762 echo ' </select>' . "\n";
00763 }
00764 @closedir($handle);
00765 } else {
00766 echo ' <font color="red">' . $strError . '</font><br />' . "\n";
00767 echo ' ' . $strWebServerUploadDirectoryError . "\n";
00768 }
00769 }
00770
00771 echo '</td>';
00772
00773 }
00774 else {
00775
00776
00777
00778
00779
00780
00781 if ($is_char) {
00782 $fieldsize = (($len > 40) ? 40 : $len);
00783 $maxlength = $len;
00784 }
00785 else {
00786 $fieldsize = 20;
00787 $maxlength = 99;
00788 }
00789 echo "\n";
00790 ?>
00791 <td bgcolor="<?php echo $bgcolor; ?>">
00792 <?php echo $backup_field . "\n"; ?>
00793 <?php
00794 if ($is_char && isset($cfg['CharEditing']) && ($cfg['CharEditing'] == 'textarea')) {
00795 echo "\n";
00796 ?>
00797 <textarea name="fields<?php echo $vkey; ?>[<?php echo urlencode($field); ?>]" rows="<?php echo $cfg['CharTextareaRows']; ?>" cols="<?php echo $cfg['CharTextareaCols']; ?>" dir="<?php echo $text_dir; ?>" id="field_<?php echo ($idindex); ?>_3"
00798 <?php echo $chg_evt_handler; ?>="return unNullify('<?php echo urlencode($field); ?>', '<?php echo $jsvkey; ?>')" tabindex="<?php echo ($tabindex + $tabindex_for_value); ?>" ><?php echo $special_chars; ?></textarea>
00799 <?php
00800 } else {
00801 echo "\n";
00802 ?>
00803 <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 $jsvkey; ?>')" tabindex="<?php echo ($tabindex + $tabindex_for_value); ?>" id="field_<?php echo ($idindex); ?>_3" />
00804 <?php
00805 if ($type == 'date' || $type == 'datetime' || substr($type, 0, 9) == 'timestamp') {
00806 ?>
00807 <script type="text/javascript">
00808 <!--
00809 document.write('<a title="<?php echo $strCalendar;?>" href="javascript:openCalendar(\'<?php echo PMA_generate_common_url();?>\', \'insertForm\', \'field_<?php echo ($idindex); ?>_3\', \'<?php echo (PMA_MYSQL_INT_VERSION >= 40100 && substr($type, 0, 9) == 'timestamp') ? 'datetime' : substr($type, 0, 9); ?>\')"><img class="calendar" src="<?php echo $pmaThemeImage; ?>b_calendar.png" alt="<?php echo $strCalendar; ?>"/></a>');
00810
00811 </script>
00812 <?php
00813 }
00814 }
00815 echo "\n";
00816 ?>
00817 </td>
00818 <?php
00819 }
00820 echo "\n";
00821 ?>
00822 </tr>
00823 <?php
00824 echo "\n";
00825 }
00826 $o_rows++;
00827 echo ' </table><br />';
00828 }
00829 ?>
00830 <br />
00831
00832 <table border="0" cellpadding="5" cellspacing="0">
00833 <tr>
00834 <td valign="middle" nowrap="nowrap">
00835 <?php
00836 if (isset($primary_key)) {
00837 ?>
00838 <input type="radio" name="submit_type" value="<?php echo $strSave; ?>" id="radio_submit_type_save" checked="checked" tabindex="<?php echo ($tabindex + $tabindex_for_value + 1); ?>" style="vertical-align: middle" /><label for="radio_submit_type_save"><?php echo $strSave; ?></label><br />
00839 <b><?php echo $strOr; ?></b><br />
00840 <input type="radio" name="submit_type" value="<?php echo $strInsertAsNewRow; ?>" id="radio_submit_type_insert_as_new_row" tabindex="<?php echo ($tabindex + $tabindex_for_value + 2); ?>" style="vertical-align: middle" /><label for="radio_submit_type_insert_as_new_row"><?php echo $strInsertAsNewRow; ?></label>
00841 <?php
00842 } else {
00843 echo "\n";
00844 ?>
00845 <input type="hidden" name="submit_type" value="<?php echo $strInsertAsNewRow; ?>" />
00846 <?php
00847 echo ' ' . $strInsertAsNewRow . "\n";
00848 }
00849 echo "\n";
00850
00851
00852
00853
00854 if (!empty($disp_message)) {
00855 $checked_after_insert_new_insert = ' checked="checked"';
00856 $checked_after_insert_back = '';
00857 } else {
00858 $checked_after_insert_back = ' checked="checked"';
00859 $checked_after_insert_new_insert = '';
00860 }
00861 ?>
00862 </td>
00863 <td valign="middle">
00864 <b>-- <?php echo $strAnd; ?> --</b>
00865 </td>
00866 <td valign="middle" nowrap="nowrap">
00867 <input type="radio" name="after_insert" value="back" id="radio_after_insert_back" <?php echo $checked_after_insert_back; ?> tabindex="<?php echo ($tabindex + $tabindex_for_value + 3); ?>" style="vertical-align: middle" /><label for="radio_after_insert_back"><?php echo $strAfterInsertBack; ?></label><br />
00868
00869 <b><?php echo $strOr; ?></b><br />
00870 <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 ($tabindex + $tabindex_for_value + 4); ?>" style="vertical-align: middle" /><label for="radio_after_insert_new_insert"><?php echo $strAfterInsertNewInsert; ?></label><br />
00871
00872 <?php
00873 if (isset($primary_key))
00874 {?>
00875 <b><?php echo $strOr; ?></b><br />
00876 <input type="radio" name="after_insert" value="same_insert" id="radio_after_insert_same_insert"<?php echo $checked_after_insert_new_insert; ?> tabindex="<?php echo ($tabindex + $tabindex_for_value + 5); ?>" style="vertical-align: middle" /><label for="radio_after_insert_same_insert"><?php echo $strAfterInsertSame; ?></label><br />
00877 <?php
00878
00879 if (preg_match('@^[\s]*`[^`]*` = [0-9]+@', $primary_key)) {
00880 ?>
00881 <b><?php echo $strOr; ?></b><br />
00882 <input type="radio" name="after_insert" value="edit_next" id="radio_after_insert_edit_next"<?php echo $checked_after_insert_new_insert; ?> tabindex="<?php echo ($tabindex + $tabindex_for_value + 5); ?>" style="vertical-align: middle" /><label for="radio_after_insert_edit_next"><?php echo $strAfterInsertNext; ?></label><br />
00883 <?php
00884 }
00885 }
00886 ?>
00887 </td>
00888 </tr>
00889
00890 <tr>
00891 <td>
00892 <?php echo PMA_showHint($strUseTabKey); ?>
00893 </td>
00894 <td colspan="3" align="right" valign="middle"&g