removing code that could be used with plugin in SM 1.4.x. After init
[squirrelmail.git] / src / read_body.php
index 77f4aafd26247ce1aff3ecc550af6df52f793d2c..410517bf5ea12aba8e0d42fe68d01171be27af0a 100644 (file)
  */
 
 /**
- * Path for SquirrelMail required files.
- * @ignore
+ * Include the SquirrelMail initialization file.
  */
-define('SM_PATH','../');
+require('../include/init.php');
 
 /* SquirrelMail required files. */
-include_once(SM_PATH . 'include/validate.php');
-//require_once(SM_PATH . 'functions/global.php');
+
+
 require_once(SM_PATH . 'functions/imap.php');
+require_once(SM_PATH . 'functions/imap_asearch.php'); // => move to mailbox_display
 require_once(SM_PATH . 'functions/mime.php');
 require_once(SM_PATH . 'functions/date.php');
 require_once(SM_PATH . 'functions/url_parser.php');
-require_once(SM_PATH . 'functions/html.php');
-//require_once(SM_PATH . 'functions/global.php');
 require_once(SM_PATH . 'functions/identity.php');
-include_once(SM_PATH . 'functions/arrays.php');
-include_once(SM_PATH . 'functions/mailbox_display.php');
+require_once(SM_PATH . 'functions/arrays.php');
+require_once(SM_PATH . 'functions/mailbox_display.php');
+require_once(SM_PATH . 'functions/forms.php');
+require_once(SM_PATH . 'functions/attachment_common.php');
 
 /**
  * Given an IMAP message id number, this will look it up in the cached
@@ -141,7 +141,7 @@ function view_as_html_link($mailbox, $passed_id, $passed_ent_id, $message) {
         }
     }
     if($has_html == true) {
-        $vars = array('passed_ent_id', 'show_more', 'show_more_cc', 'override_type0', 'override_type1', 'startMessage');
+        $vars = array('passed_ent_id', 'show_more', 'show_more_cc', 'override_type0', 'override_type1', 'startMessage','where', 'what');
 
         $new_link = $base_uri . 'src/read_body.php?passed_id=' . urlencode($passed_id) .
                     '&passed_ent_id=' . urlencode($passed_ent_id) .
@@ -318,16 +318,15 @@ function SendMDN ( $mailbox, $passed_id, $sender, $message, $imapConnection) {
                 _("Server replied:") . ' ' . $deliver->dlv_ret_nr . ' ' .
                 nl2br(htmlspecialchars($deliver->dlv_server_msg));
         }
-        require_once(SM_PATH . 'functions/display_messages.php');
         plain_error_message($msg, $color);
     } else {
         unset ($deliver);
         if (sqimap_mailbox_exists ($imapConnection, $sent_folder)) {
-            sqimap_append ($imapConnection, $sent_folder, $length);
+            $sid = sqimap_append ($imapConnection, $sent_folder, $length);
             require_once(SM_PATH . 'class/deliver/Deliver_IMAP.class.php');
             $imap_deliver = new Deliver_IMAP();
             $imap_deliver->mail($composeMessage, $imapConnection);
-            sqimap_append_done ($imapConnection);
+            sqimap_append_done ($imapConnection, $sent_folder);
             unset ($imap_deliver);
         }
     }
@@ -578,7 +577,7 @@ function formatMenubar($aMailbox, $passed_id, $passed_ent_id, $message, $removed
         // top display is enabled.
         if ( $delete_prev_next_display == 1 &&
                in_array('\\deleted', $aMailbox['PERMANENTFLAGS'],true) ) {
-            $del_prev_link = _("Delete & Prev");
+            $del_prev_link = _("Delete & Prev");
             if ($prev >= 0) {
                 $uri = $base_uri . 'src/read_body.php?passed_id='.$prev.
                        '&mailbox='.$urlMailbox.'&sort='.$sort.
@@ -588,7 +587,7 @@ function formatMenubar($aMailbox, $passed_id, $passed_ent_id, $message, $removed
                 $del_prev_link = '<a href="'.$uri.'">'.$del_prev_link.'</a>';
             }
 
-            $del_next_link = _("Delete & Next");
+            $del_next_link = _("Delete &amp; Next");
             if ($next >= 0) {
                 $uri = $base_uri . 'src/read_body.php?passed_id='.$next.
                        '&amp;mailbox='.$urlMailbox.'&amp;sort='.$sort.
@@ -807,7 +806,11 @@ sqgetGlobalVar('lastTargetMailbox', $lastTargetMailbox, SQ_SESSION);
 if (!sqgetGlobalVar('messages', $messages, SQ_SESSION) ) {
     $messages = array();
 }
-
+sqgetGlobalVar('delayed_errors',  $delayed_errors,  SQ_SESSION);
+if (is_array($delayed_errors)) {
+    $oErrorHandler->AssignDelayedErrors($delayed_errors);
+    sqsession_unregister("delayed_errors");
+}
 /** GET VARS */
 sqgetGlobalVar('sendreceipt',   $sendreceipt,   SQ_GET);
 if (!sqgetGlobalVar('where',         $where,         SQ_GET) ) {
@@ -967,7 +970,6 @@ if (isset($aMailbox['MSG_HEADERS'][$passed_id]['MESSAGE_OBJECT'])) {
     $message->is_seen = true;
     $aMailbox['MSG_HEADERS'][$passed_id]['MESSAGE_OBJECT'] = $message;
 }
-
 if (isset($passed_ent_id) && $passed_ent_id) {
     $message = $message->getEntity($passed_ent_id);
     if ($message->type0 != 'message'  && $message->type1 != 'rfc822') {
@@ -1026,6 +1028,14 @@ for ($i = 0; $i < $cnt; $i++) {
    }
 }
 
+/**
+ * Write mailbox with updated seen flag information back to cache.
+ */
+$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);
 formatEnvheader($aMailbox, $passed_id, $passed_ent_id, $message, $color, $FirstTimeSee);
@@ -1093,10 +1103,4 @@ formatMenuBar($aMailbox, $passed_id, $passed_ent_id, $message, false, FALSE);
 do_hook('read_body_bottom');
 sqimap_logout($imapConnection);
 
-/**
- * Write mailbox with updated seen flag information back to cache.
- */
-$mailbox_cache[$iAccount.'_'.$aMailbox['NAME']] = $aMailbox;
-sqsession_register($mailbox_cache,'mailbox_cache');
-$oTemplate->display('footer.tpl');
 ?>