Passed
Branch master (f497d2)
by Mike
03:18
created
version.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -11,8 +11,7 @@
 block discarded – undo
11 11
 	$version = exec("hash git 2>/dev/null && cd {$path} >/dev/null 2>&1 && git describe  --always 2>/dev/null");
12 12
 	if ($branch && $version) {
13 13
 		define("GROMMUNIOSYNC_VERSION", $branch . '-' . $version);
14
-	}
15
-	else {
14
+	} else {
16 15
 		define("GROMMUNIOSYNC_VERSION", "GIT");
17 16
 	}
18 17
 }
Please login to merge, or discard this patch.
mapi/class.meetingrequest.php 2 patches
Braces   +69 added lines, -138 removed lines patch added patch discarded remove patch
@@ -326,8 +326,7 @@  discard block
 block discarded – undo
326 326
 
327 327
 			$userStore = $delegatorStore['store'];
328 328
 			$calFolder = $delegatorStore[PR_IPM_APPOINTMENT_ENTRYID];
329
-		}
330
-		else {
329
+		} else {
331 330
 			$userStore = $this->store;
332 331
 			$calFolder = $this->openDefaultCalendar();
333 332
 		}
@@ -396,8 +395,7 @@  discard block
 block discarded – undo
396 395
 			// Create/modify exception
397 396
 			if ($recurr->isException($basedate)) {
398 397
 				$recurr->modifyException($exception_props, $basedate);
399
-			}
400
-			else {
398
+			} else {
401 399
 				// When we are creating an exception we need copy recipients from main recurring item
402 400
 				$recipTable = mapi_message_getrecipienttable($calendarItem);
403 401
 				$recips = mapi_table_queryallrows($recipTable, $this->recipprops);
@@ -415,8 +413,7 @@  discard block
 block discarded – undo
415 413
 			if ($attach) {
416 414
 				$recurringItem = $calendarItem;
417 415
 				$calendarItem = mapi_attach_openobj($attach, MAPI_MODIFY);
418
-			}
419
-			else {
416
+			} else {
420 417
 				return false;
421 418
 			}
422 419
 		}
@@ -499,8 +496,7 @@  discard block
 block discarded – undo
499 496
 			$props = [];
500 497
 			if ($messageprops[$this->proptags['counter_proposal']]) {
501 498
 				$props[$this->proptags['counter_proposal']] = true;
502
-			}
503
-			else {
499
+			} else {
504 500
 				$props[$this->proptags['counter_proposal']] = false;
505 501
 			}
506 502
 
@@ -556,8 +552,7 @@  discard block
 block discarded – undo
556 552
 
557 553
 			$store = $delegatorStore['store'];
558 554
 			$calFolder = $delegatorStore[PR_IPM_APPOINTMENT_ENTRYID];
559
-		}
560
-		else {
555
+		} else {
561 556
 			$store = $this->store;
562 557
 			$calFolder = $this->openDefaultCalendar();
563 558
 		}
@@ -585,13 +580,11 @@  discard block
 block discarded – undo
585 580
 
586 581
 					if ($recurr->isException($basedate)) {
587 582
 						$recurr->modifyException($messageProps, $basedate);
588
-					}
589
-					else {
583
+					} else {
590 584
 						$recurr->createException($messageProps, $basedate);
591 585
 					}
592 586
 				}
593
-			}
594
-			else {
587
+			} else {
595 588
 				// set the properties of the cancellation object
596 589
 				mapi_setprops($calendarItem, $messageProps);
597 590
 			}
@@ -645,8 +638,7 @@  discard block
 block discarded – undo
645 638
 
646 639
 			$store = $delegatorStore['store'];
647 640
 			$calFolder = $delegatorStore[PR_IPM_APPOINTMENT_ENTRYID];
648
-		}
649
-		else {
641
+		} else {
650 642
 			$calFolder = $this->openDefaultCalendar();
651 643
 			$store = $this->store;
652 644
 		}
@@ -707,8 +699,7 @@  discard block
 block discarded – undo
707 699
 		$senderEntryId = isset($messageprops[PR_SENT_REPRESENTING_ENTRYID]) ? $messageprops[PR_SENT_REPRESENTING_ENTRYID] : $messageprops[PR_SENDER_ENTRYID];
708 700
 		if (isset($messageprops[PR_RECEIVED_BY_ENTRYID]) && MAPIUtils::CompareEntryIds($senderEntryId, $messageprops[PR_RECEIVED_BY_ENTRYID])) {
709 701
 			$entryid = $this->accept(false, $sendresponse, $move, $proposeNewTimeProps, $body, true, $store, $calFolder, $basedate);
710
-		}
711
-		else {
702
+		} else {
712 703
 			$entryid = $this->accept($tentative, $sendresponse, $move, $proposeNewTimeProps, $body, $userAction, $store, $calFolder, $basedate);
713 704
 		}
714 705
 
@@ -762,8 +753,7 @@  discard block
 block discarded – undo
762 753
 				if (!$calendarItem) {
763 754
 					// Recurring item not found, so create new meeting in Calendar
764 755
 					$calendarItem = mapi_folder_createmessage($calFolder);
765
-				}
766
-				else {
756
+				} else {
767 757
 					// we have found the main recurring item, check if this meeting request is already processed
768 758
 					if (isset($messageprops[PR_PROCESSED]) && $messageprops[PR_PROCESSED] == true) {
769 759
 						// only set required properties, other properties are already copied when processing this meeting request
@@ -784,8 +774,7 @@  discard block
 block discarded – undo
784 774
 					if (isset($props[$this->proptags['reminderminutes']])) {
785 775
 						$props[$this->proptags['flagdueby']] = $props[$this->proptags['startdate']] - ($props[$this->proptags['reminderminutes']] * 60);
786 776
 					}
787
-				}
788
-				else {
777
+				} else {
789 778
 					// only get required properties so we will not overwrite existing updated properties from calendar
790 779
 					$props = mapi_getprops($this->message, [PR_ENTRYID]);
791 780
 				}
@@ -806,13 +795,11 @@  discard block
 block discarded – undo
806 795
 				if (isset($props[$this->proptags['intendedbusystatus']])) {
807 796
 					if ($tentative && $props[$this->proptags['intendedbusystatus']] !== fbFree) {
808 797
 						$props[$this->proptags['busystatus']] = fbTentative;
809
-					}
810
-					else {
798
+					} else {
811 799
 						$props[$this->proptags['busystatus']] = $props[$this->proptags['intendedbusystatus']];
812 800
 					}
813 801
 					// we already have intendedbusystatus value in $props so no need to copy it
814
-				}
815
-				else {
802
+				} else {
816 803
 					$props[$this->proptags['busystatus']] = $tentative ? fbTentative : fbBusy;
817 804
 				}
818 805
 
@@ -875,8 +862,7 @@  discard block
 block discarded – undo
875 862
 				}
876 863
 
877 864
 				$entryid = $props[PR_ENTRYID];
878
-			}
879
-			else {
865
+			} else {
880 866
 				/**
881 867
 				 * This meeting request is not recurring, so can be an exception or normal meeting.
882 868
 				 * If exception then find main recurring item and update exception
@@ -943,13 +929,11 @@  discard block
 block discarded – undo
943 929
 						if (isset($messageprops[$this->proptags['intendedbusystatus']])) {
944 930
 							if ($tentative && $messageprops[$this->proptags['intendedbusystatus']] !== fbFree) {
945 931
 								$calItemProps[$this->proptags['busystatus']] = fbTentative;
946
-							}
947
-							else {
932
+							} else {
948 933
 								$calItemProps[$this->proptags['busystatus']] = $messageprops[$this->proptags['intendedbusystatus']];
949 934
 							}
950 935
 							$calItemProps[$this->proptags['intendedbusystatus']] = $messageprops[$this->proptags['intendedbusystatus']];
951
-						}
952
-						else {
936
+						} else {
953 937
 							$calItemProps[$this->proptags['busystatus']] = $tentative ? fbTentative : fbBusy;
954 938
 						}
955 939
 
@@ -982,8 +966,7 @@  discard block
 block discarded – undo
982 966
 
983 967
 						$messageprops = mapi_getprops($calmsg, [PR_ENTRYID]);
984 968
 						$entryid = $messageprops[PR_ENTRYID];
985
-					}
986
-					else {
969
+					} else {
987 970
 						// Create a new appointment with duplicate properties and recipient, but as an IPM.Appointment
988 971
 						$new = mapi_folder_createmessage($calFolder);
989 972
 						$props = mapi_getprops($this->message);
@@ -1018,13 +1001,11 @@  discard block
 block discarded – undo
1018 1001
 						if (isset($props[$this->proptags['intendedbusystatus']])) {
1019 1002
 							if ($tentative && $props[$this->proptags['intendedbusystatus']] !== fbFree) {
1020 1003
 								$props[$this->proptags['busystatus']] = fbTentative;
1021
-							}
1022
-							else {
1004
+							} else {
1023 1005
 								$props[$this->proptags['busystatus']] = $props[$this->proptags['intendedbusystatus']];
1024 1006
 							}
1025 1007
 							// we already have intendedbusystatus value in $props so no need to copy it
1026
-						}
1027
-						else {
1008
+						} else {
1028 1009
 							$props[$this->proptags['busystatus']] = $tentative ? fbTentative : fbBusy;
1029 1010
 						}
1030 1011
 
@@ -1056,8 +1037,7 @@  discard block
 block discarded – undo
1056 1037
 							],
1057 1038
 							];
1058 1039
 							$recipients = mapi_table_queryallrows($recipientTable, $this->recipprops, $res);
1059
-						}
1060
-						else {
1040
+						} else {
1061 1041
 							$recipients = mapi_table_queryallrows($recipientTable, $this->recipprops);
1062 1042
 						}
1063 1043
 						$this->addOrganizer($props, $recipients);
@@ -1069,8 +1049,7 @@  discard block
 block discarded – undo
1069 1049
 					}
1070 1050
 				}
1071 1051
 			}
1072
-		}
1073
-		else {
1052
+		} else {
1074 1053
 			// Here only properties are set on calendaritem, because user is responding from calendar.
1075 1054
 			$props = [];
1076 1055
 			$props[$this->proptags['responsestatus']] = $tentative ? olResponseTentative : olResponseAccepted;
@@ -1078,13 +1057,11 @@  discard block
 block discarded – undo
1078 1057
 			if (isset($messageprops[$this->proptags['intendedbusystatus']])) {
1079 1058
 				if ($tentative && $messageprops[$this->proptags['intendedbusystatus']] !== fbFree) {
1080 1059
 					$props[$this->proptags['busystatus']] = fbTentative;
1081
-				}
1082
-				else {
1060
+				} else {
1083 1061
 					$props[$this->proptags['busystatus']] = $messageprops[$this->proptags['intendedbusystatus']];
1084 1062
 				}
1085 1063
 				$props[$this->proptags['intendedbusystatus']] = $messageprops[$this->proptags['intendedbusystatus']];
1086
-			}
1087
-			else {
1064
+			} else {
1088 1065
 				$props[$this->proptags['busystatus']] = $tentative ? fbTentative : fbBusy;
1089 1066
 			}
1090 1067
 
@@ -1107,8 +1084,7 @@  discard block
 block discarded – undo
1107 1084
 
1108 1085
 				if ($recurr->isException($basedate)) {
1109 1086
 					$recurr->modifyException($proposeNewTimeProps + $props, $basedate, $recips);
1110
-				}
1111
-				else {
1087
+				} else {
1112 1088
 					$props[$this->proptags['startdate']] = $recurr->getOccurrenceStart($basedate);
1113 1089
 					$props[$this->proptags['duedate']] = $recurr->getOccurrenceEnd($basedate);
1114 1090
 
@@ -1120,8 +1096,7 @@  discard block
 block discarded – undo
1120 1096
 
1121 1097
 					$recurr->createException($proposeNewTimeProps + $props, $basedate, false, $recips);
1122 1098
 				}
1123
-			}
1124
-			else {
1099
+			} else {
1125 1100
 				mapi_setprops($this->message, $proposeNewTimeProps + $props);
1126 1101
 			}
1127 1102
 			mapi_savechanges($this->message);
@@ -1162,8 +1137,7 @@  discard block
 block discarded – undo
1162 1137
 
1163 1138
 			$store = $delegatorStore['store'];
1164 1139
 			$calFolder = $delegatorStore[PR_IPM_APPOINTMENT_ENTRYID];
1165
-		}
1166
-		else {
1140
+		} else {
1167 1141
 			$calFolder = $this->openDefaultCalendar();
1168 1142
 			$store = $this->store;
1169 1143
 		}
@@ -1255,8 +1229,7 @@  discard block
 block discarded – undo
1255 1229
 
1256 1230
 			$store = $delegatorStore['store'];
1257 1231
 			$calFolder = $delegatorStore[PR_IPM_APPOINTMENT_ENTRYID];
1258
-		}
1259
-		else {
1232
+		} else {
1260 1233
 			$store = $this->store;
1261 1234
 			$calFolder = $this->openDefaultCalendar();
1262 1235
 		}
@@ -1288,8 +1261,7 @@  discard block
 block discarded – undo
1288 1261
 						// exception found, remove it from calendar
1289 1262
 						$this->doRemoveExceptionFromCalendar($basedate, $calendarItem, $store);
1290 1263
 					}
1291
-				}
1292
-				else {
1264
+				} else {
1293 1265
 					// remove normal / recurring series from calendar
1294 1266
 					$entryids = mapi_getprops($calendarItem, [PR_ENTRYID]);
1295 1267
 
@@ -1304,14 +1276,12 @@  discard block
 block discarded – undo
1304 1276
 
1305 1277
 			// Move the cancellation mail to wastebasket
1306 1278
 			mapi_folder_copymessages($sourcefolder, [$messageprops[PR_ENTRYID]], $wastebasket, MESSAGE_MOVE);
1307
-		}
1308
-		else {
1279
+		} else {
1309 1280
 			// Here only properties are set on calendaritem, because user is responding from calendar.
1310 1281
 			if ($basedate) {
1311 1282
 				// remove the occurrence
1312 1283
 				$this->doRemoveExceptionFromCalendar($basedate, $this->message, $store);
1313
-			}
1314
-			else {
1284
+			} else {
1315 1285
 				// remove normal/recurring meeting item.
1316 1286
 				// Move the message to the waste basket
1317 1287
 				mapi_folder_copymessages($sourcefolder, [$messageprops[PR_ENTRYID]], $wastebasket, MESSAGE_MOVE);
@@ -1358,8 +1328,7 @@  discard block
 block discarded – undo
1358 1328
 
1359 1329
 			// save changes in the message
1360 1330
 			mapi_savechanges($this->message);
1361
-		}
1362
-		else {
1331
+		} else {
1363 1332
 			// cancellation of normal meeting request
1364 1333
 			// Send the cancellation
1365 1334
 			$this->updateMeetingRequest();
@@ -1499,8 +1468,7 @@  discard block
 block discarded – undo
1499 1468
 					}
1500 1469
 				}
1501 1470
 			}
1502
-		}
1503
-		else {
1471
+		} else {
1504 1472
 			// Basedate found, an exception is to be send
1505 1473
 			if ($basedate) {
1506 1474
 				$recurr = new Recurrence($this->openDefaultStore(), $this->message);
@@ -1508,8 +1476,7 @@  discard block
 block discarded – undo
1508 1476
 				if ($cancel) {
1509 1477
 					// @TODO: remove occurrence from Resource's Calendar if resource was booked for whole series
1510 1478
 					$this->submitMeetingRequest($this->message, $cancel, $prefix, $basedate, $recurr, false);
1511
-				}
1512
-				else {
1479
+				} else {
1513 1480
 					$attach = $recurr->getExceptionAttachment($basedate);
1514 1481
 
1515 1482
 					if ($attach) {
@@ -1528,8 +1495,7 @@  discard block
 block discarded – undo
1528 1495
 						}
1529 1496
 					}
1530 1497
 				}
1531
-			}
1532
-			else {
1498
+			} else {
1533 1499
 				// This is normal meeting
1534 1500
 				$resourceRecipData = $this->bookResources($this->message, $cancel, $prefix);
1535 1501
 
@@ -1606,8 +1572,7 @@  discard block
 block discarded – undo
1606 1572
 
1607 1573
 		if (!isset($messageprops[$this->proptags['goid']])) {
1608 1574
 			$this->setMeetingRequest($basedate);
1609
-		}
1610
-		else {
1575
+		} else {
1611 1576
 			$counter = $messageprops[$this->proptags['last_updatecounter']] + 1;
1612 1577
 
1613 1578
 			// increment value of last_updatecounter, last_updatecounter will be common for recurring series
@@ -1626,8 +1591,7 @@  discard block
 block discarded – undo
1626 1591
 		if (!$this->isMeetingRequest($props[PR_MESSAGE_CLASS]) && !$this->isMeetingRequestResponse($props[PR_MESSAGE_CLASS]) && !$this->isMeetingCancellation($props[PR_MESSAGE_CLASS])) {
1627 1592
 			// we are checking with calendar item
1628 1593
 			$calendarItem = $this->message;
1629
-		}
1630
-		else {
1594
+		} else {
1631 1595
 			// we are checking with meeting request / response / cancellation mail
1632 1596
 			// get calendar items
1633 1597
 			$calendarItem = $this->getCorrespondentCalendarItem(true);
@@ -1762,8 +1726,7 @@  discard block
 block discarded – undo
1762 1726
 			if (isset($inboxprops[$prop])) {
1763 1727
 				return $inboxprops[$prop];
1764 1728
 			}
1765
-		}
1766
-		catch (MAPIException $e) {
1729
+		} catch (MAPIException $e) {
1767 1730
 			// public store doesn't support this method
1768 1731
 			if ($e->getCode() == MAPI_E_NO_SUPPORT) {
1769 1732
 				// don't propagate this error to parent handlers, if store doesn't support it
@@ -1853,8 +1816,7 @@  discard block
 block discarded – undo
1853 1816
 				if (($folderProps[PR_ACCESS] & MAPI_ACCESS_CREATE_CONTENTS) === MAPI_ACCESS_CREATE_CONTENTS) {
1854 1817
 					$accessToFolder = true;
1855 1818
 				}
1856
-			}
1857
-			catch (MAPIException $e) {
1819
+			} catch (MAPIException $e) {
1858 1820
 				// we don't have rights to open folder, so return false
1859 1821
 				if ($e->getCode() == MAPI_E_NO_ACCESS) {
1860 1822
 					return $accessToFolder;
@@ -1884,8 +1846,7 @@  discard block
 block discarded – undo
1884 1846
 				$delegatorStore = $this->getDelegatorStore($messageProps[PR_RCVD_REPRESENTING_ENTRYID]);
1885 1847
 
1886 1848
 				$store = $delegatorStore['store'];
1887
-			}
1888
-			else {
1849
+			} else {
1889 1850
 				$store = $this->store;
1890 1851
 			}
1891 1852
 		}
@@ -1895,8 +1856,7 @@  discard block
 block discarded – undo
1895 1856
 		if (isset($provider[PR_MDB_PROVIDER]) && $provider[PR_MDB_PROVIDER] === ZARAFA_STORE_PUBLIC_GUID) {
1896 1857
 			$entryid = mapi_getprops($this->message, [PR_PARENT_ENTRYID]);
1897 1858
 			$entryid = $entryid[PR_PARENT_ENTRYID];
1898
-		}
1899
-		else {
1859
+		} else {
1900 1860
 			$entryid = $this->getDefaultFolderEntryID(PR_IPM_APPOINTMENT_ENTRYID, $store);
1901 1861
 			if ($entryid === false) {
1902 1862
 				$entryid = $this->getBaseEntryID(PR_IPM_APPOINTMENT_ENTRYID, $store);
@@ -1922,8 +1882,7 @@  discard block
 block discarded – undo
1922 1882
 
1923 1883
 		try {
1924 1884
 			$mailuser = mapi_ab_openentry($ab, $ownerentryid);
1925
-		}
1926
-		catch (MAPIException $e) {
1885
+		} catch (MAPIException $e) {
1927 1886
 			return;
1928 1887
 		}
1929 1888
 
@@ -1991,8 +1950,7 @@  discard block
 block discarded – undo
1991 1950
 				$props[$this->proptags['meetingstatus']] = $imsgprops[$this->proptags['meetingstatus']];
1992 1951
 				$props[$this->proptags['responsestatus']] = $imsgprops[$this->proptags['responsestatus']];
1993 1952
 				$props[PR_SUBJECT] = $imsgprops[PR_SUBJECT];
1994
-			}
1995
-			else {
1953
+			} else {
1996 1954
 				// Exceptions is deleted.
1997 1955
 				// Update $messageprops with timings of occurrence
1998 1956
 				$messageprops[$this->proptags['startdate']] = $recurr->getOccurrenceStart($basedate);
@@ -2004,8 +1962,7 @@  discard block
 block discarded – undo
2004 1962
 
2005 1963
 			$props[$this->proptags['recurring']] = false;
2006 1964
 			$props[$this->proptags['is_exception']] = true;
2007
-		}
2008
-		else {
1965
+		} else {
2009 1966
 			// we are creating a response from meeting request mail (it could be recurring or non-recurring)
2010 1967
 			// Send all recurrence info in response, if this is a recurrence meeting.
2011 1968
 			$isRecurring = isset($messageprops[$this->proptags['recurring']]) && $messageprops[$this->proptags['recurring']];
@@ -2287,8 +2244,7 @@  discard block
 block discarded – undo
2287 2244
 		foreach ($recipients as $key => $recipient) {
2288 2245
 			if (isset($recipient[PR_RECIPIENT_FLAGS]) && $recipient[PR_RECIPIENT_FLAGS] == (recipSendable | recipOrganizer)) {
2289 2246
 				$hasOrganizer = true;
2290
-			}
2291
-			elseif ($isException && !isset($recipient[PR_RECIPIENT_FLAGS])) {
2247
+			} elseif ($isException && !isset($recipient[PR_RECIPIENT_FLAGS])) {
2292 2248
 				// Recipients for an occurrence
2293 2249
 				$recipients[$key][PR_RECIPIENT_FLAGS] = recipSendable | recipExceptionalResponse;
2294 2250
 			}
@@ -2429,8 +2385,7 @@  discard block
 block discarded – undo
2429 2385
 			],
2430 2386
 			];
2431 2387
 			$recipients = mapi_table_queryallrows($recipientTable, $this->recipprops, $res);
2432
-		}
2433
-		else {
2388
+		} else {
2434 2389
 			$recipients = mapi_table_queryallrows($recipientTable, $this->recipprops);
2435 2390
 		}
2436 2391
 
@@ -2526,8 +2481,7 @@  discard block
 block discarded – undo
2526 2481
 				if ($accessToFolder) {
2527 2482
 					$calFolder = mapi_msgstore_openentry($userStore, $userRootProps[PR_IPM_APPOINTMENT_ENTRYID]);
2528 2483
 				}
2529
-			}
2530
-			catch (MAPIException $e) {
2484
+			} catch (MAPIException $e) {
2531 2485
 				$e->setHandled();
2532 2486
 				$this->errorSetResource = 1; // No access
2533 2487
 			}
@@ -2554,8 +2508,7 @@  discard block
 block discarded – undo
2554 2508
 						 */
2555 2509
 						// $errorSetResource = 2;
2556 2510
 						$this->nonAcceptingResources[] = $resourceRecipients[$i];
2557
-					}
2558
-					else {
2511
+					} else {
2559 2512
 						if ($declineRecurringMeetingRequests && !$cancel) {
2560 2513
 							// Check if appointment is recurring
2561 2514
 							if ($messageprops[$this->proptags['recurring']]) {
@@ -2616,8 +2569,7 @@  discard block
 block discarded – undo
2616 2569
 					if (!$newResourceMsg) {
2617 2570
 						$newResourceMsg = mapi_folder_createmessage($calFolder);
2618 2571
 					}
2619
-				}
2620
-				else {
2572
+				} else {
2621 2573
 					$newResourceMsg = mapi_msgstore_openentry($userStore, $rows[0]);
2622 2574
 				}
2623 2575
 
@@ -2631,8 +2583,7 @@  discard block
 block discarded – undo
2631 2583
 				if ($cancel) {
2632 2584
 					$messageprops[$this->proptags['meetingstatus']] = olMeetingCanceled; // The meeting has been canceled
2633 2585
 					$messageprops[$this->proptags['busystatus']] = fbFree; // Free
2634
-				}
2635
-				else {
2586
+				} else {
2636 2587
 					$messageprops[$this->proptags['meetingstatus']] = olMeetingReceived; // The recipient is receiving the request
2637 2588
 				}
2638 2589
 				$messageprops[$this->proptags['responsestatus']] = olResponseAccepted; // The resource automatically accepts the appointment
@@ -2676,8 +2627,7 @@  discard block
 block discarded – undo
2676 2627
 						$messageprops[PR_SENT_REPRESENTING_ENTRYID] = $ownerentryid;
2677 2628
 						$messageprops[PR_SENT_REPRESENTING_SEARCH_KEY] = $ownersearchkey;
2678 2629
 					}
2679
-				}
2680
-				else {
2630
+				} else {
2681 2631
 					// get organizer information
2682 2632
 					$addrinfo = $this->getOwnerAddress($this->store);
2683 2633
 
@@ -2713,12 +2663,10 @@  discard block
 block discarded – undo
2713 2663
 					// Update occurrence
2714 2664
 					if ($recurr->isException($basedate)) {
2715 2665
 						$recurr->modifyException($messageprops, $basedate, $recips);
2716
-					}
2717
-					else {
2666
+					} else {
2718 2667
 						$recurr->createException($messageprops, $basedate, false, $recips);
2719 2668
 					}
2720
-				}
2721
-				else {
2669
+				} else {
2722 2670
 					mapi_setprops($newResourceMsg, $messageprops);
2723 2671
 
2724 2672
 					// Copy attachments
@@ -2742,8 +2690,7 @@  discard block
 block discarded – undo
2742 2690
 					'msg' => $newResourceMsg,
2743 2691
 				];
2744 2692
 				$this->includesResources = true;
2745
-			}
2746
-			else {
2693
+			} else {
2747 2694
 				/*
2748 2695
 				 * If no other errors occurred and you have no access to the
2749 2696
 				 * folder of the resource, throw an error=1.
@@ -2838,8 +2785,7 @@  discard block
 block discarded – undo
2838 2785
 			],
2839 2786
 			];
2840 2787
 			$recips = mapi_table_queryallrows($reciptable, $this->recipprops, $res);
2841
-		}
2842
-		else {
2788
+		} else {
2843 2789
 			$recips = mapi_table_queryallrows($reciptable, $this->recipprops);
2844 2790
 		}
2845 2791
 
@@ -2857,13 +2803,11 @@  discard block
 block discarded – undo
2857 2803
 		if (isset($exception_props[$this->proptags['intendedbusystatus']])) {
2858 2804
 			if ($tentative && $exception_props[$this->proptags['intendedbusystatus']] !== fbFree) {
2859 2805
 				$exception_props[$this->proptags['busystatus']] = fbTentative;
2860
-			}
2861
-			else {
2806
+			} else {
2862 2807
 				$exception_props[$this->proptags['busystatus']] = $exception_props[$this->proptags['intendedbusystatus']];
2863 2808
 			}
2864 2809
 			// we already have intendedbusystatus value in $exception_props so no need to copy it
2865
-		}
2866
-		else {
2810
+		} else {
2867 2811
 			$exception_props[$this->proptags['busystatus']] = $tentative ? fbTentative : fbBusy;
2868 2812
 		}
2869 2813
 
@@ -2879,8 +2823,7 @@  discard block
 block discarded – undo
2879 2823
 
2880 2824
 		if ($recurr->isException($basedate)) {
2881 2825
 			$recurr->modifyException($exception_props, $basedate, $recips, $occurrenceItem);
2882
-		}
2883
-		else {
2826
+		} else {
2884 2827
 			$recurr->createException($exception_props, $basedate, false, $recips, $occurrenceItem);
2885 2828
 		}
2886 2829
 
@@ -2917,8 +2860,7 @@  discard block
 block discarded – undo
2917 2860
 
2918 2861
 		if ($recurr->isException($basedate)) {
2919 2862
 			$recurr->modifyException($exception_props, $basedate, $recips, $occurrenceItem);
2920
-		}
2921
-		else {
2863
+		} else {
2922 2864
 			$recurr->createException($exception_props, $basedate, false, $recips, $occurrenceItem);
2923 2865
 		}
2924 2866
 
@@ -3017,8 +2959,7 @@  discard block
 block discarded – undo
3017 2959
 
3018 2960
 			if (!$deletedRecips) {
3019 2961
 				$deletedRecips = array_merge([], $recipients);
3020
-			}
3021
-			else {
2962
+			} else {
3022 2963
 				$deletedRecips = array_merge($deletedRecips, $recipients);
3023 2964
 			}
3024 2965
 		}
@@ -3157,8 +3098,7 @@  discard block
 block discarded – undo
3157 3098
 				$newmessageprops[PR_MESSAGE_CLASS] = 'IPM.Schedule.Meeting.Canceled';
3158 3099
 				$newmessageprops[$this->proptags['meetingstatus']] = olMeetingCanceled; // It's a cancel request
3159 3100
 				$newmessageprops[$this->proptags['busystatus']] = fbFree; // set the busy status as free
3160
-			}
3161
-			else {
3101
+			} else {
3162 3102
 				$newmessageprops[PR_MESSAGE_CLASS] = 'IPM.Schedule.Meeting.Request';
3163 3103
 				$newmessageprops[$this->proptags['meetingstatus']] = olMeetingReceived; // The recipient is receiving the request
3164 3104
 			}
@@ -3327,8 +3267,7 @@  discard block
 block discarded – undo
3327 3267
 					$sentprops[PR_SENDER_SEARCH_KEY] = $ownersearchkey;
3328 3268
 				}
3329 3269
 			}
3330
-		}
3331
-		else {
3270
+		} else {
3332 3271
 			// normal user is sending mail, so both set of properties will be same
3333 3272
 			$userDetails = $this->getOwnerAddress($userStore);
3334 3273
 
@@ -3494,8 +3433,7 @@  discard block
 block discarded – undo
3494 3433
 					$message = mapi_attach_openobj($attach, MAPI_MODIFY);
3495 3434
 				}
3496 3435
 			}
3497
-		}
3498
-		else {
3436
+		} else {
3499 3437
 			// use normal message or recurring series message
3500 3438
 			$message = $this->message;
3501 3439
 		}
@@ -3538,8 +3476,7 @@  discard block
 block discarded – undo
3538 3476
 			if (($recipient[PR_RECIPIENT_FLAGS] & recipOrganizer) != recipOrganizer) {
3539 3477
 				// Recipient is attendee, set the trackstatus to 'Not Responded'
3540 3478
 				$recipient[PR_RECIPIENT_TRACKSTATUS] = olRecipientTrackStatusNone;
3541
-			}
3542
-			else {
3479
+			} else {
3543 3480
 				// Recipient is organizer, this is not possible, but for safety
3544 3481
 				// it is best to clear the trackstatus for him as well by setting
3545 3482
 				// the trackstatus to 'Organized'.
@@ -3577,8 +3514,7 @@  discard block
 block discarded – undo
3577 3514
 
3578 3515
 			$store = $delegatorStore['store'];
3579 3516
 			$calFolder = $delegatorStore[PR_IPM_APPOINTMENT_ENTRYID];
3580
-		}
3581
-		else {
3517
+		} else {
3582 3518
 			$store = $this->store;
3583 3519
 			$calFolder = $this->openDefaultCalendar();
3584 3520
 		}
@@ -3640,8 +3576,7 @@  discard block
 block discarded – undo
3640 3576
 			if (isset($props[PR_RCVD_REPRESENTING_ENTRYID])) {
3641 3577
 				$delegatorStore = $this->getDelegatorStore($props[PR_RCVD_REPRESENTING_ENTRYID]);
3642 3578
 				$store = $delegatorStore['store'];
3643
-			}
3644
-			else {
3579
+			} else {
3645 3580
 				$store = $this->store;
3646 3581
 			}
3647 3582
 		}
@@ -3730,8 +3665,7 @@  discard block
 block discarded – undo
3730 3665
 
3731 3666
 									break;
3732 3667
 								}
3733
-							}
3734
-							else {
3668
+							} else {
3735 3669
 								++$noOfInstances;
3736 3670
 
3737 3671
 								break;
@@ -3743,8 +3677,7 @@  discard block
 block discarded – undo
3743 3677
 				if ($noOfInstances > 0) {
3744 3678
 					$returnValue = $noOfInstances;
3745 3679
 				}
3746
-			}
3747
-			else {
3680
+			} else {
3748 3681
 				// Get all items in the timeframe that we want to book, and get the goid and busystatus for each item
3749 3682
 				$items = getCalendarItems($userStore, $calFolder, $messageProps[$this->proptags['startdate']], $messageProps[$this->proptags['duedate']], [$this->proptags['goid'], $this->proptags['busystatus']]);
3750 3683
 
@@ -3766,8 +3699,7 @@  discard block
 block discarded – undo
3766 3699
 
3767 3700
 								break;
3768 3701
 							}
3769
-						}
3770
-						else {
3702
+						} else {
3771 3703
 							$returnValue = true;
3772 3704
 
3773 3705
 							break;
@@ -3929,8 +3861,7 @@  discard block
 block discarded – undo
3929 3861
 		foreach ($localCategories as $key => $value) {
3930 3862
 			if ($recurrence->isException($key)) {
3931 3863
 				$recurrence->modifyException([$this->proptags['categories'] => $value], $key);
3932
-			}
3933
-			else {
3864
+			} else {
3934 3865
 				$recurrence->createException([$this->proptags['categories'] => $value], $key, false);
3935 3866
 			}
3936 3867
 			mapi_savechanges($message);
Please login to merge, or discard this patch.
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -152,15 +152,15 @@  discard block
 block discarded – undo
152 152
 		$properties['reminderminutes'] = 'PT_LONG:PSETID_Common:0x8501';
153 153
 		$properties['reminderset'] = 'PT_BOOLEAN:PSETID_Common:0x8503';
154 154
 		$properties['sendasical'] = 'PT_BOOLEAN:PSETID_Appointment:0x8200';
155
-		$properties['updatecounter'] = 'PT_LONG:PSETID_Appointment:0x8201';                    // AppointmentSequenceNumber
156
-		$properties['last_updatecounter'] = 'PT_LONG:PSETID_Appointment:0x8203';            // AppointmentLastSequence
155
+		$properties['updatecounter'] = 'PT_LONG:PSETID_Appointment:0x8201'; // AppointmentSequenceNumber
156
+		$properties['last_updatecounter'] = 'PT_LONG:PSETID_Appointment:0x8203'; // AppointmentLastSequence
157 157
 		$properties['unknown7'] = 'PT_LONG:PSETID_Appointment:0x8202';
158 158
 		$properties['busystatus'] = 'PT_LONG:PSETID_Appointment:0x8205';
159 159
 		$properties['intendedbusystatus'] = 'PT_LONG:PSETID_Appointment:0x8224';
160 160
 		$properties['start'] = 'PT_SYSTIME:PSETID_Appointment:0x820d';
161 161
 		$properties['responselocation'] = 'PT_STRING8:PSETID_Meeting:0x2';
162 162
 		$properties['location'] = 'PT_STRING8:PSETID_Appointment:0x8208';
163
-		$properties['requestsent'] = 'PT_BOOLEAN:PSETID_Appointment:0x8229';        // PidLidFInvited, MeetingRequestWasSent
163
+		$properties['requestsent'] = 'PT_BOOLEAN:PSETID_Appointment:0x8229'; // PidLidFInvited, MeetingRequestWasSent
164 164
 		$properties['startdate'] = 'PT_SYSTIME:PSETID_Appointment:0x820d';
165 165
 		$properties['duedate'] = 'PT_SYSTIME:PSETID_Appointment:0x820e';
166 166
 		$properties['flagdueby'] = 'PT_SYSTIME:PSETID_Common:0x8560';
@@ -169,11 +169,11 @@  discard block
 block discarded – undo
169 169
 		$properties['recurring'] = 'PT_BOOLEAN:PSETID_Appointment:0x8223';
170 170
 		$properties['clipstart'] = 'PT_SYSTIME:PSETID_Appointment:0x8235';
171 171
 		$properties['clipend'] = 'PT_SYSTIME:PSETID_Appointment:0x8236';
172
-		$properties['start_recur_date'] = 'PT_LONG:PSETID_Meeting:0xD';                // StartRecurTime
173
-		$properties['start_recur_time'] = 'PT_LONG:PSETID_Meeting:0xE';                // StartRecurTime
174
-		$properties['end_recur_date'] = 'PT_LONG:PSETID_Meeting:0xF';                // EndRecurDate
175
-		$properties['end_recur_time'] = 'PT_LONG:PSETID_Meeting:0x10';                // EndRecurTime
176
-		$properties['is_exception'] = 'PT_BOOLEAN:PSETID_Meeting:0xA';                // LID_IS_EXCEPTION
172
+		$properties['start_recur_date'] = 'PT_LONG:PSETID_Meeting:0xD'; // StartRecurTime
173
+		$properties['start_recur_time'] = 'PT_LONG:PSETID_Meeting:0xE'; // StartRecurTime
174
+		$properties['end_recur_date'] = 'PT_LONG:PSETID_Meeting:0xF'; // EndRecurDate
175
+		$properties['end_recur_time'] = 'PT_LONG:PSETID_Meeting:0x10'; // EndRecurTime
176
+		$properties['is_exception'] = 'PT_BOOLEAN:PSETID_Meeting:0xA'; // LID_IS_EXCEPTION
177 177
 		$properties['apptreplyname'] = 'PT_STRING8:PSETID_Appointment:0x8230';
178 178
 		// Propose new time properties
179 179
 		$properties['proposed_start_whole'] = 'PT_SYSTIME:PSETID_Appointment:0x8250';
@@ -545,7 +545,7 @@  discard block
 block discarded – undo
545 545
 		$listProperties['rcvd_representing_search_key'] = PR_RCVD_REPRESENTING_SEARCH_KEY;
546 546
 		$messageProps = mapi_getprops($this->message, $listProperties);
547 547
 
548
-		$goid = $messageProps[$this->proptags['goid']];    // GlobalID (0x3)
548
+		$goid = $messageProps[$this->proptags['goid']]; // GlobalID (0x3)
549 549
 		if (!isset($goid)) {
550 550
 			return;
551 551
 		}
@@ -1436,7 +1436,7 @@  discard block
 block discarded – undo
1436 1436
 		$props[$this->proptags['goid2']] = $goid;
1437 1437
 
1438 1438
 		if (!isset($props[$this->proptags['updatecounter']])) {
1439
-			$props[$this->proptags['updatecounter']] = 0;            // OL also starts sequence no with zero.
1439
+			$props[$this->proptags['updatecounter']] = 0; // OL also starts sequence no with zero.
1440 1440
 			$props[$this->proptags['last_updatecounter']] = 0;
1441 1441
 		}
1442 1442
 
@@ -2285,12 +2285,12 @@  discard block
 block discarded – undo
2285 2285
 		$hasOrganizer = false;
2286 2286
 		// Check if meeting already has an organizer.
2287 2287
 		foreach ($recipients as $key => $recipient) {
2288
-			if (isset($recipient[PR_RECIPIENT_FLAGS]) && $recipient[PR_RECIPIENT_FLAGS] == (recipSendable | recipOrganizer)) {
2288
+			if (isset($recipient[PR_RECIPIENT_FLAGS]) && $recipient[PR_RECIPIENT_FLAGS] == (recipSendable|recipOrganizer)) {
2289 2289
 				$hasOrganizer = true;
2290 2290
 			}
2291 2291
 			elseif ($isException && !isset($recipient[PR_RECIPIENT_FLAGS])) {
2292 2292
 				// Recipients for an occurrence
2293
-				$recipients[$key][PR_RECIPIENT_FLAGS] = recipSendable | recipExceptionalResponse;
2293
+				$recipients[$key][PR_RECIPIENT_FLAGS] = recipSendable|recipExceptionalResponse;
2294 2294
 			}
2295 2295
 		}
2296 2296
 
@@ -2304,7 +2304,7 @@  discard block
 block discarded – undo
2304 2304
 			$organizer[PR_RECIPIENT_DISPLAY_NAME] = $messageProps[PR_SENT_REPRESENTING_NAME];
2305 2305
 			$organizer[PR_ADDRTYPE] = empty($messageProps[PR_SENT_REPRESENTING_ADDRTYPE]) ? 'SMTP' : $messageProps[PR_SENT_REPRESENTING_ADDRTYPE];
2306 2306
 			$organizer[PR_RECIPIENT_TRACKSTATUS] = olRecipientTrackStatusNone;
2307
-			$organizer[PR_RECIPIENT_FLAGS] = recipSendable | recipOrganizer;
2307
+			$organizer[PR_RECIPIENT_FLAGS] = recipSendable|recipOrganizer;
2308 2308
 			$organizer[PR_SEARCH_KEY] = $messageProps[PR_SENT_REPRESENTING_SEARCH_KEY];
2309 2309
 
2310 2310
 			// Add organizer to recipients list.
@@ -2400,7 +2400,7 @@  discard block
 block discarded – undo
2400 2400
 					continue;
2401 2401
 				}
2402 2402
 
2403
-				$attachOld = mapi_message_openattach($copyFrom, (int) $attachProps[PR_ATTACH_NUM]);
2403
+				$attachOld = mapi_message_openattach($copyFrom, (int)$attachProps[PR_ATTACH_NUM]);
2404 2404
 				$attachNewResourceMsg = mapi_message_createattach($copyTo);
2405 2405
 				mapi_copyto($attachOld, [], [], $attachNewResourceMsg, 0);
2406 2406
 				mapi_savechanges($attachNewResourceMsg);
@@ -2491,7 +2491,7 @@  discard block
 block discarded – undo
2491 2491
 				[
2492 2492
 					RES_PROPERTY,
2493 2493
 					[
2494
-						RELOP => RELOP_EQ,    // Equals recipient type 3: Resource
2494
+						RELOP => RELOP_EQ, // Equals recipient type 3: Resource
2495 2495
 						ULPROPTAG => PR_RECIPIENT_TYPE,
2496 2496
 						VALUE => [PR_RECIPIENT_TYPE => MAPI_BCC],
2497 2497
 					],
@@ -2773,7 +2773,7 @@  discard block
 block discarded – undo
2773 2773
 				[
2774 2774
 					RES_PROPERTY,
2775 2775
 					[
2776
-						RELOP => RELOP_EQ,    // Equals recipient type 3: Resource
2776
+						RELOP => RELOP_EQ, // Equals recipient type 3: Resource
2777 2777
 						ULPROPTAG => PR_RECIPIENT_TYPE,
2778 2778
 						VALUE => [PR_RECIPIENT_TYPE => MAPI_BCC],
2779 2779
 					],
@@ -3005,7 +3005,7 @@  discard block
 block discarded – undo
3005 3005
 				$restriction[1][] = [
3006 3006
 					RES_PROPERTY,
3007 3007
 					[
3008
-						RELOP => RELOP_NE,    // Does not equal recipient type: MAPI_BCC (Resource)
3008
+						RELOP => RELOP_NE, // Does not equal recipient type: MAPI_BCC (Resource)
3009 3009
 						ULPROPTAG => PR_RECIPIENT_TYPE,
3010 3010
 						VALUE => [PR_RECIPIENT_TYPE => MAPI_BCC],
3011 3011
 					],
@@ -3102,7 +3102,7 @@  discard block
 block discarded – undo
3102 3102
 									[
3103 3103
 										RES_PROPERTY,
3104 3104
 										[
3105
-											RELOP => RELOP_NE,    // Does not equal recipient type: MAPI_BCC (Resource)
3105
+											RELOP => RELOP_NE, // Does not equal recipient type: MAPI_BCC (Resource)
3106 3106
 											ULPROPTAG => PR_RECIPIENT_TYPE,
3107 3107
 											VALUE => [PR_RECIPIENT_TYPE => MAPI_BCC],
3108 3108
 										],
@@ -3209,7 +3209,7 @@  discard block
 block discarded – undo
3209 3209
 			$newmessageprops[PR_MESSAGE_CLASS] = 'IPM.Schedule.Meeting.Canceled';
3210 3210
 			$newmessageprops[$this->proptags['meetingstatus']] = olMeetingCanceled; // It's a cancel request
3211 3211
 			$newmessageprops[$this->proptags['busystatus']] = fbFree; // set the busy status as free
3212
-			$newmessageprops[PR_IMPORTANCE] = IMPORTANCE_HIGH;    // HIGH Importance
3212
+			$newmessageprops[PR_IMPORTANCE] = IMPORTANCE_HIGH; // HIGH Importance
3213 3213
 			if (isset($newmessageprops[PR_SUBJECT])) {
3214 3214
 				$newmessageprops[PR_SUBJECT] = _('Canceled: ') . $newmessageprops[PR_SUBJECT];
3215 3215
 			}
@@ -3269,12 +3269,12 @@  discard block
 block discarded – undo
3269 3269
 
3270 3270
 			// [0] => year, [1] => month, [2] => day, [3] => hour, [4] => minutes, [5] => seconds
3271 3271
 			// RecurStartDate = year * 512 + month_number * 32 + day_number
3272
-			$newmessageprops[$this->proptags['start_recur_date']] = (((int) $startDate[0]) * 512) + (((int) $startDate[1]) * 32) + ((int) $startDate[2]);
3272
+			$newmessageprops[$this->proptags['start_recur_date']] = (((int)$startDate[0]) * 512) + (((int)$startDate[1]) * 32) + ((int)$startDate[2]);
3273 3273
 			// RecurStartTime = hour * 4096 + minutes * 64 + seconds
3274
-			$newmessageprops[$this->proptags['start_recur_time']] = (((int) $startDate[3]) * 4096) + (((int) $startDate[4]) * 64) + ((int) $startDate[5]);
3274
+			$newmessageprops[$this->proptags['start_recur_time']] = (((int)$startDate[3]) * 4096) + (((int)$startDate[4]) * 64) + ((int)$startDate[5]);
3275 3275
 
3276
-			$newmessageprops[$this->proptags['end_recur_date']] = (((int) $endDate[0]) * 512) + (((int) $endDate[1]) * 32) + ((int) $endDate[2]);
3277
-			$newmessageprops[$this->proptags['end_recur_time']] = (((int) $endDate[3]) * 4096) + (((int) $endDate[4]) * 64) + ((int) $endDate[5]);
3276
+			$newmessageprops[$this->proptags['end_recur_date']] = (((int)$endDate[0]) * 512) + (((int)$endDate[1]) * 32) + ((int)$endDate[2]);
3277
+			$newmessageprops[$this->proptags['end_recur_time']] = (((int)$endDate[3]) * 4096) + (((int)$endDate[4]) * 64) + ((int)$endDate[5]);
3278 3278
 		}
3279 3279
 	}
3280 3280
 
Please login to merge, or discard this patch.
mapi/class.taskrecurrence.php 2 patches
Braces   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -172,8 +172,7 @@  discard block
 block discarded – undo
172 172
 					}
173 173
 
174 174
 					$props[$this->proptags["dead_occurrence"]] = false;
175
-				}
176
-				else {
175
+				} else {
177 176
 					if (isset($this->action['deleteOccurrence']) && $this->action['deleteOccurrence']) {
178 177
 						return false;
179 178
 					}
@@ -330,8 +329,7 @@  discard block
 block discarded – undo
330 329
 				// If startdate and enddate are set on task, then slide enddate according to duration
331 330
 				if (isset($this->messageprops[$this->proptags["startdate"]], $this->messageprops[$this->proptags["duedate"]])) {
332 331
 					$newItem[$this->proptags['duedate']] = $newItem[$this->proptags['startdate']] + ($this->messageprops[$this->proptags["duedate"]] - $this->messageprops[$this->proptags["startdate"]]);
333
-				}
334
-				else {
332
+				} else {
335 333
 					$newItem[$this->proptags['duedate']] = $newItem[$this->proptags['startdate']];
336 334
 				}
337 335
 
@@ -385,8 +383,7 @@  discard block
 block discarded – undo
385 383
 					$props[$this->proptags['flagdueby']] = $next_reminder_time;
386 384
 					$this->action['reminder'] = $props[$this->proptags['reminder']] = true;
387 385
 				}
388
-			}
389
-			else {
386
+			} else {
390 387
 				// Didn't get next occurrence, probably this is the last occurrence
391 388
 				$props[$this->proptags['reminder']] = false;
392 389
 				$props[$this->proptags['reset_reminder']] = false;
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -284,7 +284,7 @@
 block discarded – undo
284 284
 				$attachments = mapi_table_queryallrows($attachmentTable, [PR_ATTACH_NUM, PR_ATTACH_SIZE, PR_ATTACH_LONG_FILENAME, PR_ATTACHMENT_HIDDEN, PR_DISPLAY_NAME, PR_ATTACH_METHOD]);
285 285
 
286 286
 				foreach ($attachments as $attach_props) {
287
-					$attach_old = mapi_message_openattach($this->message, (int) $attach_props[PR_ATTACH_NUM]);
287
+					$attach_old = mapi_message_openattach($this->message, (int)$attach_props[PR_ATTACH_NUM]);
288 288
 					$attach_newResourceMsg = mapi_message_createattach($newMessage);
289 289
 
290 290
 					mapi_copyto($attach_old, [], [], $attach_newResourceMsg, 0);
Please login to merge, or discard this patch.
mapi/mapicode.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
  * @param mixed $code
28 28
  */
29 29
 function make_mapi_e($code) {
30
-	return (int) mapi_make_scode(1, $code);
30
+	return (int)mapi_make_scode(1, $code);
31 31
 }
32 32
 
33 33
 /**
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
  * @param mixed $code
37 37
  */
38 38
 function make_mapi_s($code) {
39
-	return (int) mapi_make_scode(0, $code);
39
+	return (int)mapi_make_scode(0, $code);
40 40
 }
41 41
 
42 42
 /* From mapicode.h */
Please login to merge, or discard this patch.
mapi/class.recurrence.php 2 patches
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -598,8 +598,8 @@  discard block
 block discarded – undo
598 598
 			}
599 599
 
600 600
 			// get timings of the first occurrence
601
-			$firstoccstartdate = isset($startocc) ? $start + (((int) $startocc) * 60) : $start;
602
-			$firstoccenddate = isset($endocc) ? $end + (((int) $endocc) * 60) : $end;
601
+			$firstoccstartdate = isset($startocc) ? $start + (((int)$startocc) * 60) : $start;
602
+			$firstoccenddate = isset($endocc) ? $end + (((int)$endocc) * 60) : $end;
603 603
 
604 604
 			$start = gmdate(_('d-m-Y'), $firstoccstartdate);
605 605
 			$end = gmdate(_('d-m-Y'), $firstoccenddate);
@@ -743,7 +743,7 @@  discard block
 block discarded – undo
743 743
 			$props[PR_EXCEPTION_ENDTIME] = $this->fromGMT($this->tz, $exception_props[$this->proptags["duedate"]]);
744 744
 			mapi_setprops($attachment, $props);
745 745
 
746
-			$imessage = mapi_attach_openobj($attachment, MAPI_CREATE | MAPI_MODIFY);
746
+			$imessage = mapi_attach_openobj($attachment, MAPI_CREATE|MAPI_MODIFY);
747 747
 
748 748
 			if ($copy_attach_from) {
749 749
 				$attachmentTable = mapi_message_getattachmenttable($copy_attach_from);
@@ -751,7 +751,7 @@  discard block
 block discarded – undo
751 751
 					$attachments = mapi_table_queryallrows($attachmentTable, [PR_ATTACH_NUM, PR_ATTACH_SIZE, PR_ATTACH_LONG_FILENAME, PR_ATTACHMENT_HIDDEN, PR_DISPLAY_NAME, PR_ATTACH_METHOD]);
752 752
 
753 753
 					foreach ($attachments as $attach_props) {
754
-						$attach_old = mapi_message_openattach($copy_attach_from, (int) $attach_props[PR_ATTACH_NUM]);
754
+						$attach_old = mapi_message_openattach($copy_attach_from, (int)$attach_props[PR_ATTACH_NUM]);
755 755
 						$attach_newResourceMsg = mapi_message_createattach($imessage);
756 756
 						mapi_copyto($attach_old, [], [], $attach_newResourceMsg, 0);
757 757
 						mapi_savechanges($attach_newResourceMsg);
@@ -1123,13 +1123,13 @@  discard block
 block discarded – undo
1123 1123
 			// Remove all deleted recipients
1124 1124
 			if (isset($exception_recips['remove'])) {
1125 1125
 				foreach ($exception_recips['remove'] as &$recip) {
1126
-					if (!isset($recip[PR_RECIPIENT_FLAGS]) || $recip[PR_RECIPIENT_FLAGS] != (recipReserved | recipExceptionalDeleted | recipSendable)) {
1127
-						$recip[PR_RECIPIENT_FLAGS] = recipSendable | recipExceptionalDeleted;
1126
+					if (!isset($recip[PR_RECIPIENT_FLAGS]) || $recip[PR_RECIPIENT_FLAGS] != (recipReserved|recipExceptionalDeleted|recipSendable)) {
1127
+						$recip[PR_RECIPIENT_FLAGS] = recipSendable|recipExceptionalDeleted;
1128 1128
 					}
1129 1129
 					else {
1130
-						$recip[PR_RECIPIENT_FLAGS] = recipReserved | recipExceptionalDeleted | recipSendable;
1130
+						$recip[PR_RECIPIENT_FLAGS] = recipReserved|recipExceptionalDeleted|recipSendable;
1131 1131
 					}
1132
-					$recip[PR_RECIPIENT_TRACKSTATUS] = olResponseNone;        // No Response required
1132
+					$recip[PR_RECIPIENT_TRACKSTATUS] = olResponseNone; // No Response required
1133 1133
 				}
1134 1134
 				unset($recip);
1135 1135
 				mapi_message_modifyrecipients($exception, MODRECIP_MODIFY, $exception_recips['remove']);
@@ -1199,13 +1199,13 @@  discard block
 block discarded – undo
1199 1199
 
1200 1200
 						// If recipient is not in list of deleted recipient, add him
1201 1201
 						if (!$foundInDeletedRecipients) {
1202
-							if (!isset($recipient[PR_RECIPIENT_FLAGS]) || $recipient[PR_RECIPIENT_FLAGS] != (recipReserved | recipExceptionalDeleted | recipSendable)) {
1203
-								$recipient[PR_RECIPIENT_FLAGS] = recipSendable | recipExceptionalDeleted;
1202
+							if (!isset($recipient[PR_RECIPIENT_FLAGS]) || $recipient[PR_RECIPIENT_FLAGS] != (recipReserved|recipExceptionalDeleted|recipSendable)) {
1203
+								$recipient[PR_RECIPIENT_FLAGS] = recipSendable|recipExceptionalDeleted;
1204 1204
 							}
1205 1205
 							else {
1206
-								$recipient[PR_RECIPIENT_FLAGS] = recipReserved | recipExceptionalDeleted | recipSendable;
1206
+								$recipient[PR_RECIPIENT_FLAGS] = recipReserved|recipExceptionalDeleted|recipSendable;
1207 1207
 							}
1208
-							$recipient[PR_RECIPIENT_TRACKSTATUS] = olRecipientTrackStatusNone;    // No Response required
1208
+							$recipient[PR_RECIPIENT_TRACKSTATUS] = olRecipientTrackStatusNone; // No Response required
1209 1209
 							$deletedRecipients[] = $recipient;
1210 1210
 						}
1211 1211
 					}
@@ -1265,12 +1265,12 @@  discard block
 block discarded – undo
1265 1265
 			$hasOrganizer = false;
1266 1266
 			// Check if meeting already has an organizer.
1267 1267
 			foreach ($recipients as $key => $recipient) {
1268
-				if (isset($recipient[PR_RECIPIENT_FLAGS]) && $recipient[PR_RECIPIENT_FLAGS] == (recipSendable | recipOrganizer)) {
1268
+				if (isset($recipient[PR_RECIPIENT_FLAGS]) && $recipient[PR_RECIPIENT_FLAGS] == (recipSendable|recipOrganizer)) {
1269 1269
 					$hasOrganizer = true;
1270 1270
 				}
1271 1271
 				elseif ($isException && !isset($recipient[PR_RECIPIENT_FLAGS])) {
1272 1272
 					// Recipients for an occurrence
1273
-					$recipients[$key][PR_RECIPIENT_FLAGS] = recipSendable | recipExceptionalResponse;
1273
+					$recipients[$key][PR_RECIPIENT_FLAGS] = recipSendable|recipExceptionalResponse;
1274 1274
 				}
1275 1275
 			}
1276 1276
 
@@ -1284,7 +1284,7 @@  discard block
 block discarded – undo
1284 1284
 				$organizer[PR_RECIPIENT_DISPLAY_NAME] = $messageProps[PR_SENT_REPRESENTING_NAME];
1285 1285
 				$organizer[PR_ADDRTYPE] = empty($messageProps[PR_SENT_REPRESENTING_ADDRTYPE]) ? 'SMTP' : $messageProps[PR_SENT_REPRESENTING_ADDRTYPE];
1286 1286
 				$organizer[PR_RECIPIENT_TRACKSTATUS] = olRecipientTrackStatusNone;
1287
-				$organizer[PR_RECIPIENT_FLAGS] = recipSendable | recipOrganizer;
1287
+				$organizer[PR_RECIPIENT_FLAGS] = recipSendable|recipOrganizer;
1288 1288
 				$organizer[PR_SEARCH_KEY] = $messageProps[PR_SENT_REPRESENTING_SEARCH_KEY];
1289 1289
 
1290 1290
 				// Add organizer to recipients list.
Please login to merge, or discard this patch.
Braces   +28 added lines, -56 removed lines patch added patch discarded remove patch
@@ -51,8 +51,7 @@  discard block
 block discarded – undo
51 51
 		public function __construct($store, $message, $proptags = []) {
52 52
 			if ($proptags) {
53 53
 				$this->proptags = $proptags;
54
-			}
55
-			else {
54
+			} else {
56 55
 				$properties = [];
57 56
 				$properties["entryid"] = PR_ENTRYID;
58 57
 				$properties["parent_entryid"] = PR_PARENT_ENTRYID;
@@ -192,8 +191,7 @@  discard block
 block discarded – undo
192 191
 
193 192
 				// Add the changed occurrence to the list
194 193
 				array_push($this->recur["changed_occurrences"], $changed_item);
195
-			}
196
-			else {
194
+			} else {
197 195
 				// Delete the occurrence by placing it in the deleted occurrences list
198 196
 				array_push($this->recur["deleted_occurrences"], $baseday);
199 197
 			}
@@ -290,12 +288,10 @@  discard block
 block discarded – undo
290 288
 				if ($copy_attach_from) {
291 289
 					$this->deleteExceptionAttachment($base_date);
292 290
 					$this->createException($exception_props, $base_date, false, $exception_recips, $copy_attach_from);
293
-				}
294
-				else {
291
+				} else {
295 292
 					$this->createExceptionAttachment($exception_props, $exception_recips, $copy_attach_from);
296 293
 				}
297
-			}
298
-			else {
294
+			} else {
299 295
 				$message = mapi_attach_openobj($attach, MAPI_MODIFY);
300 296
 
301 297
 				// Set exception properties on embedded message and save
@@ -339,8 +335,7 @@  discard block
 block discarded – undo
339 335
 				// the exception used to be.
340 336
 				$oldexception = $this->getChangeException($basedate);
341 337
 				$prevday = $this->dayStartOf($oldexception["start"]);
342
-			}
343
-			else {
338
+			} else {
344 339
 				// If its a new exception, we want to look at the original placement of this item.
345 340
 				$prevday = $basedate;
346 341
 			}
@@ -350,8 +345,7 @@  discard block
 block discarded – undo
350 345
 			// Get all the occurrences on the days between the basedate (may be reversed)
351 346
 			if ($prevday < $startday) {
352 347
 				$items = $this->getItems($this->toGMT($this->tz, $prevday), $this->toGMT($this->tz, $startday + 24 * 60 * 60));
353
-			}
354
-			else {
348
+			} else {
355 349
 				$items = $this->getItems($this->toGMT($this->tz, $startday), $this->toGMT($this->tz, $prevday + 24 * 60 * 60));
356 350
 			}
357 351
 
@@ -545,12 +539,10 @@  discard block
 block discarded – undo
545 539
 					if ($everyn == 1) {
546 540
 						$type = _('workday');
547 541
 						$occSingleDayRank = true;
548
-					}
549
-					elseif ($everyn == (24 * 60)) {
542
+					} elseif ($everyn == (24 * 60)) {
550 543
 						$type = _('day');
551 544
 						$occSingleDayRank = true;
552
-					}
553
-					else {
545
+					} else {
554 546
 						$everyn /= (24 * 60);
555 547
 						$type = _('days');
556 548
 						$occSingleDayRank = false;
@@ -562,8 +554,7 @@  discard block
 block discarded – undo
562 554
 					if ($everyn == 1) {
563 555
 						$type = _('week');
564 556
 						$occSingleDayRank = true;
565
-					}
566
-					else {
557
+					} else {
567 558
 						$type = _('weeks');
568 559
 						$occSingleDayRank = false;
569 560
 					}
@@ -574,8 +565,7 @@  discard block
 block discarded – undo
574 565
 					if ($everyn == 1) {
575 566
 						$type = _('month');
576 567
 						$occSingleDayRank = true;
577
-					}
578
-					else {
568
+					} else {
579 569
 						$type = _('months');
580 570
 						$occSingleDayRank = false;
581 571
 					}
@@ -587,8 +577,7 @@  discard block
 block discarded – undo
587 577
 						$everyn = 1;
588 578
 						$type = _('year');
589 579
 						$occSingleDayRank = true;
590
-					}
591
-					else {
580
+					} else {
592 581
 						$everyn = $everyn / 12;
593 582
 						$type = _('years');
594 583
 						$occSingleDayRank = false;
@@ -618,21 +607,17 @@  discard block
 block discarded – undo
618 607
 				if ($occTimeRange) {
619 608
 					if ($occSingleDayRank) {
620 609
 						$pattern = sprintf(_('Occurs every %s effective %s from %s to %s.'), $type, $start, $startocc, $endocc);
621
-					}
622
-					else {
610
+					} else {
623 611
 						$pattern = sprintf(_('Occurs every %s %s effective %s from %s to %s.'), $everyn, $type, $start, $startocc, $endocc);
624 612
 					}
625
-				}
626
-				else {
613
+				} else {
627 614
 					if ($occSingleDayRank) {
628 615
 						$pattern = sprintf(_('Occurs every %s effective %s.'), $type, $start);
629
-					}
630
-					else {
616
+					} else {
631 617
 						$pattern = sprintf(_('Occurs every %s %s effective %s.'), $everyn, $type, $start);
632 618
 					}
633 619
 				}
634
-			}
635
-			elseif ($term == 0x22) {
620
+			} elseif ($term == 0x22) {
636 621
 				// After a number of times
637 622
 				if ($occTimeRange) {
638 623
 					if ($occSingleDayRank) {
@@ -641,24 +626,21 @@  discard block
 block discarded – undo
641 626
 							'Occurs every %s effective %s for %s occurrences from %s to %s.',
642 627
 							$numocc
643 628
 						), $type, $start, $numocc, $startocc, $endocc);
644
-					}
645
-					else {
629
+					} else {
646 630
 						$pattern = sprintf(ngettext(
647 631
 							'Occurs every %s %s effective %s for %s occurrence from %s to %s.',
648 632
 							'Occurs every %s %s effective %s for %s occurrences %s to %s.',
649 633
 							$numocc
650 634
 						), $everyn, $type, $start, $numocc, $startocc, $endocc);
651 635
 					}
652
-				}
653
-				else {
636
+				} else {
654 637
 					if ($occSingleDayRank) {
655 638
 						$pattern = sprintf(ngettext(
656 639
 							'Occurs every %s effective %s for %s occurrence.',
657 640
 							'Occurs every %s effective %s for %s occurrences.',
658 641
 							$numocc
659 642
 						), $type, $start, $numocc);
660
-					}
661
-					else {
643
+					} else {
662 644
 						$pattern = sprintf(ngettext(
663 645
 							'Occurs every %s %s effective %s for %s occurrence.',
664 646
 							'Occurs every %s %s effective %s for %s occurrences.',
@@ -666,22 +648,18 @@  discard block
 block discarded – undo
666 648
 						), $everyn, $type, $start, $numocc);
667 649
 					}
668 650
 				}
669
-			}
670
-			elseif ($term == 0x21) {
651
+			} elseif ($term == 0x21) {
671 652
 				// After the given enddate
672 653
 				if ($occTimeRange) {
673 654
 					if ($occSingleDayRank) {
674 655
 						$pattern = sprintf(_('Occurs every %s effective %s until %s from %s to %s.'), $type, $start, $end, $startocc, $endocc);
675
-					}
676
-					else {
656
+					} else {
677 657
 						$pattern = sprintf(_('Occurs every %s %s effective %s until %s from %s to %s.'), $everyn, $type, $start, $end, $startocc, $endocc);
678 658
 					}
679
-				}
680
-				else {
659
+				} else {
681 660
 					if ($occSingleDayRank) {
682 661
 						$pattern = sprintf(_('Occurs every %s effective %s until %s.'), $type, $start, $end);
683
-					}
684
-					else {
662
+					} else {
685 663
 						$pattern = sprintf(_('Occurs every %s %s effective %s until %s.'), $everyn, $type, $start, $end);
686 664
 					}
687 665
 				}
@@ -713,8 +691,7 @@  discard block
 block discarded – undo
713 691
 			foreach ($this->recur["changed_occurrences"] as $entry) {
714 692
 				if (!$this->isSameDay($entry["basedate"], $base_date)) {
715 693
 					$new[] = $entry;
716
-				}
717
-				else {
694
+				} else {
718 695
 					$this->deleteExceptionAttachment($this->toGMT($this->tz, $base_date + $this->recur["startocc"] * 60));
719 696
 				}
720 697
 			}
@@ -1083,8 +1060,7 @@  discard block
 block discarded – undo
1083 1060
 		public function setExceptionRecipients($message, $exception_recips, $copy_orig_recips = true) {
1084 1061
 			if (isset($exception_recips['add']) || isset($exception_recips['remove']) || isset($exception_recips['modify'])) {
1085 1062
 				$this->setDeltaExceptionRecipients($message, $exception_recips, $copy_orig_recips);
1086
-			}
1087
-			else {
1063
+			} else {
1088 1064
 				$this->setAllExceptionRecipients($message, $exception_recips);
1089 1065
 			}
1090 1066
 		}
@@ -1125,8 +1101,7 @@  discard block
 block discarded – undo
1125 1101
 				foreach ($exception_recips['remove'] as &$recip) {
1126 1102
 					if (!isset($recip[PR_RECIPIENT_FLAGS]) || $recip[PR_RECIPIENT_FLAGS] != (recipReserved | recipExceptionalDeleted | recipSendable)) {
1127 1103
 						$recip[PR_RECIPIENT_FLAGS] = recipSendable | recipExceptionalDeleted;
1128
-					}
1129
-					else {
1104
+					} else {
1130 1105
 						$recip[PR_RECIPIENT_FLAGS] = recipReserved | recipExceptionalDeleted | recipSendable;
1131 1106
 					}
1132 1107
 					$recip[PR_RECIPIENT_TRACKSTATUS] = olResponseNone;        // No Response required
@@ -1201,8 +1176,7 @@  discard block
 block discarded – undo
1201 1176
 						if (!$foundInDeletedRecipients) {
1202 1177
 							if (!isset($recipient[PR_RECIPIENT_FLAGS]) || $recipient[PR_RECIPIENT_FLAGS] != (recipReserved | recipExceptionalDeleted | recipSendable)) {
1203 1178
 								$recipient[PR_RECIPIENT_FLAGS] = recipSendable | recipExceptionalDeleted;
1204
-							}
1205
-							else {
1179
+							} else {
1206 1180
 								$recipient[PR_RECIPIENT_FLAGS] = recipReserved | recipExceptionalDeleted | recipSendable;
1207 1181
 							}
1208 1182
 							$recipient[PR_RECIPIENT_TRACKSTATUS] = olRecipientTrackStatusNone;    // No Response required
@@ -1221,8 +1195,7 @@  discard block
 block discarded – undo
1221 1195
 					}
1222 1196
 				}
1223 1197
 				$exception_recips = array_merge($exception_recips, $deletedRecipients);
1224
-			}
1225
-			else {
1198
+			} else {
1226 1199
 				$exception_recips = $recipientRows;
1227 1200
 			}
1228 1201
 
@@ -1267,8 +1240,7 @@  discard block
 block discarded – undo
1267 1240
 			foreach ($recipients as $key => $recipient) {
1268 1241
 				if (isset($recipient[PR_RECIPIENT_FLAGS]) && $recipient[PR_RECIPIENT_FLAGS] == (recipSendable | recipOrganizer)) {
1269 1242
 					$hasOrganizer = true;
1270
-				}
1271
-				elseif ($isException && !isset($recipient[PR_RECIPIENT_FLAGS])) {
1243
+				} elseif ($isException && !isset($recipient[PR_RECIPIENT_FLAGS])) {
1272 1244
 					// Recipients for an occurrence
1273 1245
 					$recipients[$key][PR_RECIPIENT_FLAGS] = recipSendable | recipExceptionalResponse;
1274 1246
 				}
Please login to merge, or discard this patch.
mapi/class.freebusypublish.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -218,7 +218,7 @@
 block discarded – undo
218 218
 					],
219 219
 				], // EXISTS OR
220 220
 			],
221
-		];        // global OR
221
+		]; // global OR
222 222
 
223 223
 		$contents = mapi_folder_getcontentstable($this->calendar);
224 224
 		mapi_table_restrict($contents, $restrict);
Please login to merge, or discard this patch.
Braces   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -240,8 +240,7 @@  discard block
 block discarded – undo
240 240
 					$recur = new Recurrence($this->store, $row);
241 241
 
242 242
 					$occurrences = $recur->getItems($starttime, $length);
243
-				}
244
-				else {
243
+				} else {
245 244
 					$occurrences[] = $row;
246 245
 				}
247 246
 
@@ -269,8 +268,7 @@  discard block
 block discarded – undo
269 268
 		// Get the FB interface
270 269
 		try {
271 270
 			$fbsupport = mapi_freebusysupport_open($this->session, $this->store);
272
-		}
273
-		catch (MAPIException $e) {
271
+		} catch (MAPIException $e) {
274 272
 			if ($e->getCode() == MAPI_E_NOT_FOUND) {
275 273
 				$e->setHandled();
276 274
 				SLog::Write(LOGLEVEL_WARN, "Error in opening freebusysupport object.");
@@ -290,8 +288,7 @@  discard block
 block discarded – undo
290 288
 
291 289
 			// We're finished
292 290
 			mapi_freebusysupport_close($fbsupport);
293
-		}
294
-		else {
291
+		} else {
295 292
 			SLog::Write(LOGLEVEL_WARN, "FreeBusyPublish is not available");
296 293
 		}
297 294
 	}
Please login to merge, or discard this patch.
mapi/class.baserecurrence.php 3 patches
Braces   +35 added lines, -70 removed lines patch added patch discarded remove patch
@@ -53,8 +53,7 @@  discard block
 block discarded – undo
53 53
 
54 54
 			if (is_array($message)) {
55 55
 				$this->messageprops = $message;
56
-			}
57
-			else {
56
+			} else {
58 57
 				$this->message = $message;
59 58
 				$this->messageprops = mapi_getprops($this->message, $this->proptags);
60 59
 			}
@@ -218,8 +217,7 @@  discard block
 block discarded – undo
218 217
 
219 218
 					if ($ret["subtype"] == 3) {
220 219
 						$ret["weekdays"] = $data["monthday"];
221
-					}
222
-					else {
220
+					} else {
223 221
 						$ret["monthday"] = $data["monthday"];
224 222
 					}
225 223
 
@@ -247,8 +245,7 @@  discard block
 block discarded – undo
247 245
 
248 246
 					if ($ret["subtype"] == 3) {
249 247
 						$ret["weekdays"] = $data["monthday"];
250
-					}
251
-					else {
248
+					} else {
252 249
 						$ret["monthday"] = $data["monthday"];
253 250
 					}
254 251
 
@@ -592,8 +589,7 @@  discard block
 block discarded – undo
592 589
 					if ($this->recur["subtype"] == 1) {
593 590
 						// Daily every workday
594 591
 						$rdata .= pack("VVVV", (6 * 24 * 60), 1, 0, 0x3E);
595
-					}
596
-					else {
592
+					} else {
597 593
 						// Daily every N days (everyN in minutes)
598 594
 
599 595
 						$everyn = ((int) $this->recur["everyn"]) / 1440;
@@ -669,8 +665,7 @@  discard block
 block discarded – undo
669 665
 
670 666
 					if ($this->recur["regen"]) {
671 667
 						$rdata .= pack("VVV", $firstocc, (int) $this->recur["everyn"], 1);
672
-					}
673
-					else {
668
+					} else {
674 669
 						$rdata .= pack("VVVV", $firstocc, (int) $this->recur["everyn"], 0, (int) $this->recur["weekdays"]);
675 670
 					}
676 671
 
@@ -689,8 +684,7 @@  discard block
 block discarded – undo
689 684
 
690 685
 					if ($term == 0x0C /* monthly */) {
691 686
 						$everyn = (int) $this->recur["everyn"];
692
-					}
693
-					else {
687
+					} else {
694 688
 						$everyn = $this->recur["regen"] ? ((int) $this->recur["everyn"]) * 12 : 12;
695 689
 					}
696 690
 
@@ -733,18 +727,15 @@  discard block
 block discarded – undo
733 727
 								if ($term == 0x0D /* yearly */) {
734 728
 									if ($curmonth > $selmonth) {// go to next occurrence in 'everyn' months minus difference in first occurrence and original date
735 729
 										$count = $everyn - ($curmonth - $selmonth);
736
-									}
737
-									elseif ($curmonth < $selmonth) {// go to next occurrence upto difference in first occurrence and original date
730
+									} elseif ($curmonth < $selmonth) {// go to next occurrence upto difference in first occurrence and original date
738 731
 										$count = $selmonth - $curmonth;
739
-									}
740
-									else {
732
+									} else {
741 733
 										// Go to next occurrence while recurrence start date is greater than occurrence date but within same month
742 734
 										if (((int) $this->recur["monthday"]) < $curmonthday) {
743 735
 											$count = $everyn;
744 736
 										}
745 737
 									}
746
-								}
747
-								else {
738
+								} else {
748 739
 									$count = $everyn; // Monthly, go to next occurrence in 'everyn' months
749 740
 								}
750 741
 
@@ -782,8 +773,7 @@  discard block
 block discarded – undo
782 773
 								}
783 774
 
784 775
 								$rdata .= pack("VVVV", $firstocc, $everyn, $this->recur["regen"], (int) $this->recur["monthday"]);
785
-							}
786
-							else {
776
+							} else {
787 777
 								// Calc first occ
788 778
 								$firstocc = 0;
789 779
 								$monthIndex = (int) gmdate("n", $this->recur["start"]);
@@ -812,8 +802,7 @@  discard block
 block discarded – undo
812 802
 							if ($nday == 5) {
813 803
 								// Set date on the last day of the last month
814 804
 								$monthbegindow += (gmdate("t", $monthbegindow) - gmdate("j", $monthbegindow)) * 24 * 60 * 60;
815
-							}
816
-							else {
805
+							} else {
817 806
 								// Set on the first day of the month
818 807
 								$monthbegindow -= ((gmdate("j", $monthbegindow) - 1) * 24 * 60 * 60);
819 808
 							}
@@ -822,8 +811,7 @@  discard block
 block discarded – undo
822 811
 								// Set on right month
823 812
 								if ($selmonth < $curmonth) {
824 813
 									$tmp = 12 - $curmonth + $selmonth;
825
-								}
826
-								else {
814
+								} else {
827 815
 									$tmp = ($selmonth - $curmonth);
828 816
 								}
829 817
 
@@ -836,8 +824,7 @@  discard block
 block discarded – undo
836 824
 									}
837 825
 									++$curmonth;
838 826
 								}
839
-							}
840
-							else {
827
+							} else {
841 828
 								// Check or you exist in the right month
842 829
 
843 830
 								$dayofweek = gmdate("w", $monthbegindow);
@@ -900,8 +887,7 @@  discard block
 block discarded – undo
900 887
 							}
901 888
 							if ($nday == 5) {
902 889
 								$monthbegindow -= $day * 24 * 60 * 60;
903
-							}
904
-							else {
890
+							} else {
905 891
 								$monthbegindow += ($day - 1) * 24 * 60 * 60;
906 892
 							}
907 893
 
@@ -916,8 +902,7 @@  discard block
 block discarded – undo
916 902
 								}
917 903
 
918 904
 								$rdata .= pack("VVVVV", $firstocc, $everyn, 0, $weekdays, $nday);
919
-							}
920
-							else {
905
+							} else {
921 906
 								// Calc first occ
922 907
 								$monthIndex = (int) gmdate("n", $this->recur["start"]);
923 908
 
@@ -967,8 +952,7 @@  discard block
 block discarded – undo
967 952
 			// Strange little thing for the recurrence type "every workday"
968 953
 			if (((int) $this->recur["type"]) == 0x0B && ((int) $this->recur["subtype"]) == 1) {
969 954
 				$rdata .= pack("V", 1);
970
-			}
971
-			else { // Other recurrences
955
+			} else { // Other recurrences
972 956
 				$rdata .= pack("V", 0);
973 957
 			}
974 958
 
@@ -1046,8 +1030,7 @@  discard block
 block discarded – undo
1046 1030
 
1047 1031
 									$occenddate += 24 * 60 * 60;
1048 1032
 								}
1049
-							}
1050
-							else {
1033
+							} else {
1051 1034
 								// -1 because the first day already counts (from 1-1-1980 to 1-1-1980 is 1 occurrence)
1052 1035
 								$occenddate += (((int) $this->recur["everyn"]) * 60 * (((int) $this->recur["numoccur"] - 1)));
1053 1036
 							}
@@ -1096,8 +1079,7 @@  discard block
 block discarded – undo
1096 1079
 										if ($curmonth >= 12) {
1097 1080
 											$curmonth = 1;
1098 1081
 											++$curyear;
1099
-										}
1100
-										else {
1082
+										} else {
1101 1083
 											++$curmonth;
1102 1084
 										}
1103 1085
 										--$forwardcount;
@@ -1108,8 +1090,7 @@  discard block
 block discarded – undo
1108 1090
 										gmdate("j", $occenddate) < ((int) $this->recur["monthday"])) {
1109 1091
 										if (gmdate("j", $occenddate) < 28) {
1110 1092
 											$occenddate -= gmdate("j", $occenddate) * 24 * 60 * 60;
1111
-										}
1112
-										else {
1093
+										} else {
1113 1094
 											$occenddate += (gmdate("t", $occenddate) - gmdate("j", $occenddate)) * 24 * 60 * 60;
1114 1095
 										}
1115 1096
 									}
@@ -1125,8 +1106,7 @@  discard block
 block discarded – undo
1125 1106
 										if ($curmonth >= 12) {
1126 1107
 											$curmonth = 1;
1127 1108
 											++$curyear;
1128
-										}
1129
-										else {
1109
+										} else {
1130 1110
 											++$curmonth;
1131 1111
 										}
1132 1112
 
@@ -1136,8 +1116,7 @@  discard block
 block discarded – undo
1136 1116
 									if ($nday == 5) {
1137 1117
 										// Set date on the last day of the last month
1138 1118
 										$occenddate += (gmdate("t", $occenddate) - gmdate("j", $occenddate)) * 24 * 60 * 60;
1139
-									}
1140
-									else {
1119
+									} else {
1141 1120
 										// Set date on the first day of the last month
1142 1121
 										$occenddate -= (gmdate("j", $occenddate) - 1) * 24 * 60 * 60;
1143 1122
 									}
@@ -1208,8 +1187,7 @@  discard block
 block discarded – undo
1208 1187
 
1209 1188
 				// set named prop 'side_effects' to 369, needed for Outlook to ask for single or total recurrence when deleting
1210 1189
 				$propsToSet[$this->proptags["side_effects"]] = 369;
1211
-			}
1212
-			else {
1190
+			} else {
1213 1191
 				$propsToSet[$this->proptags["side_effects"]] = 3441;
1214 1192
 			}
1215 1193
 
@@ -1239,8 +1217,7 @@  discard block
 block discarded – undo
1239 1217
 
1240 1218
 				if ($occ) {
1241 1219
 					$propsToSet[$this->proptags["flagdueby"]] = $occ[$this->proptags["startdate"]] - ($reminderprops[$this->proptags["reminder_minutes"]] * 60);
1242
-				}
1243
-				else {
1220
+				} else {
1244 1221
 					// Last reminder passed, no reminders any more.
1245 1222
 					$propsToSet[$this->proptags["reminder"]] = false;
1246 1223
 					$propsToSet[$this->proptags["flagdueby"]] = 0x7FF00000;
@@ -1459,11 +1436,9 @@  discard block
 block discarded – undo
1459 1436
 		public function getMonthInSeconds($year, $month) {
1460 1437
 			if (in_array($month, [1, 3, 5, 7, 8, 10, 12])) {
1461 1438
 				$day = 31;
1462
-			}
1463
-			elseif (in_array($month, [4, 6, 9, 11])) {
1439
+			} elseif (in_array($month, [4, 6, 9, 11])) {
1464 1440
 				$day = 30;
1465
-			}
1466
-			else {
1441
+			} else {
1467 1442
 				$day = 28;
1468 1443
 				if ($this->isLeapYear($year) == 1) {
1469 1444
 					++$day;
@@ -1533,8 +1508,7 @@  discard block
 block discarded – undo
1533 1508
 				if ($date > $dststart && $date < $dstend) {
1534 1509
 					$dst = true;
1535 1510
 				}
1536
-			}
1537
-			else {
1511
+			} else {
1538 1512
 				// Southern hemisphere, eg DST is during Oct-Mar
1539 1513
 				if ($date < $dstend || $date > $dststart) {
1540 1514
 					$dst = true;
@@ -1720,8 +1694,7 @@  discard block
 block discarded – undo
1720 1694
 				// TODO use one isset
1721 1695
 				if (isset($this->recur['regen'], $this->action['datecompleted']) && $this->recur['regen']) {
1722 1696
 					$daystart = $this->dayStartOf($this->action['datecompleted']);
1723
-				}
1724
-				else {
1697
+				} else {
1725 1698
 					$daystart = $this->dayStartOf($this->recur["start"]); // start on first day of occurrence
1726 1699
 				}
1727 1700
 
@@ -1729,8 +1702,7 @@  discard block
 block discarded – undo
1729 1702
 				// or the end of the recurrence, whichever comes first
1730 1703
 				if ($end > $this->toGMT($this->tz, $this->recur["end"])) {
1731 1704
 					$rangeend = $this->toGMT($this->tz, $this->recur["end"]);
1732
-				}
1733
-				else {
1705
+				} else {
1734 1706
 					$rangeend = $end;
1735 1707
 				}
1736 1708
 
@@ -1750,8 +1722,7 @@  discard block
 block discarded – undo
1750 1722
 						for ($now = $daystart; $now <= $dayend && ($limit == 0 || count($items) < $limit); $now += 60 * $this->recur["everyn"]) {
1751 1723
 							$this->processOccurrenceItem($items, $start, $end, $now, $this->recur["startocc"], $this->recur["endocc"], $this->tz, $remindersonly);
1752 1724
 						}
1753
-					}
1754
-					else {
1725
+					} else {
1755 1726
 						// Every workday
1756 1727
 						for ($now = $daystart; $now <= $dayend && ($limit == 0 || count($items) < $limit); $now += 60 * 1440) {
1757 1728
 							$nowtime = $this->gmtime($now);
@@ -1777,8 +1748,7 @@  discard block
 block discarded – undo
1777 1748
 					for ($now = $daystart; $now <= $dayend && ($limit == 0 || count($items) < $limit); $now += (60 * 60 * 24 * 7 * $this->recur["everyn"])) {
1778 1749
 						if ($this->recur['regen']) {
1779 1750
 							$this->processOccurrenceItem($items, $start, $end, $now, $this->recur["startocc"], $this->recur["endocc"], $this->tz, $remindersonly);
1780
-						}
1781
-						else {
1751
+						} else {
1782 1752
 							// Loop through the whole following week to the first occurrence of the week, add each day that is specified
1783 1753
 							for ($wday = 0; $wday < 7; ++$wday) {
1784 1754
 								$daynow = $now + $wday * 60 * 60 * 24;
@@ -1813,8 +1783,7 @@  discard block
 block discarded – undo
1813 1783
 							if ($daynow <= $dayend) {
1814 1784
 								$this->processOccurrenceItem($items, $start, $end, $daynow, $this->recur["startocc"], $this->recur["endocc"], $this->tz, $remindersonly);
1815 1785
 							}
1816
-						}
1817
-						elseif (isset($this->recur["nday"], $this->recur["weekdays"])) { // Nth [weekday] of every N months
1786
+						} elseif (isset($this->recur["nday"], $this->recur["weekdays"])) { // Nth [weekday] of every N months
1818 1787
 							// Sanitize input
1819 1788
 							if ($this->recur["weekdays"] == 0) {
1820 1789
 								$this->recur["weekdays"] = 1;
@@ -1841,8 +1810,7 @@  discard block
 block discarded – undo
1841 1810
 								}
1842 1811
 								// $firstday is the day of the month on which the asked pattern of nth weekday matches
1843 1812
 								$daynow = $now + $firstday * 60 * 60 * 24;
1844
-							}
1845
-							else {
1813
+							} else {
1846 1814
 								// Find last day in the month ($now is the firstday of the month)
1847 1815
 								$NumDaysInMonth = $this->daysInMonth($now, 1);
1848 1816
 								$daynow = $now + (($NumDaysInMonth - 1) * 24 * 60 * 60);
@@ -1860,8 +1828,7 @@  discard block
 block discarded – undo
1860 1828
 							if ($daynow <= $dayend && $daynow >= $daystart) {
1861 1829
 								$this->processOccurrenceItem($items, $start, $end, $daynow, $this->recur["startocc"], $this->recur["endocc"], $this->tz, $remindersonly);
1862 1830
 							}
1863
-						}
1864
-						elseif ($this->recur['regen']) {
1831
+						} elseif ($this->recur['regen']) {
1865 1832
 							$next_month_start = $now + ($this->daysInMonth($now, 1) * 24 * 60 * 60);
1866 1833
 							$now = $daystart + ($this->daysInMonth($next_month_start, $this->recur['everyn']) * 24 * 60 * 60);
1867 1834
 
@@ -1890,8 +1857,7 @@  discard block
 block discarded – undo
1890 1857
 							}    // Cap $monthday on month length (eg 28 feb instead of 29 feb)
1891 1858
 							$daynow = $monthstart + ($monthday - 1) * 24 * 60 * 60;
1892 1859
 							$this->processOccurrenceItem($items, $start, $end, $daynow, $this->recur["startocc"], $this->recur["endocc"], $this->tz, $remindersonly);
1893
-						}
1894
-						elseif (isset($this->recur["nday"], $this->recur["weekdays"])) { // Nth [weekday] in month X of every N years
1860
+						} elseif (isset($this->recur["nday"], $this->recur["weekdays"])) { // Nth [weekday] in month X of every N years
1895 1861
 							// Go the correct month
1896 1862
 							$monthnow = $now + $this->daysInMonth($now, $this->monthOfYear($this->recur["month"])) * 24 * 60 * 60;
1897 1863
 
@@ -1915,8 +1881,7 @@  discard block
 block discarded – undo
1915 1881
 							}
1916 1882
 
1917 1883
 							$this->processOccurrenceItem($items, $start, $end, $daynow, $this->recur["startocc"], $this->recur["endocc"], $this->tz, $remindersonly);
1918
-						}
1919
-						elseif ($this->recur['regen']) {
1884
+						} elseif ($this->recur['regen']) {
1920 1885
 							$year_starttime = $this->gmtime($now);
1921 1886
 							$is_next_leapyear = $this->isLeapYear($year_starttime['tm_year'] + 1900 + 1);    // +1 next year
1922 1887
 							$now = $daystart + ($is_next_leapyear ? 31622400 /* Leap year in seconds */ : 31536000 /* year in seconds */);
Please login to merge, or discard this patch.
Switch Indentation   +143 added lines, -143 removed lines patch added patch discarded remove patch
@@ -1739,193 +1739,193 @@
 block discarded – undo
1739 1739
 				// Loop through the entire recurrence range of dates, and check for each occurrence whether it is in the view range.
1740 1740
 
1741 1741
 				switch ($this->recur["type"]) {
1742
-				case 10:
1743
-					// Daily
1744
-					if ($this->recur["everyn"] <= 0) {
1745
-						$this->recur["everyn"] = 1440;
1746
-					}
1747
-
1748
-					if ($this->recur["subtype"] == 0) {
1749
-						// Every Nth day
1750
-						for ($now = $daystart; $now <= $dayend && ($limit == 0 || count($items) < $limit); $now += 60 * $this->recur["everyn"]) {
1751
-							$this->processOccurrenceItem($items, $start, $end, $now, $this->recur["startocc"], $this->recur["endocc"], $this->tz, $remindersonly);
1742
+					case 10:
1743
+						// Daily
1744
+						if ($this->recur["everyn"] <= 0) {
1745
+							$this->recur["everyn"] = 1440;
1752 1746
 						}
1753
-					}
1754
-					else {
1755
-						// Every workday
1756
-						for ($now = $daystart; $now <= $dayend && ($limit == 0 || count($items) < $limit); $now += 60 * 1440) {
1757
-							$nowtime = $this->gmtime($now);
1758
-							if ($nowtime["tm_wday"] > 0 && $nowtime["tm_wday"] < 6) { // only add items in the given timespace
1747
+
1748
+						if ($this->recur["subtype"] == 0) {
1749
+							// Every Nth day
1750
+							for ($now = $daystart; $now <= $dayend && ($limit == 0 || count($items) < $limit); $now += 60 * $this->recur["everyn"]) {
1759 1751
 								$this->processOccurrenceItem($items, $start, $end, $now, $this->recur["startocc"], $this->recur["endocc"], $this->tz, $remindersonly);
1760 1752
 							}
1761 1753
 						}
1762
-					}
1763
-
1764
-					break;
1754
+						else {
1755
+							// Every workday
1756
+							for ($now = $daystart; $now <= $dayend && ($limit == 0 || count($items) < $limit); $now += 60 * 1440) {
1757
+								$nowtime = $this->gmtime($now);
1758
+								if ($nowtime["tm_wday"] > 0 && $nowtime["tm_wday"] < 6) { // only add items in the given timespace
1759
+									$this->processOccurrenceItem($items, $start, $end, $now, $this->recur["startocc"], $this->recur["endocc"], $this->tz, $remindersonly);
1760
+								}
1761
+							}
1762
+						}
1765 1763
 
1766
-				case 11:
1767
-					// Weekly
1768
-					if ($this->recur["everyn"] <= 0) {
1769
-						$this->recur["everyn"] = 1;
1770
-					}
1764
+						break;
1771 1765
 
1772
-					// If sliding flag is set then move to 'n' weeks
1773
-					if ($this->recur['regen']) {
1774
-						$daystart += (60 * 60 * 24 * 7 * $this->recur["everyn"]);
1775
-					}
1766
+					case 11:
1767
+						// Weekly
1768
+						if ($this->recur["everyn"] <= 0) {
1769
+							$this->recur["everyn"] = 1;
1770
+						}
1776 1771
 
1777
-					for ($now = $daystart; $now <= $dayend && ($limit == 0 || count($items) < $limit); $now += (60 * 60 * 24 * 7 * $this->recur["everyn"])) {
1772
+						// If sliding flag is set then move to 'n' weeks
1778 1773
 						if ($this->recur['regen']) {
1779
-							$this->processOccurrenceItem($items, $start, $end, $now, $this->recur["startocc"], $this->recur["endocc"], $this->tz, $remindersonly);
1774
+							$daystart += (60 * 60 * 24 * 7 * $this->recur["everyn"]);
1780 1775
 						}
1781
-						else {
1782
-							// Loop through the whole following week to the first occurrence of the week, add each day that is specified
1783
-							for ($wday = 0; $wday < 7; ++$wday) {
1784
-								$daynow = $now + $wday * 60 * 60 * 24;
1785
-								// checks weather the next coming day in recurring pattern is less than or equal to end day of the recurring item
1786
-								if ($daynow <= $dayend) {
1787
-									$nowtime = $this->gmtime($daynow); // Get the weekday of the current day
1788
-									if (($this->recur["weekdays"] & (1 << $nowtime["tm_wday"]))) { // Selected ?
1789
-										$this->processOccurrenceItem($items, $start, $end, $daynow, $this->recur["startocc"], $this->recur["endocc"], $this->tz, $remindersonly);
1776
+
1777
+						for ($now = $daystart; $now <= $dayend && ($limit == 0 || count($items) < $limit); $now += (60 * 60 * 24 * 7 * $this->recur["everyn"])) {
1778
+							if ($this->recur['regen']) {
1779
+								$this->processOccurrenceItem($items, $start, $end, $now, $this->recur["startocc"], $this->recur["endocc"], $this->tz, $remindersonly);
1780
+							}
1781
+							else {
1782
+								// Loop through the whole following week to the first occurrence of the week, add each day that is specified
1783
+								for ($wday = 0; $wday < 7; ++$wday) {
1784
+									$daynow = $now + $wday * 60 * 60 * 24;
1785
+									// checks weather the next coming day in recurring pattern is less than or equal to end day of the recurring item
1786
+									if ($daynow <= $dayend) {
1787
+										$nowtime = $this->gmtime($daynow); // Get the weekday of the current day
1788
+										if (($this->recur["weekdays"] & (1 << $nowtime["tm_wday"]))) { // Selected ?
1789
+											$this->processOccurrenceItem($items, $start, $end, $daynow, $this->recur["startocc"], $this->recur["endocc"], $this->tz, $remindersonly);
1790
+										}
1790 1791
 									}
1791 1792
 								}
1792 1793
 							}
1793 1794
 						}
1794
-					}
1795 1795
 
1796
-					break;
1797
-
1798
-				case 12:
1799
-					// Monthly
1800
-					if ($this->recur["everyn"] <= 0) {
1801
-						$this->recur["everyn"] = 1;
1802
-					}
1796
+						break;
1803 1797
 
1804
-					// Loop through all months from start to end of occurrence, starting at beginning of first month
1805
-					for ($now = $this->monthStartOf($daystart); $now <= $dayend && ($limit == 0 || count($items) < $limit); $now += $this->daysInMonth($now, $this->recur["everyn"]) * 24 * 60 * 60) {
1806
-						if (isset($this->recur["monthday"]) && ($this->recur['monthday'] != "undefined") && !$this->recur['regen']) { // Day M of every N months
1807
-							$difference = 1;
1808
-							if ($this->daysInMonth($now, $this->recur["everyn"]) < $this->recur["monthday"]) {
1809
-								$difference = $this->recur["monthday"] - $this->daysInMonth($now, $this->recur["everyn"]) + 1;
1810
-							}
1811
-							$daynow = $now + (($this->recur["monthday"] - $difference) * 24 * 60 * 60);
1812
-							// checks weather the next coming day in recurrence pattern is less than or equal to end day of the recurring item
1813
-							if ($daynow <= $dayend) {
1814
-								$this->processOccurrenceItem($items, $start, $end, $daynow, $this->recur["startocc"], $this->recur["endocc"], $this->tz, $remindersonly);
1815
-							}
1798
+					case 12:
1799
+						// Monthly
1800
+						if ($this->recur["everyn"] <= 0) {
1801
+							$this->recur["everyn"] = 1;
1816 1802
 						}
1817
-						elseif (isset($this->recur["nday"], $this->recur["weekdays"])) { // Nth [weekday] of every N months
1818
-							// Sanitize input
1819
-							if ($this->recur["weekdays"] == 0) {
1820
-								$this->recur["weekdays"] = 1;
1821
-							}
1822 1803
 
1823
-							// If nday is not set to the last day in the month
1824
-							if ($this->recur["nday"] < 5) {
1825
-								// keep the track of no. of time correct selection pattern(like 2nd weekday, 4th fiday, etc.)is matched
1826
-								$ndaycounter = 0;
1827
-								// Find matching weekday in this month
1828
-								for ($day = 0, $total = $this->daysInMonth($now, 1); $day < $total; ++$day) {
1829
-									$daynow = $now + $day * 60 * 60 * 24;
1830
-									$nowtime = $this->gmtime($daynow); // Get the weekday of the current day
1804
+						// Loop through all months from start to end of occurrence, starting at beginning of first month
1805
+						for ($now = $this->monthStartOf($daystart); $now <= $dayend && ($limit == 0 || count($items) < $limit); $now += $this->daysInMonth($now, $this->recur["everyn"]) * 24 * 60 * 60) {
1806
+							if (isset($this->recur["monthday"]) && ($this->recur['monthday'] != "undefined") && !$this->recur['regen']) { // Day M of every N months
1807
+								$difference = 1;
1808
+								if ($this->daysInMonth($now, $this->recur["everyn"]) < $this->recur["monthday"]) {
1809
+									$difference = $this->recur["monthday"] - $this->daysInMonth($now, $this->recur["everyn"]) + 1;
1810
+								}
1811
+								$daynow = $now + (($this->recur["monthday"] - $difference) * 24 * 60 * 60);
1812
+								// checks weather the next coming day in recurrence pattern is less than or equal to end day of the recurring item
1813
+								if ($daynow <= $dayend) {
1814
+									$this->processOccurrenceItem($items, $start, $end, $daynow, $this->recur["startocc"], $this->recur["endocc"], $this->tz, $remindersonly);
1815
+								}
1816
+							}
1817
+							elseif (isset($this->recur["nday"], $this->recur["weekdays"])) { // Nth [weekday] of every N months
1818
+								// Sanitize input
1819
+								if ($this->recur["weekdays"] == 0) {
1820
+									$this->recur["weekdays"] = 1;
1821
+								}
1831 1822
 
1832
-									if ($this->recur["weekdays"] & (1 << $nowtime["tm_wday"])) { // Selected ?
1833
-										++$ndaycounter;
1834
-									}
1835
-									// check the selected pattern is same as asked Nth weekday,If so set the firstday
1836
-									if ($this->recur["nday"] == $ndaycounter) {
1837
-										$firstday = $day;
1823
+								// If nday is not set to the last day in the month
1824
+								if ($this->recur["nday"] < 5) {
1825
+									// keep the track of no. of time correct selection pattern(like 2nd weekday, 4th fiday, etc.)is matched
1826
+									$ndaycounter = 0;
1827
+									// Find matching weekday in this month
1828
+									for ($day = 0, $total = $this->daysInMonth($now, 1); $day < $total; ++$day) {
1829
+										$daynow = $now + $day * 60 * 60 * 24;
1830
+										$nowtime = $this->gmtime($daynow); // Get the weekday of the current day
1831
+
1832
+										if ($this->recur["weekdays"] & (1 << $nowtime["tm_wday"])) { // Selected ?
1833
+											++$ndaycounter;
1834
+										}
1835
+										// check the selected pattern is same as asked Nth weekday,If so set the firstday
1836
+										if ($this->recur["nday"] == $ndaycounter) {
1837
+											$firstday = $day;
1838 1838
 
1839
-										break;
1839
+											break;
1840
+										}
1840 1841
 									}
1842
+									// $firstday is the day of the month on which the asked pattern of nth weekday matches
1843
+									$daynow = $now + $firstday * 60 * 60 * 24;
1841 1844
 								}
1842
-								// $firstday is the day of the month on which the asked pattern of nth weekday matches
1843
-								$daynow = $now + $firstday * 60 * 60 * 24;
1844
-							}
1845
-							else {
1846
-								// Find last day in the month ($now is the firstday of the month)
1847
-								$NumDaysInMonth = $this->daysInMonth($now, 1);
1848
-								$daynow = $now + (($NumDaysInMonth - 1) * 24 * 60 * 60);
1845
+								else {
1846
+									// Find last day in the month ($now is the firstday of the month)
1847
+									$NumDaysInMonth = $this->daysInMonth($now, 1);
1848
+									$daynow = $now + (($NumDaysInMonth - 1) * 24 * 60 * 60);
1849 1849
 
1850
-								$nowtime = $this->gmtime($daynow);
1851
-								while (($this->recur["weekdays"] & (1 << $nowtime["tm_wday"])) == 0) {
1852
-									$daynow -= 86400;
1853 1850
 									$nowtime = $this->gmtime($daynow);
1851
+									while (($this->recur["weekdays"] & (1 << $nowtime["tm_wday"])) == 0) {
1852
+										$daynow -= 86400;
1853
+										$nowtime = $this->gmtime($daynow);
1854
+									}
1854 1855
 								}
1855
-							}
1856 1856
 
1857
-							/*
1857
+								/*
1858 1858
 							 * 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.
1859 1859
 							 */
1860
-							if ($daynow <= $dayend && $daynow >= $daystart) {
1861
-								$this->processOccurrenceItem($items, $start, $end, $daynow, $this->recur["startocc"], $this->recur["endocc"], $this->tz, $remindersonly);
1860
+								if ($daynow <= $dayend && $daynow >= $daystart) {
1861
+									$this->processOccurrenceItem($items, $start, $end, $daynow, $this->recur["startocc"], $this->recur["endocc"], $this->tz, $remindersonly);
1862
+								}
1862 1863
 							}
1863
-						}
1864
-						elseif ($this->recur['regen']) {
1865
-							$next_month_start = $now + ($this->daysInMonth($now, 1) * 24 * 60 * 60);
1866
-							$now = $daystart + ($this->daysInMonth($next_month_start, $this->recur['everyn']) * 24 * 60 * 60);
1864
+							elseif ($this->recur['regen']) {
1865
+								$next_month_start = $now + ($this->daysInMonth($now, 1) * 24 * 60 * 60);
1866
+								$now = $daystart + ($this->daysInMonth($next_month_start, $this->recur['everyn']) * 24 * 60 * 60);
1867 1867
 
1868
-							if ($now <= $dayend) {
1869
-								$this->processOccurrenceItem($items, $daystart, $end, $now, $this->recur["startocc"], $this->recur["endocc"], $this->tz, $remindersonly);
1868
+								if ($now <= $dayend) {
1869
+									$this->processOccurrenceItem($items, $daystart, $end, $now, $this->recur["startocc"], $this->recur["endocc"], $this->tz, $remindersonly);
1870
+								}
1870 1871
 							}
1871 1872
 						}
1872
-					}
1873
-
1874
-					break;
1875 1873
 
1876
-				case 13:
1877
-					// Yearly
1878
-					if ($this->recur["everyn"] <= 0) {
1879
-						$this->recur["everyn"] = 12;
1880
-					}
1874
+						break;
1881 1875
 
1882
-					for ($now = $this->yearStartOf($daystart); $now <= $dayend && ($limit == 0 || count($items) < $limit); $now += $this->daysInMonth($now, $this->recur["everyn"]) * 24 * 60 * 60) {
1883
-						if (isset($this->recur["monthday"]) && !$this->recur['regen']) { // same as monthly, but in a specific month
1884
-							// recur["month"] is in minutes since the beginning of the year
1885
-							$month = $this->monthOfYear($this->recur["month"]); // $month is now month of year [0..11]
1886
-							$monthday = $this->recur["monthday"]; // $monthday is day of the month [1..31]
1887
-							$monthstart = $now + $this->daysInMonth($now, $month) * 24 * 60 * 60; // $monthstart is the timestamp of the beginning of the month
1888
-							if ($monthday > $this->daysInMonth($monthstart, 1)) {
1889
-								$monthday = $this->daysInMonth($monthstart, 1);
1890
-							}    // Cap $monthday on month length (eg 28 feb instead of 29 feb)
1891
-							$daynow = $monthstart + ($monthday - 1) * 24 * 60 * 60;
1892
-							$this->processOccurrenceItem($items, $start, $end, $daynow, $this->recur["startocc"], $this->recur["endocc"], $this->tz, $remindersonly);
1876
+					case 13:
1877
+						// Yearly
1878
+						if ($this->recur["everyn"] <= 0) {
1879
+							$this->recur["everyn"] = 12;
1893 1880
 						}
1894
-						elseif (isset($this->recur["nday"], $this->recur["weekdays"])) { // Nth [weekday] in month X of every N years
1895
-							// Go the correct month
1896
-							$monthnow = $now + $this->daysInMonth($now, $this->monthOfYear($this->recur["month"])) * 24 * 60 * 60;
1897 1881
 
1898
-							// Find first matching weekday in this month
1899
-							for ($wday = 0; $wday < 7; ++$wday) {
1900
-								$daynow = $monthnow + $wday * 60 * 60 * 24;
1901
-								$nowtime = $this->gmtime($daynow); // Get the weekday of the current day
1882
+						for ($now = $this->yearStartOf($daystart); $now <= $dayend && ($limit == 0 || count($items) < $limit); $now += $this->daysInMonth($now, $this->recur["everyn"]) * 24 * 60 * 60) {
1883
+							if (isset($this->recur["monthday"]) && !$this->recur['regen']) { // same as monthly, but in a specific month
1884
+								// recur["month"] is in minutes since the beginning of the year
1885
+								$month = $this->monthOfYear($this->recur["month"]); // $month is now month of year [0..11]
1886
+								$monthday = $this->recur["monthday"]; // $monthday is day of the month [1..31]
1887
+								$monthstart = $now + $this->daysInMonth($now, $month) * 24 * 60 * 60; // $monthstart is the timestamp of the beginning of the month
1888
+								if ($monthday > $this->daysInMonth($monthstart, 1)) {
1889
+									$monthday = $this->daysInMonth($monthstart, 1);
1890
+								}    // Cap $monthday on month length (eg 28 feb instead of 29 feb)
1891
+								$daynow = $monthstart + ($monthday - 1) * 24 * 60 * 60;
1892
+								$this->processOccurrenceItem($items, $start, $end, $daynow, $this->recur["startocc"], $this->recur["endocc"], $this->tz, $remindersonly);
1893
+							}
1894
+							elseif (isset($this->recur["nday"], $this->recur["weekdays"])) { // Nth [weekday] in month X of every N years
1895
+								// Go the correct month
1896
+								$monthnow = $now + $this->daysInMonth($now, $this->monthOfYear($this->recur["month"])) * 24 * 60 * 60;
1897
+
1898
+								// Find first matching weekday in this month
1899
+								for ($wday = 0; $wday < 7; ++$wday) {
1900
+									$daynow = $monthnow + $wday * 60 * 60 * 24;
1901
+									$nowtime = $this->gmtime($daynow); // Get the weekday of the current day
1902 1902
 
1903
-								if ($this->recur["weekdays"] & (1 << $nowtime["tm_wday"])) { // Selected ?
1904
-									$firstday = $wday;
1903
+									if ($this->recur["weekdays"] & (1 << $nowtime["tm_wday"])) { // Selected ?
1904
+										$firstday = $wday;
1905 1905
 
1906
-									break;
1906
+										break;
1907
+									}
1907 1908
 								}
1908
-							}
1909 1909
 
1910
-							// Same as above (monthly)
1911
-							$daynow = $monthnow + ($firstday + ($this->recur["nday"] - 1) * 7) * 60 * 60 * 24;
1910
+								// Same as above (monthly)
1911
+								$daynow = $monthnow + ($firstday + ($this->recur["nday"] - 1) * 7) * 60 * 60 * 24;
1912 1912
 
1913
-							while ($this->monthStartOf($daynow) != $this->monthStartOf($monthnow)) {
1914
-								$daynow -= 7 * 60 * 60 * 24;
1915
-							}
1913
+								while ($this->monthStartOf($daynow) != $this->monthStartOf($monthnow)) {
1914
+									$daynow -= 7 * 60 * 60 * 24;
1915
+								}
1916 1916
 
1917
-							$this->processOccurrenceItem($items, $start, $end, $daynow, $this->recur["startocc"], $this->recur["endocc"], $this->tz, $remindersonly);
1918
-						}
1919
-						elseif ($this->recur['regen']) {
1920
-							$year_starttime = $this->gmtime($now);
1921
-							$is_next_leapyear = $this->isLeapYear($year_starttime['tm_year'] + 1900 + 1);    // +1 next year
1922
-							$now = $daystart + ($is_next_leapyear ? 31622400 /* Leap year in seconds */ : 31536000 /* year in seconds */);
1917
+								$this->processOccurrenceItem($items, $start, $end, $daynow, $this->recur["startocc"], $this->recur["endocc"], $this->tz, $remindersonly);
1918
+							}
1919
+							elseif ($this->recur['regen']) {
1920
+								$year_starttime = $this->gmtime($now);
1921
+								$is_next_leapyear = $this->isLeapYear($year_starttime['tm_year'] + 1900 + 1);    // +1 next year
1922
+								$now = $daystart + ($is_next_leapyear ? 31622400 /* Leap year in seconds */ : 31536000 /* year in seconds */);
1923 1923
 
1924
-							if ($now <= $dayend) {
1925
-								$this->processOccurrenceItem($items, $daystart, $end, $now, $this->recur["startocc"], $this->recur["endocc"], $this->tz, $remindersonly);
1924
+								if ($now <= $dayend) {
1925
+									$this->processOccurrenceItem($items, $daystart, $end, $now, $this->recur["startocc"], $this->recur["endocc"], $this->tz, $remindersonly);
1926
+								}
1926 1927
 							}
1927 1928
 						}
1928
-					}
1929 1929
 				}
1930 1930
 				// to get all exception items
1931 1931
 				if (!empty($this->recur['changed_occurrences'])) {
Please login to merge, or discard this patch.
Spacing   +74 added lines, -74 removed lines patch added patch discarded remove patch
@@ -573,14 +573,14 @@  discard block
 block discarded – undo
573 573
 				return;
574 574
 			}
575 575
 
576
-			$rdata = pack("CCCCCCV", 0x04, 0x30, 0x04, 0x30, (int) $this->recur["type"], 0x20, (int) $this->recur["subtype"]);
576
+			$rdata = pack("CCCCCCV", 0x04, 0x30, 0x04, 0x30, (int)$this->recur["type"], 0x20, (int)$this->recur["subtype"]);
577 577
 
578 578
 			$weekstart = 1; // monday
579 579
 			$forwardcount = 0;
580 580
 			$restocc = 0;
581
-			$dayofweek = (int) gmdate("w", (int) $this->recur["start"]); // 0 (for Sunday) through 6 (for Saturday)
581
+			$dayofweek = (int)gmdate("w", (int)$this->recur["start"]); // 0 (for Sunday) through 6 (for Saturday)
582 582
 
583
-			$term = (int) $this->recur["type"];
583
+			$term = (int)$this->recur["type"];
584 584
 
585 585
 			switch ($term) {
586 586
 				case 0x0A:
@@ -596,12 +596,12 @@  discard block
 block discarded – undo
596 596
 					else {
597 597
 						// Daily every N days (everyN in minutes)
598 598
 
599
-						$everyn = ((int) $this->recur["everyn"]) / 1440;
599
+						$everyn = ((int)$this->recur["everyn"]) / 1440;
600 600
 
601 601
 						// Calc first occ
602
-						$firstocc = $this->unixDataToRecurData($this->recur["start"]) % ((int) $this->recur["everyn"]);
602
+						$firstocc = $this->unixDataToRecurData($this->recur["start"]) % ((int)$this->recur["everyn"]);
603 603
 
604
-						$rdata .= pack("VVV", $firstocc, (int) $this->recur["everyn"], $this->recur["regen"] ? 1 : 0);
604
+						$rdata .= pack("VVV", $firstocc, (int)$this->recur["everyn"], $this->recur["regen"] ? 1 : 0);
605 605
 					}
606 606
 
607 607
 					break;
@@ -624,7 +624,7 @@  discard block
 block discarded – undo
624 624
 						$daycount = 0;
625 625
 						$dayskip = -1;
626 626
 						for ($j = 0; $j < 7; ++$j) {
627
-							if (((int) $this->recur["weekdays"]) & (1 << (($dayofweek + $j) % 7))) {
627
+							if (((int)$this->recur["weekdays"]) & (1 << (($dayofweek + $j) % 7))) {
628 628
 								if ($dayskip == -1) {
629 629
 									$dayskip = $j;
630 630
 								}
@@ -643,35 +643,35 @@  discard block
 block discarded – undo
643 643
 
644 644
 						// Check if the recurrence ends after a number of occurrences, in that case we must calculate the
645 645
 						// remaining occurrences based on the start of the recurrence.
646
-						if (((int) $this->recur["term"]) == 0x22) {
646
+						if (((int)$this->recur["term"]) == 0x22) {
647 647
 							// $weekskip is the amount of weeks to skip from the startdate before the first occurrence
648 648
 							// $forwardcount is the maximum number of week occurrences we can go ahead after the first occurrence that
649 649
 							// is still inside the recurrence. We subtract one to make sure that the last week is never forwarded over
650 650
 							// (eg when numoccur = 2, and daycount = 1)
651
-							$forwardcount = floor((int) ($this->recur["numoccur"] - 1) / $daycount);
651
+							$forwardcount = floor((int)($this->recur["numoccur"] - 1) / $daycount);
652 652
 
653 653
 							// $restocc is the number of occurrences left after $forwardcount whole weeks of occurrences, minus one
654 654
 							// for the occurrence on the first day
655
-							$restocc = ((int) $this->recur["numoccur"]) - ($forwardcount * $daycount) - 1;
655
+							$restocc = ((int)$this->recur["numoccur"]) - ($forwardcount * $daycount) - 1;
656 656
 
657 657
 							// $forwardcount is now the number of weeks we can go forward and still be inside the recurrence
658
-							$forwardcount *= (int) $this->recur["everyn"];
658
+							$forwardcount *= (int)$this->recur["everyn"];
659 659
 						}
660 660
 
661 661
 						// The real start is start + dayskip + weekskip-1 (since dayskip will already bring us into the next week)
662
-						$this->recur["start"] = ((int) $this->recur["start"]) + ($dayskip * 24 * 60 * 60) + ($weekskip * (((int) $this->recur["everyn"]) - 1) * 7 * 24 * 60 * 60);
662
+						$this->recur["start"] = ((int)$this->recur["start"]) + ($dayskip * 24 * 60 * 60) + ($weekskip * (((int)$this->recur["everyn"]) - 1) * 7 * 24 * 60 * 60);
663 663
 					}
664 664
 
665 665
 					// Calc first occ
666
-					$firstocc = ($this->unixDataToRecurData($this->recur["start"])) % (((int) $this->recur["everyn"]) * 7 * 24 * 60);
666
+					$firstocc = ($this->unixDataToRecurData($this->recur["start"])) % (((int)$this->recur["everyn"]) * 7 * 24 * 60);
667 667
 
668
-					$firstocc -= (((int) gmdate("w", (int) $this->recur["start"])) - 1) * 24 * 60;
668
+					$firstocc -= (((int)gmdate("w", (int)$this->recur["start"])) - 1) * 24 * 60;
669 669
 
670 670
 					if ($this->recur["regen"]) {
671
-						$rdata .= pack("VVV", $firstocc, (int) $this->recur["everyn"], 1);
671
+						$rdata .= pack("VVV", $firstocc, (int)$this->recur["everyn"], 1);
672 672
 					}
673 673
 					else {
674
-						$rdata .= pack("VVVV", $firstocc, (int) $this->recur["everyn"], 0, (int) $this->recur["weekdays"]);
674
+						$rdata .= pack("VVVV", $firstocc, (int)$this->recur["everyn"], 0, (int)$this->recur["weekdays"]);
675 675
 					}
676 676
 
677 677
 					break;
@@ -688,31 +688,31 @@  discard block
 block discarded – undo
688 688
 					}
689 689
 
690 690
 					if ($term == 0x0C /* monthly */) {
691
-						$everyn = (int) $this->recur["everyn"];
691
+						$everyn = (int)$this->recur["everyn"];
692 692
 					}
693 693
 					else {
694
-						$everyn = $this->recur["regen"] ? ((int) $this->recur["everyn"]) * 12 : 12;
694
+						$everyn = $this->recur["regen"] ? ((int)$this->recur["everyn"]) * 12 : 12;
695 695
 					}
696 696
 
697 697
 					// Get montday/month/year of original start
698
-					$curmonthday = gmdate("j", (int) $this->recur["start"]);
699
-					$curyear = gmdate("Y", (int) $this->recur["start"]);
700
-					$curmonth = gmdate("n", (int) $this->recur["start"]);
698
+					$curmonthday = gmdate("j", (int)$this->recur["start"]);
699
+					$curyear = gmdate("Y", (int)$this->recur["start"]);
700
+					$curmonth = gmdate("n", (int)$this->recur["start"]);
701 701
 
702 702
 					// Check if the recurrence ends after a number of occurrences, in that case we must calculate the
703 703
 					// remaining occurrences based on the start of the recurrence.
704
-					if (((int) $this->recur["term"]) == 0x22) {
704
+					if (((int)$this->recur["term"]) == 0x22) {
705 705
 						// $forwardcount is the number of occurrences we can skip and still be inside the recurrence range (minus
706 706
 						// one to make sure there are always at least one occurrence left)
707
-						$forwardcount = ((((int) $this->recur["numoccur"]) - 1) * $everyn);
707
+						$forwardcount = ((((int)$this->recur["numoccur"]) - 1) * $everyn);
708 708
 					}
709 709
 
710 710
 					// Get month for yearly on D'th day of month M
711 711
 					if ($term == 0x0D /* yearly */) {
712
-						$selmonth = floor(((int) $this->recur["month"]) / (24 * 60 * 29)) + 1; // 1=jan, 2=feb, eg
712
+						$selmonth = floor(((int)$this->recur["month"]) / (24 * 60 * 29)) + 1; // 1=jan, 2=feb, eg
713 713
 					}
714 714
 
715
-					switch ((int) $this->recur["subtype"]) {
715
+					switch ((int)$this->recur["subtype"]) {
716 716
 						// on D day of every M month
717 717
 						case 2:
718 718
 							if (!isset($this->recur["monthday"])) {
@@ -725,11 +725,11 @@  discard block
 block discarded – undo
725 725
 							// Go the beginning of the month
726 726
 							$this->recur["start"] -= ($curmonthday - 1) * 24 * 60 * 60;
727 727
 							// Go the the correct month day
728
-							$this->recur["start"] += (((int) $this->recur["monthday"]) - 1) * 24 * 60 * 60;
728
+							$this->recur["start"] += (((int)$this->recur["monthday"]) - 1) * 24 * 60 * 60;
729 729
 
730 730
 							// If the previous calculation gave us a start date different than the original start date, then we need to skip to the first occurrence
731
-							if (($term == 0x0C /* monthly */ && ((int) $this->recur["monthday"]) < $curmonthday) ||
732
-								($term == 0x0D /* yearly */ && ($selmonth != $curmonth || ($selmonth == $curmonth && ((int) $this->recur["monthday"]) < $curmonthday)))) {
731
+							if (($term == 0x0C /* monthly */ && ((int)$this->recur["monthday"]) < $curmonthday) ||
732
+								($term == 0x0D /* yearly */ && ($selmonth != $curmonth || ($selmonth == $curmonth && ((int)$this->recur["monthday"]) < $curmonthday)))) {
733 733
 								if ($term == 0x0D /* yearly */) {
734 734
 									if ($curmonth > $selmonth) {// go to next occurrence in 'everyn' months minus difference in first occurrence and original date
735 735
 										$count = $everyn - ($curmonth - $selmonth);
@@ -739,7 +739,7 @@  discard block
 block discarded – undo
739 739
 									}
740 740
 									else {
741 741
 										// Go to next occurrence while recurrence start date is greater than occurrence date but within same month
742
-										if (((int) $this->recur["monthday"]) < $curmonthday) {
742
+										if (((int)$this->recur["monthday"]) < $curmonthday) {
743 743
 											$count = $everyn;
744 744
 										}
745 745
 									}
@@ -765,33 +765,33 @@  discard block
 block discarded – undo
765 765
 							// of each month will overshoot in february (29 days). We compensate for that by checking
766 766
 							// if the day of the month we got is wrong, and then back up to the last day of the previous
767 767
 							// month.
768
-							if (((int) $this->recur["monthday"]) >= 28 && ((int) $this->recur["monthday"]) <= 31 &&
769
-								gmdate("j", ((int) $this->recur["start"])) < ((int) $this->recur["monthday"])) {
770
-								$this->recur["start"] -= gmdate("j", ((int) $this->recur["start"])) * 24 * 60 * 60;
768
+							if (((int)$this->recur["monthday"]) >= 28 && ((int)$this->recur["monthday"]) <= 31 &&
769
+								gmdate("j", ((int)$this->recur["start"])) < ((int)$this->recur["monthday"])) {
770
+								$this->recur["start"] -= gmdate("j", ((int)$this->recur["start"])) * 24 * 60 * 60;
771 771
 							}
772 772
 
773 773
 							// "start" is now the first occurrence
774 774
 
775 775
 							if ($term == 0x0C /* monthly */) {
776 776
 								// Calc first occ
777
-								$monthIndex = ((((12 % $everyn) * ((((int) gmdate("Y", $this->recur["start"])) - 1601) % $everyn)) % $everyn) + (((int) gmdate("n", $this->recur["start"])) - 1)) % $everyn;
777
+								$monthIndex = ((((12 % $everyn) * ((((int)gmdate("Y", $this->recur["start"])) - 1601) % $everyn)) % $everyn) + (((int)gmdate("n", $this->recur["start"])) - 1)) % $everyn;
778 778
 
779 779
 								$firstocc = 0;
780 780
 								for ($i = 0; $i < $monthIndex; ++$i) {
781 781
 									$firstocc += $this->getMonthInSeconds(1601 + floor($i / 12), ($i % 12) + 1) / 60;
782 782
 								}
783 783
 
784
-								$rdata .= pack("VVVV", $firstocc, $everyn, $this->recur["regen"], (int) $this->recur["monthday"]);
784
+								$rdata .= pack("VVVV", $firstocc, $everyn, $this->recur["regen"], (int)$this->recur["monthday"]);
785 785
 							}
786 786
 							else {
787 787
 								// Calc first occ
788 788
 								$firstocc = 0;
789
-								$monthIndex = (int) gmdate("n", $this->recur["start"]);
789
+								$monthIndex = (int)gmdate("n", $this->recur["start"]);
790 790
 								for ($i = 1; $i < $monthIndex; ++$i) {
791 791
 									$firstocc += $this->getMonthInSeconds(1601 + floor($i / 12), $i) / 60;
792 792
 								}
793 793
 
794
-								$rdata .= pack("VVVV", $firstocc, $everyn, $this->recur["regen"], (int) $this->recur["monthday"]);
794
+								$rdata .= pack("VVVV", $firstocc, $everyn, $this->recur["regen"], (int)$this->recur["monthday"]);
795 795
 							}
796 796
 
797 797
 							break;
@@ -803,11 +803,11 @@  discard block
 block discarded – undo
803 803
 								return;
804 804
 							}
805 805
 
806
-							$weekdays = (int) $this->recur["weekdays"];
807
-							$nday = (int) $this->recur["nday"];
806
+							$weekdays = (int)$this->recur["weekdays"];
807
+							$nday = (int)$this->recur["nday"];
808 808
 
809 809
 							// Calc startdate
810
-							$monthbegindow = (int) $this->recur["start"];
810
+							$monthbegindow = (int)$this->recur["start"];
811 811
 
812 812
 							if ($nday == 5) {
813 813
 								// Set date on the last day of the last month
@@ -842,12 +842,12 @@  discard block
 block discarded – undo
842 842
 
843 843
 								$dayofweek = gmdate("w", $monthbegindow);
844 844
 								for ($i = 0; $i < 7; ++$i) {
845
-									if ($nday == 5 && (($dayofweek - $i) % 7 >= 0) && (1 << (($dayofweek - $i) % 7)) & $weekdays) {
845
+									if ($nday == 5 && (($dayofweek - $i) % 7 >= 0) && (1 << (($dayofweek - $i) % 7))&$weekdays) {
846 846
 										$day = gmdate("j", $monthbegindow) - $i;
847 847
 
848 848
 										break;
849 849
 									}
850
-									if ($nday != 5 && (1 << (($dayofweek + $i) % 7)) & $weekdays) {
850
+									if ($nday != 5 && (1 << (($dayofweek + $i) % 7))&$weekdays) {
851 851
 										$day = (($nday - 1) * 7) + ($i + 1);
852 852
 
853 853
 										break;
@@ -855,7 +855,7 @@  discard block
 block discarded – undo
855 855
 								}
856 856
 
857 857
 								// Goto the next X month
858
-								if (isset($day) && ($day < gmdate("j", (int) $this->recur["start"]))) {
858
+								if (isset($day) && ($day < gmdate("j", (int)$this->recur["start"]))) {
859 859
 									if ($nday == 5) {
860 860
 										$monthbegindow += 24 * 60 * 60;
861 861
 										if ($curmonth == 12) {
@@ -887,12 +887,12 @@  discard block
 block discarded – undo
887 887
 							// Set start on the right day
888 888
 							$dayofweek = gmdate("w", $monthbegindow);
889 889
 							for ($i = 0; $i < 7; ++$i) {
890
-								if ($nday == 5 && (($dayofweek - $i) % 7) >= 0 && (1 << (($dayofweek - $i) % 7)) & $weekdays) {
890
+								if ($nday == 5 && (($dayofweek - $i) % 7) >= 0 && (1 << (($dayofweek - $i) % 7))&$weekdays) {
891 891
 									$day = $i;
892 892
 
893 893
 									break;
894 894
 								}
895
-								if ($nday != 5 && (1 << (($dayofweek + $i) % 7)) & $weekdays) {
895
+								if ($nday != 5 && (1 << (($dayofweek + $i) % 7))&$weekdays) {
896 896
 									$day = ($nday - 1) * 7 + ($i + 1);
897 897
 
898 898
 									break;
@@ -909,7 +909,7 @@  discard block
 block discarded – undo
909 909
 
910 910
 							if ($term == 0x0C /* monthly */) {
911 911
 								// Calc first occ
912
-								$monthIndex = ((((12 % $everyn) * (((int) gmdate("Y", $this->recur["start"]) - 1601) % $everyn)) % $everyn) + (((int) gmdate("n", $this->recur["start"])) - 1)) % $everyn;
912
+								$monthIndex = ((((12 % $everyn) * (((int)gmdate("Y", $this->recur["start"]) - 1601) % $everyn)) % $everyn) + (((int)gmdate("n", $this->recur["start"])) - 1)) % $everyn;
913 913
 
914 914
 								for ($i = 0; $i < $monthIndex; ++$i) {
915 915
 									$firstocc += $this->getMonthInSeconds(1601 + floor($i / 12), ($i % 12) + 1) / 60;
@@ -919,7 +919,7 @@  discard block
 block discarded – undo
919 919
 							}
920 920
 							else {
921 921
 								// Calc first occ
922
-								$monthIndex = (int) gmdate("n", $this->recur["start"]);
922
+								$monthIndex = (int)gmdate("n", $this->recur["start"]);
923 923
 
924 924
 								for ($i = 1; $i < $monthIndex; ++$i) {
925 925
 									$firstocc += $this->getMonthInSeconds(1601 + floor($i / 12), $i) / 60;
@@ -939,7 +939,7 @@  discard block
 block discarded – undo
939 939
 			}
940 940
 
941 941
 			// Terminate
942
-			$term = (int) $this->recur["term"];
942
+			$term = (int)$this->recur["term"];
943 943
 			$rdata .= pack("CCCC", $term, 0x20, 0x00, 0x00);
944 944
 
945 945
 			switch ($term) {
@@ -954,7 +954,7 @@  discard block
 block discarded – undo
954 954
 						return;
955 955
 					}
956 956
 
957
-					$rdata .= pack("V", (int) $this->recur["numoccur"]);
957
+					$rdata .= pack("V", (int)$this->recur["numoccur"]);
958 958
 
959 959
 					break;
960 960
 				// Never ends
@@ -965,7 +965,7 @@  discard block
 block discarded – undo
965 965
 			}
966 966
 
967 967
 			// Strange little thing for the recurrence type "every workday"
968
-			if (((int) $this->recur["type"]) == 0x0B && ((int) $this->recur["subtype"]) == 1) {
968
+			if (((int)$this->recur["type"]) == 0x0B && ((int)$this->recur["subtype"]) == 1) {
969 969
 				$rdata .= pack("V", 1);
970 970
 			}
971 971
 			else { // Other recurrences
@@ -1009,25 +1009,25 @@  discard block
 block discarded – undo
1009 1009
 			}
1010 1010
 
1011 1011
 			// Set start date
1012
-			$rdata .= pack("V", $this->unixDataToRecurData((int) $this->recur["start"]));
1012
+			$rdata .= pack("V", $this->unixDataToRecurData((int)$this->recur["start"]));
1013 1013
 
1014 1014
 			// Set enddate
1015 1015
 			switch ($term) {
1016 1016
 				// After the given enddate
1017 1017
 				case 0x21:
1018
-					$rdata .= pack("V", $this->unixDataToRecurData((int) $this->recur["end"]));
1018
+					$rdata .= pack("V", $this->unixDataToRecurData((int)$this->recur["end"]));
1019 1019
 
1020 1020
 					break;
1021 1021
 				// After a number of times
1022 1022
 				case 0x22:
1023 1023
 					// @todo: calculate enddate with intval($this->recur["startocc"]) + intval($this->recur["duration"]) > 24 hour
1024
-					$occenddate = (int) $this->recur["start"];
1024
+					$occenddate = (int)$this->recur["start"];
1025 1025
 
1026
-					switch ((int) $this->recur["type"]) {
1026
+					switch ((int)$this->recur["type"]) {
1027 1027
 						case 0x0A: // daily
1028 1028
 							if ($this->recur["subtype"] == 1) {
1029 1029
 								// Daily every workday
1030
-								$restocc = (int) $this->recur["numoccur"];
1030
+								$restocc = (int)$this->recur["numoccur"];
1031 1031
 
1032 1032
 								// Get starting weekday
1033 1033
 								$nowtime = $this->gmtime($occenddate);
@@ -1049,7 +1049,7 @@  discard block
 block discarded – undo
1049 1049
 							}
1050 1050
 							else {
1051 1051
 								// -1 because the first day already counts (from 1-1-1980 to 1-1-1980 is 1 occurrence)
1052
-								$occenddate += (((int) $this->recur["everyn"]) * 60 * (((int) $this->recur["numoccur"] - 1)));
1052
+								$occenddate += (((int)$this->recur["everyn"]) * 60 * (((int)$this->recur["numoccur"] - 1)));
1053 1053
 							}
1054 1054
 
1055 1055
 							break;
@@ -1068,11 +1068,11 @@  discard block
 block discarded – undo
1068 1068
 							for ($j = 1; $restocc > 0; ++$j) {
1069 1069
 								// Jump to the next week (which may be N weeks away) when going over the week boundary
1070 1070
 								if ((($dayofweek + $j) % 7) == $weekstart) {
1071
-									$occenddate += (((int) $this->recur["everyn"]) - 1) * 7 * 24 * 60 * 60;
1071
+									$occenddate += (((int)$this->recur["everyn"]) - 1) * 7 * 24 * 60 * 60;
1072 1072
 								}
1073 1073
 
1074 1074
 								// If this is a matching day, once less occurrence to process
1075
-								if (((int) $this->recur["weekdays"]) & (1 << (($dayofweek + $j) % 7))) {
1075
+								if (((int)$this->recur["weekdays"]) & (1 << (($dayofweek + $j) % 7))) {
1076 1076
 									--$restocc;
1077 1077
 								}
1078 1078
 
@@ -1084,11 +1084,11 @@  discard block
 block discarded – undo
1084 1084
 
1085 1085
 						case 0x0C: // monthly
1086 1086
 						case 0x0D: // yearly
1087
-							$curyear = gmdate("Y", (int) $this->recur["start"]);
1088
-							$curmonth = gmdate("n", (int) $this->recur["start"]);
1087
+							$curyear = gmdate("Y", (int)$this->recur["start"]);
1088
+							$curmonth = gmdate("n", (int)$this->recur["start"]);
1089 1089
 							// $forwardcount = months
1090 1090
 
1091
-							switch ((int) $this->recur["subtype"]) {
1091
+							switch ((int)$this->recur["subtype"]) {
1092 1092
 								case 2: // on D day of every M month
1093 1093
 									while ($forwardcount > 0) {
1094 1094
 										$occenddate += $this->getMonthInSeconds($curyear, $curmonth);
@@ -1104,8 +1104,8 @@  discard block
 block discarded – undo
1104 1104
 									}
1105 1105
 
1106 1106
 									// compensation between 28 and 31
1107
-									if (((int) $this->recur["monthday"]) >= 28 && ((int) $this->recur["monthday"]) <= 31 &&
1108
-										gmdate("j", $occenddate) < ((int) $this->recur["monthday"])) {
1107
+									if (((int)$this->recur["monthday"]) >= 28 && ((int)$this->recur["monthday"]) <= 31 &&
1108
+										gmdate("j", $occenddate) < ((int)$this->recur["monthday"])) {
1109 1109
 										if (gmdate("j", $occenddate) < 28) {
1110 1110
 											$occenddate -= gmdate("j", $occenddate) * 24 * 60 * 60;
1111 1111
 										}
@@ -1117,8 +1117,8 @@  discard block
 block discarded – undo
1117 1117
 									break;
1118 1118
 
1119 1119
 								case 3: // on Nth weekday of every M month
1120
-									$nday = (int) $this->recur["nday"]; // 1 tot 5
1121
-									$weekdays = (int) $this->recur["weekdays"];
1120
+									$nday = (int)$this->recur["nday"]; // 1 tot 5
1121
+									$weekdays = (int)$this->recur["weekdays"];
1122 1122
 
1123 1123
 									while ($forwardcount > 0) {
1124 1124
 										$occenddate += $this->getMonthInSeconds($curyear, $curmonth);
@@ -1144,12 +1144,12 @@  discard block
 block discarded – undo
1144 1144
 
1145 1145
 									$dayofweek = gmdate("w", $occenddate);
1146 1146
 									for ($i = 0; $i < 7; ++$i) {
1147
-										if ($nday == 5 && (($dayofweek - $i) % 7) >= 0 && (1 << (($dayofweek - $i) % 7)) & $weekdays) {
1147
+										if ($nday == 5 && (($dayofweek - $i) % 7) >= 0 && (1 << (($dayofweek - $i) % 7))&$weekdays) {
1148 1148
 											$occenddate -= $i * 24 * 60 * 60;
1149 1149
 
1150 1150
 											break;
1151 1151
 										}
1152
-										if ($nday != 5 && (1 << (($dayofweek + $i) % 7)) & $weekdays) {
1152
+										if ($nday != 5 && (1 << (($dayofweek + $i) % 7))&$weekdays) {
1153 1153
 											$occenddate += ($i + (($nday - 1) * 7)) * 24 * 60 * 60;
1154 1154
 
1155 1155
 											break;
@@ -1168,7 +1168,7 @@  discard block
 block discarded – undo
1168 1168
 
1169 1169
 					$this->recur["end"] = $occenddate;
1170 1170
 
1171
-					$rdata .= pack("V", $this->unixDataToRecurData((int) $this->recur["end"]));
1171
+					$rdata .= pack("V", $this->unixDataToRecurData((int)$this->recur["end"]));
1172 1172
 
1173 1173
 					break;
1174 1174
 				// Never ends
@@ -1181,12 +1181,12 @@  discard block
 block discarded – undo
1181 1181
 			}
1182 1182
 
1183 1183
 			// UTC date
1184
-			$utcstart = $this->toGMT($this->tz, (int) $this->recur["start"]);
1185
-			$utcend = $this->toGMT($this->tz, (int) $this->recur["end"]);
1184
+			$utcstart = $this->toGMT($this->tz, (int)$this->recur["start"]);
1185
+			$utcend = $this->toGMT($this->tz, (int)$this->recur["end"]);
1186 1186
 
1187 1187
 			// utc date+time
1188
-			$utcfirstoccstartdatetime = (isset($this->recur["startocc"])) ? $utcstart + (((int) $this->recur["startocc"]) * 60) : $utcstart;
1189
-			$utcfirstoccenddatetime = (isset($this->recur["endocc"])) ? $utcstart + (((int) $this->recur["endocc"]) * 60) : $utcstart;
1188
+			$utcfirstoccstartdatetime = (isset($this->recur["startocc"])) ? $utcstart + (((int)$this->recur["startocc"]) * 60) : $utcstart;
1189
+			$utcfirstoccenddatetime = (isset($this->recur["endocc"])) ? $utcstart + (((int)$this->recur["endocc"]) * 60) : $utcstart;
1190 1190
 
1191 1191
 			$propsToSet = [];
1192 1192
 			// update reminder time
@@ -1204,7 +1204,7 @@  discard block
 block discarded – undo
1204 1204
 
1205 1205
 				// recurrencetype
1206 1206
 				// Strange enough is the property recurrencetype, (type-0x9) and not the CDO recurrencetype
1207
-				$propsToSet[$this->proptags["recurrencetype"]] = ((int) $this->recur["type"]) - 0x9;
1207
+				$propsToSet[$this->proptags["recurrencetype"]] = ((int)$this->recur["type"]) - 0x9;
1208 1208
 
1209 1209
 				// set named prop 'side_effects' to 369, needed for Outlook to ask for single or total recurrence when deleting
1210 1210
 				$propsToSet[$this->proptags["side_effects"]] = 369;
@@ -1253,7 +1253,7 @@  discard block
 block discarded – undo
1253 1253
 
1254 1254
 			if (isset($this->recur["startocc"], $this->recur["endocc"])) {
1255 1255
 				// Set start and endtime in minutes
1256
-				$rdata .= pack("VV", (int) $this->recur["startocc"], (int) $this->recur["endocc"]);
1256
+				$rdata .= pack("VV", (int)$this->recur["startocc"], (int)$this->recur["endocc"]);
1257 1257
 			}
1258 1258
 
1259 1259
 			// Detailed exception data
@@ -1918,7 +1918,7 @@  discard block
 block discarded – undo
1918 1918
 						}
1919 1919
 						elseif ($this->recur['regen']) {
1920 1920
 							$year_starttime = $this->gmtime($now);
1921
-							$is_next_leapyear = $this->isLeapYear($year_starttime['tm_year'] + 1900 + 1);    // +1 next year
1921
+							$is_next_leapyear = $this->isLeapYear($year_starttime['tm_year'] + 1900 + 1); // +1 next year
1922 1922
 							$now = $daystart + ($is_next_leapyear ? 31622400 /* Leap year in seconds */ : 31536000 /* year in seconds */);
1923 1923
 
1924 1924
 							if ($now <= $dayend) {
Please login to merge, or discard this patch.
mapi/mapi.util.php 2 patches
Braces   +5 added lines, -10 removed lines patch added patch discarded remove patch
@@ -56,8 +56,7 @@  discard block
 block discarded – undo
56 56
 				}
57 57
 			}
58 58
 		}
59
-	}
60
-	else {
59
+	} else {
61 60
 		return "NOERROR";
62 61
 	}
63 62
 
@@ -98,8 +97,7 @@  discard block
 block discarded – undo
98 97
 
99 98
 			if (substr($split[2], 0, 2) == "0x") {
100 99
 				$id = hexdec(substr($split[2], 2));
101
-			}
102
-			else {
100
+			} else {
103 101
 				$id = $split[2];
104 102
 			}
105 103
 
@@ -109,8 +107,7 @@  discard block
 block discarded – undo
109 107
 					$guids[$split[1]] = makeguid($split[1]);
110 108
 				}
111 109
 				$guid = $guids[$split[1]];
112
-			}
113
-			else {
110
+			} else {
114 111
 				$guid = constant($split[1]);
115 112
 			}
116 113
 
@@ -120,8 +117,7 @@  discard block
 block discarded – undo
120 117
 			$ids["guid"][$num] = $guid;
121 118
 			$ids["type"][$num] = $split[0];
122 119
 			++$num;
123
-		}
124
-		else {
120
+		} else {
125 121
 			// not a named property
126 122
 			$props[$name] = $val;
127 123
 		}
@@ -280,8 +276,7 @@  discard block
 block discarded – undo
280 276
 				$item = $occurrence + $row;
281 277
 				array_push($items, $item);
282 278
 			}
283
-		}
284
-		else {
279
+		} else {
285 280
 			// Normal item, it matched the search criteria and therefore overlaps the interval <$viewstart, $viewend>
286 281
 			array_push($items, $row);
287 282
 		}
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
 			 * we have to manually typecast value to integer, so float will be converted in integer,
49 49
 			 * but still its out of bound for integer limit so it will be auto adjusted to minus value
50 50
 			 */
51
-			if ($errcode == (int) $value) {
51
+			if ($errcode == (int)$value) {
52 52
 				// Check that we have an actual MAPI error or warning definition
53 53
 				$prefix = substr($key, 0, 7);
54 54
 				if ($prefix == "MAPI_E_" || $prefix == "MAPI_W_") {
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
  * @param mixed $value
168 168
  */
169 169
 function DTE_IS_REMOTE_VALID($value) {
170
-	return (bool) ($value & DTE_FLAG_REMOTE_VALID);
170
+	return (bool)($value & DTE_FLAG_REMOTE_VALID);
171 171
 }
172 172
 
173 173
 /**
@@ -176,7 +176,7 @@  discard block
 block discarded – undo
176 176
  * @param mixed $value
177 177
  */
178 178
 function DTE_IS_ACL_CAPABLE($value) {
179
-	return (bool) ($value & DTE_FLAG_ACL_CAPABLE);
179
+	return (bool)($value & DTE_FLAG_ACL_CAPABLE);
180 180
 }
181 181
 
182 182
 function DTE_REMOTE($value) {
@@ -226,7 +226,7 @@  discard block
 block discarded – undo
226 226
 			RES_OR,
227 227
 			[
228 228
 				[
229
-					RES_AND,    // Normal items: itemEnd must be after viewStart, itemStart must be before viewEnd
229
+					RES_AND, // Normal items: itemEnd must be after viewStart, itemStart must be before viewEnd
230 230
 					[
231 231
 						[
232 232
 							RES_PROPERTY,
@@ -256,7 +256,7 @@  discard block
 block discarded – undo
256 256
 					],
257 257
 				],
258 258
 			], // EXISTS OR
259
-		];        // global OR
259
+		]; // global OR
260 260
 
261 261
 	// Get requested properties, plus whatever we need
262 262
 	$proplist = [PR_ENTRYID, $properties["recurring"], $properties["recurring_data"], $properties["timezone_data"]];
Please login to merge, or discard this patch.
mapi/mapidefs.php 1 patch
Spacing   +96 added lines, -96 removed lines patch added patch discarded remove patch
@@ -16,40 +16,40 @@  discard block
 block discarded – undo
16 16
 
17 17
 /* Object type */
18 18
 
19
-define('MAPI_STORE', 0x00000001);    /* Message Store */
20
-define('MAPI_ADDRBOOK', 0x00000002);    /* Address Book */
21
-define('MAPI_FOLDER', 0x00000003);    /* Folder */
22
-define('MAPI_ABCONT', 0x00000004);    /* Address Book Container */
23
-define('MAPI_MESSAGE', 0x00000005);    /* Message */
24
-define('MAPI_MAILUSER', 0x00000006);    /* Individual Recipient */
25
-define('MAPI_ATTACH', 0x00000007);    /* Attachment */
26
-define('MAPI_DISTLIST', 0x00000008);    /* Distribution List Recipient */
27
-define('MAPI_PROFSECT', 0x00000009);    /* Profile Section */
28
-define('MAPI_STATUS', 0x0000000A);    /* Status Object */
29
-define('MAPI_SESSION', 0x0000000B);    /* Session */
30
-define('MAPI_FORMINFO', 0x0000000C);    /* Form Information */
19
+define('MAPI_STORE', 0x00000001); /* Message Store */
20
+define('MAPI_ADDRBOOK', 0x00000002); /* Address Book */
21
+define('MAPI_FOLDER', 0x00000003); /* Folder */
22
+define('MAPI_ABCONT', 0x00000004); /* Address Book Container */
23
+define('MAPI_MESSAGE', 0x00000005); /* Message */
24
+define('MAPI_MAILUSER', 0x00000006); /* Individual Recipient */
25
+define('MAPI_ATTACH', 0x00000007); /* Attachment */
26
+define('MAPI_DISTLIST', 0x00000008); /* Distribution List Recipient */
27
+define('MAPI_PROFSECT', 0x00000009); /* Profile Section */
28
+define('MAPI_STATUS', 0x0000000A); /* Status Object */
29
+define('MAPI_SESSION', 0x0000000B); /* Session */
30
+define('MAPI_FORMINFO', 0x0000000C); /* Form Information */
31 31
 
32 32
 define('MV_FLAG', 0x1000);
33 33
 define('MV_INSTANCE', 0x2000);
34
-define('MVI_FLAG', MV_FLAG | MV_INSTANCE);
35
-
36
-define('PT_UNSPECIFIED', 0);    /* (Reserved for interface use) type doesn't matter to caller */
37
-define('PT_NULL', 1);    /* NULL property value */
38
-define('PT_I2', 2);    /* Signed 16-bit value */
39
-define('PT_LONG', 3);    /* Signed 32-bit value */
40
-define('PT_R4', 4);    /* 4-byte floating point */
41
-define('PT_DOUBLE', 5);    /* Floating point double */
42
-define('PT_CURRENCY', 6);    /* Signed 64-bit int (decimal w/    4 digits right of decimal pt) */
43
-define('PT_APPTIME', 7);    /* Application time */
44
-define('PT_ERROR', 10);    /* 32-bit error value */
45
-define('PT_BOOLEAN', 11);    /* 16-bit boolean (non-zero true) */
46
-define('PT_OBJECT', 13);    /* Embedded object in a property */
47
-define('PT_I8', 20);    /* 8-byte signed integer */
48
-define('PT_STRING8', 30);    /* Null terminated 8-bit character string */
49
-define('PT_UNICODE', 31);    /* Null terminated Unicode string */
50
-define('PT_SYSTIME', 64);    /* FILETIME 64-bit int w/ number of 100ns periods since Jan 1,1601 */
51
-define('PT_CLSID', 72);    /* OLE GUID */
52
-define('PT_BINARY', 258);   /* Uninterpreted (counted byte array) */
34
+define('MVI_FLAG', MV_FLAG|MV_INSTANCE);
35
+
36
+define('PT_UNSPECIFIED', 0); /* (Reserved for interface use) type doesn't matter to caller */
37
+define('PT_NULL', 1); /* NULL property value */
38
+define('PT_I2', 2); /* Signed 16-bit value */
39
+define('PT_LONG', 3); /* Signed 32-bit value */
40
+define('PT_R4', 4); /* 4-byte floating point */
41
+define('PT_DOUBLE', 5); /* Floating point double */
42
+define('PT_CURRENCY', 6); /* Signed 64-bit int (decimal w/    4 digits right of decimal pt) */
43
+define('PT_APPTIME', 7); /* Application time */
44
+define('PT_ERROR', 10); /* 32-bit error value */
45
+define('PT_BOOLEAN', 11); /* 16-bit boolean (non-zero true) */
46
+define('PT_OBJECT', 13); /* Embedded object in a property */
47
+define('PT_I8', 20); /* 8-byte signed integer */
48
+define('PT_STRING8', 30); /* Null terminated 8-bit character string */
49
+define('PT_UNICODE', 31); /* Null terminated Unicode string */
50
+define('PT_SYSTIME', 64); /* FILETIME 64-bit int w/ number of 100ns periods since Jan 1,1601 */
51
+define('PT_CLSID', 72); /* OLE GUID */
52
+define('PT_BINARY', 258); /* Uninterpreted (counted byte array) */
53 53
 /* Changes are likely to these numbers, and to their structures. */
54 54
 
55 55
 /* Alternate property type names for ease of use */
@@ -61,18 +61,18 @@  discard block
 block discarded – undo
61 61
 
62 62
 define('PT_TSTRING', PT_STRING8);
63 63
 
64
-define('PT_MV_I2', (MV_FLAG | PT_I2));
65
-define('PT_MV_LONG', (MV_FLAG | PT_LONG));
66
-define('PT_MV_R4', (MV_FLAG | PT_R4));
67
-define('PT_MV_DOUBLE', (MV_FLAG | PT_DOUBLE));
68
-define('PT_MV_CURRENCY', (MV_FLAG | PT_CURRENCY));
69
-define('PT_MV_APPTIME', (MV_FLAG | PT_APPTIME));
70
-define('PT_MV_SYSTIME', (MV_FLAG | PT_SYSTIME));
71
-define('PT_MV_STRING8', (MV_FLAG | PT_STRING8));
72
-define('PT_MV_BINARY', (MV_FLAG | PT_BINARY));
73
-define('PT_MV_UNICODE', (MV_FLAG | PT_UNICODE));
74
-define('PT_MV_CLSID', (MV_FLAG | PT_CLSID));
75
-define('PT_MV_I8', (MV_FLAG | PT_I8));
64
+define('PT_MV_I2', (MV_FLAG|PT_I2));
65
+define('PT_MV_LONG', (MV_FLAG|PT_LONG));
66
+define('PT_MV_R4', (MV_FLAG|PT_R4));
67
+define('PT_MV_DOUBLE', (MV_FLAG|PT_DOUBLE));
68
+define('PT_MV_CURRENCY', (MV_FLAG|PT_CURRENCY));
69
+define('PT_MV_APPTIME', (MV_FLAG|PT_APPTIME));
70
+define('PT_MV_SYSTIME', (MV_FLAG|PT_SYSTIME));
71
+define('PT_MV_STRING8', (MV_FLAG|PT_STRING8));
72
+define('PT_MV_BINARY', (MV_FLAG|PT_BINARY));
73
+define('PT_MV_UNICODE', (MV_FLAG|PT_UNICODE));
74
+define('PT_MV_CLSID', (MV_FLAG|PT_CLSID));
75
+define('PT_MV_I8', (MV_FLAG|PT_I8));
76 76
 
77 77
 define('PT_MV_TSTRING', PT_MV_STRING8);
78 78
 /* bit 0: set if descending, clear if ascending */
@@ -190,14 +190,14 @@  discard block
 block discarded – undo
190 190
 
191 191
 /* Values for PR_RESOURCE_TYPE, _METHODS, _FLAGS */
192 192
 
193
-define('MAPI_STORE_PROVIDER', 33);    /* Message Store */
194
-define('MAPI_AB', 34);    /* Address Book */
195
-define('MAPI_AB_PROVIDER', 35);    /* Address Book Provider */
196
-define('MAPI_TRANSPORT_PROVIDER', 36);    /* Transport Provider */
197
-define('MAPI_SPOOLER', 37);    /* Message Spooler */
198
-define('MAPI_PROFILE_PROVIDER', 38);    /* Profile Provider */
199
-define('MAPI_SUBSYSTEM', 39);    /* Overall Subsystem Status */
200
-define('MAPI_HOOK_PROVIDER', 40);    /* Spooler Hook */
193
+define('MAPI_STORE_PROVIDER', 33); /* Message Store */
194
+define('MAPI_AB', 34); /* Address Book */
195
+define('MAPI_AB_PROVIDER', 35); /* Address Book Provider */
196
+define('MAPI_TRANSPORT_PROVIDER', 36); /* Transport Provider */
197
+define('MAPI_SPOOLER', 37); /* Message Spooler */
198
+define('MAPI_PROFILE_PROVIDER', 38); /* Profile Provider */
199
+define('MAPI_SUBSYSTEM', 39); /* Overall Subsystem Status */
200
+define('MAPI_HOOK_PROVIDER', 40); /* Spooler Hook */
201 201
 define('STATUS_VALIDATE_STATE', 0x00000001);
202 202
 define('STATUS_SETTINGS_DIALOG', 0x00000002);
203 203
 define('STATUS_CHANGE_PASSWORD', 0x00000004);
@@ -243,10 +243,10 @@  discard block
 block discarded – undo
243 243
 define('MODRECIP_MODIFY', 0x00000004);
244 244
 define('MODRECIP_REMOVE', 0x00000008);
245 245
 
246
-define('MAPI_ORIG', 0);          /* Recipient is message originator */
247
-define('MAPI_TO', 1);          /* Recipient is a primary recipient */
248
-define('MAPI_CC', 2);          /* Recipient is a copy recipient */
249
-define('MAPI_BCC', 3);          /* Recipient is blind copy recipient */
246
+define('MAPI_ORIG', 0); /* Recipient is message originator */
247
+define('MAPI_TO', 1); /* Recipient is a primary recipient */
248
+define('MAPI_CC', 2); /* Recipient is a copy recipient */
249
+define('MAPI_BCC', 3); /* Recipient is blind copy recipient */
250 250
 
251 251
 /* IAttach Interface ------------------------------------------------------- */
252 252
 
@@ -438,23 +438,23 @@  discard block
 block discarded – undo
438 438
 define('BMR_NEZ', 0x00000001);
439 439
 
440 440
 /* array index values of restrictions -- same values are used in php-ext/main.cpp::PHPArraytoSRestriction() */
441
-define('VALUE', 0);        // propval
442
-define('RELOP', 1);        // compare method
443
-define('FUZZYLEVEL', 2);        // string search flags
444
-define('CB', 3);        // size restriction
445
-define('ULTYPE', 4);        // bit mask restriction type BMR_xxx
446
-define('ULMASK', 5);        // bitmask
447
-define('ULPROPTAG', 6);        // property
448
-define('ULPROPTAG1', 7);        // RES_COMPAREPROPS 1st property
449
-define('ULPROPTAG2', 8);        // RES_COMPAREPROPS 2nd property
450
-define('PROPS', 9);        // RES_COMMENT properties
451
-define('RESTRICTION', 10);       // RES_COMMENT and RES_SUBRESTRICTION restriction
441
+define('VALUE', 0); // propval
442
+define('RELOP', 1); // compare method
443
+define('FUZZYLEVEL', 2); // string search flags
444
+define('CB', 3); // size restriction
445
+define('ULTYPE', 4); // bit mask restriction type BMR_xxx
446
+define('ULMASK', 5); // bitmask
447
+define('ULPROPTAG', 6); // property
448
+define('ULPROPTAG1', 7); // RES_COMPAREPROPS 1st property
449
+define('ULPROPTAG2', 8); // RES_COMPAREPROPS 2nd property
450
+define('PROPS', 9); // RES_COMMENT properties
451
+define('RESTRICTION', 10); // RES_COMMENT and RES_SUBRESTRICTION restriction
452 452
 
453 453
 /* GUID's for PR_MDB_PROVIDER */
454
-define("ZARAFA_SERVICE_GUID", makeGuid("{3C253DCA-D227-443C-94FE-425FAB958C19}"));    // default store
455
-define("ZARAFA_STORE_PUBLIC_GUID", makeGuid("{70FAB278-F7AF-CD11-9BC8-00AA002FC45A}"));    // public store
456
-define("ZARAFA_STORE_DELEGATE_GUID", makeGuid("{7C7C1085-BC6D-4E53-9DAB-8A53F8DEF808}"));    // other store
457
-define('ZARAFA_STORE_ARCHIVER_GUID', makeGuid("{BC8953AD-2E3F-4172-9404-896FF459870F}"));    // archive store
454
+define("ZARAFA_SERVICE_GUID", makeGuid("{3C253DCA-D227-443C-94FE-425FAB958C19}")); // default store
455
+define("ZARAFA_STORE_PUBLIC_GUID", makeGuid("{70FAB278-F7AF-CD11-9BC8-00AA002FC45A}")); // public store
456
+define("ZARAFA_STORE_DELEGATE_GUID", makeGuid("{7C7C1085-BC6D-4E53-9DAB-8A53F8DEF808}")); // other store
457
+define('ZARAFA_STORE_ARCHIVER_GUID', makeGuid("{BC8953AD-2E3F-4172-9404-896FF459870F}")); // archive store
458 458
 
459 459
 /* global profile section guid */
460 460
 define('pbGlobalProfileSectionGuid', makeGuid("{C8B0DB13-05AA-1A10-9BB0-00AA002FC45A}"));
@@ -481,10 +481,10 @@  discard block
 block discarded – undo
481 481
 // define('ecrightsContact'                       ,0x00000200);
482 482
 define('ecRightsFolderVisible', 0x00000400);
483 483
 
484
-define('ecRightsAll', ecRightsReadAny | ecRightsCreate | ecRightsEditOwned | ecRightsDeleteOwned | ecRightsEditAny | ecRightsDeleteAny | ecRightsCreateSubfolder | ecRightsFolderAccess | ecRightsFolderVisible);
485
-define('ecRightsFullControl', ecRightsReadAny | ecRightsCreate | ecRightsEditOwned | ecRightsDeleteOwned | ecRightsEditAny | ecRightsDeleteAny | ecRightsCreateSubfolder | ecRightsFolderVisible);
486
-define('ecRightsDefault', ecRightsNone | ecRightsFolderVisible);
487
-define('ecRightsDefaultPublic', ecRightsReadAny | ecRightsFolderVisible);
484
+define('ecRightsAll', ecRightsReadAny|ecRightsCreate|ecRightsEditOwned|ecRightsDeleteOwned|ecRightsEditAny|ecRightsDeleteAny|ecRightsCreateSubfolder|ecRightsFolderAccess|ecRightsFolderVisible);
485
+define('ecRightsFullControl', ecRightsReadAny|ecRightsCreate|ecRightsEditOwned|ecRightsDeleteOwned|ecRightsEditAny|ecRightsDeleteAny|ecRightsCreateSubfolder|ecRightsFolderVisible);
486
+define('ecRightsDefault', ecRightsNone|ecRightsFolderVisible);
487
+define('ecRightsDefaultPublic', ecRightsReadAny|ecRightsFolderVisible);
488 488
 define('ecRightsAdmin', 0x00001000);
489 489
 define('ecRightsAllMask', 0x000015FB);
490 490
 
@@ -500,7 +500,7 @@  discard block
 block discarded – undo
500 500
 define('ROW_ADD', 0x0001);
501 501
 define('ROW_MODIFY', 0x0002);
502 502
 define('ROW_REMOVE', 0x0004);
503
-define('ROW_EMPTY', (ROW_ADD | ROW_REMOVE));
503
+define('ROW_EMPTY', (ROW_ADD|ROW_REMOVE));
504 504
 
505 505
 // new property types
506 506
 define('PT_SRESTRICTION', 0x00FD);
@@ -570,38 +570,38 @@  discard block
 block discarded – undo
570 570
 define('SYNC_NO_FOREIGN_KEYS', 0x100);
571 571
 define('SYNC_LIMITED_IMESSAGE', 0x200);
572 572
 define('SYNC_CATCHUP', 0x400);
573
-define('SYNC_NEW_MESSAGE', 0x800);         // only applicable to ImportMessageChange()
574
-define('SYNC_MSG_SELECTIVE', 0x1000);        // Used internally.      Will reject if used by clients.
573
+define('SYNC_NEW_MESSAGE', 0x800); // only applicable to ImportMessageChange()
574
+define('SYNC_MSG_SELECTIVE', 0x1000); // Used internally.      Will reject if used by clients.
575 575
 define('SYNC_BEST_BODY', 0x2000);
576 576
 define('SYNC_IGNORE_SPECIFIED_ON_ASSOCIATED', 0x4000);
577
-define('SYNC_PROGRESS_MODE', 0x8000);        // AirMapi progress mode
577
+define('SYNC_PROGRESS_MODE', 0x8000); // AirMapi progress mode
578 578
 define('SYNC_FXRECOVERMODE', 0x10000);
579 579
 define('SYNC_DEFER_CONFIG', 0x20000);
580
-define('SYNC_FORCE_UNICODE', 0x40000);       // Forces server to return Unicode properties
581
-define('SYNC_STATE_READONLY', 0x80000);       // Server will not update the states in the DB, setting up exporter with this flag states are read only
580
+define('SYNC_FORCE_UNICODE', 0x40000); // Forces server to return Unicode properties
581
+define('SYNC_STATE_READONLY', 0x80000); // Server will not update the states in the DB, setting up exporter with this flag states are read only
582 582
 
583
-define('EMS_AB_ADDRESS_LOOKUP', 0x00000001);    // Flag for resolvename to resolve only exact matches
583
+define('EMS_AB_ADDRESS_LOOKUP', 0x00000001); // Flag for resolvename to resolve only exact matches
584 584
 
585
-define('TBL_BATCH', 0x00000002);    // Batch multiple table commands
585
+define('TBL_BATCH', 0x00000002); // Batch multiple table commands
586 586
 
587 587
 /* Flags for recipients in exceptions */
588
-define('recipSendable', 0x00000001);    // sendable attendee.
589
-define('recipOrganizer', 0x00000002);    // meeting organizer
590
-define('recipExceptionalResponse', 0x00000010);    // attendee gave a response for the exception
591
-define('recipExceptionalDeleted', 0x00000020);    // recipientRow exists, but it is treated as if the corresponding recipient is deleted from meeting
592
-define('recipOriginal', 0x00000100);    // recipient is an original Attendee
588
+define('recipSendable', 0x00000001); // sendable attendee.
589
+define('recipOrganizer', 0x00000002); // meeting organizer
590
+define('recipExceptionalResponse', 0x00000010); // attendee gave a response for the exception
591
+define('recipExceptionalDeleted', 0x00000020); // recipientRow exists, but it is treated as if the corresponding recipient is deleted from meeting
592
+define('recipOriginal', 0x00000100); // recipient is an original Attendee
593 593
 define('recipReserved', 0x00000200);
594 594
 
595 595
 /* Flags which indicates type of Meeting Object */
596
-define('mtgEmpty', 0x00000000);    // Unspecified.
597
-define('mtgRequest', 0x00000001);    // Initial meeting request.
598
-define('mtgFull', 0x00010000);    // Full update.
599
-define('mtgInfo', 0x00020000);    // Informational update.
600
-define('mtgOutOfDate', 0x00080000);    // A newer Meeting Request object or Meeting Update object was received after this one.
601
-define('mtgDelegatorCopy', 0x00100000);    // This is set on the delegator's copy when a delegate will handle meeting-related objects.
602
-
603
-define('MAPI_ONE_OFF_UNICODE', 0x8000);        // the flag that defines whether the embedded strings are Unicode in one off entryids.
604
-define('MAPI_ONE_OFF_NO_RICH_INFO', 0x0001);        // the flag that specifies whether the recipient gets TNEF or not.
596
+define('mtgEmpty', 0x00000000); // Unspecified.
597
+define('mtgRequest', 0x00000001); // Initial meeting request.
598
+define('mtgFull', 0x00010000); // Full update.
599
+define('mtgInfo', 0x00020000); // Informational update.
600
+define('mtgOutOfDate', 0x00080000); // A newer Meeting Request object or Meeting Update object was received after this one.
601
+define('mtgDelegatorCopy', 0x00100000); // This is set on the delegator's copy when a delegate will handle meeting-related objects.
602
+
603
+define('MAPI_ONE_OFF_UNICODE', 0x8000); // the flag that defines whether the embedded strings are Unicode in one off entryids.
604
+define('MAPI_ONE_OFF_NO_RICH_INFO', 0x0001); // the flag that specifies whether the recipient gets TNEF or not.
605 605
 
606 606
 /* Mask flags for mapi_msgstore_advise */
607 607
 define('fnevCriticalError', 0x00000001);
Please login to merge, or discard this patch.