<?php
// $Id: deletecomment.php,v 1.1 2004/07/11 10:28:39 Farsus Exp $
// -------------------------------------------------------------------------//
//			                 RUNCMS                                         //
//                                                                          //
//	 reliable - Unique - Nocost &  Simplicity & ease off use                //
//                       < http://www.runcms.org >                          //
// -------------------------------------------------------------------------//
// 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($HTTP_GET_VARS['ok']) ) {
	if ( !empty($HTTP_GET_VARS['comment_id']) ) {
		$artcomment = new XoopsComments($db->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_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=".$HTTP_GET_VARS['comment_id']."&mode=".$HTTP_GET_VARS['mode']."&order=".$HTTP_GET_VARS['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");
?>
