6 * Copyright (c) 1999-2002 The SquirrelMail Project Team
7 * Licensed under the GNU GPL. For full terms see the file COPYING.
9 * This code sends a mail.
11 * There are 4 modes of operation:
20 require_once('../src/validate.php');
21 require_once('../functions/imap.php');
22 require_once('../functions/date.php');
23 require_once('../functions/mime.php');
24 require_once('../functions/smtp.php');
25 require_once('../functions/display_messages.php');
26 require_once('../functions/plugin.php');
28 if (!isset($attachments)) {
29 $attachments = array();
30 session_register('attachments');
33 if (!isset($mailbox) ||
$mailbox == '' ||
($mailbox == 'None')) {
38 include_once ('../src/draft_actions.php');
39 if (!saveMessageAsDraft($send_to, $send_to_cc, $send_to_bcc, $subject, $body, $reply_id, $MDN)) {
43 $draft_message = _("Draft Email Saved");
44 /* If this is a resumed draft, then delete the original */
45 if(isset($delete_draft)) {
46 Header("Location: delete_message.php?mailbox=$draft_folder".
47 "&message=$delete_draft&sort=$sort&startMessage=1&saved_draft=yes");
51 if ($compose_new_win == '1') {
52 Header("Location: compose.php?saved_draft=yes");
56 Header("Location: right_main.php?mailbox=$draft_folder&sort=$sort".
57 "&startMessage=1¬e=$draft_message");
65 if (isset($HTTP_POST_FILES['attachfile']) &&
66 $HTTP_POST_FILES['attachfile']['tmp_name'] &&
67 $HTTP_POST_FILES['attachfile']['tmp_name'] != 'none') {
68 $AttachFailure = saveAttachedFiles();
70 if (checkInput(false) && !isset($AttachFailure)) {
71 $urlMailbox = urlencode (trim($mailbox));
72 if (! isset($reply_id)) {
76 * Set $default_charset to correspond with the user's selection
77 * of language interface.
82 * This is to change all newlines to \n
83 * We'll change them to \r\n later (in the sendMessage function)
85 $body = str_replace("\r\n", "\n", $body);
86 $body = str_replace("\r", "\n", $body);
89 * Rewrap $body so that no line is bigger than $editor_size
90 * This should only really kick in the sqWordWrap function
91 * if the browser doesn't support "HARD" as the wrap type
92 * Or, in Opera's case, something goes wrong.
94 $body = explode("\n", $body);
96 foreach ($body as $line) {
97 if( $line <> '-- ' ) {
100 if (strlen($line) <= $editor_size +
1) {
101 $newBody .= $line . "\n";
103 sqWordWrap($line, $editor_size) . "\n";
109 do_hook("compose_send");
111 $MDN = False; // we are not sending a mdn response
112 if (! isset($mailprio)) {
113 $Result = sendMessage($send_to, $send_to_cc, $send_to_bcc,
114 $subject, $body, $reply_id, $MDN);
116 $Result = sendMessage($send_to, $send_to_cc, $send_to_bcc,
117 $subject, $body, $reply_id, $MDN, $mailprio);
123 if ( isset($delete_draft)) {
124 Header("Location: delete_message.php?mailbox=$draft_folder".
125 "&message=$delete_draft&sort=$sort&startMessage=1&mail_sent=yes");
128 if ($compose_new_win == '1') {
129 Header("Location: compose.php?mail_sent=yes");
132 Header("Location: right_main.php?mailbox=$urlMailbox&sort=$sort".
137 *$imapConnection = sqimap_login($username, $key, $imapServerAddress,
140 if ($compose_new_win == '1') {
141 compose_Header($color, $mailbox);
144 displayPageHeader($color, $mailbox);
146 if (isset($AttachFailure)) {
147 plain_error_message(_("Could not move/copy file. File not attached"),
153 /* sqimap_logout($imapConnection); */
156 elseif (isset($html_addr_search_done)) {
157 if ($compose_new_win == '1') {
158 compose_Header($color, $mailbox);
161 displayPageHeader($color, $mailbox);
164 if (isset($send_to_search) && is_array($send_to_search)) {
165 foreach ($send_to_search as $k => $v) {
166 if (substr($k, 0, 1) == 'T') {
172 elseif (substr($k, 0, 1) == 'C') {
178 elseif (substr($k, 0, 1) == 'B') {
180 $send_to_bcc .= ', ';
188 elseif (isset($html_addr_search)) {
189 if (isset($HTTP_POST_FILES['attachfile']) &&
190 $HTTP_POST_FILES['attachfile']['tmp_name'] &&
191 $HTTP_POST_FILES['attachfile']['tmp_name'] != 'none') {
192 if (saveAttachedFiles()) {
193 plain_error_message(_("Could not move/copy file. File not attached"), $color);
197 * I am using an include so as to elminiate an extra unnecessary
198 * click. If you can think of a better way, please implement it.
200 include_once('./addrbook_search_html.php');
202 elseif (isset($attach)) {
203 if (saveAttachedFiles()) {
204 plain_error_message(_("Could not move/copy file. File not attached"), $color);
206 if ($compose_new_win == '1') {
207 compose_Header($color, $mailbox);
210 displayPageHeader($color, $mailbox);
214 elseif (isset($do_delete)) {
215 if ($compose_new_win == '1') {
216 compose_Header($color, $mailbox);
219 displayPageHeader($color, $mailbox);
222 $hashed_attachment_dir = getHashedDir($username, $attachment_dir);
223 if (isset($delete) && is_array($delete)) {
224 foreach($delete as $index) {
225 $attached_file = $hashed_attachment_dir . '/'
226 . $attachments[$index]['localfilename'];
227 unlink ($attached_file);
228 unset ($attachments[$index]);
235 * This handles the default case as well as the error case
236 * (they had the same code) --> if (isset($smtpErrors))
238 $imapConnection = sqimap_login($username, $key, $imapServerAddress,
240 if ($compose_new_win == '1') {
241 compose_Header($color, $mailbox);
244 displayPageHeader($color, $mailbox);
251 if (isset($forward_id) && $forward_id && isset($ent_num) && $ent_num) {
255 if (isset($draft_id) && $draft_id && isset($ent_num) && $ent_num) {
261 sqimap_logout($imapConnection);
267 /**************** Only function definitions go below *************/
270 /* This function is used when not sending or adding attachments */
271 function newMail () {
272 global $forward_id, $imapConnection, $msg, $ent_num, $body_ary, $body,
273 $reply_id, $send_to, $send_to_cc, $mailbox, $send_to_bcc, $editor_size,
274 $draft_id, $use_signature;
276 $send_to = decodeHeader($send_to, false);
277 $send_to_cc = decodeHeader($send_to_cc, false);
278 $send_to_bcc = decodeHeader($send_to_bcc, false);
282 } elseif ($reply_id) {
288 $use_signature = FALSE;
292 sqimap_mailbox_select($imapConnection, $mailbox);
293 $message = sqimap_get_message($imapConnection, $id, $mailbox);
294 $orig_header = $message->header
;
296 $message = getEntity($message, $ent_num);
298 if ($message->header
->type0
== 'text' ||
299 $message->header
->type1
== 'message') {
302 mime_fetch_body($imapConnection, $id, $ent_num),
303 $message->header
->encoding
);
306 mime_fetch_body($imapConnection, $id, 1),
307 $message->header
->encoding
);
313 if ($message->header
->type1
== 'html') {
314 $body = strip_tags($body);
318 $body_ary = explode("\n", $body);
319 $i = count($body_ary) - 1;
320 while ($i >= 0 && ereg("^[>\\s]*$", $body_ary[$i])) {
321 unset($body_ary[$i]);
325 for ($i=0; isset($body_ary[$i]); $i++
) {
327 if (ereg('^[ >]+', $body_ary[$i])) {
328 $body_ary[$i] = '>' . $body_ary[$i];
330 $body_ary[$i] = '> ' . $body_ary[$i];
334 sqWordWrap($body_ary[$i], $editor_size - 1);
336 $body .= $body_ary[$i] . "\n";
337 unset($body_ary[$i]);
340 $bodyTop = '-------- ' . _("Original Message") . " --------\n" .
341 _("Subject") . ': ' . $orig_header->subject
. "\n" .
342 _("From") . ': ' . $orig_header->from
. "\n" .
344 getLongDateString( $orig_header->date
). "\n" .
345 _("To") . ': ' . $orig_header->to
[0] . "\n";
346 if (count($orig_header->to
) > 1) {
347 for ($x=1; $x < count($orig_header->to
); $x++
) {
348 $bodyTop .= ' ' . $orig_header->to
[$x] . "\n";
352 $body = $bodyTop . $body;
355 $orig_from = decodeHeader($orig_header->from
, false);
356 $body = getReplyCitation($orig_from) . $body;
363 $send_to = sqimap_find_email($send_to);
366 /* This formats a CC string if they hit "reply all" */
367 if ($send_to_cc != '') {
368 $send_to_cc = ereg_replace('"[^"]*"', '', $send_to_cc);
369 $send_to_cc = str_replace(';', ',', $send_to_cc);
370 $sendcc = explode(',', $send_to_cc);
373 for ($i = 0; $i < count($sendcc); $i++
) {
374 $sendcc[$i] = trim($sendcc[$i]);
375 if ($sendcc[$i] == '') {
379 $sendcc[$i] = sqimap_find_email($sendcc[$i]);
380 $whofrom = sqimap_find_displayable_name($msg['HEADER']['FROM']);
381 $whoreplyto = sqimap_find_email($msg['HEADER']['REPLYTO']);
383 if ((strtolower(trim($sendcc[$i])) != strtolower(trim($whofrom))) &&
384 (strtolower(trim($sendcc[$i])) != strtolower(trim($whoreplyto))) &&
385 (trim($sendcc[$i]) != '')) {
386 $send_to_cc .= trim($sendcc[$i]) . ', ';
389 $send_to_cc = trim($send_to_cc);
390 if (substr($send_to_cc, -1) == ',') {
391 $send_to_cc = substr($send_to_cc, 0, strlen($send_to_cc) - 1);
394 } /* function newMail() */
397 function getAttachments($message) {
398 global $mailbox, $attachments, $attachment_dir, $imapConnection,
399 $ent_num, $forward_id, $draft_id, $username;
401 if (isset($draft_id)) {
408 sqimap_mailbox_select($imapConnection, $mailbox);
409 $message = sqimap_get_message($imapConnection, $id, $mailbox);
412 $hashed_attachment_dir = getHashedDir($username, $attachment_dir);
413 if (count($message->entities
) == 0) {
414 if ($message->header
->entity_id
!= $ent_num) {
415 $filename = decodeHeader($message->header
->filename
);
417 if ($filename == "") {
418 $filename = "untitled-".$message->header
->entity_id
;
421 $localfilename = GenerateRandomString(32, '', 7);
422 $full_localfilename = "$hashed_attachment_dir/$localfilename";
423 while (file_exists($full_localfilename)) {
424 $localfilename = GenerateRandomString(32, '', 7);
425 $full_localfilename = "$hashed_attachment_dir/$localfilename";
428 $newAttachment = array();
429 $newAttachment['localfilename'] = $localfilename;
430 $newAttachment['remotefilename'] = $filename;
431 $newAttachment['type'] = strtolower($message->header
->type0
.
432 '/' . $message->header
->type1
);
434 /* Write Attachment to file */
435 $fp = fopen ("$hashed_attachment_dir/$localfilename", 'w');
436 fputs($fp, decodeBody(mime_fetch_body($imapConnection,
437 $id, $message->header
->entity_id
),
438 $message->header
->encoding
));
441 $attachments[] = $newAttachment;
444 for ($i = 0; $i < count($message->entities
); $i++
) {
445 getAttachments($message->entities
[$i]);
451 function showInputForm () {
452 global $send_to, $send_to_cc, $reply_subj, $forward_subj, $body,
453 $passed_body, $color, $use_signature, $signature, $prefix_sig,
454 $editor_size, $attachments, $subject, $newmail,
455 $use_javascript_addr_book, $send_to_bcc, $reply_id, $mailbox,
456 $from_htmladdr_search, $location_of_buttons, $attachment_dir,
457 $username, $data_dir, $identity, $draft_id, $delete_draft,
458 $mailprio, $default_use_mdn, $mdn_user_support, $compose_new_win,
459 $saved_draft, $mail_sent;
461 $subject = decodeHeader($subject, false);
462 $reply_subj = decodeHeader($reply_subj, false);
463 $forward_subj = decodeHeader($forward_subj, false);
465 if ($use_javascript_addr_book) {
466 echo "\n". '<SCRIPT LANGUAGE=JavaScript><!--' . "\n" .
467 'function open_abook() { ' . "\n" .
468 ' var nwin = window.open("addrbook_popup.php","abookpopup",' .
469 '"width=670,height=300,resizable=yes,scrollbars=yes");' . "\n" .
470 ' if((!nwin.opener) && (document.windows != null))' . "\n" .
471 ' nwin.opener = document.windows;' . "\n" .
473 '// --></SCRIPT>' . "\n\n";
476 echo "\n" . '<FORM name=compose action="compose.php" METHOD=POST ' .
477 'ENCTYPE="multipart/form-data"';
478 do_hook("compose_form");
483 if (isset($draft_id)) {
484 echo '<input type="hidden" name="delete_draft" value="' . $draft_id . "\">\n";
486 if (isset($delete_draft)) {
487 echo '<input type="hidden" name="delete_draft" value="' . $delete_draft. "\">\n";
489 if ($saved_draft == 'yes') {
490 echo '<BR><CENTER><B>'. _("Draft Saved").'</CENTER></B>';
492 if ($mail_sent == 'yes') {
493 echo '<BR><CENTER><B>'. _("Your Message has been sent").'</CENTER></B>';
495 echo '<TABLE WIDTH="100%" ALIGN=center CELLSPACING=0 BORDER=0>' . "\n";
496 if ($compose_new_win == '1') {
497 echo ' <TR><TD></TD><TD ALIGN="RIGHT"><INPUT TYPE="BUTTON" NAME="Close" onClick="return self.close()" VALUE="Close"></TD></TR>'."\n";
499 if ($location_of_buttons == 'top') {
500 showComposeButtonRow();
503 $idents = getPref($data_dir, $username, 'identities', 0);
505 echo ' <TR>' . "\n" .
506 ' <TD BGCOLOR="' . $color[4] . '" WIDTH="10%" ALIGN=RIGHT>' .
509 ' </TD><TD BGCOLOR="' . $color[4] . '" WIDTH="90%">' . "\n" .
510 '<select name=identity>' . "\n" .
511 '<option value=default>' .
512 htmlspecialchars(getPref($data_dir, $username, 'full_name'));
513 $em = getPref($data_dir, $username, 'email_address');
515 echo htmlspecialchars(' <' . $em . '>') . "\n";
517 for ($i = 1; $i < $idents; $i ++
) {
518 echo '<option value="' . $i . '"';
519 if (isset($identity) && $identity == $i) {
522 echo '>' . htmlspecialchars(getPref($data_dir, $username,
524 $em = getPref($data_dir, $username, 'email_address' . $i);
526 echo htmlspecialchars(' <' . $em . '>') . "\n";
530 echo '</select>' . "\n" .
534 echo ' <TR>' . "\n" .
535 ' <TD BGCOLOR="' . $color[4] . '" WIDTH="10%" ALIGN=RIGHT>' . "\n" .
537 ' </TD><TD BGCOLOR="' . $color[4] . '" WIDTH="90%">' . "\n" .
538 ' <INPUT TYPE=text NAME="send_to" VALUE="' .
539 htmlspecialchars($send_to) . '" SIZE=60><BR>' . "\n" .
543 ' <TD BGCOLOR="' . $color[4] . '" ALIGN=RIGHT>' . "\n" .
545 ' </TD><TD BGCOLOR="' . $color[4] . '" ALIGN=LEFT>' . "\n" .
546 ' <INPUT TYPE=text NAME="send_to_cc" SIZE=60 VALUE="' .
547 htmlspecialchars($send_to_cc) . '"><BR>' . "\n" .
551 ' <TD BGCOLOR="' . $color[4] . '" ALIGN=RIGHT>' . "\n" .
553 ' </TD><TD BGCOLOR="' . $color[4] . '" ALIGN=LEFT>' . "\n" .
554 ' <INPUT TYPE=text NAME="send_to_bcc" VALUE="' .
555 htmlspecialchars($send_to_bcc) . '" SIZE=60><BR>' . "\n" .
556 '</TD></TR>' . "\n" .
558 ' <TD BGCOLOR="' . $color[4] . '" ALIGN=RIGHT>' . "\n" .
560 ' </TD><TD BGCOLOR="' . $color[4] . '" ALIGN=LEFT>' . "\n";
562 $reply_subj = str_replace('"', "'", $reply_subj);
563 $reply_subj = trim($reply_subj);
564 if (substr(strtolower($reply_subj), 0, 3) != 're:') {
565 $reply_subj = 'Re: ' . $reply_subj;
567 echo ' <INPUT TYPE=text NAME=subject SIZE=60 VALUE="' .
568 htmlspecialchars($reply_subj) . '">';
570 elseif ($forward_subj) {
571 $forward_subj = trim($forward_subj);
572 if ((substr(strtolower($forward_subj), 0, 4) != 'fwd:') &&
573 (substr(strtolower($forward_subj), 0, 5) != '[fwd:') &&
574 (substr(strtolower($forward_subj), 0, 6) != '[ fwd:')) {
575 $forward_subj = '[Fwd: ' . $forward_subj . ']';
577 echo ' <INPUT TYPE=text NAME=subject SIZE=60 VALUE="' .
578 htmlspecialchars($forward_subj) . '">';
580 echo ' <INPUT TYPE=text NAME=subject SIZE=60 VALUE="' .
581 htmlspecialchars($subject) . '">';
583 echo '</td></tr>' . "\n\n";
585 if ($location_of_buttons == 'between') {
586 showComposeButtonRow();
589 echo ' <TR>' . "\n" .
590 ' <TD BGCOLOR="' . $color[4] . '" COLSPAN=2>' . "\n" .
591 ' <TEXTAREA NAME=body ROWS=20 COLS="' .
592 $editor_size . '" WRAP=HARD>' . htmlspecialchars($body);
593 if ($use_signature == true && $newmail == true && !isset($from_htmladdr_search)) {
594 echo "\n\n".($prefix_sig==true?
"-- \n":'').htmlspecialchars($signature);
596 echo '</TEXTAREA><BR>' . "\n" .
600 if ($location_of_buttons == 'bottom') {
601 showComposeButtonRow();
603 echo ' <TR><TD COLSPAN=2 ALIGN=LEFT>';
604 echo ' <INPUT TYPE=SUBMIT NAME=send VALUE="' . _("Send") . '"></TD></TR>' . "\n";
607 /* This code is for attachments */
608 echo ' <TR>' . "\n" .
609 ' <TD VALIGN=MIDDLE ALIGN=RIGHT>' . "\n" .
612 ' <TD VALIGN=MIDDLE ALIGN=LEFT>' . "\n" .
613 ' <INPUT NAME="attachfile" SIZE=48 TYPE="file">' . "\n" .
614 ' <input type="submit" name="attach"' .
615 ' value="' . _("Add") .'">' . "\n" .
619 if (count($attachments)) {
620 $hashed_attachment_dir = getHashedDir($username, $attachment_dir);
621 echo '<tr><td bgcolor="' . $color[0] . '" align=right>' . "\n" .
623 '</td><td align=left bgcolor="' . $color[0] . '">';
624 foreach ($attachments as $key => $info) {
625 $attached_file = "$hashed_attachment_dir/$info[localfilename]";
626 echo '<input type="checkbox" name="delete[]" value="' . $key . "\">\n" .
627 $info['remotefilename'] . ' - ' . $info['type'] . ' (' .
628 show_readable_size(filesize($attached_file)) . ")<br>\n";
631 echo '<input type="submit" name="do_delete" value="' .
632 _("Delete selected attachments") . "\">\n" .
635 /* End of attachment code */
637 echo '</TABLE>' . "\n";
639 echo '<input type=hidden name=reply_id value=' . $reply_id . ">\n";
641 echo '<INPUT TYPE=hidden NAME=mailbox VALUE="' . htmlspecialchars($mailbox) .
644 do_hook('compose_bottom');
645 echo '</BODY></HTML>' . "\n";
649 function showComposeButtonRow() {
650 global $use_javascript_addr_book, $save_as_draft,
651 $default_use_priority, $mailprio, $default_use_mdn,
652 $data_dir, $username;
654 echo " <TR><TD>\n</TD><TD>\n";
655 if ($default_use_priority) {
656 if(!isset($mailprio)) {
659 echo _("Priority") .': <select name="mailprio">'.
660 '<option value="1"'.($mailprio=='1'?
' selected':'').'>'. _("High") .'</option>'.
661 '<option value="3"'.($mailprio=='3'?
' selected':'').'>'. _("Normal") .'</option>'.
662 '<option value="5"'.($mailprio=='5'?
' selected':'').'>'. _("Low").'</option>'.
665 $mdn_user_support=getPref($data_dir, $username, 'mdn_user_support',$default_use_mdn);
666 if ($default_use_mdn) {
667 if ($mdn_user_support) {
668 echo "\n\t". _("Receipt") .': '.
669 '<input type="checkbox" name="request_mdn" value=1>'. _("On read").
670 ' <input type="checkbox" name="request_dr" value=1>'. _("On Delivery");
674 echo " <TR><td>\n </td><td>\n";
675 if ($use_javascript_addr_book) {
676 echo " <SCRIPT LANGUAGE=JavaScript><!--\n document.write(\"".
677 " <input type=button value=\\\""._("Addresses").
678 "\\\" onclick='javascript:open_abook();'>\");".
679 " // --></SCRIPT><NOSCRIPT>\n".
680 " <input type=submit name=\"html_addr_search\" value=\"".
681 _("Addresses")."\">".
684 echo " <input type=submit name=\"html_addr_search\" value=\"".
685 _("Addresses")."\">";
687 echo "\n <INPUT TYPE=SUBMIT NAME=send VALUE=\"". _("Send") . "\">\n";
689 if ($save_as_draft) {
690 echo '<input type="submit" name ="draft" value="' . _("Save Draft") . "\">\n";
693 do_hook('compose_button_row');
695 echo " </TD></TR>\n\n";
698 function checkInput ($show) {
700 * I implemented the $show variable because the error messages
701 * were getting sent before the page header. So, I check once
702 * using $show=false, and then when i'm ready to display the error
705 global $body, $send_to, $subject, $color;
707 if ($send_to == "") {
709 plain_error_message(_("You have not filled in the \"To:\" field."), $color);
714 } /* function checkInput() */
717 /* True if FAILURE */
718 function saveAttachedFiles() {
719 global $HTTP_POST_FILES, $attachment_dir, $attachments, $username;
721 $hashed_attachment_dir = getHashedDir($username, $attachment_dir);
722 $localfilename = GenerateRandomString(32, '', 7);
723 $full_localfilename = "$hashed_attachment_dir/$localfilename";
724 while (file_exists($full_localfilename)) {
725 $localfilename = GenerateRandomString(32, '', 7);
726 $full_localfilename = "$hashed_attachment_dir/$localfilename";
729 if (!@rename
($HTTP_POST_FILES['attachfile']['tmp_name'], $full_localfilename)) {
730 if (!@copy
($HTTP_POST_FILES['attachfile']['tmp_name'], $full_localfilename)) {
735 $newAttachment['localfilename'] = $localfilename;
736 $newAttachment['remotefilename'] = $HTTP_POST_FILES['attachfile']['name'];
737 $newAttachment['type'] = strtolower($HTTP_POST_FILES['attachfile']['type']);
739 if ($newAttachment['type'] == "") {
740 $newAttachment['type'] = 'application/octet-stream';
743 $attachments[] = $newAttachment;
749 function ClearAttachments()
751 global $username, $attachments, $attachment_dir;
752 $hashed_attachment_dir = getHashedDir($username, $attachment_dir);
754 foreach ($attachments as $info) {
755 $attached_file = "$hashed_attachment_dir/$info[localfilename]";
756 if (file_exists($attached_file)) {
757 unlink($attached_file);
761 $attachments = array();
764 function getReplyCitation($orig_from)
766 global $reply_citation_style, $reply_citation_start, $reply_citation_end;
768 /* First, return an empty string when no citation style selected. */
769 if (($reply_citation_style == '') ||
($reply_citation_style == 'none')) {
773 /* Decode the users name. */
774 $parpos = strpos($orig_from, '(');
775 if ($parpos === false) {
776 $orig_from = trim(substr($orig_from, 0, strpos($orig_from, '<')));
777 $orig_from = str_replace('"', '', $orig_from);
778 $orig_from = str_replace("'", '', $orig_from);
780 $end_parpos = strrpos($orig_from, ')');
781 $end_parpos -= ($end_parpos === false ?
$end_parpos : $parpos +
1);
782 $orig_from = trim(substr($orig_from, $parpos +
1, $end_parpos));
785 /* Make sure our final value isn't an empty string. */
786 if ($orig_from == '') {
790 /* Otherwise, try to select the desired citation style. */
791 switch ($reply_citation_style) {
794 $end = ' ' . _("said") . ':';
797 $start = '<' . _("quote") . ' ' . _("who") . '="';
801 $start = $reply_citation_start;
802 $end = $reply_citation_end;
808 /* Build and return the citation string. */
809 return ($start . $orig_from . $end . "\n");