mirror of
https://github.com/vrana/adminer.git
synced 2025-08-15 02:54:28 +02:00
Move functions unused in Editor
This commit is contained in:
@@ -1,4 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
// This file is not used in Adminer Editor.
|
||||||
|
|
||||||
/** Print select result
|
/** Print select result
|
||||||
* @param Min_Result
|
* @param Min_Result
|
||||||
* @param Min_DB connection to examine indexes
|
* @param Min_DB connection to examine indexes
|
||||||
@@ -162,6 +164,41 @@ function textarea($name, $value, $rows = 10, $cols = 80) {
|
|||||||
echo "</textarea>";
|
echo "</textarea>";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Generate HTML <select> or <input> if $options are empty
|
||||||
|
* @param string
|
||||||
|
* @param array
|
||||||
|
* @param string
|
||||||
|
* @param string
|
||||||
|
* @param string
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
function select_input($attrs, $options, $value = "", $onchange = "", $placeholder = "") {
|
||||||
|
$tag = ($options ? "select" : "input");
|
||||||
|
return "<$tag$attrs" . ($options
|
||||||
|
? "><option value=''>$placeholder" . optionlist($options, $value, true) . "</select>"
|
||||||
|
: " size='10' value='" . h($value) . "' placeholder='$placeholder'>"
|
||||||
|
) . ($onchange ? script("qsl('$tag').onchange = $onchange;", "") : ""); //! use oninput for input
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Print one row in JSON object
|
||||||
|
* @param string or "" to close the object
|
||||||
|
* @param string
|
||||||
|
* @return null
|
||||||
|
*/
|
||||||
|
function json_row($key, $val = null) {
|
||||||
|
static $first = true;
|
||||||
|
if ($first) {
|
||||||
|
echo "{";
|
||||||
|
}
|
||||||
|
if ($key != "") {
|
||||||
|
echo ($first ? "" : ",") . "\n\t\"" . addcslashes($key, "\r\n\t\"\\/") . '": ' . ($val !== null ? '"' . addcslashes($val, "\r\n\"\\/") . '"' : 'null');
|
||||||
|
$first = false;
|
||||||
|
} else {
|
||||||
|
echo "\n}\n";
|
||||||
|
$first = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/** Print table columns for type edit
|
/** Print table columns for type edit
|
||||||
* @param string
|
* @param string
|
||||||
* @param array
|
* @param array
|
||||||
@@ -189,6 +226,22 @@ echo optionlist(array_merge($extra_types, $structured_types), $type);
|
|||||||
echo ($foreign_keys ? "<select name='" . h($key) . "[on_delete]'" . (preg_match("~`~", $type) ? "" : " class='hidden'") . "><option value=''>(" . lang('ON DELETE') . ")" . optionlist(explode("|", $on_actions), $field["on_delete"]) . "</select> " : " "); // space for IE
|
echo ($foreign_keys ? "<select name='" . h($key) . "[on_delete]'" . (preg_match("~`~", $type) ? "" : " class='hidden'") . "><option value=''>(" . lang('ON DELETE') . ")" . optionlist(explode("|", $on_actions), $field["on_delete"]) . "</select> " : " "); // space for IE
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Get partition info
|
||||||
|
* @param string
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
function get_partitions_info($table) {
|
||||||
|
global $connection;
|
||||||
|
$from = "FROM information_schema.PARTITIONS WHERE TABLE_SCHEMA = " . q(DB) . " AND TABLE_NAME = " . q($table);
|
||||||
|
$result = $connection->query("SELECT PARTITION_METHOD, PARTITION_EXPRESSION, PARTITION_ORDINAL_POSITION $from ORDER BY PARTITION_ORDINAL_POSITION DESC LIMIT 1");
|
||||||
|
$return = array();
|
||||||
|
list($return["partition_by"], $return["partition"], $return["partitions"]) = $result->fetch_row();
|
||||||
|
$partitions = get_key_vals("SELECT PARTITION_NAME, PARTITION_DESCRIPTION $from AND PARTITION_NAME != '' ORDER BY PARTITION_ORDINAL_POSITION");
|
||||||
|
$return["partition_names"] = array_keys($partitions);
|
||||||
|
$return["partition_values"] = array_values($partitions);
|
||||||
|
return $return;
|
||||||
|
}
|
||||||
|
|
||||||
/** Filter length value including enums
|
/** Filter length value including enums
|
||||||
* @param string
|
* @param string
|
||||||
* @return string
|
* @return string
|
||||||
@@ -225,7 +278,6 @@ function process_field($field, $type_field) {
|
|||||||
if ($field["on_update"]) {
|
if ($field["on_update"]) {
|
||||||
$field["on_update"] = str_ireplace("current_timestamp()", "CURRENT_TIMESTAMP", $field["on_update"]);
|
$field["on_update"] = str_ireplace("current_timestamp()", "CURRENT_TIMESTAMP", $field["on_update"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
return array(
|
return array(
|
||||||
idf_escape(trim($field["field"])),
|
idf_escape(trim($field["field"])),
|
||||||
process_type($type_field),
|
process_type($type_field),
|
||||||
|
@@ -1,4 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
// This file is used both in Adminer and Adminer Editor.
|
||||||
|
|
||||||
/** Get database connection
|
/** Get database connection
|
||||||
* @return Min_DB
|
* @return Min_DB
|
||||||
*/
|
*/
|
||||||
@@ -232,22 +234,6 @@ function html_select($name, $options, $value = "", $onchange = true, $labelled_b
|
|||||||
return $return;
|
return $return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Generate HTML <select> or <input> if $options are empty
|
|
||||||
* @param string
|
|
||||||
* @param array
|
|
||||||
* @param string
|
|
||||||
* @param string
|
|
||||||
* @param string
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
function select_input($attrs, $options, $value = "", $onchange = "", $placeholder = "") {
|
|
||||||
$tag = ($options ? "select" : "input");
|
|
||||||
return "<$tag$attrs" . ($options
|
|
||||||
? "><option value=''>$placeholder" . optionlist($options, $value, true) . "</select>"
|
|
||||||
: " size='10' value='" . h($value) . "' placeholder='$placeholder'>"
|
|
||||||
) . ($onchange ? script("qsl('$tag').onchange = $onchange;", "") : ""); //! use oninput for input
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Get onclick confirmation
|
/** Get onclick confirmation
|
||||||
* @param string
|
* @param string
|
||||||
* @param string
|
* @param string
|
||||||
@@ -300,25 +286,6 @@ function js_escape($string) {
|
|||||||
return addcslashes($string, "\r\n'\\/"); // slash for <script>
|
return addcslashes($string, "\r\n'\\/"); // slash for <script>
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Print one row in JSON object
|
|
||||||
* @param string or "" to close the object
|
|
||||||
* @param string
|
|
||||||
* @return null
|
|
||||||
*/
|
|
||||||
function json_row($key, $val = null) {
|
|
||||||
static $first = true;
|
|
||||||
if ($first) {
|
|
||||||
echo "{";
|
|
||||||
}
|
|
||||||
if ($key != "") {
|
|
||||||
echo ($first ? "" : ",") . "\n\t\"" . addcslashes($key, "\r\n\t\"\\/") . '": ' . ($val !== null ? '"' . addcslashes($val, "\r\n\"\\/") . '"' : 'null');
|
|
||||||
$first = false;
|
|
||||||
} else {
|
|
||||||
echo "\n}\n";
|
|
||||||
$first = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Get INI boolean value
|
/** Get INI boolean value
|
||||||
* @param string
|
* @param string
|
||||||
* @return bool
|
* @return bool
|
||||||
@@ -1115,22 +1082,6 @@ function search_tables() {
|
|||||||
echo ($sep ? "<p class='message'>" . lang('No tables.') : "</ul>") . "\n";
|
echo ($sep ? "<p class='message'>" . lang('No tables.') : "</ul>") . "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param string
|
|
||||||
* @return array
|
|
||||||
*/
|
|
||||||
function get_partitions_info($table) {
|
|
||||||
global $connection;
|
|
||||||
$from = "FROM information_schema.PARTITIONS WHERE TABLE_SCHEMA = " . q(DB) . " AND TABLE_NAME = " . q($table);
|
|
||||||
$result = $connection->query("SELECT PARTITION_METHOD, PARTITION_EXPRESSION, PARTITION_ORDINAL_POSITION $from ORDER BY PARTITION_ORDINAL_POSITION DESC LIMIT 1");
|
|
||||||
$info = array();
|
|
||||||
list($info["partition_by"], $info["partition"], $info["partitions"]) = $result->fetch_row();
|
|
||||||
$partitions = get_key_vals("SELECT PARTITION_NAME, PARTITION_DESCRIPTION $from AND PARTITION_NAME != '' ORDER BY PARTITION_ORDINAL_POSITION");
|
|
||||||
$info["partition_names"] = array_keys($partitions);
|
|
||||||
$info["partition_values"] = array_values($partitions);
|
|
||||||
return $info;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Send headers for export
|
/** Send headers for export
|
||||||
* @param string
|
* @param string
|
||||||
* @param bool
|
* @param bool
|
||||||
@@ -1458,7 +1409,6 @@ function edit_form($table, $fields, $row, $update) {
|
|||||||
echo "<p class='error'>" . lang('You have no privileges to update this table.') . "\n";
|
echo "<p class='error'>" . lang('You have no privileges to update this table.') . "\n";
|
||||||
} else {
|
} else {
|
||||||
echo "<table cellspacing='0' class='layout'>" . script("qsl('table').onkeydown = editingKeydown;");
|
echo "<table cellspacing='0' class='layout'>" . script("qsl('table').onkeydown = editingKeydown;");
|
||||||
|
|
||||||
foreach ($fields as $name => $field) {
|
foreach ($fields as $name => $field) {
|
||||||
echo "<tr><th>" . $adminer->fieldName($field);
|
echo "<tr><th>" . $adminer->fieldName($field);
|
||||||
$default = $_GET["set"][bracket_escape($name)];
|
$default = $_GET["set"][bracket_escape($name)];
|
||||||
|
Reference in New Issue
Block a user