示例#1
0
 /**
  * @NoAdminRequired
  *
  * @param int $id
  * @return DataResponse
  */
 public function get($id)
 {
     // save the last viewed note
     $this->settings->setUserValue($this->userId, $this->appName, 'notesLastViewedNote', $id);
     return $this->respond(function () use($id) {
         return $this->notesService->get($id, $this->userId);
     });
 }
示例#2
0
 /**
  * @NoAdminRequired
  * @NoCSRFRequired
  *
  * @return TemplateResponse
  */
 public function index()
 {
     $lastViewedNote = (int) $this->settings->getUserValue($this->userId, $this->appName, 'notesLastViewedNote');
     // check if note exists
     try {
         $this->notesService->get($lastViewedNote, $this->userId);
     } catch (NoteDoesNotExistException $ex) {
         $lastViewedNote = 0;
     }
     $response = new TemplateResponse($this->appName, 'main', ['lastViewedNote' => $lastViewedNote]);
     $csp = new ContentSecurityPolicy();
     $csp->addAllowedImageDomain('*');
     $response->setContentSecurityPolicy($csp);
     return $response;
 }
示例#3
0
 /**
  * @NoAdminRequired
  * @CORS
  * @NoCSRFRequired
  *
  * @param int $id
  * @param string $exclude
  * @return DataResponse
  */
 public function get($id, $exclude = '')
 {
     $exclude = explode(',', $exclude);
     return $this->respond(function () use($id, $exclude) {
         $note = $this->service->get($id, $this->userId);
         $note = $this->excludeFields($note, $exclude);
         return $note;
     });
 }