Passed
Push — master ( ff9d34...55b7de )
by
unknown
03:27
created
lib/grommunio/importer.php 1 patch
Spacing   +49 added lines, -49 removed lines patch added patch discarded remove patch
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
             $folderidForBackendId = ZPush::GetDeviceManager()->GetFolderIdForBackendId($this->folderidHex);
62 62
             // Only append backend id if the mapping backendid<->folderid is available.
63 63
             if ($folderidForBackendId != $this->folderidHex) {
64
-                $this->prefix = $folderidForBackendId . ':';
64
+                $this->prefix = $folderidForBackendId.':';
65 65
             }
66 66
         }
67 67
         else {
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
         if ($entryid)
79 79
             $folder = mapi_msgstore_openentry($store, $entryid);
80 80
 
81
-        if(!$folder) {
81
+        if (!$folder) {
82 82
             $this->importer = false;
83 83
 
84 84
             // We throw an general error SYNC_FSSTATUS_CODEUNKNOWN (12) which is also SYNC_STATUS_FOLDERHIERARCHYCHANGED (12)
@@ -89,10 +89,10 @@  discard block
 block discarded – undo
89 89
         $this->mapiprovider = new MAPIProvider($this->session, $this->store);
90 90
 
91 91
         if ($folderid) {
92
-            $this->importer = mapi_openproperty($folder, PR_COLLECTOR, IID_IExchangeImportContentsChanges, 0 , 0);
92
+            $this->importer = mapi_openproperty($folder, PR_COLLECTOR, IID_IExchangeImportContentsChanges, 0, 0);
93 93
         }
94 94
         else {
95
-            $this->importer = mapi_openproperty($folder, PR_COLLECTOR, IID_IExchangeImportHierarchyChanges, 0 , 0);
95
+            $this->importer = mapi_openproperty($folder, PR_COLLECTOR, IID_IExchangeImportHierarchyChanges, 0, 0);
96 96
         }
97 97
     }
98 98
 
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
 
116 116
         // Put the state information in a stream that can be used by ICS
117 117
         $stream = mapi_stream_create();
118
-        if(strlen($state) == 0)
118
+        if (strlen($state) == 0)
119 119
             $state = hex2bin("0000000000000000");
120 120
 
121 121
         ZLog::Write(LOGLEVEL_DEBUG, sprintf("ImportChangesICS->Config(): initializing importer with state: 0x%s", bin2hex($state)));
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
      */
148 148
     public function ConfigContentParameters($contentparameters) {
149 149
         $filtertype = $contentparameters->GetFilterType();
150
-        switch($contentparameters->GetContentClass()) {
150
+        switch ($contentparameters->GetContentClass()) {
151 151
             case "Email":
152 152
                 $this->cutoffdate = ($filtertype) ? Utils::GetCutOffDate($filtertype) : false;
153 153
                 break;
@@ -173,22 +173,22 @@  discard block
 block discarded – undo
173 173
      */
174 174
     public function GetState() {
175 175
         $error = false;
176
-        if(!isset($this->statestream) || $this->importer === false)
176
+        if (!isset($this->statestream) || $this->importer === false)
177 177
             $error = true;
178 178
 
179 179
         if ($error === false && $this->folderid !== false && function_exists("mapi_importcontentschanges_updatestate"))
180
-            if(mapi_importcontentschanges_updatestate($this->importer, $this->statestream) != true)
180
+            if (mapi_importcontentschanges_updatestate($this->importer, $this->statestream) != true)
181 181
                 $error = true;
182 182
 
183 183
         if ($error == true)
184
-            throw new StatusException(sprintf("ImportChangesICS->GetState(): Error, state not available or unable to update: 0x%X", mapi_last_hresult()), (($this->folderid)?SYNC_STATUS_FOLDERHIERARCHYCHANGED:SYNC_FSSTATUS_CODEUNKNOWN), null, LOGLEVEL_WARN);
184
+            throw new StatusException(sprintf("ImportChangesICS->GetState(): Error, state not available or unable to update: 0x%X", mapi_last_hresult()), (($this->folderid) ?SYNC_STATUS_FOLDERHIERARCHYCHANGED:SYNC_FSSTATUS_CODEUNKNOWN), null, LOGLEVEL_WARN);
185 185
 
186 186
         mapi_stream_seek($this->statestream, 0, STREAM_SEEK_SET);
187 187
 
188 188
         $state = "";
189
-        while(true) {
189
+        while (true) {
190 190
             $data = mapi_stream_read($this->statestream, 4096);
191
-            if(strlen($data))
191
+            if (strlen($data))
192 192
                 $state .= $data;
193 193
             else
194 194
                 break;
@@ -218,13 +218,13 @@  discard block
 block discarded – undo
218 218
 
219 219
         // open the existing object
220 220
         $entryid = mapi_msgstore_entryidfromsourcekey($this->store, $this->folderid, hex2bin($messageid));
221
-        if(!$entryid) {
221
+        if (!$entryid) {
222 222
             ZLog::Write(LOGLEVEL_WARN, sprintf("ImportChangesICS->isModificationAllowed('%s'): Error, unable to resolve message id: 0x%X", $messageid, mapi_last_hresult()));
223 223
             return false;
224 224
         }
225 225
 
226 226
         $mapimessage = mapi_msgstore_openentry($this->store, $entryid);
227
-        if(!$mapimessage) {
227
+        if (!$mapimessage) {
228 228
             ZLog::Write(LOGLEVEL_WARN, sprintf("ImportChangesICS->isModificationAllowed('%s'): Error, unable to open entry id: 0x%X", $messageid, mapi_last_hresult()));
229 229
             return false;
230 230
         }
@@ -232,8 +232,8 @@  discard block
 block discarded – undo
232 232
         // check the sync interval
233 233
         if ($this->cutoffdate !== false) {
234 234
             ZLog::Write(LOGLEVEL_DEBUG, sprintf("ImportChangesICS->isModificationAllowed('%s'): cut off date is: %s", $messageid, $this->cutoffdate));
235
-            if (  ($this->contentClass == "Email"    && !MAPIUtils::IsInEmailSyncInterval($this->store, $mapimessage, $this->cutoffdate)) ||
236
-                  ($this->contentClass == "Calendar" && !MAPIUtils::IsInCalendarSyncInterval($this->store, $mapimessage, $this->cutoffdate)) ) {
235
+            if (($this->contentClass == "Email" && !MAPIUtils::IsInEmailSyncInterval($this->store, $mapimessage, $this->cutoffdate)) ||
236
+                  ($this->contentClass == "Calendar" && !MAPIUtils::IsInCalendarSyncInterval($this->store, $mapimessage, $this->cutoffdate))) {
237 237
 
238 238
                 ZLog::Write(LOGLEVEL_WARN, sprintf("ImportChangesICS->isModificationAllowed('%s'): Message in %s is outside the sync interval. Data not saved.", $messageid, $this->contentClass));
239 239
                 return false;
@@ -312,13 +312,13 @@  discard block
 block discarded – undo
312 312
             $started = time();
313 313
             $exported = 0;
314 314
             try {
315
-                while(is_array($exporter->Synchronize())) {
315
+                while (is_array($exporter->Synchronize())) {
316 316
                     $exported++;
317 317
 
318 318
                     // stop if this takes more than 15 seconds and there are more than 5 changes still to be exported
319 319
                     // within 20 seconds this should be finished or it will not be performed
320
-                    if ((time() - $started) > 15 && ($potConflicts - $exported) > 5 ) {
321
-                        ZLog::Write(LOGLEVEL_WARN, sprintf("ImportChangesICS->lazyLoadConflicts(): conflict detection cancelled as operation is too slow. In %d seconds only %d from %d changes were processed.",(time() - $started), $exported, $potConflicts));
320
+                    if ((time() - $started) > 15 && ($potConflicts - $exported) > 5) {
321
+                        ZLog::Write(LOGLEVEL_WARN, sprintf("ImportChangesICS->lazyLoadConflicts(): conflict detection cancelled as operation is too slow. In %d seconds only %d from %d changes were processed.", (time() - $started), $exported, $potConflicts));
322 322
                         $this->conflictsLoaded = true;
323 323
                         return false;
324 324
                     }
@@ -326,7 +326,7 @@  discard block
 block discarded – undo
326 326
             }
327 327
             // something really bad happened while exporting changes
328 328
             catch (StatusException $stex) {
329
-                ZLog::Write(LOGLEVEL_WARN, sprintf("ImportChangesICS->lazyLoadConflicts(): got StatusException code %d while exporting changes. Ignore and mark conflicts as loaded.",$stex->getCode()));
329
+                ZLog::Write(LOGLEVEL_WARN, sprintf("ImportChangesICS->lazyLoadConflicts(): got StatusException code %d while exporting changes. Ignore and mark conflicts as loaded.", $stex->getCode()));
330 330
             }
331 331
             $this->conflictsLoaded = true;
332 332
         }
@@ -349,7 +349,7 @@  discard block
 block discarded – undo
349 349
         $props[PR_PARENT_SOURCE_KEY] = $this->folderid;
350 350
 
351 351
         // set the PR_SOURCE_KEY if available or mark it as new message
352
-        if($id) {
352
+        if ($id) {
353 353
             list(, $sk) = Utils::SplitMessageId($id);
354 354
             $props[PR_SOURCE_KEY] = hex2bin($sk);
355 355
 
@@ -359,7 +359,7 @@  discard block
 block discarded – undo
359 359
 
360 360
             // check for conflicts
361 361
             $this->lazyLoadConflicts();
362
-            if($this->memChanges->IsChanged($id)) {
362
+            if ($this->memChanges->IsChanged($id)) {
363 363
                 if ($this->flags & SYNC_CONFLICT_OVERWRITE_PIM) {
364 364
                     // in these cases the status SYNC_STATUS_CONFLICTCLIENTSERVEROBJECT should be returned, so the mobile client can inform the end user
365 365
                     throw new StatusException(sprintf("ImportChangesICS->ImportMessageChange('%s','%s'): Conflict detected. Data from PIM will be dropped! Server overwrites PIM. User is informed.", $id, get_class($message)), SYNC_STATUS_CONFLICTCLIENTSERVEROBJECT, null, LOGLEVEL_INFO);
@@ -368,7 +368,7 @@  discard block
 block discarded – undo
368 368
                 else
369 369
                     ZLog::Write(LOGLEVEL_INFO, sprintf("ImportChangesICS->ImportMessageChange('%s','%s'): Conflict detected. Data from Server will be dropped! PIM overwrites server.", $id, get_class($message)));
370 370
             }
371
-            if($this->memChanges->IsDeleted($id)) {
371
+            if ($this->memChanges->IsDeleted($id)) {
372 372
                 ZLog::Write(LOGLEVEL_INFO, sprintf("ImportChangesICS->ImportMessageChange('%s','%s'): Conflict detected. Data from PIM will be dropped! Object was deleted on server.", $id, get_class($message)));
373 373
                 return false;
374 374
             }
@@ -376,16 +376,16 @@  discard block
 block discarded – undo
376 376
         else
377 377
             $flags = SYNC_NEW_MESSAGE;
378 378
 
379
-        if(mapi_importcontentschanges_importmessagechange($this->importer, $props, $flags, $mapimessage)) {
379
+        if (mapi_importcontentschanges_importmessagechange($this->importer, $props, $flags, $mapimessage)) {
380 380
             $this->mapiprovider->SetMessage($mapimessage, $message);
381 381
             mapi_savechanges($mapimessage);
382 382
 
383 383
             if (mapi_last_hresult())
384 384
                 throw new StatusException(sprintf("ImportChangesICS->ImportMessageChange('%s','%s'): Error, mapi_savechanges() failed: 0x%X", $id, get_class($message), mapi_last_hresult()), SYNC_STATUS_SYNCCANNOTBECOMPLETED);
385 385
 
386
-            $sourcekeyprops = mapi_getprops($mapimessage, array (PR_SOURCE_KEY));
386
+            $sourcekeyprops = mapi_getprops($mapimessage, array(PR_SOURCE_KEY));
387 387
 
388
-            return $this->prefix . bin2hex($sourcekeyprops[PR_SOURCE_KEY]);
388
+            return $this->prefix.bin2hex($sourcekeyprops[PR_SOURCE_KEY]);
389 389
         }
390 390
         else
391 391
             throw new StatusException(sprintf("ImportChangesICS->ImportMessageChange('%s','%s'): Error updating object: 0x%X", $id, get_class($message), mapi_last_hresult()), SYNC_STATUS_OBJECTNOTFOUND);
@@ -409,16 +409,16 @@  discard block
 block discarded – undo
409 409
 
410 410
         // check for conflicts
411 411
         $this->lazyLoadConflicts();
412
-        if($this->memChanges->IsChanged($id)) {
412
+        if ($this->memChanges->IsChanged($id)) {
413 413
             ZLog::Write(LOGLEVEL_INFO, sprintf("ImportChangesICS->ImportMessageDeletion('%s'): Conflict detected. Data from Server will be dropped! PIM deleted object.", $id));
414 414
         }
415
-        elseif($this->memChanges->IsDeleted($id)) {
415
+        elseif ($this->memChanges->IsDeleted($id)) {
416 416
             ZLog::Write(LOGLEVEL_INFO, sprintf("ImportChangesICS->ImportMessageDeletion('%s'): Conflict detected. Data is already deleted. Request will be ignored.", $id));
417 417
             return true;
418 418
         }
419 419
 
420 420
         // do a 'soft' delete so people can un-delete if necessary
421
-        if(mapi_importcontentschanges_importmessagedeletion($this->importer, 1, array(hex2bin($sk))))
421
+        if (mapi_importcontentschanges_importmessagedeletion($this->importer, 1, array(hex2bin($sk))))
422 422
             throw new StatusException(sprintf("ImportChangesICS->ImportMessageDeletion('%s'): Error updating object: 0x%X", $sk, mapi_last_hresult()), SYNC_STATUS_OBJECTNOTFOUND);
423 423
 
424 424
         return true;
@@ -437,7 +437,7 @@  discard block
 block discarded – undo
437 437
      * @throws StatusException
438 438
      */
439 439
     public function ImportMessageReadFlag($id, $flags, $categories = array()) {
440
-        list($fsk,$sk) = Utils::SplitMessageId($id);
440
+        list($fsk, $sk) = Utils::SplitMessageId($id);
441 441
 
442 442
         // if $fsk is set, we convert it into a backend id.
443 443
         if ($fsk) {
@@ -463,9 +463,9 @@  discard block
 block discarded – undo
463 463
             }
464 464
              */
465 465
 
466
-            $readstate = array ( "sourcekey" => hex2bin($sk), "flags" => $flags);
466
+            $readstate = array("sourcekey" => hex2bin($sk), "flags" => $flags);
467 467
 
468
-            if(!mapi_importcontentschanges_importperuserreadstatechange($this->importer, array($readstate) ))
468
+            if (!mapi_importcontentschanges_importperuserreadstatechange($this->importer, array($readstate)))
469 469
                 throw new StatusException(sprintf("ImportChangesICS->ImportMessageReadFlag('%s','%d'): Error setting read state: 0x%X", $id, $flags, mapi_last_hresult()), SYNC_STATUS_OBJECTNOTFOUND);
470 470
         }
471 471
         // yeah OL sucks - ZP-779
@@ -504,7 +504,7 @@  discard block
 block discarded – undo
504 504
      */
505 505
     public function ImportMessageMove($id, $newfolder) {
506 506
         list(,$sk) = Utils::SplitMessageId($id);
507
-        if (strtolower($newfolder) == strtolower(bin2hex($this->folderid)) )
507
+        if (strtolower($newfolder) == strtolower(bin2hex($this->folderid)))
508 508
             throw new StatusException(sprintf("ImportChangesICS->ImportMessageMove('%s','%s'): Error, source and destination are equal", $id, $newfolder), SYNC_MOVEITEMSSTATUS_SAMESOURCEANDDEST);
509 509
 
510 510
         // Get the entryid of the message we're moving
@@ -516,7 +516,7 @@  discard block
 block discarded – undo
516 516
             $srcmessage = mapi_msgstore_openentry($this->store, $entryid);
517 517
         }
518 518
 
519
-        if(!$entryid || !$srcmessage) {
519
+        if (!$entryid || !$srcmessage) {
520 520
             $code = SYNC_MOVEITEMSSTATUS_INVALIDSOURCEID;
521 521
             $mapiLastHresult = mapi_last_hresult();
522 522
             // if we move to the trash and the source message is not found, we can also just tell the mobile that we successfully moved to avoid errors (ZP-624)
@@ -537,11 +537,11 @@  discard block
 block discarded – undo
537 537
             throw new StatusException(sprintf("ImportChangesICS->ImportMessageMove('%s','%s'): Error, unable to open store of destination folder", $sk, $newfolder), SYNC_MOVEITEMSSTATUS_INVALIDDESTID);
538 538
 
539 539
         $dstentryid = mapi_msgstore_entryidfromsourcekey($dststore, hex2bin($newfolder));
540
-        if(!$dstentryid)
540
+        if (!$dstentryid)
541 541
             throw new StatusException(sprintf("ImportChangesICS->ImportMessageMove('%s','%s'): Error, unable to resolve destination folder", $sk, $newfolder), SYNC_MOVEITEMSSTATUS_INVALIDDESTID);
542 542
 
543 543
         $dstfolder = mapi_msgstore_openentry($dststore, $dstentryid);
544
-        if(!$dstfolder)
544
+        if (!$dstfolder)
545 545
             throw new StatusException(sprintf("ImportChangesICS->ImportMessageMove('%s','%s'): Error, unable to open destination folder", $sk, $newfolder), SYNC_MOVEITEMSSTATUS_INVALIDDESTID);
546 546
 
547 547
         $newmessage = mapi_folder_createmessage($dstfolder);
@@ -554,7 +554,7 @@  discard block
 block discarded – undo
554 554
             throw new StatusException(sprintf("ImportChangesICS->ImportMessageMove('%s','%s'): Error, copy to destination message failed: 0x%X", $sk, $newfolder, mapi_last_hresult()), SYNC_MOVEITEMSSTATUS_CANNOTMOVE);
555 555
 
556 556
         $srcfolderentryid = mapi_msgstore_entryidfromsourcekey($this->store, $this->folderid);
557
-        if(!$srcfolderentryid)
557
+        if (!$srcfolderentryid)
558 558
             throw new StatusException(sprintf("ImportChangesICS->ImportMessageMove('%s','%s'): Error, unable to resolve source folder", $sk, $newfolder), SYNC_MOVEITEMSSTATUS_INVALIDSOURCEID);
559 559
 
560 560
         $srcfolder = mapi_msgstore_openentry($this->store, $srcfolderentryid);
@@ -570,15 +570,15 @@  discard block
 block discarded – undo
570 570
         if (!mapi_folder_deletemessages($srcfolder, array($entryid)))
571 571
             throw new StatusException(sprintf("ImportChangesICS->ImportMessageMove('%s','%s'): Error, delete of source message failed: 0x%X. Possible duplicates.", $sk, $newfolder, mapi_last_hresult()), SYNC_MOVEITEMSSTATUS_SOURCEORDESTLOCKED);
572 572
 
573
-        $sourcekeyprops = mapi_getprops($newmessage, array (PR_SOURCE_KEY));
573
+        $sourcekeyprops = mapi_getprops($newmessage, array(PR_SOURCE_KEY));
574 574
         if (isset($sourcekeyprops[PR_SOURCE_KEY]) && $sourcekeyprops[PR_SOURCE_KEY]) {
575 575
             $prefix = "";
576 576
             // prepend the destination short folderid, if it exists
577 577
             $destShortId = ZPush::GetDeviceManager()->GetFolderIdForBackendId($newfolder);
578 578
             if ($destShortId !== $newfolder) {
579
-                $prefix = $destShortId .":";
579
+                $prefix = $destShortId.":";
580 580
             }
581
-            return $prefix . bin2hex($sourcekeyprops[PR_SOURCE_KEY]);
581
+            return $prefix.bin2hex($sourcekeyprops[PR_SOURCE_KEY]);
582 582
         }
583 583
 
584 584
         return false;
@@ -599,7 +599,7 @@  discard block
 block discarded – undo
599 599
      * @throws StatusException
600 600
      */
601 601
     public function ImportFolderChange($folder) {
602
-        $id = isset($folder->BackendId)?$folder->BackendId : false;
602
+        $id = isset($folder->BackendId) ? $folder->BackendId : false;
603 603
         $parent = $folder->parentid;
604 604
         $parent_org = $folder->parentid;
605 605
         $displayname = u2wi($folder->displayname);
@@ -637,7 +637,7 @@  discard block
 block discarded – undo
637 637
 
638 638
             mapi_setprops($newfolder, array(PR_CONTAINER_CLASS => MAPIUtils::GetContainerClassFromFolderType($type)));
639 639
 
640
-            $props =  mapi_getprops($newfolder, array(PR_SOURCE_KEY));
640
+            $props = mapi_getprops($newfolder, array(PR_SOURCE_KEY));
641 641
             if (isset($props[PR_SOURCE_KEY])) {
642 642
                 $folder->BackendId = bin2hex($props[PR_SOURCE_KEY]);
643 643
                 $folderOrigin = DeviceManager::FLD_ORIGIN_USER;
@@ -665,7 +665,7 @@  discard block
 block discarded – undo
665 665
         if (!$mfolder)
666 666
             throw new StatusException(sprintf("ImportChangesICS->ImportFolderChange('%s','%s','%s'): Error, unable to open folder (open entry): 0x%X", Utils::PrintAsString($folder->serverid), $folder->parentid, $displayname, mapi_last_hresult()), SYNC_FSSTATUS_PARENTNOTFOUND);
667 667
 
668
-        $props =  mapi_getprops($mfolder, array(PR_SOURCE_KEY, PR_PARENT_SOURCE_KEY, PR_DISPLAY_NAME, PR_CONTAINER_CLASS));
668
+        $props = mapi_getprops($mfolder, array(PR_SOURCE_KEY, PR_PARENT_SOURCE_KEY, PR_DISPLAY_NAME, PR_CONTAINER_CLASS));
669 669
         if (!isset($props[PR_SOURCE_KEY]) || !isset($props[PR_PARENT_SOURCE_KEY]) || !isset($props[PR_DISPLAY_NAME]) || !isset($props[PR_CONTAINER_CLASS]))
670 670
             throw new StatusException(sprintf("ImportChangesICS->ImportFolderChange('%s','%s','%s'): Error, folder data not available: 0x%X", Utils::PrintAsString($folder->serverid), $folder->parentid, $displayname, mapi_last_hresult()), SYNC_FSSTATUS_SERVERERROR);
671 671
 
@@ -688,23 +688,23 @@  discard block
 block discarded – undo
688 688
         // a changed parent id means that the folder should be moved
689 689
         if (bin2hex($props[PR_PARENT_SOURCE_KEY]) !== $parent) {
690 690
             $sourceparentfentryid = mapi_msgstore_entryidfromsourcekey($this->store, $props[PR_PARENT_SOURCE_KEY]);
691
-            if(!$sourceparentfentryid)
691
+            if (!$sourceparentfentryid)
692 692
                 throw new StatusException(sprintf("ImportChangesICS->ImportFolderChange('%s','%s','%s'): Error, unable to open parent source folder (no entry id): 0x%X", Utils::PrintAsString($folder->serverid), $folder->parentid, $displayname, mapi_last_hresult()), SYNC_FSSTATUS_PARENTNOTFOUND);
693 693
 
694 694
             $sourceparentfolder = mapi_msgstore_openentry($this->store, $sourceparentfentryid);
695
-            if(!$sourceparentfolder)
695
+            if (!$sourceparentfolder)
696 696
                 throw new StatusException(sprintf("ImportChangesICS->ImportFolderChange('%s','%s','%s'): Error, unable to open parent source folder (open entry): 0x%X", Utils::PrintAsString($folder->serverid), $folder->parentid, $displayname, mapi_last_hresult()), SYNC_FSSTATUS_PARENTNOTFOUND);
697 697
 
698 698
             $destparentfentryid = mapi_msgstore_entryidfromsourcekey($this->store, hex2bin($parent));
699
-            if(!$sourceparentfentryid)
699
+            if (!$sourceparentfentryid)
700 700
                 throw new StatusException(sprintf("ImportChangesICS->ImportFolderChange('%s','%s','%s'): Error, unable to open destination folder (no entry id): 0x%X", Utils::PrintAsString($folder->serverid), $folder->parentid, $displayname, mapi_last_hresult()), SYNC_FSSTATUS_SERVERERROR);
701 701
 
702 702
             $destfolder = mapi_msgstore_openentry($this->store, $destparentfentryid);
703
-            if(!$destfolder)
703
+            if (!$destfolder)
704 704
                 throw new StatusException(sprintf("ImportChangesICS->ImportFolderChange('%s','%s','%s'): Error, unable to open destination folder (open entry): 0x%X", Utils::PrintAsString($folder->serverid), $folder->parentid, $displayname, mapi_last_hresult()), SYNC_FSSTATUS_SERVERERROR);
705 705
 
706 706
             // mapi_folder_copyfolder() fails if a folder with this name already exists -> MAPI_E_COLLISION
707
-            if(! mapi_folder_copyfolder($sourceparentfolder, $entryid, $destfolder, $displayname, FOLDER_MOVE))
707
+            if (!mapi_folder_copyfolder($sourceparentfolder, $entryid, $destfolder, $displayname, FOLDER_MOVE))
708 708
                 throw new StatusException(sprintf("ImportChangesICS->ImportFolderChange('%s','%s','%s'): Error, unable to move folder: 0x%X", Utils::PrintAsString($folder->serverid), $folder->parentid, $displayname, mapi_last_hresult()), SYNC_FSSTATUS_FOLDEREXISTS);
709 709
 
710 710
             // the parent changed, but we got a backendID as parent and have to return an AS folderid - the parent-backendId must be mapped at this point already
@@ -742,7 +742,7 @@  discard block
 block discarded – undo
742 742
         ZLog::Write(LOGLEVEL_DEBUG, sprintf("ImportChangesICS->ImportFolderDeletion('%s','%s'): importing folder deletetion", $id, $parent));
743 743
 
744 744
         $folderentryid = mapi_msgstore_entryidfromsourcekey($this->store, hex2bin($id));
745
-        if(!$folderentryid)
745
+        if (!$folderentryid)
746 746
             throw new StatusException(sprintf("ImportChangesICS->ImportFolderDeletion('%s','%s'): Error, unable to resolve folder", $id, $parent, mapi_last_hresult()), SYNC_FSSTATUS_FOLDERDOESNOTEXIST);
747 747
 
748 748
         // get the folder type from the MAPIProvider
@@ -751,7 +751,7 @@  discard block
 block discarded – undo
751 751
         if (Utils::IsSystemFolder($type) || $this->mapiprovider->IsMAPIDefaultFolder($folderentryid))
752 752
             throw new StatusException(sprintf("ImportChangesICS->ImportFolderDeletion('%s','%s'): Error deleting system/default folder", $id, $parent), SYNC_FSSTATUS_SYSTEMFOLDER);
753 753
 
754
-        $ret = mapi_importhierarchychanges_importfolderdeletion ($this->importer, 0, array(PR_SOURCE_KEY => hex2bin($id)));
754
+        $ret = mapi_importhierarchychanges_importfolderdeletion($this->importer, 0, array(PR_SOURCE_KEY => hex2bin($id)));
755 755
         if (!$ret)
756 756
             throw new StatusException(sprintf("ImportChangesICS->ImportFolderDeletion('%s','%s'): Error deleting folder: 0x%X", $id, $parent, mapi_last_hresult()), SYNC_FSSTATUS_SERVERERROR);
757 757
 
Please login to merge, or discard this patch.