Move always included vars to init.php because it is confusing when not logged in.
[squirrelmail.git] / src / read_body.php
index 882e3f7dc5bc70eab3c56d745705ff5e8e794dcf..b04812b0b355c3b144a18601b6902dfda46332fe 100644 (file)
@@ -294,8 +294,16 @@ function SendMDN ( $mailbox, $passed_id, $sender, $message, $imapConnection) {
 
     if ($useSendmail) {
         require_once(SM_PATH . 'class/deliver/Deliver_SendMail.class.php');
-        global $sendmail_path;
-        $deliver = new Deliver_SendMail();
+        global $sendmail_path, $sendmail_args;
+        // Check for outdated configuration
+        if (!isset($sendmail_args)) {
+            if ($sendmail_path=='/var/qmail/bin/qmail-inject') {
+                $sendmail_args = '';
+            } else {
+                $sendmail_args = '-i -t';
+            }
+        }
+        $deliver = new Deliver_SendMail(array('sendmail_args'=>$sendmail_args));
         $stream = $deliver->initStream($composeMessage,$sendmail_path);
     } else {
         require_once(SM_PATH . 'class/deliver/Deliver_SMTP.class.php');
@@ -432,7 +440,11 @@ function formatEnvheader($aMailbox, $passed_id, $passed_ent_id, $message,
                     if (!(handleAsSent($mailbox) ||
                           $message->is_deleted ||
                           $passed_ent_id)) {
-                        $mdn_url = $PHP_SELF . '&sendreceipt=1';
+                        $mdn_url = $PHP_SELF;
+                        $mdn_url = set_url_var($PHP_SELF, 'mailbox', urlencode($mailbox));
+                        $mdn_url = set_url_var($PHP_SELF, 'passed_id', $passed_id);
+                        $mdn_url = set_url_var($PHP_SELF, 'passed_ent_id', $passed_ent_id);
+                        $mdn_url = set_url_var($PHP_SELF, 'sendreceipt', 1);
                         if ($FirstTimeSee && $javascript_on) {
                             $script  = '<script type="text/javascript">' . "\n";
                             $script .= '<!--'. "\n";
@@ -767,7 +779,7 @@ function formatToolbar($mailbox, $passed_id, $passed_ent_id, $message, $color) {
 
     /* Output the download and/or unsafe images link/-s, if any. */
     if ($download_and_unsafe_link) {
-       echo $download_and_unsafe_link;
+        echo $download_and_unsafe_link;
     }
 
     do_hook("read_body_header_right");
@@ -804,11 +816,7 @@ function getButton($type, $name, $value, $js = '', $enabled = TRUE) {
 
 /* get the globals we may need */
 
-sqgetGlobalVar('key',       $key,           SQ_COOKIE);
-sqgetGlobalVar('username',  $username,      SQ_SESSION);
-sqgetGlobalVar('onetimepad',$onetimepad,    SQ_SESSION);
 sqgetGlobalVar('delimiter', $delimiter,     SQ_SESSION);
-sqgetGlobalVar('base_uri',  $base_uri,      SQ_SESSION);
 sqgetGlobalVar('lastTargetMailbox', $lastTargetMailbox, SQ_SESSION);
 if (!sqgetGlobalVar('messages', $messages, SQ_SESSION) ) {
     $messages = array();
@@ -884,7 +892,7 @@ sqgetGlobalVar('mailbox_cache',$mailbox_cache,SQ_SESSION);
 /* end of get globals */
 global $sqimap_capabilities, $lastTargetMailbox;
 
-$imapConnection = sqimap_login($username, $key, $imapServerAddress, $imapPort, 0);
+$imapConnection = sqimap_login($username, false, $imapServerAddress, $imapPort, 0);
 $aMailbox = sqm_api_mailbox_select($imapConnection, $iAccount, $mailbox,array('setindex' => $what, 'offset' => $startMessage),array());
 
 
@@ -1041,7 +1049,6 @@ for ($i = 0; $i < $cnt; $i++) {
 $mailbox_cache[$iAccount.'_'.$aMailbox['NAME']] = $aMailbox;
 sqsession_register($mailbox_cache,'mailbox_cache');
 $_SESSION['mailbox_cache'] = $mailbox_cache;
-$oTemplate->display('footer.tpl');
 
 displayPageHeader($color, $mailbox,'','');
 formatMenuBar($aMailbox, $passed_id, $passed_ent_id, $message,false);
@@ -1109,5 +1116,5 @@ formatMenuBar($aMailbox, $passed_id, $passed_ent_id, $message, false, FALSE);
 
 do_hook('read_body_bottom');
 sqimap_logout($imapConnection);
-
+$oTemplate->display('footer.tpl');
 ?>