diff --git a/tbl_change.php b/tbl_change.php index 9d24d8c83..05085439d 100644 --- a/tbl_change.php +++ b/tbl_change.php @@ -286,6 +286,7 @@ foreach ($rows as $row_id => $vrow) { } ?>
@@ -299,6 +300,15 @@ foreach ($rows as $row_id => $vrow) { | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
+ + | +|||||||||||
align="center"> | +align="center"> | $vrow) { $timestamp_seen = 1; $first_timestamp = 1; } - $type = $table_field['Type']; + $type = $field['Type']; $type_nowrap = ' nowrap="nowrap"'; break; default: - $type = $table_field['Type']; + $type = $field['Type']; $type_nowrap = ' nowrap="nowrap"'; break; } @@ -414,29 +426,29 @@ foreach ($rows as $row_id => $vrow) { // Prepares the field value $real_null_value = FALSE; if (isset($vrow)) { - if (! isset($vrow[$field]) - || is_null($vrow[$field])) { + if (! isset($vrow[$field['Field']]) + || is_null($vrow[$field['Field']])) { $real_null_value = TRUE; - $vrow[$field] = ''; + $vrow[$field['Field']] = ''; $special_chars = ''; - $data = $vrow[$field]; - } elseif ($table_field['True_Type'] == 'bit') { + $data = $vrow[$field['Field']]; + } elseif ($field['True_Type'] == 'bit') { $special_chars = ''; for ($j = 0; $j < ceil($len / 8); $j++) { - $special_chars .= sprintf('%08d', decbin(ord(substr($vrow[$field], $j, 1)))); + $special_chars .= sprintf('%08d', decbin(ord(substr($vrow[$field['Field']], $j, 1)))); } $special_chars = substr($special_chars, -$len); } else { // loic1: special binary "characters" if ($is_binary || $is_blob) { - $vrow[$field] = str_replace("\x00", '\0', $vrow[$field]); - $vrow[$field] = str_replace("\x08", '\b', $vrow[$field]); - $vrow[$field] = str_replace("\x0a", '\n', $vrow[$field]); - $vrow[$field] = str_replace("\x0d", '\r', $vrow[$field]); - $vrow[$field] = str_replace("\x1a", '\Z', $vrow[$field]); + $vrow[$field['Field']] = str_replace("\x00", '\0', $vrow[$field['Field']]); + $vrow[$field['Field']] = str_replace("\x08", '\b', $vrow[$field['Field']]); + $vrow[$field['Field']] = str_replace("\x0a", '\n', $vrow[$field['Field']]); + $vrow[$field['Field']] = str_replace("\x0d", '\r', $vrow[$field['Field']]); + $vrow[$field['Field']] = str_replace("\x1a", '\Z', $vrow[$field['Field']]); } // end if - $special_chars = htmlspecialchars($vrow[$field]); - $data = $vrow[$field]; + $special_chars = htmlspecialchars($vrow[$field['Field']]); + $data = $vrow[$field['Field']]; } // end if... else... // loic1: if a timestamp field value is not included in an update // statement MySQL auto-update it to the current timestamp @@ -444,17 +456,17 @@ foreach ($rows as $row_id => $vrow) { // it's better to set a fields_prev in this situation $backup_field = ''; + . htmlspecialchars($vrow[$field['Field']]) . '" />'; } else { // loic1: display default values - if (!isset($table_field['Default'])) { - $table_field['Default'] = ''; + if (!isset($field['Default'])) { + $field['Default'] = ''; $real_null_value = TRUE; $data = ''; } else { - $data = $table_field['Default']; + $data = $field['Default']; } - $special_chars = htmlspecialchars($table_field['Default']); + $special_chars = htmlspecialchars($field['Default']); $backup_field = ''; } @@ -472,7 +484,7 @@ foreach ($rows as $row_id => $vrow) { if (($cfg['ProtectBinary'] && $is_blob && !$is_upload) || ($cfg['ProtectBinary'] == 'all' && $is_binary)) { echo '' . $strBinary . ' | ' . "\n"; - } elseif (strstr($table_field['True_Type'], 'enum') || strstr($table_field['True_Type'], 'set')) { + } elseif (strstr($field['True_Type'], 'enum') || strstr($field['True_Type'], 'set')) { echo '-- | ' . "\n"; } else { ?> @@ -487,9 +499,9 @@ foreach ($rows as $row_id => $vrow) { // which will then reveal the available dropdown options if (isset($cfg['RestrictFunctions']) && isset($cfg['RestrictColumnTypes']) - && isset($cfg['RestrictColumnTypes'][strtoupper($table_field['True_Type'])]) - && isset($cfg['RestrictFunctions'][$cfg['RestrictColumnTypes'][strtoupper($table_field['True_Type'])]])) { - $current_func_type = $cfg['RestrictColumnTypes'][strtoupper($table_field['True_Type'])]; + && isset($cfg['RestrictColumnTypes'][strtoupper($field['True_Type'])]) + && isset($cfg['RestrictFunctions'][$cfg['RestrictColumnTypes'][strtoupper($field['True_Type'])]])) { + $current_func_type = $cfg['RestrictColumnTypes'][strtoupper($field['True_Type'])]; $dropdown = $cfg['RestrictFunctions'][$current_func_type]; $default_function = $cfg['DefaultFunctions'][$current_func_type]; } else { @@ -512,9 +524,9 @@ foreach ($rows as $row_id => $vrow) { // and the column does not have the // ON UPDATE DEFAULT TIMESTAMP attribute. - if (!($table_field['True_Type'] == 'timestamp' - && !empty($table_field['Default']) - && !isset($analyzed_sql[0]['create_table_fields'][$field]['on_update_current_timestamp']))) { + if (!($field['True_Type'] == 'timestamp' + && !empty($field['Default']) + && !isset($analyzed_sql[0]['create_table_fields'][$field['Field']]['on_update_current_timestamp']))) { $selected = ($first_timestamp && $dropdown[$j] == $cfg['DefaultFunctions']['first_timestamp']) || (!$first_timestamp && $dropdown[$j] == $default_function) ? ' selected="selected"' @@ -559,7 +571,7 @@ foreach ($rows as $row_id => $vrow) { // The null column // --------------- echo '' . "\n"; - if ($table_field['Null'] == 'YES') { + if ($field['Null'] == 'YES') { echo ' $vrow) { } echo ' id="field_' . ($idindex) . '_2"'; $onclick = ' onclick="if (this.checked) {nullify('; - if (strstr($table_field['True_Type'], 'enum')) { - if (strlen($table_field['Type']) > 20) { + if (strstr($field['True_Type'], 'enum')) { + if (strlen($field['Type']) > 20) { $onclick .= '1, '; } else { $onclick .= '2, '; } - } elseif (strstr($table_field['True_Type'], 'set')) { + } elseif (strstr($field['True_Type'], 'set')) { $onclick .= '3, '; - } elseif ($foreigners && isset($foreigners[$field])) { + } elseif ($foreigners && isset($foreigners[$field['Field']])) { $onclick .= '4, '; } else { $onclick .= '5, '; } - $onclick .= '\'' . PMA_escapeJsString($field_html) . '\', \'' . $field_md5 . '\', \'' . PMA_escapeJsString($vkey) . '\'); this.checked = true}; return true" />' . "\n"; + $onclick .= '\'' . PMA_escapeJsString($field['Field_html']) . '\', \'' . $field['Field_md5'] . '\', \'' . PMA_escapeJsString($vkey) . '\'); this.checked = true}; return true" />' . "\n"; echo $onclick; } else { echo ' $vrow) { require './libraries/get_foreign.lib.php'; + echo ' | ' . "\n"; if (isset($foreign_link) && $foreign_link == true) { + echo $backup_field . "\n"; ?> - | - $vrow) { document.writeln(''); + document.writeln('&field=">'); document.writeln(''); //]]> - | -- $vrow) { id="field__3"> - | -+ | |||
@@ -661,12 +670,10 @@ foreach ($rows as $row_id => $vrow) { tabindex="" > - | -- - | 32000) { - echo '' . $strTextAreaLength . ' | ' . "\n"; + echo " \n"; + echo '' . $strTextAreaLength; } } elseif ($type == 'enum') { - $enum = PMA_getEnumSetOptions($table_field['Type']); - $enum_cnt = count($enum); + if (! isset($table_fields[$i]['values'])) { + $table_fields[$i]['values'] = array(); + foreach (PMA_getEnumSetOptions($field['Type']) as $val) { + // Removes automatic MySQL escape format + $val = str_replace('\'\'', '\'', str_replace('\\\\', '\\', $val)); + $table_fields[$i]['values'][] = array( + 'plain' => $val, + 'html' => htmlspecialchars($val), + ); + } + } + $field_enum_values = $table_fields[$i]['values']; ?> - | 20) { - echo "\n"; + if (strlen($field['Type']) > 20) { ?> '; echo '' . "\n"; + . $enum_value['html'] . '' . "\n"; + $j++; } // end for - } // end else - echo "\n"; - ?> - | - $val, + 'html' => htmlspecialchars($val), + ); + } + $table_fields[$i]['select_size'] = min(4, count($table_fields[$i]['values'])); + } + $field_set_values = $table_fields[$i]['values']; + $select_size = $table_fields[$i]['select_size']; - if (isset($vset)) { - unset($vset); - } - for ($vals = explode(',', $data); list($t, $k) = each($vals);) { - $vset[$k] = 1; - } - $countset = count($set); - $size = min(4, $countset); + $vset = array_flip(explode(',', $data)); + echo $backup_field . "\n"; ?> -- - | @@ -793,9 +802,6 @@ foreach ($rows as $row_id => $vrow) { if (($cfg['ProtectBinary'] && $is_blob) || ($cfg['ProtectBinary'] == 'all' && $is_binary)) { echo "\n"; - ?> -- $vrow) { - | - | ||||
- - | -