Changeset 3493
- Timestamp:
- 11/10/10 16:07:09 (13 years ago)
- Location:
- branches/2.2/expressoMail1_2
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2.2/expressoMail1_2/inc/class.functions.inc.php
r3018 r3493 1 1 <?php 2 2 class Functions{ 3 4 // get the offset against GMT. 5 function CalculateDateOffset() 6 { 7 8 $timezone_index = $_SESSION['phpgw_info']['user']['preferences']['expressoMail']['timezone']; 9 $zones = $this->getTimezones(); 10 $user_timezone = $zones[$timezone_index]; 11 $tz = new DateTimeZone($user_timezone); 12 $gmt = new DateTimeZone("Etc/GMT+0"); 13 $gmttime = new DateTime("now", $gmt); 14 $offset = $tz->getOffset($gmttime); 15 return $offset; 16 17 } 18 19 function getTimezones() 20 { 21 $zones = timezone_identifiers_list(); 22 $friendly_zones = array(); 23 foreach ($zones as $zone) 24 { 25 if (preg_match("/^(Africa|America|Antarctica|Arctic|Asia|Atlantic|Australia|Europe|Indian|Pacific)\/.*$/", $zone)) 26 { 27 array_push($friendly_zones, $zone); 28 } 29 30 } 31 return $friendly_zones; 32 } 33 3 34 function CallVoipConnect($params){ 4 35 $fromNumber = $_SESSION['phpgw_info']['user']['preferences']['expressoMail']['telephone_number']; -
branches/2.2/expressoMail1_2/inc/class.imap_functions.inc.php
r3427 r3493 109 109 $search_box_type = $params['search_box_type'] != "ALL" && $params['search_box_type'] != "" ? $params['search_box_type'] : false; 110 110 111 111 if(!$this->mbox || !is_resource($this->mbox)) 112 112 $this->mbox = $this->open_mbox($folder); 113 113 114 114 $return = array(); 115 // Para enviar o offset entre o timezone definido pelo usuário e GMT 116 $return['offsetToGMT'] = $this->functions->CalculateDateOffset(); 115 117 116 118 if(!$search_box_type || $search_box_type=="UNSEEN" || $search_box_type=="SEEN") { … … 531 533 //return $return; 532 534 }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']; 537 539 } 538 540 … … 562 564 $return['msg_folder'] = $msg_folder; 563 565 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); 565 570 if (date("d/m/Y") == $date_msg) 566 $return['udate'] = gmdate("H:i",$ header->udate);571 $return['udate'] = gmdate("H:i",$msgTimestamp); 567 572 else 568 573 $return['udate'] = $date_msg; 569 574 570 575 $return['msg_day'] = $date_msg; 571 $return['msg_hour'] = gmdate("H:i",$ header->udate);576 $return['msg_hour'] = gmdate("H:i",$msgTimestamp); 572 577 573 578 if (date("d/m/Y") == $date_msg) //no dia 574 579 { 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); 577 582 578 583 $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. 581 586 // 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; 584 588 585 589 if (gmdate("H",$timestamp_diff) > 0) … … 601 605 } 602 606 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); 605 609 } 606 610 … … 1620 1624 $return['new_msgs'] = imap_num_recent($this->mbox); 1621 1625 $return['msgs_to_delete'] = $msg_to_delete; 1626 $return['offsetToGMT'] = $this->functions->CalculateDateOffset(); 1622 1627 if($this->mbox && is_resource($this->mbox)) 1623 1628 imap_close($this->mbox); … … 3293 3298 } 3294 3299 3300 $offsetToGMT = $this->functions->CalculateDateOffset(); 3301 3295 3302 if($search){ 3296 3303 $search_criteria = ''; … … 3459 3466 if($header->from[0]->personal != "") 3460 3467 $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; 3462 3469 return $ret_msg; 3463 3470 } … … 3706 3713 } 3707 3714 function get_header($msg_number){ 3708 3715 $header = @imap_headerinfo($this->mbox, imap_msgno($this->mbox, $msg_number), 80, 255); 3709 3716 if (!is_object($header)) 3710 3717 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);3715 3718 3716 3719 if($header->Flagged != "F" && $_SESSION['phpgw_info']['user']['preferences']['expressoMail']['use_important_flag']) { -
branches/2.2/expressoMail1_2/inc/hook_settings.inc.php
r3414 r3493 20 20 \**************************************************************************/ 21 21 include_once("fckeditor.php"); 22 include_once("class.functions.inc.php"); 22 23 $type = isset($_GET['type']) ? $_GET['type']:$GLOBALS['type']; // FIX ME 23 24 … … 211 212 create_check_box('Use shortcuts?','use_shortcuts','n key (Open new message)<br>ESC key (Close tab)<br>i key (print)<br>e key (forward)<br>r key (reply)<br>DELETE key (delete the current message)<br>Ctrl + up (go to previous message)<br>Ctrl + down (go to next message)<br>Shift + up or down (select multiple messages)<br>F9 key (search at catalog)<br>'); 212 213 create_check_box('Auto save draft','auto_save_draft','When you are away from computer it saves automatically the message you are writing'); 214 215 unset($default); 216 $functions = new functions(); 217 $zones = $functions->getTimezones(); 218 $default = array(sprintf("%s", array_search('America/Sao_Paulo', $zones)) => 'America/Sao_Paulo'); 219 create_select_box('What is your timezone?', 'timezone', $zones, 'The Timezone you\'re in.', $default); 220 213 221 $default = array( 214 222 '65536' => lang('unlimited'), -
branches/2.2/expressoMail1_2/index.php
r3414 r3493 76 76 $_SESSION['phpgw_info']['user']['preferences']['expressoMail']['number_of_contacts'] = $current_config['expressoMail_Number_of_dynamic_contacts'] ? $current_config['expressoMail_Number_of_dynamic_contacts'] : "0"; 77 77 $_SESSION['phpgw_info']['user']['preferences']['expressoMail']['notification_domains'] = $current_config['expressoMail_notification_domains']; 78 $_SESSION['phpgw_info']['user']['preferences']['expressoMail']['googlegears_url'] = $current_config['expressoMail_googlegears_url']; 78 $_SESSION['phpgw_info']['user']['preferences']['expressoMail']['googlegears_url'] = $current_config['expressoMail_googlegears_url']; 79 79 $_SESSION['phpgw_info']['user']['preferences']['expressoMail']['use_assinar_criptografar'] = $GLOBALS['phpgw_info']['server']['use_assinar_criptografar'] ? $GLOBALS['phpgw_info']['server']['use_assinar_criptografar'] : "0"; 80 80 $_SESSION['phpgw_info']['user']['preferences']['expressoMail']['use_signature_digital_cripto'] = $GLOBALS['phpgw_info']['user']['preferences']['expressoMail']['use_signature_digital_cripto'] ? $GLOBALS['phpgw_info']['user']['preferences']['expressoMail']['use_signature_digital_cripto'] : "0"; … … 178 178 179 179 $obj = createobject("expressoMail1_2.functions"); 180 181 // setting timezone preference 182 $zones = $obj->getTimezones(); 183 $_SESSION['phpgw_info']['user']['preferences']['expressoMail']['timezone'] = $GLOBALS['phpgw_info']['user']['preferences']['expressoMail']['timezone'] ? $GLOBALS['phpgw_info']['user']['preferences']['expressoMail']['timezone'] : sprintf("%s", array_search("America/Sao_Paulo", $zones)); 184 180 185 // este arquivo deve ser carregado antes que 181 186 // os demais pois nele contem a função get_lang 182 187 // que é utilizada em diversas partes 183 188 echo $obj -> getFilesJs("js/common_functions.js"); 184 include("inc/load_lang.php"); 185 186 189 include("inc/load_lang.php"); 190 191 // INCLUDE these JS Files: 187 192 if ($_SESSION['phpgw_info']['user']['preferences']['expressoMail']['use_local_messages']) 188 193 echo "<script src='js/gears_init.js'></script>"; -
branches/2.2/expressoMail1_2/js/draw_api.js
r3459 r3493 789 789 tbody_element.appendChild(td_info); 790 790 } 791 792 793 791 for (var i=0; i < headers_msgs.length; i++){ 794 792 if ((headers_msgs[i].Unseen == 'U') || (headers_msgs[i].Recent == 'N')) 795 793 f_unseen++; 796 tr_element = make_tr_message(headers_msgs[i], msg_folder);794 tr_element = make_tr_message(headers_msgs[i], msg_folder, headers_msgs.offsetToGMT); 797 795 if (tr_element){ 798 796 tbody_element.appendChild(tr_element); … … 838 836 } 839 837 840 function make_tr_message(headers_msgs, msg_folder){ 838 // Passar o parâmetro offset para esta função 839 function make_tr_message(headers_msgs, msg_folder, offsetToGMT){ 840 if (typeof offsetToGMT == 'undefined') 841 { 842 offsetToGMT = 0; 843 } 841 844 var tr_element = document.createElement('tr'); 842 845 if(typeof(preferences.line_height) != 'undefined') … … 1052 1055 var norm = function (arg) {return (arg < 10 ? '0'+arg : arg);}; 1053 1056 var weekDays = ['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday']; 1054 var date_msg = new Date(headers_msgs.udate*1000); 1055 1057 1058 var today = new Date(); 1056 1059 today.setHours(0); 1057 1060 today.setMinutes(0); 1058 if (today.getTime() - date_msg.getTime() < 86400000) 1061 1062 // Using offset between user defined timezone and GMT 1063 // Date object converts time to local timezone, so we have to adjust it 1064 var udate_local = headers_msgs.udate*1000 + offsetToGMT*1000 + today.getTimezoneOffset()*60*1000; 1065 var date_msg = new Date(udate_local); 1066 1067 if (today.getTime() - date_msg.getTime() < 86400000) 1059 1068 td_element5.innerHTML = norm(date_msg.getHours()) + ':' + norm(date_msg.getMinutes()); 1060 1069 else … … 2891 2900 var tbody = Element('tbody_box'); 2892 2901 for (var i=0; i<(headers_msgs.length); i++){ 2902 // passa parâmetro offset 2893 2903 var tr = this.make_tr_message(headers_msgs[i], headers_msgs[i].msg_folder); 2894 2904 if (tr) -
branches/2.2/expressoMail1_2/js/main.js
r3427 r3493 433 433 if (!existent) 434 434 { 435 var new_msg = this.make_tr_message(data[i], current_folder );435 var new_msg = this.make_tr_message(data[i], current_folder, data.offsetToGMT); 436 436 _dragArea.makeDragged(new_msg, data[i].msg_number, data[i].subject, true); 437 437 if (data[i].Recent == 'N') -
branches/2.2/expressoMail1_2/setup/phpgw_en.lang
r3441 r3493 362 362 The size of the message is expressoMail1_2 en The size of the message is 363 363 The size of this message has exceeded the limit (%1B). expressoMail1_2 en The size of this message has exceeded the limit (%1B). 364 The Timezone you're in. expressoMail1_2 en The Timezone you're in. 364 365 This mail box is empty expressoMail1_2 en This mail box is empty. 365 366 This message is already opened! expressoMail1_2 en This message is already opened! … … 399 400 What is the maximum number of results in an e-mail search? expressoMail1_2 en What is the maximum number of results in an e-mail search? 400 401 What is the minimum number of characters in searching contacts? expressoMail1_2 en What is the minimum number of characters in searching contacts? 402 What is your timezone? expressoMail1_2 en What is your timezone? 401 403 Who expressoMail1_2 en Who 402 404 With all expressoMail1_2 en With all -
branches/2.2/expressoMail1_2/setup/phpgw_pt-br.lang
r3441 r3493 506 506 The size of the message is expressoMail1_2 pt-br O tamanho da mensagem seja 507 507 The size of this message has exceeded the limit (%1B). expressoMail1_2 pt-br O tamanho desta mensagem excedeu o limite (maior que %1B). 508 The Timezone you're in. expressoMail1_2 pt-br O fuso-horário em que você está. 508 509 This is the number of messages shown in your mailbox per page expressoMail1_2 pt-br Este é o número de mensagens mostradas na sua caixa de correio por página 509 510 This list has no participants expressoMail1_2 pt-br Esta lista nao possui nenhum participante. … … 556 557 What is the maximum size of embedded images? expressoMail1_2 pt-br Qual o tamanho máximo das imagens inseridas nos emails? 557 558 What is the minimum number of characters in searching contacts? expressoMail1_2 pt-br Qual é o número mínimo de caracteres ao pesquisar contatos? 559 What is your timezone? expressoMail1_2 pt-br Qual o seu fuso-horário? 558 560 When delete message, send it automatically to trash folder expressoMail1_2 pt-br Ao excluir um mensagem, mover automaticamente esta mensagem para a pasta lixeira 559 561 When user send an email with image in body message, it changes the size expressoMail1_2 pt-br Quando o usuário envia um e-mail com a imagem no corpo da mensagem, ela muda o tamanho
Note: See TracChangeset
for help on using the changeset viewer.