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 (! isset($reply_id)) {
45 if (!saveMessageAsDraft($send_to, $send_to_cc, $send_to_bcc, $subject, $body, $reply_id, $MDN)) {
49 $draft_message = _("Draft Email Saved");
50 /* If this is a resumed draft, then delete the original */
51 if(isset($delete_draft)) {
52 Header("Location: delete_message.php?mailbox=" . urlencode($draft_folder) .
53 "&message=$delete_draft&sort=$sort&startMessage=1&saved_draft=yes");
57 if ($compose_new_win == '1') {
58 Header("Location: compose.php?saved_draft=yes");
62 Header("Location: right_main.php?mailbox=$draft_folder&sort=$sort".
63 "&startMessage=1¬e=$draft_message");
71 if (isset($HTTP_POST_FILES['attachfile']) &&
72 $HTTP_POST_FILES['attachfile']['tmp_name'] &&
73 $HTTP_POST_FILES['attachfile']['tmp_name'] != 'none') {
74 $AttachFailure = saveAttachedFiles();
76 if (checkInput(false) && !isset($AttachFailure)) {
77 $urlMailbox = urlencode (trim($mailbox));
78 if (! isset($reply_id)) {
82 * Set $default_charset to correspond with the user's selection
83 * of language interface.
88 * This is to change all newlines to \n
89 * We'll change them to \r\n later (in the sendMessage function)
91 $body = str_replace("\r\n", "\n", $body);
92 $body = str_replace("\r", "\n", $body);
95 * Rewrap $body so that no line is bigger than $editor_size
96 * This should only really kick in the sqWordWrap function
97 * if the browser doesn't support "HARD" as the wrap type
98 * Or, in Opera's case, something goes wrong.
100 $body = explode("\n", $body);
102 foreach ($body as $line) {
103 if( $line <> '-- ' ) {
104 $line = rtrim($line);
106 if (strlen($line) <= $editor_size +
1) {
107 $newBody .= $line . "\n";
109 sqWordWrap($line, $editor_size) . "\n";
115 do_hook('compose_send');
117 $MDN = False; // we are not sending a mdn response
118 if (! isset($mailprio)) {
119 $Result = sendMessage($send_to, $send_to_cc, $send_to_bcc,
120 $subject, $body, $reply_id, $MDN);
122 $Result = sendMessage($send_to, $send_to_cc, $send_to_bcc,
123 $subject, $body, $reply_id, $MDN, $mailprio);
129 if ( isset($delete_draft)) {
130 Header("Location: delete_message.php?mailbox=" . urlencode( $draft_folder ).
131 "&message=$delete_draft&sort=$sort&startMessage=1&mail_sent=yes");
134 if ($compose_new_win == '1') {
135 Header("Location: compose.php?mail_sent=yes");
138 Header("Location: right_main.php?mailbox=$urlMailbox&sort=$sort".
143 *$imapConnection = sqimap_login($username, $key, $imapServerAddress,
146 if ($compose_new_win == '1') {
147 compose_Header($color, $mailbox);
150 displayPageHeader($color, $mailbox);
152 if (isset($AttachFailure)) {
153 plain_error_message(_("Could not move/copy file. File not attached"),
159 /* sqimap_logout($imapConnection); */
161 } elseif (isset($html_addr_search_done)) {
162 if ($compose_new_win == '1') {
163 compose_Header($color, $mailbox);
166 displayPageHeader($color, $mailbox);
169 if (isset($send_to_search) && is_array($send_to_search)) {
170 foreach ($send_to_search as $k => $v) {
171 if (substr($k, 0, 1) == 'T') {
177 elseif (substr($k, 0, 1) == 'C') {
183 elseif (substr($k, 0, 1) == 'B') {
185 $send_to_bcc .= ', ';
192 } elseif (isset($html_addr_search)) {
193 if (isset($HTTP_POST_FILES['attachfile']) &&
194 $HTTP_POST_FILES['attachfile']['tmp_name'] &&
195 $HTTP_POST_FILES['attachfile']['tmp_name'] != 'none') {
196 if (saveAttachedFiles()) {
197 plain_error_message(_("Could not move/copy file. File not attached"), $color);
201 * I am using an include so as to elminiate an extra unnecessary
202 * click. If you can think of a better way, please implement it.
204 include_once('./addrbook_search_html.php');
205 } elseif (isset($attach)) {
206 if (saveAttachedFiles()) {
207 plain_error_message(_("Could not move/copy file. File not attached"), $color);
209 if ($compose_new_win == '1') {
210 compose_Header($color, $mailbox);
213 displayPageHeader($color, $mailbox);
216 } elseif (isset($do_delete)) {
217 if ($compose_new_win == '1') {
218 compose_Header($color, $mailbox);
221 displayPageHeader($color, $mailbox);
224 $hashed_attachment_dir = getHashedDir($username, $attachment_dir);
225 if (isset($delete) && is_array($delete)) {
226 foreach($delete as $index) {
227 $attached_file = $hashed_attachment_dir . '/'
228 . $attachments[$index]['localfilename'];
229 unlink ($attached_file);
230 unset ($attachments[$index]);
237 * This handles the default case as well as the error case
238 * (they had the same code) --> if (isset($smtpErrors))
240 $imapConnection = sqimap_login($username, $key, $imapServerAddress,
242 if ($compose_new_win == '1') {
243 compose_Header($color, $mailbox);
246 displayPageHeader($color, $mailbox);
253 if (isset($forward_id) && $forward_id && isset($ent_num) && $ent_num) {
257 if (isset($draft_id) && $draft_id && isset($ent_num) && $ent_num) {
263 sqimap_logout($imapConnection);
269 /**************** Only function definitions go below *************/
272 /* This function is used when not sending or adding attachments */
273 function newMail () {
274 global $forward_id, $imapConnection, $msg, $ent_num, $body_ary, $body,
275 $reply_id, $send_to, $send_to_cc, $mailbox, $send_to_bcc, $editor_size,
276 $draft_id, $use_signature;
278 $send_to = decodeHeader($send_to, false);
279 $send_to_cc = decodeHeader($send_to_cc, false);
280 $send_to_bcc = decodeHeader($send_to_bcc, false);
284 } elseif ($reply_id) {
290 $use_signature = FALSE;
294 sqimap_mailbox_select($imapConnection, $mailbox);
295 $message = sqimap_get_message($imapConnection, $id, $mailbox);
296 $orig_header = $message->header
;
298 $message = getEntity($message, $ent_num);
300 if ($message->header
->type0
== 'text' ||
301 $message->header
->type1
== 'message') {
304 mime_fetch_body($imapConnection, $id, $ent_num),
305 $message->header
->encoding
);
308 mime_fetch_body($imapConnection, $id, 1),
309 $message->header
->encoding
);
315 if ($message->header
->type1
== 'html') {
316 $body = strip_tags($body);
320 $body_ary = explode("\n", $body);
321 $i = count($body_ary) - 1;
322 while ($i >= 0 && ereg("^[>\\s]*$", $body_ary[$i])) {
323 unset($body_ary[$i]);
327 for ($i=0; isset($body_ary[$i]); $i++
) {
329 if (ereg('^[ >]+', $body_ary[$i])) {
330 $body_ary[$i] = '>' . $body_ary[$i];
332 $body_ary[$i] = '> ' . $body_ary[$i];
336 sqWordWrap($body_ary[$i], $editor_size - 1);
338 $body .= $body_ary[$i] . "\n";
339 unset($body_ary[$i]);
342 $bodyTop = '-------- ' . _("Original Message") . " --------\n" .
343 _("Subject") . ': ' . $orig_header->subject
. "\n" .
344 _("From") . ': ' . $orig_header->from
. "\n" .
346 getLongDateString( $orig_header->date
). "\n" .
347 _("To") . ': ' . $orig_header->to
[0] . "\n";
348 if (count($orig_header->to
) > 1) {
349 for ($x=1; $x < count($orig_header->to
); $x++
) {
350 $bodyTop .= ' ' . $orig_header->to
[$x] . "\n";
354 $body = $bodyTop . $body;
357 $orig_from = decodeHeader($orig_header->from
, false);
358 $body = getReplyCitation($orig_from) . $body;
365 $send_to = sqimap_find_email($send_to);
368 /* This formats a CC string if they hit "reply all" */
369 if ($send_to_cc != '') {
370 $send_to_cc = ereg_replace('"[^"]*"', '', $send_to_cc);
371 $send_to_cc = str_replace(';', ',', $send_to_cc);
372 $sendcc = explode(',', $send_to_cc);
375 for ($i = 0; $i < count($sendcc); $i++
) {
376 $sendcc[$i] = trim($sendcc[$i]);
377 if ($sendcc[$i] == '') {
381 $sendcc[$i] = sqimap_find_email($sendcc[$i]);
382 $whofrom = sqimap_find_displayable_name($msg['HEADER']['FROM']);
383 $whoreplyto = sqimap_find_email($msg['HEADER']['REPLYTO']);
385 if ((strtolower(trim($sendcc[$i])) != strtolower(trim($whofrom))) &&
386 (strtolower(trim($sendcc[$i])) != strtolower(trim($whoreplyto))) &&
387 (trim($sendcc[$i]) != '')) {
388 $send_to_cc .= trim($sendcc[$i]) . ', ';
391 $send_to_cc = trim($send_to_cc);
392 if (substr($send_to_cc, -1) == ',') {
393 $send_to_cc = substr($send_to_cc, 0, strlen($send_to_cc) - 1);
396 } /* function newMail() */
399 function getAttachments($message) {
400 global $mailbox, $attachments, $attachment_dir, $imapConnection,
401 $ent_num, $forward_id, $draft_id, $username;
403 if (isset($draft_id)) {
410 sqimap_mailbox_select($imapConnection, $mailbox);
411 $message = sqimap_get_message($imapConnection, $id, $mailbox);
414 $hashed_attachment_dir = getHashedDir($username, $attachment_dir);
415 if (count($message->entities
) == 0) {
416 if ($message->header
->entity_id
!= $ent_num) {
417 $filename = decodeHeader($message->header
->filename
);
419 if ($filename == "") {
420 $filename = "untitled-".$message->header
->entity_id
;
423 $localfilename = GenerateRandomString(32, '', 7);
424 $full_localfilename = "$hashed_attachment_dir/$localfilename";
425 while (file_exists($full_localfilename)) {
426 $localfilename = GenerateRandomString(32, '', 7);
427 $full_localfilename = "$hashed_attachment_dir/$localfilename";
430 $newAttachment = array();
431 $newAttachment['localfilename'] = $localfilename;
432 $newAttachment['remotefilename'] = $filename;
433 $newAttachment['type'] = strtolower($message->header
->type0
.
434 '/' . $message->header
->type1
);
436 /* Write Attachment to file */
437 $fp = fopen ("$hashed_attachment_dir/$localfilename", 'w');
438 fputs($fp, decodeBody(mime_fetch_body($imapConnection,
439 $id, $message->header
->entity_id
),
440 $message->header
->encoding
));
443 $attachments[] = $newAttachment;
446 for ($i = 0; $i < count($message->entities
); $i++
) {
447 getAttachments($message->entities
[$i]);
453 function showInputForm () {
454 global $send_to, $send_to_cc, $reply_subj, $forward_subj, $body,
455 $passed_body, $color, $use_signature, $signature, $prefix_sig,
456 $editor_size, $attachments, $subject, $newmail,
457 $use_javascript_addr_book, $send_to_bcc, $reply_id, $mailbox,
458 $from_htmladdr_search, $location_of_buttons, $attachment_dir,
459 $username, $data_dir, $identity, $draft_id, $delete_draft,
460 $mailprio, $default_use_mdn, $mdn_user_support, $compose_new_win,
461 $saved_draft, $mail_sent;
463 $subject = decodeHeader($subject, false);
464 $reply_subj = decodeHeader($reply_subj, false);
465 $forward_subj = decodeHeader($forward_subj, false);
467 if ($use_javascript_addr_book) {
468 echo "\n". '<SCRIPT LANGUAGE=JavaScript><!--' . "\n" .
469 'function open_abook() { ' . "\n" .
470 ' var nwin = window.open("addrbook_popup.php","abookpopup",' .
471 '"width=670,height=300,resizable=yes,scrollbars=yes");' . "\n" .
472 ' if((!nwin.opener) && (document.windows != null))' . "\n" .
473 ' nwin.opener = document.windows;' . "\n" .
475 '// --></SCRIPT>' . "\n\n";
478 echo "\n" . '<FORM name=compose action="compose.php" METHOD=POST ' .
479 'ENCTYPE="multipart/form-data"';
480 do_hook("compose_form");
485 if (isset($draft_id)) {
486 echo '<input type="hidden" name="delete_draft" value="' . $draft_id . "\">\n";
488 if (isset($delete_draft)) {
489 echo '<input type="hidden" name="delete_draft" value="' . $delete_draft. "\">\n";
491 if ($saved_draft == 'yes') {
492 echo '<BR><CENTER><B>'. _("Draft Saved").'</CENTER></B>';
494 if ($mail_sent == 'yes') {
495 echo '<BR><CENTER><B>'. _("Your Message has been sent").'</CENTER></B>';
497 echo '<TABLE WIDTH="100%" ALIGN=center CELLSPACING=0 BORDER=0>' . "\n";
498 if ($compose_new_win == '1') {
499 echo ' <TR><TD></TD><TD ALIGN="RIGHT"><INPUT TYPE="BUTTON" NAME="Close" onClick="return self.close()" VALUE='._("Close").'></TD></TR>'."\n";
501 if ($location_of_buttons == 'top') {
502 showComposeButtonRow();
505 $idents = getPref($data_dir, $username, 'identities', 0);
507 echo ' <TR>' . "\n" .
508 ' <TD BGCOLOR="' . $color[4] . '" WIDTH="10%" ALIGN=RIGHT>' .
511 ' </TD><TD BGCOLOR="' . $color[4] . '" WIDTH="90%">' . "\n" .
512 '<select name=identity>' . "\n" .
513 '<option value=default>' .
514 htmlspecialchars(getPref($data_dir, $username, 'full_name'));
515 $em = getPref($data_dir, $username, 'email_address');
517 echo htmlspecialchars(' <' . $em . '>') . "\n";
519 for ($i = 1; $i < $idents; $i ++
) {
520 echo '<option value="' . $i . '"';
521 if (isset($identity) && $identity == $i) {
524 echo '>' . htmlspecialchars(getPref($data_dir, $username,
526 $em = getPref($data_dir, $username, 'email_address' . $i);
528 echo htmlspecialchars(' <' . $em . '>') . "\n";
532 echo '</select>' . "\n" .
536 echo ' <TR>' . "\n" .
537 ' <TD BGCOLOR="' . $color[4] . '" WIDTH="10%" ALIGN=RIGHT>' . "\n" .
539 ' </TD><TD BGCOLOR="' . $color[4] . '" WIDTH="90%">' . "\n" .
540 ' <INPUT TYPE=text NAME="send_to" VALUE="' .
541 htmlspecialchars($send_to) . '" SIZE=60><BR>' . "\n" .
545 ' <TD BGCOLOR="' . $color[4] . '" ALIGN=RIGHT>' . "\n" .
547 ' </TD><TD BGCOLOR="' . $color[4] . '" ALIGN=LEFT>' . "\n" .
548 ' <INPUT TYPE=text NAME="send_to_cc" SIZE=60 VALUE="' .
549 htmlspecialchars($send_to_cc) . '"><BR>' . "\n" .
553 ' <TD BGCOLOR="' . $color[4] . '" ALIGN=RIGHT>' . "\n" .
555 ' </TD><TD BGCOLOR="' . $color[4] . '" ALIGN=LEFT>' . "\n" .
556 ' <INPUT TYPE=text NAME="send_to_bcc" VALUE="' .
557 htmlspecialchars($send_to_bcc) . '" SIZE=60><BR>' . "\n" .
558 '</TD></TR>' . "\n" .
560 ' <TD BGCOLOR="' . $color[4] . '" ALIGN=RIGHT>' . "\n" .
562 ' </TD><TD BGCOLOR="' . $color[4] . '" ALIGN=LEFT>' . "\n";
564 $reply_subj = str_replace('"', "'", $reply_subj);
565 $reply_subj = trim($reply_subj);
566 if (substr(strtolower($reply_subj), 0, 3) != 're:') {
567 $reply_subj = 'Re: ' . $reply_subj;
569 echo ' <INPUT TYPE=text NAME=subject SIZE=60 VALUE="' .
570 htmlspecialchars($reply_subj) . '">';
572 elseif ($forward_subj) {
573 $forward_subj = trim($forward_subj);
574 if ((substr(strtolower($forward_subj), 0, 4) != 'fwd:') &&
575 (substr(strtolower($forward_subj), 0, 5) != '[fwd:') &&
576 (substr(strtolower($forward_subj), 0, 6) != '[ fwd:')) {
577 $forward_subj = '[Fwd: ' . $forward_subj . ']';
579 echo ' <INPUT TYPE=text NAME=subject SIZE=60 VALUE="' .
580 htmlspecialchars($forward_subj) . '">';
582 echo ' <INPUT TYPE=text NAME=subject SIZE=60 VALUE="' .
583 htmlspecialchars($subject) . '">';
585 echo '</td></tr>' . "\n\n";
587 if ($location_of_buttons == 'between') {
588 showComposeButtonRow();
591 echo ' <TR>' . "\n" .
592 ' <TD BGCOLOR="' . $color[4] . '" COLSPAN=2>' . "\n" .
593 ' <TEXTAREA NAME=body ROWS=20 COLS="' .
594 $editor_size . '" WRAP=HARD>' . htmlspecialchars($body);
595 if ($use_signature == true && $newmail == true && !isset($from_htmladdr_search)) {
596 echo "\n\n".($prefix_sig==true?
"-- \n":'').htmlspecialchars($signature);
598 echo '</TEXTAREA><BR>' . "\n" .
602 if ($location_of_buttons == 'bottom') {
603 showComposeButtonRow();
605 echo ' <TR><TD COLSPAN=2 ALIGN=LEFT>';
606 echo ' <INPUT TYPE=SUBMIT NAME=send VALUE="' . _("Send") . '"></TD></TR>' . "\n";
609 /* This code is for attachments */
610 echo ' <TR>' . "\n" .
611 ' <TD VALIGN=MIDDLE ALIGN=RIGHT>' . "\n" .
614 ' <TD VALIGN=MIDDLE ALIGN=LEFT>' . "\n" .
615 ' <INPUT NAME="attachfile" SIZE=48 TYPE="file">' . "\n" .
616 ' <input type="submit" name="attach"' .
617 ' value="' . _("Add") .'">' . "\n" .
621 if (count($attachments)) {
622 $hashed_attachment_dir = getHashedDir($username, $attachment_dir);
623 echo '<tr><td bgcolor="' . $color[0] . '" align=right>' . "\n" .
625 '</td><td align=left bgcolor="' . $color[0] . '">';
626 foreach ($attachments as $key => $info) {
627 $attached_file = "$hashed_attachment_dir/$info[localfilename]";
628 echo '<input type="checkbox" name="delete[]" value="' . $key . "\">\n" .
629 $info['remotefilename'] . ' - ' . $info['type'] . ' (' .
630 show_readable_size(filesize($attached_file)) . ")<br>\n";
633 echo '<input type="submit" name="do_delete" value="' .
634 _("Delete selected attachments") . "\">\n" .
637 /* End of attachment code */
639 echo '</TABLE>' . "\n";
641 echo '<input type=hidden name=reply_id value=' . $reply_id . ">\n";
643 echo '<INPUT TYPE=hidden NAME=mailbox VALUE="' . htmlspecialchars($mailbox) .
646 do_hook('compose_bottom');
647 echo '</BODY></HTML>' . "\n";
651 function showComposeButtonRow() {
652 global $use_javascript_addr_book, $save_as_draft,
653 $default_use_priority, $mailprio, $default_use_mdn,
654 $data_dir, $username;
656 echo " <TR><TD>\n</TD><TD>\n";
657 if ($default_use_priority) {
658 if(!isset($mailprio)) {
661 echo _("Priority") .': <select name="mailprio">'.
662 '<option value="1"'.($mailprio=='1'?
' selected':'').'>'. _("High") .'</option>'.
663 '<option value="3"'.($mailprio=='3'?
' selected':'').'>'. _("Normal") .'</option>'.
664 '<option value="5"'.($mailprio=='5'?
' selected':'').'>'. _("Low").'</option>'.
667 $mdn_user_support=getPref($data_dir, $username, 'mdn_user_support',$default_use_mdn);
668 if ($default_use_mdn) {
669 if ($mdn_user_support) {
670 echo "\n\t". _("Receipt") .': '.
671 '<input type="checkbox" name="request_mdn" value=1>'. _("On read").
672 ' <input type="checkbox" name="request_dr" value=1>'. _("On Delivery");
676 echo " <TR><td>\n </td><td>\n";
677 if ($use_javascript_addr_book) {
678 echo " <SCRIPT LANGUAGE=JavaScript><!--\n document.write(\"".
679 " <input type=button value=\\\""._("Addresses").
680 "\\\" onclick='javascript:open_abook();'>\");".
681 " // --></SCRIPT><NOSCRIPT>\n".
682 " <input type=submit name=\"html_addr_search\" value=\"".
683 _("Addresses")."\">".
686 echo " <input type=submit name=\"html_addr_search\" value=\"".
687 _("Addresses")."\">";
689 echo "\n <INPUT TYPE=SUBMIT NAME=send VALUE=\"". _("Send") . "\">\n";
691 if ($save_as_draft) {
692 echo '<input type="submit" name ="draft" value="' . _("Save Draft") . "\">\n";
695 do_hook('compose_button_row');
697 echo " </TD></TR>\n\n";
700 function checkInput ($show) {
702 * I implemented the $show variable because the error messages
703 * were getting sent before the page header. So, I check once
704 * using $show=false, and then when i'm ready to display the error
707 global $body, $send_to, $subject, $color;
709 if ($send_to == "") {
711 plain_error_message(_("You have not filled in the \"To:\" field."), $color);
716 } /* function checkInput() */
719 /* True if FAILURE */
720 function saveAttachedFiles() {
721 global $HTTP_POST_FILES, $attachment_dir, $attachments, $username;
723 $hashed_attachment_dir = getHashedDir($username, $attachment_dir);
724 $localfilename = GenerateRandomString(32, '', 7);
725 $full_localfilename = "$hashed_attachment_dir/$localfilename";
726 while (file_exists($full_localfilename)) {
727 $localfilename = GenerateRandomString(32, '', 7);
728 $full_localfilename = "$hashed_attachment_dir/$localfilename";
731 if (!@rename
($HTTP_POST_FILES['attachfile']['tmp_name'], $full_localfilename)) {
732 if (!@copy
($HTTP_POST_FILES['attachfile']['tmp_name'], $full_localfilename)) {
737 $newAttachment['localfilename'] = $localfilename;
738 $newAttachment['remotefilename'] = $HTTP_POST_FILES['attachfile']['name'];
739 $newAttachment['type'] = strtolower($HTTP_POST_FILES['attachfile']['type']);
741 if ($newAttachment['type'] == "") {
742 $newAttachment['type'] = 'application/octet-stream';
745 $attachments[] = $newAttachment;
751 function ClearAttachments()
753 global $username, $attachments, $attachment_dir;
754 $hashed_attachment_dir = getHashedDir($username, $attachment_dir);
756 foreach ($attachments as $info) {
757 $attached_file = "$hashed_attachment_dir/$info[localfilename]";
758 if (file_exists($attached_file)) {
759 unlink($attached_file);
763 $attachments = array();
766 function getReplyCitation($orig_from)
768 global $reply_citation_style, $reply_citation_start, $reply_citation_end;
770 /* First, return an empty string when no citation style selected. */
771 if (($reply_citation_style == '') ||
($reply_citation_style == 'none')) {
775 /* Decode the users name. */
776 $parpos = strpos($orig_from, '(');
777 if ($parpos === false) {
778 $orig_from = trim(substr($orig_from, 0, strpos($orig_from, '<')));
779 $orig_from = str_replace('"', '', $orig_from);
780 $orig_from = str_replace("'", '', $orig_from);
782 $end_parpos = strrpos($orig_from, ')');
783 $end_parpos -= ($end_parpos === false ?
$end_parpos : $parpos +
1);
784 $orig_from = trim(substr($orig_from, $parpos +
1, $end_parpos));
787 /* Make sure our final value isn't an empty string. */
788 if ($orig_from == '') {
792 /* Otherwise, try to select the desired citation style. */
793 switch ($reply_citation_style) {
796 $end = ' ' . _("said") . ':';
799 $start = '<' . _("quote") . ' ' . _("who") . '="';
803 $start = $reply_citation_start;
804 $end = $reply_citation_end;
810 /* Build and return the citation string. */
811 return ($start . $orig_from . $end . "\n");