Changeset 551 for trunk/jabberit_messenger/inc
- Timestamp:
- 11/12/08 10:59:07 (15 years ago)
- Location:
- trunk/jabberit_messenger/inc
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/jabberit_messenger/inc/class.FileDefine.inc.php
r439 r551 14 14 { 15 15 16 final function getParams($pParam)16 public final function getParams($pParam) 17 17 { 18 18 $array_values = explode("\n", $pParam['val']); … … 68 68 fclose($handle); 69 69 } 70 71 70 } 72 71 ?> -
trunk/jabberit_messenger/inc/class.contacts_im.inc.php
r417 r551 26 26 } 27 27 28 private final function users_auth_im($pName) 29 { 30 $array_uids = $this->db->get_accounts_acl(); 31 $count = count($array_uids); 32 $uids_members = array(); 33 34 for($i = 0; $i < $count ;$i+=50) 35 { 36 $partial_uids = array_slice($array_uids,$i,50); 37 $filter_uid = implode(")(uidnumber=",$partial_uids); 38 $filter_uid = "(uidnumber=". $filter_uid. ")"; 39 $result = $this->ldap->list_users_ldap("cn=*".$pName."*", $filter_uid); 40 if ( is_array($result) ) 41 $uids_members = array_merge($uids_members,$result); 42 43 if(count($uids_members) > 50){ 44 unset($_SESSION['phpgw_info']['jabberit_messenger']['photo']); 45 return 'Many Results'; 46 } 47 } 48 if(count($uids_members) > 0) 49 return $uids_members; 50 else 51 return 0; 28 public final function getParticipantsExternal() 29 { 30 return $_SESSION['phpgw_info']['jabberit_messenger']['use_external_participants_jabberit']; 52 31 } 53 32 54 33 public final function list_contacts($param) 55 34 { … … 82 61 return $return; 83 62 } 63 64 private final function users_auth_im($pName) 65 { 66 $array_uids = $this->db->get_accounts_acl(); 67 $count = count($array_uids); 68 $uids_members = array(); 69 70 for($i = 0; $i < $count ;$i+=50) 71 { 72 $partial_uids = array_slice($array_uids,$i,50); 73 $filter_uid = implode(")(uidnumber=",$partial_uids); 74 $filter_uid = "(uidnumber=". $filter_uid. ")"; 75 $result = $this->ldap->list_users_ldap("cn=*".$pName."*", $filter_uid); 76 if ( is_array($result) ) 77 $uids_members = array_merge($uids_members,$result); 78 79 if(count($uids_members) > 50){ 80 unset($_SESSION['phpgw_info']['jabberit_messenger']['photo']); 81 return 'Many Results'; 82 } 83 } 84 if(count($uids_members) > 0) 85 return $uids_members; 86 else 87 return 0; 88 } 89 90 84 91 } 85 92 ?> -
trunk/jabberit_messenger/inc/class.ldap_im.inc.php
r526 r551 53 53 } 54 54 55 private final function _ldapConnect($refer = false) 56 { 57 function ldapRebindJabberit($ldap_connection, $ldap_url) 58 { 59 $acc = $_SESSION['phpgw_info']['jabberit_messenger']['ldapManager']['acc']; 60 $pw = $_SESSION['phpgw_info']['jabberit_messenger']['ldapManager']['pw']; 61 62 @ldap_bind($ldap_connection, $acc,$pw); 63 } 64 65 // Using ContactCenter configuration. 66 $this->ldap_host = $_SESSION['phpgw_info']['jabberit_messenger']['ldapManager']['host']; 67 $this->ldap_context = $_SESSION['phpgw_info']['jabberit_messenger']['ldapManager']['dn']; 68 $this->ldap_dn = $_SESSION['phpgw_info']['jabberit_messenger']['ldapManager']['acc']; 69 $this->ldap_pass = $_SESSION['phpgw_info']['jabberit_messenger']['ldapManager']['pw']; 70 71 $this->ldap = ldap_connect($this->ldap_host); 72 ldap_set_option($this->ldap, LDAP_OPT_PROTOCOL_VERSION, 3); 73 ldap_set_option($this->ldap, LDAP_OPT_REFERRALS, $refer); 74 75 if ($refer) 76 { 77 ldap_set_rebind_proc($this->ldap, ldapRebindJabberit); 78 } 79 80 @ldap_bind($this->ldap,$this->ldap_dn,$this->ldap_pass); 81 } 82 83 public final function list_participants_externals($pSearch) 84 { 85 $this->_ldapConnect(true); 86 87 $mail = $pSearch['mail']; 88 89 if( $this->ldap ) 90 { 91 $filter = "(&(phpgwaccounttype=u)(mail=".$mail."))"; 92 $justthese = array("uid","uidNumber","cn","mail","phpgwAccountVisible","dn","jpegPhoto"); 93 $search = ldap_search($this->ldap,$this->ldap_context,$filter,$justthese, 0, $this->max_result + 1); 94 $entry1 = ldap_get_entries($this->ldap,$search); 95 $entry = ldap_first_entry( $this->ldap, $search ); 96 } 97 98 if( $entry1['count'] > 0 ) 99 { 100 $i = 0; 101 $result_user = array(); 102 $result = array(); 103 104 while($entry) 105 { 106 107 if ( $entry1[$i]['phpgwaccountvisible'][0] != '-1' ) 108 { 109 $result['uidnumber'] = @ldap_get_values($this->ldap, $entry, 'uidnumber'); 110 $result['mail'] = @ldap_get_values($this->ldap, $entry, 'mail'); 111 $result['uid'] = @ldap_get_values($this->ldap, $entry, 'uid'); 112 $result['cn'] = @ldap_get_values($this->ldap, $entry, 'cn'); 113 114 foreach ( $result as $key => $value ) 115 $result_user[$i][$key] = $value[0]; 116 117 $ou = explode('dc=', $entry1[$i]['dn']); 118 $ou = explode("ou=",$ou[0]); 119 $ou = array_pop($ou); 120 $result_user[$i]['dn'] = strtoupper(substr($ou,0,strlen($ou)-1)); 121 122 $result_user[$i]['photo'] = 0; 123 124 $photo = @ldap_get_values_len($this->ldap, $entry, 'jpegphoto'); 125 126 if ( $photo ) 127 { 128 $result_user[$i]['photo'] = 1; 129 $_SESSION['phpgw_info']['jabberit_messenger']['photo'][trim($result_user[$i]['uid'])] = $photo[0]; 130 } 131 132 $i++; 133 } 134 $entry = ldap_next_entry($this->ldap,$entry); 135 } 136 137 $return = "<uids>"; 138 $return .= "<".$result_user[0]['dn']."><data>"; 139 $return .= "<cn>".$result_user[0]['cn']."</cn>"; 140 $return .= "<mail>".$result_user[0]['mail']."</mail>"; 141 $return .= "<uid>".$result_user[0]['uid']."</uid>"; 142 $return .= "<photo>".$result_user[0]['photo']."</photo>"; 143 $return .= "</data></".$result_user[0]['dn'].">"; 144 $return .= "</uids>"; 145 146 return $return; 147 } 148 149 return '<empty/>'; 150 } 151 55 152 public final function list_users_ldap($search, $uidnumber) 56 153 { -
trunk/jabberit_messenger/inc/controller.xml
r519 r551 30 30 </js> 31 31 <php path="/var/www/expresso/jabberit_messenger/inc" suffix=".class.php"> 32 <item ref="contacts_im" alias="getParticipantsExternal" class="contacts_im" method="getParticipantsExternal" prefix="class." suffix=".inc.php"/> 32 33 <item ref="contacts_im" alias="list_contacts" class="contacts_im" method="list_contacts" prefix="class." suffix=".inc.php"/> 33 34 <item ref="db_im" alias="getPreferences" class="db_im" method="getPreferences" prefix="class." suffix=".inc.php"/> … … 36 37 <item ref="db_im" alias="removeAttributesLdap" class="db_im" method="removeAttributesLdap" prefix="class." suffix=".inc.php"/> 37 38 <item ref="ldap_im" alias="list_organizations_ldap" class="ldap_im" method="list_organizations_ldap" prefix="class." suffix=".inc.php"/> 39 <item ref="ldap_im" alias="list_participants_externals" class="ldap_im" method="list_participants_externals" prefix="class." suffix=".inc.php"/> 38 40 <item ref="ldap_im" alias="photo_ldap" class="ldap_im" method="photo_ldap" prefix="class." suffix=".inc.php"/> 39 41 <item ref="ujabber" alias="AddNewContact" class="ujabber" method="AddNewContact" prefix="class." suffix=".inc.php"/> -
trunk/jabberit_messenger/inc/getphoto.php
r494 r551 10 10 * option) any later version. * 11 11 \***************************************************************************/ 12 13 function ldap_rebind($ldap_connection, $ldap_url){ 14 include('conf_Ldap_Photos.php'); 15 $handle = unserialize(base64_decode($CONF_SERVER)); 16 @ldap_bind($ldap_connection, $handle['dn'],$handle['passwd']); 17 } 12 18 13 19 class ldapPhoto … … 28 34 { 29 35 require_once('conf_Ldap_Photos.php'); 30 $ this->handle = unserialize(base64_decode($CONF_SERVER));31 32 $this->host = $ this->handle['host'];33 $this->context = $ this->handle['context'];34 $this->dn = $ this->handle['dn'];35 $this->passwd = $ this->handle['passwd'];36 37 $this->refer = false;36 $handle = unserialize(base64_decode($CONF_SERVER)); 37 38 $this->host = $handle['host']; 39 $this->context = $handle['context']; 40 $this->dn = $handle['dn']; 41 $this->passwd = $handle['passwd']; 42 43 $this->refer = true; 38 44 $this->version3 = true; 39 45 } 40 46 41 private final function ldap_rebind($ldap_connection, $ldap_url)42 {43 @ldap_bind($ldap_connection, $this->user_referral, $this->password_referral);44 }45 47 46 48 private final function ldapConnect() … … 57 59 return False; 58 60 } 61 59 62 if( $this->version3 ) 60 63 { … … 63 66 } 64 67 ldap_set_option($this->conn, LDAP_OPT_REFERRALS, $this->refer); 68 65 69 // verifica refer 66 70 if( $this->refer ) 67 71 { 68 $this->user_referral = $this->dn; 69 $this->password_referral = $this->passwd; 70 @ldap_set_rebind_proc($this->conn, $this->ldap_rebind); 72 @ldap_set_rebind_proc($this->conn, ldap_rebind); 71 73 } 72 74 … … 76 78 return False; 77 79 } 80 78 81 // bind as anonymous 79 82 if(!$this->dn && !$this->passwd && !@ldap_bind($this->conn)) … … 84 87 } 85 88 89 public final function getNameOrganization($pUid, $pCharset) 90 { 91 $this->ldapConnect(); 92 93 if( $this->conn ) 94 { 95 $filter = "(&(phpgwaccounttype=u)(uid=".$pUid.")(!(phpgwaccountvisible=-1)))"; 96 $justthese = array("uid","cn","dn"); 97 $search = ldap_search($this->conn,$this->context,$filter,$justthese); 98 $entry = ldap_get_entries($this->conn,$search); 99 $cn = $entry[0]['cn'][0]; 100 $ou = explode("dc=", $entry[0]['dn']); 101 $ou = explode("ou=",$ou[0]); 102 $ou = array_pop($ou); 103 $dn = strtoupper(substr($ou,0,strlen($ou)-1)); 104 105 $return = utf8_encode("Nome : " . $cn . ";Organização : " . $dn); 106 107 if( $pCharset === "1" ) 108 return $return; 109 else 110 return mb_convert_encoding($return, "ISO-8859-1", "UTF-8"); 111 112 $return = utf8_encode("Nome : Não Identificado ;Organização : Não Identificado"); 113 114 if( $pCharset === 1 ) 115 return $return; 116 else 117 return mb_convert_encoding($return, "ISO-8859-1", "UTF-8"); 118 } 119 } 120 86 121 public final function getPhotoLdap($uid) 87 122 { … … 89 124 if( $this->conn ) 90 125 { 91 $filter = "(&(phpgwaccounttype=u)(uid=".$uid.") )";92 $justthese = array("uid"," phpgwAccountVisible","jpegPhoto");126 $filter = "(&(phpgwaccounttype=u)(uid=".$uid.")(!(phpgwaccountvisible=-1)))"; 127 $justthese = array("uid","jpegPhoto"); 93 128 $search = ldap_search($this->conn,$this->context,$filter,$justthese); 94 129 $entry1 = ldap_get_entries($this->conn,$search); 95 130 $entry = ldap_first_entry( $this->conn, $search ); 96 97 131 if( $entry1['count'] > 0 ) 98 132 { … … 100 134 $photo = ""; 101 135 $return_photo = ""; 102 103 104 if ( $entry1[$i]['phpgwaccountvisible'][0] != '-1' ) 105 { 106 $photo = @ldap_get_values_len($this->conn, $entry, 'jpegphoto'); 107 108 if ( $photo ) 109 $return_photo = $photo[0]; 110 } 136 $photo = @ldap_get_values_len($this->conn, $entry, 'jpegphoto'); 137 if ($photo) 138 $return_photo = $photo[0]; 111 139 return $return_photo; 112 140 } … … 172 200 } 173 201 202 if(trim($_POST['jid']) != "") 203 { 204 $jid = trim($_POST['jid']); 205 if( strpos($jid,"@")) 206 $jid = substr($jid, 0, strpos($jid,"@")); 207 $charset = trim($_POST['charset']); 208 $a = new ldapPhoto(); 209 210 printf("%s",$a->getNameOrganization($jid, $charset)); 211 } 174 212 ?> -
trunk/jabberit_messenger/inc/jabberit_acl.inc.php
r494 r551 31 31 { 32 32 33 $ldapManager = CreateObject('contactcenter.bo_ldap_manager'); 34 $_SESSION['phpgw_info']['jabberit_messenger']['ldapManager'] = $ldapManager->srcs[1]; 35 33 36 $webserver_url = $GLOBALS['phpgw_info']['server']['webserver_url']; 34 37 $webserver_url = ( !empty($webserver_url) ) ? $webserver_url : '/'; -
trunk/jabberit_messenger/inc/jabberit_sessions.inc.php
r526 r551 16 16 $_SESSION['phpgw_info']['jabberit_messenger']['passwd'] = $GLOBALS['phpgw_info']['user']['passwd']; 17 17 $_SESSION['phpgw_info']['jabberit_messenger']['mail'] = $GLOBALS['phpgw_info']['user']['email']; 18 $_SESSION['phpgw_info']['jabberit_messenger']['fullname'] = $GLOBALS['phpgw_info']['user']['fullname']; 19 20 //Server http or https 21 $_SESSION['phpgw_info']['jabberit_messenger']['use_https'] = $GLOBALS['phpgw_info']['server']['use_https']; 18 22 19 23 //Organization Ldap 20 24 $_SESSION['phpgw_info']['jabberit_messenger']['account_dn'] = $GLOBALS['phpgw_info']['user']['account_dn']; 21 22 25 23 26 //Ldap … … 45 48 $_SESSION['phpgw_info']['jabberit_messenger']['use_attribute_jabberit'] = $GLOBALS['phpgw_info']['server']['use_attribute_jabberit']; 46 49 $_SESSION['phpgw_info']['jabberit_messenger']['attributes_org_ldap_jabberit'] = $GLOBALS['phpgw_info']['server']['attributes_org_ldap_jabberit']; 47 50 $_SESSION['phpgw_info']['jabberit_messenger']['use_external_participants_jabberit'] = $GLOBALS['phpgw_info']['server']['use_external_participants_jabberit']; 51 48 52 ?> -
trunk/jabberit_messenger/inc/login.php
r526 r551 16 16 if(isset($_SESSION['phpgw_info']['jabberit_messenger']['name_jabberit'])) 17 17 { 18 // Path Server 18 19 $path = $_SESSION['phpgw_info']['jabberit_messenger']['webserver_url']; 19 20 $SERVER_EXPRESSO = $_SERVER['HTTP_HOST'] . $path; 21 22 // Type Protocol http / https 23 $protocol = trim("http"); 24 if( $_SESSION['phpgw_info']['jabberit_messenger']['use_https'] === 2 ) 25 $protocol = trim("https"); 20 26 27 // Uid user 21 28 $uid = $_SESSION['phpgw_info']['jabberit_messenger']['user']; 22 29 … … 26 33 $organization_user = substr($organization_user, strpos($organization_user,"ou=") + 3 , strlen($organization_user)); 27 34 $organization_user = substr($organization_user, 0, strpos($organization_user, ",")); 35 36 // FirstName 37 $CnName = explode(" ",$_SESSION['phpgw_info']['jabberit_messenger']['fullname']); 28 38 29 39 if(is_array($organization)) … … 68 78 $template->set_var("value_userproxy",$_SESSION['phpgw_info']['jabberit_messenger']['use_proxy_java']); 69 79 $template->set_var("value_expresso",$SERVER_EXPRESSO); 80 $template->set_var("value_use_https", $protocol); 70 81 $template->set_var("value_company", $_SESSION['phpgw_info']['jabberit_messenger']['name_company']); 82 $template->set_var("value_cnname",$CnName[0]); 71 83 $template->set_file(Array('jabberit_messenger' => 'jabberIM.tpl')); 72 84 $template->set_block('jabberit_messenger','index');
Note: See TracChangeset
for help on using the changeset viewer.