Ignore:
Timestamp:
08/11/09 14:40:40 (15 years ago)
Author:
amuller
Message:

Ticket #615 - Resolv. problemas de criaçao de filtros, e criação de log

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/expressoMail1_2/inc/class.ScriptS.inc.php

    r1059 r1304  
    177177                // Escreve a nova regra; 
    178178                $this->reply = $this->SieveS->getscript(); 
    179                  
     179                /* 
    180180                if($this->reply){ 
    181181                        $this->errstr = $this->SieveS->deletescript($this->scriptfile);          
    182182                } 
    183  
     183                */ 
     184 
     185                $error_log_file="/home/expressolivre/sieve_error.log"; 
    184186                //Escreve a(s) nova(s) regra(s); 
    185                 $this->errstr = $this->SieveS->putscript($this->scriptfile,$this->write_rule()); 
     187                $newrule = $this->write_rule(); 
     188                if (strlen($newrule) > 0) 
     189                        $this->errstr = $this->SieveS->putscript($this->scriptfile,$newrule); 
     190                else 
     191                { 
     192                        if($_SESSION['phpgw_info']['server']['expressomail']['expressoMail_enable_log_messages'] == "True") 
     193                                error_log(date("D M j G:i:s T Y").": SieveError, Invalid rule for " 
     194                                        .$_SESSION['phpgw_info']['expressomail']['user']['userid']."=>" 
     195                                        .$this->teste."\nRule:" 
     196                                        .$var_decode."\n", 3, $error_log_file); 
     197                        return "Invalid rule\n" . $this->teste; 
     198                } 
    186199                 
    187200                //Ativa o script; 
     
    191204                $this->SieveS->close(); 
    192205                 
    193                 if($this->errstr){ 
     206                if($this->errstr) 
     207                { 
    194208                        return "Ok"; 
    195                 }else{ 
     209                } 
     210                else 
     211                { 
     212                        if($_SESSION['phpgw_info']['server']['expressomail']['expressoMail_enable_log_messages'] == "True") 
     213                        error_log(date("D M j G:i:s T Y") 
     214                        .": SieveError, Problem for " 
     215                        .$_SESSION['phpgw_info']['expressomail']['user']['userid']."=>" 
     216                        .$this->teste."\nRule:" 
     217                        .$var_decode."\n", 3, $error_log_file); 
    196218                        return "Problemas na criação do arquivo!\n" . $this->teste; 
    197219                } 
     
    203225          for ( $i = 0; $i < strlen($input); $i++ ) 
    204226          { 
    205               if ( preg_match('/[ÁáÉéÍíÓóÚúÀàÈèÌìÒòÙùüÇçÃãÕõÂâÊêÔô®©§ªºÐ¹²³°¢¿Æ£µøæß«»Ø÷±¬]/', $input[$i]) ) 
     227                if ( preg_match('/[^a-z0-9.@~_+=&\'*^"-]/i', $input[$i]) ) 
    206228              { 
    207229                  $special_char = true; 
    208                   $input = preg_replace('/'.$input[$i].'/', '=' . bin2hex($input[$i]), $input); 
     230                  $input = preg_replace('/\\'.$input[$i].'/', '=' . bin2hex($input[$i]), $input); 
    209231              } 
    210232          }    
     
    227249    } 
    228250 
    229         // Grava a nova regra; 
     251        // build the rule 
    230252        function write_rule(){ 
    231253 
     
    346368          
    347369                } 
    348           
    349                 // Ações 
     370                // Don't write half rule! 
     371                if (strlen($newruletext) == 0)  
     372                        return false; 
     373                // Actions 
    350374                if (!$rule['unconditional']) $newruletext .= ") {\n\t"; 
    351375         
Note: See TracChangeset for help on using the changeset viewer.