X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=src%2Fread_body.php;h=12be8adb7243584afa4b78b9c1b8a4df73ad8f23;hb=8949acd68dc6459372ef79823c88c0fbf2ae4e23;hp=a814cd6ca2c94e72450b73177af31d5eab3d08b1;hpb=ebd2391cb0c5e3049870f90fa8a8b28707e9571a;p=squirrelmail.git
diff --git a/src/read_body.php b/src/read_body.php
index a814cd6c..12be8adb 100644
--- a/src/read_body.php
+++ b/src/read_body.php
@@ -128,8 +128,9 @@ function ServerMDNSupport($aFlags) {
}
function SendMDN ( $mailbox, $passed_id, $message, $imapConnection) {
- global $squirrelmail_language, $default_charset,
- $languages, $useSendmail, $domain, $sent_folder;
+ global $squirrelmail_language, $default_charset, $default_move_to_sent,
+ $languages, $useSendmail, $domain, $sent_folder, $username,
+ $data_dir;
sqgetGlobalVar('SERVER_NAME', $SERVER_NAME, SQ_SERVER);
@@ -254,34 +255,60 @@ function SendMDN ( $mailbox, $passed_id, $message, $imapConnection) {
} else {
require_once(SM_PATH . 'class/deliver/Deliver_SMTP.class.php');
$deliver = new Deliver_SMTP();
- global $smtpServerAddress, $smtpPort, $pop_before_smtp;
+ global $smtpServerAddress, $smtpPort, $pop_before_smtp, $pop_before_smtp_host;
$authPop = (isset($pop_before_smtp) && $pop_before_smtp) ? true : false;
+ if (empty($pop_before_smtp_host)) $pop_before_smtp_host = $smtpServerAddress;
get_smtp_user($user, $pass);
$stream = $deliver->initStream($composeMessage,$domain,0,
- $smtpServerAddress, $smtpPort, $user, $pass, $authPop);
+ $smtpServerAddress, $smtpPort, $user, $pass, $authPop, $pop_before_smtp_host);
}
$success = false;
if ($stream) {
- $length = $deliver->mail($composeMessage, $stream);
+ $deliver->mail($composeMessage, $stream);
$success = $deliver->finalizeStream($stream);
}
if (!$success) {
- $msg = _("Message not sent.") . "
\n" .
+ $msg = _("Message not sent.") . "\n" .
$deliver->dlv_msg;
if (! empty($deliver->dlv_server_msg)) {
- $msg.= '
' .
+ $msg.= "\n" .
_("Server replied:") . ' ' . $deliver->dlv_ret_nr . ' ' .
nl2br(htmlspecialchars($deliver->dlv_server_msg));
}
plain_error_message($msg);
} else {
unset ($deliver);
- if (sqimap_mailbox_exists ($imapConnection, $sent_folder)) {
- $sid = sqimap_append ($imapConnection, $sent_folder, $length);
+
+ // move to sent folder
+ //
+ $move_to_sent = getPref($data_dir,$username,'move_to_sent');
+ if (isset($default_move_to_sent) && ($default_move_to_sent != 0)) {
+ $svr_allow_sent = true;
+ } else {
+ $svr_allow_sent = false;
+ }
+
+ if (isset($sent_folder) && (($sent_folder != '') || ($sent_folder != 'none'))
+ && sqimap_mailbox_exists( $imapConnection, $sent_folder)) {
+ $fld_sent = true;
+ } else {
+ $fld_sent = false;
+ }
+
+ if ((isset($move_to_sent) && ($move_to_sent != 0)) || (!isset($move_to_sent))) {
+ $lcl_allow_sent = true;
+ } else {
+ $lcl_allow_sent = false;
+ }
+
+ if (($fld_sent && $svr_allow_sent && !$lcl_allow_sent) || ($fld_sent && $lcl_allow_sent)) {
+ $save_reply_with_orig=getPref($data_dir,$username,'save_reply_with_orig');
+ if ($save_reply_with_orig) {
+ $sent_folder = $mailbox;
+ }
require_once(SM_PATH . 'class/deliver/Deliver_IMAP.class.php');
$imap_deliver = new Deliver_IMAP();
- $imap_deliver->mail($composeMessage, $imapConnection);
- sqimap_append_done ($imapConnection, $sent_folder);
+ $imap_deliver->mail($composeMessage, $imapConnection, 0, 0, $imapConnection, $sent_folder);
unset ($imap_deliver);
}
}
@@ -329,9 +356,10 @@ function formatRecipientString($recipients, $item ) {
$a = array();
foreach ($recipients as $r) {
$a[] = array(
- 'Name' => htmlspecialchars($r->getAddress(false)),
+ // note: decodeHeader is htmlsafe by default
+ 'Name' => decodeHeader($r->getAddress(false)),
'Email' => htmlspecialchars($r->getEmail()),
- 'Full' => htmlspecialchars($r->getAddress(true))
+ 'Full' => decodeHeader($r->getAddress(true))
);
}
@@ -376,6 +404,10 @@ function formatEnvheader($aMailbox, $passed_id, $passed_ent_id, $message,
$oTemplate->assign('xmailer', decodeHeader($header->xmailer));
$env[_("Mailer")] = $oTemplate->fetch('read_xmailer.tpl');
}
+
+ // this is used for both mdn and also general use for plugins, etc
+ $oTemplate->assign('first_time_reading', $FirstTimeSee);
+
if ($default_use_mdn) {
if ($mdn_user_support) {
if ($header->dnt) {
@@ -393,9 +425,6 @@ function formatEnvheader($aMailbox, $passed_id, $passed_ent_id, $message,
}
}
- // this is used for both mdn and also general use for plugins, etc
- $oTemplate->assign('first_time_reading', $FirstTimeSee);
-
$statuses = array();
if (isset($aMailbox['MSG_HEADERS'][$passed_id]['FLAGS'])) {
if (isset($aMailbox['MSG_HEADERS'][$passed_id]['FLAGS']['\\deleted']) &&
@@ -430,7 +459,7 @@ function formatEnvheader($aMailbox, $passed_id, $passed_ent_id, $message,
/**
* Format message toolbar
*
- * @param string $mailbox Name of current mailbox
+ * @param array $aMailbox Current mailbox information array
* @param int $passed_id UID of current message
* @param int $passed_ent_id Id of entity within message
* @param object $message Current message object
@@ -530,11 +559,11 @@ function formatMenubar($aMailbox, $passed_id, $passed_ent_id, $message, $removed
}
}
- // Start with Search Results or Message List link.
- $list_xtra = "?where=read_body.php&what=$what&mailbox=" . $urlMailbox.
- "&startMessage=$startMessage";
- $msg_list_href = $base_uri .'src/right_main.php'. $list_xtra;
- $search_href = $where=='search.php' ? $base_uri .'src/search.php?'.$list_xtra : '';
+ $msg_list_href = get_message_list_uri($aMailbox['NAME'], $startMessage, $what);
+ if ($where == 'search.php')
+ $search_href = str_replace('read_body.php', 'search.php', $msg_list_href);
+ else
+ $search_href = '';
$comp_uri = $base_uri.'src/compose.php' .
'?passed_id=' . $passed_id .
@@ -629,6 +658,21 @@ function formatMenubar($aMailbox, $passed_id, $passed_ent_id, $message, $removed
$oTemplate->assign('can_be_copied', false);
}
+ // access keys...
+ //
+ global $accesskey_read_msg_reply, $accesskey_read_msg_reply_all,
+ $accesskey_read_msg_forward, $accesskey_read_msg_as_attach,
+ $accesskey_read_msg_delete, $accesskey_read_msg_bypass_trash,
+ $accesskey_read_msg_move_to, $accesskey_read_msg_move;
+ $oTemplate->assign('accesskey_read_msg_reply', $accesskey_read_msg_reply);
+ $oTemplate->assign('accesskey_read_msg_reply_all', $accesskey_read_msg_reply_all);
+ $oTemplate->assign('accesskey_read_msg_forward', $accesskey_read_msg_forward);
+ $oTemplate->assign('accesskey_read_msg_as_attach', $accesskey_read_msg_as_attach);
+ $oTemplate->assign('accesskey_read_msg_delete', $accesskey_read_msg_delete);
+ $oTemplate->assign('accesskey_read_msg_bypass_trash', $accesskey_read_msg_bypass_trash);
+ $oTemplate->assign('accesskey_read_msg_move_to', $accesskey_read_msg_move_to);
+ $oTemplate->assign('accesskey_read_msg_move', $accesskey_read_msg_move);
+
global $null;
do_hook('read_body_menu', $null);
@@ -644,7 +688,7 @@ function formatMenubar($aMailbox, $passed_id, $passed_ent_id, $message, $removed
function formatToolbar($mailbox, $passed_id, $passed_ent_id, $message, $color) {
global $base_uri, $where, $what, $show_html_default,
- $oTemplate, $download_href,
+ $oTemplate, $download_href, $PHP_SELF,
$unsafe_image_toggle_href, $unsafe_image_toggle_text;
$urlMailbox = urlencode($mailbox);
@@ -660,28 +704,25 @@ function formatToolbar($mailbox, $passed_id, $passed_ent_id, $message, $color) {
}
$url = $base_uri.'src/view_header.php?'.$query_string;
-
- // Build the printer friend link
- /* hackydiehack */
- if( !sqgetGlobalVar('view_unsafe_images', $view_unsafe_images, SQ_GET) ) {
- $view_unsafe_images = false;
- } else {
- $view_unsafe_images = true;
- }
- $pf_params = '?passed_ent_id=' . $urlPassed_ent_id .
- '&mailbox=' . $urlMailbox .
- '&passed_id=' . $urlPassed_id .
- '&view_unsafe_images='. (bool) $view_unsafe_images .
- '&show_html_default=' . $show_html_default;
$links = array();
$links[] = array (
'URL' => $url,
'Text' => _("View Full Header")
);
- $links[] = array (
- 'URL' => $pf_params,
- 'Text' => _("View Printable Version")
+
+ if ( checkForJavaScript() ) {
+ $links[] = array (
+ 'URL' => 'javascript:printThis();',
+ 'Text' => _("Print"),
+ );
+ } else {
+ $links[] = array (
+ 'URL' => set_url_var($PHP_SELF, 'print', '1'),
+ 'Text' => _("Print"),
+ 'Target' => '_blank'
);
+ }
+
$links[] = array (
'URL' => $download_href,
'Text' => _("Download this as a file")
@@ -755,12 +796,10 @@ if ( sqgetGlobalVar('account', $temp, SQ_GET) ) {
}
/** GET/POST VARS */
+sqgetGlobalVar('passed_id', $passed_id, SQ_INORDER, NULL, SQ_TYPE_BIGINT);
sqgetGlobalVar('passed_ent_id', $passed_ent_id);
sqgetGlobalVar('mailbox', $mailbox);
-if ( sqgetGlobalVar('passed_id', $temp) ) {
- $passed_id = (int) $temp;
-}
if ( sqgetGlobalVar('sort', $temp) ) {
$sort = (int) $temp;
}
@@ -781,6 +820,7 @@ if(sqgetGlobalVar('view_unsafe_images', $temp)) {
} else {
$view_unsafe_images = 0;
}
+
/**
* Retrieve mailbox cache
*/
@@ -924,6 +964,8 @@ if (isset($sendreceipt)) {
/* End of block for handling incoming url vars */
/***********************************************/
+$oTemplate->assign('aAttribs', array('class' => 'entity_sep'));
+$hr = $oTemplate->fetch('horizontal_rule.tpl');
$messagebody = '';
do_hook('read_body_top', $null);
if ($show_html_default == 1) {
@@ -935,7 +977,7 @@ $cnt = count($ent_ar);
for ($i = 0; $i < $cnt; $i++) {
$messagebody .= formatBody($imapConnection, $message, $color, $wrap_at, $ent_ar[$i], $passed_id, $mailbox);
if ($i != $cnt-1) {
- $messagebody .= '