<?php
/*--------------------------------------------------------- 
 * File:pageBase.php
 * Author:Tomix
 * Description: 
 * Created:2009
 * -------------------------------------------------------
 * Modified history:
 * -------------------------------------------------------
 * Copyright:
 * -------------------------------------------------------
 */
	session_start();
	require_once "../../bin/web/page.php";
	require_once "../../modules/sessionKeys.php";
	
	class pageBase extends page{
		public function load(){
			if(!isset($_SESSION[sessionKeys::$userInfo])){
				parent::redirect("/admin/login.php");
			}
			parent::load();
		}

		public function getCurrentUser(){
			if(!isset($_SESSION[sessionKeys::$userInfo])){
				return null;
			}else{
				$info = (object)$_SESSION[sessionKeys::$userInfo];
				return $info;
			}
		}

		public function getCurrentUserID(){
			if(isset($_SESSION[sessionKeys::$adminUserID]) && $_SESSION[sessionKeys::$adminUserID] != "")
				return (int)$_SESSION[sessionKeys::$adminUserID];
			return 0;
		}
	}
?>