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