mirror of
https://github.com/vrana/adminer.git
synced 2025-08-08 07:36:44 +02:00
Rename functions for settings stored in a cookie
This commit is contained in:
@@ -30,7 +30,7 @@ if ($row["auto_increment_col"]) {
|
||||
}
|
||||
|
||||
if ($_POST) {
|
||||
set_adminer_settings(array("comments" => $_POST["comments"], "defaults" => $_POST["defaults"]));
|
||||
save_settings(array("comments" => $_POST["comments"], "defaults" => $_POST["defaults"]));
|
||||
}
|
||||
|
||||
if ($_POST && !process_fields($row["fields"]) && !$error) {
|
||||
@@ -203,9 +203,9 @@ foreach ($engines as $engine) {
|
||||
</div>
|
||||
<p>
|
||||
<?php echo lang('Auto Increment'); ?>: <input type="number" name="Auto_increment" class="size" value="<?php echo h($row["Auto_increment"]); ?>">
|
||||
<?php echo checkbox("defaults", 1, ($_POST ? $_POST["defaults"] : adminer_setting("defaults")), lang('Default values'), "columnShow(this.checked, 5)", "jsonly"); ?>
|
||||
<?php echo checkbox("defaults", 1, ($_POST ? $_POST["defaults"] : get_setting("defaults")), lang('Default values'), "columnShow(this.checked, 5)", "jsonly"); ?>
|
||||
<?php
|
||||
$comments = ($_POST ? $_POST["comments"] : adminer_setting("comments"));
|
||||
$comments = ($_POST ? $_POST["comments"] : get_setting("comments"));
|
||||
echo (support("comment")
|
||||
? checkbox("comments", 1, $comments, lang('Comment'), "editingCommentsClick(this, true);", "jsonly")
|
||||
. ' ' . (preg_match('~\n~', $row["Comment"])
|
||||
|
@@ -4,7 +4,7 @@ namespace Adminer;
|
||||
$TABLE = $_GET["dump"];
|
||||
|
||||
if ($_POST && !$error) {
|
||||
set_adminer_settings(
|
||||
save_settings(
|
||||
array_intersect_key($_POST, array_flip(array("output", "format", "db_style", "types", "routines", "events", "table_style", "auto_increment", "triggers", "data_style"))),
|
||||
"adminer_export"
|
||||
);
|
||||
@@ -155,7 +155,7 @@ $data_style = array('', 'TRUNCATE+INSERT', 'INSERT');
|
||||
if (JUSH == "sql") { //! use insertUpdate() in all drivers
|
||||
$data_style[] = 'INSERT+UPDATE';
|
||||
}
|
||||
$row = adminer_settings("adminer_export");
|
||||
$row = get_settings("adminer_export");
|
||||
if (!$row) {
|
||||
$row = array("output" => "text", "format" => "sql", "db_style" => (DB != "" ? "" : "CREATE"), "table_style" => "DROP+CREATE", "data_style" => "INSERT");
|
||||
}
|
||||
|
@@ -124,7 +124,7 @@ function referencable_primary($self) {
|
||||
* @param string
|
||||
* @return array
|
||||
*/
|
||||
function adminer_settings($cookie) {
|
||||
function get_settings($cookie) {
|
||||
parse_str($_COOKIE[$cookie], $settings);
|
||||
return $settings;
|
||||
}
|
||||
@@ -134,8 +134,8 @@ function adminer_settings($cookie) {
|
||||
* @param string
|
||||
* @return mixed
|
||||
*/
|
||||
function adminer_setting($key, $cookie = "adminer_settings") {
|
||||
$settings = adminer_settings($cookie);
|
||||
function get_setting($key, $cookie = "adminer_settings") {
|
||||
$settings = get_settings($cookie);
|
||||
return $settings[$key];
|
||||
}
|
||||
|
||||
@@ -144,8 +144,8 @@ function adminer_setting($key, $cookie = "adminer_settings") {
|
||||
* @param string
|
||||
* @return bool
|
||||
*/
|
||||
function set_adminer_settings($settings, $cookie = "adminer_settings") {
|
||||
return cookie($cookie, http_build_query($settings + adminer_settings($cookie)));
|
||||
function save_settings($settings, $cookie = "adminer_settings") {
|
||||
return cookie($cookie, http_build_query($settings + get_settings($cookie)));
|
||||
}
|
||||
|
||||
/** Print SQL <textarea> tag
|
||||
@@ -353,8 +353,8 @@ function type_class($type) {
|
||||
function edit_fields($fields, $collations, $type = "TABLE", $foreign_keys = array()) {
|
||||
global $driver;
|
||||
$fields = array_values($fields);
|
||||
$default_class = (($_POST ? $_POST["defaults"] : adminer_setting("defaults")) ? "" : " class='hidden'");
|
||||
$comment_class = (($_POST ? $_POST["comments"] : adminer_setting("comments")) ? "" : " class='hidden'");
|
||||
$default_class = (($_POST ? $_POST["defaults"] : get_setting("defaults")) ? "" : " class='hidden'");
|
||||
$comment_class = (($_POST ? $_POST["comments"] : get_setting("comments")) ? "" : " class='hidden'");
|
||||
?>
|
||||
<thead><tr>
|
||||
<?php echo ($type == "PROCEDURE" ? "<td>" : ""); ?>
|
||||
|
@@ -19,7 +19,7 @@ if (JUSH == "mongo") { // doesn't support primary key
|
||||
}
|
||||
$row = $_POST;
|
||||
if ($row) {
|
||||
set_adminer_settings(array("index_options" => $row["options"]));
|
||||
save_settings(array("index_options" => $row["options"]));
|
||||
}
|
||||
if ($_POST && !$error && !$_POST["add"] && !$_POST["drop_col"]) {
|
||||
$alter = array();
|
||||
@@ -97,7 +97,7 @@ if (!$row) {
|
||||
$row["indexes"] = $indexes;
|
||||
}
|
||||
$lengths = (JUSH == "sql" || JUSH == "mssql");
|
||||
$show_options = ($_POST ? $_POST["options"] : adminer_setting("index_options"));
|
||||
$show_options = ($_POST ? $_POST["options"] : get_setting("index_options"));
|
||||
?>
|
||||
|
||||
<form action="" method="post">
|
||||
|
@@ -7,7 +7,7 @@ $indexes = indexes($TABLE);
|
||||
$fields = fields($TABLE);
|
||||
$foreign_keys = column_foreign_keys($TABLE);
|
||||
$oid = $table_status["Oid"];
|
||||
$adminer_import = adminer_settings("adminer_import");
|
||||
$adminer_import = get_settings("adminer_import");
|
||||
|
||||
$rights = array(); // privilege => 0
|
||||
$columns = array(); // selectable columns
|
||||
@@ -83,7 +83,7 @@ if ($_POST && !$error) {
|
||||
}
|
||||
$where_check = ($where_check ? "\nWHERE " . implode(" AND ", $where_check) : "");
|
||||
if ($_POST["export"]) {
|
||||
set_adminer_settings(array("output" => $_POST["output"], "format" => $_POST["format"]), "adminer_import");
|
||||
save_settings(array("output" => $_POST["output"], "format" => $_POST["format"]), "adminer_import");
|
||||
dump_headers($TABLE);
|
||||
$adminer->dumpTable($TABLE, "");
|
||||
$from = ($select ? implode(", ", $select) : "*")
|
||||
@@ -195,7 +195,7 @@ if ($_POST && !$error) {
|
||||
} elseif (!preg_match('~~u', $file)) {
|
||||
$error = lang('File must be in UTF-8 encoding.');
|
||||
} else {
|
||||
set_adminer_settings(array("output" => $adminer_import["output"], "format" => $_POST["separator"]), "adminer_import");
|
||||
save_settings(array("output" => $adminer_import["output"], "format" => $_POST["separator"]), "adminer_import");
|
||||
$result = true;
|
||||
$cols = array_keys($fields);
|
||||
preg_match_all('~(?>"[^"]*"|[^"\r\n]+)+~', $file, $matches);
|
||||
|
@@ -2,7 +2,7 @@
|
||||
namespace Adminer;
|
||||
|
||||
if (!$error && $_POST["export"]) {
|
||||
set_adminer_settings(array("output" => $_POST["output"], "format" => $_POST["format"]), "adminer_import");
|
||||
save_settings(array("output" => $_POST["output"], "format" => $_POST["format"]), "adminer_import");
|
||||
dump_headers("sql");
|
||||
$adminer->dumpTable("", "");
|
||||
$adminer->dumpData("", "table", $_POST["query"]);
|
||||
@@ -65,7 +65,7 @@ if (!$error && $_POST) {
|
||||
$errors = array();
|
||||
$parse = '[\'"' . (JUSH == "sql" ? '`#' : (JUSH == "sqlite" ? '`[' : (JUSH == "mssql" ? '[' : ''))) . ']|/\*|-- |$' . (JUSH == "pgsql" ? '|\$[^$]*\$' : '');
|
||||
$total_start = microtime(true);
|
||||
$adminer_export = adminer_settings("adminer_import"); // this doesn't offer SQL export so we match the import/export style at select
|
||||
$adminer_export = get_settings("adminer_import"); // this doesn't offer SQL export so we match the import/export style at select
|
||||
$dump_format = $adminer->dumpFormat();
|
||||
unset($dump_format["sql"]);
|
||||
|
||||
|
Reference in New Issue
Block a user