1
0
mirror of https://github.com/vrana/adminer.git synced 2025-08-15 11:04:02 +02:00

Use prefix for cookies

git-svn-id: https://adminer.svn.sourceforge.net/svnroot/adminer/trunk@731 7c3ca157-0c34-0410-bff1-cbf682f78f5c
This commit is contained in:
jakubvrana
2009-06-21 23:31:12 +00:00
parent b57f0de628
commit b8ef9fb908
6 changed files with 20 additions and 20 deletions

View File

@@ -64,7 +64,7 @@ if ($_POST && !$error && !$_POST["add"] && !$_POST["drop_col"] && !$_POST["up"]
query_redirect("ALTER TABLE " . idf_escape($_GET["create"]) . implode(",", $fields) . ",\nRENAME TO " . idf_escape($_POST["name"]) . ",\n$status", $location, lang('Table has been altered.'));
} else {
$path = preg_replace('~\\?.*~', '', $_SERVER["REQUEST_URI"]);
setcookie("Engine", $_POST["Engine"], strtotime("+1 month"), $path);
setcookie("adminer_engine", $_POST["Engine"], strtotime("+1 month"), $path);
query_redirect("CREATE TABLE " . idf_escape($_POST["name"]) . " (" . implode(",", $fields) . "\n) $status", $location, lang('Table has been created.'));
}
}
@@ -108,7 +108,7 @@ if ($_POST) {
}
} else {
$row = array(
"Engine" => $_COOKIE["Engine"],
"Engine" => $_COOKIE["adminer_engine"],
"fields" => array(array("field" => "")),
"partition_names" => array(""),
);

View File

@@ -254,6 +254,6 @@ function schema_mouseup(ev) {
for (var key in table_pos) {
s += '_' + key + ':' + Math.round(table_pos[key][0] * 10000) / 10000 + 'x' + Math.round(table_pos[key][1] * 10000) / 10000;
}
document.cookie = 'schema=' + encodeURIComponent(s.substr(1)) + '; expires=' + date + '; path=' + location.pathname + location.search;
document.cookie = 'adminer_schema=' + encodeURIComponent(s.substr(1)) + '; expires=' + date + '; path=' + location.pathname + location.search;
}
}

View File

@@ -39,14 +39,14 @@ function switch_lang() {
}
if (isset($_GET["lang"])) {
$_COOKIE["lang"] = $_GET["lang"];
$_COOKIE["adminer_lang"] = $_GET["lang"];
$_SESSION["lang"] = $_GET["lang"]; // cookies may be disabled
}
$LANG = "en";
if (isset($langs[$_COOKIE["lang"]])) {
setcookie("lang", $_GET["lang"], strtotime("+1 month"), preg_replace('~\\?.*~', '', $_SERVER["REQUEST_URI"]));
$LANG = $_COOKIE["lang"];
if (isset($langs[$_COOKIE["adminer_lang"]])) {
setcookie("adminer_lang", $_GET["lang"], strtotime("+1 month"), preg_replace('~\\?.*~', '', $_SERVER["REQUEST_URI"]));
$LANG = $_COOKIE["adminer_lang"];
} elseif (isset($langs[$_SESSION["lang"]])) {
$LANG = $_SESSION["lang"];
} else {

View File

@@ -4,7 +4,7 @@ page_header(lang('Database schema'), "", array(), $_GET["db"]);
$table_pos = array();
$table_pos_js = array();
// saved in one cookie because there is a limit of 20 cookies per domain
preg_match_all('~([^:]+):([-0-9.]+)x([-0-9.]+)(_|$)~', $_COOKIE["schema"], $matches, PREG_SET_ORDER); //! ':' in table name
preg_match_all('~([^:]+):([-0-9.]+)x([-0-9.]+)(_|$)~', $_COOKIE["adminer_schema"], $matches, PREG_SET_ORDER); //! ':' in table name
foreach ($matches as $i => $match) {
$table_pos[$match[1]] = array($match[2], $match[3]);
$table_pos_js[] = "\n\t'" . addcslashes($match[1], "\r\n'\\") . "': [ $match[2], $match[3] ]";