diff --git a/tbl_addfield.php3 b/tbl_addfield.php3 index f47bc3f40..ba5c4fbba 100755 --- a/tbl_addfield.php3 +++ b/tbl_addfield.php3 @@ -20,21 +20,21 @@ if (isset($submit)) { $query .= backquote($field_name[$i]) . ' ' . $field_type[$i]; if ($field_length[$i] != '' && !eregi('^(DATE|DATETIME|TIME|TINYBLOB|TINYTEXT|BLOB|TEXT|MEDIUMBLOB|MEDIUMTEXT|LONGBLOB|LONGTEXT)$', $field_type[$i])) { - if (get_magic_quotes_gpc()) { + if (get_magic_quotes_gpc()) { $query .= '(' . stripslashes($field_length[$i]) . ')'; - } else { + } else { $query .= '(' . $field_length[$i] . ')'; - } - } + } + } if ($field_attribute[$i] != '') { $query .= ' ' . $field_attribute[$i]; } if ($field_default[$i] != '') { - if (get_magic_quotes_gpc()) { + if (get_magic_quotes_gpc()) { $query .= ' DEFAULT \'' . sql_addslashes(stripslashes($field_default[$i])) . '\''; - } else { + } else { $query .= ' DEFAULT \'' . sql_addslashes($field_default[$i]) . '\''; - } + } } if ($field_null[$i] != '') { $query .= ' ' . $field_null[$i]; @@ -45,24 +45,24 @@ if (isset($submit)) { if ($after_field != '--end--') { // Only the first field can be added somewhere else than at the end - if ($i == 0) { - if ($after_field == '--first--') { - $query .= ' FIRST'; - } else { - if (get_magic_quotes_gpc()) { - $query .= ' AFTER ' . backquote(stripslashes(urldecode($after_field))); + if ($i == 0) { + if ($after_field == '--first--') { + $query .= ' FIRST'; + } else { + if (get_magic_quotes_gpc()) { + $query .= ' AFTER ' . backquote(stripslashes(urldecode($after_field))); } else { $query .= ' AFTER ' . backquote(urldecode($after_field)); - } - } - } else { - if (get_magic_quotes_gpc()) { - $query .= ' AFTER ' . backquote(stripslashes($field_name[$i-1])); - } else { - $query .= ' AFTER ' . backquote($field_name[$i-1]); - } - } - } + } + } + } else { + if (get_magic_quotes_gpc()) { + $query .= ' AFTER ' . backquote(stripslashes($field_name[$i-1])); + } else { + $query .= ' AFTER ' . backquote($field_name[$i-1]); + } + } + } $query .= ', ADD '; } // end for $query = ereg_replace(', ADD $', '', $query); diff --git a/tbl_alter.php3 b/tbl_alter.php3 index 3f2fa067b..9cc2bb325 100755 --- a/tbl_alter.php3 +++ b/tbl_alter.php3 @@ -13,17 +13,26 @@ require('./header.inc.php3'); * Modifications have been submitted -> updates the table */ if (isset($submit)) { + if (get_magic_quotes_gpc()) { + $field_name[0] = stripslashes($field_name[0]); + $field_default[0] = stripslashes($field_default[0]); + $field_length[0] = stripslashes($field_length[0]); + } + // Some fields have been urlencoded or double quotes have been translated // to """ in tbl_properties.php3 - $field_orig[0] = urldecode($field_orig[0]); + $field_orig[0] = urldecode($field_orig[0]); if (str_replace('"', '"', $field_orig[0]) == $field_name[0]) { $field_name[0] = $field_orig[0]; } $field_default_orig[0] = urldecode($field_default_orig[0]); if (str_replace('"', '"', $field_default_orig[0]) == $field_default[0]) { - $field_default[0] = $field_default_orig[0]; + $field_default[0] = $field_default_orig[0]; + } + $field_length_orig[0] = urldecode($field_length_orig[0]); + if (str_replace('"', '"', $field_length_orig[0]) == $field_length[0]) { + $field_length[0] = $field_length_orig[0]; } - if (!isset($query)) { $query = ''; } @@ -39,9 +48,11 @@ if (isset($submit)) { if ($field_default[0] != '') { $query .= ' DEFAULT \'' . sql_addslashes($field_default[0]) . '\''; } - $query .= ' ' . $field_null[0] . ' ' . $field_extra[0]; - if (get_magic_quotes_gpc()) { - $query = stripslashes($query); + if ($field_null[0] != '') { + $query .= ' ' . $field_null[0]; + } + if ($field_extra[0] != '') { + $query .= ' ' . $field_extra[0]; } // Optimization fix - 2 May 2001 - Robbat2 diff --git a/tbl_change.php3 b/tbl_change.php3 index e795d4176..6494213f5 100755 --- a/tbl_change.php3 +++ b/tbl_change.php3 @@ -177,56 +177,74 @@ for ($i = 0; $i < mysql_num_rows($table_def); $i++) { } } else if (strstr($row_table_def['True_Type'], 'enum')) { - $set = str_replace('enum(', '', $row_table_def['Type']); - $set = ereg_replace('\\)$', '', $set); - $set = explode('\',\'', substr($set, 1, -1)); + $enum = str_replace('enum(', '', $row_table_def['Type']); + $enum = ereg_replace('\\)$', '', $enum); + $enum = explode('\',\'', substr($enum, 1, -1)); + $enum_cnt = count($enum); + $seenchecked = 0; ?>