Changeset 1198 for branches/2.0/jabberit_messenger/inc
- Timestamp:
- 07/27/09 14:04:22 (15 years ago)
- Location:
- branches/2.0/jabberit_messenger/inc
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2.0/jabberit_messenger/inc/class.contacts_im.inc.php
r991 r1198 34 34 // Server Name Jabber 35 35 $this->serverJabber = $_SESSION['phpgw_info']['jabberit_messenger']['name_jabberit']; 36 36 37 } 37 38 … … 69 70 // Hosts Jabber 70 71 $hostsJabber = unserialize($_SESSION['phpgw_info']['jabberit_messenger']['map_org_realm_jabberit']); 71 72 72 73 if( is_array($users) ) 73 74 { … … 78 79 foreach($hostsJabber as $itens) 79 80 { 80 if( trim($users[$i]['ou']) === trim($itens['org']) && strpos($users[$i]['jid'],"@") === false) 81 $users[$i]['jid'] = $users[$i]['jid']."@".$itens['jabberName']; 82 else 81 if( trim($users[$i]['ou']) === trim($itens['org']) && strpos($users[$i]['jid'],"@") === false ) 83 82 { 84 if(strpos($users[$i]['jid'],"@") === false) 85 $users[$i]['jid'] = $users[$i]['jid']."@".$this->serverJabber; 83 $users[$i]['jid'] = $users[$i]['jid']."@".$itens['jabberName']; 86 84 } 87 85 } 86 } 87 88 if( strpos($users[$i]['jid'],"@") === false ) 89 { 90 $users[$i]['jid'] = $users[$i]['jid']."@".$this->serverJabber; 88 91 } 89 92 } … … 139 142 $result[] = $this->ldap->getUsersLdapRoot("cn=*".$pName."*", $filter_uid); 140 143 } 141 if(!$this->groupsLocked()) 144 145 if( !$this->groupsLocked() ) 142 146 $result[] = $this->ldap->getUsersLdapCatalog("cn=*".$pName."*"); 143 147 -
branches/2.0/jabberit_messenger/inc/class.ldap_im.inc.php
r988 r1198 22 22 private $ldap; 23 23 private $ldap_context; 24 private $ldap_ dn;24 private $ldap_user; 25 25 private $ldap_host; 26 26 private $ldap_org; … … 52 52 $GLOBALS['phpgw_info']['server']['ldap_version3'] = true; 53 53 54 $this->ldap = $this->common->ldapConnect( $this->ldap_host, $this->ldap_ dn, $this->ldap_pass, false );54 $this->ldap = $this->common->ldapConnect( $this->ldap_host, $this->ldap_user . "," . $this->ldap_context , $this->ldap_pass, false ); 55 55 } 56 56 … … 59 59 $this->ldap_host = (isset($_SESSION['phpgw_info']['jabberit_messenger']['server_ldap_jabberit'])) ? $_SESSION['phpgw_info']['jabberit_messenger']['server_ldap_jabberit'] : $GLOBALS['phpgw_info']['server']['ldap_host']; 60 60 $this->ldap_context = (isset($_SESSION['phpgw_info']['jabberit_messenger']['context_ldap_jabberit'])) ? $_SESSION['phpgw_info']['jabberit_messenger']['context_ldap_jabberit'] : $GLOBALS['phpgw_info']['server']['ldap_context']; 61 $this->ldap_ dn= (isset($_SESSION['phpgw_info']['jabberit_messenger']['user_ldap_jabberit'])) ? $_SESSION['phpgw_info']['jabberit_messenger']['user_ldap_jabberit'] : $GLOBALS['phpgw_info']['server']['ldap_root_dn'];61 $this->ldap_user = (isset($_SESSION['phpgw_info']['jabberit_messenger']['user_ldap_jabberit'])) ? $_SESSION['phpgw_info']['jabberit_messenger']['user_ldap_jabberit'] : $GLOBALS['phpgw_info']['server']['ldap_root_dn']; 62 62 $this->ldap_pass = (isset($_SESSION['phpgw_info']['jabberit_messenger']['password_ldap_jabberit'])) ? $_SESSION['phpgw_info']['jabberit_messenger']['password_ldap_jabberit'] : $GLOBALS['phpgw_info']['server']['ldap_root_pw']; 63 63 … … 83 83 84 84 // Bind as Admin 85 if($this->ldap_ dn && $this->ldap_pass && !ldap_bind($conn, $this->ldap_dn, $this->ldap_pass))85 if($this->ldap_user && $this->ldap_pass && !ldap_bind($conn, $this->ldap_user . "," .$this->ldap_context, $this->ldap_pass)) 86 86 return false; 87 87 88 88 // Bind as Anonymous 89 if(!$this->ldap_ dn&& !$this->ldap_pass && !@ldap_bind($conn))90 return false; 91 89 if(!$this->ldap_user && !$this->ldap_pass && !@ldap_bind($conn)) 90 return false; 91 92 92 return $conn; 93 93 } … … 96 96 { 97 97 $this->ldapRoot(); 98 99 if( $this->ldap ) 98 $result_groups = ""; 99 100 if( $this->ldap && $pOrg['ou'] != "-1") 100 101 { 101 102 $organization = 'ou=' . $pOrg['ou'] .",". $this->ldap_context; … … 114 115 $result_groups .= "</ldap>"; 115 116 } 116 } 117 117 118 return $result_groups; 119 } 120 118 121 return $result_groups; 119 122 } … … 140 143 { 141 144 $this->ldapRoot(); 142 145 143 146 if( $this->ldap ) 144 147 { … … 168 171 $this->ldap_host = $confHosts[$i]['serverLdap']; 169 172 $this->ldap_context = $confHosts[$i]['contextLdap']; 170 $this->ldap_ dn= $confHosts[$i]['user'];173 $this->ldap_user = $confHosts[$i]['user']; 171 174 $this->ldap_org = $confHosts[$i]['org']; 172 175 $this->ldap_pass = $confHosts[$i]['password']; … … 179 182 $justthese = array("uid","uidNumber","cn","mail","phpgwAccountVisible","dn","jpegPhoto"); 180 183 $searchRoot = ( $this->ldap_org != "*" ) ? "ou=".$this->ldap_org.",".$this->ldap_context : $this->ldap_context; 184 181 185 $search1 = @ldap_search($conn, $searchRoot, $filter, $justthese, 0, $this->max_result + 1); 182 186 $entry1 = @ldap_get_entries( $conn, $search1 ); 183 187 $result = $this->resultArray($entry1, $conn ); 184 188 185 189 if( count($return) > 0 ) 186 190 $return = array_merge($return, $result); -
branches/2.0/jabberit_messenger/inc/webservice.php
r1139 r1198 15 15 private $conn; 16 16 private $contextLdap; 17 private $user Dn;17 private $userLDAP; 18 18 private $jabberName = null; 19 19 private $passwd; … … 21 21 private $refer; 22 22 private $serverLdap; 23 private $fileLdapInternal = false; 24 private $fileLdapExternal = false; 23 25 24 26 function __construct() … … 32 34 $this->serverLdap = $handle['serverLdap']; 33 35 $this->contextLdap = $handle['contextLdap']; 34 $this->user Dn= $handle['user'];36 $this->userLDAP = $handle['user']; 35 37 $this->passwd = $handle['password']; 36 38 37 39 $this->refer = true; 38 40 $this->version3 = true; 41 42 $this->fileLdapInternal = true; 39 43 } 40 44 } … … 55 59 56 60 // Bind as Admin 57 if( $this->userDn && $this->passwd && !ldap_bind($this->conn, $this->userDn, $this->passwd))61 if( $this->userLDAP && $this->passwd && !ldap_bind($this->conn, $this->userLDAP . "," . $this->contextLdap, $this->passwd) ) 58 62 return False; 59 63 60 64 // Bind as Anonymous 61 if( !$this->userDn && !$this->passwd && !@ldap_bind($this->conn))65 if( !$this->userLDAP && !$this->passwd && !@ldap_bind($this->conn) ) 62 66 return False; 63 67 } … … 65 69 private final function ldapConnectExternal($pHostJabber) 66 70 { 67 require_once('confLDAPExternal.php'); 68 $handle = unserialize(base64_decode($LDAP_EXTERNAL)); 69 70 foreach($handle as $itens) 71 if(trim($pHostJabber) == $itens['jabberName']) 72 { 73 $this->jabberName = $itens['jabberName']; 74 $this->serverLdap = $itens['serverLdap']; 75 $this->contextLdap = $itens['contextLdap']; 76 $this->userDn = $itens['user']; 77 $this->passwd = $itens['password']; 78 } 79 80 $this->refer = true; 81 $this->version3 = true; 82 83 $this->ldapConnect(); 71 if( file_exists('confLDAPExternal.php')) 72 { 73 require_once('confLDAPExternal.php'); 74 $handle = unserialize(base64_decode($LDAP_EXTERNAL)); 75 76 foreach($handle as $itens) 77 if(trim($pHostJabber) == $itens['jabberName']) 78 { 79 $this->jabberName = $itens['jabberName']; 80 $this->serverLdap = $itens['serverLdap']; 81 $this->contextLdap = $itens['contextLdap']; 82 $this->userLDAP = $itens['user']; 83 $this->passwd = $itens['password']; 84 } 85 86 $this->refer = true; 87 $this->version3 = true; 88 89 $this->ldapConnect(); 90 91 $this->fileLdapExternal = true; 92 } 84 93 } 85 94 … … 161 170 { 162 171 $uid = substr($pJid, 0, strpos($pJid,"@")); 172 $return = utf8_encode("Nome : Não Identificado ;Organização : Não Identificado"); 163 173 164 174 if( $this->jabberName == (substr($pJid, strpos($pJid, "@") + 1 ))) 165 175 { 166 176 $this->ldapConnect(); 167 168 if( $this->conn ) 169 { 170 $filter = "(&(phpgwaccounttype=u)(uid=".$uid.")(!(phpgwaccountvisible=-1)))"; 171 $justthese = array("uid","cn","dn"); 172 $search = ldap_search($this->conn,$this->contextLdap,$filter,$justthese); 173 $entry = ldap_get_entries($this->conn,$search); 174 $cn = $entry[0]['cn'][0]; 175 $ou = explode("dc=", $entry[0]['dn']); 176 $ou = explode("ou=",$ou[0]); 177 $ou = array_pop($ou); 178 $dn = strtoupper(substr($ou,0,strlen($ou)-1)); 179 180 $return = utf8_encode("Nome : " . $cn . ";Organização : " . $dn); 177 178 if( $this->fileLdapInternal ) 179 { 180 if( $this->conn ) 181 { 182 $filter = "(&(phpgwaccounttype=u)(uid=".$uid.")(!(phpgwaccountvisible=-1)))"; 183 $justthese = array("uid","cn","dn"); 184 $search = ldap_search( $this->conn, $this->contextLdap, $filter,$justthese); 185 $get_entries = ldap_get_entries( $this->conn, $search); 186 187 if( $get_entries['count'] > 0 ) 188 { 189 $cn = $get_entries[0]['cn'][0]; 190 $ou = explode("dc=", $get_entries[0]['dn']); 191 $ou = explode("ou=",$ou[0]); 192 $ou = array_pop($ou); 193 $dn = strtoupper(substr($ou,0,strlen($ou)-1)); 194 $return = utf8_encode("Nome : " . $cn . ";Organização : " . $dn); 195 } 196 } 181 197 } 182 198 } … … 184 200 { 185 201 $this->ldapConnectExternal(substr($pJid, strpos($pJid, "@") + 1 )); 186 187 if( $this->conn ) 188 { 189 $filter = "(&(phpgwaccounttype=u)(uid=".$uid.")(!(phpgwaccountvisible=-1)))"; 190 $justthese = array("uid","cn","dn"); 191 $search = ldap_search($this->conn,$this->contextLdap,$filter,$justthese); 192 $entry = ldap_get_entries($this->conn,$search); 193 $cn = $entry[0]['cn'][0]; 194 $ou = explode("dc=", $entry[0]['dn']); 195 $ou = explode("ou=",$ou[0]); 196 $ou = array_pop($ou); 197 $dn = strtoupper(substr($ou,0,strlen($ou)-1)); 198 199 $return = utf8_encode("Nome : " . $cn . ";Organização : " . $dn); 200 } 201 } 202 203 if( $pCharset === "1" ) 202 203 if( $this->fileLdapExternal ) 204 { 205 if( $this->conn ) 206 { 207 $filter = "(&(phpgwaccounttype=u)(uid=".$uid.")(!(phpgwaccountvisible=-1)))"; 208 $justthese = array("uid","cn","dn"); 209 $search = ldap_search( $this->conn, $this->contextLdap, $filter, $justthese); 210 $get_entries = ldap_get_entries( $this->conn, $search); 211 212 if( $get_entries['count'] > 0 ) 213 { 214 $cn = $get_entries[0]['cn'][0]; 215 $ou = explode("dc=", $get_entries[0]['dn']); 216 $ou = explode("ou=",$ou[0]); 217 $ou = array_pop($ou); 218 $dn = strtoupper(substr($ou,0,strlen($ou)-1)); 219 $return = utf8_encode("Nome : " . $cn . ";Organização : " . $dn); 220 } 221 } 222 } 223 } 224 225 if( $pCharset === "1" || $pCharset === 1 ) 204 226 return $return; 205 227 else 206 228 return mb_convert_encoding($return, "ISO-8859-1", "UTF-8"); 207 229 208 $return = utf8_encode("Nome : Não Identificado ;Organização : Não Identificado"); 209 210 if( $pCharset === 1 ) 211 return $return; 212 else 213 return mb_convert_encoding($return, "ISO-8859-1", "UTF-8"); 214 215 } 216 217 public final function getPhotoLdap( $pJid, $pCatalog ) 218 { 219 if ( ! $this->jabberName ) 220 return false; 221 222 $uid = substr($pJid, 0, strpos($pJid,"@")); 223 224 if( ($this->jabberName == (substr($pJid, strpos($pJid, "@") + 1 ))) && $pCatalog) 225 { 226 $this->ldapConnect(); 227 228 if( $this->conn ) 229 { 230 $filter = "(&(phpgwaccounttype=u)(uid=".$uid.")(!(phpgwaccountvisible=-1)))"; 231 $justthese = array("uid","jpegPhoto"); 230 } 231 232 public final function getPhotoLdap( $pJid , $pLdapInternal ) 233 { 234 $uid = substr($pJid, 0, strpos($pJid, "@")); 235 236 if( $pLdapInternal ) 237 { 238 if( $this->jabberName == (substr($pJid, strpos($pJid, "@") + 1 ))) 239 { 240 if( ! $this->fileLdapInternal ) 241 return false; 232 242 233 $search = ldap_search($this->conn,$this->contextLdap,$filter,$justthese); 234 $entry1 = ldap_get_entries($this->conn,$search); 235 $entry = ldap_first_entry( $this->conn, $search ); 236 if( $entry1['count'] > 0 ) 237 { 238 $i = 0; 239 $photo = ""; 240 $return_photo = ""; 241 $photo = @ldap_get_values_len($this->conn, $entry, 'jpegphoto'); 242 243 if ($photo) 244 $return_photo = $photo[0]; 245 return $return_photo; 243 $this->ldapConnect(); 244 245 if( $this->conn ) 246 { 247 $filter = "(&(phpgwaccounttype=u)(uid=".$uid.")(!(phpgwaccountvisible=-1)))"; 248 $justthese = array("uid","jpegPhoto"); 249 $search = ldap_search($this->conn,$this->contextLdap,$filter,$justthese); 250 $get_entries = ldap_get_entries($this->conn,$search); 251 252 if( $get_entries['count'] > 0 ) 253 { 254 $first_entry = ldap_first_entry( $this->conn, $search ); 255 $photo = @ldap_get_values_len($this->conn, $first_entry, 'jpegphoto'); 256 257 if ( $photo ) 258 return $photo[0]; 259 260 return false; 261 } 246 262 } 247 263 } … … 250 266 { 251 267 $jabberName = substr($pJid, strpos($pJid, "@") + 1 ); 252 268 253 269 if( strpos($jabberName, "/") ) 254 270 $jabberName = substr($jabberName, 0, strpos($jabberName, "/")); … … 256 272 $this->ldapConnectExternal($jabberName); 257 273 274 if( !$this->fileLdapExternal ) 275 return false; 276 258 277 if( $this->conn ) 259 278 { 260 $filter 261 $justthese 262 $search 263 $ entry1= ldap_get_entries($this->conn,$search);264 $entry = ldap_first_entry( $this->conn, $search );265 if( $ entry1['count'] > 0 )266 { 267 $ i = 0;268 $photo = "";269 $return_photo = "";270 $photo = @ldap_get_values_len($this->conn, $entry, 'jpegphoto');271 if ($photo)272 $return_photo = $photo[0];273 return $return_photo;279 $filter = "(&(phpgwaccounttype=u)(uid=".$uid.")(!(phpgwaccountvisible=-1)))"; 280 $justthese = array("uid","jpegPhoto"); 281 $search = ldap_search($this->conn,$this->contextLdap,$filter,$justthese); 282 $get_entries = ldap_get_entries($this->conn,$search); 283 284 if( $get_entries['count'] > 0 ) 285 { 286 $first_entry = ldap_first_entry( $this->conn, $search ); 287 $photo = @ldap_get_values_len($this->conn, $first_entry, 'jpegphoto'); 288 289 if ( $photo ) 290 return $photo[0]; 291 292 return false; 274 293 } 275 294 } 276 295 } 277 296 278 297 return false; 279 298 } … … 305 324 } 306 325 307 // Utilizando o serviço Asteriks;326 // Applet - utilizando o serviço Voip; 308 327 if(trim($_REQUEST['javaVoipFrom']) != "" && trim($_REQUEST['javaVoipTo']) != "" ) 309 328 { … … 314 333 } 315 334 316 // Fotos pelo applet;335 // Applet - fotos pelo applet; 317 336 if(trim($_REQUEST['javaPhoto']) != "" ) 318 337 { 319 338 $obj = new webService(); 320 339 $jid = $_REQUEST['javaPhoto']; 321 $jid = strpos($jid, "/") ? substr($jid, 0, strpos($jid, "/")) : $jid;322 323 $photo = $obj->getPhotoLdap( $jid, true);340 $jid = ( strpos($jid, "/") !== false ) ? substr($jid, 0, strpos($jid, "/")) : $jid; 341 342 $photo = $obj->getPhotoLdap( $jid, true ); 324 343 $photoWidth = 70; 325 344 $photoHeight = 90; … … 352 371 ob_end_clean(); 353 372 printf("%s",base64_encode($imagePhoto)); 354 355 } 356 357 // Jid pelo applet; 358 if(trim($_POST['jid']) != "") 359 { 360 $jid = trim($_ POST['jid']);361 $charset = trim($_ POST['charset']);373 } 374 375 // Applet - jid; 376 if(trim($_REQUEST['jid']) != "") 377 { 378 379 $jid = trim($_REQUEST['jid']); 380 $charset = trim($_REQUEST['charset']); 362 381 $obj = new webService(); 363 382 … … 365 384 } 366 385 367 // Fotos pelo php;386 // Php - fotos pelo php; 368 387 if(trim($_REQUEST['phpPhoto']) != "") 369 388 {
Note: See TracChangeset
for help on using the changeset viewer.