<?php 
require "../../Run.php";
require root_path."/include/page.inc.php";
require root_path."/include/AdminView.fun.php";
require root_path."/include/getmkurl.fun.php";
if($admin != 1 && $admin !=2 ){
	die("暂未登录或者权限不足");
}
$mysql = new D('liuyan');
if($_GET['cid'] == NULL){
	$urlStr = get_mkid('liuyan/list.php');
	echo head('选择栏目');
	echo ViewClassList($urlStr,WAPID);
}else{
if($_GET['act'] == 'del'){
	echo head('删除记录');
	echo topNav('删除留言记录','<a href="?cid='.$_GET['cid'].'">列表</a>',' ');
	if($_GET['del'] == 'yes'){
		$mysql -> where(array('lid'=>$_GET['id'],'siteid'=>WAPID))->delete();
		echo '<div class="tip">成功删除此条记录！</div>';
	}else{
		echo '<div class="content">是否确定删除当前记录？<br>[<a href="?cid='.$_GET['cid'].'&act=del&del=yes&id='.$_GET['id'].'">确定删除此条记录</a>]</div>';
	}
}else{
	if($_GET['cid'] == 0){
		echo head('所有留言内容');
		$list = $mysql -> where(array('siteid'=>WAPID))->order('lid DESC')->limit(slist($_GET['page'],15),15)->select();	
		$lis2 = $mysql -> where(array('siteid'=>WAPID))->order('lid DESC')->select();  
		$listNums = count($list2);
	}
	else
	{
		echo head('留言内容');
		$list = $mysql -> where(array('gro'=>$_GET['cid'],'siteid'=>WAPID))->order('lid DESC')->limit(slist($_GET['page'],15),15)->select();	
		$lis2 = $mysql -> where(array('gro'=>$_GET['cid'],'siteid'=>WAPID))->order('lid DESC')->select();  
		$listNums = count($list2);
	} 
		if($list){
			$num = 0;
			foreach($list as $value)
			{
				$div = $num++%2 == 0?'line1':'line2';
				echo '<div class="'.$div.'"><a href="content.php?cid='.$value['gro'].'&id='.$value['lid'].'">'.$value['title'].'</a><a href="?cid='.$_GET['cid'].'&act=del&id='.$value['lid'].'">[删|</a><a href="mod.php?">编辑]</a>['.$value['time'].']</div>';
			}
		}
		else
		{
			echo '此栏目暂无记录';
		}
		echo page($listNums,15,'?cid='.$_GET['cid'].'&',NULL,'view');
	}
	
}
echo footer(1);