<?php
include("header.php");
include_once(XOOPS_ROOT_PATH."/class/xoopscomments.php");
include_once("class/class.newsstory.php");
if ( $xoopsUser ) {
	if ( !$xoopsUser->isAdmin($xoopsModule->mid()) ) {
		include(XOOPS_ROOT_PATH."/header.php");
		echo "<h4>"._NW_DELNOTALLOWED."</h4>";
		echo "<br />";
		echo "<a href='javascript:history.go(-1)'>"._NW_GOBACK."</a>";
		include(XOOPS_ROOT_PATH."/footer.php");
		exit();
	}
} else {
	include(XOOPS_ROOT_PATH."/header.php");
	echo "<h4>"._NW_DELNOTALLOWED."</h4>";
	echo "<br />";
	echo "<a href='javascript:history.go(-1)'>"._NW_GOBACK."</a>";
	include(XOOPS_ROOT_PATH."/footer.php");
	exit();
}
if ( !empty($HTTP_GET_VARS['ok']) ) {
	if ( !empty($HTTP_GET_VARS['comment_id']) ) {
		$artcomment = new XoopsComments($xoopsDB->prefix("comments"),$HTTP_GET_VARS['comment_id']);
		$deleted = $artcomment->delete();
		$item_id = $artcomment->getVar("item_id");
	}
	redirect_header("article.php?storyid=$item_id&order=".$HTTP_GET_VARS['order']."&mode=".$HTTP_GET_VARS['mode']."",2,_PL_COMMENTSDEL);
	exit();
} else {
	include(XOOPS_ROOT_PATH."/header.php");
	OpenTable();
	echo "<div>";
	echo "<h4 style='color:#ff0000;'>"._NW_AREUSUREDEL."</font></h4>";
	echo "<table><tr><td>\n";
	echo myTextForm($PHP_SELF."?comment_id=".$HTTP_GET_VARS['comment_id']."&mode=".$HTTP_GET_VARS['mode']."&order=".$HTTP_GET_VARS['order']."&ok=1", _NW_YES);
	echo "</td><td>\n";
	echo myTextForm("javascript:history.go(-1)", _NW_NO);
	echo "</td></tr></table>\n";
	echo "</div>";
	CloseTable();
}
include(XOOPS_ROOT_PATH."/footer.php");
?>