* Not sure if they work perfectly, but it's worth a try.
* We need to make 1.0 a branch and 1.1 be the main
* Because it's not set up that way, I'll need to patch that version too.
git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@1134
7612ce4b-ef26-0410-bec9-
ea0150e637f0
if (!$message) {
sqimap_mailbox_select($imapConnection, $mailbox);
if (!$message) {
sqimap_mailbox_select($imapConnection, $mailbox);
- $message = sqimap_get_message($imapConnection, $forward_id, $mailbox); }
-
- if (!$message->entities) {
- if ($message->header->entity_id != $ent_num) {
- $filename = decodeHeader($message->header->filename);
+ $message = sqimap_get_message($imapConnection, $forward_id,
+ $mailbox);
+ }
- if ($filename == "")
- $filename = "untitled-".$message->header->entity_id;
+ if (count($message->entities) == 0) {
+ if ($message->header->entity_id != $ent_num) {
+ $filename = decodeHeader($message->header->filename);
- $localfilename = md5($filename.", $REMOTE_IP, REMOTE_PORT, $UNIQUE_ID, extra-stuff here");
+ if ($filename == "")
+ $filename = "untitled-".$message->header->entity_id;
- // Write File Info
- $fp = fopen ($attachment_dir.$localfilename.".info", "w");
- fputs ($fp, strtolower($message->header->type0)."/".strtolower($message->header->type1)."\n".$filename."\n");
- fclose ($fp);
-
- // Write Attachment to file
- $fp = fopen ($attachment_dir.$localfilename, "w");
- fputs ($fp, decodeBody(mime_fetch_body($imapConnection, $forward_id, $message->header->entity_id), $message->header->encoding));
- fclose ($fp);
+ $localfilename = GenerateRandomString(32, '', 7);
- $attachments[$localfilename] = $filename;
+ // Write File Info
+ $fp = fopen ($attachment_dir.$localfilename.".info", "w");
+ fputs ($fp, strtolower($message->header->type0)."/".
+ strtolower($message->header->type1)."\n".$filename."\n");
+ fclose ($fp);
+
+ // Write Attachment to file
+ $fp = fopen ($attachment_dir.$localfilename, "w");
+ fputs ($fp, decodeBody(mime_fetch_body($imapConnection,
+ $forward_id, $message->header->entity_id),
+ $message->header->encoding));
+ fclose ($fp);
+ $attachments[$localfilename] = $filename;
+ }
- for ($i = 0; $i < count($message->entities); $i++) {
+ for ($i = 0; $i < count($message->entities); $i++) {
getAttachments($message->entities[$i]);
getAttachments($message->entities[$i]);
function showInputForm () {
global $send_to, $send_to_cc, $reply_subj, $forward_subj, $body,
function showInputForm () {
global $send_to, $send_to_cc, $reply_subj, $forward_subj, $body,
echo " value=\"" . _("Add") ."\">\n";
echo " </td>\n";
echo " </tr>\n";
echo " value=\"" . _("Add") ."\">\n";
echo " </td>\n";
echo " </tr>\n";
- if (isset($attachments) && count($attachments)>0) {
+ if (count($attachments) > 0) {
echo "<tr><td bgcolor=\"$color[0]\" align=right>\n";
echo " ";
echo "</td><td align=left bgcolor=\"$color[0]\">";
echo "<tr><td bgcolor=\"$color[0]\" align=right>\n";
echo " ";
echo "</td><td align=left bgcolor=\"$color[0]\">";
- } else if (isset($smtpErrors)) {
- $imapConnection = sqimap_login($username, $key, $imapServerAddress, $imapPort, 0);
- displayPageHeader($color, $mailbox);
-
- $newmail = true;
- if ($forward_id && $ent_num) getAttachments(0);
-
- newMail();
- showInputForm();
- sqimap_logout($imapConnection);
- $imapConnection = sqimap_login($username, $key, $imapServerAddress, $imapPort, 0);
+ // This handles the default case as well as the error case
+ // (they had the same code) --> if (isset($smtpErrors))
+ $imapConnection = sqimap_login($username, $key, $imapServerAddress,
+ $imapPort, 0);
displayPageHeader($color, $mailbox);
$newmail = true;
displayPageHeader($color, $mailbox);
$newmail = true;
-
- if (isset($forward_id) && isset($ent_num)) getAttachments(0);
+ if (isset($forward_id) && $forward_id && isset($ent_num) && $ent_num)
+ getAttachments(0);
newMail();
showInputForm();
newMail();
showInputForm();