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