Move magic words used for fields type into special variable.

This commit is contained in:
Michal Čihař
2003-02-24 11:15:07 +00:00
parent f1bdfe2334
commit c49e25f092
3 changed files with 78 additions and 55 deletions

View File

@@ -5,6 +5,10 @@ phpMyAdmin - Changelog
$Id$
$Source$
2003-02-24 Michal Cihar <nijel@users.sourceforge.net>
* tbl_change.php3, tbl_replace_fields.php3: Move magic words used for
fields type into special variable. Fixes #647689.
2003-02-23 Marc Delisle <lem9@users.sourceforge.net>
### 2.4.0 released

View File

@@ -268,7 +268,9 @@ for ($i = 0; $i < $fields_cnt; $i++) {
break;
}
?>
<td align="center" bgcolor="<?php echo $bgcolor; ?>"<?php echo $type_nowrap; ?>><?php echo $type; ?></td>
<td align="center" bgcolor="<?php echo $bgcolor; ?>"<?php echo $type_nowrap; ?>>
<?php echo $type; ?>
</td>
<?php
echo "\n";
@@ -388,7 +390,8 @@ for ($i = 0; $i < $fields_cnt; $i++) {
?>
<td bgcolor="<?php echo $bgcolor; ?>">
<?php echo $backup_field . "\n"; ?>
<input type="hidden" name="fields[<?php echo urlencode($field); ?>]" value="$foreign$" id="field_<?php echo $i; ?>_1" />
<input type="hidden" name="fields_type[<?php echo urlencode($field); ?>]" value="foreign" />
<input type="hidden" name="fields[<?php echo urlencode($field); ?>]" value="" id="field_<?php echo $i; ?>_1" />
<select name="field_<?php echo md5($field); ?>[]" <?php echo $chg_evt_handler; ?>="return unNullify('<?php echo urlencode($field); ?>')" tabindex="<?php echo ($i + 1); ?>" id="field_<?php echo $i; ?>_3">
<option value=""></option>
<?php
@@ -426,7 +429,8 @@ for ($i = 0; $i < $fields_cnt; $i++) {
$enum_cnt = count($enum);
?>
<td bgcolor="<?php echo $bgcolor; ?>">
<input type="hidden" name="fields[<?php echo urlencode($field); ?>]" value="$enum$" />
<input type="hidden" name="fields_type[<?php echo urlencode($field); ?>]" value="enum" />
<input type="hidden" name="fields[<?php echo urlencode($field); ?>]" value="" />
<?php
echo "\n" . ' ' . $backup_field;
@@ -494,7 +498,8 @@ for ($i = 0; $i < $fields_cnt; $i++) {
?>
<td bgcolor="<?php echo $bgcolor; ?>">
<?php echo $backup_field . "\n"; ?>
<input type="hidden" name="fields[<?php echo urlencode($field); ?>]" value="$set$" />
<input type="hidden" name="fields_type[<?php echo urlencode($field); ?>]" value="set" />
<input type="hidden" name="fields[<?php echo urlencode($field); ?>]" value="" />
<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); ?>" id="field_<?php echo $i; ?>_3">
<?php
echo "\n";
@@ -532,7 +537,8 @@ for ($i = 0; $i < $fields_cnt; $i++) {
}
echo "\n";
?>
<input type="hidden" name="fields[<?php echo urlencode($field); ?>]" value="$protected$" />
<input type="hidden" name="fields_type[<?php echo urlencode($field); ?>]" value="protected" />
<input type="hidden" name="fields[<?php echo urlencode($field); ?>]" value="" />
<?php
} else if ($is_blob) {
echo "\n";

View File

@@ -56,10 +56,14 @@
if (!$check_stop) {
// f i e l d v a l u e i n t h e f o r m
if (isset($fields_type[$key])) $type = $fields_type[$key];
else $type = '';
switch (strtolower($val)) {
case 'null':
break;
case '$enum$':
case '':
switch ($type) {
case 'enum':
// if we have an enum, then construct the value
$f = 'field_' . md5($key);
if (!empty($$f)) {
@@ -73,7 +77,7 @@
$val = "''";
}
break;
case '$set$':
case 'set':
// if we have a set, then construct the value
$f = 'field_' . md5($key);
if (!empty($$f)) {
@@ -83,7 +87,7 @@
$val = "''";
}
break;
case '$foreign$':
case 'foreign':
// if we have a foreign key, then construct the value
$f = 'field_' . md5($key);
if (!empty($$f)) {
@@ -97,7 +101,7 @@
$val = "''";
}
break;
case '$protected$':
case 'protected':
// here we are in protected mode (asked in the config)
// so tbl_change has put this special value in the
// fields array, so we do not change the field value
@@ -111,6 +115,15 @@
unset($val);
}
break;
default:
if (get_magic_quotes_gpc()) {
$val = "'" . str_replace('\\"', '"', $val) . "'";
} else {
$val = "'" . PMA_sqlAddslashes($val) . "'";
}
break;
}
break;
default:
if (get_magic_quotes_gpc()) {