⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 authorization.php

📁 Joomla15 - 最新开源CMS
💻 PHP
📖 第 1 页 / 共 2 页
字号:
								break;							}						}					}				}			}		}		return $acl_result;	}	/**	 * Gets the 'name' of a group	 * @param int The group id	 * @param string The type: [ARO]|AXO	 * @return string	 */	function get_group_name($group_id = null, $group_type = 'ARO')	{		$data = $this->get_group_data( $group_id, 'ARO' );		return $data[3];	}	/**	 * @param string The value for the group	 * @return object The row from the group table	 */	function getAroGroup( $value ) {		return $this->_getGroup( 'aro', $value );	}	function _getGroup( $type, $value )	{		$db =& JFactory::getDBO();		$db->setQuery( 'SELECT g.*'			. ' FROM #__core_acl_'.$type.'_groups AS g'			. ' INNER JOIN #__core_acl_groups_'.$type.'_map AS gm ON gm.group_id = g.id'			. ' INNER JOIN #__core_acl_'.$type.' AS ao ON ao.id = gm.'.$type.'_id'			. ' WHERE ao.value='.$db->Quote($value)		);		$obj = $db->loadObject(  );		return $obj;	}	function _getBelow( $table, $fields, $groupby=null, $root_id=null, $root_name=null, $inclusive=true )	{		$db =& JFactory::getDBO();		$root = new stdClass();		$root->lft = 0;		$root->rgt = 0;		if ($root_id) {		} else if ($root_name) {			$query	= "SELECT lft, rgt FROM $table WHERE name = ".$db->Quote($root_name);			$db->setQuery( $query );			$root = $db->loadObject();		}		$where = '';		if ($root->lft+$root->rgt <> 0) {			if ($inclusive) {				$where = ' WHERE g1.lft BETWEEN '.(int) $root->lft.' AND '.(int) $root->rgt;			} else {				$where = ' WHERE g1.lft BETWEEN 3 AND 22 ';			}		}		$query	= 'SELECT '. $fields				. ' FROM '. $table .' AS g1'				. ' INNER JOIN '. $table .' AS g2 ON g1.lft BETWEEN g2.lft AND g2.rgt'				. $where				. ($groupby ? ' GROUP BY ' . $groupby : '')				. ' ORDER BY g1.lft';		$db->setQuery( $query );		return $db->loadObjectList();	}	/**	 * @param int	 * @param string	 * @param boolean	 * @param boolean Returns the complete html if true	 * @return string|array String if html, otherwise an array	 */	function get_group_children_tree( $root_id=null, $root_name=null, $inclusive=true, $html=true )	{		$db =& JFactory::getDBO();		$tree = $this->_getBelow( '#__core_acl_aro_groups',			'g1.id, g1.name, COUNT(g2.name) AS level',			'g1.name',			$root_id, $root_name, $inclusive );		// first pass get level limits		$n = count( $tree );		$min = $tree[0]->level;		$max = $tree[0]->level;		for ($i=0; $i < $n; $i++) {			$min = min( $min, $tree[$i]->level );			$max = max( $max, $tree[$i]->level );		}		$indents = array();		foreach (range( $min, $max ) as $i) {			$indents[$i] = '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';		}		// correction for first indent		$indents[$min] = '';		$list = array();		for ($i=$n-1; $i >= 0; $i--) {			$shim = '';			foreach (range( $min, $tree[$i]->level ) as $j) {				$shim .= $indents[$j];			}			if (@$indents[$tree[$i]->level+1] == '.&nbsp;') {				$twist = '&nbsp;';			} else {				$twist = "-&nbsp;";			}			$groupName = JText::_( $tree[$i]->name );			//$list[$i] = $tree[$i]->level.$shim.$twist.$tree[$i]->name;			if ($html) {				$list[$i] = JHTML::_('select.option',  $tree[$i]->id, $shim.$twist.$groupName );			} else {				$list[$i] = array( 'value'=>$tree[$i]->id, 'text'=>$shim.$twist.$groupName );			}			if ($tree[$i]->level < @$tree[$i-1]->level) {				$indents[$tree[$i]->level+1] = '.&nbsp;';			}		}		ksort($list);		return $list;	}	/*======================================================================*\		Function:	has_group_parent		Purpose:	Checks whether the 'source' group is a child of the 'target'	\*======================================================================*/	function is_group_child_of( $grp_src, $grp_tgt, $group_type='ARO' )	{		$db =& JFactory::getDBO();		$this->debug_text("has_group_parent(): Source=$grp_src, Target=$grp_tgt, Type=$group_type");		switch(strtolower(trim($group_type))) {			case 'axo':				$table = $this->_db_table_prefix .'axo_groups';				break;			default:				$table = $this->_db_table_prefix .'aro_groups';				break;		}		$query = 'SELECT COUNT(*) '.				 'FROM '.$table.' AS g1 '.				 'LEFT JOIN '.$table.' AS g2 ON (g1.lft > g2.lft AND g1.lft < g2.rgt) ';		if (is_int( $grp_src ) && is_int($grp_tgt)) {			$query .= 'WHERE g1.id = '.$grp_src.' AND g2.id = '.$grp_tgt;		} else if (is_string( $grp_src ) && is_string($grp_tgt)) {			$query .= 'WHERE g1.name = '.$db->Quote($grp_src).' AND g2.name = '.$db->Quote($grp_tgt);		} else if (is_int( $grp_src ) && is_string($grp_tgt)) {			$query .= 'WHERE g1.id = '.$grp_src.' AND g2.name = '.$db->Quote($grp_tgt);		} else {			$query .= 'WHERE g1.name = '.$db->Quote($grp_src).' AND g2.id = '.(int) $grp_tgt;		}		$db->setQuery($query);		return $db->loadResult();	}	/*======================================================================*\		Function:	get_group_children()		Purpose:	Gets a groups child IDs	\*======================================================================*/	function get_group_parents($group_id, $group_type = 'ARO', $recurse = 'NO_RECURSE')	{		$this->debug_text("get_group_parents(): Group_ID: $group_id Group Type: $group_type Recurse: $recurse");		switch (strtolower(trim($group_type))) {			case 'axo':				$group_type = 'axo';				$table = $this->_db_table_prefix .'axo_groups';				break;			default:				$group_type = 'aro';				$table = $this->_db_table_prefix .'aro_groups';		}		if (empty($group_id)) {			$this->debug_text("get_group_parents(): ID ($group_id) is empty, this is required");			return FALSE;		}		$query = '				SELECT		g2.id				FROM		'. $table .' g1';		//FIXME-mikeb: Why is group_id in quotes?		switch (strtoupper($recurse)) {			case 'RECURSE':				$query .= '				LEFT JOIN 	'. $table .' g2 ON g1.lft > g2.lft AND g1.lft < g2.rgt				WHERE		g1.id='.(int) $group_id;				break;			case 'RECURSE_INCL':				// inclusive resurse				$query .= '				LEFT JOIN 	'. $table .' g2 ON g1.lft >= g2.lft AND g1.lft <= g2.rgt				WHERE		g1.id='.(int) $group_id;				break;			default:				$query .= '				WHERE		g1.parent_id='.(int) $group_id;		}		$query .= '				ORDER BY	g2.lft';		$this->db->setQuery( $query );		return $this->db->loadResultArray();	}	/**	 * Deprecated, use JAuthorisation::addACL() instead.	 *	 * @since 1.0	 * @deprecated As of version 1.5	 * @see JAuthorisation::addACL()	 */	function _mos_add_acl( $aco_section_value, $aco_value, $aro_section_value, $aro_value, $axo_section_value=NULL, $axo_value=NULL, $return_value=NULL ) {		$this->addACL($aco_section_value, $aco_value, $aro_section_value, $aro_value, $axo_section_value, $axo_value, $return_value);	}}/** * Required for both Classess below */jimport('joomla.database.table');/** * @package 	Joomla.Framework * @subpackage	User * @since		1.5 */class JTableARO extends JTable{	/** @var int Primary key */	var $id			  	= null;	var $section_value	= null;	var $value			= null;	var $order_value	= null;	var $name			= null;	var $hidden			= null;	function __construct( &$db )	{		parent::__construct( '#__core_acl_aro', 'aro_id', $db );	}}/** * @package 	Joomla.Framework * @subpackage	User * @since		1.5 */ class JTableAROGroup extends JTable {	/** @var int Primary key */	var $id			= null;	var $parent_id	= null;	var $name		= null;	var $value		= null;	var $lft		= null;	var $rgt		= null;	function __construct( &$db )	{		parent::__construct( '#__core_acl_aro_groups', 'group_id', $db );	}}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -