From 177dde45a8aa21837e77cd2aa52e751cb369503a Mon Sep 17 00:00:00 2001 From: stekkel Date: Wed, 31 Jul 2002 23:15:44 +0000 Subject: [PATCH] support for picking up attachments in case of a expired session. Also clean up left attachments when we login. git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@3216 7612ce4b-ef26-0410-bec9-ea0150e637f0 --- src/redirect.php | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/src/redirect.php b/src/redirect.php index 883d5291..2907ab6d 100644 --- a/src/redirect.php +++ b/src/redirect.php @@ -143,11 +143,9 @@ if ($javascript_setting != SMPREF_JS_ON){ /* Update the prefs */ setPref($data_dir, $username, 'javascript_on', $js_pref); +global $attachments; +$attachments = unserialize(getPref($data_dir, $username, 'attachments', 0)); /* Compute the URL to forward the user to. */ -if(isset($rcptemail)) { - $redirect_url = 'webmail.php?right_frame=compose.php&rcptaddress='; - $redirect_url .= $rcptemail; -} else { global $session_expired_location, $session_expired_post; if (isset($session_expired_location) && $session_expired_location) { $compose_new_win = getPref($data_dir, $username, 'compose_new_win', 0); @@ -158,10 +156,23 @@ if(isset($rcptemail)) { } session_unregister('session_expired_location'); unset($session_expired_location); + if (is_array($attachments)) { + session_register('attachments'); + } } else { + if (is_array($attachments)) { + $hashed_attachment_dir = getHashedDir($username, $attachment_dir); + foreach ($attachments as $attachment) { + $attached_file = $hashed_attachment_dir.'/'.$attachment['localfilename']; + if (file_exists($attached_file)) { + unlink($attached_file); + } + } + removePref($data_dir, $username, 'attachments'); + } $redirect_url = 'webmail.php'; } -} + /* Send them off to the appropriate page. */ header("Location: $redirect_url"); -- 2.25.1