Changeset 650 for trunk


Ignore:
Timestamp:
01/30/09 13:19:05 (15 years ago)
Author:
niltonneto
Message:

Resolve #278, #346 e #410.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/expressoMail1_2/inc/class.imap_functions.inc.php

    r628 r650  
    2020        var $imap_options = ''; 
    2121        var $functions; 
     22        var $foldersLimit; 
    2223 
    2324        function imap_functions (){ 
     25                $this->foldersLimit = 200; //Limit of folders (mailboxes) user can see 
    2426                $this->username           = $_SESSION['phpgw_info']['expressomail']['user']['userid']; 
    2527                $this->password           = $_SESSION['phpgw_info']['expressomail']['user']['passwd']; 
     
    286288                        $return["msg"] = lang("error appending mail on delete attachments"); 
    287289                } 
    288                  
     290         
    289291                @imap_delete($this->mbox, imap_msgno($this->mbox, $params["msg_num"])); //Insere o novo e-mail sem anexos. 
    290292                @imap_expunge($this->mbox); //Deleta o e-mail com anexos 
     
    882884                        $body = eregi_replace("</$tag>", "</$tag-->", $new_body); 
    883885                } 
     886                // Malicious Code Remove 
     887                $dirtyCodePattern = "/(<([\w]+)([^>]*)on(mouse(move|over|down|up)|load|blur|change|click|dblclick|focus|key(down|up|press)|select)=[\"'][^>\"']*[\"']([^>]*)>)(.*)(<\/\\2>)?/isU"; 
     888                preg_match_all($dirtyCodePattern,$body,$rest,PREG_PATTERN_ORDER); 
     889                foreach($rest[0] as $i => $val) 
     890                        if (!(preg_match("/window\.open/i",$rest[1][$i]) && strtoupper($rest[4][$i]) == "CLICK" )) //Calendar events 
     891                                $body = str_replace($rest[1][$i],"<".$rest[2][$i].$rest[3][$i].$rest[7][$i].">",$body); 
    884892 
    885893                return  "<span>".$body; 
     
    909917                        if(strtolower($msg->encoding[$msg_number][$index]) == 'base64')  
    910918                        { 
    911                                 if ($file_type == 'application/x-pkcs7-signature')  
     919                                if ($file_type == 'application/x-pkcs7-signature' || $file_type == 'application/pkcs7-signature')  
    912920                                { 
    913921                                        $export_mail = new ExportEml(); 
     
    11521160                $serverString = "{".$this->imap_server.":".$this->imap_port.$this->imap_options."}"; 
    11531161                $folders_list = imap_getmailboxes($mbox_stream, $serverString, "*"); 
     1162                $folders_list = array_slice($folders_list,0,$this->foldersLimit); 
     1163 
    11541164                $tmp = array(); 
    11551165                $result = array(); 
     
    19891999 
    19902000                        if(!$flag_importance)                    
    1991                                 $return["status"] = imap_clearflag_full($this->mbox, $msgs_to_set, "\\Flagged", ST_UID); 
     2001                        $return["status"] = imap_clearflag_full($this->mbox, $msgs_to_set, "\\Flagged", ST_UID); 
    19922002                        else{ 
    19932003                                $return["status"] = false; 
     
    22172227                        $quota_used  = (($quota['usage']/1024)* 100 + .5 )* .01; 
    22182228                        if($quota_used >= $quota_limit) 
    2219                                 $quota_used = $quota_limit; 
     2229                        { 
     2230                                $quotaPercent = 100; 
     2231                        } 
     2232                        else 
     2233                        { 
    22202234                        $quotaPercent = ($quota_used / $quota_limit)*100; 
    22212235                        $quotaPercent = (($quotaPercent)* 100 + .5 )* .01; 
    2222  
     2236                        } 
    22232237                        return array( 
    22242238                                'quota_percent' => floor($quotaPercent), 
     
    24102424                                $name_box = mb_convert_encoding(utf8_decode($name_box), "UTF7-IMAP", "ISO_8859-1" );  
    24112425                                $filter = $this->remove_accents($filter); 
    2412                                 //Este bloco tem a finalidade de transformar o CPF das pastas compartilhadas em common name 
     2426                                //Este bloco tem a finalidade de transformar o login (quando numerico) das pastas compartilhadas em common name 
    24132427                                $folder_name = explode($this->imap_delimiter,$name_box); 
    24142428                                if (is_numeric($folder_name[1])) { 
     
    24652479        { 
    24662480                $header = $this->get_header($uid_msg);          
     2481                $flag = $header->Unseen.$header->Recent.$header->Flagged.$header->Draft; 
    24672482                $subject = $this->decode_string($header->fetchsubject); 
    24682483                $from = $header->from[0]->mailbox; 
    24692484                if($header->from[0]->personal != "") 
    24702485                        $from = $header->from[0]->personal; 
    2471                 $ret_msg = $this->decode_string($from) . "--" . $subject . "--". gmdate("d/m/Y",$header ->udate)."--". $this->size_msg($header->Size); 
     2486                $ret_msg = $this->decode_string($from) . "--" . $subject . "--". gmdate("d/m/Y",$header ->udate)."--". $this->size_msg($header->Size) ."--". $flag; 
    24722487                return $ret_msg;                     
    24732488        }        
Note: See TracChangeset for help on using the changeset viewer.