diff --git a/ChangeLog b/ChangeLog index ab7f03b03..55c8ba9a5 100755 --- a/ChangeLog +++ b/ChangeLog @@ -10,6 +10,8 @@ $Source$ the code and the results of the patch #484112. * sql.php3, lines 92 & 278; tbl_replace.php3, line 130: fixed bug #489770 - File name too long in tbl_replace.php. + * tbl_printview.php3; tbl_properties.php3; tbl_properties.inc.php3: fixed + bug #489440 - enum fields in tbl_properties.php. 2001-12-05 Loïc Chapeaux * lang/japanese.inc.php3; lang/bulgarian-*.inc.php3: completed thanks to diff --git a/tbl_printview.php3 b/tbl_printview.php3 index 755798c0e..b82962573 100755 --- a/tbl_printview.php3 +++ b/tbl_printview.php3 @@ -38,7 +38,7 @@ mysql_select_db($db); * Multi-tables printview thanks to Christophe Gesché from the "MySQL Form * Generator for PHPMyAdmin" (http://sourceforge.net/projects/phpmysqlformgen/) */ -if (is_array($selected_tbl)) { +if (isset($selected_tbl) && is_array($selected_tbl)) { $the_tables = $selected_tbl; } else if (isset($table)) { $the_tables[] = $table; @@ -163,11 +163,11 @@ while (list($key, $table) = each($the_tables)) { $type = $row['Type']; // reformat mysql query output - staybyte - 9. June 2001 - $shorttype = substr($type, 0, 3); - if ($shorttype == 'set' || $shorttype == 'enu') { - $type = eregi_replace(',', ', ', $type); - // Removes automatic MySQL escape format - $type = str_replace('\'\'', '\\\'', $type); + // loic1: set or enum types: slashes single quotes inside options + if (eregi('^(set|enum)\((.+)\)$', $type, $tmp)) { + $tmp[2] = ereg_replace('([^,])\'([^,])', '\\1\\\'\\2', ',' . $tmp[2] . ','); + $tmp[2] = substr($tmp[2], 1, -1); + $type = $tmp[1] . '(' . str_replace(',', ', ', $tmp[2]) . ')'; $type_nowrap = ''; } else { $type_nowrap = ' nowrap="nowrap"'; diff --git a/tbl_properties.inc.php3 b/tbl_properties.inc.php3 index 580ddbab1..6655fe868 100755 --- a/tbl_properties.inc.php3 +++ b/tbl_properties.inc.php3 @@ -87,24 +87,30 @@ for ($i = 0 ; $i < $num_fields; $i++) { $type = eregi_replace('BINARY', '', $type); $type = eregi_replace('ZEROFILL', '', $type); $type = eregi_replace('UNSIGNED', '', $type); - $length = $type; - $type = chop(eregi_replace('\\(.*\\)', '', $type)); - if (!empty($type)) { - $length = eregi_replace("^$type\(", '', $length); - $length = eregi_replace('\)$', '', trim($length)); - } - // Removes automatic MySQL escape format - $length = str_replace('\'\'', '\\\'', $length); - if ($length == $type) { - $length = ''; - } + // set or enum types: slashes single quotes inside options + if (eregi('^(set|enum)\((.+)\)$', $type, $tmp)) { + $type = $tmp[1]; + $length = ereg_replace('([^,])\'([^,])', '\\1\\\'\\2', ',' . $tmp[2] . ','); + $length = substr($length, 1, -1); + } else { + $length = $type; + $type = chop(eregi_replace('\\(.*\\)', '', $type)); + if (!empty($type)) { + $length = eregi_replace("^$type\(", '', $length); + $length = eregi_replace('\)$', '', trim($length)); + } + if ($length == $type) { + $length = ''; + } + } // end if else + for ($j = 0; $j < count($cfgColumnTypes); $j++) { echo ' \n"; - } + } // end for ?> diff --git a/tbl_properties.php3 b/tbl_properties.php3 index 61c33dcf0..d232eabbc 100755 --- a/tbl_properties.php3 +++ b/tbl_properties.php3 @@ -253,11 +253,11 @@ while ($row = mysql_fetch_array($fields_rs)) { $type = $row['Type']; // reformat mysql query output - staybyte - 9. June 2001 - $shorttype = substr($type, 0, 3); - if ($shorttype == 'set' || $shorttype == 'enu') { - $type = eregi_replace(',', ', ', $type); - // Removes automatic MySQL escape format - $type = str_replace('\'\'', '\\\'', $type); + // loic1: set or enum types: slashes single quotes inside options + if (eregi('^(set|enum)\((.+)\)$', $type, $tmp)) { + $tmp[2] = ereg_replace('([^,])\'([^,])', '\\1\\\'\\2', ',' . $tmp[2] . ','); + $tmp[2] = substr($tmp[2], 1, -1); + $type = $tmp[1] . '(' . str_replace(',', ', ', $tmp[2]) . ')'; $type_nowrap = ''; } else { $type_nowrap = ' nowrap="nowrap"';