X-Git-Url: https://vcs.fsf.org/?p=squirrelmail.git;a=blobdiff_plain;f=src%2Fcompose.php;h=bae2c47743591191e7d62d06c248807627680efa;hp=768a8eedd0bf917b958bdaa150cf7f51f88b4ebe;hb=0321108e06dfe466323317242d6ec698b9bc3b2d;hpb=a34b07a534fcaa289191146b1918f6a55ffd5a4e diff --git a/src/compose.php b/src/compose.php index 768a8eed..bae2c477 100644 --- a/src/compose.php +++ b/src/compose.php @@ -11,7 +11,7 @@ * - Send mail * - Save As Draft * - * @copyright © 1999-2005 The SquirrelMail Project Team + * @copyright © 1999-2006 The SquirrelMail Project Team * @license http://opensource.org/licenses/gpl-license.php GNU Public License * @version $Id$ * @package squirrelmail @@ -24,7 +24,7 @@ define('SM_PATH','../'); /* SquirrelMail required files. */ -require_once(SM_PATH . 'include/validate.php'); +include_once(SM_PATH . 'include/validate.php'); require_once(SM_PATH . 'functions/global.php'); require_once(SM_PATH . 'functions/imap.php'); require_once(SM_PATH . 'functions/date.php'); @@ -48,6 +48,11 @@ sqgetGlobalVar('delimiter', $delimiter, SQ_SESSION); sqgetGlobalVar('composesession', $composesession, SQ_SESSION); sqgetGlobalVar('compose_messages', $compose_messages, SQ_SESSION); +sqgetGlobalVar('delayed_errors', $delayed_errors, SQ_SESSION); +if (is_array($delayed_errors)) { + $oErrorHandler->AssignDelayedErrors($delayed_errors); + sqsession_unregister("delayed_errors"); +} /** SESSION/POST/GET VARS */ sqgetGlobalVar('session',$session); @@ -185,8 +190,6 @@ function getReplyCitation($orig_from, $orig_date) { $sOrig_from = decodeHeader($orig_from->getAddress(false),false,false,true); } -// $from = decodeHeader($orig_header->getAddr_s('from',"\n$indent"),false,false); - /* First, return an empty string when no citation style selected. */ if (($reply_citation_style == '') || ($reply_citation_style == 'none')) { return ''; @@ -206,8 +209,7 @@ function getReplyCitation($orig_from, $orig_date) { $full_reply_citation = sprintf(_("%s wrote:"),$sOrig_from); break; case 'quote_who': - // FIXME: do we have to translate xml formating? - $start = '<' . _("quote") . ' ' . _("who") . '="'; + $start = ''; $full_reply_citation = $start . $sOrig_from . $end; break; @@ -348,7 +350,6 @@ if (!isset($compose_messages)) { } if (!isset($compose_messages[$session]) || ($compose_messages[$session] == NULL)) { - /* if (!array_key_exists($session, $compose_messages)) { /* We can only do this in PHP >= 4.1 */ $composeMessage = new Message(); $rfc822_header = new Rfc822Header(); $composeMessage->rfc822_header = $rfc822_header; @@ -390,13 +391,17 @@ if ($draft) { } sqimap_logout($imap_stream); } + if (count($oErrorHandler->aErrors)) { + sqsession_register($oErrorHandler->aErrors,"delayed_errors"); + } + session_write_close(); if ($compose_new_win == '1') { if ( !isset($pageheader_sent) || !$pageheader_sent ) { Header("Location: $location/compose.php?saved_draft=yes&session=$composesession"); } else { - echo '

' - . _("Return") . '
'; + . _("Return") . ''; } exit(); } else { @@ -404,10 +409,10 @@ if ($draft) { Header("Location: $location/right_main.php?mailbox=" . urlencode($draft_folder) . "&startMessage=1¬e=".urlencode($draft_message)); } else { - echo '

' - . _("Return") . '
'; + . _("Return") . ''; } exit(); } @@ -423,7 +428,7 @@ if ($send) { if (checkInput(false) && !isset($AttachFailure)) { if ($mailbox == "All Folders") { /* We entered compose via the search results page */ - $mailbox="INBOX"; /* Send 'em to INBOX, that's safe enough */ + $mailbox = 'INBOX'; /* Send 'em to INBOX, that's safe enough */ } $urlMailbox = urlencode (trim($mailbox)); if (! isset($passed_id)) { @@ -464,12 +469,14 @@ if ($send) { $composeMessage=$compose_messages[$session]; $Result = deliverMessage($composeMessage); + do_hook('compose_send_after', $Result, $composeMessage); if (! $Result) { showInputForm($session); exit(); } unset($compose_messages[$session]); + /* if it is resumed draft, delete draft message */ if ( isset($delete_draft)) { $imap_stream = sqimap_login($username, $key, $imapServerAddress, $imapPort, false); @@ -483,13 +490,20 @@ if ($send) { } sqimap_logout($imap_stream); } + /* + * Store the error array in the session because they will be lost on a redirect + */ + if (count($oErrorHandler->aErrors)) { + sqsession_register($oErrorHandler->aErrors,"delayed_errors"); + } + session_write_close(); if ($compose_new_win == '1') { if ( !isset($pageheader_sent) || !$pageheader_sent ) { Header("Location: $location/compose.php?mail_sent=yes"); } else { - echo '

' - . _("Return") . '
'; + . _("Return") . ''; } exit(); } else { @@ -497,10 +511,10 @@ if ($send) { Header("Location: $location/right_main.php?mailbox=$urlMailbox". "&startMessage=$startMessage&mail_sent=yes"); } else { - echo '

" - . _("Return") . '
'; + . _("Return") . ''; } exit(); } @@ -595,10 +609,7 @@ elseif (isset($sigappend)) { $composeMessage = $compose_messages[$session]; foreach($delete as $index) { if (!empty($composeMessage->entities) && isset($composeMessage->entities[$index])) { - $attached_file = $composeMessage->entities[$index]->att_local_name; - if (file_exists($attached_file)) { - unlink ($attached_file); - } + $composeMessage->entities[$index]->purgeAttachments(); unset ($composeMessage->entities[$index]); } } @@ -767,7 +778,6 @@ function newMail ($mailbox='', $passed_id='', $passed_ent_id='', $action='', $se } else { $mailprio = ''; } - //ClearAttachments($session); $identity = ''; $from_o = $orig_header->from; @@ -1030,7 +1040,7 @@ function showInputForm ($session, $values=false) { $username, $data_dir, $identity, $idents, $delete_draft, $mailprio, $compose_new_win, $saved_draft, $mail_sent, $sig_first, $username, $compose_messages, $composesession, $default_charset, - $compose_onsubmit; + $compose_onsubmit, $oTemplate; if (checkForJavascript()) { $onfocus = ' onfocus="alreadyFocused=true;"'; @@ -1057,7 +1067,7 @@ function showInputForm ($session, $values=false) { } if ($use_javascript_addr_book) { - echo "\n". '