@@ -130,7 +130,7 @@ discard block |
||
| 130 | 130 | } |
| 131 | 131 | |
| 132 | 132 | // Unable to decrypt, don't update |
| 133 | - if ($version == 0 && !defined('FILES_PASSWORD_IV') && !defined('FILES_PASSWORD_KEY')) { |
|
| 133 | + if ($version == 0 && !defined('FILES_PASSWORD_IV') && !defined('FILES_PASSWORD_KEY')) { |
|
| 134 | 134 | Logger::error(self::LOG_CONTEXT, "Unable to update the account to as FILES_PASSWORD_IV/FILES_PASSWORD_KEY is not set"); |
| 135 | 135 | } else { |
| 136 | 136 | // store all backend configurations |
@@ -304,8 +304,8 @@ discard block |
||
| 304 | 304 | */ |
| 305 | 305 | private function getNewSequenceNumber() { |
| 306 | 306 | $seq = 0; |
| 307 | - foreach($this->accounts as $acc) { |
|
| 308 | - if($acc->getSequence() > $seq) { |
|
| 307 | + foreach ($this->accounts as $acc) { |
|
| 308 | + if ($acc->getSequence() > $seq) { |
|
| 309 | 309 | $seq = $acc->getSequence(); |
| 310 | 310 | } |
| 311 | 311 | } |
@@ -320,10 +320,10 @@ discard block |
||
| 320 | 320 | * like username, password, serveraddress, ... |
| 321 | 321 | * @return array |
| 322 | 322 | */ |
| 323 | - private function decryptBackendConfig($backendConfig, $version=0) { |
|
| 323 | + private function decryptBackendConfig($backendConfig, $version = 0) { |
|
| 324 | 324 | $decBackendConfig = array(); |
| 325 | 325 | |
| 326 | - foreach($backendConfig as $key => $value) { |
|
| 326 | + foreach ($backendConfig as $key => $value) { |
|
| 327 | 327 | if ($key !== "version") { |
| 328 | 328 | try { |
| 329 | 329 | $decBackendConfig[$key] = $this->decryptBackendConfigProperty($value, $version); |
@@ -343,7 +343,7 @@ discard block |
||
| 343 | 343 | * @param $version the storage version used to identify what encryption to use |
| 344 | 344 | * @return string |
| 345 | 345 | */ |
| 346 | - private function encryptBackendConfigProperty($value, $version=0) { |
|
| 346 | + private function encryptBackendConfigProperty($value, $version = 0) { |
|
| 347 | 347 | if ($version == self::ACCOUNT_VERSION && !is_bool($value)) { |
| 348 | 348 | $nonce = random_bytes(SODIUM_CRYPTO_SECRETBOX_NONCEBYTES); |
| 349 | 349 | $key = $GLOBALS["operations"]->getFilesEncryptionKey(); |
@@ -363,7 +363,7 @@ discard block |
||
| 363 | 363 | * @param $version the storage version used to identify what encryption to use |
| 364 | 364 | * @return string |
| 365 | 365 | */ |
| 366 | - private function decryptBackendConfigProperty($value, $version=0) { |
|
| 366 | + private function decryptBackendConfigProperty($value, $version = 0) { |
|
| 367 | 367 | if (is_bool($value)) { |
| 368 | 368 | return $value; |
| 369 | 369 | } |
@@ -208,7 +208,7 @@ |
||
| 208 | 208 | */ |
| 209 | 209 | public function getSequence() |
| 210 | 210 | { |
| 211 | - if(!$this->sequence) { |
|
| 211 | + if (!$this->sequence) { |
|
| 212 | 212 | $this->sequence = 0; |
| 213 | 213 | } |
| 214 | 214 | |
@@ -159,13 +159,13 @@ |
||
| 159 | 159 | */ |
| 160 | 160 | public static function checkFilesNameConflict($targetPath, $initializedBackend, $relNodeId) |
| 161 | 161 | { |
| 162 | - $keepBoth = isset($_REQUEST["keep_both"])? $_REQUEST["keep_both"] : false; |
|
| 162 | + $keepBoth = isset($_REQUEST["keep_both"]) ? $_REQUEST["keep_both"] : false; |
|
| 163 | 163 | // Check if file was already exist in directory and $keepBoth is true |
| 164 | 164 | // then append the counter in files name. |
| 165 | 165 | if (strtolower($keepBoth) === 'true') { |
| 166 | 166 | $lsNodes = $initializedBackend->ls($relNodeId); |
| 167 | 167 | $nodeExist = array_key_exists(rawurldecode($targetPath), $lsNodes); |
| 168 | - if($nodeExist) { |
|
| 168 | + if ($nodeExist) { |
|
| 169 | 169 | $i = 1; |
| 170 | 170 | $targetPathInfo = pathinfo($targetPath); |
| 171 | 171 | do { |
@@ -51,7 +51,7 @@ |
||
| 51 | 51 | $this->injectPluginSettings($data); |
| 52 | 52 | break; |
| 53 | 53 | case 'server.index.load.custom': |
| 54 | - switch($data['name']) { |
|
| 54 | + switch ($data['name']) { |
|
| 55 | 55 | case 'files_get_recipients': |
| 56 | 56 | RecipientHandler::doGetRecipients(); |
| 57 | 57 | break; |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | |
| 77 | 77 | // For backward compatibility we will check if the Encryption store exists. If not, |
| 78 | 78 | // we will fall back to the old way of retrieving the password from the session. |
| 79 | - if ( class_exists('EncryptionStore') ) { |
|
| 79 | + if (class_exists('EncryptionStore')) { |
|
| 80 | 80 | // Get the username from the Encryption store |
| 81 | 81 | $encryptionStore = \EncryptionStore::getInstance(); |
| 82 | 82 | $this->uid = $encryptionStore->get('username'); |
@@ -101,11 +101,11 @@ discard block |
||
| 101 | 101 | { |
| 102 | 102 | $data = array(); |
| 103 | 103 | $data["item"] = array(); |
| 104 | - $versions = $GLOBALS['PluginManager']->getPluginsVersion(); |
|
| 104 | + $versions = $GLOBALS['PluginManager']->getPluginsVersion(); |
|
| 105 | 105 | $filesVersion = $versions['files']; |
| 106 | 106 | |
| 107 | 107 | // Clear cache when version gets changed and update 'files' version in cache. |
| 108 | - if ($isReload || version_compare($this->getVersionFromCache('files'), $filesVersion) !== 0) { |
|
| 108 | + if ($isReload || version_compare($this->getVersionFromCache('files'), $filesVersion) !== 0) { |
|
| 109 | 109 | $this->clearCache(); |
| 110 | 110 | $this->setVersionInCache('files', $filesVersion); |
| 111 | 111 | } |
@@ -181,7 +181,7 @@ discard block |
||
| 181 | 181 | 'display_name' => "Files", |
| 182 | 182 | ) |
| 183 | 183 | )); |
| 184 | - $nodes["folders"] = array( "item" => $subFolders); |
|
| 184 | + $nodes["folders"] = array("item" => $subFolders); |
|
| 185 | 185 | array_push($data["item"], $nodes); |
| 186 | 186 | } |
| 187 | 187 | |
@@ -213,11 +213,11 @@ discard block |
||
| 213 | 213 | |
| 214 | 214 | $backendDisplayName = $backend->backendDisplayName; |
| 215 | 215 | $backendVersion = $backend->backendVersion; |
| 216 | - $cacheVersion = $this->getVersionFromCache($backendDisplayName, $accountID); |
|
| 216 | + $cacheVersion = $this->getVersionFromCache($backendDisplayName, $accountID); |
|
| 217 | 217 | $dir = $this->getCache($accountID, $cachePath); |
| 218 | 218 | |
| 219 | 219 | // Get new data from backend when cache is empty or the version of backend got changed. |
| 220 | - if (is_null($dir) || version_compare($backendVersion,$cacheVersion) !== 0) { |
|
| 220 | + if (is_null($dir) || version_compare($backendVersion, $cacheVersion) !== 0) { |
|
| 221 | 221 | $this->setVersionInCache($backendDisplayName, $backendVersion, $accountID); |
| 222 | 222 | $dir = $backend->ls($relNodeId); |
| 223 | 223 | } |
@@ -251,7 +251,7 @@ discard block |
||
| 251 | 251 | |
| 252 | 252 | $entryid = $this->createId($realID); |
| 253 | 253 | $parentEntryid = $parentNode !== false && isset($parentNode['entryid']) ? $parentNode['entryid'] : $this->createId($nodeId); |
| 254 | - $storeEntryid = $this->createId($nodeIdPrefix .'/'); |
|
| 254 | + $storeEntryid = $this->createId($nodeIdPrefix . '/'); |
|
| 255 | 255 | |
| 256 | 256 | $dir[$id]['entryid'] = $entryid; |
| 257 | 257 | $dir[$id]['parent_entryid'] = $parentEntryid; |
@@ -370,13 +370,13 @@ discard block |
||
| 370 | 370 | if ($errorCode === self::SMB_ERR_UNAUTHORIZED || |
| 371 | 371 | $errorCode === self::SMB_ERR_FORBIDDEN || |
| 372 | 372 | $errorCode === self::FTP_WD_OWNCLOUD_ERR_UNAUTHORIZED || |
| 373 | - $errorCode === self::FTP_WD_OWNCLOUD_ERR_FORBIDDEN|| |
|
| 373 | + $errorCode === self::FTP_WD_OWNCLOUD_ERR_FORBIDDEN || |
|
| 374 | 374 | $errorCode === self::ALL_BACKEND_ERR_NOTFOUND) { |
| 375 | 375 | |
| 376 | 376 | if ($errorCode === self::ALL_BACKEND_ERR_NOTFOUND) { |
| 377 | - Logger::error(self::LOG_CONTEXT, '[hasSubFolder]: folder '. $id .' not found'); |
|
| 377 | + Logger::error(self::LOG_CONTEXT, '[hasSubFolder]: folder ' . $id . ' not found'); |
|
| 378 | 378 | } else { |
| 379 | - Logger::error(self::LOG_CONTEXT, '[hasSubFolder]: Access denied for folder '. $id); |
|
| 379 | + Logger::error(self::LOG_CONTEXT, '[hasSubFolder]: Access denied for folder ' . $id); |
|
| 380 | 380 | } |
| 381 | 381 | return null; |
| 382 | 382 | } |
@@ -410,7 +410,7 @@ discard block |
||
| 410 | 410 | $path = isset($props['path']) && !empty($props['path']) ? $props['path'] : "/"; |
| 411 | 411 | |
| 412 | 412 | $relDirname = substr($path, strpos($path, '/')); |
| 413 | - $relDirname = $relDirname . $props["display_name"] .'/'; |
|
| 413 | + $relDirname = $relDirname . $props["display_name"] . '/'; |
|
| 414 | 414 | $account = $this->accountFromNode($path); |
| 415 | 415 | |
| 416 | 416 | // initialize the backend |
@@ -573,7 +573,7 @@ discard block |
||
| 573 | 573 | } |
| 574 | 574 | |
| 575 | 575 | if ($type === FILES_FOLDER) { |
| 576 | - $this->updateCacheAfterRename($id, rtrim($newId, '/'), $accountId); |
|
| 576 | + $this->updateCacheAfterRename($id, rtrim($newId, '/'), $accountId); |
|
| 577 | 577 | } |
| 578 | 578 | } |
| 579 | 579 | $this->deleteCache($accountId, $cachePath); |
@@ -637,7 +637,7 @@ discard block |
||
| 637 | 637 | */ |
| 638 | 638 | function getVersionFromCache($displayName, $accountID = '') |
| 639 | 639 | { |
| 640 | - $key = $this->uid . $accountID . $displayName; |
|
| 640 | + $key = $this->uid . $accountID . $displayName; |
|
| 641 | 641 | return $this->cache->getItem($key)->get(); |
| 642 | 642 | } |
| 643 | 643 | |
@@ -652,7 +652,7 @@ discard block |
||
| 652 | 652 | { |
| 653 | 653 | $olderVersionFromCache = $this->getVersionFromCache($displayName, $accountID); |
| 654 | 654 | // If version of files/backend is same then return. |
| 655 | - if (version_compare($olderVersionFromCache,$version) === 0) { |
|
| 655 | + if (version_compare($olderVersionFromCache, $version) === 0) { |
|
| 656 | 656 | return; |
| 657 | 657 | } |
| 658 | 658 | |
@@ -670,7 +670,7 @@ discard block |
||
| 670 | 670 | { |
| 671 | 671 | $backend = $this->backendStore->getInstanceOfBackend($account->getBackend()); |
| 672 | 672 | $backend->init_backend($account->getBackendConfig()); |
| 673 | - if($setID) { |
|
| 673 | + if ($setID) { |
|
| 674 | 674 | $backend->setAccountID($account->getId()); |
| 675 | 675 | } |
| 676 | 676 | $backend->open(); |
@@ -711,7 +711,7 @@ discard block |
||
| 711 | 711 | function deleteCache($accountID, $path) |
| 712 | 712 | { |
| 713 | 713 | $key = $this->makeCacheKey($accountID, $path); |
| 714 | - Logger::debug(self::LOG_CONTEXT, "Removing cache for node: " . $accountID . $path . " ## " . $key); |
|
| 714 | + Logger::debug(self::LOG_CONTEXT, "Removing cache for node: " . $accountID . $path . " ## " . $key); |
|
| 715 | 715 | $this->cache->deleteItem($key); |
| 716 | 716 | } |
| 717 | 717 | |
@@ -733,10 +733,10 @@ discard block |
||
| 733 | 733 | { |
| 734 | 734 | $store = false; |
| 735 | 735 | |
| 736 | - if(isset($action["store_entryid"]) && !empty($action["store_entryid"])) { |
|
| 737 | - if(is_array($action["store_entryid"])) { |
|
| 736 | + if (isset($action["store_entryid"]) && !empty($action["store_entryid"])) { |
|
| 737 | + if (is_array($action["store_entryid"])) { |
|
| 738 | 738 | $store = array(); |
| 739 | - foreach($action["store_entryid"] as $store_id) { |
|
| 739 | + foreach ($action["store_entryid"] as $store_id) { |
|
| 740 | 740 | array_push($store, $store_id); |
| 741 | 741 | } |
| 742 | 742 | } else { |
@@ -104,7 +104,7 @@ discard block |
||
| 104 | 104 | { |
| 105 | 105 | $nodeId = $action["folder_id"]; |
| 106 | 106 | $account = $this->accountFromNode($nodeId); |
| 107 | - $backend = $this->initializeBackend($account,true); |
|
| 107 | + $backend = $this->initializeBackend($account, true); |
|
| 108 | 108 | $subFolders = $this->getSubFolders($nodeId, $backend); |
| 109 | 109 | |
| 110 | 110 | $this->addActionData("updatelist", array("item"=>$subFolders)); |
@@ -119,7 +119,7 @@ discard block |
||
| 119 | 119 | function save($actionData) |
| 120 | 120 | { |
| 121 | 121 | $messageProps = parent::save($actionData); |
| 122 | - if(!empty($messageProps)) { |
|
| 122 | + if (!empty($messageProps)) { |
|
| 123 | 123 | // Notify all subfolders for update folder. |
| 124 | 124 | $this->notifySubFolders($messageProps["props"]["folder_id"]); |
| 125 | 125 | |
@@ -55,7 +55,7 @@ |
||
| 55 | 55 | $result = $this->accountDelete($actionType, $actionData); |
| 56 | 56 | break; |
| 57 | 57 | case "list": |
| 58 | - if(isset($actionData["list_backend"]) && $actionData["list_backend"]) { |
|
| 58 | + if (isset($actionData["list_backend"]) && $actionData["list_backend"]) { |
|
| 59 | 59 | $result = $this->backendInformation($actionType); |
| 60 | 60 | } else { |
| 61 | 61 | $result = $this->accountList($actionType, $actionData); |
@@ -345,7 +345,7 @@ discard block |
||
| 345 | 345 | if (!isset($node['entryid']) || !isset($node['parent_entryid']) || !isset($node['store_entryid'])) { |
| 346 | 346 | $entryid = $this->createId($realID); |
| 347 | 347 | $parentEntryid = $this->createId($path); |
| 348 | - $storeEntryid = $this->createId($nodeIdPrefix .'/'); |
|
| 348 | + $storeEntryid = $this->createId($nodeIdPrefix . '/'); |
|
| 349 | 349 | |
| 350 | 350 | $dir[$id]['entryid'] = $entryid; |
| 351 | 351 | $dir[$id]['parent_entryid'] = $parentEntryid; |
@@ -631,7 +631,7 @@ discard block |
||
| 631 | 631 | { |
| 632 | 632 | $messageProps = $this->save($actionData); |
| 633 | 633 | $notifySubFolders = isset($actionData['message_action']['isFolder']) ? $actionData['message_action']['isFolder'] : true; |
| 634 | - if(!empty($messageProps)) { |
|
| 634 | + if (!empty($messageProps)) { |
|
| 635 | 635 | $GLOBALS["bus"]->notify(REQUEST_ENTRYID, OBJECT_SAVE, $messageProps); |
| 636 | 636 | if ($notifySubFolders) { |
| 637 | 637 | $this->notifySubFolders($messageProps["props"]["folder_id"]); |
@@ -904,7 +904,7 @@ discard block |
||
| 904 | 904 | // Loop through the attachNums, message in message in message ... |
| 905 | 905 | for ($i = 0; $i < (count($attachNum) - 1); $i++) { |
| 906 | 906 | // Open the attachment |
| 907 | - $tempattach = mapi_message_openattach($message, (int)$attachNum[$i]); |
|
| 907 | + $tempattach = mapi_message_openattach($message, (int) $attachNum[$i]); |
|
| 908 | 908 | if ($tempattach) { |
| 909 | 909 | // Open the object in the attachment |
| 910 | 910 | $message = mapi_attach_openobj($tempattach); |
@@ -912,7 +912,7 @@ discard block |
||
| 912 | 912 | } |
| 913 | 913 | |
| 914 | 914 | // Open the attachment |
| 915 | - $attachment = mapi_message_openattach($message, (int)$attachNum[(count($attachNum) - 1)]); |
|
| 915 | + $attachment = mapi_message_openattach($message, (int) $attachNum[(count($attachNum) - 1)]); |
|
| 916 | 916 | } |
| 917 | 917 | |
| 918 | 918 | // Check if the attachment is opened |
@@ -27,11 +27,11 @@ |
||
| 27 | 27 | switch ($event) { |
| 28 | 28 | case OBJECT_DELETE: |
| 29 | 29 | $props["folderdelete"] = 1; |
| 30 | - $this->addNotificationActionData("folders", array( "item" => array($props))); |
|
| 30 | + $this->addNotificationActionData("folders", array("item" => array($props))); |
|
| 31 | 31 | $GLOBALS["bus"]->addData($this->createNotificationResponseData()); |
| 32 | 32 | break; |
| 33 | 33 | case OBJECT_SAVE: |
| 34 | - $this->addNotificationActionData("folders", array( "item" => $props)); |
|
| 34 | + $this->addNotificationActionData("folders", array("item" => $props)); |
|
| 35 | 35 | $GLOBALS["bus"]->addData($this->createNotificationResponseData()); |
| 36 | 36 | break; |
| 37 | 37 | } |