The branch, master has been updated via 45ec0da621e96c108bc70395eb01ad9495f281d0 (commit) from 4a71a1e5f1eee17a5ef2349e9a62cbcab7ec4971 (commit)
- Log ----------------------------------------------------------------- commit 45ec0da621e96c108bc70395eb01ad9495f281d0 Author: Marc Delisle marc@infomarc.info Date: Fri Dec 17 09:31:42 2010 -0500
Problems with latest fix and SET columns
-----------------------------------------------------------------------
Summary of changes: libraries/tbl_replace_fields.inc.php | 61 +++++++++++++-------------------- tbl_change.php | 2 +- 2 files changed, 25 insertions(+), 38 deletions(-)
diff --git a/libraries/tbl_replace_fields.inc.php b/libraries/tbl_replace_fields.inc.php index 3ba08c4..84377bf 100644 --- a/libraries/tbl_replace_fields.inc.php +++ b/libraries/tbl_replace_fields.inc.php @@ -69,44 +69,31 @@ if (false !== $possibly_uploaded_val) {
// $key contains the md5() of the fieldname if (0 === strlen($val)) { - // default - $val = "''"; - - switch ($type) { - case 'enum': - // if we have an enum, then construct the value - case 'set': - // if we have a set, then construct the value - case 'foreign': - // if we have a foreign key, then construct the value - if (! empty($_REQUEST['fields']['multi_edit'][$rownumber][$key])) { - $val = implode(',', $_REQUEST['fields']['multi_edit'][$rownumber][$key]); - $val = "'" . PMA_sqlAddslashes($val) . "'"; - } - break; - 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 - // but we can still handle field upload - - // when in UPDATE mode, do not alter field's contents. When in INSERT - // mode, insert empty field because no values were submitted. If protected - // blobs where set, insert original fields content. - if (! empty($prot_row[$me_fields_name[$key]])) { - $val = '0x' . bin2hex($prot_row[$me_fields_name[$key]]); - } else { - $val = ''; - } - - break; - default: - // best way to avoid problems in strict mode (works also in non-strict mode) - if (isset($me_auto_increment) && isset($me_auto_increment[$key])) { - $val = 'NULL'; - } - break; + // best way to avoid problems in strict mode (works also in non-strict mode) + if (isset($me_auto_increment) && isset($me_auto_increment[$key])) { + $val = 'NULL'; + } else { + $val = "''"; + } + } elseif ($type == 'set') { + if (! empty($_REQUEST['fields']['multi_edit'][$rownumber][$key])) { + $val = implode(',', $_REQUEST['fields']['multi_edit'][$rownumber][$key]); + $val = "'" . PMA_sqlAddslashes($val) . "'"; } + } elseif ($type == '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 + // but we can still handle field upload + + // when in UPDATE mode, do not alter field's contents. When in INSERT + // mode, insert empty field because no values were submitted. If protected + // blobs where set, insert original fields content. + if (! empty($prot_row[$me_fields_name[$key]])) { + $val = '0x' . bin2hex($prot_row[$me_fields_name[$key]]); + } else { + $val = ''; + } } elseif ($type == 'bit') { $val = preg_replace('/[^01]/', '0', $val); $val = "b'" . PMA_sqlAddslashes($val) . "'"; diff --git a/tbl_change.php b/tbl_change.php index 6b4446e..eaf0bc3 100644 --- a/tbl_change.php +++ b/tbl_change.php @@ -804,7 +804,7 @@ foreach ($rows as $row_id => $vrow) { echo $backup_field . "\n"; ?> <input type="hidden" name="fields_type<?php echo $field_name_appendix; ?>" value="set" /> - <select name="fields<?php echo $field_name_appendix; ?>" + <select name="fields<?php echo $field_name_appendix . '[]'; ?>" class="textfield" size="<?php echo $select_size; ?>" multiple="multiple" <?php echo $unnullify_trigger; ?>
hooks/post-receive