@@ -18,8 +18,7 @@ discard block |
||
| 18 | 18 | // only possible to download files from one backend at a time. |
| 19 | 19 | if (isset($_GET["ids"])) { |
| 20 | 20 | $tmpId = $_GET["ids"][0]; |
| 21 | - } |
|
| 22 | - else { |
|
| 21 | + } else { |
|
| 23 | 22 | $tmpId = $_GET["id"]; |
| 24 | 23 | } |
| 25 | 24 | $accountID = substr($tmpId, 3, (strpos($tmpId, '/') - 3)); |
@@ -36,8 +35,7 @@ discard block |
||
| 36 | 35 | |
| 37 | 36 | try { |
| 38 | 37 | $initializedBackend->open(); |
| 39 | - } |
|
| 40 | - catch (\Files\Backend\Exception $e) { |
|
| 38 | + } catch (\Files\Backend\Exception $e) { |
|
| 41 | 39 | Logger::error(self::LOG_CONTEXT, "Could not open the backend: " . $e->getMessage()); |
| 42 | 40 | echo json_encode(['success' => false, 'response' => $e->getCode(), 'message' => $e->getMessage()]); |
| 43 | 41 | |
@@ -44,8 +44,7 @@ discard block |
||
| 44 | 44 | // check if we should create a new account or edit an existing one |
| 45 | 45 | if (isset($actionData["entryid"])) { |
| 46 | 46 | $result = $this->accountUpdate($actionData); |
| 47 | - } |
|
| 48 | - else { |
|
| 47 | + } else { |
|
| 49 | 48 | $result = $this->accountCreate($actionData); |
| 50 | 49 | } |
| 51 | 50 | break; |
@@ -57,8 +56,7 @@ discard block |
||
| 57 | 56 | case "list": |
| 58 | 57 | if (isset($actionData["list_backend"]) && $actionData["list_backend"]) { |
| 59 | 58 | $result = $this->backendInformation($actionType); |
| 60 | - } |
|
| 61 | - else { |
|
| 59 | + } else { |
|
| 62 | 60 | $result = $this->accountList($actionType, $actionData); |
| 63 | 61 | } |
| 64 | 62 | break; |
@@ -78,11 +76,9 @@ discard block |
||
| 78 | 76 | default: |
| 79 | 77 | $this->handleUnknownActionType($actionType); |
| 80 | 78 | } |
| 81 | - } |
|
| 82 | - catch (MAPIException $e) { |
|
| 79 | + } catch (MAPIException $e) { |
|
| 83 | 80 | $this->sendFeedback(false, $this->errorDetailsFromException($e)); |
| 84 | - } |
|
| 85 | - catch (AccountException $e) { |
|
| 81 | + } catch (AccountException $e) { |
|
| 86 | 82 | $this->sendFeedback(false, [ |
| 87 | 83 | 'type' => ERROR_GENERAL, |
| 88 | 84 | 'info' => [ |
@@ -91,8 +87,7 @@ discard block |
||
| 91 | 87 | 'display_message' => $e->getMessage(), |
| 92 | 88 | ], |
| 93 | 89 | ]); |
| 94 | - } |
|
| 95 | - catch (BackendException $e) { |
|
| 90 | + } catch (BackendException $e) { |
|
| 96 | 91 | $this->sendFeedback(false, [ |
| 97 | 92 | 'type' => ERROR_GENERAL, |
| 98 | 93 | 'info' => [ |
@@ -157,8 +152,7 @@ discard block |
||
| 157 | 152 | try { |
| 158 | 153 | $accountStore = new \Files\Core\AccountStore(); |
| 159 | 154 | $accountStore->getAccount($actionData['entryid'])->beforeDelete(); |
| 160 | - } |
|
| 161 | - catch (\Files\Backend\Exception $e) { |
|
| 155 | + } catch (\Files\Backend\Exception $e) { |
|
| 162 | 156 | // ignore errors here |
| 163 | 157 | } |
| 164 | 158 | |
@@ -14,8 +14,7 @@ |
||
| 14 | 14 | $content .= file_get_contents("../resources/css/navbar.css"); |
| 15 | 15 | $content .= file_get_contents("../resources/css/pdfjspanel.css"); |
| 16 | 16 | $content .= file_get_contents("../resources/css/webodfpanel.css"); |
| 17 | -} |
|
| 18 | -else { |
|
| 17 | +} else { |
|
| 19 | 18 | $content .= file_get_contents("../resources/css/files" . $debug . ".css"); |
| 20 | 19 | } |
| 21 | 20 | |
@@ -115,19 +115,16 @@ discard block |
||
| 115 | 115 | // check if we should create something new or edit an existing file/folder |
| 116 | 116 | if (isset($actionData["entryid"])) { |
| 117 | 117 | $result = $this->rename($actionType, $actionData); |
| 118 | - } |
|
| 119 | - else { |
|
| 118 | + } else { |
|
| 120 | 119 | $result = $this->save($actionData); |
| 121 | 120 | } |
| 122 | 121 | break; |
| 123 | 122 | } |
| 124 | - } |
|
| 125 | - else { |
|
| 123 | + } else { |
|
| 126 | 124 | // check if we should create something new or edit an existing file/folder |
| 127 | 125 | if (isset($actionData["entryid"])) { |
| 128 | 126 | $result = $this->rename($actionType, $actionData); |
| 129 | - } |
|
| 130 | - else { |
|
| 127 | + } else { |
|
| 131 | 128 | $result = $this->save($actionData); |
| 132 | 129 | } |
| 133 | 130 | } |
@@ -164,11 +161,9 @@ discard block |
||
| 164 | 161 | default: |
| 165 | 162 | $this->handleUnknownActionType($actionType); |
| 166 | 163 | } |
| 167 | - } |
|
| 168 | - catch (MAPIException $e) { |
|
| 164 | + } catch (MAPIException $e) { |
|
| 169 | 165 | $this->sendFeedback(false, $this->errorDetailsFromException($e)); |
| 170 | - } |
|
| 171 | - catch (AccountException $e) { |
|
| 166 | + } catch (AccountException $e) { |
|
| 172 | 167 | $this->sendFeedback(false, [ |
| 173 | 168 | 'type' => ERROR_GENERAL, |
| 174 | 169 | 'info' => [ |
@@ -177,8 +172,7 @@ discard block |
||
| 177 | 172 | 'display_message' => $e->getMessage(), |
| 178 | 173 | ], |
| 179 | 174 | ]); |
| 180 | - } |
|
| 181 | - catch (BackendException $e) { |
|
| 175 | + } catch (BackendException $e) { |
|
| 182 | 176 | $this->sendFeedback(false, [ |
| 183 | 177 | 'type' => ERROR_GENERAL, |
| 184 | 178 | 'info' => [ |
@@ -239,8 +233,7 @@ discard block |
||
| 239 | 233 | 'parent_entryid' => $this->createId($realNodeId), |
| 240 | 234 | ]; |
| 241 | 235 | } |
| 242 | - } |
|
| 243 | - else { |
|
| 236 | + } else { |
|
| 244 | 237 | $account = $this->accountStore->getAccount($accountID); |
| 245 | 238 | |
| 246 | 239 | // initialize the backend |
@@ -356,8 +349,7 @@ discard block |
||
| 356 | 349 | $dirName = dirname($nodeId, 1); |
| 357 | 350 | if ($dirName === '/') { |
| 358 | 351 | $path = stringToUTF8Encode($nodeIdPrefix . $dirName); |
| 359 | - } |
|
| 360 | - else { |
|
| 352 | + } else { |
|
| 361 | 353 | $path = stringToUTF8Encode($nodeIdPrefix . $dirName . '/'); |
| 362 | 354 | } |
| 363 | 355 | |
@@ -371,8 +363,7 @@ discard block |
||
| 371 | 363 | $dir[$id]['store_entryid'] = $storeEntryid; |
| 372 | 364 | |
| 373 | 365 | $updateCache = true; |
| 374 | - } |
|
| 375 | - else { |
|
| 366 | + } else { |
|
| 376 | 367 | $entryid = $node['entryid']; |
| 377 | 368 | $parentEntryid = $node['parent_entryid']; |
| 378 | 369 | $storeEntryid = $node['store_entryid']; |
@@ -401,8 +392,7 @@ discard block |
||
| 401 | 392 | if ($updateCache) { |
| 402 | 393 | $this->setCache($accountID, $cachePath, $dir); |
| 403 | 394 | } |
| 404 | - } |
|
| 405 | - else { |
|
| 395 | + } else { |
|
| 406 | 396 | Logger::debug(self::LOG_CONTEXT, "dir was empty"); |
| 407 | 397 | } |
| 408 | 398 | |
@@ -433,8 +423,7 @@ discard block |
||
| 433 | 423 | |
| 434 | 424 | if ($navtree) { |
| 435 | 425 | $sortednodes = ArrayUtil::sort_by_key($nodes, $sortkey, $sortdir); |
| 436 | - } |
|
| 437 | - else { |
|
| 426 | + } else { |
|
| 438 | 427 | $sortednodes = ArrayUtil::sort_props_by_key($nodes, $sortkey, $sortdir); |
| 439 | 428 | } |
| 440 | 429 | |
@@ -481,8 +470,7 @@ discard block |
||
| 481 | 470 | $response['status'] = true; |
| 482 | 471 | $this->addActionData($actionType, $response); |
| 483 | 472 | $GLOBALS["bus"]->addData($this->getResponseData()); |
| 484 | - } |
|
| 485 | - else { |
|
| 473 | + } else { |
|
| 486 | 474 | $nodeId = $actionData['folder_id']; |
| 487 | 475 | |
| 488 | 476 | $relNodeId = substr($nodeId, strpos($nodeId, '/')); |
@@ -495,8 +483,7 @@ discard block |
||
| 495 | 483 | |
| 496 | 484 | try { |
| 497 | 485 | $result = $initializedBackend->delete($relNodeId); |
| 498 | - } |
|
| 499 | - catch (\Files\Backend\Exception $e) { |
|
| 486 | + } catch (\Files\Backend\Exception $e) { |
|
| 500 | 487 | // TODO: this might fails because the file was already deleted. |
| 501 | 488 | // fire error message if any other error occurred. |
| 502 | 489 | Logger::debug(self::LOG_CONTEXT, "deleted a directory that was no longer available"); |
@@ -686,8 +673,7 @@ discard block |
||
| 686 | 673 | |
| 687 | 674 | try { |
| 688 | 675 | $lsdata = $initializedBackend->ls($relDirname); // we can only check files in the same folder, so one request will be enough |
| 689 | - } |
|
| 690 | - catch (Exception $e) { |
|
| 676 | + } catch (Exception $e) { |
|
| 691 | 677 | // ignore - if file not found -> does not exist :) |
| 692 | 678 | } |
| 693 | 679 | if (isset($lsdata) && is_array($lsdata)) { |
@@ -810,8 +796,7 @@ discard block |
||
| 810 | 796 | |
| 811 | 797 | $this->updateDirCache($initializedBackend, $dirName, $filePath, $actionData); |
| 812 | 798 | } |
| 813 | - } |
|
| 814 | - elseif ($actionData["type"] === "mail") { |
|
| 799 | + } elseif ($actionData["type"] === "mail") { |
|
| 815 | 800 | foreach ($actionData["items"] as $item) { |
| 816 | 801 | list($tmpname, $filename) = $this->prepareEmailForUpload($item); |
| 817 | 802 | |
@@ -825,8 +810,7 @@ discard block |
||
| 825 | 810 | |
| 826 | 811 | $this->updateDirCache($initializedBackend, $dirName, $filePath, $actionData); |
| 827 | 812 | } |
| 828 | - } |
|
| 829 | - else { |
|
| 813 | + } else { |
|
| 830 | 814 | $this->sendFeedback(false, [ |
| 831 | 815 | 'type' => ERROR_GENERAL, |
| 832 | 816 | 'info' => [ |
@@ -941,12 +925,10 @@ discard block |
||
| 941 | 925 | // Set filename |
| 942 | 926 | if (isset($props[PR_ATTACH_LONG_FILENAME])) { |
| 943 | 927 | $filename = PathUtil::sanitizeFilename($props[PR_ATTACH_LONG_FILENAME]); |
| 944 | - } |
|
| 945 | - else { |
|
| 928 | + } else { |
|
| 946 | 929 | if (isset($props[PR_ATTACH_FILENAME])) { |
| 947 | 930 | $filename = PathUtil::sanitizeFilename($props[PR_ATTACH_FILENAME]); |
| 948 | - } |
|
| 949 | - else { |
|
| 931 | + } else { |
|
| 950 | 932 | if (isset($props[PR_DISPLAY_NAME])) { |
| 951 | 933 | $filename = PathUtil::sanitizeFilename($props[PR_DISPLAY_NAME]); |
| 952 | 934 | } |
@@ -956,8 +938,7 @@ discard block |
||
| 956 | 938 | // Set content type |
| 957 | 939 | if (isset($props[PR_ATTACH_MIME_TAG])) { |
| 958 | 940 | $contentType = $props[PR_ATTACH_MIME_TAG]; |
| 959 | - } |
|
| 960 | - else { |
|
| 941 | + } else { |
|
| 961 | 942 | // Parse the extension of the filename to get the content type |
| 962 | 943 | if (strrpos($filename, ".") !== false) { |
| 963 | 944 | $extension = strtolower(substr($filename, strrpos($filename, "."))); |
@@ -1001,12 +982,10 @@ discard block |
||
| 1001 | 982 | return [$tmpname, $filename]; |
| 1002 | 983 | } |
| 1003 | 984 | } |
| 1004 | - } |
|
| 1005 | - else { |
|
| 985 | + } else { |
|
| 1006 | 986 | Logger::error(self::LOG_CONTEXT, "store could not be opened"); |
| 1007 | 987 | } |
| 1008 | - } |
|
| 1009 | - else { |
|
| 988 | + } else { |
|
| 1010 | 989 | Logger::error(self::LOG_CONTEXT, "wrong call, store and entryid have to be set"); |
| 1011 | 990 | } |
| 1012 | 991 | |
@@ -1060,8 +1039,7 @@ discard block |
||
| 1060 | 1039 | if (isset($messageProps[PR_EC_IMAP_EMAIL]) || propIsError(PR_EC_IMAP_EMAIL, $messageProps) == MAPI_E_NOT_ENOUGH_MEMORY) { |
| 1061 | 1040 | // Stream the message to properly get the PR_EC_IMAP_EMAIL property |
| 1062 | 1041 | $stream = mapi_openproperty($message, PR_EC_IMAP_EMAIL, IID_IStream, 0, 0); |
| 1063 | - } |
|
| 1064 | - else { |
|
| 1042 | + } else { |
|
| 1065 | 1043 | // Get addressbook for current session |
| 1066 | 1044 | $addrBook = $GLOBALS['mapisession']->getAddressbook(); |
| 1067 | 1045 | |
@@ -1071,8 +1049,7 @@ discard block |
||
| 1071 | 1049 | |
| 1072 | 1050 | if (!empty($messageProps[PR_SUBJECT])) { |
| 1073 | 1051 | $filename = PathUtil::sanitizeFilename($messageProps[PR_SUBJECT]) . '.eml'; |
| 1074 | - } |
|
| 1075 | - else { |
|
| 1052 | + } else { |
|
| 1076 | 1053 | $filename = _('Untitled') . '.eml'; |
| 1077 | 1054 | } |
| 1078 | 1055 | |
@@ -1132,8 +1109,7 @@ discard block |
||
| 1132 | 1109 | |
| 1133 | 1110 | try { |
| 1134 | 1111 | $sInfo = $initializedBackend->sharingDetails($relRecords); |
| 1135 | - } |
|
| 1136 | - catch (Exception $e) { |
|
| 1112 | + } catch (Exception $e) { |
|
| 1137 | 1113 | $response['status'] = false; |
| 1138 | 1114 | $response['header'] = _('Fetching sharing information failed'); |
| 1139 | 1115 | $response['message'] = $e->getMessage(); |
@@ -1193,8 +1169,7 @@ discard block |
||
| 1193 | 1169 | |
| 1194 | 1170 | try { |
| 1195 | 1171 | $sInfo = $initializedBackend->share($sharingRecords); |
| 1196 | - } |
|
| 1197 | - catch (Exception $e) { |
|
| 1172 | + } catch (Exception $e) { |
|
| 1198 | 1173 | $response['status'] = false; |
| 1199 | 1174 | $response['header'] = _('Sharing failed'); |
| 1200 | 1175 | $response['message'] = $e->getMessage(); |
@@ -1255,8 +1230,7 @@ discard block |
||
| 1255 | 1230 | |
| 1256 | 1231 | try { |
| 1257 | 1232 | $sInfo = $initializedBackend->share($sharingRecords, true); |
| 1258 | - } |
|
| 1259 | - catch (Exception $e) { |
|
| 1233 | + } catch (Exception $e) { |
|
| 1260 | 1234 | $response['status'] = false; |
| 1261 | 1235 | $response['header'] = _('Updating share failed'); |
| 1262 | 1236 | $response['message'] = $e->getMessage(); |
@@ -1305,8 +1279,7 @@ discard block |
||
| 1305 | 1279 | |
| 1306 | 1280 | try { |
| 1307 | 1281 | $sInfo = $initializedBackend->unshare($records); |
| 1308 | - } |
|
| 1309 | - catch (Exception $e) { |
|
| 1282 | + } catch (Exception $e) { |
|
| 1310 | 1283 | $response['status'] = false; |
| 1311 | 1284 | $response['header'] = _('Deleting share failed'); |
| 1312 | 1285 | $response['message'] = $e->getMessage(); |
@@ -19,8 +19,7 @@ discard block |
||
| 19 | 19 | default: |
| 20 | 20 | $this->handleUnknownActionType($actionType); |
| 21 | 21 | } |
| 22 | - } |
|
| 23 | - catch (MAPIException $e) { |
|
| 22 | + } catch (MAPIException $e) { |
|
| 24 | 23 | $this->sendFeedback(false, $this->errorDetailsFromException($e)); |
| 25 | 24 | } |
| 26 | 25 | } |
@@ -59,8 +58,7 @@ discard block |
||
| 59 | 58 | |
| 60 | 59 | if (empty($errorMessage)) { |
| 61 | 60 | $this->saveInDB($data); |
| 62 | - } |
|
| 63 | - else { |
|
| 61 | + } else { |
|
| 64 | 62 | $this->sendFeedback(false, [ |
| 65 | 63 | 'type' => ERROR_ZARAFA, |
| 66 | 64 | 'info' => [ |
@@ -92,8 +90,7 @@ discard block |
||
| 92 | 90 | |
| 93 | 91 | if ($data['current_password'] !== $sessionPass) { |
| 94 | 92 | $errorMessage = _('Current password does not match.'); |
| 95 | - } |
|
| 96 | - elseif (defined('PLUGIN_PASSWD_USE_ZCORE') && PLUGIN_PASSWD_USE_ZCORE) { |
|
| 93 | + } elseif (defined('PLUGIN_PASSWD_USE_ZCORE') && PLUGIN_PASSWD_USE_ZCORE) { |
|
| 97 | 94 | try { |
| 98 | 95 | $result = nsp_setuserpasswd($userName, $sessionPass, $newPassword); |
| 99 | 96 | // password changed successfully |
@@ -111,8 +108,7 @@ discard block |
||
| 111 | 108 | |
| 112 | 109 | return; |
| 113 | 110 | } |
| 114 | - } |
|
| 115 | - catch (MAPIException $e) { |
|
| 111 | + } catch (MAPIException $e) { |
|
| 116 | 112 | if (mapi_last_hresult() == MAPI_E_NO_ACCESS) { |
| 117 | 113 | $errorMessage = _('Your password is wrong or you have insufficient permission to change password'); |
| 118 | 114 | } |
@@ -120,8 +116,7 @@ discard block |
||
| 120 | 116 | if (empty($errorMessage)) { |
| 121 | 117 | $errorMessage = _('Password is not changed.'); |
| 122 | 118 | } |
| 123 | - } |
|
| 124 | - else { |
|
| 119 | + } else { |
|
| 125 | 120 | $url = (defined('PLUGIN_PASSWD_ADMIN_API_ENDPOINT') && PLUGIN_PASSWD_ADMIN_API_ENDPOINT) ? |
| 126 | 121 | PLUGIN_PASSWD_ADMIN_API_ENDPOINT : |
| 127 | 122 | 'http://[::1]:8080/api/v1/passwd'; |
@@ -141,8 +136,7 @@ discard block |
||
| 141 | 136 | |
| 142 | 137 | if ($result === false) { |
| 143 | 138 | $errorMessage = _('Error changing password. Please contact the system administrator.'); |
| 144 | - } |
|
| 145 | - else { |
|
| 139 | + } else { |
|
| 146 | 140 | $this->sendFeedback(true, [ |
| 147 | 141 | 'info' => [ |
| 148 | 142 | 'display_message' => _('Password has been changed successfully.'), |
@@ -53,8 +53,7 @@ discard block |
||
| 53 | 53 | // fallback for "old-style" states |
| 54 | 54 | if (isset($unserializedState->data->devices)) { |
| 55 | 55 | $devices[$unserializedState->data->devices->{$username}->data->deviceid] = $unserializedState->data->devices->{$username}->data; |
| 56 | - } |
|
| 57 | - else { |
|
| 56 | + } else { |
|
| 58 | 57 | $devices[$unserializedState->data->deviceid] = $unserializedState->data; |
| 59 | 58 | } |
| 60 | 59 | } |
@@ -94,8 +93,7 @@ discard block |
||
| 94 | 93 | |
| 95 | 94 | return true; |
| 96 | 95 | } |
| 97 | - } |
|
| 98 | - catch (Exception $e) { |
|
| 96 | + } catch (Exception $e) { |
|
| 99 | 97 | error_log(sprintf("mdm plugin resyncDevice Exception: %s", $e)); |
| 100 | 98 | |
| 101 | 99 | return false; |
@@ -168,8 +166,7 @@ discard block |
||
| 168 | 166 | $ret = file_get_contents(PLUGIN_MDM_ADMIN_API_WIPE_ENDPOINT . $GLOBALS["mapisession"]->getUserName() . "?devices=" . $deviceid, false, stream_context_create($opts)); |
| 169 | 167 | |
| 170 | 168 | return $ret; |
| 171 | - } |
|
| 172 | - catch (Exception $e) { |
|
| 169 | + } catch (Exception $e) { |
|
| 173 | 170 | error_log(sprintf("mdm plugin removeDevice Exception: %s", $e)); |
| 174 | 171 | |
| 175 | 172 | return false; |
@@ -268,8 +265,7 @@ discard block |
||
| 268 | 265 | default: |
| 269 | 266 | $this->handleUnknownActionType($actionType); |
| 270 | 267 | } |
| 271 | - } |
|
| 272 | - catch (Exception $e) { |
|
| 268 | + } catch (Exception $e) { |
|
| 273 | 269 | $title = _('Mobile device management plugin'); |
| 274 | 270 | $display_message = sprintf(_('Unexpected error occurred. Please contact your system administrator. Error code: %s'), $e->getMessage()); |
| 275 | 271 | $this->sendFeedback(true, ["type" => ERROR_GENERAL, "info" => ['title' => $title, 'display_message' => $display_message]]); |
@@ -320,8 +316,7 @@ discard block |
||
| 320 | 316 | $folderType = $this->getSyncFolderType($type); |
| 321 | 317 | if (isset($synchedFolderTypes[$folderType])) { |
| 322 | 318 | ++$synchedFolderTypes[$folderType]; |
| 323 | - } |
|
| 324 | - else { |
|
| 319 | + } else { |
|
| 325 | 320 | $synchedFolderTypes[$folderType] = 1; |
| 326 | 321 | } |
| 327 | 322 | } |
@@ -400,8 +395,7 @@ discard block |
||
| 400 | 395 | foreach ($stores as $store) { |
| 401 | 396 | try { |
| 402 | 397 | $entryid = mapi_msgstore_entryidfromsourcekey($store, hex2bin($item->folderid)); |
| 403 | - } |
|
| 404 | - catch (MAPIException $me) { |
|
| 398 | + } catch (MAPIException $me) { |
|
| 405 | 399 | continue; |
| 406 | 400 | } |
| 407 | 401 | } |
@@ -496,11 +490,9 @@ discard block |
||
| 496 | 490 | } |
| 497 | 491 | if ($storeType == ZARAFA_STORE_DELEGATE_GUID) { |
| 498 | 492 | $storeUserName = $GLOBALS["mapisession"]->getUserNameOfStore($msgstore_props[PR_ENTRYID]); |
| 499 | - } |
|
| 500 | - elseif ($storeType == ZARAFA_STORE_PUBLIC_GUID) { |
|
| 493 | + } elseif ($storeType == ZARAFA_STORE_PUBLIC_GUID) { |
|
| 501 | 494 | $storeUserName = "SYSTEM"; |
| 502 | - } |
|
| 503 | - else { |
|
| 495 | + } else { |
|
| 504 | 496 | $storeUserName = $msgstore_props[PR_USER_NAME]; |
| 505 | 497 | } |
| 506 | 498 | |
@@ -521,16 +513,14 @@ discard block |
||
| 521 | 513 | |
| 522 | 514 | try { |
| 523 | 515 | $subtreeFolder = mapi_msgstore_openentry($store, $subtreeFolderEntryID); |
| 524 | - } |
|
| 525 | - catch (MAPIException $e) { |
|
| 516 | + } catch (MAPIException $e) { |
|
| 526 | 517 | // We've handled the event |
| 527 | 518 | $e->setHandled(); |
| 528 | 519 | } |
| 529 | 520 | |
| 530 | 521 | if ($storeType != ZARAFA_STORE_PUBLIC_GUID) { |
| 531 | 522 | $this->getSubFolders($subtreeFolder, $store, $properties, $storeData, $storeUserName); |
| 532 | - } |
|
| 533 | - else { |
|
| 523 | + } else { |
|
| 534 | 524 | $this->getSubFoldersPublic($subtreeFolder, $store, $properties, $storeData, $storeUserName); |
| 535 | 525 | } |
| 536 | 526 | } |
@@ -558,8 +548,7 @@ discard block |
||
| 558 | 548 | try { |
| 559 | 549 | $inbox = mapi_msgstore_getreceivefolder($store); |
| 560 | 550 | $inboxProps = mapi_getprops($inbox, [PR_ENTRYID]); |
| 561 | - } |
|
| 562 | - catch (MAPIException $e) { |
|
| 551 | + } catch (MAPIException $e) { |
|
| 563 | 552 | // don't propagate this error to parent handlers, if store doesn't support it |
| 564 | 553 | if ($e->getCode() === MAPI_E_NO_SUPPORT) { |
| 565 | 554 | $e->setHandled(); |
@@ -634,8 +623,7 @@ discard block |
||
| 634 | 623 | try { |
| 635 | 624 | // load folder props |
| 636 | 625 | $folder = mapi_msgstore_openentry($store, $folderEntryID); |
| 637 | - } |
|
| 638 | - catch (MAPIException $e) { |
|
| 626 | + } catch (MAPIException $e) { |
|
| 639 | 627 | // Indicate that we don't have access to the store, |
| 640 | 628 | // so no more attempts to read properties or open entries. |
| 641 | 629 | $store_access = false; |
@@ -834,8 +822,7 @@ discard block |
||
| 834 | 822 | if ($specialFolder) { |
| 835 | 823 | // Special folders can be redirected again to getSubFolders(), |
| 836 | 824 | $this->getSubFolders($specialFolder, $store, $properties, $storeData, $storeUserName); |
| 837 | - } |
|
| 838 | - else { |
|
| 825 | + } else { |
|
| 839 | 826 | $folderObject = mapi_msgstore_openentry($store, $subfolder[PR_ENTRYID]); |
| 840 | 827 | array_push($expand, ['folder' => $folderObject, 'props' => $subfolder]); |
| 841 | 828 | } |
@@ -177,8 +177,7 @@ discard block |
||
| 177 | 177 | $this->ocs_client = new ocsclient($this->getOwncloudBaseURL(), $this->user, $this->pass, $this->allowselfsigned); |
| 178 | 178 | |
| 179 | 179 | return true; |
| 180 | - } |
|
| 181 | - catch (\Exception $e) { |
|
| 180 | + } catch (\Exception $e) { |
|
| 182 | 181 | $this->log('Failed to open: ' . $e->getMessage()); |
| 183 | 182 | if (intval($e->getHTTPCode()) == 401) { |
| 184 | 183 | $e = new BackendException($this->parseErrorCodeToMessage(self::WD_ERR_UNAUTHORIZED), $e->getHTTPCode()); |
@@ -216,8 +215,7 @@ discard block |
||
| 216 | 215 | $this->log("[COPY] start for dir: {$src_path} -> {$dst_path}"); |
| 217 | 216 | if ($overwrite) { |
| 218 | 217 | $overwrite = 'T'; |
| 219 | - } |
|
| 220 | - else { |
|
| 218 | + } else { |
|
| 221 | 219 | $overwrite = 'F'; |
| 222 | 220 | } |
| 223 | 221 | |
@@ -233,14 +231,12 @@ discard block |
||
| 233 | 231 | $this->log("[COPY] done in {$time} seconds: " . $response['statusCode']); |
| 234 | 232 | |
| 235 | 233 | return true; |
| 236 | - } |
|
| 237 | - catch (ClientException $e) { |
|
| 234 | + } catch (ClientException $e) { |
|
| 238 | 235 | $e = new BackendException($this->parseErrorCodeToMessage($e->getCode()), $e->getCode()); |
| 239 | 236 | $e->setTitle($this->backendTransName . _('Sabre error')); |
| 240 | 237 | |
| 241 | 238 | throw $e; |
| 242 | - } |
|
| 243 | - catch (Exception $e) { |
|
| 239 | + } catch (Exception $e) { |
|
| 244 | 240 | $this->log('[COPY] fatal: ' . $e->getMessage()); |
| 245 | 241 | $e = new BackendException($this->parseErrorCodeToMessage($e->getHTTPCode()), $e->getHTTPCode()); |
| 246 | 242 | $e->setTitle($this->backendTransName . _('Copying failed')); |
@@ -376,8 +372,7 @@ discard block |
||
| 376 | 372 | if ($httpcode && $httpcode == "200" && $versiondata) { |
| 377 | 373 | $versions = json_decode($versiondata); |
| 378 | 374 | $version = $versions->versionstring; |
| 379 | - } |
|
| 380 | - else { |
|
| 375 | + } else { |
|
| 381 | 376 | $version = "Undetected (no ownCloud?)"; |
| 382 | 377 | } |
| 383 | 378 | |
@@ -410,8 +405,7 @@ discard block |
||
| 410 | 405 | |
| 411 | 406 | try { |
| 412 | 407 | $this->ocs_client->loadShares($path); |
| 413 | - } |
|
| 414 | - catch (ConnectionException $e) { |
|
| 408 | + } catch (ConnectionException $e) { |
|
| 415 | 409 | $this->log('[GETSHARES]: connection exception while loading shares: ' . $e->getMessage() . " " . $e->getCode()); |
| 416 | 410 | } |
| 417 | 411 | $shares = $this->ocs_client->getAllShares(); |
@@ -466,8 +460,7 @@ discard block |
||
| 466 | 460 | if (count($patharray) > 1) { |
| 467 | 461 | try { |
| 468 | 462 | $this->ocs_client->loadShares(); |
| 469 | - } |
|
| 470 | - catch (ConnectionException $e) { |
|
| 463 | + } catch (ConnectionException $e) { |
|
| 471 | 464 | $this->log('[SHARINGDETAILS]: connection exception while loading shares: ' . $e->getMessage() . " " . $e->getCode()); |
| 472 | 465 | } |
| 473 | 466 | |
@@ -491,13 +484,11 @@ discard block |
||
| 491 | 484 | } |
| 492 | 485 | } |
| 493 | 486 | } |
| 494 | - } |
|
| 495 | - else { |
|
| 487 | + } else { |
|
| 496 | 488 | if (count($patharray) == 1) { |
| 497 | 489 | try { |
| 498 | 490 | $shares = $this->ocs_client->loadShareByPath($patharray[0]); |
| 499 | - } |
|
| 500 | - catch (FileNotFoundException $e) { |
|
| 491 | + } catch (FileNotFoundException $e) { |
|
| 501 | 492 | $shares = false; |
| 502 | 493 | } |
| 503 | 494 | |
@@ -518,8 +509,7 @@ discard block |
||
| 518 | 509 | ]; |
| 519 | 510 | } |
| 520 | 511 | } |
| 521 | - } |
|
| 522 | - else { |
|
| 512 | + } else { |
|
| 523 | 513 | return false; // $patharray was empty... |
| 524 | 514 | } |
| 525 | 515 | } |
@@ -564,8 +554,7 @@ discard block |
||
| 564 | 554 | "token" => $share->getToken(), |
| 565 | 555 | "url" => $share->getUrl(), |
| 566 | 556 | ]; |
| 567 | - } |
|
| 568 | - else { |
|
| 557 | + } else { |
|
| 569 | 558 | foreach ($options as $key => $value) { |
| 570 | 559 | $this->ocs_client->updateShare($path, $key, $value); |
| 571 | 560 | } |
@@ -575,8 +564,7 @@ discard block |
||
| 575 | 564 | ]; |
| 576 | 565 | } |
| 577 | 566 | } |
| 578 | - } |
|
| 579 | - else { |
|
| 567 | + } else { |
|
| 580 | 568 | $this->log('No share params given'); |
| 581 | 569 | |
| 582 | 570 | return false; // no shareparams... |
@@ -160,8 +160,7 @@ discard block |
||
| 160 | 160 | |
| 161 | 161 | if ($httpcode == 0) { |
| 162 | 162 | $message = curl_errno($ch); |
| 163 | - } |
|
| 164 | - else { |
|
| 163 | + } else { |
|
| 165 | 164 | $message = $httpcode; |
| 166 | 165 | } |
| 167 | 166 | curl_close($ch); |
@@ -194,8 +193,7 @@ discard block |
||
| 194 | 193 | |
| 195 | 194 | if (empty($path)) { |
| 196 | 195 | $url = $this->getOCSUrl(); |
| 197 | - } |
|
| 198 | - else { |
|
| 196 | + } else { |
|
| 199 | 197 | $url = $this->getOCSUrl() . "?path=" . urlencode($path) . "&subfiles=true"; |
| 200 | 198 | } |
| 201 | 199 | $this->parseListingResponse($this->doCurlGetRequest($url)); |
@@ -278,8 +276,7 @@ discard block |
||
| 278 | 276 | if ($httpcode === 200) { |
| 279 | 277 | try { |
| 280 | 278 | $xmldata = new \SimpleXMLElement($responsedata); |
| 281 | - } |
|
| 282 | - catch (\Exception $e) { |
|
| 279 | + } catch (\Exception $e) { |
|
| 283 | 280 | throw new InvalidResponseException($responsedata); |
| 284 | 281 | } |
| 285 | 282 | |
@@ -466,8 +463,7 @@ discard block |
||
| 466 | 463 | if ($response) { |
| 467 | 464 | try { |
| 468 | 465 | $xmldata = new \SimpleXMLElement($response); |
| 469 | - } |
|
| 470 | - catch (\Exception $e) { |
|
| 466 | + } catch (\Exception $e) { |
|
| 471 | 467 | throw new InvalidResponseException($response); |
| 472 | 468 | } |
| 473 | 469 | |
@@ -486,8 +482,7 @@ discard block |
||
| 486 | 482 | return false; |
| 487 | 483 | } |
| 488 | 484 | } |
| 489 | - } |
|
| 490 | - else { |
|
| 485 | + } else { |
|
| 491 | 486 | throw new InvalidResponseException($response); |
| 492 | 487 | } |
| 493 | 488 | |
@@ -512,8 +507,7 @@ discard block |
||
| 512 | 507 | |
| 513 | 508 | try { |
| 514 | 509 | $xmldata = new \SimpleXMLElement($response); |
| 515 | - } |
|
| 516 | - catch (\Exception $e) { |
|
| 510 | + } catch (\Exception $e) { |
|
| 517 | 511 | throw new InvalidResponseException($response); |
| 518 | 512 | } |
| 519 | 513 | |
@@ -574,8 +568,7 @@ discard block |
||
| 574 | 568 | default: |
| 575 | 569 | throw new InvalidResponseException($message); |
| 576 | 570 | } |
| 577 | - } |
|
| 578 | - else { |
|
| 571 | + } else { |
|
| 579 | 572 | throw new InvalidResponseException("Response contains no meta block."); |
| 580 | 573 | } |
| 581 | 574 | } |
@@ -58,7 +58,6 @@ |
||
| 58 | 58 | try { |
| 59 | 59 | $deleteShare = $ocscloient->loadShareByID($share4->getId()); |
| 60 | 60 | print_r($deleteShare); |
| 61 | -} |
|
| 62 | -catch (Exception $e) { |
|
| 61 | +} catch (Exception $e) { |
|
| 63 | 62 | print_r($e); |
| 64 | 63 | } |