Changeset 564 for trunk/expressoMail1_2/inc/class.ScriptS.inc.php
- Timestamp:
- 01/05/09 17:20:41 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/expressoMail1_2/inc/class.ScriptS.inc.php
r330 r564 13 13 var $rules; // Regras do sieve; 14 14 var $errstr; // Erros retornados; 15 var $size; // var tamanho;16 var $so; // para verificarse a regra foi criada por outro tipo serviço de filtros;15 var $size; // Tamanho; 16 var $so; // Verifica se a regra foi criada por outro tipo serviço de filtros; 17 17 var $continuebit; 18 18 var $sizebit; … … 22 22 var $newrules = array(); 23 23 var $newout; 24 var $teste; 25 var $EmailVoip; 26 var $EmailExpresso; 24 27 25 28 function ScriptS(){ … … 42 45 $this->keepbit = 8; 43 46 $this->regexbit = 128; 47 48 $this->EmailVoip = trim($_SESSION['phpgw_info']['user']['preferences']['expressoMail']['voip_email_redirect']); 49 $this->EmailExpresso = trim($_SESSION['phpgw_info']['expressomail']['user']['email']); 44 50 45 51 } … … 189 195 return "Ok"; 190 196 }else{ 191 return "Problemas na criação do arquivo! ";197 return "Problemas na criação do arquivo!\n" . $this->teste; 192 198 } 193 199 } 194 200 195 function convert_specialchar($input){ 196 $special_char = false; 197 for ( $i = 0; $i < strlen($input); $i++ ) 198 if ( preg_match('/[ÁáÉéÍíÓóÚúÀàÈèÌìÒòÙùÇçÃãÕõÂâÊêÔô®©§ªºÐ¹²³°¢¿Æ£µøæß«»Ø÷±¬]/', $input[$i]) ) 199 { 200 $special_char = true; 201 $input = preg_replace('/'.$input[$i].'/', '=' . bin2hex($input[$i]), $input); 202 } 203 204 if ( $special_char ) 205 { 206 /* When using arrays with pattern and replacement, the keys are processed in the order they appear in the array. See preg_replace in php.net/preg_replace */ 201 function convert_specialchar($input) 202 { 203 $special_char = false; 204 for ( $i = 0; $i < strlen($input); $i++ ) 205 { 206 if ( preg_match('/[ÁáÉéÍíÓóÚúÀàÈèÌìÒòÙùüÇçÃãÕõÂâÊêÔô®©§ªºÐ¹²³°¢¿Æ£µøæß«»Ø÷±¬]/', $input[$i]) ) 207 { 208 $special_char = true; 209 $input = preg_replace('/'.$input[$i].'/', '=' . bin2hex($input[$i]), $input); 210 } 211 } 212 213 if ( $special_char ) 214 { 215 /* * 216 * When using arrays with pattern and replacement, 217 * the keys are processed in the order they appear in the array. 218 * See preg_replace in php.net/preg_replace 219 * */ 207 220 $patterns[0] = '/=c3/i'; 208 221 $patterns[1] = '/ /'; … … 210 223 $replacements[0] = '_'; 211 224 $input = preg_replace($patterns, $replacements, $input); 212 } 213 // if (($input{0}) && (!eregi('^[a-zA-Z0-9=\-@&\.#\$!?%:\+_<>\(\)\"\ ]+$',$input))) 214 // return false; 215 // else 216 return($input); 217 } 225 } 226 227 return($input); 228 } 218 229 219 230 // Grava a nova regra; … … 227 238 $regexused = 0; 228 239 $rejectused = 0; 240 $notify = 0; 229 241 $newscriptbody = ""; 230 242 $continue = 1; 243 $tmpSubject = ""; 231 244 232 245 // Recebe os valores das regras; … … 237 250 $rule['from'] = $this->convert_specialchar($tmp1[3]); 238 251 $rule['to'] = $this->convert_specialchar($tmp1[4]); 239 $rule['subject'] = $this->convert_specialchar($tmp1[5]); 252 $tmpSubject = $tmp1[5]; 253 $rule['subject'] = $this->convert_specialchar($tmp1[5]); 240 254 $rule['action'] = $tmp1[6]; 241 255 $rule['action_arg'] = utf8_encode(preg_replace("/\\r\\n/","\r\n",$tmp1[7])); … … 337 351 if (!$rule['unconditional']) $newruletext .= ") {\n\t"; 338 352 339 if (preg_match("/folder/i",$rule['action'])) { 353 if (preg_match("/folder/i",$rule['action'])) 354 { 340 355 $newruletext .= "fileinto \"" . $rule['action_arg'] . "\";"; 341 356 } 342 if (preg_match("/reject/i",$rule['action'])) { 357 358 if (preg_match("/reject/i",$rule['action'])) 359 { 343 360 $newruletext .= "reject text: \n" . $rule['action_arg'] . "\n.\n;"; 344 361 $rejectused = 1; 345 362 } 346 if (preg_match("/address/i",$rule['action'])) { 363 364 if (preg_match("/address/i",$rule['action'])) 365 { 347 366 $newruletext .= "redirect \"" . $rule['action_arg'] . "\";"; 348 367 } 368 369 if (preg_match("/notify/i",$rule['action'])) 370 { 371 $newruletext .= "notify :method \"mailto\" :options [\"".$this->EmailVoip ."\"]:" . 372 "message \"<expressovoip><from>". $this->EmailExpresso."</from>". 373 "<br/><Subject>".utf8_encode($tmpSubject)."</Subject></expressovoip>\";"; 374 $notify = 1; 375 } 376 349 377 if (preg_match("/discard/i",$rule['action'])) { 350 378 $newruletext .= "discard;"; … … 362 390 } 363 391 }// Fim do Foreach; 364 392 $this->teste = $newscriptbody; 365 393 // Para a regras fora do escritorio; 366 394 unset($tmp); … … 389 417 if ($activerules) { 390 418 $newscripthead .= "require [\"fileinto\""; 419 420 if($notify){ 421 $newscripthead .= ",\"notify\""; 422 } 391 423 if($regexused){ 392 424 $newscripthead .= ",\"regex\""; … … 405 437 } 406 438 407 //preg_replace("/[\\n\\r]/","", $p);408 409 410 439 // Cria o rodapé do arquivo; 411 440 $newscriptfoot = "";
Note: See TracChangeset
for help on using the changeset viewer.