Test Failed
Branch master (0ea1c2)
by Mike
31:02 queued 10:14
created
plugins/files/php/plugin.files.php 1 patch
Switch Indentation   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -49,39 +49,39 @@
 block discarded – undo
49 49
 
50 50
             case 'server.index.load.custom':
51 51
                 switch ($data['name']) {
52
-                case 'files_get_recipients':
53
-                    RecipientHandler::doGetRecipients();
52
+                    case 'files_get_recipients':
53
+                        RecipientHandler::doGetRecipients();
54 54
 
55
-                    break;
55
+                        break;
56 56
 
57
-                case 'download_file':
58
-                    DownloadHandler::doDownload();
57
+                    case 'download_file':
58
+                        DownloadHandler::doDownload();
59 59
 
60
-                    break;
60
+                        break;
61 61
 
62
-                case 'upload_file':
63
-                    UploadHandler::doUpload();
62
+                    case 'upload_file':
63
+                        UploadHandler::doUpload();
64 64
 
65
-                    break;
65
+                        break;
66 66
 
67
-                case 'form':
68
-                    if (isset($_GET['backend'])) {
69
-                        $backend = urldecode($_GET['backend']);
70
-                    } else {
71
-                        $backend = '';
72
-                    }
73
-                    $backendstore = Files\Backend\BackendStore::getInstance();
67
+                    case 'form':
68
+                        if (isset($_GET['backend'])) {
69
+                            $backend = urldecode($_GET['backend']);
70
+                        } else {
71
+                            $backend = '';
72
+                        }
73
+                        $backendstore = Files\Backend\BackendStore::getInstance();
74 74
 
75
-                    if ($backendstore->backendExists($backend)) {
76
-                        $backendInstance = $backendstore->getInstanceOfBackend($backend);
77
-                        $formdata = $backendInstance->getFormConfig();
75
+                        if ($backendstore->backendExists($backend)) {
76
+                            $backendInstance = $backendstore->getInstanceOfBackend($backend);
77
+                            $formdata = $backendInstance->getFormConfig();
78 78
 
79
-                        exit($formdata);
80
-                    }
79
+                            exit($formdata);
80
+                        }
81 81
 
82
-                        exit('Specified backend does not exist!');
82
+                            exit('Specified backend does not exist!');
83 83
 
84
-                    break;
84
+                        break;
85 85
             }
86 86
 
87 87
             break;
Please login to merge, or discard this patch.
plugins/smime/php/class.certificate.php 1 patch
Switch Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -34,14 +34,14 @@
 block discarded – undo
34 34
         }
35 35
 
36 36
         switch ($this->status) {
37
-        case 'good':
38
-            return OCSP_CERT_STATUS_GOOD;
37
+            case 'good':
38
+                return OCSP_CERT_STATUS_GOOD;
39 39
 
40
-        case 'revoked':
41
-            return OCSP_CERT_STATUS_REVOKED;
40
+            case 'revoked':
41
+                return OCSP_CERT_STATUS_REVOKED;
42 42
 
43
-        default:
44
-            return OCSP_CERT_STATUS_UNKOWN;
43
+            default:
44
+                return OCSP_CERT_STATUS_UNKOWN;
45 45
         }
46 46
     }
47 47
 }
Please login to merge, or discard this patch.
server/includes/modules/class.advancedsearchlistmodule.php 1 patch
Switch Indentation   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -215,18 +215,18 @@  discard block
 block discarded – undo
215 215
                 $errorInfo = [];
216 216
 
217 217
                 switch (mapi_last_hresult()) {
218
-                case MAPI_E_NO_ACCESS:
219
-                    $errorInfo['error_message'] = _('Unable to perform search query, no permissions to create search folder.');
218
+                    case MAPI_E_NO_ACCESS:
219
+                        $errorInfo['error_message'] = _('Unable to perform search query, no permissions to create search folder.');
220 220
 
221
-                    break;
221
+                        break;
222 222
 
223
-                case MAPI_E_NOT_FOUND:
224
-                    $errorInfo['error_message'] = _('Unable to perform search query, search folder not found.');
223
+                    case MAPI_E_NOT_FOUND:
224
+                        $errorInfo['error_message'] = _('Unable to perform search query, search folder not found.');
225 225
 
226
-                    break;
226
+                        break;
227 227
 
228
-                default:
229
-                    $errorInfo['error_message'] = _('Unable to perform search query, store might not support searching.');
228
+                    default:
229
+                        $errorInfo['error_message'] = _('Unable to perform search query, store might not support searching.');
230 230
                 }
231 231
 
232 232
                 $errorInfo['original_error_message'] = _('Error in creating search folder.');
@@ -381,45 +381,45 @@  discard block
 block discarded – undo
381 381
                 $subres = $restriction[1];
382 382
 
383 383
                 switch ($subres[ULPROPTAG]) {
384
-                case PR_SUBJECT:
385
-                    $patterns['subject'] = $subres[VALUE][$subres[ULPROPTAG]];
384
+                    case PR_SUBJECT:
385
+                        $patterns['subject'] = $subres[VALUE][$subres[ULPROPTAG]];
386 386
 
387
-                    break;
387
+                        break;
388 388
 
389
-                case PR_BODY:
390
-                    $patterns['content'] = $subres[VALUE][$subres[ULPROPTAG]];
391
-                    $patterns['attachments'] = $subres[VALUE][$subres[ULPROPTAG]];
389
+                    case PR_BODY:
390
+                        $patterns['content'] = $subres[VALUE][$subres[ULPROPTAG]];
391
+                        $patterns['attachments'] = $subres[VALUE][$subres[ULPROPTAG]];
392 392
 
393
-                    break;
393
+                        break;
394 394
 
395
-                case PR_SENDER_NAME:
396
-                    $patterns['sender'] = $subres[VALUE][$subres[ULPROPTAG]];
395
+                    case PR_SENDER_NAME:
396
+                        $patterns['sender'] = $subres[VALUE][$subres[ULPROPTAG]];
397 397
 
398
-                    break;
398
+                        break;
399 399
 
400
-                case PR_SENT_REPRESENTING_NAME:
401
-                    $patterns['from'] = $subres[VALUE][$subres[ULPROPTAG]];
400
+                    case PR_SENT_REPRESENTING_NAME:
401
+                        $patterns['from'] = $subres[VALUE][$subres[ULPROPTAG]];
402 402
 
403
-                    break;
403
+                        break;
404 404
 
405
-                case PR_DISPLAY_TO:
406
-                case PR_DISPLAY_CC:
407
-                    $patterns['recipients'] = $subres[VALUE][$subres[ULPROPTAG]];
405
+                    case PR_DISPLAY_TO:
406
+                    case PR_DISPLAY_CC:
407
+                        $patterns['recipients'] = $subres[VALUE][$subres[ULPROPTAG]];
408 408
 
409
-                    break;
409
+                        break;
410 410
 
411
-                case PR_MESSAGE_CLASS:
412
-                    if (empty($patterns['message_classes'])) {
413
-                        $patterns['message_classes'] = [];
414
-                    }
415
-                    $patterns['message_classes'][] = $subres[VALUE][$subres[ULPROPTAG]];
411
+                    case PR_MESSAGE_CLASS:
412
+                        if (empty($patterns['message_classes'])) {
413
+                            $patterns['message_classes'] = [];
414
+                        }
415
+                        $patterns['message_classes'][] = $subres[VALUE][$subres[ULPROPTAG]];
416 416
 
417
-                    break;
417
+                        break;
418 418
 
419
-                case PR_DISPLAY_NAME:
420
-                    $patterns['others'] = $subres[VALUE][$subres[ULPROPTAG]];
419
+                    case PR_DISPLAY_NAME:
420
+                        $patterns['others'] = $subres[VALUE][$subres[ULPROPTAG]];
421 421
 
422
-                    break;
422
+                        break;
423 423
                 }
424 424
             } elseif (RES_AND == $type || RES_OR == $type) {
425 425
                 foreach ($restriction[1] as $subres) {
Please login to merge, or discard this patch.
server/includes/modules/class.listmodule.php 1 patch
Switch Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -270,18 +270,18 @@
 block discarded – undo
270 270
                 $errorInfo = [];
271 271
 
272 272
                 switch (mapi_last_hresult()) {
273
-                case MAPI_E_NO_ACCESS:
274
-                    $errorInfo['error_message'] = _('Unable to perform search query, no permissions to create search folder.');
273
+                    case MAPI_E_NO_ACCESS:
274
+                        $errorInfo['error_message'] = _('Unable to perform search query, no permissions to create search folder.');
275 275
 
276
-                    break;
276
+                        break;
277 277
 
278
-                case MAPI_E_NOT_FOUND:
279
-                    $errorInfo['error_message'] = _('Unable to perform search query, search folder not found.');
278
+                    case MAPI_E_NOT_FOUND:
279
+                        $errorInfo['error_message'] = _('Unable to perform search query, search folder not found.');
280 280
 
281
-                    break;
281
+                        break;
282 282
 
283
-                default:
284
-                    $errorInfo['error_message'] = _('Unable to perform search query, store might not support searching.');
283
+                    default:
284
+                        $errorInfo['error_message'] = _('Unable to perform search query, store might not support searching.');
285 285
                 }
286 286
 
287 287
                 $errorInfo['original_error_message'] = _('Error in creating search folder.');
Please login to merge, or discard this patch.
server/includes/core/class.configcheck.php 1 patch
Switch Indentation   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -353,44 +353,44 @@
 block discarded – undo
353 353
         $result = true;
354 354
 
355 355
         switch ($loader) {
356
-        case LOAD_RELEASE:
357
-            if (!is_file(BASE_PATH . '/client/grommunio.js')) {
358
-                $this->error('<strong>LOAD_RELEASE configured, but no release files found</strong>', $help_msg);
359
-                $result = false;
360
-            } elseif (is_dir(BASE_PATH . '/client/zarafa')) {
361
-                $this->error('<strong>LOAD_RELEASE configured, but source files were found</strong>', $help_msg);
362
-                $result = false;
363
-            }
356
+            case LOAD_RELEASE:
357
+                if (!is_file(BASE_PATH . '/client/grommunio.js')) {
358
+                    $this->error('<strong>LOAD_RELEASE configured, but no release files found</strong>', $help_msg);
359
+                    $result = false;
360
+                } elseif (is_dir(BASE_PATH . '/client/zarafa')) {
361
+                    $this->error('<strong>LOAD_RELEASE configured, but source files were found</strong>', $help_msg);
362
+                    $result = false;
363
+                }
364 364
 
365
-            break;
365
+                break;
366 366
 
367
-        case LOAD_DEBUG:
368
-            if (!is_file(BASE_PATH . '/client/zarafa-debug.js')) {
369
-                $this->error('<strong>LOAD_DEBUG configured, but no debug files found</strong>', $help_msg);
370
-                $result = false;
371
-            } elseif (is_dir(BASE_PATH . '/client/zarafa')) {
372
-                $this->error('<strong>LOAD_DEBUG configured, but source files were found</strong>', $help_msg);
373
-                $result = false;
374
-            }
367
+            case LOAD_DEBUG:
368
+                if (!is_file(BASE_PATH . '/client/zarafa-debug.js')) {
369
+                    $this->error('<strong>LOAD_DEBUG configured, but no debug files found</strong>', $help_msg);
370
+                    $result = false;
371
+                } elseif (is_dir(BASE_PATH . '/client/zarafa')) {
372
+                    $this->error('<strong>LOAD_DEBUG configured, but source files were found</strong>', $help_msg);
373
+                    $result = false;
374
+                }
375 375
 
376
-            break;
376
+                break;
377 377
 
378
-        case LOAD_SOURCE:
379
-            if (!is_dir(BASE_PATH . '/client/zarafa')) {
380
-                $this->error('<strong>LOAD_SOURCE configured, but no source files found</strong>', $help_msg);
381
-                $result = false;
382
-            } elseif (is_file(BASE_PATH . '/client/grommunio.js') || is_file(BASE_PATH . '/client/zarafa-debug.js')) {
383
-                $this->error('<strong>LOAD_SOURCE configured, but release & debug file were found</strong>', $help_msg);
384
-                $result = false;
385
-            }
378
+            case LOAD_SOURCE:
379
+                if (!is_dir(BASE_PATH . '/client/zarafa')) {
380
+                    $this->error('<strong>LOAD_SOURCE configured, but no source files found</strong>', $help_msg);
381
+                    $result = false;
382
+                } elseif (is_file(BASE_PATH . '/client/grommunio.js') || is_file(BASE_PATH . '/client/zarafa-debug.js')) {
383
+                    $this->error('<strong>LOAD_SOURCE configured, but release & debug file were found</strong>', $help_msg);
384
+                    $result = false;
385
+                }
386 386
 
387
-            break;
387
+                break;
388 388
 
389
-        default:
390
-            $this->error('<strong>Unknown \'DEBUG_LOADER\' value: ' . $loader . '</strong>', $help_msg);
391
-            $result = false;
389
+            default:
390
+                $this->error('<strong>Unknown \'DEBUG_LOADER\' value: ' . $loader . '</strong>', $help_msg);
391
+                $result = false;
392 392
 
393
-            break;
393
+                break;
394 394
         }
395 395
 
396 396
         return $result;
Please login to merge, or discard this patch.
server/includes/core/class.operations.php 1 patch
Switch Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -662,23 +662,23 @@
 block discarded – undo
662 662
                     $props = mapi_getprops($store, [PR_DISPLAY_NAME]);
663 663
 
664 664
                     switch ($e->getCode()) {
665
-                    case MAPI_E_NO_ACCESS:
666
-                        $msg = 'Unable to open FINDER_ROOT for store: %s.';
667
-                        error_log(sprintf($msg, $props[PR_DISPLAY_NAME]));
665
+                        case MAPI_E_NO_ACCESS:
666
+                            $msg = 'Unable to open FINDER_ROOT for store: %s.';
667
+                            error_log(sprintf($msg, $props[PR_DISPLAY_NAME]));
668 668
 
669
-                        break;
669
+                            break;
670 670
 
671
-                    case MAPI_E_NOT_FOUND:
672
-                        $msg = 'Unable to open FINDER_ROOT for store: %s. Folder not found.';
673
-                        error_log(sprintf($msg, $props[PR_DISPLAY_NAME]));
671
+                        case MAPI_E_NOT_FOUND:
672
+                            $msg = 'Unable to open FINDER_ROOT for store: %s. Folder not found.';
673
+                            error_log(sprintf($msg, $props[PR_DISPLAY_NAME]));
674 674
 
675
-                        break;
675
+                            break;
676 676
 
677
-                    default:
678
-                        $msg = 'Unable to open FINDER_ROOT for store: %s. Unknown MAPI Error %s.';
679
-                        error_log(sprintf($msg, $props[PR_DISPLAY_NAME], get_mapi_error_name($e->getCode())));
677
+                        default:
678
+                            $msg = 'Unable to open FINDER_ROOT for store: %s. Unknown MAPI Error %s.';
679
+                            error_log(sprintf($msg, $props[PR_DISPLAY_NAME], get_mapi_error_name($e->getCode())));
680 680
 
681
-                        break;
681
+                            break;
682 682
                     }
683 683
                 }
684 684
             }
Please login to merge, or discard this patch.
server/includes/mapi/mapicode.php 1 patch
Switch Indentation   +77 added lines, -77 removed lines patch added patch discarded remove patch
@@ -205,158 +205,158 @@
 block discarded – undo
205 205
 
206 206
 function mapi_strerror($e) {
207 207
     switch ($e) {
208
-    case S_OK: return 'success';
208
+        case S_OK: return 'success';
209 209
 
210
-    case MAPI_E_CALL_FAILED: return 'An error of unexpected or unknown origin occurred';
210
+        case MAPI_E_CALL_FAILED: return 'An error of unexpected or unknown origin occurred';
211 211
 
212
-    case MAPI_E_NOT_ENOUGH_MEMORY: return 'Not enough memory was available to complete the operation';
212
+        case MAPI_E_NOT_ENOUGH_MEMORY: return 'Not enough memory was available to complete the operation';
213 213
 
214
-    case MAPI_E_INVALID_PARAMETER: return 'An invalid parameter was passed to a function or remote procedure call';
214
+        case MAPI_E_INVALID_PARAMETER: return 'An invalid parameter was passed to a function or remote procedure call';
215 215
 
216
-    case MAPI_E_INTERFACE_NOT_SUPPORTED: return 'MAPI interface not supported';
216
+        case MAPI_E_INTERFACE_NOT_SUPPORTED: return 'MAPI interface not supported';
217 217
 
218
-    case MAPI_E_NO_ACCESS: return 'An attempt was made to access a message store or object for which the user has insufficient permissions';
218
+        case MAPI_E_NO_ACCESS: return 'An attempt was made to access a message store or object for which the user has insufficient permissions';
219 219
 
220
-    case MAPI_E_NO_SUPPORT: return 'Function is not implemented';
220
+        case MAPI_E_NO_SUPPORT: return 'Function is not implemented';
221 221
 
222
-    case MAPI_E_BAD_CHARWIDTH: return 'An incompatibility exists in the character sets supported by the caller and the implementation';
222
+        case MAPI_E_BAD_CHARWIDTH: return 'An incompatibility exists in the character sets supported by the caller and the implementation';
223 223
 
224
-    case MAPI_E_STRING_TOO_LONG: return 'In the context of this method call, a string exceeds the maximum permitted length';
224
+        case MAPI_E_STRING_TOO_LONG: return 'In the context of this method call, a string exceeds the maximum permitted length';
225 225
 
226
-    case MAPI_E_UNKNOWN_FLAGS: return 'One or more values for a flags parameter were not valid';
226
+        case MAPI_E_UNKNOWN_FLAGS: return 'One or more values for a flags parameter were not valid';
227 227
 
228
-    case MAPI_E_INVALID_ENTRYID: return 'invalid entryid';
228
+        case MAPI_E_INVALID_ENTRYID: return 'invalid entryid';
229 229
 
230
-    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';
230
+        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';
231 231
 
232
-    case MAPI_E_OBJECT_CHANGED: return 'An attempt to commit changes failed because the object was changed separately';
232
+        case MAPI_E_OBJECT_CHANGED: return 'An attempt to commit changes failed because the object was changed separately';
233 233
 
234
-    case MAPI_E_OBJECT_DELETED: return 'An operation failed because the object was deleted separately';
234
+        case MAPI_E_OBJECT_DELETED: return 'An operation failed because the object was deleted separately';
235 235
 
236
-    case MAPI_E_BUSY: return 'A table operation failed because a separate operation was in progress at the same time';
236
+        case MAPI_E_BUSY: return 'A table operation failed because a separate operation was in progress at the same time';
237 237
 
238
-    case MAPI_E_NOT_ENOUGH_DISK: return 'Not enough disk space was available to complete the operation';
238
+        case MAPI_E_NOT_ENOUGH_DISK: return 'Not enough disk space was available to complete the operation';
239 239
 
240
-    case MAPI_E_NOT_ENOUGH_RESOURCES: return 'Not enough system resources were available to complete the operation';
240
+        case MAPI_E_NOT_ENOUGH_RESOURCES: return 'Not enough system resources were available to complete the operation';
241 241
 
242
-    case MAPI_E_NOT_FOUND: return 'The requested object could not be found at the server';
242
+        case MAPI_E_NOT_FOUND: return 'The requested object could not be found at the server';
243 243
 
244
-    case MAPI_E_VERSION: return 'Client and server versions are not compatible';
244
+        case MAPI_E_VERSION: return 'Client and server versions are not compatible';
245 245
 
246
-    case MAPI_E_LOGON_FAILED: return 'A client was unable to log on to the server';
246
+        case MAPI_E_LOGON_FAILED: return 'A client was unable to log on to the server';
247 247
 
248
-    case MAPI_E_SESSION_LIMIT: return 'A server or service is unable to create any more sessions';
248
+        case MAPI_E_SESSION_LIMIT: return 'A server or service is unable to create any more sessions';
249 249
 
250
-    case MAPI_E_USER_CANCEL: return 'An operation failed because a user cancelled it';
250
+        case MAPI_E_USER_CANCEL: return 'An operation failed because a user cancelled it';
251 251
 
252
-    case MAPI_E_UNABLE_TO_ABORT: return 'A ropAbort or ropAbortSubmit ROP request was unsuccessful';
252
+        case MAPI_E_UNABLE_TO_ABORT: return 'A ropAbort or ropAbortSubmit ROP request was unsuccessful';
253 253
 
254
-    case MAPI_E_NETWORK_ERROR: return 'An operation was unsuccessful because of a problem with network operations or services';
254
+        case MAPI_E_NETWORK_ERROR: return 'An operation was unsuccessful because of a problem with network operations or services';
255 255
 
256
-    case MAPI_E_DISK_ERROR: return 'There was a problem writing to or reading from disk';
256
+        case MAPI_E_DISK_ERROR: return 'There was a problem writing to or reading from disk';
257 257
 
258
-    case MAPI_E_TOO_COMPLEX: return 'The operation requested is too complex for the server to handle (often w.r.t. restrictions)';
258
+        case MAPI_E_TOO_COMPLEX: return 'The operation requested is too complex for the server to handle (often w.r.t. restrictions)';
259 259
 
260
-    case MAPI_E_BAD_COLUMN: return 'The column requested is not allowed in this type of table';
260
+        case MAPI_E_BAD_COLUMN: return 'The column requested is not allowed in this type of table';
261 261
 
262
-    case MAPI_E_EXTENDED_ERROR: return 'extended error';
262
+        case MAPI_E_EXTENDED_ERROR: return 'extended error';
263 263
 
264
-    case MAPI_E_COMPUTED: return 'A property cannot be updated because it is read-only, computed by the server';
264
+        case MAPI_E_COMPUTED: return 'A property cannot be updated because it is read-only, computed by the server';
265 265
 
266
-    case MAPI_E_CORRUPT_DATA: return 'There is an internal inconsistency in a database, or in a complex property value';
266
+        case MAPI_E_CORRUPT_DATA: return 'There is an internal inconsistency in a database, or in a complex property value';
267 267
 
268
-    case MAPI_E_UNCONFIGURED: return 'unconfigured';
268
+        case MAPI_E_UNCONFIGURED: return 'unconfigured';
269 269
 
270
-    case MAPI_E_FAILONEPROVIDER: return 'failoneprovider';
270
+        case MAPI_E_FAILONEPROVIDER: return 'failoneprovider';
271 271
 
272
-    case MAPI_E_UNKNOWN_CPID: return 'The server is not configured to support the code page requested by the client';
272
+        case MAPI_E_UNKNOWN_CPID: return 'The server is not configured to support the code page requested by the client';
273 273
 
274
-    case MAPI_E_UNKNOWN_LCID: return 'The server is not configured to support the locale requested by the client';
274
+        case MAPI_E_UNKNOWN_LCID: return 'The server is not configured to support the locale requested by the client';
275 275
 
276
-    case MAPI_E_PASSWORD_CHANGE_REQUIRED: return 'password change required';
276
+        case MAPI_E_PASSWORD_CHANGE_REQUIRED: return 'password change required';
277 277
 
278
-    case MAPI_E_PASSWORD_EXPIRED: return 'password expired';
278
+        case MAPI_E_PASSWORD_EXPIRED: return 'password expired';
279 279
 
280
-    case MAPI_E_INVALID_WORKSTATION_ACCOUNT: return 'invalid workstation account';
280
+        case MAPI_E_INVALID_WORKSTATION_ACCOUNT: return 'invalid workstation account';
281 281
 
282
-    case MAPI_E_INVALID_ACCESS_TIME: return 'The operation failed due to clock skew between servers';
282
+        case MAPI_E_INVALID_ACCESS_TIME: return 'The operation failed due to clock skew between servers';
283 283
 
284
-    case MAPI_E_ACCOUNT_DISABLED: return 'account disabled';
284
+        case MAPI_E_ACCOUNT_DISABLED: return 'account disabled';
285 285
 
286
-    case MAPI_E_END_OF_SESSION: return 'The server session has been destroyed, possibly by a server restart';
286
+        case MAPI_E_END_OF_SESSION: return 'The server session has been destroyed, possibly by a server restart';
287 287
 
288
-    case MAPI_E_UNKNOWN_ENTRYID: return 'The EntryID passed to OpenEntry was created by a different MAPI provider';
288
+        case MAPI_E_UNKNOWN_ENTRYID: return 'The EntryID passed to OpenEntry was created by a different MAPI provider';
289 289
 
290
-    case MAPI_E_MISSING_REQUIRED_COLUMN: return 'missing required column';
290
+        case MAPI_E_MISSING_REQUIRED_COLUMN: return 'missing required column';
291 291
 
292
-    case MAPI_W_NO_SERVICE: return 'no service';
292
+        case MAPI_W_NO_SERVICE: return 'no service';
293 293
 
294
-    case MAPI_E_BAD_VALUE: return 'bad value';
294
+        case MAPI_E_BAD_VALUE: return 'bad value';
295 295
 
296
-    case MAPI_E_INVALID_TYPE: return 'invalid type';
296
+        case MAPI_E_INVALID_TYPE: return 'invalid type';
297 297
 
298
-    case MAPI_E_TYPE_NO_SUPPORT: return 'type no support';
298
+        case MAPI_E_TYPE_NO_SUPPORT: return 'type no support';
299 299
 
300
-    case MAPI_E_UNEXPECTED_TYPE: return 'unexpected_type';
300
+        case MAPI_E_UNEXPECTED_TYPE: return 'unexpected_type';
301 301
 
302
-    case MAPI_E_TOO_BIG: return 'The table is too big for the requested operation to complete';
302
+        case MAPI_E_TOO_BIG: return 'The table is too big for the requested operation to complete';
303 303
 
304
-    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';
304
+        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';
305 305
 
306
-    case MAPI_E_UNEXPECTED_ID: return 'unexpected id';
306
+        case MAPI_E_UNEXPECTED_ID: return 'unexpected id';
307 307
 
308
-    case MAPI_W_ERRORS_RETURNED: return 'The call succeeded, but the message store provider has error information available';
308
+        case MAPI_W_ERRORS_RETURNED: return 'The call succeeded, but the message store provider has error information available';
309 309
 
310
-    case MAPI_E_UNABLE_TO_COMPLETE: return 'A complex operation such as building a table row set could not be completed';
310
+        case MAPI_E_UNABLE_TO_COMPLETE: return 'A complex operation such as building a table row set could not be completed';
311 311
 
312
-    case MAPI_E_TIMEOUT: return 'An asynchronous operation did not succeed within the specified time-out';
312
+        case MAPI_E_TIMEOUT: return 'An asynchronous operation did not succeed within the specified time-out';
313 313
 
314
-    case MAPI_E_TABLE_EMPTY: return 'A table essential to the operation is empty';
314
+        case MAPI_E_TABLE_EMPTY: return 'A table essential to the operation is empty';
315 315
 
316
-    case MAPI_E_TABLE_TOO_BIG: return 'The table is too big for the requested operation to complete';
316
+        case MAPI_E_TABLE_TOO_BIG: return 'The table is too big for the requested operation to complete';
317 317
 
318
-    case MAPI_E_INVALID_BOOKMARK: return 'The bookmark passed to a table operation was not created on the same table';
318
+        case MAPI_E_INVALID_BOOKMARK: return 'The bookmark passed to a table operation was not created on the same table';
319 319
 
320
-    case MAPI_W_POSITION_CHANGED: return 'position changed';
320
+        case MAPI_W_POSITION_CHANGED: return 'position changed';
321 321
 
322
-    case MAPI_W_APPROX_COUNT: return 'approx count';
322
+        case MAPI_W_APPROX_COUNT: return 'approx count';
323 323
 
324
-    case MAPI_E_WAIT: return 'A wait time-out has expired';
324
+        case MAPI_E_WAIT: return 'A wait time-out has expired';
325 325
 
326
-    case MAPI_E_CANCEL: return 'The operation had to be canceled';
326
+        case MAPI_E_CANCEL: return 'The operation had to be canceled';
327 327
 
328
-    case MAPI_E_NOT_ME: return 'not me';
328
+        case MAPI_E_NOT_ME: return 'not me';
329 329
 
330
-    case MAPI_W_CANCEL_MESSAGE: return 'cancel message';
330
+        case MAPI_W_CANCEL_MESSAGE: return 'cancel message';
331 331
 
332
-    case MAPI_E_CORRUPT_STORE: return 'corrupt store';
332
+        case MAPI_E_CORRUPT_STORE: return 'corrupt store';
333 333
 
334
-    case MAPI_E_NOT_IN_QUEUE: return 'not in queue';
334
+        case MAPI_E_NOT_IN_QUEUE: return 'not in queue';
335 335
 
336
-    case MAPI_E_NO_SUPPRESS: return 'The server does not support the suppression of read receipts';
336
+        case MAPI_E_NO_SUPPRESS: return 'The server does not support the suppression of read receipts';
337 337
 
338
-    case MAPI_E_COLLISION: return 'A folder or item cannot be created because one with the same name or other criteria already exists';
338
+        case MAPI_E_COLLISION: return 'A folder or item cannot be created because one with the same name or other criteria already exists';
339 339
 
340
-    case MAPI_E_NOT_INITIALIZED: return 'The subsystem is not ready';
340
+        case MAPI_E_NOT_INITIALIZED: return 'The subsystem is not ready';
341 341
 
342
-    case MAPI_E_NON_STANDARD: return 'non standard';
342
+        case MAPI_E_NON_STANDARD: return 'non standard';
343 343
 
344
-    case MAPI_E_NO_RECIPIENTS: return 'A message cannot be sent because it has no recipients';
344
+        case MAPI_E_NO_RECIPIENTS: return 'A message cannot be sent because it has no recipients';
345 345
 
346
-    case MAPI_E_SUBMITTED: return 'A message cannot be opened for modification because it has already been sent';
346
+        case MAPI_E_SUBMITTED: return 'A message cannot be opened for modification because it has already been sent';
347 347
 
348
-    case MAPI_E_HAS_FOLDERS: return 'A folder cannot be deleted because it still contains subfolders';
348
+        case MAPI_E_HAS_FOLDERS: return 'A folder cannot be deleted because it still contains subfolders';
349 349
 
350
-    case MAPI_E_HAS_MESSAGES: return 'A folder cannot be deleted because it still contains messages';
350
+        case MAPI_E_HAS_MESSAGES: return 'A folder cannot be deleted because it still contains messages';
351 351
 
352
-    case MAPI_E_FOLDER_CYCLE: return 'A folder move or copy operation would create a cycle';
352
+        case MAPI_E_FOLDER_CYCLE: return 'A folder move or copy operation would create a cycle';
353 353
 
354
-    case MAPI_W_PARTIAL_COMPLETION: return 'The call succeeded, but not all entries were successfully operated on';
354
+        case MAPI_W_PARTIAL_COMPLETION: return 'The call succeeded, but not all entries were successfully operated on';
355 355
 
356
-    case MAPI_E_AMBIGUOUS_RECIP: return 'An unresolved recipient matches more than one directory entry';
356
+        case MAPI_E_AMBIGUOUS_RECIP: return 'An unresolved recipient matches more than one directory entry';
357 357
 
358
-    case MAPI_E_STORE_FULL: return 'Store full';
358
+        case MAPI_E_STORE_FULL: return 'Store full';
359 359
 
360
-    default: return sprintf('%xh', $e);
360
+        default: return sprintf('%xh', $e);
361 361
     }
362 362
 }
Please login to merge, or discard this patch.
server/includes/mapi/class.baserecurrence.php 1 patch
Switch Indentation   +142 added lines, -142 removed lines patch added patch discarded remove patch
@@ -1718,186 +1718,186 @@
 block discarded – undo
1718 1718
                 // Loop through the entire recurrence range of dates, and check for each occurrence whether it is in the view range.
1719 1719
 
1720 1720
                 switch ($this->recur['type']) {
1721
-                case 10:
1722
-                    // Daily
1723
-                    if ($this->recur['everyn'] <= 0) {
1724
-                        $this->recur['everyn'] = 1440;
1725
-                    }
1726
-
1727
-                    if (0 == $this->recur['subtype']) {
1728
-                        // Every Nth day
1729
-                        for ($now = $daystart; $now <= $dayend && (0 == $limit || count($items) < $limit); $now += 60 * $this->recur['everyn']) {
1730
-                            $this->processOccurrenceItem($items, $start, $end, $now, $this->recur['startocc'], $this->recur['endocc'], $this->tz, $remindersonly);
1721
+                    case 10:
1722
+                        // Daily
1723
+                        if ($this->recur['everyn'] <= 0) {
1724
+                            $this->recur['everyn'] = 1440;
1731 1725
                         }
1732
-                    } else {
1733
-                        // Every workday
1734
-                        for ($now = $daystart; $now <= $dayend && (0 == $limit || count($items) < $limit); $now += 60 * 1440) {
1735
-                            $nowtime = $this->gmtime($now);
1736
-                            if ($nowtime['tm_wday'] > 0 && $nowtime['tm_wday'] < 6) { // only add items in the given timespace
1726
+
1727
+                        if (0 == $this->recur['subtype']) {
1728
+                            // Every Nth day
1729
+                            for ($now = $daystart; $now <= $dayend && (0 == $limit || count($items) < $limit); $now += 60 * $this->recur['everyn']) {
1737 1730
                                 $this->processOccurrenceItem($items, $start, $end, $now, $this->recur['startocc'], $this->recur['endocc'], $this->tz, $remindersonly);
1738 1731
                             }
1732
+                        } else {
1733
+                            // Every workday
1734
+                            for ($now = $daystart; $now <= $dayend && (0 == $limit || count($items) < $limit); $now += 60 * 1440) {
1735
+                                $nowtime = $this->gmtime($now);
1736
+                                if ($nowtime['tm_wday'] > 0 && $nowtime['tm_wday'] < 6) { // only add items in the given timespace
1737
+                                    $this->processOccurrenceItem($items, $start, $end, $now, $this->recur['startocc'], $this->recur['endocc'], $this->tz, $remindersonly);
1738
+                                }
1739
+                            }
1739 1740
                         }
1740
-                    }
1741 1741
 
1742
-                    break;
1743
-
1744
-                case 11:
1745
-                    // Weekly
1746
-                    if ($this->recur['everyn'] <= 0) {
1747
-                        $this->recur['everyn'] = 1;
1748
-                    }
1742
+                        break;
1749 1743
 
1750
-                    // If sliding flag is set then move to 'n' weeks
1751
-                    if ($this->recur['regen']) {
1752
-                        $daystart += (60 * 60 * 24 * 7 * $this->recur['everyn']);
1753
-                    }
1744
+                    case 11:
1745
+                        // Weekly
1746
+                        if ($this->recur['everyn'] <= 0) {
1747
+                            $this->recur['everyn'] = 1;
1748
+                        }
1754 1749
 
1755
-                    for ($now = $daystart; $now <= $dayend && (0 == $limit || count($items) < $limit); $now += (60 * 60 * 24 * 7 * $this->recur['everyn'])) {
1750
+                        // If sliding flag is set then move to 'n' weeks
1756 1751
                         if ($this->recur['regen']) {
1757
-                            $this->processOccurrenceItem($items, $start, $end, $now, $this->recur['startocc'], $this->recur['endocc'], $this->tz, $remindersonly);
1758
-                        } else {
1759
-                            // Loop through the whole following week to the first occurrence of the week, add each day that is specified
1760
-                            for ($wday = 0; $wday < 7; ++$wday) {
1761
-                                $daynow = $now + $wday * 60 * 60 * 24;
1762
-                                // checks weather the next coming day in recurring pattern is less than or equal to end day of the recurring item
1763
-                                if ($daynow <= $dayend) {
1764
-                                    $nowtime = $this->gmtime($daynow); // Get the weekday of the current day
1765
-                                    if (($this->recur['weekdays'] & (1 << $nowtime['tm_wday']))) { // Selected ?
1766
-                                        $this->processOccurrenceItem($items, $start, $end, $daynow, $this->recur['startocc'], $this->recur['endocc'], $this->tz, $remindersonly);
1752
+                            $daystart += (60 * 60 * 24 * 7 * $this->recur['everyn']);
1753
+                        }
1754
+
1755
+                        for ($now = $daystart; $now <= $dayend && (0 == $limit || count($items) < $limit); $now += (60 * 60 * 24 * 7 * $this->recur['everyn'])) {
1756
+                            if ($this->recur['regen']) {
1757
+                                $this->processOccurrenceItem($items, $start, $end, $now, $this->recur['startocc'], $this->recur['endocc'], $this->tz, $remindersonly);
1758
+                            } else {
1759
+                                // Loop through the whole following week to the first occurrence of the week, add each day that is specified
1760
+                                for ($wday = 0; $wday < 7; ++$wday) {
1761
+                                    $daynow = $now + $wday * 60 * 60 * 24;
1762
+                                    // checks weather the next coming day in recurring pattern is less than or equal to end day of the recurring item
1763
+                                    if ($daynow <= $dayend) {
1764
+                                        $nowtime = $this->gmtime($daynow); // Get the weekday of the current day
1765
+                                        if (($this->recur['weekdays'] & (1 << $nowtime['tm_wday']))) { // Selected ?
1766
+                                            $this->processOccurrenceItem($items, $start, $end, $daynow, $this->recur['startocc'], $this->recur['endocc'], $this->tz, $remindersonly);
1767
+                                        }
1767 1768
                                     }
1768 1769
                                 }
1769 1770
                             }
1770 1771
                         }
1771
-                    }
1772 1772
 
1773
-                    break;
1774
-
1775
-                case 12:
1776
-                    // Monthly
1777
-                    if ($this->recur['everyn'] <= 0) {
1778
-                        $this->recur['everyn'] = 1;
1779
-                    }
1773
+                        break;
1780 1774
 
1781
-                    // Loop through all months from start to end of occurrence, starting at beginning of first month
1782
-                    for ($now = $this->monthStartOf($daystart); $now <= $dayend && (0 == $limit || count($items) < $limit); $now += $this->daysInMonth($now, $this->recur['everyn']) * 24 * 60 * 60) {
1783
-                        if (isset($this->recur['monthday']) && ('undefined' != $this->recur['monthday']) && !$this->recur['regen']) { // Day M of every N months
1784
-                            $difference = 1;
1785
-                            if ($this->daysInMonth($now, $this->recur['everyn']) < $this->recur['monthday']) {
1786
-                                $difference = $this->recur['monthday'] - $this->daysInMonth($now, $this->recur['everyn']) + 1;
1787
-                            }
1788
-                            $daynow = $now + (($this->recur['monthday'] - $difference) * 24 * 60 * 60);
1789
-                            // checks weather the next coming day in recurrence pattern is less than or equal to end day of the recurring item
1790
-                            if ($daynow <= $dayend) {
1791
-                                $this->processOccurrenceItem($items, $start, $end, $daynow, $this->recur['startocc'], $this->recur['endocc'], $this->tz, $remindersonly);
1792
-                            }
1793
-                        } elseif (isset($this->recur['nday'], $this->recur['weekdays'])) { // Nth [weekday] of every N months
1794
-                            // Sanitize input
1795
-                            if (0 == $this->recur['weekdays']) {
1796
-                                $this->recur['weekdays'] = 1;
1797
-                            }
1775
+                    case 12:
1776
+                        // Monthly
1777
+                        if ($this->recur['everyn'] <= 0) {
1778
+                            $this->recur['everyn'] = 1;
1779
+                        }
1798 1780
 
1799
-                            // If nday is not set to the last day in the month
1800
-                            if ($this->recur['nday'] < 5) {
1801
-                                // keep the track of no. of time correct selection pattern(like 2nd weekday, 4th fiday, etc.)is matched
1802
-                                $ndaycounter = 0;
1803
-                                // Find matching weekday in this month
1804
-                                for ($day = 0, $total = $this->daysInMonth($now, 1); $day < $total; ++$day) {
1805
-                                    $daynow = $now + $day * 60 * 60 * 24;
1806
-                                    $nowtime = $this->gmtime($daynow); // Get the weekday of the current day
1781
+                        // Loop through all months from start to end of occurrence, starting at beginning of first month
1782
+                        for ($now = $this->monthStartOf($daystart); $now <= $dayend && (0 == $limit || count($items) < $limit); $now += $this->daysInMonth($now, $this->recur['everyn']) * 24 * 60 * 60) {
1783
+                            if (isset($this->recur['monthday']) && ('undefined' != $this->recur['monthday']) && !$this->recur['regen']) { // Day M of every N months
1784
+                                $difference = 1;
1785
+                                if ($this->daysInMonth($now, $this->recur['everyn']) < $this->recur['monthday']) {
1786
+                                    $difference = $this->recur['monthday'] - $this->daysInMonth($now, $this->recur['everyn']) + 1;
1787
+                                }
1788
+                                $daynow = $now + (($this->recur['monthday'] - $difference) * 24 * 60 * 60);
1789
+                                // checks weather the next coming day in recurrence pattern is less than or equal to end day of the recurring item
1790
+                                if ($daynow <= $dayend) {
1791
+                                    $this->processOccurrenceItem($items, $start, $end, $daynow, $this->recur['startocc'], $this->recur['endocc'], $this->tz, $remindersonly);
1792
+                                }
1793
+                            } elseif (isset($this->recur['nday'], $this->recur['weekdays'])) { // Nth [weekday] of every N months
1794
+                                // Sanitize input
1795
+                                if (0 == $this->recur['weekdays']) {
1796
+                                    $this->recur['weekdays'] = 1;
1797
+                                }
1807 1798
 
1808
-                                    if ($this->recur['weekdays'] & (1 << $nowtime['tm_wday'])) { // Selected ?
1809
-                                        ++$ndaycounter;
1810
-                                    }
1811
-                                    // check the selected pattern is same as asked Nth weekday,If so set the firstday
1812
-                                    if ($this->recur['nday'] == $ndaycounter) {
1813
-                                        $firstday = $day;
1799
+                                // If nday is not set to the last day in the month
1800
+                                if ($this->recur['nday'] < 5) {
1801
+                                    // keep the track of no. of time correct selection pattern(like 2nd weekday, 4th fiday, etc.)is matched
1802
+                                    $ndaycounter = 0;
1803
+                                    // Find matching weekday in this month
1804
+                                    for ($day = 0, $total = $this->daysInMonth($now, 1); $day < $total; ++$day) {
1805
+                                        $daynow = $now + $day * 60 * 60 * 24;
1806
+                                        $nowtime = $this->gmtime($daynow); // Get the weekday of the current day
1807
+
1808
+                                        if ($this->recur['weekdays'] & (1 << $nowtime['tm_wday'])) { // Selected ?
1809
+                                            ++$ndaycounter;
1810
+                                        }
1811
+                                        // check the selected pattern is same as asked Nth weekday,If so set the firstday
1812
+                                        if ($this->recur['nday'] == $ndaycounter) {
1813
+                                            $firstday = $day;
1814 1814
 
1815
-                                        break;
1815
+                                            break;
1816
+                                        }
1816 1817
                                     }
1817
-                                }
1818
-                                // $firstday is the day of the month on which the asked pattern of nth weekday matches
1819
-                                $daynow = $now + $firstday * 60 * 60 * 24;
1820
-                            } else {
1821
-                                // Find last day in the month ($now is the firstday of the month)
1822
-                                $NumDaysInMonth = $this->daysInMonth($now, 1);
1823
-                                $daynow = $now + (($NumDaysInMonth - 1) * 24 * 60 * 60);
1818
+                                    // $firstday is the day of the month on which the asked pattern of nth weekday matches
1819
+                                    $daynow = $now + $firstday * 60 * 60 * 24;
1820
+                                } else {
1821
+                                    // Find last day in the month ($now is the firstday of the month)
1822
+                                    $NumDaysInMonth = $this->daysInMonth($now, 1);
1823
+                                    $daynow = $now + (($NumDaysInMonth - 1) * 24 * 60 * 60);
1824 1824
 
1825
-                                $nowtime = $this->gmtime($daynow);
1826
-                                while (($this->recur['weekdays'] & (1 << $nowtime['tm_wday'])) == 0) {
1827
-                                    $daynow -= 86400;
1828 1825
                                     $nowtime = $this->gmtime($daynow);
1826
+                                    while (($this->recur['weekdays'] & (1 << $nowtime['tm_wday'])) == 0) {
1827
+                                        $daynow -= 86400;
1828
+                                        $nowtime = $this->gmtime($daynow);
1829
+                                    }
1829 1830
                                 }
1830
-                            }
1831 1831
 
1832
-                            /*
1832
+                                /*
1833 1833
                              * checks weather the next coming day in recurrence pattern is less than or equal to end day of the			* recurring item.Also check weather the coming day in recurrence pattern is greater than or equal to start * of recurring pattern, so that appointment that fall under the recurrence range are only displayed.
1834 1834
                              */
1835
-                            if ($daynow <= $dayend && $daynow >= $daystart) {
1836
-                                $this->processOccurrenceItem($items, $start, $end, $daynow, $this->recur['startocc'], $this->recur['endocc'], $this->tz, $remindersonly);
1837
-                            }
1838
-                        } elseif ($this->recur['regen']) {
1839
-                            $next_month_start = $now + ($this->daysInMonth($now, 1) * 24 * 60 * 60);
1840
-                            $now = $daystart + ($this->daysInMonth($next_month_start, $this->recur['everyn']) * 24 * 60 * 60);
1835
+                                if ($daynow <= $dayend && $daynow >= $daystart) {
1836
+                                    $this->processOccurrenceItem($items, $start, $end, $daynow, $this->recur['startocc'], $this->recur['endocc'], $this->tz, $remindersonly);
1837
+                                }
1838
+                            } elseif ($this->recur['regen']) {
1839
+                                $next_month_start = $now + ($this->daysInMonth($now, 1) * 24 * 60 * 60);
1840
+                                $now = $daystart + ($this->daysInMonth($next_month_start, $this->recur['everyn']) * 24 * 60 * 60);
1841 1841
 
1842
-                            if ($now <= $dayend) {
1843
-                                $this->processOccurrenceItem($items, $daystart, $end, $now, $this->recur['startocc'], $this->recur['endocc'], $this->tz, $remindersonly);
1842
+                                if ($now <= $dayend) {
1843
+                                    $this->processOccurrenceItem($items, $daystart, $end, $now, $this->recur['startocc'], $this->recur['endocc'], $this->tz, $remindersonly);
1844
+                                }
1844 1845
                             }
1845 1846
                         }
1846
-                    }
1847 1847
 
1848
-                    break;
1848
+                        break;
1849 1849
 
1850
-                case 13:
1851
-                    // Yearly
1852
-                    if ($this->recur['everyn'] <= 0) {
1853
-                        $this->recur['everyn'] = 12;
1854
-                    }
1850
+                    case 13:
1851
+                        // Yearly
1852
+                        if ($this->recur['everyn'] <= 0) {
1853
+                            $this->recur['everyn'] = 12;
1854
+                        }
1855 1855
 
1856
-                    for ($now = $this->yearStartOf($daystart); $now <= $dayend && (0 == $limit || count($items) < $limit); $now += $this->daysInMonth($now, $this->recur['everyn']) * 24 * 60 * 60) {
1857
-                        if (isset($this->recur['monthday']) && !$this->recur['regen']) { // same as monthly, but in a specific month
1858
-                            // recur["month"] is in minutes since the beginning of the year
1859
-                            $month = $this->monthOfYear($this->recur['month']); // $month is now month of year [0..11]
1860
-                            $monthday = $this->recur['monthday']; // $monthday is day of the month [1..31]
1861
-                            $monthstart = $now + $this->daysInMonth($now, $month) * 24 * 60 * 60; // $monthstart is the timestamp of the beginning of the month
1862
-                            if ($monthday > $this->daysInMonth($monthstart, 1)) {
1863
-                                $monthday = $this->daysInMonth($monthstart, 1);
1864
-                            }	// Cap $monthday on month length (eg 28 feb instead of 29 feb)
1865
-                            $daynow = $monthstart + ($monthday - 1) * 24 * 60 * 60;
1866
-                            $this->processOccurrenceItem($items, $start, $end, $daynow, $this->recur['startocc'], $this->recur['endocc'], $this->tz, $remindersonly);
1867
-                        } elseif (isset($this->recur['nday'], $this->recur['weekdays'])) { // Nth [weekday] in month X of every N years
1868
-                            // Go the correct month
1869
-                            $monthnow = $now + $this->daysInMonth($now, $this->monthOfYear($this->recur['month'])) * 24 * 60 * 60;
1870
-
1871
-                            // Find first matching weekday in this month
1872
-                            for ($wday = 0; $wday < 7; ++$wday) {
1873
-                                $daynow = $monthnow + $wday * 60 * 60 * 24;
1874
-                                $nowtime = $this->gmtime($daynow); // Get the weekday of the current day
1875
-
1876
-                                if ($this->recur['weekdays'] & (1 << $nowtime['tm_wday'])) { // Selected ?
1877
-                                    $firstday = $wday;
1856
+                        for ($now = $this->yearStartOf($daystart); $now <= $dayend && (0 == $limit || count($items) < $limit); $now += $this->daysInMonth($now, $this->recur['everyn']) * 24 * 60 * 60) {
1857
+                            if (isset($this->recur['monthday']) && !$this->recur['regen']) { // same as monthly, but in a specific month
1858
+                                // recur["month"] is in minutes since the beginning of the year
1859
+                                $month = $this->monthOfYear($this->recur['month']); // $month is now month of year [0..11]
1860
+                                $monthday = $this->recur['monthday']; // $monthday is day of the month [1..31]
1861
+                                $monthstart = $now + $this->daysInMonth($now, $month) * 24 * 60 * 60; // $monthstart is the timestamp of the beginning of the month
1862
+                                if ($monthday > $this->daysInMonth($monthstart, 1)) {
1863
+                                    $monthday = $this->daysInMonth($monthstart, 1);
1864
+                                }	// Cap $monthday on month length (eg 28 feb instead of 29 feb)
1865
+                                $daynow = $monthstart + ($monthday - 1) * 24 * 60 * 60;
1866
+                                $this->processOccurrenceItem($items, $start, $end, $daynow, $this->recur['startocc'], $this->recur['endocc'], $this->tz, $remindersonly);
1867
+                            } elseif (isset($this->recur['nday'], $this->recur['weekdays'])) { // Nth [weekday] in month X of every N years
1868
+                                // Go the correct month
1869
+                                $monthnow = $now + $this->daysInMonth($now, $this->monthOfYear($this->recur['month'])) * 24 * 60 * 60;
1878 1870
 
1879
-                                    break;
1871
+                                // Find first matching weekday in this month
1872
+                                for ($wday = 0; $wday < 7; ++$wday) {
1873
+                                    $daynow = $monthnow + $wday * 60 * 60 * 24;
1874
+                                    $nowtime = $this->gmtime($daynow); // Get the weekday of the current day
1875
+
1876
+                                    if ($this->recur['weekdays'] & (1 << $nowtime['tm_wday'])) { // Selected ?
1877
+                                        $firstday = $wday;
1878
+
1879
+                                        break;
1880
+                                    }
1880 1881
                                 }
1881
-                            }
1882 1882
 
1883
-                            // Same as above (monthly)
1884
-                            $daynow = $monthnow + ($firstday + ($this->recur['nday'] - 1) * 7) * 60 * 60 * 24;
1883
+                                // Same as above (monthly)
1884
+                                $daynow = $monthnow + ($firstday + ($this->recur['nday'] - 1) * 7) * 60 * 60 * 24;
1885 1885
 
1886
-                            while ($this->monthStartOf($daynow) != $this->monthStartOf($monthnow)) {
1887
-                                $daynow -= 7 * 60 * 60 * 24;
1888
-                            }
1886
+                                while ($this->monthStartOf($daynow) != $this->monthStartOf($monthnow)) {
1887
+                                    $daynow -= 7 * 60 * 60 * 24;
1888
+                                }
1889 1889
 
1890
-                            $this->processOccurrenceItem($items, $start, $end, $daynow, $this->recur['startocc'], $this->recur['endocc'], $this->tz, $remindersonly);
1891
-                        } elseif ($this->recur['regen']) {
1892
-                            $year_starttime = $this->gmtime($now);
1893
-                            $is_next_leapyear = $this->isLeapYear($year_starttime['tm_year'] + 1900 + 1);	// +1 next year
1894
-                            $now = $daystart + ($is_next_leapyear ? 31622400 /* Leap year in seconds */ : 31536000 /* year in seconds */);
1890
+                                $this->processOccurrenceItem($items, $start, $end, $daynow, $this->recur['startocc'], $this->recur['endocc'], $this->tz, $remindersonly);
1891
+                            } elseif ($this->recur['regen']) {
1892
+                                $year_starttime = $this->gmtime($now);
1893
+                                $is_next_leapyear = $this->isLeapYear($year_starttime['tm_year'] + 1900 + 1);	// +1 next year
1894
+                                $now = $daystart + ($is_next_leapyear ? 31622400 /* Leap year in seconds */ : 31536000 /* year in seconds */);
1895 1895
 
1896
-                            if ($now <= $dayend) {
1897
-                                $this->processOccurrenceItem($items, $daystart, $end, $now, $this->recur['startocc'], $this->recur['endocc'], $this->tz, $remindersonly);
1896
+                                if ($now <= $dayend) {
1897
+                                    $this->processOccurrenceItem($items, $daystart, $end, $now, $this->recur['startocc'], $this->recur['endocc'], $this->tz, $remindersonly);
1898
+                                }
1898 1899
                             }
1899 1900
                         }
1900
-                    }
1901 1901
                 }
1902 1902
                 // to get all exception items
1903 1903
                 if (!empty($this->recur['changed_occurrences'])) {
Please login to merge, or discard this patch.