<?php
// www.bcoos.net 2006-09 1.0.2 GPL
// $Id: deletecomment.php,v 1.4 2003/03/31 10:00:27 half-dead Exp $
// ------------------------------------------------------------------------- //
//               E-Xoops: Content Management for the Masses                  //
//                       < http://www.e-xoops.com >                          //
// ------------------------------------------------------------------------- //
// Original Author: Kazumi Ono
// Author Website : http://www.mywebaddons.com/ , http://www.myweb.ne.jp
// License Type   : GPL: See /manual/LICENSES/GPL.txt
// ------------------------------------------------------------------------- //
include_once("header.php");
include_once(XOOPS_ROOT_PATH."/class/xoopscomments.php");
if ( !$xoopsUser ) {
	include_once(XOOPS_ROOT_PATH."/header.php");
	echo "<h4>"._PL_DELNOTALLOWED."</h4><br />";
	echo "<a href=\"javascript:history.go(-1)\">"._GOBACK."</a>";
	include_once(XOOPS_ROOT_PATH."/footer.php");
	exit();
	} else {
		if ( !$xoopsUser->isAdmin($xoopsModule->mid()) ) {
			include_once(XOOPS_ROOT_PATH."/header.php");
			echo "<h4>"._PL_DELNOTALLOWED."</h4><br />";
			echo "<a href=\"javascript:history.go(-1)\">"._GOBACK."</a>";
			include_once(XOOPS_ROOT_PATH."/footer.php");
			exit();
		}
	}
if ( $_GET['ok'] == 1 ) {
	if ( !empty($_GET['comment_id']) ) {
		$pollcomment = new XoopsComments($db->prefix("xoopspollcomments"),intval($_GET['comment_id']));
		$deleted = $pollcomment->delete();
		$item_id = $pollcomment->getVar("item_id");
	}
	redirect_header("pollresults.php?poll_id=".intval($item_id)."&amp;order=".intval($_GET['order']), 2, _PL_COMMENTSDEL);
	exit();
	} else {
		include_once(XOOPS_ROOT_PATH."/header.php");
		OpenTable();
		echo "<div align='center'><h4 style='color:#ff0000;'>"._PL_AREYOUSURE."</h4><table><tr><td>";
		echo myTextForm("deletecomment.php?comment_id=".intval($_GET['comment_id'])."&amp;order=".intval($_GET['order'])."&amp;ok=1", _YES);
		echo "</td><td>";
		echo myTextForm("javascript:history.go(-1)", _NO);
		echo "</td></tr></table></div>";
		CloseTable();
	}
include_once(XOOPS_ROOT_PATH."/footer.php");
?>
