Re: Attachments broken in Squirrelmail 1.4.11 ?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 10/3/07, Jonathan Angliss <jon@xxxxxxxxxxxxxxxx> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Paul Lesniewski wrote:
> > On 10/2/07, Pascal Maes <pascal.maes@xxxxxxxxxxxxxx> wrote:
> >> Le 2 oct. 07 à 09:03, Paul Lesniewski a écrit :
> >>
> >>> [...]
> >>>
> >>> All I can suggest is to show the HTML code for your compose screen
> >>> after you have added one attachment.  After you capture that HTML,
> >>> make sure adding another attachment or sending that message as is
> >>> results in the loss of the attachment that had been added when you
> >>> captured the HTML.
> >
> > Thanks for all the testing.  You didn't show the HTML, which would
> > have been helpful.  It would be helpful to see the HTML of both after
> > the first and second attach actions.
> >
> > However, some of this information was helpful, and it looks as if the
> > problem might be in saveAttachedFiles().  I am attaching a patch to
> > try.  Can you please revert all debugging changes and apply this
> > patch?  I can't yet guarantee that this will solve the issue since I
> > still cannot reproduce it.
>
> Ironically, it shows I really should keep up with my emails, but I
> resolved this issue, in a slightly different method (patch attached).  See:
>
>   http://squirrelmail.org/bugs/1805471
>
> The issue seems to be specific to PHP 4.x, and not PHP 5.x, which might
> be why some people didn't see the original problem.  I'm not sure if
> your fix also resolves the secondary problem of the "addresses" button.

It does not, but the attached patch does.  I'd rather use mine, as
it's a better clean-up of the situation (compose_messages should not
be used any more).

One person on this thread still reports problems, but I am a little
suspicious that those problems may not be related.  Still, it'd be
nice if someone could reproduce them (or if that person (Oliver) can
use a clean, fresh 1.4.11 installation with this patch and try again).
Index: src/compose.php
===================================================================
--- src/compose.php	(revision 12656)
+++ src/compose.php	(working copy)
@@ -319,9 +319,6 @@
         if (!empty($attachments)) 
             $attachments = unserialize($attachments);
 
-        // Not used any more, but left for posterity
-        //$compose_messages = unserialize($restoremessages);
-        //sqsession_register($compose_messages,'compose_messages');
         sqsession_register($composesession,'composesession');
 
         if (isset($send)) {
@@ -357,20 +354,13 @@
     $composesession = $session;
     sqsession_register($composesession,'composesession');
 }
-if (!isset($compose_messages)) {
-    $compose_messages = array();
-}
-if (empty($compose_messages[$session])) {
+if (!empty($compose_messages[$session])) {
+    $composeMessage = $compose_messages[$session];
+} else {
     $composeMessage = new Message();
     $rfc822_header = new Rfc822Header();
     $composeMessage->rfc822_header = $rfc822_header;
     $composeMessage->reply_rfc822_header = '';
-    $compose_messages[$session] = $composeMessage;
-
-    // Not used any more, but left for posterity
-    //sqsession_register($compose_messages,'compose_messages');
-} else {
-    $composeMessage=$compose_messages[$session];
 }
 
 // re-add attachments that were already in this message
@@ -392,14 +382,10 @@
      * of language interface.
      */
     set_my_charset();
-    $composeMessage = $compose_messages[$session];
     if (! deliverMessage($composeMessage, true)) {
         showInputForm($session);
         exit();
     } else {
-        // Not used any more, but left for posterity
-        //unset($compose_messages[$session]);
-        //sqsession_register($compose_messages,'compose_messages');
         $draft_message = _("Draft Email Saved");
         /* If this is a resumed draft, then delete the original */
         if(isset($delete_draft)) {
@@ -490,17 +476,12 @@
         }
         $body = $newBody;
 
-        $composeMessage=$compose_messages[$session];
-
         $Result = deliverMessage($composeMessage);
         do_hook('compose_send_after', $Result, $composeMessage);
         if (! $Result) {
             showInputForm($session);
             exit();
         }
-        // Not used any more, but left for posterity
-        //unset($compose_messages[$session]);
-        //sqsession_register($compose_messages,'compose_messages');
 
         /* if it is resumed draft, delete draft message */
         if ( isset($delete_draft)) {
@@ -604,7 +585,6 @@
     }
 
     if (isset($delete) && is_array($delete)) {
-        $composeMessage = $compose_messages[$session];
         foreach($delete as $index) {
             if (!empty($composeMessage->entities) && isset($composeMessage->entities[$index])) {
                 $composeMessage->entities[$index]->purgeAttachments();
@@ -616,9 +596,6 @@
             $new_entities[] = $entity;
         }
         $composeMessage->entities = $new_entities;
-        $compose_messages[$session] = $composeMessage;
-        // Not used any more, but left for posterity
-        //sqsession_register($compose_messages, 'compose_messages');
     }
     showInputForm($session);
 } else {
@@ -675,7 +652,7 @@
 function newMail ($mailbox='', $passed_id='', $passed_ent_id='', $action='', $session='') {
     global $editor_size, $default_use_priority, $body, $idents,
         $use_signature, $composesession, $data_dir, $username,
-        $username, $key, $imapServerAddress, $imapPort, $compose_messages,
+        $username, $key, $imapServerAddress, $imapPort, 
         $composeMessage, $body_quote;
     global $languages, $squirrelmail_language, $default_charset;
 
@@ -896,9 +873,6 @@
             default:
                 break;
         }
-        $compose_messages[$session] = $composeMessage;
-        // Not used any more, but left for posterity
-        //sqsession_register($compose_messages, 'compose_messages');
         session_write_close();
         sqimap_logout($imapConnection);
     }
@@ -1016,7 +990,7 @@
         $username, $data_dir, $identity, $idents, $draft_id, $delete_draft,
         $mailprio, $default_use_mdn, $mdn_user_support, $compose_new_win,
         $saved_draft, $mail_sent, $sig_first, $edit_as_new, $action,
-        $username, $compose_messages, $composesession, $default_charset,
+        $username, $composesession, $default_charset, $composeMessage,
         $javascript_on;
 
     if ($javascript_on)
@@ -1024,7 +998,6 @@
     else
         $onfocus = '';
     
-    $composeMessage = $compose_messages[$session];
     if ($values) {
         $send_to = $values['send_to'];
         $send_to_cc = $values['send_to_cc'];
@@ -1294,8 +1267,6 @@
        store the complete ComposeMessages array in a hidden input value
        so we can restore them in case of a session timeout.
      */
-    // Not used any more, but left for posterity
-    //echo addHidden('restoremessages', serialize($compose_messages)).
     echo addHidden('composesession', $composesession).
         addHidden('querystring', $queryString).
         (!empty($attach_array) ?
@@ -1397,7 +1368,7 @@
 /* True if FAILURE */
 function saveAttachedFiles($session) {
     global $_FILES, $attachment_dir, $username,
-        $data_dir, $compose_messages;
+        $data_dir, $composeMessage;
 
     /* get out of here if no file was attached at all */
     if (! is_uploaded_file($_FILES['attachfile']['tmp_name']) ) {
@@ -1419,13 +1390,9 @@
             return true;
         }
     }
-    $message = $compose_messages[$session];
     $type = strtolower($_FILES['attachfile']['type']);
     $name = $_FILES['attachfile']['name'];
-    $message->initAttachment($type, $name, $localfilename);
-    $compose_messages[$session] = $message;
-    // Not used any more, but left for posterity
-    //sqsession_register($compose_messages , 'compose_messages');
+    $composeMessage->initAttachment($type, $name, $localfilename);
 }
 
 /* parse values like 8M and 2k into bytes */
Index: src/addrbook_search_html.php
===================================================================
--- src/addrbook_search_html.php	(revision 12705)
+++ src/addrbook_search_html.php	(working copy)
@@ -48,7 +48,7 @@
  */
 function addr_insert_hidden() {
     global $body, $subject, $send_to, $send_to_cc, $send_to_bcc, $mailbox,
-           $mailprio, $request_mdn, $request_dr, $identity, $session;
+           $mailprio, $request_mdn, $request_dr, $identity, $session, $composeMessage;
 
    if (substr($body, 0, 1) == "\r") {
        echo addHidden('body', "\n".$body);
@@ -56,6 +56,9 @@
        echo addHidden('body', $body);
    }
 
+   if (is_object($composeMessage) && $composeMessage->entities)
+       echo addHidden('attachments', serialize($composeMessage->entities));
+
    echo addHidden('session', $session).
         addHidden('subject', $subject).
         addHidden('send_to', $send_to).
@@ -198,11 +201,11 @@
 
 
 /* Search form */
-echo '<center>' .
+echo addForm($PHP_SELF.'?html_addr_search=true', 'post', 'f').
+    '<center>' .
     html_tag( 'table', '', 'center', '', 'border="0"' ) .
     html_tag( 'tr' ) .
     html_tag( 'td', '', 'left', '', 'nowrap valign="middle"' ) . "\n" .
-    addForm($PHP_SELF.'?html_addr_search=true', 'post', 'f').
     "\n<center>\n" .
     '  <nobr><strong>' . _("Search for") . "</strong>\n";
 addr_insert_hidden();
@@ -232,9 +235,8 @@
 echo '<input type="submit" value="' . _("Search") . '" />' .
      '&nbsp;|&nbsp;<input type="submit" value="' . _("List all") .
      '" name="listall" />' . "\n" .
-     '</form></center></td></tr></table>' . "\n";
-addr_insert_hidden();
-echo '</center>';
+     '</center></td></tr></table>' . "\n";
+echo '</center></form>';
 do_hook('addrbook_html_search_below');
 /* End search form */
 
@@ -270,6 +272,7 @@
         usort($res,'alistcmp');
         addr_display_result($res, true);
     }
+    echo '</body></html>';
     exit;
 }
 else {
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
--
squirrelmail-users mailing list
Posting Guidelines: http://www.squirrelmail.org/wiki/MailingListPostingGuidelines
List Address: squirrelmail-users@xxxxxxxxxxxxxxxxxxxxx
List Archives: http://news.gmane.org/thread.php?group=gmane.mail.squirrelmail.user
List Archives:  http://sourceforge.net/mailarchive/forum.php?forum_id=2995
List Info: https://lists.sourceforge.net/lists/listinfo/squirrelmail-users

[Index of Archives]     [Video For Linux]     [Yosemite News]     [Yosemite Photos]     [gtk]     [KDE]     [Cyrus SASL]     [Gimp on Windows]     [Steve's Art]     [Webcams]

  Powered by Linux