Ticket #615: regras2.diff
File regras2.diff, 1.8 KB (added by fpcorrea, 15 years ago) |
---|
-
class.ScriptS.inc.php
176 176 177 177 // Escreve a nova regra; 178 178 $this->reply = $this->SieveS->getscript(); 179 179 /* 180 180 if($this->reply){ 181 181 $this->errstr = $this->SieveS->deletescript($this->scriptfile); 182 182 } 183 */ 183 184 184 185 //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; 186 191 187 192 //Ativa o script; 188 193 $this->errstr = $this->SieveS->activatescript($this->scriptfile); … … 202 207 $special_char = false; 203 208 for ( $i = 0; $i < strlen($input); $i++ ) 204 209 { 205 if ( preg_match('/[ÁáÉéÍíÓóÚúÀàÈèÌìÒòÙùüÇçÃãÕõÂâÊêÔô®©§ªºÐ¹²³°¢¿Æ£µøæß«»Ø÷±¬]/', $input[$i]) ) 210 //if ( preg_match('/[^a-zA-z0-9.@~_+=&\'*^\"-]/', $input[$i]) ) 211 if ( preg_match('/[^a-z0-9.@~_+=&\'*^"-]/i', $input[$i]) ) 206 212 { 207 213 $special_char = true; 208 $input = preg_replace('/ '.$input[$i].'/', '=' . bin2hex($input[$i]), $input);214 $input = preg_replace('/\\'.$input[$i].'/', '=' . bin2hex($input[$i]), $input); 209 215 } 210 216 } 211 217 … … 226 232 return($input); 227 233 } 228 234 229 // Grava a nova regra;235 // build the rule 230 236 function write_rule(){ 231 237 232 238 // Variaveis; … … 345 351 } 346 352 347 353 } 348 349 // Ações 354 // Don't write half rule! 355 if (strlen($newruletext) == 0) 356 return false; 357 // Actions 350 358 if (!$rule['unconditional']) $newruletext .= ") {\n\t"; 351 359 352 360 if (preg_match("/folder/i",$rule['action']))