Passed
Push — master ( 19ba64...f0b7bd )
by
unknown
19:03 queued 09:39
created

getGoidFromUidZero()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 4
c 1
b 0
f 0
nop 1
dl 0
loc 7
rs 10
nc 2
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
The function mapi_load_mapidefs 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 ignore-call  annotation

11
/** @scrutinizer ignore-call */ 
12
mapi_load_mapidefs(1);
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
 * @return false|string
30
 */
31
function makeGuid($guid) {
32
	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));
33
}
34
35
/**
36
 * Function to get a human readable string from a MAPI error code.
37
 *
38
 * @param mixed $errcode the MAPI error code, if not given, we use mapi_last_hresult
39
 *
40
 * @return string The defined name for the MAPI error code
41
 */
42
function get_mapi_error_name($errcode = null) {
43
	if ($errcode === null) {
44
		$errcode = mapi_last_hresult();
45
	}
46
47
	if (strcasecmp(substr($errcode, 0, 2), '0x') === 0) {
48
		$errcode = hexdec($errcode);
49
	}
50
51
	if ($errcode !== 0) {
52
		// Retrieve constants categories, MAPI error names are defined in gromox.
53
		foreach (get_defined_constants(true)['Core'] as $key => $value) {
54
			/*
55
			 * If PHP encounters a number beyond the bounds of the integer type,
56
			 * it will be interpreted as a float instead, so when comparing these error codes
57
			 * we have to manually typecast value to integer, so float will be converted in integer,
58
			 * but still its out of bound for integer limit so it will be auto adjusted to minus value
59
			 */
60
			if ($errcode == (int) $value) {
61
				// Check that we have an actual MAPI error or warning definition
62
				$prefix = substr($key, 0, 7);
63
				if ($prefix == "MAPI_E_" || $prefix == "MAPI_W_") {
64
					return $key;
65
				}
66
				$prefix = substr($key, 0, 2);
67
				if ($prefix == "ec") {
68
					return $key;
69
				}
70
			}
71
		}
72
	}
73
	else {
74
		return "NOERROR";
75
	}
76
77
	// error code not found, return hex value (this is a fix for 64-bit systems, we can't use the dechex() function for this)
78
	$result = unpack("H*", pack("N", $errcode));
79
80
	return "0x" . $result[1];
81
}
82
83
/**
84
 * Parses properties from an array of strings. Each "string" may be either an ULONG, which is a direct property ID,
85
 * or a string with format "PT_TYPE:{GUID}:StringId" or "PT_TYPE:{GUID}:0xXXXX" for named
86
 * properties.
87
 *
88
 * @param mixed $store
89
 * @param mixed $mapping
90
 *
91
 * @return array
92
 */
93
function getPropIdsFromStrings($store, $mapping) {
94
	$props = [];
95
96
	$ids = ["name" => [], "id" => [], "guid" => [], "type" => []]; // this array stores all the information needed to retrieve a named property
97
	$num = 0;
98
99
	// caching
100
	$guids = [];
101
102
	foreach ($mapping as $name => $val) {
103
		if (is_string($val)) {
104
			$split = explode(":", $val);
105
106
			if (count($split) != 3) { // invalid string, ignore
107
				trigger_error(sprintf("Invalid property: %s \"%s\"", $name, $val), E_USER_NOTICE);
108
109
				continue;
110
			}
111
112
			if (substr($split[2], 0, 2) == "0x") {
113
				$id = hexdec(substr($split[2], 2));
114
			}
115
			elseif (preg_match('/^[1-9][0-9]{0,12}$/', $split[2])) {
116
				$id = (int) $split[2];
117
			}
118
			else {
119
				$id = $split[2];
120
			}
121
122
			// have we used this guid before?
123
			if (!defined($split[1])) {
124
				if (!array_key_exists($split[1], $guids)) {
125
					$guids[$split[1]] = makeguid($split[1]);
126
				}
127
				$guid = $guids[$split[1]];
128
			}
129
			else {
130
				$guid = constant($split[1]);
131
			}
132
133
			// temp store info about named prop, so we have to call mapi_getidsfromnames just one time
134
			$ids["name"][$num] = $name;
135
			$ids["id"][$num] = $id;
136
			$ids["guid"][$num] = $guid;
137
			$ids["type"][$num] = $split[0];
138
			++$num;
139
		}
140
		else {
141
			// not a named property
142
			$props[$name] = $val;
143
		}
144
	}
145
146
	if (empty($ids["id"])) {
147
		return $props;
148
	}
149
150
	// get the ids
151
	$named = mapi_getidsfromnames($store, $ids["id"], $ids["guid"]);
0 ignored issues
show
Bug introduced by
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 ignore-call  annotation

151
	$named = /** @scrutinizer ignore-call */ mapi_getidsfromnames($store, $ids["id"], $ids["guid"]);
Loading history...
152
	foreach ($named as $num => $prop) {
153
		$props[$ids["name"][$num]] = mapi_prop_tag(constant($ids["type"][$num]), mapi_prop_id($prop));
154
	}
155
156
	return $props;
157
}
158
159
/**
160
 * Check whether a call to mapi_getprops returned errors for some properties.
161
 * mapi_getprops function tries to get values of properties requested but somehow if
162
 * if a property value can not be fetched then it changes type of property tag as PT_ERROR
163
 * and returns error for that particular property, probable errors
164
 * that can be returned as value can be MAPI_E_NOT_FOUND, MAPI_E_NOT_ENOUGH_MEMORY.
165
 *
166
 * @param int   $property  Property to check for error
167
 * @param array $propArray An array of properties
168
 *
169
 * @return bool|mixed Gives back false when there is no error, if there is, gives the error
170
 */
171
function propIsError($property, $propArray) {
172
	if (array_key_exists(mapi_prop_tag(PT_ERROR, mapi_prop_id($property)), $propArray)) {
173
		return $propArray[mapi_prop_tag(PT_ERROR, mapi_prop_id($property))];
174
	}
175
176
	return false;
177
}
178
179
/**
180
 * Note: Static function, more like a utility function.
181
 *
182
 * Gets all the items (including recurring items) in the specified calendar in the given timeframe. Items are
183
 * included as a whole if they overlap the interval <$start, $end> (non-inclusive). This means that if the interval
184
 * 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
185
 * [7:00 - 9:00> is included as a whole, and is NOT capped to [8:00 - 9:00>.
186
 *
187
 * @param resource $store          The store in which the calendar resides
188
 * @param resource $calendar       The calendar to get the items from
189
 * @param int      $viewstart      Timestamp of beginning of view window
190
 * @param int      $viewend        Timestamp of end of view window
191
 * @param array    $propsrequested Array of properties to return
192
 *
193
 * @return array
194
 */
195
function getCalendarItems($store, $calendar, $viewstart, $viewend, $propsrequested) {
196
	$result = [];
197
	$properties = getPropIdsFromStrings($store, [
198
		"duedate" => "PT_SYSTIME:PSETID_Appointment:" . PidLidAppointmentEndWhole,
0 ignored issues
show
Bug introduced by
The constant PidLidAppointmentEndWhole was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
199
		"startdate" => "PT_SYSTIME:PSETID_Appointment:" . PidLidAppointmentStartWhole,
0 ignored issues
show
Bug introduced by
The constant PidLidAppointmentStartWhole was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
200
		"enddate_recurring" => "PT_SYSTIME:PSETID_Appointment:" . PidLidClipEnd,
0 ignored issues
show
Bug introduced by
The constant PidLidClipEnd was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
201
		"recurring" => "PT_BOOLEAN:PSETID_Appointment:" . PidLidRecurring,
0 ignored issues
show
Bug introduced by
The constant PidLidRecurring was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
202
		"recurring_data" => "PT_BINARY:PSETID_Appointment:" . PidLidAppointmentRecur,
0 ignored issues
show
Bug introduced by
The constant PidLidAppointmentRecur was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
203
		"timezone_data" => "PT_BINARY:PSETID_Appointment:" . PidLidTimeZoneStruct,
0 ignored issues
show
Bug introduced by
The constant PidLidTimeZoneStruct was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
204
		"label" => "PT_LONG:PSETID_Appointment:0x8214",
205
	]);
206
207
	// Create a restriction that will discard rows of appointments that are definitely not in our
208
	// requested time frame
209
210
	$table = mapi_folder_getcontentstable($calendar);
211
212
	$restriction =
213
		// OR
214
		[
215
			RES_OR,
216
			[
217
				[RES_AND,	// Normal items: itemEnd must be after viewStart, itemStart must be before viewEnd
218
					[
219
						[
220
							RES_PROPERTY,
221
							[
222
								RELOP => RELOP_GT,
223
								ULPROPTAG => $properties["duedate"],
224
								VALUE => $viewstart,
225
							],
226
						],
227
						[
228
							RES_PROPERTY,
229
							[
230
								RELOP => RELOP_LT,
231
								ULPROPTAG => $properties["startdate"],
232
								VALUE => $viewend,
233
							],
234
						],
235
					],
236
				],
237
				// OR
238
				[
239
					RES_PROPERTY,
240
					[
241
						RELOP => RELOP_EQ,
242
						ULPROPTAG => $properties["recurring"],
243
						VALUE => true,
244
					],
245
				],
246
			],	// EXISTS OR
247
		];		// global OR
248
249
	// Get requested properties, plus whatever we need
250
	$proplist = [PR_ENTRYID, $properties["recurring"], $properties["recurring_data"], $properties["timezone_data"]];
251
	$proplist = array_merge($proplist, $propsrequested);
252
253
	$rows = mapi_table_queryallrows($table, $proplist, $restriction);
254
255
	// $rows now contains all the items that MAY be in the window; a recurring item needs expansion before including in the output.
256
257
	foreach ($rows as $row) {
258
		$items = [];
259
260
		if (isset($row[$properties["recurring"]]) && $row[$properties["recurring"]]) {
261
			// Recurring item
262
			$rec = new Recurrence($store, $row);
263
264
			// GetItems guarantees that the item overlaps the interval <$viewstart, $viewend>
265
			$occurrences = $rec->getItems($viewstart, $viewend);
266
			foreach ($occurrences as $occurrence) {
267
				// The occurrence takes all properties from the main row, but overrides some properties (like start and end obviously)
268
				$item = $occurrence + $row;
269
				array_push($items, $item);
270
			}
271
		}
272
		else {
273
			// Normal item, it matched the search criteria and therefore overlaps the interval <$viewstart, $viewend>
274
			array_push($items, $row);
275
		}
276
277
		$result = array_merge($result, $items);
278
	}
279
280
	// All items are guaranteed to overlap the interval <$viewstart, $viewend>. Note that we may be returning a few extra
281
	// properties that the caller did not request (recurring, etc). This shouldn't be a problem though.
282
	return $result;
283
}
284
285
/**
286
 * Compares two entryIds. It is possible to have two different entryIds that should match as they
287
 * represent the same object (in multiserver environments).
288
 *
289
 * @param mixed $entryId1 EntryID
290
 * @param mixed $entryId2 EntryID
291
 *
292
 * @return bool Result of the comparison
293
 */
294
function compareEntryIds($entryId1, $entryId2) {
295
	if (!is_string($entryId1) || !is_string($entryId2)) {
296
		return false;
297
	}
298
299
	if ($entryId1 === $entryId2) {
300
		// if normal comparison succeeds then we can directly say that entryids are same
301
		return true;
302
	}
303
304
	return false;
305
}
306
307
/**
308
 * Creates a goid from an ical uuid.
309
 *
310
 * @param string $uid
311
 *
312
 * @return string binary string representation of goid
313
 */
314
function getGoidFromUid($uid) {
315
	return hex2bin("040000008200E00074C5B7101A82E0080000000000000000000000000000000000000000" .
316
				bin2hex(pack("V", 12 + strlen($uid)) . "vCal-Uid" . pack("V", 1) . $uid));
317
}
318
319
/**
320
 * Returns zero terminated goid. It is required for backwards compatibility.
321
 * 
322
 *
323
 * @param string $icalUid an appointment uid as HEX
324
 *
325
 * @return string an OL compatible GlobalObjectID
326
 */
327
function getGoidFromUidZero($uid) {
328
	if (strlen($uid) <= 64) {
329
		return hex2bin("040000008200E00074C5B7101A82E0080000000000000000000000000000000000000000" .
330
			bin2hex(pack("V", 13 + strlen($uid)) . "vCal-Uid" . pack("V", 1) . $uid) . "00");
331
	}
332
333
	return hex2bin($uid);
334
}
335
336
/**
337
 * Creates an ical uuid from a goid.
338
 *
339
 * @param string $goid
340
 *
341
 * @return null|string ical uuid
342
 */
343
function getUidFromGoid($goid) {
344
	// check if "vCal-Uid" is somewhere in outlookid case-insensitive
345
	$uid = stristr($goid, "vCal-Uid");
346
	if ($uid !== false) {
347
		// get the length of the ical id - go back 4 position from where "vCal-Uid" was found
348
		$begin = unpack("V", substr($goid, strlen($uid) * (-1) - 4, 4));
349
		// remove "vCal-Uid" and packed "1" and use the ical id length
350
		return trim(substr($uid, 12, $begin[1] - 12));
351
	}
352
353
	return null;
354
}
355
356
/**
357
 * Returns an error message from error code.
358
 *
359
 * @param int $e error code
360
 *
361
 * @return string error message
362
 */
363
function mapi_strerror($e) {
364
	switch ($e) {
365
		case 0: return "success";
366
367
		case MAPI_E_CALL_FAILED: return "An error of unexpected or unknown origin occurred";
0 ignored issues
show
Bug introduced by
The constant MAPI_E_CALL_FAILED was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
368
369
		case MAPI_E_NOT_ENOUGH_MEMORY: return "Not enough memory was available to complete the operation";
0 ignored issues
show
Bug introduced by
The constant MAPI_E_NOT_ENOUGH_MEMORY was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
370
371
		case MAPI_E_INVALID_PARAMETER: return "An invalid parameter was passed to a function or remote procedure call";
0 ignored issues
show
Bug introduced by
The constant MAPI_E_INVALID_PARAMETER was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
372
373
		case MAPI_E_INTERFACE_NOT_SUPPORTED: return "MAPI interface not supported";
0 ignored issues
show
Bug introduced by
The constant MAPI_E_INTERFACE_NOT_SUPPORTED was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
374
375
		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
Bug introduced by
The constant MAPI_E_NO_ACCESS was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
376
377
		case MAPI_E_NO_SUPPORT: return "Function is not implemented";
0 ignored issues
show
Bug introduced by
The constant MAPI_E_NO_SUPPORT was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
378
379
		case MAPI_E_BAD_CHARWIDTH: return "An incompatibility exists in the character sets supported by the caller and the implementation";
0 ignored issues
show
Bug introduced by
The constant MAPI_E_BAD_CHARWIDTH was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
380
381
		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
Bug introduced by
The constant MAPI_E_STRING_TOO_LONG was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
382
383
		case MAPI_E_UNKNOWN_FLAGS: return "One or more values for a flags parameter were not valid";
0 ignored issues
show
Bug introduced by
The constant MAPI_E_UNKNOWN_FLAGS was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
384
385
		case MAPI_E_INVALID_ENTRYID: return "invalid entryid";
0 ignored issues
show
Bug introduced by
The constant MAPI_E_INVALID_ENTRYID was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
386
387
		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
Bug introduced by
The constant MAPI_E_INVALID_OBJECT was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
388
389
		case MAPI_E_OBJECT_CHANGED: return "An attempt to commit changes failed because the object was changed separately";
0 ignored issues
show
Bug introduced by
The constant MAPI_E_OBJECT_CHANGED was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
390
391
		case MAPI_E_OBJECT_DELETED: return "An operation failed because the object was deleted separately";
0 ignored issues
show
Bug introduced by
The constant MAPI_E_OBJECT_DELETED was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
392
393
		case MAPI_E_BUSY: return "A table operation failed because a separate operation was in progress at the same time";
0 ignored issues
show
Bug introduced by
The constant MAPI_E_BUSY was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
394
395
		case MAPI_E_NOT_ENOUGH_DISK: return "Not enough disk space was available to complete the operation";
0 ignored issues
show
Bug introduced by
The constant MAPI_E_NOT_ENOUGH_DISK was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
396
397
		case MAPI_E_NOT_ENOUGH_RESOURCES: return "Not enough system resources were available to complete the operation";
0 ignored issues
show
Bug introduced by
The constant MAPI_E_NOT_ENOUGH_RESOURCES was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
398
399
		case MAPI_E_NOT_FOUND: return "The requested object could not be found at the server";
0 ignored issues
show
Bug introduced by
The constant MAPI_E_NOT_FOUND was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
400
401
		case MAPI_E_VERSION: return "Client and server versions are not compatible";
0 ignored issues
show
Bug introduced by
The constant MAPI_E_VERSION was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
402
403
		case MAPI_E_LOGON_FAILED: return "A client was unable to log on to the server";
0 ignored issues
show
Bug introduced by
The constant MAPI_E_LOGON_FAILED was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
404
405
		case MAPI_E_SESSION_LIMIT: return "A server or service is unable to create any more sessions";
0 ignored issues
show
Bug introduced by
The constant MAPI_E_SESSION_LIMIT was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
406
407
		case MAPI_E_USER_CANCEL: return "An operation failed because a user cancelled it";
0 ignored issues
show
Bug introduced by
The constant MAPI_E_USER_CANCEL was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
408
409
		case MAPI_E_UNABLE_TO_ABORT: return "A ropAbort or ropAbortSubmit ROP request was unsuccessful";
0 ignored issues
show
Bug introduced by
The constant MAPI_E_UNABLE_TO_ABORT was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
410
411
		case MAPI_E_NETWORK_ERROR: return "An operation was unsuccessful because of a problem with network operations or services";
0 ignored issues
show
Bug introduced by
The constant MAPI_E_NETWORK_ERROR was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
412
413
		case MAPI_E_DISK_ERROR: return "There was a problem writing to or reading from disk";
0 ignored issues
show
Bug introduced by
The constant MAPI_E_DISK_ERROR was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
414
415
		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
Bug introduced by
The constant MAPI_E_TOO_COMPLEX was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
416
417
		case MAPI_E_BAD_COLUMN: return "The column requested is not allowed in this type of table";
0 ignored issues
show
Bug introduced by
The constant MAPI_E_BAD_COLUMN was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
418
419
		case MAPI_E_EXTENDED_ERROR: return "extended error";
0 ignored issues
show
Bug introduced by
The constant MAPI_E_EXTENDED_ERROR was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
420
421
		case MAPI_E_COMPUTED: return "A property cannot be updated because it is read-only, computed by the server";
0 ignored issues
show
Bug introduced by
The constant MAPI_E_COMPUTED was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
422
423
		case MAPI_E_CORRUPT_DATA: return "There is an internal inconsistency in a database, or in a complex property value";
0 ignored issues
show
Bug introduced by
The constant MAPI_E_CORRUPT_DATA was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
424
425
		case MAPI_E_UNCONFIGURED: return "unconfigured";
0 ignored issues
show
Bug introduced by
The constant MAPI_E_UNCONFIGURED was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
426
427
		case MAPI_E_FAILONEPROVIDER: return "failoneprovider";
0 ignored issues
show
Bug introduced by
The constant MAPI_E_FAILONEPROVIDER was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
428
429
		case MAPI_E_UNKNOWN_CPID: return "The server is not configured to support the code page requested by the client";
0 ignored issues
show
Bug introduced by
The constant MAPI_E_UNKNOWN_CPID was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
430
431
		case MAPI_E_UNKNOWN_LCID: return "The server is not configured to support the locale requested by the client";
0 ignored issues
show
Bug introduced by
The constant MAPI_E_UNKNOWN_LCID was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
432
433
		case MAPI_E_PASSWORD_CHANGE_REQUIRED: return "password change required";
0 ignored issues
show
Bug introduced by
The constant MAPI_E_PASSWORD_CHANGE_REQUIRED was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
434
435
		case MAPI_E_PASSWORD_EXPIRED: return "password expired";
0 ignored issues
show
Bug introduced by
The constant MAPI_E_PASSWORD_EXPIRED was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
436
437
		case MAPI_E_INVALID_WORKSTATION_ACCOUNT: return "invalid workstation account";
0 ignored issues
show
Bug introduced by
The constant MAPI_E_INVALID_WORKSTATION_ACCOUNT was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
438
439
		case MAPI_E_INVALID_ACCESS_TIME: return "The operation failed due to clock skew between servers";
0 ignored issues
show
Bug introduced by
The constant MAPI_E_INVALID_ACCESS_TIME was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
440
441
		case MAPI_E_ACCOUNT_DISABLED: return "account disabled";
0 ignored issues
show
Bug introduced by
The constant MAPI_E_ACCOUNT_DISABLED was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
442
443
		case MAPI_E_END_OF_SESSION: return "The server session has been destroyed, possibly by a server restart";
0 ignored issues
show
Bug introduced by
The constant MAPI_E_END_OF_SESSION was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
444
445
		case MAPI_E_UNKNOWN_ENTRYID: return "The EntryID passed to OpenEntry was created by a different MAPI provider";
0 ignored issues
show
Bug introduced by
The constant MAPI_E_UNKNOWN_ENTRYID was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
446
447
		case MAPI_E_MISSING_REQUIRED_COLUMN: return "missing required column";
0 ignored issues
show
Bug introduced by
The constant MAPI_E_MISSING_REQUIRED_COLUMN was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
448
449
		case MAPI_W_NO_SERVICE: return "no service";
0 ignored issues
show
Bug introduced by
The constant MAPI_W_NO_SERVICE was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
450
451
		case MAPI_E_BAD_VALUE: return "bad value";
0 ignored issues
show
Bug introduced by
The constant MAPI_E_BAD_VALUE was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
452
453
		case MAPI_E_INVALID_TYPE: return "invalid type";
0 ignored issues
show
Bug introduced by
The constant MAPI_E_INVALID_TYPE was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
454
455
		case MAPI_E_TYPE_NO_SUPPORT: return "type no support";
0 ignored issues
show
Bug introduced by
The constant MAPI_E_TYPE_NO_SUPPORT was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
456
457
		case MAPI_E_UNEXPECTED_TYPE: return "unexpected_type";
0 ignored issues
show
Bug introduced by
The constant MAPI_E_UNEXPECTED_TYPE was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
458
459
		case MAPI_E_TOO_BIG: return "The table is too big for the requested operation to complete";
0 ignored issues
show
Bug introduced by
The constant MAPI_E_TOO_BIG was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
460
461
		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
Bug introduced by
The constant MAPI_E_DECLINE_COPY was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
462
463
		case MAPI_E_UNEXPECTED_ID: return "unexpected id";
0 ignored issues
show
Bug introduced by
The constant MAPI_E_UNEXPECTED_ID was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
464
465
		case MAPI_W_ERRORS_RETURNED: return "The call succeeded, but the message store provider has error information available";
0 ignored issues
show
Bug introduced by
The constant MAPI_W_ERRORS_RETURNED was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
466
467
		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
Bug introduced by
The constant MAPI_E_UNABLE_TO_COMPLETE was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
468
469
		case MAPI_E_TIMEOUT: return "An asynchronous operation did not succeed within the specified time-out";
0 ignored issues
show
Bug introduced by
The constant MAPI_E_TIMEOUT was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
470
471
		case MAPI_E_TABLE_EMPTY: return "A table essential to the operation is empty";
0 ignored issues
show
Bug introduced by
The constant MAPI_E_TABLE_EMPTY was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
472
473
		case MAPI_E_TABLE_TOO_BIG: return "The table is too big for the requested operation to complete";
0 ignored issues
show
Bug introduced by
The constant MAPI_E_TABLE_TOO_BIG was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
474
475
		case MAPI_E_INVALID_BOOKMARK: return "The bookmark passed to a table operation was not created on the same table";
0 ignored issues
show
Bug introduced by
The constant MAPI_E_INVALID_BOOKMARK was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
476
477
		case MAPI_W_POSITION_CHANGED: return "position changed";
0 ignored issues
show
Bug introduced by
The constant MAPI_W_POSITION_CHANGED was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
478
479
		case MAPI_W_APPROX_COUNT: return "approx count";
0 ignored issues
show
Bug introduced by
The constant MAPI_W_APPROX_COUNT was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
480
481
		case MAPI_E_WAIT: return "A wait time-out has expired";
0 ignored issues
show
Bug introduced by
The constant MAPI_E_WAIT was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
482
483
		case MAPI_E_CANCEL: return "The operation had to be canceled";
0 ignored issues
show
Bug introduced by
The constant MAPI_E_CANCEL was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
484
485
		case MAPI_E_NOT_ME: return "not me";
0 ignored issues
show
Bug introduced by
The constant MAPI_E_NOT_ME was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
486
487
		case MAPI_W_CANCEL_MESSAGE: return "cancel message";
0 ignored issues
show
Bug introduced by
The constant MAPI_W_CANCEL_MESSAGE was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
488
489
		case MAPI_E_CORRUPT_STORE: return "corrupt store";
0 ignored issues
show
Bug introduced by
The constant MAPI_E_CORRUPT_STORE was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
490
491
		case MAPI_E_NOT_IN_QUEUE: return "not in queue";
0 ignored issues
show
Bug introduced by
The constant MAPI_E_NOT_IN_QUEUE was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
492
493
		case MAPI_E_NO_SUPPRESS: return "The server does not support the suppression of read receipts";
0 ignored issues
show
Bug introduced by
The constant MAPI_E_NO_SUPPRESS was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
494
495
		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
Bug introduced by
The constant MAPI_E_COLLISION was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
496
497
		case MAPI_E_NOT_INITIALIZED: return "The subsystem is not ready";
0 ignored issues
show
Bug introduced by
The constant MAPI_E_NOT_INITIALIZED was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
498
499
		case MAPI_E_NON_STANDARD: return "non standard";
0 ignored issues
show
Bug introduced by
The constant MAPI_E_NON_STANDARD was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
500
501
		case MAPI_E_NO_RECIPIENTS: return "A message cannot be sent because it has no recipients";
0 ignored issues
show
Bug introduced by
The constant MAPI_E_NO_RECIPIENTS was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
502
503
		case MAPI_E_SUBMITTED: return "A message cannot be opened for modification because it has already been sent";
0 ignored issues
show
Bug introduced by
The constant MAPI_E_SUBMITTED was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
504
505
		case MAPI_E_HAS_FOLDERS: return "A folder cannot be deleted because it still contains subfolders";
0 ignored issues
show
Bug introduced by
The constant MAPI_E_HAS_FOLDERS was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
506
507
		case MAPI_E_HAS_MESSAGES: return "A folder cannot be deleted because it still contains messages";
0 ignored issues
show
Bug introduced by
The constant MAPI_E_HAS_MESSAGES was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
508
509
		case MAPI_E_FOLDER_CYCLE: return "A folder move or copy operation would create a cycle";
0 ignored issues
show
Bug introduced by
The constant MAPI_E_FOLDER_CYCLE was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
510
511
		case MAPI_W_PARTIAL_COMPLETION: return "The call succeeded, but not all entries were successfully operated on";
0 ignored issues
show
Bug introduced by
The constant MAPI_W_PARTIAL_COMPLETION was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
512
513
		case MAPI_E_AMBIGUOUS_RECIP: return "An unresolved recipient matches more than one directory entry";
0 ignored issues
show
Bug introduced by
The constant MAPI_E_AMBIGUOUS_RECIP was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
514
515
		case MAPI_E_STORE_FULL: return "Store full";
0 ignored issues
show
Bug introduced by
The constant MAPI_E_STORE_FULL was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
516
517
		default: return sprintf("%xh", $e);
518
	}
519
}
520