Location: PHPKode > projects > EXtensible Production Suite (XPS) > xpsdev/core/models/user.php
<?php

/***********************************************************************************************************
*
* <p>Contains core user functions</p>
*
* @author heidtc <hide@address.com>
*
************************************************************************************************************/
Class User
{

	/****************************************************************
	* <p>constructor for user object.</p>
	*
	* @access   public
	* @author 	heidtc < hide@address.com >
	****************************************************************/
	public function __construct()
	{
	//...
	}

	/****************************************************************
	* <p>Begins session</p>
	*
	* @access   public
	* @author 	heidtc < hide@address.com >
	****************************************************************/
	public function begin_session($username, $recordset)
	{
        $_SESSION['username'] = $username;
		$_SESSION['is_admin'] = $recordset[0]['IS_ADMIN'];
        $_SESSION['theme'] = $recordset[0]['THEME'];
	}

	/****************************************************************
	* <p>Destroys current session</p>
	*
	* @access   public
	* @author 	heidtc < hide@address.com >
	****************************************************************/
	public function end_session()
	{
		$_SESSION['username'] = '';
		$_SESSION['is_admin'] = 0;
        $_SESSION['theme'] = '';
	}

	/****************************************************************
	* <p>sets up email</p>
	*
	* @access   public
	* @author 	heidtc < hide@address.com >
	****************************************************************/
	public function launch_email($user_email, $message)
	{
		$site_admin_email = $this->get_setting('site_admin_email');
		$site_title = $this->get_setting('site_title');

		require_once( HELPERS . '/xpm2/smtp.php');
        $mail = new SMTP;
	    $mail->From($site_admin_email);
        $mail->AddTo($user_email);
        $mail->Text($message);
        $blnSent = $mail->Send($site_title);
	}

	/****************************************************************
	* <p>gets settings</p>
	*
	* @access   private
	* @author 	heidtc < hide@address.com >
	****************************************************************/
	private function get_setting($id)
	{
		$dom = new DOMDocument;
		$dom->preserveWhiteSpace = false;
		$dom->load( CONFIGS . '/settings.xml');

		$xpath = new DOMXPath($dom);

		$config_node = $xpath->query('//setting[@id='.$id.']');
		$config_value = $config_node->item(0)->nodeValue;

		return $config_value;
	}

}//END CLASS
?>
Return current item: EXtensible Production Suite (XPS)