<?php
/*
	Stempora Web Framework
	Copyright (c) 2002-2014 Stempora. 
	All rights reserved.
		web:  www.stempora.com
		mail: support@stempora.com		
*/

// dependencies

/**
* description
*
* @library	
* @author	
* @since	
*/
class CUserLogout extends CPlugin{
	
	var $tplvars; 

	function CUserLogout() {
		//$this->CPlugin($db, $tables , $templates);
		$this->name = "userlogout";

	}

	function DoEvents(){
		global $base, $_CONF, $_TSM , $_VARS , $_USER , $_BASE , $_SESS;

		parent::DoEvents();


		if ($_GET["mod"] == "userlogout") {

			$this->__init();

			return $this->Logout();
		}
		
	}

	function __init() {
		global $_CONF;

		if ($this->__inited) {
			return "";
		}

		$this->__inited = true;
		
		$path = $this->tpl_path;

		$templates = array(

		);

		foreach ($templates as $key => $val) {
			$this->private->templates[$key] = new CTemplateDynamic(
				$path . $val
			);
		}

		$this->tpl_module = $this->module->plugins["modules"]->LoadDefaultModule("userlogout");

		//$this->tpl_module["settings"]["link_dashboard"] = $this->tpl_module["link"] . "dashboard/";	
	} 
	/**
	* description
	*
	* @param
	*
	* @return
	*
	* @access
	*/
	function Logout() {
		global $_SESS , $_LANG;


		$this->plugins["users"]->LogAction(array("action"	=> "Logged out from website."));


		unset($_SESS["client"]);

		urlredirect($this->plugins["modules"]->modules["users"]["link"]);

	}



	
	/**
	* description
	*
	* @param
	*
	* @return
	*
	* @access
	*/
	function UserMenuAppend($module){

		return array(
			array(
				"title"	=> $module["module_name"], 
				"link"	=> $module["link"] ,
				"priority"	=> $module["module_user_position"],
			),

		);
	}


	

}

?>