Ticket #511: antispam.diff

File antispam.diff, 1.8 KB (added by wmerlotto, 15 years ago)

Diff da solução proposta para flexibilização da função de chamada do anti-spam

  • class.imap_functions.inc.php

    old new  
    27952795                $msgs_number = explode(',',$params['msgs_number']); 
    27962796 
    27972797                foreach($msgs_number as $msg_number) { 
    2798                         $header = imap_fetchheader($mbox_stream, imap_msgno($mbox_stream, $msg_number)); 
    2799                         $body = imap_body($mbox_stream, imap_msgno($mbox_stream, $msg_number)); 
     2798                        $imap_msg_number = imap_msgno($mbox_stream, $msg_number); 
     2799                        $header = imap_fetchheader($mbox_stream, $imap_msg_number); 
     2800                        $body = imap_body($mbox_stream, $imap_msg_number); 
    28002801                        $msg = $header . $body; 
    28012802                        $email = $_SESSION['phpgw_info']['expressomail']['user']['email']; 
    28022803                        $username = $this->username; 
     
    28072808                        $v = explode("\r\n", $header); 
    28082809                        foreach ($v as $linha){ 
    28092810                                if (eregi("^X-DSPAM-Signature", $linha)) { 
    2810                                          
    28112811                                        $args = explode(" ",$linha); 
    28122812                                        $signature = $args[1]; 
     2813                                } elseif (eregi("^Message-ID", $linha)) { 
     2814                                        $args = explode(" ", $linha); 
     2815                                        $msg_id = "$args[1]"; 
    28132816                                } 
    28142817                        } 
    28152818 
    2816                         // feed dspam 
     2819                        // Seleciona qual comando a ser executado 
    28172820                        switch($is_spam){ 
    28182821                                case 'true':  $cmd = $_SESSION['phpgw_info']['server']['expressomail']['expressoMail_command_for_spam']; break; 
    28192822                                case 'false': $cmd = $_SESSION['phpgw_info']['server']['expressomail']['expressoMail_command_for_ham']; break; 
    28202823                        } 
    2821                         $tags = array('##EMAIL##', '##USERNAME##', '##DOMAIN##', '##SIGNATURE##'); 
    2822                         $cmd = str_replace($tags,array($email,$username,$domain,$signature),$cmd); 
     2824 
     2825                        $tags = array('##EMAIL##', '##USERNAME##', '##DOMAIN##', '##SIGNATURE##', '##MSGID##', '##MSG##'); 
     2826                        $cmd = str_replace($tags, array($email, $username, $domain, $signature, $msg_id, $msg), $cmd); 
    28232827                        system($cmd); 
    28242828                } 
    28252829                imap_close($mbox_stream);