diff --git a/mail/inc/class.mail_acl.inc.php b/mail/inc/class.mail_acl.inc.php index ed4d7d5767..c858d47245 100644 --- a/mail/inc/class.mail_acl.inc.php +++ b/mail/inc/class.mail_acl.inc.php @@ -162,8 +162,9 @@ class mail_acl $n = 1; foreach ($acl as $key => $value) { - $virtuals = array_pop(array_values((array)$value)); - $rights = array_shift(array_values((array)$value)); + $parts = array_values((array)$value); + $virtuals = array_pop($parts); + $rights = array_shift($parts); foreach ($rights as $right) { diff --git a/mail/inc/class.mail_compose.inc.php b/mail/inc/class.mail_compose.inc.php index b8af3f93a1..574bcd2a62 100644 --- a/mail/inc/class.mail_compose.inc.php +++ b/mail/inc/class.mail_compose.inc.php @@ -1073,7 +1073,8 @@ class mail_compose if (($_REQUEST['mimeType']=="text" ||$_REQUEST['mimeType']=="plain") && $content['mimeType'] == 'html') { $_content['mimeType'] = $content['mimeType'] = 'plain'; - $content['body'] = $this->convertHTMLToText(str_replace(array("\n\r","\n"),' ',$content['body'])); + $html = str_replace(array("\n\r","\n"),' ',$content['body']); + $content['body'] = $this->convertHTMLToText($html); } if ($_REQUEST['mimeType']=="html" && $content['mimeType'] != 'html') { @@ -1092,7 +1093,8 @@ class mail_compose $content['mimeType'] == 'html') { $_content['mimeType'] = $content['mimeType'] = 'plain'; - $content['body'] = $this->convertHTMLToText(str_replace(array("\n\r","\n"),' ',$content['body'])); + $html = str_replace(array("\n\r","\n"),' ',$content['body']); + $content['body'] = $this->convertHTMLToText($html); } if (!empty($this->mailPreferences['replyOptions']) && $this->mailPreferences['replyOptions']=="html" && $content['mimeType'] != 'html') @@ -1553,10 +1555,10 @@ class mail_compose case 'forward': $mode = ($_GET['mode']=='forwardinline'?'inline':'asmail'); // this fill the session data with the values from the original email - foreach ($replyIds as &$mail_id) + foreach ($replyIds as &$m_id) { - //error_log(__METHOD__.__LINE__.' ID:'.$mail_id.' Mode:'.$mode); - $hA = mail_ui::splitRowID($mail_id); + //error_log(__METHOD__.__LINE__.' ID:'.$m_id.' Mode:'.$mode); + $hA = mail_ui::splitRowID($m_id); $msgUID = $hA['msgUID']; $folder = $hA['folder']; $content = $this->getForwardData($icServer, $folder, $msgUID, $part_id, $mode); @@ -1610,13 +1612,6 @@ class mail_compose base64_encode($folder).mail_ui::$delimiter.$merged_mail_id; $content = $this->getComposeFrom($merged_mail_id, $part_id, 'composefromdraft', $_focusElement, $suppressSigOnTop, $isReply); } - else - { - $success = implode(', ',$results['success']); - $fail = implode(', ', $results['failed']); - if($success) Framework::message($success, 'success'); - Framework::window_close($fail); - } } catch (Api\Exception\WrongUserinput $e) { @@ -2116,7 +2111,8 @@ class mail_compose } } //error_log(__METHOD__.__LINE__.'->'.array2string($attachment)); - Api\Header\Content::safe($attachment['attachment'], $attachment['name'], $attachment['type'], $size=0, true, $_GET['mode'] == "save"); + $size = 0; + Api\Header\Content::safe($attachment['attachment'], $attachment['name'], $attachment['type'], $size, true, $_GET['mode'] == "save"); echo $attachment['attachment']; exit(); diff --git a/mail/inc/class.mail_hooks.inc.php b/mail/inc/class.mail_hooks.inc.php index cb4500a5bd..1ab0d1fb09 100644 --- a/mail/inc/class.mail_hooks.inc.php +++ b/mail/inc/class.mail_hooks.inc.php @@ -657,7 +657,7 @@ class mail_hooks // $_folderName, $_startMessage, $_numberOfMessages, $_sort, $_reverse, $_filter, $_thisUIDOnly=null, $_cacheResult=true $headers = $bomail->getHeaders($notify_folder, 1, 999, 0, true, $_filter,null,false); if(is_array($headers['header']) && count($headers['header']) > 0) { - foreach($headers['header'] as $id=>$header) { + foreach($headers['header'] as $header) { // check if unseen mail has already been notified $headerrowid = mail_ui::generateRowID($activeProfile, $notify_folder, $header['uid'], $_prependApp=false); if(!in_array($headerrowid, $notified_mail_uidsCache[$activeProfile][$notify_folder])) { diff --git a/mail/inc/class.mail_integration.inc.php b/mail/inc/class.mail_integration.inc.php index 4147f0bff1..00ee1b500f 100644 --- a/mail/inc/class.mail_integration.inc.php +++ b/mail/inc/class.mail_integration.inc.php @@ -400,7 +400,7 @@ class mail_integration { 'html_message' => $mailcontent['html_message'], 'date' => $mailcontent['date'], 'subject' => $mailcontent['subject'], - 'entry_id' => $app_entry_id + 'entry_id' => null, ); } diff --git a/mail/inc/class.mail_sieve.inc.php b/mail/inc/class.mail_sieve.inc.php index 6964e608b0..1b08caaea4 100644 --- a/mail/inc/class.mail_sieve.inc.php +++ b/mail/inc/class.mail_sieve.inc.php @@ -278,6 +278,7 @@ class mail_sieve //$ruleID is calculated by priority from the selected rule and is an unique ID $content['ruleID'] = $ruleID = ($this->rulesByID['priority'] -1) / 2; $error = 0; + $msg = ''; switch ($button) { case 'save': @@ -1040,14 +1041,9 @@ class mail_sieve $complete .= $andor; } $complete .= "message " . $xthan . $rule['size'] . "KB'"; - $started = 1; } if (!empty($rule['field_bodytransform'])) { - if ($started) - { - $newruletext .= ", "; - } $btransform = " :raw "; $match = ' :contains'; if ($rule['bodytransform']) @@ -1063,15 +1059,9 @@ class mail_sieve $match = ':regex'; } $complete .= " body " . $btransform . $match . " \"" . $rule['field_bodytransform'] . "\""; - $started = 1; - } if ($rule['ctype']!= '0' && !empty($rule['ctype'])) { - if ($started) - { - $newruletext .= ", "; - } $btransform_ctype = Mail\Script::$btransform_ctype_array[$rule['ctype']]; $ctype_subtype = ""; if ($rule['field_ctype_val']) @@ -1079,7 +1069,6 @@ class mail_sieve $ctype_subtype = "/"; } $complete .= " body :content " . " \"" . $btransform_ctype . $ctype_subtype . $rule['field_ctype_val'] . "\"" . " :contains \"\""; - $started = 1; //error_log(__CLASS__."::".__METHOD__.array2string(Mail\Script::$btransform_ctype_array)); } if (!$rule['unconditional']) diff --git a/mail/inc/class.mail_ui.inc.php b/mail/inc/class.mail_ui.inc.php index c409f362b5..969103124b 100644 --- a/mail/inc/class.mail_ui.inc.php +++ b/mail/inc/class.mail_ui.inc.php @@ -2803,7 +2803,8 @@ $filter['before']= date("d-M-Y", $cutoffdate2); } //error_log(__METHOD__.__LINE__.'->'.array2string($attachment)); $filename = ($attachment['name']?$attachment['name']:($attachment['filename']?$attachment['filename']:$mailbox.'_uid'.$uid.'_part'.$part)); - Api\Header\Content::safe($attachment['attachment'], $filename, $attachment['type'], $size=0, True, $_GET['mode'] == "save"); + $size = 0; + Api\Header\Content::safe($attachment['attachment'], $filename, $attachment['type'], $size, True, $_GET['mode'] == "save"); echo $attachment['attachment']; exit(); @@ -2845,18 +2846,20 @@ $filter['before']= date("d-M-Y", $cutoffdate2); } $GLOBALS['egw']->session->commit_session(); + $headers = Horde_Mime_Headers::parseHeaders($message); + $subject = str_replace('$$','__',Mail::decode_header($headers['SUBJECT'])); if (!$display) { - $headers = Horde_Mime_Headers::parseHeaders($message); - $subject = str_replace('$$','__',Mail::decode_header($headers['SUBJECT'])); $subject = Api\Mail::clean_subject_for_filename($subject); - Api\Header\Content::safe($message, $subject.".eml", $mime='message/rfc822', $size=0, true, true); + $mime='message/rfc822'; + Api\Header\Content::safe($message, $subject.".eml", $mime); echo $message; } else { $subject = Api\Mail::clean_subject_for_filename($subject); - Api\Header\Content::safe($message, $subject.".eml", $mime='text/html', $size=0, true, false); + $mime='text/html'; $size=0; + Api\Header\Content::safe($message, $subject.".eml", $mime, $size, true, false); print '
'. htmlspecialchars($message, ENT_NOQUOTES|ENT_SUBSTITUTE, 'utf-8') .''; } } @@ -3387,7 +3390,11 @@ $filter['before']= date("d-M-Y", $cutoffdate2); $body = ''; //error_log(__METHOD__.array2string($bodyParts)); //exit; - if (empty($bodyParts)) return ""; + if (empty($bodyParts)) + { + $ret = ''; + return $ret; + } foreach((array)$bodyParts as $singleBodyPart) { if (!isset($singleBodyPart['body'])) { $singleBodyPart['body'] = $this->getdisplayableBody($singleBodyPart,$modifyURI,$useTidy); @@ -3462,26 +3469,15 @@ $filter['before']= date("d-M-Y", $cutoffdate2); // create links for websites if ($modifyURI) $newBody = Api\Html::activate_links($newBody); - //error_log(__METHOD__.__LINE__.'..'.$newBody); - // redirect links for websites if you use no cookies - #if (!($GLOBALS['egw_info']['server']['usecookies'])) - # $newBody = preg_replace("/href=(\"|\')((http(s?):\/\/)|(www\.))([\w,\-,\/,\?,\=,\.,&,!\n,\%,@,\(,\),\*,#,:,~,\+]+)(\"|\')/ie", - # "'href=\"$webserverURL/redirect.php?go='.@htmlentities(urlencode('http$4://$5$6'),ENT_QUOTES,\"Mail::$displayCharset\").'\"'", $newBody); // create links for email addresses - //TODO:if ($modifyURI) $this->parseEmail($newBody); // create links for inline images if ($modifyURI) { $newBody = self::resolve_inline_images($newBody, $this->mailbox, $this->uid, $this->partID, 'plain'); } - //TODO:$newBody = $this->highlightQuotes($newBody); // to display a mailpart of mimetype plain/text, may be better taged as preformatted - #$newBody = nl2br($newBody); - // since we do not display the message as HTML anymore we may want to insert good linebreaking (for visibility). - //error_log(__METHOD__.__LINE__.'..'.$newBody); - // dont break lines that start with > (> as the text was processed with htmlentities before) $newBody = "
".Mail::wordwrap($newBody,90,"\n",'>').""; } else @@ -3503,22 +3499,17 @@ $filter['before']= date("d-M-Y", $cutoffdate2); { $newBody = $cleaned; } - if (!$preserveHTML) // ToDo KL: $preserveHTML is NOT initialised, so always if is dead code + // filter only the 'body', as we only want that part, if we throw away the Api\Html + if (preg_match('`(