本文整理汇总了PHP中mapi_prop_type函数的典型用法代码示例。如果您正苦于以下问题:PHP mapi_prop_type函数的具体用法?PHP mapi_prop_type怎么用?PHP mapi_prop_type使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了mapi_prop_type函数的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: readSingleMapiProp
/**
* Reads a single mapi prop.
*
* @param string &$buffer
* @param int $size
* @param mixed &$read
* @param array &$mapiprops
*
* @access private
* @return int
*/
private function readSingleMapiProp(&$buffer, &$size, &$read, &$mapiprops)
{
$propTag = 0;
$len = 0;
$origSize = $size;
$isNamedId = 0;
$namedProp = 0;
$count = 0;
$mvProp = 0;
$guid = 0;
if ($size < 8) {
return MAPI_E_NOT_FOUND;
}
$hresult = $this->readFromTnefStream($buffer, self::DWORD, $propTag);
if ($hresult !== NOERROR) {
ZLog::Write(LOGLEVEL_WARN, "TNEF: There was an error reading a mapi property tag from the stream.");
return $hresult;
}
$size -= 4;
ZLog::Write(LOGLEVEL_DEBUG, "TNEF: mapi prop type:" . dechex(mapi_prop_type($propTag)));
ZLog::Write(LOGLEVEL_DEBUG, "TNEF: mapi prop tag: 0x" . sprintf("%04x", mapi_prop_id($propTag)));
if (mapi_prop_id($propTag) >= 0x8000) {
// Named property, first read GUID, then name/id
if ($size < 24) {
ZLog::Write(LOGLEVEL_WARN, "TNEF: Corrupt guid size for named property:" . dechex($propTag));
return MAPI_E_CORRUPT_DATA;
}
//strip GUID & name/id
$hresult = $this->readBuffer($buffer, 16, $guid);
if ($hresult !== NOERROR) {
ZLog::Write(LOGLEVEL_WARN, "TNEF: There was an error reading stream property buffer");
return $hresult;
}
$size -= 16;
//it is not used and is here only for eventual debugging
$readableGuid = unpack("VV/v2v/n4n", $guid);
$readableGuid = sprintf("{%08x-%04x-%04x-%04x-%04x%04x%04x}", $readableGuid['V'], $readableGuid['v1'], $readableGuid['v2'], $readableGuid['n1'], $readableGuid['n2'], $readableGuid['n3'], $readableGuid['n4']);
ZLog::Write(LOGLEVEL_DEBUG, "TNEF: guid:{$readableGuid}");
$hresult = $this->readFromTnefStream($buffer, self::DWORD, $isNamedId);
if ($hresult !== NOERROR) {
ZLog::Write(LOGLEVEL_WARN, "TNEF: There was an error reading stream property checksum.");
return $hresult;
}
$size -= 4;
if ($isNamedId != 0) {
// A string name follows
//read length of the property
$hresult = $this->readFromTnefStream($buffer, self::DWORD, $len);
if ($hresult !== NOERROR) {
ZLog::Write(LOGLEVEL_WARN, "TNEF: There was an error reading mapi property's length");
return $hresult;
}
$size -= 4;
if ($size < $len) {
return MAPI_E_CORRUPT_DATA;
}
//read the name of the property, eg Keywords
$hresult = $this->readBuffer($buffer, $len, $namedProp);
if ($hresult !== NOERROR) {
ZLog::Write(LOGLEVEL_WARN, "TNEF: There was an error reading stream property buffer");
return $hresult;
}
$size -= $len;
//Re-align
$buffer = substr($buffer, $len & 3 ? 4 - ($len & 3) : 0);
$size -= $len & 3 ? 4 - ($len & 3) : 0;
} else {
$hresult = $this->readFromTnefStream($buffer, self::DWORD, $namedProp);
if ($hresult !== NOERROR) {
ZLog::Write(LOGLEVEL_WARN, "TNEF: There was an error reading mapi property's length");
return $hresult;
}
ZLog::Write(LOGLEVEL_DEBUG, "TNEF: named: 0x" . sprintf("%04x", $namedProp));
$size -= 4;
}
if ($this->store !== false) {
$named = mapi_getidsfromnames($this->store, array($namedProp), array(makeguid($readableGuid)));
$propTag = mapi_prop_tag(mapi_prop_type($propTag), mapi_prop_id($named[0]));
} else {
ZLog::Write(LOGLEVEL_WARN, "TNEF: Store not available. It is impossible to get named properties");
}
}
ZLog::Write(LOGLEVEL_DEBUG, "TNEF: mapi prop tag: 0x" . sprintf("%04x", mapi_prop_id($propTag)) . " " . sprintf("%04x", mapi_prop_type($propTag)));
if ($propTag & MV_FLAG) {
if ($size < 4) {
return MAPI_E_CORRUPT_DATA;
}
//read the number of properties
$hresult = $this->readFromTnefStream($buffer, self::DWORD, $count);
//.........这里部分代码省略.........
示例2: getPropsFromMAPI
/**
* Gets the properties from a MAPI object and sets them in the Sync object according to mapping
*
* @param SyncObject &$message
* @param mixed $mapimessage
* @param array $mapping
*
* @access private
* @return
*/
private function getPropsFromMAPI(&$message, $mapimessage, $mapping)
{
$messageprops = $this->getProps($mapimessage, $mapping);
foreach ($mapping as $asprop => $mapiprop) {
// Get long strings via openproperty
if (isset($messageprops[mapi_prop_tag(PT_ERROR, mapi_prop_id($mapiprop))])) {
if ($messageprops[mapi_prop_tag(PT_ERROR, mapi_prop_id($mapiprop))] == MAPI_E_NOT_ENOUGH_MEMORY_32BIT || $messageprops[mapi_prop_tag(PT_ERROR, mapi_prop_id($mapiprop))] == MAPI_E_NOT_ENOUGH_MEMORY_64BIT) {
$messageprops[$mapiprop] = MAPIUtils::readPropStream($mapimessage, $mapiprop);
}
}
if (isset($messageprops[$mapiprop])) {
if (mapi_prop_type($mapiprop) == PT_BOOLEAN) {
// Force to actual '0' or '1'
if ($messageprops[$mapiprop]) {
$message->{$asprop} = 1;
} else {
$message->{$asprop} = 0;
}
} else {
// Special handling for PR_MESSAGE_FLAGS
if ($mapiprop == PR_MESSAGE_FLAGS) {
$message->{$asprop} = $messageprops[$mapiprop] & 1;
} else {
if ($mapiprop == PR_RTF_COMPRESSED) {
//do not send rtf to the mobile
continue;
} else {
if (is_array($messageprops[$mapiprop])) {
$message->{$asprop} = array_map("w2u", $messageprops[$mapiprop]);
} else {
if (mapi_prop_type($mapiprop) != PT_BINARY && mapi_prop_type($mapiprop) != PT_MV_BINARY) {
$message->{$asprop} = w2u($messageprops[$mapiprop]);
} else {
$message->{$asprop} = $messageprops[$mapiprop];
}
}
}
}
}
}
}
}
示例3: createExceptionAttachment
/**
* Function which saves the exception data in an attachment.
* @param array $exception_props the exception data (like any other MAPI appointment)
* @param array $exception_recips list of recipients
* @param mapi_message $copy_attach_from mapi message from which attachments should be copied
* @return array properties of the exception
*/
function createExceptionAttachment($exception_props, $exception_recips = array(), $copy_attach_from = false)
{
// Create new attachment.
$attachment = mapi_message_createattach($this->message);
$props = array();
$props[PR_ATTACHMENT_FLAGS] = 2;
$props[PR_ATTACHMENT_HIDDEN] = true;
$props[PR_ATTACHMENT_LINKID] = 0;
$props[PR_ATTACH_FLAGS] = 0;
$props[PR_ATTACH_METHOD] = 5;
$props[PR_DISPLAY_NAME] = "Exception";
$props[PR_EXCEPTION_STARTTIME] = $this->fromGMT($this->tz, $exception_props[$this->proptags["startdate"]]);
$props[PR_EXCEPTION_ENDTIME] = $this->fromGMT($this->tz, $exception_props[$this->proptags["duedate"]]);
mapi_message_setprops($attachment, $props);
$imessage = mapi_attach_openobj($attachment, MAPI_CREATE | MAPI_MODIFY);
if ($copy_attach_from) {
$attachmentTable = mapi_message_getattachmenttable($copy_attach_from);
if ($attachmentTable) {
$attachments = mapi_table_queryallrows($attachmentTable, array(PR_ATTACH_NUM, PR_ATTACH_SIZE, PR_ATTACH_LONG_FILENAME, PR_ATTACHMENT_HIDDEN, PR_DISPLAY_NAME, PR_ATTACH_METHOD));
foreach ($attachments as $attach_props) {
$attach_old = mapi_message_openattach($copy_attach_from, (int) $attach_props[PR_ATTACH_NUM]);
$attach_newResourceMsg = mapi_message_createattach($imessage);
mapi_copyto($attach_old, array(), array(), $attach_newResourceMsg, 0);
mapi_savechanges($attach_newResourceMsg);
}
}
}
$props = $props + $exception_props;
// FIXME: the following piece of code is written to fix the creation
// of an exception. This is only a quickfix as it is not yet possible
// to change an existing exception.
// remove mv properties when needed
foreach ($props as $propTag => $propVal) {
if ((mapi_prop_type($propTag) & MV_FLAG) == MV_FLAG && is_null($propVal)) {
unset($props[$propTag]);
}
}
mapi_message_setprops($imessage, $props);
$this->setExceptionRecipients($imessage, $exception_recips, true);
mapi_message_savechanges($imessage);
mapi_message_savechanges($attachment);
}
示例4: _getPropsFromMAPI
function _getPropsFromMAPI(&$message, $mapimessage, $mapping)
{
foreach ($mapping as $asprop => $mapipropstring) {
// Get the MAPI property we need to be reading
$mapiprop = $this->_getPropIDFromString($mapipropstring);
$prop = mapi_getprops($mapimessage, array($mapiprop));
// Get long strings via openproperty
if (isset($prop[mapi_prop_tag(PT_ERROR, mapi_prop_id($mapiprop))])) {
if ($prop[mapi_prop_tag(PT_ERROR, mapi_prop_id($mapiprop))] == -2147024882 || $prop[mapi_prop_tag(PT_ERROR, mapi_prop_id($mapiprop))] == 2147942414.0) {
// 64 bit
$prop = array($mapiprop => readPropStream($mapimessage, $mapiprop));
}
}
if (isset($prop[$mapiprop])) {
if (mapi_prop_type($mapiprop) == PT_BOOLEAN) {
// Force to actual '0' or '1'
if ($prop[$mapiprop]) {
$message->{$asprop} = 1;
} else {
$message->{$asprop} = 0;
}
} else {
// Special handling for PR_MESSAGE_FLAGS
if ($mapiprop == PR_MESSAGE_FLAGS) {
$message->{$asprop} = $prop[$mapiprop] & 1;
} else {
if ($mapiprop == PR_RTF_COMPRESSED) {
//do not send rtf to the mobile
continue;
} else {
if (is_array($prop[$mapiprop])) {
$message->{$asprop} = array_map("w2u", $prop[$mapiprop]);
} else {
if (mapi_prop_type($mapiprop) != PT_BINARY && mapi_prop_type($mapiprop) != PT_MV_BINARY) {
$message->{$asprop} = w2u($prop[$mapiprop]);
} else {
$message->{$asprop} = $prop[$mapiprop];
}
}
}
}
}
}
}
}
示例5: _readSingleMapiProp
function _readSingleMapiProp(&$buffer, &$size, &$read, &$mapiprops)
{
$propTag = 0;
$len = 0;
$origSize = $size;
$isNamedId = 0;
$namedProp = 0;
$count = 0;
$mvProp = 0;
$guid = 0;
if ($size < 8) {
return MAPI_E_NOT_FOUND;
}
$hresult = $this->_readFromTnefStream($buffer, ZP_DWORD, $propTag);
if ($hresult !== NOERROR) {
debugLog("There was an error reading a mapi property tag from the stream.");
return $hresult;
}
$size -= 4;
//debugLog("mapi prop type:".dechex(mapi_prop_type($propTag)));
//debugLog("mapi prop tag: 0x".sprintf("%04x", mapi_prop_id($propTag)));
if (mapi_prop_id($propTag) >= 0x8000) {
// Named property, first read GUID, then name/id
if ($size < 24) {
debugLog("Corrupt guid size for named property:" . dechex($propTag));
return MAPI_E_CORRUPT_DATA;
}
//strip GUID & name/id
$hresult = $this->_readBuffer($buffer, 16, $guid);
if ($hresult !== NOERROR) {
debugLog("There was an error reading stream property buffer");
return $hresult;
}
$size -= 16;
//it is not used and is here only for eventual debugging
$readableGuid = unpack("VV/v2v/n4n", $guid);
$readableGuid = sprintf("{%08x-%04x-%04x-%04x-%04x%04x%04x}", $readableGuid['V'], $readableGuid['v1'], $readableGuid['v2'], $readableGuid['n1'], $readableGuid['n2'], $readableGuid['n3'], $readableGuid['n4']);
//debugLog("guid:$readableGuid");
$hresult = $this->_readFromTnefStream($buffer, ZP_DWORD, $isNamedId);
if ($hresult !== NOERROR) {
debugLog("There was an error reading stream property checksum.");
return $hresult;
}
$size -= 4;
if ($isNamedId != 0) {
// A string name follows
//read length of the property
$hresult = $this->_readFromTnefStream($buffer, ZP_DWORD, $len);
if ($hresult !== NOERROR) {
debugLog("There was an error reading mapi property's length");
return $hresult;
}
$size -= 4;
if ($size < $len) {
return MAPI_E_CORRUPT_DATA;
}
//read the name of the property, eg Keywords
$hresult = $this->_readBuffer($buffer, $len, $namedProp);
if ($hresult !== NOERROR) {
debugLog("There was an error reading stream property buffer");
return $hresult;
}
$size -= $len;
//Re-align
$buffer = substr($buffer, $len & 3 ? 4 - ($len & 3) : 0);
$size -= $len & 3 ? 4 - ($len & 3) : 0;
} else {
$hresult = $this->_readFromTnefStream($buffer, ZP_DWORD, $namedProp);
if ($hresult !== NOERROR) {
debugLog("There was an error reading mapi property's length");
return $hresult;
}
//debugLog("named: 0x".sprintf("%04x", $namedProp));
$size -= 4;
}
if ($this->_store !== false) {
$named = mapi_getidsfromnames($this->_store, array($namedProp), array(makeguid($readableGuid)));
$propTag = mapi_prop_tag(mapi_prop_type($propTag), mapi_prop_id($named[0]));
} else {
debugLog("Store not available. It is impossible to get named properties");
}
}
//debugLog("mapi prop tag: 0x".sprintf("%04x", mapi_prop_id($propTag))." ".sprintf("%04x", mapi_prop_type($propTag)));
if ($propTag & MV_FLAG) {
if ($size < 4) {
return MAPI_E_CORRUPT_DATA;
}
//read the number of properties
$hresult = $this->_readFromTnefStream($buffer, ZP_DWORD, $count);
if ($hresult !== NOERROR) {
debugLog("There was an error reading number of properties for:" . dechex($propTag));
return $hresult;
}
$size -= 4;
} else {
$count = 1;
}
for ($mvProp = 0; $mvProp < $count; $mvProp++) {
switch (mapi_prop_type($propTag) & ~MV_FLAG) {
case PT_I2:
//.........这里部分代码省略.........
示例6: _getPropsFromMAPI
function _getPropsFromMAPI(&$message, $mapimessage, $mapping)
{
foreach ($mapping as $asprop => $mapipropstring) {
// Get the MAPI property we need to be reading
$mapiprop = $this->_getPropIDFromString($mapipropstring);
if ($mapiprop == PR_BODY) {
// special handling for PR_BODY
$message->{$asprop} = str_replace("\n", "\r\n", w2u(str_replace("\r", "", mapi_openproperty($mapimessage, PR_BODY))));
if (strlen($message->{$asprop}) > 0) {
$message->bodytruncated = 0;
$message->bodysize = strlen($message->body);
}
} else {
// Normal property
$prop = mapi_getprops($mapimessage, array($mapiprop));
if (isset($prop[$mapiprop])) {
if (mapi_prop_type($mapiprop) == PT_BOOLEAN) {
// Force to actual '0' or '1'
if ($prop[$mapiprop]) {
$message->{$asprop} = 1;
} else {
$message->{$asprop} = 0;
}
} else {
// Special handling for PR_MESSAGE_FLAGS
if ($mapiprop == PR_MESSAGE_FLAGS) {
$message->{$asprop} = $prop[$mapiprop] & 1;
} else {
if (is_array($prop[$mapiprop])) {
$message->{$asprop} = array_map("w2u", $prop[$mapiprop]);
} else {
if (mapi_prop_type($mapiprop) != PT_BINARY && mapi_prop_type($mapiprop) != PT_MV_BINARY) {
$message->{$asprop} = w2u($prop[$mapiprop]);
} else {
$message->{$asprop} = $prop[$mapiprop];
}
}
}
}
}
}
}
}
示例7: setProperty
function setProperty($property, $value, &$props, $properties)
{
if (isset($value) && isset($properties[$property])) {
//multi values have to be saved as an array
if ($properties[$property] & MV_FLAG) {
$value = explode(';', $value);
}
if (mapi_prop_type($properties[$property]) == PT_SYSTIME && !DATES_AS_TIMESTAMPS) {
$value = strtotime($value);
}
if (mapi_prop_type($properties[$property]) != PT_BINARY && mapi_prop_type($properties[$property]) != PT_MV_BINARY) {
if (is_array($value)) {
$props[$properties[$property]] = array_map("to_windows1252", $value);
} else {
$props[$properties[$property]] = to_windows1252($value);
}
} else {
$props[$properties[$property]] = to_windows1252($value);
}
}
}