<?php
// www.bcoos.net 2006-09 1.0.2 GPL
// $Id: deletecomment.php,v 1.3 2003/03/19 07:01:16 half-dead Exp $
// ------------------------------------------------------------------------- //
//               E-Xoops: Content Management for the Masses                  //
//                       < http://www.e-xoops.com >                          //
// ------------------------------------------------------------------------- //
// Original Author: The Xoops Project
// Author Website : http://www.xoops.org
// License Type   : GPL: See /manual/LICENSES/GPL.txt
// ------------------------------------------------------------------------- //
include_once("header.php");
include_once(XOOPS_ROOT_PATH."/class/xoopscomments.php");
include_once("class/class.newsstory.php");
if ($xoopsUser) {
	if ( !$xoopsUser->isAdmin($xoopsModule->mid()) ) {
		include_once(XOOPS_ROOT_PATH."/header.php");
		echo "<h4>"._NW_DELNOTALLOWED."</h4>";
		echo "<br />";
		echo "<a href='javascript:history.go(-1)'>"._GOBACK."</a>";
		include_once(XOOPS_ROOT_PATH."/footer.php");
		exit();
	}
	} else {
		include_once(XOOPS_ROOT_PATH."/header.php");
		echo "<h4>"._NW_DELNOTALLOWED."</h4>";
		echo "<br />";
		echo "<a href='javascript:history.go(-1)'>"._GOBACK."</a>";
		include_once(XOOPS_ROOT_PATH."/footer.php");
		exit();
	}
if ( !empty($_GET['ok']) ) {
	if ( !empty($_GET['comment_id']) ) {
		$artcomment = new XoopsComments($db->prefix("comments"),$_GET['comment_id']);
		$deleted = $artcomment->delete();
		$item_id = $artcomment->getVar("item_id");
	}
	redirect_header("article.php?storyid=$item_id&order=".$_GET['order']."&mode=".$_GET['mode']."",2,_PL_COMMENTSDEL);
	exit();
	} else {
		include_once(XOOPS_ROOT_PATH."/header.php");
		OpenTable();
		echo "<h4 style='color:#ff0000;'>"._NW_AREUSUREDEL."</font></h4>";
		echo "<table><tr><td>";
		echo myTextForm("./deletecomment.php?comment_id=".$_GET['comment_id']."&mode=".$_GET['mode']."&order=".$_GET['order']."&ok=1", _YES);
		echo "</td><td>";
		echo myTextForm("javascript:history.go(-1)", _NO);
		echo "</td></tr></table>";
		CloseTable();
	}
include_once(XOOPS_ROOT_PATH."/footer.php");
?>
