| @@ 202-210 (lines=9) @@ | ||
| 199 | ); |
|
| 200 | } |
|
| 201 | ||
| 202 | if (!$backend->validateStorage($storage)) { |
|
| 203 | // unsatisfied parameters |
|
| 204 | return new DataResponse( |
|
| 205 | array( |
|
| 206 | 'message' => (string)$this->l10n->t('Unsatisfied backend parameters') |
|
| 207 | ), |
|
| 208 | Http::STATUS_UNPROCESSABLE_ENTITY |
|
| 209 | ); |
|
| 210 | } |
|
| 211 | if (!$authMechanism->validateStorage($storage)) { |
|
| 212 | // unsatisfied parameters |
|
| 213 | return new DataResponse( |
|
| @@ 211-219 (lines=9) @@ | ||
| 208 | Http::STATUS_UNPROCESSABLE_ENTITY |
|
| 209 | ); |
|
| 210 | } |
|
| 211 | if (!$authMechanism->validateStorage($storage)) { |
|
| 212 | // unsatisfied parameters |
|
| 213 | return new DataResponse( |
|
| 214 | [ |
|
| 215 | 'message' => (string)$this->l10n->t('Unsatisfied authentication mechanism parameters') |
|
| 216 | ], |
|
| 217 | Http::STATUS_UNPROCESSABLE_ENTITY |
|
| 218 | ); |
|
| 219 | } |
|
| 220 | ||
| 221 | return null; |
|
| 222 | } |
|
| @@ 191-197 (lines=7) @@ | ||
| 188 | $this->cache->set('avatar_upload', file_get_contents($files['tmp_name'][0]), 7200); |
|
| 189 | $content = $this->cache->get('avatar_upload'); |
|
| 190 | unlink($files['tmp_name'][0]); |
|
| 191 | } else { |
|
| 192 | return new DataResponse( |
|
| 193 | ['data' => ['message' => $this->l->t('Invalid file provided')]], |
|
| 194 | Http::STATUS_BAD_REQUEST, |
|
| 195 | $headers |
|
| 196 | ); |
|
| 197 | } |
|
| 198 | } else { |
|
| 199 | //Add imgfile |
|
| 200 | return new DataResponse( |
|
| @@ 198-205 (lines=8) @@ | ||
| 195 | $headers |
|
| 196 | ); |
|
| 197 | } |
|
| 198 | } else { |
|
| 199 | //Add imgfile |
|
| 200 | return new DataResponse( |
|
| 201 | ['data' => ['message' => $this->l->t('No image or file provided')]], |
|
| 202 | Http::STATUS_BAD_REQUEST, |
|
| 203 | $headers |
|
| 204 | ); |
|
| 205 | } |
|
| 206 | ||
| 207 | try { |
|
| 208 | $image = new \OC_Image(); |
|
| @@ 228-234 (lines=7) @@ | ||
| 225 | Http::STATUS_OK, |
|
| 226 | $headers |
|
| 227 | ); |
|
| 228 | } else { |
|
| 229 | return new DataResponse( |
|
| 230 | ['data' => ['message' => $this->l->t('Invalid image')]], |
|
| 231 | Http::STATUS_OK, |
|
| 232 | $headers |
|
| 233 | ); |
|
| 234 | } |
|
| 235 | } catch (\Exception $e) { |
|
| 236 | $this->logger->logException($e, ['app' => 'core']); |
|
| 237 | return new DataResponse(['data' => ['message' => $this->l->t('An error occurred. Please contact your admin.')]], Http::STATUS_OK, $headers); |
|
| @@ 160-167 (lines=8) @@ | ||
| 157 | if ($authMechanism instanceof IUserProvided) { |
|
| 158 | $authMechanism->saveBackendOptions($this->userSession->getUser(), $id, $backendOptions); |
|
| 159 | $authMechanism->manipulateStorageConfig($storage, $this->userSession->getUser()); |
|
| 160 | } else { |
|
| 161 | return new DataResponse( |
|
| 162 | [ |
|
| 163 | 'message' => (string)$this->l10n->t('Storage with id "%i" is not user editable', array($id)) |
|
| 164 | ], |
|
| 165 | Http::STATUS_FORBIDDEN |
|
| 166 | ); |
|
| 167 | } |
|
| 168 | } catch (NotFoundException $e) { |
|
| 169 | return new DataResponse( |
|
| 170 | [ |
|
| @@ 104-112 (lines=9) @@ | ||
| 101 | public function updateLogo() { |
|
| 102 | $newLogo = $this->request->getUploadedFile('uploadlogo'); |
|
| 103 | $newBackgroundLogo = $this->request->getUploadedFile('upload-login-background'); |
|
| 104 | if (empty($newLogo) && empty($newBackgroundLogo)) { |
|
| 105 | return new DataResponse( |
|
| 106 | [ |
|
| 107 | 'data' => [ |
|
| 108 | 'message' => $this->l->t('No file uploaded') |
|
| 109 | ] |
|
| 110 | ], |
|
| 111 | Http::STATUS_UNPROCESSABLE_ENTITY); |
|
| 112 | } |
|
| 113 | $name = ''; |
|
| 114 | if(!empty($newLogo)) { |
|
| 115 | $target = $this->rootFolder->newFile('themedinstancelogo'); |
|