]> git.mxchange.org Git - friendica.git/blobdiff - include/email.php
reverting recent db driver changes - won't install cleanly, won't update cleanly...
[friendica.git] / include / email.php
old mode 100755 (executable)
new mode 100644 (file)
index 659978b..b43ae0d
@@ -1,5 +1,7 @@
 <?php
 require_once('include/html2plain.php');
+require_once('include/msgclean.php');
+require_once('include/quoteconvert.php');
 
 function email_connect($mailbox,$username,$password) {
        if(! function_exists('imap_open'))
@@ -54,7 +56,7 @@ function email_msg_headers($mbox,$uid) {
        $raw_header = (($mbox && $uid) ? @imap_fetchheader($mbox,$uid,FT_UID) : '');
        $raw_header = str_replace("\r",'',$raw_header);
        $ret = array();
-       $h = split("\n",$raw_header);
+       $h = explode("\n",$raw_header);
        if(count($h))
        foreach($h as $line ) {
            if (preg_match("/^[a-zA-Z]/", $line)) {
@@ -72,7 +74,7 @@ function email_msg_headers($mbox,$uid) {
 }
 
 
-function email_get_msg($mbox,$uid) {
+function email_get_msg($mbox,$uid, $reply) {
        $ret = array();
 
        $struc = (($mbox && $uid) ? @imap_fetchstructure($mbox,$uid,FT_UID) : null);
@@ -86,6 +88,7 @@ function email_get_msg($mbox,$uid) {
 
        if(! $struc->parts) {
                $ret['body'] = email_get_part($mbox,$uid,$struc,0, 'html');
+               $html = $ret['body'];
 
                if (trim($ret['body']) == '')
                        $ret['body'] = email_get_part($mbox,$uid,$struc,0, 'plain');
@@ -107,6 +110,17 @@ function email_get_msg($mbox,$uid) {
                else
                        $ret['body'] = $text;
        }
+
+       $ret['body'] = removegpg($ret['body']);
+       $msg = removesig($ret['body']);
+       $ret['body'] = $msg['body'];
+       $ret['body'] = convertquote($ret['body'], $reply);
+
+       if (trim($html) != '')
+               $ret['body'] = removelinebreak($ret['body']);
+
+       $ret['body'] = unifyattributionline($ret['body']);
+
        return $ret;
 }
 
@@ -236,7 +250,7 @@ function email_header_encode($in_str, $charset) {
 
         // remove trailing spacer and
         // add start and end delimiters
-        $spacer = preg_quote($spacer);
+        $spacer = preg_quote($spacer,'/');
         $out_str = preg_replace("/" . $spacer . "$/", "", $out_str);
         $out_str = $start . $out_str . $end;
     }