Changeset 1828


Ignore:
Timestamp:
12/14/09 15:46:28 (14 years ago)
Author:
niltonneto
Message:

Ticket #788 - Corrigido problema no método replace_links (regexp).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2.0/expressoMail1_2/inc/class.imap_functions.inc.php

    r1798 r1828  
    428428                $return_get_body = $this->get_body_msg($msg_number, $msg_folder); 
    429429                 
    430                 //Substituição de links em email para abrir no próprio expresso 
    431                 $body = mb_ereg_replace("<a[^>]*href=[\'\"]mailto:([^\"\']+)[\'\"]>([^<]+)</a>","<a href=\"javascript:new_message_to('\\1')\">\\2</a>",$return_get_body['body']); 
    432  
     430                $body = $return_get_body['body']; 
    433431                //Remoção de tags <span></span> para correção de erro no firefox 
    434432                $body = mb_ereg_replace("<span><span>","",$body); 
     
    10151013                        'applet','embed','frameset','xml','xmp','style'); 
    10161014 
    1017                 $body = $this-> replace_links($body); 
    1018                 $blocked_tags = array();                 
     1015                $blocked_tags = array(); 
    10191016                foreach($tag_list as $index => $tag) { 
    10201017                        $new_body = @mb_eregi_replace("<$tag", "<!--$tag", $body); 
     
    10311028                        $body = str_replace($rest[1][$i],"<".$rest[2][$i].$rest[3][$i].$rest[7][$i].">",$body); 
    10321029 
    1033                 return  "<span>".$body; 
     1030                return  "<span>".$this-> replace_links($body); 
    10341031        } 
    10351032 
     
    10411038                if(count($matches)) 
    10421039                        return $body; 
    1043          
    1044                 $pattern = '/(?<=[\s\><\n\r;])((http(s?):\/\/((?:[\w]\.?)+(?::[\d]+)?[\/.\-~&=?%;@#,+\w:]*))|((?:www?\.)(?:\w\.?)*(?::\d+)?[\/\w.\-~&=?%;@+]*))/i'; 
    1045                 $replacement = '<a href="http$3://$4$5" target="_blank">$1</a>'; 
    1046                 return preg_replace($pattern, $replacement, $body);  
    1047                  
    1048                 // Original 
    1049                 //return preg_replace('/(?<=[\s|(<br>)|\n|\r|;])((http(s?):\/\/((?:[\w]\.?)+(?::[\d]+)?[\/.\-~&=?%;@#,+\w]*))|((?:www?\.)(?:\w\.?)*(?::\d+)?[\/\w.\-~&=?%;@+]*))/i', '<a href="http$3://$4$5" target="_blank">http$3://$4$5</a>', $body); 
     1040 
     1041                /* Replace links tags <a href="" ></a> to links with target=_blank */ 
     1042                $pattern = '/<a[^>]+href="([^>"]+)"[^>]*>(.*)<\/a>/im'; 
     1043                $replacement = '<a href="$1" target="_blank">$2</a>'; 
     1044                $body = preg_replace($pattern, $replacement, $body); 
     1045 
     1046                /*Replace websites that does NOT begin with href=" to links */ 
     1047                $pattern = '/([^h][^r][^e][^f][^=][^"])((https?:\/\/)[A-Za-z0-9\.~?\/_=&#;\-:]*)/m'; 
     1048                $replacement = '$1<a href="$2" target="_blank">$2</a>'; 
     1049                $body = preg_replace($pattern, $replacement, $body); 
     1050 
     1051                /*Transform email address in new_message_to*/ 
     1052                $pattern = '/([A-Za-z0-9\.~?\/_=#\-]*@[A-Za-z0-9\.~?\/_=#\-]*)/im'; 
     1053                $replacement = '<a href="javascript:new_message_to(\'$1\')">$1</a>'; 
     1054                $body = preg_replace($pattern, $replacement, $body); 
     1055 
     1056                /*Subs. email links to expresso*/ 
     1057                $body = mb_ereg_replace("<a[^>]*href=[\'\"]mailto:([^\"\']+)[\'\"]>([^<]+)</a>", 
     1058                        "<a href=\"javascript:new_message_to('\\1')\">\\2</a>",$body); 
     1059 
     1060 
     1061                return $body; 
    10501062        } 
    10511063 
Note: See TracChangeset for help on using the changeset viewer.