Ignore:
Timestamp:
11/10/10 16:07:09 (13 years ago)
Author:
rafaelraymundo
Message:

Ticket #1322 - Data incorreta nas mensagens na caixa de entrada.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2.2/expressoMail1_2/inc/class.imap_functions.inc.php

    r3427 r3493  
    109109                $search_box_type = $params['search_box_type'] != "ALL" && $params['search_box_type'] != "" ? $params['search_box_type'] : false; 
    110110 
    111                 if(!$this->mbox || !is_resource($this->mbox)) 
     111                if(!$this->mbox || !is_resource($this->mbox)) 
    112112                        $this->mbox = $this->open_mbox($folder); 
    113113 
    114114                $return = array(); 
     115                // Para enviar o offset entre o timezone definido pelo usuário e GMT 
     116                $return['offsetToGMT'] = $this->functions->CalculateDateOffset(); 
    115117                 
    116118                if(!$search_box_type || $search_box_type=="UNSEEN" || $search_box_type=="SEEN") { 
     
    531533                        //return $return; 
    532534                }else{ 
    533             $return['body']             = $body; 
    534             $return['attachments']      = $return_get_body['attachments']; 
    535             $return['thumbs']           = $return_get_body['thumbs']; 
    536             $return['signature']        = $return_get_body['signature']; 
     535                    $return['body']             = $body; 
     536                    $return['attachments']      = $return_get_body['attachments']; 
     537                    $return['thumbs']           = $return_get_body['thumbs']; 
     538                    $return['signature']        = $return_get_body['signature']; 
    537539                } 
    538540 
     
    562564                $return['msg_folder'] = $msg_folder; 
    563565 
    564                 $date_msg = gmdate("d/m/Y",$header->udate); 
     566                $offset = $this->functions->CalculateDateOffset(); 
     567                $msgTimestamp = $header->udate + $offset; 
     568 
     569                $date_msg = gmdate("d/m/Y",$msgTimestamp); 
    565570                if (date("d/m/Y") == $date_msg) 
    566                         $return['udate'] = gmdate("H:i",$header->udate); 
     571                        $return['udate'] = gmdate("H:i",$msgTimestamp); 
    567572                else 
    568573                        $return['udate'] = $date_msg; 
    569574 
    570575                $return['msg_day'] = $date_msg; 
    571                 $return['msg_hour'] = gmdate("H:i",$header->udate); 
     576                $return['msg_hour'] = gmdate("H:i",$msgTimestamp); 
    572577 
    573578                if (date("d/m/Y") == $date_msg) //no dia 
    574579                { 
    575                         $return['fulldate'] = gmdate("d/m/Y H:i",$header->udate); 
    576                         $return['smalldate'] = gmdate("H:i",$header->udate); 
     580                        $return['fulldate'] = gmdate("d/m/Y H:i",$msgTimestamp); 
     581                        $return['smalldate'] = gmdate("H:i",$msgTimestamp); 
    577582 
    578583                        $timestamp_now = strtotime("now"); 
    579                         $timestamp_msg_time = $header->udate; 
    580                         // $timestamp_now is GMT and $timestamp_msg_time is MailDate TZ. 
     584                        $timestamp_msg_time = $msgTimestamp; 
     585                        // $timestamp_now and $timestamp_msg_time are GMT. 
    581586                        // The variable $timestamp_diff is calculated without MailDate TZ. 
    582                         $pdate = date_parse($header->MailDate); 
    583                         $timestamp_diff = $timestamp_now - $timestamp_msg_time  + ($pdate['zone']*(-60)); 
     587                        $timestamp_diff = $timestamp_now - $timestamp_msg_time; 
    584588 
    585589                        if (gmdate("H",$timestamp_diff) > 0) 
     
    601605                } 
    602606                else{ 
    603                         $return['fulldate'] = gmdate("d/m/Y H:i",$header->udate); 
    604                         $return['smalldate'] = gmdate("d/m/Y",$header->udate); 
     607                        $return['fulldate'] = gmdate("d/m/Y H:i",$msgTimestamp); 
     608                        $return['smalldate'] = gmdate("d/m/Y",$msgTimestamp); 
    605609                } 
    606610 
     
    16201624                $return['new_msgs'] = imap_num_recent($this->mbox); 
    16211625                $return['msgs_to_delete'] = $msg_to_delete; 
     1626                $return['offsetToGMT'] = $this->functions->CalculateDateOffset(); 
    16221627                if($this->mbox && is_resource($this->mbox)) 
    16231628                        imap_close($this->mbox); 
     
    32933298                } 
    32943299 
     3300                $offsetToGMT = $this->functions->CalculateDateOffset(); 
     3301 
    32953302                if($search){ 
    32963303                        $search_criteria = ''; 
     
    34593466                if($header->from[0]->personal != "") 
    34603467                        $from = $header->from[0]->personal; 
    3461                 $ret_msg = $this->decode_string($from) . "--" . $subject . "--". gmdate("d/m/Y",$header ->udate)."--". $this->size_msg($header->Size) ."--". $flag; 
     3468                $ret_msg = $this->decode_string($from) . "--" . $subject . "--". gmdate("d/m/Y",$header ->udate + $this->functions->CalculateDateOffset())."--". $this->size_msg($header->Size) ."--". $flag; 
    34623469                return $ret_msg; 
    34633470        } 
     
    37063713        } 
    37073714        function get_header($msg_number){ 
    3708                 $header = @imap_headerinfo($this->mbox, imap_msgno($this->mbox, $msg_number), 80, 255); 
     3715                $header = @imap_headerinfo($this->mbox, imap_msgno($this->mbox, $msg_number), 80, 255); 
    37093716                if (!is_object($header)) 
    37103717                        return false; 
    3711                 // Prepare udate from mailDate (DateTime arrived with TZ) for fixing summertime problem. 
    3712                 $header->udate_original = $header->udate; 
    3713                 $pdate = date_parse($header->MailDate); 
    3714                 $header->udate +=  $pdate['zone']*(-60); 
    37153718 
    37163719                if($header->Flagged != "F" && $_SESSION['phpgw_info']['user']['preferences']['expressoMail']['use_important_flag']) { 
Note: See TracChangeset for help on using the changeset viewer.