All pastes #277449 Raw Edit

Something

public text v1 · immutable
·published 2006-12-13 05:40 UTC
rendered paste body
<?php
/**
 * Authorization Class
 * This class will handle the the authentification of the users and access
 * to certain member sections of the site.
 * 
 * This code's inspiration came from Curt Zirzow's Auth and diggerAuth classes 
 * which are covered under the BSD license.  He gave me permission to use 
 * these classes as my inspiration - though it technically wasn't needed. :)
 * His copyright information:
 * 
 * Copyright (c) 2006, Curt Zirzow
 * All rights reserved.
 * 
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 * 
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 * SUCH DAMAGE.
 *  
 * 
 * @package Guamcell
 * @author Ligaya Turmelle
 * @version 0.1 
 */ 
class Auth
{
	/**
	* account 
	* @desc used to hold the users access info
	* @access protected
	*/
	protected $account = array('id'=>0, 'groups'=> array());
	
	/**
	* allow
	* @desc Holds who has access to "it"
	* @access protected
	*/
	protected $allow;
	
	/**
	* public
	* @desc Holds whether 'it' is public
	* @access protected
	*/
	protected $public;
	
	/**
	* constructor
	* @TODO figure out how I will be interacting with the database
	* 
	* @param mixed $dbh
	* @param array $groups
	* @return void
	*/
	public function __construct($dbh, $groups='') 
	{
			if (is_array($groups)) {
				$this->allow = $groups;
			}
			$this->dbh = $dbh;
			if (is_array($_SESSION['zAuth']) ) {
				$this->account = $_SESSION['zAuth'];
			}
		}
} 
?>