af1a2bde9cddb4eb8de36075b772f1632e9e19a7
[squirrelmail.git] / src / compose.php
1 <?php
2 /**
3 ** compose.php
4 **
5 ** Copyright (c) 1999-2000 The SquirrelMail development team
6 ** Licensed under the GNU GPL. For full terms see the file COPYING.
7 **
8 ** This code sends a mail.
9 **
10 ** There are 3 modes of operation:
11 ** - Start new mail
12 ** - Add an attachment
13 ** - Send mail
14 **
15 ** $Id$
16 **/
17
18 require_once('../src/validate.php');
19 require_once('../functions/imap.php');
20 require_once('../functions/date.php');
21 require_once('../functions/mime.php');
22 require_once('../functions/smtp.php');
23 require_once('../functions/display_messages.php');
24 require_once('../functions/plugin.php');
25
26 if (!isset($attachments))
27 {
28 $attachments = array();
29 session_register('attachments');
30 }
31
32
33 // This function is used when not sending or adding attachments
34 function newMail () {
35 global $forward_id, $imapConnection, $msg, $ent_num, $body_ary, $body,
36 $reply_id, $send_to, $send_to_cc, $mailbox, $send_to_bcc, $editor_size,
37 $draft_id, $use_signature;
38
39 $send_to = decodeHeader($send_to);
40 $send_to_cc = decodeHeader($send_to_cc);
41 $send_to_bcc = decodeHeader($send_to_bcc);
42
43 if ($forward_id)
44 $id = $forward_id;
45 elseif ($reply_id)
46 $id = $reply_id;
47
48 if ($draft_id){
49 $id = $draft_id;
50 $use_signature = FALSE;
51 }
52
53 if (isset($id)) {
54 sqimap_mailbox_select($imapConnection, $mailbox);
55 $message = sqimap_get_message($imapConnection, $id, $mailbox);
56 $orig_header = $message->header;
57 if ($ent_num)
58 $message = getEntity($message, $ent_num);
59
60 if ($message->header->type0 == 'text' || $message->header->type1 == 'message') {
61 if ($ent_num)
62 $body = decodeBody(mime_fetch_body($imapConnection, $id, $ent_num), $message->header->encoding);
63 else
64 $body = decodeBody(mime_fetch_body($imapConnection, $id, 1), $message->header->encoding);
65 } else {
66 $body = "";
67 }
68
69 if ($message->header->type1 == "html")
70 $body = strip_tags($body);
71
72 sqUnWordWrap($body);
73 $body_ary = explode("\n", $body);
74 $i = count($body_ary) - 1;
75 while ($i >= 0 && ereg("^[>\\s]*$", $body_ary[$i])) {
76 unset($body_ary[$i]);
77 $i --;
78 }
79 $body = "";
80 for ($i=0; isset($body_ary[$i]); $i++) {
81 if ($reply_id)
82 {
83 if (ereg('^[ >]+', $body_ary[$i]))
84 {
85 $body_ary[$i] = '>' . $body_ary[$i];
86 }
87 else
88 {
89 $body_ary[$i] = '> ' . $body_ary[$i];
90 }
91 }
92 sqWordWrap($body_ary[$i], $editor_size - 1);
93 $body .= $body_ary[$i] . "\n";
94 unset($body_ary[$i]);
95 }
96 if ($forward_id)
97 {
98 $bodyTop = "-------- " . _("Original Message") . " --------\n";
99 $bodyTop .= _("Subject") . ": " . $orig_header->subject . "\n";
100 $bodyTop .= _("From") . ": " . $orig_header->from . "\n";
101 $bodyTop .= _("To") . ": " . $orig_header->to[0] . "\n";
102 if (count($orig_header->to) > 1) {
103 for ($x=1; $x < count($orig_header->to); $x++) {
104 $bodyTop .= " " . $orig_header->to[$x] . "\n";
105 }
106 }
107 $bodyTop .= "\n";
108 $body = $bodyTop . $body;
109 } else if ($reply_id) {
110 $orig_from = decodeHeader($orig_header->from);
111 $orig_from = trim(substr($orig_from,0,strpos($orig_from,'<')));
112 $orig_from = str_replace('"','',$orig_from);
113 $orig_from = str_replace("'",'',$orig_from);
114 $body = getReplyCitation($orig_from) . $body;
115 }
116
117 return;
118 }
119
120 if (!$send_to) {
121 $send_to = sqimap_find_email($send_to);
122 }
123
124 /** This formats a CC string if they hit "reply all" **/
125 if ($send_to_cc != "") {
126 $send_to_cc = ereg_replace( '"[^"]*"', "", $send_to_cc);
127 $send_to_cc = ereg_replace(";", ",", $send_to_cc);
128 $sendcc = explode(",", $send_to_cc);
129 $send_to_cc = "";
130
131 for ($i = 0; $i < count($sendcc); $i++) {
132 $sendcc[$i] = trim($sendcc[$i]);
133 if ($sendcc[$i] == "")
134 continue;
135
136 $sendcc[$i] = sqimap_find_email($sendcc[$i]);
137 $whofrom = sqimap_find_displayable_name($msg["HEADER"]["FROM"]);
138 $whoreplyto = sqimap_find_email($msg["HEADER"]["REPLYTO"]);
139
140 if ((strtolower(trim($sendcc[$i])) != strtolower(trim($whofrom))) &&
141 (strtolower(trim($sendcc[$i])) != strtolower(trim($whoreplyto))) &&
142 (trim($sendcc[$i]) != "")) {
143 $send_to_cc .= trim($sendcc[$i]) . ", ";
144 }
145 }
146 $send_to_cc = trim($send_to_cc);
147 if (substr($send_to_cc, -1) == ",") {
148 $send_to_cc = substr($send_to_cc, 0, strlen($send_to_cc) - 1);
149 }
150 }
151 } // function newMail()
152
153 function getAttachments($message) {
154 global $mailbox, $attachments, $attachment_dir, $imapConnection,
155 $ent_num, $forward_id, $draft_id;
156
157 if (isset($draft_id))
158 $id = $draft_id;
159 else
160 $id = $forward_id;
161
162 if (!$message) {
163 sqimap_mailbox_select($imapConnection, $mailbox);
164 $message = sqimap_get_message($imapConnection, $id,
165 $mailbox);
166 }
167
168 if (count($message->entities) == 0) {
169 if ($message->header->entity_id != $ent_num) {
170 $filename = decodeHeader($message->header->filename);
171
172 if ($filename == "")
173 $filename = "untitled-".$message->header->entity_id;
174
175 $localfilename = GenerateRandomString(32, '', 7);
176 while (file_exists($attachment_dir . $localfilename))
177 $localfilename = GenerateRandomString(32, '', 7);
178
179 $newAttachment = array();
180 $newAttachment['localfilename'] = $localfilename;
181 $newAttachment['remotefilename'] = $filename;
182 $newAttachment['type'] = strtolower($message->header->type0 .
183 '/' . $message->header->type1);
184
185 // Write Attachment to file
186 $fp = fopen ($attachment_dir.$localfilename, 'w');
187 fputs ($fp, decodeBody(mime_fetch_body($imapConnection,
188 $id, $message->header->entity_id),
189 $message->header->encoding));
190 fclose ($fp);
191
192 $attachments[] = $newAttachment;
193 }
194 } else {
195 for ($i = 0; $i < count($message->entities); $i++) {
196 getAttachments($message->entities[$i]);
197 }
198 }
199 return;
200 }
201
202 function showInputForm () {
203 global $send_to, $send_to_cc, $reply_subj, $forward_subj, $body,
204 $passed_body, $color, $use_signature, $signature, $prefix_sig,
205 $editor_size, $attachments, $subject, $newmail,
206 $use_javascript_addr_book, $send_to_bcc, $reply_id, $mailbox,
207 $from_htmladdr_search, $location_of_buttons, $attachment_dir,
208 $username, $data_dir, $identity, $draft_id;
209
210 $subject = decodeHeader($subject);
211 $reply_subj = decodeHeader($reply_subj);
212 $forward_subj = decodeHeader($forward_subj);
213
214 if ($use_javascript_addr_book) {
215 echo "\n<SCRIPT LANGUAGE=JavaScript><!--\n";
216 echo "function open_abook() { \n";
217 echo " var nwin = window.open(\"addrbook_popup.php\",\"abookpopup\",";
218 echo "\"width=670,height=300,resizable=yes,scrollbars=yes\");\n";
219 echo " if((!nwin.opener) && (document.windows != null))\n";
220 echo " nwin.opener = document.windows;\n";
221 echo "}\n";
222 echo "// --></SCRIPT>\n\n";
223 }
224
225 echo "\n<FORM name=compose action=\"compose.php\" METHOD=POST ENCTYPE=\"multipart/form-data\"";
226 do_hook("compose_form");
227 echo ">\n";
228
229 if ( isset($draft_id))
230 echo "<input type=\"hidden\" name=\"delete_draft\" value=\"$draft_id\">\n";
231
232 echo "<TABLE WIDTH=\"100%\" ALIGN=center CELLSPACING=0 BORDER=0>\n";
233
234 if ($location_of_buttons == 'top') showComposeButtonRow();
235
236 $idents = getPref($data_dir, $username, 'identities');
237 if ($idents != '' && $idents > 1) {
238 echo " <TR>\n";
239 echo " <TD BGCOLOR=\"$color[4]\" WIDTH=\"10%\" ALIGN=RIGHT>\n";
240 echo _("From:");
241 echo " </TD><TD BGCOLOR=\"$color[4]\" WIDTH=\"90%\">\n";
242 echo "<select name=identity>\n";
243 echo "<option value=default>" .
244 htmlspecialchars(getPref($data_dir, $username, 'full_name'));
245 $em = getPref($data_dir, $username, 'email_address');
246 if ($em != '')
247 echo htmlspecialchars(' <' . $em . '>') . "\n";
248 for ($i = 1; $i < $idents; $i ++) {
249 echo '<option value="' . $i . '"';
250 if (isset($identity) && $identity == $i)
251 echo ' SELECTED';
252 echo '>';
253 echo htmlspecialchars(getPref($data_dir, $username, 'full_name' .
254 $i));
255 $em = getPref($data_dir, $username, 'email_address' . $i);
256 if ($em != '')
257 echo htmlspecialchars(' <' . $em . '>') . "\n";
258 }
259 echo "</select>\n";
260 echo " </TD>\n";
261 echo " </TR>\n";
262 }
263 echo " <TR>\n";
264 echo " <TD BGCOLOR=\"$color[4]\" WIDTH=\"10%\" ALIGN=RIGHT>\n";
265 echo _("To:");
266 echo " </TD><TD BGCOLOR=\"$color[4]\" WIDTH=\"90%\">\n";
267 printf(" <INPUT TYPE=text NAME=\"send_to\" VALUE=\"%s\" SIZE=60><BR>\n",
268 htmlspecialchars($send_to));
269 echo " </TD>\n";
270 echo " </TR>\n";
271 echo " <TR>\n";
272 echo " <TD BGCOLOR=\"$color[4]\" ALIGN=RIGHT>\n";
273 echo _("CC:");
274 echo " </TD><TD BGCOLOR=\"$color[4]\" ALIGN=LEFT>\n";
275 printf(" <INPUT TYPE=text NAME=\"send_to_cc\" SIZE=60 VALUE=\"%s\"><BR>\n",
276 htmlspecialchars($send_to_cc));
277 echo " </TD>\n";
278 echo " </TR>\n";
279 echo " <TR>\n";
280 echo " <TD BGCOLOR=\"$color[4]\" ALIGN=RIGHT>\n";
281 echo _("BCC:");
282 echo " </TD><TD BGCOLOR=\"$color[4]\" ALIGN=LEFT>\n";
283 printf(" <INPUT TYPE=text NAME=\"send_to_bcc\" VALUE=\"%s\" SIZE=60><BR>\n",
284 htmlspecialchars($send_to_bcc));
285 echo "</TD></TR>\n";
286
287 echo " <TR>\n";
288 echo " <TD BGCOLOR=\"$color[4]\" ALIGN=RIGHT>\n";
289 echo _("Subject:");
290 echo " </TD><TD BGCOLOR=\"$color[4]\" ALIGN=LEFT>\n";
291 if ($reply_subj) {
292 $reply_subj = str_replace("\"", "'", $reply_subj);
293 $reply_subj = trim($reply_subj);
294 if (substr(strtolower($reply_subj), 0, 3) != "re:")
295 $reply_subj = "Re: $reply_subj";
296 printf(" <INPUT TYPE=text NAME=subject SIZE=60 VALUE=\"%s\">",
297 htmlspecialchars($reply_subj));
298 } else if ($forward_subj) {
299 $forward_subj = trim($forward_subj);
300 if ((substr(strtolower($forward_subj), 0, 4) != 'fwd:') &&
301 (substr(strtolower($forward_subj), 0, 5) != '[fwd:') &&
302 (substr(strtolower($forward_subj), 0, 6) != '[ fwd:'))
303 $forward_subj = "[Fwd: $forward_subj]";
304 printf(" <INPUT TYPE=text NAME=subject SIZE=60 VALUE=\"%s\">",
305 htmlspecialchars($forward_subj));
306 } else {
307 printf(" <INPUT TYPE=text NAME=subject SIZE=60 VALUE=\"%s\">",
308 htmlspecialchars($subject));
309 }
310 echo "</td></tr>\n\n";
311
312 if ($location_of_buttons == 'between') showComposeButtonRow();
313
314 echo " <TR>\n";
315 echo " <TD BGCOLOR=\"$color[4]\" COLSPAN=2>\n";
316 echo " &nbsp;&nbsp;<TEXTAREA NAME=body ROWS=20 COLS=\"$editor_size\" WRAP=HARD>";
317 echo htmlspecialchars($body);
318 if ($use_signature == true && $newmail == true && !isset($from_htmladdr_search)) {
319 if ( $prefix_sig == true )
320 echo "\n\n-- \n" . htmlspecialchars($signature);
321 else
322 echo "\n\n" . htmlspecialchars($signature);
323 }
324 echo "</TEXTAREA><BR>\n";
325 echo " </TD>\n";
326 echo " </TR>\n";
327
328 if ($location_of_buttons == 'bottom')
329 showComposeButtonRow();
330 else {
331 echo " <TR><TD>&nbsp;</TD><TD ALIGN=LEFT><INPUT TYPE=SUBMIT NAME=send VALUE=\""._("Send")."\"></TD></TR>\n";
332 }
333
334 // This code is for attachments
335 echo " <tr>\n";
336 echo " <TD BGCOLOR=\"$color[0]\" VALIGN=TOP ALIGN=RIGHT>\n";
337 echo " <SMALL><BR></SMALL>"._("Attach:");
338 echo " </td><td ALIGN=left BGCOLOR=\"$color[0]\">\n";
339 echo " <INPUT NAME=\"attachfile\" SIZE=48 TYPE=\"file\">\n";
340 echo " &nbsp;&nbsp;<input type=\"submit\" name=\"attach\"";
341 echo " value=\"" . _("Add") ."\">\n";
342 echo " </td>\n";
343 echo " </tr>\n";
344 if (count($attachments))
345 {
346 echo "<tr><td bgcolor=\"$color[0]\" align=right>\n";
347 echo "&nbsp;";
348 echo "</td><td align=left bgcolor=\"$color[0]\">";
349 foreach ($attachments as $key => $info) {
350 echo "<input type=\"checkbox\" name=\"delete[]\" value=\"$key\">\n";
351 echo $info['remotefilename'] . " - " . $info['type'] . " (";
352 echo show_readable_size(filesize($attachment_dir .
353 $info['localfilename'])) . ")<br>\n";
354 }
355
356 echo "<input type=\"submit\" name=\"do_delete\" value=\""._("Delete selected attachments")."\">\n";
357 echo "</td></tr>";
358 }
359 // End of attachment code
360
361 echo "</TABLE>\n";
362 if ($reply_id) {
363 echo "<input type=hidden name=reply_id value=$reply_id>\n";
364 }
365 printf("<INPUT TYPE=hidden NAME=mailbox VALUE=\"%s\">\n", htmlspecialchars($mailbox));
366 echo "</FORM>";
367 do_hook("compose_bottom");
368 }
369
370 function showComposeButtonRow() {
371 global $use_javascript_addr_book, $save_as_draft;
372
373 echo " <TR><td>\n </td><td>\n";
374 if ($use_javascript_addr_book) {
375 echo " <SCRIPT LANGUAGE=JavaScript><!--\n document.write(\"";
376 echo " <input type=button value=\\\""._("Addresses")."\\\" onclick='javascript:open_abook();'>\");";
377 echo " // --></SCRIPT><NOSCRIPT>\n";
378 echo " <input type=submit name=\"html_addr_search\" value=\""._("Addresses")."\">";
379 echo " </NOSCRIPT>\n";
380 } else {
381 echo " <input type=submit name=\"html_addr_search\" value=\""._("Addresses")."\">";
382 }
383 echo "\n <INPUT TYPE=SUBMIT NAME=send VALUE=\"". _("Send") . "\">\n";
384
385 if ($save_as_draft == true)
386 echo "<input type=\"submit\" name =\"draft\" value=\"Save Draft\">\n";
387
388
389 do_hook("compose_button_row");
390
391 echo " </TD>\n";
392 echo " </TR>\n\n";
393 }
394
395 function checkInput ($show) {
396 /** I implemented the $show variable because the error messages
397 were getting sent before the page header. So, I check once
398 using $show=false, and then when i'm ready to display the
399 error message, show=true **/
400 global $body, $send_to, $subject, $color;
401
402 if ($send_to == "") {
403 if ($show)
404 plain_error_message(_("You have not filled in the \"To:\" field."), $color);
405 return false;
406 }
407 return true;
408 } // function checkInput()
409
410
411 // True if FAILURE
412 function saveAttachedFiles() {
413 global $HTTP_POST_FILES, $attachment_dir, $attachments;
414
415 $localfilename = GenerateRandomString(32, '', 7);
416 while (file_exists($attachment_dir . $localfilename))
417 $localfilename = GenerateRandomString(32, '', 7);
418
419 if (!@rename($HTTP_POST_FILES['attachfile']['tmp_name'], $attachment_dir.$localfilename)) {
420 if (!@copy($HTTP_POST_FILES['attachfile']['tmp_name'], $attachment_dir.$localfilename)) {
421 return true;
422 }
423 }
424
425 $newAttachment['localfilename'] = $localfilename;
426 $newAttachment['remotefilename'] = $HTTP_POST_FILES['attachfile']['name'];
427 $newAttachment['type'] =
428 strtolower($HTTP_POST_FILES['attachfile']['type']);
429
430 if ($newAttachment['type'] == "")
431 $newAttachment['type'] = 'application/octet-stream';
432
433 $attachments[] = $newAttachment;
434 }
435
436 if (!isset($mailbox) || $mailbox == "" || ($mailbox == "None"))
437 $mailbox = "INBOX";
438
439 if (isset($draft)) {
440 require_once ('../src/draft_actions.php');
441 if(! saveMessagetoDraft($send_to, $send_to_cc, $send_to_bcc, $subject, $body, $$reply_id)) {
442 showInputForm();
443 exit();
444 } else {
445 Header("Location: right_main.php?mailbox=$draft_folder&sort=$sort&startMessage=1&note=Draft%20Email%20Saved");
446 exit();
447 }
448 }
449
450 if (isset($send)) {
451 if (isset($HTTP_POST_FILES['attachfile']) &&
452 $HTTP_POST_FILES['attachfile']['tmp_name'] &&
453 $HTTP_POST_FILES['attachfile']['tmp_name'] != 'none')
454 $AttachFailure = saveAttachedFiles();
455 if (checkInput(false) && !isset($AttachFailure)) {
456 $urlMailbox = urlencode (trim($mailbox));
457 if (! isset($reply_id))
458 $reply_id = 0;
459 // Set $default_charset to correspond with the user's selection
460 // of language interface.
461 set_my_charset();
462
463 // This is to change all newlines to \n
464 // We'll change them to \r\n later (in the sendMessage function)
465 $body = str_replace("\r\n", "\n", $body);
466 $body = str_replace("\r", "\n", $body);
467
468 // Rewrap $body so that no line is bigger than $editor_size
469 // This should only really kick in the sqWordWrap function
470 // if the browser doesn't support "HARD" as the wrap type
471 // Or, in Opera's case, something goes wrong.
472 $body = explode("\n", $body);
473 $newBody = '';
474 foreach ($body as $line) {
475 if( $line <> '-- ' )
476 $line = rtrim($line);
477 if (strlen($line) <= $editor_size + 1)
478 $newBody .= $line . "\n";
479 else {
480 sqWordWrap($line, $editor_size) . "\n";
481 $newBody .= $line;
482 }
483 }
484 $body = $newBody;
485
486 do_hook("compose_send");
487
488 if (! sendMessage($send_to, $send_to_cc, $send_to_bcc, $subject, $body, $reply_id)) {
489 showInputForm();
490 exit();
491 }
492 if ( isset($delete_draft)) {
493 Header("Location: delete_message.php?mailbox=$draft_folder&message=$delete_draft&sort=$sort&startMessage=1");
494 exit();
495 }
496
497 Header("Location: right_main.php?mailbox=$urlMailbox&sort=$sort&startMessage=1");
498 } else {
499 //$imapConnection = sqimap_login($username, $key, $imapServerAddress, $imapPort, 0);
500 displayPageHeader($color, $mailbox);
501
502 if (isset($AttachFailure))
503 plain_error_message(_("Could not move/copy file. File not attached"), $color);
504
505 checkInput(true);
506
507 showInputForm();
508 //sqimap_logout($imapConnection);
509 }
510 } else if (isset($html_addr_search_done)) {
511 displayPageHeader($color, $mailbox);
512
513 if (isset($send_to_search) && is_array($send_to_search)) {
514 foreach ($send_to_search as $k => $v) {
515 if (substr($k, 0, 1) == 'T') {
516 if ($send_to)
517 $send_to .= ', ';
518 $send_to .= $v;
519 }
520 elseif (substr($k, 0, 1) == 'C') {
521 if ($send_to_cc)
522 $send_to_cc .= ', ';
523 $send_to_cc .= $v;
524 }
525 elseif (substr($k, 0, 1) == 'B') {
526 if ($send_to_bcc)
527 $send_to_bcc .= ', ';
528 $send_to_bcc .= $v;
529 }
530 }
531 }
532
533 showInputForm();
534 } else if (isset($html_addr_search)) {
535 if (isset($HTTP_POST_FILES['attachfile']) &&
536 $HTTP_POST_FILES['attachfile']['tmp_name'] &&
537 $HTTP_POST_FILES['attachfile']['tmp_name'] != 'none')
538 {
539 if (saveAttachedFiles())
540 plain_error_message(_("Could not move/copy file. File not attached"), $color);
541 }
542 // I am using an include so as to elminiate an extra unnecessary click. If you
543 // can think of a better way, please implement it.
544 include_once('./addrbook_search_html.php');
545 } else if (isset($attach)) {
546 if (saveAttachedFiles())
547 plain_error_message(_("Could not move/copy file. File not attached"), $color);
548 displayPageHeader($color, $mailbox);
549 showInputForm();
550 } else if (isset($do_delete)) {
551 displayPageHeader($color, $mailbox);
552
553 if (isset($delete) && is_array($delete))
554 {
555 foreach($delete as $index)
556 {
557 unlink ($attachment_dir.$attachments[$index]['localfilename']);
558 unset ($attachments[$index]);
559 }
560 }
561
562 showInputForm();
563 } else {
564 // This handles the default case as well as the error case
565 // (they had the same code) --> if (isset($smtpErrors))
566 $imapConnection = sqimap_login($username, $key, $imapServerAddress,
567 $imapPort, 0);
568 displayPageHeader($color, $mailbox);
569
570 $newmail = true;
571
572 ClearAttachments();
573
574 if (isset($forward_id) && $forward_id && isset($ent_num) && $ent_num)
575 getAttachments(0);
576
577 if (isset($draft_id) && $draft_id && isset($ent_num) && $ent_num)
578 getAttachments(0);
579
580 newMail();
581 showInputForm();
582 sqimap_logout($imapConnection);
583 }
584
585 function ClearAttachments() {
586 global $attachments, $attachment_dir;
587
588 foreach ($attachments as $info) {
589 if (file_exists($attachment_dir . $info['localfilename'])) {
590 unlink($attachment_dir . $info['localfilename']);
591 }
592 }
593
594 $attachments = array();
595 }
596
597 function getReplyCitation($orig_from) {
598 global $reply_citation_style, $reply_citation_start, $reply_citation_end;
599
600 /* First, return an empty string when no citation style selected. */
601 if (($reply_citation_style == '') || ($reply_citation_style == 'none')) {
602 return ('');
603 }
604
605 /* Otherwise, try to select the desired citation style. */
606 switch ($reply_citation_style) {
607 case 'author_said':
608 $start = '';
609 $end = ' ' . _("said") . ':';
610 break;
611 case 'quote_who':
612 $start = '<' . _("quote") . ' ' . _("who") . '="';
613 $end = '">';
614 break;
615 case 'user-defined':
616 $start = $reply_citation_start;
617 $end = $reply_citation_end;
618 break;
619 default: return ('');
620 }
621
622 /* Build and return the citation string. */
623 return ($start . $orig_from . $end . "\n");
624 }
625 ?>