Plus and minus functions
git-svn-id: https://adminer.svn.sourceforge.net/svnroot/adminer/trunk@536 7c3ca157-0c34-0410-bff1-cbf682f78f5c
This commit is contained in:
parent
ba5220ae66
commit
8c51ca2e53
|
@ -9,7 +9,7 @@ function page_header($title, $error = "", $breadcrumb = array(), $title2 = "") {
|
|||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
||||
<meta name="robots" content="noindex" />
|
||||
<title><?php echo $title . (strlen($title2) ? ": " . htmlspecialchars($title2) : "") . " - " . lang('phpMinAdmin') . " 1.9.1-dev"; ?></title>
|
||||
<title><?php echo $title . (strlen($title2) ? ": " . htmlspecialchars($title2) : "") . " - " . lang('phpMinAdmin') . " 1.9.2-dev"; ?></title>
|
||||
<link rel="shortcut icon" type="image/x-icon" href="favicon.ico" />
|
||||
<link rel="stylesheet" type="text/css" href="default.css" /><?php // Ondrej Valka, http://valka.info ?>
|
||||
</head>
|
||||
|
|
|
@ -22,9 +22,14 @@ function input($name, $field, $value) {
|
|||
$first = $field["null"] + 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"]) && preg_match('~char|date|time~', $field["type"])) {
|
||||
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"]) && preg_match('~int|float|double|decimal~', $field["type"])) {
|
||||
$options = array("", "+", "-");
|
||||
}
|
||||
}
|
||||
if ($field["null"]) {
|
||||
array_unshift($options, "NULL");
|
||||
}
|
||||
|
@ -51,10 +56,11 @@ function input($name, $field, $value) {
|
|||
function process_input($name, $field) {
|
||||
global $mysql;
|
||||
$idf = bracket_escape($name);
|
||||
$function = $_POST["function"][$idf];
|
||||
$value = $_POST["fields"][$idf];
|
||||
if ($field["type"] == "enum" ? $value == -1 : $_POST["function"][$idf] == "orig") {
|
||||
if ($field["type"] == "enum" ? $value == -1 : $function == "orig") {
|
||||
return false;
|
||||
} elseif ($field["type"] == "enum" || $field["auto_increment"] ? !strlen($value) : $_POST["function"][$idf] == "NULL") {
|
||||
} elseif ($field["type"] == "enum" || $field["auto_increment"] ? !strlen($value) : $function == "NULL") {
|
||||
return "NULL";
|
||||
} elseif ($field["type"] == "enum") {
|
||||
return (isset($_GET["default"]) ? "'" . $mysql->escape_string($value) . "'" : intval($value));
|
||||
|
@ -68,10 +74,12 @@ function process_input($name, $field) {
|
|||
return "_binary'" . (is_string($file) ? $mysql->escape_string($file) : "") . "'";
|
||||
} elseif ($field["type"] == "timestamp" && $value == "CURRENT_TIMESTAMP") {
|
||||
return $value;
|
||||
} elseif (preg_match('~^(now|uuid)$~', $_POST["function"][$idf])) {
|
||||
return $_POST["function"][$idf] . "()";
|
||||
} elseif (preg_match('~^(md5|sha1|password)$~', $_POST["function"][$idf])) {
|
||||
return $_POST["function"][$idf] . "('" . $mysql->escape_string($value) . "')";
|
||||
} elseif (preg_match('~^(now|uuid)$~', $function)) {
|
||||
return "$function()";
|
||||
} elseif (preg_match('~^(\\+|-)$~', $function)) {
|
||||
return idf_escape($name) . " $function '" . $mysql->escape_string($value) . "'";
|
||||
} elseif (preg_match('~^(md5|sha1|password)$~', $function)) {
|
||||
return "$function('" . $mysql->escape_string($value) . "')";
|
||||
} else {
|
||||
return "'" . $mysql->escape_string($value) . "'";
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue