|
From: Thijs K. <ki...@us...> - 2006-08-03 15:03:48
|
Update of /cvsroot/squirrelmail/squirrelmail/src In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv16175/src Modified Files: compose.php login.php redirect.php webmail.php Log Message: Fixed resuming of compose when session expired while writing, and make sure the code only sets those variables that are needed in compose and are not already set. Thanks James Bercegay from GulfTech for pointing this out. Index: compose.php =================================================================== RCS file: /cvsroot/squirrelmail/squirrelmail/src/compose.php,v retrieving revision 1.444 retrieving revision 1.445 diff -u -w -r1.444 -r1.445 --- compose.php 31 Jul 2006 16:43:56 -0000 1.444 +++ compose.php 3 Aug 2006 15:03:44 -0000 1.445 @@ -295,13 +295,18 @@ sqsession_unregister('session_expired_post'); session_write_close(); } else { - foreach ($session_expired_post as $postvar => $val) { - if (isset($val)) { - $$postvar = $val; - } else { - $$postvar = ''; - } + // these are the vars that we can set from the expired composed session + $compo_var_list = array ( 'send_to', 'send_to_cc','body','startMessage', + 'passed_body','use_signature','signature','attachments','subject','newmail', + 'send_to_bcc', 'passed_id', 'mailbox', 'from_htmladdr_search', 'identity', + 'draft_id', 'delete_draft', 'mailprio', 'edit_as_new', 'compose_messsages', + 'composesession', 'request_mdn', 'request_dr'); + + foreach ($compo_var_list as $var) { + if ( isset($session_expired_post[$var]) && !isset($$var) ) { + $$var = $session_expired_post[$var]; } + $compose_messages = unserialize(urldecode($restoremessages)); sqsession_register($compose_messages,'compose_messages'); sqsession_register($composesession,'composesession'); @@ -681,7 +686,7 @@ function newMail ($mailbox='', $passed_id='', $passed_ent_id='', $action='', $session='') { global $editor_size, $default_use_priority, $body, $idents, $use_signature, $data_dir, $username, - $username, $key, $imapServerAddress, $imapPort, $compose_messages, + $key, $imapServerAddress, $imapPort, $compose_messages, $composeMessage, $body_quote; global $languages, $squirrelmail_language, $default_charset; @@ -1035,7 +1040,7 @@ $from_htmladdr_search, $location_of_buttons, $attachment_dir, $username, $data_dir, $identity, $idents, $delete_draft, $mailprio, $compose_new_win, $saved_draft, $mail_sent, $sig_first, - $username, $compose_messages, $composesession, $default_charset, + $compose_messages, $composesession, $default_charset, $compose_onsubmit, $oTemplate; if (checkForJavascript()) { @@ -1424,7 +1429,7 @@ * using $show=false, and then when i'm ready to display the error * message, show=true */ - global $body, $send_to, $send_to_bcc, $subject, $color; + global $send_to, $send_to_bcc; if ($send_to == '' && $send_to_bcc == '') { if ($show) { Index: login.php =================================================================== RCS file: /cvsroot/squirrelmail/squirrelmail/src/login.php,v retrieving revision 1.143 retrieving revision 1.144 diff -u -w -r1.143 -r1.144 --- login.php 14 Jun 2006 06:31:47 -0000 1.143 +++ login.php 3 Aug 2006 15:03:44 -0000 1.144 @@ -31,20 +31,31 @@ */ set_up_language($squirrelmail_language, TRUE, TRUE); -/* +/** * In case the last session was not terminated properly, make sure - * we get a new one. + * we get a new one, but make sure we preserve session_expired_* */ -sqsession_destroy(); /** * PHP bug. http://bugs.php.net/11643 (warning, spammed bug tracker) and * http://bugs.php.net/13834 * SID constant is not destroyed in PHP 4.1.2, 4.2.3 and maybe other * versions. Produces warning on login page. Bug should be fixed only in 4.3.0 */ +if ( !empty($_SESSION['session_expired_post']) && !empty($_SESSION['session_expired_location']) ) { + $sep = $_SESSION['session_expired_post']; + $sel = $_SESSION['session_expired_location']; + + sqsession_destroy(); + + sqsession_is_active(); + $_SESSION=array(); + sqsession_register($sep, 'session_expired_post'); + sqsession_register($sel, 'session_expired_location'); +} else { + sqsession_destroy(); @sqsession_is_active(); $_SESSION=array(); - +} /** * This detects if the IMAP server has logins disabled, and if so, Index: redirect.php =================================================================== RCS file: /cvsroot/squirrelmail/squirrelmail/src/redirect.php,v retrieving revision 1.96 retrieving revision 1.97 diff -u -w -r1.96 -r1.97 --- redirect.php 5 Apr 2006 00:22:11 -0000 1.96 +++ redirect.php 3 Aug 2006 15:03:44 -0000 1.97 @@ -143,14 +143,16 @@ if ( sqgetGlobalVar('session_expired_location', $session_expired_location, SQ_SESSION) ) { sqsession_unregister('session_expired_location'); + if ( strpos($session_expired_location, 'compose.php') !== FALSE ) { $compose_new_win = getPref($data_dir, $username, 'compose_new_win', 0); if ($compose_new_win) { // do not prefix $location here because $session_expired_location is set to PHP_SELF // of the last page $redirect_url = $session_expired_location; - } elseif ( strpos($session_expired_location, 'webmail.php') === FALSE ) { + } else { $redirect_url = $location.'/webmail.php?right_frame='.urldecode($session_expired_location); } + } unset($session_expired_location); } Index: webmail.php =================================================================== RCS file: /cvsroot/squirrelmail/squirrelmail/src/webmail.php,v retrieving revision 1.122 retrieving revision 1.123 diff -u -w -r1.122 -r1.123 --- webmail.php 9 Jul 2006 22:27:40 -0000 1.122 +++ webmail.php 3 Aug 2006 15:03:44 -0000 1.123 @@ -36,9 +36,6 @@ sqgetGlobalVar('right_frame', $right_frame, SQ_GET); -if ( isset($_SESSION['session_expired_post']) ) { - sqsession_unregister('session_expired_post'); -} if(!sqgetGlobalVar('mailto', $mailto)) { $mailto = ''; } |