| 1 | <?php |
| 2 | |
| 3 | /** |
| 4 | * compose.php |
| 5 | * |
| 6 | * Copyright (c) 1999-2002 The SquirrelMail Project Team |
| 7 | * Licensed under the GNU GPL. For full terms see the file COPYING. |
| 8 | * |
| 9 | * This code sends a mail. |
| 10 | * |
| 11 | * There are 4 modes of operation: |
| 12 | * - Start new mail |
| 13 | * - Add an attachment |
| 14 | * - Send mail |
| 15 | * - Save As Draft |
| 16 | * |
| 17 | * $Id$ |
| 18 | */ |
| 19 | |
| 20 | require_once('../src/validate.php'); |
| 21 | require_once('../functions/imap.php'); |
| 22 | require_once('../functions/date.php'); |
| 23 | require_once('../functions/mime.php'); |
| 24 | require_once('../functions/smtp.php'); |
| 25 | require_once('../functions/plugin.php'); |
| 26 | require_once('../functions/display_messages.php'); |
| 27 | /* --------------------- Specific Functions ------------------------------ */ |
| 28 | |
| 29 | function replyAllString($header) { |
| 30 | global $include_self_reply_all, $username, $data_dir; |
| 31 | $excl_arr = array(); |
| 32 | /** |
| 33 | * 1) Remove the addresses we'll be sending the message 'to' |
| 34 | */ |
| 35 | $url_replytoall_avoid_addrs = ''; |
| 36 | if (isset($header->replyto)) { |
| 37 | $excl_ar = $header->getAddr_a('replyto'); |
| 38 | } |
| 39 | /** |
| 40 | * 2) Remove our identities from the CC list (they still can be in the |
| 41 | * TO list) only if $include_self_reply_all is turned off |
| 42 | */ |
| 43 | if (!$include_self_reply_all) { |
| 44 | $email_address = trim(getPref($data_dir, $username, 'email_address')); |
| 45 | $excl_ar[$email_address] = ''; |
| 46 | |
| 47 | $idents = getPref($data_dir, $username, 'identities'); |
| 48 | if ($idents != '' && $idents > 1) { |
| 49 | for ($i = 1; $i < $idents; $i ++) { |
| 50 | $cur_email_address = getPref($data_dir, $username, |
| 51 | 'email_address' . $i); |
| 52 | $cur_email_address = strtolower($cur_email_address); |
| 53 | $excl_ar[$cur_email_address] = ''; |
| 54 | } |
| 55 | } |
| 56 | } |
| 57 | |
| 58 | /** |
| 59 | * 3) get the addresses. |
| 60 | */ |
| 61 | $url_replytoall_ar = $header->getAddr_a(array('to','cc'), $excl_ar); |
| 62 | |
| 63 | /** |
| 64 | * 4) generate the string. |
| 65 | */ |
| 66 | $url_replytoallcc = ''; |
| 67 | foreach( $url_replytoall_ar as $email => $personal) { |
| 68 | if ($personal) { |
| 69 | $url_replytoallcc .= ", \"$personal\" <$email>"; |
| 70 | } else { |
| 71 | $url_replytoallcc .= ', '. $email; |
| 72 | } |
| 73 | } |
| 74 | $url_replytoallcc = substr($url_replytoallcc,2); |
| 75 | return $url_replytoallcc; |
| 76 | } |
| 77 | |
| 78 | function getforwardHeader($orig_header) { |
| 79 | $bodyTop = '-------- ' . _("Original Message") . " --------\n" . |
| 80 | _("Subject") . ': ' . $orig_header->subject . "\n" . |
| 81 | _("From") . ': ' . $orig_header->from->getAddress() . "\n" . |
| 82 | _("Date") . ': ' . |
| 83 | getLongDateString( $orig_header->date ). "\n" . |
| 84 | _("To") . ': ' . $orig_header->to[0]->getAddress() . "\n"; |
| 85 | if (count($orig_header->to) > 1) { |
| 86 | for ($x=1; $x < count($orig_header->to); $x++) { |
| 87 | $bodyTop .= ' ' . $orig_header->to[$x]->getAddress() . "\n"; |
| 88 | } |
| 89 | } |
| 90 | if ($orig_header->cc != array() && $orig_header->cc !='') { |
| 91 | $bodyTop .= _("Cc") . ': ' . $orig_header->cc[0]->getAddress() . "\n"; |
| 92 | if (count($orig_header->cc) > 1) { |
| 93 | for ($x = 1; $x < count($orig_header->cc); $x++) { |
| 94 | $bodyTop .= ' ' . $orig_header->cc[$x]->getAddress() . "\n"; |
| 95 | } |
| 96 | } |
| 97 | } |
| 98 | $bodyTop .= "\n"; |
| 99 | return $bodyTop; |
| 100 | } |
| 101 | /* ----------------------------------------------------------------------- */ |
| 102 | |
| 103 | if (!isset($attachments)) { |
| 104 | $attachments = array(); |
| 105 | session_register('attachments'); |
| 106 | } |
| 107 | |
| 108 | if (!isset($composesession)) { |
| 109 | $composesession = 0; |
| 110 | session_register('composesession'); |
| 111 | } |
| 112 | |
| 113 | if (!isset($session) || (isset($newmessage) && $newmessage)) { |
| 114 | $session = "$composesession" +1; |
| 115 | $composesession = $session; |
| 116 | } |
| 117 | |
| 118 | if (!isset($mailbox) || $mailbox == '' || ($mailbox == 'None')) { |
| 119 | $mailbox = 'INBOX'; |
| 120 | } |
| 121 | |
| 122 | if (isset($draft)) { |
| 123 | include_once ('../src/draft_actions.php'); |
| 124 | if (! isset($reply_id)) { |
| 125 | $reply_id = 0; |
| 126 | } |
| 127 | if (! isset($MDN)) { |
| 128 | $MDN = 'False'; |
| 129 | } |
| 130 | if (! isset($mailprio)) { |
| 131 | $mailprio = ''; |
| 132 | } |
| 133 | if (!saveMessageAsDraft($send_to, $send_to_cc, $send_to_bcc, $subject, $body, $reply_id, $mailprio, $session)) { |
| 134 | showInputForm($session); |
| 135 | exit(); |
| 136 | } else { |
| 137 | $draft_message = _("Draft Email Saved"); |
| 138 | /* If this is a resumed draft, then delete the original */ |
| 139 | if(isset($delete_draft)) { |
| 140 | Header("Location: delete_message.php?mailbox=" . urlencode($draft_folder) . |
| 141 | "&message=$delete_draft&sort=$sort&startMessage=1&saved_draft=yes"); |
| 142 | exit(); |
| 143 | } |
| 144 | else { |
| 145 | if ($compose_new_win == '1') { |
| 146 | Header("Location: compose.php?saved_draft=yes&session=$composesession"); |
| 147 | exit(); |
| 148 | } |
| 149 | else { |
| 150 | Header("Location: right_main.php?mailbox=$draft_folder&sort=$sort". |
| 151 | "&startMessage=1¬e=".urlencode($draft_message)); |
| 152 | exit(); |
| 153 | } |
| 154 | } |
| 155 | } |
| 156 | } |
| 157 | |
| 158 | if (isset($send)) { |
| 159 | if (isset($HTTP_POST_FILES['attachfile']) && |
| 160 | $HTTP_POST_FILES['attachfile']['tmp_name'] && |
| 161 | $HTTP_POST_FILES['attachfile']['tmp_name'] != 'none') { |
| 162 | $AttachFailure = saveAttachedFiles($session); |
| 163 | } |
| 164 | if (checkInput(false) && !isset($AttachFailure)) { |
| 165 | $urlMailbox = urlencode (trim($mailbox)); |
| 166 | if (! isset($reply_id)) { |
| 167 | $reply_id = 0; |
| 168 | } |
| 169 | /* |
| 170 | * Set $default_charset to correspond with the user's selection |
| 171 | * of language interface. |
| 172 | */ |
| 173 | set_my_charset(); |
| 174 | |
| 175 | /* |
| 176 | * This is to change all newlines to \n |
| 177 | * We'll change them to \r\n later (in the sendMessage function) |
| 178 | */ |
| 179 | $body = str_replace("\r\n", "\n", $body); |
| 180 | $body = str_replace("\r", "\n", $body); |
| 181 | |
| 182 | /* |
| 183 | * Rewrap $body so that no line is bigger than $editor_size |
| 184 | * This should only really kick in the sqWordWrap function |
| 185 | * if the browser doesn't support "VIRTUAL" as the wrap type. |
| 186 | */ |
| 187 | $body = explode("\n", $body); |
| 188 | $newBody = ''; |
| 189 | foreach ($body as $line) { |
| 190 | if( $line <> '-- ' ) { |
| 191 | $line = rtrim($line); |
| 192 | } |
| 193 | if (strlen($line) <= $editor_size + 1) { |
| 194 | $newBody .= $line . "\n"; |
| 195 | } else { |
| 196 | sqWordWrap($line, $editor_size); |
| 197 | $newBody .= $line . "\n"; |
| 198 | } |
| 199 | } |
| 200 | $body = $newBody; |
| 201 | |
| 202 | do_hook('compose_send'); |
| 203 | |
| 204 | $MDN = False; // we are not sending a mdn response |
| 205 | if (! isset($mailprio)) { |
| 206 | $Result = sendMessage($send_to, $send_to_cc, $send_to_bcc, |
| 207 | $subject, $body, $reply_id, $MDN, '', $session); |
| 208 | } else { |
| 209 | $Result = sendMessage($send_to, $send_to_cc, $send_to_bcc, |
| 210 | $subject, $body, $reply_id, $MDN, $mailprio, $session); |
| 211 | } |
| 212 | if (! $Result) { |
| 213 | showInputForm($session); |
| 214 | exit(); |
| 215 | } |
| 216 | if ( isset($delete_draft)) { |
| 217 | Header("Location: delete_message.php?mailbox=" . urlencode( $draft_folder ). |
| 218 | "&message=$delete_draft&sort=$sort&startMessage=1&mail_sent=yes"); |
| 219 | exit(); |
| 220 | } |
| 221 | if ($compose_new_win == '1') { |
| 222 | Header("Location: compose.php?mail_sent=yes"); |
| 223 | } |
| 224 | else { |
| 225 | Header("Location: right_main.php?mailbox=$urlMailbox&sort=$sort". |
| 226 | "&startMessage=1"); |
| 227 | } |
| 228 | } else { |
| 229 | /* |
| 230 | *$imapConnection = sqimap_login($username, $key, $imapServerAddress, |
| 231 | * $imapPort, 0); |
| 232 | */ |
| 233 | if ($compose_new_win == '1') { |
| 234 | compose_Header($color, $mailbox); |
| 235 | } |
| 236 | else { |
| 237 | displayPageHeader($color, $mailbox); |
| 238 | } |
| 239 | if (isset($AttachFailure)) { |
| 240 | plain_error_message(_("Could not move/copy file. File not attached"), |
| 241 | $color); |
| 242 | } |
| 243 | checkInput(true); |
| 244 | showInputForm($session); |
| 245 | /* sqimap_logout($imapConnection); */ |
| 246 | } |
| 247 | } elseif (isset($html_addr_search_done)) { |
| 248 | if ($compose_new_win == '1') { |
| 249 | compose_Header($color, $mailbox); |
| 250 | } |
| 251 | else { |
| 252 | displayPageHeader($color, $mailbox); |
| 253 | } |
| 254 | |
| 255 | if (isset($send_to_search) && is_array($send_to_search)) { |
| 256 | foreach ($send_to_search as $k => $v) { |
| 257 | if (substr($k, 0, 1) == 'T') { |
| 258 | if ($send_to) { |
| 259 | $send_to .= ', '; |
| 260 | } |
| 261 | $send_to .= $v; |
| 262 | } |
| 263 | elseif (substr($k, 0, 1) == 'C') { |
| 264 | if ($send_to_cc) { |
| 265 | $send_to_cc .= ', '; |
| 266 | } |
| 267 | $send_to_cc .= $v; |
| 268 | } |
| 269 | elseif (substr($k, 0, 1) == 'B') { |
| 270 | if ($send_to_bcc) { |
| 271 | $send_to_bcc .= ', '; |
| 272 | } |
| 273 | $send_to_bcc .= $v; |
| 274 | } |
| 275 | } |
| 276 | } |
| 277 | showInputForm($session); |
| 278 | } elseif (isset($html_addr_search)) { |
| 279 | if (isset($HTTP_POST_FILES['attachfile']) && |
| 280 | $HTTP_POST_FILES['attachfile']['tmp_name'] && |
| 281 | $HTTP_POST_FILES['attachfile']['tmp_name'] != 'none') { |
| 282 | if (saveAttachedFiles($session)) { |
| 283 | plain_error_message(_("Could not move/copy file. File not attached"), $color); |
| 284 | } |
| 285 | } |
| 286 | /* |
| 287 | * I am using an include so as to elminiate an extra unnecessary |
| 288 | * click. If you can think of a better way, please implement it. |
| 289 | */ |
| 290 | include_once('./addrbook_search_html.php'); |
| 291 | } elseif (isset($attach)) { |
| 292 | if (saveAttachedFiles($session)) { |
| 293 | plain_error_message(_("Could not move/copy file. File not attached"), $color); |
| 294 | } |
| 295 | if ($compose_new_win == '1') { |
| 296 | compose_Header($color, $mailbox); |
| 297 | } |
| 298 | else { |
| 299 | displayPageHeader($color, $mailbox); |
| 300 | } |
| 301 | showInputForm($session); |
| 302 | } |
| 303 | elseif (isset($sigappend)) { |
| 304 | $idents = getPref($data_dir, $username, 'identities', 0); |
| 305 | if ($idents > 1) { |
| 306 | if ($identity == 'default') { |
| 307 | $no = 'g'; |
| 308 | } else { |
| 309 | $no = $identity; |
| 310 | } |
| 311 | $signature = getSig($data_dir, $username, $no); |
| 312 | } |
| 313 | $body .= "\n\n".($prefix_sig==true? "-- \n":'').$signature; |
| 314 | if ($compose_new_win == '1') { |
| 315 | compose_Header($color, $mailbox); |
| 316 | } else { |
| 317 | displayPageHeader($color, $mailbox); |
| 318 | } |
| 319 | showInputForm($session); |
| 320 | } elseif (isset($do_delete)) { |
| 321 | if ($compose_new_win == '1') { |
| 322 | compose_Header($color, $mailbox); |
| 323 | } |
| 324 | else { |
| 325 | displayPageHeader($color, $mailbox); |
| 326 | } |
| 327 | |
| 328 | $hashed_attachment_dir = getHashedDir($username, $attachment_dir); |
| 329 | if (isset($delete) && is_array($delete)) { |
| 330 | foreach($delete as $index) { |
| 331 | $attached_file = $hashed_attachment_dir . '/' |
| 332 | . $attachments[$index]['localfilename']; |
| 333 | unlink ($attached_file); |
| 334 | unset ($attachments[$index]); |
| 335 | } |
| 336 | } |
| 337 | |
| 338 | showInputForm($session); |
| 339 | |
| 340 | } elseif (isset($attachedmessages)) { |
| 341 | |
| 342 | /* |
| 343 | * This handles the case if we attache message |
| 344 | */ |
| 345 | $imapConnection = sqimap_login($username, $key, $imapServerAddress, |
| 346 | $imapPort, 0); |
| 347 | if ($compose_new_win == '1') { |
| 348 | compose_Header($color, $mailbox); |
| 349 | } |
| 350 | else { |
| 351 | displayPageHeader($color, $mailbox); |
| 352 | } |
| 353 | |
| 354 | $newmail = true; |
| 355 | |
| 356 | if (!isset($passed_ent_id)) $passed_ent_id = ''; |
| 357 | if (!isset($passed_id)) $passed_id = ''; |
| 358 | if (!isset($mailbox)) $mailbox = ''; |
| 359 | if (!isset($action)) $action = ''; |
| 360 | |
| 361 | $values = newMail($imapConnection,$mailbox,$passed_id,$passed_ent_id, $action, $session); |
| 362 | /* in case the origin is not read_body.php */ |
| 363 | if (isset($send_to)) { |
| 364 | $values['send_to'] = $send_to; |
| 365 | } |
| 366 | if (isset($send_to_cc)) { |
| 367 | $values['send_to_cc'] = $send_cc; |
| 368 | } |
| 369 | if (isset($send_to_bcc)) { |
| 370 | $values['send_to_bcc'] = $send_bcc; |
| 371 | } |
| 372 | |
| 373 | showInputForm($session, $values); |
| 374 | sqimap_logout($imapConnection); |
| 375 | |
| 376 | } else { |
| 377 | /* |
| 378 | * This handles the default case as well as the error case |
| 379 | * (they had the same code) --> if (isset($smtpErrors)) |
| 380 | */ |
| 381 | $imapConnection = sqimap_login($username, $key, $imapServerAddress, |
| 382 | $imapPort, 0); |
| 383 | if ($compose_new_win == '1') { |
| 384 | compose_Header($color, $mailbox); |
| 385 | } |
| 386 | else { |
| 387 | displayPageHeader($color, $mailbox); |
| 388 | } |
| 389 | |
| 390 | $newmail = true; |
| 391 | |
| 392 | if (!isset($passed_ent_id)) $passed_ent_id = ''; |
| 393 | if (!isset($passed_id)) $passed_id = ''; |
| 394 | if (!isset($mailbox)) $mailbox = ''; |
| 395 | if (!isset($action)) $action = ''; |
| 396 | |
| 397 | $values = newMail($imapConnection,$mailbox,$passed_id,$passed_ent_id, $action, $session); |
| 398 | |
| 399 | /* in case the origin is not read_body.php */ |
| 400 | if (isset($send_to)) { |
| 401 | $values['send_to'] = $send_to; |
| 402 | } |
| 403 | if (isset($send_to_cc)) { |
| 404 | $values['send_to_cc'] = $send_cc; |
| 405 | } |
| 406 | if (isset($send_to_bcc)) { |
| 407 | $values['send_to_bcc'] = $send_bcc; |
| 408 | } |
| 409 | showInputForm($session, $values); |
| 410 | sqimap_logout($imapConnection); |
| 411 | } |
| 412 | |
| 413 | exit(); |
| 414 | |
| 415 | /**************** Only function definitions go below *************/ |
| 416 | |
| 417 | |
| 418 | /* This function is used when not sending or adding attachments */ |
| 419 | function newMail ($imapConnection, $mailbox='', $passed_id='', $passed_ent_id='', $action='', $session='') { |
| 420 | global $editor_size, $default_use_priority, |
| 421 | $use_signature, $composesession, $data_dir, $username; |
| 422 | |
| 423 | $send_to = $send_to_cc = $send_to_bcc = $subject = $body = $identity = ''; |
| 424 | $mailprio = 3; |
| 425 | if ($passed_id) { |
| 426 | sqimap_mailbox_select($imapConnection, $mailbox); |
| 427 | $message = sqimap_get_message($imapConnection, $passed_id, $mailbox); |
| 428 | $body = ''; |
| 429 | if ($passed_ent_id) { |
| 430 | /* redefine the messsage in case of message/rfc822 */ |
| 431 | $message = $message->getEntity($passed_ent_id); |
| 432 | /* message is an entity which contains the envelope and type0=message |
| 433 | * and type1=rfc822. The actual entities are childs from |
| 434 | * $message->entities[0]. That's where the encoding and is located |
| 435 | */ |
| 436 | |
| 437 | $entities = $message->entities[0]->findDisplayEntity |
| 438 | (array(), $alt_order = array('text/plain')); |
| 439 | if (!count($entities)) { |
| 440 | $entities = $message->entities[0]->findDisplayEntity |
| 441 | (array(), $alt_order = array('text/plain','html/plain')); |
| 442 | } |
| 443 | $orig_header = $message->header; /* here is the envelope located */ |
| 444 | /* redefine the message for picking up the attachments */ |
| 445 | $message = $message->entities[0]; |
| 446 | |
| 447 | } else { |
| 448 | $entities = $message->findDisplayEntity (array(), $alt_order = array('text/plain')); |
| 449 | if (!count($entities)) { |
| 450 | $entities = $message->findDisplayEntity (array(), $alt_order = array('text/plain','html/plain')); |
| 451 | } |
| 452 | $orig_header = $message->header; |
| 453 | } |
| 454 | $encoding = $message->header->encoding; |
| 455 | $type0 = $message->type0; |
| 456 | $type1 = $message->type1; |
| 457 | |
| 458 | foreach ($entities as $ent) { |
| 459 | $bodypart = decodeBody( |
| 460 | mime_fetch_body($imapConnection, $passed_id, $ent), |
| 461 | $encoding); |
| 462 | if ($type1 == 'html') { |
| 463 | $bodypart = strip_tags($bodypart); |
| 464 | } |
| 465 | $body .= $bodypart; |
| 466 | } |
| 467 | if ($default_use_priority) { |
| 468 | $mailprio = substr($orig_header->priority,0,1); |
| 469 | } else { |
| 470 | $mailprio = ''; |
| 471 | } |
| 472 | ClearAttachments($session); |
| 473 | |
| 474 | $identity = ''; |
| 475 | $idents = getPref($data_dir, $username, 'identities'); |
| 476 | $from_o = $message->header->from; |
| 477 | if (is_object($from_o)) { |
| 478 | $orig_from = $from_o->getAddress(); |
| 479 | } else { |
| 480 | $orig_from = ''; |
| 481 | } |
| 482 | if (!empty($idents) && $idents > 1) { |
| 483 | for ($i = 1; $i < $idents; $i++) { |
| 484 | $enc_from_name = '"'. |
| 485 | getPref($data_dir, |
| 486 | $username, |
| 487 | 'full_name' . $i) . |
| 488 | '" <' . getPref($data_dir, $username, |
| 489 | 'email_address' . $i) . '>'; |
| 490 | if ($enc_from_name == $orig_from) { |
| 491 | $identity = $i; |
| 492 | break; |
| 493 | } |
| 494 | } |
| 495 | } |
| 496 | |
| 497 | switch ($action) { |
| 498 | case ('draft'): |
| 499 | $use_signature = FALSE; |
| 500 | $send_to = $orig_header->getAddr_s('to'); |
| 501 | $send_to_cc = $orig_header->getAddr_s('cc'); |
| 502 | $send_to_bcc = $orig_header->getAddr_s('bcc'); |
| 503 | $subject = $orig_header->subject; |
| 504 | |
| 505 | $body_ary = explode("\n", $body); |
| 506 | $cnt = count($body_ary) ; |
| 507 | $body = ''; |
| 508 | for ($i=0; $i < $cnt; $i++) { |
| 509 | if (!ereg("^[>\\s]*$", $body_ary[$i])) { |
| 510 | sqWordWrap($body_ary[$i], $editor_size ); |
| 511 | $body .= $body_ary[$i] . "\n"; |
| 512 | } |
| 513 | unset($body_ary[$i]); |
| 514 | } |
| 515 | sqUnWordWrap($body); |
| 516 | getAttachments($message, $session, $passed_id, $entities, $imapConnection); |
| 517 | break; |
| 518 | case ('edit_as_new'): |
| 519 | $send_to = $orig_header->getAddr_s('to'); |
| 520 | $send_to_cc = $orig_header->getAddr_s('cc'); |
| 521 | $send_to_bcc = $orig_header->getAddr_s('bcc'); |
| 522 | $subject = $orig_header->subject; |
| 523 | $mailprio = $orig_header->priority; |
| 524 | $orig_from = ''; |
| 525 | getAttachments($message, $session, $passed_id, $entities, $imapConnection); |
| 526 | sqUnWordWrap($body); |
| 527 | break; |
| 528 | case ('forward'): |
| 529 | $send_to = ''; |
| 530 | // $orig_from = $orig_header->from->getAddress(); |
| 531 | $subject = $orig_header->subject; |
| 532 | if ((substr(strtolower($subject), 0, 4) != 'fwd:') && |
| 533 | (substr(strtolower($subject), 0, 5) != '[fwd:') && |
| 534 | (substr(strtolower($subject), 0, 6) != '[ fwd:')) { |
| 535 | $subject = '[Fwd: ' . $subject . ']'; |
| 536 | } |
| 537 | $body = getforwardHeader($orig_header) . $body; |
| 538 | sqUnWordWrap($body); |
| 539 | getAttachments($message, $session, $passed_id, $entities, $imapConnection); |
| 540 | break; |
| 541 | case ('reply' || 'reply_all'): |
| 542 | $send_to = $orig_header->reply_to; |
| 543 | if ($send_to) { |
| 544 | $send_to = $send_to->getAddress(); |
| 545 | } else { |
| 546 | $send_to = $orig_header->from->getAddress(); |
| 547 | } |
| 548 | // $orig_from = $orig_header->from->getAddress(); |
| 549 | $subject = $orig_header->subject; |
| 550 | $subject = str_replace('"', "'", $subject); |
| 551 | $subject = trim($subject); |
| 552 | if (substr(strtolower($subject), 0, 3) != 're:') { |
| 553 | $subject = 'Re: ' . $subject; |
| 554 | } |
| 555 | if ($action == 'reply_all') { |
| 556 | $send_to_cc = replyAllString($orig_header); |
| 557 | } |
| 558 | /* this corrects some wrapping/quoting problems on replies */ |
| 559 | $rewrap_body = explode("\n", $body); |
| 560 | $body = getReplyCitation($orig_header->from->personal); |
| 561 | $cnt = count($rewrap_body); |
| 562 | for ($i=0;$i<$cnt;$i++) { |
| 563 | sqWordWrap($rewrap_body[$i], ($editor_size - 2)); |
| 564 | if (preg_match("/^(>+)/", $rewrap_body[$i], $matches)) { |
| 565 | $gt = $matches[1]; |
| 566 | $body .= '>' . str_replace("\n", "\n$gt ", $rewrap_body[$i]) ."\n"; |
| 567 | } else { |
| 568 | $body .= '> ' . $rewrap_body[$i] . "\n"; |
| 569 | } |
| 570 | unset($rewrap_body[$i]); |
| 571 | } |
| 572 | break; |
| 573 | default: |
| 574 | break; |
| 575 | } |
| 576 | } |
| 577 | $ret = array( |
| 578 | 'send_to' => $send_to, |
| 579 | 'send_to_cc' => $send_to_cc, |
| 580 | 'send_to_bcc' => $send_to_bcc, |
| 581 | 'subject' => $subject, |
| 582 | 'mailprio' => $mailprio, |
| 583 | 'body' => $body, |
| 584 | 'identity' => $identity |
| 585 | ); |
| 586 | |
| 587 | return ($ret); |
| 588 | } /* function newMail() */ |
| 589 | |
| 590 | |
| 591 | function getAttachments($message, $session, $passed_id, $entities, $imapConnection) { |
| 592 | global $attachments, $attachment_dir, $username; |
| 593 | |
| 594 | $hashed_attachment_dir = getHashedDir($username, $attachment_dir); |
| 595 | if (!count($message->entities) || |
| 596 | ($message->type0 == 'message' && $message->type1 == 'rfc822')) { |
| 597 | if ( !in_array($message->entity_id, $entities) && $message->entity_id) { |
| 598 | if ($message->type0 == 'message' && $message->type1 == 'rfc822') { |
| 599 | $filename = decodeHeader($message->header->subject.'.eml'); |
| 600 | if ($filename == "") { |
| 601 | $filename = "untitled-".$message->entity_id.'.eml'; |
| 602 | } |
| 603 | } else { |
| 604 | $filename = decodeHeader($message->header->filename); |
| 605 | if ($filename == "") { |
| 606 | $filename = "untitled-".$message->entity_id; |
| 607 | } |
| 608 | } |
| 609 | $localfilename = GenerateRandomString(32, '', 7); |
| 610 | $full_localfilename = "$hashed_attachment_dir/$localfilename"; |
| 611 | while (file_exists($full_localfilename)) { |
| 612 | $localfilename = GenerateRandomString(32, '', 7); |
| 613 | $full_localfilename = "$hashed_attachment_dir/$localfilename"; |
| 614 | } |
| 615 | |
| 616 | $newAttachment = array(); |
| 617 | $newAttachment['localfilename'] = $localfilename; |
| 618 | $newAttachment['remotefilename'] = $filename; |
| 619 | $newAttachment['type'] = strtolower($message->type0 . |
| 620 | '/' . $message->type1); |
| 621 | $newAttachment['id'] = strtolower($message->header->id); |
| 622 | $newAttachment['session'] = $session; |
| 623 | |
| 624 | /* Write Attachment to file */ |
| 625 | $fp = fopen ("$hashed_attachment_dir/$localfilename", 'w'); |
| 626 | fputs($fp, decodeBody(mime_fetch_body($imapConnection, |
| 627 | $passed_id, $message->entity_id), |
| 628 | $message->header->encoding)); |
| 629 | fclose ($fp); |
| 630 | |
| 631 | $attachments[] = $newAttachment; |
| 632 | } |
| 633 | } else { |
| 634 | for ($i = 0; $i < count($message->entities); $i++) { |
| 635 | getAttachments($message->entities[$i], $session, $passed_id, $entities, $imapConnection); |
| 636 | } |
| 637 | } |
| 638 | return; |
| 639 | } |
| 640 | |
| 641 | function showInputForm ($session, $values=false) { |
| 642 | global $send_to, $send_to_cc, $body, |
| 643 | $passed_body, $color, $use_signature, $signature, $prefix_sig, |
| 644 | $editor_size, $attachments, $subject, $newmail, |
| 645 | $use_javascript_addr_book, $send_to_bcc, $passed_id, $mailbox, |
| 646 | $from_htmladdr_search, $location_of_buttons, $attachment_dir, |
| 647 | $username, $data_dir, $identity, $draft_id, $delete_draft, |
| 648 | $mailprio, $default_use_mdn, $mdn_user_support, $compose_new_win, |
| 649 | $saved_draft, $mail_sent, $sig_first, $edit_as_new, $action; |
| 650 | |
| 651 | $subject = decodeHeader($subject, false); |
| 652 | if ($values) { |
| 653 | $send_to = $values['send_to']; |
| 654 | $send_to_cc = $values['send_to_cc']; |
| 655 | $send_to_bcc = $values['send_to_bcc']; |
| 656 | $subject = $values['subject']; |
| 657 | $mailprio = $values['mailprio']; |
| 658 | $body = $values['body']; |
| 659 | $identity = $values['identity']; |
| 660 | } |
| 661 | |
| 662 | if ($use_javascript_addr_book) { |
| 663 | echo "\n". '<SCRIPT LANGUAGE=JavaScript><!--' . "\n" . |
| 664 | 'function open_abook() { ' . "\n" . |
| 665 | ' var nwin = window.open("addrbook_popup.php","abookpopup",' . |
| 666 | '"width=670,height=300,resizable=yes,scrollbars=yes");' . "\n" . |
| 667 | ' if((!nwin.opener) && (document.windows != null))' . "\n" . |
| 668 | ' nwin.opener = document.windows;' . "\n" . |
| 669 | "}\n" . |
| 670 | '// --></SCRIPT>' . "\n\n"; |
| 671 | } |
| 672 | |
| 673 | echo "\n" . '<FORM name=compose action="compose.php" METHOD=POST ' . |
| 674 | 'ENCTYPE="multipart/form-data"'; |
| 675 | do_hook("compose_form"); |
| 676 | |
| 677 | |
| 678 | echo ">\n"; |
| 679 | |
| 680 | if ($action == 'draft') { |
| 681 | echo '<input type="hidden" name="delete_draft" value="' . $passed_id . "\">\n"; |
| 682 | } |
| 683 | if (isset($delete_draft)) { |
| 684 | echo '<input type="hidden" name="delete_draft" value="' . $delete_draft. "\">\n"; |
| 685 | } |
| 686 | if (isset($session)) { |
| 687 | echo '<input type="hidden" name="session" value="' . "$session" . "\">\n"; |
| 688 | } |
| 689 | |
| 690 | if ($saved_draft == 'yes') { |
| 691 | echo '<BR><CENTER><B>'. _("Draft Saved").'</CENTER></B>'; |
| 692 | } |
| 693 | if ($mail_sent == 'yes') { |
| 694 | echo '<BR><CENTER><B>'. _("Your Message has been sent").'</CENTER></B>'; |
| 695 | } |
| 696 | echo '<TABLE WIDTH="100%" ALIGN=center CELLSPACING=0 BORDER=0>' . "\n"; |
| 697 | if ($compose_new_win == '1') { |
| 698 | echo '<TABLE ALIGN=CENTER BGCOLOR="'.$color[0].'" WIDTH="100%" BORDER=0>'."\n"; |
| 699 | echo ' <TR><TD></TD><TD ALIGN="RIGHT"><INPUT TYPE="BUTTON" NAME="Close" onClick="return self.close()" VALUE='._("Close").'></TD></TR>'."\n"; |
| 700 | } |
| 701 | if ($location_of_buttons == 'top') { |
| 702 | showComposeButtonRow(); |
| 703 | } |
| 704 | |
| 705 | $idents = getPref($data_dir, $username, 'identities', 0); |
| 706 | if ($idents > 1) { |
| 707 | echo ' <TR>' . "\n" . |
| 708 | ' <TD BGCOLOR="' . $color[4] . '" WIDTH="10%" ALIGN=RIGHT>' . |
| 709 | "\n" . |
| 710 | _("From:") . |
| 711 | ' </TD><TD BGCOLOR="' . $color[4] . '" WIDTH="90%">' . "\n" . |
| 712 | '<select name=identity>' . "\n" . |
| 713 | '<option value=default>' . |
| 714 | htmlspecialchars(getPref($data_dir, $username, 'full_name')); |
| 715 | $em = getPref($data_dir, $username, 'email_address'); |
| 716 | if ($em != '') { |
| 717 | echo htmlspecialchars(' <' . $em . '>') . "\n"; |
| 718 | } |
| 719 | for ($i = 1; $i < $idents; $i ++) { |
| 720 | echo '<option value="' . $i . '"'; |
| 721 | if (isset($identity) && $identity == $i) { |
| 722 | echo ' SELECTED'; |
| 723 | } |
| 724 | echo '>' . htmlspecialchars(getPref($data_dir, $username, |
| 725 | 'full_name' . $i)); |
| 726 | $em = getPref($data_dir, $username, 'email_address' . $i); |
| 727 | if ($em != '') { |
| 728 | echo htmlspecialchars(' <' . $em . '>') . "\n"; |
| 729 | } |
| 730 | echo '</option>'; |
| 731 | } |
| 732 | echo '</select>' . "\n" . |
| 733 | ' </TD>' . "\n" . |
| 734 | ' </TR>' . "\n"; |
| 735 | } |
| 736 | echo ' <TR>' . "\n" . |
| 737 | ' <TD BGCOLOR="' . $color[4] . '" WIDTH="10%" ALIGN=RIGHT>' . "\n" . |
| 738 | _("To:") . |
| 739 | ' </TD><TD BGCOLOR="' . $color[4] . '" WIDTH="90%">' . "\n" . |
| 740 | ' <INPUT TYPE=text NAME="send_to" VALUE="' . |
| 741 | htmlspecialchars($send_to) . '" SIZE=60><BR>' . "\n" . |
| 742 | ' </TD>' . "\n" . |
| 743 | ' </TR>' . "\n" . |
| 744 | ' <TR>' . "\n" . |
| 745 | ' <TD BGCOLOR="' . $color[4] . '" ALIGN=RIGHT>' . "\n" . |
| 746 | _("CC:") . |
| 747 | ' </TD><TD BGCOLOR="' . $color[4] . '" ALIGN=LEFT>' . "\n" . |
| 748 | ' <INPUT TYPE=text NAME="send_to_cc" SIZE=60 VALUE="' . |
| 749 | htmlspecialchars($send_to_cc) . '"><BR>' . "\n" . |
| 750 | ' </TD>' . "\n" . |
| 751 | ' </TR>' . "\n" . |
| 752 | ' <TR>' . "\n" . |
| 753 | ' <TD BGCOLOR="' . $color[4] . '" ALIGN=RIGHT>' . "\n" . |
| 754 | _("BCC:") . |
| 755 | ' </TD><TD BGCOLOR="' . $color[4] . '" ALIGN=LEFT>' . "\n" . |
| 756 | ' <INPUT TYPE=text NAME="send_to_bcc" VALUE="' . |
| 757 | htmlspecialchars($send_to_bcc) . '" SIZE=60><BR>' . "\n" . |
| 758 | '</TD></TR>' . "\n" . |
| 759 | ' <TR>' . "\n" . |
| 760 | ' <TD BGCOLOR="' . $color[4] . '" ALIGN=RIGHT>' . "\n" . |
| 761 | _("Subject:") . |
| 762 | ' </TD><TD BGCOLOR="' . $color[4] . '" ALIGN=LEFT>' . "\n"; |
| 763 | echo ' <INPUT TYPE=text NAME=subject SIZE=60 VALUE="' . |
| 764 | htmlspecialchars($subject) . '">'; |
| 765 | echo '</td></tr>' . "\n\n"; |
| 766 | |
| 767 | if ($location_of_buttons == 'between') { |
| 768 | showComposeButtonRow(); |
| 769 | } |
| 770 | if ($compose_new_win == '1') { |
| 771 | echo ' <TR>' . "\n" . |
| 772 | ' <TD BGCOLOR="' . $color[0] . '" COLSPAN=2 ALIGN=CENTER>' . "\n" . |
| 773 | ' <TEXTAREA NAME=body ROWS=20 COLS="' . |
| 774 | $editor_size . '" WRAP="VIRTUAL">'; |
| 775 | } |
| 776 | else { |
| 777 | echo ' <TR>' . "\n" . |
| 778 | ' <TD BGCOLOR="' . $color[4] . '" COLSPAN=2>' . "\n" . |
| 779 | ' <TEXTAREA NAME=body ROWS=20 COLS="' . |
| 780 | $editor_size . '" WRAP="VIRTUAL">'; |
| 781 | } |
| 782 | if ($use_signature == true && $newmail == true && !isset($from_htmladdr_search)) { |
| 783 | if ($sig_first == '1') { |
| 784 | echo "\n\n".($prefix_sig==true? "-- \n":'').htmlspecialchars($signature); |
| 785 | echo "\n\n".htmlspecialchars($body); |
| 786 | } |
| 787 | else { |
| 788 | echo "\n\n".htmlspecialchars($body); |
| 789 | echo "\n\n".($prefix_sig==true? "-- \n":'').htmlspecialchars($signature); |
| 790 | } |
| 791 | } |
| 792 | else { |
| 793 | echo htmlspecialchars($body); |
| 794 | } |
| 795 | echo '</TEXTAREA><BR>' . "\n" . |
| 796 | ' </TD>' . "\n" . |
| 797 | ' </TR>' . "\n"; |
| 798 | |
| 799 | if ($location_of_buttons == 'bottom') { |
| 800 | showComposeButtonRow(); |
| 801 | } else { |
| 802 | echo ' <TR><TD COLSPAN=2 ALIGN=LEFT>'; |
| 803 | echo ' <INPUT TYPE=SUBMIT NAME=send VALUE="' . _("Send") . '"></TD></TR>' . "\n"; |
| 804 | } |
| 805 | |
| 806 | /* This code is for attachments */ |
| 807 | echo ' <TR>' . "\n" . |
| 808 | ' <TD VALIGN=MIDDLE ALIGN=RIGHT>' . "\n" . |
| 809 | _("Attach:") . |
| 810 | ' </TD>' . "\n" . |
| 811 | ' <TD VALIGN=MIDDLE ALIGN=LEFT>' . "\n" . |
| 812 | ' <INPUT NAME="attachfile" SIZE=48 TYPE="file">' . "\n" . |
| 813 | ' <input type="submit" name="attach"' . |
| 814 | ' value="' . _("Add") .'">' . "\n" . |
| 815 | ' </TD>' . "\n" . |
| 816 | ' </TR>' . "\n"; |
| 817 | |
| 818 | if (count($attachments)) { |
| 819 | $hashed_attachment_dir = getHashedDir($username, $attachment_dir); |
| 820 | echo '<tr><td bgcolor="' . $color[0] . '" align=right>' . "\n" . |
| 821 | ' ' . |
| 822 | '</td><td align=left bgcolor="' . $color[0] . '">'; |
| 823 | foreach ($attachments as $key => $info) { |
| 824 | if ($info['session'] == $session) { |
| 825 | $attached_file = "$hashed_attachment_dir/$info[localfilename]"; |
| 826 | echo '<input type="checkbox" name="delete[]" value="' . $key . "\">\n" . |
| 827 | $info['remotefilename'] . ' - ' . $info['type'] . ' (' . |
| 828 | show_readable_size( filesize( $attached_file ) ) . ")<br>\n"; |
| 829 | } |
| 830 | } |
| 831 | |
| 832 | echo '<input type="submit" name="do_delete" value="' . |
| 833 | _("Delete selected attachments") . "\">\n" . |
| 834 | '</td></tr>'; |
| 835 | } |
| 836 | /* End of attachment code */ |
| 837 | if ($compose_new_win == '1') { |
| 838 | echo '</TABLE>'."\n"; |
| 839 | } |
| 840 | echo '</TABLE>' . "\n"; |
| 841 | if ($action = 'reply' || $action = 'reply_all') { |
| 842 | echo '<input type=hidden name=reply_id value=' . $passed_id . ">\n"; |
| 843 | } |
| 844 | echo '<INPUT TYPE=hidden NAME=mailbox VALUE="' . htmlspecialchars($mailbox) . |
| 845 | "\">\n" . |
| 846 | '</FORM>'; |
| 847 | do_hook('compose_bottom'); |
| 848 | echo '</BODY></HTML>' . "\n"; |
| 849 | } |
| 850 | |
| 851 | |
| 852 | function showComposeButtonRow() { |
| 853 | global $use_javascript_addr_book, $save_as_draft, |
| 854 | $default_use_priority, $mailprio, $default_use_mdn, |
| 855 | $request_mdn, $request_dr, |
| 856 | $data_dir, $username; |
| 857 | |
| 858 | echo " <TR><TD>\n</TD><TD>\n"; |
| 859 | if ($default_use_priority) { |
| 860 | if(!isset($mailprio)) { |
| 861 | $mailprio = "3"; |
| 862 | } |
| 863 | echo _("Priority") .': <select name="mailprio">'. |
| 864 | '<option value="1"'.($mailprio=='1'?' selected':'').'>'. _("High") .'</option>'. |
| 865 | '<option value="3"'.($mailprio=='3'?' selected':'').'>'. _("Normal") .'</option>'. |
| 866 | '<option value="5"'.($mailprio=='5'?' selected':'').'>'. _("Low").'</option>'. |
| 867 | "</select>"; |
| 868 | } |
| 869 | $mdn_user_support=getPref($data_dir, $username, 'mdn_user_support',$default_use_mdn); |
| 870 | if ($default_use_mdn) { |
| 871 | if ($mdn_user_support) { |
| 872 | echo "\n\t". _("Receipt") .': '. |
| 873 | '<input type="checkbox" name="request_mdn" value=1'. |
| 874 | ($request_mdn=='1'?' checked':'') .'>'. _("On read"). |
| 875 | ' <input type="checkbox" name="request_dr" value=1'. |
| 876 | ($request_dr=='1'?' checked':'') .'>'. _("On Delivery"); |
| 877 | } |
| 878 | } |
| 879 | |
| 880 | echo " </td></tr>\n <TR><td>\n </td><td>\n"; |
| 881 | echo "\n <INPUT TYPE=SUBMIT NAME=\"sigappend\" VALUE=\"". _("Signature") . "\">\n"; |
| 882 | if ($use_javascript_addr_book) { |
| 883 | echo " <SCRIPT LANGUAGE=JavaScript><!--\n document.write(\"". |
| 884 | " <input type=button value=\\\""._("Addresses"). |
| 885 | "\\\" onclick='javascript:open_abook();'>\");". |
| 886 | " // --></SCRIPT><NOSCRIPT>\n". |
| 887 | " <input type=submit name=\"html_addr_search\" value=\"". |
| 888 | _("Addresses")."\">". |
| 889 | " </NOSCRIPT>\n"; |
| 890 | } else { |
| 891 | echo " <input type=submit name=\"html_addr_search\" value=\"". |
| 892 | _("Addresses")."\">"; |
| 893 | } |
| 894 | echo "\n <INPUT TYPE=SUBMIT NAME=send VALUE=\"". _("Send") . "\">\n"; |
| 895 | |
| 896 | if ($save_as_draft) { |
| 897 | echo '<input type="submit" name ="draft" value="' . _("Save Draft") . "\">\n"; |
| 898 | } |
| 899 | |
| 900 | do_hook('compose_button_row'); |
| 901 | |
| 902 | echo " </TD></TR>\n\n"; |
| 903 | } |
| 904 | |
| 905 | function checkInput ($show) { |
| 906 | /* |
| 907 | * I implemented the $show variable because the error messages |
| 908 | * were getting sent before the page header. So, I check once |
| 909 | * using $show=false, and then when i'm ready to display the error |
| 910 | * message, show=true |
| 911 | */ |
| 912 | global $body, $send_to, $subject, $color; |
| 913 | |
| 914 | if ($send_to == "") { |
| 915 | if ($show) { |
| 916 | plain_error_message(_("You have not filled in the \"To:\" field."), $color); |
| 917 | } |
| 918 | return false; |
| 919 | } |
| 920 | return true; |
| 921 | } /* function checkInput() */ |
| 922 | |
| 923 | |
| 924 | /* True if FAILURE */ |
| 925 | function saveAttachedFiles($session) { |
| 926 | global $HTTP_POST_FILES, $attachment_dir, $attachments, $username; |
| 927 | |
| 928 | $hashed_attachment_dir = getHashedDir($username, $attachment_dir); |
| 929 | $localfilename = GenerateRandomString(32, '', 7); |
| 930 | $full_localfilename = "$hashed_attachment_dir/$localfilename"; |
| 931 | while (file_exists($full_localfilename)) { |
| 932 | $localfilename = GenerateRandomString(32, '', 7); |
| 933 | $full_localfilename = "$hashed_attachment_dir/$localfilename"; |
| 934 | } |
| 935 | |
| 936 | if (!@rename($HTTP_POST_FILES['attachfile']['tmp_name'], $full_localfilename)) { |
| 937 | if (function_exists("move_uploaded_file")) { |
| 938 | if (!@move_uploaded_file($HTTP_POST_FILES['attachfile']['tmp_name'], $full_localfilename)) { |
| 939 | return true; |
| 940 | } |
| 941 | } else { |
| 942 | |
| 943 | if (!@copy($HTTP_POST_FILES['attachfile']['tmp_name'], $full_localfilename)) { |
| 944 | return true; |
| 945 | } |
| 946 | } |
| 947 | |
| 948 | } |
| 949 | |
| 950 | |
| 951 | |
| 952 | $newAttachment['localfilename'] = $localfilename; |
| 953 | $newAttachment['remotefilename'] = $HTTP_POST_FILES['attachfile']['name']; |
| 954 | $newAttachment['type'] = strtolower($HTTP_POST_FILES['attachfile']['type']); |
| 955 | $newAttachment['session'] = $session; |
| 956 | |
| 957 | if ($newAttachment['type'] == "") { |
| 958 | $newAttachment['type'] = 'application/octet-stream'; |
| 959 | } |
| 960 | |
| 961 | $attachments[] = $newAttachment; |
| 962 | } |
| 963 | |
| 964 | |
| 965 | function ClearAttachments($session) |
| 966 | { |
| 967 | global $username, $attachments, $attachment_dir; |
| 968 | $hashed_attachment_dir = getHashedDir($username, $attachment_dir); |
| 969 | |
| 970 | $rem_attachments = array(); |
| 971 | if (is_array($attachments)) { |
| 972 | foreach ($attachments as $info) { |
| 973 | if ($info['session'] == $session) { |
| 974 | $attached_file = "$hashed_attachment_dir/$info[localfilename]"; |
| 975 | if (file_exists($attached_file)) { |
| 976 | unlink($attached_file); |
| 977 | } |
| 978 | } |
| 979 | else { |
| 980 | $rem_attachments[] = $info; |
| 981 | } |
| 982 | } |
| 983 | } |
| 984 | $attachments = $rem_attachments; |
| 985 | } |
| 986 | |
| 987 | |
| 988 | function getReplyCitation($orig_from) |
| 989 | { |
| 990 | global $reply_citation_style, $reply_citation_start, $reply_citation_end; |
| 991 | |
| 992 | /* First, return an empty string when no citation style selected. */ |
| 993 | if (($reply_citation_style == '') || ($reply_citation_style == 'none')) { |
| 994 | return ''; |
| 995 | } |
| 996 | |
| 997 | /* Make sure our final value isn't an empty string. */ |
| 998 | if ($orig_from == '') { |
| 999 | return ''; |
| 1000 | } |
| 1001 | |
| 1002 | /* Otherwise, try to select the desired citation style. */ |
| 1003 | switch ($reply_citation_style) { |
| 1004 | case 'author_said': |
| 1005 | $start = ''; |
| 1006 | $end = ' ' . _("said") . ':'; |
| 1007 | break; |
| 1008 | case 'quote_who': |
| 1009 | $start = '<' . _("quote") . ' ' . _("who") . '="'; |
| 1010 | $end = '">'; |
| 1011 | break; |
| 1012 | case 'user-defined': |
| 1013 | $start = $reply_citation_start . ' '; |
| 1014 | $end = $reply_citation_end; |
| 1015 | break; |
| 1016 | default: |
| 1017 | return ''; |
| 1018 | } |
| 1019 | |
| 1020 | /* Build and return the citation string. */ |
| 1021 | return ($start . $orig_from . $end . "\n"); |
| 1022 | } |
| 1023 | |
| 1024 | ?> |