@@ -11,8 +11,7 @@ |
||
| 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 | } |
@@ -326,8 +326,7 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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); |
@@ -172,8 +172,7 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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; |
@@ -51,8 +51,7 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 | } |
@@ -240,8 +240,7 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 | } |
@@ -53,8 +53,7 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 */); |
@@ -56,8 +56,7 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 | } |
@@ -271,8 +271,7 @@ discard block |
||
| 271 | 271 | // Copy sender information from the e-mail |
| 272 | 272 | $props = mapi_getprops($this->message, $senderProps); |
| 273 | 273 | mapi_setprops($task, $props); |
| 274 | - } |
|
| 275 | - else { |
|
| 274 | + } else { |
|
| 276 | 275 | // If there are multiple, just use the first |
| 277 | 276 | $entryid = $rows[0][PR_ENTRYID]; |
| 278 | 277 | |
@@ -575,8 +574,7 @@ discard block |
||
| 575 | 574 | |
| 576 | 575 | if (isset($messageprops)) { |
| 577 | 576 | ++$messageprops[$this->props['updatecount']]; |
| 578 | - } |
|
| 579 | - else { |
|
| 577 | + } else { |
|
| 580 | 578 | $messageprops[$this->props['updatecount']] = 1; |
| 581 | 579 | } |
| 582 | 580 | |
@@ -754,8 +752,7 @@ discard block |
||
| 754 | 752 | $props = mapi_getprops($this->message, [$this->props['taskupdates'], $this->props['tasksoc'], $this->props['recurring'], $this->props['complete']]); |
| 755 | 753 | if (!$props[$this->props['complete']] && $props[$this->props['taskupdates']] && !(isset($props[$this->props['recurring']]) && $props[$this->props['recurring']])) { |
| 756 | 754 | $this->sendResponse(tdmtTaskUpd, _("Task Updated:") . " "); |
| 757 | - } |
|
| 758 | - elseif ($props[$this->props['complete']]) { |
|
| 755 | + } elseif ($props[$this->props['complete']]) { |
|
| 759 | 756 | $this->sendResponse(tdmtTaskUpd, _("Task Completed:") . " "); |
| 760 | 757 | } |
| 761 | 758 | |
@@ -778,8 +775,7 @@ discard block |
||
| 778 | 775 | |
| 779 | 776 | if (!$ownerentryid) { |
| 780 | 777 | $store = $this->store; |
| 781 | - } |
|
| 782 | - else { |
|
| 778 | + } else { |
|
| 783 | 779 | $ab = mapi_openaddressbook($this->session); |
| 784 | 780 | if (!$ab) { |
| 785 | 781 | return false; |
@@ -922,8 +918,7 @@ discard block |
||
| 922 | 918 | mapi_setprops($sub, [PR_ICON_INDEX => ICON_TASK_ASSIGNER]); |
| 923 | 919 | if ($messageprops[$this->props['complete']]) { |
| 924 | 920 | $props[PR_MESSAGE_CLASS] = "IPM.TaskRequest.Complete"; |
| 925 | - } |
|
| 926 | - else { |
|
| 921 | + } else { |
|
| 927 | 922 | $props[PR_MESSAGE_CLASS] = "IPM.TaskRequest.Update"; |
| 928 | 923 | } |
| 929 | 924 | |
@@ -1011,8 +1006,7 @@ discard block |
||
| 1011 | 1006 | try { |
| 1012 | 1007 | $attach = mapi_message_openattach($message, $row[PR_ATTACH_NUM]); |
| 1013 | 1008 | $task = mapi_attach_openobj($attach); |
| 1014 | - } |
|
| 1015 | - catch (MAPIException $e) { |
|
| 1009 | + } catch (MAPIException $e) { |
|
| 1016 | 1010 | continue; |
| 1017 | 1011 | } |
| 1018 | 1012 | |
@@ -53,12 +53,10 @@ discard block |
||
| 53 | 53 | $zpt->run(); |
| 54 | 54 | $zpt->scrClear(); |
| 55 | 55 | system("stty sane"); |
| 56 | - } |
|
| 57 | - else { |
|
| 56 | + } else { |
|
| 58 | 57 | echo "grommunio-sync interprocess communication (IPC) is not available or TopCollector is disabled.\n"; |
| 59 | 58 | } |
| 60 | - } |
|
| 61 | - catch (GSyncException $zpe) { |
|
| 59 | + } catch (GSyncException $zpe) { |
|
| 62 | 60 | fwrite(STDERR, get_class($zpe) . ": " . $zpe->getMessage() . "\n"); |
| 63 | 61 | |
| 64 | 62 | exit(1); |
@@ -173,8 +171,7 @@ discard block |
||
| 173 | 171 | if ($this->scrSize['width'] != $s['width']) { |
| 174 | 172 | if ($s['width'] > 180) { |
| 175 | 173 | $this->wide = true; |
| 176 | - } |
|
| 177 | - else { |
|
| 174 | + } else { |
|
| 178 | 175 | $this->wide = false; |
| 179 | 176 | } |
| 180 | 177 | } |
@@ -260,15 +257,12 @@ discard block |
||
| 260 | 257 | $lastUpdate = $this->currenttime - $line["update"]; |
| 261 | 258 | if ($this->currenttime - $line["update"] < 2) { |
| 262 | 259 | $this->linesActive[$line["update"] . $line["pid"]] = $line; |
| 263 | - } |
|
| 264 | - elseif (($line['push'] === true && $lastUpdate > ($this->pingInterval + 2)) || ($line['push'] !== true && $lastUpdate > 4)) { |
|
| 260 | + } elseif (($line['push'] === true && $lastUpdate > ($this->pingInterval + 2)) || ($line['push'] !== true && $lastUpdate > 4)) { |
|
| 265 | 261 | $this->linesUnknown[$line["update"] . $line["pid"]] = $line; |
| 266 | - } |
|
| 267 | - else { |
|
| 262 | + } else { |
|
| 268 | 263 | $this->linesOpen[$line["update"] . $line["pid"]] = $line; |
| 269 | 264 | } |
| 270 | - } |
|
| 271 | - else { |
|
| 265 | + } else { |
|
| 272 | 266 | // do not show terminated + expired connections |
| 273 | 267 | if ($this->currenttime > $line['ended'] + $this->showTermSec) { |
| 274 | 268 | continue; |
@@ -490,51 +484,40 @@ discard block |
||
| 490 | 484 | $this->topCollector->ClearLatest(true); |
| 491 | 485 | |
| 492 | 486 | $this->terminate = true; |
| 493 | - } |
|
| 494 | - elseif ($cmds[0] == "clear") { |
|
| 487 | + } elseif ($cmds[0] == "clear") { |
|
| 495 | 488 | $this->topCollector->ClearLatest(true); |
| 496 | 489 | $this->topCollector->CollectData(true); |
| 497 | 490 | $this->topCollector->ReInitIPC(); |
| 498 | - } |
|
| 499 | - elseif ($cmds[0] == "filter" || $cmds[0] == "f") { |
|
| 491 | + } elseif ($cmds[0] == "filter" || $cmds[0] == "f") { |
|
| 500 | 492 | if (!isset($cmds[1]) || $cmds[1] == "") { |
| 501 | 493 | $this->filter = false; |
| 502 | 494 | $this->status = "No filter"; |
| 503 | 495 | $this->statusexpire = $this->currenttime + 5; |
| 504 | - } |
|
| 505 | - else { |
|
| 496 | + } else { |
|
| 506 | 497 | $this->filter = $cmds[1]; |
| 507 | 498 | $this->status = false; |
| 508 | 499 | } |
| 509 | - } |
|
| 510 | - elseif ($cmds[0] == "option" || $cmds[0] == "o") { |
|
| 500 | + } elseif ($cmds[0] == "option" || $cmds[0] == "o") { |
|
| 511 | 501 | if (!isset($cmds[1]) || $cmds[1] == "") { |
| 512 | 502 | $this->status = "Option value needs to be specified. See 'help' or 'h' for instructions"; |
| 513 | 503 | $this->statusexpire = $this->currenttime + 5; |
| 514 | - } |
|
| 515 | - elseif ($cmds[1] == "p" || $cmds[1] == "push" || $cmds[1] == "ping") { |
|
| 504 | + } elseif ($cmds[1] == "p" || $cmds[1] == "push" || $cmds[1] == "ping") { |
|
| 516 | 505 | $this->showPush = !$this->showPush; |
| 517 | - } |
|
| 518 | - elseif ($cmds[1] == "a" || $cmds[1] == "active") { |
|
| 506 | + } elseif ($cmds[1] == "a" || $cmds[1] == "active") { |
|
| 519 | 507 | $this->showOption = self::SHOW_ACTIVE_ONLY; |
| 520 | - } |
|
| 521 | - elseif ($cmds[1] == "u" || $cmds[1] == "unknown") { |
|
| 508 | + } elseif ($cmds[1] == "u" || $cmds[1] == "unknown") { |
|
| 522 | 509 | $this->showOption = self::SHOW_UNKNOWN_ONLY; |
| 523 | - } |
|
| 524 | - elseif ($cmds[1] == "d" || $cmds[1] == "default") { |
|
| 510 | + } elseif ($cmds[1] == "d" || $cmds[1] == "default") { |
|
| 525 | 511 | $this->showOption = self::SHOW_DEFAULT; |
| 526 | 512 | $this->showTermSec = self::SHOW_TERM_DEFAULT_TIME; |
| 527 | 513 | $this->showPush = true; |
| 528 | - } |
|
| 529 | - elseif (is_numeric($cmds[1])) { |
|
| 514 | + } elseif (is_numeric($cmds[1])) { |
|
| 530 | 515 | $this->showTermSec = $cmds[1]; |
| 531 | - } |
|
| 532 | - else { |
|
| 516 | + } else { |
|
| 533 | 517 | $this->status = sprintf("Option '%s' unknown", $cmds[1]); |
| 534 | 518 | $this->statusexpire = $this->currenttime + 5; |
| 535 | 519 | } |
| 536 | - } |
|
| 537 | - elseif ($cmds[0] == "reset" || $cmds[0] == "r") { |
|
| 520 | + } elseif ($cmds[0] == "reset" || $cmds[0] == "r") { |
|
| 538 | 521 | $this->filter = false; |
| 539 | 522 | $this->wide = false; |
| 540 | 523 | $this->helpexpire = 0; |
@@ -546,16 +529,14 @@ discard block |
||
| 546 | 529 | $this->wide = !$this->wide; |
| 547 | 530 | $this->status = ($this->wide) ? "w i d e view" : "normal view"; |
| 548 | 531 | $this->statusexpire = $this->currenttime + 2; |
| 549 | - } |
|
| 550 | - elseif ($cmds[0] == "help" || $cmds[0] == "h") { |
|
| 532 | + } elseif ($cmds[0] == "help" || $cmds[0] == "h") { |
|
| 551 | 533 | $this->helpexpire = $this->currenttime + 20; |
| 552 | 534 | } |
| 553 | 535 | // grep the log file |
| 554 | 536 | elseif (($cmds[0] == "log" || $cmds[0] == "l") && isset($cmds[1])) { |
| 555 | 537 | if (!file_exists(LOGFILE)) { |
| 556 | 538 | $this->status = "Logfile can not be found: " . LOGFILE; |
| 557 | - } |
|
| 558 | - else { |
|
| 539 | + } else { |
|
| 559 | 540 | system('bash -c "fgrep -a ' . escapeshellarg($cmds[1]) . ' ' . LOGFILE . ' | less +G" > `tty`'); |
| 560 | 541 | $this->status = "Returning from log, updating data"; |
| 561 | 542 | } |
@@ -565,8 +546,7 @@ discard block |
||
| 565 | 546 | elseif (($cmds[0] == "tail" || $cmds[0] == "t")) { |
| 566 | 547 | if (!file_exists(LOGFILE)) { |
| 567 | 548 | $this->status = "Logfile can not be found: " . LOGFILE; |
| 568 | - } |
|
| 569 | - else { |
|
| 549 | + } else { |
|
| 570 | 550 | $this->doingTail = true; |
| 571 | 551 | $this->scrClear(); |
| 572 | 552 | $this->scrPrintAt(1, 0, $this->scrAsBold("Press CTRL+C to return to grommunio-sync-top\n\n")); |
@@ -584,8 +564,7 @@ discard block |
||
| 584 | 564 | elseif (($cmds[0] == "error" || $cmds[0] == "e")) { |
| 585 | 565 | if (!file_exists(LOGERRORFILE)) { |
| 586 | 566 | $this->status = "Error logfile can not be found: " . LOGERRORFILE; |
| 587 | - } |
|
| 588 | - else { |
|
| 567 | + } else { |
|
| 589 | 568 | $this->doingTail = true; |
| 590 | 569 | $this->scrClear(); |
| 591 | 570 | $this->scrPrintAt(1, 0, $this->scrAsBold("Press CTRL+C to return to grommunio-sync-top\n\n")); |
@@ -598,8 +577,7 @@ discard block |
||
| 598 | 577 | $this->status = "Returning from tail, updating data"; |
| 599 | 578 | } |
| 600 | 579 | $this->statusexpire = time() + 5; // it might be much "later" now |
| 601 | - } |
|
| 602 | - elseif ($cmds[0] != "") { |
|
| 580 | + } elseif ($cmds[0] != "") { |
|
| 603 | 581 | $this->status = sprintf("Command '%s' unknown", $cmds[0]); |
| 604 | 582 | $this->statusexpire = $this->currenttime + 8; |
| 605 | 583 | } |