<?
		$iserror = 0;

		$topicid = isset($topicid)?intval($topicid):0;
		$getbooks = new getbook;
		$bid = $db->query_field("select ownerid from ".JIEQI_DB_PREFIX."_article_replies where istopic=1 and topicid = ".$topicid);
		if(!$bid){
				$iserror = 1;
				$url = array();
				$tourl = URL_book_index($url);
				$pagecontent = "<b>错误：</b><br/>";
				$pagecontent .= "该书评不存在或已经被删除！<br/>";
		}else{
				$bookname = $db->query_field("select articlename from ".JIEQI_DB_PREFIX."_article_article where articleid = ".$bid);
		}
		if($iserror == 0){
				/*自定义数据*/$pagesize = 1000;//每页显示字数
				$topic = $db->query_object("select postid,posterid,editorid,editor,edittime,editorip,editnote,attachment,subject,posttext from ".JIEQI_DB_PREFIX."_article_replies where istopic=1 and topicid=".$topicid);
				$totalwords = mb_strlen($topic->posttext,"utf-8");
				$totalpage = ceil($totalwords/$pagesize);
				$page = isset($page)?intval($page):"1";
				$page = ($page>$totalpage)?($totalpage):($page);
				$totalpage = ($totalpage==0)?1:intval($totalpage);
				$page = ($page<1)?(1):($page);
				$start = (($page-1)*$pagesize);
				$topiccontent = mb_substr($topic->posttext,$start,$pagesize,'utf-8');
				$smartyObj -> assign("gettopic",$db->query_object("select title,posttime,posterid,poster,views,replies,islock,istop,isgood from ".JIEQI_DB_PREFIX."_article_reviews where topicid = ".$topicid));
				$smartyObj -> assign("getreply",$db->query_array("select * from ".JIEQI_DB_PREFIX."_article_replies where istopic=0 and topicid = ".$topicid." order by posttime desc limit 0,3"));
				$replynum = $db->query_num("select * from ".JIEQI_DB_PREFIX."_article_replies where istopic=0 and topicid = ".$topicid);
				$smartydate = array("pagetitle" => $topic->subject,
													"topiccontent" => $topiccontent,
													"totalwords" => $totalwords,
													"totalpage" => $totalpage,
													"page" => $page,
													"pagesize" => $pagesize,
													"bid" => $bid,
													"topicid" => $topicid,
													"bookname" => $bookname,
													"authsign" => $listuser->getuserdate("sign",$topic->posterid),
													"replynum" => $replynum,
													"posturl" => "book_reviews_reply_post.php?topicid=".$topicid."&sid=".$sid,
													"postid" => $topic->postid,
													"editorid" => $topic->editorid,
													"editor" => $topic->editor,
													"edittime" => $topic->edittime,
													"editorip" => $topic->editorip,
													"editnote" => $topic->editnote,
													"CheckAdmin" => $getbooks->CheckAdmin($bid,@$_SESSION["member"]->uid,"0"),
													"data" => array("topicid"=>$topicid),
														);
				$db->query("UPDATE ".JIEQI_DB_PREFIX."_article_reviews SET views = views + 1 WHERE topicid = ".$topicid);

				$tplpath = "book/reviews_topic.tpl";
		}else{
				$smartydate = array("pagetitle" => "提醒",
														"pagecontent" => $pagecontent,
														"tourl" => $tourl,
														"redirecturl" => $tourl,
														);
				$tplpath = "public.tpl";
		}
?>