Replacing tabs with spaces, trimming white space at EOL and newline at EOF (PHP only)
[squirrelmail.git] / src / read_body.php
index 7b89b2bc61be7cb2776b176fcd5e76b91fb1b18e..74f4e96008221366fbf291aaebe35eabb28d1fb7 100644 (file)
@@ -3,7 +3,7 @@
 /**
  * read_body.php
  *
- * Copyright (c) 1999-2004 The SquirrelMail Project Team
+ * Copyright (c) 1999-2005 The SquirrelMail Project Team
  * Licensed under the GNU GPL. For full terms see the file COPYING.
  *
  * This file is used for reading the msgs array and displaying
@@ -91,7 +91,7 @@ function findPreviousMessage($uidset, $passed_id) {
  * @param int $passed_id
  */
 function printer_friendly_link($mailbox, $passed_id, $passed_ent_id) {
-    global $javascript_on, $color;
+    global $javascript_on;
 
     $params = '?passed_ent_id=' . urlencode($passed_ent_id) .
               '&mailbox=' . urlencode($mailbox) .
@@ -125,15 +125,13 @@ function ServerMDNSupport($aFlags) {
 }
 
 function SendMDN ( $mailbox, $passed_id, $sender, $message, $imapConnection) {
-    global $username, $attachment_dir,
-           $version, $attachments, $squirrelmail_language, $default_charset,
-           $languages, $useSendmail, $domain, $sent_folder,
-           $popuser, $data_dir, $username;
+    global $username, $attachment_dir, $popuser, $username, $color,
+           $version, $squirrelmail_language, $default_charset,
+           $languages, $useSendmail, $domain, $sent_folder;
 
     sqgetGlobalVar('SERVER_NAME', $SERVER_NAME, SQ_SERVER);
 
     $header = $message->rfc822_header;
-    $hashed_attachment_dir = getHashedDir($username, $attachment_dir);
 
     $rfc822_header = new Rfc822Header();
     $content_type  = new ContentType('multipart/report');
@@ -203,6 +201,8 @@ function SendMDN ( $mailbox, $passed_id, $sender, $message, $imapConnection) {
                 $special_encoding = '7bit';
             }
         }
+    } elseif (sq_is8bit($body)) {
+        $special_encoding = '8bit';
     }
     $part1 = new Message();
     $part1->setBody($body);
@@ -254,7 +254,7 @@ function SendMDN ( $mailbox, $passed_id, $sender, $message, $imapConnection) {
     } else {
         require_once(SM_PATH . 'class/deliver/Deliver_SMTP.class.php');
         $deliver = new Deliver_SMTP();
-        global $smtpServerAddress, $smtpPort, $smtp_auth_mech, $pop_before_smtp;
+        global $smtpServerAddress, $smtpPort, $pop_before_smtp;
         $authPop = (isset($pop_before_smtp) && $pop_before_smtp) ? true : false;
         get_smtp_user($user, $pass);
         $stream = $deliver->initStream($composeMessage,$domain,0,
@@ -368,7 +368,7 @@ function formatRecipientString($recipients, $item ) {
 
 function formatEnvheader($aMailbox, $passed_id, $passed_ent_id, $message,
                          $color, $FirstTimeSee) {
-    global $msn_user_support, $default_use_mdn, $default_use_priority,
+    global $default_use_mdn, $default_use_priority,
            $show_xmailer_default, $mdn_user_support, $PHP_SELF, $javascript_on,
            $squirrelmail_language;
 
@@ -461,7 +461,7 @@ function formatMenubar($aMailbox, $passed_id, $passed_ent_id, $message, $removed
     global $base_uri, $draft_folder, $where, $what, $color, $sort,
            $startMessage, $PHP_SELF, $save_as_draft,
            $enable_forward_as_attachment, $imapConnection, $lastTargetMailbox,
-           $data_dir, $username, $delete_prev_next_display,
+           $username, $delete_prev_next_display,
            $compose_new_win, $javascript_on;
 
     //FIXME cleanup argument list, use $aMailbox where possible
@@ -608,17 +608,20 @@ function formatMenubar($aMailbox, $passed_id, $passed_ent_id, $message, $removed
     $target = '';
     $on_click='';
     $method='method="post" ';
+    $onsubmit='';
     if ($compose_new_win == '1') {
         if ( $javascript_on ) {
           $on_click=' onclick="comp_in_new_form(\''.$comp_uri.'\', this, this.form)"';
           $comp_uri = 'javascript:void(0)';
           $method='method="get" ';
+          $onsubmit = 'onsubmit="return false" ';
         } else {
           $target = 'target="_blank"';
         }
     }
 
-    $menu_row .= "\n".'<form name="composeForm" action="'.$comp_uri.'" '.$method.$target.' style="display: inline">'."\n";
+    $menu_row .= "\n".'<form name="composeForm" action="'.$comp_uri.'" '
+              . $method.$target.$onsubmit.' style="display: inline">'."\n";
 
     // If Draft folder - create Resume link
     if (($mailbox == $draft_folder) && ($save_as_draft)) {
@@ -881,7 +884,7 @@ $cnt = count($ent_ar);
 for ($i = 0; $i < $cnt; $i++) {
    $messagebody .= formatBody($imapConnection, $message, $color, $wrap_at, $ent_ar[$i], $passed_id, $mailbox);
    if ($i != $cnt-1) {
-       $messagebody .= '<hr noshade size="1" />';
+       $messagebody .= '<hr style="height: 1px;" />';
    }
 }
 
@@ -957,4 +960,4 @@ sqimap_logout($imapConnection);
 $mailbox_cache[$aMailbox['NAME']] = $aMailbox;
 sqsession_register($mailbox_cache,'mailbox_cache');
 ?>
-</body></html>
+</body></html>
\ No newline at end of file