X-Git-Url: https://vcs.fsf.org/?p=squirrelmail.git;a=blobdiff_plain;f=src%2Fdownload.php;h=9561171165a5395262242acde526c5ba85453e26;hp=1d5acca8af1e6830f0c75e4522b074c22aea437d;hb=c91b2e3b5b2b35ab39b7c44bc866318b7341f7a1;hpb=3a621bee646d94c8a4979f6a3a46afb733132173 diff --git a/src/download.php b/src/download.php index 1d5acca8..95611711 100644 --- a/src/download.php +++ b/src/download.php @@ -6,12 +6,15 @@ * Handles attachment downloads to the users computer. * Also allows displaying of attachments when possible. * - * @copyright © 1999-2006 The SquirrelMail Project Team + * @copyright © 1999-2007 The SquirrelMail Project Team * @license http://opensource.org/licenses/gpl-license.php GNU Public License * @version $Id$ * @package squirrelmail */ +/** This is the download page */ +define('PAGE_NAME', 'download'); + /** * Include the SquirrelMail initialization file. */ @@ -22,13 +25,23 @@ require(SM_PATH . 'functions/imap_general.php'); require(SM_PATH . 'functions/mailbox_display.php'); require(SM_PATH . 'functions/mime.php'); +/** + * If a message is viewed from the search page, $aMailbox[$passed_id]['MESSAGE_OBJECT'] + * is not initialized, which makes this page error out on line 65 with an + * undefined function. We need to include some additional files in case the + * object has not been initialized. + * + * TODO: Determine why the object in question is not initialized when coming from + * a search page and correct. Once that is done, we can remove these + * includes. + */ +require(SM_PATH . 'functions/imap_messages.php'); +require(SM_PATH . 'functions/date.php'); + header('Pragma: '); header('Cache-Control: cache'); /* globals */ -sqgetGlobalVar('key', $key, SQ_COOKIE); -sqgetGlobalVar('username', $username, SQ_SESSION); -sqgetGlobalVar('onetimepad', $onetimepad, SQ_SESSION); sqgetGlobalVar('mailbox_cache',$mailbox_cache,SQ_SESSION); sqgetGlobalVar('messages', $messages, SQ_SESSION); sqgetGlobalVar('mailbox', $mailbox, SQ_GET); @@ -46,15 +59,15 @@ set_my_charset(); /* end globals */ -$imapConnection = sqimap_login($username, $key, $imapServerAddress, $imapPort, 0); +$imapConnection = sqimap_login($username, false, $imapServerAddress, $imapPort, 0); $aMailbox = sqm_api_mailbox_select($imapConnection, $account, $mailbox,array(),array()); if (isset($aMailbox['MSG_HEADERS'][$passed_id]['MESSAGE_OBJECT']) && is_object($aMailbox['MSG_HEADERS'][$passed_id]['MESSAGE_OBJECT']) ) { $message = $aMailbox['MSG_HEADERS'][$passed_id]['MESSAGE_OBJECT']; } else { - $message = sqimap_get_message($imapConnection, $passed_id, $mailbox); - $aMailbox['MSG_HEADERS'][$passed_id]['MESSAGE_OBJECT'] = $message; + $message = sqimap_get_message($imapConnection, $passed_id, $mailbox); + $aMailbox['MSG_HEADERS'][$passed_id]['MESSAGE_OBJECT'] = $message; } $subject = $message->rfc822_header->subject; @@ -118,7 +131,7 @@ if (strlen($filename) < 1) { else if ($type1 == 'postscript' && $type0 == 'application') $suffix = 'ps'; else if ($type1 == 'rfc822' && $type0 == 'message') - $suffix = 'msg'; + $suffix = 'eml'; else $suffix = $type1;