private function setSessionParams() { Session\set('user_id', $this->user_id); Session\set('sess_id', $this->sess_id); }
case 'editArticle': (new Articles($db))->edit($_GET['id'], $_POST['title'], $_POST['content']); header('Location: ' . ROOT_DIR . '?section=admin'); break; case 'deleteArticle': (new Articles($db))->delete($_GET['id']); header('Location: ' . ROOT_DIR . '?section=admin'); break; // Comments actions // Comments actions case 'addComment': $result = (new Comments($db))->add($_POST['text'], $_GET['id'], $session->get('user_id')); if (!$result) { if (trim($_POST['text']) == '') { $error_comment = '&error_comment=1'; // Empty comment } else { $error_comment = '&error_comment=2'; // Error in DataBase Session\set('post_text', $_POST['text']); } } header('Location: ' . ROOT_DIR . '?section=article&id=' . $_GET['id'] . $error_comment); break; case 'deleteComment': $result = (new Comments($db))->delete($_GET['comment_id']); return_back(); break; case 'editComment': break; }