grommunio /
mapi-header-php
| 1 | <?php |
||||||
| 2 | /* |
||||||
| 3 | * SPDX-License-Identifier: AGPL-3.0-only |
||||||
| 4 | * SPDX-FileCopyrightText: Copyright 2005-2016 Zarafa Deutschland GmbH |
||||||
| 5 | * SPDX-FileCopyrightText: Copyright 2020-2022 grommunio GmbH |
||||||
| 6 | */ |
||||||
| 7 | |||||||
| 8 | define('NOERROR', 0); |
||||||
| 9 | |||||||
| 10 | // Load all mapi defs |
||||||
| 11 | mapi_load_mapidefs(1); |
||||||
|
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||||||
| 12 | |||||||
| 13 | /** |
||||||
| 14 | * Function to make a MAPIGUID from a php string. |
||||||
| 15 | * The C++ definition for the GUID is: |
||||||
| 16 | * typedef struct _GUID |
||||||
| 17 | * { |
||||||
| 18 | * unsigned long Data1; |
||||||
| 19 | * unsigned short Data2; |
||||||
| 20 | * unsigned short Data3; |
||||||
| 21 | * unsigned char Data4[8]; |
||||||
| 22 | * } GUID;. |
||||||
| 23 | * |
||||||
| 24 | * A GUID is normally represented in the following form: |
||||||
| 25 | * {00062008-0000-0000-C000-000000000046} |
||||||
| 26 | * |
||||||
| 27 | * @param string $guid |
||||||
| 28 | */ |
||||||
| 29 | function makeGuid($guid): string { |
||||||
| 30 | return pack("vvvv", hexdec(substr($guid, 5, 4)), hexdec(substr($guid, 1, 4)), hexdec(substr($guid, 10, 4)), hexdec(substr($guid, 15, 4))) . hex2bin(substr($guid, 20, 4)) . hex2bin(substr($guid, 25, 12)); |
||||||
| 31 | } |
||||||
| 32 | |||||||
| 33 | /** |
||||||
| 34 | * Function to get a human readable string from a MAPI error code. |
||||||
| 35 | * |
||||||
| 36 | * @param mixed $errcode the MAPI error code, if not given, we use mapi_last_hresult |
||||||
| 37 | * |
||||||
| 38 | * @return string The defined name for the MAPI error code |
||||||
| 39 | */ |
||||||
| 40 | function get_mapi_error_name($errcode = null) { |
||||||
| 41 | if ($errcode === null) { |
||||||
| 42 | $errcode = mapi_last_hresult(); |
||||||
|
0 ignored issues
–
show
The function
mapi_last_hresult was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||||
| 43 | } |
||||||
| 44 | |||||||
| 45 | if (strcasecmp(substr($errcode, 0, 2), '0x') === 0) { |
||||||
| 46 | $errcode = hexdec($errcode); |
||||||
| 47 | } |
||||||
| 48 | |||||||
| 49 | if ($errcode !== 0) { |
||||||
| 50 | // Retrieve constants categories, MAPI error names are defined in gromox. |
||||||
| 51 | foreach (get_defined_constants(true)['Core'] as $key => $value) { |
||||||
| 52 | /* |
||||||
| 53 | * If PHP encounters a number beyond the bounds of the integer type, |
||||||
| 54 | * it will be interpreted as a float instead, so when comparing these error codes |
||||||
| 55 | * we have to manually typecast value to integer, so float will be converted in integer, |
||||||
| 56 | * but still its out of bound for integer limit so it will be auto adjusted to minus value |
||||||
| 57 | */ |
||||||
| 58 | if ($errcode == (int) $value) { |
||||||
| 59 | // Check that we have an actual MAPI error or warning definition |
||||||
| 60 | $prefix = substr($key, 0, 7); |
||||||
| 61 | if ($prefix == "MAPI_E_" || $prefix == "MAPI_W_") { |
||||||
| 62 | return $key; |
||||||
| 63 | } |
||||||
| 64 | $prefix = substr($key, 0, 2); |
||||||
| 65 | if ($prefix == "ec") { |
||||||
| 66 | return $key; |
||||||
| 67 | } |
||||||
| 68 | } |
||||||
| 69 | } |
||||||
| 70 | } |
||||||
| 71 | else { |
||||||
| 72 | return "NOERROR"; |
||||||
| 73 | } |
||||||
| 74 | |||||||
| 75 | // error code not found, return hex value (this is a fix for 64-bit systems, we can't use the dechex() function for this) |
||||||
| 76 | $result = unpack("H*", pack("N", $errcode)); |
||||||
| 77 | |||||||
| 78 | return "0x" . $result[1]; |
||||||
| 79 | } |
||||||
| 80 | |||||||
| 81 | /** |
||||||
| 82 | * Parses properties from an array of strings. Each "string" may be either an ULONG, which is a direct property ID, |
||||||
| 83 | * or a string with format "PT_TYPE:{GUID}:StringId" or "PT_TYPE:{GUID}:0xXXXX" for named |
||||||
| 84 | * properties. |
||||||
| 85 | * |
||||||
| 86 | * @param mixed $store |
||||||
| 87 | * @param mixed $mapping |
||||||
| 88 | * |
||||||
| 89 | * @return array |
||||||
| 90 | */ |
||||||
| 91 | function getPropIdsFromStrings($store, $mapping) { |
||||||
| 92 | $props = []; |
||||||
| 93 | |||||||
| 94 | $ids = ["name" => [], "id" => [], "guid" => [], "type" => []]; // this array stores all the information needed to retrieve a named property |
||||||
| 95 | $num = 0; |
||||||
| 96 | |||||||
| 97 | // caching |
||||||
| 98 | $guids = []; |
||||||
| 99 | |||||||
| 100 | foreach ($mapping as $name => $val) { |
||||||
| 101 | if (is_string($val)) { |
||||||
| 102 | $split = explode(":", $val); |
||||||
| 103 | |||||||
| 104 | if (count($split) != 3) { // invalid string, ignore |
||||||
| 105 | trigger_error(sprintf("Invalid property: %s \"%s\"", $name, $val), E_USER_NOTICE); |
||||||
| 106 | |||||||
| 107 | continue; |
||||||
| 108 | } |
||||||
| 109 | |||||||
| 110 | if (substr($split[2], 0, 2) == "0x") { |
||||||
| 111 | $id = hexdec(substr($split[2], 2)); |
||||||
| 112 | } |
||||||
| 113 | elseif (preg_match('/^[1-9][0-9]{0,12}$/', $split[2])) { |
||||||
| 114 | $id = (int) $split[2]; |
||||||
| 115 | } |
||||||
| 116 | else { |
||||||
| 117 | $id = $split[2]; |
||||||
| 118 | } |
||||||
| 119 | |||||||
| 120 | // have we used this guid before? |
||||||
| 121 | if (!defined($split[1])) { |
||||||
| 122 | if (!array_key_exists($split[1], $guids)) { |
||||||
| 123 | $guids[$split[1]] = makeguid($split[1]); |
||||||
| 124 | } |
||||||
| 125 | $guid = $guids[$split[1]]; |
||||||
| 126 | } |
||||||
| 127 | else { |
||||||
| 128 | $guid = constant($split[1]); |
||||||
| 129 | } |
||||||
| 130 | |||||||
| 131 | // temp store info about named prop, so we have to call mapi_getidsfromnames just one time |
||||||
| 132 | $ids["name"][$num] = $name; |
||||||
| 133 | $ids["id"][$num] = $id; |
||||||
| 134 | $ids["guid"][$num] = $guid; |
||||||
| 135 | $ids["type"][$num] = $split[0]; |
||||||
| 136 | ++$num; |
||||||
| 137 | } |
||||||
| 138 | else { |
||||||
| 139 | // not a named property |
||||||
| 140 | $props[$name] = $val; |
||||||
| 141 | } |
||||||
| 142 | } |
||||||
| 143 | |||||||
| 144 | if (empty($ids["id"])) { |
||||||
| 145 | return $props; |
||||||
| 146 | } |
||||||
| 147 | |||||||
| 148 | // get the ids |
||||||
| 149 | $named = mapi_getidsfromnames($store, $ids["id"], $ids["guid"]); |
||||||
|
0 ignored issues
–
show
The function
mapi_getidsfromnames was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||||
| 150 | foreach ($named as $num => $prop) { |
||||||
| 151 | $props[$ids["name"][$num]] = mapi_prop_tag(constant($ids["type"][$num]), mapi_prop_id($prop)); |
||||||
|
0 ignored issues
–
show
The function
mapi_prop_tag was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
The function
mapi_prop_id was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||||
| 152 | } |
||||||
| 153 | |||||||
| 154 | return $props; |
||||||
| 155 | } |
||||||
| 156 | |||||||
| 157 | /** |
||||||
| 158 | * Check whether a call to mapi_getprops returned errors for some properties. |
||||||
| 159 | * mapi_getprops function tries to get values of properties requested but somehow if |
||||||
| 160 | * if a property value can not be fetched then it changes type of property tag as PT_ERROR |
||||||
| 161 | * and returns error for that particular property, probable errors |
||||||
| 162 | * that can be returned as value can be MAPI_E_NOT_FOUND, MAPI_E_NOT_ENOUGH_MEMORY. |
||||||
| 163 | * |
||||||
| 164 | * @param int $property Property to check for error |
||||||
| 165 | * @param array $propArray An array of properties |
||||||
| 166 | * |
||||||
| 167 | * @return bool|mixed Gives back false when there is no error, if there is, gives the error |
||||||
| 168 | */ |
||||||
| 169 | function propIsError($property, $propArray) { |
||||||
| 170 | if (array_key_exists(mapi_prop_tag(PT_ERROR, mapi_prop_id($property)), $propArray)) { |
||||||
|
0 ignored issues
–
show
The function
mapi_prop_id was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
The function
mapi_prop_tag was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||||
| 171 | return $propArray[mapi_prop_tag(PT_ERROR, mapi_prop_id($property))]; |
||||||
| 172 | } |
||||||
| 173 | |||||||
| 174 | return false; |
||||||
| 175 | } |
||||||
| 176 | |||||||
| 177 | /** |
||||||
| 178 | * Note: Static function, more like a utility function. |
||||||
| 179 | * |
||||||
| 180 | * Gets all the items (including recurring items) in the specified calendar in the given timeframe. Items are |
||||||
| 181 | * included as a whole if they overlap the interval <$start, $end> (non-inclusive). This means that if the interval |
||||||
| 182 | * is <08:00 - 14:00>, the item [6:00 - 8:00> is NOT included, nor is the item [14:00 - 16:00>. However, the item |
||||||
| 183 | * [7:00 - 9:00> is included as a whole, and is NOT capped to [8:00 - 9:00>. |
||||||
| 184 | * |
||||||
| 185 | * @param resource $store The store in which the calendar resides |
||||||
| 186 | * @param resource $calendar The calendar to get the items from |
||||||
| 187 | * @param int $viewstart Timestamp of beginning of view window |
||||||
| 188 | * @param int $viewend Timestamp of end of view window |
||||||
| 189 | * @param array $propsrequested Array of properties to return |
||||||
| 190 | * |
||||||
| 191 | * @psalm-return list<mixed> |
||||||
| 192 | */ |
||||||
| 193 | function getCalendarItems($store, $calendar, $viewstart, $viewend, $propsrequested): array { |
||||||
| 194 | $result = []; |
||||||
| 195 | $properties = getPropIdsFromStrings($store, [ |
||||||
| 196 | "duedate" => "PT_SYSTIME:PSETID_Appointment:" . PidLidAppointmentEndWhole, |
||||||
|
0 ignored issues
–
show
|
|||||||
| 197 | "startdate" => "PT_SYSTIME:PSETID_Appointment:" . PidLidAppointmentStartWhole, |
||||||
|
0 ignored issues
–
show
|
|||||||
| 198 | "enddate_recurring" => "PT_SYSTIME:PSETID_Appointment:" . PidLidClipEnd, |
||||||
|
0 ignored issues
–
show
|
|||||||
| 199 | "recurring" => "PT_BOOLEAN:PSETID_Appointment:" . PidLidRecurring, |
||||||
|
0 ignored issues
–
show
|
|||||||
| 200 | "recurring_data" => "PT_BINARY:PSETID_Appointment:" . PidLidAppointmentRecur, |
||||||
|
0 ignored issues
–
show
|
|||||||
| 201 | "timezone_data" => "PT_BINARY:PSETID_Appointment:" . PidLidTimeZoneStruct, |
||||||
|
0 ignored issues
–
show
|
|||||||
| 202 | "label" => "PT_LONG:PSETID_Appointment:0x8214", |
||||||
| 203 | ]); |
||||||
| 204 | |||||||
| 205 | // Create a restriction that will discard rows of appointments that are definitely not in our |
||||||
| 206 | // requested time frame |
||||||
| 207 | |||||||
| 208 | $table = mapi_folder_getcontentstable($calendar); |
||||||
|
0 ignored issues
–
show
The function
mapi_folder_getcontentstable was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||||
| 209 | |||||||
| 210 | $restriction = |
||||||
| 211 | // OR |
||||||
| 212 | [ |
||||||
| 213 | RES_OR, |
||||||
| 214 | [ |
||||||
| 215 | [RES_AND, // Normal items: itemEnd must be after viewStart, itemStart must be before viewEnd |
||||||
| 216 | [ |
||||||
| 217 | [ |
||||||
| 218 | RES_PROPERTY, |
||||||
| 219 | [ |
||||||
| 220 | RELOP => RELOP_GT, |
||||||
| 221 | ULPROPTAG => $properties["duedate"], |
||||||
| 222 | VALUE => $viewstart, |
||||||
| 223 | ], |
||||||
| 224 | ], |
||||||
| 225 | [ |
||||||
| 226 | RES_PROPERTY, |
||||||
| 227 | [ |
||||||
| 228 | RELOP => RELOP_LT, |
||||||
| 229 | ULPROPTAG => $properties["startdate"], |
||||||
| 230 | VALUE => $viewend, |
||||||
| 231 | ], |
||||||
| 232 | ], |
||||||
| 233 | ], |
||||||
| 234 | ], |
||||||
| 235 | // OR |
||||||
| 236 | [ |
||||||
| 237 | RES_PROPERTY, |
||||||
| 238 | [ |
||||||
| 239 | RELOP => RELOP_EQ, |
||||||
| 240 | ULPROPTAG => $properties["recurring"], |
||||||
| 241 | VALUE => true, |
||||||
| 242 | ], |
||||||
| 243 | ], |
||||||
| 244 | ], // EXISTS OR |
||||||
| 245 | ]; // global OR |
||||||
| 246 | |||||||
| 247 | // Get requested properties, plus whatever we need |
||||||
| 248 | $proplist = [PR_ENTRYID, $properties["recurring"], $properties["recurring_data"], $properties["timezone_data"]]; |
||||||
| 249 | $proplist = array_merge($proplist, $propsrequested); |
||||||
| 250 | |||||||
| 251 | $rows = mapi_table_queryallrows($table, $proplist, $restriction); |
||||||
|
0 ignored issues
–
show
The function
mapi_table_queryallrows was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||||
| 252 | |||||||
| 253 | // $rows now contains all the items that MAY be in the window; a recurring item needs expansion before including in the output. |
||||||
| 254 | |||||||
| 255 | foreach ($rows as $row) { |
||||||
| 256 | $items = []; |
||||||
| 257 | |||||||
| 258 | if (isset($row[$properties["recurring"]]) && $row[$properties["recurring"]]) { |
||||||
| 259 | // Recurring item |
||||||
| 260 | $rec = new Recurrence($store, $row); |
||||||
| 261 | |||||||
| 262 | // GetItems guarantees that the item overlaps the interval <$viewstart, $viewend> |
||||||
| 263 | $occurrences = $rec->getItems($viewstart, $viewend); |
||||||
| 264 | foreach ($occurrences as $occurrence) { |
||||||
| 265 | // The occurrence takes all properties from the main row, but overrides some properties (like start and end obviously) |
||||||
| 266 | $item = $occurrence + $row; |
||||||
| 267 | array_push($items, $item); |
||||||
| 268 | } |
||||||
| 269 | } |
||||||
| 270 | else { |
||||||
| 271 | // Normal item, it matched the search criteria and therefore overlaps the interval <$viewstart, $viewend> |
||||||
| 272 | array_push($items, $row); |
||||||
| 273 | } |
||||||
| 274 | |||||||
| 275 | $result = array_merge($result, $items); |
||||||
| 276 | } |
||||||
| 277 | |||||||
| 278 | // All items are guaranteed to overlap the interval <$viewstart, $viewend>. Note that we may be returning a few extra |
||||||
| 279 | // properties that the caller did not request (recurring, etc). This shouldn't be a problem though. |
||||||
| 280 | return $result; |
||||||
| 281 | } |
||||||
| 282 | |||||||
| 283 | /** |
||||||
| 284 | * Compares two entryIds. It is possible to have two different entryIds that should match as they |
||||||
| 285 | * represent the same object (in multiserver environments). |
||||||
| 286 | * |
||||||
| 287 | * @param mixed $entryId1 EntryID |
||||||
| 288 | * @param mixed $entryId2 EntryID |
||||||
| 289 | * |
||||||
| 290 | * @return bool Result of the comparison |
||||||
| 291 | */ |
||||||
| 292 | function compareEntryIds($entryId1, $entryId2) { |
||||||
| 293 | if (!is_string($entryId1) || !is_string($entryId2)) { |
||||||
| 294 | return false; |
||||||
| 295 | } |
||||||
| 296 | |||||||
| 297 | if ($entryId1 === $entryId2) { |
||||||
| 298 | // if normal comparison succeeds then we can directly say that entryids are same |
||||||
| 299 | return true; |
||||||
| 300 | } |
||||||
| 301 | |||||||
| 302 | return false; |
||||||
| 303 | } |
||||||
| 304 | |||||||
| 305 | /** |
||||||
| 306 | * Creates a goid from an ical uuid. |
||||||
| 307 | * |
||||||
| 308 | * @param string $uid |
||||||
| 309 | * |
||||||
| 310 | * @return string binary string representation of goid |
||||||
| 311 | */ |
||||||
| 312 | function getGoidFromUid($uid) { |
||||||
| 313 | return hex2bin("040000008200E00074C5B7101A82E0080000000000000000000000000000000000000000" . |
||||||
| 314 | bin2hex(pack("V", 12 + strlen($uid)) . "vCal-Uid" . pack("V", 1) . $uid)); |
||||||
| 315 | } |
||||||
| 316 | |||||||
| 317 | /** |
||||||
| 318 | * Returns zero terminated goid. It is required for backwards compatibility. |
||||||
| 319 | * |
||||||
| 320 | * @param string $icalUid an appointment uid as HEX |
||||||
| 321 | * @param mixed $uid |
||||||
| 322 | * |
||||||
| 323 | * @return string an OL compatible GlobalObjectID |
||||||
| 324 | */ |
||||||
| 325 | function getGoidFromUidZero($uid) { |
||||||
| 326 | if (strlen($uid) <= 64) { |
||||||
| 327 | return hex2bin("040000008200E00074C5B7101A82E0080000000000000000000000000000000000000000" . |
||||||
| 328 | bin2hex(pack("V", 13 + strlen($uid)) . "vCal-Uid" . pack("V", 1) . $uid) . "00"); |
||||||
| 329 | } |
||||||
| 330 | |||||||
| 331 | return hex2bin($uid); |
||||||
| 332 | } |
||||||
| 333 | |||||||
| 334 | /** |
||||||
| 335 | * Creates an ical uuid from a goid. |
||||||
| 336 | * |
||||||
| 337 | * @param string $goid |
||||||
| 338 | * |
||||||
| 339 | * @return null|string ical uuid |
||||||
| 340 | */ |
||||||
| 341 | function getUidFromGoid($goid) { |
||||||
| 342 | // check if "vCal-Uid" is somewhere in outlookid case-insensitive |
||||||
| 343 | $uid = stristr($goid, "vCal-Uid"); |
||||||
| 344 | if ($uid !== false) { |
||||||
| 345 | // get the length of the ical id - go back 4 position from where "vCal-Uid" was found |
||||||
| 346 | $begin = unpack("V", substr($goid, strlen($uid) * (-1) - 4, 4)); |
||||||
| 347 | // remove "vCal-Uid" and packed "1" and use the ical id length |
||||||
| 348 | return trim(substr($uid, 12, $begin[1] - 12)); |
||||||
| 349 | } |
||||||
| 350 | |||||||
| 351 | return null; |
||||||
| 352 | } |
||||||
| 353 | |||||||
| 354 | /** |
||||||
| 355 | * Returns an error message from error code. |
||||||
| 356 | * |
||||||
| 357 | * @param int $e error code |
||||||
| 358 | * |
||||||
| 359 | * @return string error message |
||||||
| 360 | */ |
||||||
| 361 | function mapi_strerror($e) { |
||||||
| 362 | switch ($e) { |
||||||
| 363 | case 0: return "success"; |
||||||
| 364 | |||||||
| 365 | case MAPI_E_CALL_FAILED: return "An error of unexpected or unknown origin occurred"; |
||||||
|
0 ignored issues
–
show
|
|||||||
| 366 | |||||||
| 367 | case MAPI_E_NOT_ENOUGH_MEMORY: return "Not enough memory was available to complete the operation"; |
||||||
|
0 ignored issues
–
show
|
|||||||
| 368 | |||||||
| 369 | case MAPI_E_INVALID_PARAMETER: return "An invalid parameter was passed to a function or remote procedure call"; |
||||||
|
0 ignored issues
–
show
|
|||||||
| 370 | |||||||
| 371 | case MAPI_E_INTERFACE_NOT_SUPPORTED: return "MAPI interface not supported"; |
||||||
|
0 ignored issues
–
show
|
|||||||
| 372 | |||||||
| 373 | case MAPI_E_NO_ACCESS: return "An attempt was made to access a message store or object for which the user has insufficient permissions"; |
||||||
|
0 ignored issues
–
show
|
|||||||
| 374 | |||||||
| 375 | case MAPI_E_NO_SUPPORT: return "Function is not implemented"; |
||||||
|
0 ignored issues
–
show
|
|||||||
| 376 | |||||||
| 377 | case MAPI_E_BAD_CHARWIDTH: return "An incompatibility exists in the character sets supported by the caller and the implementation"; |
||||||
|
0 ignored issues
–
show
|
|||||||
| 378 | |||||||
| 379 | case MAPI_E_STRING_TOO_LONG: return "In the context of this method call, a string exceeds the maximum permitted length"; |
||||||
|
0 ignored issues
–
show
|
|||||||
| 380 | |||||||
| 381 | case MAPI_E_UNKNOWN_FLAGS: return "One or more values for a flags parameter were not valid"; |
||||||
|
0 ignored issues
–
show
|
|||||||
| 382 | |||||||
| 383 | case MAPI_E_INVALID_ENTRYID: return "invalid entryid"; |
||||||
|
0 ignored issues
–
show
|
|||||||
| 384 | |||||||
| 385 | case MAPI_E_INVALID_OBJECT: return "A method call was made using a reference to an object that has been destroyed or is not in a viable state"; |
||||||
|
0 ignored issues
–
show
|
|||||||
| 386 | |||||||
| 387 | case MAPI_E_OBJECT_CHANGED: return "An attempt to commit changes failed because the object was changed separately"; |
||||||
|
0 ignored issues
–
show
|
|||||||
| 388 | |||||||
| 389 | case MAPI_E_OBJECT_DELETED: return "An operation failed because the object was deleted separately"; |
||||||
|
0 ignored issues
–
show
|
|||||||
| 390 | |||||||
| 391 | case MAPI_E_BUSY: return "A table operation failed because a separate operation was in progress at the same time"; |
||||||
|
0 ignored issues
–
show
|
|||||||
| 392 | |||||||
| 393 | case MAPI_E_NOT_ENOUGH_DISK: return "Not enough disk space was available to complete the operation"; |
||||||
|
0 ignored issues
–
show
|
|||||||
| 394 | |||||||
| 395 | case MAPI_E_NOT_ENOUGH_RESOURCES: return "Not enough system resources were available to complete the operation"; |
||||||
|
0 ignored issues
–
show
|
|||||||
| 396 | |||||||
| 397 | case MAPI_E_NOT_FOUND: return "The requested object could not be found at the server"; |
||||||
|
0 ignored issues
–
show
|
|||||||
| 398 | |||||||
| 399 | case MAPI_E_VERSION: return "Client and server versions are not compatible"; |
||||||
|
0 ignored issues
–
show
|
|||||||
| 400 | |||||||
| 401 | case MAPI_E_LOGON_FAILED: return "A client was unable to log on to the server"; |
||||||
|
0 ignored issues
–
show
|
|||||||
| 402 | |||||||
| 403 | case MAPI_E_SESSION_LIMIT: return "A server or service is unable to create any more sessions"; |
||||||
|
0 ignored issues
–
show
|
|||||||
| 404 | |||||||
| 405 | case MAPI_E_USER_CANCEL: return "An operation failed because a user cancelled it"; |
||||||
|
0 ignored issues
–
show
|
|||||||
| 406 | |||||||
| 407 | case MAPI_E_UNABLE_TO_ABORT: return "A ropAbort or ropAbortSubmit ROP request was unsuccessful"; |
||||||
|
0 ignored issues
–
show
|
|||||||
| 408 | |||||||
| 409 | case MAPI_E_NETWORK_ERROR: return "An operation was unsuccessful because of a problem with network operations or services"; |
||||||
|
0 ignored issues
–
show
|
|||||||
| 410 | |||||||
| 411 | case MAPI_E_DISK_ERROR: return "There was a problem writing to or reading from disk"; |
||||||
|
0 ignored issues
–
show
|
|||||||
| 412 | |||||||
| 413 | case MAPI_E_TOO_COMPLEX: return "The operation requested is too complex for the server to handle (often w.r.t. restrictions)"; |
||||||
|
0 ignored issues
–
show
|
|||||||
| 414 | |||||||
| 415 | case MAPI_E_BAD_COLUMN: return "The column requested is not allowed in this type of table"; |
||||||
|
0 ignored issues
–
show
|
|||||||
| 416 | |||||||
| 417 | case MAPI_E_EXTENDED_ERROR: return "extended error"; |
||||||
|
0 ignored issues
–
show
|
|||||||
| 418 | |||||||
| 419 | case MAPI_E_COMPUTED: return "A property cannot be updated because it is read-only, computed by the server"; |
||||||
|
0 ignored issues
–
show
|
|||||||
| 420 | |||||||
| 421 | case MAPI_E_CORRUPT_DATA: return "There is an internal inconsistency in a database, or in a complex property value"; |
||||||
|
0 ignored issues
–
show
|
|||||||
| 422 | |||||||
| 423 | case MAPI_E_UNCONFIGURED: return "unconfigured"; |
||||||
|
0 ignored issues
–
show
|
|||||||
| 424 | |||||||
| 425 | case MAPI_E_FAILONEPROVIDER: return "failoneprovider"; |
||||||
|
0 ignored issues
–
show
|
|||||||
| 426 | |||||||
| 427 | case MAPI_E_UNKNOWN_CPID: return "The server is not configured to support the code page requested by the client"; |
||||||
|
0 ignored issues
–
show
|
|||||||
| 428 | |||||||
| 429 | case MAPI_E_UNKNOWN_LCID: return "The server is not configured to support the locale requested by the client"; |
||||||
|
0 ignored issues
–
show
|
|||||||
| 430 | |||||||
| 431 | case MAPI_E_PASSWORD_CHANGE_REQUIRED: return "password change required"; |
||||||
|
0 ignored issues
–
show
|
|||||||
| 432 | |||||||
| 433 | case MAPI_E_PASSWORD_EXPIRED: return "password expired"; |
||||||
|
0 ignored issues
–
show
|
|||||||
| 434 | |||||||
| 435 | case MAPI_E_INVALID_WORKSTATION_ACCOUNT: return "invalid workstation account"; |
||||||
|
0 ignored issues
–
show
|
|||||||
| 436 | |||||||
| 437 | case MAPI_E_INVALID_ACCESS_TIME: return "The operation failed due to clock skew between servers"; |
||||||
|
0 ignored issues
–
show
|
|||||||
| 438 | |||||||
| 439 | case MAPI_E_ACCOUNT_DISABLED: return "account disabled"; |
||||||
|
0 ignored issues
–
show
|
|||||||
| 440 | |||||||
| 441 | case MAPI_E_END_OF_SESSION: return "The server session has been destroyed, possibly by a server restart"; |
||||||
|
0 ignored issues
–
show
|
|||||||
| 442 | |||||||
| 443 | case MAPI_E_UNKNOWN_ENTRYID: return "The EntryID passed to OpenEntry was created by a different MAPI provider"; |
||||||
|
0 ignored issues
–
show
|
|||||||
| 444 | |||||||
| 445 | case MAPI_E_MISSING_REQUIRED_COLUMN: return "missing required column"; |
||||||
|
0 ignored issues
–
show
|
|||||||
| 446 | |||||||
| 447 | case MAPI_W_NO_SERVICE: return "no service"; |
||||||
|
0 ignored issues
–
show
|
|||||||
| 448 | |||||||
| 449 | case MAPI_E_BAD_VALUE: return "bad value"; |
||||||
|
0 ignored issues
–
show
|
|||||||
| 450 | |||||||
| 451 | case MAPI_E_INVALID_TYPE: return "invalid type"; |
||||||
|
0 ignored issues
–
show
|
|||||||
| 452 | |||||||
| 453 | case MAPI_E_TYPE_NO_SUPPORT: return "type no support"; |
||||||
|
0 ignored issues
–
show
|
|||||||
| 454 | |||||||
| 455 | case MAPI_E_UNEXPECTED_TYPE: return "unexpected_type"; |
||||||
|
0 ignored issues
–
show
|
|||||||
| 456 | |||||||
| 457 | case MAPI_E_TOO_BIG: return "The table is too big for the requested operation to complete"; |
||||||
|
0 ignored issues
–
show
|
|||||||
| 458 | |||||||
| 459 | case MAPI_E_DECLINE_COPY: return "The provider implements this method by calling a support object method, and the caller has passed the MAPI_DECLINE_OK flag"; |
||||||
|
0 ignored issues
–
show
|
|||||||
| 460 | |||||||
| 461 | case MAPI_E_UNEXPECTED_ID: return "unexpected id"; |
||||||
|
0 ignored issues
–
show
|
|||||||
| 462 | |||||||
| 463 | case MAPI_W_ERRORS_RETURNED: return "The call succeeded, but the message store provider has error information available"; |
||||||
|
0 ignored issues
–
show
|
|||||||
| 464 | |||||||
| 465 | case MAPI_E_UNABLE_TO_COMPLETE: return "A complex operation such as building a table row set could not be completed"; |
||||||
|
0 ignored issues
–
show
|
|||||||
| 466 | |||||||
| 467 | case MAPI_E_TIMEOUT: return "An asynchronous operation did not succeed within the specified time-out"; |
||||||
|
0 ignored issues
–
show
|
|||||||
| 468 | |||||||
| 469 | case MAPI_E_TABLE_EMPTY: return "A table essential to the operation is empty"; |
||||||
|
0 ignored issues
–
show
|
|||||||
| 470 | |||||||
| 471 | case MAPI_E_TABLE_TOO_BIG: return "The table is too big for the requested operation to complete"; |
||||||
|
0 ignored issues
–
show
|
|||||||
| 472 | |||||||
| 473 | case MAPI_E_INVALID_BOOKMARK: return "The bookmark passed to a table operation was not created on the same table"; |
||||||
|
0 ignored issues
–
show
|
|||||||
| 474 | |||||||
| 475 | case MAPI_W_POSITION_CHANGED: return "position changed"; |
||||||
|
0 ignored issues
–
show
|
|||||||
| 476 | |||||||
| 477 | case MAPI_W_APPROX_COUNT: return "approx count"; |
||||||
|
0 ignored issues
–
show
|
|||||||
| 478 | |||||||
| 479 | case MAPI_E_WAIT: return "A wait time-out has expired"; |
||||||
|
0 ignored issues
–
show
|
|||||||
| 480 | |||||||
| 481 | case MAPI_E_CANCEL: return "The operation had to be canceled"; |
||||||
|
0 ignored issues
–
show
|
|||||||
| 482 | |||||||
| 483 | case MAPI_E_NOT_ME: return "not me"; |
||||||
|
0 ignored issues
–
show
|
|||||||
| 484 | |||||||
| 485 | case MAPI_W_CANCEL_MESSAGE: return "cancel message"; |
||||||
|
0 ignored issues
–
show
|
|||||||
| 486 | |||||||
| 487 | case MAPI_E_CORRUPT_STORE: return "corrupt store"; |
||||||
|
0 ignored issues
–
show
|
|||||||
| 488 | |||||||
| 489 | case MAPI_E_NOT_IN_QUEUE: return "not in queue"; |
||||||
|
0 ignored issues
–
show
|
|||||||
| 490 | |||||||
| 491 | case MAPI_E_NO_SUPPRESS: return "The server does not support the suppression of read receipts"; |
||||||
|
0 ignored issues
–
show
|
|||||||
| 492 | |||||||
| 493 | case MAPI_E_COLLISION: return "A folder or item cannot be created because one with the same name or other criteria already exists"; |
||||||
|
0 ignored issues
–
show
|
|||||||
| 494 | |||||||
| 495 | case MAPI_E_NOT_INITIALIZED: return "The subsystem is not ready"; |
||||||
|
0 ignored issues
–
show
|
|||||||
| 496 | |||||||
| 497 | case MAPI_E_NON_STANDARD: return "non standard"; |
||||||
|
0 ignored issues
–
show
|
|||||||
| 498 | |||||||
| 499 | case MAPI_E_NO_RECIPIENTS: return "A message cannot be sent because it has no recipients"; |
||||||
|
0 ignored issues
–
show
|
|||||||
| 500 | |||||||
| 501 | case MAPI_E_SUBMITTED: return "A message cannot be opened for modification because it has already been sent"; |
||||||
|
0 ignored issues
–
show
|
|||||||
| 502 | |||||||
| 503 | case MAPI_E_HAS_FOLDERS: return "A folder cannot be deleted because it still contains subfolders"; |
||||||
|
0 ignored issues
–
show
|
|||||||
| 504 | |||||||
| 505 | case MAPI_E_HAS_MESSAGES: return "A folder cannot be deleted because it still contains messages"; |
||||||
|
0 ignored issues
–
show
|
|||||||
| 506 | |||||||
| 507 | case MAPI_E_FOLDER_CYCLE: return "A folder move or copy operation would create a cycle"; |
||||||
|
0 ignored issues
–
show
|
|||||||
| 508 | |||||||
| 509 | case MAPI_W_PARTIAL_COMPLETION: return "The call succeeded, but not all entries were successfully operated on"; |
||||||
|
0 ignored issues
–
show
|
|||||||
| 510 | |||||||
| 511 | case MAPI_E_AMBIGUOUS_RECIP: return "An unresolved recipient matches more than one directory entry"; |
||||||
|
0 ignored issues
–
show
|
|||||||
| 512 | |||||||
| 513 | case MAPI_E_STORE_FULL: return "Store full"; |
||||||
|
0 ignored issues
–
show
|
|||||||
| 514 | |||||||
| 515 | default: return sprintf("%xh", $e); |
||||||
| 516 | } |
||||||
| 517 | } |
||||||
| 518 |