@@ -109,31 +109,31 @@ discard block |
||
109 | 109 | self::CLASS_OTHERTYPES => array(SYNC_FOLDER_TYPE_OTHER, SYNC_FOLDER_TYPE_DRAFTS, SYNC_FOLDER_TYPE_WASTEBASKET, |
110 | 110 | SYNC_FOLDER_TYPE_SENTMAIL, SYNC_FOLDER_TYPE_OUTBOX, SYNC_FOLDER_TYPE_USER_MAIL, |
111 | 111 | SYNC_FOLDER_TYPE_JOURNAL, SYNC_FOLDER_TYPE_USER_JOURNAL), |
112 | - ), |
|
112 | + ), |
|
113 | 113 | "Contacts" => array( |
114 | 114 | self::CLASS_NAME => "SyncContact", |
115 | 115 | self::CLASS_REQUIRESPROTOCOLVERSION => true, |
116 | 116 | self::CLASS_DEFAULTTYPE => SYNC_FOLDER_TYPE_CONTACT, |
117 | 117 | self::CLASS_OTHERTYPES => array(SYNC_FOLDER_TYPE_USER_CONTACT, SYNC_FOLDER_TYPE_UNKNOWN), |
118 | - ), |
|
118 | + ), |
|
119 | 119 | "Calendar" => array( |
120 | 120 | self::CLASS_NAME => "SyncAppointment", |
121 | 121 | self::CLASS_REQUIRESPROTOCOLVERSION => false, |
122 | 122 | self::CLASS_DEFAULTTYPE => SYNC_FOLDER_TYPE_APPOINTMENT, |
123 | 123 | self::CLASS_OTHERTYPES => array(SYNC_FOLDER_TYPE_USER_APPOINTMENT), |
124 | - ), |
|
124 | + ), |
|
125 | 125 | "Tasks" => array( |
126 | 126 | self::CLASS_NAME => "SyncTask", |
127 | 127 | self::CLASS_REQUIRESPROTOCOLVERSION => false, |
128 | 128 | self::CLASS_DEFAULTTYPE => SYNC_FOLDER_TYPE_TASK, |
129 | 129 | self::CLASS_OTHERTYPES => array(SYNC_FOLDER_TYPE_USER_TASK), |
130 | - ), |
|
130 | + ), |
|
131 | 131 | "Notes" => array( |
132 | 132 | self::CLASS_NAME => "SyncNote", |
133 | 133 | self::CLASS_REQUIRESPROTOCOLVERSION => false, |
134 | 134 | self::CLASS_DEFAULTTYPE => SYNC_FOLDER_TYPE_NOTE, |
135 | 135 | self::CLASS_OTHERTYPES => array(SYNC_FOLDER_TYPE_USER_NOTE), |
136 | - ), |
|
136 | + ), |
|
137 | 137 | ); |
138 | 138 | |
139 | 139 | |
@@ -435,7 +435,6 @@ discard block |
||
435 | 435 | * Loads a backend file |
436 | 436 | * |
437 | 437 | * @param string $backendname |
438 | - |
|
439 | 438 | * @access public |
440 | 439 | * @throws FatalNotImplementedException |
441 | 440 | * @return boolean |
@@ -636,7 +635,6 @@ discard block |
||
636 | 635 | * |
637 | 636 | * @param string $message (opt) message to be displayed |
638 | 637 | * @param string $additionalMessage (opt) additional message to be displayed |
639 | - |
|
640 | 638 | * @access public |
641 | 639 | * @return |
642 | 640 | * |
@@ -786,7 +784,6 @@ discard block |
||
786 | 784 | * Indicates if the Provisioning check has to be forced on these commands |
787 | 785 | * |
788 | 786 | * @param string $commandCode |
789 | - |
|
790 | 787 | * @access public |
791 | 788 | * @return boolean |
792 | 789 | */ |
@@ -814,7 +811,6 @@ discard block |
||
814 | 811 | * Indicates if the command to be executed operates on the hierarchy |
815 | 812 | * |
816 | 813 | * @param int $commandCode |
817 | - |
|
818 | 814 | * @access public |
819 | 815 | * @return boolean |
820 | 816 | */ |
@@ -829,7 +825,6 @@ discard block |
||
829 | 825 | * |
830 | 826 | * @param string $commandCode a commandCode |
831 | 827 | * @param string $option e.g. self::UNAUTHENTICATED |
832 | - |
|
833 | 828 | * @access private |
834 | 829 | * @throws FatalNotImplementedException |
835 | 830 | * @return object StateMachine |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | const UNAUTHENTICATED = 1; |
12 | 12 | const UNPROVISIONED = 2; |
13 | 13 | const NOACTIVESYNCCOMMAND = 3; |
14 | - const WEBSERVICECOMMAND = 4; // DEPRECATED |
|
14 | + const WEBSERVICECOMMAND = 4; // DEPRECATED |
|
15 | 15 | const HIERARCHYCOMMAND = 5; |
16 | 16 | const PLAININPUT = 6; |
17 | 17 | const REQUESTHANDLER = 7; |
@@ -73,28 +73,28 @@ discard block |
||
73 | 73 | |
74 | 74 | static private $supportedCommands = array( |
75 | 75 | // COMMAND // AS VERSION // REQUESTHANDLER // OTHER SETTINGS |
76 | - self::COMMAND_SYNC => array(self::ASV_1, self::REQUESTHANDLER => "Sync"), |
|
77 | - self::COMMAND_SENDMAIL => array(self::ASV_1, self::REQUESTHANDLER => "SendMail"), |
|
78 | - self::COMMAND_SMARTFORWARD => array(self::ASV_1, self::REQUESTHANDLER => "SendMail"), |
|
79 | - self::COMMAND_SMARTREPLY => array(self::ASV_1, self::REQUESTHANDLER => "SendMail"), |
|
80 | - self::COMMAND_GETATTACHMENT => array(self::ASV_1, self::REQUESTHANDLER => "GetAttachment"), |
|
81 | - self::COMMAND_GETHIERARCHY => array(self::ASV_1, self::REQUESTHANDLER => "GetHierarchy", self::HIERARCHYCOMMAND), // deprecated but implemented |
|
82 | - self::COMMAND_CREATECOLLECTION => array(self::ASV_1), // deprecated & not implemented |
|
83 | - self::COMMAND_DELETECOLLECTION => array(self::ASV_1), // deprecated & not implemented |
|
84 | - self::COMMAND_MOVECOLLECTION => array(self::ASV_1), // deprecated & not implemented |
|
85 | - self::COMMAND_FOLDERSYNC => array(self::ASV_2, self::REQUESTHANDLER => "FolderSync", self::HIERARCHYCOMMAND), |
|
86 | - self::COMMAND_FOLDERCREATE => array(self::ASV_2, self::REQUESTHANDLER => "FolderChange", self::HIERARCHYCOMMAND), |
|
87 | - self::COMMAND_FOLDERDELETE => array(self::ASV_2, self::REQUESTHANDLER => "FolderChange", self::HIERARCHYCOMMAND), |
|
88 | - self::COMMAND_FOLDERUPDATE => array(self::ASV_2, self::REQUESTHANDLER => "FolderChange", self::HIERARCHYCOMMAND), |
|
89 | - self::COMMAND_MOVEITEMS => array(self::ASV_1, self::REQUESTHANDLER => "MoveItems"), |
|
90 | - self::COMMAND_GETITEMESTIMATE => array(self::ASV_1, self::REQUESTHANDLER => "GetItemEstimate"), |
|
91 | - self::COMMAND_MEETINGRESPONSE => array(self::ASV_1, self::REQUESTHANDLER => "MeetingResponse"), |
|
92 | - self::COMMAND_RESOLVERECIPIENTS => array(self::ASV_1, self::REQUESTHANDLER => "ResolveRecipients"), |
|
93 | - self::COMMAND_VALIDATECERT => array(self::ASV_1, self::REQUESTHANDLER => "ValidateCert"), |
|
94 | - self::COMMAND_PROVISION => array(self::ASV_25, self::REQUESTHANDLER => "Provisioning", self::UNAUTHENTICATED, self::UNPROVISIONED), |
|
95 | - self::COMMAND_SEARCH => array(self::ASV_1, self::REQUESTHANDLER => "Search"), |
|
96 | - self::COMMAND_PING => array(self::ASV_2, self::REQUESTHANDLER => "Ping", self::UNPROVISIONED), |
|
97 | - self::COMMAND_NOTIFY => array(self::ASV_1, self::REQUESTHANDLER => "Notify"), // deprecated & not implemented |
|
76 | + self::COMMAND_SYNC => array(self::ASV_1, self::REQUESTHANDLER => "Sync"), |
|
77 | + self::COMMAND_SENDMAIL => array(self::ASV_1, self::REQUESTHANDLER => "SendMail"), |
|
78 | + self::COMMAND_SMARTFORWARD => array(self::ASV_1, self::REQUESTHANDLER => "SendMail"), |
|
79 | + self::COMMAND_SMARTREPLY => array(self::ASV_1, self::REQUESTHANDLER => "SendMail"), |
|
80 | + self::COMMAND_GETATTACHMENT => array(self::ASV_1, self::REQUESTHANDLER => "GetAttachment"), |
|
81 | + self::COMMAND_GETHIERARCHY => array(self::ASV_1, self::REQUESTHANDLER => "GetHierarchy", self::HIERARCHYCOMMAND), // deprecated but implemented |
|
82 | + self::COMMAND_CREATECOLLECTION => array(self::ASV_1), // deprecated & not implemented |
|
83 | + self::COMMAND_DELETECOLLECTION => array(self::ASV_1), // deprecated & not implemented |
|
84 | + self::COMMAND_MOVECOLLECTION => array(self::ASV_1), // deprecated & not implemented |
|
85 | + self::COMMAND_FOLDERSYNC => array(self::ASV_2, self::REQUESTHANDLER => "FolderSync", self::HIERARCHYCOMMAND), |
|
86 | + self::COMMAND_FOLDERCREATE => array(self::ASV_2, self::REQUESTHANDLER => "FolderChange", self::HIERARCHYCOMMAND), |
|
87 | + self::COMMAND_FOLDERDELETE => array(self::ASV_2, self::REQUESTHANDLER => "FolderChange", self::HIERARCHYCOMMAND), |
|
88 | + self::COMMAND_FOLDERUPDATE => array(self::ASV_2, self::REQUESTHANDLER => "FolderChange", self::HIERARCHYCOMMAND), |
|
89 | + self::COMMAND_MOVEITEMS => array(self::ASV_1, self::REQUESTHANDLER => "MoveItems"), |
|
90 | + self::COMMAND_GETITEMESTIMATE => array(self::ASV_1, self::REQUESTHANDLER => "GetItemEstimate"), |
|
91 | + self::COMMAND_MEETINGRESPONSE => array(self::ASV_1, self::REQUESTHANDLER => "MeetingResponse"), |
|
92 | + self::COMMAND_RESOLVERECIPIENTS => array(self::ASV_1, self::REQUESTHANDLER => "ResolveRecipients"), |
|
93 | + self::COMMAND_VALIDATECERT => array(self::ASV_1, self::REQUESTHANDLER => "ValidateCert"), |
|
94 | + self::COMMAND_PROVISION => array(self::ASV_25, self::REQUESTHANDLER => "Provisioning", self::UNAUTHENTICATED, self::UNPROVISIONED), |
|
95 | + self::COMMAND_SEARCH => array(self::ASV_1, self::REQUESTHANDLER => "Search"), |
|
96 | + self::COMMAND_PING => array(self::ASV_2, self::REQUESTHANDLER => "Ping", self::UNPROVISIONED), |
|
97 | + self::COMMAND_NOTIFY => array(self::ASV_1, self::REQUESTHANDLER => "Notify"), // deprecated & not implemented |
|
98 | 98 | self::COMMAND_ITEMOPERATIONS => array(self::ASV_12, self::REQUESTHANDLER => "ItemOperations"), |
99 | 99 | self::COMMAND_SETTINGS => array(self::ASV_12, self::REQUESTHANDLER => "Settings"), |
100 | 100 | ); |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | */ |
157 | 157 | static public function CheckConfig() { |
158 | 158 | // check the php version |
159 | - if (version_compare(phpversion(),'5.4.0') < 0) { |
|
159 | + if (version_compare(phpversion(), '5.4.0') < 0) { |
|
160 | 160 | throw new FatalException("The configured PHP version is too old. Please make sure at least PHP 5.4 is used."); |
161 | 161 | } |
162 | 162 | |
@@ -164,7 +164,7 @@ discard block |
||
164 | 164 | if (!defined('BASE_PATH')) |
165 | 165 | throw new FatalMisconfigurationException("The BASE_PATH is not configured. Check if the config.php file is in place."); |
166 | 166 | |
167 | - if (substr(BASE_PATH, -1,1) != "/") |
|
167 | + if (substr(BASE_PATH, -1, 1) != "/") |
|
168 | 168 | throw new FatalMisconfigurationException("The BASE_PATH should terminate with a '/'"); |
169 | 169 | |
170 | 170 | if (!file_exists(BASE_PATH)) |
@@ -210,7 +210,7 @@ discard block |
||
210 | 210 | if (!defined('LOGFILEDIR')) |
211 | 211 | throw new FatalMisconfigurationException("The LOGFILEDIR is not configured. Check if the config.php file is in place."); |
212 | 212 | |
213 | - if (substr(LOGFILEDIR, -1,1) != "/") |
|
213 | + if (substr(LOGFILEDIR, -1, 1) != "/") |
|
214 | 214 | throw new FatalMisconfigurationException("The LOGFILEDIR should terminate with a '/'"); |
215 | 215 | |
216 | 216 | if (!file_exists(LOGFILEDIR)) |
@@ -232,11 +232,11 @@ discard block |
||
232 | 232 | |
233 | 233 | // set time zone |
234 | 234 | // code contributed by Robert Scheck (rsc) |
235 | - if(defined('TIMEZONE') ? constant('TIMEZONE') : false) { |
|
236 | - if (! @date_default_timezone_set(TIMEZONE)) |
|
235 | + if (defined('TIMEZONE') ? constant('TIMEZONE') : false) { |
|
236 | + if (!@date_default_timezone_set(TIMEZONE)) |
|
237 | 237 | throw new FatalMisconfigurationException(sprintf("The configured TIMEZONE '%s' is not valid. Please check supported timezones at http://www.php.net/manual/en/timezones.php", constant('TIMEZONE'))); |
238 | 238 | } |
239 | - else if(!ini_get('date.timezone')) { |
|
239 | + else if (!ini_get('date.timezone')) { |
|
240 | 240 | date_default_timezone_set('Europe/Vienna'); |
241 | 241 | } |
242 | 242 | |
@@ -283,23 +283,23 @@ discard block |
||
283 | 283 | if (!defined('PING_LOWER_BOUND_LIFETIME')) { |
284 | 284 | define('PING_LOWER_BOUND_LIFETIME', false); |
285 | 285 | } |
286 | - elseif(PING_LOWER_BOUND_LIFETIME !== false && (!is_int(PING_LOWER_BOUND_LIFETIME) || PING_LOWER_BOUND_LIFETIME < 1 || PING_LOWER_BOUND_LIFETIME > 3540)){ |
|
286 | + elseif (PING_LOWER_BOUND_LIFETIME !== false && (!is_int(PING_LOWER_BOUND_LIFETIME) || PING_LOWER_BOUND_LIFETIME < 1 || PING_LOWER_BOUND_LIFETIME > 3540)) { |
|
287 | 287 | throw new FatalMisconfigurationException("The PING_LOWER_BOUND_LIFETIME value must be 'false' or a number between 1 and 3540 inclusively."); |
288 | 288 | } |
289 | 289 | if (!defined('PING_HIGHER_BOUND_LIFETIME')) { |
290 | 290 | define('PING_HIGHER_BOUND_LIFETIME', false); |
291 | 291 | } |
292 | - elseif(PING_HIGHER_BOUND_LIFETIME !== false && (!is_int(PING_HIGHER_BOUND_LIFETIME) || PING_HIGHER_BOUND_LIFETIME < 1 || PING_HIGHER_BOUND_LIFETIME > 3540)){ |
|
292 | + elseif (PING_HIGHER_BOUND_LIFETIME !== false && (!is_int(PING_HIGHER_BOUND_LIFETIME) || PING_HIGHER_BOUND_LIFETIME < 1 || PING_HIGHER_BOUND_LIFETIME > 3540)) { |
|
293 | 293 | throw new FatalMisconfigurationException("The PING_HIGHER_BOUND_LIFETIME value must be 'false' or a number between 1 and 3540 inclusively."); |
294 | 294 | } |
295 | - if(PING_HIGHER_BOUND_LIFETIME !== false && PING_LOWER_BOUND_LIFETIME !== false && PING_HIGHER_BOUND_LIFETIME < PING_LOWER_BOUND_LIFETIME){ |
|
295 | + if (PING_HIGHER_BOUND_LIFETIME !== false && PING_LOWER_BOUND_LIFETIME !== false && PING_HIGHER_BOUND_LIFETIME < PING_LOWER_BOUND_LIFETIME) { |
|
296 | 296 | throw new FatalMisconfigurationException("The PING_HIGHER_BOUND_LIFETIME value must be greater or equal to PING_LOWER_BOUND_LIFETIME."); |
297 | 297 | } |
298 | 298 | |
299 | 299 | if (!defined('RETRY_AFTER_DELAY')) { |
300 | 300 | define('RETRY_AFTER_DELAY', 300); |
301 | 301 | } |
302 | - elseif (RETRY_AFTER_DELAY !== false && (!is_int(RETRY_AFTER_DELAY) || RETRY_AFTER_DELAY < 1)) { |
|
302 | + elseif (RETRY_AFTER_DELAY !== false && (!is_int(RETRY_AFTER_DELAY) || RETRY_AFTER_DELAY < 1)) { |
|
303 | 303 | throw new FatalMisconfigurationException("The RETRY_AFTER_DELAY value must be 'false' or a number greater than 0."); |
304 | 304 | } |
305 | 305 | |
@@ -445,12 +445,12 @@ discard block |
||
445 | 445 | |
446 | 446 | $backendname = strtolower($backendname); |
447 | 447 | if (substr($backendname, 0, 7) !== 'backend') |
448 | - throw new FatalNotImplementedException(sprintf("Backend '%s' is not allowed",$backendname)); |
|
448 | + throw new FatalNotImplementedException(sprintf("Backend '%s' is not allowed", $backendname)); |
|
449 | 449 | |
450 | 450 | $rbn = substr($backendname, 7); |
451 | 451 | |
452 | - $subdirbackend = REAL_BASE_PATH . "backend/" . $rbn . "/" . $rbn . ".php"; |
|
453 | - $stdbackend = REAL_BASE_PATH . "backend/" . $rbn . ".php"; |
|
452 | + $subdirbackend = REAL_BASE_PATH."backend/".$rbn."/".$rbn.".php"; |
|
453 | + $stdbackend = REAL_BASE_PATH."backend/".$rbn.".php"; |
|
454 | 454 | |
455 | 455 | if (is_file($subdirbackend)) |
456 | 456 | $toLoad = $subdirbackend; |
@@ -516,7 +516,7 @@ discard block |
||
516 | 516 | * @return string |
517 | 517 | */ |
518 | 518 | static public function GetAdditionalSyncFolderStore($backendid, $noDebug = false) { |
519 | - if(isset(self::getAddSyncFolders()[$backendid]->Store)) { |
|
519 | + if (isset(self::getAddSyncFolders()[$backendid]->Store)) { |
|
520 | 520 | $val = self::getAddSyncFolders()[$backendid]->Store; |
521 | 521 | } |
522 | 522 | else { |
@@ -642,10 +642,10 @@ discard block |
||
642 | 642 | * |
643 | 643 | */ |
644 | 644 | static public function PrintGrommunioSyncLegal($message = "", $additionalMessage = "") { |
645 | - ZLog::Write(LOGLEVEL_DEBUG,"ZPush::PrintGrommunioSyncLegal()"); |
|
645 | + ZLog::Write(LOGLEVEL_DEBUG, "ZPush::PrintGrommunioSyncLegal()"); |
|
646 | 646 | |
647 | 647 | if ($message) |
648 | - $message = "<h3>". $message . "</h3>"; |
|
648 | + $message = "<h3>".$message."</h3>"; |
|
649 | 649 | if ($additionalMessage) |
650 | 650 | $additionalMessage .= "<br>"; |
651 | 651 | |
@@ -703,7 +703,7 @@ discard block |
||
703 | 703 | if (self::GetSupportedASVersion() == self::ASV_25) |
704 | 704 | return "MS-Server-ActiveSync: 6.5.7638.1"; |
705 | 705 | else |
706 | - return "MS-Server-ActiveSync: ". self::GetSupportedASVersion(); |
|
706 | + return "MS-Server-ActiveSync: ".self::GetSupportedASVersion(); |
|
707 | 707 | } |
708 | 708 | |
709 | 709 | /** |
@@ -715,13 +715,13 @@ discard block |
||
715 | 715 | * @return string |
716 | 716 | */ |
717 | 717 | static public function GetSupportedProtocolVersions($valueOnly = false) { |
718 | - $versions = implode(',', array_slice(self::$supportedASVersions, 0, (array_search(self::GetSupportedASVersion(), self::$supportedASVersions)+1))); |
|
719 | - ZLog::Write(LOGLEVEL_DEBUG, "ZPush::GetSupportedProtocolVersions(): " . $versions); |
|
718 | + $versions = implode(',', array_slice(self::$supportedASVersions, 0, (array_search(self::GetSupportedASVersion(), self::$supportedASVersions) + 1))); |
|
719 | + ZLog::Write(LOGLEVEL_DEBUG, "ZPush::GetSupportedProtocolVersions(): ".$versions); |
|
720 | 720 | |
721 | 721 | if ($valueOnly === true) |
722 | 722 | return $versions; |
723 | 723 | |
724 | - return "MS-ASProtocolVersions: " . $versions; |
|
724 | + return "MS-ASProtocolVersions: ".$versions; |
|
725 | 725 | } |
726 | 726 | |
727 | 727 | /** |
@@ -739,8 +739,8 @@ discard block |
||
739 | 739 | $asCommands[] = Utils::GetCommandFromCode($c); |
740 | 740 | |
741 | 741 | $commands = implode(',', $asCommands); |
742 | - ZLog::Write(LOGLEVEL_DEBUG, "ZPush::GetSupportedCommands(): " . $commands); |
|
743 | - return "MS-ASProtocolCommands: " . $commands; |
|
742 | + ZLog::Write(LOGLEVEL_DEBUG, "ZPush::GetSupportedCommands(): ".$commands); |
|
743 | + return "MS-ASProtocolCommands: ".$commands; |
|
744 | 744 | } |
745 | 745 | |
746 | 746 | /** |
@@ -753,11 +753,11 @@ discard block |
||
753 | 753 | */ |
754 | 754 | static public function GetRequestHandlerForCommand($commandCode) { |
755 | 755 | if (!array_key_exists($commandCode, self::$supportedCommands) || |
756 | - !array_key_exists(self::REQUESTHANDLER, self::$supportedCommands[$commandCode]) ) |
|
756 | + !array_key_exists(self::REQUESTHANDLER, self::$supportedCommands[$commandCode])) |
|
757 | 757 | throw new FatalNotImplementedException(sprintf("Command '%s' has no request handler or class", Utils::GetCommandFromCode($commandCode))); |
758 | 758 | |
759 | 759 | $class = self::$supportedCommands[$commandCode][self::REQUESTHANDLER]; |
760 | - $handlerclass = REAL_BASE_PATH . "lib/request/" . strtolower($class) . ".php"; |
|
760 | + $handlerclass = REAL_BASE_PATH."lib/request/".strtolower($class).".php"; |
|
761 | 761 | |
762 | 762 | if (is_file($handlerclass)) |
763 | 763 | include($handlerclass); |
@@ -777,7 +777,7 @@ discard block |
||
777 | 777 | * @return boolean |
778 | 778 | */ |
779 | 779 | static public function CommandNeedsAuthentication($commandCode) { |
780 | - $stat = ! self::checkCommandOptions($commandCode, self::UNAUTHENTICATED); |
|
780 | + $stat = !self::checkCommandOptions($commandCode, self::UNAUTHENTICATED); |
|
781 | 781 | ZLog::Write(LOGLEVEL_DEBUG, sprintf("ZPush::CommandNeedsAuthentication(%d): %s", $commandCode, Utils::PrintAsString($stat))); |
782 | 782 | return $stat; |
783 | 783 | } |
@@ -791,7 +791,7 @@ discard block |
||
791 | 791 | * @return boolean |
792 | 792 | */ |
793 | 793 | static public function CommandNeedsProvisioning($commandCode) { |
794 | - $stat = ! self::checkCommandOptions($commandCode, self::UNPROVISIONED); |
|
794 | + $stat = !self::checkCommandOptions($commandCode, self::UNPROVISIONED); |
|
795 | 795 | ZLog::Write(LOGLEVEL_DEBUG, sprintf("ZPush::CommandNeedsProvisioning(%s): %s", $commandCode, Utils::PrintAsString($stat))); |
796 | 796 | return $stat; |
797 | 797 | } |
@@ -161,19 +161,23 @@ discard block |
||
161 | 161 | } |
162 | 162 | |
163 | 163 | // some basic checks |
164 | - if (!defined('BASE_PATH')) |
|
165 | - throw new FatalMisconfigurationException("The BASE_PATH is not configured. Check if the config.php file is in place."); |
|
164 | + if (!defined('BASE_PATH')) { |
|
165 | + throw new FatalMisconfigurationException("The BASE_PATH is not configured. Check if the config.php file is in place."); |
|
166 | + } |
|
166 | 167 | |
167 | - if (substr(BASE_PATH, -1,1) != "/") |
|
168 | - throw new FatalMisconfigurationException("The BASE_PATH should terminate with a '/'"); |
|
168 | + if (substr(BASE_PATH, -1,1) != "/") { |
|
169 | + throw new FatalMisconfigurationException("The BASE_PATH should terminate with a '/'"); |
|
170 | + } |
|
169 | 171 | |
170 | - if (!file_exists(BASE_PATH)) |
|
171 | - throw new FatalMisconfigurationException("The configured BASE_PATH does not exist or can not be accessed."); |
|
172 | + if (!file_exists(BASE_PATH)) { |
|
173 | + throw new FatalMisconfigurationException("The configured BASE_PATH does not exist or can not be accessed."); |
|
174 | + } |
|
172 | 175 | |
173 | - if (defined('BASE_PATH_CLI') && file_exists(BASE_PATH_CLI)) |
|
174 | - define('REAL_BASE_PATH', BASE_PATH_CLI); |
|
175 | - else |
|
176 | - define('REAL_BASE_PATH', BASE_PATH); |
|
176 | + if (defined('BASE_PATH_CLI') && file_exists(BASE_PATH_CLI)) { |
|
177 | + define('REAL_BASE_PATH', BASE_PATH_CLI); |
|
178 | + } else { |
|
179 | + define('REAL_BASE_PATH', BASE_PATH); |
|
180 | + } |
|
177 | 181 | |
178 | 182 | if (!defined('LOGBACKEND')) { |
179 | 183 | define('LOGBACKEND', 'filelog'); |
@@ -204,39 +208,42 @@ discard block |
||
204 | 208 | if (LOG_SYSLOG_HOST && LOG_SYSLOG_PORT <= 0) { |
205 | 209 | throw new FatalMisconfigurationException("LOG_SYSLOG_HOST is defined but the LOG_SYSLOG_PORT does not seem to be valid."); |
206 | 210 | } |
207 | - } |
|
208 | - elseif (strtolower(LOGBACKEND) == 'filelog') { |
|
211 | + } elseif (strtolower(LOGBACKEND) == 'filelog') { |
|
209 | 212 | define('LOGBACKEND_CLASS', 'FileLog'); |
210 | - if (!defined('LOGFILEDIR')) |
|
211 | - throw new FatalMisconfigurationException("The LOGFILEDIR is not configured. Check if the config.php file is in place."); |
|
213 | + if (!defined('LOGFILEDIR')) { |
|
214 | + throw new FatalMisconfigurationException("The LOGFILEDIR is not configured. Check if the config.php file is in place."); |
|
215 | + } |
|
212 | 216 | |
213 | - if (substr(LOGFILEDIR, -1,1) != "/") |
|
214 | - throw new FatalMisconfigurationException("The LOGFILEDIR should terminate with a '/'"); |
|
217 | + if (substr(LOGFILEDIR, -1,1) != "/") { |
|
218 | + throw new FatalMisconfigurationException("The LOGFILEDIR should terminate with a '/'"); |
|
219 | + } |
|
215 | 220 | |
216 | - if (!file_exists(LOGFILEDIR)) |
|
217 | - throw new FatalMisconfigurationException("The configured LOGFILEDIR does not exist or can not be accessed."); |
|
221 | + if (!file_exists(LOGFILEDIR)) { |
|
222 | + throw new FatalMisconfigurationException("The configured LOGFILEDIR does not exist or can not be accessed."); |
|
223 | + } |
|
218 | 224 | |
219 | - if ((!file_exists(LOGFILE) && !touch(LOGFILE)) || !is_writable(LOGFILE)) |
|
220 | - throw new FatalMisconfigurationException("The configured LOGFILE can not be modified."); |
|
225 | + if ((!file_exists(LOGFILE) && !touch(LOGFILE)) || !is_writable(LOGFILE)) { |
|
226 | + throw new FatalMisconfigurationException("The configured LOGFILE can not be modified."); |
|
227 | + } |
|
221 | 228 | |
222 | - if ((!file_exists(LOGERRORFILE) && !touch(LOGERRORFILE)) || !is_writable(LOGERRORFILE)) |
|
223 | - throw new FatalMisconfigurationException("The configured LOGERRORFILE can not be modified."); |
|
229 | + if ((!file_exists(LOGERRORFILE) && !touch(LOGERRORFILE)) || !is_writable(LOGERRORFILE)) { |
|
230 | + throw new FatalMisconfigurationException("The configured LOGERRORFILE can not be modified."); |
|
231 | + } |
|
224 | 232 | |
225 | 233 | // check ownership on the (eventually) just created files |
226 | 234 | Utils::FixFileOwner(LOGFILE); |
227 | 235 | Utils::FixFileOwner(LOGERRORFILE); |
228 | - } |
|
229 | - else { |
|
236 | + } else { |
|
230 | 237 | define('LOGBACKEND_CLASS', LOGBACKEND); |
231 | 238 | } |
232 | 239 | |
233 | 240 | // set time zone |
234 | 241 | // code contributed by Robert Scheck (rsc) |
235 | 242 | if(defined('TIMEZONE') ? constant('TIMEZONE') : false) { |
236 | - if (! @date_default_timezone_set(TIMEZONE)) |
|
237 | - throw new FatalMisconfigurationException(sprintf("The configured TIMEZONE '%s' is not valid. Please check supported timezones at http://www.php.net/manual/en/timezones.php", constant('TIMEZONE'))); |
|
238 | - } |
|
239 | - else if(!ini_get('date.timezone')) { |
|
243 | + if (! @date_default_timezone_set(TIMEZONE)) { |
|
244 | + throw new FatalMisconfigurationException(sprintf("The configured TIMEZONE '%s' is not valid. Please check supported timezones at http://www.php.net/manual/en/timezones.php", constant('TIMEZONE'))); |
|
245 | + } |
|
246 | + } else if(!ini_get('date.timezone')) { |
|
240 | 247 | date_default_timezone_set('Europe/Vienna'); |
241 | 248 | } |
242 | 249 | |
@@ -267,14 +274,15 @@ discard block |
||
267 | 274 | static public function CheckAdvancedConfig() { |
268 | 275 | global $specialLogUsers, $additionalFolders; |
269 | 276 | |
270 | - if (!is_array($specialLogUsers)) |
|
271 | - throw new FatalMisconfigurationException("The WBXML log users is not an array."); |
|
277 | + if (!is_array($specialLogUsers)) { |
|
278 | + throw new FatalMisconfigurationException("The WBXML log users is not an array."); |
|
279 | + } |
|
272 | 280 | |
273 | 281 | if (!defined('SYNC_CONTACTS_MAXPICTURESIZE')) { |
274 | 282 | define('SYNC_CONTACTS_MAXPICTURESIZE', 49152); |
283 | + } else if ((!is_int(SYNC_CONTACTS_MAXPICTURESIZE) || SYNC_CONTACTS_MAXPICTURESIZE < 1)) { |
|
284 | + throw new FatalMisconfigurationException("The SYNC_CONTACTS_MAXPICTURESIZE value must be a number higher than 0."); |
|
275 | 285 | } |
276 | - else if ((!is_int(SYNC_CONTACTS_MAXPICTURESIZE) || SYNC_CONTACTS_MAXPICTURESIZE < 1)) |
|
277 | - throw new FatalMisconfigurationException("The SYNC_CONTACTS_MAXPICTURESIZE value must be a number higher than 0."); |
|
278 | 286 | |
279 | 287 | if (!defined('USE_PARTIAL_FOLDERSYNC')) { |
280 | 288 | define('USE_PARTIAL_FOLDERSYNC', false); |
@@ -282,14 +290,12 @@ discard block |
||
282 | 290 | |
283 | 291 | if (!defined('PING_LOWER_BOUND_LIFETIME')) { |
284 | 292 | define('PING_LOWER_BOUND_LIFETIME', false); |
285 | - } |
|
286 | - elseif(PING_LOWER_BOUND_LIFETIME !== false && (!is_int(PING_LOWER_BOUND_LIFETIME) || PING_LOWER_BOUND_LIFETIME < 1 || PING_LOWER_BOUND_LIFETIME > 3540)){ |
|
293 | + } elseif(PING_LOWER_BOUND_LIFETIME !== false && (!is_int(PING_LOWER_BOUND_LIFETIME) || PING_LOWER_BOUND_LIFETIME < 1 || PING_LOWER_BOUND_LIFETIME > 3540)){ |
|
287 | 294 | throw new FatalMisconfigurationException("The PING_LOWER_BOUND_LIFETIME value must be 'false' or a number between 1 and 3540 inclusively."); |
288 | 295 | } |
289 | 296 | if (!defined('PING_HIGHER_BOUND_LIFETIME')) { |
290 | 297 | define('PING_HIGHER_BOUND_LIFETIME', false); |
291 | - } |
|
292 | - elseif(PING_HIGHER_BOUND_LIFETIME !== false && (!is_int(PING_HIGHER_BOUND_LIFETIME) || PING_HIGHER_BOUND_LIFETIME < 1 || PING_HIGHER_BOUND_LIFETIME > 3540)){ |
|
298 | + } elseif(PING_HIGHER_BOUND_LIFETIME !== false && (!is_int(PING_HIGHER_BOUND_LIFETIME) || PING_HIGHER_BOUND_LIFETIME < 1 || PING_HIGHER_BOUND_LIFETIME > 3540)){ |
|
293 | 299 | throw new FatalMisconfigurationException("The PING_HIGHER_BOUND_LIFETIME value must be 'false' or a number between 1 and 3540 inclusively."); |
294 | 300 | } |
295 | 301 | if(PING_HIGHER_BOUND_LIFETIME !== false && PING_LOWER_BOUND_LIFETIME !== false && PING_HIGHER_BOUND_LIFETIME < PING_LOWER_BOUND_LIFETIME){ |
@@ -298,8 +304,7 @@ discard block |
||
298 | 304 | |
299 | 305 | if (!defined('RETRY_AFTER_DELAY')) { |
300 | 306 | define('RETRY_AFTER_DELAY', 300); |
301 | - } |
|
302 | - elseif (RETRY_AFTER_DELAY !== false && (!is_int(RETRY_AFTER_DELAY) || RETRY_AFTER_DELAY < 1)) { |
|
307 | + } elseif (RETRY_AFTER_DELAY !== false && (!is_int(RETRY_AFTER_DELAY) || RETRY_AFTER_DELAY < 1)) { |
|
303 | 308 | throw new FatalMisconfigurationException("The RETRY_AFTER_DELAY value must be 'false' or a number greater than 0."); |
304 | 309 | } |
305 | 310 | |
@@ -312,9 +317,9 @@ discard block |
||
312 | 317 | } |
313 | 318 | |
314 | 319 | // the check on additional folders will not throw hard errors, as this is probably changed on live systems |
315 | - if (isset($additionalFolders) && !is_array($additionalFolders)) |
|
316 | - ZLog::Write(LOGLEVEL_ERROR, "ZPush::CheckConfig() : The additional folders synchronization not available as array."); |
|
317 | - else { |
|
320 | + if (isset($additionalFolders) && !is_array($additionalFolders)) { |
|
321 | + ZLog::Write(LOGLEVEL_ERROR, "ZPush::CheckConfig() : The additional folders synchronization not available as array."); |
|
322 | + } else { |
|
318 | 323 | // check configured data |
319 | 324 | foreach ($additionalFolders as $af) { |
320 | 325 | |
@@ -358,7 +363,9 @@ discard block |
||
358 | 363 | ZPush::$stateMachine = self::GetBackend()->GetStateMachine(); |
359 | 364 | |
360 | 365 | if (ZPush::$stateMachine->GetStateVersion() !== ZPush::GetLatestStateVersion()) { |
361 | - if (class_exists("TopCollector")) self::GetTopCollector()->AnnounceInformation("Run migration script!", true); |
|
366 | + if (class_exists("TopCollector")) { |
|
367 | + self::GetTopCollector()->AnnounceInformation("Run migration script!", true); |
|
368 | + } |
|
362 | 369 | throw new ServiceUnavailableException(sprintf("The state version available to the %s is not the latest version - please run the state upgrade script. See release notes for more information.", get_class(ZPush::$stateMachine))); |
363 | 370 | } |
364 | 371 | } |
@@ -373,8 +380,9 @@ discard block |
||
373 | 380 | * @return object Redis |
374 | 381 | */ |
375 | 382 | static public function GetRedis() { |
376 | - if (!isset(ZPush::$redis)) |
|
377 | - ZPush::$redis = new RedisConnection(); |
|
383 | + if (!isset(ZPush::$redis)) { |
|
384 | + ZPush::$redis = new RedisConnection(); |
|
385 | + } |
|
378 | 386 | |
379 | 387 | return ZPush::$redis; |
380 | 388 | } |
@@ -412,8 +420,9 @@ discard block |
||
412 | 420 | * @return object DeviceManager |
413 | 421 | */ |
414 | 422 | static public function GetDeviceManager($initialize = true) { |
415 | - if (!isset(ZPush::$deviceManager) && $initialize) |
|
416 | - ZPush::$deviceManager = new DeviceManager(); |
|
423 | + if (!isset(ZPush::$deviceManager) && $initialize) { |
|
424 | + ZPush::$deviceManager = new DeviceManager(); |
|
425 | + } |
|
417 | 426 | |
418 | 427 | return ZPush::$deviceManager; |
419 | 428 | } |
@@ -425,8 +434,9 @@ discard block |
||
425 | 434 | * @return object TopCollector |
426 | 435 | */ |
427 | 436 | static public function GetTopCollector() { |
428 | - if (!isset(ZPush::$topCollector)) |
|
429 | - ZPush::$topCollector = new TopCollector(); |
|
437 | + if (!isset(ZPush::$topCollector)) { |
|
438 | + ZPush::$topCollector = new TopCollector(); |
|
439 | + } |
|
430 | 440 | |
431 | 441 | return ZPush::$topCollector; |
432 | 442 | } |
@@ -441,23 +451,27 @@ discard block |
||
441 | 451 | * @return boolean |
442 | 452 | */ |
443 | 453 | static public function IncludeBackend($backendname) { |
444 | - if ($backendname == false) return false; |
|
454 | + if ($backendname == false) { |
|
455 | + return false; |
|
456 | + } |
|
445 | 457 | |
446 | 458 | $backendname = strtolower($backendname); |
447 | - if (substr($backendname, 0, 7) !== 'backend') |
|
448 | - throw new FatalNotImplementedException(sprintf("Backend '%s' is not allowed",$backendname)); |
|
459 | + if (substr($backendname, 0, 7) !== 'backend') { |
|
460 | + throw new FatalNotImplementedException(sprintf("Backend '%s' is not allowed",$backendname)); |
|
461 | + } |
|
449 | 462 | |
450 | 463 | $rbn = substr($backendname, 7); |
451 | 464 | |
452 | 465 | $subdirbackend = REAL_BASE_PATH . "backend/" . $rbn . "/" . $rbn . ".php"; |
453 | 466 | $stdbackend = REAL_BASE_PATH . "backend/" . $rbn . ".php"; |
454 | 467 | |
455 | - if (is_file($subdirbackend)) |
|
456 | - $toLoad = $subdirbackend; |
|
457 | - else if (is_file($stdbackend)) |
|
458 | - $toLoad = $stdbackend; |
|
459 | - else |
|
460 | - return false; |
|
468 | + if (is_file($subdirbackend)) { |
|
469 | + $toLoad = $subdirbackend; |
|
470 | + } else if (is_file($stdbackend)) { |
|
471 | + $toLoad = $stdbackend; |
|
472 | + } else { |
|
473 | + return false; |
|
474 | + } |
|
461 | 475 | |
462 | 476 | ZLog::Write(LOGLEVEL_DEBUG, sprintf("Including backend file: '%s'", $toLoad)); |
463 | 477 | return include_once($toLoad); |
@@ -518,16 +532,16 @@ discard block |
||
518 | 532 | static public function GetAdditionalSyncFolderStore($backendid, $noDebug = false) { |
519 | 533 | if(isset(self::getAddSyncFolders()[$backendid]->Store)) { |
520 | 534 | $val = self::getAddSyncFolders()[$backendid]->Store; |
521 | - } |
|
522 | - else { |
|
535 | + } else { |
|
523 | 536 | $val = self::GetDeviceManager()->GetAdditionalUserSyncFolder($backendid); |
524 | 537 | if (isset($val['store'])) { |
525 | 538 | $val = $val['store']; |
526 | 539 | } |
527 | 540 | } |
528 | 541 | |
529 | - if (!$noDebug) |
|
530 | - ZLog::Write(LOGLEVEL_DEBUG, sprintf("ZPush::GetAdditionalSyncFolderStore('%s'): '%s'", $backendid, Utils::PrintAsString($val))); |
|
542 | + if (!$noDebug) { |
|
543 | + ZLog::Write(LOGLEVEL_DEBUG, sprintf("ZPush::GetAdditionalSyncFolderStore('%s'): '%s'", $backendid, Utils::PrintAsString($val))); |
|
544 | + } |
|
531 | 545 | return $val; |
532 | 546 | } |
533 | 547 | |
@@ -541,14 +555,16 @@ discard block |
||
541 | 555 | * @throws FatalNotImplementedException |
542 | 556 | */ |
543 | 557 | static public function getSyncObjectFromFolderClass($folderclass) { |
544 | - if (!isset(self::$classes[$folderclass])) |
|
545 | - throw new FatalNotImplementedException("Class '$folderclass' is not supported"); |
|
558 | + if (!isset(self::$classes[$folderclass])) { |
|
559 | + throw new FatalNotImplementedException("Class '$folderclass' is not supported"); |
|
560 | + } |
|
546 | 561 | |
547 | 562 | $class = self::$classes[$folderclass][self::CLASS_NAME]; |
548 | - if (self::$classes[$folderclass][self::CLASS_REQUIRESPROTOCOLVERSION]) |
|
549 | - return new $class(Request::GetProtocolVersion()); |
|
550 | - else |
|
551 | - return new $class(); |
|
563 | + if (self::$classes[$folderclass][self::CLASS_REQUIRESPROTOCOLVERSION]) { |
|
564 | + return new $class(Request::GetProtocolVersion()); |
|
565 | + } else { |
|
566 | + return new $class(); |
|
567 | + } |
|
552 | 568 | } |
553 | 569 | |
554 | 570 | /** |
@@ -565,8 +581,7 @@ discard block |
||
565 | 581 | |
566 | 582 | if (isset($additionalFolders) && !is_array($additionalFolders)) { |
567 | 583 | ZLog::Write(LOGLEVEL_ERROR, "ZPush::getAddSyncFolders() : The additional folders synchronization not available as array."); |
568 | - } |
|
569 | - else { |
|
584 | + } else { |
|
570 | 585 | foreach ($additionalFolders as $af) { |
571 | 586 | if (!is_array($af) || !isset($af['store']) || !isset($af['folderid']) || !isset($af['name']) || !isset($af['type'])) { |
572 | 587 | ZLog::Write(LOGLEVEL_ERROR, "ZPush::getAddSyncFolders() : the additional folder synchronization is not configured correctly. Missing parameters. Entry will be ignored."); |
@@ -644,10 +659,12 @@ discard block |
||
644 | 659 | static public function PrintGrommunioSyncLegal($message = "", $additionalMessage = "") { |
645 | 660 | ZLog::Write(LOGLEVEL_DEBUG,"ZPush::PrintGrommunioSyncLegal()"); |
646 | 661 | |
647 | - if ($message) |
|
648 | - $message = "<h3>". $message . "</h3>"; |
|
649 | - if ($additionalMessage) |
|
650 | - $additionalMessage .= "<br>"; |
|
662 | + if ($message) { |
|
663 | + $message = "<h3>". $message . "</h3>"; |
|
664 | + } |
|
665 | + if ($additionalMessage) { |
|
666 | + $additionalMessage .= "<br>"; |
|
667 | + } |
|
651 | 668 | |
652 | 669 | header("Content-type: text/html"); |
653 | 670 | print <<<END |
@@ -687,8 +704,9 @@ discard block |
||
687 | 704 | */ |
688 | 705 | static public function GetSupportedASVersion() { |
689 | 706 | $version = self::GetBackend()->GetSupportedASVersion(); |
690 | - if (!in_array($version, self::$supportedASVersions)) |
|
691 | - throw new FatalNotImplementedException(sprintf("AS version '%s' reported by the backend is not supported", $version)); |
|
707 | + if (!in_array($version, self::$supportedASVersions)) { |
|
708 | + throw new FatalNotImplementedException(sprintf("AS version '%s' reported by the backend is not supported", $version)); |
|
709 | + } |
|
692 | 710 | |
693 | 711 | return $version; |
694 | 712 | } |
@@ -700,10 +718,11 @@ discard block |
||
700 | 718 | * @return string |
701 | 719 | */ |
702 | 720 | static public function GetServerHeader() { |
703 | - if (self::GetSupportedASVersion() == self::ASV_25) |
|
704 | - return "MS-Server-ActiveSync: 6.5.7638.1"; |
|
705 | - else |
|
706 | - return "MS-Server-ActiveSync: ". self::GetSupportedASVersion(); |
|
721 | + if (self::GetSupportedASVersion() == self::ASV_25) { |
|
722 | + return "MS-Server-ActiveSync: 6.5.7638.1"; |
|
723 | + } else { |
|
724 | + return "MS-Server-ActiveSync: ". self::GetSupportedASVersion(); |
|
725 | + } |
|
707 | 726 | } |
708 | 727 | |
709 | 728 | /** |
@@ -718,8 +737,9 @@ discard block |
||
718 | 737 | $versions = implode(',', array_slice(self::$supportedASVersions, 0, (array_search(self::GetSupportedASVersion(), self::$supportedASVersions)+1))); |
719 | 738 | ZLog::Write(LOGLEVEL_DEBUG, "ZPush::GetSupportedProtocolVersions(): " . $versions); |
720 | 739 | |
721 | - if ($valueOnly === true) |
|
722 | - return $versions; |
|
740 | + if ($valueOnly === true) { |
|
741 | + return $versions; |
|
742 | + } |
|
723 | 743 | |
724 | 744 | return "MS-ASProtocolVersions: " . $versions; |
725 | 745 | } |
@@ -733,10 +753,11 @@ discard block |
||
733 | 753 | static public function GetSupportedCommands() { |
734 | 754 | $asCommands = array(); |
735 | 755 | // filter all non-activesync commands |
736 | - foreach (self::$supportedCommands as $c=>$v) |
|
737 | - if (!self::checkCommandOptions($c, self::NOACTIVESYNCCOMMAND) && |
|
756 | + foreach (self::$supportedCommands as $c=>$v) { |
|
757 | + if (!self::checkCommandOptions($c, self::NOACTIVESYNCCOMMAND) && |
|
738 | 758 | self::checkCommandOptions($c, self::GetSupportedASVersion())) |
739 | 759 | $asCommands[] = Utils::GetCommandFromCode($c); |
760 | + } |
|
740 | 761 | |
741 | 762 | $commands = implode(',', $asCommands); |
742 | 763 | ZLog::Write(LOGLEVEL_DEBUG, "ZPush::GetSupportedCommands(): " . $commands); |
@@ -753,19 +774,22 @@ discard block |
||
753 | 774 | */ |
754 | 775 | static public function GetRequestHandlerForCommand($commandCode) { |
755 | 776 | if (!array_key_exists($commandCode, self::$supportedCommands) || |
756 | - !array_key_exists(self::REQUESTHANDLER, self::$supportedCommands[$commandCode]) ) |
|
757 | - throw new FatalNotImplementedException(sprintf("Command '%s' has no request handler or class", Utils::GetCommandFromCode($commandCode))); |
|
777 | + !array_key_exists(self::REQUESTHANDLER, self::$supportedCommands[$commandCode]) ) { |
|
778 | + throw new FatalNotImplementedException(sprintf("Command '%s' has no request handler or class", Utils::GetCommandFromCode($commandCode))); |
|
779 | + } |
|
758 | 780 | |
759 | 781 | $class = self::$supportedCommands[$commandCode][self::REQUESTHANDLER]; |
760 | 782 | $handlerclass = REAL_BASE_PATH . "lib/request/" . strtolower($class) . ".php"; |
761 | 783 | |
762 | - if (is_file($handlerclass)) |
|
763 | - include($handlerclass); |
|
784 | + if (is_file($handlerclass)) { |
|
785 | + include($handlerclass); |
|
786 | + } |
|
764 | 787 | |
765 | - if (class_exists($class)) |
|
766 | - return new $class(); |
|
767 | - else |
|
768 | - throw new FatalNotImplementedException(sprintf("Request handler '%s' can not be loaded", $class)); |
|
788 | + if (class_exists($class)) { |
|
789 | + return new $class(); |
|
790 | + } else { |
|
791 | + throw new FatalNotImplementedException(sprintf("Request handler '%s' can not be loaded", $class)); |
|
792 | + } |
|
769 | 793 | } |
770 | 794 | |
771 | 795 | /** |
@@ -835,10 +859,13 @@ discard block |
||
835 | 859 | * @return object StateMachine |
836 | 860 | */ |
837 | 861 | static private function checkCommandOptions($commandCode, $option) { |
838 | - if ($commandCode === false) return false; |
|
862 | + if ($commandCode === false) { |
|
863 | + return false; |
|
864 | + } |
|
839 | 865 | |
840 | - if (!array_key_exists($commandCode, self::$supportedCommands)) |
|
841 | - throw new FatalNotImplementedException(sprintf("Command '%s' is not supported", Utils::GetCommandFromCode($commandCode))); |
|
866 | + if (!array_key_exists($commandCode, self::$supportedCommands)) { |
|
867 | + throw new FatalNotImplementedException(sprintf("Command '%s' is not supported", Utils::GetCommandFromCode($commandCode))); |
|
868 | + } |
|
842 | 869 | |
843 | 870 | $capa = self::$supportedCommands[$commandCode]; |
844 | 871 | $defcapa = in_array($option, $capa, true); |
@@ -480,15 +480,15 @@ |
||
480 | 480 | return true; |
481 | 481 | } |
482 | 482 | |
483 | - /** |
|
484 | - * Sets the supported fields transmitted by the device for a certain folder |
|
485 | - * |
|
486 | - * @param string $folderid |
|
487 | - * @param array $fieldlist supported fields |
|
488 | - * |
|
489 | - * @access public |
|
490 | - * @return boolean |
|
491 | - */ |
|
483 | + /** |
|
484 | + * Sets the supported fields transmitted by the device for a certain folder |
|
485 | + * |
|
486 | + * @param string $folderid |
|
487 | + * @param array $fieldlist supported fields |
|
488 | + * |
|
489 | + * @access public |
|
490 | + * @return boolean |
|
491 | + */ |
|
492 | 492 | public function SetSupportedFields($folderid, $fieldlist) { |
493 | 493 | return $this->device->SetSupportedFields($folderid, $fieldlist); |
494 | 494 | } |
@@ -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; |
@@ -76,9 +76,9 @@ discard block |
||
76 | 76 | $this->loadDeviceData(); |
77 | 77 | |
78 | 78 | ZPush::GetTopCollector()->SetUserAgent($this->device->GetDeviceUserAgent()); |
79 | + } else { |
|
80 | + throw new FatalNotImplementedException("Can not proceed without a device id."); |
|
79 | 81 | } |
80 | - else |
|
81 | - throw new FatalNotImplementedException("Can not proceed without a device id."); |
|
82 | 82 | |
83 | 83 | $this->loopdetection = new LoopDetection(); |
84 | 84 | $this->loopdetection->ProcessLoopDetectionInit(); |
@@ -139,8 +139,9 @@ discard block |
||
139 | 139 | |
140 | 140 | // check if previousily ignored messages were synchronized for the current folder |
141 | 141 | // on multifolder operations of AS14 this is done by setLatestFolder() |
142 | - if ($this->latestFolder !== false) |
|
143 | - $this->checkBrokenMessages($this->latestFolder); |
|
142 | + if ($this->latestFolder !== false) { |
|
143 | + $this->checkBrokenMessages($this->latestFolder); |
|
144 | + } |
|
144 | 145 | |
145 | 146 | // update the user agent and AS version on the device |
146 | 147 | $this->device->SetUserAgent(Request::GetUserAgent()); |
@@ -166,8 +167,7 @@ discard block |
||
166 | 167 | $this->setDeviceUserData($this->type, array(self::$user => $this->device), self::$devid, -1, $doCas="merge"); |
167 | 168 | ZLog::Write(LOGLEVEL_DEBUG, "DeviceManager->Save(): Device data saved"); |
168 | 169 | } |
169 | - } |
|
170 | - catch (StateNotFoundException $snfex) { |
|
170 | + } catch (StateNotFoundException $snfex) { |
|
171 | 171 | ZLog::Write(LOGLEVEL_ERROR, "DeviceManager->Save(): Exception: ". $snfex->getMessage()); |
172 | 172 | } |
173 | 173 | } |
@@ -179,8 +179,9 @@ discard block |
||
179 | 179 | } |
180 | 180 | |
181 | 181 | // we terminated this process |
182 | - if ($this->loopdetection) |
|
183 | - $this->loopdetection->ProcessLoopDetectionTerminate(); |
|
182 | + if ($this->loopdetection) { |
|
183 | + $this->loopdetection->ProcessLoopDetectionTerminate(); |
|
184 | + } |
|
184 | 185 | |
185 | 186 | return true; |
186 | 187 | } |
@@ -211,8 +212,9 @@ discard block |
||
211 | 212 | ZLog::Write(LOGLEVEL_DEBUG, "Saving submitted device information"); |
212 | 213 | |
213 | 214 | // set the user agent |
214 | - if (isset($deviceinformation->useragent)) |
|
215 | - $this->device->SetUserAgent($deviceinformation->useragent); |
|
215 | + if (isset($deviceinformation->useragent)) { |
|
216 | + $this->device->SetUserAgent($deviceinformation->useragent); |
|
217 | + } |
|
216 | 218 | |
217 | 219 | // save other information |
218 | 220 | foreach (array("model", "imei", "friendlyname", "os", "oslanguage", "phonenumber", "mobileoperator", "enableoutboundsms") as $info) { |
@@ -294,8 +296,9 @@ discard block |
||
294 | 296 | // Old Palm Treos always do initial sync for calendar and contacts, even if they are not made available by the backend. |
295 | 297 | // We need to fake these folderids, allowing a fake sync/ping, even if they are not supported by the backend |
296 | 298 | // if the folderid would be available, they would already be returned in the above statement |
297 | - if ($folderidforClass == false && ($type == SYNC_FOLDER_TYPE_APPOINTMENT || $type == SYNC_FOLDER_TYPE_CONTACT)) |
|
298 | - $folderidforClass = SYNC_FOLDER_TYPE_DUMMY; |
|
299 | + if ($folderidforClass == false && ($type == SYNC_FOLDER_TYPE_APPOINTMENT || $type == SYNC_FOLDER_TYPE_CONTACT)) { |
|
300 | + $folderidforClass = SYNC_FOLDER_TYPE_DUMMY; |
|
301 | + } |
|
299 | 302 | } |
300 | 303 | |
301 | 304 | ZLog::Write(LOGLEVEL_DEBUG, sprintf("DeviceManager->GetFolderIdFromCacheByClass('%s'): '%s' => '%s'", $class, $type, $folderidforClass)); |
@@ -314,12 +317,14 @@ discard block |
||
314 | 317 | public function GetFolderClassFromCacheByID($folderid) { |
315 | 318 | //TODO check if the parent folder exists and is also being synchronized |
316 | 319 | $typeFromCache = $this->device->GetFolderType($folderid); |
317 | - if ($typeFromCache === false) |
|
318 | - throw new NoHierarchyCacheAvailableException(sprintf("Folderid '%s' is not fully synchronized on the device", $folderid)); |
|
320 | + if ($typeFromCache === false) { |
|
321 | + throw new NoHierarchyCacheAvailableException(sprintf("Folderid '%s' is not fully synchronized on the device", $folderid)); |
|
322 | + } |
|
319 | 323 | |
320 | 324 | $class = ZPush::GetFolderClassFromFolderType($typeFromCache); |
321 | - if ($class === false) |
|
322 | - throw new NotImplementedException(sprintf("Folderid '%s' is saved to be of type '%d' but this type is not implemented", $folderid, $typeFromCache)); |
|
325 | + if ($class === false) { |
|
326 | + throw new NotImplementedException(sprintf("Folderid '%s' is saved to be of type '%d' but this type is not implemented", $folderid, $typeFromCache)); |
|
327 | + } |
|
323 | 328 | |
324 | 329 | return $class; |
325 | 330 | } |
@@ -386,8 +391,9 @@ discard block |
||
386 | 391 | public function DoNotStreamMessage($id, &$message) { |
387 | 392 | $folderid = $this->getLatestFolder(); |
388 | 393 | |
389 | - if (isset($message->parentid)) |
|
390 | - $folder = $message->parentid; |
|
394 | + if (isset($message->parentid)) { |
|
395 | + $folder = $message->parentid; |
|
396 | + } |
|
391 | 397 | |
392 | 398 | // message was identified to be causing a loop |
393 | 399 | if ($this->loopdetection->IgnoreNextMessage(true, $id, $folderid)) { |
@@ -439,10 +445,12 @@ discard block |
||
439 | 445 | * @return int |
440 | 446 | */ |
441 | 447 | public function GetWindowSize($folderid, $uuid, $statecounter, $queuedmessages) { |
442 | - if (isset($this->windowSize[$folderid])) |
|
443 | - $items = $this->windowSize[$folderid]; |
|
444 | - else |
|
445 | - $items = WINDOW_SIZE_MAX; // 512 by default |
|
448 | + if (isset($this->windowSize[$folderid])) { |
|
449 | + $items = $this->windowSize[$folderid]; |
|
450 | + } else { |
|
451 | + $items = WINDOW_SIZE_MAX; |
|
452 | + } |
|
453 | + // 512 by default |
|
446 | 454 | |
447 | 455 | $this->setLatestFolder($folderid); |
448 | 456 | |
@@ -451,16 +459,16 @@ discard block |
||
451 | 459 | if ($loop !== false) { |
452 | 460 | if ($loop === true) { |
453 | 461 | $items = ($items == 0) ? 0: 1+($this->loopdetection->IgnoreNextMessage(false)?1:0) ; |
454 | - } |
|
455 | - else { |
|
462 | + } else { |
|
456 | 463 | // we got a new suggested window size |
457 | 464 | $items = $loop; |
458 | 465 | ZLog::Write(LOGLEVEL_DEBUG, sprintf("Mobile loop pre stage detected! Forcing smaller window size of %d before entering loop detection mode", $items)); |
459 | 466 | } |
460 | 467 | } |
461 | 468 | |
462 | - if ($items >= 0 && $items <= 2) |
|
463 | - ZLog::Write(LOGLEVEL_WARN, sprintf("Mobile loop detected! Messages sent to the mobile will be restricted to %d items in order to identify the conflict", $items)); |
|
469 | + if ($items >= 0 && $items <= 2) { |
|
470 | + ZLog::Write(LOGLEVEL_WARN, sprintf("Mobile loop detected! Messages sent to the mobile will be restricted to %d items in order to identify the conflict", $items)); |
|
471 | + } |
|
464 | 472 | |
465 | 473 | return $items; |
466 | 474 | } |
@@ -536,8 +544,7 @@ discard block |
||
536 | 544 | // do not limit when the owner or impersonated user is syncing! |
537 | 545 | if ($origin == DeviceManager::FLD_ORIGIN_USER || $origin == DeviceManager::FLD_ORIGIN_IMPERSONATED) { |
538 | 546 | ZLog::Write(LOGLEVEL_DEBUG, "Not checking for specific sync limit as this is the owner/impersonated user."); |
539 | - } |
|
540 | - else { |
|
547 | + } else { |
|
541 | 548 | $spKey = false; |
542 | 549 | $spFilter = false; |
543 | 550 | // 1. step: check if there is a general limitation for the store |
@@ -598,8 +605,9 @@ discard block |
||
598 | 605 | ZLog::Write(LOGLEVEL_INFO, "Full device resync requested"); |
599 | 606 | |
600 | 607 | // delete all other uuids |
601 | - foreach ($this->device->GetAllFolderIds() as $folderid) |
|
602 | - $uuid = StateManager::UnLinkState($this->device, $folderid); |
|
608 | + foreach ($this->device->GetAllFolderIds() as $folderid) { |
|
609 | + $uuid = StateManager::UnLinkState($this->device, $folderid); |
|
610 | + } |
|
603 | 611 | |
604 | 612 | // delete hierarchy states |
605 | 613 | StateManager::UnLinkState($this->device, false); |
@@ -627,8 +635,9 @@ discard block |
||
627 | 635 | } |
628 | 636 | |
629 | 637 | // check if a hierarchy sync might be necessary |
630 | - if ($this->device->GetFolderUUID(false) === false) |
|
631 | - $this->hierarchySyncRequired = true; |
|
638 | + if ($this->device->GetFolderUUID(false) === false) { |
|
639 | + $this->hierarchySyncRequired = true; |
|
640 | + } |
|
632 | 641 | |
633 | 642 | return $this->hierarchySyncRequired; |
634 | 643 | } |
@@ -915,13 +924,15 @@ discard block |
||
915 | 924 | * @return boolean |
916 | 925 | */ |
917 | 926 | private function loadDeviceData() { |
918 | - if (!Request::IsValidDeviceID()) |
|
919 | - return false; |
|
927 | + if (!Request::IsValidDeviceID()) { |
|
928 | + return false; |
|
929 | + } |
|
920 | 930 | try { |
921 | 931 | $deviceHash = $this->statemachine->GetStateHash(self::$devid, IStateMachine::DEVICEDATA); |
922 | 932 | if ($deviceHash != $this->deviceHash) { |
923 | - if ($this->deviceHash) |
|
924 | - ZLog::Write(LOGLEVEL_DEBUG, "DeviceManager->loadDeviceData(): Device data was changed, reloading"); |
|
933 | + if ($this->deviceHash) { |
|
934 | + ZLog::Write(LOGLEVEL_DEBUG, "DeviceManager->loadDeviceData(): Device data was changed, reloading"); |
|
935 | + } |
|
925 | 936 | $device = $this->statemachine->GetState(self::$devid, IStateMachine::DEVICEDATA); |
926 | 937 | // TODO: case should be removed when removing ASDevice backwards compatibility |
927 | 938 | // fallback for old grosync like devicedata |
@@ -932,8 +943,7 @@ discard block |
||
932 | 943 | ZLog::Write(LOGLEVEL_INFO, "Using old style device for this request and updating when concluding"); |
933 | 944 | $device = $device->devices[$_deviceuser]; |
934 | 945 | $device->lastupdatetime = time(); |
935 | - } |
|
936 | - else { |
|
946 | + } else { |
|
937 | 947 | ZLog::Write(LOGLEVEL_WARN, sprintf("Could not find '%s' in device state. Dropping previous device state!", $_deviceuser)); |
938 | 948 | } |
939 | 949 | } |
@@ -941,17 +951,14 @@ discard block |
||
941 | 951 | $this->device = $device; |
942 | 952 | $this->device->LoadedDevice(); |
943 | 953 | $this->deviceHash = $deviceHash; |
944 | - } |
|
945 | - else { |
|
954 | + } else { |
|
946 | 955 | ZLog::Write(LOGLEVEL_WARN, "Loaded device is not a device object. Dropping new loaded state and keeping initialized object!"); |
947 | 956 | } |
948 | 957 | $this->stateManager->SetDevice($this->device); |
949 | 958 | } |
950 | - } |
|
951 | - catch (StateNotFoundException $snfex) { |
|
959 | + } catch (StateNotFoundException $snfex) { |
|
952 | 960 | $this->hierarchySyncRequired = true; |
953 | - } |
|
954 | - catch (UnavailableException $uaex) { |
|
961 | + } catch (UnavailableException $uaex) { |
|
955 | 962 | // This is temporary and can be ignored e.g. in PING - see https://jira.z-hub.io/browse/ZP-1054 |
956 | 963 | // If the hash was not available before we treat it like a StateNotFoundException. |
957 | 964 | if ($this->deviceHash === false) { |
@@ -974,8 +981,9 @@ discard block |
||
974 | 981 | * @return boolean |
975 | 982 | */ |
976 | 983 | public function AnnounceIgnoredMessage($folderid, $id, SyncObject $message, $reason = self::MSG_BROKEN_UNKNOWN) { |
977 | - if ($folderid === false) |
|
978 | - $folderid = $this->getLatestFolder(); |
|
984 | + if ($folderid === false) { |
|
985 | + $folderid = $this->getLatestFolder(); |
|
986 | + } |
|
979 | 987 | |
980 | 988 | $class = get_class($message); |
981 | 989 | |
@@ -988,14 +996,18 @@ discard block |
||
988 | 996 | $brokenMessage->reasonString = 'unknown cause'; |
989 | 997 | $brokenMessage->timestamp = time(); |
990 | 998 | $info = ""; |
991 | - if (isset($message->subject)) |
|
992 | - $info .= sprintf("Subject: '%s'", $message->subject); |
|
993 | - if (isset($message->fileas)) |
|
994 | - $info .= sprintf("FileAs: '%s'", $message->fileas); |
|
995 | - if (isset($message->from)) |
|
996 | - $info .= sprintf(" - From: '%s'", $message->from); |
|
997 | - if (isset($message->starttime)) |
|
998 | - $info .= sprintf(" - On: '%s'", strftime("%Y-%m-%d %H:%M", $message->starttime)); |
|
999 | + if (isset($message->subject)) { |
|
1000 | + $info .= sprintf("Subject: '%s'", $message->subject); |
|
1001 | + } |
|
1002 | + if (isset($message->fileas)) { |
|
1003 | + $info .= sprintf("FileAs: '%s'", $message->fileas); |
|
1004 | + } |
|
1005 | + if (isset($message->from)) { |
|
1006 | + $info .= sprintf(" - From: '%s'", $message->from); |
|
1007 | + } |
|
1008 | + if (isset($message->starttime)) { |
|
1009 | + $info .= sprintf(" - On: '%s'", strftime("%Y-%m-%d %H:%M", $message->starttime)); |
|
1010 | + } |
|
999 | 1011 | $brokenMessage->info = $info; |
1000 | 1012 | $brokenMessage->reasonString = ZLog::GetLastMessage(LOGLEVEL_WARN); |
1001 | 1013 | |
@@ -1052,8 +1064,9 @@ discard block |
||
1052 | 1064 | private function setLatestFolder($folderid) { |
1053 | 1065 | // this is a multi folder operation |
1054 | 1066 | // check on ignoredmessages before discaring the folderid |
1055 | - if ($this->latestFolder !== false) |
|
1056 | - $this->checkBrokenMessages($this->latestFolder); |
|
1067 | + if ($this->latestFolder !== false) { |
|
1068 | + $this->checkBrokenMessages($this->latestFolder); |
|
1069 | + } |
|
1057 | 1070 | |
1058 | 1071 | $this->latestFolder = $folderid; |
1059 | 1072 |
@@ -118,7 +118,7 @@ |
||
118 | 118 | */ |
119 | 119 | public function ImportMessageDeletion($id, $asSoftDelete = false) { |
120 | 120 | if ($this->checkForIgnoredMessages) { |
121 | - ZPush::GetDeviceManager()->RemoveBrokenMessage($id); |
|
121 | + ZPush::GetDeviceManager()->RemoveBrokenMessage($id); |
|
122 | 122 | } |
123 | 123 | |
124 | 124 | $this->importedMsgs++; |
@@ -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(); |
@@ -76,17 +76,25 @@ discard block |
||
76 | 76 | return $stat; |
77 | 77 | } |
78 | 78 | |
79 | - if ($message->flags === false || $message->flags === SYNC_NEWMESSAGE) |
|
80 | - $this->encoder->startTag(SYNC_ADD); |
|
81 | - else { |
|
79 | + if ($message->flags === false || $message->flags === SYNC_NEWMESSAGE) { |
|
80 | + $this->encoder->startTag(SYNC_ADD); |
|
81 | + } else { |
|
82 | 82 | // on update of an SyncEmail we only export the flags and categories |
83 | 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 | - if (isset($message->flag)) $newmessage->flag = $message->flag; |
|
87 | - if (isset($message->lastverbexectime)) $newmessage->lastverbexectime = $message->lastverbexectime; |
|
88 | - if (isset($message->lastverbexecuted)) $newmessage->lastverbexecuted = $message->lastverbexecuted; |
|
89 | - if (isset($message->categories)) $newmessage->categories = $message->categories; |
|
86 | + if (isset($message->flag)) { |
|
87 | + $newmessage->flag = $message->flag; |
|
88 | + } |
|
89 | + if (isset($message->lastverbexectime)) { |
|
90 | + $newmessage->lastverbexectime = $message->lastverbexectime; |
|
91 | + } |
|
92 | + if (isset($message->lastverbexecuted)) { |
|
93 | + $newmessage->lastverbexecuted = $message->lastverbexecuted; |
|
94 | + } |
|
95 | + if (isset($message->categories)) { |
|
96 | + $newmessage->categories = $message->categories; |
|
97 | + } |
|
90 | 98 | $message = $newmessage; |
91 | 99 | unset($newmessage); |
92 | 100 | ZLog::Write(LOGLEVEL_DEBUG, sprintf("ImportChangesStream->ImportMessageChange('%s'): SyncMail message updated. Message content is striped, only flags/categories are streamed.", $id)); |
@@ -124,8 +132,7 @@ discard block |
||
124 | 132 | $this->importedMsgs++; |
125 | 133 | if ($asSoftDelete) { |
126 | 134 | $this->encoder->startTag(SYNC_SOFTDELETE); |
127 | - } |
|
128 | - else { |
|
135 | + } else { |
|
129 | 136 | $this->encoder->startTag(SYNC_REMOVE); |
130 | 137 | } |
131 | 138 | $this->encoder->startTag(SYNC_SERVERENTRYID); |
@@ -148,8 +155,9 @@ discard block |
||
148 | 155 | * @return boolean |
149 | 156 | */ |
150 | 157 | public function ImportMessageReadFlag($id, $flags, $categories = array()) { |
151 | - if(!($this->objclass instanceof SyncMail)) |
|
152 | - return false; |
|
158 | + if(!($this->objclass instanceof SyncMail)) { |
|
159 | + return false; |
|
160 | + } |
|
153 | 161 | |
154 | 162 | $this->importedMsgs++; |
155 | 163 | |
@@ -205,10 +213,11 @@ discard block |
||
205 | 213 | } |
206 | 214 | |
207 | 215 | // send a modify flag if the folder is already known on the device |
208 | - if (isset($folder->flags) && $folder->flags === SYNC_NEWMESSAGE) |
|
209 | - $this->encoder->startTag(SYNC_FOLDERHIERARCHY_ADD); |
|
210 | - else |
|
211 | - $this->encoder->startTag(SYNC_FOLDERHIERARCHY_UPDATE); |
|
216 | + if (isset($folder->flags) && $folder->flags === SYNC_NEWMESSAGE) { |
|
217 | + $this->encoder->startTag(SYNC_FOLDERHIERARCHY_ADD); |
|
218 | + } else { |
|
219 | + $this->encoder->startTag(SYNC_FOLDERHIERARCHY_UPDATE); |
|
220 | + } |
|
212 | 221 | |
213 | 222 | $folder->Encode($this->encoder); |
214 | 223 | $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 | /** |
@@ -59,8 +59,7 @@ discard block |
||
59 | 59 | public function GetFolder($serverid, $oldState = false) { |
60 | 60 | if (!$oldState && array_key_exists($serverid, $this->data)) { |
61 | 61 | return $this->data[$serverid]; |
62 | - } |
|
63 | - else if ($oldState && array_key_exists($serverid, $this->dataOld)) { |
|
62 | + } else if ($oldState && array_key_exists($serverid, $this->dataOld)) { |
|
64 | 63 | return $this->dataOld[$serverid]; |
65 | 64 | } |
66 | 65 | return false; |
@@ -117,14 +116,16 @@ discard block |
||
117 | 116 | * @return boolean |
118 | 117 | */ |
119 | 118 | public function ImportFolders($folders) { |
120 | - if (!is_array($folders)) |
|
121 | - return false; |
|
119 | + if (!is_array($folders)) { |
|
120 | + return false; |
|
121 | + } |
|
122 | 122 | |
123 | 123 | $this->data = array(); |
124 | 124 | |
125 | 125 | foreach ($folders as $folder) { |
126 | - if (!isset($folder->type)) |
|
127 | - continue; |
|
126 | + if (!isset($folder->type)) { |
|
127 | + continue; |
|
128 | + } |
|
128 | 129 | $this->AddFolder($folder); |
129 | 130 | } |
130 | 131 | return true; |
@@ -139,10 +140,11 @@ discard block |
||
139 | 140 | * @return array |
140 | 141 | */ |
141 | 142 | public function ExportFolders($oldstate = false) { |
142 | - if ($oldstate === false) |
|
143 | - return $this->data; |
|
144 | - else |
|
145 | - return $this->dataOld; |
|
143 | + if ($oldstate === false) { |
|
144 | + return $this->data; |
|
145 | + } else { |
|
146 | + return $this->dataOld; |
|
147 | + } |
|
146 | 148 | } |
147 | 149 | |
148 | 150 | /** |
@@ -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 | } |
@@ -58,8 +58,7 @@ discard block |
||
58 | 58 | if ($this->multipart) { |
59 | 59 | header("Content-Type: application/vnd.ms-sync.multipart"); |
60 | 60 | ZLog::Write(LOGLEVEL_DEBUG, "WBXMLEncoder->startWBXML() type: vnd.ms-sync.multipart"); |
61 | - } |
|
62 | - else { |
|
61 | + } else { |
|
63 | 62 | header("Content-Type: application/vnd.ms-sync.wbxml"); |
64 | 63 | ZLog::Write(LOGLEVEL_DEBUG, "WBXMLEncoder->startWBXML() type: vnd.ms-sync.wbxml"); |
65 | 64 | } |
@@ -111,14 +110,16 @@ discard block |
||
111 | 110 | if($stackelem['sent']) { |
112 | 111 | $this->_endTag(); |
113 | 112 | |
114 | - if(count($this->_stack) == 0) |
|
115 | - ZLog::Write(LOGLEVEL_DEBUG, "WBXMLEncoder->endTag() WBXML output completed"); |
|
113 | + if(count($this->_stack) == 0) { |
|
114 | + ZLog::Write(LOGLEVEL_DEBUG, "WBXMLEncoder->endTag() WBXML output completed"); |
|
115 | + } |
|
116 | 116 | |
117 | 117 | if(count($this->_stack) == 0 && $this->multipart == true) { |
118 | 118 | $this->processMultipart(); |
119 | 119 | } |
120 | - if(count($this->_stack) == 0) |
|
121 | - $this->writeLog(); |
|
120 | + if(count($this->_stack) == 0) { |
|
121 | + $this->writeLog(); |
|
122 | + } |
|
122 | 123 | } |
123 | 124 | } |
124 | 125 | |
@@ -135,8 +136,9 @@ discard block |
||
135 | 136 | // cannot send \0 characters within the XML content anywhere. |
136 | 137 | $content = str_replace("\0","",$content); |
137 | 138 | |
138 | - if("x" . $content == "x") |
|
139 | - return; |
|
139 | + if("x" . $content == "x") { |
|
140 | + return; |
|
141 | + } |
|
140 | 142 | $this->_outputStack(); |
141 | 143 | $this->_content($content); |
142 | 144 | } |
@@ -187,10 +189,12 @@ discard block |
||
187 | 189 | * @return void |
188 | 190 | */ |
189 | 191 | public function addBodypartStream($bp) { |
190 | - if (!is_resource($bp)) |
|
191 | - throw new WBXMLException("WBXMLEncoder->addBodypartStream(): trying to add a ".gettype($bp)." instead of a stream"); |
|
192 | - if ($this->multipart) |
|
193 | - $this->bodyparts[] = $bp; |
|
192 | + if (!is_resource($bp)) { |
|
193 | + throw new WBXMLException("WBXMLEncoder->addBodypartStream(): trying to add a ".gettype($bp)." instead of a stream"); |
|
194 | + } |
|
195 | + if ($this->multipart) { |
|
196 | + $this->bodyparts[] = $bp; |
|
197 | + } |
|
194 | 198 | } |
195 | 199 | |
196 | 200 | /** |
@@ -229,13 +233,15 @@ discard block |
||
229 | 233 | * @return |
230 | 234 | */ |
231 | 235 | private function _startTag($tag, $nocontent = false) { |
232 | - if ($this->log) |
|
233 | - $this->logStartTag($tag, $nocontent); |
|
236 | + if ($this->log) { |
|
237 | + $this->logStartTag($tag, $nocontent); |
|
238 | + } |
|
234 | 239 | |
235 | 240 | $mapping = $this->getMapping($tag); |
236 | 241 | |
237 | - if(!$mapping) |
|
238 | - return false; |
|
242 | + if(!$mapping) { |
|
243 | + return false; |
|
244 | + } |
|
239 | 245 | |
240 | 246 | if($this->_tagcp != $mapping["cp"]) { |
241 | 247 | $this->outSwitchPage($mapping["cp"]); |
@@ -244,8 +250,9 @@ discard block |
||
244 | 250 | |
245 | 251 | $code = $mapping["code"]; |
246 | 252 | |
247 | - if(!isset($nocontent) || !$nocontent) |
|
248 | - $code |= 0x40; |
|
253 | + if(!isset($nocontent) || !$nocontent) { |
|
254 | + $code |= 0x40; |
|
255 | + } |
|
249 | 256 | |
250 | 257 | $this->outByte($code); |
251 | 258 | } |
@@ -258,8 +265,9 @@ discard block |
||
258 | 265 | * @return |
259 | 266 | */ |
260 | 267 | private function _content($content) { |
261 | - if ($this->log) |
|
262 | - $this->logContent($content); |
|
268 | + if ($this->log) { |
|
269 | + $this->logContent($content); |
|
270 | + } |
|
263 | 271 | $this->outByte(self::WBXML_STR_I); |
264 | 272 | $this->outTermStr($content); |
265 | 273 | } |
@@ -278,8 +286,7 @@ discard block |
||
278 | 286 | if ($opaque) { |
279 | 287 | $this->outByte(self::WBXML_OPAQUE); |
280 | 288 | $this->outMBUInt($stat['size']); |
281 | - } |
|
282 | - else { |
|
289 | + } else { |
|
283 | 290 | $this->outByte(self::WBXML_STR_I); |
284 | 291 | } |
285 | 292 | |
@@ -307,8 +314,9 @@ discard block |
||
307 | 314 | * @return |
308 | 315 | */ |
309 | 316 | private function _endTag() { |
310 | - if ($this->log) |
|
311 | - $this->logEndTag(); |
|
317 | + if ($this->log) { |
|
318 | + $this->logEndTag(); |
|
319 | + } |
|
312 | 320 | $this->outByte(self::WBXML_END); |
313 | 321 | } |
314 | 322 | |
@@ -352,8 +360,7 @@ discard block |
||
352 | 360 | $uint = $uint >> 7; |
353 | 361 | if ($i == 0) { |
354 | 362 | $out = chr($byte) . $out; |
355 | - } |
|
356 | - else { |
|
363 | + } else { |
|
357 | 364 | $out = chr($byte | 0x80) . $out; |
358 | 365 | } |
359 | 366 | } |
@@ -401,8 +408,7 @@ discard block |
||
401 | 408 | |
402 | 409 | if(isset($split["ns"])) { |
403 | 410 | $cp = $this->_dtd["namespaces"][$split["ns"]]; |
404 | - } |
|
405 | - else { |
|
411 | + } else { |
|
406 | 412 | $cp = 0; |
407 | 413 | } |
408 | 414 | |
@@ -429,14 +435,14 @@ discard block |
||
429 | 435 | if($pos) { |
430 | 436 | $ns = substr($fulltag, 0, $pos); |
431 | 437 | $tag = substr($fulltag, $pos+1); |
432 | - } |
|
433 | - else { |
|
438 | + } else { |
|
434 | 439 | $tag = $fulltag; |
435 | 440 | } |
436 | 441 | |
437 | 442 | $ret = array(); |
438 | - if($ns) |
|
439 | - $ret["ns"] = $ns; |
|
443 | + if($ns) { |
|
444 | + $ret["ns"] = $ns; |
|
445 | + } |
|
440 | 446 | $ret["tag"] = $tag; |
441 | 447 | |
442 | 448 | return $ret; |
@@ -453,9 +459,9 @@ discard block |
||
453 | 459 | */ |
454 | 460 | private function logStartTag($tag, $nocontent) { |
455 | 461 | $spaces = str_repeat(" ", count($this->logStack)); |
456 | - if($nocontent) |
|
457 | - ZLog::Write(LOGLEVEL_WBXML,"O " . $spaces . " <$tag/>"); |
|
458 | - else { |
|
462 | + if($nocontent) { |
|
463 | + ZLog::Write(LOGLEVEL_WBXML,"O " . $spaces . " <$tag/>"); |
|
464 | + } else { |
|
459 | 465 | array_push($this->logStack, $tag); |
460 | 466 | ZLog::Write(LOGLEVEL_WBXML,"O " . $spaces . " <$tag>"); |
461 | 467 | } |
@@ -457,14 +457,14 @@ |
||
457 | 457 | $uint = 0; |
458 | 458 | |
459 | 459 | while(1) { |
460 | - $byte = $this->getByte(); |
|
460 | + $byte = $this->getByte(); |
|
461 | 461 | |
462 | - $uint |= $byte & 0x7f; |
|
462 | + $uint |= $byte & 0x7f; |
|
463 | 463 | |
464 | - if($byte & 0x80) |
|
465 | - $uint = $uint << 7; |
|
466 | - else |
|
467 | - break; |
|
464 | + if($byte & 0x80) |
|
465 | + $uint = $uint << 7; |
|
466 | + else |
|
467 | + break; |
|
468 | 468 | } |
469 | 469 | |
470 | 470 | return $uint; |
@@ -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 | } |
@@ -36,8 +36,7 @@ discard block |
||
36 | 36 | static public function InWhile($name) { |
37 | 37 | if (!isset(self::$loopCounter[$name])) { |
38 | 38 | self::$loopCounter[$name] = 0; |
39 | - } |
|
40 | - else { |
|
39 | + } else { |
|
41 | 40 | self::$loopCounter[$name]++; |
42 | 41 | } |
43 | 42 | |
@@ -81,16 +80,19 @@ discard block |
||
81 | 80 | } |
82 | 81 | |
83 | 82 | $publicid = $this->getMBUInt(); |
84 | - if($publicid !== 1) |
|
85 | - throw new WBXMLException("Wrong publicid : ".$publicid); |
|
83 | + if($publicid !== 1) { |
|
84 | + throw new WBXMLException("Wrong publicid : ".$publicid); |
|
85 | + } |
|
86 | 86 | |
87 | 87 | $charsetid = $this->getMBUInt(); |
88 | - if ($charsetid !== 106) |
|
89 | - throw new WBXMLException("Wrong charset : ".$charsetid); |
|
88 | + if ($charsetid !== 106) { |
|
89 | + throw new WBXMLException("Wrong charset : ".$charsetid); |
|
90 | + } |
|
90 | 91 | |
91 | 92 | $stringtablesize = $this->getMBUInt(); |
92 | - if ($stringtablesize !== 0) |
|
93 | - throw new WBXMLException("Wrong string table size : ".$stringtablesize); |
|
93 | + if ($stringtablesize !== 0) { |
|
94 | + throw new WBXMLException("Wrong string table size : ".$stringtablesize); |
|
95 | + } |
|
94 | 96 | } |
95 | 97 | |
96 | 98 | /** |
@@ -111,9 +113,9 @@ discard block |
||
111 | 113 | WBXMLDecoder::ResetInWhile("decoderGetElement"); |
112 | 114 | while(WBXMLDecoder::InWhile("decoderGetElement")) { |
113 | 115 | $next = $this->getToken(); |
114 | - if($next == false) |
|
115 | - return false; |
|
116 | - else if($next[EN_TYPE] == EN_CONTENT) { |
|
116 | + if($next == false) { |
|
117 | + return false; |
|
118 | + } else if($next[EN_TYPE] == EN_CONTENT) { |
|
117 | 119 | $element[EN_CONTENT] .= $next[EN_CONTENT]; |
118 | 120 | } else { |
119 | 121 | $this->ungetElement($next); |
@@ -149,12 +151,13 @@ discard block |
||
149 | 151 | public function getElementStartTag($tag) { |
150 | 152 | $element = $this->getToken(); |
151 | 153 | |
152 | - if (!$element) |
|
153 | - return false; |
|
154 | + if (!$element) { |
|
155 | + return false; |
|
156 | + } |
|
154 | 157 | |
155 | - if($element[EN_TYPE] == EN_TYPE_STARTTAG && $element[EN_TAG] == $tag) |
|
156 | - return $element; |
|
157 | - else { |
|
158 | + if($element[EN_TYPE] == EN_TYPE_STARTTAG && $element[EN_TAG] == $tag) { |
|
159 | + return $element; |
|
160 | + } else { |
|
158 | 161 | 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 | 162 | $this->ungetElement($element); |
160 | 163 | } |
@@ -171,9 +174,9 @@ discard block |
||
171 | 174 | public function getElementEndTag() { |
172 | 175 | $element = $this->getToken(); |
173 | 176 | |
174 | - if($element[EN_TYPE] == EN_TYPE_ENDTAG) |
|
175 | - return $element; |
|
176 | - else { |
|
177 | + if($element[EN_TYPE] == EN_TYPE_ENDTAG) { |
|
178 | + return $element; |
|
179 | + } else { |
|
177 | 180 | 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 | 181 | |
179 | 182 | $bt = debug_backtrace(); |
@@ -198,8 +201,7 @@ discard block |
||
198 | 201 | |
199 | 202 | if($element[EN_TYPE] == EN_TYPE_CONTENT) { |
200 | 203 | return $element[EN_CONTENT]; |
201 | - } |
|
202 | - else { |
|
204 | + } else { |
|
203 | 205 | 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 | 206 | $this->ungetElement($element); |
205 | 207 | } |
@@ -216,8 +218,9 @@ discard block |
||
216 | 218 | * @return |
217 | 219 | */ |
218 | 220 | 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]:""))); |
|
221 | + if($this->ungetbuffer) { |
|
222 | + 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]:""))); |
|
223 | + } |
|
221 | 224 | |
222 | 225 | $this->ungetbuffer = $element; |
223 | 226 | } |
@@ -272,8 +275,9 @@ discard block |
||
272 | 275 | } |
273 | 276 | |
274 | 277 | $el = $this->_getToken(); |
275 | - if($this->log && $el) |
|
276 | - $this->logToken($el); |
|
278 | + if($this->log && $el) { |
|
279 | + $this->logToken($el); |
|
280 | + } |
|
277 | 281 | |
278 | 282 | return $el; |
279 | 283 | } |
@@ -294,8 +298,9 @@ discard block |
||
294 | 298 | if($el[EN_FLAGS] & EN_FLAGS_CONTENT) { |
295 | 299 | ZLog::Write(LOGLEVEL_WBXML,"I " . $spaces . " <". $el[EN_TAG] . ">"); |
296 | 300 | array_push($this->logStack, $el[EN_TAG]); |
297 | - } else |
|
298 | - ZLog::Write(LOGLEVEL_WBXML,"I " . $spaces . " <" . $el[EN_TAG] . "/>"); |
|
301 | + } else { |
|
302 | + ZLog::Write(LOGLEVEL_WBXML,"I " . $spaces . " <" . $el[EN_TAG] . "/>"); |
|
303 | + } |
|
299 | 304 | |
300 | 305 | break; |
301 | 306 | case EN_TYPE_ENDTAG: |
@@ -309,8 +314,7 @@ discard block |
||
309 | 314 | $messagesize = strlen($el[EN_CONTENT]); |
310 | 315 | if ($messagesize > 10240 && !defined('WBXML_DEBUGGING')) { |
311 | 316 | $content = substr($el[EN_CONTENT], 0, 10240) . sprintf(" <log message with %d bytes truncated>", $messagesize); |
312 | - } |
|
313 | - else { |
|
317 | + } else { |
|
314 | 318 | $content = $el[EN_CONTENT]; |
315 | 319 | } |
316 | 320 | // Log but make sure it's not truncated again (will be slightly bigger than 10KB) |
@@ -332,8 +336,9 @@ discard block |
||
332 | 336 | WBXMLDecoder::ResetInWhile("decoderGetToken"); |
333 | 337 | while(WBXMLDecoder::InWhile("decoderGetToken")) { |
334 | 338 | $byte = fread($this->in, 1); |
335 | - if($byte === "" || $byte === false) |
|
336 | - break; |
|
339 | + if($byte === "" || $byte === false) { |
|
340 | + break; |
|
341 | + } |
|
337 | 342 | $byte = ord($byte); |
338 | 343 | |
339 | 344 | switch($byte) { |
@@ -375,8 +380,9 @@ discard block |
||
375 | 380 | throw new WBXMLException("Invalid token :".$byte); |
376 | 381 | |
377 | 382 | default: |
378 | - if($byte & self::WBXML_WITH_ATTRIBUTES) |
|
379 | - throw new WBXMLException("Attributes are not allowed :".$byte); |
|
383 | + if($byte & self::WBXML_WITH_ATTRIBUTES) { |
|
384 | + throw new WBXMLException("Attributes are not allowed :".$byte); |
|
385 | + } |
|
380 | 386 | $element[EN_TYPE] = EN_TYPE_STARTTAG; |
381 | 387 | $element[EN_TAG] = $this->getMapping($this->tagcp, $byte & 0x3f); |
382 | 388 | $element[EN_FLAGS] = ($byte & self::WBXML_WITH_CONTENT ? EN_FLAGS_CONTENT : 0); |
@@ -398,8 +404,7 @@ discard block |
||
398 | 404 | $in = $this->getByte(); |
399 | 405 | if ($in == 0) { |
400 | 406 | break; |
401 | - } |
|
402 | - else { |
|
407 | + } else { |
|
403 | 408 | $str .= chr($in); |
404 | 409 | } |
405 | 410 | } |
@@ -425,11 +430,13 @@ discard block |
||
425 | 430 | */ |
426 | 431 | private function getOpaque($len) { |
427 | 432 | $d = stream_get_contents($this->in, $len); |
428 | - if ($d === false) |
|
429 | - throw new HTTPReturnCodeException("WBXMLDecoder->getOpaque(): stream_get_contents === false", HTTP_CODE_500, null, LOGLEVEL_WARN); |
|
433 | + if ($d === false) { |
|
434 | + throw new HTTPReturnCodeException("WBXMLDecoder->getOpaque(): stream_get_contents === false", HTTP_CODE_500, null, LOGLEVEL_WARN); |
|
435 | + } |
|
430 | 436 | $l = strlen($d); |
431 | - if ($l !== $len) |
|
432 | - throw new HTTPReturnCodeException("WBXMLDecoder->getOpaque(): only $l byte read instead of $len", HTTP_CODE_500, null, LOGLEVEL_WARN); |
|
437 | + if ($l !== $len) { |
|
438 | + throw new HTTPReturnCodeException("WBXMLDecoder->getOpaque(): only $l byte read instead of $len", HTTP_CODE_500, null, LOGLEVEL_WARN); |
|
439 | + } |
|
433 | 440 | return $d; |
434 | 441 | } |
435 | 442 | |
@@ -441,10 +448,11 @@ discard block |
||
441 | 448 | */ |
442 | 449 | private function getByte() { |
443 | 450 | $ch = fread($this->in, 1); |
444 | - if(strlen($ch) > 0) |
|
445 | - return ord($ch); |
|
446 | - else |
|
447 | - return; |
|
451 | + if(strlen($ch) > 0) { |
|
452 | + return ord($ch); |
|
453 | + } else { |
|
454 | + return; |
|
455 | + } |
|
448 | 456 | } |
449 | 457 | |
450 | 458 | /** |
@@ -461,10 +469,11 @@ discard block |
||
461 | 469 | |
462 | 470 | $uint |= $byte & 0x7f; |
463 | 471 | |
464 | - if($byte & 0x80) |
|
465 | - $uint = $uint << 7; |
|
466 | - else |
|
467 | - break; |
|
472 | + if($byte & 0x80) { |
|
473 | + $uint = $uint << 7; |
|
474 | + } else { |
|
475 | + break; |
|
476 | + } |
|
468 | 477 | } |
469 | 478 | |
470 | 479 | return $uint; |
@@ -480,13 +489,14 @@ discard block |
||
480 | 489 | * @return string |
481 | 490 | */ |
482 | 491 | private function getMapping($cp, $id) { |
483 | - if(!isset($this->dtd["codes"][$cp]) || !isset($this->dtd["codes"][$cp][$id])) |
|
484 | - return false; |
|
485 | - else { |
|
492 | + if(!isset($this->dtd["codes"][$cp]) || !isset($this->dtd["codes"][$cp][$id])) { |
|
493 | + return false; |
|
494 | + } else { |
|
486 | 495 | if(isset($this->dtd["namespaces"][$cp])) { |
487 | 496 | return $this->dtd["namespaces"][$cp] . ":" . $this->dtd["codes"][$cp][$id]; |
488 | - } else |
|
489 | - return $this->dtd["codes"][$cp][$id]; |
|
497 | + } else { |
|
498 | + return $this->dtd["codes"][$cp][$id]; |
|
499 | + } |
|
490 | 500 | } |
491 | 501 | } |
492 | 502 | } |
@@ -704,33 +704,33 @@ |
||
704 | 704 | 0x17 => "ContentOwner", |
705 | 705 | 0x18 => "RemoveRightsManagementProtection", |
706 | 706 | ), |
707 | - ), |
|
708 | - "namespaces" => array( |
|
709 | - //0 => "AirSync", // |
|
710 | - 1 => "POOMCONTACTS", |
|
711 | - 2 => "POOMMAIL", |
|
712 | - 3 => "AirNotify", //no longer used |
|
713 | - 4 => "POOMCAL", |
|
714 | - 5 => "Move", |
|
715 | - 6 => "GetItemEstimate", |
|
716 | - 7 => "FolderHierarchy", |
|
717 | - 8 => "MeetingResponse", |
|
718 | - 9 => "POOMTASKS", |
|
719 | - 0xA => "ResolveRecipients", |
|
720 | - 0xB => "ValidateCert", |
|
721 | - 0xC => "POOMCONTACTS2", |
|
722 | - 0xD => "Ping", |
|
723 | - 0xE => "Provision",// |
|
724 | - 0xF => "Search",// |
|
725 | - 0x10 => "GAL", |
|
726 | - 0x11 => "AirSyncBase", //12.0, 12.1 and 14.0 |
|
727 | - 0x12 => "Settings", //12.0, 12.1 and 14.0. |
|
728 | - 0x13 => "DocumentLibrary", //12.0, 12.1 and 14.0 |
|
729 | - 0x14 => "ItemOperations", //12.0, 12.1 and 14.0 |
|
730 | - 0x15 => "ComposeMail", //14.0 |
|
731 | - 0x16 => "POOMMAIL2", //14.0 |
|
732 | - 0x17 => "Notes", //14.0 |
|
733 | - 0x18 => "RightsManagement", |
|
734 | - ) |
|
735 | - ); |
|
707 | + ), |
|
708 | + "namespaces" => array( |
|
709 | + //0 => "AirSync", // |
|
710 | + 1 => "POOMCONTACTS", |
|
711 | + 2 => "POOMMAIL", |
|
712 | + 3 => "AirNotify", //no longer used |
|
713 | + 4 => "POOMCAL", |
|
714 | + 5 => "Move", |
|
715 | + 6 => "GetItemEstimate", |
|
716 | + 7 => "FolderHierarchy", |
|
717 | + 8 => "MeetingResponse", |
|
718 | + 9 => "POOMTASKS", |
|
719 | + 0xA => "ResolveRecipients", |
|
720 | + 0xB => "ValidateCert", |
|
721 | + 0xC => "POOMCONTACTS2", |
|
722 | + 0xD => "Ping", |
|
723 | + 0xE => "Provision",// |
|
724 | + 0xF => "Search",// |
|
725 | + 0x10 => "GAL", |
|
726 | + 0x11 => "AirSyncBase", //12.0, 12.1 and 14.0 |
|
727 | + 0x12 => "Settings", //12.0, 12.1 and 14.0. |
|
728 | + 0x13 => "DocumentLibrary", //12.0, 12.1 and 14.0 |
|
729 | + 0x14 => "ItemOperations", //12.0, 12.1 and 14.0 |
|
730 | + 0x15 => "ComposeMail", //14.0 |
|
731 | + 0x16 => "POOMMAIL2", //14.0 |
|
732 | + 0x17 => "Notes", //14.0 |
|
733 | + 0x18 => "RightsManagement", |
|
734 | + ) |
|
735 | + ); |
|
736 | 736 | } |
@@ -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. |
@@ -44,21 +44,21 @@ |
||
44 | 44 | public function GetGALSearchResults($searchquery, $searchrange, $searchpicture); |
45 | 45 | |
46 | 46 | /** |
47 | - * Searches for the emails on the server |
|
48 | - * |
|
49 | - * @param ContentParameter $cpo |
|
50 | - * |
|
51 | - * @return array |
|
52 | - */ |
|
47 | + * Searches for the emails on the server |
|
48 | + * |
|
49 | + * @param ContentParameter $cpo |
|
50 | + * |
|
51 | + * @return array |
|
52 | + */ |
|
53 | 53 | public function GetMailboxSearchResults($cpo); |
54 | 54 | |
55 | 55 | /** |
56 | - * Terminates a search for a given PID |
|
57 | - * |
|
58 | - * @param int $pid |
|
59 | - * |
|
60 | - * @return boolean |
|
61 | - */ |
|
56 | + * Terminates a search for a given PID |
|
57 | + * |
|
58 | + * @param int $pid |
|
59 | + * |
|
60 | + * @return boolean |
|
61 | + */ |
|
62 | 62 | public function TerminateSearch($pid); |
63 | 63 | |
64 | 64 |
@@ -108,7 +108,7 @@ |
||
108 | 108 | */ |
109 | 109 | public function LinkUserDevice($username, $devid); |
110 | 110 | |
111 | - /** |
|
111 | + /** |
|
112 | 112 | * Unlinks a device from a user |
113 | 113 | * |
114 | 114 | * @param string $username |