diff --git a/application/controllers/components/stv/Favorites.php b/application/controllers/components/stv/Favorites.php deleted file mode 100644 index e0e7bbf7e..000000000 --- a/application/controllers/components/stv/Favorites.php +++ /dev/null @@ -1,61 +0,0 @@ -load->model('system/Variable_model', 'VariableModel'); - - // Load libraries - $this->load->library('AuthLib'); - - // TODO(chris): variable table might be to small to store favorites! - } - - public function index() - { - $result = $this->VariableModel->getVariables(getAuthUID(), ['stv_favorites']); - - if (isError($result)) { - $this->output->set_status_header(REST_Controller::HTTP_INTERNAL_SERVER_ERROR); - return $this->outputJson(getError($result)); - } - - $result = getData($result); - if (!$result) - $this->outputJson(null); - else - $this->outputJson($result['stv_favorites']); - } - - public function set() - { - $_POST = json_decode(utf8_encode($this->input->raw_input_stream), true); - - $this->load->library('form_validation'); - - $this->form_validation->set_rules('favorites', 'Favorites', 'required'); - - if ($this->form_validation->run() == false) { - $this->output->set_status_header(REST_Controller::HTTP_BAD_REQUEST); - return $this->outputJson($this->form_validation->error_array()); - } - - $favorites = $this->input->post('favorites'); - - $result = $this->VariableModel->setVariable(getAuthUID(), 'stv_favorites', $favorites); - - if (isError($result)) { - $this->output->set_status_header(REST_Controller::HTTP_INTERNAL_SERVER_ERROR); - return $this->outputJson(getError($result)); - } - - $this->outputJsonSuccess(true); - } -}