Index: class.ScriptS.inc.php =================================================================== --- class.ScriptS.inc.php (revisão 1262) +++ class.ScriptS.inc.php (cópia de trabalho) @@ -176,13 +176,18 @@ // Escreve a nova regra; $this->reply = $this->SieveS->getscript(); - + /* if($this->reply){ $this->errstr = $this->SieveS->deletescript($this->scriptfile); } + */ //Escreve a(s) nova(s) regra(s); - $this->errstr = $this->SieveS->putscript($this->scriptfile,$this->write_rule()); + $newrule = $this->write_rule(); + if (strlen($newrule) > 0) + $this->errstr = $this->SieveS->putscript($this->scriptfile,$newrule); + else + return "Invalid rule\n" . $this->teste; //Ativa o script; $this->errstr = $this->SieveS->activatescript($this->scriptfile); @@ -202,10 +207,11 @@ $special_char = false; for ( $i = 0; $i < strlen($input); $i++ ) { - if ( preg_match('/[ÁáÉéÍíÓóÚúÀàÈèÌìÒòÙùüÇçÃãÕõÂâÊêÔô®©§ªºÐ¹²³°¢¿Æ£µøæß«»Ø÷±¬]/', $input[$i]) ) + //if ( preg_match('/[^a-zA-z0-9.@~_+=&\'*^\"-]/', $input[$i]) ) + if ( preg_match('/[^a-z0-9.@~_+=&\'*^"-]/i', $input[$i]) ) { $special_char = true; - $input = preg_replace('/'.$input[$i].'/', '=' . bin2hex($input[$i]), $input); + $input = preg_replace('/\\'.$input[$i].'/', '=' . bin2hex($input[$i]), $input); } } @@ -226,7 +232,7 @@ return($input); } - // Grava a nova regra; + // build the rule function write_rule(){ // Variaveis; @@ -345,8 +351,10 @@ } } - - // Ações + // Don't write half rule! + if (strlen($newruletext) == 0) + return false; + // Actions if (!$rule['unconditional']) $newruletext .= ") {\n\t"; if (preg_match("/folder/i",$rule['action']))