make use of new status function & make use of option show cumulative
[squirrelmail.git] / src / download.php
index 574420ec16baa09bd44c3fe5b1f18bc51ca8341e..472ce840f60fe212e926087bb3c706da90a0d865 100644 (file)
@@ -23,28 +23,28 @@ require_once(SM_PATH . 'functions/mime.php');
 header('Pragma: ');
 header('Cache-Control: cache');
 
-function get_extract_to_target_list($imapConnection) {
-    $boxes = sqimap_mailbox_list($imapConnection);
-    for ($i = 0; $i < count($boxes); $i++) {  
-        if (!in_array('noselect', $boxes[$i]['flags'])) {
-            $box = $boxes[$i]['unformatted'];
-            $box2 = str_replace(' ', '&nbsp;', $boxes[$i]['unformatted-disp']);
-            if ( $box2 == 'INBOX' ) {
-                $box2 = _("INBOX");
-            }
-            echo "<option value=\"$box\">$box2</option>\n";
-        }
-    }
+/* globals */
+
+$key = $_COOKIE['key'];
+$username = $_SESSION['username'];
+$onetimepad = $_SESSION['onetimepad'];
+$mailbox = $_GET['mailbox'];
+$passed_id = $_GET['passed_id'];
+$ent_id = $_GET['ent_id'];
+$messages = $_SESSION['messages'];
+if (!isset($passed_ent_id)) {
+   $passed_ent_id = '';
+} else {
+   $passed_ent_id = $_GET['passed_ent_id'];
 }
+
+/* end globals */
 $mailbox = decodeHeader($mailbox);
 
-global $messages, $uid_support;
+global $uid_support;
 
 $imapConnection = sqimap_login($username, $key, $imapServerAddress, $imapPort, 0);
 $mbx_response =  sqimap_mailbox_select($imapConnection, $mailbox);
-if (!isset($passed_ent_id)) {
-   $passed_ent_id = '';
-}
 
 $message = &$messages[$mbx_response['UIDVALIDITY']]["$passed_id"];
 if (!is_object($message)) {
@@ -64,28 +64,6 @@ $type0 = $header->type0;
 $type1 = $header->type1;
 $encoding = strtolower($header->encoding);
 
-/*
-$extracted = false;
-if (isset($extract_message) && $extract_message) {
-  $cmd = "FETCH $passed_id BODY[$passed_ent_id]";
-  $read = sqimap_run_command ($imapConnection, $cmd, true, $response, $message, $uid_support);
-  $cnt = count($read);
-  $body = '';
-  $length = 0;
-  for ($i=1;$i<$cnt;$i++) {
-      $length = $length + strlen($read[$i]);
-      $body .= $read[$i];
-  }
-  if (isset($targetMailbox) && $length>0) {
-      sqimap_append ($imapConnection, $targetMailbox, $length);
-      fputs($imapConnection,$body);
-      sqimap_append_done ($imapConnection);
-      $extracted = true;
-  }
-}   
-
-
-*/
 /*
  * lets redefine message as this particular entity that we wish to display.
  * it should hold only the header for this entity.  We need to fetch the body
@@ -158,9 +136,11 @@ mime_print_body_lines ($imapConnection, $passed_id, $ent_id, $encoding);
  * version of IE.  I don't know if it works with Opera, but it should now.
  */
 function DumpHeaders($type0, $type1, $filename, $force) {
-    global $HTTP_USER_AGENT, $languages, $squirrelmail_language;
+    global $_SERVER, $languages, $squirrelmail_language;
     $isIE = 0;
 
+    $HTTP_USER_AGENT = $_SERVER['HTTP_USER_AGENT'];
+
     if (strstr($HTTP_USER_AGENT, 'compatible; MSIE ') !== false &&
         strstr($HTTP_USER_AGENT, 'Opera') === false) {
         $isIE = 1;