本文整理汇总了PHP中mapi_openproperty函数的典型用法代码示例。如果您正苦于以下问题:PHP mapi_openproperty函数的具体用法?PHP mapi_openproperty怎么用?PHP mapi_openproperty使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了mapi_openproperty函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getFullRecurrenceBlob
function getFullRecurrenceBlob()
{
$message = mapi_msgstore_openentry($this->store, $this->messageprops[PR_ENTRYID]);
$recurrBlob = '';
$stream = mapi_openproperty($message, $this->proptags["recurring_data"], IID_IStream, 0, 0);
$stat = mapi_stream_stat($stream);
for ($i = 0; $i < $stat['cb']; $i += 1024) {
$recurrBlob .= mapi_stream_read($stream, 1024);
}
if (!empty($recurrBlob)) {
$this->messageprops[$this->proptags["recurring_data"]] = $recurrBlob;
}
}
示例2: readPropStream
/**
* Reads data of large properties from a stream
*
* @param MAPIMessage $message
* @param long $prop
*
* @access public
* @return string
*/
public static function readPropStream($message, $prop)
{
$stream = mapi_openproperty($message, $prop, IID_IStream, 0, 0);
$ret = mapi_last_hresult();
if ($ret == MAPI_E_NOT_FOUND) {
ZLog::Write(LOGLEVEL_DEBUG, sprintf("MAPIUtils->readPropStream: property 0x%s not found. It is either empty or not set. It will be ignored.", str_pad(dechex($prop), 8, 0, STR_PAD_LEFT)));
return "";
} elseif ($ret) {
ZLog::Write(LOGLEVEL_ERROR, "MAPIUtils->readPropStream error opening stream: 0X%X", $ret);
return "";
}
$data = "";
$string = "";
while (1) {
$data = mapi_stream_read($stream, 1024);
if (strlen($data) == 0) {
break;
}
$string .= $data;
}
return $string;
}
示例3: ImportChangesICS
/**
* Constructor
*
* @param mapisession $session
* @param mapistore $store
* @param string $folderid (opt)
*
* @access public
* @throws StatusException
*/
public function ImportChangesICS($session, $store, $folderid = false)
{
$this->session = $session;
$this->store = $store;
$this->folderid = $folderid;
$this->conflictsLoaded = false;
if ($folderid) {
$entryid = mapi_msgstore_entryidfromsourcekey($store, $folderid);
} else {
$storeprops = mapi_getprops($store, array(PR_IPM_SUBTREE_ENTRYID));
$entryid = $storeprops[PR_IPM_SUBTREE_ENTRYID];
}
$folder = false;
if ($entryid) {
$folder = mapi_msgstore_openentry($store, $entryid);
}
if (!$folder) {
$this->importer = false;
// We throw an general error SYNC_FSSTATUS_CODEUNKNOWN (12) which is also SYNC_STATUS_FOLDERHIERARCHYCHANGED (12)
// if this happened while doing content sync, the mobile will try to resync the folderhierarchy
throw new StatusException(sprintf("ImportChangesICS('%s','%s','%s'): Error, unable to open folder: 0x%X", $session, $store, Utils::PrintAsString($folderid), mapi_last_hresult()), SYNC_FSSTATUS_CODEUNKNOWN);
}
$this->mapiprovider = new MAPIProvider($this->session, $this->store);
if ($folderid) {
$this->importer = mapi_openproperty($folder, PR_COLLECTOR, IID_IExchangeImportContentsChanges, 0, 0);
} else {
$this->importer = mapi_openproperty($folder, PR_COLLECTOR, IID_IExchangeImportHierarchyChanges, 0, 0);
}
}
示例4: SendMail
//.........这里部分代码省略.........
$this->_storeAttachment($mapimessage, $part);
}
}
} else {
if ($message->ctype_primary == "text" && $message->ctype_secondary == "html") {
$body_html .= u2wi($message->body);
} else {
$body = u2wi($message->body);
}
}
// some devices only transmit a html body
if (strlen($body) == 0 && strlen($body_html) > 0) {
debugLog("only html body sent, transformed into plain text");
$body = strip_tags($body_html);
}
if ($forward) {
$orig = $forward;
}
if ($reply) {
$orig = $reply;
}
if (isset($orig) && $orig) {
// Append the original text body for reply/forward
$entryid = mapi_msgstore_entryidfromsourcekey($this->_defaultstore, hex2bin($parent), hex2bin($orig));
$fwmessage = mapi_msgstore_openentry($this->_defaultstore, $entryid);
if ($fwmessage) {
//update icon when forwarding or replying message
if ($forward) {
mapi_setprops($fwmessage, array(PR_ICON_INDEX => 262));
} elseif ($reply) {
mapi_setprops($fwmessage, array(PR_ICON_INDEX => 261));
}
mapi_savechanges($fwmessage);
$stream = mapi_openproperty($fwmessage, PR_BODY, IID_IStream, 0, 0);
$fwbody = "";
while (1) {
$data = mapi_stream_read($stream, 1024);
if (strlen($data) == 0) {
break;
}
$fwbody .= $data;
}
$stream = mapi_openproperty($fwmessage, PR_HTML, IID_IStream, 0, 0);
$fwbody_html = "";
while (1) {
$data = mapi_stream_read($stream, 1024);
if (strlen($data) == 0) {
break;
}
$fwbody_html .= $data;
}
if ($forward) {
// During a forward, we have to add the forward header ourselves. This is because
// normally the forwarded message is added as an attachment. However, we don't want this
// because it would be rather complicated to copy over the entire original message due
// to the lack of IMessage::CopyTo ..
$fwmessageprops = mapi_getprops($fwmessage, array(PR_SENT_REPRESENTING_NAME, PR_DISPLAY_TO, PR_DISPLAY_CC, PR_SUBJECT, PR_CLIENT_SUBMIT_TIME));
$fwheader = "\r\n\r\n";
$fwheader .= "-----Original Message-----\r\n";
if (isset($fwmessageprops[PR_SENT_REPRESENTING_NAME])) {
$fwheader .= "From: " . $fwmessageprops[PR_SENT_REPRESENTING_NAME] . "\r\n";
}
if (isset($fwmessageprops[PR_DISPLAY_TO]) && strlen($fwmessageprops[PR_DISPLAY_TO]) > 0) {
$fwheader .= "To: " . $fwmessageprops[PR_DISPLAY_TO] . "\r\n";
}
if (isset($fwmessageprops[PR_DISPLAY_CC]) && strlen($fwmessageprops[PR_DISPLAY_CC]) > 0) {
示例5: ExportChangesICS
/**
* Constructor
*
* @param mapisession $session
* @param mapistore $store
* @param string (opt)
*
* @access public
* @throws StatusException
*/
public function ExportChangesICS($session, $store, $folderid = false)
{
// Open a hierarchy or a contents exporter depending on whether a folderid was specified
$this->session = $session;
$this->folderid = $folderid;
$this->store = $store;
$this->restriction = false;
try {
if ($folderid) {
$entryid = mapi_msgstore_entryidfromsourcekey($store, $folderid);
} else {
$storeprops = mapi_getprops($this->store, array(PR_IPM_SUBTREE_ENTRYID));
$entryid = $storeprops[PR_IPM_SUBTREE_ENTRYID];
}
$folder = false;
if ($entryid) {
$folder = mapi_msgstore_openentry($this->store, $entryid);
}
// Get the actual ICS exporter
if ($folderid) {
if ($folder) {
$this->exporter = mapi_openproperty($folder, PR_CONTENTS_SYNCHRONIZER, IID_IExchangeExportChanges, 0, 0);
} else {
$this->exporter = false;
}
} else {
$this->exporter = mapi_openproperty($folder, PR_HIERARCHY_SYNCHRONIZER, IID_IExchangeExportChanges, 0, 0);
}
} catch (MAPIException $me) {
$this->exporter = false;
// We return the general error SYNC_FSSTATUS_CODEUNKNOWN (12) which is also SYNC_STATUS_FOLDERHIERARCHYCHANGED (12)
// if this happened while doing content sync, the mobile will try to resync the folderhierarchy
throw new StatusException(sprintf("ExportChangesICS('%s','%s','%s'): Error, unable to open folder: 0x%X", $session, $store, Utils::PrintAsString($folderid), mapi_last_hresult()), SYNC_FSSTATUS_CODEUNKNOWN);
}
}
示例6: getEmbeddedTask
function getEmbeddedTask($message)
{
$table = mapi_message_getattachmenttable($message);
$rows = mapi_table_queryallrows($table, array(PR_ATTACH_NUM));
// Assume only one attachment
if (empty($rows)) {
return false;
}
$attach = mapi_message_openattach($message, $rows[0][PR_ATTACH_NUM]);
$message = mapi_openproperty($attach, PR_ATTACH_DATA_OBJ, IID_IMessage, 0, 0);
return $message;
}
示例7: SendMail
//.........这里部分代码省略.........
$zpical = new ZPush_ical($this->_defaultstore);
$mapiprops = array();
$zpical->extractProps($part->body, $mapiprops);
if (is_array($mapiprops) && !empty($mapiprops)) {
mapi_setprops($mapimessage, $mapiprops);
} else {
debugLog("ICAL: Mapi props array was empty");
}
} else {
$this->_storeAttachment($mapimessage, $part);
}
}
} else {
$body = u2w($message->body);
}
if ($forward) {
$orig = $forward;
}
if ($reply) {
$orig = $reply;
}
if (isset($orig) && $orig) {
// Append the original text body for reply/forward
$entryid = mapi_msgstore_entryidfromsourcekey($this->_defaultstore, hex2bin($parent), hex2bin($orig));
$fwmessage = mapi_msgstore_openentry($this->_defaultstore, $entryid);
if ($fwmessage) {
//update icon when forwarding or replying message
if ($forward) {
mapi_setprops($fwmessage, array(PR_ICON_INDEX => 262));
} elseif ($reply) {
mapi_setprops($fwmessage, array(PR_ICON_INDEX => 261));
}
mapi_savechanges($fwmessage);
$stream = mapi_openproperty($fwmessage, PR_BODY, IID_IStream, 0, 0);
$fwbody = "";
while (1) {
$data = mapi_stream_read($stream, 1024);
if (strlen($data) == 0) {
break;
}
$fwbody .= $data;
}
if (strlen($body) > 0) {
if ($forward) {
// During a forward, we have to add the forward header ourselves. This is because
// normally the forwarded message is added as an attachment. However, we don't want this
// because it would be rather complicated to copy over the entire original message due
// to the lack of IMessage::CopyTo ..
$fwmessageprops = mapi_getprops($fwmessage, array(PR_SENT_REPRESENTING_NAME, PR_DISPLAY_TO, PR_DISPLAY_CC, PR_SUBJECT, PR_CLIENT_SUBMIT_TIME));
$body .= "\r\n\r\n";
$body .= "-----Original Message-----\r\n";
if (isset($fwmessageprops[PR_SENT_REPRESENTING_NAME])) {
$body .= "From: " . $fwmessageprops[PR_SENT_REPRESENTING_NAME] . "\r\n";
}
if (isset($fwmessageprops[PR_DISPLAY_TO]) && strlen($fwmessageprops[PR_DISPLAY_TO]) > 0) {
$body .= "To: " . $fwmessageprops[PR_DISPLAY_TO] . "\r\n";
}
if (isset($fwmessageprops[PR_DISPLAY_CC]) && strlen($fwmessageprops[PR_DISPLAY_CC]) > 0) {
$body .= "Cc: " . $fwmessageprops[PR_DISPLAY_CC] . "\r\n";
}
if (isset($fwmessageprops[PR_CLIENT_SUBMIT_TIME])) {
$body .= "Sent: " . strftime("%x %X", $fwmessageprops[PR_CLIENT_SUBMIT_TIME]) . "\r\n";
}
if (isset($fwmessageprops[PR_SUBJECT])) {
$body .= "Subject: " . $fwmessageprops[PR_SUBJECT] . "\r\n";
}
示例8: SendMail
//.........这里部分代码省略.........
if (($fwmessage = mapi_msgstore_openentry($this->_defaultstore, $entryid)) === false) {
debugLog("Sendmail: Provided EntryID cannot be opened. Return error code 150.");
switch ($smartdata['task']) {
case 'forward':
return 150;
case 'reply':
return 150;
}
}
if ($fwmessage) {
// START CHANGED dw2412 LAST Verb Exec Props included
//update icon when forwarding or replying message
if ($smartdata['task'] == 'forward') {
mapi_setprops($fwmessage, array(PR_LAST_VERB_EXECUTED => 0x68, PR_LAST_VERB_EXECUTION_TIME => time()));
mapi_setprops($fwmessage, array(PR_ICON_INDEX => 262));
} elseif ($smartdata['task'] == 'reply') {
// START ADDED dw2412 update/create conversation index
$fwmessageprops = mapi_getprops($fwmessage, array(PR_CONVERSATION_INDEX));
if (isset($fwmessageprops[PR_CONVERSATION_INDEX])) {
$conversationindex = $fwmessageprops[PR_CONVERSATION_INDEX];
}
// END ADDED dw2412 update/create conversation index
if (sizeof($recips) > 1) {
mapi_setprops($fwmessage, array(PR_LAST_VERB_EXECUTED => 0x67, PR_LAST_VERB_EXECUTION_TIME => time()));
} else {
mapi_setprops($fwmessage, array(PR_LAST_VERB_EXECUTED => 0x66, PR_LAST_VERB_EXECUTION_TIME => time()));
}
mapi_setprops($fwmessage, array(PR_ICON_INDEX => 261));
} else {
mapi_setprops($fwmessage, array(PR_LAST_VERB_EXECUTED => 0x0, PR_LAST_VERB_EXECUTION_TIME => time()));
}
// END CHANGED dw2412 LAST Verb Exec Props included
mapi_savechanges($fwmessage);
$stream = mapi_openproperty($fwmessage, PR_BODY, IID_IStream, 0, 0);
$fwbody = "";
while (1) {
$data = mapi_stream_read($stream, 1024);
if (strlen($data) == 0) {
break;
}
$fwbody .= $data;
}
$stream = mapi_openproperty($fwmessage, PR_HTML, IID_IStream, 0, 0);
$fwbody_html = "";
while (1) {
$data = mapi_stream_read($stream, 1024);
if (strlen($data) == 0) {
break;
}
$fwbody_html .= $data;
}
$stream = mapi_openproperty($fwmessage, PR_HTML, IID_IStream, 0, 0);
$fwbody_html = "";
while (1) {
$data = mapi_stream_read($stream, 1024);
if (strlen($data) == 0) {
break;
}
$fwbody_html .= $data;
}
// dw2412 Enable this only in case of AS2.5 Protocol... in AS12 this seem
// being done already by winmobile client.
if ($smartdata['task'] == 'forward' && $protocolversion <= 2.5) {
// During a forward, we have to add the forward header ourselves. This is because
// normally the forwarded message is added as an attachment. However, we don't want this
// because it would be rather complicated to copy over the entire original message due
示例9: getRecurrence
//.........这里部分代码省略.........
$syncMessage->alldayevent = true;
}
// Interval is different according to the type/subtype
switch ($recurrence->recur["type"]) {
case 10:
if ($recurrence->recur["subtype"] == 0) {
$syncRecurrence->interval = (int) ($recurrence->recur["everyn"] / 1440);
}
// minutes
break;
case 11:
case 12:
$syncRecurrence->interval = $recurrence->recur["everyn"];
break;
// months / weeks
// months / weeks
case 13:
$syncRecurrence->interval = (int) ($recurrence->recur["everyn"] / 12);
break;
// months
}
if (isset($recurrence->recur["weekdays"])) {
$syncRecurrence->dayofweek = $recurrence->recur["weekdays"];
}
// bitmask of days (1 == sunday, 128 == saturday
if (isset($recurrence->recur["nday"])) {
$syncRecurrence->weekofmonth = $recurrence->recur["nday"];
}
// N'th {DAY} of {X} (0-5)
if (isset($recurrence->recur["month"])) {
$syncRecurrence->monthofyear = (int) ($recurrence->recur["month"] / (60 * 24 * 29)) + 1;
}
// works ok due to rounding. see also $monthminutes below (1-12)
if (isset($recurrence->recur["monthday"])) {
$syncRecurrence->dayofmonth = $recurrence->recur["monthday"];
}
// day of month (1-31)
// All changed exceptions are appointments within the 'exceptions' array. They contain the same items as a normal appointment
foreach ($recurrence->recur["changed_occurences"] as $change) {
$exception = new SyncAppointmentException();
// start, end, basedate, subject, remind_before, reminderset, location, busystatus, alldayevent, label
if (isset($change["start"])) {
$exception->starttime = $this->getGMTTimeByTZ($change["start"], $tz);
}
if (isset($change["end"])) {
$exception->endtime = $this->getGMTTimeByTZ($change["end"], $tz);
}
if (isset($change["basedate"])) {
$exception->exceptionstarttime = $this->getGMTTimeByTZ($this->getDayStartOfTimestamp($change["basedate"]) + $recurrence->recur["startocc"] * 60, $tz);
//open body because getting only property might not work because of memory limit
$exceptionatt = $recurrence->getExceptionAttachment($change["basedate"]);
if ($exceptionatt) {
$exceptionobj = mapi_attach_openobj($exceptionatt, 0);
$exception->body = mapi_openproperty($exceptionobj, PR_BODY);
}
}
if (isset($change["subject"])) {
$exception->subject = w2u($change["subject"]);
}
if (isset($change["reminder_before"]) && $change["reminder_before"]) {
$exception->reminder = $change["remind_before"];
}
if (isset($change["location"])) {
$exception->location = w2u($change["location"]);
}
if (isset($change["busystatus"])) {
$exception->busystatus = $change["busystatus"];
}
if (isset($change["alldayevent"])) {
$exception->alldayevent = $change["alldayevent"];
}
// set some data from the original appointment
if (isset($syncMessage->uid)) {
$exception->uid = $syncMessage->uid;
}
if (isset($syncMessage->organizername)) {
$exception->organizername = $syncMessage->organizername;
}
if (isset($syncMessage->organizeremail)) {
$exception->organizeremail = $syncMessage->organizeremail;
}
if (!isset($syncMessage->exceptions)) {
$syncMessage->exceptions = array();
}
array_push($syncMessage->exceptions, $exception);
}
// Deleted appointments contain only the original date (basedate) and a 'deleted' tag
foreach ($recurrence->recur["deleted_occurences"] as $deleted) {
$exception = new SyncAppointmentException();
$exception->exceptionstarttime = $this->getGMTTimeByTZ($this->getDayStartOfTimestamp($deleted) + $recurrence->recur["startocc"] * 60, $tz);
$exception->deleted = "1";
if (!isset($syncMessage->exceptions)) {
$syncMessage->exceptions = array();
}
array_push($syncMessage->exceptions, $exception);
}
if (isset($syncMessage->complete) && $syncMessage->complete) {
$syncRecurrence->complete = $syncMessage->complete;
}
}
示例10: setMessageBodyForType
/**
* Returns the message body for a required format.
*
* @param MAPIMessage $mapimessage
* @param int $bpReturnType
* @param SyncObject $message
*
* @access private
* @return boolean
*/
private function setMessageBodyForType($mapimessage, $bpReturnType, &$message)
{
//default value is PR_BODY
$property = PR_BODY;
switch ($bpReturnType) {
case SYNC_BODYPREFERENCE_HTML:
$property = PR_HTML;
break;
case SYNC_BODYPREFERENCE_RTF:
$property = PR_RTF_COMPRESSED;
break;
case SYNC_BODYPREFERENCE_MIME:
$stat = $this->imtoinet($mapimessage, $message);
if (isset($message->asbody)) {
$message->asbody->type = $bpReturnType;
}
return $stat;
}
$stream = mapi_openproperty($mapimessage, $property, IID_IStream, 0, 0);
if ($stream) {
$stat = mapi_stream_stat($stream);
$streamsize = $stat['cb'];
} else {
$streamsize = 0;
}
//set the properties according to supported AS version
if (Request::GetProtocolVersion() >= 12.0) {
$message->asbody = new SyncBaseBody();
$message->asbody->type = $bpReturnType;
if ($bpReturnType == SYNC_BODYPREFERENCE_RTF) {
$body = $this->mapiReadStream($stream, $streamsize);
$message->asbody->data = StringStreamWrapper::Open(base64_encode($body));
} elseif (isset($message->internetcpid) && $bpReturnType == SYNC_BODYPREFERENCE_HTML) {
// if PR_HTML is UTF-8 we can stream it directly, else we have to convert to UTF-8 & wrap it
if (Utils::GetCodepageCharset($message->internetcpid) == "utf-8") {
$message->asbody->data = MAPIStreamWrapper::Open($stream);
} else {
$body = $this->mapiReadStream($stream, $streamsize);
$message->asbody->data = StringStreamWrapper::Open(Utils::ConvertCodepageStringToUtf8($message->internetcpid, $body));
}
} else {
$message->asbody->data = MAPIStreamWrapper::Open($stream);
}
$message->asbody->estimatedDataSize = $streamsize;
} else {
$body = $this->mapiReadStream($stream, $streamsize);
$message->body = str_replace("\n", "\r\n", w2u(str_replace("\r", "", $body)));
$message->bodysize = $streamsize;
$message->bodytruncated = 0;
}
return true;
}
示例11: ExportChangesICS
function ExportChangesICS($session, $store, $folderid = false)
{
// Open a hierarchy or a contents exporter depending on whether a folderid was specified
$this->_session = $session;
$this->_folderid = $folderid;
$this->_store = $store;
if ($folderid) {
$entryid = mapi_msgstore_entryidfromsourcekey($store, $folderid);
} else {
$storeprops = mapi_getprops($this->_store, array(PR_IPM_SUBTREE_ENTRYID));
$entryid = $storeprops[PR_IPM_SUBTREE_ENTRYID];
}
$folder = mapi_msgstore_openentry($this->_store, $entryid);
if (!$folder) {
$this->exporter = false;
return;
}
// Get the actual ICS exporter
if ($folderid) {
$this->exporter = mapi_openproperty($folder, PR_CONTENTS_SYNCHRONIZER, IID_IExchangeExportChanges, 0, 0);
} else {
$this->exporter = mapi_openproperty($folder, PR_HIERARCHY_SYNCHRONIZER, IID_IExchangeExportChanges, 0, 0);
}
}
示例12: __construct
/**
* Constructor
*
* @param mapisession $session
* @param mapistore $store
* @param string $folderid (opt)
*
* @access public
* @throws StatusException
*/
public function __construct($session, $store, $folderid = false)
{
$this->session = $session;
$this->store = $store;
$this->folderid = $folderid;
$this->folderidHex = bin2hex($folderid);
$this->conflictsLoaded = false;
$this->cutoffdate = false;
$this->contentClass = false;
$this->prefix = '';
if ($folderid) {
$entryid = mapi_msgstore_entryidfromsourcekey($store, $folderid);
$folderidForBackendId = ZPush::GetDeviceManager()->GetFolderIdForBackendId($this->folderidHex);
// Only append backend id if the mapping backendid<->folderid is available.
if ($folderidForBackendId != $this->folderidHex) {
$this->prefix = $folderidForBackendId . ':';
}
} else {
$storeprops = mapi_getprops($store, array(PR_IPM_SUBTREE_ENTRYID));
$entryid = $storeprops[PR_IPM_SUBTREE_ENTRYID];
}
$folder = false;
if ($entryid) {
$folder = mapi_msgstore_openentry($store, $entryid);
}
if (!$folder) {
$this->importer = false;
// We throw an general error SYNC_FSSTATUS_CODEUNKNOWN (12) which is also SYNC_STATUS_FOLDERHIERARCHYCHANGED (12)
// if this happened while doing content sync, the mobile will try to resync the folderhierarchy
throw new StatusException(sprintf("ImportChangesICS('%s','%s'): Error, unable to open folder: 0x%X", $session, bin2hex($folderid), mapi_last_hresult()), SYNC_FSSTATUS_CODEUNKNOWN);
}
$this->mapiprovider = new MAPIProvider($this->session, $this->store);
if ($folderid) {
$this->importer = mapi_openproperty($folder, PR_COLLECTOR, IID_IExchangeImportContentsChanges, 0, 0);
} else {
$this->importer = mapi_openproperty($folder, PR_COLLECTOR, IID_IExchangeImportHierarchyChanges, 0, 0);
}
}
示例13: readPropStream
/**
* Reads data of large properties from a stream
*
* @access public
*
* @param MAPIMessage $message
* @param long $prop
* @return string
*/
public static function readPropStream($message, $prop)
{
$stream = mapi_openproperty($message, $prop, IID_IStream, 0, 0);
$data = "";
$string = "";
while (1) {
$data = mapi_stream_read($stream, 1024);
if (strlen($data) == 0) {
break;
}
$string .= $data;
}
return $string;
}
示例14: ParseSmime
/**
* Function will be used to decode smime messages and convert it to normal messages.
*
* @param MAPISession $session
* @param MAPIStore $store
* @param MAPIAdressBook $addressBook
* @param MAPIMessage $message smime message
*
* @access public
* @return void
*/
public static function ParseSmime($session, $store, $addressBook, &$mapimessage)
{
$props = mapi_getprops($mapimessage, array(PR_MESSAGE_CLASS));
if (isset($props[PR_MESSAGE_CLASS]) && stripos($props[PR_MESSAGE_CLASS], 'IPM.Note.SMIME.MultipartSigned') !== false) {
// this is a signed message. decode it.
$attachTable = mapi_message_getattachmenttable($mapimessage);
$rows = mapi_table_queryallrows($attachTable, array(PR_ATTACH_MIME_TAG, PR_ATTACH_NUM));
$attnum = false;
foreach ($rows as $row) {
if (isset($row[PR_ATTACH_MIME_TAG]) && $row[PR_ATTACH_MIME_TAG] == 'multipart/signed') {
$attnum = $row[PR_ATTACH_NUM];
}
}
if ($attnum !== false) {
$att = mapi_message_openattach($mapimessage, $attnum);
$data = mapi_openproperty($att, PR_ATTACH_DATA_BIN);
mapi_message_deleteattach($mapimessage, $attnum);
mapi_inetmapi_imtomapi($session, $store, $addressBook, $mapimessage, $data, array("parse_smime_signed" => 1));
ZLog::Write(LOGLEVEL_DEBUG, "Convert a smime signed message to a normal message.");
}
mapi_setprops($mapimessage, array(PR_MESSAGE_CLASS => 'IPM.Note.SMIME.MultipartSigned'));
}
// TODO check if we need to do this for encrypted (and signed?) message as well
}
示例15: readPropStream
/**
* Reads data of large properties from a stream.
*
* @param MAPIMessage $message
* @param long $prop
*
* @access private
* @return string
*/
private function readPropStream($message, $prop)
{
$stream = mapi_openproperty($message, $prop, IID_IStream, 0, 0);
$ret = mapi_last_hresult();
if ($ret == MAPI_E_NOT_FOUND) {
$this->Log(sprintf("Kopano>readPropStream: property 0x%s not found. It is either empty or not set. It will be ignored.", str_pad(dechex($prop), 8, 0, STR_PAD_LEFT)));
return "";
} elseif ($ret) {
$this->Log("Kopano->readPropStream error opening stream: 0x%08X", $ret);
return "";
}
$data = "";
$string = "";
while (1) {
$data = mapi_stream_read($stream, 1024);
if (strlen($data) == 0) {
break;
}
$string .= $data;
}
return $string;
}