@@ -13,7 +13,7 @@ discard block |
||
| 13 | 13 | define('SSLCERT_FILE', null); |
| 14 | 14 | define('SSLCERT_PASS', null); |
| 15 | 15 | |
| 16 | -$supported_classes = array ( |
|
| 16 | +$supported_classes = array( |
|
| 17 | 17 | "IPF.Note" => "SYNC_FOLDER_TYPE_USER_MAIL", |
| 18 | 18 | "IPF.Task" => "SYNC_FOLDER_TYPE_USER_TASK", |
| 19 | 19 | "IPF.Appointment" => "SYNC_FOLDER_TYPE_USER_APPOINTMENT", |
@@ -80,11 +80,11 @@ discard block |
||
| 80 | 80 | } |
| 81 | 81 | } |
| 82 | 82 | |
| 83 | -function listfolders_zarafa_admin_setup ($mapi, $user, $pass, $sslcert_file, $sslcert_pass) { |
|
| 83 | +function listfolders_zarafa_admin_setup($mapi, $user, $pass, $sslcert_file, $sslcert_pass) { |
|
| 84 | 84 | $session = @mapi_logon_zarafa($user, $pass, $mapi, $sslcert_file, $sslcert_pass, 0, 'script', 'script'); |
| 85 | 85 | |
| 86 | 86 | if (!$session) { |
| 87 | - echo "User '$user' could not login. The script will exit. Errorcode: 0x". sprintf("%x", mapi_last_hresult()) . "\n"; |
|
| 87 | + echo "User '$user' could not login. The script will exit. Errorcode: 0x".sprintf("%x", mapi_last_hresult())."\n"; |
|
| 88 | 88 | exit(1); |
| 89 | 89 | } |
| 90 | 90 | |
@@ -98,7 +98,7 @@ discard block |
||
| 98 | 98 | } |
| 99 | 99 | } |
| 100 | 100 | $zarafauserinfo['admin'] = 1; |
| 101 | - $admin = (isset($zarafauserinfo['admin']) && $zarafauserinfo['admin'])?true:false; |
|
| 101 | + $admin = (isset($zarafauserinfo['admin']) && $zarafauserinfo['admin']) ?true:false; |
|
| 102 | 102 | |
| 103 | 103 | if (!$stores || !$storeslist || !$adminStore || !$admin) { |
| 104 | 104 | echo "There was error trying to log in as admin or retrieving admin info. The script will exit.\n"; |
@@ -109,7 +109,7 @@ discard block |
||
| 109 | 109 | } |
| 110 | 110 | |
| 111 | 111 | |
| 112 | -function listfolders_getlist ($adminStore, $session, $user) { |
|
| 112 | +function listfolders_getlist($adminStore, $session, $user) { |
|
| 113 | 113 | global $supported_classes; |
| 114 | 114 | |
| 115 | 115 | if (strtoupper($user) == 'SYSTEM') { |
@@ -117,10 +117,10 @@ discard block |
||
| 117 | 117 | $storestables = @mapi_getmsgstorestable($session); |
| 118 | 118 | $result = @mapi_last_hresult(); |
| 119 | 119 | |
| 120 | - if ($result == NOERROR){ |
|
| 120 | + if ($result == NOERROR) { |
|
| 121 | 121 | $rows = @mapi_table_queryallrows($storestables, array(PR_ENTRYID, PR_MDB_PROVIDER)); |
| 122 | 122 | |
| 123 | - foreach($rows as $row) { |
|
| 123 | + foreach ($rows as $row) { |
|
| 124 | 124 | if (isset($row[PR_MDB_PROVIDER]) && $row[PR_MDB_PROVIDER] == ZARAFA_STORE_PUBLIC_GUID) { |
| 125 | 125 | if (!isset($row[PR_ENTRYID])) { |
| 126 | 126 | echo "Public folder are not available.\nIf this is a multi-tenancy system, use -u and -p and login with an admin user of the company.\nThe script will exit.\n"; |
@@ -139,14 +139,14 @@ discard block |
||
| 139 | 139 | $hresult = mapi_last_hresult(); |
| 140 | 140 | |
| 141 | 141 | // Cache the store for later use |
| 142 | - if($hresult != NOERROR) { |
|
| 142 | + if ($hresult != NOERROR) { |
|
| 143 | 143 | echo "Could not open store for '$user'. The script will exit.\n"; |
| 144 | 144 | exit (1); |
| 145 | 145 | } |
| 146 | 146 | |
| 147 | 147 | if (strtoupper($user) != 'SYSTEM') { |
| 148 | 148 | $inbox = mapi_msgstore_getreceivefolder($userStore); |
| 149 | - if(mapi_last_hresult() != NOERROR) { |
|
| 149 | + if (mapi_last_hresult() != NOERROR) { |
|
| 150 | 150 | printf("Could not open inbox for %s (0x%08X). The script will exit.\n", $user, mapi_last_hresult()); |
| 151 | 151 | exit (1); |
| 152 | 152 | } |
@@ -158,8 +158,8 @@ discard block |
||
| 158 | 158 | $h_table = @mapi_folder_gethierarchytable($root, CONVENIENT_DEPTH); |
| 159 | 159 | $subfolders = @mapi_table_queryallrows($h_table, array(PR_ENTRYID, PR_DISPLAY_NAME, PR_CONTAINER_CLASS, PR_SOURCE_KEY, PR_PARENT_SOURCE_KEY, PR_FOLDER_TYPE, PR_ATTR_HIDDEN)); |
| 160 | 160 | |
| 161 | - echo "Available folders in store '$user':\n" . str_repeat("-", 50) . "\n"; |
|
| 162 | - foreach($subfolders as $folder) { |
|
| 161 | + echo "Available folders in store '$user':\n".str_repeat("-", 50)."\n"; |
|
| 162 | + foreach ($subfolders as $folder) { |
|
| 163 | 163 | // do not display hidden and search folders |
| 164 | 164 | if ((isset($folder[PR_ATTR_HIDDEN]) && $folder[PR_ATTR_HIDDEN]) || |
| 165 | 165 | (isset($folder[PR_FOLDER_TYPE]) && $folder[PR_FOLDER_TYPE] == FOLDER_SEARCH)) { |
@@ -177,9 +177,9 @@ discard block |
||
| 177 | 177 | } |
| 178 | 178 | |
| 179 | 179 | if (isset($folder[PR_CONTAINER_CLASS]) && array_key_exists($folder[PR_CONTAINER_CLASS], $supported_classes)) { |
| 180 | - echo "Folder name:\t". $folder[PR_DISPLAY_NAME] . "\n"; |
|
| 181 | - echo "Folder ID:\t". bin2hex($folder[PR_SOURCE_KEY]) . "\n"; |
|
| 182 | - echo "Type:\t\t". $supported_classes[$folder[PR_CONTAINER_CLASS]] . "\n"; |
|
| 180 | + echo "Folder name:\t".$folder[PR_DISPLAY_NAME]."\n"; |
|
| 181 | + echo "Folder ID:\t".bin2hex($folder[PR_SOURCE_KEY])."\n"; |
|
| 182 | + echo "Type:\t\t".$supported_classes[$folder[PR_CONTAINER_CLASS]]."\n"; |
|
| 183 | 183 | echo "\n"; |
| 184 | 184 | } |
| 185 | 185 | } |
@@ -192,8 +192,8 @@ discard block |
||
| 192 | 192 | return ($version <= $vs[1]); |
| 193 | 193 | } |
| 194 | 194 | |
| 195 | - if (extension_loaded("mapi")){ |
|
| 196 | - if (version_compare(phpversion("mapi"), $version) == -1){ |
|
| 195 | + if (extension_loaded("mapi")) { |
|
| 196 | + if (version_compare(phpversion("mapi"), $version) == -1) { |
|
| 197 | 197 | return false; |
| 198 | 198 | } |
| 199 | 199 | } |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | $len = ($this->position + $len > $this->streamlength) ? ($this->streamlength - $this->position) : $len; |
| 70 | 70 | |
| 71 | 71 | // read 4 additional bytes from the stream so we can always truncate correctly |
| 72 | - if ($this->toTruncate && $this->position+$len >= $this->streamlength) { |
|
| 72 | + if ($this->toTruncate && $this->position + $len >= $this->streamlength) { |
|
| 73 | 73 | $len += 4; |
| 74 | 74 | } |
| 75 | 75 | if ($this->mapistream) { |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | * @return boolean |
| 97 | 97 | */ |
| 98 | 98 | public function stream_seek($offset, $whence = SEEK_SET) { |
| 99 | - switch($whence) { |
|
| 99 | + switch ($whence) { |
|
| 100 | 100 | case SEEK_SET: |
| 101 | 101 | $mapiWhence = STREAM_SEEK_SET; |
| 102 | 102 | break; |
@@ -170,7 +170,7 @@ discard block |
||
| 170 | 170 | */ |
| 171 | 171 | static public function Open($mapistream, $truncatehtmlsafe = false) { |
| 172 | 172 | $context = stream_context_create(array(self::PROTOCOL => array('stream' => &$mapistream, 'truncatehtmlsafe' => $truncatehtmlsafe))); |
| 173 | - return fopen(self::PROTOCOL . "://",'r', false, $context); |
|
| 173 | + return fopen(self::PROTOCOL."://", 'r', false, $context); |
|
| 174 | 174 | } |
| 175 | 175 | } |
| 176 | 176 | |
@@ -24,17 +24,17 @@ discard block |
||
| 24 | 24 | $rwstatus = ZPush::GetProvisioningManager()->GetProvisioningWipeStatus(); |
| 25 | 25 | $rwstatusWiped = false; |
| 26 | 26 | $deviceInfoSet = false; |
| 27 | - $wipeRequest = ! ($rwstatus < SYNC_PROVISION_RWSTATUS_PENDING); |
|
| 27 | + $wipeRequest = !($rwstatus < SYNC_PROVISION_RWSTATUS_PENDING); |
|
| 28 | 28 | |
| 29 | 29 | // if this is a regular provisioning require that an authenticated remote user |
| 30 | - if (! $wipeRequest) { |
|
| 30 | + if (!$wipeRequest) { |
|
| 31 | 31 | ZLog::Write(LOGLEVEL_DEBUG, "RequestProcessor::HandleProvision(): Forcing delayed Authentication"); |
| 32 | 32 | self::Authenticate(); |
| 33 | 33 | } |
| 34 | 34 | |
| 35 | 35 | $phase2 = true; |
| 36 | 36 | |
| 37 | - if(!self::$decoder->getElementStartTag(SYNC_PROVISION_PROVISION)) |
|
| 37 | + if (!self::$decoder->getElementStartTag(SYNC_PROVISION_PROVISION)) |
|
| 38 | 38 | return false; |
| 39 | 39 | |
| 40 | 40 | // Loop through Provision request tags. Possible are: |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | // - Policies |
| 44 | 44 | // Each of them should only be once per request. |
| 45 | 45 | WBXMLDecoder::ResetInWhile("provisioningMain"); |
| 46 | - while(WBXMLDecoder::InWhile("provisioningMain")) { |
|
| 46 | + while (WBXMLDecoder::InWhile("provisioningMain")) { |
|
| 47 | 47 | $requestName = ""; |
| 48 | 48 | if (self::$decoder->getElementStartTag(SYNC_PROVISION_REMOTEWIPE)) { |
| 49 | 49 | $requestName = SYNC_PROVISION_REMOTEWIPE; |
@@ -61,15 +61,15 @@ discard block |
||
| 61 | 61 | //set is available for OOF, device password and device information |
| 62 | 62 | switch ($requestName) { |
| 63 | 63 | case SYNC_PROVISION_REMOTEWIPE: |
| 64 | - if(!self::$decoder->getElementStartTag(SYNC_PROVISION_STATUS)) |
|
| 64 | + if (!self::$decoder->getElementStartTag(SYNC_PROVISION_STATUS)) |
|
| 65 | 65 | return false; |
| 66 | 66 | |
| 67 | 67 | $instatus = self::$decoder->getElementContent(); |
| 68 | 68 | |
| 69 | - if(!self::$decoder->getElementEndTag()) |
|
| 69 | + if (!self::$decoder->getElementEndTag()) |
|
| 70 | 70 | return false; |
| 71 | 71 | |
| 72 | - if(!self::$decoder->getElementEndTag()) |
|
| 72 | + if (!self::$decoder->getElementEndTag()) |
|
| 73 | 73 | return false; |
| 74 | 74 | |
| 75 | 75 | $phase2 = false; |
@@ -78,40 +78,40 @@ discard block |
||
| 78 | 78 | break; |
| 79 | 79 | |
| 80 | 80 | case SYNC_PROVISION_POLICIES: |
| 81 | - if(!self::$decoder->getElementStartTag(SYNC_PROVISION_POLICY)) |
|
| 81 | + if (!self::$decoder->getElementStartTag(SYNC_PROVISION_POLICY)) |
|
| 82 | 82 | return false; |
| 83 | 83 | |
| 84 | - if(!self::$decoder->getElementStartTag(SYNC_PROVISION_POLICYTYPE)) |
|
| 84 | + if (!self::$decoder->getElementStartTag(SYNC_PROVISION_POLICYTYPE)) |
|
| 85 | 85 | return false; |
| 86 | 86 | |
| 87 | 87 | $policytype = self::$decoder->getElementContent(); |
| 88 | 88 | if ($policytype != 'MS-WAP-Provisioning-XML' && $policytype != 'MS-EAS-Provisioning-WBXML') { |
| 89 | 89 | $status = SYNC_PROVISION_STATUS_SERVERERROR; |
| 90 | 90 | } |
| 91 | - if(!self::$decoder->getElementEndTag()) //policytype |
|
| 91 | + if (!self::$decoder->getElementEndTag()) //policytype |
|
| 92 | 92 | return false; |
| 93 | 93 | |
| 94 | 94 | if (self::$decoder->getElementStartTag(SYNC_PROVISION_POLICYKEY)) { |
| 95 | 95 | $devpolicykey = self::$decoder->getElementContent(); |
| 96 | 96 | |
| 97 | - if(!self::$decoder->getElementEndTag()) |
|
| 97 | + if (!self::$decoder->getElementEndTag()) |
|
| 98 | 98 | return false; |
| 99 | 99 | |
| 100 | - if(!self::$decoder->getElementStartTag(SYNC_PROVISION_STATUS)) |
|
| 100 | + if (!self::$decoder->getElementStartTag(SYNC_PROVISION_STATUS)) |
|
| 101 | 101 | return false; |
| 102 | 102 | |
| 103 | 103 | $instatus = self::$decoder->getElementContent(); |
| 104 | 104 | |
| 105 | - if(!self::$decoder->getElementEndTag()) |
|
| 105 | + if (!self::$decoder->getElementEndTag()) |
|
| 106 | 106 | return false; |
| 107 | 107 | |
| 108 | 108 | $phase2 = false; |
| 109 | 109 | } |
| 110 | 110 | |
| 111 | - if(!self::$decoder->getElementEndTag()) //policy |
|
| 111 | + if (!self::$decoder->getElementEndTag()) //policy |
|
| 112 | 112 | return false; |
| 113 | 113 | |
| 114 | - if(!self::$decoder->getElementEndTag()) //policies |
|
| 114 | + if (!self::$decoder->getElementEndTag()) //policies |
|
| 115 | 115 | return false; |
| 116 | 116 | break; |
| 117 | 117 | |
@@ -123,7 +123,7 @@ discard block |
||
| 123 | 123 | $deviceinformation = new SyncDeviceInformation(); |
| 124 | 124 | $deviceinformation->Decode(self::$decoder); |
| 125 | 125 | $deviceinformation->Status = SYNC_SETTINGSSTATUS_SUCCESS; |
| 126 | - if (! $wipeRequest) { |
|
| 126 | + if (!$wipeRequest) { |
|
| 127 | 127 | // for this operation the device manager is available |
| 128 | 128 | ZPush::GetDeviceManager()->SaveDeviceInformation($deviceinformation); |
| 129 | 129 | } |
@@ -138,12 +138,12 @@ discard block |
||
| 138 | 138 | |
| 139 | 139 | default: |
| 140 | 140 | //TODO: a special status code needed? |
| 141 | - ZLog::Write(LOGLEVEL_WARN, sprintf ("This property ('%s') is not allowed to be used in a provision request", $requestName)); |
|
| 141 | + ZLog::Write(LOGLEVEL_WARN, sprintf("This property ('%s') is not allowed to be used in a provision request", $requestName)); |
|
| 142 | 142 | } |
| 143 | 143 | |
| 144 | 144 | } |
| 145 | 145 | |
| 146 | - if(!self::$decoder->getElementEndTag()) //provision |
|
| 146 | + if (!self::$decoder->getElementEndTag()) //provision |
|
| 147 | 147 | return false; |
| 148 | 148 | |
| 149 | 149 | if (PROVISIONING !== true) { |
@@ -173,7 +173,7 @@ discard block |
||
| 173 | 173 | self::$encoder->startTag(SYNC_PROVISION_POLICIES); |
| 174 | 174 | self::$encoder->startTag(SYNC_PROVISION_POLICY); |
| 175 | 175 | |
| 176 | - if(isset($policytype)) { |
|
| 176 | + if (isset($policytype)) { |
|
| 177 | 177 | self::$encoder->startTag(SYNC_PROVISION_POLICYTYPE); |
| 178 | 178 | self::$encoder->content($policytype); |
| 179 | 179 | self::$encoder->endTag(); |
@@ -211,14 +211,14 @@ discard block |
||
| 211 | 211 | } |
| 212 | 212 | self::$topCollector->AnnounceInformation("Updated provisioning", true); |
| 213 | 213 | |
| 214 | - self::$encoder->endTag();//data |
|
| 214 | + self::$encoder->endTag(); //data |
|
| 215 | 215 | } |
| 216 | - self::$encoder->endTag();//policy |
|
| 216 | + self::$encoder->endTag(); //policy |
|
| 217 | 217 | self::$encoder->endTag(); //policies |
| 218 | 218 | } |
| 219 | 219 | |
| 220 | 220 | //set the new final policy key in the provisioning manager |
| 221 | - if (!$phase2 && ! $wipeRequest) { |
|
| 221 | + if (!$phase2 && !$wipeRequest) { |
|
| 222 | 222 | ZPush::GetProvisioningManager()->SetProvisioningPolicyKey($policykey); |
| 223 | 223 | self::$topCollector->AnnounceInformation("Policies deployed", true); |
| 224 | 224 | } |
@@ -226,11 +226,11 @@ discard block |
||
| 226 | 226 | //wipe data if a higher RWSTATUS is requested |
| 227 | 227 | if ($rwstatus > SYNC_PROVISION_RWSTATUS_OK && $policystatus === SYNC_PROVISION_POLICYSTATUS_SUCCESS) { |
| 228 | 228 | self::$encoder->startTag(SYNC_PROVISION_REMOTEWIPE, false, true); |
| 229 | - ZPush::GetProvisioningManager()->SetProvisioningWipeStatus(($rwstatusWiped)?SYNC_PROVISION_RWSTATUS_WIPED:SYNC_PROVISION_RWSTATUS_REQUESTED); |
|
| 230 | - self::$topCollector->AnnounceInformation(sprintf("Remote wipe %s", ($rwstatusWiped)?"executed":"requested"), true); |
|
| 229 | + ZPush::GetProvisioningManager()->SetProvisioningWipeStatus(($rwstatusWiped) ?SYNC_PROVISION_RWSTATUS_WIPED:SYNC_PROVISION_RWSTATUS_REQUESTED); |
|
| 230 | + self::$topCollector->AnnounceInformation(sprintf("Remote wipe %s", ($rwstatusWiped) ? "executed" : "requested"), true); |
|
| 231 | 231 | } |
| 232 | 232 | |
| 233 | - self::$encoder->endTag();//provision |
|
| 233 | + self::$encoder->endTag(); //provision |
|
| 234 | 234 | |
| 235 | 235 | return true; |
| 236 | 236 | } |
@@ -18,34 +18,34 @@ discard block |
||
| 18 | 18 | * @return boolean |
| 19 | 19 | */ |
| 20 | 20 | public function Handle($commandCode) { |
| 21 | - if(!self::$decoder->getElementStartTag(SYNC_MOVE_MOVES)) |
|
| 21 | + if (!self::$decoder->getElementStartTag(SYNC_MOVE_MOVES)) |
|
| 22 | 22 | return false; |
| 23 | 23 | |
| 24 | 24 | $moves = array(); |
| 25 | - while(self::$decoder->getElementStartTag(SYNC_MOVE_MOVE)) { |
|
| 25 | + while (self::$decoder->getElementStartTag(SYNC_MOVE_MOVE)) { |
|
| 26 | 26 | $move = array(); |
| 27 | - if(self::$decoder->getElementStartTag(SYNC_MOVE_SRCMSGID)) { |
|
| 27 | + if (self::$decoder->getElementStartTag(SYNC_MOVE_SRCMSGID)) { |
|
| 28 | 28 | $move["srcmsgid"] = self::$decoder->getElementContent(); |
| 29 | - if(!self::$decoder->getElementEndTag()) |
|
| 29 | + if (!self::$decoder->getElementEndTag()) |
|
| 30 | 30 | break; |
| 31 | 31 | } |
| 32 | - if(self::$decoder->getElementStartTag(SYNC_MOVE_SRCFLDID)) { |
|
| 32 | + if (self::$decoder->getElementStartTag(SYNC_MOVE_SRCFLDID)) { |
|
| 33 | 33 | $move["srcfldid"] = self::$decoder->getElementContent(); |
| 34 | - if(!self::$decoder->getElementEndTag()) |
|
| 34 | + if (!self::$decoder->getElementEndTag()) |
|
| 35 | 35 | break; |
| 36 | 36 | } |
| 37 | - if(self::$decoder->getElementStartTag(SYNC_MOVE_DSTFLDID)) { |
|
| 37 | + if (self::$decoder->getElementStartTag(SYNC_MOVE_DSTFLDID)) { |
|
| 38 | 38 | $move["dstfldid"] = self::$decoder->getElementContent(); |
| 39 | - if(!self::$decoder->getElementEndTag()) |
|
| 39 | + if (!self::$decoder->getElementEndTag()) |
|
| 40 | 40 | break; |
| 41 | 41 | } |
| 42 | 42 | array_push($moves, $move); |
| 43 | 43 | |
| 44 | - if(!self::$decoder->getElementEndTag()) |
|
| 44 | + if (!self::$decoder->getElementEndTag()) |
|
| 45 | 45 | return false; |
| 46 | 46 | } |
| 47 | 47 | |
| 48 | - if(!self::$decoder->getElementEndTag()) |
|
| 48 | + if (!self::$decoder->getElementEndTag()) |
|
| 49 | 49 | return false; |
| 50 | 50 | |
| 51 | 51 | self::$encoder->StartWBXML(); |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | $operationResults = array(); |
| 56 | 56 | $operationCounter = 0; |
| 57 | 57 | $operationTotal = count($moves); |
| 58 | - foreach($moves as $move) { |
|
| 58 | + foreach ($moves as $move) { |
|
| 59 | 59 | $operationCounter++; |
| 60 | 60 | self::$encoder->startTag(SYNC_MOVE_RESPONSE); |
| 61 | 61 | self::$encoder->startTag(SYNC_MOVE_SRCMSGID); |
@@ -107,7 +107,7 @@ discard block |
||
| 107 | 107 | self::$encoder->endTag(); |
| 108 | 108 | |
| 109 | 109 | self::$encoder->startTag(SYNC_MOVE_DSTMSGID); |
| 110 | - self::$encoder->content( (($result !== false ) ? $result : $move["srcmsgid"])); |
|
| 110 | + self::$encoder->content((($result !== false) ? $result : $move["srcmsgid"])); |
|
| 111 | 111 | self::$encoder->endTag(); |
| 112 | 112 | self::$encoder->endTag(); |
| 113 | 113 | } |
@@ -19,7 +19,7 @@ discard block |
||
| 19 | 19 | */ |
| 20 | 20 | public function Handle($commandCode) { |
| 21 | 21 | // Parse input |
| 22 | - if(!self::$decoder->getElementStartTag(SYNC_VALIDATECERT_VALIDATECERT)) |
|
| 22 | + if (!self::$decoder->getElementStartTag(SYNC_VALIDATECERT_VALIDATECERT)) |
|
| 23 | 23 | return false; |
| 24 | 24 | |
| 25 | 25 | $validateCert = new SyncValidateCert(); |
@@ -33,7 +33,7 @@ discard block |
||
| 33 | 33 | else |
| 34 | 34 | $status = SYNC_VALIDATECERTSTATUS_CANTVALIDATESIG; |
| 35 | 35 | |
| 36 | - if(!self::$decoder->getElementEndTag()) |
|
| 36 | + if (!self::$decoder->getElementEndTag()) |
|
| 37 | 37 | return false; // SYNC_VALIDATECERT_VALIDATECERT |
| 38 | 38 | |
| 39 | 39 | self::$encoder->startWBXML(); |
@@ -18,16 +18,16 @@ |
||
| 18 | 18 | * @return boolean |
| 19 | 19 | */ |
| 20 | 20 | public function Handle($commandCode) { |
| 21 | - if(!self::$decoder->getElementStartTag(SYNC_AIRNOTIFY_NOTIFY)) |
|
| 21 | + if (!self::$decoder->getElementStartTag(SYNC_AIRNOTIFY_NOTIFY)) |
|
| 22 | 22 | return false; |
| 23 | 23 | |
| 24 | - if(!self::$decoder->getElementStartTag(SYNC_AIRNOTIFY_DEVICEINFO)) |
|
| 24 | + if (!self::$decoder->getElementStartTag(SYNC_AIRNOTIFY_DEVICEINFO)) |
|
| 25 | 25 | return false; |
| 26 | 26 | |
| 27 | - if(!self::$decoder->getElementEndTag()) |
|
| 27 | + if (!self::$decoder->getElementEndTag()) |
|
| 28 | 28 | return false; |
| 29 | 29 | |
| 30 | - if(!self::$decoder->getElementEndTag()) |
|
| 30 | + if (!self::$decoder->getElementEndTag()) |
|
| 31 | 31 | return false; |
| 32 | 32 | |
| 33 | 33 | self::$encoder->StartWBXML(); |
@@ -60,40 +60,40 @@ discard block |
||
| 60 | 60 | ZLog::Write(LOGLEVEL_DEBUG, sprintf("HandlePing(): reference PolicyKey for PING: %s", $sc->GetReferencePolicyKey())); |
| 61 | 61 | |
| 62 | 62 | // receive PING initialization data |
| 63 | - if($params_present) { |
|
| 63 | + if ($params_present) { |
|
| 64 | 64 | self::$topCollector->AnnounceInformation("Processing PING data"); |
| 65 | 65 | ZLog::Write(LOGLEVEL_DEBUG, "HandlePing(): initialization data received"); |
| 66 | 66 | |
| 67 | - if(self::$decoder->getElementStartTag(SYNC_PING_LIFETIME)) { |
|
| 67 | + if (self::$decoder->getElementStartTag(SYNC_PING_LIFETIME)) { |
|
| 68 | 68 | $sc->SetLifetime(self::$decoder->getElementContent()); |
| 69 | 69 | self::$decoder->getElementEndTag(); |
| 70 | 70 | } |
| 71 | 71 | |
| 72 | - if(($el = self::$decoder->getElementStartTag(SYNC_PING_FOLDERS)) && $el[EN_FLAGS] & EN_FLAGS_CONTENT) { |
|
| 72 | + if (($el = self::$decoder->getElementStartTag(SYNC_PING_FOLDERS)) && $el[EN_FLAGS] & EN_FLAGS_CONTENT) { |
|
| 73 | 73 | // cache requested (pingable) folderids |
| 74 | 74 | $pingable = array(); |
| 75 | 75 | |
| 76 | - while(self::$decoder->getElementStartTag(SYNC_PING_FOLDER)) { |
|
| 76 | + while (self::$decoder->getElementStartTag(SYNC_PING_FOLDER)) { |
|
| 77 | 77 | WBXMLDecoder::ResetInWhile("pingFolder"); |
| 78 | - while(WBXMLDecoder::InWhile("pingFolder")) { |
|
| 79 | - if(self::$decoder->getElementStartTag(SYNC_PING_SERVERENTRYID)) { |
|
| 78 | + while (WBXMLDecoder::InWhile("pingFolder")) { |
|
| 79 | + if (self::$decoder->getElementStartTag(SYNC_PING_SERVERENTRYID)) { |
|
| 80 | 80 | $folderid = self::$decoder->getElementContent(); |
| 81 | 81 | self::$decoder->getElementEndTag(); |
| 82 | 82 | } |
| 83 | - if(self::$decoder->getElementStartTag(SYNC_PING_FOLDERTYPE)) { |
|
| 83 | + if (self::$decoder->getElementStartTag(SYNC_PING_FOLDERTYPE)) { |
|
| 84 | 84 | $class = self::$decoder->getElementContent(); |
| 85 | 85 | self::$decoder->getElementEndTag(); |
| 86 | 86 | } |
| 87 | 87 | |
| 88 | 88 | $e = self::$decoder->peek(); |
| 89 | - if($e[EN_TYPE] == EN_TYPE_ENDTAG) { |
|
| 89 | + if ($e[EN_TYPE] == EN_TYPE_ENDTAG) { |
|
| 90 | 90 | self::$decoder->getElementEndTag(); |
| 91 | 91 | break; |
| 92 | 92 | } |
| 93 | 93 | } |
| 94 | 94 | |
| 95 | 95 | $spa = $sc->GetCollection($folderid); |
| 96 | - if (! $spa) { |
|
| 96 | + if (!$spa) { |
|
| 97 | 97 | // The requested collection is not synchronized. |
| 98 | 98 | // check if the HierarchyCache is available, if not, trigger a HierarchySync |
| 99 | 99 | try { |
@@ -118,7 +118,7 @@ discard block |
||
| 118 | 118 | ZLog::Write(LOGLEVEL_DEBUG, sprintf("HandlePing(): using saved sync state for '%s' id '%s'", $spa->GetContentClass(), $folderid)); |
| 119 | 119 | } |
| 120 | 120 | } |
| 121 | - if(!self::$decoder->getElementEndTag()) |
|
| 121 | + if (!self::$decoder->getElementEndTag()) |
|
| 122 | 122 | return false; |
| 123 | 123 | |
| 124 | 124 | // update pingable flags |
@@ -127,15 +127,15 @@ discard block |
||
| 127 | 127 | if (in_array($folderid, $pingable)) { |
| 128 | 128 | $spa->SetPingableFlag(true); |
| 129 | 129 | } |
| 130 | - else { |
|
| 130 | + else { |
|
| 131 | 131 | $spa->DelPingableFlag(); |
| 132 | 132 | } |
| 133 | 133 | } |
| 134 | 134 | } |
| 135 | - if(!self::$decoder->getElementEndTag()) |
|
| 135 | + if (!self::$decoder->getElementEndTag()) |
|
| 136 | 136 | return false; |
| 137 | 137 | |
| 138 | - if(!$this->lifetimeBetweenBound($sc->GetLifetime())){ |
|
| 138 | + if (!$this->lifetimeBetweenBound($sc->GetLifetime())) { |
|
| 139 | 139 | $pingstatus = SYNC_PINGSTATUS_HBOUTOFRANGE; |
| 140 | 140 | ZLog::Write(LOGLEVEL_DEBUG, sprintf("HandlePing(): ping lifetime not between bound (higher bound:'%d' lower bound:'%d' current lifetime:'%d'. Returning SYNC_PINGSTATUS_HBOUTOFRANGE.", PING_HIGHER_BOUND_LIFETIME, PING_LOWER_BOUND_LIFETIME, $sc->GetLifetime())); |
| 141 | 141 | } |
@@ -146,11 +146,11 @@ discard block |
||
| 146 | 146 | else { |
| 147 | 147 | // if no ping initialization data was sent, we check if we have pingable folders |
| 148 | 148 | // if not, we indicate that there is nothing to do. |
| 149 | - if (! $sc->PingableFolders()) { |
|
| 149 | + if (!$sc->PingableFolders()) { |
|
| 150 | 150 | $pingstatus = SYNC_PINGSTATUS_FAILINGPARAMS; |
| 151 | 151 | ZLog::Write(LOGLEVEL_DEBUG, "HandlePing(): no pingable folders found and no initialization data sent. Returning SYNC_PINGSTATUS_FAILINGPARAMS."); |
| 152 | 152 | } |
| 153 | - elseif(!$this->lifetimeBetweenBound($sc->GetLifetime())){ |
|
| 153 | + elseif (!$this->lifetimeBetweenBound($sc->GetLifetime())) { |
|
| 154 | 154 | $pingstatus = SYNC_PINGSTATUS_FAILINGPARAMS; |
| 155 | 155 | ZLog::Write(LOGLEVEL_DEBUG, sprintf("HandlePing(): ping lifetime not between bound (higher bound:'%d' lower bound:'%d' current lifetime:'%d'. Returning SYNC_PINGSTATUS_FAILINGPARAMS.", PING_HIGHER_BOUND_LIFETIME, PING_LOWER_BOUND_LIFETIME, $sc->GetLifetime())); |
| 156 | 156 | } |
@@ -165,7 +165,7 @@ discard block |
||
| 165 | 165 | } |
| 166 | 166 | } |
| 167 | 167 | catch (StatusException $ste) { |
| 168 | - switch($ste->getCode()) { |
|
| 168 | + switch ($ste->getCode()) { |
|
| 169 | 169 | case SyncCollections::ERROR_NO_COLLECTIONS: |
| 170 | 170 | $pingstatus = SYNC_PINGSTATUS_FAILINGPARAMS; |
| 171 | 171 | break; |
@@ -192,7 +192,7 @@ discard block |
||
| 192 | 192 | self::$encoder->content($foundchanges ? SYNC_PINGSTATUS_CHANGES : SYNC_PINGSTATUS_HBEXPIRED); |
| 193 | 193 | self::$encoder->endTag(); |
| 194 | 194 | |
| 195 | - if (! $pingstatus) { |
|
| 195 | + if (!$pingstatus) { |
|
| 196 | 196 | self::$encoder->startTag(SYNC_PING_FOLDERS); |
| 197 | 197 | |
| 198 | 198 | if (empty($fakechanges)) |
@@ -225,12 +225,12 @@ discard block |
||
| 225 | 225 | } |
| 226 | 226 | self::$encoder->endTag(); |
| 227 | 227 | } |
| 228 | - elseif($pingstatus == SYNC_PINGSTATUS_HBOUTOFRANGE){ |
|
| 228 | + elseif ($pingstatus == SYNC_PINGSTATUS_HBOUTOFRANGE) { |
|
| 229 | 229 | self::$encoder->startTag(SYNC_PING_LIFETIME); |
| 230 | - if($sc->GetLifetime() > PING_HIGHER_BOUND_LIFETIME){ |
|
| 230 | + if ($sc->GetLifetime() > PING_HIGHER_BOUND_LIFETIME) { |
|
| 231 | 231 | self::$encoder->content(PING_HIGHER_BOUND_LIFETIME); |
| 232 | 232 | } |
| 233 | - else{ |
|
| 233 | + else { |
|
| 234 | 234 | self::$encoder->content(PING_LOWER_BOUND_LIFETIME); |
| 235 | 235 | } |
| 236 | 236 | self::$encoder->endTag(); |
@@ -253,14 +253,14 @@ discard block |
||
| 253 | 253 | * @access private |
| 254 | 254 | * @return boolean |
| 255 | 255 | */ |
| 256 | - private function lifetimeBetweenBound($lifetime){ |
|
| 257 | - if(PING_HIGHER_BOUND_LIFETIME !== false && PING_LOWER_BOUND_LIFETIME !== false){ |
|
| 256 | + private function lifetimeBetweenBound($lifetime) { |
|
| 257 | + if (PING_HIGHER_BOUND_LIFETIME !== false && PING_LOWER_BOUND_LIFETIME !== false) { |
|
| 258 | 258 | return ($lifetime <= PING_HIGHER_BOUND_LIFETIME && $lifetime >= PING_LOWER_BOUND_LIFETIME); |
| 259 | 259 | } |
| 260 | - if(PING_HIGHER_BOUND_LIFETIME !== false){ |
|
| 260 | + if (PING_HIGHER_BOUND_LIFETIME !== false) { |
|
| 261 | 261 | return $lifetime <= PING_HIGHER_BOUND_LIFETIME; |
| 262 | 262 | } |
| 263 | - if(PING_LOWER_BOUND_LIFETIME !== false){ |
|
| 263 | + if (PING_LOWER_BOUND_LIFETIME !== false) { |
|
| 264 | 264 | return $lifetime >= PING_LOWER_BOUND_LIFETIME; |
| 265 | 265 | } |
| 266 | 266 | return true; |
@@ -20,33 +20,33 @@ discard block |
||
| 20 | 20 | public function Handle($commandCode) { |
| 21 | 21 | $requests = Array(); |
| 22 | 22 | |
| 23 | - if(!self::$decoder->getElementStartTag(SYNC_MEETINGRESPONSE_MEETINGRESPONSE)) |
|
| 23 | + if (!self::$decoder->getElementStartTag(SYNC_MEETINGRESPONSE_MEETINGRESPONSE)) |
|
| 24 | 24 | return false; |
| 25 | 25 | |
| 26 | - while(self::$decoder->getElementStartTag(SYNC_MEETINGRESPONSE_REQUEST)) { |
|
| 26 | + while (self::$decoder->getElementStartTag(SYNC_MEETINGRESPONSE_REQUEST)) { |
|
| 27 | 27 | $req = Array(); |
| 28 | 28 | WBXMLDecoder::ResetInWhile("meetingResponseRequest"); |
| 29 | - while(WBXMLDecoder::InWhile("meetingResponseRequest")) { |
|
| 30 | - if(self::$decoder->getElementStartTag(SYNC_MEETINGRESPONSE_USERRESPONSE)) { |
|
| 29 | + while (WBXMLDecoder::InWhile("meetingResponseRequest")) { |
|
| 30 | + if (self::$decoder->getElementStartTag(SYNC_MEETINGRESPONSE_USERRESPONSE)) { |
|
| 31 | 31 | $req["response"] = self::$decoder->getElementContent(); |
| 32 | - if(!self::$decoder->getElementEndTag()) |
|
| 32 | + if (!self::$decoder->getElementEndTag()) |
|
| 33 | 33 | return false; |
| 34 | 34 | } |
| 35 | 35 | |
| 36 | - if(self::$decoder->getElementStartTag(SYNC_MEETINGRESPONSE_FOLDERID)) { |
|
| 36 | + if (self::$decoder->getElementStartTag(SYNC_MEETINGRESPONSE_FOLDERID)) { |
|
| 37 | 37 | $req["folderid"] = self::$decoder->getElementContent(); |
| 38 | - if(!self::$decoder->getElementEndTag()) |
|
| 38 | + if (!self::$decoder->getElementEndTag()) |
|
| 39 | 39 | return false; |
| 40 | 40 | } |
| 41 | 41 | |
| 42 | - if(self::$decoder->getElementStartTag(SYNC_MEETINGRESPONSE_REQUESTID)) { |
|
| 42 | + if (self::$decoder->getElementStartTag(SYNC_MEETINGRESPONSE_REQUESTID)) { |
|
| 43 | 43 | $req["requestid"] = self::$decoder->getElementContent(); |
| 44 | - if(!self::$decoder->getElementEndTag()) |
|
| 44 | + if (!self::$decoder->getElementEndTag()) |
|
| 45 | 45 | return false; |
| 46 | 46 | } |
| 47 | 47 | |
| 48 | 48 | $e = self::$decoder->peek(); |
| 49 | - if($e[EN_TYPE] == EN_TYPE_ENDTAG) { |
|
| 49 | + if ($e[EN_TYPE] == EN_TYPE_ENDTAG) { |
|
| 50 | 50 | self::$decoder->getElementEndTag(); |
| 51 | 51 | break; |
| 52 | 52 | } |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | array_push($requests, $req); |
| 55 | 55 | } |
| 56 | 56 | |
| 57 | - if(!self::$decoder->getElementEndTag()) |
|
| 57 | + if (!self::$decoder->getElementEndTag()) |
|
| 58 | 58 | return false; |
| 59 | 59 | |
| 60 | 60 | // output the error code, plus the ID of the calendar item that was generated by the |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | self::$encoder->StartWBXML(); |
| 63 | 63 | self::$encoder->startTag(SYNC_MEETINGRESPONSE_MEETINGRESPONSE); |
| 64 | 64 | |
| 65 | - foreach($requests as $req) { |
|
| 65 | + foreach ($requests as $req) { |
|
| 66 | 66 | $status = SYNC_MEETRESPSTATUS_SUCCESS; |
| 67 | 67 | |
| 68 | 68 | try { |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | self::$encoder->content($status); |
| 90 | 90 | self::$encoder->endTag(); |
| 91 | 91 | |
| 92 | - if($status == SYNC_MEETRESPSTATUS_SUCCESS && !empty($calendarid)) { |
|
| 92 | + if ($status == SYNC_MEETRESPSTATUS_SUCCESS && !empty($calendarid)) { |
|
| 93 | 93 | self::$encoder->startTag(SYNC_MEETINGRESPONSE_CALENDARID); |
| 94 | 94 | self::$encoder->content($calendarid); |
| 95 | 95 | self::$encoder->endTag(); |
@@ -18,37 +18,37 @@ discard block |
||
| 18 | 18 | * @access public |
| 19 | 19 | * @return boolean |
| 20 | 20 | */ |
| 21 | - public function Handle ($commandCode) { |
|
| 21 | + public function Handle($commandCode) { |
|
| 22 | 22 | $el = self::$decoder->getElement(); |
| 23 | 23 | |
| 24 | - if($el[EN_TYPE] != EN_TYPE_STARTTAG) |
|
| 24 | + if ($el[EN_TYPE] != EN_TYPE_STARTTAG) |
|
| 25 | 25 | return false; |
| 26 | 26 | |
| 27 | 27 | $create = $update = $delete = false; |
| 28 | - if($el[EN_TAG] == SYNC_FOLDERHIERARCHY_FOLDERCREATE) |
|
| 28 | + if ($el[EN_TAG] == SYNC_FOLDERHIERARCHY_FOLDERCREATE) |
|
| 29 | 29 | $create = true; |
| 30 | - else if($el[EN_TAG] == SYNC_FOLDERHIERARCHY_FOLDERUPDATE) |
|
| 30 | + else if ($el[EN_TAG] == SYNC_FOLDERHIERARCHY_FOLDERUPDATE) |
|
| 31 | 31 | $update = true; |
| 32 | - else if($el[EN_TAG] == SYNC_FOLDERHIERARCHY_FOLDERDELETE) |
|
| 32 | + else if ($el[EN_TAG] == SYNC_FOLDERHIERARCHY_FOLDERDELETE) |
|
| 33 | 33 | $delete = true; |
| 34 | 34 | |
| 35 | - if(!$create && !$update && !$delete) |
|
| 35 | + if (!$create && !$update && !$delete) |
|
| 36 | 36 | return false; |
| 37 | 37 | |
| 38 | 38 | // SyncKey |
| 39 | - if(!self::$decoder->getElementStartTag(SYNC_FOLDERHIERARCHY_SYNCKEY)) |
|
| 39 | + if (!self::$decoder->getElementStartTag(SYNC_FOLDERHIERARCHY_SYNCKEY)) |
|
| 40 | 40 | return false; |
| 41 | 41 | $synckey = self::$decoder->getElementContent(); |
| 42 | - if(!self::$decoder->getElementEndTag()) |
|
| 42 | + if (!self::$decoder->getElementEndTag()) |
|
| 43 | 43 | return false; |
| 44 | 44 | |
| 45 | 45 | // ServerID |
| 46 | 46 | $serverid = false; |
| 47 | 47 | $backendid = false; |
| 48 | - if(self::$decoder->getElementStartTag(SYNC_FOLDERHIERARCHY_SERVERENTRYID)) { |
|
| 48 | + if (self::$decoder->getElementStartTag(SYNC_FOLDERHIERARCHY_SERVERENTRYID)) { |
|
| 49 | 49 | $serverid = self::$decoder->getElementContent(); |
| 50 | 50 | $backendid = self::$deviceManager->GetBackendIdForFolderId($serverid); |
| 51 | - if(!self::$decoder->getElementEndTag()) |
|
| 51 | + if (!self::$decoder->getElementEndTag()) |
|
| 52 | 52 | return false; |
| 53 | 53 | } |
| 54 | 54 | |
@@ -58,31 +58,31 @@ discard block |
||
| 58 | 58 | |
| 59 | 59 | // when creating or updating more information is necessary |
| 60 | 60 | if (!$delete) { |
| 61 | - if(self::$decoder->getElementStartTag(SYNC_FOLDERHIERARCHY_PARENTID)) { |
|
| 61 | + if (self::$decoder->getElementStartTag(SYNC_FOLDERHIERARCHY_PARENTID)) { |
|
| 62 | 62 | $parentid = self::$decoder->getElementContent(); |
| 63 | 63 | $parentBackendId = self::$deviceManager->GetBackendIdForFolderId($parentid); |
| 64 | - if(!self::$decoder->getElementEndTag()) |
|
| 64 | + if (!self::$decoder->getElementEndTag()) |
|
| 65 | 65 | return false; |
| 66 | 66 | } |
| 67 | 67 | |
| 68 | 68 | // Displayname |
| 69 | - if(!self::$decoder->getElementStartTag(SYNC_FOLDERHIERARCHY_DISPLAYNAME)) |
|
| 69 | + if (!self::$decoder->getElementStartTag(SYNC_FOLDERHIERARCHY_DISPLAYNAME)) |
|
| 70 | 70 | return false; |
| 71 | 71 | $displayname = self::$decoder->getElementContent(); |
| 72 | - if(!self::$decoder->getElementEndTag()) |
|
| 72 | + if (!self::$decoder->getElementEndTag()) |
|
| 73 | 73 | return false; |
| 74 | 74 | |
| 75 | 75 | // Type |
| 76 | 76 | $type = false; |
| 77 | - if(self::$decoder->getElementStartTag(SYNC_FOLDERHIERARCHY_TYPE)) { |
|
| 77 | + if (self::$decoder->getElementStartTag(SYNC_FOLDERHIERARCHY_TYPE)) { |
|
| 78 | 78 | $type = self::$decoder->getElementContent(); |
| 79 | - if(!self::$decoder->getElementEndTag()) |
|
| 79 | + if (!self::$decoder->getElementEndTag()) |
|
| 80 | 80 | return false; |
| 81 | 81 | } |
| 82 | 82 | } |
| 83 | 83 | |
| 84 | 84 | // endtag foldercreate, folderupdate, folderdelete |
| 85 | - if(!self::$decoder->getElementEndTag()) |
|
| 85 | + if (!self::$decoder->getElementEndTag()) |
|
| 86 | 86 | return false; |
| 87 | 87 | |
| 88 | 88 | $status = SYNC_FSSTATUS_SUCCESS; |