Project

General

Profile

Bug #2720 » 2720-pt1.patch

krileon, 14 October 2011 21:59

View differences:

administrator/components/com_comprofiler/library/cb/cb.acl.php
function get_groups_below_me() {
global $_CB_framework;
static $gids = array();
static $gids = array();
$myId = $_CB_framework->myId();
$myId = $_CB_framework->myId();
if ( ! isset( $gids[$myId] ) ) {
if ( checkJversion() == 2 ) {
$my_groups = $this->get_object_groups( $myId );
$my_groups = $_CB_framework->acl->get_object_groups( $myId );
} elseif ( checkJversion() == 1 ) {
$aro_id = $this->get_object_id( 'users', $myId, 'ARO' );
$my_groups = $this->get_object_groups( $aro_id, 'ARO' );
$aro_id = $_CB_framework->acl->get_object_id( 'users', $myId, 'ARO' );
$my_groups = $_CB_framework->acl->get_object_groups( $aro_id, 'ARO' );
} else {
$my_groups = $this->get_object_groups( 'users', $myId, 'ARO' );
$my_groups = $_CB_framework->acl->get_object_groups( 'users', $myId, 'ARO' );
}
if ( is_array( $my_groups ) && count( $my_groups ) > 0 ) {
$ex_groups = $this->get_group_children( $my_groups[0], 'ARO', 'RECURSE' );
$my_gids = array();
if ( $my_groups ) foreach ( $my_groups as $gid ) {
$my_gids = array_unique( array_merge( $my_gids, $_CB_framework->acl->get_group_children_ids( $gid ) ) );
if ( checkJversion() == 2 ) {
$my_gids = array_unique( array_merge( $my_gids, $_CB_framework->acl->get_object_groups( $myId, null, 'RECURSE' ) ) );
}
}
if ( ( ! is_array( $my_gids ) ) || empty( $my_gids ) ) {
$my_gids = array();
} else {
$ex_groups = array();
cbArrayToInts( $my_gids );
}
$groups = $this->get_group_children_tree( null, 'USERS', false );
$tree = $_CB_framework->acl->get_group_children_tree( null, 'USERS', false );
$i = 0;
if ( is_array( $ex_groups ) && ( count( $ex_groups ) > 0 ) ) {
while ( $i < count( $groups ) ) {
if ( in_array( $groups[$i]->value, $ex_groups ) ) {
array_splice( $groups, $i, 1 );
} else {
$i++;
}
if ( $tree ) foreach ( $tree as $k => $v ) {
if ( ! in_array( (int) $v->value, $my_gids ) ) {
unset( $tree[$k] );
}
}
$gids[$myId] = $groups;
$gids[$myId] = array_values( $tree );
}
return $gids[$myId];
(1-1/2)