@@ -157,18 +157,18 @@ discard block |
||
157 | 157 | $this->statemachine->LinkUserDevice($this->device->GetDeviceUser(), self::$devid); |
158 | 158 | } |
159 | 159 | |
160 | - if (RequestProcessor::isUserAuthenticated() || $this->device->GetForceSave() ) { |
|
160 | + if (RequestProcessor::isUserAuthenticated() || $this->device->GetForceSave()) { |
|
161 | 161 | $this->device->lastupdatetime = time(); |
162 | 162 | $this->device->StripData(); |
163 | 163 | $this->statemachine->SetState($this->device, self::$devid, IStateMachine::DEVICEDATA); |
164 | 164 | |
165 | 165 | // update deviceuser stat in redis as well |
166 | - $this->setDeviceUserData($this->type, array(self::$user => $this->device), self::$devid, -1, $doCas="merge"); |
|
166 | + $this->setDeviceUserData($this->type, array(self::$user => $this->device), self::$devid, -1, $doCas = "merge"); |
|
167 | 167 | ZLog::Write(LOGLEVEL_DEBUG, "DeviceManager->Save(): Device data saved"); |
168 | 168 | } |
169 | 169 | } |
170 | 170 | catch (StateNotFoundException $snfex) { |
171 | - ZLog::Write(LOGLEVEL_ERROR, "DeviceManager->Save(): Exception: ". $snfex->getMessage()); |
|
171 | + ZLog::Write(LOGLEVEL_ERROR, "DeviceManager->Save(): Exception: ".$snfex->getMessage()); |
|
172 | 172 | } |
173 | 173 | } |
174 | 174 | |
@@ -194,7 +194,7 @@ discard block |
||
194 | 194 | * @return void |
195 | 195 | */ |
196 | 196 | public function DoAutomaticASDeviceSaving($doSave) { |
197 | - ZLog::Write(LOGLEVEL_DEBUG, "DeviceManager->DoAutomaticASDeviceSaving(): save automatically: ". Utils::PrintAsString($doSave)); |
|
197 | + ZLog::Write(LOGLEVEL_DEBUG, "DeviceManager->DoAutomaticASDeviceSaving(): save automatically: ".Utils::PrintAsString($doSave)); |
|
198 | 198 | $this->saveDevice = $doSave; |
199 | 199 | } |
200 | 200 | |
@@ -338,7 +338,7 @@ discard block |
||
338 | 338 | return $folders; |
339 | 339 | } |
340 | 340 | |
341 | - foreach($this->device->GetAdditionalFolders() as $df) { |
|
341 | + foreach ($this->device->GetAdditionalFolders() as $df) { |
|
342 | 342 | if (!isset($df['flags'])) { |
343 | 343 | $df['flags'] = 0; |
344 | 344 | ZLog::Write(LOGLEVEL_WARN, sprintf("DeviceManager->GetAdditionalUserSyncFolders(): Additional folder '%s' has no flags.", $df['name'])); |
@@ -450,7 +450,7 @@ discard block |
||
450 | 450 | $loop = $this->loopdetection->Detect($folderid, $uuid, $statecounter, $items, $queuedmessages); |
451 | 451 | if ($loop !== false) { |
452 | 452 | if ($loop === true) { |
453 | - $items = ($items == 0) ? 0: 1+($this->loopdetection->IgnoreNextMessage(false)?1:0) ; |
|
453 | + $items = ($items == 0) ? 0 : 1 + ($this->loopdetection->IgnoreNextMessage(false) ? 1 : 0); |
|
454 | 454 | } |
455 | 455 | else { |
456 | 456 | // we got a new suggested window size |
@@ -543,18 +543,18 @@ discard block |
||
543 | 543 | // 1. step: check if there is a general limitation for the store |
544 | 544 | if (array_key_exists($store, $specialSyncFilter)) { |
545 | 545 | $spFilter = $specialSyncFilter[$store]; |
546 | - ZLog::Write(LOGLEVEL_DEBUG, sprintf("Limit sync due to configured limitation on the store: '%s': %s",$store, $spFilter)); |
|
546 | + ZLog::Write(LOGLEVEL_DEBUG, sprintf("Limit sync due to configured limitation on the store: '%s': %s", $store, $spFilter)); |
|
547 | 547 | } |
548 | 548 | |
549 | 549 | // 2. step: check if there is a limitation for the hashed ID (for shared/configured stores) |
550 | - $spKey= $store .'/'. $folderid; |
|
550 | + $spKey = $store.'/'.$folderid; |
|
551 | 551 | if (array_key_exists($spKey, $specialSyncFilter)) { |
552 | 552 | $spFilter = $specialSyncFilter[$spKey]; |
553 | 553 | ZLog::Write(LOGLEVEL_DEBUG, sprintf("Limit sync due to configured limitation on the folder: '%s': %s", $spKey, $spFilter)); |
554 | 554 | } |
555 | 555 | |
556 | 556 | // 3. step: check if there is a limitation for the backendId |
557 | - $spKey= $store .'/'. $backendFolderId; |
|
557 | + $spKey = $store.'/'.$backendFolderId; |
|
558 | 558 | if (array_key_exists($spKey, $specialSyncFilter)) { |
559 | 559 | $spFilter = $specialSyncFilter[$spKey]; |
560 | 560 | ZLog::Write(LOGLEVEL_DEBUG, sprintf("Limit sync due to configured limitation on the folder: '%s': %s", $spKey, $spFilter)); |
@@ -737,7 +737,7 @@ discard block |
||
737 | 737 | $uuid = $this->device->GetFolderUUID($folderid); |
738 | 738 | if ($uuid) { |
739 | 739 | // has a UUID but is not in the cache?! This is deleted, remove the states. |
740 | - if (! $hc->GetFolder($folderid)) { |
|
740 | + if (!$hc->GetFolder($folderid)) { |
|
741 | 741 | ZLog::Write(LOGLEVEL_WARN, sprintf("DeviceManager->CheckFolderData(): Folder '%s' has sync states but is not in the hierarchy cache. Removing states.", $folderid)); |
742 | 742 | StateManager::UnLinkState($this->device, $folderid); |
743 | 743 | } |
@@ -927,7 +927,7 @@ discard block |
||
927 | 927 | // fallback for old grosync like devicedata |
928 | 928 | if (($device instanceof StateObject) && isset($device->devices) && is_array($device->devices)) { |
929 | 929 | ZLog::Write(LOGLEVEL_INFO, "Found old style device, converting..."); |
930 | - list ($_deviceuser, $_domain) = Utils::SplitDomainUser(Request::GetGETUser()); |
|
930 | + list ($_deviceuser, $_domain) = Utils::SplitDomainUser(Request::GetGETUser()); |
|
931 | 931 | if (!isset($device->data->devices[$_deviceuser])) { |
932 | 932 | ZLog::Write(LOGLEVEL_INFO, "Using old style device for this request and updating when concluding"); |
933 | 933 | $device = $device->devices[$_deviceuser]; |
@@ -1017,7 +1017,7 @@ discard block |
||
1017 | 1017 | */ |
1018 | 1018 | private function announceAcceptedMessage($folderid, $id) { |
1019 | 1019 | if ($this->device->RemoveIgnoredMessage($folderid, $id)) { |
1020 | - ZLog::Write(LOGLEVEL_INFO, sprintf("DeviceManager->announceAcceptedMessage('%s', '%s'): cleared previously ignored message as message is successfully streamed",$folderid, $id)); |
|
1020 | + ZLog::Write(LOGLEVEL_INFO, sprintf("DeviceManager->announceAcceptedMessage('%s', '%s'): cleared previously ignored message as message is successfully streamed", $folderid, $id)); |
|
1021 | 1021 | return true; |
1022 | 1022 | } |
1023 | 1023 | return false; |
@@ -1034,7 +1034,7 @@ discard block |
||
1034 | 1034 | */ |
1035 | 1035 | private function checkBrokenMessages($folderid) { |
1036 | 1036 | // check for correctly synchronized messages of the folder |
1037 | - foreach($this->loopdetection->GetSyncedButBeforeIgnoredMessages($folderid) as $okID) { |
|
1037 | + foreach ($this->loopdetection->GetSyncedButBeforeIgnoredMessages($folderid) as $okID) { |
|
1038 | 1038 | $this->announceAcceptedMessage($folderid, $okID); |
1039 | 1039 | } |
1040 | 1040 | return true; |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | public function __construct(&$encoder, $class) { |
27 | 27 | $this->encoder = &$encoder; |
28 | 28 | $this->objclass = $class; |
29 | - $this->classAsString = (is_object($class))?get_class($class):''; |
|
29 | + $this->classAsString = (is_object($class)) ?get_class($class) : ''; |
|
30 | 30 | $this->seenObjects = array(); |
31 | 31 | $this->importedMsgs = 0; |
32 | 32 | $this->checkForIgnoredMessages = true; |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | */ |
38 | 38 | public function Config($state, $flags = 0) { return true; } |
39 | 39 | public function ConfigContentParameters($contentparameters) { return true; } |
40 | - public function GetState() { return false;} |
|
40 | + public function GetState() { return false; } |
|
41 | 41 | public function LoadConflicts($contentparameters, $state) { return true; } |
42 | 42 | |
43 | 43 | /** |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | */ |
52 | 52 | public function ImportMessageChange($id, $message) { |
53 | 53 | // ignore other SyncObjects |
54 | - if(!($message instanceof $this->classAsString)) { |
|
54 | + if (!($message instanceof $this->classAsString)) { |
|
55 | 55 | return false; |
56 | 56 | } |
57 | 57 | |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | $this->encoder->startTag(SYNC_ADD); |
81 | 81 | else { |
82 | 82 | // on update of an SyncEmail we only export the flags and categories |
83 | - if($message instanceof SyncMail && ((isset($message->flag) && $message->flag instanceof SyncMailFlags) || isset($message->categories))) { |
|
83 | + if ($message instanceof SyncMail && ((isset($message->flag) && $message->flag instanceof SyncMailFlags) || isset($message->categories))) { |
|
84 | 84 | $newmessage = new SyncMail(); |
85 | 85 | $newmessage->read = $message->read; |
86 | 86 | if (isset($message->flag)) $newmessage->flag = $message->flag; |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | * @return boolean |
149 | 149 | */ |
150 | 150 | public function ImportMessageReadFlag($id, $flags, $categories = array()) { |
151 | - if(!($this->objclass instanceof SyncMail)) |
|
151 | + if (!($this->objclass instanceof SyncMail)) |
|
152 | 152 | return false; |
153 | 153 | |
154 | 154 | $this->importedMsgs++; |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | $this->encoder->endTag(); |
164 | 164 | if (!empty($categories) && is_array($categories)) { |
165 | 165 | $this->encoder->startTag(SYNC_POOMMAIL_CATEGORIES); |
166 | - foreach($categories as $category) { |
|
166 | + foreach ($categories as $category) { |
|
167 | 167 | $this->encoder->startTag(SYNC_POOMMAIL_CATEGORY); |
168 | 168 | $this->encoder->content($category); |
169 | 169 | $this->encoder->endTag(); |
@@ -163,7 +163,7 @@ |
||
163 | 163 | * @return string |
164 | 164 | */ |
165 | 165 | public function GetStat() { |
166 | - return sprintf("HierarchyCache is %s - Cached objects: %d", ((isset($this->data))?"up":"down"), ((isset($this->data))?count($this->data):"0")); |
|
166 | + return sprintf("HierarchyCache is %s - Cached objects: %d", ((isset($this->data)) ? "up" : "down"), ((isset($this->data)) ?count($this->data) : "0")); |
|
167 | 167 | } |
168 | 168 | |
169 | 169 | /** |
@@ -33,13 +33,13 @@ discard block |
||
33 | 33 | $this->_out = $output; |
34 | 34 | |
35 | 35 | // reverse-map the DTD |
36 | - foreach($this->dtd["namespaces"] as $nsid => $nsname) { |
|
36 | + foreach ($this->dtd["namespaces"] as $nsid => $nsname) { |
|
37 | 37 | $this->_dtd["namespaces"][$nsname] = $nsid; |
38 | 38 | } |
39 | 39 | |
40 | - foreach($this->dtd["codes"] as $cp => $value) { |
|
40 | + foreach ($this->dtd["codes"] as $cp => $value) { |
|
41 | 41 | $this->_dtd["codes"][$cp] = array(); |
42 | - foreach($this->dtd["codes"][$cp] as $tagid => $tagname) { |
|
42 | + foreach ($this->dtd["codes"][$cp] as $tagid => $tagname) { |
|
43 | 43 | $this->_dtd["codes"][$cp][$tagname] = $tagid; |
44 | 44 | } |
45 | 45 | } |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | public function startTag($tag, $attributes = false, $nocontent = false) { |
84 | 84 | $stackelem = array(); |
85 | 85 | |
86 | - if(!$nocontent) { |
|
86 | + if (!$nocontent) { |
|
87 | 87 | $stackelem['tag'] = $tag; |
88 | 88 | $stackelem['nocontent'] = $nocontent; |
89 | 89 | $stackelem['sent'] = false; |
@@ -108,16 +108,16 @@ discard block |
||
108 | 108 | $stackelem = array_pop($this->_stack); |
109 | 109 | |
110 | 110 | // Only output end tags for items that have had a start tag sent |
111 | - if($stackelem['sent']) { |
|
111 | + if ($stackelem['sent']) { |
|
112 | 112 | $this->_endTag(); |
113 | 113 | |
114 | - if(count($this->_stack) == 0) |
|
114 | + if (count($this->_stack) == 0) |
|
115 | 115 | ZLog::Write(LOGLEVEL_DEBUG, "WBXMLEncoder->endTag() WBXML output completed"); |
116 | 116 | |
117 | - if(count($this->_stack) == 0 && $this->multipart == true) { |
|
117 | + if (count($this->_stack) == 0 && $this->multipart == true) { |
|
118 | 118 | $this->processMultipart(); |
119 | 119 | } |
120 | - if(count($this->_stack) == 0) |
|
120 | + if (count($this->_stack) == 0) |
|
121 | 121 | $this->writeLog(); |
122 | 122 | } |
123 | 123 | } |
@@ -133,9 +133,9 @@ discard block |
||
133 | 133 | public function content($content) { |
134 | 134 | // We need to filter out any \0 chars because it's the string terminator in WBXML. We currently |
135 | 135 | // cannot send \0 characters within the XML content anywhere. |
136 | - $content = str_replace("\0","",$content); |
|
136 | + $content = str_replace("\0", "", $content); |
|
137 | 137 | |
138 | - if("x" . $content == "x") |
|
138 | + if ("x".$content == "x") |
|
139 | 139 | return; |
140 | 140 | $this->_outputStack(); |
141 | 141 | $this->_content($content); |
@@ -214,8 +214,8 @@ discard block |
||
214 | 214 | * @return |
215 | 215 | */ |
216 | 216 | private function _outputStack() { |
217 | - for($i=0;$i<count($this->_stack);$i++) { |
|
218 | - if(!$this->_stack[$i]['sent']) { |
|
217 | + for ($i = 0; $i < count($this->_stack); $i++) { |
|
218 | + if (!$this->_stack[$i]['sent']) { |
|
219 | 219 | $this->_startTag($this->_stack[$i]['tag'], $this->_stack[$i]['nocontent']); |
220 | 220 | $this->_stack[$i]['sent'] = true; |
221 | 221 | } |
@@ -234,17 +234,17 @@ discard block |
||
234 | 234 | |
235 | 235 | $mapping = $this->getMapping($tag); |
236 | 236 | |
237 | - if(!$mapping) |
|
237 | + if (!$mapping) |
|
238 | 238 | return false; |
239 | 239 | |
240 | - if($this->_tagcp != $mapping["cp"]) { |
|
240 | + if ($this->_tagcp != $mapping["cp"]) { |
|
241 | 241 | $this->outSwitchPage($mapping["cp"]); |
242 | 242 | $this->_tagcp = $mapping["cp"]; |
243 | 243 | } |
244 | 244 | |
245 | 245 | $code = $mapping["code"]; |
246 | 246 | |
247 | - if(!isset($nocontent) || !$nocontent) |
|
247 | + if (!isset($nocontent) || !$nocontent) |
|
248 | 248 | $code |= 0x40; |
249 | 249 | |
250 | 250 | $this->outByte($code); |
@@ -296,7 +296,7 @@ discard block |
||
296 | 296 | |
297 | 297 | if ($this->log) { |
298 | 298 | // data is out, do some logging |
299 | - $this->logContent(sprintf("<<< written %d of %d bytes of %s data >>>", $written, $stat['size'], $asBase64 ? "base64 encoded":"plain")); |
|
299 | + $this->logContent(sprintf("<<< written %d of %d bytes of %s data >>>", $written, $stat['size'], $asBase64 ? "base64 encoded" : "plain")); |
|
300 | 300 | } |
301 | 301 | } |
302 | 302 | |
@@ -351,10 +351,10 @@ discard block |
||
351 | 351 | $byte = $uint & 0x7f; |
352 | 352 | $uint = $uint >> 7; |
353 | 353 | if ($i == 0) { |
354 | - $out = chr($byte) . $out; |
|
354 | + $out = chr($byte).$out; |
|
355 | 355 | } |
356 | 356 | else { |
357 | - $out = chr($byte | 0x80) . $out; |
|
357 | + $out = chr($byte|0x80).$out; |
|
358 | 358 | } |
359 | 359 | } |
360 | 360 | fwrite($this->_out, $out); |
@@ -399,7 +399,7 @@ discard block |
||
399 | 399 | |
400 | 400 | $split = $this->splitTag($tag); |
401 | 401 | |
402 | - if(isset($split["ns"])) { |
|
402 | + if (isset($split["ns"])) { |
|
403 | 403 | $cp = $this->_dtd["namespaces"][$split["ns"]]; |
404 | 404 | } |
405 | 405 | else { |
@@ -426,16 +426,16 @@ discard block |
||
426 | 426 | $ns = false; |
427 | 427 | $pos = strpos($fulltag, chr(58)); // chr(58) == ':' |
428 | 428 | |
429 | - if($pos) { |
|
429 | + if ($pos) { |
|
430 | 430 | $ns = substr($fulltag, 0, $pos); |
431 | - $tag = substr($fulltag, $pos+1); |
|
431 | + $tag = substr($fulltag, $pos + 1); |
|
432 | 432 | } |
433 | 433 | else { |
434 | 434 | $tag = $fulltag; |
435 | 435 | } |
436 | 436 | |
437 | 437 | $ret = array(); |
438 | - if($ns) |
|
438 | + if ($ns) |
|
439 | 439 | $ret["ns"] = $ns; |
440 | 440 | $ret["tag"] = $tag; |
441 | 441 | |
@@ -453,11 +453,11 @@ discard block |
||
453 | 453 | */ |
454 | 454 | private function logStartTag($tag, $nocontent) { |
455 | 455 | $spaces = str_repeat(" ", count($this->logStack)); |
456 | - if($nocontent) |
|
457 | - ZLog::Write(LOGLEVEL_WBXML,"O " . $spaces . " <$tag/>"); |
|
456 | + if ($nocontent) |
|
457 | + ZLog::Write(LOGLEVEL_WBXML, "O ".$spaces." <$tag/>"); |
|
458 | 458 | else { |
459 | 459 | array_push($this->logStack, $tag); |
460 | - ZLog::Write(LOGLEVEL_WBXML,"O " . $spaces . " <$tag>"); |
|
460 | + ZLog::Write(LOGLEVEL_WBXML, "O ".$spaces." <$tag>"); |
|
461 | 461 | } |
462 | 462 | } |
463 | 463 | |
@@ -470,7 +470,7 @@ discard block |
||
470 | 470 | private function logEndTag() { |
471 | 471 | $spaces = str_repeat(" ", count($this->logStack)); |
472 | 472 | $tag = array_pop($this->logStack); |
473 | - ZLog::Write(LOGLEVEL_WBXML,"O " . $spaces . "</$tag>"); |
|
473 | + ZLog::Write(LOGLEVEL_WBXML, "O ".$spaces."</$tag>"); |
|
474 | 474 | } |
475 | 475 | |
476 | 476 | /** |
@@ -483,7 +483,7 @@ discard block |
||
483 | 483 | */ |
484 | 484 | private function logContent($content) { |
485 | 485 | $spaces = str_repeat(" ", count($this->logStack)); |
486 | - ZLog::Write(LOGLEVEL_WBXML,"O " . $spaces . $content); |
|
486 | + ZLog::Write(LOGLEVEL_WBXML, "O ".$spaces.$content); |
|
487 | 487 | } |
488 | 488 | |
489 | 489 | /** |
@@ -513,7 +513,7 @@ discard block |
||
513 | 513 | |
514 | 514 | fwrite($this->_out, $buffer); |
515 | 515 | |
516 | - foreach($this->bodyparts as $bp) { |
|
516 | + foreach ($this->bodyparts as $bp) { |
|
517 | 517 | stream_copy_to_stream($bp, $this->_out); |
518 | 518 | fclose($bp); |
519 | 519 | } |
@@ -533,6 +533,6 @@ discard block |
||
533 | 533 | } else { |
534 | 534 | $data = "more than 512K of data"; |
535 | 535 | } |
536 | - ZLog::Write(LOGLEVEL_WBXML, "WBXML-OUT: ". $data, false); |
|
536 | + ZLog::Write(LOGLEVEL_WBXML, "WBXML-OUT: ".$data, false); |
|
537 | 537 | } |
538 | 538 | } |
@@ -74,14 +74,14 @@ discard block |
||
74 | 74 | $this->in = $input; |
75 | 75 | |
76 | 76 | $version = $this->getByte(); |
77 | - if($version != self::VERSION) { |
|
77 | + if ($version != self::VERSION) { |
|
78 | 78 | $this->inputBuffer .= chr($version); |
79 | 79 | $this->isWBXML = false; |
80 | 80 | return; |
81 | 81 | } |
82 | 82 | |
83 | 83 | $publicid = $this->getMBUInt(); |
84 | - if($publicid !== 1) |
|
84 | + if ($publicid !== 1) |
|
85 | 85 | throw new WBXMLException("Wrong publicid : ".$publicid); |
86 | 86 | |
87 | 87 | $charsetid = $this->getMBUInt(); |
@@ -102,18 +102,18 @@ discard block |
||
102 | 102 | public function getElement() { |
103 | 103 | $element = $this->getToken(); |
104 | 104 | |
105 | - switch($element[EN_TYPE]) { |
|
105 | + switch ($element[EN_TYPE]) { |
|
106 | 106 | case EN_TYPE_STARTTAG: |
107 | 107 | return $element; |
108 | 108 | case EN_TYPE_ENDTAG: |
109 | 109 | return $element; |
110 | 110 | case EN_TYPE_CONTENT: |
111 | 111 | WBXMLDecoder::ResetInWhile("decoderGetElement"); |
112 | - while(WBXMLDecoder::InWhile("decoderGetElement")) { |
|
112 | + while (WBXMLDecoder::InWhile("decoderGetElement")) { |
|
113 | 113 | $next = $this->getToken(); |
114 | - if($next == false) |
|
114 | + if ($next == false) |
|
115 | 115 | return false; |
116 | - else if($next[EN_TYPE] == EN_CONTENT) { |
|
116 | + else if ($next[EN_TYPE] == EN_CONTENT) { |
|
117 | 117 | $element[EN_CONTENT] .= $next[EN_CONTENT]; |
118 | 118 | } else { |
119 | 119 | $this->ungetElement($next); |
@@ -152,10 +152,10 @@ discard block |
||
152 | 152 | if (!$element) |
153 | 153 | return false; |
154 | 154 | |
155 | - if($element[EN_TYPE] == EN_TYPE_STARTTAG && $element[EN_TAG] == $tag) |
|
155 | + if ($element[EN_TYPE] == EN_TYPE_STARTTAG && $element[EN_TAG] == $tag) |
|
156 | 156 | return $element; |
157 | 157 | else { |
158 | - ZLog::Write(LOGLEVEL_WBXMLSTACK, sprintf("WBXMLDecoder->getElementStartTag(): unmatched WBXML tag: '%s' matching '%s' type '%s' flags '%s'", $tag, ((isset($element[EN_TAG]))?$element[EN_TAG]:""), ((isset($element[EN_TYPE]))?$element[EN_TYPE]:""), ((isset($element[EN_FLAGS]))?$element[EN_FLAGS]:""))); |
|
158 | + ZLog::Write(LOGLEVEL_WBXMLSTACK, sprintf("WBXMLDecoder->getElementStartTag(): unmatched WBXML tag: '%s' matching '%s' type '%s' flags '%s'", $tag, ((isset($element[EN_TAG])) ? $element[EN_TAG] : ""), ((isset($element[EN_TYPE])) ? $element[EN_TYPE] : ""), ((isset($element[EN_FLAGS])) ? $element[EN_FLAGS] : ""))); |
|
159 | 159 | $this->ungetElement($element); |
160 | 160 | } |
161 | 161 | |
@@ -171,17 +171,17 @@ discard block |
||
171 | 171 | public function getElementEndTag() { |
172 | 172 | $element = $this->getToken(); |
173 | 173 | |
174 | - if($element[EN_TYPE] == EN_TYPE_ENDTAG) |
|
174 | + if ($element[EN_TYPE] == EN_TYPE_ENDTAG) |
|
175 | 175 | return $element; |
176 | 176 | else { |
177 | - ZLog::Write(LOGLEVEL_WBXMLSTACK, sprintf("WBXMLDecoder->getElementEndTag(): unmatched WBXML tag: '%s' type '%s' flags '%s'", ((isset($element[EN_TAG]))?$element[EN_TAG]:""), ((isset($element[EN_TYPE]))?$element[EN_TYPE]:""), ((isset($element[EN_FLAGS]))?$element[EN_FLAGS]:""))); |
|
177 | + ZLog::Write(LOGLEVEL_WBXMLSTACK, sprintf("WBXMLDecoder->getElementEndTag(): unmatched WBXML tag: '%s' type '%s' flags '%s'", ((isset($element[EN_TAG])) ? $element[EN_TAG] : ""), ((isset($element[EN_TYPE])) ? $element[EN_TYPE] : ""), ((isset($element[EN_FLAGS])) ? $element[EN_FLAGS] : ""))); |
|
178 | 178 | |
179 | 179 | $bt = debug_backtrace(); |
180 | - ZLog::Write(LOGLEVEL_ERROR, sprintf("WBXMLDecoder->getElementEndTag(): could not read end tag in '%s'. Please enable the LOGLEVEL_WBXML and send the log to the grommunio-sync dev team.", $bt[0]["file"] . ":" . $bt[0]["line"])); |
|
180 | + ZLog::Write(LOGLEVEL_ERROR, sprintf("WBXMLDecoder->getElementEndTag(): could not read end tag in '%s'. Please enable the LOGLEVEL_WBXML and send the log to the grommunio-sync dev team.", $bt[0]["file"].":".$bt[0]["line"])); |
|
181 | 181 | |
182 | 182 | // log the remaining wbxml content |
183 | 183 | $this->ungetElement($element); |
184 | - while($el = $this->getElement()); |
|
184 | + while ($el = $this->getElement()); |
|
185 | 185 | } |
186 | 186 | |
187 | 187 | return false; |
@@ -196,11 +196,11 @@ discard block |
||
196 | 196 | public function getElementContent() { |
197 | 197 | $element = $this->getToken(); |
198 | 198 | |
199 | - if($element[EN_TYPE] == EN_TYPE_CONTENT) { |
|
199 | + if ($element[EN_TYPE] == EN_TYPE_CONTENT) { |
|
200 | 200 | return $element[EN_CONTENT]; |
201 | 201 | } |
202 | 202 | else { |
203 | - ZLog::Write(LOGLEVEL_WBXMLSTACK, sprintf("WBXMLDecoder->getElementContent(): unmatched WBXML content: '%s' type '%s' flags '%s'", ((isset($element[EN_TAG]))?$element[EN_TAG]:""), ((isset($element[EN_TYPE]))?$element[EN_TYPE]:""), ((isset($element[EN_FLAGS]))?$element[EN_FLAGS]:""))); |
|
203 | + ZLog::Write(LOGLEVEL_WBXMLSTACK, sprintf("WBXMLDecoder->getElementContent(): unmatched WBXML content: '%s' type '%s' flags '%s'", ((isset($element[EN_TAG])) ? $element[EN_TAG] : ""), ((isset($element[EN_TYPE])) ? $element[EN_TYPE] : ""), ((isset($element[EN_FLAGS])) ? $element[EN_FLAGS] : ""))); |
|
204 | 204 | $this->ungetElement($element); |
205 | 205 | } |
206 | 206 | |
@@ -216,8 +216,8 @@ discard block |
||
216 | 216 | * @return |
217 | 217 | */ |
218 | 218 | public function ungetElement($element) { |
219 | - if($this->ungetbuffer) |
|
220 | - ZLog::Write(LOGLEVEL_ERROR,sprintf("WBXMLDecoder->ungetElement(): WBXML double unget on tag: '%s' type '%s' flags '%s'", ((isset($element[EN_TAG]))?$element[EN_TAG]:""), ((isset($element[EN_TYPE]))?$element[EN_TYPE]:""), ((isset($element[EN_FLAGS]))?$element[EN_FLAGS]:""))); |
|
219 | + if ($this->ungetbuffer) |
|
220 | + ZLog::Write(LOGLEVEL_ERROR, sprintf("WBXMLDecoder->ungetElement(): WBXML double unget on tag: '%s' type '%s' flags '%s'", ((isset($element[EN_TAG])) ? $element[EN_TAG] : ""), ((isset($element[EN_TYPE])) ? $element[EN_TYPE] : ""), ((isset($element[EN_FLAGS])) ? $element[EN_FLAGS] : ""))); |
|
221 | 221 | |
222 | 222 | $this->ungetbuffer = $element; |
223 | 223 | } |
@@ -250,7 +250,7 @@ discard block |
||
250 | 250 | */ |
251 | 251 | public function readRemainingData() { |
252 | 252 | ZLog::Write(LOGLEVEL_DEBUG, "WBXMLDecoder->readRemainingData() reading remaining data from input stream"); |
253 | - while($this->getElement()); |
|
253 | + while ($this->getElement()); |
|
254 | 254 | } |
255 | 255 | |
256 | 256 | /**---------------------------------------------------------------------------------------------------------- |
@@ -265,14 +265,14 @@ discard block |
||
265 | 265 | */ |
266 | 266 | private function getToken() { |
267 | 267 | // See if there's something in the ungetBuffer |
268 | - if($this->ungetbuffer) { |
|
268 | + if ($this->ungetbuffer) { |
|
269 | 269 | $element = $this->ungetbuffer; |
270 | 270 | $this->ungetbuffer = false; |
271 | 271 | return $element; |
272 | 272 | } |
273 | 273 | |
274 | 274 | $el = $this->_getToken(); |
275 | - if($this->log && $el) |
|
275 | + if ($this->log && $el) |
|
276 | 276 | $this->logToken($el); |
277 | 277 | |
278 | 278 | return $el; |
@@ -289,18 +289,18 @@ discard block |
||
289 | 289 | private function logToken($el) { |
290 | 290 | $spaces = str_repeat(" ", count($this->logStack)); |
291 | 291 | |
292 | - switch($el[EN_TYPE]) { |
|
292 | + switch ($el[EN_TYPE]) { |
|
293 | 293 | case EN_TYPE_STARTTAG: |
294 | - if($el[EN_FLAGS] & EN_FLAGS_CONTENT) { |
|
295 | - ZLog::Write(LOGLEVEL_WBXML,"I " . $spaces . " <". $el[EN_TAG] . ">"); |
|
294 | + if ($el[EN_FLAGS] & EN_FLAGS_CONTENT) { |
|
295 | + ZLog::Write(LOGLEVEL_WBXML, "I ".$spaces." <".$el[EN_TAG].">"); |
|
296 | 296 | array_push($this->logStack, $el[EN_TAG]); |
297 | 297 | } else |
298 | - ZLog::Write(LOGLEVEL_WBXML,"I " . $spaces . " <" . $el[EN_TAG] . "/>"); |
|
298 | + ZLog::Write(LOGLEVEL_WBXML, "I ".$spaces." <".$el[EN_TAG]."/>"); |
|
299 | 299 | |
300 | 300 | break; |
301 | 301 | case EN_TYPE_ENDTAG: |
302 | 302 | $tag = array_pop($this->logStack); |
303 | - ZLog::Write(LOGLEVEL_WBXML,"I " . $spaces . "</" . $tag . ">"); |
|
303 | + ZLog::Write(LOGLEVEL_WBXML, "I ".$spaces."</".$tag.">"); |
|
304 | 304 | break; |
305 | 305 | case EN_TYPE_CONTENT: |
306 | 306 | // as we concatenate the string here, the entire content is copied. |
@@ -308,13 +308,13 @@ discard block |
||
308 | 308 | // requires easily additional 20 MB of RAM. See https://jira.z-hub.io/browse/ZP-1159 |
309 | 309 | $messagesize = strlen($el[EN_CONTENT]); |
310 | 310 | if ($messagesize > 10240 && !defined('WBXML_DEBUGGING')) { |
311 | - $content = substr($el[EN_CONTENT], 0, 10240) . sprintf(" <log message with %d bytes truncated>", $messagesize); |
|
311 | + $content = substr($el[EN_CONTENT], 0, 10240).sprintf(" <log message with %d bytes truncated>", $messagesize); |
|
312 | 312 | } |
313 | 313 | else { |
314 | 314 | $content = $el[EN_CONTENT]; |
315 | 315 | } |
316 | 316 | // Log but make sure it's not truncated again (will be slightly bigger than 10KB) |
317 | - ZLog::Write(LOGLEVEL_WBXML,"I " . $spaces . " " . $content, false); |
|
317 | + ZLog::Write(LOGLEVEL_WBXML, "I ".$spaces." ".$content, false); |
|
318 | 318 | break; |
319 | 319 | } |
320 | 320 | } |
@@ -330,13 +330,13 @@ discard block |
||
330 | 330 | $element = array(); |
331 | 331 | |
332 | 332 | WBXMLDecoder::ResetInWhile("decoderGetToken"); |
333 | - while(WBXMLDecoder::InWhile("decoderGetToken")) { |
|
333 | + while (WBXMLDecoder::InWhile("decoderGetToken")) { |
|
334 | 334 | $byte = fread($this->in, 1); |
335 | - if($byte === "" || $byte === false) |
|
335 | + if ($byte === "" || $byte === false) |
|
336 | 336 | break; |
337 | 337 | $byte = ord($byte); |
338 | 338 | |
339 | - switch($byte) { |
|
339 | + switch ($byte) { |
|
340 | 340 | case self::WBXML_SWITCH_PAGE: |
341 | 341 | $this->tagcp = $this->getByte(); |
342 | 342 | break; |
@@ -375,7 +375,7 @@ discard block |
||
375 | 375 | throw new WBXMLException("Invalid token :".$byte); |
376 | 376 | |
377 | 377 | default: |
378 | - if($byte & self::WBXML_WITH_ATTRIBUTES) |
|
378 | + if ($byte & self::WBXML_WITH_ATTRIBUTES) |
|
379 | 379 | throw new WBXMLException("Attributes are not allowed :".$byte); |
380 | 380 | $element[EN_TYPE] = EN_TYPE_STARTTAG; |
381 | 381 | $element[EN_TAG] = $this->getMapping($this->tagcp, $byte & 0x3f); |
@@ -441,7 +441,7 @@ discard block |
||
441 | 441 | */ |
442 | 442 | private function getByte() { |
443 | 443 | $ch = fread($this->in, 1); |
444 | - if(strlen($ch) > 0) |
|
444 | + if (strlen($ch) > 0) |
|
445 | 445 | return ord($ch); |
446 | 446 | else |
447 | 447 | return; |
@@ -456,12 +456,12 @@ discard block |
||
456 | 456 | private function getMBUInt() { |
457 | 457 | $uint = 0; |
458 | 458 | |
459 | - while(1) { |
|
459 | + while (1) { |
|
460 | 460 | $byte = $this->getByte(); |
461 | 461 | |
462 | 462 | $uint |= $byte & 0x7f; |
463 | 463 | |
464 | - if($byte & 0x80) |
|
464 | + if ($byte & 0x80) |
|
465 | 465 | $uint = $uint << 7; |
466 | 466 | else |
467 | 467 | break; |
@@ -480,11 +480,11 @@ discard block |
||
480 | 480 | * @return string |
481 | 481 | */ |
482 | 482 | private function getMapping($cp, $id) { |
483 | - if(!isset($this->dtd["codes"][$cp]) || !isset($this->dtd["codes"][$cp][$id])) |
|
483 | + if (!isset($this->dtd["codes"][$cp]) || !isset($this->dtd["codes"][$cp][$id])) |
|
484 | 484 | return false; |
485 | 485 | else { |
486 | - if(isset($this->dtd["namespaces"][$cp])) { |
|
487 | - return $this->dtd["namespaces"][$cp] . ":" . $this->dtd["codes"][$cp][$id]; |
|
486 | + if (isset($this->dtd["namespaces"][$cp])) { |
|
487 | + return $this->dtd["namespaces"][$cp].":".$this->dtd["codes"][$cp][$id]; |
|
488 | 488 | } else |
489 | 489 | return $this->dtd["codes"][$cp][$id]; |
490 | 490 | } |
@@ -7,41 +7,41 @@ discard block |
||
7 | 7 | * WBXML definitions |
8 | 8 | */ |
9 | 9 | |
10 | -define('EN_TYPE', 1); |
|
11 | -define('EN_TAG', 2); |
|
12 | -define('EN_CONTENT', 3); |
|
13 | -define('EN_FLAGS', 4); |
|
14 | -define('EN_ATTRIBUTES', 5); |
|
10 | +define('EN_TYPE', 1); |
|
11 | +define('EN_TAG', 2); |
|
12 | +define('EN_CONTENT', 3); |
|
13 | +define('EN_FLAGS', 4); |
|
14 | +define('EN_ATTRIBUTES', 5); |
|
15 | 15 | |
16 | -define('EN_TYPE_STARTTAG', 1); |
|
17 | -define('EN_TYPE_ENDTAG', 2); |
|
18 | -define('EN_TYPE_CONTENT', 3); |
|
16 | +define('EN_TYPE_STARTTAG', 1); |
|
17 | +define('EN_TYPE_ENDTAG', 2); |
|
18 | +define('EN_TYPE_CONTENT', 3); |
|
19 | 19 | |
20 | -define('EN_FLAGS_CONTENT', 1); |
|
21 | -define('EN_FLAGS_ATTRIBUTES', 2); |
|
20 | +define('EN_FLAGS_CONTENT', 1); |
|
21 | +define('EN_FLAGS_ATTRIBUTES', 2); |
|
22 | 22 | |
23 | 23 | class WBXMLDefs { |
24 | 24 | |
25 | 25 | const WBXML_SWITCH_PAGE = 0x00; |
26 | - const WBXML_END = 0x01; |
|
27 | - const WBXML_ENTITY = 0x02; //not used in ActiveSync |
|
28 | - const WBXML_STR_I = 0x03; |
|
29 | - const WBXML_LITERAL = 0x04; //not used in ActiveSync |
|
30 | - const WBXML_EXT_I_0 = 0x40; //not used in ActiveSync |
|
31 | - const WBXML_EXT_I_1 = 0x41; //not used in ActiveSync |
|
32 | - const WBXML_EXT_I_2 = 0x42; //not used in ActiveSync |
|
33 | - const WBXML_PI = 0x43; //not used in ActiveSync |
|
34 | - const WBXML_LITERAL_C = 0x44; //not used in ActiveSync |
|
35 | - const WBXML_EXT_T_0 = 0x80; //not used in ActiveSync |
|
36 | - const WBXML_EXT_T_1 = 0x81; //not used in ActiveSync |
|
37 | - const WBXML_EXT_T_2 = 0x82; //not used in ActiveSync |
|
38 | - const WBXML_STR_T = 0x83; //not used in ActiveSync |
|
39 | - const WBXML_LITERAL_A = 0x84; //not used in ActiveSync |
|
40 | - const WBXML_EXT_0 = 0xC0; //not used in ActiveSync |
|
41 | - const WBXML_EXT_1 = 0xC1; //not used in ActiveSync |
|
42 | - const WBXML_EXT_2 = 0xC2; //not used in ActiveSync |
|
43 | - const WBXML_OPAQUE = 0xC3; |
|
44 | - const WBXML_LITERAL_AC = 0xC4; //not used in ActiveSync |
|
26 | + const WBXML_END = 0x01; |
|
27 | + const WBXML_ENTITY = 0x02; //not used in ActiveSync |
|
28 | + const WBXML_STR_I = 0x03; |
|
29 | + const WBXML_LITERAL = 0x04; //not used in ActiveSync |
|
30 | + const WBXML_EXT_I_0 = 0x40; //not used in ActiveSync |
|
31 | + const WBXML_EXT_I_1 = 0x41; //not used in ActiveSync |
|
32 | + const WBXML_EXT_I_2 = 0x42; //not used in ActiveSync |
|
33 | + const WBXML_PI = 0x43; //not used in ActiveSync |
|
34 | + const WBXML_LITERAL_C = 0x44; //not used in ActiveSync |
|
35 | + const WBXML_EXT_T_0 = 0x80; //not used in ActiveSync |
|
36 | + const WBXML_EXT_T_1 = 0x81; //not used in ActiveSync |
|
37 | + const WBXML_EXT_T_2 = 0x82; //not used in ActiveSync |
|
38 | + const WBXML_STR_T = 0x83; //not used in ActiveSync |
|
39 | + const WBXML_LITERAL_A = 0x84; //not used in ActiveSync |
|
40 | + const WBXML_EXT_0 = 0xC0; //not used in ActiveSync |
|
41 | + const WBXML_EXT_1 = 0xC1; //not used in ActiveSync |
|
42 | + const WBXML_EXT_2 = 0xC2; //not used in ActiveSync |
|
43 | + const WBXML_OPAQUE = 0xC3; |
|
44 | + const WBXML_LITERAL_AC = 0xC4; //not used in ActiveSync |
|
45 | 45 | |
46 | 46 | const WBXML_WITH_ATTRIBUTES = 0x80; //not used in ActiveSync |
47 | 47 | const WBXML_WITH_CONTENT = 0x40; |
@@ -50,8 +50,8 @@ discard block |
||
50 | 50 | * The WBXML DTDs |
51 | 51 | */ |
52 | 52 | protected $dtd = array( |
53 | - "codes" => array ( |
|
54 | - 0 => array ( |
|
53 | + "codes" => array( |
|
54 | + 0 => array( |
|
55 | 55 | 0x05 => "Synchronize", |
56 | 56 | 0x06 => "Replies", //Responses |
57 | 57 | 0x07 => "Add", |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | 0x28 => "MaxItems", // Since 14.0 |
91 | 91 | 0x29 => "HeartbeatInterval", // Since 14.0 Either this tag or the Wait tag can be present, but not both. |
92 | 92 | ), |
93 | - 1 => array ( |
|
93 | + 1 => array( |
|
94 | 94 | 0x05 => "Anniversary", |
95 | 95 | 0x06 => "AssistantName", |
96 | 96 | 0x07 => "AssistnamePhoneNumber", //AssistantTelephoneNumber |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | 0x3d => "Alias", // Since 14.0 |
151 | 151 | 0x3e => "WeightedRank" // Since 14.0 |
152 | 152 | ), |
153 | - 2 => array ( |
|
153 | + 2 => array( |
|
154 | 154 | 0x05 => "Attachment", // AirSyncBase Attachments is used since 12.0 |
155 | 155 | 0x06 => "Attachments", // AirSyncBase Attachments is used since 12.0 |
156 | 156 | 0x07 => "AttName", // AirSyncBase Attachments is used since 12.0 |
@@ -211,7 +211,7 @@ discard block |
||
211 | 211 | 0x3e => "CompleteTime", // Since 12.0 |
212 | 212 | 0x3f => "DisallowNewTimeProposal", // Since 14.0 |
213 | 213 | ), |
214 | - 3 => array ( //Code page 3 is no longer in use, however, tokens 05 through 17 have been defined. 20100501 |
|
214 | + 3 => array( //Code page 3 is no longer in use, however, tokens 05 through 17 have been defined. 20100501 |
|
215 | 215 | 0x05 => "Notify", |
216 | 216 | 0x06 => "Notification", |
217 | 217 | 0x07 => "Version", |
@@ -232,7 +232,7 @@ discard block |
||
232 | 232 | 0x15 => "Expiry", |
233 | 233 | 0x16 => "NotifyGUID", |
234 | 234 | ), |
235 | - 4 => array ( |
|
235 | + 4 => array( |
|
236 | 236 | 0x05 => "Timezone", |
237 | 237 | 0x06 => "AllDayEvent", |
238 | 238 | 0x07 => "Attendees", |
@@ -289,7 +289,7 @@ discard block |
||
289 | 289 | 0x3a => "OnlineMeetingConfLink", // Since 14.1 |
290 | 290 | 0x3b => "OnlineMeetingExternalLink", // Since 14.1 |
291 | 291 | ), |
292 | - 5 => array ( |
|
292 | + 5 => array( |
|
293 | 293 | 0x05 => "Moves", |
294 | 294 | 0x06 => "Move", |
295 | 295 | 0x07 => "SrcMsgId", |
@@ -299,7 +299,7 @@ discard block |
||
299 | 299 | 0x0b => "Status", |
300 | 300 | 0x0c => "DstMsgId", |
301 | 301 | ), |
302 | - 6 => array ( |
|
302 | + 6 => array( |
|
303 | 303 | 0x05 => "GetItemEstimate", |
304 | 304 | 0x06 => "Version", // deprecated |
305 | 305 | 0x07 => "Folders", // Collections |
@@ -311,7 +311,7 @@ discard block |
||
311 | 311 | 0x0d => "Response", |
312 | 312 | 0x0e => "Status", |
313 | 313 | ), |
314 | - 7 => array ( |
|
314 | + 7 => array( |
|
315 | 315 | 0x05 => "Folders", // 2.5, 12.0 and 12.1 |
316 | 316 | 0x06 => "Folder", // 2.5, 12.0 and 12.1 |
317 | 317 | 0x07 => "DisplayName", |
@@ -333,7 +333,7 @@ discard block |
||
333 | 333 | 0x17 => "Count", |
334 | 334 | 0x18 => "Version", // 2.0 - not defined in 20100501 |
335 | 335 | ), |
336 | - 8 => array ( |
|
336 | + 8 => array( |
|
337 | 337 | 0x05 => "CalendarId", |
338 | 338 | 0x06 => "FolderId", // CollectionId |
339 | 339 | 0x07 => "MeetingResponse", |
@@ -345,7 +345,7 @@ discard block |
||
345 | 345 | 0x0d => "Version", // 2.0 - not defined in 20100501 |
346 | 346 | 0x0e => "InstanceId" // Since AS 14.1 |
347 | 347 | ), |
348 | - 9 => array ( |
|
348 | + 9 => array( |
|
349 | 349 | 0x05 => "Body", // AirSyncBase Body is used since 12.0 |
350 | 350 | 0x06 => "BodySize", // AirSyncBase Body is used since 12.0 |
351 | 351 | 0x07 => "BodyTruncated", // AirSyncBase Body is used since 12.0 |
@@ -381,7 +381,7 @@ discard block |
||
381 | 381 | 0x25 => "IsLeapMonth", // Since 14.0 |
382 | 382 | 0x26 => "FirstDayOfWeek", // Since 14.1 |
383 | 383 | ), |
384 | - 0xa => array ( |
|
384 | + 0xa => array( |
|
385 | 385 | 0x05 => "ResolveRecipients", |
386 | 386 | 0x06 => "Response", |
387 | 387 | 0x07 => "Status", |
@@ -408,7 +408,7 @@ discard block |
||
408 | 408 | 0x1C => "Data", // Since 14.1 |
409 | 409 | 0x1D => "MaxPictures", // Since 14.1 |
410 | 410 | ), |
411 | - 0xb => array ( |
|
411 | + 0xb => array( |
|
412 | 412 | 0x05 => "ValidateCert", |
413 | 413 | 0x06 => "Certificates", |
414 | 414 | 0x07 => "Certificate", |
@@ -416,7 +416,7 @@ discard block |
||
416 | 416 | 0x09 => "CheckCRL", |
417 | 417 | 0x0a => "Status", |
418 | 418 | ), |
419 | - 0xc => array ( |
|
419 | + 0xc => array( |
|
420 | 420 | 0x05 => "CustomerId", |
421 | 421 | 0x06 => "GovernmentId", |
422 | 422 | 0x07 => "IMAddress", |
@@ -428,7 +428,7 @@ discard block |
||
428 | 428 | 0x0d => "NickName", |
429 | 429 | 0x0e => "MMS", |
430 | 430 | ), |
431 | - 0xd => array ( |
|
431 | + 0xd => array( |
|
432 | 432 | 0x05 => "Ping", |
433 | 433 | 0x06 => "AutdState", // (Not used by protocol) |
434 | 434 | 0x07 => "Status", |
@@ -440,7 +440,7 @@ discard block |
||
440 | 440 | 0x0d => "MaxFolders", |
441 | 441 | 0x0e => "Version" // not defined / deprecated |
442 | 442 | ), |
443 | - 0xe => array ( |
|
443 | + 0xe => array( |
|
444 | 444 | 0x05 => "Provision", |
445 | 445 | 0x06 => "Policies", |
446 | 446 | 0x07 => "Policy", |
@@ -720,8 +720,8 @@ discard block |
||
720 | 720 | 0xB => "ValidateCert", |
721 | 721 | 0xC => "POOMCONTACTS2", |
722 | 722 | 0xD => "Ping", |
723 | - 0xE => "Provision",// |
|
724 | - 0xF => "Search",// |
|
723 | + 0xE => "Provision", // |
|
724 | + 0xF => "Search", // |
|
725 | 725 | 0x10 => "GAL", |
726 | 726 | 0x11 => "AirSyncBase", //12.0, 12.1 and 14.0 |
727 | 727 | 0x12 => "Settings", //12.0, 12.1 and 14.0. |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | $this->truncateHtmlSafe = (isset($contextOptions[self::PROTOCOL]['truncatehtmlsafe'])) ? $contextOptions[self::PROTOCOL]['truncatehtmlsafe'] : false; |
43 | 43 | |
44 | 44 | $this->stringlength = strlen($this->stringstream); |
45 | - ZLog::Write(LOGLEVEL_DEBUG, sprintf("StringStreamWrapper::stream_open(): initialized stream length: %d - HTML-safe-truncate: %s", $this->stringlength, Utils::PrintAsString($this->truncateHtmlSafe))); |
|
45 | + ZLog::Write(LOGLEVEL_DEBUG, sprintf("StringStreamWrapper::stream_open(): initialized stream length: %d - HTML-safe-truncate: %s", $this->stringlength, Utils::PrintAsString($this->truncateHtmlSafe))); |
|
46 | 46 | |
47 | 47 | return true; |
48 | 48 | } |
@@ -67,9 +67,9 @@ discard block |
||
67 | 67 | * @param string $data |
68 | 68 | * @return int |
69 | 69 | */ |
70 | - public function stream_write($data){ |
|
70 | + public function stream_write($data) { |
|
71 | 71 | $l = strlen($data); |
72 | - $this->stringstream = substr($this->stringstream, 0, $this->position) . $data . substr($this->stringstream, $this->position += $l); |
|
72 | + $this->stringstream = substr($this->stringstream, 0, $this->position).$data.substr($this->stringstream, $this->position += $l); |
|
73 | 73 | $this->stringlength = strlen($this->stringstream); |
74 | 74 | return $l; |
75 | 75 | } |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | * @param int $new_size |
121 | 121 | * @return boolean |
122 | 122 | */ |
123 | - public function stream_truncate ($new_size) { |
|
123 | + public function stream_truncate($new_size) { |
|
124 | 124 | // cut the string! |
125 | 125 | $this->stringstream = Utils::Utf8_truncate($this->stringstream, $new_size, $this->truncateHtmlSafe); |
126 | 126 | $this->stringlength = strlen($this->stringstream); |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | */ |
157 | 157 | static public function Open($string, $truncatehtmlsafe = false) { |
158 | 158 | $context = stream_context_create(array(self::PROTOCOL => array('string' => &$string, 'truncatehtmlsafe' => $truncatehtmlsafe))); |
159 | - return fopen(self::PROTOCOL . "://",'r', false, $context); |
|
159 | + return fopen(self::PROTOCOL."://", 'r', false, $context); |
|
160 | 160 | } |
161 | 161 | } |
162 | 162 |
@@ -256,7 +256,7 @@ discard block |
||
256 | 256 | |
257 | 257 | // First check there's a colon at all: |
258 | 258 | if (strpos($string, ':') === false) { |
259 | - $this->error = 'Invalid address: ' . $string; |
|
259 | + $this->error = 'Invalid address: '.$string; |
|
260 | 260 | return false; |
261 | 261 | } |
262 | 262 | |
@@ -283,7 +283,7 @@ discard block |
||
283 | 283 | // If the next char is a comma and this was a group, then |
284 | 284 | // there are more addresses, otherwise, if there are any more |
285 | 285 | // chars, then there is another address. |
286 | - if ($is_group && substr($address, 0, 1) == ','){ |
|
286 | + if ($is_group && substr($address, 0, 1) == ',') { |
|
287 | 287 | $address = trim(substr($address, 1)); |
288 | 288 | return $address; |
289 | 289 | |
@@ -339,7 +339,7 @@ discard block |
||
339 | 339 | || $this->_hasUnclosedBrackets($string, '()') |
340 | 340 | || substr($string, -1) == '\\') { |
341 | 341 | if (isset($parts[$i + 1])) { |
342 | - $string = $string . $char . $parts[$i + 1]; |
|
342 | + $string = $string.$char.$parts[$i + 1]; |
|
343 | 343 | } else { |
344 | 344 | $this->error = 'Invalid address spec. Unclosed bracket or quotes'; |
345 | 345 | return false; |
@@ -405,7 +405,7 @@ discard block |
||
405 | 405 | $this->_hasUnclosedBracketsSub($string, $num_angle_end, $chars[1]); |
406 | 406 | |
407 | 407 | if ($num_angle_start < $num_angle_end) { |
408 | - $this->error = 'Invalid address spec. Unmatched quote or bracket (' . $chars . ')'; |
|
408 | + $this->error = 'Invalid address spec. Unmatched quote or bracket ('.$chars.')'; |
|
409 | 409 | return false; |
410 | 410 | } else { |
411 | 411 | return ($num_angle_start > $num_angle_end); |
@@ -423,11 +423,11 @@ discard block |
||
423 | 423 | protected function _hasUnclosedBracketsSub($string, &$num, $char) |
424 | 424 | { |
425 | 425 | $parts = explode($char, $string); |
426 | - for ($i = 0; $i < count($parts); $i++){ |
|
426 | + for ($i = 0; $i < count($parts); $i++) { |
|
427 | 427 | if (substr($parts[$i], -1) == '\\' || $this->_hasUnclosedQuotes($parts[$i])) |
428 | 428 | $num--; |
429 | 429 | if (isset($parts[$i + 1])) |
430 | - $parts[$i + 1] = $parts[$i] . $char . $parts[$i + 1]; |
|
430 | + $parts[$i + 1] = $parts[$i].$char.$parts[$i + 1]; |
|
431 | 431 | } |
432 | 432 | |
433 | 433 | return $num; |
@@ -453,7 +453,7 @@ discard block |
||
453 | 453 | $structure = array(); |
454 | 454 | |
455 | 455 | // And validate the group part of the name. |
456 | - if (!$this->_validatePhrase($groupname)){ |
|
456 | + if (!$this->_validatePhrase($groupname)) { |
|
457 | 457 | $this->error = 'Group name did not validate.'; |
458 | 458 | return false; |
459 | 459 | } else { |
@@ -465,7 +465,7 @@ discard block |
||
465 | 465 | } |
466 | 466 | } |
467 | 467 | |
468 | - $address['address'] = ltrim(substr($address['address'], strlen($groupname . ':'))); |
|
468 | + $address['address'] = ltrim(substr($address['address'], strlen($groupname.':'))); |
|
469 | 469 | } |
470 | 470 | |
471 | 471 | // If a group then split on comma and put into an array. |
@@ -474,7 +474,7 @@ discard block |
||
474 | 474 | while (strlen($address['address']) > 0) { |
475 | 475 | $parts = explode(',', $address['address']); |
476 | 476 | $addresses[] = $this->_splitCheck($parts, ','); |
477 | - $address['address'] = trim(substr($address['address'], strlen(end($addresses) . ','))); |
|
477 | + $address['address'] = trim(substr($address['address'], strlen(end($addresses).','))); |
|
478 | 478 | } |
479 | 479 | } else { |
480 | 480 | $addresses[] = $address['address']; |
@@ -491,7 +491,7 @@ discard block |
||
491 | 491 | for ($i = 0; $i < count($addresses); $i++) { |
492 | 492 | if (!$this->validateMailbox($addresses[$i])) { |
493 | 493 | if (empty($this->error)) { |
494 | - $this->error = 'Validation failed for: ' . $addresses[$i]; |
|
494 | + $this->error = 'Validation failed for: '.$addresses[$i]; |
|
495 | 495 | } |
496 | 496 | return false; |
497 | 497 | } |
@@ -529,7 +529,7 @@ discard block |
||
529 | 529 | $parts = preg_split('/[ \\x09]+/', $phrase, -1, PREG_SPLIT_NO_EMPTY); |
530 | 530 | |
531 | 531 | $phrase_parts = array(); |
532 | - while (count($parts) > 0){ |
|
532 | + while (count($parts) > 0) { |
|
533 | 533 | $phrase_parts[] = $this->_splitCheck($parts, ' '); |
534 | 534 | for ($i = 0; $i < $this->index + 1; $i++) |
535 | 535 | array_shift($parts); |
@@ -632,7 +632,7 @@ discard block |
||
632 | 632 | $comments[] = $comment; |
633 | 633 | |
634 | 634 | // +2 is for the brackets |
635 | - $_mailbox = substr($_mailbox, strpos($_mailbox, '('.$comment)+strlen($comment)+2); |
|
635 | + $_mailbox = substr($_mailbox, strpos($_mailbox, '('.$comment) + strlen($comment) + 2); |
|
636 | 636 | } else { |
637 | 637 | break; |
638 | 638 | } |
@@ -717,7 +717,7 @@ discard block |
||
717 | 717 | |
718 | 718 | // If $route is same as $route_addr then the colon was in |
719 | 719 | // quotes or brackets or, of course, non existent. |
720 | - if ($route === $route_addr){ |
|
720 | + if ($route === $route_addr) { |
|
721 | 721 | unset($route); |
722 | 722 | $addr_spec = $route_addr; |
723 | 723 | if (($addr_spec = $this->_validateAddrSpec($addr_spec)) === false) { |
@@ -729,7 +729,7 @@ discard block |
||
729 | 729 | return false; |
730 | 730 | } |
731 | 731 | |
732 | - $addr_spec = substr($route_addr, strlen($route . ':')); |
|
732 | + $addr_spec = substr($route_addr, strlen($route.':')); |
|
733 | 733 | |
734 | 734 | // Validate addr-spec part. |
735 | 735 | if (($addr_spec = $this->_validateAddrSpec($addr_spec)) === false) { |
@@ -805,7 +805,7 @@ discard block |
||
805 | 805 | */ |
806 | 806 | protected function _validateSubdomain($subdomain) |
807 | 807 | { |
808 | - if (preg_match('|^\[(.*)]$|', $subdomain, $arr)){ |
|
808 | + if (preg_match('|^\[(.*)]$|', $subdomain, $arr)) { |
|
809 | 809 | if (!$this->_validateDliteral($arr[1])) return false; |
810 | 810 | } else { |
811 | 811 | if (!$this->_validateAtom($subdomain)) return false; |
@@ -824,7 +824,7 @@ discard block |
||
824 | 824 | */ |
825 | 825 | protected function _validateDliteral($dliteral) |
826 | 826 | { |
827 | - return !preg_match('/(.)[][\x0D\\\\]/', $dliteral, $matches) && ((! isset($matches[1])) || $matches[1] != '\\'); |
|
827 | + return !preg_match('/(.)[][\x0D\\\\]/', $dliteral, $matches) && ((!isset($matches[1])) || $matches[1] != '\\'); |
|
828 | 828 | } |
829 | 829 | |
830 | 830 | /** |
@@ -843,7 +843,7 @@ discard block |
||
843 | 843 | if (strpos($addr_spec, '@') !== false) { |
844 | 844 | $parts = explode('@', $addr_spec); |
845 | 845 | $local_part = $this->_splitCheck($parts, '@'); |
846 | - $domain = substr($addr_spec, strlen($local_part . '@')); |
|
846 | + $domain = substr($addr_spec, strlen($local_part.'@')); |
|
847 | 847 | |
848 | 848 | // No @ sign so assume the default domain. |
849 | 849 | } else { |
@@ -943,7 +943,7 @@ discard block |
||
943 | 943 | * @access private |
944 | 944 | */ |
945 | 945 | function raiseError($message) { |
946 | - ZLog::Write(LOGLEVEL_ERROR, "z_RFC822 error: ". $message); |
|
946 | + ZLog::Write(LOGLEVEL_ERROR, "z_RFC822 error: ".$message); |
|
947 | 947 | return false; |
948 | 948 | } |
949 | 949 | } |
@@ -84,12 +84,12 @@ |
||
84 | 84 | case 504: $text = 'Gateway Time-out'; break; |
85 | 85 | case 505: $text = 'HTTP Version not supported'; break; |
86 | 86 | default: |
87 | - exit('Unknown http status code "' . htmlentities($code) . '"'); |
|
87 | + exit('Unknown http status code "'.htmlentities($code).'"'); |
|
88 | 88 | break; |
89 | 89 | } |
90 | 90 | |
91 | 91 | $protocol = (isset($_SERVER['SERVER_PROTOCOL']) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0'); |
92 | - header($protocol . ' ' . $code . ' ' . $text); |
|
92 | + header($protocol.' '.$code.' '.$text); |
|
93 | 93 | |
94 | 94 | $GLOBALS['http_response_code'] = $code; |
95 | 95 | } else { |