Ignore:
Timestamp:
03/12/09 11:32:55 (15 years ago)
Author:
niltonneto
Message:

Fechamento das ocorrências referentes à versão 0.7.11

Location:
trunk/jabberit_messenger/inc
Files:
2 added
8 edited

Legend:

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

    r598 r697  
    1919        private $ldap; 
    2020        private $db; 
    21          
     21        private $ou_User; 
     22                 
    2223        public final function __construct() 
    2324        { 
    2425                $this->ldap = new ldap_im(); 
    25                 $this->db = new db_im();                 
     26                $this->db = new db_im(); 
     27 
     28                $ou_User = $_SESSION['phpgw_info']['jabberit_messenger']['account_dn']; 
     29                $ou_User = substr($this->ou_User,strpos($this->ou_User, "ou=")); 
     30                $ou_User = strtoupper(substr($this->ou_User, 0, strpos($this->ou_User, ",dc="))); 
     31 
     32                // (OU) User 
     33                $this->ou_User = $_SESSION['phpgw_info']['jabberit_messenger']['account_dn']; 
     34                $this->ou_User = substr($this->ou_User,strpos($this->ou_User, "ou=")); 
     35                $this->ou_User = strtoupper(substr($this->ou_User, 0, strpos($this->ou_User, ",dc="))); 
    2636        } 
    2737 
     
    4555                { 
    4656                        $groups = explode(":", $tmp); 
    47                         if( array_search($groups[1], $memberShip) !== False) 
     57                        if( array_search($groups[1], $memberShip) !== False ) 
     58                        {        
     59                                $_SESSION['phpgw_info']['jabberit_messenger']['organizationsGroupsLocked'] = $groups[2];  
    4860                                return true; 
     61                        } 
    4962                } 
    5063                 
     
    8295                return $return; 
    8396        } 
    84          
     97 
    8598        private final function users_auth_im($pName) 
    8699        {    
     
    88101        $count = count($array_uids); 
    89102        $uids_members = array(); 
     103        $result = array(); 
    90104         
    91105        for($i = 0; $i < $count ;$i+=50) 
     
    94108            $filter_uid = implode(")(uidnumber=",$partial_uids); 
    95109            $filter_uid = "(uidnumber=". $filter_uid. ")"; 
    96             $result = $this->ldap->list_users_ldap("cn=*".$pName."*", $filter_uid, $this->groupsLocked()); 
    97             if ( is_array($result) ) 
    98                 $uids_members = array_merge($uids_members,$result);                          
     110 
     111                        if( $this->groupsLocked() ) 
     112                        { 
     113                    $orgs[] = $this->ou_User; 
     114                    $orgsGroupsLocked = explode(",", $_SESSION['phpgw_info']['jabberit_messenger']['organizationsGroupsLocked']);  
     115                     
     116                                foreach( $orgsGroupsLocked as $tmp ) 
     117                                { 
     118                                        if( $tmp != "" ) 
     119                                                $orgs[] = "OU=". $tmp;             
     120                                } 
     121                                 
     122                    $orgs = array_unique($orgs); 
     123 
     124                                foreach( $orgs as $tmp ) 
     125                                        $result[] = $this->ldap->list_users_ldap("cn=*".$pName."*", $filter_uid, $tmp); 
     126                        } 
     127                        else 
     128                    $result[] = $this->ldap->list_users_ldap("cn=*".$pName."*", $filter_uid); 
     129        } 
     130 
     131        if ( is_array($result) ) 
     132        { 
     133                for($i = 0; $i < count($result); $i++) 
     134                        if(is_array($result[$i])) 
     135                                $uids_members = array_merge($uids_members,$result[$i]); 
     136        } 
    99137                 
    100                 if(count($uids_members) > 50){ 
    101                         unset($_SESSION['phpgw_info']['jabberit_messenger']['photo']);           
    102                         return 'Many Results'; 
    103                 }             
    104         } 
    105         if(count($uids_members) > 0) 
     138        if( count($uids_members) > 50 ) 
     139        { 
     140                unset($_SESSION['phpgw_info']['jabberit_messenger']['photo']);           
     141                return 'Many Results'; 
     142        }             
     143         
     144        if( count($uids_members) > 0 ) 
    106145            return $uids_members; 
    107146        else 
    108             return 0;    
     147            return 0;   
     148        } 
     149         
     150        public final function verifyAddNewContact($pUid) 
     151        { 
     152                $groupsLocked =  explode(";",$_SESSION['phpgw_info']['jabberit_messenger']['groups_locked']); 
     153                $gidNumbers = array(); 
     154                $uid = $pUid['uid']; 
     155 
     156                foreach($groupsLocked as $tmp) 
     157                { 
     158                        $groups = explode(":", $tmp); 
     159                        $gidNumbers[] = $groups[1]; 
     160                } 
     161                 
     162                $filter_gid = implode(")(gidnumber=",$gidNumbers); 
     163            $filter_gid = "(gidnumber=". $filter_gid. ")"; 
     164                 
     165                $result = $this->ldap->list_groups_memberUid($filter_gid); 
     166 
     167                if( $result && is_array($result) ) 
     168                { 
     169                        array_shift($result); 
     170                        $i = 0; 
     171                         
     172                        foreach($result as $value) 
     173                        { 
     174                                $Groups[$i]['dn'] = $value['dn']; 
     175                                $Groups[$i]['gidnumber'] = $value['gidnumber'][0]; 
     176                                if(array_key_exists('memberuid',$value)) 
     177                                { 
     178                                        array_shift($value['memberuid']); 
     179                                        $Groups[$i++]['memberuid'] = $value['memberuid']; 
     180                                } 
     181                        } 
     182 
     183                        $search = array(); 
     184                        $search_Gid = array(); 
     185                         
     186                        // Verifica Uid em Grupo Bloqueado 
     187                        foreach($Groups as $value) 
     188                        {                        
     189                                if( array_search( $uid , $value['memberuid'] ) !== false ) 
     190                                { 
     191                                        $ou = substr($value['dn'],strpos($value['dn'], "ou=")); 
     192                                        $search[] = strtoupper(substr($ou, 0, strpos($ou, ",dc="))); 
     193                                        $search_Gid[] = $value['gidnumber']; 
     194                                }        
     195                        } 
     196                } 
     197 
     198                if( $this->groupsLocked() ) 
     199                { 
     200                        if( count($search) > 0 ) 
     201                        { 
     202                                // Verifica permissões do grupo 
     203                                foreach($groupsLocked as $value) 
     204                                {                                                        
     205                                        $tpGroups = explode(":",$value); 
     206                                        if( $tpGroups[1] == $search_Gid[0] ) 
     207                                        { 
     208                                                $ousTp = explode(",",$tpGroups[2]); 
     209                                                $ou_User = substr($this->ou_User,3); 
     210                                                 
     211                                                if( array_search( $ou_User, $ousTp) !== false ) 
     212                                                        return "true"; 
     213                                        } 
     214                                } 
     215                                return "false"; 
     216                        } 
     217                        else 
     218                                return "true"; 
     219                }  
     220                else 
     221                {                
     222                        // Se Bloqueado verifica o Grupo         
     223                        if( count($search) > 0 ) 
     224                        { 
     225                                if( array_search($this->ou_User, $search) === false ) 
     226                                { 
     227                                        // Verifica permissões do grupo 
     228                                        foreach($groupsLocked as $value) 
     229                                        {                                                        
     230                                                $tpGroups = explode(":",$value); 
     231                                                if( $tpGroups[1] == $search_Gid[0] ) 
     232                                                { 
     233                                                        $ousTp = explode(",",$tpGroups[2]); 
     234                                                        $ou_User = substr($this->ou_User,3); 
     235                                                                 
     236                                                        if( array_search( $ou_User, $ousTp) !== false ) 
     237                                                                return "true"; 
     238                                                } 
     239                                        } 
     240                                        return "false"; 
     241                                } 
     242                                return "true"; 
     243                        }                                        
     244                        return "true"; 
     245                } 
    109246        } 
    110247} 
  • trunk/jabberit_messenger/inc/class.db_im.inc.php

    r622 r697  
    112112        } 
    113113         
     114        public final function getGroupsBlocked() 
     115        { 
     116                $return = ""; 
     117                 
     118                if( $this->db ) 
     119                { 
     120                        $query = "SELECT * FROM phpgw_config WHERE config_app = 'phpgwapi' AND config_name = 'groups_locked_jabberit';";         
     121                         
     122                        if($this->db->query($query)) 
     123                        { 
     124 
     125                                if ( $this->db->query($query) ) 
     126                                {        
     127                                        while($this->db->next_record()) 
     128                                                $result[] = $this->db->row(); 
     129                                } 
     130                                 
     131                                if( count($result) > 0 ) 
     132                                        $return = $result[0]['config_value']; 
     133                        } 
     134                } 
     135                 
     136                return $return; 
     137        } 
     138         
    114139        public final function getPreferences() 
    115140        { 
     
    126151                } 
    127152 
    128                 return "openWindowJabberit:true;openWindowJabberitPopUp:false"; 
    129  
     153                return "openWindowJabberit:true;openWindowJabberitPopUp:false;flagAwayIM:5"; 
     154                //return "openWindowJabberit:true;openWindowJabberitPopUp:false";                
    130155        } 
    131156 
    132157        public final function setPreferences($pParam) 
    133158        { 
    134                 $preferences = $preferences1 = $pParam['preferences1']; 
     159                $preferences = $pParam['preferences1']; 
    135160                 
    136161                if(isset($pParam['preferences2'])) 
    137                 { 
    138                         $preferences2 = $pParam['preferences2']; 
    139                         $preferences .= ";". $preferences2; 
    140                 } 
     162                        $preferences .= ";". $pParam['preferences2']; 
     163                 
     164                if(isset($pParam['preferences3'])) 
     165                        $preferences .= ";". $pParam['preferences3']; 
    141166                 
    142167                $user_id  = $this->user_id; 
     
    291316        } 
    292317         
     318        public final function setOuGroupsLocked($pGroup) 
     319        { 
     320                $group = $pGroup['group']; 
     321                $gidnumber = $pGroup['gidnumber']; 
     322                $organization = strtoupper($pGroup['ou']); 
     323 
     324                if( $this->db ) 
     325                { 
     326                        $query = "SELECT * FROM phpgw_config WHERE config_app = 'phpgwapi' AND config_name = 'groups_locked_jabberit';";         
     327                         
     328                        if($this->db->query($query)) 
     329                        { 
     330 
     331                                if ( $this->db->query($query) ) 
     332                                {        
     333                                        while($this->db->next_record()) 
     334                                                $result[] = $this->db->row(); 
     335                                } 
     336 
     337                                $groupsLocked = explode(";",$result[0]['config_value']); 
     338                                         
     339                                foreach( $groupsLocked as $tmp ) 
     340                                { 
     341                                        $aux = explode(":", $tmp); 
     342                                        if(($group.":".$gidnumber) == ($aux[0].":".$aux[1])) 
     343                                        { 
     344                                                if( $aux[2] ) 
     345                                                { 
     346                                                        $ou_groups = explode(",",$aux[2]); 
     347                                                        natcasesort($ou_groups); 
     348                                                        $key = array_search($organization, $ou_groups); 
     349                                                         
     350                                                        if( $key === false ) 
     351                                                                array_push($ou_groups, $organization); 
     352                                                         
     353                                                        $groups .= $group.":".$gidnumber.":"; 
     354                                                         
     355                                                        $return = "<return>";                                            
     356                                                         
     357                                                        foreach($ou_groups as $tmp) 
     358                                                        { 
     359                                                                $return .= "<ou attr='".$tmp."'>".$tmp."</ou>"; 
     360                                                                $groups .= $tmp .",";    
     361                                                        } 
     362                                                         
     363                                                        $return .= "</return>"; 
     364                                                         
     365                                                        $groups  = substr($groups,0,strlen($groups)-1); 
     366                                                        $groups .= ";"; 
     367                                                } 
     368                                                else 
     369                                                { 
     370                                                        $groups .= $group.":".$gidnumber.":".$organization.";"; 
     371                                                        $return = "<return><ou attr='".$organization."'>".$organization."</ou></return>"; 
     372                                                } 
     373                                        } 
     374                                        else 
     375                                                $groups .= $tmp . ";" ; 
     376                                } 
     377 
     378                                $groups = substr($groups,0,strlen($groups)-1); 
     379 
     380                                $query = "UPDATE phpgw_config SET config_value = '".trim($groups)."' WHERE config_app = 'phpgwapi' AND config_name = 'groups_locked_jabberit';"; 
     381                                $this->db->query($query); 
     382                                 
     383                                return $return; 
     384                        } 
     385                } 
     386                 
     387                return false; 
     388        } 
     389         
    293390        public final function setUseParticipantsExternal($pFlag) 
    294391        { 
     
    377474        } 
    378475         
     476        public final function removeOuGroupsLocked($pGroup) 
     477        { 
     478                $group = $pGroup['group']; 
     479                $gidnumber = $pGroup['gidnumber']; 
     480                $organization = strtoupper($pGroup['ou']); 
     481                $return = false; 
     482                 
     483                if( $this->db ) 
     484                { 
     485                        $query = "SELECT * FROM phpgw_config WHERE config_app = 'phpgwapi' AND config_name = 'groups_locked_jabberit';";         
     486                         
     487                        if($this->db->query($query)) 
     488                        { 
     489 
     490                                if ( $this->db->query($query) ) 
     491                                {        
     492                                        while($this->db->next_record()) 
     493                                                $result[] = $this->db->row(); 
     494                                } 
     495 
     496                                $groupsLocked = explode(";",$result[0]['config_value']); 
     497                                 
     498                                foreach( $groupsLocked as $tmp ) 
     499                                { 
     500                                        $aux = explode(":",$tmp); 
     501                                         
     502                                        if(($group.":".$gidnumber) == ($aux[0].":".$aux[1])) 
     503                                        { 
     504                                                $ous = explode(",", $aux[2]); 
     505                                                $key = array_search($organization, $ous); 
     506 
     507                                                if( $key !== false ) 
     508                                                        unset($ous[$key]); 
     509 
     510                                                $groups .= $group.":".$gidnumber.":"; 
     511                                                 
     512                                                foreach($ous as $ouTmp) 
     513                                                        $groups .= $ouTmp .",";  
     514                                                 
     515                                                $groups  = substr($groups,0,strlen($groups)-1); 
     516                                                $groups .= ";"; 
     517                                        } 
     518                                        else 
     519                                                $groups .= $tmp . ";" ;                                                                  
     520                                } 
     521                                         
     522                                $groups  = substr($groups,0,strlen($groups)-1); 
     523                         
     524                                $query = "UPDATE phpgw_config SET config_value = '".trim($groups)."' WHERE config_app = 'phpgwapi' AND config_name = 'groups_locked_jabberit';"; 
     525 
     526                                if( $this->db->query($query)) 
     527                                        $return = true; 
     528                        } 
     529                }        
     530                 
     531                return $return; 
     532        } 
     533         
    379534        public final function removeAttributesLdap($pOrg) 
    380535        { 
  • trunk/jabberit_messenger/inc/class.ldap_im.inc.php

    r563 r697  
    3535                $this->jid                      = $_SESSION['phpgw_info']['jabberit_messenger']['user']; 
    3636                $this->max_result       = 50; 
    37                  
    38                 // Ou User 
    39                 $this->ou_User = $_SESSION['phpgw_info']['jabberit_messenger']['account_dn']; 
    40                 $this->ou_User = substr($this->ou_User,strpos($this->ou_User, "ou=")); 
    41                 $this->ou_User = strtoupper(substr($this->ou_User, 0, strpos($this->ou_User, ",dc="))); 
    4237        } 
    4338 
     
    8580                 
    8681                @ldap_bind($this->ldap,$this->ldap_dn,$this->ldap_pass); 
     82        } 
     83 
     84        public final function list_groups_memberUid($pGroup) 
     85        { 
     86                $this->_ldapConnect(); 
     87                 
     88                if( $this->ldap ) 
     89                { 
     90                        $filter = "(&(objectclass=posixgroup)(|".$pGroup."))"; 
     91                        $justthese = array("dn","memberuid","gidnumber"); 
     92                        $search = ldap_search($this->ldap,$this->ldap_context,$filter, $justthese); 
     93                        $result = ldap_get_entries($this->ldap,$search); 
     94                         
     95                        if( $result['count'] > 0 ) 
     96                                return $result; 
     97                }                
     98                 
     99                return false; 
    87100        } 
    88101 
     
    156169        } 
    157170 
    158         public final function list_users_ldap($search, $uidnumber, $groupsDeny) 
     171        public final function list_users_ldap( $search, $uidnumber, $ous = false ) 
    159172        { 
    160173                $this->_connect_ldap(); 
     
    166179                        // SERPRO 
    167180                        //$justthese = array("uid","uidNumber","cn","mail","description","phpgwAccountVisible","dn","jpegPhoto"); 
    168                         if( $groupsDeny )                        
    169                                 $search = ldap_search($this->ldap,$this->ou_User.",".$this->ldap_context,$filter,$justthese, 0, $this->max_result + 1); 
     181         
     182                        if( $ous != false ) 
     183                                $search = ldap_search($this->ldap,$ous.",".$this->ldap_context,$filter,$justthese, 0, $this->max_result + 1); 
    170184                        else 
    171185                                $search = ldap_search($this->ldap,$this->ldap_context,$filter,$justthese, 0, $this->max_result + 1); 
     186 
    172187                        $entry1 = ldap_get_entries($this->ldap,$search); 
    173                         $entry = ldap_first_entry( $this->ldap, $search ); 
     188                        $entry  = ldap_first_entry($this->ldap,$search); 
    174189                } 
    175190 
     
    297312                return $result_groups; 
    298313        } 
    299  
    300314} 
    301315 
  • trunk/jabberit_messenger/inc/controller.xml

    r563 r697  
    3333                        <item ref="contacts_im" alias="getParticipantsExternal" class="contacts_im" method="getParticipantsExternal" prefix="class." suffix=".inc.php"/> 
    3434                        <item ref="contacts_im" alias="list_contacts" class="contacts_im" method="list_contacts" prefix="class." suffix=".inc.php"/> 
     35                        <item ref="contacts_im" alias="verifyAddNewContact" class="contacts_im" method="verifyAddNewContact" prefix="class." suffix=".inc.php"/> 
    3536                        <item ref="db_im" alias="getPreferences" class="db_im" method="getPreferences" prefix="class." suffix=".inc.php"/> 
    3637                        <item ref="db_im" alias="setAttributesLdap" class="db_im" method="setAttributesLdap" prefix="class." suffix=".inc.php"/> 
    3738                        <item ref="db_im" alias="setPreferences" class="db_im" method="setPreferences" prefix="class." suffix=".inc.php"/> 
    3839                        <item ref="db_im" alias="setUseParticipantsExternal" class="db_im" method="setUseParticipantsExternal" prefix="class." suffix=".inc.php"/> 
     40                        <item ref="db_im" alias="setOuGroupsLocked" class="db_im" method="setOuGroupsLocked" prefix="class." suffix=".inc.php"/> 
    3941                        <item ref="db_im" alias="setOrganization" class="db_im" method="setOrganization" prefix="class." suffix=".inc.php"/> 
    4042                        <item ref="db_im" alias="removeAttributesLdap" class="db_im" method="removeAttributesLdap" prefix="class." suffix=".inc.php"/> 
     43                        <item ref="db_im" alias="removeOuGroupsLocked" class="db_im" method="removeOuGroupsLocked" prefix="class." suffix=".inc.php"/> 
    4144                        <item ref="db_im" alias="removeParticipantsExternal" class="db_im" method="removeParticipantsExternal" prefix="class." suffix=".inc.php"/> 
    4245                        <item ref="ldap_im" alias="list_organizations_ldap" class="ldap_im" method="list_organizations_ldap" prefix="class." suffix=".inc.php"/> 
  • trunk/jabberit_messenger/inc/getphoto.php

    r551 r697  
    176176                $photoHeight = 90; 
    177177                $newImage = imagecreatetruecolor($photoWidth,$photoHeight);              
    178                  
     178 
    179179                if($photo) 
    180180                { 
    181181                        $photo = imagecreatefromstring($photo); 
    182                         $trans = imagecolortransparent($photo); 
    183182                        imagecopyresized($newImage,$photo,0,0,0,0,$photoWidth,$photoHeight,imagesx($photo),imagesy($photo)); 
    184                         imagepng($newImage); 
    185                         imagedestroy($newImage); 
    186183                } 
    187184                else 
    188185                { 
    189186                        $photo = @imagecreatefrompng("../templates/default/images/photo.png"); 
    190                         $trans = imagecolortransparent($photo); 
    191187                        imagecopyresized($newImage,$photo,0,0,0,0,$photoWidth,$photoHeight,imagesx($photo),imagesy($photo)); 
    192                         imagepng($newImage); 
    193                         imagedestroy($newImage); 
    194                 } 
     188                } 
     189 
     190                ob_start(); 
     191                imagepng($newImage); 
     192                $imagePhoto = ob_get_contents(); 
     193                imagedestroy($newImage); 
     194                ob_end_clean(); 
     195                printf("%s",base64_encode($imagePhoto)); 
    195196        } 
    196197        else 
  • trunk/jabberit_messenger/inc/hook_admin.inc.php

    r563 r697  
    1818                'Configuration of authentication attribute by Organization (OU)' => $GLOBALS['phpgw']->link('/index.php','menuaction=jabberit_messenger.uiconforganization.edit_conf'), 
    1919                'External Participants' => $GLOBALS['phpgw']->link('/index.php','menuaction=jabberit_messenger.uiexternals.editParticipantsExternals'), 
    20                 'Deny module\'s use by group' => $GLOBALS['phpgw']->link('/index.php','menuaction=jabberit_messenger.uigroupslocked.editGroups') 
    21                  
     20                'Deny module\'s use by group' => $GLOBALS['phpgw']->link('/index.php','menuaction=jabberit_messenger.uigroupslocked.editGroups'), 
     21                'Liberar Organizações para grupos restritos' => $GLOBALS['phpgw']->link('/index.php','menuaction=jabberit_messenger.uienabledgroups.getGroups'), 
    2222        ); 
    2323 
  • trunk/jabberit_messenger/inc/jabberit_acl.inc.php

    r563 r697  
    5555                        $ExternalParticipants = implode(",", $ExternalParticipants); 
    5656                } 
    57                                          
     57                 
    5858                require_once dirname(__FILE__) . '/load_lang.php'; 
    5959                 
    60                 print "<script type='text/javascript'>". 
    61                                  "var path_jabberit='".$webserver_url."';". 
    62                                  "var externalParticipantsJabberit='".$ExternalParticipants."';". 
    63                           "</script>"; 
     60                $var_js  = "var path_jabberit='".$webserver_url."';"; 
     61                $var_js .= "var externalParticipantsJabberit='".$ExternalParticipants."';"; 
     62 
     63                echo "<script type=\"text/javascript\">".$var_js."</script>"; 
    6464 
    6565                $js = array( 
  • trunk/jabberit_messenger/inc/login.php

    r622 r697  
    8080                } 
    8181 
     82                // Enable Plugins Java; 
     83                $pluginsJava[] = $path . "applet.jar?" . filemtime("applet.jar"); 
     84                $pluginsJava[] = $path . "plugins/filetransfer.jar?" . filemtime("plugins/filetransfer.jar"); 
     85                $pluginsJava[] = $path . "plugins/xhtml.jar?" . filemtime("plugins/xhtml.jar"); 
     86                 
     87                for($i = 0; $i < count($pluginsJava); $i++) 
     88                        $javaFiles .= $pluginsJava[$i] . ","; 
     89 
     90                // Load Template; 
    8291                $template = new Template('templates/default'); 
    8392                $template->set_var("path", $path); 
    84                 $template->set_var("file0", filemtime("applet.jar")); 
    85                 $template->set_var("file1", filemtime("plugins/groupchat.jar")); 
    86                 $template->set_var("file2", filemtime("plugins/sound.jar")); 
    87                 $template->set_var("file3", filemtime("plugins/xhtml.jar"));             
     93                $template->set_var("java_files", $javaFiles); 
    8894                $template->set_var("value_server",$_SESSION['phpgw_info']['jabberit_messenger']['name_jabberit']); 
    8995                $template->set_var("value_host",$_SESSION['phpgw_info']['jabberit_messenger']['name_jabberit']);                         
Note: See TracChangeset for help on using the changeset viewer.