@@ -24,8 +24,7 @@ discard block |
||
| 24 | 24 | // before we close the session. |
| 25 | 25 | if (isset($_SESSION["lang"])) { |
| 26 | 26 | $session_lang = $_SESSION["lang"]; |
| 27 | - } |
|
| 28 | - else { |
|
| 27 | + } else { |
|
| 29 | 28 | $session_lang = LANG; |
| 30 | 29 | } |
| 31 | 30 | |
@@ -62,8 +61,7 @@ discard block |
||
| 62 | 61 | // Return a HTTP 503 error so the client can act upon this event correctly. |
| 63 | 62 | header('HTTP/1.1 503 Service unavailable'); |
| 64 | 63 | header("X-grommunio-Hresult: " . get_mapi_error_name(WebAppAuthentication::getErrorCode())); |
| 65 | - } |
|
| 66 | - else { |
|
| 64 | + } else { |
|
| 67 | 65 | // The session expired, or the user is otherwise not logged on. |
| 68 | 66 | // Return a HTTP 401 error so the client can act upon this event correctly. |
| 69 | 67 | header('HTTP/1.1 401 Unauthorized'); |
@@ -145,8 +143,7 @@ discard block |
||
| 145 | 143 | // Execute the request |
| 146 | 144 | try { |
| 147 | 145 | $json = $request->execute($json); |
| 148 | - } |
|
| 149 | - catch (Exception $e) { |
|
| 146 | + } catch (Exception $e) { |
|
| 150 | 147 | // invalid requestdata exception |
| 151 | 148 | dump($e); |
| 152 | 149 | } |
@@ -160,8 +157,7 @@ discard block |
||
| 160 | 157 | // Set the correct header and compress the response |
| 161 | 158 | header("Content-Encoding: gzip"); |
| 162 | 159 | echo gzencode($json); |
| 163 | - } |
|
| 164 | - else { |
|
| 160 | + } else { |
|
| 165 | 161 | echo $json; |
| 166 | 162 | } |
| 167 | 163 | |
@@ -60,8 +60,7 @@ |
||
| 60 | 60 | case 'form': |
| 61 | 61 | if (isset($_GET['backend'])) { |
| 62 | 62 | $backend = urldecode($_GET["backend"]); |
| 63 | - } |
|
| 64 | - else { |
|
| 63 | + } else { |
|
| 65 | 64 | $backend = ''; |
| 66 | 65 | } |
| 67 | 66 | $backendstore = Files\Backend\BackendStore::getInstance(); |
@@ -47,11 +47,9 @@ discard block |
||
| 47 | 47 | default: |
| 48 | 48 | $this->handleUnknownActionType($actionType); |
| 49 | 49 | } |
| 50 | - } |
|
| 51 | - catch (MAPIException $e) { |
|
| 50 | + } catch (MAPIException $e) { |
|
| 52 | 51 | $this->sendFeedback(false, $this->errorDetailsFromException($e)); |
| 53 | - } |
|
| 54 | - catch (AccountException $e) { |
|
| 52 | + } catch (AccountException $e) { |
|
| 55 | 53 | $this->sendFeedback(false, [ |
| 56 | 54 | 'type' => ERROR_GENERAL, |
| 57 | 55 | 'info' => [ |
@@ -60,8 +58,7 @@ discard block |
||
| 60 | 58 | 'display_message' => $e->getMessage(), |
| 61 | 59 | ], |
| 62 | 60 | ]); |
| 63 | - } |
|
| 64 | - catch (BackendException $e) { |
|
| 61 | + } catch (BackendException $e) { |
|
| 65 | 62 | $this->sendFeedback(false, [ |
| 66 | 63 | 'type' => ERROR_GENERAL, |
| 67 | 64 | 'info' => [ |
@@ -71,8 +68,7 @@ discard block |
||
| 71 | 68 | 'code' => $e->getCode(), |
| 72 | 69 | ], |
| 73 | 70 | ]); |
| 74 | - } |
|
| 75 | - catch (Exception $e) { |
|
| 71 | + } catch (Exception $e) { |
|
| 76 | 72 | $this->sendFeedback(false, [ |
| 77 | 73 | 'type' => ERROR_GENERAL, |
| 78 | 74 | 'info' => [ |
@@ -172,8 +168,7 @@ discard block |
||
| 172 | 168 | } |
| 173 | 169 | |
| 174 | 170 | $this->sendFeedback(true); |
| 175 | - } |
|
| 176 | - else { |
|
| 171 | + } else { |
|
| 177 | 172 | $nodeId = $actionData['folder_id']; |
| 178 | 173 | $relNodeId = substr($nodeId, strpos($nodeId, '/')); |
| 179 | 174 | |
@@ -185,8 +180,7 @@ discard block |
||
| 185 | 180 | |
| 186 | 181 | try { |
| 187 | 182 | $initializedBackend->delete($relNodeId); |
| 188 | - } |
|
| 189 | - catch (\Files\Backend\Exception $e) { |
|
| 183 | + } catch (\Files\Backend\Exception $e) { |
|
| 190 | 184 | // TODO: this might fails because the file was already deleted. |
| 191 | 185 | // fire error message if any other error occurred. |
| 192 | 186 | // Logger::debug(self::LOG_CONTEXT, "deleted a directory that was no longer available"); |
@@ -79,8 +79,7 @@ discard block |
||
| 79 | 79 | // Get the username from the Encryption store |
| 80 | 80 | $encryptionStore = \EncryptionStore::getInstance(); |
| 81 | 81 | $this->uid = $encryptionStore->get('username'); |
| 82 | - } |
|
| 83 | - else { |
|
| 82 | + } else { |
|
| 84 | 83 | $this->uid = $_SESSION["username"]; |
| 85 | 84 | } |
| 86 | 85 | // As of the V6, the following characters can not longer being a part of the key identifier: {}()/\@: |
@@ -259,8 +258,7 @@ discard block |
||
| 259 | 258 | $dir[$id]['store_entryid'] = $storeEntryid; |
| 260 | 259 | |
| 261 | 260 | $updateCache = true; |
| 262 | - } |
|
| 263 | - else { |
|
| 261 | + } else { |
|
| 264 | 262 | $entryid = $node['entryid']; |
| 265 | 263 | $parentEntryid = $node['parent_entryid']; |
| 266 | 264 | $storeEntryid = $node['store_entryid']; |
@@ -272,8 +270,7 @@ discard block |
||
| 272 | 270 | if (is_null($nodeHasSubFolder)) { |
| 273 | 271 | unset($dir[$id]); |
| 274 | 272 | $updateCache = true; |
| 275 | - } |
|
| 276 | - else { |
|
| 273 | + } else { |
|
| 277 | 274 | array_push($nodes, [ |
| 278 | 275 | 'id' => $realID, |
| 279 | 276 | 'folder_id' => $realID, |
@@ -367,8 +364,7 @@ discard block |
||
| 367 | 364 | try { |
| 368 | 365 | $dir = $backend->ls($id); |
| 369 | 366 | $this->setCache($accountID, $cachePath, $dir); |
| 370 | - } |
|
| 371 | - catch (Exception $e) { |
|
| 367 | + } catch (Exception $e) { |
|
| 372 | 368 | $errorCode = $e->getCode(); |
| 373 | 369 | |
| 374 | 370 | // If folder not found or folder doesn't have enough access then don't display that folder. |
@@ -379,8 +375,7 @@ discard block |
||
| 379 | 375 | $errorCode === self::ALL_BACKEND_ERR_NOTFOUND) { |
| 380 | 376 | if ($errorCode === self::ALL_BACKEND_ERR_NOTFOUND) { |
| 381 | 377 | Logger::error(self::LOG_CONTEXT, '[hasSubFolder]: folder ' . $id . ' not found'); |
| 382 | - } |
|
| 383 | - else { |
|
| 378 | + } else { |
|
| 384 | 379 | Logger::error(self::LOG_CONTEXT, '[hasSubFolder]: Access denied for folder ' . $id); |
| 385 | 380 | } |
| 386 | 381 | |
@@ -480,8 +475,7 @@ discard block |
||
| 480 | 475 | ]; |
| 481 | 476 | $response = $folder; |
| 482 | 477 | } |
| 483 | - } |
|
| 484 | - else { |
|
| 478 | + } else { |
|
| 485 | 479 | // Rename/update the folder/file name |
| 486 | 480 | $folderId = $actionData['message_action']["source_folder_id"]; |
| 487 | 481 | // rename/update the folder or files name. |
@@ -517,8 +511,7 @@ discard block |
||
| 517 | 511 | $this->setCache($account->getId(), dirname($relSrc), $dir); |
| 518 | 512 | |
| 519 | 513 | $this->updateCacheAfterRename($relSrc, $relDst, $account->getId()); |
| 520 | - } |
|
| 521 | - else { |
|
| 514 | + } else { |
|
| 522 | 515 | // clear the cache |
| 523 | 516 | $this->deleteCache($account->getId(), dirname($relSrc)); |
| 524 | 517 | } |
@@ -753,8 +746,7 @@ discard block |
||
| 753 | 746 | foreach ($action["store_entryid"] as $store_id) { |
| 754 | 747 | array_push($store, $store_id); |
| 755 | 748 | } |
| 756 | - } |
|
| 757 | - else { |
|
| 749 | + } else { |
|
| 758 | 750 | $store = $action["store_entryid"]; |
| 759 | 751 | } |
| 760 | 752 | } |
@@ -71,8 +71,7 @@ discard block |
||
| 71 | 71 | array_push($list, $file); |
| 72 | 72 | } |
| 73 | 73 | } |
| 74 | - } |
|
| 75 | - else { |
|
| 74 | + } else { |
|
| 76 | 75 | Logger::error(self::LOG_CONTEXT, "Error opening the backend directory: " . $workdir); |
| 77 | 76 | } |
| 78 | 77 | |
@@ -99,8 +98,7 @@ discard block |
||
| 99 | 98 | array_push($list, $backendName); |
| 100 | 99 | } |
| 101 | 100 | } |
| 102 | - } |
|
| 103 | - else { |
|
| 101 | + } else { |
|
| 104 | 102 | Logger::error(self::LOG_CONTEXT, "Error opening the external backend directory: " . $workdir); |
| 105 | 103 | } |
| 106 | 104 | |
@@ -214,8 +214,7 @@ discard block |
||
| 214 | 214 | if ($backend_config["use_grommunio_credentials"] === false) { |
| 215 | 215 | $this->set_user($backend_config["user"]); |
| 216 | 216 | $this->set_pass($backend_config["password"]); |
| 217 | - } |
|
| 218 | - else { |
|
| 217 | + } else { |
|
| 219 | 218 | // For backward compatibility we will check if the Encryption store exists. If not, |
| 220 | 219 | // we will fall back to the old way of retrieving the password from the session. |
| 221 | 220 | if (class_exists('EncryptionStore')) { |
@@ -223,8 +222,7 @@ discard block |
||
| 223 | 222 | $encryptionStore = \EncryptionStore::getInstance(); |
| 224 | 223 | $this->set_user($encryptionStore->get('username')); |
| 225 | 224 | $this->set_pass($encryptionStore->get('password')); |
| 226 | - } |
|
| 227 | - else { |
|
| 225 | + } else { |
|
| 228 | 226 | $this->set_user($GLOBALS['mapisession']->getUserName()); |
| 229 | 227 | $password = $_SESSION['password']; |
| 230 | 228 | if (function_exists('openssl_decrypt')) { |
@@ -338,8 +336,7 @@ discard block |
||
| 338 | 336 | $this->sabre_client->addCurlSetting(CURLOPT_SSL_VERIFYPEER, !$this->allowselfsigned); |
| 339 | 337 | |
| 340 | 338 | return true; |
| 341 | - } |
|
| 342 | - catch (Exception $e) { |
|
| 339 | + } catch (Exception $e) { |
|
| 343 | 340 | $this->log('Failed to open: ' . $e->getMessage()); |
| 344 | 341 | if (intval($e->getHTTPCode()) == 401) { |
| 345 | 342 | $e = new BackendException($this->parseErrorCodeToMessage(self::WD_ERR_UNAUTHORIZED), $e->getHTTPCode()); |
@@ -417,15 +414,13 @@ discard block |
||
| 417 | 414 | $this->log("[LS] done in {$time} seconds"); |
| 418 | 415 | |
| 419 | 416 | return $lsdata; |
| 420 | - } |
|
| 421 | - catch (ClientException $e) { |
|
| 417 | + } catch (ClientException $e) { |
|
| 422 | 418 | $this->log('ls sabre ClientException: ' . $e->getMessage()); |
| 423 | 419 | $e = new BackendException($this->parseErrorCodeToMessage($e->getCode()), $e->getCode()); |
| 424 | 420 | $e->setTitle($this->backendTransName . _('Sabre error')); |
| 425 | 421 | |
| 426 | 422 | throw $e; |
| 427 | - } |
|
| 428 | - catch (Exception $e) { |
|
| 423 | + } catch (Exception $e) { |
|
| 429 | 424 | $this->log('ls general exception: ' . $e->getMessage() . " [" . $e->getHTTPCode() . "]"); |
| 430 | 425 | // THIS IS A FIX FOR OWNCLOUD - It does return 500 instead of 401... |
| 431 | 426 | $err_code = $e->getHTTPCode(); |
@@ -465,14 +460,12 @@ discard block |
||
| 465 | 460 | $this->log("[MKCOL] done in {$time} seconds: " . $response['statusCode']); |
| 466 | 461 | |
| 467 | 462 | return true; |
| 468 | - } |
|
| 469 | - catch (ClientException $e) { |
|
| 463 | + } catch (ClientException $e) { |
|
| 470 | 464 | $e = new BackendException($this->parseErrorCodeToMessage($e->getCode()), $e->getCode()); |
| 471 | 465 | $e->setTitle($this->backendTransName . _('Sabre error')); |
| 472 | 466 | |
| 473 | 467 | throw $e; |
| 474 | - } |
|
| 475 | - catch (Exception $e) { |
|
| 468 | + } catch (Exception $e) { |
|
| 476 | 469 | $this->log('[MKCOL] fatal: ' . $e->getMessage()); |
| 477 | 470 | $e = new BackendException($this->parseErrorCodeToMessage($e->getHTTPCode()), $e->getHTTPCode()); |
| 478 | 471 | $e->setTitle($this->backendTransName . _('Directory creation failed')); |
@@ -502,14 +495,12 @@ discard block |
||
| 502 | 495 | $this->log("[DELETE] done in {$time} seconds: " . $response['statusCode']); |
| 503 | 496 | |
| 504 | 497 | return true; |
| 505 | - } |
|
| 506 | - catch (ClientException $e) { |
|
| 498 | + } catch (ClientException $e) { |
|
| 507 | 499 | $e = new BackendException($this->parseErrorCodeToMessage($e->getCode()), $e->getCode()); |
| 508 | 500 | $e->setTitle($this->backendTransName . _('Sabre error')); |
| 509 | 501 | |
| 510 | 502 | throw $e; |
| 511 | - } |
|
| 512 | - catch (Exception $e) { |
|
| 503 | + } catch (Exception $e) { |
|
| 513 | 504 | $this->log('[DELETE] fatal: ' . $e->getMessage()); |
| 514 | 505 | $e = new BackendException($this->parseErrorCodeToMessage($e->getHTTPCode()), $e->getHTTPCode()); |
| 515 | 506 | $e->setTitle($this->backendTransName . _('Deletion failed')); |
@@ -538,8 +529,7 @@ discard block |
||
| 538 | 529 | $this->log("[MOVE] start for dir: {$src_path} -> {$dst_path}"); |
| 539 | 530 | if ($overwrite) { |
| 540 | 531 | $overwrite = 'T'; |
| 541 | - } |
|
| 542 | - else { |
|
| 532 | + } else { |
|
| 543 | 533 | $overwrite = 'F'; |
| 544 | 534 | } |
| 545 | 535 | |
@@ -550,14 +540,12 @@ discard block |
||
| 550 | 540 | $this->log("[MOVE] done in {$time} seconds: " . $response['statusCode']); |
| 551 | 541 | |
| 552 | 542 | return true; |
| 553 | - } |
|
| 554 | - catch (ClientException $e) { |
|
| 543 | + } catch (ClientException $e) { |
|
| 555 | 544 | $e = new BackendException($this->parseErrorCodeToMessage($e->getCode()), $e->getCode()); |
| 556 | 545 | $e->setTitle($this->backendTransName . _('Sabre error')); |
| 557 | 546 | |
| 558 | 547 | throw $e; |
| 559 | - } |
|
| 560 | - catch (Exception $e) { |
|
| 548 | + } catch (Exception $e) { |
|
| 561 | 549 | $this->log('[MOVE] fatal: ' . $e->getMessage()); |
| 562 | 550 | $e = new BackendException($this->parseErrorCodeToMessage($e->getHTTPCode()), $e->getHTTPCode()); |
| 563 | 551 | $e->setTitle($this->backendTransName . _('Moving failed')); |
@@ -590,14 +578,12 @@ discard block |
||
| 590 | 578 | $this->log("[PUT] done in {$time} seconds: " . $response['statusCode']); |
| 591 | 579 | |
| 592 | 580 | return true; |
| 593 | - } |
|
| 594 | - catch (ClientException $e) { |
|
| 581 | + } catch (ClientException $e) { |
|
| 595 | 582 | $e = new BackendException($this->parseErrorCodeToMessage($e->getCode()), $e->getCode()); |
| 596 | 583 | $e->setTitle($this->backendTransName . _('Sabre error')); |
| 597 | 584 | |
| 598 | 585 | throw $e; |
| 599 | - } |
|
| 600 | - catch (Exception $e) { |
|
| 586 | + } catch (Exception $e) { |
|
| 601 | 587 | $this->log('[PUT] fatal: ' . $e->getMessage()); |
| 602 | 588 | $e = new BackendException($this->parseErrorCodeToMessage($e->getHTTPCode()), $e->getHTTPCode()); |
| 603 | 589 | $e->setTitle($this->backendTransName . _('Connection failed')); |
@@ -669,14 +655,12 @@ discard block |
||
| 669 | 655 | $time_end = microtime(true); |
| 670 | 656 | $time = $time_end - $time_start; |
| 671 | 657 | $this->log("[GET_FILE] done in {$time} seconds: " . $response['statusCode']); |
| 672 | - } |
|
| 673 | - catch (ClientException $e) { |
|
| 658 | + } catch (ClientException $e) { |
|
| 674 | 659 | $e = new BackendException($this->parseErrorCodeToMessage($e->getCode()), $e->getCode()); |
| 675 | 660 | $e->setTitle($this->backendTransName . _('Sabre error')); |
| 676 | 661 | |
| 677 | 662 | throw $e; |
| 678 | - } |
|
| 679 | - catch (Exception $e) { |
|
| 663 | + } catch (Exception $e) { |
|
| 680 | 664 | $this->log('[GET_FILE] - FATAL -' . $e->getMessage()); |
| 681 | 665 | $e = new BackendException($this->parseErrorCodeToMessage($e->getHTTPCode()), $e->getHTTPCode()); |
| 682 | 666 | $e->setTitle($this->backendTransName . _('File or folder not found')); |
@@ -751,8 +735,7 @@ discard block |
||
| 751 | 735 | $type = $response["{DAV:}resourcetype"]->resourceType; |
| 752 | 736 | if (is_array($type) && !empty($type)) { |
| 753 | 737 | $type = $type[0] == "{DAV:}collection" ? "collection" : "file"; |
| 754 | - } |
|
| 755 | - else { |
|
| 738 | + } else { |
|
| 756 | 739 | $type = "file"; // fall back to file if detection fails... less harmful |
| 757 | 740 | } |
| 758 | 741 | |
@@ -849,8 +832,7 @@ discard block |
||
| 849 | 832 | $this->log("[COPY] start for dir: {$src_path} -> {$dst_path}"); |
| 850 | 833 | if ($overwrite) { |
| 851 | 834 | $overwrite = 'T'; |
| 852 | - } |
|
| 853 | - else { |
|
| 835 | + } else { |
|
| 854 | 836 | $overwrite = 'F'; |
| 855 | 837 | } |
| 856 | 838 | |
@@ -866,14 +848,12 @@ discard block |
||
| 866 | 848 | $this->log("[COPY] done in {$time} seconds: " . $response['statusCode']); |
| 867 | 849 | |
| 868 | 850 | return true; |
| 869 | - } |
|
| 870 | - catch (ClientException $e) { |
|
| 851 | + } catch (ClientException $e) { |
|
| 871 | 852 | $e = new BackendException($this->parseErrorCodeToMessage($e->getCode()), $e->getCode()); |
| 872 | 853 | $e->setTitle($this->backendTransName . _('Sabre error')); |
| 873 | 854 | |
| 874 | 855 | throw $e; |
| 875 | - } |
|
| 876 | - catch (Exception $e) { |
|
| 856 | + } catch (Exception $e) { |
|
| 877 | 857 | $this->log('[COPY] - FATAL - ' . $e->getMessage()); |
| 878 | 858 | $e = new BackendException($this->parseErrorCodeToMessage($e->getHTTPCode()), $e->getHTTPCode()); |
| 879 | 859 | $e->setTitle($this->backendTransName . _('Copying failed')); |
@@ -890,8 +870,7 @@ discard block |
||
| 890 | 870 | protected function webdavUrl() { |
| 891 | 871 | if ($this->ssl) { |
| 892 | 872 | $url = "https://"; |
| 893 | - } |
|
| 894 | - else { |
|
| 873 | + } else { |
|
| 895 | 874 | $url = "http://"; |
| 896 | 875 | } |
| 897 | 876 | |
@@ -1098,8 +1077,7 @@ discard block |
||
| 1098 | 1077 | if ($httpcode && $httpcode == "200" && $versiondata) { |
| 1099 | 1078 | $versions = json_decode($versiondata); |
| 1100 | 1079 | $version = $versions->versionstring; |
| 1101 | - } |
|
| 1102 | - else { |
|
| 1080 | + } else { |
|
| 1103 | 1081 | $version = "Undetected (no Owncloud?)"; |
| 1104 | 1082 | } |
| 1105 | 1083 | |
@@ -20,8 +20,7 @@ discard block |
||
| 20 | 20 | |
| 21 | 21 | if ($dir == "DESC") { |
| 22 | 22 | usort($arr, ['self', 'invsort']); |
| 23 | - } |
|
| 24 | - else { |
|
| 23 | + } else { |
|
| 25 | 24 | usort($arr, ['self', 'sort']); |
| 26 | 25 | } |
| 27 | 26 | |
@@ -45,8 +44,7 @@ discard block |
||
| 45 | 44 | |
| 46 | 45 | if ($dir == "DESC") { |
| 47 | 46 | usort($arr, ['self', 'invpropsort']); |
| 48 | - } |
|
| 49 | - else { |
|
| 47 | + } else { |
|
| 50 | 48 | usort($arr, ['self', 'propsort']); |
| 51 | 49 | } |
| 52 | 50 | |
@@ -125,8 +125,7 @@ discard block |
||
| 125 | 125 | // Unable to decrypt, don't update |
| 126 | 126 | if ($version == 0 && !defined('FILES_PASSWORD_IV') && !defined('FILES_PASSWORD_KEY')) { |
| 127 | 127 | Logger::error(self::LOG_CONTEXT, "Unable to update the account to as FILES_PASSWORD_IV/FILES_PASSWORD_KEY is not set"); |
| 128 | - } |
|
| 129 | - else { |
|
| 128 | + } else { |
|
| 130 | 129 | // store all backend configurations |
| 131 | 130 | foreach ($account->getBackendConfig() as $key => $value) { |
| 132 | 131 | if ($key !== "version") { |
@@ -228,11 +227,9 @@ discard block |
||
| 228 | 227 | $backend_config = $this->decryptBackendConfig($acc["backend_config"], $version); |
| 229 | 228 | // version is lost after decryption, add it again |
| 230 | 229 | $backend_config["version"] = $version; |
| 231 | - } |
|
| 232 | - elseif ($version === 0) { |
|
| 230 | + } elseif ($version === 0) { |
|
| 233 | 231 | Logger::error(self::LOG_CONTEXT, "FILES_PASSWORD_IV or FILES_PASSWORD_KEY not set, unable to decrypt backend configuration"); |
| 234 | - } |
|
| 235 | - else { |
|
| 232 | + } else { |
|
| 236 | 233 | Logger::error(self::LOG_CONTEXT, "Unsupported account version {$version}, unable to decrypt backend configuration"); |
| 237 | 234 | } |
| 238 | 235 | |
@@ -268,8 +265,7 @@ discard block |
||
| 268 | 265 | $backendInstance->open(); |
| 269 | 266 | $backendInstance->ls("/"); |
| 270 | 267 | $status = Account::STATUS_OK; |
| 271 | - } |
|
| 272 | - catch (BackendException $e) { |
|
| 268 | + } catch (BackendException $e) { |
|
| 273 | 269 | $status = Account::STATUS_ERROR; |
| 274 | 270 | $description = $e->getMessage(); |
| 275 | 271 | |
@@ -322,8 +318,7 @@ discard block |
||
| 322 | 318 | if ($key !== "version") { |
| 323 | 319 | try { |
| 324 | 320 | $decBackendConfig[$key] = $this->decryptBackendConfigProperty($value, $version); |
| 325 | - } |
|
| 326 | - catch (Exception $e) { |
|
| 321 | + } catch (Exception $e) { |
|
| 327 | 322 | Logger::error(self::LOG_CONTEXT, sprintf("Unable to decrypt backend configuration: '%s'", $e->getMessage())); |
| 328 | 323 | } |
| 329 | 324 | } |
@@ -346,8 +341,7 @@ discard block |
||
| 346 | 341 | $key = $GLOBALS["operations"]->getFilesEncryptionKey(); |
| 347 | 342 | $encrypted = sodium_crypto_secretbox($value, $nonce, $key); |
| 348 | 343 | $value = bin2hex($nonce) . bin2hex($encrypted); |
| 349 | - } |
|
| 350 | - elseif ($version !== self::ACCOUNT_VERSION) { |
|
| 344 | + } elseif ($version !== self::ACCOUNT_VERSION) { |
|
| 351 | 345 | throw Exception("Unable to encrypt backend configuration unsupported version {$version}"); |
| 352 | 346 | } |
| 353 | 347 | |
@@ -23,12 +23,10 @@ discard block |
||
| 23 | 23 | // parse account id. |
| 24 | 24 | if (isset($_POST["parentID"])) { // will be set if a standard upload is used. |
| 25 | 25 | $dstID = $_POST["parentID"]; |
| 26 | - } |
|
| 27 | - else { |
|
| 26 | + } else { |
|
| 28 | 27 | if (isset($_SERVER['HTTP_X_FILE_DESTINATION'])) { // will be set if the upload is a ajax upload. |
| 29 | 28 | $dstID = $_SERVER['HTTP_X_FILE_DESTINATION']; |
| 30 | - } |
|
| 31 | - else { |
|
| 29 | + } else { |
|
| 32 | 30 | Logger::error(self::LOG_CONTEXT, "upload failed: No destination given"); |
| 33 | 31 | echo json_encode(['success' => false, 'response' => 'No destination given', 'message' => 'No destination given']); |
| 34 | 32 | |
@@ -53,8 +51,7 @@ discard block |
||
| 53 | 51 | |
| 54 | 52 | try { |
| 55 | 53 | $initializedBackend->open(); |
| 56 | - } |
|
| 57 | - catch (\Files\Backend\Exception $e) { |
|
| 54 | + } catch (\Files\Backend\Exception $e) { |
|
| 58 | 55 | Logger::error(self::LOG_CONTEXT, "backend initialization failed: " . $e->getMessage()); |
| 59 | 56 | echo json_encode(['success' => false, 'response' => $e->getCode(), 'message' => $e->getMessage()]); |
| 60 | 57 | |
@@ -81,8 +78,7 @@ discard block |
||
| 81 | 78 | |
| 82 | 79 | fwrite($fileWriter, $buffer); |
| 83 | 80 | } |
| 84 | - } |
|
| 85 | - else { // fallback to tmp files |
|
| 81 | + } else { // fallback to tmp files |
|
| 86 | 82 | $targetPath = UploadHandler::checkFilesNameConflict($targetPath, $initializedBackend, $relNodeId); |
| 87 | 83 | $targetPath = rawurldecode($targetPath); |
| 88 | 84 | $temp_file = tempnam(TMP_PATH, "{$targetPath}"); |
@@ -134,8 +130,7 @@ discard block |
||
| 134 | 130 | |
| 135 | 131 | fwrite($fileWriter, $buffer); |
| 136 | 132 | } |
| 137 | - } |
|
| 138 | - else { // use the normal way - might have a high memory footprint |
|
| 133 | + } else { // use the normal way - might have a high memory footprint |
|
| 139 | 134 | $initializedBackend->put_file($targetPath, $_FILES['attachments']['tmp_name'][$i]); |
| 140 | 135 | } |
| 141 | 136 | |
@@ -144,8 +139,7 @@ discard block |
||
| 144 | 139 | echo json_encode(['success' => true, 'parent' => $dstID, 'items' => $items]); |
| 145 | 140 | |
| 146 | 141 | exit(); |
| 147 | - } |
|
| 148 | - catch (\Files\Backend\Exception $e) { |
|
| 142 | + } catch (\Files\Backend\Exception $e) { |
|
| 149 | 143 | Logger::error(self::LOG_CONTEXT, "upload failed: " . $e->getMessage()); |
| 150 | 144 | echo json_encode(['success' => false, 'response' => $e->getCode(), 'message' => $e->getMessage()]); |
| 151 | 145 | |