Patch for the bug #449858 (PHP3 compatible)
This commit is contained in:
@@ -18,7 +18,8 @@ if (isset($submit)) {
|
|||||||
// Builds the field creation statement and alters the table
|
// Builds the field creation statement and alters the table
|
||||||
for ($i = 0; $i < count($field_name); ++$i) {
|
for ($i = 0; $i < count($field_name); ++$i) {
|
||||||
$query .= backquote($field_name[$i]) . ' ' . $field_type[$i];
|
$query .= backquote($field_name[$i]) . ' ' . $field_type[$i];
|
||||||
if ($field_length[$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]) . ')';
|
$query .= '(' . stripslashes($field_length[$i]) . ')';
|
||||||
} else {
|
} else {
|
||||||
|
@@ -27,35 +27,19 @@ if (isset($submit)) {
|
|||||||
if (!isset($query)) {
|
if (!isset($query)) {
|
||||||
$query = '';
|
$query = '';
|
||||||
}
|
}
|
||||||
$query .= ' ' . backquote($field_orig[0]) . ' ' . backquote($field_name[0]) . ' ' . $field_type[0] . ' ';
|
$query .= ' ' . backquote($field_orig[0]) . ' ' . backquote($field_name[0]) . ' ' . $field_type[0];
|
||||||
// Some field types shouldn't have lengths
|
// Some field types shouldn't have lengths
|
||||||
switch (strtoupper($field_type[0]))
|
if ($field_length[0] != ''
|
||||||
{
|
&& !eregi('^(DATE|DATETIME|TIME|TINYBLOB|TINYTEXT|BLOB|TEXT|MEDIUMBLOB|MEDIUMTEXT|LONGBLOB|LONGTEXT)$', $field_type[0])) {
|
||||||
case 'DATE':
|
$query .= '(' . $field_length[0] . ')';
|
||||||
case 'DATETIME':
|
}
|
||||||
case 'TIME':
|
|
||||||
case 'TINYBLOB':
|
|
||||||
case 'TINYTEXT':
|
|
||||||
case 'BLOB':
|
|
||||||
case 'TEXT':
|
|
||||||
case 'MEDIUMBLOB':
|
|
||||||
case 'MEDIUMTEXT':
|
|
||||||
case 'LONGBLOB':
|
|
||||||
case 'LONGTEXT':
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
if ($field_length[0] != '') {
|
|
||||||
$query .= '(' . $field_length[0] . ') ';
|
|
||||||
};
|
|
||||||
};
|
|
||||||
if ($field_attribute[0] != '') {
|
if ($field_attribute[0] != '') {
|
||||||
$query .= $field_attribute[0] . ' ';
|
$query .= ' ' . $field_attribute[0];
|
||||||
}
|
}
|
||||||
if ($field_default[0] != '') {
|
if ($field_default[0] != '') {
|
||||||
$query .= 'DEFAULT \'' . sql_addslashes($field_default[0]) . '\' ';
|
$query .= ' DEFAULT \'' . sql_addslashes($field_default[0]) . '\'';
|
||||||
}
|
}
|
||||||
$query .= $field_null[0] . ' ' . $field_extra[0];
|
$query .= ' ' . $field_null[0] . ' ' . $field_extra[0];
|
||||||
if (get_magic_quotes_gpc()) {
|
if (get_magic_quotes_gpc()) {
|
||||||
$query = stripslashes($query);
|
$query = stripslashes($query);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user