'; } preg_match_all("~'((?:[^']+|'')*)'~", $field["length"], $matches); foreach ($matches[1] as $i => $val) { $val = stripcslashes(str_replace("''", "'", $val)); $id = "field-$name-" . ($i+1); $checked = (is_int($value) ? $value == $i+1 : $value === $val); //! '' collide with NULL in $_GET["default"] echo ' '; } if ($field["null"]) { $id = "field-$name-"; echo ' '; } } elseif ($field["type"] == "set") { //! 64 bits preg_match_all("~'((?:[^']+|'')*)'~", $field["length"], $matches); foreach ($matches[1] as $i => $val) { $val = stripcslashes(str_replace("''", "'", $val)); $id = "field-$name-" . ($i+1); $checked = (is_int($value) ? ($value >> $i) & 1 : in_array($val, explode(",", $value), true)); echo ' '; } } elseif (strpos($field["type"], "text") !== false) { echo ''; } elseif (preg_match('~binary|blob~', $field["type"])) { echo (ini_get("file_uploads") ? '' : lang('File uploads are disabled.') . ' '); } else { echo ''; } if ($field["null"] && $field["type"] != "enum") { $id = "null-$name"; echo ''; } } function process_input($name, $field) { global $mysql; $name = bracket_escape($name); $value = $_POST["fields"][$name]; if ($field["type"] != "enum" && !$field["auto_increment"] ? $_POST["null"][$name] : !strlen($value)) { return "NULL"; } elseif ($field["type"] == "enum") { return (isset($_GET["default"]) ? "'" . $mysql->escape_string($value) . "'" : intval($value)); } elseif ($field["type"] == "set") { return (isset($_GET["default"]) ? "'" . implode(",", array_map(array($mysql, 'escape_string'), (array) $value)) . "'" : array_sum((array) $value)); } elseif (preg_match('~binary|blob~', $field["type"])) { $file = get_file($name); if (!is_string($file) && !$field["null"]) { return false; //! report errors, also empty $_POST (too big POST data, not only FILES) } return "_binary'" . (is_string($file) ? $mysql->escape_string($file) : "") . "'"; } elseif ($field["type"] == "timestamp" && $value == "CURRENT_TIMESTAMP") { return $value; } else { return "'" . $mysql->escape_string($value) . "'"; } } function edit_type($key, $field, $collations) { global $types, $unsigned, $inout; ?>