]> git.joonet.de Git - adminer.git/commitdiff
Plus and minus functions
authorjakubvrana <jakubvrana@7c3ca157-0c34-0410-bff1-cbf682f78f5c>
Tue, 28 Oct 2008 08:34:40 +0000 (08:34 +0000)
committerjakubvrana <jakubvrana@7c3ca157-0c34-0410-bff1-cbf682f78f5c>
Tue, 28 Oct 2008 08:34:40 +0000 (08:34 +0000)
git-svn-id: https://adminer.svn.sourceforge.net/svnroot/adminer/trunk@536 7c3ca157-0c34-0410-bff1-cbf682f78f5c

design.inc.php
editing.inc.php

index b7b50a45072efd793f706d2962c2612faf799230..332f14ad6b2ea1be69e0705888b2f9ba29cabed1 100644 (file)
@@ -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>
index f3dd183cba1c8fe543e270ba16ada1780ff0785b..a8cdb824e3a9b7dc29284c5481d9f762aef601a0 100644 (file)
@@ -22,8 +22,13 @@ 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"])) {
-                       $options = (preg_match('~char~', $field["type"]) ? array("", "md5", "sha1", "password", "uuid") : array("", "now"));
+               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) . "'";
        }