<?
		$iserror = 0;
		
		$listuser -> checklogin($_SESSION["member"]->uid);

		$topicid = isset($topicid)?intval($topicid):0;
		
		$getbooks = new getbook;
		
		$getposts = $db->query_object("select ownerid,posterid from ".JIEQI_DB_PREFIX."_article_replies where istopic=1 and topicid = ".$topicid);
		
		if(!$getposts){
				$iserror = 1;
				$url = array();
				$tourl = URL_book_index($url);
				$pagecontent = "<b>删除错误</b><br/>";
				$pagecontent .= "该帖子不存在或已经被删除！<br/>";
		}else{
				$bid = $getposts->ownerid;
				$posterid = $getposts->posterid;
				$articlename = $db->query_field("select articlename from ".JIEQI_DB_PREFIX."_article_article where articleid = ".$bid);
		}
		if($iserror == 0 and !$getbooks->CheckAdmin($bid,$_SESSION["member"]->uid,"1")){
				if($iserror == 0 and $posterid != $_SESSION["member"]->uid){
						$iserror = 1;
						$url = array("topicid"=>$topicid,"page"=>"");
						$tourl = URL_book_reviews_topic($url);
						$pagecontent = "<b>删除错误</b><br/>";
						$pagecontent .= "您不是该帖的主人无权修改本帖！<br/>";
				}
		}
		if($iserror == 0 and $act == "ok"){
				$db->query("DELETE FROM ".JIEQI_DB_PREFIX."_article_replies WHERE topicid = ".$topicid);
				$db->query("DELETE FROM ".JIEQI_DB_PREFIX."_article_reviews WHERE topicid = ".$topicid);
				
				$db->query("UPDATE ".JIEQI_DB_PREFIX."_system_users SET experience=experience-".$jieqiConfigs['forum']['scoretopic'].",score=score-".$jieqiConfigs['forum']['scoretopic']." WHERE uid=".$_SESSION["member"]->uid);//回帖成功增加积分
				
				$_SESSION["member"]->score	= $_SESSION["member"]->score	- $jieqiConfigs['forum']['scoretopic'];//增加用户积分
				$_SESSION["member"]->experience	= $_SESSION["member"]->experience	- $jieqiConfigs['forum']['scoretopic'];//增加用户积分
				
				$url = array("bid"=>$bid,"page"=>"","rank"=>"");
				$tourl = URL_book_reviews_list($url);
				$pagecontent = "<b>删除成功</b><br/>";
				$pagecontent .= "已经删除该帖以及该帖所有评论，正在返回列表！<br/>";
		}
		
		if($iserror == 0 and $act != "ok"){
				$smartydate = array("pagetitle" => "删除帖子",
											"topicid" => $topicid,
											"bid" => $bid,
											"articlename" => $articlename,
											);
				$tplpath = "book/reviews_topic_delet.tpl";
		}else{
				$smartydate = array("pagetitle" => "删除帖子",
														"pagecontent" => $pagecontent,
														"tourl" => $tourl,
														"redirecturl" => $tourl,
														);
														
				$tplpath = "public.tpl";
		}
?>