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

📄 authorization.php

📁 Joomla!是一套获得过多个奖项的内容管理系统(Content Management System, CMS)。Joomla!采用PHP+MySQL数据库开发
💻 PHP
📖 第 1 页 / 共 2 页
字号:
		if ($this->_checkMode === 1) {			return parent::acl_check( $aco_section_value, $aco_value, $aro_section_value, $aro_value, $axo_section_value, $axo_value, $root_aro_group, $root_axo_group );		}		$this->debug_text( "\n<br /> ACO=$aco_section_value:$aco_value, ARO=$aro_section_value:$aro_value, AXO=$axo_section_value|$axo_value" );		$acl_result = 0;		for ($i=0; $i < $this->acl_count; $i++)		{			$acl =& $this->acl[$i];			if (strcasecmp( $aco_section_value, $acl[0] ) == 0) {				if (strcasecmp( $aco_value, $acl[1] ) == 0) {					if (strcasecmp( $aro_section_value, $acl[2] ) == 0) {						if (strcasecmp( $aro_value, $acl[3] ) == 0) {							if ($axo_section_value && $acl[4]) {								if (strcasecmp( $axo_section_value, $acl[4] ) == 0) {									if (strcasecmp( $axo_value, $acl[5] ) == 0) {										$acl_result = @$acl[6] ? $acl[6] : 1;										break;									}								}							} else {								$acl_result = @$acl[6] ? $acl[6] : 1;								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)			. ' ORDER BY g.id'		);		$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 > '.(int) $root->lft.' AND g1.lft <'.(int) $root->rgt;			}		}		$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);	}}

⌨️ 快捷键说明

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