Ignore:
Timestamp:
09/21/09 15:56:22 (15 years ago)
Author:
alexandrecorreia
Message:

Ticket #649 - Correção para liberar organização ( sub-ous ) por grupo.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/jabberit_messenger/inc/class.db_im.inc.php

    r988 r1438  
    426426        public final function setOuGroupsLocked($pGroup) 
    427427        { 
     428                 
     429                function strallpos($haystack, $needle, $offset = 0) 
     430                { 
     431                    $result = array(); 
     432                    for($i = $offset; $i< strlen($haystack); $i++ ) 
     433                    { 
     434                        $pos = strpos($haystack,$needle,$i); 
     435                        if($pos !== FALSE) 
     436                        { 
     437                            $offset =  $pos; 
     438                            if($offset >= $i) 
     439                                $result[] = $i = $offset; 
     440                        } 
     441                    } 
     442                 
     443                return $result; 
     444                }  
     445 
    428446                $group = $pGroup['group']; 
    429447                $gidnumber = $pGroup['gidnumber']; 
    430                 $organization = strtoupper($pGroup['ou']); 
     448                $organization = strtoupper(trim($pGroup['ou'])); 
     449 
     450                $posAll = strallpos($organization, "OU=" ); 
     451                $orgs = array(); 
     452 
     453                for( $i = 0 ; $i < count($posAll); $i++ ) 
     454                { 
     455                        $pos = strpos($organization, ","); 
     456                        $tmpString = substr($organization, $posAll[$i] + 3); 
     457                        $orgs[] = substr($tmpString, 0, strpos($tmpString, ",")); 
     458                } 
     459 
     460                $organization = implode("/", array_reverse($orgs)); 
    431461 
    432462                if( $this->db ) 
Note: See TracChangeset for help on using the changeset viewer.