<?php
include("header.php");
include_once(XOOPS_ROOT_PATH."/class/xoopscomments.php");
if ( !$xoopsUser ) {
	include(XOOPS_ROOT_PATH."/header.php");
	echo "<h4>"._PL_DELNOTALLOWED."</h4>";
	echo "<br />";
	echo "<a href=\"javascript:history.go(-1)\">"._PL_GOBACK."</a>";
	include(XOOPS_ROOT_PATH."/footer.php");
	exit();
} else {
	if ( !$xoopsUser->isAdmin($xoopsModule->mid()) ) {
		include(XOOPS_ROOT_PATH."/header.php");
		echo "<h4>"._PL_DELNOTALLOWED."</h4>";
		echo "<br />";
		echo "<a href=\"javascript:history.go(-1)\">"._PL_GOBACK."</a>";
		include(XOOPS_ROOT_PATH."/footer.php");
		exit();
	}
}
if ( $HTTP_GET_VARS['ok'] == 1 ) {
	if ( !empty($HTTP_GET_VARS['comment_id']) ) {
		$pollcomment = new XoopsComments($xoopsDB->prefix("xoopspollcomments"),intval($HTTP_GET_VARS['comment_id']));
		$deleted = $pollcomment->delete();
		$item_id = $pollcomment->getVar("item_id");
	}
	redirect_header("pollresults.php?poll_id=".$item_id."&amp;order=".intval($HTTP_GET_VARS['order']),2,_PL_COMMENTSDEL);
	exit();
} else {
	include(XOOPS_ROOT_PATH."/header.php");
	OpenTable();
	echo "<div align=\"center\">";
	echo "<h4 style='color:#ff0000;'>"._PL_AREYOUSURE."</h4>";
	echo "<table><tr><td>\n";
	echo myTextForm("deletecomment.php?comment_id=".intval($HTTP_GET_VARS['comment_id'])."&amp;order=".intval($HTTP_GET_VARS['order'])."&amp;ok=1", _YES);
	echo "</td><td>\n";
	echo myTextForm("javascript:history.go(-1)", _NO);
	echo "</td></tr></table>\n";
	echo "</div>";
	CloseTable();
}
include(XOOPS_ROOT_PATH."/footer.php");
?>