@@ -23,12 +23,12 @@ discard block |
||
23 | 23 | * carried in the IPM.TaskRequest item (although this information seems |
24 | 24 | * redundant due to that information already being available in PR_MESSAGE_CLASS). |
25 | 25 | */ |
26 | - define('tdmtNothing', 0); // Value in IPM.Task items |
|
27 | - define('tdmtTaskReq', 1); // Assigner -> Assignee |
|
28 | - define('tdmtTaskAcc', 2); // Assignee -> Assigner |
|
29 | - define('tdmtTaskDec', 3); // Assignee -> Assigner |
|
30 | - define('tdmtTaskUpd', 4); // Assignee -> Assigner |
|
31 | - define('tdmtTaskSELF', 5); // Assigner -> Assigner (?) |
|
26 | + define('tdmtNothing', 0); // Value in IPM.Task items |
|
27 | + define('tdmtTaskReq', 1); // Assigner -> Assignee |
|
28 | + define('tdmtTaskAcc', 2); // Assignee -> Assigner |
|
29 | + define('tdmtTaskDec', 3); // Assignee -> Assigner |
|
30 | + define('tdmtTaskUpd', 4); // Assignee -> Assigner |
|
31 | + define('tdmtTaskSELF', 5); // Assigner -> Assigner (?) |
|
32 | 32 | |
33 | 33 | /* The TaskHistory is used to show the last action on the task |
34 | 34 | * on both the assigner and the assignee's side. |
@@ -38,22 +38,22 @@ discard block |
||
38 | 38 | * the format 'Accepted by <user> on 01-01-2010 11:00'. |
39 | 39 | */ |
40 | 40 | define('thNone', 0); |
41 | - define('thAccepted', 1); // Set by assignee |
|
42 | - define('thDeclined', 2); // Set by assignee |
|
43 | - define('thUpdated', 3); // Set by assignee |
|
41 | + define('thAccepted', 1); // Set by assignee |
|
42 | + define('thDeclined', 2); // Set by assignee |
|
43 | + define('thUpdated', 3); // Set by assignee |
|
44 | 44 | define('thDueDateChanged', 4); |
45 | - define('thAssigned', 5); // Set by assigner |
|
45 | + define('thAssigned', 5); // Set by assigner |
|
46 | 46 | |
47 | 47 | /* The TaskState value is used to differentiate the version of a task |
48 | 48 | * in the assigner's folder and the version in the |
49 | 49 | * assignee's folder. The buttons shown depend on this and |
50 | 50 | * the 'taskaccepted' boolean (for the assignee) |
51 | 51 | */ |
52 | - define('tdsNOM', 0); // Got a response to a deleted task, and re-created the task for the assigner |
|
53 | - define('tdsOWNNEW', 1); // Not assigned |
|
54 | - define('tdsOWN', 2); // Assignee version |
|
55 | - define('tdsACC', 3); // Assigner version |
|
56 | - define('tdsDEC', 4); // Assigner version, but assignee declined |
|
52 | + define('tdsNOM', 0); // Got a response to a deleted task, and re-created the task for the assigner |
|
53 | + define('tdsOWNNEW', 1); // Not assigned |
|
54 | + define('tdsOWN', 2); // Assignee version |
|
55 | + define('tdsACC', 3); // Assigner version |
|
56 | + define('tdsDEC', 4); // Assigner version, but assignee declined |
|
57 | 57 | |
58 | 58 | /* The TaskAcceptanceState is used for the assigner to indicate state */ |
59 | 59 | define('olTaskNotDelegated', 0); |
@@ -63,13 +63,13 @@ discard block |
||
63 | 63 | |
64 | 64 | /* The task ownership indicates the role of the current user relative to the task. */ |
65 | 65 | define('olNewTask', 0); |
66 | - define('olDelegatedTask', 1); // Task has been assigned |
|
67 | - define('olOwnTask', 2); // Task owned |
|
66 | + define('olDelegatedTask', 1); // Task has been assigned |
|
67 | + define('olOwnTask', 2); // Task owned |
|
68 | 68 | |
69 | 69 | /* taskmultrecips indicates whether the task request sent or received has multiple assignees or not. */ |
70 | 70 | define('tmrNone', 0); |
71 | - define('tmrSent', 1); // Task has been sent to multiple assignee |
|
72 | - define('tmrReceived', 2); // Task Request received has multiple assignee |
|
71 | + define('tmrSent', 1); // Task has been sent to multiple assignee |
|
72 | + define('tmrReceived', 2); // Task Request received has multiple assignee |
|
73 | 73 | |
74 | 74 | // Task icon index. |
75 | 75 | define('ICON_TASK_ASSIGNEE', 0x00000502); |
@@ -307,7 +307,7 @@ discard block |
||
307 | 307 | VALUE => $goid, ], |
308 | 308 | ]; |
309 | 309 | |
310 | - $table = mapi_folder_getcontentstable($folder, MAPI_DEFERRED_ERRORS | SHOW_SOFT_DELETES); |
|
310 | + $table = mapi_folder_getcontentstable($folder, MAPI_DEFERRED_ERRORS|SHOW_SOFT_DELETES); |
|
311 | 311 | $softDeletedItems = mapi_table_queryallrows($table, [PR_ENTRYID], $restriction); |
312 | 312 | if (!empty($softDeletedItems)) { |
313 | 313 | return true; |
@@ -515,14 +515,14 @@ discard block |
||
515 | 515 | // Set properties on Task Request |
516 | 516 | mapi_setprops($this->message, [ |
517 | 517 | $this->props['task_goid'] => $taskid, /* our new task_goid */ |
518 | - $this->props['taskstate'] => tdsACC, /* state for our outgoing request */ |
|
519 | - $this->props['taskmode'] => tdmtNothing, /* we're not sending a change */ |
|
520 | - $this->props['updatecount'] => 2, /* version 2 (no idea) */ |
|
518 | + $this->props['taskstate'] => tdsACC, /* state for our outgoing request */ |
|
519 | + $this->props['taskmode'] => tdmtNothing, /* we're not sending a change */ |
|
520 | + $this->props['updatecount'] => 2, /* version 2 (no idea) */ |
|
521 | 521 | $this->props['task_acceptance_state'] => olTaskDelegationUnknown, /* no reply yet */ |
522 | 522 | $this->props['ownership'] => olDelegatedTask, /* Task has been assigned */ |
523 | - $this->props['taskhistory'] => thAssigned, /* Task has been assigned */ |
|
523 | + $this->props['taskhistory'] => thAssigned, /* Task has been assigned */ |
|
524 | 524 | PR_CONVERSATION_TOPIC => $messageprops[PR_SUBJECT], |
525 | - PR_ICON_INDEX => ICON_TASK_ASSIGNER, /* Task request icon */ |
|
525 | + PR_ICON_INDEX => ICON_TASK_ASSIGNER, /* Task request icon */ |
|
526 | 526 | ]); |
527 | 527 | $this->setLastUser(); |
528 | 528 | $this->setOwnerForAssignor(); |
@@ -537,10 +537,10 @@ discard block |
||
537 | 537 | |
538 | 538 | // Make it a task request, and put it in sent items after it is sent |
539 | 539 | mapi_setprops($outgoing, [ |
540 | - PR_MESSAGE_CLASS => "IPM.TaskRequest", /* class is task request */ |
|
541 | - $this->props['taskstate'] => tdsOWN, /* for the recipient he is the task owner */ |
|
542 | - $this->props['taskmode'] => tdmtTaskReq, /* for the recipient it's a request */ |
|
543 | - $this->props['updatecount'] => 1, /* version 2 is in the attachment */ |
|
540 | + PR_MESSAGE_CLASS => "IPM.TaskRequest", /* class is task request */ |
|
541 | + $this->props['taskstate'] => tdsOWN, /* for the recipient he is the task owner */ |
|
542 | + $this->props['taskmode'] => tdmtTaskReq, /* for the recipient it's a request */ |
|
543 | + $this->props['updatecount'] => 1, /* version 2 is in the attachment */ |
|
544 | 544 | PR_SUBJECT_PREFIX => $prefix, |
545 | 545 | PR_SUBJECT => $prefix . $messageprops[PR_SUBJECT], |
546 | 546 | ]); |
@@ -551,7 +551,7 @@ discard block |
||
551 | 551 | PR_ATTACHMENT_HIDDEN => true, |
552 | 552 | PR_DISPLAY_NAME => $messageprops[PR_SUBJECT], ]); |
553 | 553 | |
554 | - $sub = mapi_attach_openproperty($attach, PR_ATTACH_DATA_OBJ, IID_IMessage, 0, MAPI_MODIFY | MAPI_CREATE); |
|
554 | + $sub = mapi_attach_openproperty($attach, PR_ATTACH_DATA_OBJ, IID_IMessage, 0, MAPI_MODIFY|MAPI_CREATE); |
|
555 | 555 | |
556 | 556 | mapi_copyto($this->message, [], [], $sub); |
557 | 557 | mapi_savechanges($sub); |
@@ -890,7 +890,7 @@ discard block |
||
890 | 890 | |
891 | 891 | $attach = mapi_message_createattach($outgoing); |
892 | 892 | mapi_setprops($attach, [PR_ATTACH_METHOD => ATTACH_EMBEDDED_MSG, PR_DISPLAY_NAME => $messageprops[PR_CONVERSATION_TOPIC], PR_ATTACHMENT_HIDDEN => true]); |
893 | - $sub = mapi_attach_openproperty($attach, PR_ATTACH_DATA_OBJ, IID_IMessage, 0, MAPI_CREATE | MAPI_MODIFY); |
|
893 | + $sub = mapi_attach_openproperty($attach, PR_ATTACH_DATA_OBJ, IID_IMessage, 0, MAPI_CREATE|MAPI_MODIFY); |
|
894 | 894 | |
895 | 895 | $message = !$this->isTaskRequest() ? $this->message : $this->getAssociatedTask(false); |
896 | 896 | |
@@ -943,7 +943,7 @@ discard block |
||
943 | 943 | // edit response before sending task response. |
944 | 944 | if ($this->taskCommentsInfo) { |
945 | 945 | $comments = $this->getTaskCommentsInfo(); |
946 | - $stream = mapi_openproperty($outgoing, PR_BODY, IID_IStream, STGM_TRANSACTED, MAPI_CREATE | MAPI_MODIFY); |
|
946 | + $stream = mapi_openproperty($outgoing, PR_BODY, IID_IStream, STGM_TRANSACTED, MAPI_CREATE|MAPI_MODIFY); |
|
947 | 947 | mapi_stream_setsize($stream, strlen($comments)); |
948 | 948 | mapi_stream_write($stream, $comments); |
949 | 949 | mapi_stream_commit($stream); |
@@ -1206,7 +1206,7 @@ discard block |
||
1206 | 1206 | } |
1207 | 1207 | |
1208 | 1208 | foreach ($recips as $recip) { |
1209 | - $recip[PR_RECIPIENT_TYPE] = MAPI_TO; // Change recipient type to MAPI_TO |
|
1209 | + $recip[PR_RECIPIENT_TYPE] = MAPI_TO; // Change recipient type to MAPI_TO |
|
1210 | 1210 | mapi_message_modifyrecipients($outgoing, MODRECIP_ADD, [$recip]); |
1211 | 1211 | } |
1212 | 1212 |
@@ -48,7 +48,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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"]]; |
@@ -152,15 +152,15 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
@@ -1739,193 +1739,193 @@ |
||
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'])) { |
@@ -573,14 +573,14 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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) { |
@@ -54,7 +54,7 @@ |
||
54 | 54 | // assign display message |
55 | 55 | $this->displayMessage = $displayMessage; |
56 | 56 | |
57 | - parent::__construct($errorMessage, (int) $code, $previous); |
|
57 | + parent::__construct($errorMessage, (int)$code, $previous); |
|
58 | 58 | } |
59 | 59 | |
60 | 60 | /** |
@@ -284,7 +284,7 @@ |
||
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); |