Changeset 2761 for trunk/expressoMail1_2/inc
- Timestamp:
- 05/12/10 17:11:46 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/expressoMail1_2/inc/class.imap_functions.inc.php
r2747 r2761 3309 3309 3310 3310 function search_msg($params = ''){ 3311 $retorno = "";3312 3311 $mbox_stream = ""; 3313 3312 if(strpos($params['condition'],"#")===false) { //local messages … … 3374 3373 } 3375 3374 3376 if (preg_match("/^.?\bALL\b/", $filter)) 3377 { // Quick Search, note: this ALL isn't the same ALL from imap_search 3378 3379 $all_criterias = array ("TO","SUBJECT","FROM","CC"); 3380 foreach($all_criterias as $criteria_fixed) 3381 { 3382 $_filter = $criteria_fixed . substr($filter,4); 3383 3384 $search_criteria = imap_search($mbox_stream, $_filter, SE_UID); 3385 3386 if($search_criteria) //&& count($search_criteria) < 50) 3387 { 3388 foreach($search_criteria as $new_search) 3389 { 3390 if ($search_result_number != '65536' && $sum == $search_result_number) 3391 { 3392 return $retorno ? $sum . "=sumResults=" . $retorno : "none"; 3393 } 3394 3395 $m_token = trim("##".mb_convert_encoding( $name_box, "ISO_8859-1", "UTF7-IMAP" ) . "--" . $this->get_msg($new_search,$name_box,$mbox_stream) . "--".$new_search."##"."\n"); 3396 if(!@strstr($retorno,$m_token)) 3397 { 3398 $retorno .= $m_token; 3399 $sum ++; 3400 } 3401 } 3402 } 3403 } 3404 } 3405 else { 3406 $search_criteria = imap_search($mbox_stream, $filter, SE_UID); 3407 if( is_array( $search_criteria) ) 3408 { 3409 foreach($search_criteria as $new_search) 3410 { 3411 if ($search_result_number != '65536' && $sum == $search_result_number) 3412 { 3413 return $retorno ? $sum . "=sumResults=" . $retorno : "none"; 3414 } 3415 $retorno .= trim("##".mb_convert_encoding( $name_box, "ISO_8859-1", "UTF7-IMAP" ) . "--" . $this->get_msg($new_search,$name_box,$mbox_stream) . "--" . $new_search."##"."\n"); 3416 $sum++; 3417 } 3418 } 3419 } 3420 } 3421 } 3375 if (preg_match("/^.?\bALL\b/", $filter)) 3376 { // Quick Search, note: this ALL isn't the same ALL from imap_search 3377 3378 $all_criterias = array ("TO","SUBJECT","FROM","CC"); 3379 foreach($all_criterias as $criteria_fixed) 3380 { 3381 $_filter = $criteria_fixed . substr($filter,4); 3382 3383 $search_criteria = imap_search($mbox_stream, $_filter, SE_UID); 3384 3385 if($search_criteria) //&& count($search_criteria) < 50) 3386 { 3387 foreach($search_criteria as $new_search) 3388 { 3389 if ($search_result_number != '65536' && $sum == $search_result_number) 3390 { 3391 return $retorno['sum'] = $sum; 3392 } 3393 $elem = $this->get_msg_detail($new_search,$name_box,$mbox_stream); 3394 $elem['boxname'] = mb_convert_encoding( $name_box, "ISO_8859-1", "UTF7-IMAP" ); 3395 $elem['uid'] = $new_search; 3396 $retorno[] = $elem; 3397 $sum ++; 3398 3399 } 3400 } 3401 } 3402 } 3403 else { 3404 $search_criteria = imap_search($mbox_stream, $filter, SE_UID); 3405 if( is_array( $search_criteria) ) 3406 { 3407 foreach($search_criteria as $new_search) 3408 { 3409 if ($search_result_number != '65536' && $sum == $search_result_number) 3410 { 3411 return $retorno['sum'] = $sum; 3412 } 3413 $elem = $this->get_msg_detail($new_search,$name_box,$mbox_stream); 3414 $elem['boxname'] = mb_convert_encoding( $name_box, "ISO_8859-1", "UTF7-IMAP" ); 3415 $elem['uid'] = $new_search; 3416 $retorno[] = $elem; 3417 $sum++; 3418 } 3419 } 3420 } 3421 } 3422 } 3422 3423 if($mbox_stream) 3423 3424 { … … 3435 3436 } 3436 3437 3437 function get_msg ($uid_msg,$name_box, $mbox_stream )3438 function get_msg_detail($uid_msg,$name_box, $mbox_stream ) 3438 3439 { 3439 3440 $header = $this->get_header($uid_msg); 3440 include_once("class.imap_attachment.inc.php");3441 require_once("class.imap_attachment.inc.php"); 3441 3442 $imap_attachment = new imap_attachment(); 3442 3443 $attachments = $imap_attachment->get_attachment_headerinfo($mbox_stream, $uid_msg); … … 3455 3456 if($header->from[0]->personal != "") 3456 3457 $from = $header->from[0]->personal; 3457 $ret_msg = $this->decode_string($from) . "--" . $subject . "--". gmdate("d/m/Y",$header ->udate)."--". $this->size_msg($header->Size) ."--". $flag; 3458 $ret_msg['from'] = $this->decode_string($from); 3459 $ret_msg['subject'] = $subject; 3460 $ret_msg['udate'] = $header ->udate; 3461 $ret_msg['size'] = $header->Size; 3462 $ret_msg['flag'] = $flag; 3458 3463 return $ret_msg; 3459 }3460 3461 function size_msg($size){3462 $var = floor($size/1024);3463 if($var >= 1){3464 return $var." kb";3465 }else{3466 return $size ." b";3467 }3468 3464 } 3469 3465
Note: See TracChangeset
for help on using the changeset viewer.