X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=src%2Fread_body.php;h=a4588362c4a0b64eb3ebaeb0c7e3b11b82054287;hb=b7043f905faff3c0e7e6ab8bfe7a658372de3ce2;hp=81bd5e1c192c1a6765f93e41ebab164123116934;hpb=d6b6d22168e00130de9ce544ee661cc791b239f3;p=squirrelmail.git diff --git a/src/read_body.php b/src/read_body.php index 81bd5e1c..a4588362 100644 --- a/src/read_body.php +++ b/src/read_body.php @@ -1,18 +1,18 @@ \x36 */ - $ret = preg_match('/(\x36MDNSent|\\\*)/i', $read); + $ret = preg_match('/(\x36MDNSent|\\\\\*)/i', $read); return $ret; } @@ -169,6 +177,16 @@ function SendMDN ( $mailbox, $passed_id, $sender, $message, $imapConnection) { $rfc822_header->to[] = $header->dnt; $rfc822_header->subject = _("Read:") . ' ' . encodeHeader($header->subject); + // Patch #793504 Return Receipt Failing with <@> from Tim Craig (burny_md) + // This merely comes from compose.php and only happens when there is no + // email_addr specified in user's identity (which is the startup config) + if (ereg("^([^@%/]+)[@%/](.+)$", $username, $usernamedata)) { + $popuser = $usernamedata[1]; + $domain = $usernamedata[2]; + unset($usernamedata); + } else { + $popuser = $username; + } $reply_to = ''; $ident = get_identities(); @@ -178,9 +196,9 @@ function SendMDN ( $mailbox, $passed_id, $sender, $message, $imapConnection) { $from_addr = '"'.$full_name.'" <'.$from_mail.'>'; $reply_to = $ident[$identity]['reply_to']; - if (!$from_addr) { - $from_addr = "$popuser@$domain"; - $from_mail = $from_addr; + if (!$from_mail) { + $from_mail = "$popuser@$domain"; + $from_addr = $from_mail; } $rfc822_header->from = $rfc822_header->parseAddress($from_addr,true); if ($reply_to) { @@ -267,15 +285,8 @@ function SendMDN ( $mailbox, $passed_id, $sender, $message, $imapConnection) { require_once(SM_PATH . 'class/deliver/Deliver_SMTP.class.php'); $deliver = new Deliver_SMTP(); global $smtpServerAddress, $smtpPort, $smtp_auth_mech, $pop_before_smtp; - if ($smtp_auth_mech == 'none') { - $user = ''; - $pass = ''; - } else { - global $key, $onetimepad; - $user = $username; - $pass = OneTimePadDecrypt($key, $onetimepad); - } $authPop = (isset($pop_before_smtp) && $pop_before_smtp) ? true : false; + get_smtp_user($user, $pass); $stream = $deliver->initStream($composeMessage,$domain,0, $smtpServerAddress, $smtpPort, $user, $pass, $authPop); } @@ -394,6 +405,7 @@ function formatEnvheader($mailbox, $passed_id, $passed_ent_id, $message, $header = $message->rfc822_header; $env = array(); $env[_("Subject")] = str_replace(" "," ",decodeHeader($header->subject)); + $from_name = $header->getAddr_s('from'); if (!$from_name) $from_name = $header->getAddr_s('sender'); @@ -464,85 +476,41 @@ function formatEnvheader($mailbox, $passed_id, $passed_ent_id, $message, echo ''; } -function formatMenubar($mailbox, $passed_id, $passed_ent_id, $message, $mbx_response) { +/** + * Format message toolbar + * + * @param string $mailbox Name of current mailbox + * @param int $passed_id UID of current message + * @param int $passed_ent_id Id of entity within message + * @param object $message Current message object + * @param object $mbx_response + */ +function formatMenubar($mailbox, $passed_id, $passed_ent_id, $message, $mbx_response, $nav_on_top = TRUE) { global $base_uri, $draft_folder, $where, $what, $color, $sort, - $startMessage, $PHP_SELF, $save_as_draft, - $enable_forward_as_attachment; + $startMessage, $PHP_SELF, $save_as_draft, $uid_support, + $enable_forward_as_attachment, $imapConnection, $lastTargetMailbox, + $data_dir, $username, $delete_prev_next_display; $topbar_delimiter = ' | '; + $double_delimiter = ' '; $urlMailbox = urlencode($mailbox); - $s = '
';
+ // BEGIN NAV ROW - PREV/NEXT, DEL PREV/NEXT, LINKS TO INDEX, etc.
+ $nav_row = '';
- if (!(isset($where) && isset($what)) && !$passed_ent_id) {
- $prev = findPreviousMessage($mbx_response['EXISTS'], $passed_id);
- $next = findNextMessage($passed_id);
- if ($prev != -1) {
- $uri = $base_uri . 'src/read_body.php?passed_id='.$prev.
- '&mailbox='.$urlMailbox.'&sort='.$sort.
- '&startMessage='.$startMessage.'&show_more=0';
- $s .= ''._("Previous").'';
- } else {
- $s .= _("Previous");
- }
- $s .= $topbar_delimiter;
- if ($next != -1) {
- $uri = $base_uri . 'src/read_body.php?passed_id='.$next.
- '&mailbox='.$urlMailbox.'&sort='.$sort.
- '&startMessage='.$startMessage.'&show_more=0';
- $s .= ''._("Next").'';
- } else {
- $s .= _("Next");
- }
- } else if (isset($passed_ent_id) && $passed_ent_id) {
- /* code for navigating through attached message/rfc822 messages */
+ // Create Prev & Next links
+ // Handle nested entities first (i.e. Mime Attach parts)
+ 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 .= ''._("View Message").'';
$entities = array();
$entity_count = array();
$c = 0;
@@ -554,52 +522,199 @@ function formatMenubar($mailbox, $passed_id, $passed_ent_id, $message, $mbx_resp
$entities[$ent->entity_id] = $c;
}
}
+
$prev_link = _("Previous");
- $next_link = _("Next");
if($entities[$passed_ent_id] > 1) {
$prev_ent_id = $entity_count[$entities[$passed_ent_id] - 1];
$prev_link = '' . $prev_link . '';
}
+
+ $next_link = _("Next");
if($entities[$passed_ent_id] < $c) {
$next_ent_id = $entity_count[$entities[$passed_ent_id] + 1];
$next_link = '' . $next_link . '';
}
- $s .= $topbar_delimiter . $prev_link;
+
$par_ent_id = $message->parent->entity_id;
+ $up_link = '';
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 .= ''._("Up").'';
+ if ( $par_ent_id != 0 ) {
+ $up_link = $topbar_delimiter;
+ $url = set_url_var($PHP_SELF, 'passed_ent_id',$par_ent_id);
+ $up_link .= ''._("Up").'';
+ }
+ }
+
+ $nav_row .= $prev_link . $up_link . $topbar_delimiter . $next_link;
+ $nav_row .= $double_delimiter . '['._("View Message").']';
+
+ // Prev/Next links for regular messages
+ } else if ( !(isset($where) && isset($what)) ) {
+ $prev = findPreviousMessage($mbx_response['EXISTS'], $passed_id);
+ $next = findNextMessage($passed_id);
+
+ $prev_link = _("Previous");
+ if ($prev >= 0) {
+ $uri = $base_uri . 'src/read_body.php?passed_id='.$prev.
+ '&mailbox='.$urlMailbox.'&sort='.$sort.
+ '&startMessage='.$startMessage.'&show_more=0';
+ $prev_link = ''.$prev_link.'';
}
- $s .= $topbar_delimiter . $next_link;
+
+ $next_link = _("Next");
+ if ($next >= 0) {
+ $uri = $base_uri . 'src/read_body.php?passed_id='.$next.
+ '&mailbox='.$urlMailbox.'&sort='.$sort.
+ '&startMessage='.$startMessage.'&show_more=0';
+ $next_link = ''.$next_link.'';
+ }
+
+ // Only bother with Delete & Prev and Delete & Next IF
+ // we have UID support, and top display is enabled.
+ if ( $uid_support && $delete_prev_next_display == 1 ) {
+ $del_prev_link = _("Delete & Prev");
+ if ($prev >= 0) {
+ $uri = $base_uri . 'src/read_body.php?passed_id='.$prev.
+ '&mailbox='.$urlMailbox.'&sort='.$sort.
+ '&startMessage='.$startMessage.'&show_more=0'.
+ '&delete_id='.$passed_id;
+ $del_prev_link = ''.$del_prev_link.'';
+ }
+
+ $del_next_link = _("Delete & Next");
+ if ($next >= 0) {
+ $uri = $base_uri . 'src/read_body.php?passed_id='.$next.
+ '&mailbox='.$urlMailbox.'&sort='.$sort.
+ '&startMessage='.$startMessage.'&show_more=0'.
+ '&delete_id='.$passed_id;
+ $del_next_link = ''.$del_next_link.'';
+ }
+ }
+
+ $nav_row .= '['.$prev_link.$topbar_delimiter.$next_link.']';
+ if ( isset($del_prev_link) && isset($del_next_link) )
+ $nav_row .= $double_delimiter.'['.$del_prev_link.$topbar_delimiter.$del_next_link.']';
+ }
+
+ // Start with Search Results or Message List link.
+ if (isset($where) && isset($what)) {
+ $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");
}
+ $nav_row .= $double_delimiter .
+ '[' . $msgs_str . ']';
+
+ $nav_row .= ' | ';
+
+ // If Draft folder - create Resume link
+ if (($mailbox == $draft_folder) && ($save_as_draft)) {
+ $comp_alt_uri = $comp_uri . '&smaction=draft';
+ $comp_alt_string = _("Resume Draft");
+ } else if (handleAsSent($mailbox)) {
+ // If in Sent folder, edit as new
+ $comp_alt_uri = $comp_uri . '&smaction=edit_as_new';
+ $comp_alt_string = _("Edit Message as New");
+ }
+
+ // Show Alt URI for Draft/Sent
+ if (isset($comp_alt_uri)) {
+ $menu_row .= makeComposeLink($comp_alt_uri, $comp_alt_string);
+ $menu_row .= $topbar_delimiter . "\n";
+ }
+
+ $comp_action_uri = $comp_uri . '&smaction=reply';
+ $menu_row .= makeComposeLink($comp_action_uri, _("Reply")) . "\n";
+
+ $comp_action_uri = $comp_uri . '&smaction=reply_all';
+ $menu_row .= $topbar_delimiter;
+ $menu_row .= makeComposeLink($comp_action_uri, _("Reply All")) . "\n";
+
- $s .= ' | ' . "\n" .
- html_tag( 'td', '', 'right', '', 'width="33%" nowrap' ) . '';
$comp_action_uri = $comp_uri . '&smaction=forward';
- $s .= makeComposeLink($comp_action_uri, _("Forward"));
+ $menu_row .= $topbar_delimiter;
+ $menu_row .= makeComposeLink($comp_action_uri, _("Forward")) . "\n";
if ($enable_forward_as_attachment) {
$comp_action_uri = $comp_uri . '&smaction=forward_as_attachment';
- $s .= $topbar_delimiter;
- $s .= makeComposeLink($comp_action_uri, _("Forward as Attachment"));
+ $menu_row .= $topbar_delimiter;
+ $menu_row .= makeComposeLink($comp_action_uri, _("Forward as Attachment")) . "\n";
}
- $comp_action_uri = $comp_uri . '&smaction=reply';
- $s .= $topbar_delimiter;
- $s .= makeComposeLink($comp_action_uri, _("Reply"));
+ $delete_link = _("Delete");
+ if (!(isset($passed_ent_id) && $passed_ent_id)) {
+ $delete_url = $base_uri . 'src/delete_message.php?mailbox=' . $urlMailbox .
+ '&message=' . $passed_id . '&';
- $comp_action_uri = $comp_uri . '&smaction=reply_all';
- $s .= $topbar_delimiter;
- $s .= makeComposeLink($comp_action_uri, _("Reply All"));
- $s .= ' |