<?php
class action
{
	var $db;
	var $tpl;
	var $siteinfo = array();
	var $userinfo = array();

	function action()
	{
		global $db_obj,$glo_install_num,$glo_domain_directory,$glo_domain_name,$glo_site_version;
		$this->db 			= 	$db_obj;
		$this->is_ajax		=	$_GET['is_ajax']?1:0;
		$this->message_info		=		false;
		$this->install_num	=	$glo_install_num;
		$this->domain_directory	=	$glo_domain_directory;
		$this->domain_name			=	$glo_domain_name;
		$this->site_version	=	$glo_site_version;
	}

	function init_tpl()
	{
		if(!$this->tpl){
			require_once(ROOT_PATH.'includes/glo_template.php');
			$this->tpl = new template;
			$this->tpl->out['glo_install_num']		=	$this->install_num;
			$this->tpl->out['glo_domain_name']		=	$this->domain_name;
			$this->tpl->out['glo_domain_directory']=	$this->domain_directory;
			$this->tpl->out['glo_site_version']		=	$this->site_version;
			return $this->tpl;
		}
	}

	function system_message($message,$type,$return_arr,$message_info='')
	{
		$message_arr	=	array(
			'message'		=>	$message,
			'type'			=>	$type,
			'return_arr'	=>	$return_arr,
			'message_info'	=>	$message_info,	
		);
		$this->message_info		=	false;

		if(!$this->is_ajax){
			$this->init_tpl();
			$this->tpl->out['message_arr']	=	$message_arr;
			$this->tpl->display("system.message.html");
		}else{
			echo json_return($message_arr);
			exit;
		}
	}
}
?>
