Changeset 4932


Ignore:
Timestamp:
08/16/11 16:19:05 (13 years ago)
Author:
rafaelraymundo
Message:

Ticket #2157 - O Filtro de "Assunto" não funciona com expressões.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2.3/expressoMail1_2/inc/class.ScriptS.inc.php

    r4851 r4932  
    215215 
    216216    function convert_specialchar($input) { 
    217         $temp_input = $input;   
    218         $temp_input = imap_8bit($temp_input);  
    219                   
    220         $patterns[0] = '/ /';  
    221         $replacements[0] = '_';   
    222         $temp_input = preg_replace($patterns, $replacements, $temp_input);   
    223         return ($temp_input); 
     217        $special_char = false; 
     218        for ($i = 0; $i < strlen($input); $i++) { 
     219            if (preg_match('/[^a-z0-9.@~_+=&\'*^\ \-\[\]]/i', $input[$i])) { 
     220                $special_char = true; 
     221                $input = preg_replace('/\\' . $input[$i] . '/', '=' . bin2hex($input[$i]), $input); 
     222            } 
     223        } 
     224 
     225        if ($special_char) { 
     226            /*             * 
     227             * When using arrays with pattern and replacement, 
     228             * the keys are processed in the order they appear in the array. 
     229             * See preg_replace in php.net/preg_replace 
     230             * */ 
     231            $patterns[0] = '/=c3/i'; 
     232            $patterns[1] = '/ /'; 
     233            $replacements[1] = ''; 
     234            $replacements[0] = '_'; 
     235            $input = preg_replace($patterns, $replacements, $input); 
     236        } 
     237 
     238        return($input); 
    224239    } 
    225240 
Note: See TracChangeset for help on using the changeset viewer.