Hide edit functions in Editor
git-svn-id: https://adminer.svn.sourceforge.net/svnroot/adminer/trunk@881 7c3ca157-0c34-0410-bff1-cbf682f78f5c
This commit is contained in:
parent
61778f5790
commit
492123506b
|
@ -119,6 +119,37 @@ function adminer_message_query($query) {
|
||||||
return call_adminer('message_query', " <a href='#$id' onclick=\"return !toggle('$id');\">" . lang('SQL command') . "</a><div id='$id' class='hidden'><pre class='jush-sql'>" . htmlspecialchars($query) . '</pre><a href="' . htmlspecialchars($SELF . 'sql=&history=' . (count($_SESSION["history"][$_GET["server"]][$_GET["db"]]) - 1)) . '">' . lang('Edit') . '</a></div>', $query);
|
return call_adminer('message_query', " <a href='#$id' onclick=\"return !toggle('$id');\">" . lang('SQL command') . "</a><div id='$id' class='hidden'><pre class='jush-sql'>" . htmlspecialchars($query) . '</pre><a href="' . htmlspecialchars($SELF . 'sql=&history=' . (count($_SESSION["history"][$_GET["server"]][$_GET["db"]]) - 1)) . '">' . lang('Edit') . '</a></div>', $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
|
/** Prints navigation after Adminer title
|
||||||
* @param string can be "auth" if there is no database connection or "db" if there is no database selected
|
* @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
|
* @return bool true if default navigation should be printed
|
||||||
|
|
|
@ -286,29 +286,7 @@ function input($name, $field, $value, $function) {
|
||||||
} else {
|
} else {
|
||||||
$first = ($field["null"] || isset($_GET["default"])) + isset($_GET["select"]);
|
$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 . ';"' : '');
|
$onchange = ($first ? ' onchange="var f = this.form[\'function[' . addcslashes($name, "\r\n'\\") . ']\']; if (' . $first . ' > f.selectedIndex) f.selectedIndex = ' . $first . ';"' : '');
|
||||||
$options = array("");
|
$options = adminer_edit_functions($field);
|
||||||
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");
|
|
||||||
}
|
|
||||||
echo (count($options) > 1 || isset($_GET["select"]) ? '<select name="function[' . $name . ']">' . (isset($_GET["select"]) ? '<option value="orig">' . lang('original') : '') . optionlist($options, $function) . '</select>' : " ") . '<td>';
|
echo (count($options) > 1 || isset($_GET["select"]) ? '<select name="function[' . $name . ']">' . (isset($_GET["select"]) ? '<option value="orig">' . lang('original') : '') . optionlist($options, $function) . '</select>' : " ") . '<td>';
|
||||||
if ($field["type"] == "set") { //! 64 bits
|
if ($field["type"] == "set") { //! 64 bits
|
||||||
preg_match_all("~'((?:[^']+|'')*)'~", $field["length"], $matches);
|
preg_match_all("~'((?:[^']+|'')*)'~", $field["length"], $matches);
|
||||||
|
|
|
@ -111,6 +111,10 @@ function adminer_message_query($query) {
|
||||||
return call_adminer('message_query', "<!-- " . str_replace("--", "--><!--", $query) . " -->", $query);
|
return call_adminer('message_query', "<!-- " . str_replace("--", "--><!--", $query) . " -->", $query);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function adminer_edit_functions($field) {
|
||||||
|
return call_adminer('edit_functions', array(""), $field);
|
||||||
|
}
|
||||||
|
|
||||||
function adminer_navigation($missing) {
|
function adminer_navigation($missing) {
|
||||||
global $SELF;
|
global $SELF;
|
||||||
if (call_adminer('navigation', true, $missing) && $missing != "auth") {
|
if (call_adminer('navigation', true, $missing) && $missing != "auth") {
|
||||||
|
|
Loading…
Reference in a new issue