<?php
// $Id: deletecomment.php,v 1.1 2004/07/11 10:29:11 Farsus Exp $
// -------------------------------------------------------------------------//
//			       RUNCMS                                                   //
//                                                                          //
//	 reliable - Unique - Nocost &  Simplicity & ease off use                //
//                       < http://www.runcms.org >                          //
// -------------------------------------------------------------------------//
// 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 ( $HTTP_GET_VARS['ok'] == 1 ) {
	if ( !empty($HTTP_GET_VARS['comment_id']) ) {
		$pollcomment = new XoopsComments($db->prefix("xoopspollcomments"), intval($HTTP_GET_VARS['comment_id']));
		$deleted = $pollcomment->delete();
		$item_id = $pollcomment->getVar("item_id");
	}
	redirect_header("pollresults.php?poll_id=".intval($item_id)."&amp;order=".intval($HTTP_GET_VARS['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($HTTP_GET_VARS['comment_id'])."&amp;order=".intval($HTTP_GET_VARS['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");
?>
