X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=src%2Fread_body.php;h=e8a74a1582504c83f219a2ba4887fe1b76d9e885;hb=190dc452bedb05364a6f5842142b5e484995b1ca;hp=65e74c7cf7f13aed0492e1fa80aced4f8624a8c7;hpb=40a34e575d4c65b11ea0a4e125c1abf4d3b2c65f;p=squirrelmail.git diff --git a/src/read_body.php b/src/read_body.php index 65e74c7c..e8a74a15 100644 --- a/src/read_body.php +++ b/src/read_body.php @@ -13,23 +13,23 @@ */ /** - * 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 @@ -115,6 +115,55 @@ function printer_friendly_link($mailbox, $passed_id, $passed_ent_id) { return $result; } +function view_as_html_link($mailbox, $passed_id, $passed_ent_id, $message) { + global $base_uri, $show_html_default; + + $has_html = false; + if ($message->header->type0 == 'message' && $message->header->type1 == 'rfc822') { + $type0 = $message->rfc822_header->content_type->type0; + $type1 = $message->rfc822_header->content_type->type1; + } else { + $type0 = $message->header->type0; + $type1 = $message->header->type1; + } + if($type0 == 'multipart' && + ($type1 == 'alternative' || $type1 == 'mixed' || $type1 == 'related')) { + if ($message->findDisplayEntity(array(), array('text/html'), true)) { + $has_html = true; + } + } + /* + * Normal single part message so check its type. + */ + else { + if($type0 == 'text' && $type1 == 'html') { + $has_html = true; + } + } + if($has_html == true) { + $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) . + '&mailbox=' . urlencode($mailbox); + foreach($vars as $var) { + if(sqgetGlobalVar($var, $temp)) { + $new_link .= '&' . $var . '=' . urlencode($temp); + } + } + + if($show_html_default == 1) { + $new_link .= '&show_html_default=0'; + $link = _("View as plain text"); + } else { + $new_link .= '&show_html_default=1'; + $link = _("View as HTML"); + } + return ' | ' . $link . ''; + } + return ''; +} + function ServerMDNSupport($aFlags) { /* escaping $ doesn't work -> \x36 */ return ( in_array('$mdnsent',$aFlags,true) || @@ -245,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'); @@ -269,16 +326,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); } } @@ -384,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 = '