mirror of
https://github.com/vrana/adminer.git
synced 2025-08-18 04:11:27 +02:00
Improve session restarting
git-svn-id: https://adminer.svn.sourceforge.net/svnroot/adminer/trunk@1227 7c3ca157-0c34-0410-bff1-cbf682f78f5c
This commit is contained in:
@@ -358,7 +358,7 @@ class Adminer {
|
||||
* @return string
|
||||
*/
|
||||
function messageQuery($query) {
|
||||
session_start();
|
||||
restart_session();
|
||||
$id = "sql-" . count($_SESSION["messages"]);
|
||||
$_SESSION["history"][$_GET["server"]][DB][] = $query;
|
||||
return " <a href='#$id' onclick=\"return !toggle('$id');\">" . lang('SQL command') . "</a><div id='$id' class='hidden'><pre class='jush-sql'>" . shorten_utf8($query, 1000) . '</pre><a href="' . h(ME . 'sql=&history=' . (count($_SESSION["history"][$_GET["server"]][DB]) - 1)) . '">' . lang('Edit') . '</a></div>';
|
||||
|
@@ -92,8 +92,8 @@ include "./include/editing.inc.php";
|
||||
include "./include/export.inc.php";
|
||||
|
||||
session_cache_limiter(""); // to allow restarting session
|
||||
if (@ini_set("session.use_cookies", false) !== false) { // @ - may be disabled
|
||||
session_write_close(); // improves concurrency, may be restarted later
|
||||
if (!ini_get("session.use_cookies") || @ini_set("session.use_cookies", false) !== false) { // @ - may be disabled
|
||||
session_write_close(); // improves concurrency if a user opens several pages at once, may be restarted later
|
||||
}
|
||||
|
||||
$confirm = " onclick=\"return confirm('" . lang('Are you sure?') . "');\"";
|
||||
|
@@ -52,10 +52,6 @@ function page_header($title, $error = "", $breadcrumb = array(), $title2 = "") {
|
||||
if (strlen(DB) && $databases && !in_array(DB, $databases, true)) {
|
||||
$databases = null;
|
||||
}
|
||||
if ((isset($databases) && !isset($_GET["sql"])) || !ini_get("session.use_cookies")) {
|
||||
// improves concurrency if a user opens several pages at once
|
||||
session_write_close();
|
||||
}
|
||||
if ($error) {
|
||||
echo "<div class='error'>$error</div>\n";
|
||||
}
|
||||
|
@@ -351,7 +351,7 @@ function drop_create($drop, $create, $location, $message_drop, $message_alter, $
|
||||
$dropped = strlen($name) && ($_POST["dropped"] || queries($drop));
|
||||
$created = queries($create);
|
||||
if (!queries_redirect($location, (strlen($name) ? $message_alter : $message_create), $created) && $dropped) {
|
||||
session_start();
|
||||
restart_session();
|
||||
$_SESSION["messages"][] = $message_drop;
|
||||
}
|
||||
return $dropped;
|
||||
|
@@ -220,7 +220,7 @@ function restart_session() {
|
||||
*/
|
||||
function redirect($location, $message = null) {
|
||||
if (isset($message)) {
|
||||
session_start();
|
||||
restart_session();
|
||||
$_SESSION["messages"][] = $message;
|
||||
}
|
||||
header("Location: " . (strlen($location) ? $location : "."));
|
||||
|
Reference in New Issue
Block a user