summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorthomascube <thomas@roundcube.net>2011-09-16 19:13:27 +0000
committerthomascube <thomas@roundcube.net>2011-09-16 19:13:27 +0000
commit85993b24f8860d7674414fce18acaa8bcef359a5 (patch)
treef4d55ca5021b37c3e86fccb8ef7b7136efdc150d
parentf593222ef5d5dc3b678618593abb873f4fcd4343 (diff)
Backport r5226 to release 0.6 branch
-rw-r--r--CHANGELOG1
-rw-r--r--program/include/rcube_session.php6
-rw-r--r--program/steps/mail/attachments.inc2
-rw-r--r--program/steps/mail/compose.inc4
-rw-r--r--program/steps/mail/func.inc4
-rw-r--r--program/steps/mail/sendmail.inc2
6 files changed, 10 insertions, 9 deletions
diff --git a/CHANGELOG b/CHANGELOG
index fb4a6908d..30479b352 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,6 +1,7 @@
CHANGELOG Roundcube Webmail
===========================
+- Fix session race conditions when composing new messages
- jQuery 1.6.4
- Fix handling of binary attachments encoded with quoted-printable (#1488065)
- Fix text-overflow:ellipsis issues on messages list in FF7 and Webkit (#1488061)
diff --git a/program/include/rcube_session.php b/program/include/rcube_session.php
index 14475ca90..dbb9a9e7d 100644
--- a/program/include/rcube_session.php
+++ b/program/include/rcube_session.php
@@ -333,9 +333,9 @@ class rcube_session
*/
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'];
+ // current compose information is stored in $_SESSION['compose'], move it to $_SESSION['compose_data_<ID>']
+ if ($compose_id = $_SESSION['compose']['id']) {
+ $_SESSION['compose_data_'.$compose_id] = $_SESSION['compose'];
$this->remove('compose');
}
}
diff --git a/program/steps/mail/attachments.inc b/program/steps/mail/attachments.inc
index 4674034a1..ffb164279 100644
--- a/program/steps/mail/attachments.inc
+++ b/program/steps/mail/attachments.inc
@@ -25,7 +25,7 @@ if (!empty($_GET['_progress'])) {
}
$COMPOSE_ID = get_input_value('_id', RCUBE_INPUT_GPC);
-$_SESSION['compose'] = $_SESSION['compose_data'][$COMPOSE_ID];
+$_SESSION['compose'] = $_SESSION['compose_data_'.$COMPOSE_ID];
if (!$_SESSION['compose']) {
die("Invalid session var!");
diff --git a/program/steps/mail/compose.inc b/program/steps/mail/compose.inc
index 4449ea0b2..00d4b6421 100644
--- a/program/steps/mail/compose.inc
+++ b/program/steps/mail/compose.inc
@@ -29,7 +29,7 @@ $MESSAGE_FORM = NULL;
$MESSAGE = NULL;
$COMPOSE_ID = get_input_value('_id', RCUBE_INPUT_GET);
-$_SESSION['compose'] = $_SESSION['compose_data'][$COMPOSE_ID];
+$_SESSION['compose'] = $_SESSION['compose_data_'.$COMPOSE_ID];
// Nothing below is called during message composition, only at "new/forward/reply/draft" initialization or
// if a compose-ID is given (i.e. when the compose step is opened in a new window/tab).
@@ -39,7 +39,7 @@ if (!is_array($_SESSION['compose']))
if ($COMPOSE_ID)
raise_error(array('code' => 500, 'type' => 'php',
'file' => __FILE__, 'line' => __LINE__,
- 'message' => "Invalid session"), true, true);
+ 'message' => "Invalid compose ID"), true, true);
$_SESSION['compose'] = array(
'id' => uniqid(mt_rand()),
diff --git a/program/steps/mail/func.inc b/program/steps/mail/func.inc
index 0c19b661b..8b57c9e11 100644
--- a/program/steps/mail/func.inc
+++ b/program/steps/mail/func.inc
@@ -1427,12 +1427,12 @@ function rcmail_message_part_frame($attrib)
*/
function rcmail_compose_cleanup($id)
{
- if (!isset($_SESSION['compose_data'][$id]))
+ if (!isset($_SESSION['compose_data_'.$id]))
return;
$rcmail = rcmail::get_instance();
$rcmail->plugins->exec_hook('attachments_cleanup', array('group' => $id));
- unset($_SESSION['compose_data'][$id]);
+ $rcmail->session->remove('compose_data_'.$id);
}
diff --git a/program/steps/mail/sendmail.inc b/program/steps/mail/sendmail.inc
index f81c1529d..7850859f3 100644
--- a/program/steps/mail/sendmail.inc
+++ b/program/steps/mail/sendmail.inc
@@ -27,7 +27,7 @@ $OUTPUT->framed = TRUE;
$savedraft = !empty($_POST['_draft']) ? true : false;
$COMPOSE_ID = get_input_value('_id', RCUBE_INPUT_GPC);
-$_SESSION['compose'] = $_SESSION['compose_data'][$COMPOSE_ID];
+$_SESSION['compose'] = $_SESSION['compose_data_'.$COMPOSE_ID];
/****** checks ********/