' . lang('original') . ''; } if ($field["null"] || isset($_GET["default"])) { echo ' '; } if (!isset($_GET["default"])) { echo ''; } preg_match_all("~'((?:[^']+|'')*)'~", $field["length"], $matches); foreach ($matches[1] as $i => $val) { $val = stripcslashes(str_replace("''", "'", $val)); $checked = (is_int($value) ? $value == $i+1 : $value === $val); echo ' '; } } else { $first = ($field["null"] || isset($_GET["default"])) + isset($_GET["select"]); $onchange = ($first ? ' onchange="var f = this.form[\'function[' . addcslashes($name, "\r\n'\\") . ']\']; if (' . $first . ' > f.selectedIndex) f.selectedIndex = ' . $first . ';"' : ''); $options = array(""); if (!isset($_GET["default"])) { if (preg_match('~char|date|time~', $field["type"])) { $options = (preg_match('~char~', $field["type"]) ? array("", "md5", "sha1", "password", "uuid") : array("", "now")); } if (!isset($_GET["clone"]) && !isset($_GET["call"]) && preg_match('~int|float|double|decimal~', $field["type"])) { $options = array("", "+", "-"); } } if ($field["null"] || isset($_GET["default"])) { array_unshift($options, "NULL"); } if (count($options) > 1 || isset($_GET["select"])) { echo ''; } if ($field["type"] == "set") { //! 64 bits preg_match_all("~'((?:[^']+|'')*)'~", $field["length"], $matches); foreach ($matches[1] as $i => $val) { $val = stripcslashes(str_replace("''", "'", $val)); $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 { $maxlength = (!ereg('int', $field["type"]) && preg_match('~^([0-9]+)(,([0-9]+))?$~', $field["length"], $match) ? ($match[1] + ($match[3] ? 1 : 0) + ($match[2] && !$field["unsigned"] ? 1 : 0)) : ($types[$field["type"]] ? $types[$field["type"]] + ($field["unsigned"] ? 0 : 1) : 0)); echo ''; } } } function process_input($name, $field) { global $dbh; $idf = bracket_escape($name); $function = $_POST["function"][$idf]; $value = $_POST["fields"][$idf]; if ($field["type"] == "enum" ? $value == -1 : $function == "orig") { return false; } elseif ($field["type"] == "enum" || $field["auto_increment"] ? !strlen($value) : $function == "NULL") { return "NULL"; } elseif ($field["type"] == "enum") { return (isset($_GET["default"]) ? "'" . $dbh->escape_string($value) . "'" : intval($value)); } elseif ($field["type"] == "set") { return (isset($_GET["default"]) ? "'" . implode(",", array_map(array($dbh, 'escape_string'), (array) $value)) . "'" : array_sum((array) $value)); } elseif (preg_match('~binary|blob~', $field["type"])) { $file = get_file($idf); if (!is_string($file)) { return false; //! report errors } return "_binary'" . (is_string($file) ? $dbh->escape_string($file) : "") . "'"; } elseif ($field["type"] == "timestamp" && $value == "CURRENT_TIMESTAMP") { return $value; } elseif (preg_match('~^(now|uuid)$~', $function)) { return "$function()"; } elseif (preg_match('~^(\\+|-)$~', $function)) { return idf_escape($name) . " $function '" . $dbh->escape_string($value) . "'"; } elseif (preg_match('~^(md5|sha1|password)$~', $function)) { return "$function('" . $dbh->escape_string($value) . "')"; } else { return "'" . $dbh->escape_string($value) . "'"; } } function edit_type($key, $field, $collations) { global $types, $unsigned, $inout; ?> " size="3" /> ' . optionlist($collations, $field["collation"]) . '' . ($unsigned ? " ' : ''); ?> escape_string($field["collation"]) . "'" : "") ; } function edit_fields($fields, $collations, $type = "TABLE", $allowed = 0) { global $inout; $column_comments = false; foreach ($fields as $field) { if (strlen($field["comment"])) { $column_comments = true; } } ?>