<?php
	!defined('DIRCMS_MEMBER') && exit('Access Denied!');
	if(!$_iscompmayed)showmsg('Bad Request!!!',$DIRCMS['site_url']); //非法请求
	$action=empty($action)?'manage':trim($action);
	require_once(DIRCMS_ROOT.'include/form.class.php');	
	require_once(DIRCMS_ROOT.'include/list.class.php');
	$l=new dircmslist();
	switch($action)
	{
		case 'manage':
			if($do_submit)
			{	
				if(!$id)showmsg('请选择需要删除的留言!');
				$id=!is_array($id)?array($id):$id;
				$id=array_map('intval',$id);
				$db->query("DELETE FROM ".DB_PRE."member_comment WHERE id IN (".implode(',',$id).") AND memberid=$_userid",true);
				showmsg('删除成功!',$forwardurl);
			}
			$ispassed=isset($ispassed)?intval($ispassed):1;
			$where='status='.$ispassed.' AND memberid='.$_userid;
			$k=trim($k);
			$where=!empty($k)?$where." AND content like '%{$k}%'":$where;
			$orderby="id DESC";
			$page=max(isset($page)?intval($page):1,1);
			$result=$l->getlist(DB_PRE.'member_comment',$where,$orderby,$page,20);
			$pages=$l->pages;
			include member_tlp('co_guestbook_manage');
			break;
		case 'pass':
			if(!$id)showmsg('请选择需要审核的留言!');
			$id=!is_array($id)?array($id):$id;
			$db->update(DB_PRE.'member_comment',array('status'=>intval($status)),'id IN('.implode(',',array_map('intval',$id)).')  AND memberid='.$_userid,true);
			showmsg('审核成功!',$forwardurl);
			break;
	}
?>