<?php
if(!$_SESSION['admin_id']){
	pe_goto("index.php");
}
$menumark = 'comment_list';
switch ($act) {
	//#####################@ 评价修改 @#####################//
	case 'edit':
		$info = $db->pe_select('comment', array('comment_id'=>$_g_id));

		$seo = pe_seo('修改评价', '', '', 'admin');
		$action = "admin.php?mod=comment&act=editsql&id={$_g_id}";
		include(pe_tpl('comment_add.html'));
	break;
	//#####################@ 评价回复sql @#####################//
	case 'editsql':
		$_p_info['comment_atime'] = $_p_info['comment_atime'] ? strtotime($_p_info['comment_atime']) : time();
		$_p_info['comment_replytime'] = $_p_info['comment_replytime'] ? strtotime($_p_info['comment_replytime']) : time();
		if ($db->pe_update('comment', array('comment_id'=>$_g_id), pe_dbhold($_p_info))) {
			pe_success('评价回复成功!', 'admin.php?mod=comment&act=list');
		}
		else {
			pe_error('评价回复失败...');
		}
	break;
	//#####################@ 评价删除sql @#####################//
	case 'delsql':
		if ($db->pe_delete('comment', array('comment_id'=>is_array($_p_comment_id) ? $_p_comment_id : $_g_id))) {
			pe_success('评价删除成功!');
		}
		else {
			pe_error('评价删除失败...');
		}
	break;
	//#####################@ 评价审核sql @#####################//
	case 'statesql':
		if ($db->pe_update('comment', array('comment_id'=>is_array($_p_comment_id) ? $_p_comment_id : $_g_id), array('comment_state'=>intval($_g_state)))) {
			pe_success('评价状态更改成功!');
		}
		else {
			pe_error('评价状态更改失败...');
		}
	break;
	//#####################@ 评价列表 @#####################//
	default :
		$_g_keyword && $sqlwhere .= " and `comment_text` like '%{$_g_keyword}%'";
		$sqlwhere .= " order by `comment_id` desc";
		$info_list = $db->pe_selectall('comment', $sqlwhere, '*', array(20, $_g_page));

		$seo = pe_seo('评价列表', '', '', 'admin');
		include(pe_tpl('comment_list.html'));
	break;
}
pe_result();
?>