Changeset 5388


Ignore:
Timestamp:
01/17/12 17:18:42 (12 years ago)
Author:
gustavo
Message:

Ticket #2434 - correcao na importacaode eventos via expressoMail para a nova agenda

File:
1 edited

Legend:

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

    r5380 r5388  
    363363         
    364364        function import_vcard($params){ 
    365                          
    366                 include_once('class.imap_functions.inc.php'); 
    367                 $objImap = new imap_functions(); 
    368                 $msg_number = $params['msg_number']; 
    369                 $idx_file = $params['idx_file']; 
    370                 $msg_part = $params['msg_part']; 
    371                 $msg_folder = $params['msg_folder']; 
     365            include_once('class.imap_functions.inc.php'); 
     366            $objImap = new imap_functions(); 
     367            $msg_number = $params['msg_number']; 
     368            $idx_file = $params['idx_file']; 
     369            $msg_part = $params['msg_part']; 
     370            $msg_folder = $params['msg_folder']; 
    372371            $from_ajax = $params['from_ajax']; 
    373                 $encoding = strtolower($params['encoding']); 
    374                 $fileContent = ""; 
     372            $encoding = strtolower($params['encoding']); 
     373            $fileContent = ""; 
    375374            $cirus_delimiter = $params['cirus_delimiter']; 
    376375            $expFolder = explode($cirus_delimiter, $msg_folder); 
     
    378377            if($msg_number != null && $msg_part != null && $msg_folder != null && (intval($idx_file == '0' ? '1' : $idx_file))) 
    379378            { 
    380                 require_once dirname(__FILE__).'/class.attachment.inc.php'; 
     379                require_once PHPGW_INCLUDE_ROOT.'/expressoMail1_2/inc/class.attachment.inc.php'; 
    381380                $attachmentObj = new attachment(); 
    382381                $attachmentObj->setStructureFromMail($msg_folder,$msg_number); 
     
    384383                $info = $attachmentObj->getAttachmentInfo($msg_part); 
    385384                $filename = $info['name']; 
    386                 } 
    387                 else 
    388                         $filename = $idx_file; 
    389                                          
    390                 // It's necessary to access calendar method.  
     385            } 
     386            else 
     387                    $filename = $idx_file; 
     388                     
     389            // It's necessary to access calendar method. 
    391390            $GLOBALS['phpgw_info']['flags']['noappheader'] = True; 
    392391            $GLOBALS['phpgw_info']['flags']['noappfooter'] = True; 
    393392            $GLOBALS['phpgw_info']['flags']['currentapp'] = 'calendar'; 
    394                 include_once(PHPGW_INCLUDE_ROOT.'/header.inc.php');  
    395                 $uiicalendar = CreateObject("calendar.uiicalendar"); 
    396  
     393            include_once(PHPGW_INCLUDE_ROOT.'/header.inc.php'); 
     394            $uiicalendar = CreateObject("calendar.uiicalendar"); 
     395                        if($params['selected'] || $params['readable']){ 
     396                                $_REQUEST['data'] = $fileContent; 
     397                                $_REQUEST['type'] = 'iCal'; 
     398                                $_REQUEST['params']['calendar'] = $params['selected']; 
     399                                $_REQUEST['readable'] = $params['readable'] ? true : false; 
     400                                $_REQUEST['params']['status'] = $params['status']; 
     401                                $_REQUEST['params']['owner'] = $_SESSION['phpgw_info']['expressomail']['user']['account_id']; 
     402                                ob_start(); 
     403                                include_once(PHPGW_INCLUDE_ROOT.'/prototype/converter.php'); 
     404                                $output = ob_get_clean();                        
     405                                $valid = json_decode($output, true); 
     406 
     407 
     408                                if($_REQUEST['readable']){       
     409                                        if(!$valid) 
     410                                        { 
     411                                                $return = false; 
     412                                                $output = unserialize($output); 
     413                                                foreach($output[0] as $key => $value){ 
     414                                                        if(array_key_exists("id",$output[0][$key])) 
     415                                                                $return = true; 
     416                                                } 
     417                                                return $return; 
     418                                        } 
     419                                        return false; 
     420                                } 
     421 
     422                                if(empty($valid)) 
     423                                        return "error";  
     424                                return "ok"; 
     425                        } 
    397426            if(strtoupper($expFolder[0]) == 'USER' && $expFolder[1]) // IF se a conta o ical estiver em uma conta compartilhada 
    398427            { 
     
    407436            else 
    408437                return $uiicalendar->import_from_mail($fileContent, $from_ajax); 
    409              
    410              
     438 
    411439        } 
    412440 
Note: See TracChangeset for help on using the changeset viewer.