public function execute() { $album_id = waRequest::post('album_id', null, waRequest::TYPE_INT); $album_rights_model = new photosAlbumRightsModel(); if (!$album_rights_model->checkRights($album_id, true)) { throw new waException(_w("You don't have sufficient access rights")); } $album_model = new photosAlbumModel(); $album_model->delete($album_id); $this->log('album_delete', 1); }
public function execute() { $id = $this->post('id', true); $album_model = new photosAlbumModel(); $album = $album_model->getById((int) $id); if ($album) { $album_rights_model = new photosAlbumRightsModel(); if (!$album_rights_model->checkRights($id, true)) { throw new waAPIException('access_denied', 403); } if ($album_model->delete($id)) { $this->response = true; } else { throw new waAPIException('server_error', 500); } } else { throw new waAPIException('invalid_request', 'Album not found', 404); } }