Passed
Branch master (ff9d34)
by Mike
09:14
created
mapi/class.freebusypublish.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -192,23 +192,23 @@  discard block
 block discarded – undo
192 192
                                                )
193 193
                                          ) // EXISTS OR
194 194
                                    )
195
-                             );        // global OR
195
+                             ); // global OR
196 196
 
197 197
         $contents = mapi_folder_getcontentstable($this->calendar);
198 198
         mapi_table_restrict($contents, $restrict);
199 199
 
200
-        while(1) {
200
+        while (1) {
201 201
             $rows = mapi_table_queryrows($contents, array_values($this->proptags), 0, 50);
202 202
 
203
-            if(!is_array($rows))
203
+            if (!is_array($rows))
204 204
                 break;
205 205
 
206
-            if(empty($rows))
206
+            if (empty($rows))
207 207
                 break;
208 208
 
209 209
             foreach ($rows as $row) {
210 210
                 $occurrences = Array();
211
-                if(isset($row[$this->proptags['recurring']]) && $row[$this->proptags['recurring']]) {
211
+                if (isset($row[$this->proptags['recurring']]) && $row[$this->proptags['recurring']]) {
212 212
                     $recur = new Recurrence($this->store, $row);
213 213
 
214 214
                     $occurrences = $recur->getItems($starttime, $length);
@@ -241,14 +241,14 @@  discard block
 block discarded – undo
241 241
         try {
242 242
             $fbsupport = mapi_freebusysupport_open($this->session, $this->store);
243 243
         } catch (MAPIException $e) {
244
-            if($e->getCode() == MAPI_E_NOT_FOUND) {
244
+            if ($e->getCode() == MAPI_E_NOT_FOUND) {
245 245
                 $e->setHandled();
246 246
                 ZLog::Write(LOGLEVEL_WARN, "Error in opening freebusysupport object.");
247 247
             }
248 248
         }
249 249
 
250 250
         // Open updater for this user
251
-        if(isset($fbsupport) && $fbsupport) {
251
+        if (isset($fbsupport) && $fbsupport) {
252 252
             $updaters = mapi_freebusysupport_loadupdate($fbsupport, Array($this->entryid));
253 253
 
254 254
             $updater = $updaters[0];
@@ -256,7 +256,7 @@  discard block
 block discarded – undo
256 256
             // Send the data
257 257
             mapi_freebusyupdate_reset($updater);
258 258
             mapi_freebusyupdate_publish($updater, $freebusy);
259
-            mapi_freebusyupdate_savechanges($updater, $start-24*60*60, $end);
259
+            mapi_freebusyupdate_savechanges($updater, $start - 24 * 60 * 60, $end);
260 260
 
261 261
             // We're finished
262 262
             mapi_freebusysupport_close($fbsupport);
@@ -271,9 +271,9 @@  discard block
 block discarded – undo
271 271
     function cmp($a, $b)
272 272
     {
273 273
         if ($a["time"] == $b["time"]) {
274
-            if($a["type"] < $b["type"])
274
+            if ($a["type"] < $b["type"])
275 275
                 return 1;
276
-            if($a["type"] > $b["type"])
276
+            if ($a["type"] > $b["type"])
277 277
                 return -1;
278 278
             return 0;
279 279
         }
@@ -293,7 +293,7 @@  discard block
 block discarded – undo
293 293
         $level = 0;
294 294
         $laststart = null;
295 295
 
296
-        foreach($items as $item)
296
+        foreach ($items as $item)
297 297
         {
298 298
             $ts["type"] = 0;
299 299
             $ts["time"] = $item[$this->proptags["startdate"]];
@@ -311,7 +311,7 @@  discard block
 block discarded – undo
311 311
         usort($timestamps, Array($this, "cmp"));
312 312
         $laststart = 0; // seb added
313 313
 
314
-        foreach($timestamps as $ts)
314
+        foreach ($timestamps as $ts)
315 315
         {
316 316
             switch ($ts["type"])
317 317
             {
@@ -322,7 +322,7 @@  discard block
 block discarded – undo
322 322
                         $newitem["end"] = $ts["time"];
323 323
                         $newitem["subject"] = join(",", $csubj);
324 324
                         $newitem["status"] = !empty($cbusy) ? max($cbusy) : 0;
325
-                        if($newitem["status"] > 0)
325
+                        if ($newitem["status"] > 0)
326 326
                             $merged[] = $newitem;
327 327
                     }
328 328
 
@@ -340,7 +340,7 @@  discard block
 block discarded – undo
340 340
                         $newitem["end"] = $ts["time"];
341 341
                         $newitem["subject"] = join(",", $csubj);
342 342
                         $newitem["status"] = !empty($cbusy) ? max($cbusy) : 0;
343
-                        if($newitem["status"] > 0)
343
+                        if ($newitem["status"] > 0)
344 344
                             $merged[] = $newitem;
345 345
                     }
346 346
 
Please login to merge, or discard this patch.
mapi/mapidefs.php 1 patch
Spacing   +449 added lines, -449 removed lines patch added patch discarded remove patch
@@ -6,110 +6,110 @@  discard block
 block discarded – undo
6 6
  */
7 7
 
8 8
 /* Resource types as defined in main.h of the mapi extension */
9
-define('RESOURCE_SESSION'                        ,'MAPI Session');
10
-define('RESOURCE_TABLE'                          ,'MAPI Table');
11
-define('RESOURCE_ROWSET'                         ,'MAPI Rowset');
12
-define('RESOURCE_MSGSTORE'                       ,'MAPI Message Store');
13
-define('RESOURCE_FOLDER'                         ,'MAPI Folder');
14
-define('RESOURCE_MESSAGE'                        ,'MAPI Message');
15
-define('RESOURCE_ATTACHMENT'                     ,'MAPI Attachment');
9
+define('RESOURCE_SESSION', 'MAPI Session');
10
+define('RESOURCE_TABLE', 'MAPI Table');
11
+define('RESOURCE_ROWSET', 'MAPI Rowset');
12
+define('RESOURCE_MSGSTORE', 'MAPI Message Store');
13
+define('RESOURCE_FOLDER', 'MAPI Folder');
14
+define('RESOURCE_MESSAGE', 'MAPI Message');
15
+define('RESOURCE_ATTACHMENT', 'MAPI Attachment');
16 16
 
17 17
 
18 18
 /* Object type */
19 19
 
20
-define('MAPI_STORE'                              ,0x00000001);    /* Message Store */
21
-define('MAPI_ADDRBOOK'                           ,0x00000002);    /* Address Book */
22
-define('MAPI_FOLDER'                             ,0x00000003);    /* Folder */
23
-define('MAPI_ABCONT'                             ,0x00000004);    /* Address Book Container */
24
-define('MAPI_MESSAGE'                            ,0x00000005);    /* Message */
25
-define('MAPI_MAILUSER'                           ,0x00000006);    /* Individual Recipient */
26
-define('MAPI_ATTACH'                             ,0x00000007);    /* Attachment */
27
-define('MAPI_DISTLIST'                           ,0x00000008);    /* Distribution List Recipient */
28
-define('MAPI_PROFSECT'                           ,0x00000009);    /* Profile Section */
29
-define('MAPI_STATUS'                             ,0x0000000A);    /* Status Object */
30
-define('MAPI_SESSION'                            ,0x0000000B);    /* Session */
31
-define('MAPI_FORMINFO'                           ,0x0000000C);    /* Form Information */
32
-
33
-define('MV_FLAG'                                 ,0x1000);
34
-define('MV_INSTANCE'                             ,0x2000);
35
-define('MVI_FLAG'                                ,MV_FLAG | MV_INSTANCE);
36
-
37
-define('PT_UNSPECIFIED'                          ,  0);    /* (Reserved for interface use) type doesn't matter to caller */
38
-define('PT_NULL'                                 ,  1);    /* NULL property value */
39
-define('PT_I2'                                   ,  2);    /* Signed 16-bit value */
40
-define('PT_LONG'                                 ,  3);    /* Signed 32-bit value */
41
-define('PT_R4'                                   ,  4);    /* 4-byte floating point */
42
-define('PT_DOUBLE'                               ,  5);    /* Floating point double */
43
-define('PT_CURRENCY'                             ,  6);    /* Signed 64-bit int (decimal w/    4 digits right of decimal pt) */
44
-define('PT_APPTIME'                              ,  7);    /* Application time */
45
-define('PT_ERROR'                                , 10);    /* 32-bit error value */
46
-define('PT_BOOLEAN'                              , 11);    /* 16-bit boolean (non-zero true) */
47
-define('PT_OBJECT'                               , 13);    /* Embedded object in a property */
48
-define('PT_I8'                                   , 20);    /* 8-byte signed integer */
49
-define('PT_STRING8'                              , 30);    /* Null terminated 8-bit character string */
50
-define('PT_UNICODE'                              , 31);    /* Null terminated Unicode string */
51
-define('PT_SYSTIME'                              , 64);    /* FILETIME 64-bit int w/ number of 100ns periods since Jan 1,1601 */
52
-define('PT_CLSID'                                , 72);    /* OLE GUID */
53
-define('PT_BINARY'                               ,258);   /* Uninterpreted (counted byte array) */
20
+define('MAPI_STORE', 0x00000001); /* Message Store */
21
+define('MAPI_ADDRBOOK', 0x00000002); /* Address Book */
22
+define('MAPI_FOLDER', 0x00000003); /* Folder */
23
+define('MAPI_ABCONT', 0x00000004); /* Address Book Container */
24
+define('MAPI_MESSAGE', 0x00000005); /* Message */
25
+define('MAPI_MAILUSER', 0x00000006); /* Individual Recipient */
26
+define('MAPI_ATTACH', 0x00000007); /* Attachment */
27
+define('MAPI_DISTLIST', 0x00000008); /* Distribution List Recipient */
28
+define('MAPI_PROFSECT', 0x00000009); /* Profile Section */
29
+define('MAPI_STATUS', 0x0000000A); /* Status Object */
30
+define('MAPI_SESSION', 0x0000000B); /* Session */
31
+define('MAPI_FORMINFO', 0x0000000C); /* Form Information */
32
+
33
+define('MV_FLAG', 0x1000);
34
+define('MV_INSTANCE', 0x2000);
35
+define('MVI_FLAG', MV_FLAG|MV_INSTANCE);
36
+
37
+define('PT_UNSPECIFIED', 0); /* (Reserved for interface use) type doesn't matter to caller */
38
+define('PT_NULL', 1); /* NULL property value */
39
+define('PT_I2', 2); /* Signed 16-bit value */
40
+define('PT_LONG', 3); /* Signed 32-bit value */
41
+define('PT_R4', 4); /* 4-byte floating point */
42
+define('PT_DOUBLE', 5); /* Floating point double */
43
+define('PT_CURRENCY', 6); /* Signed 64-bit int (decimal w/    4 digits right of decimal pt) */
44
+define('PT_APPTIME', 7); /* Application time */
45
+define('PT_ERROR', 10); /* 32-bit error value */
46
+define('PT_BOOLEAN', 11); /* 16-bit boolean (non-zero true) */
47
+define('PT_OBJECT', 13); /* Embedded object in a property */
48
+define('PT_I8', 20); /* 8-byte signed integer */
49
+define('PT_STRING8', 30); /* Null terminated 8-bit character string */
50
+define('PT_UNICODE', 31); /* Null terminated Unicode string */
51
+define('PT_SYSTIME', 64); /* FILETIME 64-bit int w/ number of 100ns periods since Jan 1,1601 */
52
+define('PT_CLSID', 72); /* OLE GUID */
53
+define('PT_BINARY', 258); /* Uninterpreted (counted byte array) */
54 54
 /* Changes are likely to these numbers, and to their structures. */
55 55
 
56 56
 /* Alternate property type names for ease of use */
57
-define('PT_SHORT'                                ,PT_I2);
58
-define('PT_I4'                                   ,PT_LONG);
59
-define('PT_FLOAT'                                ,PT_R4);
60
-define('PT_R8'                                   ,PT_DOUBLE);
61
-define('PT_LONGLONG'                             ,PT_I8);
57
+define('PT_SHORT', PT_I2);
58
+define('PT_I4', PT_LONG);
59
+define('PT_FLOAT', PT_R4);
60
+define('PT_R8', PT_DOUBLE);
61
+define('PT_LONGLONG', PT_I8);
62 62
 
63 63
 
64
-define('PT_TSTRING'                              ,PT_STRING8);
64
+define('PT_TSTRING', PT_STRING8);
65 65
 
66 66
 
67 67
 
68
-define('PT_MV_I2'                                ,(MV_FLAG | PT_I2));
69
-define('PT_MV_LONG'                              ,(MV_FLAG | PT_LONG));
70
-define('PT_MV_R4'                                ,(MV_FLAG | PT_R4));
71
-define('PT_MV_DOUBLE'                            ,(MV_FLAG | PT_DOUBLE));
72
-define('PT_MV_CURRENCY'                          ,(MV_FLAG | PT_CURRENCY));
73
-define('PT_MV_APPTIME'                           ,(MV_FLAG | PT_APPTIME));
74
-define('PT_MV_SYSTIME'                           ,(MV_FLAG | PT_SYSTIME));
75
-define('PT_MV_STRING8'                           ,(MV_FLAG | PT_STRING8));
76
-define('PT_MV_BINARY'                            ,(MV_FLAG | PT_BINARY));
77
-define('PT_MV_UNICODE'                           ,(MV_FLAG | PT_UNICODE));
78
-define('PT_MV_CLSID'                             ,(MV_FLAG | PT_CLSID));
79
-define('PT_MV_I8'                                ,(MV_FLAG | PT_I8));
68
+define('PT_MV_I2', (MV_FLAG|PT_I2));
69
+define('PT_MV_LONG', (MV_FLAG|PT_LONG));
70
+define('PT_MV_R4', (MV_FLAG|PT_R4));
71
+define('PT_MV_DOUBLE', (MV_FLAG|PT_DOUBLE));
72
+define('PT_MV_CURRENCY', (MV_FLAG|PT_CURRENCY));
73
+define('PT_MV_APPTIME', (MV_FLAG|PT_APPTIME));
74
+define('PT_MV_SYSTIME', (MV_FLAG|PT_SYSTIME));
75
+define('PT_MV_STRING8', (MV_FLAG|PT_STRING8));
76
+define('PT_MV_BINARY', (MV_FLAG|PT_BINARY));
77
+define('PT_MV_UNICODE', (MV_FLAG|PT_UNICODE));
78
+define('PT_MV_CLSID', (MV_FLAG|PT_CLSID));
79
+define('PT_MV_I8', (MV_FLAG|PT_I8));
80 80
 
81
-define('PT_MV_TSTRING'                           ,PT_MV_STRING8);
81
+define('PT_MV_TSTRING', PT_MV_STRING8);
82 82
 /* bit 0: set if descending, clear if ascending */
83 83
 
84
-define('TABLE_SORT_ASCEND'                       ,(0x00000000));
85
-define('TABLE_SORT_DESCEND'                      ,(0x00000001));
86
-define('TABLE_SORT_COMBINE'                      ,(0x00000002));
84
+define('TABLE_SORT_ASCEND', (0x00000000));
85
+define('TABLE_SORT_DESCEND', (0x00000001));
86
+define('TABLE_SORT_COMBINE', (0x00000002));
87 87
 
88 88
 /* Bookmarks in Table */
89
-define('BOOKMARK_BEGINNING'                      , 0); /* Before first row */
90
-define('BOOKMARK_CURRENT'                        , 1); /* Before current row */
91
-define('BOOKMARK_END'                            , 2); /* After last row */
89
+define('BOOKMARK_BEGINNING', 0); /* Before first row */
90
+define('BOOKMARK_CURRENT', 1); /* Before current row */
91
+define('BOOKMARK_END', 2); /* After last row */
92 92
 
93
-define('MAPI_UNICODE'                            ,0x80000000);
93
+define('MAPI_UNICODE', 0x80000000);
94 94
 
95 95
 /* IMAPIFolder Interface --------------------------------------------------- */
96
-define('CONVENIENT_DEPTH'                        ,0x00000001);
97
-define('SEARCH_RUNNING'                          ,0x00000001);
98
-define('SEARCH_REBUILD'                          ,0x00000002);
99
-define('SEARCH_RECURSIVE'                        ,0x00000004);
100
-define('SEARCH_FOREGROUND'                       ,0x00000008);
101
-define('STOP_SEARCH'                             ,0x00000001);
102
-define('RESTART_SEARCH'                          ,0x00000002);
103
-define('RECURSIVE_SEARCH'                        ,0x00000004);
104
-define('SHALLOW_SEARCH'                          ,0x00000008);
105
-define('FOREGROUND_SEARCH'                       ,0x00000010);
106
-define('BACKGROUND_SEARCH'                       ,0x00000020);
96
+define('CONVENIENT_DEPTH', 0x00000001);
97
+define('SEARCH_RUNNING', 0x00000001);
98
+define('SEARCH_REBUILD', 0x00000002);
99
+define('SEARCH_RECURSIVE', 0x00000004);
100
+define('SEARCH_FOREGROUND', 0x00000008);
101
+define('STOP_SEARCH', 0x00000001);
102
+define('RESTART_SEARCH', 0x00000002);
103
+define('RECURSIVE_SEARCH', 0x00000004);
104
+define('SHALLOW_SEARCH', 0x00000008);
105
+define('FOREGROUND_SEARCH', 0x00000010);
106
+define('BACKGROUND_SEARCH', 0x00000020);
107 107
 
108 108
 /* IMAPIFolder folder type (enum) */
109 109
 
110
-define('FOLDER_ROOT'                             ,0x00000000);
111
-define('FOLDER_GENERIC'                          ,0x00000001);
112
-define('FOLDER_SEARCH'                           ,0x00000002);
110
+define('FOLDER_ROOT', 0x00000000);
111
+define('FOLDER_GENERIC', 0x00000001);
112
+define('FOLDER_SEARCH', 0x00000002);
113 113
 
114 114
 /* CreateMessage */
115 115
 /****** MAPI_DEFERRED_ERRORS    ((ULONG) 0x00000008) below */
@@ -117,188 +117,188 @@  discard block
 block discarded – undo
117 117
 
118 118
 /* CopyMessages */
119 119
 
120
-define('MESSAGE_MOVE'                            ,0x00000001);
121
-define('MESSAGE_DIALOG'                          ,0x00000002);
120
+define('MESSAGE_MOVE', 0x00000001);
121
+define('MESSAGE_DIALOG', 0x00000002);
122 122
 /****** MAPI_DECLINE_OK         ((ULONG) 0x00000004) above */
123 123
 
124 124
 /* CreateFolder */
125 125
 
126
-define('OPEN_IF_EXISTS'                          ,0x00000001);
126
+define('OPEN_IF_EXISTS', 0x00000001);
127 127
 /****** MAPI_DEFERRED_ERRORS    ((ULONG) 0x00000008) below */
128 128
 /****** MAPI_UNICODE            ((ULONG) 0x80000000) above */
129 129
 
130 130
 /* DeleteFolder */
131 131
 
132
-define('DEL_MESSAGES'                            ,0x00000001);
133
-define('FOLDER_DIALOG'                           ,0x00000002);
134
-define('DEL_FOLDERS'                             ,0x00000004);
132
+define('DEL_MESSAGES', 0x00000001);
133
+define('FOLDER_DIALOG', 0x00000002);
134
+define('DEL_FOLDERS', 0x00000004);
135 135
 
136 136
 /* EmptyFolder */
137
-define('DEL_ASSOCIATED'                          ,0x00000008);
137
+define('DEL_ASSOCIATED', 0x00000008);
138 138
 
139 139
 /* CopyFolder */
140 140
 
141
-define('FOLDER_MOVE'                             ,0x00000001);
141
+define('FOLDER_MOVE', 0x00000001);
142 142
 /****** FOLDER_DIALOG           ((ULONG) 0x00000002) above */
143 143
 /****** MAPI_DECLINE_OK         ((ULONG) 0x00000004) above */
144
-define('COPY_SUBFOLDERS'                         ,0x00000010);
144
+define('COPY_SUBFOLDERS', 0x00000010);
145 145
 /****** MAPI_UNICODE            ((ULONG) 0x80000000) above */
146 146
 
147 147
 
148 148
 /* SetReadFlags */
149 149
 
150
-define('SUPPRESS_RECEIPT'                        ,0x00000001);
150
+define('SUPPRESS_RECEIPT', 0x00000001);
151 151
 /****** FOLDER_DIALOG           ((ULONG) 0x00000002) above */
152
-define('CLEAR_READ_FLAG'                         ,0x00000004);
152
+define('CLEAR_READ_FLAG', 0x00000004);
153 153
 /****** MAPI_DEFERRED_ERRORS    ((ULONG) 0x00000008) below */
154
-define('GENERATE_RECEIPT_ONLY'                   ,0x00000010);
155
-define('CLEAR_RN_PENDING'                        ,0x00000020);
156
-define('CLEAR_NRN_PENDING'                       ,0x00000040);
154
+define('GENERATE_RECEIPT_ONLY', 0x00000010);
155
+define('CLEAR_RN_PENDING', 0x00000020);
156
+define('CLEAR_NRN_PENDING', 0x00000040);
157 157
 
158 158
 /* Flags defined in PR_MESSAGE_FLAGS */
159 159
 
160
-define('MSGFLAG_READ'                            ,0x00000001);
161
-define('MSGFLAG_UNMODIFIED'                      ,0x00000002);
162
-define('MSGFLAG_SUBMIT'                          ,0x00000004);
163
-define('MSGFLAG_UNSENT'                          ,0x00000008);
164
-define('MSGFLAG_HASATTACH'                       ,0x00000010);
165
-define('MSGFLAG_FROMME'                          ,0x00000020);
166
-define('MSGFLAG_ASSOCIATED'                      ,0x00000040);
167
-define('MSGFLAG_RESEND'                          ,0x00000080);
168
-define('MSGFLAG_RN_PENDING'                      ,0x00000100);
169
-define('MSGFLAG_NRN_PENDING'                     ,0x00000200);
160
+define('MSGFLAG_READ', 0x00000001);
161
+define('MSGFLAG_UNMODIFIED', 0x00000002);
162
+define('MSGFLAG_SUBMIT', 0x00000004);
163
+define('MSGFLAG_UNSENT', 0x00000008);
164
+define('MSGFLAG_HASATTACH', 0x00000010);
165
+define('MSGFLAG_FROMME', 0x00000020);
166
+define('MSGFLAG_ASSOCIATED', 0x00000040);
167
+define('MSGFLAG_RESEND', 0x00000080);
168
+define('MSGFLAG_RN_PENDING', 0x00000100);
169
+define('MSGFLAG_NRN_PENDING', 0x00000200);
170 170
 
171 171
 /* GetMessageStatus */
172 172
 
173
-define('MSGSTATUS_HIGHLIGHTED'                   ,0x00000001);
174
-define('MSGSTATUS_TAGGED'                        ,0x00000002);
175
-define('MSGSTATUS_HIDDEN'                        ,0x00000004);
176
-define('MSGSTATUS_DELMARKED'                     ,0x00000008);
173
+define('MSGSTATUS_HIGHLIGHTED', 0x00000001);
174
+define('MSGSTATUS_TAGGED', 0x00000002);
175
+define('MSGSTATUS_HIDDEN', 0x00000004);
176
+define('MSGSTATUS_DELMARKED', 0x00000008);
177 177
 
178 178
 /* Bits for remote message status */
179 179
 
180
-define('MSGSTATUS_REMOTE_DOWNLOAD'               ,0x00001000);
181
-define('MSGSTATUS_REMOTE_DELETE'                 ,0x00002000);
180
+define('MSGSTATUS_REMOTE_DOWNLOAD', 0x00001000);
181
+define('MSGSTATUS_REMOTE_DELETE', 0x00002000);
182 182
 
183 183
 /* SaveContentsSort */
184 184
 
185
-define('RECURSIVE_SORT'                          ,0x00000002);
185
+define('RECURSIVE_SORT', 0x00000002);
186 186
 
187 187
 /* PR_STATUS property */
188 188
 
189
-define('FLDSTATUS_HIGHLIGHTED'                   ,0x00000001);
190
-define('FLDSTATUS_TAGGED'                        ,0x00000002);
191
-define('FLDSTATUS_HIDDEN'                        ,0x00000004);
192
-define('FLDSTATUS_DELMARKED'                     ,0x00000008);
189
+define('FLDSTATUS_HIGHLIGHTED', 0x00000001);
190
+define('FLDSTATUS_TAGGED', 0x00000002);
191
+define('FLDSTATUS_HIDDEN', 0x00000004);
192
+define('FLDSTATUS_DELMARKED', 0x00000008);
193 193
 
194 194
 
195 195
 /* IMAPIStatus Interface --------------------------------------------------- */
196 196
 
197 197
 /* Values for PR_RESOURCE_TYPE, _METHODS, _FLAGS */
198 198
 
199
-define('MAPI_STORE_PROVIDER'                     , 33);    /* Message Store */
200
-define('MAPI_AB'                                 , 34);    /* Address Book */
201
-define('MAPI_AB_PROVIDER'                        , 35);    /* Address Book Provider */
202
-define('MAPI_TRANSPORT_PROVIDER'                 , 36);    /* Transport Provider */
203
-define('MAPI_SPOOLER'                            , 37);    /* Message Spooler */
204
-define('MAPI_PROFILE_PROVIDER'                   , 38);    /* Profile Provider */
205
-define('MAPI_SUBSYSTEM'                          , 39);    /* Overall Subsystem Status */
206
-define('MAPI_HOOK_PROVIDER'                      , 40);    /* Spooler Hook */
207
-define('STATUS_VALIDATE_STATE'                   ,0x00000001);
208
-define('STATUS_SETTINGS_DIALOG'                  ,0x00000002);
209
-define('STATUS_CHANGE_PASSWORD'                  ,0x00000004);
210
-define('STATUS_FLUSH_QUEUES'                     ,0x00000008);
211
-
212
-define('STATUS_DEFAULT_OUTBOUND'                 ,0x00000001);
213
-define('STATUS_DEFAULT_STORE'                    ,0x00000002);
214
-define('STATUS_PRIMARY_IDENTITY'                 ,0x00000004);
215
-define('STATUS_SIMPLE_STORE'                     ,0x00000008);
216
-define('STATUS_XP_PREFER_LAST'                   ,0x00000010);
217
-define('STATUS_NO_PRIMARY_IDENTITY'              ,0x00000020);
218
-define('STATUS_NO_DEFAULT_STORE'                 ,0x00000040);
219
-define('STATUS_TEMP_SECTION'                     ,0x00000080);
220
-define('STATUS_OWN_STORE'                        ,0x00000100);
221
-define('STATUS_NEED_IPM_TREE'                    ,0x00000800);
222
-define('STATUS_PRIMARY_STORE'                    ,0x00001000);
223
-define('STATUS_SECONDARY_STORE'                  ,0x00002000);
199
+define('MAPI_STORE_PROVIDER', 33); /* Message Store */
200
+define('MAPI_AB', 34); /* Address Book */
201
+define('MAPI_AB_PROVIDER', 35); /* Address Book Provider */
202
+define('MAPI_TRANSPORT_PROVIDER', 36); /* Transport Provider */
203
+define('MAPI_SPOOLER', 37); /* Message Spooler */
204
+define('MAPI_PROFILE_PROVIDER', 38); /* Profile Provider */
205
+define('MAPI_SUBSYSTEM', 39); /* Overall Subsystem Status */
206
+define('MAPI_HOOK_PROVIDER', 40); /* Spooler Hook */
207
+define('STATUS_VALIDATE_STATE', 0x00000001);
208
+define('STATUS_SETTINGS_DIALOG', 0x00000002);
209
+define('STATUS_CHANGE_PASSWORD', 0x00000004);
210
+define('STATUS_FLUSH_QUEUES', 0x00000008);
211
+
212
+define('STATUS_DEFAULT_OUTBOUND', 0x00000001);
213
+define('STATUS_DEFAULT_STORE', 0x00000002);
214
+define('STATUS_PRIMARY_IDENTITY', 0x00000004);
215
+define('STATUS_SIMPLE_STORE', 0x00000008);
216
+define('STATUS_XP_PREFER_LAST', 0x00000010);
217
+define('STATUS_NO_PRIMARY_IDENTITY', 0x00000020);
218
+define('STATUS_NO_DEFAULT_STORE', 0x00000040);
219
+define('STATUS_TEMP_SECTION', 0x00000080);
220
+define('STATUS_OWN_STORE', 0x00000100);
221
+define('STATUS_NEED_IPM_TREE', 0x00000800);
222
+define('STATUS_PRIMARY_STORE', 0x00001000);
223
+define('STATUS_SECONDARY_STORE', 0x00002000);
224 224
 
225 225
 
226 226
 /* ------------ */
227 227
 /* Random flags */
228 228
 
229 229
 /* Flag for deferred error */
230
-define('MAPI_DEFERRED_ERRORS'                    ,0x00000008);
230
+define('MAPI_DEFERRED_ERRORS', 0x00000008);
231 231
 
232 232
 /* Flag for creating and using Folder Associated Information Messages */
233
-define('MAPI_ASSOCIATED'                         ,0x00000040);
233
+define('MAPI_ASSOCIATED', 0x00000040);
234 234
 
235 235
 /* Flags for OpenMessageStore() */
236 236
 
237
-define('MDB_NO_DIALOG'                           ,0x00000001);
238
-define('MDB_WRITE'                               ,0x00000004);
237
+define('MDB_NO_DIALOG', 0x00000001);
238
+define('MDB_WRITE', 0x00000004);
239 239
 /****** MAPI_DEFERRED_ERRORS    ((ULONG) 0x00000008) above */
240 240
 /****** MAPI_BEST_ACCESS        ((ULONG) 0x00000010) above */
241
-define('MDB_TEMPORARY'                           ,0x00000020);
242
-define('MDB_NO_MAIL'                             ,0x00000080);
241
+define('MDB_TEMPORARY', 0x00000020);
242
+define('MDB_NO_MAIL', 0x00000080);
243 243
 
244 244
 /* Flags for OpenAddressBook */
245 245
 
246
-define('AB_NO_DIALOG'                            ,0x00000001);
246
+define('AB_NO_DIALOG', 0x00000001);
247 247
 
248 248
 /* ((ULONG) 0x00000001 is not a valid flag on ModifyRecipients. */
249
-define('MODRECIP_ADD'                            ,0x00000002);
250
-define('MODRECIP_MODIFY'                         ,0x00000004);
251
-define('MODRECIP_REMOVE'                         ,0x00000008);
249
+define('MODRECIP_ADD', 0x00000002);
250
+define('MODRECIP_MODIFY', 0x00000004);
251
+define('MODRECIP_REMOVE', 0x00000008);
252 252
 
253 253
 
254
-define('MAPI_ORIG'                               ,0);          /* Recipient is message originator          */
255
-define('MAPI_TO'                                 ,1);          /* Recipient is a primary recipient         */
256
-define('MAPI_CC'                                 ,2);          /* Recipient is a copy recipient            */
257
-define('MAPI_BCC'                                ,3);          /* Recipient is blind copy recipient        */
254
+define('MAPI_ORIG', 0); /* Recipient is message originator          */
255
+define('MAPI_TO', 1); /* Recipient is a primary recipient         */
256
+define('MAPI_CC', 2); /* Recipient is a copy recipient            */
257
+define('MAPI_BCC', 3); /* Recipient is blind copy recipient        */
258 258
 
259 259
 
260 260
 /* IAttach Interface ------------------------------------------------------- */
261 261
 
262 262
 /* IAttach attachment methods: PR_ATTACH_METHOD values */
263 263
 
264
-define('NO_ATTACHMENT'                           ,0x00000000);
265
-define('ATTACH_BY_VALUE'                         ,0x00000001);
266
-define('ATTACH_BY_REFERENCE'                     ,0x00000002);
267
-define('ATTACH_BY_REF_RESOLVE'                   ,0x00000003);
268
-define('ATTACH_BY_REF_ONLY'                      ,0x00000004);
269
-define('ATTACH_EMBEDDED_MSG'                     ,0x00000005);
270
-define('ATTACH_OLE'                              ,0x00000006);
264
+define('NO_ATTACHMENT', 0x00000000);
265
+define('ATTACH_BY_VALUE', 0x00000001);
266
+define('ATTACH_BY_REFERENCE', 0x00000002);
267
+define('ATTACH_BY_REF_RESOLVE', 0x00000003);
268
+define('ATTACH_BY_REF_ONLY', 0x00000004);
269
+define('ATTACH_EMBEDDED_MSG', 0x00000005);
270
+define('ATTACH_OLE', 0x00000006);
271 271
 
272 272
 /* OpenProperty  - ulFlags */
273
-define('MAPI_MODIFY'                             ,0x00000001);
274
-define('MAPI_CREATE'                             ,0x00000002);
275
-define('STREAM_APPEND'                           ,0x00000004);
273
+define('MAPI_MODIFY', 0x00000001);
274
+define('MAPI_CREATE', 0x00000002);
275
+define('STREAM_APPEND', 0x00000004);
276 276
 /****** MAPI_DEFERRED_ERRORS    ((ULONG) 0x00000008) below */
277 277
 
278 278
 
279 279
 /* PR_PRIORITY values */
280
-define('PRIO_URGENT'                             , 1);
281
-define('PRIO_NORMAL'                             , 0);
282
-define('PRIO_NONURGENT'                          ,-1);
280
+define('PRIO_URGENT', 1);
281
+define('PRIO_NORMAL', 0);
282
+define('PRIO_NONURGENT', -1);
283 283
 
284 284
 /* PR_SENSITIVITY values */
285
-define('SENSITIVITY_NONE'                        ,0x00000000);
286
-define('SENSITIVITY_PERSONAL'                    ,0x00000001);
287
-define('SENSITIVITY_PRIVATE'                     ,0x00000002);
288
-define('SENSITIVITY_COMPANY_CONFIDENTIAL'        ,0x00000003);
285
+define('SENSITIVITY_NONE', 0x00000000);
286
+define('SENSITIVITY_PERSONAL', 0x00000001);
287
+define('SENSITIVITY_PRIVATE', 0x00000002);
288
+define('SENSITIVITY_COMPANY_CONFIDENTIAL', 0x00000003);
289 289
 
290 290
 /* PR_IMPORTANCE values */
291
-define('IMPORTANCE_LOW'                          ,0);
292
-define('IMPORTANCE_NORMAL'                       ,1);
293
-define('IMPORTANCE_HIGH'                         ,2);
291
+define('IMPORTANCE_LOW', 0);
292
+define('IMPORTANCE_NORMAL', 1);
293
+define('IMPORTANCE_HIGH', 2);
294 294
 
295 295
 /* Stream interface values */
296
-define('STREAM_SEEK_SET'                         ,0);
297
-define('STREAM_SEEK_CUR'                         ,1);
298
-define('STREAM_SEEK_END'                         ,2);
296
+define('STREAM_SEEK_SET', 0);
297
+define('STREAM_SEEK_CUR', 1);
298
+define('STREAM_SEEK_END', 2);
299 299
 
300
-define('SHOW_SOFT_DELETES'                       ,0x00000002);
301
-define('DELETE_HARD_DELETE'                      ,0x00000010);
300
+define('SHOW_SOFT_DELETES', 0x00000002);
301
+define('DELETE_HARD_DELETE', 0x00000010);
302 302
 
303 303
 /*
304 304
  *    The following flags are used to indicate to the client what access
@@ -306,78 +306,78 @@  discard block
 block discarded – undo
306 306
  *    message and folder objects as well as in contents and associated
307 307
  *    contents tables
308 308
  */
309
-define('MAPI_ACCESS_MODIFY'                      ,0x00000001);
310
-define('MAPI_ACCESS_READ'                        ,0x00000002);
311
-define('MAPI_ACCESS_DELETE'                      ,0x00000004);
312
-define('MAPI_ACCESS_CREATE_HIERARCHY'            ,0x00000008);
313
-define('MAPI_ACCESS_CREATE_CONTENTS'             ,0x00000010);
314
-define('MAPI_ACCESS_CREATE_ASSOCIATED'           ,0x00000020);
309
+define('MAPI_ACCESS_MODIFY', 0x00000001);
310
+define('MAPI_ACCESS_READ', 0x00000002);
311
+define('MAPI_ACCESS_DELETE', 0x00000004);
312
+define('MAPI_ACCESS_CREATE_HIERARCHY', 0x00000008);
313
+define('MAPI_ACCESS_CREATE_CONTENTS', 0x00000010);
314
+define('MAPI_ACCESS_CREATE_ASSOCIATED', 0x00000020);
315 315
 
316
-define('MAPI_SEND_NO_RICH_INFO'                  ,0x00010000);
316
+define('MAPI_SEND_NO_RICH_INFO', 0x00010000);
317 317
 
318 318
 /* flags for PR_STORE_SUPPORT_MASK */
319
-define('STORE_ANSI_OK'                           ,0x00020000); // The message store supports properties containing ANSI (8-bit) characters.
320
-define('STORE_ATTACH_OK'                         ,0x00000020); // The message store supports attachments (OLE or non-OLE) to messages.
321
-define('STORE_CATEGORIZE_OK'                     ,0x00000400); // The message store supports categorized views of tables.
322
-define('STORE_CREATE_OK'                         ,0x00000010); // The message store supports creation of new messages.
323
-define('STORE_ENTRYID_UNIQUE'                    ,0x00000001); // Entry identifiers for the objects in the message store are unique, that is, never reused during the life of the store.
324
-define('STORE_HTML_OK'                           ,0x00010000); // The message store supports Hypertext Markup Language (HTML) messages, stored in the PR_BODY_HTML property. Note that STORE_HTML_OK is not defined in versions of MAPIDEFS.H included with Microsoft� Exchange 2000 Server and earlier. If your development environment uses a MAPIDEFS.H file that does not include STORE_HTML_OK, use the value 0x00010000 instead.
325
-define('STORE_LOCALSTORE'                        ,0x00080000); // This flag is reserved and should not be used.
326
-define('STORE_MODIFY_OK'                         ,0x00000008); // The message store supports modification of its existing messages.
327
-define('STORE_MV_PROPS_OK'                       ,0x00000200); // The message store supports multivalued properties, guarantees the stability of value order in a multivalued property throughout a save operation, and supports instantiation of multivalued properties in tables.
328
-define('STORE_NOTIFY_OK'                         ,0x00000100); // The message store supports notifications.
329
-define('STORE_OLE_OK'                            ,0x00000040); // The message store supports OLE attachments. The OLE data is accessible through an IStorage interface, such as that available through the PR_ATTACH_DATA_OBJ property.
330
-define('STORE_PUBLIC_FOLDERS'                    ,0x00004000); // The folders in this store are public (multi-user), not private (possibly multi-instance but not multi-user).
331
-define('STORE_READONLY'                          ,0x00000002); // All interfaces for the message store have a read-only access level.
332
-define('STORE_RESTRICTION_OK'                    ,0x00001000); // The message store supports restrictions.
333
-define('STORE_RTF_OK'                            ,0x00000800); // The message store supports Rich Text Format (RTF) messages, usually stored compressed, and the store itself keeps PR_BODY and PR_RTF_COMPRESSED synchronized.
334
-define('STORE_SEARCH_OK'                         ,0x00000004); // The message store supports search-results folders.
335
-define('STORE_SORT_OK'                           ,0x00002000); // The message store supports sorting views of tables.
336
-define('STORE_SUBMIT_OK'                         ,0x00000080); // The message store supports marking a message for submission.
337
-define('STORE_UNCOMPRESSED_RTF'                  ,0x00008000); // The message store supports storage of Rich Text Format (RTF) messages in uncompressed form. An uncompressed RTF stream is identified by the value dwMagicUncompressedRTF in the stream header. The dwMagicUncompressedRTF value is defined in the RTFLIB.H file.
338
-define('STORE_UNICODE_OK'                        ,0x00040000); // The message store supports properties containing Unicode characters.
319
+define('STORE_ANSI_OK', 0x00020000); // The message store supports properties containing ANSI (8-bit) characters.
320
+define('STORE_ATTACH_OK', 0x00000020); // The message store supports attachments (OLE or non-OLE) to messages.
321
+define('STORE_CATEGORIZE_OK', 0x00000400); // The message store supports categorized views of tables.
322
+define('STORE_CREATE_OK', 0x00000010); // The message store supports creation of new messages.
323
+define('STORE_ENTRYID_UNIQUE', 0x00000001); // Entry identifiers for the objects in the message store are unique, that is, never reused during the life of the store.
324
+define('STORE_HTML_OK', 0x00010000); // The message store supports Hypertext Markup Language (HTML) messages, stored in the PR_BODY_HTML property. Note that STORE_HTML_OK is not defined in versions of MAPIDEFS.H included with Microsoft� Exchange 2000 Server and earlier. If your development environment uses a MAPIDEFS.H file that does not include STORE_HTML_OK, use the value 0x00010000 instead.
325
+define('STORE_LOCALSTORE', 0x00080000); // This flag is reserved and should not be used.
326
+define('STORE_MODIFY_OK', 0x00000008); // The message store supports modification of its existing messages.
327
+define('STORE_MV_PROPS_OK', 0x00000200); // The message store supports multivalued properties, guarantees the stability of value order in a multivalued property throughout a save operation, and supports instantiation of multivalued properties in tables.
328
+define('STORE_NOTIFY_OK', 0x00000100); // The message store supports notifications.
329
+define('STORE_OLE_OK', 0x00000040); // The message store supports OLE attachments. The OLE data is accessible through an IStorage interface, such as that available through the PR_ATTACH_DATA_OBJ property.
330
+define('STORE_PUBLIC_FOLDERS', 0x00004000); // The folders in this store are public (multi-user), not private (possibly multi-instance but not multi-user).
331
+define('STORE_READONLY', 0x00000002); // All interfaces for the message store have a read-only access level.
332
+define('STORE_RESTRICTION_OK', 0x00001000); // The message store supports restrictions.
333
+define('STORE_RTF_OK', 0x00000800); // The message store supports Rich Text Format (RTF) messages, usually stored compressed, and the store itself keeps PR_BODY and PR_RTF_COMPRESSED synchronized.
334
+define('STORE_SEARCH_OK', 0x00000004); // The message store supports search-results folders.
335
+define('STORE_SORT_OK', 0x00002000); // The message store supports sorting views of tables.
336
+define('STORE_SUBMIT_OK', 0x00000080); // The message store supports marking a message for submission.
337
+define('STORE_UNCOMPRESSED_RTF', 0x00008000); // The message store supports storage of Rich Text Format (RTF) messages in uncompressed form. An uncompressed RTF stream is identified by the value dwMagicUncompressedRTF in the stream header. The dwMagicUncompressedRTF value is defined in the RTFLIB.H file.
338
+define('STORE_UNICODE_OK', 0x00040000); // The message store supports properties containing Unicode characters.
339 339
 
340 340
 
341 341
 /*  PR_DISPLAY_TYPEs                 */
342 342
 /*  For address book contents tables */
343
-define('DT_MAILUSER'                             ,0x00000000);
344
-define('DT_DISTLIST'                             ,0x00000001);
345
-define('DT_FORUM'                                ,0x00000002);
346
-define('DT_AGENT'                                ,0x00000003);
347
-define('DT_ORGANIZATION'                         ,0x00000004);
348
-define('DT_PRIVATE_DISTLIST'                     ,0x00000005);
349
-define('DT_REMOTE_MAILUSER'                      ,0x00000006);
343
+define('DT_MAILUSER', 0x00000000);
344
+define('DT_DISTLIST', 0x00000001);
345
+define('DT_FORUM', 0x00000002);
346
+define('DT_AGENT', 0x00000003);
347
+define('DT_ORGANIZATION', 0x00000004);
348
+define('DT_PRIVATE_DISTLIST', 0x00000005);
349
+define('DT_REMOTE_MAILUSER', 0x00000006);
350 350
 
351 351
 /* For address book hierarchy tables */
352
-define('DT_MODIFIABLE'                           ,0x00010000);
353
-define('DT_GLOBAL'                               ,0x00020000);
354
-define('DT_LOCAL'                                ,0x00030000);
355
-define('DT_WAN'                                  ,0x00040000);
356
-define('DT_NOT_SPECIFIC'                         ,0x00050000);
352
+define('DT_MODIFIABLE', 0x00010000);
353
+define('DT_GLOBAL', 0x00020000);
354
+define('DT_LOCAL', 0x00030000);
355
+define('DT_WAN', 0x00040000);
356
+define('DT_NOT_SPECIFIC', 0x00050000);
357 357
 
358 358
 /* For folder hierarchy tables */
359
-define('DT_FOLDER'                               ,0x01000000);
360
-define('DT_FOLDER_LINK'                          ,0x02000000);
361
-define('DT_FOLDER_SPECIAL'                       ,0x04000000);
359
+define('DT_FOLDER', 0x01000000);
360
+define('DT_FOLDER_LINK', 0x02000000);
361
+define('DT_FOLDER_SPECIAL', 0x04000000);
362 362
 
363 363
 /* PR_DISPLAY_TYPE_EX values */
364
-define('DT_ROOM'                                 ,0x00000007);
365
-define('DT_EQUIPMENT'                            ,0x00000008);
366
-define('DT_SEC_DISTLIST'                         ,0x00000009);
364
+define('DT_ROOM', 0x00000007);
365
+define('DT_EQUIPMENT', 0x00000008);
366
+define('DT_SEC_DISTLIST', 0x00000009);
367 367
 
368 368
 /* PR_DISPLAY_TYPE_EX flags */
369
-define('DTE_FLAG_REMOTE_VALID'                   ,0x80000000);
370
-define('DTE_FLAG_ACL_CAPABLE'                    ,0x40000000); /* on for DT_MAILUSER and DT_SEC_DISTLIST */
371
-define('DTE_MASK_REMOTE'                         ,0x0000FF00);
372
-define('DTE_MASK_LOCAL'                          ,0x000000FF);
369
+define('DTE_FLAG_REMOTE_VALID', 0x80000000);
370
+define('DTE_FLAG_ACL_CAPABLE', 0x40000000); /* on for DT_MAILUSER and DT_SEC_DISTLIST */
371
+define('DTE_MASK_REMOTE', 0x0000FF00);
372
+define('DTE_MASK_LOCAL', 0x000000FF);
373 373
 
374 374
 /* OlResponseStatus */
375
-define('olResponseNone'                          ,0);
376
-define('olResponseOrganized'                     ,1);
377
-define('olResponseTentative'                     ,2);
378
-define('olResponseAccepted'                      ,3);
379
-define('olResponseDeclined'                      ,4);
380
-define('olResponseNotResponded'                  ,5);
375
+define('olResponseNone', 0);
376
+define('olResponseOrganized', 1);
377
+define('olResponseTentative', 2);
378
+define('olResponseAccepted', 3);
379
+define('olResponseDeclined', 4);
380
+define('olResponseNotResponded', 5);
381 381
 
382 382
 /* OlRecipientTrackStatus to set PR_RECIPIENT_TRACKSTATUS in recipient table
383 383
  * Value of the recipient trackstatus are same as OlResponseStatus but
@@ -385,282 +385,282 @@  discard block
 block discarded – undo
385 385
  * and olResponseNone has different interpretation with PR_RECIPIENT_TRACKSTATUS
386 386
  * so to avoid confusions we have defined new constants.
387 387
 */
388
-define('olRecipientTrackStatusNone'              ,0);
389
-define('olRecipientTrackStatusTentative'         ,2);
390
-define('olRecipientTrackStatusAccepted'          ,3);
391
-define('olRecipientTrackStatusDeclined'          ,4);
388
+define('olRecipientTrackStatusNone', 0);
389
+define('olRecipientTrackStatusTentative', 2);
390
+define('olRecipientTrackStatusAccepted', 3);
391
+define('olRecipientTrackStatusDeclined', 4);
392 392
 
393 393
 /* OlMeetingStatus */
394
-define('olNonMeeting'                            ,0);
395
-define('olMeeting'                               ,1);
396
-define('olMeetingReceived'                       ,3);
397
-define('olMeetingCanceled'                       ,5);
398
-define('olMeetingReceivedAndCanceled'            ,7);
394
+define('olNonMeeting', 0);
395
+define('olMeeting', 1);
396
+define('olMeetingReceived', 3);
397
+define('olMeetingCanceled', 5);
398
+define('olMeetingReceivedAndCanceled', 7);
399 399
 
400 400
 /*    OlMeetingResponse */
401
-define('olMeetingTentative'                      ,2);
402
-define('olMeetingAccepted'                       ,3);
403
-define('olMeetingDeclined'                       ,4);
401
+define('olMeetingTentative', 2);
402
+define('olMeetingAccepted', 3);
403
+define('olMeetingDeclined', 4);
404 404
 
405 405
 /* OL Attendee type */
406
-define('olAttendeeRequired'                      ,1);
407
-define('olAttendeeOptional'                      ,2);
408
-define('olAttendeeResource'                      ,3);
406
+define('olAttendeeRequired', 1);
407
+define('olAttendeeOptional', 2);
408
+define('olAttendeeResource', 3);
409 409
 
410 410
 /* task status */
411
-define('olTaskNotStarted'                        ,0);
412
-define('olTaskInProgress'                        ,1);
413
-define('olTaskComplete'                          ,2);
414
-define('olTaskWaiting'                           ,3);
415
-define('olTaskDeferred'                          ,4);
411
+define('olTaskNotStarted', 0);
412
+define('olTaskInProgress', 1);
413
+define('olTaskComplete', 2);
414
+define('olTaskWaiting', 3);
415
+define('olTaskDeferred', 4);
416 416
 
417 417
 /* restrictions */
418
-define('RES_AND'                                 ,0);
419
-define('RES_OR'                                  ,1);
420
-define('RES_NOT'                                 ,2);
421
-define('RES_CONTENT'                             ,3);
422
-define('RES_PROPERTY'                            ,4);
423
-define('RES_COMPAREPROPS'                        ,5);
424
-define('RES_BITMASK'                             ,6);
425
-define('RES_SIZE'                                ,7);
426
-define('RES_EXIST'                               ,8);
427
-define('RES_SUBRESTRICTION'                      ,9);
428
-define('RES_COMMENT'                             ,10);
418
+define('RES_AND', 0);
419
+define('RES_OR', 1);
420
+define('RES_NOT', 2);
421
+define('RES_CONTENT', 3);
422
+define('RES_PROPERTY', 4);
423
+define('RES_COMPAREPROPS', 5);
424
+define('RES_BITMASK', 6);
425
+define('RES_SIZE', 7);
426
+define('RES_EXIST', 8);
427
+define('RES_SUBRESTRICTION', 9);
428
+define('RES_COMMENT', 10);
429 429
 
430 430
 /* restriction compares */
431
-define('RELOP_LT'                                ,0);
432
-define('RELOP_LE'                                ,1);
433
-define('RELOP_GT'                                ,2);
434
-define('RELOP_GE'                                ,3);
435
-define('RELOP_EQ'                                ,4);
436
-define('RELOP_NE'                                ,5);
437
-define('RELOP_RE'                                ,6);
431
+define('RELOP_LT', 0);
432
+define('RELOP_LE', 1);
433
+define('RELOP_GT', 2);
434
+define('RELOP_GE', 3);
435
+define('RELOP_EQ', 4);
436
+define('RELOP_NE', 5);
437
+define('RELOP_RE', 6);
438 438
 
439 439
 /* string 'fuzzylevel' */
440
-define('FL_FULLSTRING'                           ,0x00000000);
441
-define('FL_SUBSTRING'                            ,0x00000001);
442
-define('FL_PREFIX'                               ,0x00000002);
443
-define('FL_IGNORECASE'                           ,0x00010000);
444
-define('FL_IGNORENONSPACE'                       ,0x00020000);
445
-define('FL_LOOSE'                                ,0x00040000);
440
+define('FL_FULLSTRING', 0x00000000);
441
+define('FL_SUBSTRING', 0x00000001);
442
+define('FL_PREFIX', 0x00000002);
443
+define('FL_IGNORECASE', 0x00010000);
444
+define('FL_IGNORENONSPACE', 0x00020000);
445
+define('FL_LOOSE', 0x00040000);
446 446
 
447 447
 /* bitmask restriction types */
448
-define('BMR_EQZ'                                 ,0x00000000);
449
-define('BMR_NEZ'                                 ,0x00000001);
448
+define('BMR_EQZ', 0x00000000);
449
+define('BMR_NEZ', 0x00000001);
450 450
 
451 451
 /* array index values of restrictions -- same values are used in php-ext/main.cpp::PHPArraytoSRestriction() */
452
-define('VALUE'                                   ,0);        // propval
453
-define('RELOP'                                   ,1);        // compare method
454
-define('FUZZYLEVEL'                              ,2);        // string search flags
455
-define('CB'                                      ,3);        // size restriction
456
-define('ULTYPE'                                  ,4);        // bit mask restriction type BMR_xxx
457
-define('ULMASK'                                  ,5);        // bitmask
458
-define('ULPROPTAG'                               ,6);        // property
459
-define('ULPROPTAG1'                              ,7);        // RES_COMPAREPROPS 1st property
460
-define('ULPROPTAG2'                              ,8);        // RES_COMPAREPROPS 2nd property
461
-define('PROPS'                                   ,9);        // RES_COMMENT properties
462
-define('RESTRICTION'                             ,10);       // RES_COMMENT and RES_SUBRESTRICTION restriction
452
+define('VALUE', 0); // propval
453
+define('RELOP', 1); // compare method
454
+define('FUZZYLEVEL', 2); // string search flags
455
+define('CB', 3); // size restriction
456
+define('ULTYPE', 4); // bit mask restriction type BMR_xxx
457
+define('ULMASK', 5); // bitmask
458
+define('ULPROPTAG', 6); // property
459
+define('ULPROPTAG1', 7); // RES_COMPAREPROPS 1st property
460
+define('ULPROPTAG2', 8); // RES_COMPAREPROPS 2nd property
461
+define('PROPS', 9); // RES_COMMENT properties
462
+define('RESTRICTION', 10); // RES_COMMENT and RES_SUBRESTRICTION restriction
463 463
 
464 464
 /* GUID's for PR_MDB_PROVIDER */
465
-define("ZARAFA_SERVICE_GUID"                     ,makeGuid("{3C253DCA-D227-443C-94FE-425FAB958C19}"));    // default store
466
-define("ZARAFA_STORE_PUBLIC_GUID"                ,makeGuid("{70FAB278-F7AF-CD11-9BC8-00AA002FC45A}"));    // public store
467
-define("ZARAFA_STORE_DELEGATE_GUID"              ,makeGuid("{7C7C1085-BC6D-4E53-9DAB-8A53F8DEF808}"));    // other store
468
-define('ZARAFA_STORE_ARCHIVER_GUID'              ,makeGuid("{BC8953AD-2E3F-4172-9404-896FF459870F}"));    // archive store
465
+define("ZARAFA_SERVICE_GUID", makeGuid("{3C253DCA-D227-443C-94FE-425FAB958C19}")); // default store
466
+define("ZARAFA_STORE_PUBLIC_GUID", makeGuid("{70FAB278-F7AF-CD11-9BC8-00AA002FC45A}")); // public store
467
+define("ZARAFA_STORE_DELEGATE_GUID", makeGuid("{7C7C1085-BC6D-4E53-9DAB-8A53F8DEF808}")); // other store
468
+define('ZARAFA_STORE_ARCHIVER_GUID', makeGuid("{BC8953AD-2E3F-4172-9404-896FF459870F}")); // archive store
469 469
 
470 470
 /* global profile section guid */
471
-define('pbGlobalProfileSectionGuid'              ,makeGuid("{C8B0DB13-05AA-1A10-9BB0-00AA002FC45A}"));
471
+define('pbGlobalProfileSectionGuid', makeGuid("{C8B0DB13-05AA-1A10-9BB0-00AA002FC45A}"));
472 472
 
473 473
 /* Zarafa Contacts provider GUID */
474
-define('ZARAFA_CONTACTS_GUID'                    ,makeGuid("{30047F72-92E3-DA4F-B86A-E52A7FE46571}"));
474
+define('ZARAFA_CONTACTS_GUID', makeGuid("{30047F72-92E3-DA4F-B86A-E52A7FE46571}"));
475 475
 
476 476
 /* Permissions */
477 477
 
478 478
 // Get permission type
479
-define('ACCESS_TYPE_DENIED'                      ,1);
480
-define('ACCESS_TYPE_GRANT'                       ,2);
481
-define('ACCESS_TYPE_BOTH'                        ,3);
482
-
483
-define('ecRightsNone'                            ,0x00000000);
484
-define('ecRightsReadAny'                         ,0x00000001);
485
-define('ecRightsCreate'                          ,0x00000002);
486
-define('ecRightsEditOwned'                       ,0x00000008);
487
-define('ecRightsDeleteOwned'                     ,0x00000010);
488
-define('ecRightsEditAny'                         ,0x00000020);
489
-define('ecRightsDeleteAny'                       ,0x00000040);
490
-define('ecRightsCreateSubfolder'                 ,0x00000080);
491
-define('ecRightsFolderAccess'                    ,0x00000100);
479
+define('ACCESS_TYPE_DENIED', 1);
480
+define('ACCESS_TYPE_GRANT', 2);
481
+define('ACCESS_TYPE_BOTH', 3);
482
+
483
+define('ecRightsNone', 0x00000000);
484
+define('ecRightsReadAny', 0x00000001);
485
+define('ecRightsCreate', 0x00000002);
486
+define('ecRightsEditOwned', 0x00000008);
487
+define('ecRightsDeleteOwned', 0x00000010);
488
+define('ecRightsEditAny', 0x00000020);
489
+define('ecRightsDeleteAny', 0x00000040);
490
+define('ecRightsCreateSubfolder', 0x00000080);
491
+define('ecRightsFolderAccess', 0x00000100);
492 492
 //define('ecrightsContact'                       ,0x00000200);
493
-define('ecRightsFolderVisible'                   ,0x00000400);
493
+define('ecRightsFolderVisible', 0x00000400);
494 494
 
495
-define('ecRightsAll'                             ,ecRightsReadAny | ecRightsCreate | ecRightsEditOwned | ecRightsDeleteOwned | ecRightsEditAny | ecRightsDeleteAny | ecRightsCreateSubfolder | ecRightsFolderAccess | ecRightsFolderVisible);
496
-define('ecRightsFullControl'                     ,ecRightsReadAny | ecRightsCreate | ecRightsEditOwned | ecRightsDeleteOwned | ecRightsEditAny | ecRightsDeleteAny | ecRightsCreateSubfolder | ecRightsFolderVisible);
497
-define('ecRightsDefault'                         ,ecRightsNone | ecRightsFolderVisible);
498
-define('ecRightsDefaultPublic'                   ,ecRightsReadAny | ecRightsFolderVisible);
499
-define('ecRightsAdmin'                           ,0x00001000);
500
-define('ecRightsAllMask'                         ,0x000015FB);
495
+define('ecRightsAll', ecRightsReadAny|ecRightsCreate|ecRightsEditOwned|ecRightsDeleteOwned|ecRightsEditAny|ecRightsDeleteAny|ecRightsCreateSubfolder|ecRightsFolderAccess|ecRightsFolderVisible);
496
+define('ecRightsFullControl', ecRightsReadAny|ecRightsCreate|ecRightsEditOwned|ecRightsDeleteOwned|ecRightsEditAny|ecRightsDeleteAny|ecRightsCreateSubfolder|ecRightsFolderVisible);
497
+define('ecRightsDefault', ecRightsNone|ecRightsFolderVisible);
498
+define('ecRightsDefaultPublic', ecRightsReadAny|ecRightsFolderVisible);
499
+define('ecRightsAdmin', 0x00001000);
500
+define('ecRightsAllMask', 0x000015FB);
501 501
 
502 502
 // Right change indication
503
-define('RIGHT_NORMAL'                            ,0x00);
504
-define('RIGHT_NEW'                               ,0x01);
505
-define('RIGHT_MODIFY'                            ,0x02);
506
-define('RIGHT_DELETED'                           ,0x04);
507
-define('RIGHT_AUTOUPDATE_DENIED'                 ,0x08);
503
+define('RIGHT_NORMAL', 0x00);
504
+define('RIGHT_NEW', 0x01);
505
+define('RIGHT_MODIFY', 0x02);
506
+define('RIGHT_DELETED', 0x04);
507
+define('RIGHT_AUTOUPDATE_DENIED', 0x08);
508 508
 
509 509
 // IExchangeModifyTable: defines for rules
510
-define('ROWLIST_REPLACE'                         ,0x0001);
511
-define('ROW_ADD'                                 ,0x0001);
512
-define('ROW_MODIFY'                              ,0x0002);
513
-define('ROW_REMOVE'                              ,0x0004);
514
-define('ROW_EMPTY'                               ,(ROW_ADD|ROW_REMOVE));
510
+define('ROWLIST_REPLACE', 0x0001);
511
+define('ROW_ADD', 0x0001);
512
+define('ROW_MODIFY', 0x0002);
513
+define('ROW_REMOVE', 0x0004);
514
+define('ROW_EMPTY', (ROW_ADD|ROW_REMOVE));
515 515
 
516 516
 // new property types
517
-define('PT_SRESTRICTION'                         ,0x00FD);
518
-define('PT_ACTIONS'                              ,0x00FE);
517
+define('PT_SRESTRICTION', 0x00FD);
518
+define('PT_ACTIONS', 0x00FE);
519 519
 // unused, I believe
520
-define('PT_FILE_HANDLE'                          ,0x0103);
521
-define('PT_FILE_EA'                              ,0x0104);
522
-define('PT_VIRTUAL'                              ,0x0105);
520
+define('PT_FILE_HANDLE', 0x0103);
521
+define('PT_FILE_EA', 0x0104);
522
+define('PT_VIRTUAL', 0x0105);
523 523
 
524 524
 // rules state
525
-define('ST_DISABLED'                             ,0x0000);
526
-define('ST_ENABLED'                              ,0x0001);
527
-define('ST_ERROR'                                ,0x0002);
528
-define('ST_ONLY_WHEN_OOF'                        ,0x0004);
529
-define('ST_KEEP_OOF_HIST'                        ,0x0008);
530
-define('ST_EXIT_LEVEL'                           ,0x0010);
531
-define('ST_SKIP_IF_SCL_IS_SAFE'                  ,0x0020);
532
-define('ST_RULE_PARSE_ERROR'                     ,0x0040);
533
-define('ST_CLEAR_OOF_HIST'                       ,0x80000000);
525
+define('ST_DISABLED', 0x0000);
526
+define('ST_ENABLED', 0x0001);
527
+define('ST_ERROR', 0x0002);
528
+define('ST_ONLY_WHEN_OOF', 0x0004);
529
+define('ST_KEEP_OOF_HIST', 0x0008);
530
+define('ST_EXIT_LEVEL', 0x0010);
531
+define('ST_SKIP_IF_SCL_IS_SAFE', 0x0020);
532
+define('ST_RULE_PARSE_ERROR', 0x0040);
533
+define('ST_CLEAR_OOF_HIST', 0x80000000);
534 534
 
535 535
 // action types
536
-define('OP_MOVE'                                 ,1);
537
-define('OP_COPY'                                 ,2);
538
-define('OP_REPLY'                                ,3);
539
-define('OP_OOF_REPLY'                            ,4);
540
-define('OP_DEFER_ACTION'                         ,5);
541
-define('OP_BOUNCE'                               ,6);
542
-define('OP_FORWARD'                              ,7);
543
-define('OP_DELEGATE'                             ,8);
544
-define('OP_TAG'                                  ,9);
545
-define('OP_DELETE'                               ,10);
546
-define('OP_MARK_AS_READ'                         ,11);
536
+define('OP_MOVE', 1);
537
+define('OP_COPY', 2);
538
+define('OP_REPLY', 3);
539
+define('OP_OOF_REPLY', 4);
540
+define('OP_DEFER_ACTION', 5);
541
+define('OP_BOUNCE', 6);
542
+define('OP_FORWARD', 7);
543
+define('OP_DELEGATE', 8);
544
+define('OP_TAG', 9);
545
+define('OP_DELETE', 10);
546
+define('OP_MARK_AS_READ', 11);
547 547
 
548 548
 // for OP_REPLY
549
-define('DO_NOT_SEND_TO_ORIGINATOR'               ,1);
550
-define('STOCK_REPLY_TEMPLATE'                    ,2);
549
+define('DO_NOT_SEND_TO_ORIGINATOR', 1);
550
+define('STOCK_REPLY_TEMPLATE', 2);
551 551
 
552 552
 // for OP_FORWARD
553
-define('FWD_PRESERVE_SENDER'                     ,1);
554
-define('FWD_DO_NOT_MUNGE_MSG'                    ,2);
555
-define('FWD_AS_ATTACHMENT'                       ,4);
553
+define('FWD_PRESERVE_SENDER', 1);
554
+define('FWD_DO_NOT_MUNGE_MSG', 2);
555
+define('FWD_AS_ATTACHMENT', 4);
556 556
 
557 557
 // scBounceCodevalues
558
-define('BOUNCE_MESSAGE_SIZE_TOO_LARGE'           ,13);
559
-define('BOUNCE_FORMS_MISMATCH'                   ,31);
560
-define('BOUNCE_ACCESS_DENIED'                    ,38);
558
+define('BOUNCE_MESSAGE_SIZE_TOO_LARGE', 13);
559
+define('BOUNCE_FORMS_MISMATCH', 31);
560
+define('BOUNCE_ACCESS_DENIED', 38);
561 561
 
562 562
 // Free/busystatus
563
-define('fbFree'                                  ,0);
564
-define('fbTentative'                             ,1);
565
-define('fbBusy'                                  ,2);
566
-define('fbOutOfOffice'                           ,3);
567
-define('fbWorkingElsewhere'                      ,4);
568
-define('fbNoData'                                ,4);
563
+define('fbFree', 0);
564
+define('fbTentative', 1);
565
+define('fbBusy', 2);
566
+define('fbOutOfOffice', 3);
567
+define('fbWorkingElsewhere', 4);
568
+define('fbNoData', 4);
569 569
 
570 570
 /* ICS flags */
571 571
 
572 572
 // For Synchronize()
573
-define('SYNC_UNICODE'                            ,0x01);
574
-define('SYNC_NO_DELETIONS'                       ,0x02);
575
-define('SYNC_NO_SOFT_DELETIONS'                  ,0x04);
576
-define('SYNC_READ_STATE'                         ,0x08);
577
-define('SYNC_ASSOCIATED'                         ,0x10);
578
-define('SYNC_NORMAL'                             ,0x20);
579
-define('SYNC_NO_CONFLICTS'                       ,0x40);
580
-define('SYNC_ONLY_SPECIFIED_PROPS'               ,0x80);
581
-define('SYNC_NO_FOREIGN_KEYS'                    ,0x100);
582
-define('SYNC_LIMITED_IMESSAGE'                   ,0x200);
583
-define('SYNC_CATCHUP'                            ,0x400);
584
-define('SYNC_NEW_MESSAGE'                        ,0x800);         // only applicable to ImportMessageChange()
585
-define('SYNC_MSG_SELECTIVE'                      ,0x1000);        // Used internally.      Will reject if used by clients.
586
-define('SYNC_BEST_BODY'                          ,0x2000);
587
-define('SYNC_IGNORE_SPECIFIED_ON_ASSOCIATED'     ,0x4000);
588
-define('SYNC_PROGRESS_MODE'                      ,0x8000);        // AirMapi progress mode
589
-define('SYNC_FXRECOVERMODE'                      ,0x10000);
590
-define('SYNC_DEFER_CONFIG'                       ,0x20000);
591
-define('SYNC_FORCE_UNICODE'                      ,0x40000);       // Forces server to return Unicode properties
592
-define('SYNC_STATE_READONLY'                     ,0x80000);       // Server will not update the states in the DB, setting up exporter with this flag states are read only
593
-
594
-define('EMS_AB_ADDRESS_LOOKUP'                   ,0x00000001);    // Flag for resolvename to resolve only exact matches
595
-
596
-define('TBL_BATCH'                               ,0x00000002);    // Batch multiple table commands
573
+define('SYNC_UNICODE', 0x01);
574
+define('SYNC_NO_DELETIONS', 0x02);
575
+define('SYNC_NO_SOFT_DELETIONS', 0x04);
576
+define('SYNC_READ_STATE', 0x08);
577
+define('SYNC_ASSOCIATED', 0x10);
578
+define('SYNC_NORMAL', 0x20);
579
+define('SYNC_NO_CONFLICTS', 0x40);
580
+define('SYNC_ONLY_SPECIFIED_PROPS', 0x80);
581
+define('SYNC_NO_FOREIGN_KEYS', 0x100);
582
+define('SYNC_LIMITED_IMESSAGE', 0x200);
583
+define('SYNC_CATCHUP', 0x400);
584
+define('SYNC_NEW_MESSAGE', 0x800); // only applicable to ImportMessageChange()
585
+define('SYNC_MSG_SELECTIVE', 0x1000); // Used internally.      Will reject if used by clients.
586
+define('SYNC_BEST_BODY', 0x2000);
587
+define('SYNC_IGNORE_SPECIFIED_ON_ASSOCIATED', 0x4000);
588
+define('SYNC_PROGRESS_MODE', 0x8000); // AirMapi progress mode
589
+define('SYNC_FXRECOVERMODE', 0x10000);
590
+define('SYNC_DEFER_CONFIG', 0x20000);
591
+define('SYNC_FORCE_UNICODE', 0x40000); // Forces server to return Unicode properties
592
+define('SYNC_STATE_READONLY', 0x80000); // Server will not update the states in the DB, setting up exporter with this flag states are read only
593
+
594
+define('EMS_AB_ADDRESS_LOOKUP', 0x00000001); // Flag for resolvename to resolve only exact matches
595
+
596
+define('TBL_BATCH', 0x00000002); // Batch multiple table commands
597 597
 
598 598
 /* Flags for recipients in exceptions */
599
-define('recipSendable'                           ,0x00000001);    // sendable attendee.
600
-define('recipOrganizer'                          ,0x00000002);    // meeting organizer
601
-define('recipExceptionalResponse'                ,0x00000010);    // attendee gave a response for the exception
602
-define('recipExceptionalDeleted'                 ,0x00000020);    // recipientRow exists, but it is treated as if the corresponding recipient is deleted from meeting
603
-define('recipOriginal'                           ,0x00000100);    // recipient is an original Attendee
604
-define('recipReserved'                           ,0x00000200);
599
+define('recipSendable', 0x00000001); // sendable attendee.
600
+define('recipOrganizer', 0x00000002); // meeting organizer
601
+define('recipExceptionalResponse', 0x00000010); // attendee gave a response for the exception
602
+define('recipExceptionalDeleted', 0x00000020); // recipientRow exists, but it is treated as if the corresponding recipient is deleted from meeting
603
+define('recipOriginal', 0x00000100); // recipient is an original Attendee
604
+define('recipReserved', 0x00000200);
605 605
 
606 606
 /* Flags which indicates type of Meeting Object */
607
-define('mtgEmpty'                                ,0x00000000);    // Unspecified.
608
-define('mtgRequest'                              ,0x00000001);    // Initial meeting request.
609
-define('mtgFull'                                 ,0x00010000);    // Full update.
610
-define('mtgInfo'                                 ,0x00020000);    // Informational update.
611
-define('mtgOutOfDate'                            ,0x00080000);    // A newer Meeting Request object or Meeting Update object was received after this one.
612
-define('mtgDelegatorCopy'                        ,0x00100000);    // This is set on the delegator's copy when a delegate will handle meeting-related objects.
607
+define('mtgEmpty', 0x00000000); // Unspecified.
608
+define('mtgRequest', 0x00000001); // Initial meeting request.
609
+define('mtgFull', 0x00010000); // Full update.
610
+define('mtgInfo', 0x00020000); // Informational update.
611
+define('mtgOutOfDate', 0x00080000); // A newer Meeting Request object or Meeting Update object was received after this one.
612
+define('mtgDelegatorCopy', 0x00100000); // This is set on the delegator's copy when a delegate will handle meeting-related objects.
613 613
 
614
-define('MAPI_ONE_OFF_UNICODE'                    ,0x8000);        // the flag that defines whether the embedded strings are Unicode in one off entryids.
615
-define('MAPI_ONE_OFF_NO_RICH_INFO'               ,0x0001);        // the flag that specifies whether the recipient gets TNEF or not.
614
+define('MAPI_ONE_OFF_UNICODE', 0x8000); // the flag that defines whether the embedded strings are Unicode in one off entryids.
615
+define('MAPI_ONE_OFF_NO_RICH_INFO', 0x0001); // the flag that specifies whether the recipient gets TNEF or not.
616 616
 
617 617
 /* Mask flags for mapi_msgstore_advise */
618
-define('fnevCriticalError'                       ,0x00000001);
619
-define('fnevNewMail'                             ,0x00000002);
620
-define('fnevObjectCreated'                       ,0x00000004);
621
-define('fnevObjectDeleted'                       ,0x00000008);
622
-define('fnevObjectModified'                      ,0x00000010);
623
-define('fnevObjectMoved'                         ,0x00000020);
624
-define('fnevObjectCopied'                        ,0x00000040);
625
-define('fnevSearchComplete'                      ,0x00000080);
626
-define('fnevTableModified'                       ,0x00000100);
627
-define('fnevStatusObjectModified'                ,0x00000200);
628
-define('fnevReservedForMapi'                     ,0x40000000);
629
-define('fnevExtended'                            ,0x80000000);
618
+define('fnevCriticalError', 0x00000001);
619
+define('fnevNewMail', 0x00000002);
620
+define('fnevObjectCreated', 0x00000004);
621
+define('fnevObjectDeleted', 0x00000008);
622
+define('fnevObjectModified', 0x00000010);
623
+define('fnevObjectMoved', 0x00000020);
624
+define('fnevObjectCopied', 0x00000040);
625
+define('fnevSearchComplete', 0x00000080);
626
+define('fnevTableModified', 0x00000100);
627
+define('fnevStatusObjectModified', 0x00000200);
628
+define('fnevReservedForMapi', 0x40000000);
629
+define('fnevExtended', 0x80000000);
630 630
 
631 631
 /* PersistBlockType values PR_IPM_OL2007_ENTRYIDS / PR_ADDITIONAL_REN_ENTRYIDS_EX PersistIDs*/
632
-define('PERSIST_SENTINEL'                        ,0x0000); // Indicates that the PersistData structure is the last one contained in the PidTagAdditionalRenEntryIdsEx property
633
-define('RSF_PID_RSS_SUBSCRIPTION'                ,0x8001); // Indicates that the structure contains data for the RSS Feeds folder
634
-define('RSF_PID_SEND_AND_TRACK'                  ,0x8002); // Indicates that the structure contains data for the Tracked Mail Processing folder
635
-define('RSF_PID_TODO_SEARCH'                     ,0x8004); // Indicates that the structure contains data for the To-Do folder
636
-define('RSF_PID_CONV_ACTIONS'                    ,0x8006); // Indicates that the structure contains data for the Conversation Action Settings folder
637
-define('RSF_PID_COMBINED_ACTIONS'                ,0x8007); // This value is reserved.
638
-define('RSF_PID_SUGGESTED_CONTACTS'              ,0x8008); // Indicates that the structure contains data for the Suggested Contacts folder.
639
-define('RSF_PID_CONTACT_SEARCH'                  ,0x8009); // Indicates that the structure contains data for the Contacts Search folder.
640
-define('RSF_PID_BUDDYLIST_PDLS'                  ,0x800A); // Indicates that the structure contains data for the IM Contacts List folder.
641
-define('RSF_PID_BUDDYLIST_CONTACTS'              ,0x800B); // Indicates that the structure contains data for the Quick Contacts folder.
632
+define('PERSIST_SENTINEL', 0x0000); // Indicates that the PersistData structure is the last one contained in the PidTagAdditionalRenEntryIdsEx property
633
+define('RSF_PID_RSS_SUBSCRIPTION', 0x8001); // Indicates that the structure contains data for the RSS Feeds folder
634
+define('RSF_PID_SEND_AND_TRACK', 0x8002); // Indicates that the structure contains data for the Tracked Mail Processing folder
635
+define('RSF_PID_TODO_SEARCH', 0x8004); // Indicates that the structure contains data for the To-Do folder
636
+define('RSF_PID_CONV_ACTIONS', 0x8006); // Indicates that the structure contains data for the Conversation Action Settings folder
637
+define('RSF_PID_COMBINED_ACTIONS', 0x8007); // This value is reserved.
638
+define('RSF_PID_SUGGESTED_CONTACTS', 0x8008); // Indicates that the structure contains data for the Suggested Contacts folder.
639
+define('RSF_PID_CONTACT_SEARCH', 0x8009); // Indicates that the structure contains data for the Contacts Search folder.
640
+define('RSF_PID_BUDDYLIST_PDLS', 0x800A); // Indicates that the structure contains data for the IM Contacts List folder.
641
+define('RSF_PID_BUDDYLIST_CONTACTS', 0x800B); // Indicates that the structure contains data for the Quick Contacts folder.
642 642
 
643 643
 /* PersistElementType Values ElementIDs for persist data of PR_IPM_OL2007_ENTRYIDS / PR_ADDITIONAL_REN_ENTRYIDS_EX */
644
-define('ELEMENT_SENTINEL'                        ,0x0000); // 0 bytes Indicates that the PersistElement structure is the last one contained in the DataElements field of the PersistData structure.
645
-define('RSF_ELID_ENTRYID'                        ,0x0001); // variable Indicates that the ElementData field contains the entry ID of the special folder
644
+define('ELEMENT_SENTINEL', 0x0000); // 0 bytes Indicates that the PersistElement structure is the last one contained in the DataElements field of the PersistData structure.
645
+define('RSF_ELID_ENTRYID', 0x0001); // variable Indicates that the ElementData field contains the entry ID of the special folder
646 646
                                                            // that is of the type indicated by the value of the PersistID field of the PersistData structure.
647
-define('RSF_ELID_HEADER'                         ,0x0002); // 4 bytes Indicates that the ElementData field contains a 4-byte header value equal to 0x00000000.
648
-
649
-define('STGM_DIRECT'                             ,0x00000000);
650
-define('STGM_TRANSACTED'                         ,0x00010000);
651
-define('STGM_SIMPLE'                             ,0x08000000);
652
-define('STGM_READ'                               ,0x00000000);
653
-define('STGM_WRITE'                              ,0x00000001);
654
-define('STGM_READWRITE'                          ,0x00000002);
655
-define('STGM_SHARE_DENY_NONE'                    ,0x00000040);
656
-define('STGM_SHARE_DENY_READ'                    ,0x00000030);
657
-define('STGM_SHARE_DENY_WRITE'                   ,0x00000020);
658
-define('STGM_SHARE_EXCLUSIVE'                    ,0x00000010);
659
-define('STGM_PRIORITY'                           ,0x00040000);
660
-define('STGM_DELETEONRELEASE'                    ,0x04000000);
661
-define('STGM_NOSCRATCH'                          ,0x00100000);
662
-define('STGM_CREATE'                             ,0x00001000);
663
-define('STGM_CONVERT'                            ,0x00020000);
664
-define('STGM_FAILIFTHERE'                        ,0x00000000);
665
-define('STGM_NOSNAPSHOT'                         ,0x00200000);
666
-define('STGM_DIRECT_SWMR'                        ,0x00400000);
647
+define('RSF_ELID_HEADER', 0x0002); // 4 bytes Indicates that the ElementData field contains a 4-byte header value equal to 0x00000000.
648
+
649
+define('STGM_DIRECT', 0x00000000);
650
+define('STGM_TRANSACTED', 0x00010000);
651
+define('STGM_SIMPLE', 0x08000000);
652
+define('STGM_READ', 0x00000000);
653
+define('STGM_WRITE', 0x00000001);
654
+define('STGM_READWRITE', 0x00000002);
655
+define('STGM_SHARE_DENY_NONE', 0x00000040);
656
+define('STGM_SHARE_DENY_READ', 0x00000030);
657
+define('STGM_SHARE_DENY_WRITE', 0x00000020);
658
+define('STGM_SHARE_EXCLUSIVE', 0x00000010);
659
+define('STGM_PRIORITY', 0x00040000);
660
+define('STGM_DELETEONRELEASE', 0x04000000);
661
+define('STGM_NOSCRATCH', 0x00100000);
662
+define('STGM_CREATE', 0x00001000);
663
+define('STGM_CONVERT', 0x00020000);
664
+define('STGM_FAILIFTHERE', 0x00000000);
665
+define('STGM_NOSNAPSHOT', 0x00200000);
666
+define('STGM_DIRECT_SWMR', 0x00400000);
Please login to merge, or discard this patch.
mapi/mapi.util.php 1 patch
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
  */
24 24
 function makeGuid($guid)
25 25
 {
26
-    return pack("vvvv", hexdec(substr($guid, 5, 4)), hexdec(substr($guid, 1, 4)), hexdec(substr($guid, 10, 4)), hexdec(substr($guid, 15, 4))) . hex2bin(substr($guid, 20, 4)) . hex2bin(substr($guid, 25, 12));
26
+    return pack("vvvv", hexdec(substr($guid, 5, 4)), hexdec(substr($guid, 1, 4)), hexdec(substr($guid, 10, 4)), hexdec(substr($guid, 15, 4))).hex2bin(substr($guid, 20, 4)).hex2bin(substr($guid, 25, 12));
27 27
 }
28 28
 
29 29
 /**
@@ -32,9 +32,9 @@  discard block
 block discarded – undo
32 32
  *@param int $errcode the MAPI error code, if not given, we use mapi_last_hresult
33 33
  *@return string The defined name for the MAPI error code
34 34
  */
35
-function get_mapi_error_name($errcode=null)
35
+function get_mapi_error_name($errcode = null)
36 36
 {
37
-    if ($errcode === null){
37
+    if ($errcode === null) {
38 38
         $errcode = mapi_last_hresult();
39 39
     }
40 40
 
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
              * we have to manually typecast value to integer, so float will be converted in integer,
49 49
              * but still its out of bound for integer limit so it will be auto adjusted to minus value
50 50
              */
51
-            if ($errcode == (int) $value) {
51
+            if ($errcode == (int)$value) {
52 52
                 // Check that we have an actual MAPI error or warning definition
53 53
                 $prefix = substr($key, 0, 7);
54 54
                 if ($prefix == "MAPI_E_" || $prefix == "MAPI_W_") {
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
 
63 63
     // error code not found, return hex value (this is a fix for 64-bit systems, we can't use the dechex() function for this)
64 64
     $result = unpack("H*", pack("N", $errcode));
65
-    return "0x" . $result[1];
65
+    return "0x".$result[1];
66 66
 }
67 67
 
68 68
 /**
@@ -82,28 +82,28 @@  discard block
 block discarded – undo
82 82
     // caching
83 83
     $guids = array();
84 84
 
85
-    foreach($mapping as $name=>$val){
86
-        if(is_string($val)) {
85
+    foreach ($mapping as $name=>$val) {
86
+        if (is_string($val)) {
87 87
             $split = explode(":", $val);
88 88
 
89
-            if(count($split) != 3){ // invalid string, ignore
90
-                trigger_error(sprintf("Invalid property: %s \"%s\"",$name,$val), E_USER_NOTICE);
89
+            if (count($split) != 3) { // invalid string, ignore
90
+                trigger_error(sprintf("Invalid property: %s \"%s\"", $name, $val), E_USER_NOTICE);
91 91
                 continue;
92 92
             }
93 93
 
94
-            if(substr($split[2], 0, 2) == "0x") {
94
+            if (substr($split[2], 0, 2) == "0x") {
95 95
                 $id = hexdec(substr($split[2], 2));
96 96
             } else {
97 97
                 $id = $split[2];
98 98
             }
99 99
 
100 100
             // have we used this guid before?
101
-            if (!defined($split[1])){
102
-                if (!array_key_exists($split[1], $guids)){
101
+            if (!defined($split[1])) {
102
+                if (!array_key_exists($split[1], $guids)) {
103 103
                     $guids[$split[1]] = makeguid($split[1]);
104 104
                 }
105 105
                 $guid = $guids[$split[1]];
106
-            }else{
106
+            } else {
107 107
                 $guid = constant($split[1]);
108 108
             }
109 109
 
@@ -113,19 +113,19 @@  discard block
 block discarded – undo
113 113
             $ids["guid"][$num] = $guid;
114 114
             $ids["type"][$num] = $split[0];
115 115
             $num++;
116
-        }else{
116
+        } else {
117 117
             // not a named property
118 118
             $props[$name] = $val;
119 119
         }
120 120
     }
121 121
 
122
-    if (empty($ids["id"])){
122
+    if (empty($ids["id"])) {
123 123
         return $props;
124 124
     }
125 125
 
126 126
     // get the ids
127 127
     $named = mapi_getidsfromnames($store, $ids["id"], $ids["guid"]);
128
-    foreach($named as $num=>$prop){
128
+    foreach ($named as $num=>$prop) {
129 129
         $props[$ids["name"][$num]] = mapi_prop_tag(constant($ids["type"][$num]), mapi_prop_id($prop));
130 130
     }
131 131
 
@@ -190,9 +190,9 @@  discard block
 block discarded – undo
190 190
  * @param $rows array Array of rowdata as if they were returned directly from mapi_table_queryrows. Each recurring item is
191 191
  *                    expanded so that it seems that there are only many single appointments in the table.
192 192
  */
193
-function getCalendarItems($store, $calendar, $viewstart, $viewend, $propsrequested){
193
+function getCalendarItems($store, $calendar, $viewstart, $viewend, $propsrequested) {
194 194
     $result = array();
195
-    $properties = getPropIdsFromStrings($store, Array( "duedate" => "PT_SYSTIME:PSETID_Appointment:0x820e",
195
+    $properties = getPropIdsFromStrings($store, Array("duedate" => "PT_SYSTIME:PSETID_Appointment:0x820e",
196 196
                                                "startdate" =>  "PT_SYSTIME:PSETID_Appointment:0x820d",
197 197
                                                "enddate_recurring" => "PT_SYSTIME:PSETID_Appointment:0x8236",
198 198
                                                "recurring" => "PT_BOOLEAN:PSETID_Appointment:0x8223",
@@ -210,7 +210,7 @@  discard block
 block discarded – undo
210 210
         // OR
211 211
         Array(RES_OR,
212 212
                  Array(
213
-                       Array(RES_AND,    // Normal items: itemEnd must be after viewStart, itemStart must be before viewEnd
213
+                       Array(RES_AND, // Normal items: itemEnd must be after viewStart, itemStart must be before viewEnd
214 214
                              Array(
215 215
                                    Array(RES_PROPERTY,
216 216
                                          Array(RELOP => RELOP_GT,
@@ -234,7 +234,7 @@  discard block
 block discarded – undo
234 234
                                    )
235 235
                              )
236 236
                        ) // EXISTS OR
237
-                 );        // global OR
237
+                 ); // global OR
238 238
 
239 239
     // Get requested properties, plus whatever we need
240 240
     $proplist = array(PR_ENTRYID, $properties["recurring"], $properties["recurring_data"], $properties["timezone_data"]);
@@ -244,16 +244,16 @@  discard block
 block discarded – undo
244 244
 
245 245
     // $rows now contains all the items that MAY be in the window; a recurring item needs expansion before including in the output.
246 246
 
247
-    foreach($rows as $row) {
247
+    foreach ($rows as $row) {
248 248
         $items = array();
249 249
 
250
-        if(isset($row[$properties["recurring"]]) && $row[$properties["recurring"]]) {
250
+        if (isset($row[$properties["recurring"]]) && $row[$properties["recurring"]]) {
251 251
             // Recurring item
252 252
             $rec = new Recurrence($store, $row);
253 253
 
254 254
             // GetItems guarantees that the item overlaps the interval <$viewstart, $viewend>
255 255
             $occurrences = $rec->getItems($viewstart, $viewend);
256
-            foreach($occurrences as $occurrence) {
256
+            foreach ($occurrences as $occurrence) {
257 257
                 // The occurrence takes all properties from the main row, but overrides some properties (like start and end obviously)
258 258
                 $item = $occurrence + $row;
259 259
                 array_push($items, $item);
@@ -264,7 +264,7 @@  discard block
 block discarded – undo
264 264
             array_push($items, $row);
265 265
         }
266 266
 
267
-        $result = array_merge($result,$items);
267
+        $result = array_merge($result, $items);
268 268
     }
269 269
 
270 270
     // All items are guaranteed to overlap the interval <$viewstart, $viewend>. Note that we may be returning a few extra
Please login to merge, or discard this patch.
mapi/mapicode.php 1 patch
Spacing   +96 added lines, -96 removed lines patch added patch discarded remove patch
@@ -15,9 +15,9 @@  discard block
 block discarded – undo
15 15
 //
16 16
 // Success codes
17 17
 //
18
-define('S_OK',               0x00000000);
19
-define('S_FALSE',            0x00000001);
20
-define('SEVERITY_ERROR',     1);
18
+define('S_OK', 0x00000000);
19
+define('S_FALSE', 0x00000001);
20
+define('SEVERITY_ERROR', 1);
21 21
 
22 22
 /* from winerror.h */
23 23
 
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
 */
27 27
 function make_mapi_e($code)
28 28
 {
29
-    return (int) mapi_make_scode(1, $code);
29
+    return (int)mapi_make_scode(1, $code);
30 30
 }
31 31
 
32 32
 
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
 */
36 36
 function make_mapi_s($code)
37 37
 {
38
-    return (int) mapi_make_scode(0, $code);
38
+    return (int)mapi_make_scode(0, $code);
39 39
 }
40 40
 
41 41
 /* From mapicode.h */
@@ -81,128 +81,128 @@  discard block
 block discarded – undo
81 81
  *      Code - is the facility's status code
82 82
  *
83 83
  */
84
-define('NOERROR'                                         ,0);
84
+define('NOERROR', 0);
85 85
 
86 86
 // The following codes don't use make_mapi_e because they are in the 0x000FF000 range,
87 87
 // but we cannot use the HEX value as would make most sense as that would break in 64bit PHP
88 88
 // (grommunio will return a negative value, but PHP would convert this define into a positive
89 89
 // value). Hence we declare the value exactly as we need it as integer and bypass the
90 90
 // 32bit/64bit hell.
91
-define('MAPI_E_CALL_FAILED'                              ,(int)-2147467259); // 0x80004005
92
-define('MAPI_E_NOT_ENOUGH_MEMORY'                        ,(int)-2147024882); // 0x8007000E
93
-define('MAPI_E_INVALID_PARAMETER'                        ,(int)-2147024809); // 0x80070057
94
-define('MAPI_E_INTERFACE_NOT_SUPPORTED'                  ,(int)-2147467262); // 0x80004002
95
-define('MAPI_E_NO_ACCESS'                                ,(int)-2147024891); // 0x80070005
96
-
97
-define('MAPI_E_NO_SUPPORT'                               ,make_mapi_e(0x102));
98
-define('MAPI_E_BAD_CHARWIDTH'                            ,make_mapi_e(0x103));
99
-define('MAPI_E_STRING_TOO_LONG'                          ,make_mapi_e(0x105));
100
-define('MAPI_E_UNKNOWN_FLAGS'                            ,make_mapi_e(0x106));
101
-define('MAPI_E_INVALID_ENTRYID'                          ,make_mapi_e(0x107));
102
-define('MAPI_E_INVALID_OBJECT'                           ,make_mapi_e(0x108));
103
-define('MAPI_E_OBJECT_CHANGED'                           ,make_mapi_e(0x109));
104
-define('MAPI_E_OBJECT_DELETED'                           ,make_mapi_e(0x10A));
105
-define('MAPI_E_BUSY'                                     ,make_mapi_e(0x10B));
106
-define('MAPI_E_NOT_ENOUGH_DISK'                          ,make_mapi_e(0x10D));
107
-define('MAPI_E_NOT_ENOUGH_RESOURCES'                     ,make_mapi_e(0x10E));
108
-define('MAPI_E_NOT_FOUND'                                ,make_mapi_e(0x10F));
109
-define('MAPI_E_VERSION'                                  ,make_mapi_e(0x110));
110
-define('MAPI_E_LOGON_FAILED'                             ,make_mapi_e(0x111));
111
-define('MAPI_E_SESSION_LIMIT'                            ,make_mapi_e(0x112));
112
-define('MAPI_E_USER_CANCEL'                              ,make_mapi_e(0x113));
113
-define('MAPI_E_UNABLE_TO_ABORT'                          ,make_mapi_e(0x114));
114
-define('MAPI_E_NETWORK_ERROR'                            ,make_mapi_e(0x115));
115
-define('MAPI_E_DISK_ERROR'                               ,make_mapi_e(0x116));
116
-define('MAPI_E_TOO_COMPLEX'                              ,make_mapi_e(0x117));
117
-define('MAPI_E_BAD_COLUMN'                               ,make_mapi_e(0x118));
118
-define('MAPI_E_EXTENDED_ERROR'                           ,make_mapi_e(0x119));
119
-define('MAPI_E_COMPUTED'                                 ,make_mapi_e(0x11A));
120
-define('MAPI_E_CORRUPT_DATA'                             ,make_mapi_e(0x11B));
121
-define('MAPI_E_UNCONFIGURED'                             ,make_mapi_e(0x11C));
122
-define('MAPI_E_FAILONEPROVIDER'                          ,make_mapi_e(0x11D));
123
-define('MAPI_E_UNKNOWN_CPID'                             ,make_mapi_e(0x11E));
124
-define('MAPI_E_UNKNOWN_LCID'                             ,make_mapi_e(0x11F));
91
+define('MAPI_E_CALL_FAILED', (int)-2147467259); // 0x80004005
92
+define('MAPI_E_NOT_ENOUGH_MEMORY', (int)-2147024882); // 0x8007000E
93
+define('MAPI_E_INVALID_PARAMETER', (int)-2147024809); // 0x80070057
94
+define('MAPI_E_INTERFACE_NOT_SUPPORTED', (int)-2147467262); // 0x80004002
95
+define('MAPI_E_NO_ACCESS', (int)-2147024891); // 0x80070005
96
+
97
+define('MAPI_E_NO_SUPPORT', make_mapi_e(0x102));
98
+define('MAPI_E_BAD_CHARWIDTH', make_mapi_e(0x103));
99
+define('MAPI_E_STRING_TOO_LONG', make_mapi_e(0x105));
100
+define('MAPI_E_UNKNOWN_FLAGS', make_mapi_e(0x106));
101
+define('MAPI_E_INVALID_ENTRYID', make_mapi_e(0x107));
102
+define('MAPI_E_INVALID_OBJECT', make_mapi_e(0x108));
103
+define('MAPI_E_OBJECT_CHANGED', make_mapi_e(0x109));
104
+define('MAPI_E_OBJECT_DELETED', make_mapi_e(0x10A));
105
+define('MAPI_E_BUSY', make_mapi_e(0x10B));
106
+define('MAPI_E_NOT_ENOUGH_DISK', make_mapi_e(0x10D));
107
+define('MAPI_E_NOT_ENOUGH_RESOURCES', make_mapi_e(0x10E));
108
+define('MAPI_E_NOT_FOUND', make_mapi_e(0x10F));
109
+define('MAPI_E_VERSION', make_mapi_e(0x110));
110
+define('MAPI_E_LOGON_FAILED', make_mapi_e(0x111));
111
+define('MAPI_E_SESSION_LIMIT', make_mapi_e(0x112));
112
+define('MAPI_E_USER_CANCEL', make_mapi_e(0x113));
113
+define('MAPI_E_UNABLE_TO_ABORT', make_mapi_e(0x114));
114
+define('MAPI_E_NETWORK_ERROR', make_mapi_e(0x115));
115
+define('MAPI_E_DISK_ERROR', make_mapi_e(0x116));
116
+define('MAPI_E_TOO_COMPLEX', make_mapi_e(0x117));
117
+define('MAPI_E_BAD_COLUMN', make_mapi_e(0x118));
118
+define('MAPI_E_EXTENDED_ERROR', make_mapi_e(0x119));
119
+define('MAPI_E_COMPUTED', make_mapi_e(0x11A));
120
+define('MAPI_E_CORRUPT_DATA', make_mapi_e(0x11B));
121
+define('MAPI_E_UNCONFIGURED', make_mapi_e(0x11C));
122
+define('MAPI_E_FAILONEPROVIDER', make_mapi_e(0x11D));
123
+define('MAPI_E_UNKNOWN_CPID', make_mapi_e(0x11E));
124
+define('MAPI_E_UNKNOWN_LCID', make_mapi_e(0x11F));
125 125
 
126 126
 /* Flavors of E_ACCESSDENIED, used at logon */
127 127
 
128
-define('MAPI_E_PASSWORD_CHANGE_REQUIRED'                 ,make_mapi_e(0x120));
129
-define('MAPI_E_PASSWORD_EXPIRED'                         ,make_mapi_e(0x121));
130
-define('MAPI_E_INVALID_WORKSTATION_ACCOUNT'              ,make_mapi_e(0x122));
131
-define('MAPI_E_INVALID_ACCESS_TIME'                      ,make_mapi_e(0x123));
132
-define('MAPI_E_ACCOUNT_DISABLED'                         ,make_mapi_e(0x124));
133
-define('MAPI_E_WEBAPP_FEATURE_DISABLED'                  ,make_mapi_e(0x125));
128
+define('MAPI_E_PASSWORD_CHANGE_REQUIRED', make_mapi_e(0x120));
129
+define('MAPI_E_PASSWORD_EXPIRED', make_mapi_e(0x121));
130
+define('MAPI_E_INVALID_WORKSTATION_ACCOUNT', make_mapi_e(0x122));
131
+define('MAPI_E_INVALID_ACCESS_TIME', make_mapi_e(0x123));
132
+define('MAPI_E_ACCOUNT_DISABLED', make_mapi_e(0x124));
133
+define('MAPI_E_WEBAPP_FEATURE_DISABLED', make_mapi_e(0x125));
134 134
 
135 135
 /* MAPI base function and status object specific errors and warnings */
136 136
 
137
-define('MAPI_E_END_OF_SESSION'                           ,make_mapi_e(0x200));
138
-define('MAPI_E_UNKNOWN_ENTRYID'                          ,make_mapi_e(0x201));
139
-define('MAPI_E_MISSING_REQUIRED_COLUMN'                  ,make_mapi_e(0x202));
140
-define('MAPI_W_NO_SERVICE'                               ,make_mapi_s(0x203));
137
+define('MAPI_E_END_OF_SESSION', make_mapi_e(0x200));
138
+define('MAPI_E_UNKNOWN_ENTRYID', make_mapi_e(0x201));
139
+define('MAPI_E_MISSING_REQUIRED_COLUMN', make_mapi_e(0x202));
140
+define('MAPI_W_NO_SERVICE', make_mapi_s(0x203));
141 141
 
142 142
 /* Property specific errors and warnings */
143 143
 
144
-define('MAPI_E_BAD_VALUE'                                ,make_mapi_e(0x301));
145
-define('MAPI_E_INVALID_TYPE'                             ,make_mapi_e(0x302));
146
-define('MAPI_E_TYPE_NO_SUPPORT'                          ,make_mapi_e(0x303));
147
-define('MAPI_E_UNEXPECTED_TYPE'                          ,make_mapi_e(0x304));
148
-define('MAPI_E_TOO_BIG'                                  ,make_mapi_e(0x305));
149
-define('MAPI_E_DECLINE_COPY'                             ,make_mapi_e(0x306));
150
-define('MAPI_E_UNEXPECTED_ID'                            ,make_mapi_e(0x307));
144
+define('MAPI_E_BAD_VALUE', make_mapi_e(0x301));
145
+define('MAPI_E_INVALID_TYPE', make_mapi_e(0x302));
146
+define('MAPI_E_TYPE_NO_SUPPORT', make_mapi_e(0x303));
147
+define('MAPI_E_UNEXPECTED_TYPE', make_mapi_e(0x304));
148
+define('MAPI_E_TOO_BIG', make_mapi_e(0x305));
149
+define('MAPI_E_DECLINE_COPY', make_mapi_e(0x306));
150
+define('MAPI_E_UNEXPECTED_ID', make_mapi_e(0x307));
151 151
 
152
-define('MAPI_W_ERRORS_RETURNED'                          ,make_mapi_s(0x380));
152
+define('MAPI_W_ERRORS_RETURNED', make_mapi_s(0x380));
153 153
 
154 154
 /* Table specific errors and warnings */
155 155
 
156
-define('MAPI_E_UNABLE_TO_COMPLETE'                       ,make_mapi_e(0x400));
157
-define('MAPI_E_TIMEOUT'                                  ,make_mapi_e(0x401));
158
-define('MAPI_E_TABLE_EMPTY'                              ,make_mapi_e(0x402));
159
-define('MAPI_E_TABLE_TOO_BIG'                            ,make_mapi_e(0x403));
156
+define('MAPI_E_UNABLE_TO_COMPLETE', make_mapi_e(0x400));
157
+define('MAPI_E_TIMEOUT', make_mapi_e(0x401));
158
+define('MAPI_E_TABLE_EMPTY', make_mapi_e(0x402));
159
+define('MAPI_E_TABLE_TOO_BIG', make_mapi_e(0x403));
160 160
 
161
-define('MAPI_E_INVALID_BOOKMARK'                         ,make_mapi_e(0x405));
161
+define('MAPI_E_INVALID_BOOKMARK', make_mapi_e(0x405));
162 162
 
163
-define('MAPI_W_POSITION_CHANGED'                         ,make_mapi_s(0x481));
164
-define('MAPI_W_APPROX_COUNT'                             ,make_mapi_s(0x482));
163
+define('MAPI_W_POSITION_CHANGED', make_mapi_s(0x481));
164
+define('MAPI_W_APPROX_COUNT', make_mapi_s(0x482));
165 165
 
166 166
 /* Transport specific errors and warnings */
167 167
 
168
-define('MAPI_E_WAIT'                                     ,make_mapi_e(0x500));
169
-define('MAPI_E_CANCEL'                                   ,make_mapi_e(0x501));
170
-define('MAPI_E_NOT_ME'                                   ,make_mapi_e(0x502));
168
+define('MAPI_E_WAIT', make_mapi_e(0x500));
169
+define('MAPI_E_CANCEL', make_mapi_e(0x501));
170
+define('MAPI_E_NOT_ME', make_mapi_e(0x502));
171 171
 
172
-define('MAPI_W_CANCEL_MESSAGE'                           ,make_mapi_s(0x580));
172
+define('MAPI_W_CANCEL_MESSAGE', make_mapi_s(0x580));
173 173
 
174 174
 /* Message Store, Folder, and Message specific errors and warnings */
175 175
 
176
-define('MAPI_E_CORRUPT_STORE'                            ,make_mapi_e(0x600));
177
-define('MAPI_E_NOT_IN_QUEUE'                             ,make_mapi_e(0x601));
178
-define('MAPI_E_NO_SUPPRESS'                              ,make_mapi_e(0x602));
179
-define('MAPI_E_COLLISION'                                ,make_mapi_e(0x604));
180
-define('MAPI_E_NOT_INITIALIZED'                          ,make_mapi_e(0x605));
181
-define('MAPI_E_NON_STANDARD'                             ,make_mapi_e(0x606));
182
-define('MAPI_E_NO_RECIPIENTS'                            ,make_mapi_e(0x607));
183
-define('MAPI_E_SUBMITTED'                                ,make_mapi_e(0x608));
184
-define('MAPI_E_HAS_FOLDERS'                              ,make_mapi_e(0x609));
185
-define('MAPI_E_HAS_MESSAGES'                             ,make_mapi_e(0x60A));
186
-define('MAPI_E_FOLDER_CYCLE'                             ,make_mapi_e(0x60B));
187
-define('MAPI_E_STORE_FULL'                               ,make_mapi_e(0x60C));
188
-
189
-define('MAPI_W_PARTIAL_COMPLETION'                       ,make_mapi_s(0x680));
176
+define('MAPI_E_CORRUPT_STORE', make_mapi_e(0x600));
177
+define('MAPI_E_NOT_IN_QUEUE', make_mapi_e(0x601));
178
+define('MAPI_E_NO_SUPPRESS', make_mapi_e(0x602));
179
+define('MAPI_E_COLLISION', make_mapi_e(0x604));
180
+define('MAPI_E_NOT_INITIALIZED', make_mapi_e(0x605));
181
+define('MAPI_E_NON_STANDARD', make_mapi_e(0x606));
182
+define('MAPI_E_NO_RECIPIENTS', make_mapi_e(0x607));
183
+define('MAPI_E_SUBMITTED', make_mapi_e(0x608));
184
+define('MAPI_E_HAS_FOLDERS', make_mapi_e(0x609));
185
+define('MAPI_E_HAS_MESSAGES', make_mapi_e(0x60A));
186
+define('MAPI_E_FOLDER_CYCLE', make_mapi_e(0x60B));
187
+define('MAPI_E_STORE_FULL', make_mapi_e(0x60C));
188
+
189
+define('MAPI_W_PARTIAL_COMPLETION', make_mapi_s(0x680));
190 190
 
191 191
 /* Address Book specific errors and warnings */
192 192
 
193
-define('MAPI_E_AMBIGUOUS_RECIP'                          ,make_mapi_e(0x700));
193
+define('MAPI_E_AMBIGUOUS_RECIP', make_mapi_e(0x700));
194 194
 
195 195
 /* ICS errors and warnings */
196 196
 
197
-define('SYNC_E_UNKNOWN_FLAGS',                            MAPI_E_UNKNOWN_FLAGS);
198
-define('SYNC_E_INVALID_PARAMETER',                        MAPI_E_INVALID_PARAMETER);
199
-define('SYNC_E_ERROR',                                    MAPI_E_CALL_FAILED);
200
-define('SYNC_E_OBJECT_DELETED',                           make_mapi_e(0x800));
201
-define('SYNC_E_IGNORE',                                   make_mapi_e(0x801));
202
-define('SYNC_E_CONFLICT',                                 make_mapi_e(0x802));
203
-define('SYNC_E_NO_PARENT',                                make_mapi_e(0x803));
204
-define('SYNC_E_INCEST',                                   make_mapi_e(0x804));
205
-define('SYNC_E_UNSYNCHRONIZED',                           make_mapi_e(0x805));
206
-
207
-define('SYNC_W_PROGRESS',                                 make_mapi_s(0x820));
208
-define('SYNC_W_CLIENT_CHANGE_NEWER',                      make_mapi_s(0x821));
197
+define('SYNC_E_UNKNOWN_FLAGS', MAPI_E_UNKNOWN_FLAGS);
198
+define('SYNC_E_INVALID_PARAMETER', MAPI_E_INVALID_PARAMETER);
199
+define('SYNC_E_ERROR', MAPI_E_CALL_FAILED);
200
+define('SYNC_E_OBJECT_DELETED', make_mapi_e(0x800));
201
+define('SYNC_E_IGNORE', make_mapi_e(0x801));
202
+define('SYNC_E_CONFLICT', make_mapi_e(0x802));
203
+define('SYNC_E_NO_PARENT', make_mapi_e(0x803));
204
+define('SYNC_E_INCEST', make_mapi_e(0x804));
205
+define('SYNC_E_UNSYNCHRONIZED', make_mapi_e(0x805));
206
+
207
+define('SYNC_W_PROGRESS', make_mapi_s(0x820));
208
+define('SYNC_W_CLIENT_CHANGE_NEWER', make_mapi_s(0x821));
Please login to merge, or discard this patch.
mapi/class.meetingrequest.php 1 patch
Spacing   +258 added lines, -258 removed lines patch added patch discarded remove patch
@@ -150,15 +150,15 @@  discard block
 block discarded – undo
150 150
         $properties['reminderminutes'] = 'PT_LONG:PSETID_Common:0x8501';
151 151
         $properties['reminderset'] = 'PT_BOOLEAN:PSETID_Common:0x8503';
152 152
         $properties['sendasical'] = 'PT_BOOLEAN:PSETID_Appointment:0x8200';
153
-        $properties['updatecounter'] = 'PT_LONG:PSETID_Appointment:0x8201';                    // AppointmentSequenceNumber
154
-        $properties['last_updatecounter'] = 'PT_LONG:PSETID_Appointment:0x8203';            // AppointmentLastSequence
153
+        $properties['updatecounter'] = 'PT_LONG:PSETID_Appointment:0x8201'; // AppointmentSequenceNumber
154
+        $properties['last_updatecounter'] = 'PT_LONG:PSETID_Appointment:0x8203'; // AppointmentLastSequence
155 155
         $properties['unknown7'] = 'PT_LONG:PSETID_Appointment:0x8202';
156 156
         $properties['busystatus'] = 'PT_LONG:PSETID_Appointment:0x8205';
157 157
         $properties['intendedbusystatus'] = 'PT_LONG:PSETID_Appointment:0x8224';
158 158
         $properties['start'] = 'PT_SYSTIME:PSETID_Appointment:0x820d';
159 159
         $properties['responselocation'] = 'PT_STRING8:PSETID_Meeting:0x2';
160 160
         $properties['location'] = 'PT_STRING8:PSETID_Appointment:0x8208';
161
-        $properties['requestsent'] = 'PT_BOOLEAN:PSETID_Appointment:0x8229';        // PidLidFInvited, MeetingRequestWasSent
161
+        $properties['requestsent'] = 'PT_BOOLEAN:PSETID_Appointment:0x8229'; // PidLidFInvited, MeetingRequestWasSent
162 162
         $properties['startdate'] = 'PT_SYSTIME:PSETID_Appointment:0x820d';
163 163
         $properties['duedate'] = 'PT_SYSTIME:PSETID_Appointment:0x820e';
164 164
         $properties['flagdueby'] = 'PT_SYSTIME:PSETID_Common:0x8560';
@@ -167,11 +167,11 @@  discard block
 block discarded – undo
167 167
         $properties['recurring'] = 'PT_BOOLEAN:PSETID_Appointment:0x8223';
168 168
         $properties['clipstart'] = 'PT_SYSTIME:PSETID_Appointment:0x8235';
169 169
         $properties['clipend'] = 'PT_SYSTIME:PSETID_Appointment:0x8236';
170
-        $properties['start_recur_date'] = 'PT_LONG:PSETID_Meeting:0xD';                // StartRecurTime
171
-        $properties['start_recur_time'] = 'PT_LONG:PSETID_Meeting:0xE';                // StartRecurTime
172
-        $properties['end_recur_date'] = 'PT_LONG:PSETID_Meeting:0xF';                // EndRecurDate
173
-        $properties['end_recur_time'] = 'PT_LONG:PSETID_Meeting:0x10';                // EndRecurTime
174
-        $properties['is_exception'] = 'PT_BOOLEAN:PSETID_Meeting:0xA';                // LID_IS_EXCEPTION
170
+        $properties['start_recur_date'] = 'PT_LONG:PSETID_Meeting:0xD'; // StartRecurTime
171
+        $properties['start_recur_time'] = 'PT_LONG:PSETID_Meeting:0xE'; // StartRecurTime
172
+        $properties['end_recur_date'] = 'PT_LONG:PSETID_Meeting:0xF'; // EndRecurDate
173
+        $properties['end_recur_time'] = 'PT_LONG:PSETID_Meeting:0x10'; // EndRecurTime
174
+        $properties['is_exception'] = 'PT_BOOLEAN:PSETID_Meeting:0xA'; // LID_IS_EXCEPTION
175 175
         $properties['apptreplyname'] = 'PT_STRING8:PSETID_Appointment:0x8230';
176 176
         // Propose new time properties
177 177
         $properties['proposed_start_whole'] = 'PT_SYSTIME:PSETID_Appointment:0x8250';
@@ -209,12 +209,12 @@  discard block
 block discarded – undo
209 209
      */
210 210
     function isMeetingRequest($messageClass = false)
211 211
     {
212
-        if($messageClass === false) {
212
+        if ($messageClass === false) {
213 213
             $props = mapi_getprops($this->message, Array(PR_MESSAGE_CLASS));
214 214
             $messageClass = isset($props[PR_MESSAGE_CLASS]) ? $props[PR_MESSAGE_CLASS] : false;
215 215
         }
216 216
 
217
-        if($messageClass !== false &&  stripos($messageClass, 'ipm.schedule.meeting.request') === 0) {
217
+        if ($messageClass !== false && stripos($messageClass, 'ipm.schedule.meeting.request') === 0) {
218 218
             return true;
219 219
         }
220 220
 
@@ -228,12 +228,12 @@  discard block
 block discarded – undo
228 228
      */
229 229
     function isMeetingRequestResponse($messageClass = false)
230 230
     {
231
-        if($messageClass === false) {
231
+        if ($messageClass === false) {
232 232
             $props = mapi_getprops($this->message, Array(PR_MESSAGE_CLASS));
233 233
             $messageClass = isset($props[PR_MESSAGE_CLASS]) ? $props[PR_MESSAGE_CLASS] : false;
234 234
         }
235 235
 
236
-        if($messageClass !== false && stripos($messageClass, 'ipm.schedule.meeting.resp') === 0) {
236
+        if ($messageClass !== false && stripos($messageClass, 'ipm.schedule.meeting.resp') === 0) {
237 237
             return true;
238 238
         }
239 239
 
@@ -247,12 +247,12 @@  discard block
 block discarded – undo
247 247
      */
248 248
     function isMeetingCancellation($messageClass = false)
249 249
     {
250
-        if($messageClass === false) {
250
+        if ($messageClass === false) {
251 251
             $props = mapi_getprops($this->message, Array(PR_MESSAGE_CLASS));
252 252
             $messageClass = isset($props[PR_MESSAGE_CLASS]) ? $props[PR_MESSAGE_CLASS] : false;
253 253
         }
254 254
 
255
-        if($messageClass !== false && stripos($messageClass, 'ipm.schedule.meeting.canceled') === 0) {
255
+        if ($messageClass !== false && stripos($messageClass, 'ipm.schedule.meeting.canceled') === 0) {
256 256
             return true;
257 257
         }
258 258
 
@@ -266,7 +266,7 @@  discard block
 block discarded – undo
266 266
     function getLastUpdateCounter()
267 267
     {
268 268
         $calendarItemProps = mapi_getprops($this->message, array($this->proptags['last_updatecounter']));
269
-        if(isset($calendarItemProps) && !empty($calendarItemProps)){
269
+        if (isset($calendarItemProps) && !empty($calendarItemProps)) {
270 270
             return $calendarItemProps[$this->proptags['last_updatecounter']];
271 271
         }
272 272
         return false;
@@ -278,10 +278,10 @@  discard block
 block discarded – undo
278 278
      */
279 279
     function processMeetingRequestResponse()
280 280
     {
281
-        if(!$this->isMeetingRequestResponse())
281
+        if (!$this->isMeetingRequestResponse())
282 282
             return;
283 283
 
284
-        if(!$this->isLocalOrganiser())
284
+        if (!$this->isLocalOrganiser())
285 285
             return;
286 286
 
287 287
         // Get information we need from the response message
@@ -306,7 +306,7 @@  discard block
 block discarded – undo
306 306
 
307 307
         $goid2 = $messageprops[$this->proptags['goid2']];
308 308
 
309
-        if(!isset($goid2) || !isset($messageprops[PR_SENT_REPRESENTING_EMAIL_ADDRESS])) {
309
+        if (!isset($goid2) || !isset($messageprops[PR_SENT_REPRESENTING_EMAIL_ADDRESS])) {
310 310
             return;
311 311
         }
312 312
 
@@ -325,7 +325,7 @@  discard block
 block discarded – undo
325 325
         }
326 326
 
327 327
         // check for calendar access
328
-        if($this->checkCalendarWriteAccess($userStore) !== true) {
328
+        if ($this->checkCalendarWriteAccess($userStore) !== true) {
329 329
             // Throw an exception that we don't have write permissions on calendar folder,
330 330
             // allow caller to fill the error message
331 331
             throw new MAPIException(null, MAPI_E_NO_ACCESS);
@@ -359,7 +359,7 @@  discard block
 block discarded – undo
359 359
         $calendarItemProps = mapi_getprops($calendarItem, array($this->proptags['recurring'], PR_STORE_ENTRYID, PR_PARENT_ENTRYID, PR_ENTRYID, $this->proptags['updatecounter']));
360 360
 
361 361
         // check if meeting response is already processed
362
-        if(isset($messageprops[PR_PROCESSED]) && $messageprops[PR_PROCESSED] == true) {
362
+        if (isset($messageprops[PR_PROCESSED]) && $messageprops[PR_PROCESSED] == true) {
363 363
             // meeting is already processed
364 364
             return;
365 365
         } else {
@@ -369,7 +369,7 @@  discard block
 block discarded – undo
369 369
 
370 370
         // if meeting is updated in organizer's calendar then we don't need to process
371 371
         // old response
372
-        if($this->isMeetingUpdated($basedate)) {
372
+        if ($this->isMeetingUpdated($basedate)) {
373 373
             return;
374 374
         }
375 375
 
@@ -387,11 +387,11 @@  discard block
 block discarded – undo
387 387
                                             ));
388 388
 
389 389
             // Create/modify exception
390
-            if($recurr->isException($basedate)) {
390
+            if ($recurr->isException($basedate)) {
391 391
                 $recurr->modifyException($exception_props, $basedate);
392 392
             } else {
393 393
                 // When we are creating an exception we need copy recipients from main recurring item
394
-                $recipTable =  mapi_message_getrecipienttable($calendarItem);
394
+                $recipTable = mapi_message_getrecipienttable($calendarItem);
395 395
                 $recips = mapi_table_queryallrows($recipTable, $this->recipprops);
396 396
 
397 397
                 // Retrieve actual start/due dates from calendar item.
@@ -423,9 +423,9 @@  discard block
 block discarded – undo
423 423
 
424 424
         $totalrecips = 0;
425 425
         $acceptedrecips = 0;
426
-        foreach($recipients as $recipient) {
426
+        foreach ($recipients as $recipient) {
427 427
             $totalrecips++;
428
-            if(isset($recipient[PR_ENTRYID]) && $this->compareABEntryIDs($recipient[PR_ENTRYID], $senderentryid)) {
428
+            if (isset($recipient[PR_ENTRYID]) && $this->compareABEntryIDs($recipient[PR_ENTRYID], $senderentryid)) {
429 429
                 $found = true;
430 430
 
431 431
                 /**
@@ -441,7 +441,7 @@  discard block
 block discarded – undo
441 441
                 $recipient[PR_RECIPIENT_TRACKSTATUS_TIME] = $messageprops[$this->proptags['attendee_critical_change']];
442 442
 
443 443
                 // If this is a counter proposal, set the proposal properties in the recipient row
444
-                if(isset($messageprops[$this->proptags['counter_proposal']]) && $messageprops[$this->proptags['counter_proposal']]){
444
+                if (isset($messageprops[$this->proptags['counter_proposal']]) && $messageprops[$this->proptags['counter_proposal']]) {
445 445
                     $recipient[PR_PROPOSENEWTIME_START] = $messageprops[$this->proptags['proposed_start_whole']];
446 446
                     $recipient[PR_PROPOSENEWTIME_END] = $messageprops[$this->proptags['proposed_end_whole']];
447 447
                     $recipient[PR_PROPOSEDNEWTIME] = $messageprops[$this->proptags['counter_proposal']];
@@ -449,13 +449,13 @@  discard block
 block discarded – undo
449 449
 
450 450
                 mapi_message_modifyrecipients($calendarItem, MODRECIP_MODIFY, Array($recipient));
451 451
             }
452
-            if(isset($recipient[PR_RECIPIENT_TRACKSTATUS]) && $recipient[PR_RECIPIENT_TRACKSTATUS] == olRecipientTrackStatusAccepted)
452
+            if (isset($recipient[PR_RECIPIENT_TRACKSTATUS]) && $recipient[PR_RECIPIENT_TRACKSTATUS] == olRecipientTrackStatusAccepted)
453 453
                 $acceptedrecips++;
454 454
         }
455 455
 
456 456
         // If the recipient was not found in the original calendar item,
457 457
         // then add the recpient as a new optional recipient
458
-        if(!$found) {
458
+        if (!$found) {
459 459
             $recipient = Array();
460 460
             $recipient[PR_ENTRYID] = $messageprops[PR_SENT_REPRESENTING_ENTRYID];
461 461
             $recipient[PR_EMAIL_ADDRESS] = $messageprops[PR_SENT_REPRESENTING_EMAIL_ADDRESS];
@@ -467,7 +467,7 @@  discard block
 block discarded – undo
467 467
             $recipient[PR_RECIPIENT_TRACKSTATUS_TIME] = $deliverytime;
468 468
 
469 469
             // If this is a counter proposal, set the proposal properties in the recipient row
470
-            if(isset($messageprops[$this->proptags['counter_proposal']])){
470
+            if (isset($messageprops[$this->proptags['counter_proposal']])) {
471 471
                 $recipient[PR_PROPOSENEWTIME_START] = $messageprops[$this->proptags['proposed_start_whole']];
472 472
                 $recipient[PR_PROPOSENEWTIME_END] = $messageprops[$this->proptags['proposed_end_whole']];
473 473
                 $recipient[PR_PROPOSEDNEWTIME] = $messageprops[$this->proptags['counter_proposal']];
@@ -475,7 +475,7 @@  discard block
 block discarded – undo
475 475
 
476 476
             mapi_message_modifyrecipients($calendarItem, MODRECIP_ADD, Array($recipient));
477 477
             $totalrecips++;
478
-            if($recipient[PR_RECIPIENT_TRACKSTATUS] == olRecipientTrackStatusAccepted) {
478
+            if ($recipient[PR_RECIPIENT_TRACKSTATUS] == olRecipientTrackStatusAccepted) {
479 479
                 $acceptedrecips++;
480 480
             }
481 481
         }
@@ -485,11 +485,11 @@  discard block
 block discarded – undo
485 485
 If it is the first time this attendee has proposed a new date/time, increment the value of the PidLidAppointmentProposalNumber property on the organizer's meeting object, by 0x00000001. If this property did not previously exist on the organizer's meeting object, it MUST be set with a value of 0x00000001.
486 486
 */
487 487
         // If this is a counter proposal, set the counter proposal indicator boolean
488
-        if(isset($messageprops[$this->proptags['counter_proposal']])){
488
+        if (isset($messageprops[$this->proptags['counter_proposal']])) {
489 489
             $props = Array();
490
-            if($messageprops[$this->proptags['counter_proposal']]){
490
+            if ($messageprops[$this->proptags['counter_proposal']]) {
491 491
                 $props[$this->proptags['counter_proposal']] = true;
492
-            }else{
492
+            } else {
493 493
                 $props[$this->proptags['counter_proposal']] = false;
494 494
             }
495 495
 
@@ -509,15 +509,15 @@  discard block
 block discarded – undo
509 509
      */
510 510
     function processMeetingCancellation()
511 511
     {
512
-        if(!$this->isMeetingCancellation()) {
512
+        if (!$this->isMeetingCancellation()) {
513 513
             return;
514 514
         }
515 515
 
516
-        if($this->isLocalOrganiser()) {
516
+        if ($this->isLocalOrganiser()) {
517 517
             return;
518 518
         }
519 519
 
520
-        if(!$this->isInCalendar()) {
520
+        if (!$this->isInCalendar()) {
521 521
             return;
522 522
         }
523 523
 
@@ -535,13 +535,13 @@  discard block
 block discarded – undo
535 535
         $listProperties['rcvd_representing_search_key'] = PR_RCVD_REPRESENTING_SEARCH_KEY;
536 536
         $messageProps = mapi_getprops($this->message, $listProperties);
537 537
 
538
-        $goid = $messageProps[$this->proptags['goid']];    //GlobalID (0x3)
539
-        if(!isset($goid)) {
538
+        $goid = $messageProps[$this->proptags['goid']]; //GlobalID (0x3)
539
+        if (!isset($goid)) {
540 540
             return;
541 541
         }
542 542
 
543 543
         // get delegator store, if delegate is processing this cancellation
544
-        if (isset($messageProps[PR_RCVD_REPRESENTING_ENTRYID])){
544
+        if (isset($messageProps[PR_RCVD_REPRESENTING_ENTRYID])) {
545 545
             $delegatorStore = $this->getDelegatorStore($messageProps[PR_RCVD_REPRESENTING_ENTRYID], array(PR_IPM_APPOINTMENT_ENTRYID));
546 546
 
547 547
             $store = $delegatorStore['store'];
@@ -552,7 +552,7 @@  discard block
 block discarded – undo
552 552
         }
553 553
 
554 554
         // check for calendar access
555
-        if($this->checkCalendarWriteAccess($store) !== true) {
555
+        if ($this->checkCalendarWriteAccess($store) !== true) {
556 556
             // Throw an exception that we don't have write permissions on calendar folder,
557 557
             // allow caller to fill the error message
558 558
             throw new MAPIException(null, MAPI_E_NO_ACCESS);
@@ -561,18 +561,18 @@  discard block
 block discarded – undo
561 561
         $calendarItem = $this->getCorrespondentCalendarItem(true);
562 562
         $basedate = $this->getBasedateFromGlobalID($goid);
563 563
 
564
-        if($calendarItem !== false) {
564
+        if ($calendarItem !== false) {
565 565
             // if basedate is provided and we could not find the item then it could be that we are processing
566 566
             // an exception so get the exception and process it
567
-            if($basedate) {
567
+            if ($basedate) {
568 568
                 $calendarItemProps = mapi_getprops($calendarItem, array($this->proptags['recurring']));
569
-                if ($calendarItemProps[$this->proptags['recurring']] === true){
569
+                if ($calendarItemProps[$this->proptags['recurring']] === true) {
570 570
                     $recurr = new Recurrence($store, $calendarItem);
571 571
 
572 572
                     // Set message class
573 573
                     $messageProps[PR_MESSAGE_CLASS] = 'IPM.Appointment';
574 574
 
575
-                    if($recurr->isException($basedate)) {
575
+                    if ($recurr->isException($basedate)) {
576 576
                         $recurr->modifyException($messageProps, $basedate);
577 577
                     } else {
578 578
                         $recurr->createException($messageProps, $basedate);
@@ -614,9 +614,9 @@  discard block
 block discarded – undo
614 614
 	 * @param boolean $isImported true to indicate that MR is imported from .ics or .vcs file else it false.
615 615
      * @return string $entryid entryid of item which created/updated in calendar
616 616
      */
617
-    function doAccept($tentative, $sendresponse, $move, $newProposedStartTime=false, $newProposedEndTime=false, $body=false, $userAction = false, $store=false, $basedate = false, $isImported = false)
617
+    function doAccept($tentative, $sendresponse, $move, $newProposedStartTime = false, $newProposedEndTime = false, $body = false, $userAction = false, $store = false, $basedate = false, $isImported = false)
618 618
     {
619
-        if($this->isLocalOrganiser()) {
619
+        if ($this->isLocalOrganiser()) {
620 620
             return false;
621 621
         }
622 622
 
@@ -635,14 +635,14 @@  discard block
 block discarded – undo
635 635
         }
636 636
 
637 637
         // check for calendar access
638
-        if($this->checkCalendarWriteAccess($store) !== true) {
638
+        if ($this->checkCalendarWriteAccess($store) !== true) {
639 639
             // Throw an exception that we don't have write permissions on calendar folder,
640 640
             // allow caller to fill the error message
641 641
             throw new MAPIException(null, MAPI_E_NO_ACCESS);
642 642
         }
643 643
 
644 644
         // if meeting is out dated then don't process it
645
-        if($this->isMeetingRequest($messageprops[PR_MESSAGE_CLASS]) && $this->isMeetingOutOfDate()) {
645
+        if ($this->isMeetingRequest($messageprops[PR_MESSAGE_CLASS]) && $this->isMeetingOutOfDate()) {
646 646
             return false;
647 647
         }
648 648
 
@@ -653,8 +653,8 @@  discard block
 block discarded – undo
653 653
                 recipient's calendar
654 654
          *    2) after this every subsequent request to open meeting request will not do any processing
655 655
          */
656
-        if($this->isMeetingRequest($messageprops[PR_MESSAGE_CLASS]) && $userAction == false) {
657
-            if(isset($messageprops[PR_PROCESSED]) && $messageprops[PR_PROCESSED] == true) {
656
+        if ($this->isMeetingRequest($messageprops[PR_MESSAGE_CLASS]) && $userAction == false) {
657
+            if (isset($messageprops[PR_PROCESSED]) && $messageprops[PR_PROCESSED] == true) {
658 658
                 // if meeting request is already processed then don't do anything
659 659
                 return false;
660 660
             }
@@ -662,7 +662,7 @@  discard block
 block discarded – undo
662 662
             // if correspondent calendar item is already processed then don't do anything
663 663
             $calendarItem = $this->getCorrespondentCalendarItem();
664 664
             $calendarItemProps = mapi_getprops($calendarItem, array(PR_PROCESSED));
665
-            if(isset($calendarItemProps[PR_PROCESSED]) && $calendarItemProps[PR_PROCESSED] == true) {
665
+            if (isset($calendarItemProps[PR_PROCESSED]) && $calendarItemProps[PR_PROCESSED] == true) {
666 666
                 // mark meeting-request mail as processed as well
667 667
                 mapi_setprops($this->message, Array(PR_PROCESSED => true));
668 668
                 mapi_savechanges($this->message);
@@ -678,7 +678,7 @@  discard block
 block discarded – undo
678 678
 
679 679
         // set counter proposal properties in calendar item when proposing new time
680 680
         $proposeNewTimeProps = array();
681
-        if($newProposedStartTime && $newProposedEndTime) {
681
+        if ($newProposedStartTime && $newProposedEndTime) {
682 682
             $proposeNewTimeProps[$this->proptags['proposed_start_whole']] = $newProposedStartTime;
683 683
             $proposeNewTimeProps[$this->proptags['proposed_end_whole']] = $newProposedEndTime;
684 684
             $proposeNewTimeProps[$this->proptags['proposed_duration']] = round($newProposedEndTime - $newProposedStartTime) / 60;
@@ -688,15 +688,15 @@  discard block
 block discarded – undo
688 688
         // While sender is receiver then we have to process the meeting request as per the intended busy status
689 689
         // instead of tentative, and accept the same as per the intended busystatus.
690 690
         $senderEntryId = isset($messageprops[PR_SENT_REPRESENTING_ENTRYID]) ? $messageprops[PR_SENT_REPRESENTING_ENTRYID] : $messageprops[PR_SENDER_ENTRYID];
691
-        if(isset($messageprops[PR_RECEIVED_BY_ENTRYID]) && MAPIUtils::CompareEntryIds($senderEntryId, $messageprops[PR_RECEIVED_BY_ENTRYID])) {
691
+        if (isset($messageprops[PR_RECEIVED_BY_ENTRYID]) && MAPIUtils::CompareEntryIds($senderEntryId, $messageprops[PR_RECEIVED_BY_ENTRYID])) {
692 692
             $entryid = $this->accept(false, $sendresponse, $move, $proposeNewTimeProps, $body, true, $store, $calFolder, $basedate);
693 693
         } else {
694 694
             $entryid = $this->accept($tentative, $sendresponse, $move, $proposeNewTimeProps, $body, $userAction, $store, $calFolder, $basedate);
695 695
         }
696 696
 
697 697
         // if we have first time processed this meeting then set PR_PROCESSED property
698
-        if($this->isMeetingRequest($messageprops[PR_MESSAGE_CLASS]) && $userAction === false && $isImported === false) {
699
-            if(!isset($messageprops[PR_PROCESSED]) || $messageprops[PR_PROCESSED] != true) {
698
+        if ($this->isMeetingRequest($messageprops[PR_MESSAGE_CLASS]) && $userAction === false && $isImported === false) {
699
+            if (!isset($messageprops[PR_PROCESSED]) || $messageprops[PR_PROCESSED] != true) {
700 700
                 // set processed flag
701 701
                 mapi_setprops($this->message, Array(PR_PROCESSED => true));
702 702
                 mapi_savechanges($this->message);
@@ -736,7 +736,7 @@  discard block
 block discarded – undo
736 736
                 // Find main recurring item based on GlobalID (0x3)
737 737
                 $items = $this->findCalendarItems($messageprops[$this->proptags['goid2']], $calFolder);
738 738
                 if (is_array($items)) {
739
-                    foreach($items as $key => $entryid) {
739
+                    foreach ($items as $key => $entryid) {
740 740
                         $calendarItem = mapi_msgstore_openentry($store, $entryid);
741 741
                     }
742 742
                 }
@@ -747,14 +747,14 @@  discard block
 block discarded – undo
747 747
                     $calendarItem = mapi_folder_createmessage($calFolder);
748 748
                 } else {
749 749
                     // we have found the main recurring item, check if this meeting request is already processed
750
-                    if(isset($messageprops[PR_PROCESSED]) && $messageprops[PR_PROCESSED] == true) {
750
+                    if (isset($messageprops[PR_PROCESSED]) && $messageprops[PR_PROCESSED] == true) {
751 751
                         // only set required properties, other properties are already copied when processing this meeting request
752 752
                         // for the first time
753 753
                         $processed = true;
754 754
                     }
755 755
                 }
756 756
 
757
-                if(!$processed) {
757
+                if (!$processed) {
758 758
                     // get all the properties and copy that to calendar item
759 759
                     $props = mapi_getprops($this->message);
760 760
 
@@ -785,7 +785,7 @@  discard block
 block discarded – undo
785 785
                 $props[$this->proptags['responsestatus']] = $userAction ? ($tentative ? olResponseTentative : olResponseAccepted) : olResponseNotResponded;
786 786
 
787 787
                 if (isset($props[$this->proptags['intendedbusystatus']])) {
788
-                    if($tentative && $props[$this->proptags['intendedbusystatus']] !== fbFree) {
788
+                    if ($tentative && $props[$this->proptags['intendedbusystatus']] !== fbFree) {
789 789
                         $props[$this->proptags['busystatus']] = fbTentative;
790 790
                     } else {
791 791
                         $props[$this->proptags['busystatus']] = $props[$this->proptags['intendedbusystatus']];
@@ -795,12 +795,12 @@  discard block
 block discarded – undo
795 795
                     $props[$this->proptags['busystatus']] = $tentative ? fbTentative : fbBusy;
796 796
                 }
797 797
 
798
-                if($userAction) {
798
+                if ($userAction) {
799 799
                     $addrInfo = $this->getOwnerAddress($this->store);
800 800
 
801 801
                     // if user has responded then set replytime and name
802 802
                     $props[$this->proptags['replytime']] = time();
803
-                    if(!empty($addrInfo)) {
803
+                    if (!empty($addrInfo)) {
804 804
                         // @FIXME conditionally set this property only for delegation case
805 805
                         $props[$this->proptags['apptreplyname']] = $addrInfo[0];
806 806
                     }
@@ -809,7 +809,7 @@  discard block
 block discarded – undo
809 809
                 mapi_setprops($calendarItem, $props);
810 810
 
811 811
                 // we have already processed attachments and recipients, so no need to do it again
812
-                if(!$processed) {
812
+                if (!$processed) {
813 813
                     // Copy attachments too
814 814
                     $this->replaceAttachments($this->message, $calendarItem);
815 815
                     // Copy recipients too
@@ -821,7 +821,7 @@  discard block
 block discarded – undo
821 821
                 $items = $this->findCalendarItems($messageprops[$this->proptags['goid2']], $calFolder, true);
822 822
                 if (is_array($items)) {
823 823
                     // Save all existing occurrence as exceptions
824
-                    foreach($items as $entryid) {
824
+                    foreach ($items as $entryid) {
825 825
                         // Open occurrence
826 826
                         $occurrenceItem = mapi_msgstore_openentry($store, $entryid);
827 827
 
@@ -867,7 +867,7 @@  discard block
 block discarded – undo
867 867
                     // Find main recurring item from CleanGlobalID of this meeting request
868 868
                     $items = $this->findCalendarItems($messageprops[$this->proptags['goid2']], $calFolder);
869 869
                     if (is_array($items)) {
870
-                        foreach($items as $key => $entryid) {
870
+                        foreach ($items as $key => $entryid) {
871 871
                             $calendarItem = mapi_msgstore_openentry($store, $entryid);
872 872
                         }
873 873
                     }
@@ -902,7 +902,7 @@  discard block
 block discarded – undo
902 902
                         mapi_copyto($this->message, array(), array(), $calmsg); /* includes attachments and recipients */
903 903
 
904 904
                         // After creating new MR, If local categories exist then apply it on new MR.
905
-                        if(!empty($localCategories)) {
905
+                        if (!empty($localCategories)) {
906 906
                             mapi_setprops($calmsg, $localCategories);
907 907
                         }
908 908
 
@@ -919,7 +919,7 @@  discard block
 block discarded – undo
919 919
                         }
920 920
 
921 921
                         if (isset($messageprops[$this->proptags['intendedbusystatus']])) {
922
-                            if($tentative && $messageprops[$this->proptags['intendedbusystatus']] !== fbFree) {
922
+                            if ($tentative && $messageprops[$this->proptags['intendedbusystatus']] !== fbFree) {
923 923
                                 $calItemProps[$this->proptags['busystatus']] = fbTentative;
924 924
                             } else {
925 925
                                 $calItemProps[$this->proptags['busystatus']] = $messageprops[$this->proptags['intendedbusystatus']];
@@ -931,12 +931,12 @@  discard block
 block discarded – undo
931 931
 
932 932
                         // when we are automatically processing the meeting request set responsestatus to olResponseNotResponded
933 933
                         $calItemProps[$this->proptags['responsestatus']] = $userAction ? ($tentative ? olResponseTentative : olResponseAccepted) : olResponseNotResponded;
934
-                        if($userAction) {
934
+                        if ($userAction) {
935 935
                             $addrInfo = $this->getOwnerAddress($this->store);
936 936
 
937 937
                             // if user has responded then set replytime and name
938 938
                             $calItemProps[$this->proptags['replytime']] = time();
939
-                            if(!empty($addrInfo)) {
939
+                            if (!empty($addrInfo)) {
940 940
                                 $calItemProps[$this->proptags['apptreplyname']] = $addrInfo[0];
941 941
                             }
942 942
                         }
@@ -991,7 +991,7 @@  discard block
 block discarded – undo
991 991
                         $props[$this->proptags['responsestatus']] = $userAction ? ($tentative ? olResponseTentative : olResponseAccepted) : olResponseNotResponded;
992 992
 
993 993
                         if (isset($props[$this->proptags['intendedbusystatus']])) {
994
-                            if($tentative && $props[$this->proptags['intendedbusystatus']] !== fbFree) {
994
+                            if ($tentative && $props[$this->proptags['intendedbusystatus']] !== fbFree) {
995 995
                                 $props[$this->proptags['busystatus']] = fbTentative;
996 996
                             } else {
997 997
                                 $props[$this->proptags['busystatus']] = $props[$this->proptags['intendedbusystatus']];
@@ -1001,12 +1001,12 @@  discard block
 block discarded – undo
1001 1001
                             $props[$this->proptags['busystatus']] = $tentative ? fbTentative : fbBusy;
1002 1002
                         }
1003 1003
 
1004
-                        if($userAction) {
1004
+                        if ($userAction) {
1005 1005
                             $addrInfo = $this->getOwnerAddress($this->store);
1006 1006
 
1007 1007
                             // if user has responded then set replytime and name
1008 1008
                             $props[$this->proptags['replytime']] = time();
1009
-                            if(!empty($addrInfo)) {
1009
+                            if (!empty($addrInfo)) {
1010 1010
                                 $props[$this->proptags['apptreplyname']] = $addrInfo[0];
1011 1011
                             }
1012 1012
                         }
@@ -1049,7 +1049,7 @@  discard block
 block discarded – undo
1049 1049
             $props[$this->proptags['responsestatus']] = $tentative ? olResponseTentative : olResponseAccepted;
1050 1050
 
1051 1051
             if (isset($messageprops[$this->proptags['intendedbusystatus']])) {
1052
-                if($tentative && $messageprops[$this->proptags['intendedbusystatus']] !== fbFree) {
1052
+                if ($tentative && $messageprops[$this->proptags['intendedbusystatus']] !== fbFree) {
1053 1053
                     $props[$this->proptags['busystatus']] = fbTentative;
1054 1054
                 } else {
1055 1055
                     $props[$this->proptags['busystatus']] = $messageprops[$this->proptags['intendedbusystatus']];
@@ -1065,7 +1065,7 @@  discard block
 block discarded – undo
1065 1065
 
1066 1066
             // if user has responded then set replytime and name
1067 1067
             $props[$this->proptags['replytime']] = time();
1068
-            if(!empty($addrInfo)) {
1068
+            if (!empty($addrInfo)) {
1069 1069
                 $props[$this->proptags['apptreplyname']] = $addrInfo[0];
1070 1070
             }
1071 1071
 
@@ -1076,7 +1076,7 @@  discard block
 block discarded – undo
1076 1076
                 $reciptable = mapi_message_getrecipienttable($this->message);
1077 1077
                 $recips = mapi_table_queryallrows($reciptable, $this->recipprops);
1078 1078
 
1079
-                if($recurr->isException($basedate)) {
1079
+                if ($recurr->isException($basedate)) {
1080 1080
                     $recurr->modifyException($proposeNewTimeProps + $props, $basedate, $recips);
1081 1081
                 } else {
1082 1082
                     $props[$this->proptags['startdate']] = $recurr->getOccurrenceStart($basedate);
@@ -1114,7 +1114,7 @@  discard block
 block discarded – undo
1114 1114
      */
1115 1115
     function doDecline($sendresponse, $basedate = false, $body = false)
1116 1116
     {
1117
-        if($this->isLocalOrganiser()) {
1117
+        if ($this->isLocalOrganiser()) {
1118 1118
             return false;
1119 1119
         }
1120 1120
 
@@ -1136,7 +1136,7 @@  discard block
 block discarded – undo
1136 1136
         }
1137 1137
 
1138 1138
         // check for calendar access before deleting the calendar item
1139
-        if($this->checkCalendarWriteAccess($store) !== true) {
1139
+        if ($this->checkCalendarWriteAccess($store) !== true) {
1140 1140
             // Throw an exception that we don't have write permissions on calendar folder,
1141 1141
             // allow caller to fill the error message
1142 1142
             throw new MAPIException(null, MAPI_E_NO_ACCESS);
@@ -1151,7 +1151,7 @@  discard block
 block discarded – undo
1151 1151
             $basedate = $this->getBasedateFromGlobalID($goid);
1152 1152
         }
1153 1153
 
1154
-        if($sendresponse) {
1154
+        if ($sendresponse) {
1155 1155
             $this->createResponse(olResponseDeclined, array(), $body, $store, $basedate, $calFolder);
1156 1156
         }
1157 1157
 
@@ -1160,7 +1160,7 @@  discard block
 block discarded – undo
1160 1160
             $calendaritems = $this->findCalendarItems($messageprops[$this->proptags['goid2']], $calFolder);
1161 1161
 
1162 1162
             if (is_array($calendaritems)) {
1163
-                foreach($calendaritems as $entryid) {
1163
+                foreach ($calendaritems as $entryid) {
1164 1164
                     // Open each calendar item and set the properties of the cancellation object
1165 1165
                     $calendaritem = mapi_msgstore_openentry($store, $entryid);
1166 1166
 
@@ -1180,7 +1180,7 @@  discard block
 block discarded – undo
1180 1180
         if (!$calendaritem) {
1181 1181
             $calendar = $this->openDefaultCalendar($store);
1182 1182
 
1183
-            if(!empty($entryids)) {
1183
+            if (!empty($entryids)) {
1184 1184
                 mapi_folder_deletemessages($calendar, $entryids);
1185 1185
             }
1186 1186
 
@@ -1209,7 +1209,7 @@  discard block
 block discarded – undo
1209 1209
      */
1210 1210
     function doRemoveFromCalendar($basedate)
1211 1211
     {
1212
-        if($this->isLocalOrganiser()) {
1212
+        if ($this->isLocalOrganiser()) {
1213 1213
             return false;
1214 1214
         }
1215 1215
 
@@ -1228,7 +1228,7 @@  discard block
 block discarded – undo
1228 1228
         }
1229 1229
 
1230 1230
         // check for calendar access before deleting the calendar item
1231
-        if($this->checkCalendarWriteAccess($store) !== true) {
1231
+        if ($this->checkCalendarWriteAccess($store) !== true) {
1232 1232
             // Throw an exception that we don't have write permissions on calendar folder,
1233 1233
             // allow caller to fill the error message
1234 1234
             throw new MAPIException(null, MAPI_E_NO_ACCESS);
@@ -1245,12 +1245,12 @@  discard block
 block discarded – undo
1245 1245
 
1246 1246
             $calendarItem = $this->getCorrespondentCalendarItem(true);
1247 1247
 
1248
-            if($calendarItem !== false) {
1248
+            if ($calendarItem !== false) {
1249 1249
                 // basedate is provided so open exception
1250
-                if($basedate) {
1250
+                if ($basedate) {
1251 1251
                     $exception = $this->getExceptionItem($calendarItem, $basedate);
1252 1252
 
1253
-                    if($exception !== false) {
1253
+                    if ($exception !== false) {
1254 1254
                         // exception found, remove it from calendar
1255 1255
                         $this->doRemoveExceptionFromCalendar($basedate, $calendarItem, $store);
1256 1256
                     }
@@ -1291,12 +1291,12 @@  discard block
 block discarded – undo
1291 1291
      */
1292 1292
     function doCancelInvitation($basedate = false)
1293 1293
     {
1294
-        if(!$this->isLocalOrganiser()) {
1294
+        if (!$this->isLocalOrganiser()) {
1295 1295
             return;
1296 1296
         }
1297 1297
 
1298 1298
         // check write access for delegate
1299
-        if($this->checkCalendarWriteAccess($this->store) !== true) {
1299
+        if ($this->checkCalendarWriteAccess($this->store) !== true) {
1300 1300
             // Throw an exception that we don't have write permissions on calendar folder,
1301 1301
             // error message will be filled by module
1302 1302
             throw new MAPIException(null, MAPI_E_NO_ACCESS);
@@ -1304,12 +1304,12 @@  discard block
 block discarded – undo
1304 1304
 
1305 1305
         $messageProps = mapi_getprops($this->message, array(PR_ENTRYID, $this->proptags['recurring']));
1306 1306
 
1307
-        if(isset($messageProps[$this->proptags['recurring']]) && $messageProps[$this->proptags['recurring']] === true) {
1307
+        if (isset($messageProps[$this->proptags['recurring']]) && $messageProps[$this->proptags['recurring']] === true) {
1308 1308
             // cancellation of recurring series or one occurence
1309 1309
             $recurrence = new Recurrence($this->store, $this->message);
1310 1310
 
1311 1311
             // if basedate is specified then we are cancelling only one occurence, so create exception for that occurence
1312
-            if($basedate) {
1312
+            if ($basedate) {
1313 1313
                 $recurrence->createException(array(), $basedate, true);
1314 1314
             }
1315 1315
 
@@ -1333,7 +1333,7 @@  discard block
 block discarded – undo
1333 1333
 
1334 1334
         // if basedate is specified then we have already created exception of it so nothing should be done now
1335 1335
         // but when cancelling normal / recurring meeting request we need to remove meeting from calendar
1336
-        if($basedate === false) {
1336
+        if ($basedate === false) {
1337 1337
             // get the wastebasket folder, for delegate this will give wastebasket of delegate
1338 1338
             $wastebasket = $this->openDefaultWastebasket($this->openDefaultStore());
1339 1339
 
@@ -1382,7 +1382,7 @@  discard block
 block discarded – undo
1382 1382
         // Length of the random data
1383 1383
         $goid .= pack('V', 16);
1384 1384
         // Random data.
1385
-        for ($i=0; $i<16; $i++)
1385
+        for ($i = 0; $i < 16; $i++)
1386 1386
             $goid .= chr(rand(0, 255));
1387 1387
 
1388 1388
         // Create a new appointment id for this item
@@ -1394,7 +1394,7 @@  discard block
 block discarded – undo
1394 1394
         $props[$this->proptags['goid2']] = $goid;
1395 1395
 
1396 1396
         if (!isset($props[$this->proptags['updatecounter']])) {
1397
-            $props[$this->proptags['updatecounter']] = 0;            // OL also starts sequence no with zero.
1397
+            $props[$this->proptags['updatecounter']] = 0; // OL also starts sequence no with zero.
1398 1398
             $props[$this->proptags['last_updatecounter']] = 0;
1399 1399
         }
1400 1400
 
@@ -1441,7 +1441,7 @@  discard block
 block discarded – undo
1441 1441
                 // Then send all meeting request for all exceptions
1442 1442
                 $exceptions = $recurr->getAllExceptions();
1443 1443
                 if ($exceptions) {
1444
-                    foreach($exceptions as $exceptionBasedate) {
1444
+                    foreach ($exceptions as $exceptionBasedate) {
1445 1445
                         $attach = $recurr->getExceptionAttachment($exceptionBasedate);
1446 1446
 
1447 1447
                         if ($attach) {
@@ -1489,12 +1489,12 @@  discard block
 block discarded – undo
1489 1489
             }
1490 1490
         }
1491 1491
 
1492
-        if(isset($this->errorSetResource) && $this->errorSetResource){
1492
+        if (isset($this->errorSetResource) && $this->errorSetResource) {
1493 1493
             return Array(
1494 1494
                 'error' => $this->errorSetResource,
1495 1495
                 'displayname' => $this->recipientDisplayname
1496 1496
             );
1497
-        }else{
1497
+        } else {
1498 1498
             return true;
1499 1499
         }
1500 1500
     }
@@ -1514,23 +1514,23 @@  discard block
 block discarded – undo
1514 1514
 
1515 1515
         $fbDataArray = mapi_freebusysupport_loaddata($fbsupport, array($entryID));
1516 1516
 
1517
-        if($fbDataArray[0] != NULL){
1518
-            foreach($fbDataArray as $fbDataUser){
1517
+        if ($fbDataArray[0] != NULL) {
1518
+            foreach ($fbDataArray as $fbDataUser) {
1519 1519
                 $rangeuser1 = mapi_freebusydata_getpublishrange($fbDataUser);
1520
-                if($rangeuser1 == NULL){
1520
+                if ($rangeuser1 == NULL) {
1521 1521
                     return $result;
1522 1522
                 }
1523 1523
 
1524 1524
                 $enumblock = mapi_freebusydata_enumblocks($fbDataUser, $start, $end);
1525 1525
                 mapi_freebusyenumblock_reset($enumblock);
1526 1526
 
1527
-                while(true){
1527
+                while (true) {
1528 1528
                     $blocks = mapi_freebusyenumblock_next($enumblock, 100);
1529
-                    if(!$blocks){
1529
+                    if (!$blocks) {
1530 1530
                         break;
1531 1531
                     }
1532 1532
 
1533
-                    foreach($blocks as $blockItem){
1533
+                    foreach ($blocks as $blockItem) {
1534 1534
                         $result[] = $blockItem;
1535 1535
                     }
1536 1536
                 }
@@ -1553,7 +1553,7 @@  discard block
 block discarded – undo
1553 1553
     {
1554 1554
         $messageprops = mapi_getprops($this->message, Array($this->proptags['last_updatecounter'], $this->proptags['goid']));
1555 1555
 
1556
-        if ( !isset($messageprops[$this->proptags['goid']]) ) {
1556
+        if (!isset($messageprops[$this->proptags['goid']])) {
1557 1557
             $this->setMeetingRequest($basedate);
1558 1558
         } else {
1559 1559
             $counter = $messageprops[$this->proptags['last_updatecounter']] + 1;
@@ -1572,7 +1572,7 @@  discard block
 block discarded – undo
1572 1572
     {
1573 1573
         $props = mapi_getprops($this->message, array($this->proptags['goid'], PR_MESSAGE_CLASS));
1574 1574
 
1575
-        if(!$this->isMeetingRequest($props[PR_MESSAGE_CLASS]) && !$this->isMeetingRequestResponse($props[PR_MESSAGE_CLASS]) && !$this->isMeetingCancellation($props[PR_MESSAGE_CLASS])) {
1575
+        if (!$this->isMeetingRequest($props[PR_MESSAGE_CLASS]) && !$this->isMeetingRequestResponse($props[PR_MESSAGE_CLASS]) && !$this->isMeetingCancellation($props[PR_MESSAGE_CLASS])) {
1576 1576
             // we are checking with calendar item
1577 1577
             $calendarItem = $this->message;
1578 1578
         } else {
@@ -1584,10 +1584,10 @@  discard block
 block discarded – undo
1584 1584
         // even if we have received request/response for exception/occurence then also
1585 1585
         // we can check recurring series for organizer, no need to check with exception/occurence
1586 1586
 
1587
-        if($calendarItem !== false) {
1587
+        if ($calendarItem !== false) {
1588 1588
             $messageProps = mapi_getprops($calendarItem, Array($this->proptags['responsestatus']));
1589 1589
 
1590
-            if(isset($messageProps[$this->proptags['responsestatus']]) && $messageProps[$this->proptags['responsestatus']] === olResponseOrganized) {
1590
+            if (isset($messageProps[$this->proptags['responsestatus']]) && $messageProps[$this->proptags['responsestatus']] === olResponseOrganized) {
1591 1591
                 return true;
1592 1592
             }
1593 1593
         }
@@ -1606,7 +1606,7 @@  discard block
 block discarded – undo
1606 1606
     function getTrackStatus($class)
1607 1607
     {
1608 1608
         $status = olRecipientTrackStatusNone;
1609
-        switch($class)
1609
+        switch ($class)
1610 1610
         {
1611 1611
             case 'IPM.Schedule.Meeting.Resp.Pos':
1612 1612
                 $status = olRecipientTrackStatusAccepted;
@@ -1723,7 +1723,7 @@  discard block
 block discarded – undo
1723 1723
         $folder = false;
1724 1724
         $entryid = $this->getDefaultFolderEntryID($prop, $store);
1725 1725
 
1726
-        if($entryid !== false) {
1726
+        if ($entryid !== false) {
1727 1727
             $folder = mapi_msgstore_openentry($store ? $store : $this->store, $entryid);
1728 1728
         }
1729 1729
 
@@ -1741,7 +1741,7 @@  discard block
 block discarded – undo
1741 1741
     function getBaseEntryID($prop, $store = false)
1742 1742
     {
1743 1743
         $storeprops = mapi_getprops($store ? $store : $this->store, Array($prop));
1744
-        if(!isset($storeprops[$prop])) {
1744
+        if (!isset($storeprops[$prop])) {
1745 1745
             return false;
1746 1746
         }
1747 1747
 
@@ -1759,7 +1759,7 @@  discard block
 block discarded – undo
1759 1759
         $folder = false;
1760 1760
         $entryid = $this->getBaseEntryID($prop, $store);
1761 1761
 
1762
-        if($entryid !== false) {
1762
+        if ($entryid !== false) {
1763 1763
             $folder = mapi_msgstore_openentry($store ? $store : $this->store, $entryid);
1764 1764
         }
1765 1765
 
@@ -1776,20 +1776,20 @@  discard block
 block discarded – undo
1776 1776
     {
1777 1777
         $accessToFolder = false;
1778 1778
 
1779
-        if(!empty($entryid)) {
1780
-            if($store === false) {
1779
+        if (!empty($entryid)) {
1780
+            if ($store === false) {
1781 1781
                 $store = $this->store;
1782 1782
             }
1783 1783
 
1784 1784
             try {
1785 1785
                 $folder = mapi_msgstore_openentry($store, $entryid);
1786 1786
                 $folderProps = mapi_getprops($folder, Array(PR_ACCESS));
1787
-                if(($folderProps[PR_ACCESS] & MAPI_ACCESS_CREATE_CONTENTS) === MAPI_ACCESS_CREATE_CONTENTS) {
1787
+                if (($folderProps[PR_ACCESS] & MAPI_ACCESS_CREATE_CONTENTS) === MAPI_ACCESS_CREATE_CONTENTS) {
1788 1788
                     $accessToFolder = true;
1789 1789
                 }
1790 1790
             } catch (MAPIException $e) {
1791 1791
                 // we don't have rights to open folder, so return false
1792
-                if($e->getCode() == MAPI_E_NO_ACCESS) {
1792
+                if ($e->getCode() == MAPI_E_NO_ACCESS) {
1793 1793
                     return $accessToFolder;
1794 1794
                 }
1795 1795
 
@@ -1808,7 +1808,7 @@  discard block
 block discarded – undo
1808 1808
      */
1809 1809
     function checkCalendarWriteAccess($store = false)
1810 1810
     {
1811
-        if($store === false) {
1811
+        if ($store === false) {
1812 1812
             // If this meeting request is received by a delegate then open delegator's store.
1813 1813
             $messageProps = mapi_getprops($this->message, array(PR_RCVD_REPRESENTING_ENTRYID));
1814 1814
             if (isset($messageProps[PR_RCVD_REPRESENTING_ENTRYID])) {
@@ -1822,7 +1822,7 @@  discard block
 block discarded – undo
1822 1822
 
1823 1823
         // If the store is a public folder, the calendar folder is the PARENT_ENTRYID of the calendar item
1824 1824
         $provider = mapi_getprops($store, array(PR_MDB_PROVIDER));
1825
-        if(isset($provider[PR_MDB_PROVIDER]) && $provider[PR_MDB_PROVIDER] === ZARAFA_STORE_PUBLIC_GUID) {
1825
+        if (isset($provider[PR_MDB_PROVIDER]) && $provider[PR_MDB_PROVIDER] === ZARAFA_STORE_PUBLIC_GUID) {
1826 1826
             $entryid = mapi_getprops($this->message, array(PR_PARENT_ENTRYID));
1827 1827
             $entryid = $entryid[PR_PARENT_ENTRYID];
1828 1828
         } else {
@@ -1932,10 +1932,10 @@  discard block
 block discarded – undo
1932 1932
             $isRecurring = isset($messageprops[$this->proptags['recurring']]) && $messageprops[$this->proptags['recurring']];
1933 1933
             $isException = isset($messageprops[$this->proptags['is_exception']]) && $messageprops[$this->proptags['is_exception']];
1934 1934
             if ($isRecurring || $isException) {
1935
-                if($isRecurring) {
1935
+                if ($isRecurring) {
1936 1936
                     $props[$this->proptags['recurring']] = $messageprops[$this->proptags['recurring']];
1937 1937
                 }
1938
-                if($isException) {
1938
+                if ($isException) {
1939 1939
                     $props[$this->proptags['is_exception']] = $messageprops[$this->proptags['is_exception']];
1940 1940
                 }
1941 1941
                 $calendaritems = $this->findCalendarItems($messageprops[$this->proptags['goid2']], $calFolder);
@@ -1946,12 +1946,12 @@  discard block
 block discarded – undo
1946 1946
         }
1947 1947
 
1948 1948
         // we are sending a response for recurring meeting request (or exception), so set some required properties
1949
-        if(isset($recurr) && $recurr) {
1950
-            if(!empty($messageprops[$this->proptags['recurring_pattern']])) {
1949
+        if (isset($recurr) && $recurr) {
1950
+            if (!empty($messageprops[$this->proptags['recurring_pattern']])) {
1951 1951
                 $props[$this->proptags['recurring_pattern']] = $messageprops[$this->proptags['recurring_pattern']];
1952 1952
             }
1953 1953
 
1954
-            if(!empty($messageprops[$this->proptags['recurrence_data']])) {
1954
+            if (!empty($messageprops[$this->proptags['recurrence_data']])) {
1955 1955
                 $props[$this->proptags['recurrence_data']] = $messageprops[$this->proptags['recurrence_data']];
1956 1956
             }
1957 1957
 
@@ -1970,7 +1970,7 @@  discard block
 block discarded – undo
1970 1970
         $recip[PR_RECIPIENT_TYPE] = MAPI_TO;
1971 1971
         $recip[PR_SEARCH_KEY] = $messageprops[PR_SENT_REPRESENTING_SEARCH_KEY];
1972 1972
 
1973
-        switch($status) {
1973
+        switch ($status) {
1974 1974
             case olResponseAccepted:
1975 1975
                 $classpostfix = 'Pos';
1976 1976
                 $subjectprefix = _('Accepted');
@@ -1990,10 +1990,10 @@  discard block
 block discarded – undo
1990 1990
             $subjectprefix = _('New Time Proposed');
1991 1991
         }
1992 1992
 
1993
-        $props[PR_SUBJECT] = $subjectprefix . ': ' . $messageprops[PR_SUBJECT];
1993
+        $props[PR_SUBJECT] = $subjectprefix.': '.$messageprops[PR_SUBJECT];
1994 1994
 
1995
-        $props[PR_MESSAGE_CLASS] = 'IPM.Schedule.Meeting.Resp.' . $classpostfix;
1996
-        if(isset($messageprops[PR_OWNER_APPT_ID]))
1995
+        $props[PR_MESSAGE_CLASS] = 'IPM.Schedule.Meeting.Resp.'.$classpostfix;
1996
+        if (isset($messageprops[PR_OWNER_APPT_ID]))
1997 1997
             $props[PR_OWNER_APPT_ID] = $messageprops[PR_OWNER_APPT_ID];
1998 1998
 
1999 1999
         // Set GlobalId AND CleanGlobalId, if exception then also set basedate into GlobalId(0x3).
@@ -2007,7 +2007,7 @@  discard block
 block discarded – undo
2007 2007
         }
2008 2008
 
2009 2009
         //Set body message in Appointment
2010
-        if(isset($body)) {
2010
+        if (isset($body)) {
2011 2011
             $props[PR_BODY] = $this->getMeetingTimeInfo() ? $this->getMeetingTimeInfo() : $body;
2012 2012
         }
2013 2013
 
@@ -2041,7 +2041,7 @@  discard block
 block discarded – undo
2041 2041
      */
2042 2042
     function findCalendarItems($goid, $calendar = false, $useCleanGlobalId = false)
2043 2043
     {
2044
-        if($calendar === false) {
2044
+        if ($calendar === false) {
2045 2045
             // Open the Calendar
2046 2046
             $calendar = $this->openDefaultCalendar();
2047 2047
         }
@@ -2061,13 +2061,13 @@  discard block
 block discarded – undo
2061 2061
 
2062 2062
         $rows = mapi_table_queryallrows($calendarcontents, Array(PR_ENTRYID), $restrict);
2063 2063
 
2064
-        if(empty($rows))
2064
+        if (empty($rows))
2065 2065
             return;
2066 2066
 
2067 2067
         $calendaritems = Array();
2068 2068
 
2069 2069
         // In principle, there should only be one row, but we'll handle them all just in case
2070
-        foreach($rows as $row) {
2070
+        foreach ($rows as $row) {
2071 2071
             $calendaritems[] = $row[PR_ENTRYID];
2072 2072
         }
2073 2073
 
@@ -2079,14 +2079,14 @@  discard block
 block discarded – undo
2079 2079
     function compareABEntryIDs($entryid1, $entryid2)
2080 2080
     {
2081 2081
         // If the session was not passed, just do a 'normal' compare.
2082
-        if(!$this->session) {
2082
+        if (!$this->session) {
2083 2083
             return $entryid1 == $entryid2;
2084 2084
         }
2085 2085
 
2086 2086
         $smtp1 = $this->getSMTPAddress($entryid1);
2087 2087
         $smtp2 = $this->getSMTPAddress($entryid2);
2088 2088
 
2089
-        if($smtp1 == $smtp2) {
2089
+        if ($smtp1 == $smtp2) {
2090 2090
             return true;
2091 2091
         } else {
2092 2092
             return false;
@@ -2096,7 +2096,7 @@  discard block
 block discarded – undo
2096 2096
     // Gets the SMTP address of the passed addressbook entryid
2097 2097
     function getSMTPAddress($entryid)
2098 2098
     {
2099
-        if(!$this->session) {
2099
+        if (!$this->session) {
2100 2100
             return false;
2101 2101
         }
2102 2102
 
@@ -2104,13 +2104,13 @@  discard block
 block discarded – undo
2104 2104
 
2105 2105
         $abitem = mapi_ab_openentry($ab, $entryid);
2106 2106
 
2107
-        if(!$abitem) {
2107
+        if (!$abitem) {
2108 2108
             return '';
2109 2109
         }
2110 2110
 
2111 2111
         $props = mapi_getprops($abitem, array(PR_ADDRTYPE, PR_EMAIL_ADDRESS, PR_SMTP_ADDRESS));
2112 2112
 
2113
-        if($props[PR_ADDRTYPE] == 'SMTP') {
2113
+        if ($props[PR_ADDRTYPE] == 'SMTP') {
2114 2114
             return $props[PR_EMAIL_ADDRESS];
2115 2115
         }
2116 2116
         return $props[PR_SMTP_ADDRESS];
@@ -2128,25 +2128,25 @@  discard block
 block discarded – undo
2128 2128
      */
2129 2129
     function getOwnerAddress($store, $fallbackToLoggedInUser = true)
2130 2130
     {
2131
-        if(!$this->session)
2131
+        if (!$this->session)
2132 2132
             return false;
2133 2133
 
2134 2134
         $storeProps = mapi_getprops($store, array(PR_MAILBOX_OWNER_ENTRYID, PR_USER_ENTRYID));
2135 2135
 
2136 2136
         $ownerEntryId = false;
2137
-        if(isset($storeProps[PR_USER_ENTRYID]) && $storeProps[PR_USER_ENTRYID]) {
2137
+        if (isset($storeProps[PR_USER_ENTRYID]) && $storeProps[PR_USER_ENTRYID]) {
2138 2138
             $ownerEntryId = $storeProps[PR_USER_ENTRYID];
2139 2139
         }
2140 2140
 
2141
-        if(isset($storeProps[PR_MAILBOX_OWNER_ENTRYID]) && $storeProps[PR_MAILBOX_OWNER_ENTRYID] && !$fallbackToLoggedInUser) {
2141
+        if (isset($storeProps[PR_MAILBOX_OWNER_ENTRYID]) && $storeProps[PR_MAILBOX_OWNER_ENTRYID] && !$fallbackToLoggedInUser) {
2142 2142
             $ownerEntryId = $storeProps[PR_MAILBOX_OWNER_ENTRYID];
2143 2143
         }
2144 2144
 
2145
-        if($ownerEntryId) {
2145
+        if ($ownerEntryId) {
2146 2146
             $ab = mapi_openaddressbook($this->session);
2147 2147
 
2148 2148
             $zarafaUser = mapi_ab_openentry($ab, $ownerEntryId);
2149
-            if(!$zarafaUser)
2149
+            if (!$zarafaUser)
2150 2150
                 return false;
2151 2151
 
2152 2152
             $ownerProps = mapi_getprops($zarafaUser, array(PR_ADDRTYPE, PR_DISPLAY_NAME, PR_EMAIL_ADDRESS, PR_SEARCH_KEY));
@@ -2169,14 +2169,14 @@  discard block
 block discarded – undo
2169 2169
         $storestable = mapi_getmsgstorestable($this->session);
2170 2170
         $rows = mapi_table_queryallrows($storestable, array(PR_ENTRYID, PR_DEFAULT_STORE));
2171 2171
 
2172
-        foreach($rows as $row) {
2173
-            if(isset($row[PR_DEFAULT_STORE]) && $row[PR_DEFAULT_STORE]) {
2172
+        foreach ($rows as $row) {
2173
+            if (isset($row[PR_DEFAULT_STORE]) && $row[PR_DEFAULT_STORE]) {
2174 2174
                 $entryid = $row[PR_ENTRYID];
2175 2175
                 break;
2176 2176
             }
2177 2177
         }
2178 2178
 
2179
-        if(!$entryid)
2179
+        if (!$entryid)
2180 2180
             return false;
2181 2181
 
2182 2182
         return mapi_openmsgstore($this->session, $entryid);
@@ -2190,20 +2190,20 @@  discard block
 block discarded – undo
2190 2190
      * @param array $recipients    recipients list of message.
2191 2191
      * @param boolean $isException true if we are processing recipient of exception
2192 2192
      */
2193
-    function addOrganizer($messageProps, &$recipients, $isException = false){
2193
+    function addOrganizer($messageProps, &$recipients, $isException = false) {
2194 2194
 
2195 2195
         $hasOrganizer = false;
2196 2196
         // Check if meeting already has an organizer.
2197
-        foreach ($recipients as $key => $recipient){
2198
-            if (isset($recipient[PR_RECIPIENT_FLAGS]) && $recipient[PR_RECIPIENT_FLAGS] == (recipSendable | recipOrganizer)) {
2197
+        foreach ($recipients as $key => $recipient) {
2198
+            if (isset($recipient[PR_RECIPIENT_FLAGS]) && $recipient[PR_RECIPIENT_FLAGS] == (recipSendable|recipOrganizer)) {
2199 2199
                 $hasOrganizer = true;
2200
-            } else if ($isException && !isset($recipient[PR_RECIPIENT_FLAGS])){
2200
+            } else if ($isException && !isset($recipient[PR_RECIPIENT_FLAGS])) {
2201 2201
                 // Recipients for an occurrence
2202
-                $recipients[$key][PR_RECIPIENT_FLAGS] = recipSendable | recipExceptionalResponse;
2202
+                $recipients[$key][PR_RECIPIENT_FLAGS] = recipSendable|recipExceptionalResponse;
2203 2203
             }
2204 2204
         }
2205 2205
 
2206
-        if (!$hasOrganizer){
2206
+        if (!$hasOrganizer) {
2207 2207
             // Create organizer.
2208 2208
             $organizer = array();
2209 2209
             $organizer[PR_ENTRYID] = $messageProps[PR_SENT_REPRESENTING_ENTRYID];
@@ -2213,7 +2213,7 @@  discard block
 block discarded – undo
2213 2213
             $organizer[PR_RECIPIENT_DISPLAY_NAME] = $messageProps[PR_SENT_REPRESENTING_NAME];
2214 2214
             $organizer[PR_ADDRTYPE] = empty($messageProps[PR_SENT_REPRESENTING_ADDRTYPE]) ? 'SMTP' : $messageProps[PR_SENT_REPRESENTING_ADDRTYPE];
2215 2215
             $organizer[PR_RECIPIENT_TRACKSTATUS] = olRecipientTrackStatusNone;
2216
-            $organizer[PR_RECIPIENT_FLAGS] = recipSendable | recipOrganizer;
2216
+            $organizer[PR_RECIPIENT_FLAGS] = recipSendable|recipOrganizer;
2217 2217
             $organizer[PR_SEARCH_KEY] = $messageProps[PR_SENT_REPRESENTING_SEARCH_KEY];
2218 2218
 
2219 2219
             // Add organizer to recipients list.
@@ -2267,7 +2267,7 @@  discard block
 block discarded – undo
2267 2267
         $month = $basedate ? sprintf('%02s', dechex(gmdate('m', $basedate))) : '00';
2268 2268
         $day = $basedate ? sprintf('%02s', dechex(gmdate('d', $basedate))) : '00';
2269 2269
 
2270
-        return hex2bin(strtoupper(substr($hexguid, 0, 32) . $year . $month . $day . substr($hexguid, 40)));
2270
+        return hex2bin(strtoupper(substr($hexguid, 0, 32).$year.$month.$day.substr($hexguid, 40)));
2271 2271
     }
2272 2272
 
2273 2273
     /**
@@ -2280,10 +2280,10 @@  discard block
 block discarded – undo
2280 2280
     {
2281 2281
         /* remove all old attachments */
2282 2282
         $attachmentTable = mapi_message_getattachmenttable($copyTo);
2283
-        if($attachmentTable) {
2283
+        if ($attachmentTable) {
2284 2284
             $attachments = mapi_table_queryallrows($attachmentTable, array(PR_ATTACH_NUM, PR_ATTACH_METHOD, PR_EXCEPTION_STARTTIME));
2285 2285
 
2286
-            foreach($attachments as $attachProps){
2286
+            foreach ($attachments as $attachProps) {
2287 2287
                 /* remove exceptions too? */
2288 2288
                 if (!$copyExceptions && $attachProps[PR_ATTACH_METHOD] == ATTACH_EMBEDDED_MSG && isset($attachProps[PR_EXCEPTION_STARTTIME])) {
2289 2289
                     continue;
@@ -2295,15 +2295,15 @@  discard block
 block discarded – undo
2295 2295
 
2296 2296
         /* copy new attachments */
2297 2297
         $attachmentTable = mapi_message_getattachmenttable($copyFrom);
2298
-        if($attachmentTable) {
2298
+        if ($attachmentTable) {
2299 2299
             $attachments = mapi_table_queryallrows($attachmentTable, array(PR_ATTACH_NUM, PR_ATTACH_METHOD, PR_EXCEPTION_STARTTIME));
2300 2300
 
2301
-            foreach($attachments as $attachProps){
2301
+            foreach ($attachments as $attachProps) {
2302 2302
                 if (!$copyExceptions && $attachProps[PR_ATTACH_METHOD] == ATTACH_EMBEDDED_MSG && isset($attachProps[PR_EXCEPTION_STARTTIME])) {
2303 2303
                     continue;
2304 2304
                 }
2305 2305
 
2306
-                $attachOld = mapi_message_openattach($copyFrom, (int) $attachProps[PR_ATTACH_NUM]);
2306
+                $attachOld = mapi_message_openattach($copyFrom, (int)$attachProps[PR_ATTACH_NUM]);
2307 2307
                 $attachNewResourceMsg = mapi_message_createattach($copyTo);
2308 2308
                 mapi_copyto($attachOld, array(), array(), $attachNewResourceMsg, 0);
2309 2309
                 mapi_savechanges($attachNewResourceMsg);
@@ -2351,7 +2351,7 @@  discard block
 block discarded – undo
2351 2351
      */
2352 2352
     function bookResources($message, $cancel, $prefix, $basedate = false)
2353 2353
     {
2354
-        if(!$this->enableDirectBooking) {
2354
+        if (!$this->enableDirectBooking) {
2355 2355
             return array();
2356 2356
         }
2357 2357
 
@@ -2388,7 +2388,7 @@  discard block
 block discarded – undo
2388 2388
         // Get resource recipients
2389 2389
         $getResourcesRestriction = Array(RES_AND,
2390 2390
             Array(Array(RES_PROPERTY,
2391
-                Array(RELOP => RELOP_EQ,    // Equals recipient type 3: Resource
2391
+                Array(RELOP => RELOP_EQ, // Equals recipient type 3: Resource
2392 2392
                     ULPROPTAG => PR_RECIPIENT_TYPE,
2393 2393
                     VALUE => array(PR_RECIPIENT_TYPE =>MAPI_BCC)
2394 2394
                 )
@@ -2403,7 +2403,7 @@  discard block
 block discarded – undo
2403 2403
         // Put appointment into store resource users
2404 2404
         $i = 0;
2405 2405
         $len = count($resourceRecipients);
2406
-        while(!$this->errorSetResource && $i < $len){
2406
+        while (!$this->errorSetResource && $i < $len) {
2407 2407
             $userStore = $this->openCustomUserStore($resourceRecipients[$i][PR_ENTRYID]);
2408 2408
 
2409 2409
             // Open root folder
@@ -2427,21 +2427,21 @@  discard block
 block discarded – undo
2427 2427
                 $this->errorSetResource = 1; // No access
2428 2428
             }
2429 2429
 
2430
-            if($accessToFolder) {
2430
+            if ($accessToFolder) {
2431 2431
                 /**
2432 2432
                  * Get the LocalFreebusy message that contains the properties that
2433 2433
                  * are set to accept or decline resource meeting requests
2434 2434
                  */
2435 2435
                 // Use PR_FREEBUSY_ENTRYIDS[1] to open folder the LocalFreeBusy msg
2436 2436
                 $localFreebusyMsg = mapi_msgstore_openentry($userStore, $userRootProps[PR_FREEBUSY_ENTRYIDS][1]);
2437
-                if($localFreebusyMsg){
2437
+                if ($localFreebusyMsg) {
2438 2438
                     $props = mapi_getprops($localFreebusyMsg, array(PR_PROCESS_MEETING_REQUESTS, PR_DECLINE_RECURRING_MEETING_REQUESTS, PR_DECLINE_CONFLICTING_MEETING_REQUESTS));
2439 2439
 
2440 2440
                     $acceptMeetingRequests = isset($props[PR_PROCESS_MEETING_REQUESTS]) ? $props[PR_PROCESS_MEETING_REQUESTS] : false;
2441 2441
                     $declineRecurringMeetingRequests = isset($props[PR_DECLINE_RECURRING_MEETING_REQUESTS]) ? $props[PR_DECLINE_RECURRING_MEETING_REQUESTS] : false;
2442 2442
                     $declineConflictingMeetingRequests = isset($props[PR_DECLINE_CONFLICTING_MEETING_REQUESTS]) ? $props[PR_DECLINE_CONFLICTING_MEETING_REQUESTS] : false;
2443 2443
 
2444
-                    if(!$acceptMeetingRequests){
2444
+                    if (!$acceptMeetingRequests) {
2445 2445
                         /**
2446 2446
                          * When a resource has not been set to automatically accept meeting requests,
2447 2447
                          * the meeting request has to be sent to him rather than being put directly into
@@ -2449,14 +2449,14 @@  discard block
 block discarded – undo
2449 2449
                          */
2450 2450
                         //$errorSetResource = 2;
2451 2451
                         $this->nonAcceptingResources[] = $resourceRecipients[$i];
2452
-                    }else{
2453
-                        if($declineRecurringMeetingRequests && !$cancel){
2452
+                    } else {
2453
+                        if ($declineRecurringMeetingRequests && !$cancel) {
2454 2454
                             // Check if appointment is recurring
2455
-                            if($messageprops[ $this->proptags['recurring'] ]){
2455
+                            if ($messageprops[$this->proptags['recurring']]) {
2456 2456
                                 $this->errorSetResource = 3;
2457 2457
                             }
2458 2458
                         }
2459
-                        if($declineConflictingMeetingRequests && !$cancel){
2459
+                        if ($declineConflictingMeetingRequests && !$cancel) {
2460 2460
                             // Check for conflicting items
2461 2461
                             if ($calFolder && $this->isMeetingConflicting($message, $userStore, $calFolder)) {
2462 2462
                                 $this->errorSetResource = 4; // Conflict
@@ -2466,7 +2466,7 @@  discard block
 block discarded – undo
2466 2466
                 }
2467 2467
             }
2468 2468
 
2469
-            if(!$this->errorSetResource && $accessToFolder){
2469
+            if (!$this->errorSetResource && $accessToFolder) {
2470 2470
                 /**
2471 2471
                  * First search on GlobalID(0x3)
2472 2472
                  * If (recurring and occurrence) If Resource was booked for only this occurrence then Resource should have only this occurrence in Calendar and not whole series.
@@ -2480,7 +2480,7 @@  discard block
 block discarded – undo
2480 2480
                  * OR
2481 2481
                  * 2) We were looking for occurrence item but Resource has whole series
2482 2482
                  */
2483
-                if(empty($rows)){
2483
+                if (empty($rows)) {
2484 2484
                     /**
2485 2485
                      * Now search on CleanGlobalID(0x23) WHY???
2486 2486
                      * Because we are looking recurring item
@@ -2494,7 +2494,7 @@  discard block
 block discarded – undo
2494 2494
                     $newResourceMsg = false;
2495 2495
                     if (!empty($rows)) {
2496 2496
                         // Since we are looking for recurring item, open every result and check for 'recurring' property.
2497
-                        foreach($rows as $row) {
2497
+                        foreach ($rows as $row) {
2498 2498
                             $ResourceMsg = mapi_msgstore_openentry($userStore, $row);
2499 2499
                             $ResourceMsgProps = mapi_getprops($ResourceMsg, array($this->proptags['recurring']));
2500 2500
 
@@ -2508,18 +2508,18 @@  discard block
 block discarded – undo
2508 2508
                     // Still no results found. I giveup, create new message.
2509 2509
                     if (!$newResourceMsg)
2510 2510
                         $newResourceMsg = mapi_folder_createmessage($calFolder);
2511
-                }else{
2511
+                } else {
2512 2512
                     $newResourceMsg = mapi_msgstore_openentry($userStore, $rows[0]);
2513 2513
                 }
2514 2514
 
2515 2515
                 // Prefix the subject if needed
2516
-                if($prefix && isset($messageprops[PR_SUBJECT])) {
2517
-                    $messageprops[PR_SUBJECT] = $prefix . $messageprops[PR_SUBJECT];
2516
+                if ($prefix && isset($messageprops[PR_SUBJECT])) {
2517
+                    $messageprops[PR_SUBJECT] = $prefix.$messageprops[PR_SUBJECT];
2518 2518
                 }
2519 2519
 
2520 2520
                 // Set status to cancelled if needed
2521 2521
                 $messageprops[$this->proptags['busystatus']] = fbBusy; // The default status (Busy)
2522
-                if($cancel) {
2522
+                if ($cancel) {
2523 2523
                     $messageprops[$this->proptags['meetingstatus']] = olMeetingCanceled; // The meeting has been canceled
2524 2524
                     $messageprops[$this->proptags['busystatus']] = fbFree; // Free
2525 2525
                 } else {
@@ -2540,11 +2540,11 @@  discard block
 block discarded – undo
2540 2540
                 $defaultStoreProps = mapi_getprops($defaultStore, array(PR_ENTRYID));
2541 2541
 
2542 2542
                 // @FIXME use entryid comparison functions here
2543
-                if($storeProps[PR_ENTRYID] !== $defaultStoreProps[PR_ENTRYID]) {
2543
+                if ($storeProps[PR_ENTRYID] !== $defaultStoreProps[PR_ENTRYID]) {
2544 2544
                     // get delegate information
2545 2545
                     $addrInfo = $this->getOwnerAddress($defaultStore, false);
2546 2546
 
2547
-                    if($addrInfo) {
2547
+                    if ($addrInfo) {
2548 2548
                         list($ownername, $owneremailaddr, $owneraddrtype, $ownerentryid, $ownersearchkey) = $addrInfo;
2549 2549
 
2550 2550
                         $messageprops[PR_SENDER_EMAIL_ADDRESS] = $owneremailaddr;
@@ -2557,7 +2557,7 @@  discard block
 block discarded – undo
2557 2557
                     // get delegator information
2558 2558
                     $addrInfo = $this->getOwnerAddress($this->store, false);
2559 2559
 
2560
-                    if($addrInfo) {
2560
+                    if ($addrInfo) {
2561 2561
                         list($ownername, $owneremailaddr, $owneraddrtype, $ownerentryid, $ownersearchkey) = $addrInfo;
2562 2562
 
2563 2563
                         $messageprops[PR_SENT_REPRESENTING_EMAIL_ADDRESS] = $owneremailaddr;
@@ -2570,7 +2570,7 @@  discard block
 block discarded – undo
2570 2570
                     // get organizer information
2571 2571
                     $addrinfo = $this->getOwnerAddress($this->store);
2572 2572
 
2573
-                    if($addrinfo) {
2573
+                    if ($addrinfo) {
2574 2574
                         list($ownername, $owneremailaddr, $owneraddrtype, $ownerentryid, $ownersearchkey) = $addrinfo;
2575 2575
 
2576 2576
                         $messageprops[PR_SENDER_EMAIL_ADDRESS] = $owneremailaddr;
@@ -2600,7 +2600,7 @@  discard block
 block discarded – undo
2600 2600
                     $this->addOrganizer($messageprops, $recips, true);
2601 2601
 
2602 2602
                     // Update occurrence
2603
-                    if($recurr->isException($basedate))
2603
+                    if ($recurr->isException($basedate))
2604 2604
                         $recurr->modifyException($messageprops, $basedate, $recips);
2605 2605
                     else
2606 2606
                         $recurr->createException($messageprops, $basedate, false, $recips);
@@ -2629,16 +2629,16 @@  discard block
 block discarded – undo
2629 2629
                     'msg' => $newResourceMsg,
2630 2630
                 );
2631 2631
                 $this->includesResources = true;
2632
-            }else{
2632
+            } else {
2633 2633
                 /**
2634 2634
                  * If no other errors occurred and you have no access to the
2635 2635
                  * folder of the resource, throw an error=1.
2636 2636
                  */
2637
-                if(!$this->errorSetResource){
2637
+                if (!$this->errorSetResource) {
2638 2638
                     $this->errorSetResource = 1;
2639 2639
                 }
2640 2640
 
2641
-                for($j = 0, $len = count($resourceRecipData); $j < $len; $j++){
2641
+                for ($j = 0, $len = count($resourceRecipData); $j < $len; $j++) {
2642 2642
                     // Get the EntryID
2643 2643
                     $props = mapi_message_getprops($resourceRecipData[$j]['msg']);
2644 2644
 
@@ -2655,7 +2655,7 @@  discard block
 block discarded – undo
2655 2655
         // Get resource recipients
2656 2656
         $getResourcesRestriction = Array(RES_AND,
2657 2657
             Array(Array(RES_PROPERTY,
2658
-                Array(RELOP => RELOP_EQ,    // Equals recipient type 3: Resource
2658
+                Array(RELOP => RELOP_EQ, // Equals recipient type 3: Resource
2659 2659
                     ULPROPTAG => PR_RECIPIENT_TYPE,
2660 2660
                     VALUE => array(PR_RECIPIENT_TYPE =>MAPI_BCC)
2661 2661
                 )
@@ -2663,9 +2663,9 @@  discard block
 block discarded – undo
2663 2663
         );
2664 2664
         $recipienttable = mapi_message_getrecipienttable($message);
2665 2665
         $resourceRecipients = mapi_table_queryallrows($recipienttable, $this->recipprops, $getResourcesRestriction);
2666
-        if(!empty($resourceRecipients)){
2666
+        if (!empty($resourceRecipients)) {
2667 2667
             // Set Tracking status of resource recipients to olResponseAccepted (3)
2668
-            for($i = 0, $len = count($resourceRecipients); $i < $len; $i++){
2668
+            for ($i = 0, $len = count($resourceRecipients); $i < $len; $i++) {
2669 2669
                 $resourceRecipients[$i][PR_RECIPIENT_TRACKSTATUS] = olRecipientTrackStatusAccepted;
2670 2670
                 $resourceRecipients[$i][PR_RECIPIENT_TRACKSTATUS_TIME] = time();
2671 2671
             }
@@ -2673,16 +2673,16 @@  discard block
 block discarded – undo
2673 2673
         }
2674 2674
 
2675 2675
         // Publish updated free/busy information
2676
-        if(!$this->errorSetResource){
2677
-            for($i = 0, $len = count($resourceRecipData); $i < $len; $i++){
2676
+        if (!$this->errorSetResource) {
2677
+            for ($i = 0, $len = count($resourceRecipData); $i < $len; $i++) {
2678 2678
                 $storeProps = mapi_getprops($resourceRecipData[$i]['store'], array(PR_MAILBOX_OWNER_ENTRYID));
2679
-                if (isset($storeProps[PR_MAILBOX_OWNER_ENTRYID])){
2679
+                if (isset($storeProps[PR_MAILBOX_OWNER_ENTRYID])) {
2680 2680
                     $start = time() - 7 * 24 * 60 * 60;
2681 2681
                     $range = strtotime("+6 month");
2682 2682
                     $range = $range - (7 * 24 * 60 * 60);
2683 2683
 
2684 2684
                     $pub = new FreeBusyPublish($this->session, $resourceRecipData[$i]['store'], $resourceRecipData[$i]['folder'], $storeProps[PR_MAILBOX_OWNER_ENTRYID]);
2685
-                    $pub->publishFB($start, $range ); // publish from one week ago, 6 months ahead
2685
+                    $pub->publishFB($start, $range); // publish from one week ago, 6 months ahead
2686 2686
                 }
2687 2687
             }
2688 2688
         }
@@ -2717,7 +2717,7 @@  discard block
 block discarded – undo
2717 2717
             $res = array(RES_PROPERTY, array(
2718 2718
                                             RELOP => RELOP_NE,
2719 2719
                                             ULPROPTAG => PR_EMAIL_ADDRESS,
2720
-                                            VALUE => array( PR_EMAIL_ADDRESS => $delegate[PR_RECEIVED_BY_EMAIL_ADDRESS] )
2720
+                                            VALUE => array(PR_EMAIL_ADDRESS => $delegate[PR_RECEIVED_BY_EMAIL_ADDRESS])
2721 2721
                                         )
2722 2722
                         );
2723 2723
             $recips = mapi_table_queryallrows($reciptable, $this->recipprops, $res);
@@ -2737,7 +2737,7 @@  discard block
 block discarded – undo
2737 2737
         $exception_props[$this->proptags['responsestatus']] = $userAction ? ($tentative ? olResponseTentative : olResponseAccepted) : olResponseNotResponded;
2738 2738
 
2739 2739
         if (isset($exception_props[$this->proptags['intendedbusystatus']])) {
2740
-            if($tentative && $exception_props[$this->proptags['intendedbusystatus']] !== fbFree) {
2740
+            if ($tentative && $exception_props[$this->proptags['intendedbusystatus']] !== fbFree) {
2741 2741
                 $exception_props[$this->proptags['busystatus']] = fbTentative;
2742 2742
             } else {
2743 2743
                 $exception_props[$this->proptags['busystatus']] = $exception_props[$this->proptags['intendedbusystatus']];
@@ -2747,17 +2747,17 @@  discard block
 block discarded – undo
2747 2747
             $exception_props[$this->proptags['busystatus']] = $tentative ? fbTentative : fbBusy;
2748 2748
         }
2749 2749
 
2750
-        if($userAction) {
2750
+        if ($userAction) {
2751 2751
             $addrInfo = $this->getOwnerAddress($this->store);
2752 2752
 
2753 2753
             // if user has responded then set replytime and name
2754 2754
             $exception_props[$this->proptags['replytime']] = time();
2755
-            if(!empty($addrInfo)) {
2755
+            if (!empty($addrInfo)) {
2756 2756
                 $exception_props[$this->proptags['apptreplyname']] = $addrInfo[0];
2757 2757
             }
2758 2758
         }
2759 2759
 
2760
-        if($recurr->isException($basedate)) {
2760
+        if ($recurr->isException($basedate)) {
2761 2761
             $recurr->modifyException($exception_props, $basedate, $recips, $occurrenceItem);
2762 2762
         } else {
2763 2763
             $recurr->createException($exception_props, $basedate, false, $recips, $occurrenceItem);
@@ -2795,7 +2795,7 @@  discard block
 block discarded – undo
2795 2795
         $reciptable = mapi_message_getrecipienttable($occurrenceItem);
2796 2796
         $recips = mapi_table_queryallrows($reciptable, $this->recipprops);
2797 2797
 
2798
-        if($recurr->isException($basedate)) {
2798
+        if ($recurr->isException($basedate)) {
2799 2799
             $recurr->modifyException($exception_props, $basedate, $recips, $occurrenceItem);
2800 2800
         } else {
2801 2801
             $recurr->createException($exception_props, $basedate, false, $recips, $occurrenceItem);
@@ -2839,7 +2839,7 @@  discard block
 block discarded – undo
2839 2839
             $newmessageprops[$this->proptags['is_exception']] = true;
2840 2840
 
2841 2841
             // Set to high importance
2842
-            if($cancel) $newmessageprops[PR_IMPORTANCE] = IMPORTANCE_HIGH;
2842
+            if ($cancel) $newmessageprops[PR_IMPORTANCE] = IMPORTANCE_HIGH;
2843 2843
 
2844 2844
             // Set startdate and enddate of exception
2845 2845
             if ($cancel && $recurObject) {
@@ -2873,9 +2873,9 @@  discard block
 block discarded – undo
2873 2873
             );
2874 2874
 
2875 2875
             // In direct-booking mode, we don't need to send cancellations to resources
2876
-            if($this->enableDirectBooking) {
2876
+            if ($this->enableDirectBooking) {
2877 2877
                 $restriction[1][] = Array(RES_PROPERTY,
2878
-                                        Array(RELOP => RELOP_NE,    // Does not equal recipient type: MAPI_BCC (Resource)
2878
+                                        Array(RELOP => RELOP_NE, // Does not equal recipient type: MAPI_BCC (Resource)
2879 2879
                                             ULPROPTAG => PR_RECIPIENT_TYPE,
2880 2880
                                             VALUE => array(PR_RECIPIENT_TYPE => MAPI_BCC)
2881 2881
                                         )
@@ -2906,19 +2906,19 @@  discard block
 block discarded – undo
2906 2906
 
2907 2907
         $meetingTimeInfo = $this->getMeetingTimeInfo();
2908 2908
 
2909
-        if($meetingTimeInfo)
2909
+        if ($meetingTimeInfo)
2910 2910
             $newmessageprops[PR_BODY] = $meetingTimeInfo;
2911 2911
 
2912 2912
         // Send all recurrence info in mail, if this is a recurrence meeting.
2913 2913
         if (isset($messageprops[$this->proptags['recurring']]) && $messageprops[$this->proptags['recurring']]) {
2914
-            if(!empty($messageprops[$this->proptags['recurring_pattern']])) {
2914
+            if (!empty($messageprops[$this->proptags['recurring_pattern']])) {
2915 2915
                 $newmessageprops[$this->proptags['recurring_pattern']] = $messageprops[$this->proptags['recurring_pattern']];
2916 2916
             }
2917 2917
             $newmessageprops[$this->proptags['recurrence_data']] = $messageprops[$this->proptags['recurrence_data']];
2918 2918
             $newmessageprops[$this->proptags['timezone_data']] = $messageprops[$this->proptags['timezone_data']];
2919 2919
             $newmessageprops[$this->proptags['timezone']] = $messageprops[$this->proptags['timezone']];
2920 2920
 
2921
-            if($recurObject) {
2921
+            if ($recurObject) {
2922 2922
                 $this->generateRecurDates($recurObject, $messageprops, $newmessageprops);
2923 2923
             }
2924 2924
         }
@@ -2929,9 +2929,9 @@  discard block
 block discarded – undo
2929 2929
 
2930 2930
         // Prefix the subject if needed
2931 2931
         if ($prefix && isset($newmessageprops[PR_SUBJECT]))
2932
-            $newmessageprops[PR_SUBJECT] = $prefix . $newmessageprops[PR_SUBJECT];
2932
+            $newmessageprops[PR_SUBJECT] = $prefix.$newmessageprops[PR_SUBJECT];
2933 2933
 
2934
-        if(isset($newmessageprops[$this->proptags['categories']]) &&
2934
+        if (isset($newmessageprops[$this->proptags['categories']]) &&
2935 2935
             !empty($newmessageprops[$this->proptags['categories']])) {
2936 2936
             unset($newmessageprops[$this->proptags['categories']]);
2937 2937
         }
@@ -2944,13 +2944,13 @@  discard block
 block discarded – undo
2944 2944
         $stripResourcesRestriction = Array(RES_AND,
2945 2945
                                 Array(
2946 2946
                                     Array(RES_BITMASK,
2947
-                                        Array(    ULTYPE        =>    BMR_EQZ,
2947
+                                        Array(ULTYPE        =>    BMR_EQZ,
2948 2948
                                                 ULPROPTAG    =>    PR_RECIPIENT_FLAGS,
2949 2949
                                                 ULMASK        =>    recipExceptionalDeleted
2950 2950
                                         )
2951 2951
                                     ),
2952 2952
                                     Array(RES_BITMASK,
2953
-                                        Array(    ULTYPE        =>    BMR_EQZ,
2953
+                                        Array(ULTYPE        =>    BMR_EQZ,
2954 2954
                                                 ULPROPTAG    =>    PR_RECIPIENT_FLAGS,
2955 2955
                                                 ULMASK        =>    recipOrganizer
2956 2956
                                         )
@@ -2959,10 +2959,10 @@  discard block
 block discarded – undo
2959 2959
         );
2960 2960
 
2961 2961
         // In direct-booking mode, resources do not receive a meeting request
2962
-        if($this->enableDirectBooking) {
2962
+        if ($this->enableDirectBooking) {
2963 2963
             $stripResourcesRestriction[1][] =
2964 2964
                                     Array(RES_PROPERTY,
2965
-                                        Array(RELOP => RELOP_NE,    // Does not equal recipient type: MAPI_BCC (Resource)
2965
+                                        Array(RELOP => RELOP_NE, // Does not equal recipient type: MAPI_BCC (Resource)
2966 2966
                                             ULPROPTAG => PR_RECIPIENT_TYPE,
2967 2967
                                             VALUE => array(PR_RECIPIENT_TYPE => MAPI_BCC)
2968 2968
                                         )
@@ -2997,7 +2997,7 @@  discard block
 block discarded – undo
2997 2997
             $recipients[] = $this->nonAcceptingResources[$i];
2998 2998
         }*/
2999 2999
 
3000
-        if(!empty($modifiedRecips)) {
3000
+        if (!empty($modifiedRecips)) {
3001 3001
             // Strip out the sender/'owner' recipient
3002 3002
             mapi_message_modifyrecipients($new, MODRECIP_ADD, $modifiedRecips);
3003 3003
 
@@ -3068,9 +3068,9 @@  discard block
 block discarded – undo
3068 3068
             $newmessageprops[PR_MESSAGE_CLASS] = 'IPM.Schedule.Meeting.Canceled';
3069 3069
             $newmessageprops[$this->proptags['meetingstatus']] = olMeetingCanceled; // It's a cancel request
3070 3070
             $newmessageprops[$this->proptags['busystatus']] = fbFree; // set the busy status as free
3071
-            $newmessageprops[PR_IMPORTANCE] = IMPORTANCE_HIGH;    // HIGH Importance
3071
+            $newmessageprops[PR_IMPORTANCE] = IMPORTANCE_HIGH; // HIGH Importance
3072 3072
             if (isset($newmessageprops[PR_SUBJECT])) {
3073
-                $newmessageprops[PR_SUBJECT] = _('Canceled: ') . $newmessageprops[PR_SUBJECT];
3073
+                $newmessageprops[PR_SUBJECT] = _('Canceled: ').$newmessageprops[PR_SUBJECT];
3074 3074
             }
3075 3075
 
3076 3076
             mapi_setprops($new, $newmessageprops);
@@ -3119,7 +3119,7 @@  discard block
 block discarded – undo
3119 3119
      */
3120 3120
     function generateRecurDates($recurObject, $messageprops, &$newmessageprops)
3121 3121
     {
3122
-        if($messageprops[$this->proptags['startdate']] && $messageprops[$this->proptags['duedate']]) {
3122
+        if ($messageprops[$this->proptags['startdate']] && $messageprops[$this->proptags['duedate']]) {
3123 3123
             $startDate = date('Y:n:j:G:i:s', $recurObject->fromGMT($recurObject->tz, $messageprops[$this->proptags['startdate']]));
3124 3124
             $endDate = date('Y:n:j:G:i:s', $recurObject->fromGMT($recurObject->tz, $messageprops[$this->proptags['duedate']]));
3125 3125
 
@@ -3128,12 +3128,12 @@  discard block
 block discarded – undo
3128 3128
 
3129 3129
             // [0] => year, [1] => month, [2] => day, [3] => hour, [4] => minutes, [5] => seconds
3130 3130
             // RecurStartDate = year * 512 + month_number * 32 + day_number
3131
-            $newmessageprops[$this->proptags['start_recur_date']] = (((int) $startDate[0]) * 512) + (((int) $startDate[1]) * 32) + ((int) $startDate[2]);
3131
+            $newmessageprops[$this->proptags['start_recur_date']] = (((int)$startDate[0]) * 512) + (((int)$startDate[1]) * 32) + ((int)$startDate[2]);
3132 3132
             // RecurStartTime = hour * 4096 + minutes * 64 + seconds
3133
-            $newmessageprops[$this->proptags['start_recur_time']] = (((int) $startDate[3]) * 4096) + (((int) $startDate[4]) * 64) + ((int) $startDate[5]);
3133
+            $newmessageprops[$this->proptags['start_recur_time']] = (((int)$startDate[3]) * 4096) + (((int)$startDate[4]) * 64) + ((int)$startDate[5]);
3134 3134
 
3135
-            $newmessageprops[$this->proptags['end_recur_date']] = (((int) $endDate[0]) * 512) + (((int) $endDate[1]) * 32) + ((int) $endDate[2]);
3136
-            $newmessageprops[$this->proptags['end_recur_time']] = (((int) $endDate[3]) * 4096) + (((int) $endDate[4]) * 64) + ((int) $endDate[5]);
3135
+            $newmessageprops[$this->proptags['end_recur_date']] = (((int)$endDate[0]) * 512) + (((int)$endDate[1]) * 32) + ((int)$endDate[2]);
3136
+            $newmessageprops[$this->proptags['end_recur_time']] = (((int)$endDate[3]) * 4096) + (((int)$endDate[4]) * 64) + ((int)$endDate[5]);
3137 3137
         }
3138 3138
     }
3139 3139
 
@@ -3155,16 +3155,16 @@  discard block
 block discarded – undo
3155 3155
         $outgoing = mapi_folder_createmessage($outbox);
3156 3156
 
3157 3157
         // check if $store is set and it is not equal to $defaultStore (means its the delegation case)
3158
-        if($store !== false) {
3158
+        if ($store !== false) {
3159 3159
             $storeProps = mapi_getprops($store, array(PR_ENTRYID));
3160 3160
             $userStoreProps = mapi_getprops($userStore, array(PR_ENTRYID));
3161 3161
 
3162 3162
             // @FIXME use entryid comparison functions here
3163
-            if($storeProps[PR_ENTRYID] !== $userStoreProps[PR_ENTRYID]) {
3163
+            if ($storeProps[PR_ENTRYID] !== $userStoreProps[PR_ENTRYID]) {
3164 3164
                 // get the delegator properties and set it into outgoing mail
3165 3165
                 $delegatorDetails = $this->getOwnerAddress($store, false);
3166 3166
 
3167
-                if($delegatorDetails) {
3167
+                if ($delegatorDetails) {
3168 3168
                     list($ownername, $owneremailaddr, $owneraddrtype, $ownerentryid, $ownersearchkey) = $delegatorDetails;
3169 3169
                     $sentprops[PR_SENT_REPRESENTING_EMAIL_ADDRESS] = $owneremailaddr;
3170 3170
                     $sentprops[PR_SENT_REPRESENTING_NAME] = $ownername;
@@ -3176,7 +3176,7 @@  discard block
 block discarded – undo
3176 3176
                 // get the delegate properties and set it into outgoing mail
3177 3177
                 $delegateDetails = $this->getOwnerAddress($userStore, false);
3178 3178
 
3179
-                if($delegateDetails) {
3179
+                if ($delegateDetails) {
3180 3180
                     list($ownername, $owneremailaddr, $owneraddrtype, $ownerentryid, $ownersearchkey) = $delegateDetails;
3181 3181
                     $sentprops[PR_SENDER_EMAIL_ADDRESS] = $owneremailaddr;
3182 3182
                     $sentprops[PR_SENDER_NAME] = $ownername;
@@ -3189,7 +3189,7 @@  discard block
 block discarded – undo
3189 3189
             // normal user is sending mail, so both set of properties will be same
3190 3190
             $userDetails = $this->getOwnerAddress($userStore);
3191 3191
 
3192
-            if($userDetails) {
3192
+            if ($userDetails) {
3193 3193
                 list($ownername, $owneremailaddr, $owneraddrtype, $ownerentryid, $ownersearchkey) = $userDetails;
3194 3194
                 $sentprops[PR_SENT_REPRESENTING_EMAIL_ADDRESS] = $owneremailaddr;
3195 3195
                 $sentprops[PR_SENT_REPRESENTING_NAME] = $ownername;
@@ -3224,7 +3224,7 @@  discard block
 block discarded – undo
3224 3224
 
3225 3225
         $props = mapi_getprops($this->message, array(PR_MESSAGE_CLASS, $this->proptags['goid'], $this->proptags['goid2'], $this->proptags['updatecounter'], $this->proptags['meetingtype'], $this->proptags['owner_critical_change']));
3226 3226
 
3227
-        if(!$this->isMeetingRequest($props[PR_MESSAGE_CLASS])) {
3227
+        if (!$this->isMeetingRequest($props[PR_MESSAGE_CLASS])) {
3228 3228
             return $result;
3229 3229
         }
3230 3230
 
@@ -3239,10 +3239,10 @@  discard block
 block discarded – undo
3239 3239
 
3240 3240
         // if basedate is provided and we could not find the item then it could be that we are checking
3241 3241
         // an exception so get the exception and check it
3242
-        if($basedate && $calendarItem !== false) {
3242
+        if ($basedate && $calendarItem !== false) {
3243 3243
             $exception = $this->getExceptionItem($calendarItem, $basedate);
3244 3244
 
3245
-            if($exception !== false) {
3245
+            if ($exception !== false) {
3246 3246
                 // we are able to find the exception compare with it
3247 3247
                 $calendarItem = $exception;
3248 3248
             } else {
@@ -3252,7 +3252,7 @@  discard block
 block discarded – undo
3252 3252
             }
3253 3253
         }
3254 3254
 
3255
-        if($calendarItem !== false) {
3255
+        if ($calendarItem !== false) {
3256 3256
             $calendarItemProps = mapi_getprops($calendarItem, array(
3257 3257
                                                     $this->proptags['owner_critical_change'],
3258 3258
                                                     $this->proptags['updatecounter']
@@ -3262,7 +3262,7 @@  discard block
 block discarded – undo
3262 3262
 
3263 3263
             $criticalChange = (isset($calendarItemProps[$this->proptags['owner_critical_change']]) && $props[$this->proptags['owner_critical_change']] < $calendarItemProps[$this->proptags['owner_critical_change']]);
3264 3264
 
3265
-            if($updateCounter || $criticalChange) {
3265
+            if ($updateCounter || $criticalChange) {
3266 3266
                 // meeting request is out of date, set properties to indicate this
3267 3267
                 mapi_setprops($this->message, array($this->proptags['meetingtype'] => mtgOutOfDate, PR_ICON_INDEX => 1033));
3268 3268
                 mapi_savechanges($this->message);
@@ -3285,18 +3285,18 @@  discard block
 block discarded – undo
3285 3285
 
3286 3286
         $props = mapi_getprops($this->message, array(PR_MESSAGE_CLASS, $this->proptags['updatecounter']));
3287 3287
 
3288
-        if(!$this->isMeetingRequestResponse($props[PR_MESSAGE_CLASS])) {
3288
+        if (!$this->isMeetingRequestResponse($props[PR_MESSAGE_CLASS])) {
3289 3289
             return $result;
3290 3290
         }
3291 3291
 
3292 3292
         $calendarItem = $this->getCorrespondentCalendarItem(true);
3293 3293
 
3294
-        if($calendarItem !== false) {
3294
+        if ($calendarItem !== false) {
3295 3295
             // basedate is provided so open exception
3296
-            if($basedate !== false) {
3296
+            if ($basedate !== false) {
3297 3297
                 $exception = $this->getExceptionItem($calendarItem, $basedate);
3298 3298
 
3299
-                if($exception !== false) {
3299
+                if ($exception !== false) {
3300 3300
                     // we are able to find the exception compare with it
3301 3301
                     $calendarItem = $exception;
3302 3302
                 } else {
@@ -3306,15 +3306,15 @@  discard block
 block discarded – undo
3306 3306
                 }
3307 3307
             }
3308 3308
 
3309
-            if($calendarItem !== false) {
3309
+            if ($calendarItem !== false) {
3310 3310
                 $calendarItemProps = mapi_getprops($calendarItem, array($this->proptags['updatecounter']));
3311 3311
 
3312 3312
                 /*
3313 3313
                  * if(message_counter < appointment_counter) meeting object is newer then meeting response (meeting is updated)
3314 3314
                  * if(message_counter >= appointment_counter) meeting is not updated, do normal processing
3315 3315
                  */
3316
-                if(isset($calendarItemProps[$this->proptags['updatecounter']], $props[$this->proptags['updatecounter']])) {
3317
-                    if($props[$this->proptags['updatecounter']] < $calendarItemProps[$this->proptags['updatecounter']]) {
3316
+                if (isset($calendarItemProps[$this->proptags['updatecounter']], $props[$this->proptags['updatecounter']])) {
3317
+                    if ($props[$this->proptags['updatecounter']] < $calendarItemProps[$this->proptags['updatecounter']]) {
3318 3318
                         $result = true;
3319 3319
                     }
3320 3320
                 }
@@ -3342,9 +3342,9 @@  discard block
 block discarded – undo
3342 3342
         $attach = null;
3343 3343
 
3344 3344
         // If basedate is specified then we need to open exception message to clear recipient responses
3345
-        if($basedate) {
3345
+        if ($basedate) {
3346 3346
             $recurrence = new Recurrence($this->store, $this->message);
3347
-            if($recurrence->isException($basedate)){
3347
+            if ($recurrence->isException($basedate)) {
3348 3348
                 $attach = $recurrence->getExceptionAttachment($basedate);
3349 3349
                 if ($attach) {
3350 3350
                     $message = mapi_attach_openobj($attach, MAPI_MODIFY);
@@ -3355,14 +3355,14 @@  discard block
 block discarded – undo
3355 3355
             $message = $this->message;
3356 3356
         }
3357 3357
 
3358
-        if(!$message) {
3358
+        if (!$message) {
3359 3359
             return;
3360 3360
         }
3361 3361
 
3362 3362
         $newProps = mapi_getprops($message, array($this->proptags['startdate'], $this->proptags['duedate'], $this->proptags['updatecounter']));
3363 3363
 
3364 3364
         // Check whether message is updated or not.
3365
-        if(isset($newProps[$this->proptags['updatecounter']]) && $newProps[$this->proptags['updatecounter']] == 0) {
3365
+        if (isset($newProps[$this->proptags['updatecounter']]) && $newProps[$this->proptags['updatecounter']] == 0) {
3366 3366
             return;
3367 3367
         }
3368 3368
 
@@ -3389,8 +3389,8 @@  discard block
 block discarded – undo
3389 3389
         $recipTable = mapi_message_getrecipienttable($message);
3390 3390
         $recipsRows = mapi_table_queryallrows($recipTable, $this->recipprops);
3391 3391
 
3392
-        foreach($recipsRows as $recipient) {
3393
-            if(($recipient[PR_RECIPIENT_FLAGS] & recipOrganizer) != recipOrganizer){
3392
+        foreach ($recipsRows as $recipient) {
3393
+            if (($recipient[PR_RECIPIENT_FLAGS] & recipOrganizer) != recipOrganizer) {
3394 3394
                 // Recipient is attendee, set the trackstatus to 'Not Responded'
3395 3395
                 $recipient[PR_RECIPIENT_TRACKSTATUS] = olRecipientTrackStatusNone;
3396 3396
             } else {
@@ -3416,7 +3416,7 @@  discard block
 block discarded – undo
3416 3416
     {
3417 3417
         $props = mapi_getprops($this->message, array(PR_MESSAGE_CLASS, $this->proptags['goid'], $this->proptags['goid2'], PR_RCVD_REPRESENTING_ENTRYID));
3418 3418
 
3419
-        if(!$this->isMeetingRequest($props[PR_MESSAGE_CLASS]) && !$this->isMeetingRequestResponse($props[PR_MESSAGE_CLASS]) && !$this->isMeetingCancellation($props[PR_MESSAGE_CLASS])) {
3419
+        if (!$this->isMeetingRequest($props[PR_MESSAGE_CLASS]) && !$this->isMeetingRequestResponse($props[PR_MESSAGE_CLASS]) && !$this->isMeetingCancellation($props[PR_MESSAGE_CLASS])) {
3420 3420
             // can work only with meeting requests/responses/cancellations
3421 3421
             return false;
3422 3422
         }
@@ -3454,9 +3454,9 @@  discard block
 block discarded – undo
3454 3454
         }
3455 3455
 
3456 3456
         // there should be only one item returned
3457
-        if(!empty($entryids) && count($entryids) === 1) {
3457
+        if (!empty($entryids) && count($entryids) === 1) {
3458 3458
             // return only entryid
3459
-            if($open === false) {
3459
+            if ($open === false) {
3460 3460
                 return $entryids[0];
3461 3461
             }
3462 3462
 
@@ -3482,11 +3482,11 @@  discard block
 block discarded – undo
3482 3482
         $props = mapi_getprops($this->message, array(PR_RCVD_REPRESENTING_ENTRYID, $this->proptags['recurring']));
3483 3483
 
3484 3484
         // check if the passed item is recurring series
3485
-        if($props[$this->proptags['recurring']] !== false) {
3485
+        if ($props[$this->proptags['recurring']] !== false) {
3486 3486
             return false;
3487 3487
         }
3488 3488
 
3489
-        if($store === false) {
3489
+        if ($store === false) {
3490 3490
             // If Delegate is processing Meeting Request/Response for Delegator then retrieve Delegator's store and calendar.
3491 3491
             if (isset($props[PR_RCVD_REPRESENTING_ENTRYID])) {
3492 3492
                 $delegatorStore = $this->getDelegatorStore($props[PR_RCVD_REPRESENTING_ENTRYID]);
@@ -3498,7 +3498,7 @@  discard block
 block discarded – undo
3498 3498
 
3499 3499
         $recurr = new Recurrence($store, $recurringMessage);
3500 3500
         $attach = $recurr->getExceptionAttachment($basedate);
3501
-        if($attach) {
3501
+        if ($attach) {
3502 3502
             $occurItem = mapi_attach_openobj($attach);
3503 3503
         }
3504 3504
 
@@ -3519,7 +3519,7 @@  discard block
 block discarded – undo
3519 3519
         $returnValue = false;
3520 3520
         $noOfInstances = 0;
3521 3521
 
3522
-        if($message === false) {
3522
+        if ($message === false) {
3523 3523
             $message = $this->message;
3524 3524
         }
3525 3525
 
@@ -3538,7 +3538,7 @@  discard block
 block discarded – undo
3538 3538
                 )
3539 3539
         );
3540 3540
 
3541
-        if($userStore === false) {
3541
+        if ($userStore === false) {
3542 3542
             $userStore = $this->store;
3543 3543
 
3544 3544
             // check if delegate is processing the response
@@ -3550,16 +3550,16 @@  discard block
 block discarded – undo
3550 3550
             }
3551 3551
         }
3552 3552
 
3553
-        if($calFolder === false) {
3553
+        if ($calFolder === false) {
3554 3554
             $calFolder = $this->openDefaultCalendar($userStore);
3555 3555
         }
3556 3556
 
3557
-        if($calFolder) {
3557
+        if ($calFolder) {
3558 3558
             // Meeting request is recurring, so get all occurrence and check for each occurrence whether it conflicts with other appointments in Calendar.
3559 3559
             if (isset($messageProps[$this->proptags['recurring']]) && $messageProps[$this->proptags['recurring']] === true) {
3560 3560
                 // Apply recurrence class and retrieve all occurrences(max: 30 occurrence because recurrence can also be set as 'no end date')
3561 3561
                 $recurr = new Recurrence($userStore, $message);
3562
-                $items = $recurr->getItems($messageProps[$this->proptags['clipstart']], $messageProps[$this->proptags['clipend']] * (24*24*60), 30);
3562
+                $items = $recurr->getItems($messageProps[$this->proptags['clipstart']], $messageProps[$this->proptags['clipend']] * (24 * 24 * 60), 30);
3563 3563
 
3564 3564
                 foreach ($items as $item) {
3565 3565
                     // Get all items in the timeframe that we want to book, and get the goid and busystatus for each item
@@ -3571,7 +3571,7 @@  discard block
 block discarded – undo
3571 3571
                              * Only meeting requests have globalID, normal appointments do not have globalID
3572 3572
                              * so if any normal appointment if found then it is assumed to be conflict.
3573 3573
                              */
3574
-                            if(isset($calendarItem[$this->proptags['goid']])) {
3574
+                            if (isset($calendarItem[$this->proptags['goid']])) {
3575 3575
                                 if ($calendarItem[$this->proptags['goid']] !== $messageProps[$this->proptags['goid']]) {
3576 3576
                                     $noOfInstances++;
3577 3577
                                     break;
@@ -3584,14 +3584,14 @@  discard block
 block discarded – undo
3584 3584
                     }
3585 3585
                 }
3586 3586
 
3587
-                if($noOfInstances > 0) {
3587
+                if ($noOfInstances > 0) {
3588 3588
                     $returnValue = $noOfInstances;
3589 3589
                 }
3590 3590
             } else {
3591 3591
                 // Get all items in the timeframe that we want to book, and get the goid and busystatus for each item
3592 3592
                 $items = getCalendarItems($userStore, $calFolder, $messageProps[$this->proptags['startdate']], $messageProps[$this->proptags['duedate']], array($this->proptags['goid'], $this->proptags['busystatus']));
3593 3593
 
3594
-                if(isset($messageProps[$this->proptags['basedate']]) && !empty($messageProps[$this->proptags['basedate']])) {
3594
+                if (isset($messageProps[$this->proptags['basedate']]) && !empty($messageProps[$this->proptags['basedate']])) {
3595 3595
                     $basedate = $messageProps[$this->proptags['basedate']];
3596 3596
                     // Get the goid2 from recurring MR which further used to
3597 3597
                     // check the resource conflicts item.
@@ -3600,9 +3600,9 @@  discard block
 block discarded – undo
3600 3600
                     $messageProps[$this->proptags['goid2']] = $recurrItemProps[$this->proptags['goid2']];
3601 3601
                 }
3602 3602
 
3603
-                foreach($items as $item) {
3603
+                foreach ($items as $item) {
3604 3604
                     if ($item[$this->proptags['busystatus']] !== fbFree) {
3605
-                        if(isset($item[$this->proptags['goid']])) {
3605
+                        if (isset($item[$this->proptags['goid']])) {
3606 3606
                             if (($item[$this->proptags['goid']] !== $messageProps[$this->proptags['goid']])
3607 3607
                                 && ($item[$this->proptags['goid']] !== $messageProps[$this->proptags['goid2']])) {
3608 3608
                                 $returnValue = true;
@@ -3632,12 +3632,12 @@  discard block
 block discarded – undo
3632 3632
     {
3633 3633
         $hasDelegator = false;
3634 3634
         // Check if meeting already has an organizer.
3635
-        foreach ($recipients as $key => $recipient){
3635
+        foreach ($recipients as $key => $recipient) {
3636 3636
             if (isset($messageProps[PR_RCVD_REPRESENTING_EMAIL_ADDRESS]) && $recipient[PR_EMAIL_ADDRESS] == $messageProps[PR_RCVD_REPRESENTING_EMAIL_ADDRESS])
3637 3637
                 $hasDelegator = true;
3638 3638
         }
3639 3639
 
3640
-        if (!$hasDelegator){
3640
+        if (!$hasDelegator) {
3641 3641
             // Create delegator.
3642 3642
             $delegator = array();
3643 3643
             $delegator[PR_ENTRYID] = $messageProps[PR_RCVD_REPRESENTING_ENTRYID];
@@ -3645,7 +3645,7 @@  discard block
 block discarded – undo
3645 3645
             $delegator[PR_EMAIL_ADDRESS] = $messageProps[PR_RCVD_REPRESENTING_EMAIL_ADDRESS];
3646 3646
             $delegator[PR_RECIPIENT_TYPE] = MAPI_TO;
3647 3647
             $delegator[PR_RECIPIENT_DISPLAY_NAME] = $messageProps[PR_RCVD_REPRESENTING_NAME];
3648
-            $delegator[PR_ADDRTYPE] = empty($messageProps[PR_RCVD_REPRESENTING_ADDRTYPE]) ? 'SMTP':$messageProps[PR_RCVD_REPRESENTING_ADDRTYPE];
3648
+            $delegator[PR_ADDRTYPE] = empty($messageProps[PR_RCVD_REPRESENTING_ADDRTYPE]) ? 'SMTP' : $messageProps[PR_RCVD_REPRESENTING_ADDRTYPE];
3649 3649
             $delegator[PR_RECIPIENT_TRACKSTATUS] = olRecipientTrackStatusNone;
3650 3650
             $delegator[PR_RECIPIENT_FLAGS] = recipSendable;
3651 3651
             $delegator[PR_SEARCH_KEY] = $messageProps[PR_RCVD_REPRESENTING_SEARCH_KEY];
@@ -3668,19 +3668,19 @@  discard block
 block discarded – undo
3668 3668
         $delegatorStore = $this->openCustomUserStore($receivedRepresentingEntryId);
3669 3669
         $returnData['store'] = $delegatorStore;
3670 3670
 
3671
-        if(!empty($foldersToOpen)) {
3672
-            for($index = 0, $len = count($foldersToOpen); $index < $len; $index++) {
3671
+        if (!empty($foldersToOpen)) {
3672
+            for ($index = 0, $len = count($foldersToOpen); $index < $len; $index++) {
3673 3673
                 $folderType = $foldersToOpen[$index];
3674 3674
 
3675 3675
                 // first try with default folders
3676 3676
                 $folder = $this->openDefaultFolder($folderType, $delegatorStore);
3677 3677
 
3678 3678
                 // if folder not found then try with base folders
3679
-                if($folder === false) {
3679
+                if ($folder === false) {
3680 3680
                     $folder = $this->openBaseFolder($folderType, $delegatorStore);
3681 3681
                 }
3682 3682
 
3683
-                if($folder === false) {
3683
+                if ($folder === false) {
3684 3684
                     // we are still not able to get the folder so give up
3685 3685
                     continue;
3686 3686
                 }
@@ -3728,7 +3728,7 @@  discard block
 block discarded – undo
3728 3728
         $recurrence = new Recurrence($store, $calendarItem);
3729 3729
 
3730 3730
         //Retrieve all occurrences(max: 30 occurrence because recurrence can also be set as 'no end date')
3731
-        $items = $recurrence->getItems($calendarItemProps[$this->proptags['clipstart']], $calendarItemProps[$this->proptags['clipend']] * (24*24*60), 30);
3731
+        $items = $recurrence->getItems($calendarItemProps[$this->proptags['clipstart']], $calendarItemProps[$this->proptags['clipend']] * (24 * 24 * 60), 30);
3732 3732
         $localCategories = array();
3733 3733
 
3734 3734
         foreach ($items as $item) {
Please login to merge, or discard this patch.
mapi/class.baserecurrence.php 1 patch
Spacing   +284 added lines, -284 removed lines patch added patch discarded remove patch
@@ -52,14 +52,14 @@  discard block
 block discarded – undo
52 52
         {
53 53
             $this->store = $store;
54 54
 
55
-            if(is_array($message)) {
55
+            if (is_array($message)) {
56 56
                 $this->messageprops = $message;
57 57
             } else {
58 58
                 $this->message = $message;
59 59
                 $this->messageprops = mapi_getprops($this->message, $this->proptags);
60 60
             }
61 61
 
62
-            if(isset($this->messageprops[$this->proptags["recurring_data"]])) {
62
+            if (isset($this->messageprops[$this->proptags["recurring_data"]])) {
63 63
                 // There is a possibility that recurr blob can be more than 255 bytes so get full blob through stream interface
64 64
                 if (strlen($this->messageprops[$this->proptags["recurring_data"]]) >= 255) {
65 65
                     $this->getFullRecurrenceBlob();
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
 
68 68
                 $this->recur = $this->parseRecurrence($this->messageprops[$this->proptags["recurring_data"]]);
69 69
             }
70
-            if(isset($this->proptags["timezone_data"], $this->messageprops[$this->proptags["timezone_data"]])) {
70
+            if (isset($this->proptags["timezone_data"], $this->messageprops[$this->proptags["timezone_data"]])) {
71 71
                 $this->tz = $this->parseTimezone($this->messageprops[$this->proptags["timezone_data"]]);
72 72
             }
73 73
         }
@@ -171,7 +171,7 @@  discard block
 block discarded – undo
171 171
                     $ret["everyn"] = $data["everyn"];
172 172
                     $ret["regen"] = $data["regen"];
173 173
 
174
-                    switch($ret["subtype"])
174
+                    switch ($ret["subtype"])
175 175
                     {
176 176
                         case 0:
177 177
                             $rdata = substr($rdata, 12);
@@ -271,7 +271,7 @@  discard block
 block discarded – undo
271 271
 
272 272
             // exc_base_dates are *all* the base dates that have been either deleted or modified
273 273
             $exc_base_dates = array();
274
-            for($i = 0; $i < $ret["numexcept"]; $i++)
274
+            for ($i = 0; $i < $ret["numexcept"]; $i++)
275 275
             {
276 276
                 if (strlen($rdata) < 4) {
277 277
                     // We shouldn't arrive here, because that implies
@@ -296,7 +296,7 @@  discard block
 block discarded – undo
296 296
             // exc_changed are the base dates of *modified* occurrences. exactly what is modified
297 297
             // is in the attachments *and* in the data further down this function.
298 298
             $exc_changed = array();
299
-            for($i = 0; $i < $ret["numexceptmod"]; $i++)
299
+            for ($i = 0; $i < $ret["numexceptmod"]; $i++)
300 300
             {
301 301
                 if (strlen($rdata) < 4) {
302 302
                     // We shouldn't arrive here, because that implies
@@ -338,7 +338,7 @@  discard block
 block discarded – undo
338 338
             $exc_changed_details = array();
339 339
 
340 340
             // Parse n modified exceptions
341
-            for($i=0;$i<$nexceptions;$i++)
341
+            for ($i = 0; $i < $nexceptions; $i++)
342 342
             {
343 343
                 $item = array();
344 344
 
@@ -365,13 +365,13 @@  discard block
 block discarded – undo
365 365
 
366 366
                 // ARO_SUBJECT: 0x0001
367 367
                 // Look for field: SubjectLength (2b), SubjectLength2 (2b) and Subject
368
-                if(($bitmask &(1 << 0))) {
368
+                if (($bitmask &(1 << 0))) {
369 369
                     $data = unpack("vnull_length/vlength", $rdata);
370 370
                     $rdata = substr($rdata, 4);
371 371
 
372 372
                     $length = $data["length"];
373 373
                     $item["subject"] = ""; // Normalized subject
374
-                    for($j = 0; $j < $length && strlen($rdata); $j++)
374
+                    for ($j = 0; $j < $length && strlen($rdata); $j++)
375 375
                     {
376 376
                         $data = unpack("Cchar", $rdata);
377 377
                         $rdata = substr($rdata, 1);
@@ -381,14 +381,14 @@  discard block
 block discarded – undo
381 381
                 }
382 382
 
383 383
                 // ARO_MEETINGTYPE: 0x0002
384
-                if(($bitmask &(1 << 1))) {
384
+                if (($bitmask &(1 << 1))) {
385 385
                     $rdata = substr($rdata, 4);
386 386
                     // Attendees modified: no data here (only in attachment)
387 387
                 }
388 388
 
389 389
                 // ARO_REMINDERDELTA: 0x0004
390 390
                 // Look for field: ReminderDelta (4b)
391
-                if(($bitmask &(1 << 2))) {
391
+                if (($bitmask &(1 << 2))) {
392 392
                     $data = unpack("Vremind_before", $rdata);
393 393
                     $rdata = substr($rdata, 4);
394 394
 
@@ -397,7 +397,7 @@  discard block
 block discarded – undo
397 397
 
398 398
                 // ARO_REMINDER: 0x0008
399 399
                 // Look field: ReminderSet (4b)
400
-                if(($bitmask &(1 << 3))) {
400
+                if (($bitmask &(1 << 3))) {
401 401
                     $data = unpack("Vreminder_set", $rdata);
402 402
                     $rdata = substr($rdata, 4);
403 403
 
@@ -407,7 +407,7 @@  discard block
 block discarded – undo
407 407
                 // ARO_LOCATION: 0x0010
408 408
                 // Look for fields: LocationLength (2b), LocationLength2 (2b) and Location
409 409
                 // Similar to ARO_SUBJECT above.
410
-                if(($bitmask &(1 << 4))) {
410
+                if (($bitmask &(1 << 4))) {
411 411
                     $data = unpack("vnull_length/vlength", $rdata);
412 412
                     $rdata = substr($rdata, 4);
413 413
 
@@ -422,7 +422,7 @@  discard block
 block discarded – undo
422 422
 
423 423
                 // ARO_BUSYSTATUS: 0x0020
424 424
                 // Look for field: BusyStatus (4b)
425
-                if(($bitmask &(1 << 5))) {
425
+                if (($bitmask &(1 << 5))) {
426 426
                     $data = unpack("Vbusystatus", $rdata);
427 427
                     $rdata = substr($rdata, 4);
428 428
 
@@ -430,14 +430,14 @@  discard block
 block discarded – undo
430 430
                 }
431 431
 
432 432
                 // ARO_ATTACHMENT: 0x0040
433
-                if(($bitmask &(1 << 6))) {
433
+                if (($bitmask &(1 << 6))) {
434 434
                     // no data: RESERVED
435 435
                     $rdata = substr($rdata, 4);
436 436
                 }
437 437
 
438 438
                 // ARO_SUBTYPE: 0x0080
439 439
                 // Look for field: SubType (4b). Determines whether it is an allday event.
440
-                if(($bitmask &(1 << 7))) {
440
+                if (($bitmask &(1 << 7))) {
441 441
                     $data = unpack("Vallday", $rdata);
442 442
                     $rdata = substr($rdata, 4);
443 443
 
@@ -446,7 +446,7 @@  discard block
 block discarded – undo
446 446
 
447 447
                 // ARO_APPTCOLOR: 0x0100
448 448
                 // Look for field: AppointmentColor (4b)
449
-                if(($bitmask &(1 << 8))) {
449
+                if (($bitmask &(1 << 8))) {
450 450
                     $data = unpack("Vlabel", $rdata);
451 451
                     $rdata = substr($rdata, 4);
452 452
 
@@ -454,7 +454,7 @@  discard block
 block discarded – undo
454 454
                 }
455 455
 
456 456
                 // ARO_EXCEPTIONAL_BODY: 0x0200
457
-                if(($bitmask &(1 << 9))) {
457
+                if (($bitmask &(1 << 9))) {
458 458
                     // Notes or Attachments modified: no data here (only in attachment)
459 459
                 }
460 460
 
@@ -471,16 +471,16 @@  discard block
 block discarded – undo
471 471
             // Find deleted occurrences
472 472
             $deleted_occurences = array();
473 473
 
474
-            foreach($exc_base_dates as $base_date) {
474
+            foreach ($exc_base_dates as $base_date) {
475 475
                 $found = false;
476 476
 
477
-                foreach($exc_changed_details as $details) {
478
-                    if($details["basedate"] == $base_date) {
477
+                foreach ($exc_changed_details as $details) {
478
+                    if ($details["basedate"] == $base_date) {
479 479
                         $found = true;
480 480
                         break;
481 481
                     }
482 482
                 }
483
-                if(! $found) {
483
+                if (!$found) {
484 484
                     // item was not in exc_changed_details, so it must be deleted
485 485
                     $deleted_occurences[] = $base_date;
486 486
                 }
@@ -497,7 +497,7 @@  discard block
 block discarded – undo
497 497
             $data = unpack("Vreservedsize", $rdata);
498 498
             $rdata = substr($rdata, 4 + $data["reservedsize"]);
499 499
 
500
-            for($i=0;$i<$nexceptions;$i++)
500
+            for ($i = 0; $i < $nexceptions; $i++)
501 501
             {
502 502
                 // subject and location in ucs-2 to utf-8
503 503
                 if ($writerversion >= 0x3009) {
@@ -564,48 +564,48 @@  discard block
 block discarded – undo
564 564
         function saveRecurrence()
565 565
         {
566 566
             // Only save if a message was passed
567
-            if(!isset($this->message))
567
+            if (!isset($this->message))
568 568
                 return;
569 569
 
570 570
             // Abort if no recurrence was set
571
-            if(!isset($this->recur["type"], $this->recur["subtype"], $this->recur["start"], $this->recur["end"], $this->recur["startocc"], $this->recur["endocc"])) {
571
+            if (!isset($this->recur["type"], $this->recur["subtype"], $this->recur["start"], $this->recur["end"], $this->recur["startocc"], $this->recur["endocc"])) {
572 572
                 return;
573 573
             }
574 574
 
575
-            $rdata = pack("CCCCCCV", 0x04, 0x30, 0x04, 0x30, (int) $this->recur["type"], 0x20, (int) $this->recur["subtype"]);
575
+            $rdata = pack("CCCCCCV", 0x04, 0x30, 0x04, 0x30, (int)$this->recur["type"], 0x20, (int)$this->recur["subtype"]);
576 576
 
577 577
             $weekstart = 1; //monday
578 578
             $forwardcount = 0;
579 579
             $restocc = 0;
580
-            $dayofweek = (int) gmdate("w", (int) $this->recur["start"]); //0 (for Sunday) through 6 (for Saturday)
580
+            $dayofweek = (int)gmdate("w", (int)$this->recur["start"]); //0 (for Sunday) through 6 (for Saturday)
581 581
 
582
-            $term = (int) $this->recur["type"];
583
-            switch($term)
582
+            $term = (int)$this->recur["type"];
583
+            switch ($term)
584 584
             {
585 585
                 case 0x0A:
586 586
                     // Daily
587
-                    if(!isset($this->recur["everyn"])) {
587
+                    if (!isset($this->recur["everyn"])) {
588 588
                         return;
589 589
                     }
590 590
 
591
-                    if($this->recur["subtype"] == 1) {
591
+                    if ($this->recur["subtype"] == 1) {
592 592
 
593 593
                         // Daily every workday
594 594
                         $rdata .= pack("VVVV", (6 * 24 * 60), 1, 0, 0x3E);
595 595
                     } else {
596 596
                         // Daily every N days (everyN in minutes)
597 597
 
598
-                        $everyn =  ((int) $this->recur["everyn"]) / 1440;
598
+                        $everyn = ((int)$this->recur["everyn"]) / 1440;
599 599
 
600 600
                         // Calc first occ
601
-                        $firstocc = $this->unixDataToRecurData($this->recur["start"]) % ((int) $this->recur["everyn"]);
601
+                        $firstocc = $this->unixDataToRecurData($this->recur["start"]) % ((int)$this->recur["everyn"]);
602 602
 
603
-                        $rdata .= pack("VVV", $firstocc, (int) $this->recur["everyn"], $this->recur["regen"] ? 1 : 0);
603
+                        $rdata .= pack("VVV", $firstocc, (int)$this->recur["everyn"], $this->recur["regen"] ? 1 : 0);
604 604
                     }
605 605
                     break;
606 606
                 case 0x0B:
607 607
                     // Weekly
608
-                    if(!isset($this->recur["everyn"])) {
608
+                    if (!isset($this->recur["everyn"])) {
609 609
                         return;
610 610
                     }
611 611
 
@@ -620,9 +620,9 @@  discard block
 block discarded – undo
620 620
                         // Find the first day that matches one of the weekdays selected
621 621
                         $daycount = 0;
622 622
                         $dayskip = -1;
623
-                        for($j = 0; $j < 7; $j++) {
624
-                            if(((int) $this->recur["weekdays"]) & (1<<( ($dayofweek+$j)%7)) ) {
625
-                                if($dayskip == -1)
623
+                        for ($j = 0; $j < 7; $j++) {
624
+                            if (((int)$this->recur["weekdays"]) & (1 << (($dayofweek + $j) % 7))) {
625
+                                if ($dayskip == -1)
626 626
                                     $dayskip = $j;
627 627
 
628 628
                                 $daycount++;
@@ -633,80 +633,80 @@  discard block
 block discarded – undo
633 633
                         // $daycount is the number of days per week that an occurrence occurs
634 634
 
635 635
                         $weekskip = 0;
636
-                        if(($dayofweek < $weekstart && $dayskip > 0) || ($dayofweek+$dayskip) > 6)
636
+                        if (($dayofweek < $weekstart && $dayskip > 0) || ($dayofweek + $dayskip) > 6)
637 637
                             $weekskip = 1;
638 638
 
639 639
                         // Check if the recurrence ends after a number of occurences, in that case we must calculate the
640 640
                         // remaining occurences based on the start of the recurrence.
641
-                        if (((int) $this->recur["term"]) == 0x22) {
641
+                        if (((int)$this->recur["term"]) == 0x22) {
642 642
                             // $weekskip is the amount of weeks to skip from the startdate before the first occurence
643 643
                             // $forwardcount is the maximum number of week occurrences we can go ahead after the first occurrence that
644 644
                             // is still inside the recurrence. We subtract one to make sure that the last week is never forwarded over
645 645
                             // (eg when numoccur = 2, and daycount = 1)
646
-                            $forwardcount = floor( (int) ($this->recur["numoccur"] -1 ) / $daycount);
646
+                            $forwardcount = floor((int)($this->recur["numoccur"] - 1) / $daycount);
647 647
 
648 648
                             // $restocc is the number of occurrences left after $forwardcount whole weeks of occurrences, minus one
649 649
                             // for the occurrence on the first day
650
-                            $restocc = ((int) $this->recur["numoccur"]) - ($forwardcount*$daycount) - 1;
650
+                            $restocc = ((int)$this->recur["numoccur"]) - ($forwardcount * $daycount) - 1;
651 651
 
652 652
                             // $forwardcount is now the number of weeks we can go forward and still be inside the recurrence
653
-                            $forwardcount *= (int) $this->recur["everyn"];
653
+                            $forwardcount *= (int)$this->recur["everyn"];
654 654
                         }
655 655
 
656 656
                         // The real start is start + dayskip + weekskip-1 (since dayskip will already bring us into the next week)
657
-                        $this->recur["start"] = ((int) $this->recur["start"]) + ($dayskip * 24*60*60)+ ($weekskip *(((int) $this->recur["everyn"]) - 1) * 7 * 24*60*60);
657
+                        $this->recur["start"] = ((int)$this->recur["start"]) + ($dayskip * 24 * 60 * 60) + ($weekskip * (((int)$this->recur["everyn"]) - 1) * 7 * 24 * 60 * 60);
658 658
                     }
659 659
 
660 660
                     // Calc first occ
661
-                    $firstocc = ($this->unixDataToRecurData($this->recur["start"]) ) % ( ((int) $this->recur["everyn"]) * 7 * 24 * 60);
661
+                    $firstocc = ($this->unixDataToRecurData($this->recur["start"])) % (((int)$this->recur["everyn"]) * 7 * 24 * 60);
662 662
 
663
-                    $firstocc -= (((int) gmdate("w", (int) $this->recur["start"])) - 1) * 24 * 60;
663
+                    $firstocc -= (((int)gmdate("w", (int)$this->recur["start"])) - 1) * 24 * 60;
664 664
 
665 665
                     if ($this->recur["regen"])
666
-                        $rdata .= pack("VVV", $firstocc, (int) $this->recur["everyn"], 1);
666
+                        $rdata .= pack("VVV", $firstocc, (int)$this->recur["everyn"], 1);
667 667
                     else
668
-                        $rdata .= pack("VVVV", $firstocc, (int) $this->recur["everyn"], 0, (int) $this->recur["weekdays"]);
668
+                        $rdata .= pack("VVVV", $firstocc, (int)$this->recur["everyn"], 0, (int)$this->recur["weekdays"]);
669 669
                     break;
670 670
                 case 0x0C:
671 671
                     // Monthly
672 672
                 case 0x0D:
673 673
                     // Yearly
674
-                    if(!isset($this->recur["everyn"])) {
674
+                    if (!isset($this->recur["everyn"])) {
675 675
                         return;
676 676
                     }
677
-                    if($term == 0x0D /*yearly*/ && !isset($this->recur["month"])) {
677
+                    if ($term == 0x0D /*yearly*/ && !isset($this->recur["month"])) {
678 678
                         return;
679 679
                     }
680 680
 
681
-                    if($term == 0x0C /*monthly*/) {
682
-                        $everyn = (int) $this->recur["everyn"];
683
-                    }else {
684
-                        $everyn = $this->recur["regen"] ? ((int) $this->recur["everyn"]) * 12 : 12;
681
+                    if ($term == 0x0C /*monthly*/) {
682
+                        $everyn = (int)$this->recur["everyn"];
683
+                    } else {
684
+                        $everyn = $this->recur["regen"] ? ((int)$this->recur["everyn"]) * 12 : 12;
685 685
                     }
686 686
 
687 687
                     // Get montday/month/year of original start
688
-                    $curmonthday = gmdate("j", (int) $this->recur["start"] );
689
-                    $curyear = gmdate("Y", (int) $this->recur["start"] );
690
-                    $curmonth = gmdate("n", (int) $this->recur["start"] );
688
+                    $curmonthday = gmdate("j", (int)$this->recur["start"]);
689
+                    $curyear = gmdate("Y", (int)$this->recur["start"]);
690
+                    $curmonth = gmdate("n", (int)$this->recur["start"]);
691 691
 
692 692
                     // Check if the recurrence ends after a number of occurences, in that case we must calculate the
693 693
                     // remaining occurences based on the start of the recurrence.
694
-                    if (((int) $this->recur["term"]) == 0x22) {
694
+                    if (((int)$this->recur["term"]) == 0x22) {
695 695
                         // $forwardcount is the number of occurrences we can skip and still be inside the recurrence range (minus
696 696
                         // one to make sure there are always at least one occurrence left)
697
-                        $forwardcount = ((((int) $this->recur["numoccur"])-1) * $everyn );
697
+                        $forwardcount = ((((int)$this->recur["numoccur"]) - 1) * $everyn);
698 698
                     }
699 699
 
700 700
                     // Get month for yearly on D'th day of month M
701
-                    if($term == 0x0D /*yearly*/) {
702
-                        $selmonth = floor(((int) $this->recur["month"]) / (24 * 60 *29)) + 1; // 1=jan, 2=feb, eg
701
+                    if ($term == 0x0D /*yearly*/) {
702
+                        $selmonth = floor(((int)$this->recur["month"]) / (24 * 60 * 29)) + 1; // 1=jan, 2=feb, eg
703 703
                     }
704 704
 
705
-                    switch((int) $this->recur["subtype"])
705
+                    switch ((int)$this->recur["subtype"])
706 706
                     {
707 707
                         // on D day of every M month
708 708
                         case 2:
709
-                            if(!isset($this->recur["monthday"])) {
709
+                            if (!isset($this->recur["monthday"])) {
710 710
                                 return;
711 711
                             }
712 712
                             // Recalc startdate
@@ -714,13 +714,13 @@  discard block
 block discarded – undo
714 714
                             // Set on the right begin day
715 715
 
716 716
                             // Go the beginning of the month
717
-                            $this->recur["start"] -= ($curmonthday-1) * 24*60*60;
717
+                            $this->recur["start"] -= ($curmonthday - 1) * 24 * 60 * 60;
718 718
                             // Go the the correct month day
719
-                            $this->recur["start"] += (((int) $this->recur["monthday"])-1) * 24*60*60;
719
+                            $this->recur["start"] += (((int)$this->recur["monthday"]) - 1) * 24 * 60 * 60;
720 720
 
721 721
                             // If the previous calculation gave us a start date different than the original start date, then we need to skip to the first occurrence
722
-                            if ( ($term == 0x0C /*monthly*/ && ((int) $this->recur["monthday"]) < $curmonthday) ||
723
-                                ($term == 0x0D /*yearly*/ && ( $selmonth != $curmonth || ($selmonth == $curmonth && ((int) $this->recur["monthday"]) < $curmonthday)) ))
722
+                            if (($term == 0x0C /*monthly*/ && ((int)$this->recur["monthday"]) < $curmonthday) ||
723
+                                ($term == 0x0D /*yearly*/ && ($selmonth != $curmonth || ($selmonth == $curmonth && ((int)$this->recur["monthday"]) < $curmonthday))))
724 724
                             {
725 725
                                 if ($term == 0x0D /*yearly*/) {
726 726
                                     if ($curmonth > $selmonth) {//go to next occurrence in 'everyn' months minus difference in first occurrence and original date
@@ -729,7 +729,7 @@  discard block
 block discarded – undo
729 729
                                         $count = $selmonth - $curmonth;
730 730
                                     } else {
731 731
                                         // Go to next occurrence while recurrence start date is greater than occurrence date but within same month
732
-                                        if (((int) $this->recur["monthday"]) < $curmonthday) {
732
+                                        if (((int)$this->recur["monthday"]) < $curmonthday) {
733 733
                                             $count = $everyn;
734 734
                                         }
735 735
                                     }
@@ -738,10 +738,10 @@  discard block
 block discarded – undo
738 738
                                 }
739 739
 
740 740
                                 // Forward by $count months. This is done by getting the number of days in that month and forwarding that many days
741
-                                for($i=0; $i < $count; $i++) {
741
+                                for ($i = 0; $i < $count; $i++) {
742 742
                                     $this->recur["start"] += $this->getMonthInSeconds($curyear, $curmonth);
743 743
 
744
-                                    if($curmonth == 12) {
744
+                                    if ($curmonth == 12) {
745 745
                                         $curyear++;
746 746
                                         $curmonth = 0;
747 747
                                     }
@@ -754,110 +754,110 @@  discard block
 block discarded – undo
754 754
                             // of each month will overshoot in february (29 days). We compensate for that by checking
755 755
                             // if the day of the month we got is wrong, and then back up to the last day of the previous
756 756
                             // month.
757
-                            if(((int) $this->recur["monthday"]) >=28 && ((int) $this->recur["monthday"]) <= 31 &&
758
-                                gmdate("j", ((int) $this->recur["start"])) < ((int) $this->recur["monthday"]))
757
+                            if (((int)$this->recur["monthday"]) >= 28 && ((int)$this->recur["monthday"]) <= 31 &&
758
+                                gmdate("j", ((int)$this->recur["start"])) < ((int)$this->recur["monthday"]))
759 759
                             {
760
-                                $this->recur["start"] -= gmdate("j", ((int) $this->recur["start"])) * 24 * 60 *60;
760
+                                $this->recur["start"] -= gmdate("j", ((int)$this->recur["start"])) * 24 * 60 * 60;
761 761
                             }
762 762
 
763 763
                             // "start" is now the first occurrence
764 764
 
765
-                            if($term == 0x0C /*monthly*/) {
765
+                            if ($term == 0x0C /*monthly*/) {
766 766
                                 // Calc first occ
767
-                                $monthIndex = ((((12%$everyn) * ((((int) gmdate("Y", $this->recur["start"])) - 1601)%$everyn)) % $everyn) + (((int) gmdate("n", $this->recur["start"])) - 1))%$everyn;
767
+                                $monthIndex = ((((12 % $everyn) * ((((int)gmdate("Y", $this->recur["start"])) - 1601) % $everyn)) % $everyn) + (((int)gmdate("n", $this->recur["start"])) - 1)) % $everyn;
768 768
 
769 769
                                 $firstocc = 0;
770
-                                for($i=0; $i < $monthIndex; $i++) {
771
-                                    $firstocc+= $this->getMonthInSeconds(1601 + floor($i/12), ($i%12)+1) / 60;
770
+                                for ($i = 0; $i < $monthIndex; $i++) {
771
+                                    $firstocc += $this->getMonthInSeconds(1601 + floor($i / 12), ($i % 12) + 1) / 60;
772 772
                                 }
773 773
 
774
-                                $rdata .= pack("VVVV", $firstocc, $everyn, $this->recur["regen"], (int) $this->recur["monthday"]);
775
-                            } else{
774
+                                $rdata .= pack("VVVV", $firstocc, $everyn, $this->recur["regen"], (int)$this->recur["monthday"]);
775
+                            } else {
776 776
                                 // Calc first occ
777 777
                                 $firstocc = 0;
778
-                                $monthIndex = (int) gmdate("n", $this->recur["start"]);
779
-                                for($i=1; $i < $monthIndex; $i++) {
780
-                                    $firstocc+= $this->getMonthInSeconds(1601 + floor($i/12), $i) / 60;
778
+                                $monthIndex = (int)gmdate("n", $this->recur["start"]);
779
+                                for ($i = 1; $i < $monthIndex; $i++) {
780
+                                    $firstocc += $this->getMonthInSeconds(1601 + floor($i / 12), $i) / 60;
781 781
                                 }
782 782
 
783
-                                $rdata .= pack("VVVV", $firstocc, $everyn, $this->recur["regen"], (int) $this->recur["monthday"]);
783
+                                $rdata .= pack("VVVV", $firstocc, $everyn, $this->recur["regen"], (int)$this->recur["monthday"]);
784 784
                             }
785 785
                             break;
786 786
 
787 787
                         case 3:
788 788
                             // monthly: on Nth weekday of every M month
789 789
                             // yearly: on Nth weekday of M month
790
-                            if(!isset($this->recur["weekdays"], $this->recur["nday"])) {
790
+                            if (!isset($this->recur["weekdays"], $this->recur["nday"])) {
791 791
                                 return;
792 792
                             }
793 793
 
794
-                            $weekdays = (int) $this->recur["weekdays"];
795
-                            $nday = (int) $this->recur["nday"];
794
+                            $weekdays = (int)$this->recur["weekdays"];
795
+                            $nday = (int)$this->recur["nday"];
796 796
 
797 797
                             // Calc startdate
798
-                            $monthbegindow = (int) $this->recur["start"];
798
+                            $monthbegindow = (int)$this->recur["start"];
799 799
 
800
-                            if($nday == 5) {
800
+                            if ($nday == 5) {
801 801
                                 // Set date on the last day of the last month
802
-                                $monthbegindow += (gmdate("t", $monthbegindow ) - gmdate("j", $monthbegindow )) * 24 * 60 * 60;
803
-                            }else {
802
+                                $monthbegindow += (gmdate("t", $monthbegindow) - gmdate("j", $monthbegindow)) * 24 * 60 * 60;
803
+                            } else {
804 804
                                 // Set on the first day of the month
805
-                                $monthbegindow -= ((gmdate("j", $monthbegindow )-1) * 24 * 60 * 60);
805
+                                $monthbegindow -= ((gmdate("j", $monthbegindow) - 1) * 24 * 60 * 60);
806 806
                             }
807 807
 
808
-                            if($term == 0x0D /*yearly*/) {
808
+                            if ($term == 0x0D /*yearly*/) {
809 809
                                 // Set on right month
810
-                                if($selmonth < $curmonth)
810
+                                if ($selmonth < $curmonth)
811 811
                                     $tmp = 12 - $curmonth + $selmonth;
812 812
                                 else
813 813
                                     $tmp = ($selmonth - $curmonth);
814 814
 
815
-                                for($i=0; $i < $tmp; $i++) {
815
+                                for ($i = 0; $i < $tmp; $i++) {
816 816
                                     $monthbegindow += $this->getMonthInSeconds($curyear, $curmonth);
817 817
 
818
-                                    if($curmonth == 12) {
818
+                                    if ($curmonth == 12) {
819 819
                                         $curyear++;
820 820
                                         $curmonth = 0;
821 821
                                     }
822 822
                                     $curmonth++;
823 823
                                 }
824 824
 
825
-                            }else {
825
+                            } else {
826 826
                                 // Check or you exist in the right month
827 827
 
828 828
                                 $dayofweek = gmdate("w", $monthbegindow);
829
-                                for($i = 0; $i < 7; $i++) {
830
-                                    if($nday == 5 && (($dayofweek-$i)%7 >= 0) && (1<<( ($dayofweek-$i)%7) ) & $weekdays) {
829
+                                for ($i = 0; $i < 7; $i++) {
830
+                                    if ($nday == 5 && (($dayofweek - $i) % 7 >= 0) && (1 << (($dayofweek - $i) % 7))&$weekdays) {
831 831
                                         $day = gmdate("j", $monthbegindow) - $i;
832 832
                                         break;
833
-                                    }else if($nday != 5 && (1<<( ($dayofweek+$i)%7) ) & $weekdays) {
834
-                                        $day = (($nday-1)*7) + ($i+1);
833
+                                    } else if ($nday != 5 && (1 << (($dayofweek + $i) % 7))&$weekdays) {
834
+                                        $day = (($nday - 1) * 7) + ($i + 1);
835 835
                                         break;
836 836
                                     }
837 837
                                 }
838 838
 
839 839
                                 // Goto the next X month
840
-                                if(isset($day) && ($day < gmdate("j", (int) $this->recur["start"])) ) {
841
-                                    if($nday == 5) {
840
+                                if (isset($day) && ($day < gmdate("j", (int)$this->recur["start"]))) {
841
+                                    if ($nday == 5) {
842 842
                                         $monthbegindow += 24 * 60 * 60;
843
-                                        if($curmonth == 12) {
843
+                                        if ($curmonth == 12) {
844 844
                                             $curyear++;
845 845
                                             $curmonth = 0;
846 846
                                         }
847 847
                                         $curmonth++;
848 848
                                     }
849 849
 
850
-                                    for($i=0; $i < $everyn; $i++) {
850
+                                    for ($i = 0; $i < $everyn; $i++) {
851 851
                                         $monthbegindow += $this->getMonthInSeconds($curyear, $curmonth);
852 852
 
853
-                                        if($curmonth == 12) {
853
+                                        if ($curmonth == 12) {
854 854
                                             $curyear++;
855 855
                                             $curmonth = 0;
856 856
                                         }
857 857
                                         $curmonth++;
858 858
                                     }
859 859
 
860
-                                    if($nday == 5) {
860
+                                    if ($nday == 5) {
861 861
                                         $monthbegindow -= 24 * 60 * 60;
862 862
                                     }
863 863
                                 }
@@ -868,37 +868,37 @@  discard block
 block discarded – undo
868 868
                             $day = 0;
869 869
                             // Set start on the right day
870 870
                             $dayofweek = gmdate("w", $monthbegindow);
871
-                            for($i = 0; $i < 7; $i++) {
872
-                                if($nday == 5 && (($dayofweek-$i)%7) >= 0&& (1<<(($dayofweek-$i)%7) ) & $weekdays) {
871
+                            for ($i = 0; $i < 7; $i++) {
872
+                                if ($nday == 5 && (($dayofweek - $i) % 7) >= 0 && (1 << (($dayofweek - $i) % 7))&$weekdays) {
873 873
                                     $day = $i;
874 874
                                     break;
875
-                                }else if($nday != 5 && (1<<( ($dayofweek+$i)%7) ) & $weekdays) {
876
-                                    $day = ($nday - 1) * 7 + ($i+1);
875
+                                } else if ($nday != 5 && (1 << (($dayofweek + $i) % 7))&$weekdays) {
876
+                                    $day = ($nday - 1) * 7 + ($i + 1);
877 877
                                     break;
878 878
                                 }
879 879
                             }
880
-                            if($nday == 5)
881
-                                $monthbegindow -= $day * 24 * 60 *60;
880
+                            if ($nday == 5)
881
+                                $monthbegindow -= $day * 24 * 60 * 60;
882 882
                             else
883
-                                $monthbegindow += ($day-1) * 24 * 60 *60;
883
+                                $monthbegindow += ($day - 1) * 24 * 60 * 60;
884 884
 
885 885
                             $firstocc = 0;
886 886
 
887
-                            if($term == 0x0C /*monthly*/) {
887
+                            if ($term == 0x0C /*monthly*/) {
888 888
                                 // Calc first occ
889
-                                $monthIndex = ((((12%$everyn) * (((int) gmdate("Y", $this->recur["start"]) - 1601)%$everyn)) % $everyn) + (((int) gmdate("n", $this->recur["start"])) - 1))%$everyn;
889
+                                $monthIndex = ((((12 % $everyn) * (((int)gmdate("Y", $this->recur["start"]) - 1601) % $everyn)) % $everyn) + (((int)gmdate("n", $this->recur["start"])) - 1)) % $everyn;
890 890
 
891
-                                for($i=0; $i < $monthIndex; $i++) {
892
-                                    $firstocc+= $this->getMonthInSeconds(1601 + floor($i/12), ($i%12)+1) / 60;
891
+                                for ($i = 0; $i < $monthIndex; $i++) {
892
+                                    $firstocc += $this->getMonthInSeconds(1601 + floor($i / 12), ($i % 12) + 1) / 60;
893 893
                                 }
894 894
 
895 895
                                 $rdata .= pack("VVVVV", $firstocc, $everyn, 0, $weekdays, $nday);
896 896
                             } else {
897 897
                                 // Calc first occ
898
-                                $monthIndex = (int) gmdate("n", $this->recur["start"]);
898
+                                $monthIndex = (int)gmdate("n", $this->recur["start"]);
899 899
 
900
-                                for($i=1; $i < $monthIndex; $i++) {
901
-                                    $firstocc+= $this->getMonthInSeconds(1601 + floor($i/12), $i) / 60;
900
+                                for ($i = 1; $i < $monthIndex; $i++) {
901
+                                    $firstocc += $this->getMonthInSeconds(1601 + floor($i / 12), $i) / 60;
902 902
                                 }
903 903
 
904 904
                                 $rdata .= pack("VVVVV", $firstocc, $everyn, 0, $weekdays, $nday);
@@ -911,15 +911,15 @@  discard block
 block discarded – undo
911 911
 
912 912
             }
913 913
 
914
-            if(!isset($this->recur["term"])) {
914
+            if (!isset($this->recur["term"])) {
915 915
                 return;
916 916
             }
917 917
 
918 918
             // Terminate
919
-            $term = (int) $this->recur["term"];
919
+            $term = (int)$this->recur["term"];
920 920
             $rdata .= pack("CCCC", $term, 0x20, 0x00, 0x00);
921 921
 
922
-            switch($term)
922
+            switch ($term)
923 923
             {
924 924
                 // After the given enddate
925 925
                 case 0x21:
@@ -927,11 +927,11 @@  discard block
 block discarded – undo
927 927
                     break;
928 928
                 // After a number of times
929 929
                 case 0x22:
930
-                    if(!isset($this->recur["numoccur"])) {
930
+                    if (!isset($this->recur["numoccur"])) {
931 931
                         return;
932 932
                     }
933 933
 
934
-                    $rdata .= pack("V", (int) $this->recur["numoccur"]);
934
+                    $rdata .= pack("V", (int)$this->recur["numoccur"]);
935 935
                     break;
936 936
                 // Never ends
937 937
                 case 0x23:
@@ -940,7 +940,7 @@  discard block
 block discarded – undo
940 940
             }
941 941
 
942 942
             // Strange little thing for the recurrence type "every workday"
943
-            if(((int) $this->recur["type"]) == 0x0B && ((int) $this->recur["subtype"]) == 1) {
943
+            if (((int)$this->recur["type"]) == 0x0B && ((int)$this->recur["subtype"]) == 1) {
944 944
                 $rdata .= pack("V", 1);
945 945
             } else { // Other recurrences
946 946
                 $rdata .= pack("V", 0);
@@ -955,21 +955,21 @@  discard block
 block discarded – undo
955 955
             // Merge deleted and changed items into one list
956 956
             $items = $deleted_items;
957 957
 
958
-            foreach($changed_items as $changed_item)
958
+            foreach ($changed_items as $changed_item)
959 959
                 array_push($items, $changed_item["basedate"]);
960 960
 
961 961
             sort($items);
962 962
 
963 963
             // Add the merged list in to the rdata
964 964
             $rdata .= pack("V", count($items));
965
-            foreach($items as $item)
965
+            foreach ($items as $item)
966 966
                 $rdata .= pack("V", $this->unixDataToRecurData($item));
967 967
 
968 968
             // Loop through the changed exceptions (not deleted)
969 969
             $rdata .= pack("V", count($changed_items));
970 970
             $items = array();
971 971
 
972
-            foreach($changed_items as $changed_item)
972
+            foreach ($changed_items as $changed_item)
973 973
             {
974 974
                 $items[] = $this->dayStartOf($changed_item["start"]);
975 975
             }
@@ -977,52 +977,52 @@  discard block
 block discarded – undo
977 977
             sort($items);
978 978
 
979 979
             // Add the changed items list int the rdata
980
-            foreach($items as $item)
980
+            foreach ($items as $item)
981 981
                 $rdata .= pack("V", $this->unixDataToRecurData($item));
982 982
 
983 983
             // Set start date
984
-            $rdata .= pack("V", $this->unixDataToRecurData((int) $this->recur["start"]));
984
+            $rdata .= pack("V", $this->unixDataToRecurData((int)$this->recur["start"]));
985 985
 
986 986
             // Set enddate
987
-            switch($term)
987
+            switch ($term)
988 988
             {
989 989
                 // After the given enddate
990 990
                 case 0x21:
991
-                    $rdata .= pack("V", $this->unixDataToRecurData((int) $this->recur["end"]));
991
+                    $rdata .= pack("V", $this->unixDataToRecurData((int)$this->recur["end"]));
992 992
                     break;
993 993
                 // After a number of times
994 994
                 case 0x22:
995 995
                     // @todo: calculate enddate with intval($this->recur["startocc"]) + intval($this->recur["duration"]) > 24 hour
996
-                    $occenddate = (int) $this->recur["start"];
996
+                    $occenddate = (int)$this->recur["start"];
997 997
 
998
-                    switch((int) $this->recur["type"]) {
998
+                    switch ((int)$this->recur["type"]) {
999 999
                         case 0x0A: //daily
1000 1000
 
1001
-                            if($this->recur["subtype"] == 1) {
1001
+                            if ($this->recur["subtype"] == 1) {
1002 1002
                                 // Daily every workday
1003
-                                $restocc = (int) $this->recur["numoccur"];
1003
+                                $restocc = (int)$this->recur["numoccur"];
1004 1004
 
1005 1005
                                 // Get starting weekday
1006 1006
                                 $nowtime = $this->gmtime($occenddate);
1007 1007
                                 $j = $nowtime["tm_wday"];
1008 1008
 
1009
-                                while(1)
1009
+                                while (1)
1010 1010
                                 {
1011
-                                    if(($j%7) > 0 && ($j%7)<6 ) {
1011
+                                    if (($j % 7) > 0 && ($j % 7) < 6) {
1012 1012
                                         $restocc--;
1013 1013
                                     }
1014 1014
 
1015 1015
                                     $j++;
1016 1016
 
1017
-                                    if($restocc <= 0)
1017
+                                    if ($restocc <= 0)
1018 1018
                                         break;
1019 1019
 
1020
-                                    $occenddate += 24*60*60;
1020
+                                    $occenddate += 24 * 60 * 60;
1021 1021
                                 }
1022 1022
 
1023 1023
                             } else {
1024 1024
                                 // -1 because the first day already counts (from 1-1-1980 to 1-1-1980 is 1 occurrence)
1025
-                                $occenddate += (((int) $this->recur["everyn"]) * 60 * (((int) $this->recur["numoccur"]-1)));
1025
+                                $occenddate += (((int)$this->recur["everyn"]) * 60 * (((int)$this->recur["numoccur"] - 1)));
1026 1026
                             }
1027 1027
                             break;
1028 1028
                         case 0x0B: //weekly
@@ -1031,42 +1031,42 @@  discard block
 block discarded – undo
1031 1031
                             // $restocc - number of remaining occurrences after the week skip
1032 1032
 
1033 1033
                             // Add the weeks till the last item
1034
-                            $occenddate+=($forwardcount*7*24*60*60);
1034
+                            $occenddate += ($forwardcount * 7 * 24 * 60 * 60);
1035 1035
 
1036 1036
                             $dayofweek = gmdate("w", $occenddate);
1037 1037
 
1038 1038
                             // Loop through the last occurrences until we have had them all
1039
-                            for($j = 1; $restocc>0; $j++)
1039
+                            for ($j = 1; $restocc > 0; $j++)
1040 1040
                             {
1041 1041
                                 // Jump to the next week (which may be N weeks away) when going over the week boundary
1042
-                                if((($dayofweek+$j)%7) == $weekstart)
1043
-                                    $occenddate += (((int) $this->recur["everyn"])-1) * 7 * 24*60*60;
1042
+                                if ((($dayofweek + $j) % 7) == $weekstart)
1043
+                                    $occenddate += (((int)$this->recur["everyn"]) - 1) * 7 * 24 * 60 * 60;
1044 1044
 
1045 1045
                                 // If this is a matching day, once less occurrence to process
1046
-                                if(((int) $this->recur["weekdays"]) & (1<<(($dayofweek+$j)%7)) ) {
1046
+                                if (((int)$this->recur["weekdays"]) & (1 << (($dayofweek + $j) % 7))) {
1047 1047
                                     $restocc--;
1048 1048
                                 }
1049 1049
 
1050 1050
                                 // Next day
1051
-                                $occenddate += 24*60*60;
1051
+                                $occenddate += 24 * 60 * 60;
1052 1052
                             }
1053 1053
 
1054 1054
                             break;
1055 1055
                         case 0x0C: //monthly
1056 1056
                         case 0x0D: //yearly
1057 1057
 
1058
-                            $curyear = gmdate("Y", (int) $this->recur["start"] );
1059
-                            $curmonth = gmdate("n", (int) $this->recur["start"] );
1058
+                            $curyear = gmdate("Y", (int)$this->recur["start"]);
1059
+                            $curmonth = gmdate("n", (int)$this->recur["start"]);
1060 1060
                             // $forwardcount = months
1061 1061
 
1062
-                            switch((int) $this->recur["subtype"])
1062
+                            switch ((int)$this->recur["subtype"])
1063 1063
                             {
1064 1064
                                 case 2: // on D day of every M month
1065
-                                    while($forwardcount > 0)
1065
+                                    while ($forwardcount > 0)
1066 1066
                                     {
1067 1067
                                         $occenddate += $this->getMonthInSeconds($curyear, $curmonth);
1068 1068
 
1069
-                                        if($curmonth >=12) {
1069
+                                        if ($curmonth >= 12) {
1070 1070
                                             $curmonth = 1;
1071 1071
                                             $curyear++;
1072 1072
                                         } else {
@@ -1076,26 +1076,26 @@  discard block
 block discarded – undo
1076 1076
                                     }
1077 1077
 
1078 1078
                                     // compensation between 28 and 31
1079
-                                    if(((int) $this->recur["monthday"]) >=28 && ((int) $this->recur["monthday"]) <= 31 &&
1080
-                                        gmdate("j", $occenddate) < ((int) $this->recur["monthday"]))
1079
+                                    if (((int)$this->recur["monthday"]) >= 28 && ((int)$this->recur["monthday"]) <= 31 &&
1080
+                                        gmdate("j", $occenddate) < ((int)$this->recur["monthday"]))
1081 1081
                                     {
1082
-                                        if(gmdate("j", $occenddate) < 28)
1083
-                                            $occenddate -= gmdate("j", $occenddate) * 24 * 60 *60;
1082
+                                        if (gmdate("j", $occenddate) < 28)
1083
+                                            $occenddate -= gmdate("j", $occenddate) * 24 * 60 * 60;
1084 1084
                                         else
1085
-                                            $occenddate += (gmdate("t", $occenddate) - gmdate("j", $occenddate)) * 24 * 60 *60;
1085
+                                            $occenddate += (gmdate("t", $occenddate) - gmdate("j", $occenddate)) * 24 * 60 * 60;
1086 1086
                                     }
1087 1087
 
1088 1088
 
1089 1089
                                     break;
1090 1090
                                 case 3: // on Nth weekday of every M month
1091
-                                    $nday = (int) $this->recur["nday"]; //1 tot 5
1092
-                                    $weekdays = (int) $this->recur["weekdays"];
1091
+                                    $nday = (int)$this->recur["nday"]; //1 tot 5
1092
+                                    $weekdays = (int)$this->recur["weekdays"];
1093 1093
 
1094 1094
 
1095
-                                    while($forwardcount > 0)
1095
+                                    while ($forwardcount > 0)
1096 1096
                                     {
1097 1097
                                         $occenddate += $this->getMonthInSeconds($curyear, $curmonth);
1098
-                                        if($curmonth >=12) {
1098
+                                        if ($curmonth >= 12) {
1099 1099
                                             $curmonth = 1;
1100 1100
                                             $curyear++;
1101 1101
                                         } else {
@@ -1105,21 +1105,21 @@  discard block
 block discarded – undo
1105 1105
                                         $forwardcount--;
1106 1106
                                     }
1107 1107
 
1108
-                                    if($nday == 5) {
1108
+                                    if ($nday == 5) {
1109 1109
                                         // Set date on the last day of the last month
1110
-                                        $occenddate += (gmdate("t", $occenddate ) - gmdate("j", $occenddate )) * 24 * 60 * 60;
1111
-                                    }else {
1110
+                                        $occenddate += (gmdate("t", $occenddate) - gmdate("j", $occenddate)) * 24 * 60 * 60;
1111
+                                    } else {
1112 1112
                                         // Set date on the first day of the last month
1113
-                                        $occenddate -= (gmdate("j", $occenddate )-1) * 24 * 60 * 60;
1113
+                                        $occenddate -= (gmdate("j", $occenddate) - 1) * 24 * 60 * 60;
1114 1114
                                     }
1115 1115
 
1116 1116
                                     $dayofweek = gmdate("w", $occenddate);
1117
-                                    for($i = 0; $i < 7; $i++) {
1118
-                                        if($nday == 5 && (($dayofweek-$i)%7) >= 0&& (1<<(($dayofweek-$i)%7) ) & $weekdays) {
1117
+                                    for ($i = 0; $i < 7; $i++) {
1118
+                                        if ($nday == 5 && (($dayofweek - $i) % 7) >= 0 && (1 << (($dayofweek - $i) % 7))&$weekdays) {
1119 1119
                                             $occenddate -= $i * 24 * 60 * 60;
1120 1120
                                             break;
1121
-                                        }else if($nday != 5 && (1<<(($dayofweek+$i)%7) ) & $weekdays) {
1122
-                                            $occenddate +=  ($i + (($nday-1) *7)) * 24 * 60 * 60;
1121
+                                        } else if ($nday != 5 && (1 << (($dayofweek + $i) % 7))&$weekdays) {
1122
+                                            $occenddate += ($i + (($nday - 1) * 7)) * 24 * 60 * 60;
1123 1123
                                             break;
1124 1124
                                         }
1125 1125
                                     }
@@ -1136,7 +1136,7 @@  discard block
 block discarded – undo
1136 1136
 
1137 1137
                     $this->recur["end"] = $occenddate;
1138 1138
 
1139
-                    $rdata .= pack("V", $this->unixDataToRecurData((int) $this->recur["end"]) );
1139
+                    $rdata .= pack("V", $this->unixDataToRecurData((int)$this->recur["end"]));
1140 1140
                     break;
1141 1141
                 // Never ends
1142 1142
                 case 0x23:
@@ -1147,12 +1147,12 @@  discard block
 block discarded – undo
1147 1147
             }
1148 1148
 
1149 1149
             // UTC date
1150
-            $utcstart = $this->toGMT($this->tz, (int) $this->recur["start"]);
1151
-            $utcend = $this->toGMT($this->tz, (int) $this->recur["end"]);
1150
+            $utcstart = $this->toGMT($this->tz, (int)$this->recur["start"]);
1151
+            $utcend = $this->toGMT($this->tz, (int)$this->recur["end"]);
1152 1152
 
1153 1153
             //utc date+time
1154
-            $utcfirstoccstartdatetime = (isset($this->recur["startocc"])) ? $utcstart + (((int) $this->recur["startocc"])*60) : $utcstart;
1155
-            $utcfirstoccenddatetime = (isset($this->recur["endocc"])) ? $utcstart + (((int) $this->recur["endocc"]) * 60) : $utcstart;
1154
+            $utcfirstoccstartdatetime = (isset($this->recur["startocc"])) ? $utcstart + (((int)$this->recur["startocc"]) * 60) : $utcstart;
1155
+            $utcfirstoccenddatetime = (isset($this->recur["endocc"])) ? $utcstart + (((int)$this->recur["endocc"]) * 60) : $utcstart;
1156 1156
 
1157 1157
             $propsToSet = array();
1158 1158
             // update reminder time
@@ -1170,7 +1170,7 @@  discard block
 block discarded – undo
1170 1170
 
1171 1171
                 // recurrencetype
1172 1172
                 // Strange enough is the property recurrencetype, (type-0x9) and not the CDO recurrencetype
1173
-                $propsToSet[$this->proptags["recurrencetype"]] = ((int) $this->recur["type"]) - 0x9;
1173
+                $propsToSet[$this->proptags["recurrencetype"]] = ((int)$this->recur["type"]) - 0x9;
1174 1174
 
1175 1175
                 // set named prop 'side_effects' to 369, needed for Outlook to ask for single or total recurrence when deleting
1176 1176
                 $propsToSet[$this->proptags["side_effects"]] = 369;
@@ -1183,25 +1183,25 @@  discard block
 block discarded – undo
1183 1183
             // to the 'next' occurrence; this makes sure that deleting the next occurrence will correctly set the reminder to
1184 1184
             // the occurrence after that. The 'next' occurrence is defined as being the first occurrence that starts at moment X (server time)
1185 1185
             // with the reminder flag set.
1186
-            $reminderprops = mapi_getprops($this->message, array($this->proptags["reminder_minutes"]) );
1187
-            if(isset($reminderprops[$this->proptags["reminder_minutes"]]) ) {
1186
+            $reminderprops = mapi_getprops($this->message, array($this->proptags["reminder_minutes"]));
1187
+            if (isset($reminderprops[$this->proptags["reminder_minutes"]])) {
1188 1188
                 $occ = false;
1189 1189
                 $occurrences = $this->getItems(time(), 0x7ff00000, 3, true);
1190 1190
 
1191
-                for($i = 0, $len = count($occurrences) ; $i < $len; $i++) {
1191
+                for ($i = 0, $len = count($occurrences); $i < $len; $i++) {
1192 1192
                     // This will actually also give us appointments that have already started, but not yet ended. Since we want the next
1193 1193
                     // reminder that occurs after time(), we may have to skip the first few entries. We get 3 entries since that is the maximum
1194 1194
                     // number that would be needed (assuming reminder for item X cannot be before the previous occurrence starts). Worst case:
1195 1195
                     // time() is currently after start but before end of item, but reminder of next item has already passed (reminder for next item
1196 1196
                     // can be DURING the previous item, eg daily allday events). In that case, the first and second items must be skipped.
1197 1197
 
1198
-                    if(($occurrences[$i][$this->proptags["startdate"]] - $reminderprops[$this->proptags["reminder_minutes"]] * 60) > time()) {
1198
+                    if (($occurrences[$i][$this->proptags["startdate"]] - $reminderprops[$this->proptags["reminder_minutes"]] * 60) > time()) {
1199 1199
                         $occ = $occurrences[$i];
1200 1200
                         break;
1201 1201
                     }
1202 1202
                 }
1203 1203
 
1204
-                if($occ) {
1204
+                if ($occ) {
1205 1205
                     $propsToSet[$this->proptags["flagdueby"]] = $occ[$this->proptags["startdate"]] - ($reminderprops[$this->proptags["reminder_minutes"]] * 60);
1206 1206
                 } else {
1207 1207
                     // Last reminder passed, no reminders any more.
@@ -1214,9 +1214,9 @@  discard block
 block discarded – undo
1214 1214
             // Second item (0x08) indicates the Outlook version (see documentation at the bottom of this file for more information)
1215 1215
             $rdata .= pack("VCCCC", 0x00003006, 0x08, 0x30, 0x00, 0x00);
1216 1216
 
1217
-            if(isset($this->recur["startocc"], $this->recur["endocc"])) {
1217
+            if (isset($this->recur["startocc"], $this->recur["endocc"])) {
1218 1218
                 // Set start and endtime in minutes
1219
-                $rdata .= pack("VV", (int) $this->recur["startocc"], (int) $this->recur["endocc"]);
1219
+                $rdata .= pack("VV", (int)$this->recur["startocc"], (int)$this->recur["endocc"]);
1220 1220
             }
1221 1221
 
1222 1222
             // Detailed exception data
@@ -1225,7 +1225,7 @@  discard block
 block discarded – undo
1225 1225
 
1226 1226
             $rdata .= pack("v", count($changed_items));
1227 1227
 
1228
-            foreach($changed_items as $changed_item)
1228
+            foreach ($changed_items as $changed_item)
1229 1229
             {
1230 1230
                 // Set start and end time of exception
1231 1231
                 $rdata .= pack("V", $this->unixDataToRecurData($changed_item["start"]));
@@ -1236,38 +1236,38 @@  discard block
 block discarded – undo
1236 1236
                 $bitmask = 0;
1237 1237
 
1238 1238
                 // Check for changed strings
1239
-                if(isset($changed_item["subject"]))    {
1239
+                if (isset($changed_item["subject"])) {
1240 1240
                     $bitmask |= 1 << 0;
1241 1241
                 }
1242 1242
 
1243
-                if(isset($changed_item["remind_before"])) {
1243
+                if (isset($changed_item["remind_before"])) {
1244 1244
                     $bitmask |= 1 << 2;
1245 1245
                 }
1246 1246
 
1247
-                if(isset($changed_item["reminder_set"])) {
1247
+                if (isset($changed_item["reminder_set"])) {
1248 1248
                     $bitmask |= 1 << 3;
1249 1249
                 }
1250 1250
 
1251
-                if(isset($changed_item["location"])) {
1251
+                if (isset($changed_item["location"])) {
1252 1252
                     $bitmask |= 1 << 4;
1253 1253
                 }
1254 1254
 
1255
-                if(isset($changed_item["busystatus"])) {
1255
+                if (isset($changed_item["busystatus"])) {
1256 1256
                     $bitmask |= 1 << 5;
1257 1257
                 }
1258 1258
 
1259
-                if(isset($changed_item["alldayevent"])) {
1259
+                if (isset($changed_item["alldayevent"])) {
1260 1260
                     $bitmask |= 1 << 7;
1261 1261
                 }
1262 1262
 
1263
-                if(isset($changed_item["label"])) {
1263
+                if (isset($changed_item["label"])) {
1264 1264
                     $bitmask |= 1 << 8;
1265 1265
                 }
1266 1266
 
1267 1267
                 $rdata .= pack("v", $bitmask);
1268 1268
 
1269 1269
                 // Set "subject"
1270
-                if(isset($changed_item["subject"])) {
1270
+                if (isset($changed_item["subject"])) {
1271 1271
                     // convert utf-8 to non-unicode blob string (us-ascii?)
1272 1272
                     $subject = iconv("UTF-8", "windows-1252//TRANSLIT", $changed_item["subject"]);
1273 1273
                     $length = strlen($subject);
@@ -1275,30 +1275,30 @@  discard block
 block discarded – undo
1275 1275
                     $rdata .= pack("a".$length, $subject);
1276 1276
                 }
1277 1277
 
1278
-                if(isset($changed_item["remind_before"])) {
1278
+                if (isset($changed_item["remind_before"])) {
1279 1279
                     $rdata .= pack("V", $changed_item["remind_before"]);
1280 1280
                 }
1281 1281
 
1282
-                if(isset($changed_item["reminder_set"])) {
1282
+                if (isset($changed_item["reminder_set"])) {
1283 1283
                     $rdata .= pack("V", $changed_item["reminder_set"]);
1284 1284
                 }
1285 1285
 
1286
-                if(isset($changed_item["location"])) {
1286
+                if (isset($changed_item["location"])) {
1287 1287
                     $location = iconv("UTF-8", "windows-1252//TRANSLIT", $changed_item["location"]);
1288 1288
                     $length = strlen($location);
1289 1289
                     $rdata .= pack("vv", $length + 1, $length);
1290 1290
                     $rdata .= pack("a".$length, $location);
1291 1291
                 }
1292 1292
 
1293
-                if(isset($changed_item["busystatus"])) {
1293
+                if (isset($changed_item["busystatus"])) {
1294 1294
                     $rdata .= pack("V", $changed_item["busystatus"]);
1295 1295
                 }
1296 1296
 
1297
-                if(isset($changed_item["alldayevent"])) {
1297
+                if (isset($changed_item["alldayevent"])) {
1298 1298
                     $rdata .= pack("V", $changed_item["alldayevent"]);
1299 1299
                 }
1300 1300
 
1301
-                if(isset($changed_item["label"])) {
1301
+                if (isset($changed_item["label"])) {
1302 1302
                     $rdata .= pack("V", $changed_item["label"]);
1303 1303
                 }
1304 1304
             }
@@ -1306,30 +1306,30 @@  discard block
 block discarded – undo
1306 1306
             $rdata .= pack("V", 0);
1307 1307
 
1308 1308
             // write extended data
1309
-            foreach($changed_items as $changed_item)
1309
+            foreach ($changed_items as $changed_item)
1310 1310
             {
1311 1311
                 $rdata .= pack("V", 0);
1312
-                if(isset($changed_item["subject"]) || isset($changed_item["location"])) {
1312
+                if (isset($changed_item["subject"]) || isset($changed_item["location"])) {
1313 1313
                     $rdata .= pack("V", $this->unixDataToRecurData($changed_item["start"]));
1314 1314
                     $rdata .= pack("V", $this->unixDataToRecurData($changed_item["end"]));
1315 1315
                     $rdata .= pack("V", $this->unixDataToRecurData($changed_item["basedate"]));
1316 1316
                 }
1317 1317
 
1318
-                if(isset($changed_item["subject"])) {
1318
+                if (isset($changed_item["subject"])) {
1319 1319
                     $subject = iconv("UTF-8", "UCS-2LE", $changed_item["subject"]);
1320 1320
                     $length = iconv_strlen($subject, "UCS-2LE");
1321 1321
                     $rdata .= pack("v", $length);
1322
-                    $rdata .= pack("a".$length*2, $subject);
1322
+                    $rdata .= pack("a".$length * 2, $subject);
1323 1323
                 }
1324 1324
 
1325
-                if(isset($changed_item["location"])) {
1325
+                if (isset($changed_item["location"])) {
1326 1326
                     $location = iconv("UTF-8", "UCS-2LE", $changed_item["location"]);
1327 1327
                     $length = iconv_strlen($location, "UCS-2LE");
1328 1328
                     $rdata .= pack("v", $length);
1329
-                    $rdata .= pack("a".$length*2, $location);
1329
+                    $rdata .= pack("a".$length * 2, $location);
1330 1330
                 }
1331 1331
 
1332
-                if(isset($changed_item["subject"]) || isset($changed_item["location"])) {
1332
+                if (isset($changed_item["subject"]) || isset($changed_item["location"])) {
1333 1333
                     $rdata .= pack("V", 0);
1334 1334
                 }
1335 1335
             }
@@ -1340,13 +1340,13 @@  discard block
 block discarded – undo
1340 1340
             $propsToSet[$this->proptags["recurring_data"]] = $rdata;
1341 1341
             $propsToSet[$this->proptags["recurring"]] = true;
1342 1342
 
1343
-            if(isset($this->tz) && $this->tz){
1343
+            if (isset($this->tz) && $this->tz) {
1344 1344
                 $timezone = "GMT";
1345
-                if($this->tz["timezone"]!=0){
1345
+                if ($this->tz["timezone"] != 0) {
1346 1346
                     // Create user readable timezone information
1347
-                    $timezone = sprintf("(GMT %s%02d:%02d)",    (-$this->tz["timezone"]>0 ? "+" : "-"),
1348
-                                                            abs($this->tz["timezone"]/60),
1349
-                                                            abs($this->tz["timezone"]%60));
1347
+                    $timezone = sprintf("(GMT %s%02d:%02d)", (-$this->tz["timezone"] > 0 ? "+" : "-"),
1348
+                                                            abs($this->tz["timezone"] / 60),
1349
+                                                            abs($this->tz["timezone"] % 60));
1350 1350
                 }
1351 1351
                 $propsToSet[$this->proptags["timezone_data"]] = $this->getTimezoneData($this->tz);
1352 1352
                 $propsToSet[$this->proptags["timezone"]] = $timezone;
@@ -1362,7 +1362,7 @@  discard block
 block discarded – undo
1362 1362
         */
1363 1363
         function recurDataToUnixData($rdate)
1364 1364
         {
1365
-            return ($rdate - 194074560) * 60 ;
1365
+            return ($rdate - 194074560) * 60;
1366 1366
         }
1367 1367
 
1368 1368
         /**
@@ -1408,18 +1408,18 @@  discard block
 block discarded – undo
1408 1408
         }
1409 1409
 
1410 1410
         function isLeapYear($year) {
1411
-            return ( $year % 4 == 0 && ($year % 100 != 0 || $year % 400 == 0) );
1411
+            return ($year % 4 == 0 && ($year % 100 != 0 || $year % 400 == 0));
1412 1412
         }
1413 1413
 
1414 1414
         function getMonthInSeconds($year, $month)
1415 1415
         {
1416
-            if( in_array($month, array(1,3,5,7,8,10,12) ) ) {
1416
+            if (in_array($month, array(1, 3, 5, 7, 8, 10, 12))) {
1417 1417
                 $day = 31;
1418
-            } else if( in_array($month, array(4,6,9,11) ) ) {
1418
+            } else if (in_array($month, array(4, 6, 9, 11))) {
1419 1419
                 $day = 30;
1420 1420
             } else {
1421 1421
                 $day = 28;
1422
-                if( $this->isLeapYear($year) == 1 )
1422
+                if ($this->isLeapYear($year) == 1)
1423 1423
                     $day++;
1424 1424
             }
1425 1425
             return $day * 24 * 60 * 60;
@@ -1437,7 +1437,7 @@  discard block
 block discarded – undo
1437 1437
         function getDateByYearMonthWeekDayHour($year, $month, $week, $day, $hour)
1438 1438
         {
1439 1439
             // get first day of month
1440
-            $date = gmmktime(0,0,0,$month,0,$year + 1900);
1440
+            $date = gmmktime(0, 0, 0, $month, 0, $year + 1900);
1441 1441
 
1442 1442
             // get wday info
1443 1443
             $gmdate = $this->gmtime($date);
@@ -1453,7 +1453,7 @@  discard block
 block discarded – undo
1453 1453
             // if we are in the next month, then back up a week, because week '5' means
1454 1454
             // 'last week of month'
1455 1455
 
1456
-            if($gmdate["tm_mon"]+1 != $month)
1456
+            if ($gmdate["tm_mon"] + 1 != $month)
1457 1457
                 $date -= 7 * 24 * 60 * 60;
1458 1458
 
1459 1459
             return $date;
@@ -1466,7 +1466,7 @@  discard block
 block discarded – undo
1466 1466
         function getTimezone($tz, $date)
1467 1467
         {
1468 1468
             // No timezone -> GMT (+0)
1469
-            if(!isset($tz["timezone"]))
1469
+            if (!isset($tz["timezone"]))
1470 1470
                 return 0;
1471 1471
 
1472 1472
             $dst = false;
@@ -1475,19 +1475,19 @@  discard block
 block discarded – undo
1475 1475
             $dststart = $this->getDateByYearMonthWeekDayHour($gmdate["tm_year"], $tz["dststartmonth"], $tz["dststartweek"], 0, $tz["dststarthour"]);
1476 1476
             $dstend = $this->getDateByYearMonthWeekDayHour($gmdate["tm_year"], $tz["dstendmonth"], $tz["dstendweek"], 0, $tz["dstendhour"]);
1477 1477
 
1478
-            if($dststart <= $dstend) {
1478
+            if ($dststart <= $dstend) {
1479 1479
                 // Northern hemisphere, eg DST is during Mar-Oct
1480
-                if($date > $dststart && $date < $dstend) {
1480
+                if ($date > $dststart && $date < $dstend) {
1481 1481
                     $dst = true;
1482 1482
                 }
1483 1483
             } else {
1484 1484
                 // Southern hemisphere, eg DST is during Oct-Mar
1485
-                if($date < $dstend || $date > $dststart) {
1485
+                if ($date < $dstend || $date > $dststart) {
1486 1486
                     $dst = true;
1487 1487
                 }
1488 1488
             }
1489 1489
 
1490
-            if($dst) {
1490
+            if ($dst) {
1491 1491
                 return $tz["timezone"] + $tz["timezonedst"];
1492 1492
             } else {
1493 1493
                 return $tz["timezone"];
@@ -1511,7 +1511,7 @@  discard block
 block discarded – undo
1511 1511
          */
1512 1512
         function parseTimezone($data)
1513 1513
         {
1514
-            if(strlen($data) < 48)
1514
+            if (strlen($data) < 48)
1515 1515
                 return;
1516 1516
 
1517 1517
             $tz = unpack("ltimezone/lunk/ltimezonedst/lunk/ldstendmonth/vdstendweek/vdstendhour/lunk/lunk/vunk/ldststartmonth/vdststartweek/vdststarthour/lunk/vunk", $data);
@@ -1520,7 +1520,7 @@  discard block
 block discarded – undo
1520 1520
 
1521 1521
         function getTimezoneData($tz)
1522 1522
         {
1523
-            $data = pack("lllllvvllvlvvlv", $tz["timezone"], 0, $tz["timezonedst"], 0, $tz["dstendmonth"], $tz["dstendweek"], $tz["dstendhour"], 0, 0, 0, $tz["dststartmonth"], $tz["dststartweek"], $tz["dststarthour"], 0 ,0);
1523
+            $data = pack("lllllvvllvlvvlv", $tz["timezone"], 0, $tz["timezonedst"], 0, $tz["dstendmonth"], $tz["dstendweek"], $tz["dstendhour"], 0, 0, 0, $tz["dststartmonth"], $tz["dststartweek"], $tz["dststarthour"], 0, 0);
1524 1524
 
1525 1525
             return $data;
1526 1526
         }
@@ -1534,13 +1534,13 @@  discard block
 block discarded – undo
1534 1534
         {
1535 1535
             $data = pack("lxxxxlxxxxlvvxxxxxxxxxxlvvxxxxxx",
1536 1536
                         $tz["timezone"],
1537
-                        array_key_exists("timezonedst",$tz)?$tz["timezonedst"]:0,
1538
-                        array_key_exists("dstendmonth",$tz)?$tz["dstendmonth"]:0,
1539
-                        array_key_exists("dstendweek",$tz)?$tz["dstendweek"]:0,
1540
-                        array_key_exists("dstendhour",$tz)?$tz["dstendhour"]:0,
1541
-                        array_key_exists("dststartmonth",$tz)?$tz["dststartmonth"]:0,
1542
-                        array_key_exists("dststartweek",$tz)?$tz["dststartweek"]:0,
1543
-                        array_key_exists("dststarthour",$tz)?$tz["dststarthour"]:0
1537
+                        array_key_exists("timezonedst", $tz) ? $tz["timezonedst"] : 0,
1538
+                        array_key_exists("dstendmonth", $tz) ? $tz["dstendmonth"] : 0,
1539
+                        array_key_exists("dstendweek", $tz) ? $tz["dstendweek"] : 0,
1540
+                        array_key_exists("dstendhour", $tz) ? $tz["dstendhour"] : 0,
1541
+                        array_key_exists("dststartmonth", $tz) ? $tz["dststartmonth"] : 0,
1542
+                        array_key_exists("dststartweek", $tz) ? $tz["dststartweek"] : 0,
1543
+                        array_key_exists("dststarthour", $tz) ? $tz["dststarthour"] : 0
1544 1544
                     );
1545 1545
 
1546 1546
             return $data;
@@ -1550,7 +1550,7 @@  discard block
 block discarded – undo
1550 1550
          * toGMT returns a timestamp in GMT time for the time and timezone given
1551 1551
          */
1552 1552
         function toGMT($tz, $date) {
1553
-            if(!isset($tz['timezone']))
1553
+            if (!isset($tz['timezone']))
1554 1554
                 return $date;
1555 1555
             $offset = $this->getTimezone($tz, $date);
1556 1556
 
@@ -1616,18 +1616,18 @@  discard block
 block discarded – undo
1616 1616
         {
1617 1617
             $items = array();
1618 1618
 
1619
-            if(isset($this->recur)) {
1619
+            if (isset($this->recur)) {
1620 1620
 
1621 1621
                 // Optimization: remindersonly and default reminder is off; since only exceptions with reminder set will match, just look which
1622 1622
                 // exceptions are in range and have a reminder set
1623
-                if($remindersonly && (!isset($this->messageprops[$this->proptags["reminder"]]) || $this->messageprops[$this->proptags["reminder"]] == false)) {
1623
+                if ($remindersonly && (!isset($this->messageprops[$this->proptags["reminder"]]) || $this->messageprops[$this->proptags["reminder"]] == false)) {
1624 1624
                     // Sort exceptions by start time
1625 1625
                     uasort($this->recur["changed_occurences"], array($this, "sortExceptionStart"));
1626 1626
 
1627 1627
                     // Loop through all changed exceptions
1628
-                    foreach($this->recur["changed_occurences"] as $exception) {
1628
+                    foreach ($this->recur["changed_occurences"] as $exception) {
1629 1629
                         // Check reminder set
1630
-                        if(!isset($exception["reminder"]) || $exception["reminder"] == false)
1630
+                        if (!isset($exception["reminder"]) || $exception["reminder"] == false)
1631 1631
                             continue;
1632 1632
 
1633 1633
                         // Convert to GMT
@@ -1635,12 +1635,12 @@  discard block
 block discarded – undo
1635 1635
                         $occend = $this->toGMT($this->tz, $exception["end"]); // seb changed $tz to $this->tz
1636 1636
 
1637 1637
                         // Check range criterium
1638
-                        if($occstart > $end || $occend < $start)
1638
+                        if ($occstart > $end || $occend < $start)
1639 1639
                             continue;
1640 1640
 
1641 1641
                         // OK, add to items.
1642 1642
                         array_push($items, $this->getExceptionProperties($exception));
1643
-                        if($limit && (count($items) == $limit))
1643
+                        if ($limit && (count($items) == $limit))
1644 1644
                             break;
1645 1645
                     }
1646 1646
 
@@ -1652,7 +1652,7 @@  discard block
 block discarded – undo
1652 1652
                 // From here on, the dates of the occurrences are calculated in local time, so the days we're looking
1653 1653
                 // at are calculated from the local time dates of $start and $end
1654 1654
                 // TODO use one isset
1655
-                if(isset($this->recur['regen'], $this->action['datecompleted']) && $this->recur['regen']) {
1655
+                if (isset($this->recur['regen'], $this->action['datecompleted']) && $this->recur['regen']) {
1656 1656
                     $daystart = $this->dayStartOf($this->action['datecompleted']);
1657 1657
                 } else {
1658 1658
                     $daystart = $this->dayStartOf($this->recur["start"]); // start on first day of occurrence
@@ -1660,7 +1660,7 @@  discard block
 block discarded – undo
1660 1660
 
1661 1661
                 // Calculate the last day on which we want to be looking at a recurrence; this is either the end of the view
1662 1662
                 // or the end of the recurrence, whichever comes first
1663
-                if($end > $this->toGMT($this->tz, $this->recur["end"])) {
1663
+                if ($end > $this->toGMT($this->tz, $this->recur["end"])) {
1664 1664
                     $rangeend = $this->toGMT($this->tz, $this->recur["end"]);
1665 1665
                 } else {
1666 1666
                     $rangeend = $end;
@@ -1670,21 +1670,21 @@  discard block
 block discarded – undo
1670 1670
 
1671 1671
                 // Loop through the entire recurrence range of dates, and check for each occurrence whether it is in the view range.
1672 1672
 
1673
-                switch($this->recur["type"])
1673
+                switch ($this->recur["type"])
1674 1674
                 {
1675 1675
                 case 10:
1676 1676
                     // Daily
1677
-                    if($this->recur["everyn"] <= 0)
1677
+                    if ($this->recur["everyn"] <= 0)
1678 1678
                         $this->recur["everyn"] = 1440;
1679 1679
 
1680
-                    if($this->recur["subtype"] == 0) {
1680
+                    if ($this->recur["subtype"] == 0) {
1681 1681
                         // Every Nth day
1682
-                        for($now = $daystart; $now <= $dayend && ($limit == 0 || count($items) < $limit); $now += 60 * $this->recur["everyn"]) {
1682
+                        for ($now = $daystart; $now <= $dayend && ($limit == 0 || count($items) < $limit); $now += 60 * $this->recur["everyn"]) {
1683 1683
                             $this->processOccurrenceItem($items, $start, $end, $now, $this->recur["startocc"], $this->recur["endocc"], $this->tz, $remindersonly);
1684 1684
                         }
1685 1685
                     } else {
1686 1686
                         // Every workday
1687
-                        for($now = $daystart; $now <= $dayend && ($limit == 0 || count($items) < $limit); $now += 60 * 1440)
1687
+                        for ($now = $daystart; $now <= $dayend && ($limit == 0 || count($items) < $limit); $now += 60 * 1440)
1688 1688
                         {
1689 1689
                             $nowtime = $this->gmtime($now);
1690 1690
                             if ($nowtime["tm_wday"] > 0 && $nowtime["tm_wday"] < 6) { // only add items in the given timespace
@@ -1695,25 +1695,25 @@  discard block
 block discarded – undo
1695 1695
                     break;
1696 1696
                 case 11:
1697 1697
                     // Weekly
1698
-                    if($this->recur["everyn"] <= 0)
1698
+                    if ($this->recur["everyn"] <= 0)
1699 1699
                         $this->recur["everyn"] = 1;
1700 1700
 
1701 1701
                     // If sliding flag is set then move to 'n' weeks
1702 1702
                     if ($this->recur['regen']) $daystart += (60 * 60 * 24 * 7 * $this->recur["everyn"]);
1703 1703
 
1704
-                    for($now = $daystart; $now <= $dayend && ($limit == 0 || count($items) < $limit); $now += (60 * 60 * 24 * 7 * $this->recur["everyn"]))
1704
+                    for ($now = $daystart; $now <= $dayend && ($limit == 0 || count($items) < $limit); $now += (60 * 60 * 24 * 7 * $this->recur["everyn"]))
1705 1705
                     {
1706 1706
                         if ($this->recur['regen']) {
1707 1707
                             $this->processOccurrenceItem($items, $start, $end, $now, $this->recur["startocc"], $this->recur["endocc"], $this->tz, $remindersonly);
1708 1708
                         } else {
1709 1709
                             // Loop through the whole following week to the first occurrence of the week, add each day that is specified
1710
-                            for($wday = 0; $wday < 7; $wday++)
1710
+                            for ($wday = 0; $wday < 7; $wday++)
1711 1711
                             {
1712 1712
                                 $daynow = $now + $wday * 60 * 60 * 24;
1713 1713
                                 //checks weather the next coming day in recurring pattern is less than or equal to end day of the recurring item
1714
-                                if ($daynow <= $dayend){
1714
+                                if ($daynow <= $dayend) {
1715 1715
                                     $nowtime = $this->gmtime($daynow); // Get the weekday of the current day
1716
-                                    if(($this->recur["weekdays"] &(1 << $nowtime["tm_wday"]))) { // Selected ?
1716
+                                    if (($this->recur["weekdays"] &(1 << $nowtime["tm_wday"]))) { // Selected ?
1717 1717
                                         $this->processOccurrenceItem($items, $start, $end, $daynow, $this->recur["startocc"], $this->recur["endocc"], $this->tz, $remindersonly);
1718 1718
                                     }
1719 1719
                                 }
@@ -1723,26 +1723,26 @@  discard block
 block discarded – undo
1723 1723
                     break;
1724 1724
                 case 12:
1725 1725
                     // Monthly
1726
-                    if($this->recur["everyn"] <= 0)
1726
+                    if ($this->recur["everyn"] <= 0)
1727 1727
                         $this->recur["everyn"] = 1;
1728 1728
 
1729 1729
                     // Loop through all months from start to end of occurrence, starting at beginning of first month
1730
-                    for($now = $this->monthStartOf($daystart); $now <= $dayend && ($limit == 0 || count($items) < $limit); $now += $this->daysInMonth($now, $this->recur["everyn"]) * 24 * 60 * 60 )
1730
+                    for ($now = $this->monthStartOf($daystart); $now <= $dayend && ($limit == 0 || count($items) < $limit); $now += $this->daysInMonth($now, $this->recur["everyn"]) * 24 * 60 * 60)
1731 1731
                     {
1732
-                        if(isset($this->recur["monthday"]) &&($this->recur['monthday'] != "undefined") && !$this->recur['regen']) { // Day M of every N months
1732
+                        if (isset($this->recur["monthday"]) && ($this->recur['monthday'] != "undefined") && !$this->recur['regen']) { // Day M of every N months
1733 1733
                             $difference = 1;
1734 1734
                             if ($this->daysInMonth($now, $this->recur["everyn"]) < $this->recur["monthday"]) {
1735 1735
                                 $difference = $this->recur["monthday"] - $this->daysInMonth($now, $this->recur["everyn"]) + 1;
1736 1736
                             }
1737 1737
                             $daynow = $now + (($this->recur["monthday"] - $difference) * 24 * 60 * 60);
1738 1738
                             //checks weather the next coming day in recurrence pattern is less than or equal to end day of the recurring item
1739
-                            if ($daynow <= $dayend){
1739
+                            if ($daynow <= $dayend) {
1740 1740
                                 $this->processOccurrenceItem($items, $start, $end, $daynow, $this->recur["startocc"], $this->recur["endocc"], $this->tz, $remindersonly);
1741 1741
                             }
1742 1742
                         }
1743
-                        else if(isset($this->recur["nday"], $this->recur["weekdays"])) { // Nth [weekday] of every N months
1743
+                        else if (isset($this->recur["nday"], $this->recur["weekdays"])) { // Nth [weekday] of every N months
1744 1744
                             // Sanitize input
1745
-                            if($this->recur["weekdays"] == 0)
1745
+                            if ($this->recur["weekdays"] == 0)
1746 1746
                                 $this->recur["weekdays"] = 1;
1747 1747
 
1748 1748
                             // If nday is not set to the last day in the month
@@ -1750,29 +1750,29 @@  discard block
 block discarded – undo
1750 1750
                                 // keep the track of no. of time correct selection pattern(like 2nd weekday, 4th fiday, etc.)is matched
1751 1751
                                 $ndaycounter = 0;
1752 1752
                                 // Find matching weekday in this month
1753
-                                for($day = 0, $total = $this->daysInMonth($now, 1); $day < $total; $day++)
1753
+                                for ($day = 0, $total = $this->daysInMonth($now, 1); $day < $total; $day++)
1754 1754
                                 {
1755 1755
                                     $daynow = $now + $day * 60 * 60 * 24;
1756 1756
                                     $nowtime = $this->gmtime($daynow); // Get the weekday of the current day
1757 1757
 
1758
-                                    if($this->recur["weekdays"] & (1 << $nowtime["tm_wday"])) { // Selected ?
1759
-                                        $ndaycounter ++;
1758
+                                    if ($this->recur["weekdays"] & (1 << $nowtime["tm_wday"])) { // Selected ?
1759
+                                        $ndaycounter++;
1760 1760
                                     }
1761 1761
                                     // check the selected pattern is same as asked Nth weekday,If so set the firstday
1762
-                                    if($this->recur["nday"] == $ndaycounter){
1762
+                                    if ($this->recur["nday"] == $ndaycounter) {
1763 1763
                                         $firstday = $day;
1764 1764
                                         break;
1765 1765
                                     }
1766 1766
                                 }
1767 1767
                                 // $firstday is the day of the month on which the asked pattern of nth weekday matches
1768 1768
                                 $daynow = $now + $firstday * 60 * 60 * 24;
1769
-                            }else{
1769
+                            } else {
1770 1770
                                 // Find last day in the month ($now is the firstday of the month)
1771
-                                $NumDaysInMonth =  $this->daysInMonth($now, 1);
1772
-                                $daynow = $now + (($NumDaysInMonth-1) * 24*60*60);
1771
+                                $NumDaysInMonth = $this->daysInMonth($now, 1);
1772
+                                $daynow = $now + (($NumDaysInMonth - 1) * 24 * 60 * 60);
1773 1773
 
1774 1774
                                 $nowtime = $this->gmtime($daynow);
1775
-                                while (($this->recur["weekdays"] & (1 << $nowtime["tm_wday"]))==0){
1775
+                                while (($this->recur["weekdays"] & (1 << $nowtime["tm_wday"])) == 0) {
1776 1776
                                     $daynow -= 86400;
1777 1777
                                     $nowtime = $this->gmtime($daynow);
1778 1778
                                 }
@@ -1781,12 +1781,12 @@  discard block
 block discarded – undo
1781 1781
                             /**
1782 1782
                              * 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.
1783 1783
                              */
1784
-                            if ($daynow <= $dayend && $daynow >= $daystart){
1785
-                                $this->processOccurrenceItem($items, $start, $end, $daynow, $this->recur["startocc"], $this->recur["endocc"], $this->tz , $remindersonly);
1784
+                            if ($daynow <= $dayend && $daynow >= $daystart) {
1785
+                                $this->processOccurrenceItem($items, $start, $end, $daynow, $this->recur["startocc"], $this->recur["endocc"], $this->tz, $remindersonly);
1786 1786
                             }
1787 1787
                         } else if ($this->recur['regen']) {
1788 1788
                             $next_month_start = $now + ($this->daysInMonth($now, 1) * 24 * 60 * 60);
1789
-                            $now = $daystart +($this->daysInMonth($next_month_start, $this->recur['everyn']) * 24 * 60 * 60);
1789
+                            $now = $daystart + ($this->daysInMonth($next_month_start, $this->recur['everyn']) * 24 * 60 * 60);
1790 1790
 
1791 1791
                             if ($now <= $dayend) {
1792 1792
                                 $this->processOccurrenceItem($items, $daystart, $end, $now, $this->recur["startocc"], $this->recur["endocc"], $this->tz, $remindersonly);
@@ -1796,49 +1796,49 @@  discard block
 block discarded – undo
1796 1796
                     break;
1797 1797
                 case 13:
1798 1798
                     // Yearly
1799
-                    if($this->recur["everyn"] <= 0)
1799
+                    if ($this->recur["everyn"] <= 0)
1800 1800
                         $this->recur["everyn"] = 12;
1801 1801
 
1802
-                    for($now = $this->yearStartOf($daystart); $now <= $dayend && ($limit == 0 || count($items) < $limit); $now += $this->daysInMonth($now, $this->recur["everyn"]) * 24 * 60 * 60 )
1802
+                    for ($now = $this->yearStartOf($daystart); $now <= $dayend && ($limit == 0 || count($items) < $limit); $now += $this->daysInMonth($now, $this->recur["everyn"]) * 24 * 60 * 60)
1803 1803
                     {
1804
-                        if(isset($this->recur["monthday"]) && !$this->recur['regen']) { // same as monthly, but in a specific month
1804
+                        if (isset($this->recur["monthday"]) && !$this->recur['regen']) { // same as monthly, but in a specific month
1805 1805
                             // recur["month"] is in minutes since the beginning of the year
1806 1806
                             $month = $this->monthOfYear($this->recur["month"]); // $month is now month of year [0..11]
1807 1807
                             $monthday = $this->recur["monthday"]; // $monthday is day of the month [1..31]
1808 1808
                             $monthstart = $now + $this->daysInMonth($now, $month) * 24 * 60 * 60; // $monthstart is the timestamp of the beginning of the month
1809
-                            if($monthday > $this->daysInMonth($monthstart, 1))
1810
-                                $monthday = $this->daysInMonth($monthstart, 1);    // Cap $monthday on month length (eg 28 feb instead of 29 feb)
1811
-                            $daynow = $monthstart + ($monthday-1) * 24 * 60 * 60;
1809
+                            if ($monthday > $this->daysInMonth($monthstart, 1))
1810
+                                $monthday = $this->daysInMonth($monthstart, 1); // Cap $monthday on month length (eg 28 feb instead of 29 feb)
1811
+                            $daynow = $monthstart + ($monthday - 1) * 24 * 60 * 60;
1812 1812
                             $this->processOccurrenceItem($items, $start, $end, $daynow, $this->recur["startocc"], $this->recur["endocc"], $this->tz, $remindersonly);
1813 1813
                         }
1814
-                        else if(isset($this->recur["nday"], $this->recur["weekdays"])) { // Nth [weekday] in month X of every N years
1814
+                        else if (isset($this->recur["nday"], $this->recur["weekdays"])) { // Nth [weekday] in month X of every N years
1815 1815
 
1816 1816
                             // Go the correct month
1817 1817
                             $monthnow = $now + $this->daysInMonth($now, $this->monthOfYear($this->recur["month"])) * 24 * 60 * 60;
1818 1818
 
1819 1819
                             // Find first matching weekday in this month
1820
-                            for($wday = 0; $wday < 7; $wday++)
1820
+                            for ($wday = 0; $wday < 7; $wday++)
1821 1821
                             {
1822 1822
                                 $daynow = $monthnow + $wday * 60 * 60 * 24;
1823 1823
                                 $nowtime = $this->gmtime($daynow); // Get the weekday of the current day
1824 1824
 
1825
-                                if($this->recur["weekdays"] & (1 << $nowtime["tm_wday"])) { // Selected ?
1825
+                                if ($this->recur["weekdays"] & (1 << $nowtime["tm_wday"])) { // Selected ?
1826 1826
                                     $firstday = $wday;
1827 1827
                                     break;
1828 1828
                                 }
1829 1829
                             }
1830 1830
 
1831 1831
                             // Same as above (monthly)
1832
-                            $daynow = $monthnow + ($firstday + ($this->recur["nday"]-1)*7) * 60 * 60 * 24;
1832
+                            $daynow = $monthnow + ($firstday + ($this->recur["nday"] - 1) * 7) * 60 * 60 * 24;
1833 1833
 
1834
-                            while($this->monthStartOf($daynow) != $this->monthStartOf($monthnow)) {
1834
+                            while ($this->monthStartOf($daynow) != $this->monthStartOf($monthnow)) {
1835 1835
                                 $daynow -= 7 * 60 * 60 * 24;
1836 1836
                             }
1837 1837
 
1838 1838
                             $this->processOccurrenceItem($items, $start, $end, $daynow, $this->recur["startocc"], $this->recur["endocc"], $this->tz, $remindersonly);
1839 1839
                         } else if ($this->recur['regen']) {
1840 1840
                             $year_starttime = $this->gmtime($now);
1841
-                            $is_next_leapyear = $this->isLeapYear($year_starttime['tm_year'] + 1900 + 1);    // +1 next year
1841
+                            $is_next_leapyear = $this->isLeapYear($year_starttime['tm_year'] + 1900 + 1); // +1 next year
1842 1842
                             $now = $daystart + ($is_next_leapyear ? 31622400 /* Leap year in seconds */ : 31536000 /*year in seconds*/);
1843 1843
 
1844 1844
                             if ($now <= $dayend) {
@@ -1864,7 +1864,7 @@  discard block
 block discarded – undo
1864 1864
             $aTime = $a[$this->proptags["startdate"]];
1865 1865
             $bTime = $b[$this->proptags["startdate"]];
1866 1866
 
1867
-            return $aTime==$bTime?0:($aTime>$bTime?1:-1);
1867
+            return $aTime == $bTime ? 0 : ($aTime > $bTime ? 1 : -1);
1868 1868
         }
1869 1869
 
1870 1870
         /**
@@ -1882,7 +1882,7 @@  discard block
 block discarded – undo
1882 1882
         function daysInMonth($date, $months) {
1883 1883
             $days = 0;
1884 1884
 
1885
-            for($i=0;$i<$months;$i++) {
1885
+            for ($i = 0; $i < $months; $i++) {
1886 1886
                 $days += date("t", $date + $days * 24 * 60 * 60);
1887 1887
             }
1888 1888
 
@@ -1891,9 +1891,9 @@  discard block
 block discarded – undo
1891 1891
 
1892 1892
         // Converts MAPI-style 'minutes' into the month of the year [0..11]
1893 1893
         function monthOfYear($minutes) {
1894
-            $d = gmmktime(0,0,0,1,1,2001); // The year 2001 was a non-leap year, and the minutes provided are always in non-leap-year-minutes
1894
+            $d = gmmktime(0, 0, 0, 1, 1, 2001); // The year 2001 was a non-leap year, and the minutes provided are always in non-leap-year-minutes
1895 1895
 
1896
-            $d += $minutes*60;
1896
+            $d += $minutes * 60;
1897 1897
 
1898 1898
             $dtime = $this->gmtime($d);
1899 1899
 
@@ -1902,6 +1902,6 @@  discard block
 block discarded – undo
1902 1902
 
1903 1903
         function sortExceptionStart($a, $b)
1904 1904
         {
1905
-            return $a["start"] == $b["start"] ? 0 : ($a["start"]  > $b["start"] ? 1 : -1 );
1905
+            return $a["start"] == $b["start"] ? 0 : ($a["start"] > $b["start"] ? 1 : -1);
1906 1906
         }
1907 1907
     }
Please login to merge, or discard this patch.
mapi/class.mapiexception.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -22,10 +22,10 @@
 block discarded – undo
22 22
          */
23 23
         public function getDisplayMessage()
24 24
         {
25
-            if(!empty($this->displayMessage))
25
+            if (!empty($this->displayMessage))
26 26
                 return $this->displayMessage;
27 27
 
28
-            switch($this->getCode())
28
+            switch ($this->getCode())
29 29
             {
30 30
                 case MAPI_E_NO_ACCESS:
31 31
                     return _("You have insufficient privileges to open this object.");
Please login to merge, or discard this patch.
mapi/class.baseexception.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
         // assign display message
59 59
         $this->displayMessage = $displayMessage;
60 60
 
61
-        parent::__construct($errorMessage, (int) $code, $previous);
61
+        parent::__construct($errorMessage, (int)$code, $previous);
62 62
     }
63 63
 
64 64
     /**
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
      */
67 67
     public function getFileLine()
68 68
     {
69
-        return $this->getBaseFile() . ':' . $this->getLine();
69
+        return $this->getBaseFile().':'.$this->getLine();
70 70
     }
71 71
 
72 72
     /**
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
      */
75 75
     public function getDisplayMessage()
76 76
     {
77
-        if(!is_null($this->displayMessage)) {
77
+        if (!is_null($this->displayMessage)) {
78 78
             return $this->displayMessage;
79 79
         }
80 80
 
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
      */
126 126
     public function getBaseFile()
127 127
     {
128
-        if(is_null($this->baseFile)) {
128
+        if (is_null($this->baseFile)) {
129 129
             $this->baseFile = basename(parent::getFile());
130 130
         }
131 131
 
Please login to merge, or discard this patch.
mapi/class.taskrecurrence.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -74,12 +74,12 @@  discard block
 block discarded – undo
74 74
         function setRecurrence(&$recur)
75 75
         {
76 76
             $this->recur = $recur;
77
-            $this->action =& $recur;
77
+            $this->action = & $recur;
78 78
 
79
-            if(!isset($this->recur["changed_occurences"]))
79
+            if (!isset($this->recur["changed_occurences"]))
80 80
                 $this->recur["changed_occurences"] = Array();
81 81
 
82
-            if(!isset($this->recur["deleted_occurences"]))
82
+            if (!isset($this->recur["deleted_occurences"]))
83 83
                 $this->recur["deleted_occurences"] = Array();
84 84
 
85 85
             if (!isset($this->recur['startocc'])) $this->recur['startocc'] = 0;
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
             // Update $this->recur with proper startrecurrdate and endrecurrdate updated after saving recurrence
92 92
             $msgProps = mapi_getprops($this->message, array($this->proptags['recurring_data']));
93 93
             $recurring_data = $this->parseRecurrence($msgProps[$this->proptags['recurring_data']]);
94
-            foreach($recurring_data as $key => $value) {
94
+            foreach ($recurring_data as $key => $value) {
95 95
                 $this->recur[$key] = $value;
96 96
             }
97 97
 
@@ -107,9 +107,9 @@  discard block
 block discarded – undo
107 107
         function setFirstOccurrence()
108 108
         {
109 109
             // Check if it is already the first occurrence
110
-            if($this->action['start'] == $this->recur["start"]){
110
+            if ($this->action['start'] == $this->recur["start"]) {
111 111
                 return;
112
-            }else{
112
+            } else {
113 113
                 $items = $this->getNextOccurrence();
114 114
 
115 115
                 $props = array();
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
              * then we create first two occurrence separately and for first occurrence recurrence has ended.
141 141
              */
142 142
             if ((empty($this->action['startdate']) && empty($this->action['duedate']))
143
-                || ($this->action['complete'] == 1) || (isset($this->action['deleteOccurrence']) && $this->action['deleteOccurrence'])){
143
+                || ($this->action['complete'] == 1) || (isset($this->action['deleteOccurrence']) && $this->action['deleteOccurrence'])) {
144 144
 
145 145
                 $nextOccurrence = $this->getNextOccurrence();
146 146
                 $result = mapi_getprops($this->message, array(PR_ENTRYID, PR_PARENT_ENTRYID, PR_STORE_ENTRYID));
@@ -265,18 +265,18 @@  discard block
 block discarded – undo
265 265
 
266 266
             $copy_to_recipientTable = mapi_message_getrecipienttable($newMessage);
267 267
             $copy_to_recipientRows = mapi_table_queryallrows($copy_to_recipientTable, array(PR_ROWID));
268
-            foreach($copy_to_recipientRows as $recipient) {
268
+            foreach ($copy_to_recipientRows as $recipient) {
269 269
                 mapi_message_modifyrecipients($newMessage, MODRECIP_REMOVE, array($recipient));
270 270
             }
271 271
             mapi_message_modifyrecipients($newMessage, MODRECIP_ADD, $recipients);
272 272
 
273 273
             // Copy attachments
274 274
             $attachmentTable = mapi_message_getattachmenttable($this->message);
275
-            if($attachmentTable) {
275
+            if ($attachmentTable) {
276 276
                 $attachments = mapi_table_queryallrows($attachmentTable, array(PR_ATTACH_NUM, PR_ATTACH_SIZE, PR_ATTACH_LONG_FILENAME, PR_ATTACHMENT_HIDDEN, PR_DISPLAY_NAME, PR_ATTACH_METHOD));
277 277
 
278
-                foreach($attachments as $attach_props){
279
-                    $attach_old = mapi_message_openattach($this->message, (int) $attach_props[PR_ATTACH_NUM]);
278
+                foreach ($attachments as $attach_props) {
279
+                    $attach_old = mapi_message_openattach($this->message, (int)$attach_props[PR_ATTACH_NUM]);
280 280
                     $attach_newResourceMsg = mapi_message_createattach($newMessage);
281 281
 
282 282
                     mapi_copyto($attach_old, array(), array(), $attach_newResourceMsg, 0);
@@ -293,7 +293,7 @@  discard block
 block discarded – undo
293 293
             $separator = "------------\r\n";
294 294
 
295 295
             if (!empty($msgbody) && strrpos($msgbody, $separator) === false) {
296
-                $msgbody = $separator . $msgbody;
296
+                $msgbody = $separator.$msgbody;
297 297
                 $stream = mapi_openproperty($this->message, PR_BODY, IID_IStream, STGM_TRANSACTED, 0);
298 298
                 mapi_stream_setsize($stream, strlen($msgbody));
299 299
                 mapi_stream_write($stream, $msgbody);
@@ -338,7 +338,7 @@  discard block
 block discarded – undo
338 338
         {
339 339
             // Fix timezone object
340 340
             $this->tz = false;
341
-            $this->action =& $recur;
341
+            $this->action = & $recur;
342 342
             $dead_occurrence = isset($this->messageprops[$this->proptags['dead_occurrence']]) ? $this->messageprops[$this->proptags['dead_occurrence']] : false;
343 343
 
344 344
             if (!$dead_occurrence) {
Please login to merge, or discard this patch.