@@ -147,9 +147,9 @@ discard block |
||
| 147 | 147 | 5 => "Meeting canceled", |
| 148 | 148 | 7 => "Meeting canceled and received", |
| 149 | 149 | 9 => "Meeting", |
| 150 | - 11 => "Meeting received", |
|
| 151 | - 13 => "Meeting canceled", |
|
| 152 | - 15 => "Meeting canceled and received",)), |
|
| 150 | + 11 => "Meeting received", |
|
| 151 | + 13 => "Meeting canceled", |
|
| 152 | + 15 => "Meeting canceled and received",)), |
|
| 153 | 153 | |
| 154 | 154 | SYNC_POOMCAL_ATTENDEES => array ( self::STREAMER_VAR => "attendees", |
| 155 | 155 | self::STREAMER_TYPE => "SyncAttendee", |
@@ -178,7 +178,7 @@ discard block |
||
| 178 | 178 | self::STREAMER_TYPE => "SyncBaseBody", |
| 179 | 179 | self::STREAMER_RONOTIFY => true, |
| 180 | 180 | self::STREAMER_PRIVATE => true |
| 181 | - ); |
|
| 181 | + ); |
|
| 182 | 182 | |
| 183 | 183 | $mapping[SYNC_AIRSYNCBASE_NATIVEBODYTYPE] = array ( self::STREAMER_VAR => "nativebodytype"); |
| 184 | 184 | |
@@ -201,7 +201,7 @@ |
||
| 201 | 201 | * @return boolean |
| 202 | 202 | */ |
| 203 | 203 | public function IsDeleted($id) { |
| 204 | - return !((array_search(array(self::DELETION, $id), $this->changes) === false) && (array_search(array(self::SOFTDELETION, $id), $this->changes) === false)); |
|
| 204 | + return !((array_search(array(self::DELETION, $id), $this->changes) === false) && (array_search(array(self::SOFTDELETION, $id), $this->changes) === false)); |
|
| 205 | 205 | } |
| 206 | 206 | |
| 207 | 207 | /** |
@@ -337,8 +337,8 @@ discard block |
||
| 337 | 337 | * @return boolean |
| 338 | 338 | * @throws FatalNotImplementedException |
| 339 | 339 | */ |
| 340 | - private function isValidType($options) { |
|
| 341 | - if ($options !== self::DEFAULTOPTIONS && |
|
| 340 | + private function isValidType($options) { |
|
| 341 | + if ($options !== self::DEFAULTOPTIONS && |
|
| 342 | 342 | $options !== self::EMAILOPTIONS && |
| 343 | 343 | $options !== self::CALENDAROPTIONS && |
| 344 | 344 | $options !== self::CONTACTOPTIONS && |
@@ -360,7 +360,7 @@ discard block |
||
| 360 | 360 | * @return string |
| 361 | 361 | * @throws FatalNotImplementedException |
| 362 | 362 | */ |
| 363 | - private function normalizeType($options) { |
|
| 363 | + private function normalizeType($options) { |
|
| 364 | 364 | // return the requested CPO as it is defined |
| 365 | 365 | if (isset($this->contentParameters[$options])) |
| 366 | 366 | return $options; |
@@ -646,7 +646,7 @@ discard block |
||
| 646 | 646 | * @access private |
| 647 | 647 | * @return boolean indicating if changes were found or not |
| 648 | 648 | */ |
| 649 | - private function CountChange($folderid) { |
|
| 649 | + private function CountChange($folderid) { |
|
| 650 | 650 | $spa = $this->GetCollection($folderid); |
| 651 | 651 | |
| 652 | 652 | if (!$spa) { |
@@ -690,62 +690,62 @@ discard block |
||
| 690 | 690 | $this->changes[$folderid] = $changecount; |
| 691 | 691 | |
| 692 | 692 | return ($changecount > 0); |
| 693 | - } |
|
| 694 | - |
|
| 695 | - /** |
|
| 696 | - * Checks the hierarchy for changes. |
|
| 697 | - * |
|
| 698 | - * @param boolean export changes, default: false |
|
| 699 | - * |
|
| 700 | - * @access private |
|
| 701 | - * @return boolean indicating if changes were found or not |
|
| 702 | - */ |
|
| 703 | - private function countHierarchyChange($exportChanges = false) { |
|
| 704 | - $folderid = false; |
|
| 705 | - |
|
| 706 | - // Check with device manager if the hierarchy should be reloaded. |
|
| 707 | - // New additional folders are loaded here. |
|
| 708 | - if (ZPush::GetDeviceManager()->IsHierarchySyncRequired()) { |
|
| 709 | - ZLog::Write(LOGLEVEL_DEBUG, "SyncCollections->countHierarchyChange(): DeviceManager says HierarchySync is required."); |
|
| 710 | - return true; |
|
| 711 | - } |
|
| 712 | - |
|
| 713 | - $changecount = false; |
|
| 714 | - if ($exportChanges || $this->hierarchyExporterChecked === false) { |
|
| 715 | - try { |
|
| 716 | - // if this is a validation (not first run), make sure to load the hierarchy data again |
|
| 717 | - if ($this->hierarchyExporterChecked === true && !$this->LoadCollection(false, true, false)) |
|
| 718 | - throw new StatusException("Invalid states found while re-loading hierarchy data."); |
|
| 719 | - |
|
| 720 | - |
|
| 721 | - $changesMem = ZPush::GetDeviceManager()->GetHierarchyChangesWrapper(); |
|
| 722 | - // the hierarchyCache should now fully be initialized - check for changes in the additional folders |
|
| 723 | - $changesMem->Config(ZPush::GetAdditionalSyncFolders(false)); |
|
| 724 | - |
|
| 725 | - // reset backend to the main store |
|
| 726 | - ZPush::GetBackend()->Setup(false); |
|
| 727 | - $exporter = ZPush::GetBackend()->GetExporter(); |
|
| 728 | - if ($exporter !== false && isset($this->addparms[$folderid]["state"])) { |
|
| 729 | - $exporter->Config($this->addparms[$folderid]["state"]); |
|
| 730 | - $ret = $exporter->InitializeExporter($changesMem); |
|
| 731 | - while(is_array($exporter->Synchronize())); |
|
| 732 | - |
|
| 733 | - if ($ret !== false) |
|
| 734 | - $changecount = $changesMem->GetChangeCount(); |
|
| 735 | - |
|
| 736 | - $this->hierarchyExporterChecked = true; |
|
| 737 | - } |
|
| 738 | - } |
|
| 739 | - catch (StatusException $ste) { |
|
| 740 | - throw new StatusException("SyncCollections->countHierarchyChange(): exporter can not be re-configured.", self::ERROR_WRONG_HIERARCHY, null, LOGLEVEL_WARN); |
|
| 741 | - } |
|
| 742 | - |
|
| 743 | - // start over if exporter can not be configured atm |
|
| 744 | - if ($changecount === false ) |
|
| 745 | - ZLog::Write(LOGLEVEL_WARN, "SyncCollections->countHierarchyChange(): no changes received from Exporter."); |
|
| 746 | - } |
|
| 747 | - return ($changecount > 0); |
|
| 748 | - } |
|
| 693 | + } |
|
| 694 | + |
|
| 695 | + /** |
|
| 696 | + * Checks the hierarchy for changes. |
|
| 697 | + * |
|
| 698 | + * @param boolean export changes, default: false |
|
| 699 | + * |
|
| 700 | + * @access private |
|
| 701 | + * @return boolean indicating if changes were found or not |
|
| 702 | + */ |
|
| 703 | + private function countHierarchyChange($exportChanges = false) { |
|
| 704 | + $folderid = false; |
|
| 705 | + |
|
| 706 | + // Check with device manager if the hierarchy should be reloaded. |
|
| 707 | + // New additional folders are loaded here. |
|
| 708 | + if (ZPush::GetDeviceManager()->IsHierarchySyncRequired()) { |
|
| 709 | + ZLog::Write(LOGLEVEL_DEBUG, "SyncCollections->countHierarchyChange(): DeviceManager says HierarchySync is required."); |
|
| 710 | + return true; |
|
| 711 | + } |
|
| 712 | + |
|
| 713 | + $changecount = false; |
|
| 714 | + if ($exportChanges || $this->hierarchyExporterChecked === false) { |
|
| 715 | + try { |
|
| 716 | + // if this is a validation (not first run), make sure to load the hierarchy data again |
|
| 717 | + if ($this->hierarchyExporterChecked === true && !$this->LoadCollection(false, true, false)) |
|
| 718 | + throw new StatusException("Invalid states found while re-loading hierarchy data."); |
|
| 719 | + |
|
| 720 | + |
|
| 721 | + $changesMem = ZPush::GetDeviceManager()->GetHierarchyChangesWrapper(); |
|
| 722 | + // the hierarchyCache should now fully be initialized - check for changes in the additional folders |
|
| 723 | + $changesMem->Config(ZPush::GetAdditionalSyncFolders(false)); |
|
| 724 | + |
|
| 725 | + // reset backend to the main store |
|
| 726 | + ZPush::GetBackend()->Setup(false); |
|
| 727 | + $exporter = ZPush::GetBackend()->GetExporter(); |
|
| 728 | + if ($exporter !== false && isset($this->addparms[$folderid]["state"])) { |
|
| 729 | + $exporter->Config($this->addparms[$folderid]["state"]); |
|
| 730 | + $ret = $exporter->InitializeExporter($changesMem); |
|
| 731 | + while(is_array($exporter->Synchronize())); |
|
| 732 | + |
|
| 733 | + if ($ret !== false) |
|
| 734 | + $changecount = $changesMem->GetChangeCount(); |
|
| 735 | + |
|
| 736 | + $this->hierarchyExporterChecked = true; |
|
| 737 | + } |
|
| 738 | + } |
|
| 739 | + catch (StatusException $ste) { |
|
| 740 | + throw new StatusException("SyncCollections->countHierarchyChange(): exporter can not be re-configured.", self::ERROR_WRONG_HIERARCHY, null, LOGLEVEL_WARN); |
|
| 741 | + } |
|
| 742 | + |
|
| 743 | + // start over if exporter can not be configured atm |
|
| 744 | + if ($changecount === false ) |
|
| 745 | + ZLog::Write(LOGLEVEL_WARN, "SyncCollections->countHierarchyChange(): no changes received from Exporter."); |
|
| 746 | + } |
|
| 747 | + return ($changecount > 0); |
|
| 748 | + } |
|
| 749 | 749 | |
| 750 | 750 | /** |
| 751 | 751 | * Returns an array with all folderid and the amount of changes found |
@@ -873,26 +873,26 @@ discard block |
||
| 873 | 873 | * @access private |
| 874 | 874 | * @return |
| 875 | 875 | */ |
| 876 | - private function loadStateManager() { |
|
| 877 | - if (!isset($this->stateManager)) |
|
| 876 | + private function loadStateManager() { |
|
| 877 | + if (!isset($this->stateManager)) |
|
| 878 | 878 | $this->stateManager = ZPush::GetDeviceManager()->GetStateManager(); |
| 879 | - } |
|
| 880 | - |
|
| 881 | - /** |
|
| 882 | - * Remove folder statistics from a SyncParameter object. |
|
| 883 | - * |
|
| 884 | - * @param SyncParameters $spa |
|
| 885 | - * |
|
| 886 | - * @access public |
|
| 887 | - * @return |
|
| 888 | - */ |
|
| 889 | - private function invalidateFolderStat($spa) { |
|
| 890 | - if($spa->HasFolderStat()) { |
|
| 891 | - ZLog::Write(LOGLEVEL_DEBUG, sprintf("SyncCollections->invalidateFolderStat(): removing folder stat '%s' for folderid '%s'", $spa->GetFolderStat(), $spa->GetFolderId())); |
|
| 892 | - $spa->DelFolderStat(); |
|
| 893 | - $this->SaveCollection($spa); |
|
| 894 | - return true; |
|
| 895 | - } |
|
| 896 | - return false; |
|
| 897 | - } |
|
| 879 | + } |
|
| 880 | + |
|
| 881 | + /** |
|
| 882 | + * Remove folder statistics from a SyncParameter object. |
|
| 883 | + * |
|
| 884 | + * @param SyncParameters $spa |
|
| 885 | + * |
|
| 886 | + * @access public |
|
| 887 | + * @return |
|
| 888 | + */ |
|
| 889 | + private function invalidateFolderStat($spa) { |
|
| 890 | + if($spa->HasFolderStat()) { |
|
| 891 | + ZLog::Write(LOGLEVEL_DEBUG, sprintf("SyncCollections->invalidateFolderStat(): removing folder stat '%s' for folderid '%s'", $spa->GetFolderStat(), $spa->GetFolderId())); |
|
| 892 | + $spa->DelFolderStat(); |
|
| 893 | + $this->SaveCollection($spa); |
|
| 894 | + return true; |
|
| 895 | + } |
|
| 896 | + return false; |
|
| 897 | + } |
|
| 898 | 898 | } |
@@ -257,8 +257,8 @@ |
||
| 257 | 257 | } |
| 258 | 258 | else { |
| 259 | 259 | if(strlen($element) == 0) |
| 260 | - // Do not output empty items. Not sure if we should output an empty tag with $encoder->startTag($map[self::STREAMER_ARRAY], false, true); |
|
| 261 | - ; |
|
| 260 | + // Do not output empty items. Not sure if we should output an empty tag with $encoder->startTag($map[self::STREAMER_ARRAY], false, true); |
|
| 261 | + ; |
|
| 262 | 262 | else { |
| 263 | 263 | $encoder->startTag($map[self::STREAMER_ARRAY]); |
| 264 | 264 | $encoder->content($element); |
@@ -276,7 +276,7 @@ |
||
| 276 | 276 | } |
| 277 | 277 | } |
| 278 | 278 | |
| 279 | - /** |
|
| 279 | + /** |
|
| 280 | 280 | * Writes the backendstorage data |
| 281 | 281 | * |
| 282 | 282 | * @param mixed $data |
@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | $this->useragent = $useragent; |
| 65 | 65 | } |
| 66 | 66 | |
| 67 | - /** |
|
| 67 | + /** |
|
| 68 | 68 | * Removes internal data from the object, so this data can not be exposed. |
| 69 | 69 | * |
| 70 | 70 | * @param boolean $stripHierarchyCache (opt) strips the hierarchy cache - default: true |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | return true; |
| 91 | 91 | } |
| 92 | 92 | |
| 93 | - /** |
|
| 93 | + /** |
|
| 94 | 94 | * Indicates if the object was just created |
| 95 | 95 | * |
| 96 | 96 | * @access public |
@@ -335,7 +335,7 @@ discard block |
||
| 335 | 335 | return false; |
| 336 | 336 | } |
| 337 | 337 | |
| 338 | - /** |
|
| 338 | + /** |
|
| 339 | 339 | * Returns the HierarchyCache Object |
| 340 | 340 | * |
| 341 | 341 | * @access public |
@@ -349,7 +349,7 @@ discard block |
||
| 349 | 349 | return $this->hierarchyCache; |
| 350 | 350 | } |
| 351 | 351 | |
| 352 | - /** |
|
| 352 | + /** |
|
| 353 | 353 | * Returns all known folderids |
| 354 | 354 | * |
| 355 | 355 | * @access public |
@@ -361,7 +361,7 @@ discard block |
||
| 361 | 361 | return array(); |
| 362 | 362 | } |
| 363 | 363 | |
| 364 | - /** |
|
| 364 | + /** |
|
| 365 | 365 | * Returns a linked UUID for a folder id |
| 366 | 366 | * |
| 367 | 367 | * @param string $folderid (opt) if not set, Hierarchy UUID is returned |
@@ -379,7 +379,7 @@ discard block |
||
| 379 | 379 | return false; |
| 380 | 380 | } |
| 381 | 381 | |
| 382 | - /** |
|
| 382 | + /** |
|
| 383 | 383 | * Link a UUID to a folder id |
| 384 | 384 | * If a boolean false UUID is sent, the relation is removed |
| 385 | 385 | * |
@@ -426,7 +426,7 @@ discard block |
||
| 426 | 426 | return true; |
| 427 | 427 | } |
| 428 | 428 | |
| 429 | - /** |
|
| 429 | + /** |
|
| 430 | 430 | * Returns a foldertype for a folder already known to the mobile |
| 431 | 431 | * |
| 432 | 432 | * @param string $folderid |
@@ -441,7 +441,7 @@ discard block |
||
| 441 | 441 | return false; |
| 442 | 442 | } |
| 443 | 443 | |
| 444 | - /** |
|
| 444 | + /** |
|
| 445 | 445 | * Sets the foldertype of a folder id |
| 446 | 446 | * |
| 447 | 447 | * @param string $folderid |
@@ -799,7 +799,7 @@ discard block |
||
| 799 | 799 | 'name' => $name, |
| 800 | 800 | 'type' => $type, |
| 801 | 801 | 'flags' => $flags, |
| 802 | - ); |
|
| 802 | + ); |
|
| 803 | 803 | $this->additionalfolders = $af; |
| 804 | 804 | $this->changed = true; |
| 805 | 805 | |
@@ -133,7 +133,7 @@ |
||
| 133 | 133 | } |
| 134 | 134 | |
| 135 | 135 | |
| 136 | - /** |
|
| 136 | + /** |
|
| 137 | 137 | * Generates a new Policykey |
| 138 | 138 | * |
| 139 | 139 | * @access public |
@@ -109,31 +109,31 @@ discard block |
||
| 109 | 109 | self::CLASS_OTHERTYPES => array(SYNC_FOLDER_TYPE_OTHER, SYNC_FOLDER_TYPE_DRAFTS, SYNC_FOLDER_TYPE_WASTEBASKET, |
| 110 | 110 | SYNC_FOLDER_TYPE_SENTMAIL, SYNC_FOLDER_TYPE_OUTBOX, SYNC_FOLDER_TYPE_USER_MAIL, |
| 111 | 111 | SYNC_FOLDER_TYPE_JOURNAL, SYNC_FOLDER_TYPE_USER_JOURNAL), |
| 112 | - ), |
|
| 112 | + ), |
|
| 113 | 113 | "Contacts" => array( |
| 114 | 114 | self::CLASS_NAME => "SyncContact", |
| 115 | 115 | self::CLASS_REQUIRESPROTOCOLVERSION => true, |
| 116 | 116 | self::CLASS_DEFAULTTYPE => SYNC_FOLDER_TYPE_CONTACT, |
| 117 | 117 | self::CLASS_OTHERTYPES => array(SYNC_FOLDER_TYPE_USER_CONTACT, SYNC_FOLDER_TYPE_UNKNOWN), |
| 118 | - ), |
|
| 118 | + ), |
|
| 119 | 119 | "Calendar" => array( |
| 120 | 120 | self::CLASS_NAME => "SyncAppointment", |
| 121 | 121 | self::CLASS_REQUIRESPROTOCOLVERSION => false, |
| 122 | 122 | self::CLASS_DEFAULTTYPE => SYNC_FOLDER_TYPE_APPOINTMENT, |
| 123 | 123 | self::CLASS_OTHERTYPES => array(SYNC_FOLDER_TYPE_USER_APPOINTMENT), |
| 124 | - ), |
|
| 124 | + ), |
|
| 125 | 125 | "Tasks" => array( |
| 126 | 126 | self::CLASS_NAME => "SyncTask", |
| 127 | 127 | self::CLASS_REQUIRESPROTOCOLVERSION => false, |
| 128 | 128 | self::CLASS_DEFAULTTYPE => SYNC_FOLDER_TYPE_TASK, |
| 129 | 129 | self::CLASS_OTHERTYPES => array(SYNC_FOLDER_TYPE_USER_TASK), |
| 130 | - ), |
|
| 130 | + ), |
|
| 131 | 131 | "Notes" => array( |
| 132 | 132 | self::CLASS_NAME => "SyncNote", |
| 133 | 133 | self::CLASS_REQUIRESPROTOCOLVERSION => false, |
| 134 | 134 | self::CLASS_DEFAULTTYPE => SYNC_FOLDER_TYPE_NOTE, |
| 135 | 135 | self::CLASS_OTHERTYPES => array(SYNC_FOLDER_TYPE_USER_NOTE), |
| 136 | - ), |
|
| 136 | + ), |
|
| 137 | 137 | ); |
| 138 | 138 | |
| 139 | 139 | |
@@ -435,7 +435,6 @@ discard block |
||
| 435 | 435 | * Loads a backend file |
| 436 | 436 | * |
| 437 | 437 | * @param string $backendname |
| 438 | - |
|
| 439 | 438 | * @access public |
| 440 | 439 | * @throws FatalNotImplementedException |
| 441 | 440 | * @return boolean |
@@ -636,7 +635,6 @@ discard block |
||
| 636 | 635 | * |
| 637 | 636 | * @param string $message (opt) message to be displayed |
| 638 | 637 | * @param string $additionalMessage (opt) additional message to be displayed |
| 639 | - |
|
| 640 | 638 | * @access public |
| 641 | 639 | * @return |
| 642 | 640 | * |
@@ -786,7 +784,6 @@ discard block |
||
| 786 | 784 | * Indicates if the Provisioning check has to be forced on these commands |
| 787 | 785 | * |
| 788 | 786 | * @param string $commandCode |
| 789 | - |
|
| 790 | 787 | * @access public |
| 791 | 788 | * @return boolean |
| 792 | 789 | */ |
@@ -814,7 +811,6 @@ discard block |
||
| 814 | 811 | * Indicates if the command to be executed operates on the hierarchy |
| 815 | 812 | * |
| 816 | 813 | * @param int $commandCode |
| 817 | - |
|
| 818 | 814 | * @access public |
| 819 | 815 | * @return boolean |
| 820 | 816 | */ |
@@ -829,7 +825,6 @@ discard block |
||
| 829 | 825 | * |
| 830 | 826 | * @param string $commandCode a commandCode |
| 831 | 827 | * @param string $option e.g. self::UNAUTHENTICATED |
| 832 | - |
|
| 833 | 828 | * @access private |
| 834 | 829 | * @throws FatalNotImplementedException |
| 835 | 830 | * @return object StateMachine |