/** * Delete the specified comment and all its children. */ function delete($args) { $articleId = isset($args[0]) ? (int) $args[0] : 0; $galleyId = isset($args[1]) ? (int) $args[1] : 0; $commentId = isset($args[2]) ? (int) $args[2] : 0; list($journal, $issue, $article) = CommentHandler::validate($articleId); $user =& Request::getUser(); $userId = isset($user) ? $user->getUserId() : null; $commentDao =& DAORegistry::getDAO('CommentDAO'); $roleDao =& DAORegistry::getDAO('RoleDAO'); if (!$roleDao->roleExists($journal->getJournalId(), $userId, ROLE_ID_JOURNAL_MANAGER)) { Request::redirect(null, 'index'); } $comment =& $commentDao->getComment($commentId, $articleId, ARTICLE_COMMENT_RECURSE_ALL); if ($comment) { $commentDao->deleteComment($comment); } Request::redirect(null, null, 'view', array($articleId, $galleyId), array('refresh' => '1')); }