Changeset 1502 for trunk/jabberit_messenger/inc/webservice.php
- Timestamp:
- 10/08/09 12:06:41 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/jabberit_messenger/inc/webservice.php
r1214 r1502 31 31 $handle = unserialize(base64_decode($LDAP_INTERNAL)); 32 32 33 $this->jabberName = $handle['jabberName'];34 $this->serverLdap = $handle['serverLdap'];33 $this->jabberName = $handle['jabberName']; 34 $this->serverLdap = $handle['serverLdap']; 35 35 $this->contextLdap = $handle['contextLdap']; 36 36 $this->userLDAP = $handle['user']; 37 $this->passwd = $handle['password'];37 $this->passwd = $handle['password']; 38 38 39 39 $this->refer = true; … … 170 170 171 171 if( $this->jabberName == (substr($pJid, strpos($pJid, "@") + 1 ))) 172 {173 172 $this->ldapConnect(); 174 175 if( $this->fileLdapInternal ) 176 { 177 if( $this->conn ) 178 { 173 else 174 $this->ldapConnectExternal(substr($pJid, strpos($pJid, "@") + 1 )); 175 176 if( $this->conn ) 177 { 178 // Verificando atributo que a organização utiliza para autenticar no servidor jabber 179 switch ($_SESSION['phpgw_info']['jabberit_messenger']['user_org_att']) 180 { 181 case 'description': 182 $filter = "(&(phpgwaccounttype=u)(description=".$uid.")(!(phpgwaccountvisible=-1)))"; 183 break; 184 case 'uid': 179 185 $filter = "(&(phpgwaccounttype=u)(uid=".$uid.")(!(phpgwaccountvisible=-1)))"; 180 $justthese = array("uid","cn","dn"); 181 $search = ldap_search( $this->conn, $this->contextLdap, $filter,$justthese); 182 $get_entries = ldap_get_entries( $this->conn, $search); 183 184 if( $get_entries['count'] > 0 ) 185 { 186 $cn = $get_entries[0]['cn'][0]; 187 $ou = explode("dc=", $get_entries[0]['dn']); 188 $ou = explode("ou=",$ou[0]); 189 $ou = array_pop($ou); 190 $dn = strtoupper(substr($ou,0,strlen($ou)-1)); 191 $return = utf8_encode("Nome : " . $cn . ";Organização : " . $dn); 192 } 193 } 194 } 195 } 196 else 197 { 198 $this->ldapConnectExternal(substr($pJid, strpos($pJid, "@") + 1 )); 199 200 if( $this->fileLdapExternal ) 201 { 202 if( $this->conn ) 203 { 186 break; 187 case 'mail': 204 188 $filter = "(&(phpgwaccounttype=u)(uid=".$uid.")(!(phpgwaccountvisible=-1)))"; 205 $justthese = array("uid","cn","dn"); 206 $search = ldap_search( $this->conn, $this->contextLdap, $filter, $justthese); 207 $get_entries = ldap_get_entries( $this->conn, $search); 189 break; 190 } 191 192 $justthese = array("uid","cn","dn"); 193 $search = ldap_search( $this->conn, $this->contextLdap, $filter, $justthese); 194 $get_entries = ldap_get_entries( $this->conn, $search); 208 195 209 if( $get_entries['count'] > 0 ) 210 { 211 $cn = $get_entries[0]['cn'][0]; 212 $ou = explode("dc=", $get_entries[0]['dn']); 213 $ou = explode("ou=",$ou[0]); 214 $ou = array_pop($ou); 215 $dn = strtoupper(substr($ou,0,strlen($ou)-1)); 216 $return = utf8_encode("Nome : " . $cn . ";Organização : " . $dn); 217 } 218 } 196 if( $get_entries['count'] > 0 ) 197 { 198 $cn = $get_entries[0]['cn'][0]; 199 $ou = explode("dc=", $get_entries[0]['dn']); 200 $ou = explode("ou=",$ou[0]); 201 $ou = array_pop($ou); 202 $dn = strtoupper(substr($ou,0,strlen($ou)-1)); 203 $return = utf8_encode("Nome : " . $cn . ";Organização : " . $dn); 219 204 } 220 205 } … … 239 224 240 225 $this->ldapConnect(); 241 242 if( $this->conn )243 {244 $filter = "(&(phpgwaccounttype=u)(uid=".$uid.")(!(phpgwaccountvisible=-1)))";245 $justthese = array("uid","jpegPhoto");246 $search = ldap_search($this->conn,$this->contextLdap,$filter,$justthese);247 $get_entries = ldap_get_entries($this->conn,$search);248 249 if( $get_entries['count'] > 0 )250 {251 $first_entry = ldap_first_entry( $this->conn, $search );252 $photo = @ldap_get_values_len($this->conn, $first_entry, 'jpegphoto');253 254 if ( $photo )255 return $photo[0];256 257 return false;258 }259 }260 226 } 261 227 } … … 271 237 if( !$this->fileLdapExternal ) 272 238 return false; 273 274 if( $this->conn ) 275 { 276 $filter = "(&(phpgwaccounttype=u)(uid=".$uid.")(!(phpgwaccountvisible=-1)))"; 277 $justthese = array("uid","jpegPhoto"); 278 $search = ldap_search($this->conn,$this->contextLdap,$filter,$justthese); 279 $get_entries = ldap_get_entries($this->conn,$search); 239 } 240 241 if( $this->conn ) 242 { 243 // Verificando atributo que a organização utiliza para autenticar no servidor jabber 244 switch ($_SESSION['phpgw_info']['jabberit_messenger']['user_org_att']) 245 { 246 case 'description': 247 $filter = "(&(phpgwaccounttype=u)(description=".$uid.")(!(phpgwaccountvisible=-1)))"; 248 $justthese = array("description","jpegPhoto"); 249 break; 250 case 'uid': 251 $filter = "(&(phpgwaccounttype=u)(uid=".$uid.")(!(phpgwaccountvisible=-1)))"; 252 $justthese = array("uid","jpegPhoto"); 253 break; 254 case 'mail': 255 $filter = "(&(phpgwaccounttype=u)(uid=".$uid.")(!(phpgwaccountvisible=-1)))"; 256 $justthese = array("uid","jpegPhoto"); 257 break; 258 } 259 260 $search = ldap_search($this->conn,$this->contextLdap,$filter,$justthese); 261 $get_entries = ldap_get_entries($this->conn,$search); 280 262 281 if( $get_entries['count'] > 0 ) 282 { 283 $first_entry = ldap_first_entry( $this->conn, $search ); 284 $photo = @ldap_get_values_len($this->conn, $first_entry, 'jpegphoto'); 285 286 if ( $photo ) 287 return $photo[0]; 288 289 return false; 290 } 263 if( $get_entries['count'] > 0 ) 264 { 265 $first_entry = ldap_first_entry( $this->conn, $search ); 266 $photo = @ldap_get_values_len($this->conn, $first_entry, 'jpegphoto'); 267 268 if ( $photo ) 269 return $photo[0]; 270 271 return false; 291 272 } 292 273 }
Note: See TracChangeset
for help on using the changeset viewer.