<?php
require_once '../../Config.php';
header ( "Content-Type: text/html; charset=utf-8" );
if (intval ( BLL_Admin::isLogin () ) === 0) {
	header ( 'Location:../index.html' );
	die ();
}
new BackUSL_Controller ( $_REQUEST ['action'] );

/**
 * 链接控制器
 * 
 * @author Wzb
 *
 */
class BackUSL_Controller {
	/**
	 * 构造函数
	 * 
	 * @param string $action 处理方法名
	 */
	public function __construct($action) {
		if (! method_exists ( $this, $action )) {
			die ( "该方法不存在" );
		}
		switch ($action) {
			case "delete" : //删除留言
			case "guestBookSh" : //审核留言
			case "repaly" : //留言回复
				break;
			default :
				die ( "该方法错误" );
				break;
		}
		$this->{$action} ();
	}
	
	/**
	 * 删除类别
	 * 
	 */
	private function delete() {
		if (BLL_GuestBook::delete ( $_GET ['theList'] )) {
			echo COM_OftenJavaScript::parentRefurbish ();
		} else {
			echo COM_OftenJavaScript::parentAlert ( "删除失败!!!" );
		}
	}
	
	/**
	 * 审核留言
	 * 
	 */
	private function guestBookSh() {
		if (BLL_GuestBook::checkup ( array ("id" => $_GET ['theId'], "isSh" => $_GET ['isSh'] ) )) {
			echo COM_OftenJavaScript::parentRefurbish ();
		} else {
			echo COM_OftenJavaScript::parentAlert ( "操作失败!!!" );
		}
	}
	
	/**
	 * 回复留言
	 * 
	 */
	private function repaly() {
		if (BLL_GuestBook::repaly ( array ("id" => $_POST ['theId'], "repaly" => $_POST ['repaly'] ) )) {
			echo COM_OftenJavaScript::alertGoToUrl ( "回复成功!!!", "GuestBook_Repaly.php?theId=" . $_POST ['theId'] );
		} else {
			echo COM_OftenJavaScript::alertGoBack ( "回复失败!!!" );
		}
	}
}
?>