squirrelmail-webmail  1.4.22
About: SquirrelMail is a standards-based webmail package with strong MIME support, address books, and folder manipulation (written in PHP4).
  Fossies Dox: squirrelmail-webmail-1.4.22.tar.gz  ("inofficial" and yet experimental doxygen-generated source code documentation)  

compose.php
Go to the documentation of this file.
1 <?php
2 
21 define('PAGE_NAME', 'compose');
22 
27 define('SM_PATH','../');
28 
29 /* SquirrelMail required files. */
30 require_once(SM_PATH . 'include/validate.php');
31 require_once(SM_PATH . 'functions/global.php');
32 require_once(SM_PATH . 'functions/imap.php');
33 require_once(SM_PATH . 'functions/date.php');
34 require_once(SM_PATH . 'functions/mime.php');
35 require_once(SM_PATH . 'functions/plugin.php');
36 require_once(SM_PATH . 'functions/display_messages.php');
37 require_once(SM_PATH . 'class/deliver/Deliver.class.php');
38 require_once(SM_PATH . 'functions/addressbook.php');
39 require_once(SM_PATH . 'functions/forms.php');
40 require_once(SM_PATH . 'functions/identity.php');
41 
42 /* --------------------- Get globals ------------------------------------- */
44 sqgetGlobalVar('key', $key, SQ_COOKIE);
45 
47 sqgetGlobalVar('username', $username, SQ_SESSION);
48 sqgetGlobalVar('onetimepad',$onetimepad, SQ_SESSION);
49 sqgetGlobalVar('base_uri', $base_uri, SQ_SESSION);
50 sqgetGlobalVar('delimiter', $delimiter, SQ_SESSION);
51 
52 sqgetGlobalVar('composesession', $composesession, SQ_SESSION);
53 sqgetGlobalVar('compose_messages', $compose_messages, SQ_SESSION);
54 
55 // compose_messages only useful in SESSION when a forward-as-attachment
56 // has been preconstructed for us and passed in via that mechanism; once
57 // we have it, we can clear it from the SESSION
58 sqsession_unregister('compose_messages');
59 
61 sqgetGlobalVar('send', $send, SQ_POST);
62 // Send can only be achieved by setting $_POST var. If Send = true then
63 // retrieve other form fields from $_POST
64 if (isset($send) && $send) {
65  $SQ_GLOBAL = SQ_POST;
66 } else {
67  $SQ_GLOBAL = SQ_FORM;
68 }
69 sqgetGlobalVar('smaction',$action, $SQ_GLOBAL);
70 if (!sqgetGlobalVar('smtoken',$submitted_token, $SQ_GLOBAL)) {
71  $submitted_token = '';
72 }
73 sqgetGlobalVar('session',$session, $SQ_GLOBAL);
74 sqgetGlobalVar('mailbox',$mailbox, $SQ_GLOBAL);
75 if ( !sqgetGlobalVar('identity',$identity, $SQ_GLOBAL) ) {
76  $identity = 0;
77 }
78 sqgetGlobalVar('send_to',$send_to, $SQ_GLOBAL);
79 sqgetGlobalVar('send_to_cc',$send_to_cc, $SQ_GLOBAL);
80 sqgetGlobalVar('send_to_bcc',$send_to_bcc, $SQ_GLOBAL);
81 sqgetGlobalVar('subject',$subject, $SQ_GLOBAL);
82 sqgetGlobalVar('body',$body, $SQ_GLOBAL);
83 sqgetGlobalVar('mailprio',$mailprio, $SQ_GLOBAL);
84 sqgetGlobalVar('request_mdn',$request_mdn, $SQ_GLOBAL);
85 sqgetGlobalVar('request_dr',$request_dr, $SQ_GLOBAL);
86 sqgetGlobalVar('html_addr_search',$html_addr_search, SQ_FORM);
87 sqgetGlobalVar('mail_sent',$mail_sent, SQ_FORM);
88 sqgetGlobalVar('passed_id',$passed_id, $SQ_GLOBAL);
89 sqgetGlobalVar('passed_ent_id',$passed_ent_id, $SQ_GLOBAL);
90 
91 sqgetGlobalVar('attach',$attach, SQ_POST);
92 sqgetGlobalVar('draft',$draft, SQ_POST);
93 sqgetGlobalVar('draft_id',$draft_id, $SQ_GLOBAL);
94 sqgetGlobalVar('ent_num',$ent_num, $SQ_GLOBAL);
95 sqgetGlobalVar('saved_draft',$saved_draft, SQ_FORM);
96 
97 if ( sqgetGlobalVar('delete_draft',$delete_draft) ) {
98  $delete_draft = (int)$delete_draft;
99 }
100 
101 if ( sqgetGlobalVar('startMessage',$startMessage) ) {
102  $startMessage = (int)$startMessage;
103 } else {
104  $startMessage = 1;
105 }
106 
108 sqgetGlobalVar('sigappend', $sigappend, SQ_POST);
109 sqgetGlobalVar('from_htmladdr_search', $from_htmladdr_search, SQ_POST);
110 sqgetGlobalVar('addr_search_done', $html_addr_search_done, SQ_POST);
111 sqgetGlobalVar('send_to_search', $send_to_search, SQ_POST);
112 sqgetGlobalVar('do_delete', $do_delete, SQ_POST);
113 sqgetGlobalVar('delete', $delete, SQ_POST);
114 sqgetGlobalVar('attachments', $attachments, SQ_POST);
115 // Not used any more, but left for posterity
116 //sqgetGlobalVar('restoremessages', $restoremessages, SQ_POST);
117 if ( sqgetGlobalVar('return', $temp, SQ_POST) ) {
118  $html_addr_search_done = 'Use Addresses';
119 }
120 
122 // (none)
123 
127 if ( sqgetGlobalVar('mailtodata', $mailtodata, SQ_GET) ) {
128  $trtable = array('to' => 'send_to',
129  'cc' => 'send_to_cc',
130  'bcc' => 'send_to_bcc',
131  'body' => 'body',
132  'subject' => 'subject');
133  $mtdata = unserialize($mailtodata);
134 
135  foreach ($trtable as $f => $t) {
136  if ( !empty($mtdata[$f]) ) {
137  $$t = $mtdata[$f];
138  }
139  }
140  unset($mailtodata,$mtdata, $trtable);
141 }
142 
143 /* Location (For HTTP 1.1 Header("Location: ...") redirects) */
145 /* Identities (fetch only once) */
147 
148 /* --------------------- Specific Functions ------------------------------ */
149 
152  $excl_ar = array();
156  $url_replytoall_avoid_addrs = '';
157  if (isset($header->reply_to)) {
158  $excl_ar = $header->getAddr_a('reply_to');
159  }
165  global $idents;
166  foreach($idents as $id) {
167  $excl_ar[strtolower(trim($id['email_address']))] = '';
168  }
169  }
170 
174  $url_replytoall_ar = $header->getAddr_a(array('to','cc'), $excl_ar);
175 
179  $url_replytoallcc = '';
180  foreach( $url_replytoall_ar as $email => $personal) {
181  if ($personal) {
182  // always quote personal name (can't just quote it if
183  // it contains a comma separator, since it might still
184  // be encoded)
185  $url_replytoallcc .= ", \"$personal\" <$email>";
186  } else {
187  $url_replytoallcc .= ', '. $email;
188  }
189  }
190  $url_replytoallcc = substr($url_replytoallcc,2);
191 
192  return $url_replytoallcc;
193 }
194 
195 function getReplyCitation($orig_from, $orig_date) {
197 
198  // FIXME: why object is rewritten with string.
199 
200  if (!is_object($orig_from)) {
201  $orig_from = '';
202  } else {
203  $orig_from = decodeHeader($orig_from->getAddress(false),false,false,true);
204  }
205 
206  /* First, return an empty string when no citation style selected. */
207  if (($reply_citation_style == '') || ($reply_citation_style == 'none')) {
208  return '';
209  }
210 
211  /* Make sure our final value isn't an empty string. */
212  if ($orig_from == '') {
213  return '';
214  }
215 
216  /* Otherwise, try to select the desired citation style. */
217  switch ($reply_citation_style) {
218  case 'author_said':
222  $full_reply_citation = sprintf(_("%s wrote:"),$orig_from);
223  break;
224  case 'quote_who':
225  $start = '<' . _("quote") . ' ' . _("who") . '="';
226  $end = '">';
227  $full_reply_citation = $start . $orig_from . $end;
228  break;
229  case 'date_time_author':
239  $full_reply_citation = sprintf(_("On %s, %s wrote:"), getLongDateString($orig_date), $orig_from);
240  break;
241  case 'user-defined':
242  $start = $reply_citation_start .
243  ($reply_citation_start == '' ? '' : ' ');
245  $full_reply_citation = $start . $orig_from . $end;
246  break;
247  default:
248  return '';
249  }
250 
251  /* Add line feed and return the citation string. */
252  return ($full_reply_citation . "\n");
253 }
254 
255 function getforwardHeader($orig_header) {
256  global $editor_size;
257 
258  $display = array( _("Subject") => strlen(_("Subject")),
259  _("From") => strlen(_("From")),
260  _("Date") => strlen(_("Date")),
261  _("To") => strlen(_("To")),
262  _("Cc") => strlen(_("Cc")) );
263  $maxsize = max($display);
264  $indent = str_pad('',$maxsize+2);
265  foreach($display as $key => $val) {
266  $display[$key] = $key .': '. str_pad('', $maxsize - $val);
267  }
268  $from = decodeHeader($orig_header->getAddr_s('from',"\n$indent"),false,false,true);
269  $from = str_replace('&nbsp;',' ',$from);
270  $to = decodeHeader($orig_header->getAddr_s('to',"\n$indent"),false,false,true);
271  $to = str_replace('&nbsp;',' ',$to);
272  $subject = decodeHeader($orig_header->subject,false,false,true);
273  $subject = str_replace('&nbsp;',' ',$subject);
274  $bodyTop = str_pad(' '._("Original Message").' ',$editor_size -2,'-',STR_PAD_BOTH) .
275  "\n". $display[_("Subject")] . $subject . "\n" .
276  $display[_("From")] . $from . "\n" .
277  $display[_("Date")] . getLongDateString( $orig_header->date, $orig_header->date_unparsed ). "\n" .
278  $display[_("To")] . $to . "\n";
279  if ($orig_header->cc != array() && $orig_header->cc !='') {
280  $cc = decodeHeader($orig_header->getAddr_s('cc',"\n$indent"),false,false,true);
281  $cc = str_replace('&nbsp;',' ',$cc);
282  $bodyTop .= $display[_("Cc")] .$cc . "\n";
283  }
284  $bodyTop .= str_pad('', $editor_size -2 , '-') .
285  "\n\n";
286  return $bodyTop;
287 }
288 /* ----------------------------------------------------------------------- */
289 
290 /*
291  * If the session is expired during a post this restores the compose session
292  * vars.
293  */
295 if (sqsession_is_registered('session_expired_post')) {
296  sqgetGlobalVar('session_expired_post', $session_expired_post, SQ_SESSION);
297  /*
298  * extra check for username so we don't display previous post data from
299  * another user during this session.
300  */
301  if ($session_expired_post['username'] != $username) {
302  unset($session_expired_post);
303  sqsession_unregister('session_expired_post');
304  session_write_close();
305  } else {
306  // these are the vars that we can set from the expired composed session
307  $compo_var_list = array ('send_to', 'send_to_cc', 'body', 'mailbox',
308  'startMessage', 'passed_body', 'use_signature', 'signature',
309  'attachments', 'subject', 'newmail', 'send_to_bcc', 'passed_id',
310  'from_htmladdr_search', 'identity', 'draft_id', 'delete_draft',
311  'mailprio', 'edit_as_new', 'request_mdn', 'request_dr',
312  'composesession', /* Not used any more: 'compose_messsages', */);
313 
314  foreach ($compo_var_list as $var) {
315  if ( isset($session_expired_post[$var]) && !isset($$var) ) {
316  $$var = $session_expired_post[$var];
317  }
318  }
319 
320  if (!empty($attachments))
321  $attachments = unserialize($attachments);
322 
323  sqsession_register($composesession,'composesession');
324 
325  if (isset($send)) {
326  unset($send);
327  }
328  $session_expired = true;
329  }
330  unset($session_expired_post);
331  sqsession_unregister('session_expired_post');
332  session_write_close();
333  if (!isset($mailbox)) {
334  $mailbox = '';
335  }
336  if ($compose_new_win == '1') {
338  } else {
340  }
341  showInputForm($session, false);
342  exit();
343 }
344 
345 if (!isset($composesession)) {
346  $composesession = 0;
347  sqsession_register(0,'composesession');
348 } else {
349  $composesession = (int)$composesession;
350 }
351 
352 if (!isset($session) || (isset($newmessage) && $newmessage)) {
353  sqsession_unregister('composesession');
354  $session = "$composesession" +1;
355  $composesession = $session;
356  sqsession_register($composesession,'composesession');
357 }
358 if (!empty($compose_messages[$session])) {
359  $composeMessage = $compose_messages[$session];
360 } else {
361  $composeMessage = new Message();
363  $composeMessage->rfc822_header = $rfc822_header;
364  $composeMessage->reply_rfc822_header = '';
365 }
366 
367 // re-add attachments that were already in this message
368 // FIXME: note that technically this is very bad form -
369 // should never directly manipulate an object like this
370 if (!empty($attachments)) {
371  $attachments = unserialize($attachments);
372  if (!empty($attachments) && is_array($attachments))
373  $composeMessage->entities = $attachments;
374 }
375 
376 if (!isset($mailbox) || $mailbox == '' || ($mailbox == 'None')) {
377  $mailbox = 'INBOX';
378 }
379 
380 if ($draft) {
381 
382  // validate security token
383  //
384  sm_validate_security_token($submitted_token, 3600, TRUE);
385 
386  /*
387  * Set $default_charset to correspond with the user's selection
388  * of language interface.
389  */
390  set_my_charset();
391  if (! deliverMessage($composeMessage, true)) {
392  showInputForm($session);
393  exit();
394  } else {
395  $draft_message = _("Draft Email Saved");
396  /* If this is a resumed draft, then delete the original */
397  if(isset($delete_draft)) {
398  if ( !isset($pageheader_sent) || !$pageheader_sent ) {
399  Header("Location: $location/delete_message.php?mailbox=" . urlencode($draft_folder) .
400  "&message=$delete_draft&sort=$sort&startMessage=1&saved_draft=yes&smtoken=" . sm_generate_security_token());
401  } else {
402  echo ' <br><br><center><a href="' . $location
403  . "/delete_message.php?mailbox=" . urlencode($draft_folder)
404  . "&message=$delete_draft&sort=$sort&startMessage=1&saved_draft=yes&smtoken=" . sm_generate_security_token() . "\">"
405  . _("Return") . '</a></center>';
406  }
407  exit();
408  }
409  else {
410  if ($compose_new_win == '1') {
411  if ( !isset($pageheader_sent) || !$pageheader_sent ) {
412  Header("Location: $location/compose.php?saved_draft=yes&session=$composesession");
413  } else {
414  echo ' <br><br><center><a href="' . $location
415  . "/compose.php?saved_draft=yes&session=$composesession\">"
416  . _("Return") . '</a></center>';
417  }
418  exit();
419  }
420  else {
421  if ( !isset($pageheader_sent) || !$pageheader_sent ) {
422  Header("Location: $location/right_main.php?mailbox=" . urlencode($draft_folder) .
423  "&sort=$sort&startMessage=1&note=".urlencode($draft_message));
424  } else {
425  echo ' <br><br><center><a href="' . $location
426  . "/right_main.php?mailbox=" . urlencode($draft_folder)
427  . "&sort=$sort&startMessage=1&note=".urlencode($draft_message)
428  . "\">" . _("Return") . '</a></center>';
429  }
430  exit();
431  }
432  }
433  }
434 }
435 
436 if ($send) {
437 
438  // validate security token
439  //
440  sm_validate_security_token($submitted_token, 3600, TRUE);
441 
442  if (isset($_FILES['attachfile']) &&
443  $_FILES['attachfile']['tmp_name'] &&
444  $_FILES['attachfile']['tmp_name'] != 'none') {
445  $AttachFailure = saveAttachedFiles($session);
446  }
447  if (checkInput(false) && !isset($AttachFailure)) {
448  if ($mailbox == "All Folders") {
449  /* We entered compose via the search results page */
450  $mailbox = 'INBOX'; /* Send 'em to INBOX, that's safe enough */
451  }
452  $urlMailbox = urlencode($mailbox);
453  if (! isset($passed_id)) {
454  $passed_id = 0;
455  }
460  set_my_charset();
465  $body = str_replace("\r\n", "\n", $body);
466  $body = str_replace("\r", "\n", $body);
467 
473  $body = explode("\n", $body);
474  $newBody = '';
475  foreach ($body as $line) {
476  if( $line <> '-- ' ) {
477  $line = rtrim($line);
478  }
479  if (sq_strlen($line, $default_charset) <= $editor_size + 1) {
480  $newBody .= $line . "\n";
481  } else {
483  $newBody .= $line . "\n";
484 
485  }
486 
487  }
488  $body = $newBody;
489 
490  $Result = deliverMessage($composeMessage);
491  do_hook('compose_send_after', $Result, $composeMessage);
492  if (! $Result) {
493  showInputForm($session);
494  exit();
495  }
496 
497  /* if it is resumed draft, delete draft message */
498  if ( isset($delete_draft)) {
499  Header("Location: $location/delete_message.php?mailbox=" . urlencode( $draft_folder ).
500  "&message=$delete_draft&sort=$sort&startMessage=1&mail_sent=yes&smtoken=" . sm_generate_security_token());
501  exit();
502  }
503  if ($compose_new_win == '1') {
504 
505  Header("Location: $location/compose.php?mail_sent=yes");
506  }
507  else {
508  Header("Location: $location/right_main.php?mailbox=$urlMailbox&sort=$sort".
509  "&startMessage=$startMessage");
510  }
511  } else {
512  if ($compose_new_win == '1') {
514  }
515  else {
517  }
518  if (isset($AttachFailure)) {
519  plain_error_message(_("Could not move/copy file. File not attached"),
520  $color);
521  }
522  checkInput(true);
523  showInputForm($session);
524  /* sqimap_logout($imapConnection); */
525  }
526 } elseif (isset($html_addr_search_done)) {
527 
528  // validate security token
529  //
530  sm_validate_security_token($submitted_token, 3600, TRUE);
531 
532  if ($compose_new_win == '1') {
534  }
535  else {
537  }
538 
539  if (isset($send_to_search) && is_array($send_to_search)) {
540  foreach ($send_to_search as $k => $v) {
541  if (substr($k, 0, 1) == 'T') {
542  if ($send_to) {
543  $send_to .= ', ';
544  }
545  $send_to .= $v;
546  }
547  elseif (substr($k, 0, 1) == 'C') {
548  if ($send_to_cc) {
549  $send_to_cc .= ', ';
550  }
551  $send_to_cc .= $v;
552  }
553  elseif (substr($k, 0, 1) == 'B') {
554  if ($send_to_bcc) {
555  $send_to_bcc .= ', ';
556  }
557  $send_to_bcc .= $v;
558  }
559  }
560  }
561  showInputForm($session);
562 } elseif (isset($html_addr_search)) {
563  if (isset($_FILES['attachfile']) &&
564  $_FILES['attachfile']['tmp_name'] &&
565  $_FILES['attachfile']['tmp_name'] != 'none') {
566  if(saveAttachedFiles($session)) {
567  plain_error_message(_("Could not move/copy file. File not attached"), $color);
568  }
569  }
570  /*
571  * I am using an include so as to elminiate an extra unnecessary
572  * click. If you can think of a better way, please implement it.
573  */
574  include_once('./addrbook_search_html.php');
575 } elseif (isset($attach)) {
576 
577  // validate security token
578  //
579  sm_validate_security_token($submitted_token, 3600, TRUE);
580 
581  if (saveAttachedFiles($session)) {
582  plain_error_message(_("Could not move/copy file. File not attached"), $color);
583  }
584  if ($compose_new_win == '1') {
586  } else {
588  }
589  showInputForm($session);
590 }
591 elseif (isset($sigappend)) {
592 
593  // validate security token
594  //
595  sm_validate_security_token($submitted_token, 3600, TRUE);
596 
597  $signature = $idents[$identity]['signature'];
598 
599  $body .= "\n\n".($prefix_sig==true? "-- \n":'').$signature;
600  if ($compose_new_win == '1') {
602  } else {
604  }
605  showInputForm($session);
606 } elseif (isset($do_delete)) {
607 
608  // validate security token
609  //
610  sm_validate_security_token($submitted_token, 3600, TRUE);
611 
612  if ($compose_new_win == '1') {
614  } else {
616  }
617 
618  if (isset($delete) && is_array($delete)) {
619  foreach($delete as $index) {
620  if (!empty($composeMessage->entities) && isset($composeMessage->entities[$index])) {
621  $composeMessage->entities[$index]->purgeAttachments();
622  // FIXME: one person reported that unset() didn't do anything at all here, so this is a work-around... but it triggers PHP notices if the unset() doesn't work, which should be fixed... but bigger question is if unset() doesn't work here, what about everywhere else? Anyway, uncomment this if you think you need it
623  //$composeMessage->entities[$index] = NULL;
624  unset ($composeMessage->entities[$index]);
625  }
626  }
627  $new_entities = array();
628  foreach ($composeMessage->entities as $entity) {
629  $new_entities[] = $entity;
630  }
631  $composeMessage->entities = $new_entities;
632  }
633  showInputForm($session);
634 } else {
635  /*
636  * This handles the default case as well as the error case
637  * (they had the same code) --> if (isset($smtpErrors))
638  */
639 
640  if ($compose_new_win == '1') {
642  } else {
644  }
645 
646  $newmail = true;
647 
648  if (!isset($passed_ent_id)) {
649  $passed_ent_id = '';
650  }
651  if (!isset($passed_id)) {
652  $passed_id = '';
653  }
654  if (!isset($mailbox)) {
655  $mailbox = '';
656  }
657  if (!isset($action)) {
658  $action = '';
659  }
660 
661  $values = newMail($mailbox,$passed_id,$passed_ent_id, $action, $session);
662 
663  // forward as attachment - subject is in the message in session
664  //
665  if (sqgetGlobalVar('forward_as_attachment_init', $forward_as_attachment_init, SQ_GET)
666  && $forward_as_attachment_init)
667  $subject = $composeMessage->rfc822_header->subject;
668 
669  /* in case the origin is not read_body.php */
670  if (isset($send_to)) {
671  $values['send_to'] = $send_to;
672  }
673  if (isset($send_to_cc)) {
674  $values['send_to_cc'] = $send_to_cc;
675  }
676  if (isset($send_to_bcc)) {
677  $values['send_to_bcc'] = $send_to_bcc;
678  }
679  if (isset($subject)) {
680  $values['subject'] = $subject;
681  }
682  showInputForm($session, $values);
683 }
684 
685 exit();
686 
687 /**************** Only function definitions go below *************/
688 
689 
690 /* This function is used when not sending or adding attachments */
691 function newMail ($mailbox='', $passed_id='', $passed_ent_id='', $action='', $session='') {
693  $use_signature, $composesession, $data_dir, $username,
695  $composeMessage, $body_quote, $strip_sigs;
697 
698  /*
699  * Set $default_charset to correspond with the user's selection
700  * of language interface. $default_charset global is not correct,
701  * if message is composed in new window.
702  */
703  set_my_charset();
704 
705  $send_to = $send_to_cc = $send_to_bcc = $subject = $identity = '';
706  $mailprio = 3;
707 
708  if ($passed_id) {
710  $imapPort, 0);
711 
714 
715  $body = '';
716  if ($passed_ent_id) {
717  /* redefine the messsage in case of message/rfc822 */
718  $message = $message->getEntity($passed_ent_id);
719  /* message is an entity which contains the envelope and type0=message
720  * and type1=rfc822. The actual entities are childs from
721  * $message->entities[0]. That's where the encoding and is located
722  */
723 
724  $entities = $message->entities[0]->findDisplayEntity
725  (array(), $alt_order = array('text/plain'));
726  if (!count($entities)) {
727  $entities = $message->entities[0]->findDisplayEntity
728  (array(), $alt_order = array('text/plain','text/html'));
729  }
730  $orig_header = $message->rfc822_header; /* here is the envelope located */
731  /* redefine the message for picking up the attachments */
732  $message = $message->entities[0];
733 
734  } else {
735  $entities = $message->findDisplayEntity (array(), $alt_order = array('text/plain'));
736  if (!count($entities)) {
737  $entities = $message->findDisplayEntity (array(), $alt_order = array('text/plain','text/html'));
738  }
739  $orig_header = $message->rfc822_header;
740  }
741 
742  $encoding = $message->header->encoding;
743  $type0 = $message->type0;
744  $type1 = $message->type1;
745  foreach ($entities as $ent) {
746  $unencoded_bodypart = mime_fetch_body($imapConnection, $passed_id, $ent);
747  $body_part_entity = $message->getEntity($ent);
748  $bodypart = decodeBody($unencoded_bodypart,
749  $body_part_entity->header->encoding);
750  if ($type1 == 'html') {
751  $bodypart = str_replace("\n", ' ', $bodypart);
752  $bodypart = preg_replace(array('/<p>/i','/<br\s*(\/)*>/i'), "\n", $bodypart);
753  $bodypart = str_replace(array('&nbsp;','&gt;','&lt;'),array(' ','>','<'),$bodypart);
754  $bodypart = strip_tags($bodypart);
755  }
756  if (isset($languages[$squirrelmail_language]['XTRA_CODE']) &&
757  function_exists($languages[$squirrelmail_language]['XTRA_CODE'])) {
758  if (mb_detect_encoding($bodypart) != 'ASCII') {
759  $bodypart = $languages[$squirrelmail_language]['XTRA_CODE']('decode', $bodypart);
760  }
761  }
762 
763  // charset encoding in compose form stuff
764  if (isset($body_part_entity->header->parameters['charset'])) {
765  $actual = $body_part_entity->header->parameters['charset'];
766  } else {
767  $actual = 'us-ascii';
768  }
769 
770  if ( $actual && is_conversion_safe($actual) && $actual != $default_charset){
771  $bodypart = charset_convert($actual,$bodypart,$default_charset,false);
772  }
773  // end of charset encoding in compose
774 
775  $body .= $bodypart;
776  }
777  if ($default_use_priority) {
778  $mailprio = substr($orig_header->priority,0,1);
779  if (!$mailprio) {
780  $mailprio = 3;
781  }
782  } else {
783  $mailprio = '';
784  }
785 
786  $identity = '';
787  $from_o = $orig_header->from;
788  if (is_array($from_o)) {
789  if (isset($from_o[0])) {
790  $from_o = $from_o[0];
791  }
792  }
793  if (is_object($from_o)) {
794  $orig_from = $from_o->getAddress();
795  } else {
796  $orig_from = '';
797  }
798 
799  $identities = array();
800  if (count($idents) > 1) {
801  foreach($idents as $nr=>$data) {
802  $enc_from_name = '"'.$data['full_name'].'" <'. $data['email_address'].'>';
803  if(strtolower($enc_from_name) == strtolower($orig_from)) {
804  $identity = $nr;
805  // don't stop! need to build $identities array for idents match below
806  //break;
807  }
808  $identities[] = $enc_from_name;
809  }
810 
811  $identity_match = $orig_header->findAddress($identities);
812  if ($identity_match) {
813  $identity = $identity_match;
814  }
815  }
816 
817  switch ($action) {
818  case ('draft'):
819  $use_signature = FALSE;
820  $composeMessage->rfc822_header = $orig_header;
821  $send_to = decodeHeader($orig_header->getAddr_s('to'),false,false,true);
822  $send_to_cc = decodeHeader($orig_header->getAddr_s('cc'),false,false,true);
823  $send_to_bcc = decodeHeader($orig_header->getAddr_s('bcc'),false,false,true);
824  // FIXME: ident support?
825  $subject = decodeHeader($orig_header->subject,false,false,true);
826  /* remember the references and in-reply-to headers in case of an reply */
827  $composeMessage->rfc822_header->more_headers['References'] = $orig_header->references;
828  $composeMessage->rfc822_header->more_headers['In-Reply-To'] = $orig_header->in_reply_to;
829  $body_ary = explode("\n", $body);
830  $cnt = count($body_ary) ;
831  $body = '';
832  for ($i=0; $i < $cnt; $i++) {
833  if (!preg_match('/^[>\s]*$/', $body_ary[$i]) || !$body_ary[$i]) {
834  sqWordWrap($body_ary[$i], $editor_size, $default_charset );
835  $body .= $body_ary[$i] . "\n";
836  }
837  unset($body_ary[$i]);
838  }
840  $composeMessage = getAttachments($message, $composeMessage, $passed_id, $entities, $imapConnection);
841  break;
842  case ('edit_as_new'):
843  $send_to = decodeHeader($orig_header->getAddr_s('to'),false,false,true);
844  $send_to_cc = decodeHeader($orig_header->getAddr_s('cc'),false,false,true);
845  $send_to_bcc = decodeHeader($orig_header->getAddr_s('bcc'),false,false,true);
846  $subject = decodeHeader($orig_header->subject,false,false,true);
847  $mailprio = $orig_header->priority;
848  $orig_from = '';
849  $composeMessage = getAttachments($message, $composeMessage, $passed_id, $entities, $imapConnection);
851  break;
852  case ('forward'):
853  $send_to = '';
854  $subject = decodeHeader($orig_header->subject,false,false,true);
855  if ((substr(strtolower($subject), 0, 4) != 'fwd:') &&
856  (substr(strtolower($subject), 0, 5) != '[fwd:') &&
857  (substr(strtolower($subject), 0, 6) != '[ fwd:')) {
858  $subject = '[Fwd: ' . $subject . ']';
859  }
860  $body = getforwardHeader($orig_header) . $body;
861  $composeMessage = getAttachments($message, $composeMessage, $passed_id, $entities, $imapConnection);
862  $body = "\n" . $body;
863  break;
864  case ('forward_as_attachment'):
865  $subject = decodeHeader($orig_header->subject,false,false,true);
866  $subject = trim($subject);
867  if (substr(strtolower($subject), 0, 4) != 'fwd:') {
868  $subject = 'Fwd: ' . $subject;
869  }
870  $composeMessage = getMessage_RFC822_Attachment($message, $composeMessage, $passed_id, $passed_ent_id, $imapConnection);
871  $body = '';
872  break;
873  case ('reply_all'):
874  if(isset($orig_header->mail_followup_to) && $orig_header->mail_followup_to) {
875  $send_to = $orig_header->getAddr_s('mail_followup_to');
876  } else {
877  $send_to_cc = replyAllString($orig_header);
878  $send_to_cc = decodeHeader($send_to_cc,false,false,true);
879  $send_to_cc = str_replace('""', '"', $send_to_cc);
880  }
881  case ('reply'):
882  if (!$send_to) {
883  $send_to = $orig_header->reply_to;
884  if (is_array($send_to) && count($send_to)) {
885  $send_to = $orig_header->getAddr_s('reply_to', ',', FALSE, TRUE);
886  } else if (is_object($send_to)) { /* unneccesarry, just for failsafe purpose */
887  $send_to = $orig_header->getAddr_s('reply_to', ',', FALSE, TRUE);
888  } else {
889  $send_to = $orig_header->getAddr_s('from', ',', FALSE, TRUE);
890  }
891  }
892  $send_to = decodeHeader($send_to,false,false,true);
893  $send_to = str_replace('""', '"', $send_to);
894  $subject = decodeHeader($orig_header->subject,false,false,true);
895  $subject = trim($subject);
896  if (substr(strtolower($subject), 0, 3) != 're:') {
897  $subject = 'Re: ' . $subject;
898  }
899  /* this corrects some wrapping/quoting problems on replies */
900  $rewrap_body = explode("\n", $body);
901  $from = (is_array($orig_header->from) && !empty($orig_header->from)) ? $orig_header->from[0] : $orig_header->from;
903  $body = '';
904  $cnt = count($rewrap_body);
905  for ($i=0;$i<$cnt;$i++) {
906  if ($strip_sigs && $rewrap_body[$i] == '-- ') {
907  break;
908  }
909  sqWordWrap($rewrap_body[$i], $editor_size, $default_charset);
910  if (preg_match("/^(>+)/", $rewrap_body[$i], $matches)) {
911  $gt = $matches[1];
912  $body .= $body_quote . str_replace("\n", "\n" . $body_quote
913  . "$gt ", rtrim($rewrap_body[$i])) ."\n";
914  } else {
915  $body .= $body_quote . (!empty($body_quote) ? ' ' : '') . str_replace("\n", "\n" . $body_quote . (!empty($body_quote) ? ' ' : ''), rtrim($rewrap_body[$i])) . "\n";
916  }
917  unset($rewrap_body[$i]);
918  }
919  $body = getReplyCitation($from , $orig_header->date) . $body;
920  $composeMessage->reply_rfc822_header = $orig_header;
921 
922  break;
923  default:
924  break;
925  }
926  session_write_close();
928  }
929  $ret = array( 'send_to' => $send_to,
930  'send_to_cc' => $send_to_cc,
931  'send_to_bcc' => $send_to_bcc,
932  'subject' => $subject,
933  'mailprio' => $mailprio,
934  'body' => $body,
935  'identity' => $identity );
936 
937  return ($ret);
938 } /* function newMail() */
939 
940 function getAttachments($message, &$composeMessage, $passed_id, $entities, $imapConnection) {
942  $hashed_attachment_dir = getHashedDir($username, $attachment_dir);
943  if (!count($message->entities) ||
944  ($message->type0 == 'message' && $message->type1 == 'rfc822')) {
945  if ( !in_array($message->entity_id, $entities) && $message->entity_id) {
946  switch ($message->type0) {
947  case 'message':
948  if ($message->type1 == 'rfc822') {
949  $filename = $message->rfc822_header->subject;
950  if ($filename == "") {
951  $filename = "untitled-".$message->entity_id;
952  }
953  $filename .= '.msg';
954  } else {
955  $filename = $message->getFilename();
956  }
957  break;
958  default:
959  if (!$message->mime_header) { /* temporary hack */
960  $message->mime_header = $message->header;
961  }
962  $filename = $message->getFilename();
963  break;
964  }
965 
966  $filename = decodeHeader($filename, false, false, true);
967  if (isset($languages[$squirrelmail_language]['XTRA_CODE']) &&
968  function_exists($languages[$squirrelmail_language]['XTRA_CODE'])) {
969  $filename = $languages[$squirrelmail_language]['XTRA_CODE']('encode', $filename);
970  }
971  $localfilename = GenerateRandomString(32, '', 7);
972  $full_localfilename = "$hashed_attachment_dir/$localfilename";
973  while (file_exists($full_localfilename)) {
974  $localfilename = GenerateRandomString(32, '', 7);
975  $full_localfilename = "$hashed_attachment_dir/$localfilename";
976  }
977  $fp = fopen ("$hashed_attachment_dir/$localfilename", 'wb');
978 
979  $message->att_local_name = $localfilename;
980 
981  $composeMessage->initAttachment($message->type0.'/'.$message->type1,$filename,
982  $localfilename);
983 
984  /* Write Attachment to file
985  The function mime_print_body_lines writes directly to the
986  provided resource $fp. That prohibits large memory consumption in
987  case of forwarding mail with large attachments.
988  */
989  mime_print_body_lines ($imapConnection, $passed_id, $message->entity_id, $message->header->encoding, $fp);
990  fclose ($fp);
991  }
992  } else {
993  for ($i=0, $entCount=count($message->entities); $i<$entCount;$i++) {
994  $composeMessage=getAttachments($message->entities[$i], $composeMessage, $passed_id, $entities, $imapConnection);
995  }
996  }
997  return $composeMessage;
998 }
999 
1000 function getMessage_RFC822_Attachment($message, $composeMessage, $passed_id,
1001  $passed_ent_id='', $imapConnection) {
1003  $hashed_attachment_dir = getHashedDir($username, $attachment_dir);
1004  if (!$passed_ent_id) {
1006  'FETCH '.$passed_id.' RFC822',
1007  TRUE, $response, $readmessage,
1008  $uid_support);
1009  } else {
1011  'FETCH '.$passed_id.' BODY['.$passed_ent_id.']',
1012  TRUE, $response, $readmessage, $uid_support);
1013  $message = $message->parent;
1014  }
1015  if ($response == 'OK') {
1016  $subject = encodeHeader($message->rfc822_header->subject);
1017  array_shift($body_a);
1018  array_pop($body_a);
1019  $body = implode('', $body_a) . "\r\n";
1020 
1021  $localfilename = GenerateRandomString(32, 'FILE', 7);
1022  $full_localfilename = "$hashed_attachment_dir/$localfilename";
1023 
1024  $fp = fopen($full_localfilename, 'w');
1025  fwrite ($fp, $body);
1026  fclose($fp);
1027  $composeMessage->initAttachment('message/rfc822',$subject.'.msg',
1028  $localfilename);
1029  }
1030  return $composeMessage;
1031 }
1032 
1033 function showInputForm ($session, $values=false) {
1034  global $send_to, $send_to_cc, $body, $startMessage, $attachments,
1036  $passed_body, $color, $use_signature, $signature, $prefix_sig,
1037  $editor_size, $editor_height, $subject, $newmail,
1038  $use_javascript_addr_book, $send_to_bcc, $passed_id, $mailbox,
1039  $from_htmladdr_search, $location_of_buttons, $attachment_dir,
1040  $username, $data_dir, $identity, $idents, $draft_id, $delete_draft,
1042  $saved_draft, $mail_sent, $sig_first, $edit_as_new, $action,
1043  $username, $composesession, $default_charset, $composeMessage,
1044  $javascript_on, $compose_onsubmit;
1045 
1046  if ($javascript_on)
1047  $onfocus = ' onfocus="alreadyFocused=true;"';
1048  else
1049  $onfocus = '';
1050 
1051  if ($values) {
1052  $send_to = $values['send_to'];
1053  $send_to_cc = $values['send_to_cc'];
1054  $send_to_bcc = $values['send_to_bcc'];
1055  $subject = $values['subject'];
1056  $mailprio = $values['mailprio'];
1057  $body = $values['body'];
1058  $identity = (int) $values['identity'];
1059  } else {
1060  $send_to = decodeHeader($send_to, true, false);
1061  $send_to_cc = decodeHeader($send_to_cc, true, false);
1062  $send_to_bcc = decodeHeader($send_to_bcc, true, false);
1063  }
1064 
1066  echo "\n". '<script language="JavaScript">'."\n<!--\n" .
1067  'function open_abook() { ' . "\n" .
1068  ' var nwin = window.open("addrbook_popup.php","abookpopup",' .
1069  '"width=670,height=300,resizable=yes,scrollbars=yes");' . "\n" .
1070  ' if((!nwin.opener) && (document.windows != null))' . "\n" .
1071  ' nwin.opener = document.windows;' . "\n" .
1072  "}\n" .
1073  "// -->\n</script>\n\n";
1074  }
1075 
1076  echo "\n" . '<form name="compose" action="compose.php" method="post" ' .
1077  'enctype="multipart/form-data"';
1078 
1079  $compose_onsubmit = array();
1080  do_hook('compose_form');
1081 
1082  // Plugins that use compose_form hook can add an array entry
1083  // to the globally scoped $compose_onsubmit; we add them up
1084  // here and format the form tag's full onsubmit handler.
1085  // Each plugin should use "return false" if they need to
1086  // stop form submission but otherwise should NOT use "return
1087  // true" to give other plugins the chance to do what they need
1088  // to do; SquirrelMail itself will add the final "return true".
1089  // Onsubmit text is enclosed inside of double quotes, so plugins
1090  // need to quote accordingly.
1091  if ($javascript_on) {
1092  if (empty($compose_onsubmit))
1093  $compose_onsubmit = array();
1094  else if (!is_array($compose_onsubmit))
1095  $compose_onsubmit = array($compose_onsubmit);
1096 
1097  $onsubmit_text = '';
1098  foreach ($compose_onsubmit as $text) {
1099  $text = trim($text);
1100  if (!empty($text)) {
1101  if (substr($text, -1) != ';' && substr($text, -1) != '}')
1102  $text .= '; ';
1103  $onsubmit_text .= $text;
1104  }
1105  }
1106 
1107  if (!empty($onsubmit_text))
1108  echo ' onsubmit="' . $onsubmit_text . ' return true;"';
1109  }
1110 
1111  echo ">\n";
1112 
1113  echo addHidden('smtoken', sm_generate_security_token());
1114  echo addHidden('startMessage', $startMessage);
1115 
1116  if ($action == 'draft') {
1117  echo addHidden('delete_draft', $passed_id);
1118  }
1119  if (isset($delete_draft)) {
1120  echo addHidden('delete_draft', $delete_draft);
1121  }
1122  if (isset($session)) {
1123  echo addHidden('session', $session);
1124  }
1125 
1126  if (isset($passed_id)) {
1127  echo addHidden('passed_id', $passed_id);
1128  }
1129 
1130  if ($saved_draft == 'yes') {
1131  echo '<br /><center><b>'. _("Your draft has been saved.").'</center></b>';
1132  }
1133  if ($mail_sent == 'yes') {
1134  echo '<br /><center><b>'. _("Your mail has been sent.").'</center></b>';
1135  }
1136  if ($compose_new_win == '1') {
1137  echo '<table align="center" bgcolor="'.$color[0].'" width="100%" border="0">'."\n" .
1138  ' <tr><td></td>'.html_tag( 'td', '', 'right' ).
1139  '<input type="button" name="Close" onclick="return self.close()" value="'.
1140  _("Close").'" /></td></tr>'."\n";
1141  } else {
1142  echo '<table align="center" cellspacing="0" border="0">' . "\n";
1143  }
1144  if ($location_of_buttons == 'top') {
1146  }
1147 
1148  /* display select list for identities */
1149  if (count($idents) > 1) {
1150  echo ' <tr>' . "\n" .
1151  html_tag( 'td', '', 'right', $color[4], 'width="10%"' ) .
1152  _("From:") . '</td>' . "\n" .
1153  html_tag( 'td', '', 'left', $color[4], 'width="90%"' ) .
1154  ' <select name="identity">' . "\n";
1155 
1156  foreach($idents as $nr => $data) {
1157  echo '<option value="' . $nr . '"';
1158  if (isset($identity) && $identity == $nr) {
1159  echo ' selected="selected"';
1160  }
1161  echo '>' . htmlspecialchars(
1162  $data['full_name'] . ' <' .
1163  $data['email_address'] . '>') .
1164  "</option>\n";
1165  }
1166 
1167  echo '</select>' . "\n" .
1168  ' </td>' . "\n" .
1169  ' </tr>' . "\n";
1170  }
1171 
1172  echo ' <tr>' . "\n" .
1173  html_tag( 'td', '', 'right', $color[4], 'width="10%"' ) .
1174  _("To:") . '</td>' . "\n" .
1175  html_tag( 'td', '', 'left', $color[4], 'width="90%"' ) .
1176  substr(addInput('send_to', $send_to, 60), 0, -3). $onfocus . ' /><br />' . "\n" .
1177  ' </td>' . "\n" .
1178  ' </tr>' . "\n" .
1179  ' <tr>' . "\n" .
1180  html_tag( 'td', '', 'right', $color[4] ) .
1181  _("Cc:") . '</td>' . "\n" .
1182  html_tag( 'td', '', 'left', $color[4] ) .
1183  substr(addInput('send_to_cc', $send_to_cc, 60), 0, -3). $onfocus . ' /><br />' . "\n" .
1184  ' </td>' . "\n" .
1185  ' </tr>' . "\n" .
1186  ' <tr>' . "\n" .
1187  html_tag( 'td', '', 'right', $color[4] ) .
1188  _("Bcc:") . '</td>' . "\n" .
1189  html_tag( 'td', '', 'left', $color[4] ) .
1190  substr(addInput('send_to_bcc', $send_to_bcc, 60), 0, -3). $onfocus . ' /><br />' . "\n" .
1191  ' </td>' . "\n" .
1192  ' </tr>' . "\n" .
1193  ' <tr>' . "\n" .
1194  html_tag( 'td', '', 'right', $color[4] ) .
1195  _("Subject:") . '</td>' . "\n" .
1196  html_tag( 'td', '', 'left', $color[4] ) . "\n";
1197  echo ' '.substr(addInput('subject', $subject, 60), 0, -3). $onfocus .
1198  ' /> </td>' . "\n" .
1199  ' </tr>' . "\n\n";
1200 
1201  if ($location_of_buttons == 'between') {
1203  }
1204 
1205  /* why this distinction? */
1206  if ($compose_new_win == '1') {
1207  echo ' <tr>' . "\n" .
1208  ' <td bgcolor="' . $color[0] . '" colspan="2" align="center">' . "\n" .
1209  ' <textarea name="body" id="body" rows="' . (int)$editor_height .
1210  '" cols="' . (int)$editor_size . '" wrap="virtual"' . $onfocus . '>';
1211  }
1212  else {
1213  echo ' <tr>' . "\n" .
1214  ' <td bgcolor="' . $color[4] . '" colspan="2">' . "\n" .
1215  ' &nbsp;&nbsp;<textarea name="body" id="body" rows="' . (int)$editor_height .
1216  '" cols="' . (int)$editor_size . '" wrap="virtual"' . $onfocus . '>';
1217  }
1218 
1219  if ($use_signature == true && $newmail == true && !isset($from_htmladdr_search)) {
1220  $signature = $idents[$identity]['signature'];
1221 
1222  if ($sig_first == '1') {
1223  if ($default_charset == 'iso-2022-jp') {
1224  echo "\n\n".($prefix_sig==true? "-- \n":'').mb_convert_encoding($signature, 'EUC-JP');
1225  } else {
1226  echo "\n\n".($prefix_sig==true? "-- \n":'').decodeHeader($signature,false,false,true);
1227  }
1228  echo "\n\n".htmlspecialchars(decodeHeader($body,false,false,true));
1229  }
1230  else {
1231  echo "\n\n".htmlspecialchars(decodeHeader($body,false,false,true));
1232  if ($default_charset == 'iso-2022-jp') {
1233  echo "\n\n".($prefix_sig==true? "-- \n":'').mb_convert_encoding($signature, 'EUC-JP');
1234  }else{
1235  echo "\n\n".($prefix_sig==true? "-- \n":'').decodeHeader($signature,false,false,true);
1236  }
1237  }
1238  } else {
1239  echo htmlspecialchars(decodeHeader($body,false,false,true));
1240  }
1241  echo '</textarea><br />' . "\n" .
1242  ' </td>' . "\n" .
1243  ' </tr>' . "\n";
1244 
1245 
1246  if ($location_of_buttons == 'bottom') {
1248  } else {
1249  echo ' <tr>' . "\n" .
1250  html_tag( 'td', '', 'right', '', 'colspan="2"' ) . "\n" .
1251  ' ' . addSubmit(_("Send"), 'send').
1252  ' &nbsp;&nbsp;&nbsp;&nbsp;<br /><br />' . "\n" .
1253  ' </td>' . "\n" .
1254  ' </tr>' . "\n";
1255  }
1256 
1257  // composeMessage can be empty when coming from a restored session
1258  if (is_object($composeMessage) && $composeMessage->entities)
1259  $attach_array = $composeMessage->entities;
1260  if ($session_expired && !empty($attachments) && is_array($attachments))
1261  $attach_array = $attachments;
1262 
1263  /* This code is for attachments */
1264  if ((bool) ini_get('file_uploads')) {
1265 
1266  /* Calculate the max size for an uploaded file.
1267  * This is advisory for the user because we can't actually prevent
1268  * people to upload too large files. */
1269  $sizes = array();
1270  /* php.ini vars which influence the max for uploads */
1271  $configvars = array('post_max_size', 'memory_limit', 'upload_max_filesize');
1272  foreach($configvars as $var) {
1273  /* skip 0 or empty values, and -1 which means 'unlimited' */
1274  if( $size = getByteSize(ini_get($var)) ) {
1275  if ( $size != '-1' ) {
1276  $sizes[] = $size;
1277  }
1278  }
1279  }
1280 
1281  if(count($sizes) > 0) {
1282  $maxsize_text = '(max.&nbsp;' . show_readable_size( min( $sizes ) ) . ')';
1283  $maxsize_input = addHidden('MAX_FILE_SIZE', min( $sizes ));
1284  } else {
1285  $maxsize_text = $maxsize_input = '';
1286  }
1287  echo ' <tr>' . "\n" .
1288  ' <td colspan="2">' . "\n" .
1289  ' <table width="100%" cellpadding="1" cellspacing="0" align="center"'.
1290  ' border="0" bgcolor="'.$color[9].'">' . "\n" .
1291  ' <tr>' . "\n" .
1292  ' <td>' . "\n" .
1293  ' <table width="100%" cellpadding="3" cellspacing="0" align="center"'.
1294  ' border="0">' . "\n" .
1295  ' <tr>' . "\n" .
1296  html_tag( 'td', '', 'right', '', 'valign="middle"' ) .
1297  _("Attach:") . '</td>' . "\n" .
1298  html_tag( 'td', '', 'left', '', 'valign="middle"' ) .
1299  $maxsize_input .
1300  ' <input name="attachfile" size="48" type="file" />' . "\n" .
1301  ' &nbsp;&nbsp;<input type="submit" name="attach"' .
1302  ' value="' . _("Add") .'" />' . "\n" .
1303  $maxsize_text .
1304  ' </td>' . "\n" .
1305  ' </tr>' . "\n";
1306 
1307  $s_a = array();
1308  global $username, $attachment_dir;
1309  $hashed_attachment_dir = getHashedDir($username, $attachment_dir);
1310  if (!empty($attach_array)) {
1311  foreach ($attach_array as $key => $attachment) {
1312  $attached_file = $attachment->att_local_name;
1313  if ($attachment->att_local_name || $attachment->body_part) {
1314  $attached_filename = decodeHeader($attachment->mime_header->getParameter('name'));
1315  $type = $attachment->mime_header->type0.'/'.
1316  $attachment->mime_header->type1;
1317 
1318  $s_a[] = '<table bgcolor="'.$color[0].
1319  '" border="0"><tr><td>'.
1320  addCheckBox('delete[]', FALSE, $key).
1321  "</td><td>\n" . $attached_filename .
1322  '</td><td>-</td><td> ' . $type . '</td><td>('.
1323  show_readable_size( filesize( $hashed_attachment_dir . '/' . $attached_file ) ) .
1324  ')</td></tr></table>'."\n";
1325  }
1326  }
1327  }
1328  if (count($s_a)) {
1329  foreach ($s_a as $s) {
1330  echo '<tr>' . html_tag( 'td', '', 'left', $color[0], 'colspan="2"' ) . $s .'</td></tr>';
1331  }
1332  echo '<tr><td colspan="2"><input type="submit" name="do_delete" value="' .
1333  _("Delete selected attachments") . "\" />\n" .
1334  '</td></tr>';
1335  }
1336  echo ' </table>' . "\n" .
1337  ' </td>' . "\n" .
1338  ' </tr>' . "\n" .
1339  ' </table>' . "\n" .
1340  ' </td>' . "\n" .
1341  ' </tr>' . "\n";
1342  } // End of file_uploads if-block
1343  /* End of attachment code */
1344  echo '</table>' . "\n" .
1345  addHidden('username', $username).
1346  addHidden('smaction', $action).
1347  addHidden('mailbox', $mailbox);
1348  sqgetGlobalVar('QUERY_STRING', $queryString, SQ_SERVER);
1349  /*
1350  store the complete ComposeMessages array in a hidden input value
1351  so we can restore them in case of a session timeout.
1352  */
1353  echo addHidden('composesession', $composesession).
1354  addHidden('querystring', $queryString).
1355  (!empty($attach_array) ?
1356  addHidden('attachments', serialize($attach_array)) : '').
1357  "</form>\n";
1358  if (!(bool) ini_get('file_uploads')) {
1359  /* File uploads are off, so we didn't show that part of the form.
1360  To avoid bogus bug reports, tell the user why. */
1361  echo '<p style="text-align:center">'
1362  . _("Because PHP file uploads are turned off, you can not attach files to this message. Please see your system administrator for details.")
1363  . "</p>\r\n";
1364  }
1365 
1366  do_hook('compose_bottom');
1367  echo '</body></html>' . "\n";
1368 }
1369 
1370 
1374  $request_mdn, $request_dr,
1376 
1377  echo ' <tr>' . "\n" .
1378  ' <td></td>' . "\n" .
1379  ' <td>' . "\n";
1380  if ($default_use_priority) {
1381  if(!isset($mailprio)) {
1382  $mailprio = '3';
1383  }
1384  echo ' ' . _("Priority") .
1385  addSelect('mailprio', array(
1386  '1' => _("High"),
1387  '3' => _("Normal"),
1388  '5' => _("Low") ), $mailprio, TRUE);
1389  }
1391  if ($default_use_mdn) {
1392  if ($mdn_user_support) {
1393  echo ' ' . _("Receipt") .': '.
1394  addCheckBox('request_mdn', $request_mdn == '1', '1', 'id="request_mdn"') . '<label for="request_mdn">' . _("On Read") . '</label>' .
1395  addCheckBox('request_dr', $request_dr == '1', '1', 'id="request_dr"') . '<label for="request_dr">' . _("On Delivery") . '</label>';
1396  }
1397  }
1398 
1399  echo ' </td>' . "\n" .
1400  ' </tr>' . "\n" .
1401  ' <tr>' . "\n" .
1402  ' <td></td>' . "\n" .
1403  ' <td>' . "\n" .
1404  ' <input type="submit" name="sigappend" value="' . _("Signature") . '" />' . "\n";
1406  echo " <script language=\"JavaScript\"><!--\n document.write(\"".
1407  " <input type=button value=\\\""._("Addresses").
1408  "\\\" onclick=\\\"javascript:open_abook();\\\" />\");".
1409  " // --></script><noscript>\n".
1410  ' <input type="submit" name="html_addr_search" value="'.
1411  _("Addresses").'" />'.
1412  " </noscript>\n";
1413  } else {
1414  echo ' <input type="submit" name="html_addr_search" value="'.
1415  _("Addresses").'" />' . "\n";
1416  }
1417 
1418  if ($save_as_draft) {
1419  echo ' <input type="submit" name ="draft" value="' . _("Save Draft") . "\" />\n";
1420  }
1421 
1422  echo ' <input type="submit" name="send" value="'. _("Send") . '" />' . "\n";
1423  do_hook('compose_button_row');
1424 
1425  echo ' </td>' . "\n" .
1426  ' </tr>' . "\n\n";
1427 }
1428 
1429 function checkInput ($show) {
1430  /*
1431  * I implemented the $show variable because the error messages
1432  * were getting sent before the page header. So, I check once
1433  * using $show=false, and then when i'm ready to display the error
1434  * message, show=true
1435  */
1436  global $body, $send_to, $send_to_cc, $send_to_bcc, $subject, $color;
1437 
1438  $send_to = trim($send_to);
1439  $send_to_cc = trim($send_to_cc);
1440  $send_to_bcc = trim($send_to_bcc);
1441  if (empty($send_to) && empty($send_to_cc) && empty($send_to_bcc)) {
1442  if ($show) {
1443  plain_error_message(_("You have not filled in the \"To:\" field."), $color);
1444  }
1445  return false;
1446  }
1447  return true;
1448 } /* function checkInput() */
1449 
1450 
1451 /* True if FAILURE */
1452 function saveAttachedFiles($session) {
1453  global $_FILES, $attachment_dir, $username,
1454  $data_dir, $composeMessage;
1455 
1456  /* get out of here if no file was attached at all */
1457  if (! is_uploaded_file($_FILES['attachfile']['tmp_name']) ) {
1458  return true;
1459  }
1460 
1461  $hashed_attachment_dir = getHashedDir($username, $attachment_dir);
1462  $localfilename = GenerateRandomString(32, '', 7);
1463  $full_localfilename = "$hashed_attachment_dir/$localfilename";
1464  while (file_exists($full_localfilename)) {
1465  $localfilename = GenerateRandomString(32, '', 7);
1466  $full_localfilename = "$hashed_attachment_dir/$localfilename";
1467  }
1468 
1469  // FIXME: we SHOULD prefer move_uploaded_file over rename because
1470  // m_u_f works better with restricted PHP installs (safe_mode, open_basedir)
1471  if (!@rename($_FILES['attachfile']['tmp_name'], $full_localfilename)) {
1472  if (!@move_uploaded_file($_FILES['attachfile']['tmp_name'],$full_localfilename)) {
1473  return true;
1474  }
1475  }
1476  $type = strtolower($_FILES['attachfile']['type']);
1477  $name = $_FILES['attachfile']['name'];
1478  $composeMessage->initAttachment($type, $name, $localfilename);
1479 }
1480 
1481 /* parse values like 8M and 2k into bytes */
1482 function getByteSize($ini_size) {
1483 
1484  if(!$ini_size) {
1485  return FALSE;
1486  }
1487 
1488  $ini_size = trim($ini_size);
1489 
1490  // if there's some kind of letter at the end of the string we need to multiply.
1491  if(!is_numeric(substr($ini_size, -1))) {
1492 
1493  switch(strtoupper(substr($ini_size, -1))) {
1494  case 'G':
1495  $bytesize = 1073741824;
1496  break;
1497  case 'M':
1498  $bytesize = 1048576;
1499  break;
1500  case 'K':
1501  $bytesize = 1024;
1502  break;
1503  }
1504 
1505  return ($bytesize * (int)substr($ini_size, 0, -1));
1506  }
1507 
1508  return $ini_size;
1509 }
1510 
1511 
1528 function deliverMessage(&$composeMessage, $draft=false) {
1529  global $send_to, $send_to_cc, $send_to_bcc, $mailprio, $subject, $body,
1530  $username, $popuser, $usernamedata, $identity, $idents, $data_dir,
1531  $request_mdn, $request_dr, $default_charset, $color, $useSendmail,
1532  $domain, $action, $default_move_to_sent, $move_to_sent;
1533  global $imapServerAddress, $imapPort, $sent_folder, $key;
1534 
1535  $rfc822_header = $composeMessage->rfc822_header;
1536 
1537  $abook = addressbook_init(false, true);
1538  $rfc822_header->to = $rfc822_header->parseAddress($send_to,true, array(), '', $domain, array(&$abook,'lookup'));
1539  $rfc822_header->cc = $rfc822_header->parseAddress($send_to_cc,true,array(), '',$domain, array(&$abook,'lookup'));
1540  $rfc822_header->bcc = $rfc822_header->parseAddress($send_to_bcc,true, array(), '',$domain, array(&$abook,'lookup'));
1541  $rfc822_header->priority = $mailprio;
1542  $rfc822_header->subject = $subject;
1543 
1544  $special_encoding='';
1545  if (strtolower($default_charset) == 'iso-2022-jp') {
1546  if (mb_detect_encoding($body) == 'ASCII') {
1547  $special_encoding = '8bit';
1548  } else {
1549  $body = mb_convert_encoding($body, 'JIS');
1550  $special_encoding = '7bit';
1551  }
1552  }
1553  $composeMessage->setBody($body);
1554 
1555  if (preg_match('|^([^@%/]+)[@%/](.+)$|', $username, $usernamedata)) {
1556  $popuser = $usernamedata[1];
1557  $domain = $usernamedata[2];
1558  unset($usernamedata);
1559  } else {
1560  $popuser = $username;
1561  }
1562  $reply_to = '';
1563  $from_mail = $idents[$identity]['email_address'];
1564  $full_name = $idents[$identity]['full_name'];
1565  $reply_to = $idents[$identity]['reply_to'];
1566  if (!$from_mail) {
1567  $from_mail = "$popuser@$domain";
1568  }
1569  $rfc822_header->from = $rfc822_header->parseAddress($from_mail,true);
1570  if (!$rfc822_header->from[0]->host) $rfc822_header->from[0]->host = $domain;
1571  if ($full_name) {
1572  $from = $rfc822_header->from[0];
1573  $full_name_encoded = encodeHeader('"' . $full_name . '"');
1574  if ($full_name_encoded != $full_name) {
1575  $from_addr = $full_name_encoded .' <'.$from->mailbox.'@'.$from->host.'>';
1576  } else {
1577  $from_addr = '"'.$full_name .'" <'.$from->mailbox.'@'.$from->host.'>';
1578  }
1579  $rfc822_header->from = $rfc822_header->parseAddress($from_addr,true);
1580  }
1581  if ($reply_to) {
1582  $rfc822_header->reply_to = $rfc822_header->parseAddress($reply_to,true);
1583  }
1584  /* Receipt: On Read */
1585  if (isset($request_mdn) && $request_mdn) {
1586  $rfc822_header->dnt = $rfc822_header->parseAddress($from_mail,true);
1587  }
1588 
1589  /* Receipt: On Delivery */
1590  if (isset($request_dr) && $request_dr) {
1591  $rfc822_header->more_headers['Return-Receipt-To'] = $from_mail;
1592  }
1593 
1594  /* multipart messages */
1595  if (count($composeMessage->entities)) {
1596  $message_body = new Message();
1597  $message_body->body_part = $composeMessage->body_part;
1598  $composeMessage->body_part = '';
1599  $mime_header = new MessageHeader;
1600  $mime_header->type0 = 'text';
1601  $mime_header->type1 = 'plain';
1602  if ($special_encoding) {
1603  $mime_header->encoding = $special_encoding;
1604  } else {
1605  $mime_header->encoding = '8bit';
1606  }
1607  if ($default_charset) {
1608  $mime_header->parameters['charset'] = $default_charset;
1609  }
1610  $message_body->mime_header = $mime_header;
1611  array_unshift($composeMessage->entities, $message_body);
1612  $content_type = new ContentType('multipart/mixed');
1613  } else {
1614  $content_type = new ContentType('text/plain');
1615  if ($special_encoding) {
1616  $rfc822_header->encoding = $special_encoding;
1617  } else {
1618  $rfc822_header->encoding = '8bit';
1619  }
1620  if ($default_charset) {
1621  $content_type->properties['charset']=$default_charset;
1622  }
1623  }
1624 
1625  $rfc822_header->content_type = $content_type;
1626  $composeMessage->rfc822_header = $rfc822_header;
1627  if ($action == 'reply' || $action == 'reply_all') {
1628  global $passed_id, $passed_ent_id;
1629  $reply_id = $passed_id;
1630  $reply_ent_id = $passed_ent_id;
1631  } else {
1632  $reply_id = '';
1633  $reply_ent_id = '';
1634  }
1635 
1636  /* Here you can modify the message structure just before we hand
1637  it over to deliver */
1638  $hookReturn = do_hook('compose_send', $composeMessage);
1639  /* Get any changes made by plugins to $composeMessage. */
1640  if ( is_object($hookReturn[1]) ) {
1641  $composeMessage = $hookReturn[1];
1642  }
1643 
1644  if (!$useSendmail && !$draft) {
1645  require_once(SM_PATH . 'class/deliver/Deliver_SMTP.class.php');
1646  $deliver = new Deliver_SMTP();
1648 
1649  $authPop = (isset($pop_before_smtp) && $pop_before_smtp) ? true : false;
1650 
1651  $user = '';
1652  $pass = '';
1653  if (empty($pop_before_smtp_host))
1655 
1656  get_smtp_user($user, $pass);
1657 
1658  $stream = $deliver->initStream($composeMessage,$domain,0,
1659  $smtpServerAddress, $smtpPort, $user, $pass, $authPop, $pop_before_smtp_host);
1660  } elseif (!$draft) {
1661  require_once(SM_PATH . 'class/deliver/Deliver_SendMail.class.php');
1663  // Check for outdated configuration
1664  if (!isset($sendmail_args)) {
1665  if ($sendmail_path=='/var/qmail/bin/qmail-inject') {
1666  $sendmail_args = '';
1667  } else {
1668  $sendmail_args = '-i -t';
1669  }
1670  }
1671  $deliver = new Deliver_SendMail(array('sendmail_args'=>$sendmail_args));
1672  $stream = $deliver->initStream($composeMessage,$sendmail_path);
1673  } elseif ($draft) {
1674  global $draft_folder;
1676  $imapPort, 0);
1678  require_once(SM_PATH . 'class/deliver/Deliver_IMAP.class.php');
1679  $imap_deliver = new Deliver_IMAP();
1680  $succes = $imap_deliver->mail($composeMessage, $imap_stream, $reply_id, $reply_ent_id, $imap_stream, $draft_folder);
1682  unset ($imap_deliver);
1683  $composeMessage->purgeAttachments();
1684  return $succes;
1685  } else {
1686  $msg = '<br />'.sprintf(_("Error: Draft folder %s does not exist."),
1687  htmlspecialchars($draft_folder));
1688  plain_error_message($msg, $color);
1689  return false;
1690  }
1691  }
1692  $succes = false;
1693  if ($stream) {
1694  $deliver->mail($composeMessage, $stream, $reply_id, $reply_ent_id);
1695  $succes = $deliver->finalizeStream($stream);
1696  }
1697  if (!$succes) {
1698  $msg = _("Message not sent.") .' '. _("Server replied:") .
1699  "\n<blockquote>\n" . $deliver->dlv_msg . '<br />' .
1700  $deliver->dlv_ret_nr . ' ' .
1701  $deliver->dlv_server_msg . "</blockquote>\n\n";
1702  plain_error_message($msg, $color);
1703  } else {
1704  unset ($deliver);
1706 
1707 
1708  // mark original message as having been replied to if applicable
1709  global $passed_id, $mailbox, $action;
1710  if ($action == 'reply' || $action == 'reply_all') {
1712  sqimap_messages_flag ($imap_stream, $passed_id, $passed_id, 'Answered', false);
1713  }
1714 
1715 
1716  // copy message to sent folder
1717  $move_to_sent = getPref($data_dir,$username,'move_to_sent');
1718  if (isset($default_move_to_sent) && ($default_move_to_sent != 0)) {
1719  $svr_allow_sent = true;
1720  } else {
1721  $svr_allow_sent = false;
1722  }
1723 
1724  if (isset($sent_folder) && (($sent_folder != '') || ($sent_folder != 'none'))
1726  $fld_sent = true;
1727  } else {
1728  $fld_sent = false;
1729  }
1730 
1731  if ((isset($move_to_sent) && ($move_to_sent != 0)) || (!isset($move_to_sent))) {
1732  $lcl_allow_sent = true;
1733  } else {
1734  $lcl_allow_sent = false;
1735  }
1736 
1737  if (($fld_sent && $svr_allow_sent && !$lcl_allow_sent) || ($fld_sent && $lcl_allow_sent)) {
1738  require_once(SM_PATH . 'class/deliver/Deliver_IMAP.class.php');
1739  $imap_deliver = new Deliver_IMAP();
1740  $imap_deliver->mail($composeMessage, $imap_stream, $reply_id, $reply_ent_id, $imap_stream, $sent_folder);
1741  unset ($imap_deliver);
1742  }
1743  $composeMessage->purgeAttachments();
1745  }
1746  return $succes;
1747 }
1748 
plain_error_message
plain_error_message($message, $color)
Definition: display_messages.php:40
$body
if(isset($ldap_server) && $ldap_server[0] &&! extension_loaded('ldap')) $body
Definition: bug_report.php:106
elseif
if(! sqgetGlobalVar('sound', $sound, SQ_GET)) elseif($sound=='(none)')
Definition: testsound.php:25
sqgetGlobalVar
sqgetGlobalVar($name, &$value, $search=SQ_INORDER)
Definition: global.php:344
Deliver_SMTP
Definition: Deliver_SMTP.class.php:21
$ret
$ret
Definition: webmail.php:172
$imapConnection
$imapConnection
Definition: message_details_bottom.php:74
getPref
getPref($data_dir, $username, $string, $default='')
Definition: db_prefs.php:316
$useSendmail
$useSendmail
Definition: config_default.php:140
$sendmail_path
$sendmail_path
Definition: config_default.php:180
$cnt
$cnt
Definition: options_identities.php:86
$default_use_mdn
$default_use_mdn
Definition: config_default.php:575
html_tag
html_tag( $tag, $val='', $align='', $bgcolor='', $xtra='')
Definition: html.php:27
$imapServerAddress
$imapServerAddress
Definition: config_default.php:202
$location
if(sqgetGlobalVar('return', $temp, SQ_POST)) if(sqgetGlobalVar('mailtodata', $mailtodata, SQ_GET)) $location
Definition: compose.php:144
$from
$from
Definition: printer_friendly_bottom.php:60
sqimap_login
sqimap_login($username, $password, $imap_server_address, $imap_port, $hide)
Definition: imap_general.php:481
$draft_folder
$draft_folder
Definition: config_default.php:396
sqUnWordWrap
sqUnWordWrap(&$body)
Definition: strings.php:105
$rfc822_header
$rfc822_header
Definition: compose.php:362
$data_dir
$data_dir
Definition: config_default.php:499
showInputForm
showInputForm($session, $values=false)
Definition: compose.php:1033
SQ_SESSION
const SQ_SESSION
Definition: global.php:18
$imap_stream
$imap_stream
Definition: bug_report.php:119
$id
$id
Definition: move_messages.php:190
sqimap_mailbox_exists
sqimap_mailbox_exists($imap_stream, $mailbox)
Definition: imap_mailbox.php:226
$default_move_to_sent
$default_move_to_sent
Definition: config_default.php:392
displayPageHeader
displayPageHeader($color, $mailbox, $xtra='', $session=false)
Definition: page_header.php:105
$mailbox
$mailbox
Definition: options.php:28
get_smtp_user
get_smtp_user(&$user, &$pass)
Definition: auth.php:346
sprintf
powered by Systran sprintf(_("Number of supported language pairs: %s"), '36').' '
Definition: options.php:107
$message_body
$message_body
Definition: message_details_bottom.php:80
$pop_before_smtp_host
$pop_before_smtp_host
Definition: config_default.php:321
$username
global $username
Definition: validate.php:55
do_hook
do_hook($name)
Definition: plugin.php:42
$sendmail_args
$sendmail_args
Definition: config_default.php:194
newMail
newMail($mailbox='', $passed_id='', $passed_ent_id='', $action='', $session='')
Definition: compose.php:691
addInput
addInput($name, $value='', $size=0, $maxlength=0, $extra_attributes='')
Definition: forms.php:65
get_identities
get_identities()
Definition: identity.php:27
mime_fetch_body
mime_fetch_body($imap_stream, $id, $ent_id=1, $fetch_size=0)
Definition: mime.php:100
sqimap_mailbox_select
sqimap_mailbox_select($imap_stream, $mailbox)
Definition: imap_mailbox.php:238
$reply_citation_end
$reply_citation_end
Definition: load_prefs.php:157
$mdn_user_support
$mdn_user_support
Definition: load_prefs.php:237
compose_Header
compose_Header($color, $mailbox)
Definition: page_header.php:326
$sig_first
$sig_first
Definition: load_prefs.php:257
$uid_support
$uid_support
Definition: config_default.php:643
$message
$message
Definition: download.php:54
sm_validate_security_token
sm_validate_security_token($token, $validity_period=0, $show_error=FALSE)
Definition: strings.php:1405
decodeBody
decodeBody($body, $encoding)
Definition: mime.php:598
getAttachments
getAttachments($message, &$composeMessage, $passed_id, $entities, $imapConnection)
Definition: compose.php:940
replyAllString
replyAllString($header)
Definition: compose.php:150
$gt
$gt
Definition: monostochastic.php:42
$smtpPort
$smtpPort
Definition: config_default.php:151
$languages
global $languages
Definition: i18n.php:774
sqimap_messages_flag
sqimap_messages_flag($imap_stream, $start, $end, $flag, $handle_errors)
Definition: imap_messages.php:1160
getHashedDir
getHashedDir($username, $dir, $hash_dirs='')
Definition: prefs.php:109
$attachments
$attachments
Definition: printer_friendly_bottom.php:113
addSelect
addSelect($name, $values, $default=null, $usekeys=false)
Definition: forms.php:86
$sent_folder
$sent_folder
Definition: config_default.php:395
SM_PATH
const SM_PATH
Definition: compose.php:27
$values
if(!isset($passed_ent_id)) if(!isset($passed_id)) if(!isset($mailbox)) if(!isset($action)) $values
Definition: compose.php:661
Deliver_SendMail
Definition: Deliver_SendMail.class.php:23
mime_print_body_lines
mime_print_body_lines($imap_stream, $id, $ent_id=1, $encoding, $rStream='php://stdout')
Definition: mime.php:164
$end
$end
Definition: message_details_bottom.php:90
Rfc822Header
Definition: Rfc822Header.class.php:26
$use_javascript_addr_book
$use_javascript_addr_book
Definition: load_prefs.php:271
$attachment_dir
$attachment_dir
Definition: config_default.php:517
sqsession_is_registered
sqsession_is_registered($name)
Definition: global.php:318
$editor_height
$editor_height
Definition: load_prefs.php:145
$trtable
$trtable
Definition: mailto.php:77
checkInput
checkInput($show)
Definition: compose.php:1429
sqimap_logout
sqimap_logout($imap_stream)
Definition: imap_general.php:639
$save_as_draft
$save_as_draft
Definition: load_prefs.php:86
getLongDateString
getLongDateString( $stamp, $fallback='')
Definition: date.php:309
addSubmit
addSubmit($value, $name=null, $extra_attributes='')
Definition: forms.php:112
Deliver_IMAP
Definition: Deliver_IMAP.class.php:22
getMessage_RFC822_Attachment
getMessage_RFC822_Attachment($message, $composeMessage, $passed_id, $passed_ent_id='', $imapConnection)
Definition: compose.php:1000
sm_generate_security_token
sm_generate_security_token()
Definition: strings.php:1340
SQ_GET
const SQ_GET
Definition: global.php:16
$default_use_priority
$default_use_priority
Definition: config_default.php:558
$smtpServerAddress
$smtpServerAddress
Definition: config_default.php:146
encodeHeader
encodeHeader($string)
Definition: mime.php:759
show_readable_size
show_readable_size($bytes)
Definition: strings.php:582
addHidden
addHidden($name, $value)
Definition: forms.php:58
is_conversion_safe
is_conversion_safe($input_charset)
Definition: i18n.php:540
$strip_sigs
$strip_sigs
Definition: load_prefs.php:260
SQ_SERVER
const SQ_SERVER
Definition: global.php:20
MessageHeader
Definition: MessageHeader.class.php:25
$reply_citation_style
$reply_citation_style
Definition: load_prefs.php:154
SQ_POST
const SQ_POST
Definition: global.php:17
$editor_size
if($left_size=='') $editor_size
Definition: load_prefs.php:144
decodeHeader
decodeHeader($string, $utfencode=true, $htmlsave=true, $decide=false)
Definition: mime.php:633
$filename
if(isset($override_type0)) if(isset($override_type1)) $filename
Definition: download.php:97
$data
$data
Definition: mailto.php:83
exit
exit
Definition: help.php:128
$location_of_buttons
$location_of_buttons
Definition: load_prefs.php:216
$action
$action
Definition: options.php:34
$pop_before_smtp
$pop_before_smtp
Definition: config_default.php:309
sqsession_register
sqsession_register($var, $name)
Definition: global.php:289
_
_($str)
Definition: gettext.php:160
sq_strlen
sq_strlen($string, $charset=NULL)
Definition: strings.php:816
$default_charset
$default_charset
Definition: config_default.php:1027
$type0
$type0
Definition: view_text.php:65
$base_uri
if(!(bool) ini_get('session.use_cookies')||ini_get('session.use_cookies')=='off') $base_uri
Definition: global.php:173
set_my_charset
set_my_charset()
Definition: i18n.php:511
$subject
if(isset($messages[$mbx_response['UIDVALIDITY']]["$passed_id"])) if(!is_object($message)) $subject
Definition: download.php:64
sqimap_get_message
sqimap_get_message($imap_stream, $id, $mailbox)
Definition: imap_messages.php:1050
saveAttachedFiles
saveAttachedFiles($session)
Definition: compose.php:1452
getforwardHeader
getforwardHeader($orig_header)
Definition: compose.php:255
deliverMessage
deliverMessage(&$composeMessage, $draft=false)
Definition: compose.php:1528
$reply_citation_start
$reply_citation_start
Definition: load_prefs.php:156
$to
$to
Definition: printer_friendly_bottom.php:66
sqimap_run_command
sqimap_run_command($imap_stream, $query, $handle_errors, &$response, &$message, $unique_id=false, $filter=false, $outputstream=false, $no_return=false)
Definition: imap_general.php:58
$imapPort
$imapPort
Definition: config_default.php:210
Message
Definition: Message.class.php:27
$cc
$cc
Definition: printer_friendly_bottom.php:65
getByteSize
getByteSize($ini_size)
Definition: compose.php:1482
sqWordWrap
if(file_exists(SM_PATH . 'plugins/compatibility/functions.php')) sqWordWrap(&$line, $wrap, $charset=null)
Definition: strings.php:48
SQ_FORM
const SQ_FORM
Definition: global.php:21
charset_convert
charset_convert($in_charset, $string, $out_charset, $htmlencode=true)
Definition: i18n.php:264
$color
$color
Definition: load_prefs.php:28
$include_self_reply_all
$include_self_reply_all
Definition: load_prefs.php:239
$stream
$stream
Definition: configtest.php:429
SQ_COOKIE
const SQ_COOKIE
Definition: global.php:19
$squirrelmail_language
global $squirrelmail_language
Definition: i18n.php:774
sqsession_unregister
sqsession_unregister($name)
Definition: global.php:301
GenerateRandomString
GenerateRandomString($size, $chars, $flags=0)
Definition: strings.php:614
$encoding
$encoding
Definition: download.php:81
getReplyCitation
getReplyCitation($orig_from, $orig_date)
Definition: compose.php:195
get_location
get_location()
Definition: strings.php:340
$use_signature
$use_signature
Definition: load_prefs.php:146
$body_quote
$body_quote
Definition: load_prefs.php:159
$entities
$entities
Definition: message_details_bottom.php:87
$type1
$type1
Definition: download.php:80
$session_expired
$session_expired
Definition: compose.php:294
addCheckBox
addCheckBox($name, $checked=false, $value=null, $extra_attributes='')
Definition: forms.php:42
$header
$header
Definition: message_details_bottom.php:81
$idents
$idents
Definition: compose.php:146
$prefix_sig
$prefix_sig
Definition: load_prefs.php:147
$compose_new_win
$compose_new_win
Definition: load_prefs.php:251
$abook
if(empty($query) &&empty($show) &&empty($listall)) $abook
Definition: addrbook_search.php:204
$domain
$domain
Definition: config_default.php:118
showComposeButtonRow
showComposeButtonRow()
Definition: compose.php:1371
$javascript_on
$javascript_on
Definition: load_prefs.php:270
ContentType
Definition: ContentType.class.php:25
addressbook_init
addressbook_init($showerr=true, $onlylocal=false)
Definition: addressbook.php:32