Ticket #615: regras.diff

File regras.diff, 1.6 KB (added by amuller, 15 years ago)

Implementação de corrige o problema

  • class.ScriptS.inc.php

     
    176176                 
    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                */ 
    183184 
    184185                //Escreve a(s) nova(s) regra(s); 
    185                 $this->errstr = $this->SieveS->putscript($this->scriptfile,$this->write_rule()); 
     186                $newrule = $this->write_rule(); 
     187                if (strlen($newrule) > 0) 
     188                        $this->errstr = $this->SieveS->putscript($this->scriptfile,$newrule); 
     189                else 
     190                        return "Invalid rule\n" . $this->teste; 
    186191                 
    187192                //Ativa o script; 
    188193                $this->errstr = $this->SieveS->activatescript($this->scriptfile); 
     
    202207      $special_char = false; 
    203208          for ( $i = 0; $i < strlen($input); $i++ ) 
    204209          { 
    205               if ( preg_match('/[ÁáÉéÍíÓóÚúÀàÈèÌìÒòÙùüÇçÃãÕõÂâÊêÔô®©§ªºÐ¹²³°¢¿Æ£µøæß«»Ø÷±¬]/', $input[$i]) ) 
     210              if ( preg_match('/[^a-zA-z0-9.@~_+=&\'*^\"-]/', $input[$i]) ) 
    206211              { 
    207212                  $special_char = true; 
    208213                  $input = preg_replace('/'.$input[$i].'/', '=' . bin2hex($input[$i]), $input); 
     
    226231       return($input); 
    227232    } 
    228233 
    229         // Grava a nova regra; 
     234        // build the rule 
    230235        function write_rule(){ 
    231236 
    232237                // Variaveis; 
     
    345350                    } 
    346351          
    347352                } 
    348           
    349                 // Ações 
     353                // Don't write half rule! 
     354                if (strlen($newruletext) == 0)  
     355                        return false; 
     356                // Actions 
    350357                if (!$rule['unconditional']) $newruletext .= ") {\n\t"; 
    351358         
    352359                if (preg_match("/folder/i",$rule['action']))