require_once('../functions/url_parser.php');
require_once('../functions/smtp.php');
require_once('../functions/html.php');
-require_once('../src/view_header.php');
/**
* Given an IMAP message id number, this will look it up in the cached
$to_array = $header->to;
$to = '';
foreach ($to_array as $line) {
- $to .= " $line ";
+ $to .= ' '.$line->getAddress();
}
$subject = $header->subject;
return $string;
}
-function formatEnvheader($mailbox, $passed_id, $passed_ent_id, $message, $color) {
+function formatEnvheader($mailbox, $passed_id, $passed_ent_id, $message,
+ $color, $FirstTimeSee) {
global $msn_user_support, $default_use_mdn, $draft_folder, $sent_folder,
$default_use_priority, $show_xmailer_default,
$mdn_user_support, $PHP_SELF, $javascript_on;
if ( !($mailbox == $draft_folder ||
$mailbox == $sent_folder || $message->is_deleted)) {
$mdn_url = $PHP_SELF . '&sendreceipt=1';
- $FirstTimeSee = false;
if ($FirstTimeSee && $javascript_on) {
$script = '<script language="JavaScript" type="text/javascript">' ."\n";
$script .= '<!--'. "\n";
}
}
$s .= '</table>';
- return $s;
+ echo $s;
}
-function formatMenubar($mailbox, $passed_id, $passed_ent_id, $msg, $mbx_response) {
+function formatMenubar($mailbox, $passed_id, $passed_ent_id, $message, $mbx_response) {
global $base_uri, $sent_folder, $draft_folder, $where, $what, $color, $sort,
- $startMessage, $data_dir, $username, $compose_new_win;
+ $startMessage, $compose_new_win, $PHP_SELF, $save_as_draft;
$topbar_delimiter = ' | ';
$urlMailbox = encodeHeader($mailbox);
- $identity = '';
- $idents = getPref($data_dir, $username, 'identities');
- $from_name = $msg->header->from->getAddress();
- if (!empty($idents) && $idents > 1) {
- for ($i = 1; $i < $idents; $i++) {
- $enc_from_name = '"'.
- encodeHeader(getPref($data_dir,
- $username,
- 'full_name' . $i)) .
- '" <' . getPref($data_dir, $username,
- 'email_address' . $i) . '>';
- if (htmlspecialchars($enc_from_name) == $from_name) {
- $identity = $i;
- break;
- }
- }
- }
-
$s = '<table width="100%" cellpadding="3" cellspacing="0" align="center"'.
' border="0" bgcolor="'.$color[9].'"><tr><td align="left" width="33%"><small>';
$msgs_url = $base_uri . 'src/';
if (isset($where) && isset($what)) {
- if ($pos == '') {
- $pos=0;
- }
- $msgs_url .= 'search.php?where='.urlencode($where).'&pos='.$pos.
+ $msgs_url .= 'search.php?where='.urlencode($where).
'&what='.urlencode($what).'&mailbox='.$urlMailbox;
+ $msgs_str = _("Search results");
} else {
$msgs_url .= 'right_main.php?sort='.$sort.'&startMessage='.
$startMessage.'&mailbox='.$urlMailbox;
+ $msgs_str = _("Message List");
}
- $s .= '<a href="'. $msgs_url.'">'._("Message List").'</a>';
+ $s .= '<a href="'. $msgs_url.'">'.$msgs_str.'</a>';
$s .= $topbar_delimiter;
$delete_url = $base_uri . 'src/delete_message.php?mailbox='.$urlMailbox.
$comp_uri = $base_uri . 'src/compose.php'.
'?passed_id='.$passed_id.
'&mailbox='.$urlMailbox.
- (isset($passed_ent_id)?'&passed_ent_id='.$passed_ent_id:'').
- '&identity='.$identity;
-
+ (isset($passed_ent_id)?'&passed_ent_id='.$passed_ent_id:'');
if (($mailbox == $draft_folder) && ($save_as_draft)) {
$comp_alt_uri = $comp_uri . '&action=draft';
$s .= $topbar_delimiter;
if ($compose_new_win == '1') {
$s .= '<a href="javascript:void(0)" '.
- 'onclick="comp_in_new("'.$comp_alt_uri.'")">'.$comp_alt_string.'</a>';
+ 'onclick="comp_in_new(\''.$comp_alt_uri.'\')">'.$comp_alt_string.'</a>';
} else {
$s .= '<a href="'.$comp_alt_uri.'">'.$comp_alt_string.'</a>';
}
$s .= _("Next");
}
} else if (isset($passed_ent_id) && $passed_ent_id) {
+ /* code for navigating through attached message/rfc822 messages */
+ $url = set_url_var($PHP_SELF, 'passed_ent_id',0);
+ $s .= '<a href="'.$url.'">'._("View Message").'</a>';
+ $par_ent_id = $message->parent->entity_id;
+ if ($par_ent_id) {
+ $par_ent_id = substr($par_ent_id,0,-2);
+ $s .= $topbar_delimiter;
+ $url = set_url_var($PHP_SELF, 'passed_ent_id',$par_ent_id);
+ $s .= '<a href="'.$url.'">'._("Up").'</a>';
+ }
}
$s .= '</small></td><td align="right" width="33%"><small>';
$s .= '<a href="'.$comp_action_uri.'">'._("Reply All").'</a>';
}
$s .= '</small></td></tr></table>';
- return $s;
+ echo $s;
}
function formatToolbar($mailbox, $passed_id, $passed_ent_id, $message, $color) {
- global $startMessage, $show_more, $base_uri, $where, $what;
+ global $QUERY_STRING, $base_uri;
$urlMailbox = encodeHeader($mailbox);
- $s = '<table width="100%" cellpadding="3" cellspacing="0" align="right"'.
- ' border="0" bgcolor="'.$color[9].'">'.
+ $s = '<table width="100%" cellpadding="3" cellspacing="0" align="center"'.
+ ' border="0" bgcolor="'.$color[9].'">'. "\n".
'<tr align="right"><td valign="top" align="right"><small>';
-
- $viewheader_url = $base_uri . 'src/read_body.php?mailbox=' . $urlMailbox .
- '&passed_id='. $passed_id. '&';
- if ($where && $what) {
- $viewheader_url .= 'where=' . urlencode($where) . '&what=' . urlencode($what) .
- '&view_hdr=1';
- } else {
- $viewheader_url .= 'startMessage=' .$startMessage. '&show_more='.
- $show_more .'&view_hdr=1';
- }
- $s .= '<a href="'.$viewheader_url.'">'.("View Full Header").'</a>';
+ $url = $base_uri.'src/view_header.php?'.$QUERY_STRING;
+ $s .= '<a href="'.$url.'">'.("View Full Header").'</a>';
/* Output the printer friendly link if we are in subtle mode. */
$s .= ' | '.
printer_friendly_link($mailbox, $passed_id, $passed_ent_id, $color);
-
+ echo $s;
do_hook("read_body_header_right");
-
- $s .= '</small></td></tr></table>'."\n";
- return $s;
+ echo '</small></td></tr>';
+ echo '</table>'."\n";
}
// $message = sqimap_get_message($imapConnection, $passed_id, $mailbox);
$message = $messages[$uidvalidity][$passed_id];
}
+$FirstTimeSee = !$message->is_seen;
+$message->is_seen = true;
+$messages[$uidvalidity][$passed_id] = $message;
+
if (isset($passed_ent_id)) {
$message = $message->getEntity($passed_ent_id);
$message->id = $passed_id;
//do_hook('html_top');
-/*
- * The following code sets necesarry stuff for the MDN thing
- */
-if($default_use_mdn &&
- ($mdn_user_support = getPref($data_dir, $username, 'mdn_user_support',
- $default_use_mdn))) {
- $supportMDN = ServerMDNSupport($mbx_response["PERMANENTFLAGS"]);
- $FirstTimeSee = !$message->is_seen;
-}
-
/* =============================================================================
* block for handling incoming url vars
*
* =============================================================================
*/
-
-/*
- * The following code shows the header of the message and then exit
- */
-if (isset($view_hdr)) {
- $template_vars = array();
- $template_vars['full_header'] = parse_viewheader($imapConnection,$passed_id, $passed_ent_id);
- $template_vars['return_address'] = set_url_var($PHP_SELF, 'view_hdr');
- view_header($template_vars, '', '</body></html>');
- exit;
-}
-
if (isset($sendreceipt)) {
if ( !$message->is_mdnsent ) {
if (isset($identity) ) {
if ($final_recipient == '' ) {
$final_recipient = getPref($data_dir, $username, 'email_address', '' );
}
-
+ $supportMDN = ServerMDNSupport($mbx_response["PERMANENTFLAGS"]);
if ( SendMDN( $mailbox, $passed_id, $final_recipient, $message ) > 0 && $supportMDN ) {
ToggleMDNflag( true, $imapConnection, $mailbox, $passed_id, $uid_support);
$message->is_mdnsent = true;
$ent_ar = $message->findDisplayEntity(array());
for ($i = 0; $i < count($ent_ar); $i++) {
$messagebody .= formatBody($imapConnection, $message, $color, $wrap_at, $ent_ar[$i], $passed_id, $mailbox);
+ $messagebody .= '<hr noshade size=1>';
}
displayPageHeader($color, $mailbox);
do_hook('read_body_top');
-echo formatMenuBar($mailbox, $passed_id, $passed_ent_id, $message, $mbx_response);
-echo formatEnvheader($mailbox, $passed_id, $passed_ent_id, $message, $color);
-echo formatToolbar($mailbox,$passed_id,$passed_ent_id,$message, $color);
-echo "BOE";
+formatMenuBar($mailbox, $passed_id, $passed_ent_id, $message, $mbx_response);
+formatEnvheader($mailbox, $passed_id, $passed_ent_id, $message, $color, $FirstTimeSee);
+do_hook("read_body_header");
+formatToolbar($mailbox,$passed_id,$passed_ent_id,$message, $color);
echo '<table width="100%" cellpadding="3" cellspacing="3" align="center"'.
' border="0" bgcolor="'.$color[4].'">';
echo '<tr><td>'.$messagebody.'</td></tr>';