diff --git a/adminer/include/adminer.inc.php b/adminer/include/adminer.inc.php
index 7575b2a7..25965c53 100644
--- a/adminer/include/adminer.inc.php
+++ b/adminer/include/adminer.inc.php
@@ -119,6 +119,37 @@ function adminer_message_query($query) {
return call_adminer('message_query', " " . lang('SQL command') . "
', $query);
}
+/** Functions displayed in edit form
+* @param array single field from fields()
+* @return array
+*/
+function adminer_edit_functions($field) {
+ $return = array("");
+ if (!isset($_GET["default"])) {
+ if (ereg('char|date|time', $field["type"])) {
+ $return = (ereg('char', $field["type"]) ? array("", "md5", "sha1", "password", "uuid") : array("", "now")); //! JavaScript for disabling maxlength
+ }
+ if (!isset($_GET["call"]) && (isset($_GET["select"]) || where($_GET))) {
+ // relative functions
+ if (ereg('int|float|double|decimal', $field["type"])) {
+ $return = array("", "+", "-");
+ }
+ if (ereg('date', $field["type"])) {
+ $return[] = "+ interval";
+ $return[] = "- interval";
+ }
+ if (ereg('time', $field["type"])) {
+ $return[] = "addtime";
+ $return[] = "subtime";
+ }
+ }
+ }
+ if ($field["null"] || isset($_GET["default"])) {
+ array_unshift($return, "NULL");
+ }
+ return call_adminer('edit_functions', $return, $field);
+}
+
/** Prints navigation after Adminer title
* @param string can be "auth" if there is no database connection or "db" if there is no database selected
* @return bool true if default navigation should be printed
diff --git a/adminer/include/functions.inc.php b/adminer/include/functions.inc.php
index 0d84836b..ec2b46e2 100644
--- a/adminer/include/functions.inc.php
+++ b/adminer/include/functions.inc.php
@@ -286,29 +286,7 @@ function input($name, $field, $value, $function) {
} 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 (ereg('char|date|time', $field["type"])) {
- $options = (ereg('char', $field["type"]) ? array("", "md5", "sha1", "password", "uuid") : array("", "now")); //! JavaScript for disabling maxlength
- }
- if (!isset($_GET["call"]) && (isset($_GET["select"]) || where($_GET))) {
- // relative functions
- if (ereg('int|float|double|decimal', $field["type"])) {
- $options = array("", "+", "-");
- }
- if (ereg('date', $field["type"])) {
- $options[] = "+ interval";
- $options[] = "- interval";
- }
- if (ereg('time', $field["type"])) {
- $options[] = "addtime";
- $options[] = "subtime";
- }
- }
- }
- if ($field["null"] || isset($_GET["default"])) {
- array_unshift($options, "NULL");
- }
+ $options = adminer_edit_functions($field);
echo (count($options) > 1 || isset($_GET["select"]) ? '' : " ") . '';
if ($field["type"] == "set") { //! 64 bits
preg_match_all("~'((?:[^']+|'')*)'~", $field["length"], $matches);
diff --git a/editor/include/adminer.inc.php b/editor/include/adminer.inc.php
index 788adb29..ca6b1ed1 100644
--- a/editor/include/adminer.inc.php
+++ b/editor/include/adminer.inc.php
@@ -111,6 +111,10 @@ function adminer_message_query($query) {
return call_adminer('message_query', "", $query);
}
+function adminer_edit_functions($field) {
+ return call_adminer('edit_functions', array(""), $field);
+}
+
function adminer_navigation($missing) {
global $SELF;
if (call_adminer('navigation', true, $missing) && $missing != "auth") {
|