Revize 305
Přidáno uživatelem Michal Kliment před asi 15 roky(ů)
freenetis/trunk/kohana/application/vendors/phpgacl/gacl.class.php | ||
---|---|---|
<?php
|
||
<?php defined('SYSPATH') or die('No direct script access.');
|
||
|
||
// $Id: gacl.class.php 422 2006-09-03 22:52:20Z ipso $
|
||
|
||
/**
|
||
* phpGACL - Generic Access Control List
|
||
* Copyright (C) 2002,2003 Mike Benoit
|
||
... | ... | |
* @author Mike Benoit <ipso@snappymail.ca>
|
||
*/
|
||
class gacl {
|
||
|
||
/*
|
||
--- phpGACL Configuration path/file ---
|
||
*/
|
||
... | ... | |
--- Database configuration. ---
|
||
*/
|
||
/** @var string Prefix for all the phpgacl tables in the database */
|
||
var $_db_table_prefix = '';
|
||
var $_db_table_prefix;
|
||
|
||
/** @var string The database type, based on available ADODB connectors - mysql, postgres7, sybase, oci8po See here for more: http://php.weblogs.com/adodb_manual#driverguide */
|
||
var $_db_type = 'mysql';
|
||
var $_db_type;
|
||
|
||
/** @var string The database server */
|
||
var $_db_host = 'localhost';
|
||
var $_db_host;
|
||
|
||
/** @var string The database user name */
|
||
var $_db_user = 'freenetis';
|
||
var $_db_user;
|
||
|
||
/** @var string The database user password */
|
||
var $_db_password = 'heslo';
|
||
var $_db_password;
|
||
|
||
/** @var string The database name */
|
||
var $_db_name = 'freenetis';
|
||
var $_db_name;
|
||
|
||
/** @var object An ADODB database connector object */
|
||
var $_db = '';
|
||
var $_db;
|
||
|
||
/*
|
||
* NOTE: This cache must be manually cleaned each time ACL's are modified.
|
||
... | ... | |
*/
|
||
function gacl($options = NULL) {
|
||
|
||
$this->set_db();
|
||
|
||
$available_options = array('db','debug','items_per_page','max_select_box_items','max_search_return_items','db_table_prefix','db_type','db_host','db_user','db_password','db_name','caching','force_cache_expire','cache_dir','cache_expire_time');
|
||
|
||
//Values supplied in $options array overwrite those in the config file.
|
||
... | ... | |
'writeControl' => FALSE,
|
||
'readControl' => FALSE,
|
||
'memoryCaching' => TRUE,
|
||
'automaticSerialization' => FALSE
|
||
'automaticSerialization' => FALSE
|
||
);
|
||
$this->Cache_Lite = new Hashed_Cache_Lite($cache_options);
|
||
}
|
||
... | ... | |
return true;
|
||
}
|
||
|
||
function set_db()
|
||
{
|
||
require (APPPATH.'config/database.php');
|
||
|
||
$this->_db_type = $connection['driver'];
|
||
|
||
/** @var string The database server */
|
||
$this->_db_host = $connection['host'];
|
||
|
||
/** @var string The database user name */
|
||
$this->_db_user = $connection['user'];
|
||
|
||
/** @var string The database user password */
|
||
$this->_db_password = $connection['password'];
|
||
|
||
/** @var string The database name */
|
||
$this->_db_name = $connection['database'];
|
||
|
||
/** @var object An ADODB database connector object */
|
||
$this->_db = '';
|
||
|
||
return true;
|
||
}
|
||
|
||
/**
|
||
* Prints database debug text if debug is enabled.
|
||
* @param string The name of the function calling this method
|
||
... | ... | |
* @return array Returns as much information as possible about the ACL so other functions can trim it down and omit unwanted data.
|
||
*/
|
||
function acl_query($aco_section_value, $aco_value, $aro_section_value, $aro_value, $axo_section_value=NULL, $axo_value=NULL, $root_aro_group=NULL, $root_axo_group=NULL, $debug=NULL) {
|
||
|
||
|
||
$cache_id = 'acl_query_'.$aco_section_value.'-'.$aco_value.'-'.$aro_section_value.'-'.$aro_value.'-'.$axo_section_value.'-'.$axo_value.'-'.$root_aro_group.'-'.$root_axo_group.'-'.$debug;
|
||
|
||
$retarr = $this->get_cache($cache_id);
|
Také k dispozici: Unified diff
Opravena mensi chybicka...