Changeset 697 for trunk/jabberit_messenger/inc
- Timestamp:
- 03/12/09 11:32:55 (15 years ago)
- 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 19 19 private $ldap; 20 20 private $db; 21 21 private $ou_User; 22 22 23 public final function __construct() 23 24 { 24 25 $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="))); 26 36 } 27 37 … … 45 55 { 46 56 $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]; 48 60 return true; 61 } 49 62 } 50 63 … … 82 95 return $return; 83 96 } 84 97 85 98 private final function users_auth_im($pName) 86 99 { … … 88 101 $count = count($array_uids); 89 102 $uids_members = array(); 103 $result = array(); 90 104 91 105 for($i = 0; $i < $count ;$i+=50) … … 94 108 $filter_uid = implode(")(uidnumber=",$partial_uids); 95 109 $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 } 99 137 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 ) 106 145 return $uids_members; 107 146 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 } 109 246 } 110 247 } -
trunk/jabberit_messenger/inc/class.db_im.inc.php
r622 r697 112 112 } 113 113 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 114 139 public final function getPreferences() 115 140 { … … 126 151 } 127 152 128 return "openWindowJabberit:true;openWindowJabberitPopUp:false ";129 153 return "openWindowJabberit:true;openWindowJabberitPopUp:false;flagAwayIM:5"; 154 //return "openWindowJabberit:true;openWindowJabberitPopUp:false"; 130 155 } 131 156 132 157 public final function setPreferences($pParam) 133 158 { 134 $preferences = $p references1 = $pParam['preferences1'];159 $preferences = $pParam['preferences1']; 135 160 136 161 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']; 141 166 142 167 $user_id = $this->user_id; … … 291 316 } 292 317 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 293 390 public final function setUseParticipantsExternal($pFlag) 294 391 { … … 377 474 } 378 475 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 379 534 public final function removeAttributesLdap($pOrg) 380 535 { -
trunk/jabberit_messenger/inc/class.ldap_im.inc.php
r563 r697 35 35 $this->jid = $_SESSION['phpgw_info']['jabberit_messenger']['user']; 36 36 $this->max_result = 50; 37 38 // Ou User39 $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=")));42 37 } 43 38 … … 85 80 86 81 @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; 87 100 } 88 101 … … 156 169 } 157 170 158 public final function list_users_ldap( $search, $uidnumber, $groupsDeny)171 public final function list_users_ldap( $search, $uidnumber, $ous = false ) 159 172 { 160 173 $this->_connect_ldap(); … … 166 179 // SERPRO 167 180 //$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); 170 184 else 171 185 $search = ldap_search($this->ldap,$this->ldap_context,$filter,$justthese, 0, $this->max_result + 1); 186 172 187 $entry1 = ldap_get_entries($this->ldap,$search); 173 $entry = ldap_first_entry( $this->ldap, $search);188 $entry = ldap_first_entry($this->ldap,$search); 174 189 } 175 190 … … 297 312 return $result_groups; 298 313 } 299 300 314 } 301 315 -
trunk/jabberit_messenger/inc/controller.xml
r563 r697 33 33 <item ref="contacts_im" alias="getParticipantsExternal" class="contacts_im" method="getParticipantsExternal" prefix="class." suffix=".inc.php"/> 34 34 <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"/> 35 36 <item ref="db_im" alias="getPreferences" class="db_im" method="getPreferences" prefix="class." suffix=".inc.php"/> 36 37 <item ref="db_im" alias="setAttributesLdap" class="db_im" method="setAttributesLdap" prefix="class." suffix=".inc.php"/> 37 38 <item ref="db_im" alias="setPreferences" class="db_im" method="setPreferences" prefix="class." suffix=".inc.php"/> 38 39 <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"/> 39 41 <item ref="db_im" alias="setOrganization" class="db_im" method="setOrganization" prefix="class." suffix=".inc.php"/> 40 42 <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"/> 41 44 <item ref="db_im" alias="removeParticipantsExternal" class="db_im" method="removeParticipantsExternal" prefix="class." suffix=".inc.php"/> 42 45 <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 176 176 $photoHeight = 90; 177 177 $newImage = imagecreatetruecolor($photoWidth,$photoHeight); 178 178 179 179 if($photo) 180 180 { 181 181 $photo = imagecreatefromstring($photo); 182 $trans = imagecolortransparent($photo);183 182 imagecopyresized($newImage,$photo,0,0,0,0,$photoWidth,$photoHeight,imagesx($photo),imagesy($photo)); 184 imagepng($newImage);185 imagedestroy($newImage);186 183 } 187 184 else 188 185 { 189 186 $photo = @imagecreatefrompng("../templates/default/images/photo.png"); 190 $trans = imagecolortransparent($photo);191 187 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)); 195 196 } 196 197 else -
trunk/jabberit_messenger/inc/hook_admin.inc.php
r563 r697 18 18 'Configuration of authentication attribute by Organization (OU)' => $GLOBALS['phpgw']->link('/index.php','menuaction=jabberit_messenger.uiconforganization.edit_conf'), 19 19 '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'), 22 22 ); 23 23 -
trunk/jabberit_messenger/inc/jabberit_acl.inc.php
r563 r697 55 55 $ExternalParticipants = implode(",", $ExternalParticipants); 56 56 } 57 57 58 58 require_once dirname(__FILE__) . '/load_lang.php'; 59 59 60 print "<script type='text/javascript'>".61 "var path_jabberit='".$webserver_url."';".62 "var externalParticipantsJabberit='".$ExternalParticipants."';". 63 60 $var_js = "var path_jabberit='".$webserver_url."';"; 61 $var_js .= "var externalParticipantsJabberit='".$ExternalParticipants."';"; 62 63 echo "<script type=\"text/javascript\">".$var_js."</script>"; 64 64 65 65 $js = array( -
trunk/jabberit_messenger/inc/login.php
r622 r697 80 80 } 81 81 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; 82 91 $template = new Template('templates/default'); 83 92 $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); 88 94 $template->set_var("value_server",$_SESSION['phpgw_info']['jabberit_messenger']['name_jabberit']); 89 95 $template->set_var("value_host",$_SESSION['phpgw_info']['jabberit_messenger']['name_jabberit']);
Note: See TracChangeset
for help on using the changeset viewer.