<?php
require_once(dirname(__FILE__)."/config.php");
$id = ereg_replace("[^0-9]","",$id);
if($id < 1) {
	ShowMsg("错误,未定义的操作！","-1");
	exit(); 
}
$db = new DedeSql(false);
$rs = $db->GetOne("SELECT ishidden,groupname,groupimg,creater,hits,ismaster,threads,members,smalltype,des,uid FROM #@__groups WHERE groupid='$id'");
if(!is_array($rs)){
	$db->Close();
	ShowMsg("圈子不存在,或被删除！","-1");
	exit(); 
}else if($rs['ishidden']){
	$db->Close();
	ShowMsg("圈子被管理员屏蔽中！","-1");
	exit();
}
$row = $db->GetOne("SELECT creater FROM #@__groups WHERE groupid='$id' AND uid=".$cfg_ml->M_ID);
if(is_array($row)){
	if($row['creater']!=$cfg_ml->M_UserName) $db->ExecuteNoneQuery("UPDATE #@__groups SET creater='".$cfg_ml->M_UserName."' WHERE groupid='$id';");
	unset($row);
}
$db->ExecuteNoneQuery("UPDATE #@__groups SET hits=hits+1 WHERE groupid='$id';");
$title = $rs['groupname'];
$icon  = $rs['groupimg'];
if(!$icon) $icon = "images/group_mainlist00.gif";
$des = $rs['des'];
if(empty($des)) $des = "本圈还没有介绍说明.";

$userid	= $rs['uid'];
$hits    = $rs['hits'];
$master = $rs['ismaster'];
$creater = $rs['creater'];
//贴子数
$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;
if($userid==$cfg_ml->M_ID) $ismaster = 1;
$smalltype = $rs['smalltype'];
//获得公告信息
$rs = $db->GetOne("SELECT uname,notice FROM #@__group_notice WHERE gid='$id' ORDER BY stime DESC");
if(!is_array($rs)){
	$notice = "系统:本圈刚开张,大家多发贴.送人鲜花 手有余香,让我们为公益事业加油!";
}else{
	$notice = $rs['uname']."：".$rs['notice'];
}
require_once(dirname(__FILE__)."/templets/group.htm");
unset($rs);
$db->Close();
?>