@@ -80,11 +80,11 @@ discard block |
||
80 | 80 | * @throws SecurityException |
81 | 81 | * @since 6.0.0 |
82 | 82 | */ |
83 | - public function beforeController($controller, $methodName){ |
|
83 | + public function beforeController($controller, $methodName) { |
|
84 | 84 | // ensure that @CORS annotated API routes are not used in conjunction |
85 | 85 | // with session authentication since this enables CSRF attack vectors |
86 | 86 | if ($this->reflector->hasAnnotation('CORS') && |
87 | - !$this->reflector->hasAnnotation('PublicPage')) { |
|
87 | + !$this->reflector->hasAnnotation('PublicPage')) { |
|
88 | 88 | $user = $this->request->server['PHP_AUTH_USER']; |
89 | 89 | $pass = $this->request->server['PHP_AUTH_PW']; |
90 | 90 | |
@@ -110,16 +110,16 @@ discard block |
||
110 | 110 | * @return Response a Response object |
111 | 111 | * @throws SecurityException |
112 | 112 | */ |
113 | - public function afterController($controller, $methodName, Response $response){ |
|
113 | + public function afterController($controller, $methodName, Response $response) { |
|
114 | 114 | // only react if its a CORS request and if the request sends origin and |
115 | 115 | |
116 | - if(isset($this->request->server['HTTP_ORIGIN']) && |
|
116 | + if (isset($this->request->server['HTTP_ORIGIN']) && |
|
117 | 117 | $this->reflector->hasAnnotation('CORS')) { |
118 | 118 | |
119 | 119 | // allow credentials headers must not be true or CSRF is possible |
120 | 120 | // otherwise |
121 | - foreach($response->getHeaders() as $header => $value) { |
|
122 | - if(strtolower($header) === 'access-control-allow-credentials' && |
|
121 | + foreach ($response->getHeaders() as $header => $value) { |
|
122 | + if (strtolower($header) === 'access-control-allow-credentials' && |
|
123 | 123 | strtolower(trim($value)) === 'true') { |
124 | 124 | $msg = 'Access-Control-Allow-Credentials must not be '. |
125 | 125 | 'set to true in order to prevent CSRF'; |
@@ -143,10 +143,10 @@ discard block |
||
143 | 143 | * @throws \Exception the passed in exception if it can't handle it |
144 | 144 | * @return Response a Response object or null in case that the exception could not be handled |
145 | 145 | */ |
146 | - public function afterException($controller, $methodName, \Exception $exception){ |
|
147 | - if($exception instanceof SecurityException){ |
|
148 | - $response = new JSONResponse(['message' => $exception->getMessage()]); |
|
149 | - if($exception->getCode() !== 0) { |
|
146 | + public function afterException($controller, $methodName, \Exception $exception) { |
|
147 | + if ($exception instanceof SecurityException) { |
|
148 | + $response = new JSONResponse(['message' => $exception->getMessage()]); |
|
149 | + if ($exception->getCode() !== 0) { |
|
150 | 150 | $response->setStatus($exception->getCode()); |
151 | 151 | } else { |
152 | 152 | $response->setStatus(Http::STATUS_INTERNAL_SERVER_ERROR); |
@@ -143,7 +143,7 @@ |
||
143 | 143 | $format = $this->request->getParam('format'); |
144 | 144 | |
145 | 145 | // if none is given try the first Accept header |
146 | - if($format === null) { |
|
146 | + if ($format === null) { |
|
147 | 147 | $headers = $this->request->getHeader('Accept'); |
148 | 148 | $format = $controller->getResponderByHTTPHeader($headers, 'xml'); |
149 | 149 | } |
@@ -71,7 +71,7 @@ |
||
71 | 71 | * @param Response $response |
72 | 72 | * @return Response |
73 | 73 | */ |
74 | - public function afterController($controller, $methodName, Response $response){ |
|
74 | + public function afterController($controller, $methodName, Response $response) { |
|
75 | 75 | $useSession = $this->reflector->hasAnnotation('UseSession'); |
76 | 76 | if ($useSession) { |
77 | 77 | $this->session->close(); |
@@ -35,7 +35,7 @@ |
||
35 | 35 | */ |
36 | 36 | public function getStatus() { |
37 | 37 | |
38 | - $status = parent::getStatus(); |
|
38 | + $status = parent::getStatus(); |
|
39 | 39 | if ($status === API::RESPOND_UNAUTHORISED) { |
40 | 40 | return Http::STATUS_UNAUTHORIZED; |
41 | 41 | } else if ($status === API::RESPOND_NOT_FOUND) { |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | * @return int |
35 | 35 | */ |
36 | 36 | public function getStatus() { |
37 | - $status = parent::getStatus(); |
|
37 | + $status = parent::getStatus(); |
|
38 | 38 | if ($status === Http::STATUS_FORBIDDEN || $status === API::RESPOND_UNAUTHORISED) { |
39 | 39 | return Http::STATUS_UNAUTHORIZED; |
40 | 40 | } |
@@ -70,8 +70,8 @@ discard block |
||
70 | 70 | 'message' => $this->getOCSStatus() === 100 ? 'OK' : $this->statusMessage, |
71 | 71 | ]; |
72 | 72 | |
73 | - $meta['totalitems'] = $this->itemsCount !== null ? (string)$this->itemsCount : ''; |
|
74 | - $meta['itemsperpage'] = $this->itemsPerPage !== null ? (string)$this->itemsPerPage: ''; |
|
73 | + $meta['totalitems'] = $this->itemsCount !== null ? (string) $this->itemsCount : ''; |
|
74 | + $meta['itemsperpage'] = $this->itemsPerPage !== null ? (string) $this->itemsPerPage : ''; |
|
75 | 75 | |
76 | 76 | return $this->renderResult($meta); |
77 | 77 | } |
@@ -35,7 +35,7 @@ |
||
35 | 35 | |
36 | 36 | const FORMAT_NONE = -1; |
37 | 37 | const FORMAT_STATUSES = -2; |
38 | - const FORMAT_SOURCES = -3; // ToDo Check if it is still in use otherwise remove it |
|
38 | + const FORMAT_SOURCES = -3; // ToDo Check if it is still in use otherwise remove it |
|
39 | 39 | |
40 | 40 | const RESPONSE_FORMAT = 'json'; // default resonse format for ocs calls |
41 | 41 |
@@ -44,23 +44,23 @@ discard block |
||
44 | 44 | |
45 | 45 | public function run(IOutput $output) { |
46 | 46 | |
47 | - $dataDir = $this->config->getSystemValue('datadirectory', \OC::$SERVERROOT . '/data'); |
|
47 | + $dataDir = $this->config->getSystemValue('datadirectory', \OC::$SERVERROOT.'/data'); |
|
48 | 48 | $instanceId = $this->config->getSystemValue('instanceid', null); |
49 | 49 | |
50 | - if(!is_string($instanceId) || empty($instanceId)) { |
|
50 | + if (!is_string($instanceId) || empty($instanceId)) { |
|
51 | 51 | return; |
52 | 52 | } |
53 | 53 | |
54 | - $updaterFolderPath = $dataDir . '/updater-' . $instanceId; |
|
55 | - $stepFile = $updaterFolderPath . '/.step'; |
|
56 | - if(file_exists($stepFile)) { |
|
54 | + $updaterFolderPath = $dataDir.'/updater-'.$instanceId; |
|
55 | + $stepFile = $updaterFolderPath.'/.step'; |
|
56 | + if (file_exists($stepFile)) { |
|
57 | 57 | $output->info('.step file exists'); |
58 | 58 | |
59 | - $previousStepFile = $updaterFolderPath . '/.step-previous-update'; |
|
59 | + $previousStepFile = $updaterFolderPath.'/.step-previous-update'; |
|
60 | 60 | |
61 | 61 | // cleanup |
62 | - if(file_exists($previousStepFile)) { |
|
63 | - if(\OC_Helper::rmdirr($previousStepFile)) { |
|
62 | + if (file_exists($previousStepFile)) { |
|
63 | + if (\OC_Helper::rmdirr($previousStepFile)) { |
|
64 | 64 | $output->info('.step-previous-update removed'); |
65 | 65 | } else { |
66 | 66 | $output->info('.step-previous-update can\'t be removed - abort move of .step file'); |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | } |
70 | 70 | |
71 | 71 | // move step file |
72 | - if(rename($stepFile, $previousStepFile)) { |
|
72 | + if (rename($stepFile, $previousStepFile)) { |
|
73 | 73 | $output->info('.step file moved to .step-previous-update'); |
74 | 74 | } else { |
75 | 75 | $output->warning('.step file can\'t be moved'); |
@@ -69,7 +69,7 @@ |
||
69 | 69 | $result->closeCursor(); |
70 | 70 | |
71 | 71 | if ($entriesUpdated > 0) { |
72 | - $output->info($entriesUpdated . ' mounts updated'); |
|
72 | + $output->info($entriesUpdated.' mounts updated'); |
|
73 | 73 | return; |
74 | 74 | } |
75 | 75 |
@@ -93,7 +93,7 @@ |
||
93 | 93 | $result->closeCursor(); |
94 | 94 | |
95 | 95 | if ($deletedEntries) { |
96 | - $output->info('Removed ' . $deletedEntries . ' shares where user is not a member of the group anymore'); |
|
96 | + $output->info('Removed '.$deletedEntries.' shares where user is not a member of the group anymore'); |
|
97 | 97 | } |
98 | 98 | } |
99 | 99 |