Project

General

Profile

2720-pt1.patch

krileon, 14 October 2011 09:59 PM

View differences:

administrator/components/com_comprofiler/library/cb/cb.acl.php
528 528
	function get_groups_below_me() {
529 529
		global $_CB_framework;
530 530

  
531
		static $gids		=	array();
531
		static $gids			=	array();
532 532

  
533
		$myId				=	$_CB_framework->myId();
533
		$myId					=	$_CB_framework->myId();
534 534

  
535 535
		if ( ! isset( $gids[$myId] ) ) {
536 536
			if ( checkJversion() == 2 ) {
537
				$my_groups	=	$this->get_object_groups( $myId );
537
				$my_groups		=	$_CB_framework->acl->get_object_groups( $myId );
538 538
			} elseif ( checkJversion() == 1 ) {
539
				$aro_id		=	$this->get_object_id( 'users', $myId, 'ARO' );
540
				$my_groups	=	$this->get_object_groups( $aro_id, 'ARO' );
539
				$aro_id			=	$_CB_framework->acl->get_object_id( 'users', $myId, 'ARO' );
540
				$my_groups		=	$_CB_framework->acl->get_object_groups( $aro_id, 'ARO' );
541 541
			} else {
542
				$my_groups	=	$this->get_object_groups( 'users', $myId, 'ARO' );
542
				$my_groups		=	$_CB_framework->acl->get_object_groups( 'users', $myId, 'ARO' );
543 543
			}
544 544

  
545
			if ( is_array( $my_groups ) && count( $my_groups ) > 0 ) {
546
				$ex_groups	=	$this->get_group_children( $my_groups[0], 'ARO', 'RECURSE' );
545
			$my_gids			=	array();
546

  
547
			if ( $my_groups ) foreach ( $my_groups as $gid ) {
548
				$my_gids		=	array_unique( array_merge( $my_gids, $_CB_framework->acl->get_group_children_ids( $gid ) ) );
549

  
550
				if ( checkJversion() == 2 ) {
551
					$my_gids	=	array_unique( array_merge( $my_gids, $_CB_framework->acl->get_object_groups( $myId, null, 'RECURSE' ) ) );
552
				}
553
			}
554

  
555
			if ( ( ! is_array( $my_gids ) ) || empty( $my_gids ) ) {
556
				$my_gids		=	array();
547 557
			} else {
548
				$ex_groups	=	array();
558
				cbArrayToInts( $my_gids );
549 559
			}
550 560

  
551
			$groups			=	$this->get_group_children_tree( null, 'USERS', false );
561
			$tree				=	$_CB_framework->acl->get_group_children_tree( null, 'USERS', false );
552 562

  
553
			$i				=	0;
554

  
555
			if ( is_array( $ex_groups ) && ( count( $ex_groups ) > 0 ) ) {
556
				while ( $i < count( $groups ) ) {
557
					if ( in_array( $groups[$i]->value, $ex_groups ) ) {
558
						array_splice( $groups, $i, 1 );
559
					} else {
560
						$i++;
561
					}
563
			if ( $tree ) foreach ( $tree as $k => $v ) {
564
				if ( ! in_array( (int) $v->value, $my_gids ) ) {
565
					unset( $tree[$k] );
562 566
				}
563 567
			}
564
			$gids[$myId]	=	$groups;
568

  
569
			$gids[$myId]		=	array_values( $tree );
565 570
		}
566 571

  
567 572
		return $gids[$myId];