<?php
require_once(dirname(__FILE__)."/config.php");
require_once(dirname(__FILE__)."/../include/pub_datalist_dm.php");
require_once(dirname(__FILE__)."/../include/inc_functions.php");
$db = new DedeSql(false);
$id = ereg_replace("[^0-9]","",$id);
if($id < 1) {
	ShowMsg("错误,未定义的操作！","-1");
	exit(); 
}
$rs = $db->GetOne("SELECT * FROM #@__groups WHERE groupid='$id'");
if(!is_array($rs)){
	$db->Close();
	ShowMsg("圈子不存在,或被删除！","-1");
	exit(); 
}else if($rs['ishidden']){
	$db->Close();
	ShowMsg("圈子被管理员屏蔽中！","-1");
	exit();
}
$title = $rs['groupname'];
$des = $rs['des'];
if(empty($des)) $des = "本圈还没有介绍说明.";
$creater = $rs['creater'];
$hits    = $rs['hits'];
$master = $rs['ismaster'];
//贴子数
$threads = $rs['threads'];
//成员数
$members = $rs['members'];
//检测管理员
$ismaster    = @explode(",",$master);
$ismaster	 = in_array($cfg_ml->M_UserName,$ismaster);
if(empty($cfg_ml->M_UserName)) $ismaster = 0;
$smalltype = $rs['smalltype'];
$userid	= $rs['uid'];
$WhereSql = "WHERE gid='$id'";
//
if(!isset($do)) $do = '';
if($do=="del"){
	if($ismaster) $db->ExecuteNoneQuery("DELETE FROM #@__group_guestbook WHERE bid='$bid'");	
}
$sql = "SELECT * FROM #@__group_guestbook $WhereSql ORDER BY stime ASC";
$dlist = new DataList();
$dlist->pageSize = 5;
if($nowpage<2) $i=0;
else $i=($nowpage-1)*5;
$dlist->SetParameter("id",$id);
$dlist->SetSource($sql);
require_once(dirname(__FILE__)."/templets/guestbook.htm");
$dlist->Close();
unset($rs);
$db->Close();
?>