Passed
Branch master (ff9d34)
by Mike
09:14
created
lib/request/resolverecipients.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -19,13 +19,13 @@
 block discarded – undo
19 19
      */
20 20
     public function Handle($commandCode) {
21 21
         // Parse input
22
-        if(!self::$decoder->getElementStartTag(SYNC_RESOLVERECIPIENTS_RESOLVERECIPIENTS))
22
+        if (!self::$decoder->getElementStartTag(SYNC_RESOLVERECIPIENTS_RESOLVERECIPIENTS))
23 23
             return false;
24 24
 
25 25
         $resolveRecipients = new SyncResolveRecipients();
26 26
         $resolveRecipients->Decode(self::$decoder);
27 27
 
28
-        if(!self::$decoder->getElementEndTag())
28
+        if (!self::$decoder->getElementEndTag())
29 29
             return false; // SYNC_RESOLVERECIPIENTS_RESOLVERECIPIENTS
30 30
 
31 31
         $resolveRecipients = self::$backend->ResolveRecipients($resolveRecipients);
Please login to merge, or discard this patch.
lib/request/foldersync.php 1 patch
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -17,21 +17,21 @@  discard block
 block discarded – undo
17 17
      * @access public
18 18
      * @return boolean
19 19
      */
20
-    public function Handle ($commandCode) {
20
+    public function Handle($commandCode) {
21 21
         // Parse input
22
-        if(!self::$decoder->getElementStartTag(SYNC_FOLDERHIERARCHY_FOLDERSYNC))
22
+        if (!self::$decoder->getElementStartTag(SYNC_FOLDERHIERARCHY_FOLDERSYNC))
23 23
             return false;
24 24
 
25
-        if(!self::$decoder->getElementStartTag(SYNC_FOLDERHIERARCHY_SYNCKEY))
25
+        if (!self::$decoder->getElementStartTag(SYNC_FOLDERHIERARCHY_SYNCKEY))
26 26
             return false;
27 27
 
28 28
         $synckey = self::$decoder->getElementContent();
29 29
 
30
-        if(!self::$decoder->getElementEndTag())
30
+        if (!self::$decoder->getElementEndTag())
31 31
             return false;
32 32
 
33 33
         // every FolderSync with SyncKey 0 should return the supported AS version & command headers
34
-        if($synckey == "0") {
34
+        if ($synckey == "0") {
35 35
             self::$specialHeaders = array();
36 36
             self::$specialHeaders[] = ZPush::GetSupportedProtocolVersions();
37 37
             self::$specialHeaders[] = ZPush::GetSupportedCommands();
@@ -67,25 +67,25 @@  discard block
 block discarded – undo
67 67
         self::$backend->Setup(false);
68 68
 
69 69
         // process incoming changes
70
-        if(self::$decoder->getElementStartTag(SYNC_FOLDERHIERARCHY_CHANGES)) {
70
+        if (self::$decoder->getElementStartTag(SYNC_FOLDERHIERARCHY_CHANGES)) {
71 71
             // Ignore <Count> if present
72
-            if(self::$decoder->getElementStartTag(SYNC_FOLDERHIERARCHY_COUNT)) {
72
+            if (self::$decoder->getElementStartTag(SYNC_FOLDERHIERARCHY_COUNT)) {
73 73
                 self::$decoder->getElementContent();
74
-                if(!self::$decoder->getElementEndTag())
74
+                if (!self::$decoder->getElementEndTag())
75 75
                     return false;
76 76
             }
77 77
 
78 78
             // Process the changes (either <Add>, <Modify>, or <Remove>)
79 79
             $element = self::$decoder->getElement();
80 80
 
81
-            if($element[EN_TYPE] != EN_TYPE_STARTTAG)
81
+            if ($element[EN_TYPE] != EN_TYPE_STARTTAG)
82 82
                 return false;
83 83
 
84 84
             $importer = false;
85 85
             WBXMLDecoder::ResetInWhile("folderSyncIncomingChange");
86
-            while(WBXMLDecoder::InWhile("folderSyncIncomingChange")) {
86
+            while (WBXMLDecoder::InWhile("folderSyncIncomingChange")) {
87 87
                 $folder = new SyncFolder();
88
-                if(!$folder->Decode(self::$decoder))
88
+                if (!$folder->Decode(self::$decoder))
89 89
                     break;
90 90
 
91 91
                 // add the backendId to the SyncFolder object
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
                     }
102 102
 
103 103
                     if ($status == SYNC_FSSTATUS_SUCCESS) {
104
-                        switch($element[EN_TAG]) {
104
+                        switch ($element[EN_TAG]) {
105 105
                             case SYNC_ADD:
106 106
                             case SYNC_MODIFY:
107 107
                                 $serverid = $changesMem->ImportFolderChange($folder);
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
                 }
122 122
             }
123 123
 
124
-            if(!self::$decoder->getElementEndTag())
124
+            if (!self::$decoder->getElementEndTag())
125 125
                 return false;
126 126
         }
127 127
         // no incoming changes
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
             }
134 134
         }
135 135
 
136
-        if(!self::$decoder->getElementEndTag())
136
+        if (!self::$decoder->getElementEndTag())
137 137
             return false;
138 138
 
139 139
         // We have processed incoming foldersync requests, now send the PIM
@@ -161,16 +161,16 @@  discard block
 block discarded – undo
161 161
                     $totalChanges = $exporter->GetChangeCount();
162 162
                     $exported = 0;
163 163
                     $partial = false;
164
-                    while(is_array($exporter->Synchronize())) {
164
+                    while (is_array($exporter->Synchronize())) {
165 165
                         $exported++;
166 166
 
167
-                        if (time() % 4 ) {
167
+                        if (time() % 4) {
168 168
                             self::$topCollector->AnnounceInformation(sprintf("Exported %d from %d folders", $exported, $totalChanges));
169 169
                         }
170 170
 
171 171
                         // if partial sync is allowed, stop if this takes too long
172 172
                         if (USE_PARTIAL_FOLDERSYNC && Request::IsRequestTimeoutReached()) {
173
-                            ZLog::Write(LOGLEVEL_WARN, sprintf("Request->HandleFolderSync(): Exporting folders is too slow. In %d seconds only %d from %d changes were processed.",(time() - $_SERVER["REQUEST_TIME"]), $exported, $totalChanges));
173
+                            ZLog::Write(LOGLEVEL_WARN, sprintf("Request->HandleFolderSync(): Exporting folders is too slow. In %d seconds only %d from %d changes were processed.", (time() - $_SERVER["REQUEST_TIME"]), $exported, $totalChanges));
174 174
                             self::$topCollector->AnnounceInformation(sprintf("Partial export of %d out of %d folders", $exported, $totalChanges), true);
175 175
                             self::$deviceManager->SetFolderSyncComplete(false);
176 176
                             $partial = true;
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
                     }
189 189
 
190 190
                     // get the new state from the backend
191
-                    $newsyncstate = (isset($exporter))?$exporter->GetState():"";
191
+                    $newsyncstate = (isset($exporter)) ? $exporter->GetState() : "";
192 192
                 }
193 193
                 catch (StatusException $stex) {
194 194
                     if ($stex->getCode() == SYNC_FSSTATUS_CODEUNKNOWN)
@@ -218,10 +218,10 @@  discard block
 block discarded – undo
218 218
                     self::$encoder->startTag(SYNC_FOLDERHIERARCHY_COUNT);
219 219
                     self::$encoder->content($changeCount);
220 220
                     self::$encoder->endTag();
221
-                    while($changesMem->Synchronize());
221
+                    while ($changesMem->Synchronize());
222 222
                 }
223 223
                 self::$encoder->endTag();
224
-                self::$topCollector->AnnounceInformation(sprintf("Outgoing %d folders",$changeCount), true);
224
+                self::$topCollector->AnnounceInformation(sprintf("Outgoing %d folders", $changeCount), true);
225 225
 
226 226
                 if ($changeCount == 0) {
227 227
                     self::$deviceManager->CheckFolderData();
Please login to merge, or discard this patch.
lib/request/itemoperations.php 1 patch
Spacing   +67 added lines, -67 removed lines patch added patch discarded remove patch
@@ -20,38 +20,38 @@  discard block
 block discarded – undo
20 20
      */
21 21
     public function Handle($commandCode) {
22 22
         // Parse input
23
-        if(!self::$decoder->getElementStartTag(SYNC_ITEMOPERATIONS_ITEMOPERATIONS))
23
+        if (!self::$decoder->getElementStartTag(SYNC_ITEMOPERATIONS_ITEMOPERATIONS))
24 24
             return false;
25 25
 
26 26
         $itemoperations = array();
27 27
         //ItemOperations can either be Fetch, EmptyFolderContents or Move
28 28
         WBXMLDecoder::ResetInWhile("itemOperationsActions");
29
-        while(WBXMLDecoder::InWhile("itemOperationsActions")) {
29
+        while (WBXMLDecoder::InWhile("itemOperationsActions")) {
30 30
             //TODO check if multiple item operations are possible in one request
31 31
             $el = self::$decoder->getElement();
32 32
 
33
-            if($el[EN_TYPE] != EN_TYPE_STARTTAG)
33
+            if ($el[EN_TYPE] != EN_TYPE_STARTTAG)
34 34
                 return false;
35 35
 
36 36
             $fetch = $efc = $move = false;
37 37
             $operation = array();
38
-            if($el[EN_TAG] == SYNC_ITEMOPERATIONS_FETCH) {
38
+            if ($el[EN_TAG] == SYNC_ITEMOPERATIONS_FETCH) {
39 39
                 $fetch = true;
40 40
                 $operation['operation'] = SYNC_ITEMOPERATIONS_FETCH;
41 41
                 self::$topCollector->AnnounceInformation("Fetch", true);
42 42
             }
43
-            else if($el[EN_TAG] == SYNC_ITEMOPERATIONS_EMPTYFOLDERCONTENTS) {
43
+            else if ($el[EN_TAG] == SYNC_ITEMOPERATIONS_EMPTYFOLDERCONTENTS) {
44 44
                 $efc = true;
45 45
                 $operation['operation'] = SYNC_ITEMOPERATIONS_EMPTYFOLDERCONTENTS;
46 46
                 self::$topCollector->AnnounceInformation("Empty Folder", true);
47 47
             }
48
-            else if($el[EN_TAG] == SYNC_ITEMOPERATIONS_MOVE) {
48
+            else if ($el[EN_TAG] == SYNC_ITEMOPERATIONS_MOVE) {
49 49
                 $move = true;
50 50
                 $operation['operation'] = SYNC_ITEMOPERATIONS_MOVE;
51 51
                 self::$topCollector->AnnounceInformation("Move", true);
52 52
             }
53 53
 
54
-            if(!$fetch && !$efc && !$move) {
54
+            if (!$fetch && !$efc && !$move) {
55 55
                 ZLog::Write(LOGLEVEL_DEBUG, "Unknown item operation:".print_r($el, 1));
56 56
                 self::$topCollector->AnnounceInformation("Unknown operation", true);
57 57
                 return false;
@@ -59,42 +59,42 @@  discard block
 block discarded – undo
59 59
 
60 60
             // process operation
61 61
             WBXMLDecoder::ResetInWhile("itemOperationsOperation");
62
-            while(WBXMLDecoder::InWhile("itemOperationsOperation")) {
62
+            while (WBXMLDecoder::InWhile("itemOperationsOperation")) {
63 63
                 if ($fetch) {
64 64
                     // Save all OPTIONS into a ContentParameters object
65 65
                     $operation["cpo"] = new ContentParameters();
66 66
 
67
-                    if(self::$decoder->getElementStartTag(SYNC_ITEMOPERATIONS_STORE)) {
67
+                    if (self::$decoder->getElementStartTag(SYNC_ITEMOPERATIONS_STORE)) {
68 68
                         $operation['store'] = self::$decoder->getElementContent();
69
-                        if(!self::$decoder->getElementEndTag())
70
-                            return false;//SYNC_ITEMOPERATIONS_STORE
69
+                        if (!self::$decoder->getElementEndTag())
70
+                            return false; //SYNC_ITEMOPERATIONS_STORE
71 71
                     }
72 72
 
73
-                    if(self::$decoder->getElementStartTag(SYNC_SEARCH_LONGID)) {
73
+                    if (self::$decoder->getElementStartTag(SYNC_SEARCH_LONGID)) {
74 74
                         $operation['longid'] = self::$decoder->getElementContent();
75
-                        if(!self::$decoder->getElementEndTag())
76
-                            return false;//SYNC_SEARCH_LONGID
75
+                        if (!self::$decoder->getElementEndTag())
76
+                            return false; //SYNC_SEARCH_LONGID
77 77
                     }
78 78
 
79
-                    if(self::$decoder->getElementStartTag(SYNC_FOLDERID)) {
79
+                    if (self::$decoder->getElementStartTag(SYNC_FOLDERID)) {
80 80
                         $operation['folderid'] = self::$decoder->getElementContent();
81
-                        if(!self::$decoder->getElementEndTag())
82
-                            return false;//SYNC_FOLDERID
81
+                        if (!self::$decoder->getElementEndTag())
82
+                            return false; //SYNC_FOLDERID
83 83
                     }
84 84
 
85
-                    if(self::$decoder->getElementStartTag(SYNC_SERVERENTRYID)) {
85
+                    if (self::$decoder->getElementStartTag(SYNC_SERVERENTRYID)) {
86 86
                         $operation['serverid'] = self::$decoder->getElementContent();
87
-                        if(!self::$decoder->getElementEndTag())
88
-                            return false;//SYNC_SERVERENTRYID
87
+                        if (!self::$decoder->getElementEndTag())
88
+                            return false; //SYNC_SERVERENTRYID
89 89
                     }
90 90
 
91
-                    if(self::$decoder->getElementStartTag(SYNC_AIRSYNCBASE_FILEREFERENCE)) {
91
+                    if (self::$decoder->getElementStartTag(SYNC_AIRSYNCBASE_FILEREFERENCE)) {
92 92
                         $operation['filereference'] = self::$decoder->getElementContent();
93
-                        if(!self::$decoder->getElementEndTag())
94
-                            return false;//SYNC_AIRSYNCBASE_FILEREFERENCE
93
+                        if (!self::$decoder->getElementEndTag())
94
+                            return false; //SYNC_AIRSYNCBASE_FILEREFERENCE
95 95
                     }
96 96
 
97
-                    if(($el = self::$decoder->getElementStartTag(SYNC_ITEMOPERATIONS_OPTIONS)) && ($el[EN_FLAGS] & EN_FLAGS_CONTENT)) {
97
+                    if (($el = self::$decoder->getElementStartTag(SYNC_ITEMOPERATIONS_OPTIONS)) && ($el[EN_FLAGS] & EN_FLAGS_CONTENT)) {
98 98
                         //TODO other options
99 99
                         //schema
100 100
                         //range
@@ -104,36 +104,36 @@  discard block
 block discarded – undo
104 104
                         //rm:RightsManagementSupport
105 105
 
106 106
                         WBXMLDecoder::ResetInWhile("itemOperationsOptions");
107
-                        while(WBXMLDecoder::InWhile("itemOperationsOptions")) {
107
+                        while (WBXMLDecoder::InWhile("itemOperationsOptions")) {
108 108
                             while (self::$decoder->getElementStartTag(SYNC_AIRSYNCBASE_BODYPREFERENCE)) {
109
-                                if(self::$decoder->getElementStartTag(SYNC_AIRSYNCBASE_TYPE)) {
109
+                                if (self::$decoder->getElementStartTag(SYNC_AIRSYNCBASE_TYPE)) {
110 110
                                     $bptype = self::$decoder->getElementContent();
111 111
                                     $operation["cpo"]->BodyPreference($bptype);
112
-                                    if(!self::$decoder->getElementEndTag()) {
112
+                                    if (!self::$decoder->getElementEndTag()) {
113 113
                                         return false;
114 114
                                     }
115 115
                                 }
116 116
 
117
-                                if(self::$decoder->getElementStartTag(SYNC_AIRSYNCBASE_TRUNCATIONSIZE)) {
117
+                                if (self::$decoder->getElementStartTag(SYNC_AIRSYNCBASE_TRUNCATIONSIZE)) {
118 118
                                     $operation["cpo"]->BodyPreference($bptype)->SetTruncationSize(self::$decoder->getElementContent());
119
-                                    if(!self::$decoder->getElementEndTag())
119
+                                    if (!self::$decoder->getElementEndTag())
120 120
                                         return false;
121 121
                                 }
122 122
 
123
-                                if(self::$decoder->getElementStartTag(SYNC_AIRSYNCBASE_ALLORNONE)) {
123
+                                if (self::$decoder->getElementStartTag(SYNC_AIRSYNCBASE_ALLORNONE)) {
124 124
                                     $operation["cpo"]->BodyPreference($bptype)->SetAllOrNone(self::$decoder->getElementContent());
125
-                                    if(!self::$decoder->getElementEndTag())
125
+                                    if (!self::$decoder->getElementEndTag())
126 126
                                         return false;
127 127
                                 }
128 128
 
129
-                                if(self::$decoder->getElementStartTag(SYNC_AIRSYNCBASE_PREVIEW)) {
129
+                                if (self::$decoder->getElementStartTag(SYNC_AIRSYNCBASE_PREVIEW)) {
130 130
                                     $operation["cpo"]->BodyPreference($bptype)->SetPreview(self::$decoder->getElementContent());
131
-                                    if(!self::$decoder->getElementEndTag())
131
+                                    if (!self::$decoder->getElementEndTag())
132 132
                                         return false;
133 133
                                 }
134 134
 
135
-                                if(!self::$decoder->getElementEndTag())
136
-                                    return false;//SYNC_AIRSYNCBASE_BODYPREFERENCE
135
+                                if (!self::$decoder->getElementEndTag())
136
+                                    return false; //SYNC_AIRSYNCBASE_BODYPREFERENCE
137 137
                             }
138 138
 
139 139
                             if (self::$decoder->getElementStartTag(SYNC_AIRSYNCBASE_BODYPARTPREFERENCE)) {
@@ -147,19 +147,19 @@  discard block
 block discarded – undo
147 147
 
148 148
                                 if (self::$decoder->getElementStartTag(SYNC_AIRSYNCBASE_TRUNCATIONSIZE)) {
149 149
                                     $operation["cpo"]->BodyPartPreference($bpptype)->SetTruncationSize(self::$decoder->getElementContent());
150
-                                    if(!self::$decoder->getElementEndTag())
150
+                                    if (!self::$decoder->getElementEndTag())
151 151
                                         return false;
152 152
                                 }
153 153
 
154 154
                                 if (self::$decoder->getElementStartTag(SYNC_AIRSYNCBASE_ALLORNONE)) {
155 155
                                     $operation["cpo"]->BodyPartPreference($bpptype)->SetAllOrNone(self::$decoder->getElementContent());
156
-                                    if(!self::$decoder->getElementEndTag())
156
+                                    if (!self::$decoder->getElementEndTag())
157 157
                                         return false;
158 158
                                 }
159 159
 
160 160
                                 if (self::$decoder->getElementStartTag(SYNC_AIRSYNCBASE_PREVIEW)) {
161 161
                                     $operation["cpo"]->BodyPartPreference($bpptype)->SetPreview(self::$decoder->getElementContent());
162
-                                    if(!self::$decoder->getElementEndTag())
162
+                                    if (!self::$decoder->getElementEndTag())
163 163
                                         return false;
164 164
                                 }
165 165
 
@@ -167,41 +167,41 @@  discard block
 block discarded – undo
167 167
                                     return false;
168 168
                             }
169 169
 
170
-                            if(self::$decoder->getElementStartTag(SYNC_MIMESUPPORT)) {
170
+                            if (self::$decoder->getElementStartTag(SYNC_MIMESUPPORT)) {
171 171
                                 $operation["cpo"]->SetMimeSupport(self::$decoder->getElementContent());
172
-                                if(!self::$decoder->getElementEndTag())
172
+                                if (!self::$decoder->getElementEndTag())
173 173
                                     return false;
174 174
                             }
175 175
 
176
-                            if(self::$decoder->getElementStartTag(SYNC_ITEMOPERATIONS_RANGE)) {
176
+                            if (self::$decoder->getElementStartTag(SYNC_ITEMOPERATIONS_RANGE)) {
177 177
                                 $operation["range"] = self::$decoder->getElementContent();
178
-                                if(!self::$decoder->getElementEndTag())
178
+                                if (!self::$decoder->getElementEndTag())
179 179
                                     return false;
180 180
                             }
181 181
 
182
-                            if(self::$decoder->getElementStartTag(SYNC_ITEMOPERATIONS_SCHEMA)) {
182
+                            if (self::$decoder->getElementStartTag(SYNC_ITEMOPERATIONS_SCHEMA)) {
183 183
                                 // read schema tags
184 184
                                 WBXMLDecoder::ResetInWhile("itemOperationsSchema");
185
-                                while(WBXMLDecoder::InWhile("itemOperationsSchema")) {
185
+                                while (WBXMLDecoder::InWhile("itemOperationsSchema")) {
186 186
                                     // TODO save elements
187 187
                                     $el = self::$decoder->getElement();
188 188
                                     $e = self::$decoder->peek();
189
-                                    if($e[EN_TYPE] == EN_TYPE_ENDTAG) {
189
+                                    if ($e[EN_TYPE] == EN_TYPE_ENDTAG) {
190 190
                                         self::$decoder->getElementEndTag();
191 191
                                         break;
192 192
                                     }
193 193
                                 }
194 194
                             }
195 195
 
196
-                            if(self::$decoder->getElementStartTag(SYNC_RIGHTSMANAGEMENT_SUPPORT)) {
196
+                            if (self::$decoder->getElementStartTag(SYNC_RIGHTSMANAGEMENT_SUPPORT)) {
197 197
                                 $operation["cpo"]->SetRmSupport(self::$decoder->getElementContent());
198
-                                if(!self::$decoder->getElementEndTag())
198
+                                if (!self::$decoder->getElementEndTag())
199 199
                                     return false;
200 200
                             }
201 201
 
202 202
                             //break if it reached the endtag
203 203
                             $e = self::$decoder->peek();
204
-                            if($e[EN_TYPE] == EN_TYPE_ENDTAG) {
204
+                            if ($e[EN_TYPE] == EN_TYPE_ENDTAG) {
205 205
                                 self::$decoder->getElementEndTag();
206 206
                                 break;
207 207
                             }
@@ -212,7 +212,7 @@  discard block
 block discarded – undo
212 212
                         $operation["cpo"]->SetRemoveRmProtection(true);
213 213
                         if (($rrmp = self::$decoder->getElementContent()) !== false) {
214 214
                             $operation["cpo"]->SetRemoveRmProtection($rrmp);
215
-                            if(!self::$decoder->getElementEndTag()) {
215
+                            if (!self::$decoder->getElementEndTag()) {
216 216
                                 return false;
217 217
                             }
218 218
                         }
@@ -220,17 +220,17 @@  discard block
 block discarded – undo
220 220
                 } // end if fetch
221 221
 
222 222
                 if ($efc) {
223
-                    if(self::$decoder->getElementStartTag(SYNC_FOLDERID)) {
223
+                    if (self::$decoder->getElementStartTag(SYNC_FOLDERID)) {
224 224
                         $operation['folderid'] = self::$decoder->getElementContent();
225
-                        if(!self::$decoder->getElementEndTag())
226
-                            return false;//SYNC_FOLDERID
225
+                        if (!self::$decoder->getElementEndTag())
226
+                            return false; //SYNC_FOLDERID
227 227
                     }
228
-                    if(self::$decoder->getElementStartTag(SYNC_ITEMOPERATIONS_OPTIONS)) {
229
-                        if(self::$decoder->getElementStartTag(SYNC_ITEMOPERATIONS_DELETESUBFOLDERS)) {
228
+                    if (self::$decoder->getElementStartTag(SYNC_ITEMOPERATIONS_OPTIONS)) {
229
+                        if (self::$decoder->getElementStartTag(SYNC_ITEMOPERATIONS_DELETESUBFOLDERS)) {
230 230
                             $operation['deletesubfolders'] = true;
231 231
                             if (($dsf = self::$decoder->getElementContent()) !== false) {
232 232
                                 $operation['deletesubfolders'] = (bool)$dsf;
233
-                                if(!self::$decoder->getElementEndTag())
233
+                                if (!self::$decoder->getElementEndTag())
234 234
                                     return false;
235 235
                             }
236 236
                         }
@@ -242,7 +242,7 @@  discard block
 block discarded – undo
242 242
 
243 243
                 //break if it reached the endtag SYNC_ITEMOPERATIONS_FETCH or SYNC_ITEMOPERATIONS_EMPTYFOLDERCONTENTS or SYNC_ITEMOPERATIONS_MOVE
244 244
                 $e = self::$decoder->peek();
245
-                if($e[EN_TYPE] == EN_TYPE_ENDTAG) {
245
+                if ($e[EN_TYPE] == EN_TYPE_ENDTAG) {
246 246
                     self::$decoder->getElementEndTag();
247 247
                     break;
248 248
                 }
@@ -256,7 +256,7 @@  discard block
 block discarded – undo
256 256
             $itemoperations[] = $operation;
257 257
             //break if it reached the endtag
258 258
             $e = self::$decoder->peek();
259
-            if($e[EN_TYPE] == EN_TYPE_ENDTAG) {
259
+            if ($e[EN_TYPE] == EN_TYPE_ENDTAG) {
260 260
                 self::$decoder->getElementEndTag(); //SYNC_ITEMOPERATIONS_ITEMOPERATIONS
261 261
                 break;
262 262
             }
@@ -270,11 +270,11 @@  discard block
 block discarded – undo
270 270
 
271 271
         self::$encoder->startTag(SYNC_ITEMOPERATIONS_STATUS);
272 272
         self::$encoder->content($status);
273
-        self::$encoder->endTag();//SYNC_ITEMOPERATIONS_STATUS
273
+        self::$encoder->endTag(); //SYNC_ITEMOPERATIONS_STATUS
274 274
 
275 275
         // Stop here if something went wrong
276 276
         if ($status != SYNC_ITEMOPERATIONSSTATUS_SUCCESS) {
277
-            self::$encoder->endTag();//SYNC_ITEMOPERATIONS_ITEMOPERATIONS
277
+            self::$encoder->endTag(); //SYNC_ITEMOPERATIONS_ITEMOPERATIONS
278 278
             return true;
279 279
         }
280 280
 
@@ -320,7 +320,7 @@  discard block
 block discarded – undo
320 320
 
321 321
                     self::$encoder->startTag(SYNC_ITEMOPERATIONS_STATUS);
322 322
                     self::$encoder->content($status);
323
-                    self::$encoder->endTag();//SYNC_ITEMOPERATIONS_STATUS
323
+                    self::$encoder->endTag(); //SYNC_ITEMOPERATIONS_STATUS
324 324
 
325 325
                     if (isset($operation['folderid']) && isset($operation['serverid'])) {
326 326
                         self::$encoder->startTag(SYNC_FOLDERID);
@@ -365,7 +365,7 @@  discard block
 block discarded – undo
365 365
                         self::$encoder->endTag(); //SYNC_ITEMOPERATIONS_PROPERTIES
366 366
                     }
367 367
 
368
-                self::$encoder->endTag();//SYNC_ITEMOPERATIONS_FETCH
368
+                self::$encoder->endTag(); //SYNC_ITEMOPERATIONS_FETCH
369 369
             }
370 370
             // empty folder contents operation
371 371
             else if ($operation['operation'] == SYNC_ITEMOPERATIONS_EMPTYFOLDERCONTENTS) {
@@ -383,14 +383,14 @@  discard block
 block discarded – undo
383 383
 
384 384
                     self::$encoder->startTag(SYNC_ITEMOPERATIONS_STATUS);
385 385
                     self::$encoder->content($status);
386
-                    self::$encoder->endTag();//SYNC_ITEMOPERATIONS_STATUS
386
+                    self::$encoder->endTag(); //SYNC_ITEMOPERATIONS_STATUS
387 387
 
388 388
                     if (isset($operation['folderid'])) {
389 389
                         self::$encoder->startTag(SYNC_FOLDERID);
390 390
                         self::$encoder->content($operation['folderid']);
391 391
                         self::$encoder->endTag(); // end SYNC_FOLDERID
392 392
                     }
393
-                self::$encoder->endTag();//SYNC_ITEMOPERATIONS_EMPTYFOLDERCONTENTS
393
+                self::$encoder->endTag(); //SYNC_ITEMOPERATIONS_EMPTYFOLDERCONTENTS
394 394
             }
395 395
             // TODO implement ItemOperations Move
396 396
             // move operation
@@ -401,13 +401,13 @@  discard block
 block discarded – undo
401 401
                 self::$encoder->startTag(SYNC_ITEMOPERATIONS_MOVE);
402 402
                     self::$encoder->startTag(SYNC_ITEMOPERATIONS_STATUS);
403 403
                     self::$encoder->content(SYNC_ITEMOPERATIONSSTATUS_SERVERERROR);
404
-                    self::$encoder->endTag();//SYNC_ITEMOPERATIONS_STATUS
405
-                self::$encoder->endTag();//SYNC_ITEMOPERATIONS_MOVE
404
+                    self::$encoder->endTag(); //SYNC_ITEMOPERATIONS_STATUS
405
+                self::$encoder->endTag(); //SYNC_ITEMOPERATIONS_MOVE
406 406
             }
407 407
 
408 408
         }
409
-        self::$encoder->endTag();//SYNC_ITEMOPERATIONS_RESPONSE
410
-        self::$encoder->endTag();//SYNC_ITEMOPERATIONS_ITEMOPERATIONS
409
+        self::$encoder->endTag(); //SYNC_ITEMOPERATIONS_RESPONSE
410
+        self::$encoder->endTag(); //SYNC_ITEMOPERATIONS_ITEMOPERATIONS
411 411
 
412 412
         return true;
413 413
     }
Please login to merge, or discard this patch.
lib/request/getattachment.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
      */
20 20
     public function Handle($commandCode) {
21 21
         $attname = Request::GetGETAttachmentName();
22
-        if(!$attname)
22
+        if (!$attname)
23 23
             return false;
24 24
 
25 25
         try {
@@ -37,8 +37,8 @@  discard block
 block discarded – undo
37 37
             fclose($stream);
38 38
             if ($l === false)
39 39
                 throw new FatalException("HandleGetAttachment(): fpassthru === false !!!");
40
-            self::$topCollector->AnnounceInformation(sprintf("Streamed %d KB attachment", round($l/1024)), true);
41
-            ZLog::Write(LOGLEVEL_DEBUG, sprintf("HandleGetAttachment(): attachment with %d KB sent to mobile", round($l/1024)));
40
+            self::$topCollector->AnnounceInformation(sprintf("Streamed %d KB attachment", round($l / 1024)), true);
41
+            ZLog::Write(LOGLEVEL_DEBUG, sprintf("HandleGetAttachment(): attachment with %d KB sent to mobile", round($l / 1024)));
42 42
         }
43 43
         catch (StatusException $s) {
44 44
             // StatusException already logged so we just need to pass it upwards to send a HTTP error
Please login to merge, or discard this patch.
lib/request/getitemestimate.php 1 patch
Spacing   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -22,20 +22,20 @@  discard block
 block discarded – undo
22 22
     public function Handle($commandCode) {
23 23
         $sc = new SyncCollections();
24 24
 
25
-        if(!self::$decoder->getElementStartTag(SYNC_GETITEMESTIMATE_GETITEMESTIMATE))
25
+        if (!self::$decoder->getElementStartTag(SYNC_GETITEMESTIMATE_GETITEMESTIMATE))
26 26
             return false;
27 27
 
28
-        if(!self::$decoder->getElementStartTag(SYNC_GETITEMESTIMATE_FOLDERS))
28
+        if (!self::$decoder->getElementStartTag(SYNC_GETITEMESTIMATE_FOLDERS))
29 29
             return false;
30 30
 
31
-        while(self::$decoder->getElementStartTag(SYNC_GETITEMESTIMATE_FOLDER)) {
31
+        while (self::$decoder->getElementStartTag(SYNC_GETITEMESTIMATE_FOLDER)) {
32 32
             $spa = new SyncParameters();
33 33
             $spastatus = false;
34 34
 
35 35
             // read the folder properties
36 36
             WBXMLDecoder::ResetInWhile("getItemEstimateFolders");
37
-            while(WBXMLDecoder::InWhile("getItemEstimateFolders")) {
38
-                if(self::$decoder->getElementStartTag(SYNC_SYNCKEY)) {
37
+            while (WBXMLDecoder::InWhile("getItemEstimateFolders")) {
38
+                if (self::$decoder->getElementStartTag(SYNC_SYNCKEY)) {
39 39
                     try {
40 40
                         $spa->SetSyncKey(self::$decoder->getElementContent());
41 41
                     }
@@ -43,51 +43,51 @@  discard block
 block discarded – undo
43 43
                         $spastatus = SYNC_GETITEMESTSTATUS_SYNCSTATENOTPRIMED;
44 44
                     }
45 45
 
46
-                    if(!self::$decoder->getElementEndTag())
46
+                    if (!self::$decoder->getElementEndTag())
47 47
                         return false;
48 48
                 }
49 49
 
50
-                elseif(self::$decoder->getElementStartTag(SYNC_GETITEMESTIMATE_FOLDERID)) {
50
+                elseif (self::$decoder->getElementStartTag(SYNC_GETITEMESTIMATE_FOLDERID)) {
51 51
                     $fid = self::$decoder->getElementContent();
52 52
                     $spa->SetFolderId($fid);
53 53
                     $spa->SetBackendFolderId(self::$deviceManager->GetBackendIdForFolderId($fid));
54 54
 
55
-                    if(!self::$decoder->getElementEndTag())
55
+                    if (!self::$decoder->getElementEndTag())
56 56
                         return false;
57 57
                 }
58 58
 
59 59
                 // conversation mode requested
60
-                elseif(self::$decoder->getElementStartTag(SYNC_CONVERSATIONMODE)) {
60
+                elseif (self::$decoder->getElementStartTag(SYNC_CONVERSATIONMODE)) {
61 61
                     $spa->SetConversationMode(true);
62
-                    if(($conversationmode = self::$decoder->getElementContent()) !== false) {
62
+                    if (($conversationmode = self::$decoder->getElementContent()) !== false) {
63 63
                         $spa->SetConversationMode((bool)$conversationmode);
64
-                        if(!self::$decoder->getElementEndTag())
64
+                        if (!self::$decoder->getElementEndTag())
65 65
                             return false;
66 66
                     }
67 67
                 }
68 68
 
69 69
                 // get items estimate does not necessarily send the folder type
70
-                elseif(self::$decoder->getElementStartTag(SYNC_GETITEMESTIMATE_FOLDERTYPE)) {
70
+                elseif (self::$decoder->getElementStartTag(SYNC_GETITEMESTIMATE_FOLDERTYPE)) {
71 71
                     $spa->SetContentClass(self::$decoder->getElementContent());
72 72
 
73
-                    if(!self::$decoder->getElementEndTag())
73
+                    if (!self::$decoder->getElementEndTag())
74 74
                         return false;
75 75
                 }
76 76
 
77 77
                 //TODO AS 2.5 and filtertype not set
78
-                elseif(self::$decoder->getElementStartTag(SYNC_FILTERTYPE)) {
78
+                elseif (self::$decoder->getElementStartTag(SYNC_FILTERTYPE)) {
79 79
                     $spa->SetFilterType(self::$decoder->getElementContent());
80 80
 
81
-                    if(!self::$decoder->getElementEndTag())
81
+                    if (!self::$decoder->getElementEndTag())
82 82
                         return false;
83 83
                 }
84 84
 
85
-                while(self::$decoder->getElementStartTag(SYNC_OPTIONS)) {
85
+                while (self::$decoder->getElementStartTag(SYNC_OPTIONS)) {
86 86
                     WBXMLDecoder::ResetInWhile("getItemEstimateOptions");
87
-                    while(WBXMLDecoder::InWhile("getItemEstimateOptions")) {
87
+                    while (WBXMLDecoder::InWhile("getItemEstimateOptions")) {
88 88
                         $firstOption = true;
89 89
                         // foldertype definition
90
-                        if(self::$decoder->getElementStartTag(SYNC_FOLDERTYPE)) {
90
+                        if (self::$decoder->getElementStartTag(SYNC_FOLDERTYPE)) {
91 91
                             $foldertype = self::$decoder->getElementContent();
92 92
                             ZLog::Write(LOGLEVEL_DEBUG, sprintf("HandleGetItemEstimate(): specified options block with foldertype '%s'", $foldertype));
93 93
 
@@ -97,31 +97,31 @@  discard block
 block discarded – undo
97 97
                             // set to synchronize all changes. The mobile could overwrite this value
98 98
                             $spa->SetFilterType(SYNC_FILTERTYPE_ALL);
99 99
 
100
-                            if(!self::$decoder->getElementEndTag())
100
+                            if (!self::$decoder->getElementEndTag())
101 101
                                 return false;
102 102
                         }
103 103
                         // if no foldertype is defined, use default cpo
104
-                        else if ($firstOption){
104
+                        else if ($firstOption) {
105 105
                             $spa->UseCPO();
106 106
                             // set to synchronize all changes. The mobile could overwrite this value
107 107
                             $spa->SetFilterType(SYNC_FILTERTYPE_ALL);
108 108
                         }
109 109
                         $firstOption = false;
110 110
 
111
-                        if(self::$decoder->getElementStartTag(SYNC_FILTERTYPE)) {
111
+                        if (self::$decoder->getElementStartTag(SYNC_FILTERTYPE)) {
112 112
                             $spa->SetFilterType(self::$decoder->getElementContent());
113
-                            if(!self::$decoder->getElementEndTag())
113
+                            if (!self::$decoder->getElementEndTag())
114 114
                                 return false;
115 115
                         }
116 116
 
117
-                        if(self::$decoder->getElementStartTag(SYNC_MAXITEMS)) {
117
+                        if (self::$decoder->getElementStartTag(SYNC_MAXITEMS)) {
118 118
                             $spa->SetWindowSize($maxitems = self::$decoder->getElementContent());
119
-                            if(!self::$decoder->getElementEndTag())
119
+                            if (!self::$decoder->getElementEndTag())
120 120
                                 return false;
121 121
                         }
122 122
 
123 123
                         $e = self::$decoder->peek();
124
-                        if($e[EN_TYPE] == EN_TYPE_ENDTAG) {
124
+                        if ($e[EN_TYPE] == EN_TYPE_ENDTAG) {
125 125
                             self::$decoder->getElementEndTag();
126 126
                             break;
127 127
                         }
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
                 }
130 130
 
131 131
                 $e = self::$decoder->peek();
132
-                if($e[EN_TYPE] == EN_TYPE_ENDTAG) {
132
+                if ($e[EN_TYPE] == EN_TYPE_ENDTAG) {
133 133
                     self::$decoder->getElementEndTag(); //SYNC_GETITEMESTIMATE_FOLDER
134 134
                     break;
135 135
                 }
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
             // Process folder data
138 138
 
139 139
             //In AS 14 request only collectionid is sent, without class
140
-            if (! $spa->HasContentClass() && $spa->HasFolderId()) {
140
+            if (!$spa->HasContentClass() && $spa->HasFolderId()) {
141 141
                try {
142 142
                     $spa->SetContentClass(self::$deviceManager->GetFolderClassFromCacheByID($spa->GetFolderId()));
143 143
                 }
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
             }
148 148
 
149 149
             // compatibility mode AS 1.0 - get folderid which was sent during GetHierarchy()
150
-            if (! $spa->HasFolderId() && $spa->HasContentClass()) {
150
+            if (!$spa->HasFolderId() && $spa->HasContentClass()) {
151 151
                 $spa->SetFolderId(self::$deviceManager->GetFolderIdFromCacheByClass($spa->GetContentClass()));
152 152
             }
153 153
 
@@ -177,22 +177,22 @@  discard block
 block discarded – undo
177 177
                         $sc->AddParameter($spa, "status", SYNC_GETITEMESTSTATUS_COLLECTIONINVALID);
178 178
                     }
179 179
 
180
-                    self::$topCollector->AnnounceInformation("StateNotFoundException ". $sc->GetParameter($spa, "status"), true);
180
+                    self::$topCollector->AnnounceInformation("StateNotFoundException ".$sc->GetParameter($spa, "status"), true);
181 181
                 }
182 182
                 catch (StatusException $stex) {
183 183
                     if ($stex->getCode() == SYNC_GETITEMESTSTATUS_COLLECTIONINVALID)
184 184
                         $sc->AddParameter($spa, "status", SYNC_GETITEMESTSTATUS_COLLECTIONINVALID);
185 185
                     else
186 186
                         $sc->AddParameter($spa, "status", SYNC_GETITEMESTSTATUS_SYNCSTATENOTPRIMED);
187
-                    self::$topCollector->AnnounceInformation("StatusException ". $sc->GetParameter($spa, "status"), true);
187
+                    self::$topCollector->AnnounceInformation("StatusException ".$sc->GetParameter($spa, "status"), true);
188 188
                 }
189 189
             }
190 190
 
191 191
         }
192
-        if(!self::$decoder->getElementEndTag())
192
+        if (!self::$decoder->getElementEndTag())
193 193
             return false; //SYNC_GETITEMESTIMATE_FOLDERS
194 194
 
195
-        if(!self::$decoder->getElementEndTag())
195
+        if (!self::$decoder->getElementEndTag())
196 196
             return false; //SYNC_GETITEMESTIMATE_GETITEMESTIMATE
197 197
 
198 198
         self::$encoder->startWBXML();
@@ -209,7 +209,7 @@  discard block
 block discarded – undo
209 209
             }
210 210
             $changes = $sc->GetChangedFolderIds();
211 211
 
212
-            foreach($sc as $folderid => $spa) {
212
+            foreach ($sc as $folderid => $spa) {
213 213
                 self::$encoder->startTag(SYNC_GETITEMESTIMATE_RESPONSE);
214 214
                 {
215 215
                     if ($sc->GetParameter($spa, "status"))
Please login to merge, or discard this patch.
lib/request/requestprocessor.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
         self::$userIsAuthenticated = false;
38 38
 
39 39
         // when a certificate is sent, allow authentication only as the certificate owner
40
-        if(defined("CERTIFICATE_OWNER_PARAMETER") && isset($_SERVER[CERTIFICATE_OWNER_PARAMETER]) && strtolower($_SERVER[CERTIFICATE_OWNER_PARAMETER]) != strtolower(Request::GetAuthUser()))
40
+        if (defined("CERTIFICATE_OWNER_PARAMETER") && isset($_SERVER[CERTIFICATE_OWNER_PARAMETER]) && strtolower($_SERVER[CERTIFICATE_OWNER_PARAMETER]) != strtolower(Request::GetAuthUser()))
41 41
             throw new AuthenticationRequiredException(sprintf("Access denied. Access is allowed only for the certificate owner '%s'", $_SERVER[CERTIFICATE_OWNER_PARAMETER]));
42 42
 
43 43
         if (Request::GetImpersonatedUser() && strcasecmp(Request::GetAuthUser(), Request::GetImpersonatedUser()) !== 0) {
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
         }
46 46
 
47 47
         $backend = ZPush::GetBackend();
48
-        if($backend->Logon(Request::GetAuthUser(), Request::GetAuthDomain(), Request::GetAuthPassword()) == false)
48
+        if ($backend->Logon(Request::GetAuthUser(), Request::GetAuthDomain(), Request::GetAuthPassword()) == false)
49 49
             throw new AuthenticationRequiredException("Access denied. Username or password incorrect");
50 50
 
51 51
         // mark this request as "authenticated"
@@ -99,14 +99,14 @@  discard block
 block discarded – undo
99 99
         }
100 100
         catch (Exception $ex) {
101 101
             // Log 10 KB of the WBXML data
102
-            ZLog::Write(LOGLEVEL_FATAL, "WBXML 10K debug data: " . Request::GetInputAsBase64(10240), false);
102
+            ZLog::Write(LOGLEVEL_FATAL, "WBXML 10K debug data: ".Request::GetInputAsBase64(10240), false);
103 103
             throw $ex;
104 104
         }
105 105
 
106 106
         // also log WBXML in happy case
107 107
         if (ZLog::IsWbxmlDebugEnabled()) {
108 108
             // Log 4 KB in the happy case
109
-            ZLog::Write(LOGLEVEL_WBXML, "WBXML-IN : ". Request::GetInputAsBase64(4096), false);
109
+            ZLog::Write(LOGLEVEL_WBXML, "WBXML-IN : ".Request::GetInputAsBase64(4096), false);
110 110
         }
111 111
         return true;
112 112
     }
Please login to merge, or discard this patch.
lib/request/sync.php 1 patch
Spacing   +123 added lines, -123 removed lines patch added patch discarded remove patch
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
 
40 40
         // check if the hierarchySync was fully completed
41 41
         if (USE_PARTIAL_FOLDERSYNC) {
42
-            if (self::$deviceManager->GetFolderSyncComplete() === false)  {
42
+            if (self::$deviceManager->GetFolderSyncComplete() === false) {
43 43
                 ZLog::Write(LOGLEVEL_INFO, "Request->HandleSync(): Sync request aborted, as exporting of folders has not yet completed");
44 44
                 self::$topCollector->AnnounceInformation("Aborted due incomplete folder sync", true);
45 45
                 $status = SYNC_STATUS_FOLDERHIERARCHYCHANGED;
@@ -49,13 +49,13 @@  discard block
 block discarded – undo
49 49
         }
50 50
 
51 51
         // Start Synchronize
52
-        if(self::$decoder->getElementStartTag(SYNC_SYNCHRONIZE)) {
52
+        if (self::$decoder->getElementStartTag(SYNC_SYNCHRONIZE)) {
53 53
 
54 54
             // AS 1.0 sends version information in WBXML
55
-            if(self::$decoder->getElementStartTag(SYNC_VERSION)) {
55
+            if (self::$decoder->getElementStartTag(SYNC_VERSION)) {
56 56
                 $sync_version = self::$decoder->getElementContent();
57 57
                 ZLog::Write(LOGLEVEL_DEBUG, sprintf("WBXML sync version: '%s'", $sync_version));
58
-                if(!self::$decoder->getElementEndTag())
58
+                if (!self::$decoder->getElementEndTag())
59 59
                     return false;
60 60
             }
61 61
 
@@ -64,8 +64,8 @@  discard block
 block discarded – undo
64 64
             // Check if Folders tag is empty (<Folders/>) and only sync if there are
65 65
             // some folders in the request. See ZP-172
66 66
             $startTag = self::$decoder->getElementStartTag(SYNC_FOLDERS);
67
-            if(isset($startTag[EN_FLAGS]) && $startTag[EN_FLAGS]) {
68
-                while(self::$decoder->getElementStartTag(SYNC_FOLDER)) {
67
+            if (isset($startTag[EN_FLAGS]) && $startTag[EN_FLAGS]) {
68
+                while (self::$decoder->getElementStartTag(SYNC_FOLDER)) {
69 69
                     $actiondata = array();
70 70
                     $actiondata["requested"] = true;
71 71
                     $actiondata["clientids"] = array();
@@ -83,19 +83,19 @@  discard block
 block discarded – undo
83 83
                     }
84 84
 
85 85
                     //for AS versions < 2.5
86
-                    if(self::$decoder->getElementStartTag(SYNC_FOLDERTYPE)) {
86
+                    if (self::$decoder->getElementStartTag(SYNC_FOLDERTYPE)) {
87 87
                         $class = self::$decoder->getElementContent();
88 88
                         ZLog::Write(LOGLEVEL_DEBUG, sprintf("Sync folder: '%s'", $class));
89 89
 
90
-                        if(!self::$decoder->getElementEndTag())
90
+                        if (!self::$decoder->getElementEndTag())
91 91
                             return false;
92 92
                     }
93 93
 
94 94
                     // SyncKey
95
-                    if(self::$decoder->getElementStartTag(SYNC_SYNCKEY)) {
95
+                    if (self::$decoder->getElementStartTag(SYNC_SYNCKEY)) {
96 96
                         $synckey = "0";
97 97
                         if (($synckey = self::$decoder->getElementContent()) !== false) {
98
-                            if(!self::$decoder->getElementEndTag()) {
98
+                            if (!self::$decoder->getElementEndTag()) {
99 99
                                 return false;
100 100
                             }
101 101
                         }
@@ -104,15 +104,15 @@  discard block
 block discarded – undo
104 104
                         return false;
105 105
 
106 106
                     // FolderId
107
-                    if(self::$decoder->getElementStartTag(SYNC_FOLDERID)) {
107
+                    if (self::$decoder->getElementStartTag(SYNC_FOLDERID)) {
108 108
                         $folderid = self::$decoder->getElementContent();
109 109
 
110
-                        if(!self::$decoder->getElementEndTag())
110
+                        if (!self::$decoder->getElementEndTag())
111 111
                             return false;
112 112
                     }
113 113
 
114 114
                     // compatibility mode AS 1.0 - get folderid which was sent during GetHierarchy()
115
-                    if (! $folderid && $class) {
115
+                    if (!$folderid && $class) {
116 116
                         $folderid = self::$deviceManager->GetFolderIdFromCacheByClass($class);
117 117
                     }
118 118
 
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
 
123 123
                         // TODO remove resync of folders
124 124
                         // this forces a resync of all states
125
-                        if (! $spa instanceof SyncParameters)
125
+                        if (!$spa instanceof SyncParameters)
126 126
                             throw new StateInvalidException("Saved state are not of type SyncParameters");
127 127
 
128 128
                         // new/resync requested
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
                         $spa->SetContentClass($class);
156 156
 
157 157
                     // Get class for as versions >= 12.0
158
-                    if (! $spa->HasContentClass()) {
158
+                    if (!$spa->HasContentClass()) {
159 159
                         try {
160 160
                             $spa->SetContentClass(self::$deviceManager->GetFolderClassFromCacheByID($spa->GetFolderId()));
161 161
                             ZLog::Write(LOGLEVEL_DEBUG, sprintf("GetFolderClassFromCacheByID from Device Manager: '%s' for id:'%s'", $spa->GetContentClass(), $spa->GetFolderId()));
@@ -176,17 +176,17 @@  discard block
 block discarded – undo
176 176
                         ZLog::Write(LOGLEVEL_WARN, "Not possible to determine class of request. Request did not contain class and apparently there is an issue with the HierarchyCache.");
177 177
 
178 178
                     // SUPPORTED properties
179
-                    if(($se = self::$decoder->getElementStartTag(SYNC_SUPPORTED)) !== false) {
179
+                    if (($se = self::$decoder->getElementStartTag(SYNC_SUPPORTED)) !== false) {
180 180
                         // ZP-481: LG phones send an empty supported tag, so only read the contents if available here
181 181
                         // if <Supported/> is received, it's as no supported fields would have been sent at all.
182 182
                         // unsure if this is the correct approach, or if in this case some default list should be used
183 183
                         if ($se[EN_FLAGS] & EN_FLAGS_CONTENT) {
184 184
                             $supfields = array();
185 185
                             WBXMLDecoder::ResetInWhile("syncSupported");
186
-                            while(WBXMLDecoder::InWhile("syncSupported")) {
186
+                            while (WBXMLDecoder::InWhile("syncSupported")) {
187 187
                                 $el = self::$decoder->getElement();
188 188
 
189
-                                if($el[EN_TYPE] == EN_TYPE_ENDTAG)
189
+                                if ($el[EN_TYPE] == EN_TYPE_ENDTAG)
190 190
                                     break;
191 191
                                 else
192 192
                                     $supfields[] = $el[EN_TAG];
@@ -196,11 +196,11 @@  discard block
 block discarded – undo
196 196
                     }
197 197
 
198 198
                     // Deletes as moves can be an empty tag as well as have value
199
-                    if(self::$decoder->getElementStartTag(SYNC_DELETESASMOVES)) {
199
+                    if (self::$decoder->getElementStartTag(SYNC_DELETESASMOVES)) {
200 200
                         $spa->SetDeletesAsMoves(true);
201 201
                         if (($dam = self::$decoder->getElementContent()) !== false) {
202 202
                             $spa->SetDeletesAsMoves((bool)$dam);
203
-                            if(!self::$decoder->getElementEndTag()) {
203
+                            if (!self::$decoder->getElementEndTag()) {
204 204
                                 return false;
205 205
                             }
206 206
                         }
@@ -208,7 +208,7 @@  discard block
 block discarded – undo
208 208
 
209 209
                     // Get changes can be an empty tag as well as have value
210 210
                     // code block partly contributed by dw2412
211
-                    if($starttag = self::$decoder->getElementStartTag(SYNC_GETCHANGES)) {
211
+                    if ($starttag = self::$decoder->getElementStartTag(SYNC_GETCHANGES)) {
212 212
                         $sc->AddParameter($spa, "getchanges", true);
213 213
                         if (($gc = self::$decoder->getElementContent()) !== false) {
214 214
                             $sc->AddParameter($spa, "getchanges", $gc);
@@ -221,7 +221,7 @@  discard block
 block discarded – undo
221 221
                         }
222 222
                     }
223 223
 
224
-                    if(self::$decoder->getElementStartTag(SYNC_WINDOWSIZE)) {
224
+                    if (self::$decoder->getElementStartTag(SYNC_WINDOWSIZE)) {
225 225
                         $ws = self::$decoder->getElementContent();
226 226
                         // normalize windowsize - see ZP-477
227 227
                         if ($ws == 0 || $ws > WINDOW_SIZE_MAX)
@@ -232,16 +232,16 @@  discard block
 block discarded – undo
232 232
                         // also announce the currently requested window size to the DeviceManager
233 233
                         self::$deviceManager->SetWindowSize($spa->GetFolderId(), $spa->GetWindowSize());
234 234
 
235
-                        if(!self::$decoder->getElementEndTag())
235
+                        if (!self::$decoder->getElementEndTag())
236 236
                             return false;
237 237
                     }
238 238
 
239 239
                     // conversation mode requested
240
-                    if(self::$decoder->getElementStartTag(SYNC_CONVERSATIONMODE)) {
240
+                    if (self::$decoder->getElementStartTag(SYNC_CONVERSATIONMODE)) {
241 241
                         $spa->SetConversationMode(true);
242
-                        if(($conversationmode = self::$decoder->getElementContent()) !== false) {
242
+                        if (($conversationmode = self::$decoder->getElementContent()) !== false) {
243 243
                             $spa->SetConversationMode((bool)$conversationmode);
244
-                            if(!self::$decoder->getElementEndTag())
244
+                            if (!self::$decoder->getElementEndTag())
245 245
                             return false;
246 246
                         }
247 247
                     }
@@ -255,12 +255,12 @@  discard block
 block discarded – undo
255 255
                     // save the current filtertype because it might have been changed on the mobile
256 256
                     $currentFilterType = $spa->GetFilterType();
257 257
 
258
-                    while(self::$decoder->getElementStartTag(SYNC_OPTIONS)) {
258
+                    while (self::$decoder->getElementStartTag(SYNC_OPTIONS)) {
259 259
                         $firstOption = true;
260 260
                         WBXMLDecoder::ResetInWhile("syncOptions");
261
-                        while(WBXMLDecoder::InWhile("syncOptions")) {
261
+                        while (WBXMLDecoder::InWhile("syncOptions")) {
262 262
                             // foldertype definition
263
-                            if(self::$decoder->getElementStartTag(SYNC_FOLDERTYPE)) {
263
+                            if (self::$decoder->getElementStartTag(SYNC_FOLDERTYPE)) {
264 264
                                 $foldertype = self::$decoder->getElementContent();
265 265
                                 ZLog::Write(LOGLEVEL_DEBUG, sprintf("HandleSync(): specified options block with foldertype '%s'", $foldertype));
266 266
 
@@ -273,11 +273,11 @@  discard block
 block discarded – undo
273 273
                                 // set to synchronize all changes. The mobile could overwrite this value
274 274
                                 $spa->SetFilterType(SYNC_FILTERTYPE_ALL);
275 275
 
276
-                                if(!self::$decoder->getElementEndTag())
276
+                                if (!self::$decoder->getElementEndTag())
277 277
                                     return false;
278 278
                             }
279 279
                             // if no foldertype is defined, use default cpo
280
-                            else if ($firstOption){
280
+                            else if ($firstOption) {
281 281
                                 $spa->UseCPO();
282 282
                                 // save the current filtertype because it might have been changed on the mobile
283 283
                                 $currentFilterType = $spa->GetFilterType();
@@ -286,68 +286,68 @@  discard block
 block discarded – undo
286 286
                             }
287 287
                             $firstOption = false;
288 288
 
289
-                            if(self::$decoder->getElementStartTag(SYNC_FILTERTYPE)) {
289
+                            if (self::$decoder->getElementStartTag(SYNC_FILTERTYPE)) {
290 290
                                 $spa->SetFilterType(self::$decoder->getElementContent());
291
-                                if(!self::$decoder->getElementEndTag())
291
+                                if (!self::$decoder->getElementEndTag())
292 292
                                     return false;
293 293
                             }
294
-                            if(self::$decoder->getElementStartTag(SYNC_TRUNCATION)) {
294
+                            if (self::$decoder->getElementStartTag(SYNC_TRUNCATION)) {
295 295
                                 $spa->SetTruncation(self::$decoder->getElementContent());
296
-                                if(!self::$decoder->getElementEndTag())
296
+                                if (!self::$decoder->getElementEndTag())
297 297
                                     return false;
298 298
                             }
299
-                            if(self::$decoder->getElementStartTag(SYNC_RTFTRUNCATION)) {
299
+                            if (self::$decoder->getElementStartTag(SYNC_RTFTRUNCATION)) {
300 300
                                 $spa->SetRTFTruncation(self::$decoder->getElementContent());
301
-                                if(!self::$decoder->getElementEndTag())
301
+                                if (!self::$decoder->getElementEndTag())
302 302
                                     return false;
303 303
                             }
304 304
 
305
-                            if(self::$decoder->getElementStartTag(SYNC_MIMESUPPORT)) {
305
+                            if (self::$decoder->getElementStartTag(SYNC_MIMESUPPORT)) {
306 306
                                 $spa->SetMimeSupport(self::$decoder->getElementContent());
307
-                                if(!self::$decoder->getElementEndTag())
307
+                                if (!self::$decoder->getElementEndTag())
308 308
                                     return false;
309 309
                             }
310 310
 
311
-                            if(self::$decoder->getElementStartTag(SYNC_MIMETRUNCATION)) {
311
+                            if (self::$decoder->getElementStartTag(SYNC_MIMETRUNCATION)) {
312 312
                                 $spa->SetMimeTruncation(self::$decoder->getElementContent());
313
-                                if(!self::$decoder->getElementEndTag())
313
+                                if (!self::$decoder->getElementEndTag())
314 314
                                     return false;
315 315
                             }
316 316
 
317
-                            if(self::$decoder->getElementStartTag(SYNC_CONFLICT)) {
317
+                            if (self::$decoder->getElementStartTag(SYNC_CONFLICT)) {
318 318
                                 $spa->SetConflict(self::$decoder->getElementContent());
319
-                                if(!self::$decoder->getElementEndTag())
319
+                                if (!self::$decoder->getElementEndTag())
320 320
                                     return false;
321 321
                             }
322 322
 
323 323
                             while (self::$decoder->getElementStartTag(SYNC_AIRSYNCBASE_BODYPREFERENCE)) {
324
-                                if(self::$decoder->getElementStartTag(SYNC_AIRSYNCBASE_TYPE)) {
324
+                                if (self::$decoder->getElementStartTag(SYNC_AIRSYNCBASE_TYPE)) {
325 325
                                     $bptype = self::$decoder->getElementContent();
326 326
                                     $spa->BodyPreference($bptype);
327
-                                    if(!self::$decoder->getElementEndTag()) {
327
+                                    if (!self::$decoder->getElementEndTag()) {
328 328
                                         return false;
329 329
                                     }
330 330
                                 }
331 331
 
332
-                                if(self::$decoder->getElementStartTag(SYNC_AIRSYNCBASE_TRUNCATIONSIZE)) {
332
+                                if (self::$decoder->getElementStartTag(SYNC_AIRSYNCBASE_TRUNCATIONSIZE)) {
333 333
                                     $spa->BodyPreference($bptype)->SetTruncationSize(self::$decoder->getElementContent());
334
-                                    if(!self::$decoder->getElementEndTag())
334
+                                    if (!self::$decoder->getElementEndTag())
335 335
                                         return false;
336 336
                                 }
337 337
 
338
-                                if(self::$decoder->getElementStartTag(SYNC_AIRSYNCBASE_ALLORNONE)) {
338
+                                if (self::$decoder->getElementStartTag(SYNC_AIRSYNCBASE_ALLORNONE)) {
339 339
                                     $spa->BodyPreference($bptype)->SetAllOrNone(self::$decoder->getElementContent());
340
-                                    if(!self::$decoder->getElementEndTag())
340
+                                    if (!self::$decoder->getElementEndTag())
341 341
                                         return false;
342 342
                                 }
343 343
 
344
-                                if(self::$decoder->getElementStartTag(SYNC_AIRSYNCBASE_PREVIEW)) {
344
+                                if (self::$decoder->getElementStartTag(SYNC_AIRSYNCBASE_PREVIEW)) {
345 345
                                     $spa->BodyPreference($bptype)->SetPreview(self::$decoder->getElementContent());
346
-                                    if(!self::$decoder->getElementEndTag())
346
+                                    if (!self::$decoder->getElementEndTag())
347 347
                                         return false;
348 348
                                 }
349 349
 
350
-                                if(!self::$decoder->getElementEndTag())
350
+                                if (!self::$decoder->getElementEndTag())
351 351
                                     return false;
352 352
                             }
353 353
 
@@ -362,19 +362,19 @@  discard block
 block discarded – undo
362 362
 
363 363
                                 if (self::$decoder->getElementStartTag(SYNC_AIRSYNCBASE_TRUNCATIONSIZE)) {
364 364
                                     $spa->BodyPartPreference($bpptype)->SetTruncationSize(self::$decoder->getElementContent());
365
-                                    if(!self::$decoder->getElementEndTag())
365
+                                    if (!self::$decoder->getElementEndTag())
366 366
                                         return false;
367 367
                                 }
368 368
 
369 369
                                 if (self::$decoder->getElementStartTag(SYNC_AIRSYNCBASE_ALLORNONE)) {
370 370
                                     $spa->BodyPartPreference($bpptype)->SetAllOrNone(self::$decoder->getElementContent());
371
-                                    if(!self::$decoder->getElementEndTag())
371
+                                    if (!self::$decoder->getElementEndTag())
372 372
                                         return false;
373 373
                                 }
374 374
 
375 375
                                 if (self::$decoder->getElementStartTag(SYNC_AIRSYNCBASE_PREVIEW)) {
376 376
                                     $spa->BodyPartPreference($bpptype)->SetPreview(self::$decoder->getElementContent());
377
-                                    if(!self::$decoder->getElementEndTag())
377
+                                    if (!self::$decoder->getElementEndTag())
378 378
                                         return false;
379 379
                                 }
380 380
 
@@ -389,7 +389,7 @@  discard block
 block discarded – undo
389 389
                             }
390 390
 
391 391
                             $e = self::$decoder->peek();
392
-                            if($e[EN_TYPE] == EN_TYPE_ENDTAG) {
392
+                            if ($e[EN_TYPE] == EN_TYPE_ENDTAG) {
393 393
                                 self::$decoder->getElementEndTag();
394 394
                                 break;
395 395
                             }
@@ -415,7 +415,7 @@  discard block
 block discarded – undo
415 415
                         ZLog::Write(LOGLEVEL_DEBUG, "HierarchyCache is also not available. Triggering HierarchySync to device");
416 416
                     }
417 417
 
418
-                    if(($el = self::$decoder->getElementStartTag(SYNC_PERFORM)) && ($el[EN_FLAGS] & EN_FLAGS_CONTENT)) {
418
+                    if (($el = self::$decoder->getElementStartTag(SYNC_PERFORM)) && ($el[EN_FLAGS] & EN_FLAGS_CONTENT)) {
419 419
                         // We can not proceed here as the content class is unknown
420 420
                         if ($status != SYNC_STATUS_SUCCESS) {
421 421
                             ZLog::Write(LOGLEVEL_WARN, "Ignoring all incoming actions as global status indicates problem.");
@@ -430,11 +430,11 @@  discard block
 block discarded – undo
430 430
 
431 431
                         $nchanges = 0;
432 432
                         WBXMLDecoder::ResetInWhile("syncActions");
433
-                        while(WBXMLDecoder::InWhile("syncActions")) {
433
+                        while (WBXMLDecoder::InWhile("syncActions")) {
434 434
                             // ADD, MODIFY, REMOVE or FETCH
435 435
                             $element = self::$decoder->getElement();
436 436
 
437
-                            if($element[EN_TYPE] != EN_TYPE_STARTTAG) {
437
+                            if ($element[EN_TYPE] != EN_TYPE_STARTTAG) {
438 438
                                 self::$decoder->ungetElement($element);
439 439
                                 break;
440 440
                             }
@@ -443,49 +443,49 @@  discard block
 block discarded – undo
443 443
                                 $nchanges++;
444 444
 
445 445
                             // Foldertype sent when syncing SMS
446
-                            if(self::$decoder->getElementStartTag(SYNC_FOLDERTYPE)) {
446
+                            if (self::$decoder->getElementStartTag(SYNC_FOLDERTYPE)) {
447 447
                                 $foldertype = self::$decoder->getElementContent();
448 448
                                 ZLog::Write(LOGLEVEL_DEBUG, sprintf("HandleSync(): incoming data with foldertype '%s'", $foldertype));
449 449
 
450
-                                if(!self::$decoder->getElementEndTag())
450
+                                if (!self::$decoder->getElementEndTag())
451 451
                                 return false;
452 452
                             }
453 453
                             else
454 454
                                 $foldertype = false;
455 455
 
456 456
                             $serverid = false;
457
-                            if(self::$decoder->getElementStartTag(SYNC_SERVERENTRYID)) {
457
+                            if (self::$decoder->getElementStartTag(SYNC_SERVERENTRYID)) {
458 458
                                 if (($serverid = self::$decoder->getElementContent()) !== false) {
459
-                                    if(!self::$decoder->getElementEndTag()) { // end serverid
459
+                                    if (!self::$decoder->getElementEndTag()) { // end serverid
460 460
                                         return false;
461 461
                                     }
462 462
                                 }
463 463
                             }
464 464
 
465
-                            if(self::$decoder->getElementStartTag(SYNC_CLIENTENTRYID)) {
465
+                            if (self::$decoder->getElementStartTag(SYNC_CLIENTENTRYID)) {
466 466
                                 $clientid = self::$decoder->getElementContent();
467 467
 
468
-                                if(!self::$decoder->getElementEndTag()) // end clientid
468
+                                if (!self::$decoder->getElementEndTag()) // end clientid
469 469
                                     return false;
470 470
                             }
471 471
                             else
472 472
                                 $clientid = false;
473 473
 
474 474
                             // Get the SyncMessage if sent
475
-                            if(($el = self::$decoder->getElementStartTag(SYNC_DATA)) && ($el[EN_FLAGS] & EN_FLAGS_CONTENT)) {
475
+                            if (($el = self::$decoder->getElementStartTag(SYNC_DATA)) && ($el[EN_FLAGS] & EN_FLAGS_CONTENT)) {
476 476
                                 $message = ZPush::getSyncObjectFromFolderClass($spa->GetContentClass());
477 477
                                 $message->Decode(self::$decoder);
478 478
 
479 479
                                 // set Ghosted fields
480 480
                                 $message->emptySupported(self::$deviceManager->GetSupportedFields($spa->GetFolderId()));
481 481
 
482
-                                if(!self::$decoder->getElementEndTag()) // end applicationdata
482
+                                if (!self::$decoder->getElementEndTag()) // end applicationdata
483 483
                                     return false;
484 484
                             }
485 485
                             else
486 486
                                 $message = false;
487 487
 
488
-                            switch($element[EN_TAG]) {
488
+                            switch ($element[EN_TAG]) {
489 489
                                 case SYNC_FETCH:
490 490
                                     array_push($actiondata["fetchids"], $serverid);
491 491
                                     break;
@@ -507,7 +507,7 @@  discard block
 block discarded – undo
507 507
                             else
508 508
                                 self::$topCollector->AnnounceInformation(sprintf("Incoming %d", $nchanges));
509 509
 
510
-                            if(!self::$decoder->getElementEndTag()) // end add/change/delete/move
510
+                            if (!self::$decoder->getElementEndTag()) // end add/change/delete/move
511 511
                                 return false;
512 512
                         }
513 513
 
@@ -527,7 +527,7 @@  discard block
 block discarded – undo
527 527
                             }
528 528
                         }
529 529
 
530
-                        if(!self::$decoder->getElementEndTag()) // end PERFORM
530
+                        if (!self::$decoder->getElementEndTag()) // end PERFORM
531 531
                             return false;
532 532
                     }
533 533
 
@@ -541,7 +541,7 @@  discard block
 block discarded – undo
541 541
                     // save actiondata
542 542
                     $sc->AddParameter($spa, "actiondata", $actiondata);
543 543
 
544
-                    if(!self::$decoder->getElementEndTag()) // end collection
544
+                    if (!self::$decoder->getElementEndTag()) // end collection
545 545
                         return false;
546 546
 
547 547
                     // AS14 does not send GetChanges anymore. We should do it if there were no incoming changes
@@ -549,19 +549,19 @@  discard block
 block discarded – undo
549 549
                         $sc->AddParameter($spa, "getchanges", true);
550 550
                 } // END FOLDER
551 551
 
552
-                if(!$wbxmlproblem && !self::$decoder->getElementEndTag()) // end collections
552
+                if (!$wbxmlproblem && !self::$decoder->getElementEndTag()) // end collections
553 553
                     return false;
554 554
             } // end FOLDERS
555 555
 
556 556
             if (self::$decoder->getElementStartTag(SYNC_HEARTBEATINTERVAL)) {
557 557
                 $hbinterval = self::$decoder->getElementContent();
558
-                if(!self::$decoder->getElementEndTag()) // SYNC_HEARTBEATINTERVAL
558
+                if (!self::$decoder->getElementEndTag()) // SYNC_HEARTBEATINTERVAL
559 559
                     return false;
560 560
             }
561 561
 
562 562
             if (self::$decoder->getElementStartTag(SYNC_WAIT)) {
563 563
                 $wait = self::$decoder->getElementContent();
564
-                if(!self::$decoder->getElementEndTag()) // SYNC_WAIT
564
+                if (!self::$decoder->getElementEndTag()) // SYNC_WAIT
565 565
                     return false;
566 566
 
567 567
                 // internally the heartbeat interval and the wait time are the same
@@ -571,17 +571,17 @@  discard block
 block discarded – undo
571 571
 
572 572
             if (self::$decoder->getElementStartTag(SYNC_WINDOWSIZE)) {
573 573
                 $sc->SetGlobalWindowSize(self::$decoder->getElementContent());
574
-                ZLog::Write(LOGLEVEL_DEBUG, "Sync(): Global WindowSize requested: ". $sc->GetGlobalWindowSize());
575
-                if(!self::$decoder->getElementEndTag()) // SYNC_WINDOWSIZE
574
+                ZLog::Write(LOGLEVEL_DEBUG, "Sync(): Global WindowSize requested: ".$sc->GetGlobalWindowSize());
575
+                if (!self::$decoder->getElementEndTag()) // SYNC_WINDOWSIZE
576 576
                     return false;
577 577
             }
578 578
 
579
-            if(self::$decoder->getElementStartTag(SYNC_PARTIAL))
579
+            if (self::$decoder->getElementStartTag(SYNC_PARTIAL))
580 580
                 $partial = true;
581 581
             else
582 582
                 $partial = false;
583 583
 
584
-            if(!$wbxmlproblem && !self::$decoder->getElementEndTag()) // end sync
584
+            if (!$wbxmlproblem && !self::$decoder->getElementEndTag()) // end sync
585 585
                 return false;
586 586
         }
587 587
         // we did not receive a SYNCHRONIZE block - assume empty sync
@@ -599,7 +599,7 @@  discard block
 block discarded – undo
599 599
         }
600 600
 
601 601
         // Partial & Empty Syncs need saved data to proceed with synchronization
602
-        if ($status == SYNC_STATUS_SUCCESS && ($emptysync === true || $partial === true) ) {
602
+        if ($status == SYNC_STATUS_SUCCESS && ($emptysync === true || $partial === true)) {
603 603
             ZLog::Write(LOGLEVEL_DEBUG, sprintf("HandleSync(): Partial or Empty sync requested. Retrieving data of synchronized folders."));
604 604
 
605 605
             // Load all collections - do not overwrite existing (received!), load states, check permissions and only load confirmed states!
@@ -618,7 +618,7 @@  discard block
 block discarded – undo
618 618
             }
619 619
 
620 620
             // update a few values
621
-            foreach($sc as $folderid => $spa) {
621
+            foreach ($sc as $folderid => $spa) {
622 622
                 // manually set getchanges parameter for this collection if it is synchronized
623 623
                 if ($spa->HasSyncKey()) {
624 624
                     $actiondata = $sc->GetParameter($spa, "actiondata");
@@ -652,7 +652,7 @@  discard block
 block discarded – undo
652 652
 
653 653
             // states are lazy loaded - we have to make sure that they are there!
654 654
             $loadstatus = SYNC_STATUS_SUCCESS;
655
-            foreach($sc as $folderid => $spa) {
655
+            foreach ($sc as $folderid => $spa) {
656 656
                 // some androids do heartbeat on the OUTBOX folder, with weird results - ZP-362
657 657
                 // we do not load the state so we will never get relevant changes on the OUTBOX folder
658 658
                 if (self::$deviceManager->GetFolderTypeFromCacheById($folderid) == SYNC_FOLDER_TYPE_OUTBOX) {
@@ -693,7 +693,7 @@  discard block
 block discarded – undo
693 693
                 if (!$foundchanges && $status == SYNC_STATUS_SUCCESS) {
694 694
                     // if there were changes to the SPA or CPOs we need to save this before we terminate
695 695
                     // only save if the state was not modified by some other request, if so, return state invalid status
696
-                    foreach($sc as $folderid => $spa) {
696
+                    foreach ($sc as $folderid => $spa) {
697 697
                         if (self::$deviceManager->CheckHearbeatStateIntegrity($spa->GetFolderId(), $spa->GetUuid(), $spa->GetUuidCounter())) {
698 698
                             $status = SYNC_COMMONSTATUS_SYNCSTATEVERSIONINVALID;
699 699
                         }
@@ -741,7 +741,7 @@  discard block
 block discarded – undo
741 741
         }
742 742
 
743 743
         // Loop through requested folders
744
-        foreach($sc as $folderid => $spa) {
744
+        foreach ($sc as $folderid => $spa) {
745 745
             // get actiondata
746 746
             $actiondata = $sc->GetParameter($spa, "actiondata");
747 747
 
@@ -750,7 +750,7 @@  discard block
 block discarded – undo
750 750
                 continue;
751 751
             }
752 752
 
753
-            if (! $sc->GetParameter($spa, "requested")) {
753
+            if (!$sc->GetParameter($spa, "requested")) {
754 754
                 ZLog::Write(LOGLEVEL_DEBUG, sprintf("HandleSync(): partial sync for folder class '%s' with id '%s'", $spa->GetContentClass(), $spa->GetFolderId()));
755 755
                 // reload state and initialize StateMachine correctly
756 756
                 $sc->AddParameter($spa, "state", null);
@@ -765,7 +765,7 @@  discard block
 block discarded – undo
765 765
             $setupExporter = true;
766 766
 
767 767
             // TODO we could check against $sc->GetChangedFolderIds() on heartbeat so we do not need to configure all exporter again
768
-            if($status == SYNC_STATUS_SUCCESS && ($sc->GetParameter($spa, "getchanges") || ! $spa->HasSyncKey())) {
768
+            if ($status == SYNC_STATUS_SUCCESS && ($sc->GetParameter($spa, "getchanges") || !$spa->HasSyncKey())) {
769 769
 
770 770
                 // no need to run the exporter if the globalwindowsize is already full - if collection already has a synckey (ZP-1215)
771 771
                 if ($sc->GetGlobalWindowSize() == $this->globallyExportedItems && $spa->HasSyncKey()) {
@@ -792,7 +792,7 @@  discard block
 block discarded – undo
792 792
                 elseif ($setupExporter && self::$backend->HasFolderStats()) {
793 793
                     // check if the folder stats changed -> if not, don't setup the exporter, there are no changes!
794 794
                     $newFolderStat = self::$backend->GetFolderStat(ZPush::GetAdditionalSyncFolderStore($spa->GetBackendFolderId()), $spa->GetBackendFolderId());
795
-                    if ($newFolderStat !== false && ! $spa->IsExporterRunRequired($newFolderStat, true)) {
795
+                    if ($newFolderStat !== false && !$spa->IsExporterRunRequired($newFolderStat, true)) {
796 796
                         $changecount = 0;
797 797
                         $setupExporter = false;
798 798
                     }
@@ -803,7 +803,7 @@  discard block
 block discarded – undo
803 803
                     //make sure the states are loaded
804 804
                     $status = $this->loadStates($sc, $spa, $actiondata);
805 805
 
806
-                    if($status == SYNC_STATUS_SUCCESS) {
806
+                    if ($status == SYNC_STATUS_SUCCESS) {
807 807
                         try {
808 808
                             // if this is an additional folder the backend has to be setup correctly
809 809
                             if (!self::$backend->Setup(ZPush::GetAdditionalSyncFolderStore($spa->GetBackendFolderId())))
@@ -837,7 +837,7 @@  discard block
 block discarded – undo
837 837
                                 $status = $stex->getCode();
838 838
                         }
839 839
 
840
-                        if (! $spa->HasSyncKey()) {
840
+                        if (!$spa->HasSyncKey()) {
841 841
                             self::$topCollector->AnnounceInformation(sprintf("Exporter registered. %d objects queued.", $changecount), $this->singleFolder);
842 842
                             $this->saveMultiFolderInfo("queued", $changecount);
843 843
                             // update folder status as initialized
@@ -860,7 +860,7 @@  discard block
 block discarded – undo
860 860
             if (!empty($actiondata["modifyids"]) ||
861 861
                 !empty($actiondata["clientids"]) ||
862 862
                 !empty($actiondata["removeids"]) ||
863
-                (! $spa->HasSyncKey() && $status == SYNC_STATUS_SUCCESS)) {
863
+                (!$spa->HasSyncKey() && $status == SYNC_STATUS_SUCCESS)) {
864 864
                     $spa->SetNewSyncKey(self::$deviceManager->GetStateManager()->GetNewSyncKey($spa->GetSyncKey()));
865 865
             }
866 866
             // get a new synckey only if we did not reach the global limit yet
@@ -878,8 +878,8 @@  discard block
 block discarded – undo
878 878
             }
879 879
 
880 880
             // Fir AS 14.0+ omit output for folder, if there were no incoming or outgoing changes and no Fetch
881
-            if (Request::GetProtocolVersion() >= 14.0 && ! $spa->HasNewSyncKey() && $changecount == 0 && empty($actiondata["fetchids"]) && $status == SYNC_STATUS_SUCCESS &&
882
-                    ! $spa->HasConfirmationChanged() && ($newFolderStat === false || ! $spa->IsExporterRunRequired($newFolderStat))) {
881
+            if (Request::GetProtocolVersion() >= 14.0 && !$spa->HasNewSyncKey() && $changecount == 0 && empty($actiondata["fetchids"]) && $status == SYNC_STATUS_SUCCESS &&
882
+                    !$spa->HasConfirmationChanged() && ($newFolderStat === false || !$spa->IsExporterRunRequired($newFolderStat))) {
883 883
                 ZLog::Write(LOGLEVEL_DEBUG, sprintf("HandleSync: No changes found for %s folder id '%s'. Omitting output.", $spa->GetContentClass(), $spa->GetFolderId()));
884 884
                 continue;
885 885
             }
@@ -978,7 +978,7 @@  discard block
 block discarded – undo
978 978
         $this->sendFolderStartTag();
979 979
         self::$encoder->startTag(SYNC_FOLDER);
980 980
 
981
-        if($spa->HasContentClass()) {
981
+        if ($spa->HasContentClass()) {
982 982
             ZLog::Write(LOGLEVEL_DEBUG, sprintf("Folder type: %s", $spa->GetContentClass()));
983 983
             // AS 12.0 devices require content class
984 984
             if (Request::GetProtocolVersion() < 12.1) {
@@ -989,7 +989,7 @@  discard block
 block discarded – undo
989 989
         }
990 990
 
991 991
         self::$encoder->startTag(SYNC_SYNCKEY);
992
-        if($status == SYNC_STATUS_SUCCESS && $spa->HasNewSyncKey())
992
+        if ($status == SYNC_STATUS_SUCCESS && $spa->HasNewSyncKey())
993 993
             self::$encoder->content($spa->GetNewSyncKey());
994 994
         else
995 995
             self::$encoder->content($spa->GetSyncKey());
@@ -1008,7 +1008,7 @@  discard block
 block discarded – undo
1008 1008
             self::$deviceManager->AnnounceProcessStatus($spa->GetFolderId(), $status);
1009 1009
 
1010 1010
         // Output IDs and status for incoming items & requests
1011
-        if($status == SYNC_STATUS_SUCCESS && (
1011
+        if ($status == SYNC_STATUS_SUCCESS && (
1012 1012
                 !empty($actiondata["clientids"]) ||
1013 1013
                 !empty($actiondata["modifyids"]) ||
1014 1014
                 !empty($actiondata["removeids"]) ||
@@ -1016,7 +1016,7 @@  discard block
 block discarded – undo
1016 1016
 
1017 1017
             self::$encoder->startTag(SYNC_REPLIES);
1018 1018
             // output result of all new incoming items
1019
-            foreach($actiondata["clientids"] as $clientid => $serverid) {
1019
+            foreach ($actiondata["clientids"] as $clientid => $serverid) {
1020 1020
                 self::$encoder->startTag(SYNC_ADD);
1021 1021
                 self::$encoder->startTag(SYNC_CLIENTENTRYID);
1022 1022
                 self::$encoder->content($clientid);
@@ -1027,13 +1027,13 @@  discard block
 block discarded – undo
1027 1027
                     self::$encoder->endTag();
1028 1028
                 }
1029 1029
                 self::$encoder->startTag(SYNC_STATUS);
1030
-                self::$encoder->content((isset($actiondata["statusids"][$clientid])?$actiondata["statusids"][$clientid]:SYNC_STATUS_CLIENTSERVERCONVERSATIONERROR));
1030
+                self::$encoder->content((isset($actiondata["statusids"][$clientid]) ? $actiondata["statusids"][$clientid] : SYNC_STATUS_CLIENTSERVERCONVERSATIONERROR));
1031 1031
                 self::$encoder->endTag();
1032 1032
                 self::$encoder->endTag();
1033 1033
             }
1034 1034
 
1035 1035
             // loop through modify operations which were not a success, send status
1036
-            foreach($actiondata["modifyids"] as $serverid) {
1036
+            foreach ($actiondata["modifyids"] as $serverid) {
1037 1037
                 if (isset($actiondata["statusids"][$serverid]) && $actiondata["statusids"][$serverid] !== SYNC_STATUS_SUCCESS) {
1038 1038
                     self::$encoder->startTag(SYNC_MODIFY);
1039 1039
                     self::$encoder->startTag(SYNC_SERVERENTRYID);
@@ -1047,7 +1047,7 @@  discard block
 block discarded – undo
1047 1047
             }
1048 1048
 
1049 1049
             // loop through remove operations which were not a success, send status
1050
-            foreach($actiondata["removeids"] as $serverid) {
1050
+            foreach ($actiondata["removeids"] as $serverid) {
1051 1051
                 if (isset($actiondata["statusids"][$serverid]) && $actiondata["statusids"][$serverid] !== SYNC_STATUS_SUCCESS) {
1052 1052
                     self::$encoder->startTag(SYNC_REMOVE);
1053 1053
                     self::$encoder->startTag(SYNC_SERVERENTRYID);
@@ -1065,7 +1065,7 @@  discard block
 block discarded – undo
1065 1065
                 $this->saveMultiFolderInfo("fetching", count($actiondata["fetchids"]));
1066 1066
             }
1067 1067
 
1068
-            foreach($actiondata["fetchids"] as $id) {
1068
+            foreach ($actiondata["fetchids"] as $id) {
1069 1069
                 $data = false;
1070 1070
                 try {
1071 1071
                     $fetchstatus = SYNC_STATUS_SUCCESS;
@@ -1095,7 +1095,7 @@  discard block
 block discarded – undo
1095 1095
                 self::$encoder->content($fetchstatus);
1096 1096
                 self::$encoder->endTag();
1097 1097
 
1098
-                if($data !== false && $status == SYNC_STATUS_SUCCESS) {
1098
+                if ($data !== false && $status == SYNC_STATUS_SUCCESS) {
1099 1099
                     self::$encoder->startTag(SYNC_DATA);
1100 1100
                     $data->Encode(self::$encoder);
1101 1101
                     self::$encoder->endTag();
@@ -1108,7 +1108,7 @@  discard block
 block discarded – undo
1108 1108
             self::$encoder->endTag();
1109 1109
         }
1110 1110
 
1111
-        if($sc->GetParameter($spa, "getchanges") && $spa->HasFolderId() && $spa->HasContentClass() && $spa->HasSyncKey()) {
1111
+        if ($sc->GetParameter($spa, "getchanges") && $spa->HasFolderId() && $spa->HasContentClass() && $spa->HasSyncKey()) {
1112 1112
             $moreAvailableSent = false;
1113 1113
             $windowSize = self::$deviceManager->GetWindowSize($spa->GetFolderId(), $spa->GetUuid(), $spa->GetUuidCounter(), $changecount);
1114 1114
 
@@ -1120,7 +1120,7 @@  discard block
 block discarded – undo
1120 1120
             }
1121 1121
             // send <MoreAvailable/> if there are more changes than fit in the folder windowsize
1122 1122
             // or there is a move state (another sync should be done afterwards)
1123
-            if($changecount > $windowSize) {
1123
+            if ($changecount > $windowSize) {
1124 1124
                 self::$encoder->startTag(SYNC_MOREAVAILABLE, false, true);
1125 1125
                 $moreAvailableSent = true;
1126 1126
                 $spa->DelFolderStat();
@@ -1128,22 +1128,22 @@  discard block
 block discarded – undo
1128 1128
         }
1129 1129
 
1130 1130
         // Stream outgoing changes
1131
-        if($status == SYNC_STATUS_SUCCESS && $sc->GetParameter($spa, "getchanges") == true && $windowSize > 0 && !!$exporter) {
1132
-            self::$topCollector->AnnounceInformation(sprintf("Streaming data of %d objects", (($changecount > $windowSize)?$windowSize:$changecount)));
1131
+        if ($status == SYNC_STATUS_SUCCESS && $sc->GetParameter($spa, "getchanges") == true && $windowSize > 0 && !!$exporter) {
1132
+            self::$topCollector->AnnounceInformation(sprintf("Streaming data of %d objects", (($changecount > $windowSize) ? $windowSize : $changecount)));
1133 1133
 
1134 1134
             // Output message changes per folder
1135 1135
             self::$encoder->startTag(SYNC_PERFORM);
1136 1136
 
1137 1137
             $n = 0;
1138 1138
             WBXMLDecoder::ResetInWhile("syncSynchronize");
1139
-            while(WBXMLDecoder::InWhile("syncSynchronize")) {
1139
+            while (WBXMLDecoder::InWhile("syncSynchronize")) {
1140 1140
                 try {
1141 1141
                     $progress = $exporter->Synchronize();
1142
-                    if(!is_array($progress))
1142
+                    if (!is_array($progress))
1143 1143
                         break;
1144 1144
                     $n++;
1145 1145
                     if ($n % 10 == 0)
1146
-                        self::$topCollector->AnnounceInformation(sprintf("Streamed data of %d objects out of %d", $n, (($changecount > $windowSize)?$windowSize:$changecount)));
1146
+                        self::$topCollector->AnnounceInformation(sprintf("Streamed data of %d objects out of %d", $n, (($changecount > $windowSize) ? $windowSize : $changecount)));
1147 1147
                 }
1148 1148
                 catch (SyncObjectBrokenException $mbe) {
1149 1149
                     $brokenSO = $mbe->GetSyncObject();
@@ -1168,7 +1168,7 @@  discard block
 block discarded – undo
1168 1168
                     }
1169 1169
                 }
1170 1170
 
1171
-                if($n >= $windowSize || Request::IsRequestTimeoutReached() || Request::IsRequestMemoryLimitReached()) {
1171
+                if ($n >= $windowSize || Request::IsRequestTimeoutReached() || Request::IsRequestMemoryLimitReached()) {
1172 1172
                     ZLog::Write(LOGLEVEL_DEBUG, sprintf("HandleSync(): Exported maxItems of messages: %d / %d", $n, $changecount));
1173 1173
                     break;
1174 1174
                 }
@@ -1193,7 +1193,7 @@  discard block
 block discarded – undo
1193 1193
                 }
1194 1194
             }
1195 1195
 
1196
-            self::$topCollector->AnnounceInformation(sprintf("Outgoing %d objects%s", $n, ($n >= $windowSize)?" of ".$changecount:""), $this->singleFolder);
1196
+            self::$topCollector->AnnounceInformation(sprintf("Outgoing %d objects%s", $n, ($n >= $windowSize) ? " of ".$changecount : ""), $this->singleFolder);
1197 1197
             $this->saveMultiFolderInfo("outgoing", $n);
1198 1198
             $this->saveMultiFolderInfo("queued", $changecount);
1199 1199
 
@@ -1225,7 +1225,7 @@  discard block
 block discarded – undo
1225 1225
         self::$encoder->endTag();
1226 1226
 
1227 1227
         // Save the sync state for the next time
1228
-        if($spa->HasNewSyncKey()) {
1228
+        if ($spa->HasNewSyncKey()) {
1229 1229
             self::$topCollector->AnnounceInformation("Saving state");
1230 1230
 
1231 1231
             try {
@@ -1238,7 +1238,7 @@  discard block
 block discarded – undo
1238 1238
                     $state = $sc->GetParameter($spa, "state");
1239 1239
 
1240 1240
                 // if a new request without state information (hierarchy) save an empty state
1241
-                else if (! $spa->HasSyncKey())
1241
+                else if (!$spa->HasSyncKey())
1242 1242
                     $state = "";
1243 1243
             }
1244 1244
             catch (StatusException $stex) {
@@ -1274,7 +1274,7 @@  discard block
 block discarded – undo
1274 1274
         $status = SYNC_STATUS_SUCCESS;
1275 1275
 
1276 1276
         if ($sc->GetParameter($spa, "state") == null) {
1277
-            ZLog::Write(LOGLEVEL_DEBUG, sprintf("Sync->loadStates(): loading states for folder '%s'",$spa->GetFolderId()));
1277
+            ZLog::Write(LOGLEVEL_DEBUG, sprintf("Sync->loadStates(): loading states for folder '%s'", $spa->GetFolderId()));
1278 1278
 
1279 1279
             try {
1280 1280
                 $sc->AddParameter($spa, "state", self::$deviceManager->GetStateManager()->GetSyncState($spa->GetSyncKey()));
@@ -1408,7 +1408,7 @@  discard block
 block discarded – undo
1408 1408
         }
1409 1409
 
1410 1410
         if (!$ignoreMessage) {
1411
-            switch($todo) {
1411
+            switch ($todo) {
1412 1412
                 case SYNC_MODIFY:
1413 1413
                     self::$topCollector->AnnounceInformation(sprintf("Saving modified message %d", $messageCount));
1414 1414
                     try {
@@ -1425,7 +1425,7 @@  discard block
 block discarded – undo
1425 1425
                             $actiondata["statusids"][$serverid] = SYNC_STATUS_CLIENTSERVERCONVERSATIONERROR;
1426 1426
                         }
1427 1427
                         else {
1428
-                            if(isset($message->read)) {
1428
+                            if (isset($message->read)) {
1429 1429
                                 // Currently, 'read' is only sent by the PDA when it is ONLY setting the read flag.
1430 1430
                                 $this->importer->ImportMessageReadFlag($serverid, $message->read);
1431 1431
                             }
@@ -1435,7 +1435,7 @@  discard block
 block discarded – undo
1435 1435
 
1436 1436
                             // email todoflags - some devices send todos flags together with read flags,
1437 1437
                             // so they have to be handled separately
1438
-                            if (isset($message->flag)){
1438
+                            if (isset($message->flag)) {
1439 1439
                                 $this->importer->ImportMessageChange($serverid, $message);
1440 1440
                             }
1441 1441
 
@@ -1458,7 +1458,7 @@  discard block
 block discarded – undo
1458 1458
                             ZLog::Write(LOGLEVEL_DEBUG, "SMS sync are not supported. Ignoring message.");
1459 1459
                             // TODO we should create the SMS
1460 1460
                             // return a fake serverid which we can identify later
1461
-                            $actiondata["clientids"][$clientid] = self::ZPUSHIGNORESMS . $clientid;
1461
+                            $actiondata["clientids"][$clientid] = self::ZPUSHIGNORESMS.$clientid;
1462 1462
                             $actiondata["statusids"][$clientid] = SYNC_STATUS_SUCCESS;
1463 1463
                         }
1464 1464
                         // check incoming message without logging WARN messages about errors
@@ -1488,10 +1488,10 @@  discard block
 block discarded – undo
1488 1488
                         }
1489 1489
                         else {
1490 1490
                             // if message deletions are to be moved, move them
1491
-                            if($spa->GetDeletesAsMoves()) {
1491
+                            if ($spa->GetDeletesAsMoves()) {
1492 1492
                                 $folderid = self::$backend->GetWasteBasket();
1493 1493
 
1494
-                                if($folderid) {
1494
+                                if ($folderid) {
1495 1495
                                     $actiondata["statusids"][$serverid] = SYNC_STATUS_SUCCESS;
1496 1496
                                     $this->importer->ImportMessageMove($serverid, $folderid);
1497 1497
                                     break;
@@ -1505,7 +1505,7 @@  discard block
 block discarded – undo
1505 1505
                         }
1506 1506
                     }
1507 1507
                     catch (StatusException $stex) {
1508
-                        if($stex->getCode() != SYNC_MOVEITEMSSTATUS_SUCCESS) {
1508
+                        if ($stex->getCode() != SYNC_MOVEITEMSSTATUS_SUCCESS) {
1509 1509
                             $actiondata["statusids"][$serverid] = SYNC_STATUS_OBJECTNOTFOUND;
1510 1510
                         }
1511 1511
                     }
@@ -1545,9 +1545,9 @@  discard block
 block discarded – undo
1545 1545
      * @return string
1546 1546
      */
1547 1547
     private function getMultiFolderInfoLine($amountOfFolders) {
1548
-        $s = $amountOfFolders . " folders";
1548
+        $s = $amountOfFolders." folders";
1549 1549
         if (isset($this->multiFolderInfo["incoming"])) {
1550
-            $s .= ": ". $this->multiFolderInfo["incoming"] ." saved";
1550
+            $s .= ": ".$this->multiFolderInfo["incoming"]." saved";
1551 1551
         }
1552 1552
         if (isset($this->multiFolderInfo["outgoing"]) && isset($this->multiFolderInfo["queued"]) && $this->multiFolderInfo["outgoing"] > 0) {
1553 1553
             $s .= sprintf(": Streamed %d out of %d", $this->multiFolderInfo["outgoing"], $this->multiFolderInfo["queued"]);
@@ -1557,10 +1557,10 @@  discard block
 block discarded – undo
1557 1557
         }
1558 1558
         else {
1559 1559
             if (isset($this->multiFolderInfo["outgoing"])) {
1560
-                $s .= "/".$this->multiFolderInfo["outgoing"] ." streamed";
1560
+                $s .= "/".$this->multiFolderInfo["outgoing"]." streamed";
1561 1561
             }
1562 1562
             if (isset($this->multiFolderInfo["queued"])) {
1563
-                $s .= "/".$this->multiFolderInfo["queued"] ." queued";
1563
+                $s .= "/".$this->multiFolderInfo["queued"]." queued";
1564 1564
             }
1565 1565
         }
1566 1566
         if (isset($this->multiFolderInfo["exception"])) {
Please login to merge, or discard this patch.
lib/request/search.php 1 patch
Spacing   +73 added lines, -73 removed lines patch added patch discarded remove patch
@@ -22,26 +22,26 @@  discard block
 block discarded – undo
22 22
         $searchpicture = false;
23 23
         $cpo = new ContentParameters();
24 24
 
25
-        if(!self::$decoder->getElementStartTag(SYNC_SEARCH_SEARCH))
25
+        if (!self::$decoder->getElementStartTag(SYNC_SEARCH_SEARCH))
26 26
             return false;
27 27
 
28 28
         // TODO check: possible to search in other stores?
29
-        if(!self::$decoder->getElementStartTag(SYNC_SEARCH_STORE))
29
+        if (!self::$decoder->getElementStartTag(SYNC_SEARCH_STORE))
30 30
             return false;
31 31
 
32
-        if(!self::$decoder->getElementStartTag(SYNC_SEARCH_NAME))
32
+        if (!self::$decoder->getElementStartTag(SYNC_SEARCH_NAME))
33 33
             return false;
34 34
         $searchname = strtoupper(self::$decoder->getElementContent());
35
-        if(!self::$decoder->getElementEndTag())
35
+        if (!self::$decoder->getElementEndTag())
36 36
             return false;
37 37
 
38
-        if(!self::$decoder->getElementStartTag(SYNC_SEARCH_QUERY))
38
+        if (!self::$decoder->getElementStartTag(SYNC_SEARCH_QUERY))
39 39
             return false;
40 40
 
41 41
         // check if it is a content of an element (= GAL search)
42 42
         // or a starttag (= mailbox or documentlibrary search)
43 43
         $searchquery = self::$decoder->getElementContent();
44
-        if($searchquery && !self::$decoder->getElementEndTag())
44
+        if ($searchquery && !self::$decoder->getElementEndTag())
45 45
             return false;
46 46
 
47 47
         if ($searchquery === false) {
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
                 if (self::$decoder->getElementStartTag(SYNC_FOLDERID)) {
51 51
                     $searchfolderid = self::$decoder->getElementContent();
52 52
                     $cpo->SetSearchFolderid($searchfolderid);
53
-                    if(!self::$decoder->getElementEndTag()) // SYNC_FOLDERTYPE
53
+                    if (!self::$decoder->getElementEndTag()) // SYNC_FOLDERTYPE
54 54
                     return false;
55 55
                 }
56 56
 
@@ -58,176 +58,176 @@  discard block
 block discarded – undo
58 58
                 if (self::$decoder->getElementStartTag(SYNC_FOLDERTYPE)) {
59 59
                     $searchclass = self::$decoder->getElementContent();
60 60
                     $cpo->SetSearchClass($searchclass);
61
-                    if(!self::$decoder->getElementEndTag()) // SYNC_FOLDERTYPE
61
+                    if (!self::$decoder->getElementEndTag()) // SYNC_FOLDERTYPE
62 62
                         return false;
63 63
                 }
64 64
 
65 65
                 if (self::$decoder->getElementStartTag(SYNC_FOLDERID)) {
66 66
                     $searchfolderid = self::$decoder->getElementContent();
67 67
                     $cpo->SetSearchFolderid($searchfolderid);
68
-                    if(!self::$decoder->getElementEndTag()) // SYNC_FOLDERTYPE
68
+                    if (!self::$decoder->getElementEndTag()) // SYNC_FOLDERTYPE
69 69
                     return false;
70 70
                 }
71 71
 
72 72
                 if (self::$decoder->getElementStartTag(SYNC_SEARCH_FREETEXT)) {
73 73
                     $searchfreetext = self::$decoder->getElementContent();
74 74
                     $cpo->SetSearchFreeText($searchfreetext);
75
-                    if(!self::$decoder->getElementEndTag()) // SYNC_SEARCH_FREETEXT
75
+                    if (!self::$decoder->getElementEndTag()) // SYNC_SEARCH_FREETEXT
76 76
                     return false;
77 77
                 }
78 78
 
79 79
                 //TODO - review
80 80
                 if (self::$decoder->getElementStartTag(SYNC_SEARCH_GREATERTHAN)) {
81
-                    if(self::$decoder->getElementStartTag(SYNC_POOMMAIL_DATERECEIVED)) {
81
+                    if (self::$decoder->getElementStartTag(SYNC_POOMMAIL_DATERECEIVED)) {
82 82
                         $datereceivedgreater = true;
83 83
                         if (($dam = self::$decoder->getElementContent()) !== false) {
84 84
                             $datereceivedgreater = true;
85
-                            if(!self::$decoder->getElementEndTag()) {
85
+                            if (!self::$decoder->getElementEndTag()) {
86 86
                                 return false;
87 87
                             }
88 88
                         }
89 89
                         $cpo->SetSearchDateReceivedGreater($datereceivedgreater);
90 90
                     }
91 91
 
92
-                    if(self::$decoder->getElementStartTag(SYNC_SEARCH_VALUE)) {
92
+                    if (self::$decoder->getElementStartTag(SYNC_SEARCH_VALUE)) {
93 93
                         $searchvalue = self::$decoder->getElementContent();
94 94
                         $cpo->SetSearchValueGreater($searchvalue);
95
-                        if(!self::$decoder->getElementEndTag()) // SYNC_SEARCH_VALUE
95
+                        if (!self::$decoder->getElementEndTag()) // SYNC_SEARCH_VALUE
96 96
                             return false;
97 97
                     }
98 98
 
99
-                    if(!self::$decoder->getElementEndTag()) // SYNC_SEARCH_GREATERTHAN
99
+                    if (!self::$decoder->getElementEndTag()) // SYNC_SEARCH_GREATERTHAN
100 100
                         return false;
101 101
                 }
102 102
 
103 103
                 if (self::$decoder->getElementStartTag(SYNC_SEARCH_LESSTHAN)) {
104
-                    if(self::$decoder->getElementStartTag(SYNC_POOMMAIL_DATERECEIVED)) {
104
+                    if (self::$decoder->getElementStartTag(SYNC_POOMMAIL_DATERECEIVED)) {
105 105
                         $datereceivedless = true;
106 106
                         if (($dam = self::$decoder->getElementContent()) !== false) {
107 107
                             $datereceivedless = true;
108
-                            if(!self::$decoder->getElementEndTag()) {
108
+                            if (!self::$decoder->getElementEndTag()) {
109 109
                                 return false;
110 110
                             }
111 111
                         }
112 112
                         $cpo->SetSearchDateReceivedLess($datereceivedless);
113 113
                     }
114 114
 
115
-                    if(self::$decoder->getElementStartTag(SYNC_SEARCH_VALUE)) {
115
+                    if (self::$decoder->getElementStartTag(SYNC_SEARCH_VALUE)) {
116 116
                         $searchvalue = self::$decoder->getElementContent();
117 117
                         $cpo->SetSearchValueLess($searchvalue);
118
-                        if(!self::$decoder->getElementEndTag()) // SYNC_SEARCH_VALUE
118
+                        if (!self::$decoder->getElementEndTag()) // SYNC_SEARCH_VALUE
119 119
                          return false;
120 120
                     }
121 121
 
122
-                    if(!self::$decoder->getElementEndTag()) // SYNC_SEARCH_LESSTHAN
122
+                    if (!self::$decoder->getElementEndTag()) // SYNC_SEARCH_LESSTHAN
123 123
                         return false;
124 124
                 }
125 125
 
126 126
                 if (self::$decoder->getElementStartTag(SYNC_SEARCH_FREETEXT)) {
127 127
                     $searchfreetext = self::$decoder->getElementContent();
128 128
                     $cpo->SetSearchFreeText($searchfreetext);
129
-                    if(!self::$decoder->getElementEndTag()) // SYNC_SEARCH_FREETEXT
129
+                    if (!self::$decoder->getElementEndTag()) // SYNC_SEARCH_FREETEXT
130 130
                     return false;
131 131
                 }
132 132
 
133
-                if(!self::$decoder->getElementEndTag()) // SYNC_SEARCH_AND
133
+                if (!self::$decoder->getElementEndTag()) // SYNC_SEARCH_AND
134 134
                     return false;
135 135
             }
136 136
             elseif (self::$decoder->getElementStartTag(SYNC_SEARCH_EQUALTO)) {
137 137
                     // linkid can be an empty tag as well as have value
138
-                    if(self::$decoder->getElementStartTag(SYNC_DOCUMENTLIBRARY_LINKID)) {
138
+                    if (self::$decoder->getElementStartTag(SYNC_DOCUMENTLIBRARY_LINKID)) {
139 139
                         if (($linkId = self::$decoder->getElementContent()) !== false) {
140 140
                             $cpo->SetLinkId($linkId);
141
-                            if(!self::$decoder->getElementEndTag()) { // SYNC_DOCUMENTLIBRARY_LINKID
141
+                            if (!self::$decoder->getElementEndTag()) { // SYNC_DOCUMENTLIBRARY_LINKID
142 142
                                 return false;
143 143
                             }
144 144
                         }
145 145
                     }
146 146
 
147
-                    if(self::$decoder->getElementStartTag(SYNC_SEARCH_VALUE)) {
147
+                    if (self::$decoder->getElementStartTag(SYNC_SEARCH_VALUE)) {
148 148
                         $searchvalue = self::$decoder->getElementContent();
149 149
                         $cpo->SetSearchValueEqualTo($searchvalue);
150
-                        if(!self::$decoder->getElementEndTag()) // SYNC_SEARCH_VALUE
150
+                        if (!self::$decoder->getElementEndTag()) // SYNC_SEARCH_VALUE
151 151
                             return false;
152 152
                     }
153 153
 
154
-                    if(!self::$decoder->getElementEndTag()) // SYNC_SEARCH_EQUALTO
154
+                    if (!self::$decoder->getElementEndTag()) // SYNC_SEARCH_EQUALTO
155 155
                         return false;
156 156
                 }
157 157
 
158
-            if(!self::$decoder->getElementEndTag()) // SYNC_SEARCH_QUERY
158
+            if (!self::$decoder->getElementEndTag()) // SYNC_SEARCH_QUERY
159 159
                 return false;
160 160
 
161 161
         }
162 162
 
163
-        if(self::$decoder->getElementStartTag(SYNC_SEARCH_OPTIONS)) {
163
+        if (self::$decoder->getElementStartTag(SYNC_SEARCH_OPTIONS)) {
164 164
             WBXMLDecoder::ResetInWhile("searchOptions");
165
-            while(WBXMLDecoder::InWhile("searchOptions")) {
166
-                if(self::$decoder->getElementStartTag(SYNC_SEARCH_RANGE)) {
165
+            while (WBXMLDecoder::InWhile("searchOptions")) {
166
+                if (self::$decoder->getElementStartTag(SYNC_SEARCH_RANGE)) {
167 167
                     $searchrange = self::$decoder->getElementContent();
168 168
                     $cpo->SetSearchRange($searchrange);
169
-                    if(!self::$decoder->getElementEndTag())
169
+                    if (!self::$decoder->getElementEndTag())
170 170
                         return false;
171 171
                 }
172 172
 
173 173
 
174
-                if(self::$decoder->getElementStartTag(SYNC_SEARCH_REBUILDRESULTS)) {
174
+                if (self::$decoder->getElementStartTag(SYNC_SEARCH_REBUILDRESULTS)) {
175 175
                     $rebuildresults = true;
176 176
                     if (($dam = self::$decoder->getElementContent()) !== false) {
177 177
                         $rebuildresults = true;
178
-                        if(!self::$decoder->getElementEndTag()) {
178
+                        if (!self::$decoder->getElementEndTag()) {
179 179
                             return false;
180 180
                         }
181 181
                     }
182 182
                     $cpo->SetSearchRebuildResults($rebuildresults);
183 183
                 }
184 184
 
185
-                if(self::$decoder->getElementStartTag(SYNC_SEARCH_DEEPTRAVERSAL)) {
185
+                if (self::$decoder->getElementStartTag(SYNC_SEARCH_DEEPTRAVERSAL)) {
186 186
                     $deeptraversal = true;
187 187
                     if (($dam = self::$decoder->getElementContent()) !== false) {
188 188
                         $deeptraversal = true;
189
-                        if(!self::$decoder->getElementEndTag()) {
189
+                        if (!self::$decoder->getElementEndTag()) {
190 190
                             return false;
191 191
                         }
192 192
                     }
193 193
                     $cpo->SetSearchDeepTraversal($deeptraversal);
194 194
                 }
195 195
 
196
-                if(self::$decoder->getElementStartTag(SYNC_MIMESUPPORT)) {
196
+                if (self::$decoder->getElementStartTag(SYNC_MIMESUPPORT)) {
197 197
                     $cpo->SetMimeSupport(self::$decoder->getElementContent());
198
-                    if(!self::$decoder->getElementEndTag())
198
+                    if (!self::$decoder->getElementEndTag())
199 199
                     return false;
200 200
                 }
201 201
 
202 202
                 //TODO body preferences
203 203
                 while (self::$decoder->getElementStartTag(SYNC_AIRSYNCBASE_BODYPREFERENCE)) {
204
-                    if(self::$decoder->getElementStartTag(SYNC_AIRSYNCBASE_TYPE)) {
204
+                    if (self::$decoder->getElementStartTag(SYNC_AIRSYNCBASE_TYPE)) {
205 205
                         $bptype = self::$decoder->getElementContent();
206 206
                         $cpo->BodyPreference($bptype);
207
-                        if(!self::$decoder->getElementEndTag()) {
207
+                        if (!self::$decoder->getElementEndTag()) {
208 208
                             return false;
209 209
                         }
210 210
                     }
211 211
 
212
-                    if(self::$decoder->getElementStartTag(SYNC_AIRSYNCBASE_TRUNCATIONSIZE)) {
212
+                    if (self::$decoder->getElementStartTag(SYNC_AIRSYNCBASE_TRUNCATIONSIZE)) {
213 213
                         $cpo->BodyPreference($bptype)->SetTruncationSize(self::$decoder->getElementContent());
214
-                        if(!self::$decoder->getElementEndTag())
214
+                        if (!self::$decoder->getElementEndTag())
215 215
                             return false;
216 216
                     }
217 217
 
218
-                    if(self::$decoder->getElementStartTag(SYNC_AIRSYNCBASE_ALLORNONE)) {
218
+                    if (self::$decoder->getElementStartTag(SYNC_AIRSYNCBASE_ALLORNONE)) {
219 219
                         $cpo->BodyPreference($bptype)->SetAllOrNone(self::$decoder->getElementContent());
220
-                        if(!self::$decoder->getElementEndTag())
220
+                        if (!self::$decoder->getElementEndTag())
221 221
                             return false;
222 222
                     }
223 223
 
224
-                    if(self::$decoder->getElementStartTag(SYNC_AIRSYNCBASE_PREVIEW)) {
224
+                    if (self::$decoder->getElementStartTag(SYNC_AIRSYNCBASE_PREVIEW)) {
225 225
                         $cpo->BodyPreference($bptype)->SetPreview(self::$decoder->getElementContent());
226
-                        if(!self::$decoder->getElementEndTag())
226
+                        if (!self::$decoder->getElementEndTag())
227 227
                             return false;
228 228
                     }
229 229
 
230
-                    if(!self::$decoder->getElementEndTag())
230
+                    if (!self::$decoder->getElementEndTag())
231 231
                         return false;
232 232
                 }
233 233
 
@@ -242,19 +242,19 @@  discard block
 block discarded – undo
242 242
 
243 243
                     if (self::$decoder->getElementStartTag(SYNC_AIRSYNCBASE_TRUNCATIONSIZE)) {
244 244
                         $cpo->BodyPartPreference($bpptype)->SetTruncationSize(self::$decoder->getElementContent());
245
-                        if(!self::$decoder->getElementEndTag())
245
+                        if (!self::$decoder->getElementEndTag())
246 246
                             return false;
247 247
                     }
248 248
 
249 249
                     if (self::$decoder->getElementStartTag(SYNC_AIRSYNCBASE_ALLORNONE)) {
250 250
                         $cpo->BodyPartPreference($bpptype)->SetAllOrNone(self::$decoder->getElementContent());
251
-                        if(!self::$decoder->getElementEndTag())
251
+                        if (!self::$decoder->getElementEndTag())
252 252
                             return false;
253 253
                     }
254 254
 
255 255
                     if (self::$decoder->getElementStartTag(SYNC_AIRSYNCBASE_PREVIEW)) {
256 256
                         $cpo->BodyPartPreference($bpptype)->SetPreview(self::$decoder->getElementContent());
257
-                        if(!self::$decoder->getElementEndTag())
257
+                        if (!self::$decoder->getElementEndTag())
258 258
                             return false;
259 259
                     }
260 260
 
@@ -262,45 +262,45 @@  discard block
 block discarded – undo
262 262
                         return false;
263 263
                 }
264 264
 
265
-                if(self::$decoder->getElementStartTag(SYNC_RIGHTSMANAGEMENT_SUPPORT)) {
265
+                if (self::$decoder->getElementStartTag(SYNC_RIGHTSMANAGEMENT_SUPPORT)) {
266 266
                     $cpo->SetRmSupport(self::$decoder->getElementContent());
267
-                    if(!self::$decoder->getElementEndTag())
267
+                    if (!self::$decoder->getElementEndTag())
268 268
                         return false;
269 269
                 }
270 270
 
271
-                if(self::$decoder->getElementStartTag(SYNC_SEARCH_PICTURE)) { // TODO - do something with maxsize and maxpictures in the backend
271
+                if (self::$decoder->getElementStartTag(SYNC_SEARCH_PICTURE)) { // TODO - do something with maxsize and maxpictures in the backend
272 272
                     $searchpicture = new SyncResolveRecipientsPicture();
273
-                    if(self::$decoder->getElementStartTag(SYNC_SEARCH_MAXSIZE)) {
273
+                    if (self::$decoder->getElementStartTag(SYNC_SEARCH_MAXSIZE)) {
274 274
                         $searchpicture->maxsize = self::$decoder->getElementContent();
275
-                        if(!self::$decoder->getElementEndTag())
275
+                        if (!self::$decoder->getElementEndTag())
276 276
                             return false;
277 277
                     }
278 278
 
279
-                    if(self::$decoder->getElementStartTag(SYNC_SEARCH_MAXPICTURES)) {
279
+                    if (self::$decoder->getElementStartTag(SYNC_SEARCH_MAXPICTURES)) {
280 280
                         $searchpicture->maxpictures = self::$decoder->getElementContent();
281
-                        if(!self::$decoder->getElementEndTag())
281
+                        if (!self::$decoder->getElementEndTag())
282 282
                             return false;
283 283
                     }
284 284
 
285 285
                     // iOs devices send empty picture tag: <Search:Picture/>
286 286
                     if (($sp = self::$decoder->getElementContent()) !== false) {
287
-                        if(!self::$decoder->getElementEndTag()) {
287
+                        if (!self::$decoder->getElementEndTag()) {
288 288
                             return false;
289 289
                         }
290 290
                     }
291 291
                 }
292 292
 
293 293
                 $e = self::$decoder->peek();
294
-                if($e[EN_TYPE] == EN_TYPE_ENDTAG) {
294
+                if ($e[EN_TYPE] == EN_TYPE_ENDTAG) {
295 295
                     self::$decoder->getElementEndTag();
296 296
                     break;
297 297
                 }
298 298
             }
299 299
         }
300
-        if(!self::$decoder->getElementEndTag()) //store
300
+        if (!self::$decoder->getElementEndTag()) //store
301 301
             return false;
302 302
 
303
-        if(!self::$decoder->getElementEndTag()) //search
303
+        if (!self::$decoder->getElementEndTag()) //search
304 304
             return false;
305 305
 
306 306
         // get SearchProvider
@@ -334,7 +334,7 @@  discard block
 block discarded – undo
334 334
         }
335 335
         $searchprovider->Disconnect();
336 336
 
337
-        self::$topCollector->AnnounceInformation(sprintf("'%s' search found %d results", $searchname, (isset($rows['searchtotal']) ? $rows['searchtotal'] : 0) ), true);
337
+        self::$topCollector->AnnounceInformation(sprintf("'%s' search found %d results", $searchname, (isset($rows['searchtotal']) ? $rows['searchtotal'] : 0)), true);
338 338
 
339 339
         self::$encoder->startWBXML();
340 340
         self::$encoder->startTag(SYNC_SEARCH_SEARCH);
@@ -366,7 +366,7 @@  discard block
 block discarded – undo
366 366
                                     self::$encoder->startTag(SYNC_SEARCH_PROPERTIES);
367 367
 
368 368
                                         self::$encoder->startTag(SYNC_GAL_DISPLAYNAME);
369
-                                        self::$encoder->content((isset($u[SYNC_GAL_DISPLAYNAME]))?$u[SYNC_GAL_DISPLAYNAME]:"No name");
369
+                                        self::$encoder->content((isset($u[SYNC_GAL_DISPLAYNAME])) ? $u[SYNC_GAL_DISPLAYNAME] : "No name");
370 370
                                         self::$encoder->endTag();
371 371
 
372 372
                                         if (isset($u[SYNC_GAL_PHONE])) {
@@ -401,11 +401,11 @@  discard block
 block discarded – undo
401 401
 
402 402
                                         // Always send the firstname, even empty. Nokia needs this to display the entry
403 403
                                         self::$encoder->startTag(SYNC_GAL_FIRSTNAME);
404
-                                        self::$encoder->content((isset($u[SYNC_GAL_FIRSTNAME]))?$u[SYNC_GAL_FIRSTNAME]:"");
404
+                                        self::$encoder->content((isset($u[SYNC_GAL_FIRSTNAME])) ? $u[SYNC_GAL_FIRSTNAME] : "");
405 405
                                         self::$encoder->endTag();
406 406
 
407 407
                                         self::$encoder->startTag(SYNC_GAL_LASTNAME);
408
-                                        self::$encoder->content((isset($u[SYNC_GAL_LASTNAME]))?$u[SYNC_GAL_LASTNAME]:"No name");
408
+                                        self::$encoder->content((isset($u[SYNC_GAL_LASTNAME])) ? $u[SYNC_GAL_LASTNAME] : "No name");
409 409
                                         self::$encoder->endTag();
410 410
 
411 411
                                         if (isset($u[SYNC_GAL_HOMEPHONE])) {
@@ -421,7 +421,7 @@  discard block
 block discarded – undo
421 421
                                         }
422 422
 
423 423
                                         self::$encoder->startTag(SYNC_GAL_EMAILADDRESS);
424
-                                        self::$encoder->content((isset($u[SYNC_GAL_EMAILADDRESS]))?$u[SYNC_GAL_EMAILADDRESS]:"");
424
+                                        self::$encoder->content((isset($u[SYNC_GAL_EMAILADDRESS])) ? $u[SYNC_GAL_EMAILADDRESS] : "");
425 425
                                         self::$encoder->endTag();
426 426
 
427 427
 
@@ -437,8 +437,8 @@  discard block
 block discarded – undo
437 437
                                             self::$encoder->endTag(); // SYNC_GAL_PICTURE
438 438
                                         }
439 439
 
440
-                                    self::$encoder->endTag();//result
441
-                                self::$encoder->endTag();//properties
440
+                                    self::$encoder->endTag(); //result
441
+                                self::$encoder->endTag(); //properties
442 442
                             }
443 443
                         }
444 444
                     }
@@ -462,8 +462,8 @@  discard block
 block discarded – undo
462 462
                                     $message = self::$backend->Fetch(false, $u['longid'], $cpo);
463 463
                                     $message->Encode(self::$encoder);
464 464
 
465
-                                self::$encoder->endTag();//result
466
-                            self::$encoder->endTag();//properties
465
+                                self::$encoder->endTag(); //result
466
+                            self::$encoder->endTag(); //properties
467 467
                         }
468 468
                     }
469 469
                     // it seems that android 4 requires range and searchtotal
@@ -479,10 +479,10 @@  discard block
 block discarded – undo
479 479
                         self::$encoder->endTag();
480 480
                     }
481 481
 
482
-                self::$encoder->endTag();//store
483
-                self::$encoder->endTag();//response
482
+                self::$encoder->endTag(); //store
483
+                self::$encoder->endTag(); //response
484 484
             }
485
-        self::$encoder->endTag();//search
485
+        self::$encoder->endTag(); //search
486 486
 
487 487
         return true;
488 488
     }
Please login to merge, or discard this patch.
lib/request/sendmail.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -31,18 +31,18 @@
 block discarded – undo
31 31
         if (self::$decoder->IsWBXML()) {
32 32
             $el = self::$decoder->getElement();
33 33
 
34
-            if($el[EN_TYPE] != EN_TYPE_STARTTAG)
34
+            if ($el[EN_TYPE] != EN_TYPE_STARTTAG)
35 35
                 return false;
36 36
 
37 37
 
38
-            if($el[EN_TAG] == SYNC_COMPOSEMAIL_SENDMAIL)
38
+            if ($el[EN_TAG] == SYNC_COMPOSEMAIL_SENDMAIL)
39 39
                 $sendmail = true;
40
-            else if($el[EN_TAG] == SYNC_COMPOSEMAIL_SMARTREPLY)
40
+            else if ($el[EN_TAG] == SYNC_COMPOSEMAIL_SMARTREPLY)
41 41
                 $smartreply = true;
42
-            else if($el[EN_TAG] == SYNC_COMPOSEMAIL_SMARTFORWARD)
42
+            else if ($el[EN_TAG] == SYNC_COMPOSEMAIL_SMARTFORWARD)
43 43
                 $smartforward = true;
44 44
 
45
-            if(!$sendmail && !$smartreply && !$smartforward)
45
+            if (!$sendmail && !$smartreply && !$smartforward)
46 46
                 return false;
47 47
 
48 48
             $sm->Decode(self::$decoder);
Please login to merge, or discard this patch.