Beispiel #1
0
 public function post_delete()
 {
     if (!isset($_POST['id'])) {
         return $this->error('Missing parameter: id');
     }
     if (!isset($_POST['user'])) {
         return $this->error('Missing parameter: user');
     }
     $note = new \user\Note($_POST['id']);
     if ($note->error) {
         error_log($note->error);
         return $this->error('An unexpected error occurred.');
     }
     if (!$note->remove()) {
         error_log($note->error);
         return $this->error('An unexpected error occurred.');
     }
     return $this->get__default($_POST['user']);
     //return true;
 }
Beispiel #2
0
 /**
  * Get all notes for the current user.
  * Alias of `user\Note::for_user ($user_id)`
  */
 public function notes()
 {
     return user\Note::for_user($this->id);
 }