From ec045b0a24bbb0de2b203961b453a9f5bd640f34 Mon Sep 17 00:00:00 2001
From: thomascube <thomas@roundcube.net>
Date: Tue, 22 Mar 2011 03:49:43 -0400
Subject: [PATCH] Revert r4609 and use stateless request tokens; no need to save them in session and thus no keep-alive necessary; fixes #1487829
---
program/include/rcube_session.php | 37 +++++++++++++++++++------------------
1 files changed, 19 insertions(+), 18 deletions(-)
diff --git a/program/include/rcube_session.php b/program/include/rcube_session.php
index 2bd663c..8c7adb3 100644
--- a/program/include/rcube_session.php
+++ b/program/include/rcube_session.php
@@ -192,6 +192,19 @@
/**
+ * Cleanup session data before saving
+ */
+ public function cleanup()
+ {
+ // current compose information is stored in $_SESSION['compose'], move it to $_SESSION['compose_data']
+ if ($_SESSION['compose']) {
+ $_SESSION['compose_data'][$_SESSION['compose']['id']] = $_SESSION['compose'];
+ $this->remove('compose');
+ }
+ }
+
+
+ /**
* Register additional garbage collector functions
*
* @param mixed Callback function
@@ -205,27 +218,15 @@
/**
* Generate and set new session id
+ *
+ * @param boolean $destroy If enabled the current session will be destroyed
*/
- public function regenerate_id()
+ public function regenerate_id($destroy=true)
{
- // delete old session record
- $this->destroy(session_id());
+ session_regenerate_id($destroy);
+
$this->vars = false;
-
- $randval = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
-
- for ($random = '', $i=1; $i <= 32; $i++) {
- $random .= substr($randval, mt_rand(0,(strlen($randval) - 1)), 1);
- }
-
- // use md5 value for id
- $this->key = md5($random);
- session_id($this->key);
-
- $cookie = session_get_cookie_params();
- $lifetime = $cookie['lifetime'] ? time() + $cookie['lifetime'] : 0;
-
- rcmail::setcookie(session_name(), $this->key, $lifetime);
+ $this->key = session_id();
return true;
}
--
Gitblit v1.9.1