function getForwardingAttachment($folder, $uid, $part, $rfc_822bodies = true, $info = true) { include_once dirname(__FILE__) . '/class.attachment.inc.php'; $attachment = new attachment(); $attachment->decodeConf['rfc_822bodies'] = $rfc_822bodies; //Forçar a não decodificação de mensagens em anexo. $folder = urldecode($folder); $attachment->setStructureFromMail($folder, $uid); if ($info === true) { $return = $attachment->getAttachmentInfo($part); $return['source'] = $attachment->getAttachment($part); return $return; } return $attachment->getAttachment($part); }
function import_vcard($params) { include_once 'class.imap_functions.inc.php'; $objImap = new imap_functions(); $msg_number = $params['msg_number']; $idx_file = $params['idx_file']; $msg_part = $params['msg_part']; $msg_folder = $params['msg_folder']; $from_ajax = $params['from_ajax']; $encoding = strtolower($params['encoding']); $fileContent = ""; $cirus_delimiter = $params['cirus_delimiter']; $expFolder = explode($cirus_delimiter, $msg_folder); if ($msg_number != null && $msg_part != null && $msg_folder != null && intval($idx_file == '0' ? '1' : $idx_file)) { require_once PHPGW_INCLUDE_ROOT . '/expressoMail/inc/class.attachment.inc.php'; $attachmentObj = new attachment(); $attachmentObj->setStructureFromMail($msg_folder, $msg_number); $fileContent = $attachmentObj->getAttachment($msg_part); $info = $attachmentObj->getAttachmentInfo($msg_part); $filename = $info['name']; } else { $filename = $idx_file; } // It's necessary to access calendar method. $GLOBALS['phpgw_info']['flags']['noappheader'] = True; $GLOBALS['phpgw_info']['flags']['noappfooter'] = True; $GLOBALS['phpgw_info']['flags']['currentapp'] = 'calendar'; if (isset($params['selected']) || isset($params['readable'])) { $_REQUEST['data'] = $fileContent; $_REQUEST['type'] = 'iCal'; $_REQUEST['params']['calendar'] = isset($params['selected']) ? $params['selected'] : false; $_REQUEST['readable'] = isset($params['readable']) && $params['readable'] ? true : false; $_REQUEST['analize'] = isset($params['analize']) ? true : false; $_REQUEST['params']['status'] = isset($params['status']) ? $params['status'] : false; $_REQUEST['params']['owner'] = $params['uidAccount']; if (isset($params['acceptedSuggestion'])) { $_REQUEST['params']['acceptedSuggestion'] = $params['acceptedSuggestion']; $_REQUEST['params']['from'] = $params['from']; } ob_start(); include_once PHPGW_INCLUDE_ROOT . '/prototype/converter.php'; $output = ob_get_clean(); $valid = json_decode($output, true); if ($_REQUEST['readable']) { if (!is_array($valid)) { $output = unserialize($output); foreach ($output as $key => $value) { return $value; } } return false; } if (empty($output)) { return "error"; } return "ok"; } include_once PHPGW_INCLUDE_ROOT . '/header.inc.php'; $uiicalendar = CreateObject("calendar.uiicalendar"); if (strtoupper($expFolder[0]) == 'USER' && $expFolder[1]) { include_once 'class.ldap_functions.inc.php'; $ldap = new ldap_functions(); $account['uid'] = $expFolder[1]; $account['uidnumber'] = $ldap->uid2uidnumber($expFolder[1]); $account['mail'] = $ldap->getMailByUid($expFolder[1]); return $uiicalendar->import_from_mail($fileContent, $from_ajax, $account); } else { return $uiicalendar->import_from_mail($fileContent, $from_ajax); } }
} if ($num < 2097152) { return chr(($num >> 18) + 240) . chr(($num >> 12 & 63) + 128) . chr(($num >> 6 & 63) + 128) . chr(($num & 63) + 128); } return ''; } //-----------------------// /* * Main */ if ($msgNumber != 'null' && $indexPart !== null && $msgFolder) { require_once dirname(__FILE__) . '/class.attachment.inc.php'; $attachment = new attachment(); $attachment->setStructureFromMail($msgFolder, $msgNumber); $fileContent = $attachment->getAttachment($indexPart); $info = $attachment->getAttachmentInfo($indexPart); $filename = $newFilename ? $newFilename : $info['name']; $filename = unhtmlentities($filename); $messageId = $attachment->messageId; } else { if ($image && $_SESSION['phpgw_info']['expressomail']['contact_photo']) { $image = "thumbnail"; $photo = array('width' => 60, 'height' => 80, 'quality' => 100); $fileContent = $_SESSION['phpgw_info']['expressomail']['contact_photo'][0]; unset($_SESSION['phpgw_info']['expressomail']['contact_photo']); } $filename = $indexFile; } $filename = $filename ? $filename : "attachment.bin"; $newFilename = $newFilename ? $newFilename : $filename; $newFilename = unhtmlentities($newFilename);