Changeset 3923
- Timestamp:
- 03/28/11 15:09:35 (13 years ago)
- Location:
- branches/2.2
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2.2/expressoMail1_2/inc/class.imap_functions.inc.php
r3922 r3923 210 210 $head_array['msg_number'] = $msg_number; 211 211 $head_array['udate'] = $header->udate; 212 $head_array['offsetToGMT'] = $this->functions->CalculateDateOffset(); 213 214 $msgTimestamp = $header->udate + $head_array['offsetToGMT']; 212 $head_array['offsetToGMT'] = $this->functions->CalculateDateOffset(); 213 214 $msgTimestamp = $header->udate + $head_array['offsetToGMT']; 215 $head_array['timestamp'] = $msgTimestamp; 216 215 217 $date_msg = gmdate("d/m/Y",$msgTimestamp); 216 218 // if (date("d/m/Y") == $date_msg) … … 3289 3291 return $return; 3290 3292 } 3291 3292 3293 3294 3293 3295 function mobile_search($params) 3294 3296 { … … 3306 3308 $folders = array(0=>array('folder_id'=>$params['folder'])); 3307 3309 $num_msgs = 0; 3308 $max_msgs = $params['max_msgs']; 3309 $return["total_msgs"] = 0; 3310 $max_msgs = $params['max_msgs'] + 1; //get one more because mobile paginate 3311 $return["msgs"] = array(); 3312 3313 //get max_msgs of each folder order by date and later order all messages together and retur only max_msgs msgs 3310 3314 foreach($folders as $id =>$folder) 3311 3315 { 3312 3316 if(strpos($folder['folder_id'],'user')===false && is_array($folder)) { 3313 3317 foreach($criterias as $criteria_fixed) 3314 { 3315 $_filter = $criteria_fixed . ' "'.$params['filter'].'"'; 3318 { 3319 $_filter = $criteria_fixed . ' "'.$params['filter'].'"'; 3320 3316 3321 $mbox_stream = $this->open_mbox($folder['folder_id']); 3317 3318 $messages = imap_s earch($mbox_stream, $_filter, SE_UID);3322 3323 $messages = imap_sort($mbox_stream,SORTARRIVAL,1,SE_UID,$_filter); 3319 3324 3320 3325 if ($messages == ''){ … … 3323 3328 continue; 3324 3329 } 3325 3330 3326 3331 foreach($messages as $msg_number) 3327 { 3328 if($num_msgs>=$max_msgs) 3329 break; 3332 { 3330 3333 $temp = $this->get_info_head_msg($msg_number); 3331 3334 if(!$temp) 3332 3335 return false; 3333 3336 $temp['msg_folder'] = $folder['folder_id']; 3334 $return[ $num_msgs] = $temp;3337 $return["msgs"][$num_msgs] = $temp; 3335 3338 $num_msgs++; 3336 3337 3339 } 3338 $return['num_msgs'] = $num_msgs; 3339 $return["total_msgs"]+=count($messages); 3340 3340 3341 if($mbox_stream) 3341 3342 imap_close($mbox_stream); 3342 if($num_msgs>=$max_msgs) 3343 continue; 3344 } 3345 } 3346 } 3343 } 3344 } 3345 } 3346 3347 if(!function_exists("cmp_date")) { 3348 function cmp_date($obj1, $obj2){ 3349 if($obj1['timestamp'] == $obj2['timestamp']) return 0; 3350 return ($obj1['timestamp'] < $obj2['timestamp']) ? 1 : -1; 3351 } 3352 } 3353 usort($return["msgs"], "cmp_date"); 3354 $return["has_more_msg"] = (sizeof($return["msgs"]) > $max_msgs); 3355 $return["msgs"] = array_slice($return["msgs"], 0, $max_msgs); 3356 3347 3357 return $return; 3348 3358 } -
branches/2.2/mobile/inc/class.common_functions.inc.php
r3609 r3923 1 1 <?php 2 3 4 5 6 7 8 9 10 11 2 /**************************************************************************\ 3 * eGroupWare * 4 * http://www.egroupware.org * 5 * The file written by Mário César Kolling <mario.kolling@serpro.gov.br> * 6 * -------------------------------------------- * 7 * This program is free software; you can redistribute it and/or modify it * 8 * under the terms of the GNU General Public License as published by the * 9 * Free Software Foundation; either version 2 of the License, or (at your * 10 * option) any later version. * 11 \**************************************************************************/ 12 12 13 class common_functions 13 class common_functions 14 { 15 function borkb($size, $enclosed = NULL) 14 16 { 15 function borkb($size, $enclosed = NULL) 16 { 17 if (!$size) 17 if (!$size) 18 18 $size = 0; 19 20 if ($enclosed) 21 { 22 $left = '('; 23 $right = ')'; 19 20 if ($enclosed) 21 { 22 $left = '('; 23 $right = ')'; 24 } 25 26 if ($size < 1024) 27 $rstring = $left . $size . ' B' . $right; 28 else if ($size < 1048576) 29 $rstring = $left . round($size/1024) . ' KB' . $right; 30 else if ($size < 1073741824) 31 $rstring = $left . round($size/1024/1024) . ' MB' . $right; 32 else 33 $rstring = $left . round($size/1024/1024/1024) . ' GB' . $right; 34 35 return $rstring; 36 } 37 38 function complete_string($str = "", $length = 10, $align = "R", $char = " ") { 39 if( $str == null ) 40 $str = ""; 41 else 42 if( strlen($str) > $length ) { 43 return substr($str, 0, $length); 44 } else if( strlen($str) == $length ) { 45 return $str; 46 } 47 48 $char = substr($char, 0, 1); 49 $complete_str = ""; 50 51 while( strlen($str) + strlen($complete_str) < $length ) 52 $complete_str .= $char; 53 54 if( $align == "L" ) 55 return $str . $complete_str; 56 else 57 return $complete_str . $str; 58 } 59 60 function strach_string($string,$size) { 61 return strlen($string)>$size ? substr($string,0,$size)."...": 62 $string; 63 } 64 65 /** 66 * Fixes the odd indexing of multiple file uploads from the format: 67 * 68 * $_FILES['field']['key']['index'] 69 * 70 * To the more standard and appropriate: 71 * 72 * $_FILES['field']['index']['key'] 73 * 74 * @param array $files 75 * @author Corey Ballou 76 * @link http://www.jqueryin.com 77 */ 78 function fixFilesArray(&$files) 79 { 80 $names = array( 'name' => 1, 'type' => 1, 'tmp_name' => 1, 'error' => 1, 'size' => 1); 81 82 foreach ($files as $key => $part) { 83 // only deal with valid keys and multiple files 84 $key = (string) $key; 85 if (isset($names[$key]) && is_array($part)) { 86 foreach ($part as $position => $value) { 87 $files[$position][$key] = $value; 88 } 89 // remove old key reference 90 unset($files[$key]); 24 91 } 25 26 if ($size < 1024)27 $rstring = $left . $size . ' B' . $right;28 else if ($size < 1048576)29 $rstring = $left . round($size/1024) . ' KB' . $right;30 else if ($size < 1073741824)31 $rstring = $left . round($size/1024/1024) . ' MB' . $right;32 else33 $rstring = $left . round($size/1024/1024/1024) . ' GB' . $right;34 35 return $rstring;36 92 } 37 38 function complete_string($str = "", $length = 10, $align = "R", $char = " ") { 39 if( $str == null ) 40 $str = ""; 41 else 42 if( strlen($str) > $length ) { 43 return substr($str, 0, $length); 44 } else if( strlen($str) == $length ) { 45 return $str; 46 } 47 48 $char = substr($char, 0, 1); 49 $complete_str = ""; 50 51 while( strlen($str) + strlen($complete_str) < $length ) 52 $complete_str .= $char; 53 54 if( $align == "L" ) 55 return $str . $complete_str; 56 else 57 return $complete_str . $str; 58 } 59 60 function strach_string($string,$size) { 61 return strlen($string)>$size ? substr($string,0,$size)."...": 62 $string; 63 } 64 65 /** 66 * Fixes the odd indexing of multiple file uploads from the format: 67 * 68 * $_FILES['field']['key']['index'] 69 * 70 * To the more standard and appropriate: 71 * 72 * $_FILES['field']['index']['key'] 73 * 74 * @param array $files 75 * @author Corey Ballou 76 * @link http://www.jqueryin.com 77 */ 78 function fixFilesArray(&$files) 79 { 80 $names = array( 'name' => 1, 'type' => 1, 'tmp_name' => 1, 'error' => 1, 'size' => 1); 81 82 foreach ($files as $key => $part) { 83 // only deal with valid keys and multiple files 84 $key = (string) $key; 85 if (isset($names[$key]) && is_array($part)) { 86 foreach ($part as $position => $value) { 87 $files[$position][$key] = $value; 88 } 89 // remove old key reference 90 unset($files[$key]); 91 } 92 } 93 } 94 95 } //end common class 96 93 } 94 95 } //end common class 96 97 97 98 98 ?> -
branches/2.2/mobile/inc/class.ui_home.inc.php
r3829 r3923 232 232 $p->set_var('next_max_msgs',$mail_params['max_msgs']+10); 233 233 $p->set_var('max_msgs',$mail_params['max_msgs']); 234 234 235 235 $messages = $imap_functions->mobile_search($mail_params); 236 if($mail_params['max_msgs']>=$messages["total_msgs"]) 236 if($messages["has_more_msg"]) 237 $p->set_var('show_more_messages',"block"); 238 else 237 239 $p->set_var('show_more_messages',"none"); 238 else 239 $p->set_var('show_more_messages',"block"); 240 $p->set_var('mails',$ui_mobilemail->print_mails_list($messages)); 240 $p->set_var('mails',$ui_mobilemail->print_mails_list($messages['msgs'])); 241 241 } 242 242 else { -
branches/2.2/mobile/inc/class.ui_mobilemail.inc.php
r3907 r3923 502 502 foreach($messages as $id => $message) { 503 503 504 if(($id==='num_msgs') ||($id==='total_msgs') )504 if(($id==='num_msgs') ||($id==='total_msgs') || ($id==='has_more_msg')) 505 505 continue; 506 506 if($message['from']['name'])
Note: See TracChangeset
for help on using the changeset viewer.