Changeset 519 for trunk/jabberit_messenger/inc
- Timestamp:
- 10/09/08 08:58:47 (16 years ago)
- Location:
- trunk/jabberit_messenger/inc
- Files:
-
- 1 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/jabberit_messenger/inc/class.db_im.inc.php
r417 r519 35 35 $this->db_type = $_SESSION['phpgw_info']['jabberit_messenger']['server']['db_type']; 36 36 $this->user_id = $_SESSION['phpgw_info']['jabberit_messenger']['user_id']; 37 $this->connectDB(); 37 38 } 38 39 … … 40 41 { 41 42 $this->db = new db(); 43 $this->db_name = ( !$this->db_name ) ? $_SESSION['phpgwinfo']['db_name'] : $this->db_name; 44 $this->db_host = ( !$this->db_host ) ? $_SESSION['phpgwinfo']['db_host'] : $this->db_host; 45 $this->db_port = ( !$this->db_port ) ? $_SESSION['phpgwinfo']['db_port'] : $this->db_port; 46 $this->db_user = ( !$this->db_user ) ? $_SESSION['phpgwinfo']['db_user'] : $this->db_user; 47 $this->db_pass = ( !$this->db_pass ) ? $_SESSION['phpgwinfo']['db_pass'] : $this->db_pass; 48 $this->db_type = ( !$this->db_type ) ? $_SESSION['phpgwinfo']['db_type'] : $this->db_type; 49 42 50 $this->db->connect($this->db_name,$this->db_host,$this->db_port,$this->db_user,$this->db_pass,$this->db_type); 43 51 } … … 45 53 public final function getApplicationsEnabled() 46 54 { 47 $this->connectDB();55 48 56 $this->db->query("SELECT * FROM phpgw_config WHERE config_app = 'phpgwapi' and config_name ='apps_jabberit'"); 49 57 if($this->db->num_rows()) … … 61 69 public final function getApplicationsList() 62 70 { 63 $this->connectDB();64 71 $this->db->query("SELECT * FROM phpgw_applications WHERE app_enabled = '1' order by app_name"); 65 72 if($this->db->num_rows()) … … 85 92 public final function get_accounts_acl() 86 93 { 87 $this->connectDB();88 89 94 $query = "select acl_account from phpgw_acl where acl_location in (select acl_account from phpgw_acl where acl_appname = 'jabberit_messenger') "; 90 95 $query .= "union select acl_account from phpgw_acl where acl_appname = 'jabberit_messenger'"; … … 109 114 public final function getPreferences() 110 115 { 111 $this->connectDB();112 113 116 $result = array(); 114 117 $query = "select * from phpgw_preferences where preference_owner = '".$this->user_id."' and preference_app = 'jabberit_messenger'"; … … 128 131 public final function setPreferences($pParam) 129 132 { 130 $this->connectDB();131 133 $preferences = $pParam['preferences']; 132 134 $user_id = $this->user_id; … … 151 153 public final function setApplications($pApplications) 152 154 { 153 $this->connectDB();154 155 $apps = serialize($pApplications); 155 156 … … 175 176 return false; 176 177 } 178 179 public final function setAttributesLdap($pAttributes) 180 { 181 $values = $pAttributes['conf']; 182 $attributesOrg = ""; 183 184 if( $this->db ) 185 { 186 $query = "SELECT * from phpgw_config WHERE config_app = 'phpgwapi' and config_name = 'attributes_org_ldap_jabberit'"; 187 188 if ( $this->db->query($query) ) 189 { 190 while($this->db->next_record()) 191 $result[] = $this->db->row(); 192 193 if(count($result) > 0) 194 $attributesOrg = $result[0]['config_value']; 195 } 196 197 if( trim($attributesOrg) == "" ) 198 { 199 $query = "INSERT INTO phpgw_config(config_app,config_name,config_value) VALUES('phpgwapi','attributes_org_ldap_jabberit','".$values."')"; 200 $this->db->query($query); 201 202 $attr = explode(";", $values); 203 $values = "<return><ou attr='".$attr[1]."'>".$attr[0]."</ou></return>"; 204 return $values; 205 } 206 else 207 { 208 $org = explode(",", $attributesOrg); 209 $newValue = explode(";", $values); 210 211 foreach( $org as $tmp ) 212 { 213 $attr = explode(";",$tmp); 214 if( strtolower(trim($attr[0])) == strtolower(trim($newValue[0])) ) 215 return false; 216 } 217 218 $values = $values . "," . $attributesOrg; 219 $query = "UPDATE phpgw_config SET config_value = '".$values."' WHERE config_app = 'phpgwapi' AND config_name = 'attributes_org_ldap_jabberit'"; 220 $this->db->query($query); 221 222 $return = explode(",",$values); 223 natcasesort($return); 224 225 $values = "<return>"; 226 227 foreach($return as $tmp) 228 { 229 $attr = explode(";", $tmp); 230 $values .= "<ou attr='" . $attr[1] . "'>" . $attr[0] . "</ou>"; 231 } 232 233 $values .= "</return>"; 234 235 return $values; 236 } 237 } 238 return false; 239 } 240 241 public final function removeAttributesLdap($pOrg) 242 { 243 $organization = $pOrg['org']; 244 245 if( $this->db ) 246 { 247 $query = "SELECT * from phpgw_config WHERE config_app = 'phpgwapi' and config_name = 'attributes_org_ldap_jabberit'"; 248 249 if ( $this->db->query($query) ) 250 { 251 while( $this->db->next_record() ) 252 $result[] = $this->db->row(); 253 254 if( count($result) > 0 ) 255 $attributesOrg = $result[0]['config_value']; 256 } 257 258 $attributesOrg = explode(",", $attributesOrg); 259 $newValue = ""; 260 foreach($attributesOrg as $tmp) 261 { 262 $attr = explode(";",$tmp); 263 264 if( strtolower(trim($attr[0])) != strtolower(trim($organization))) 265 { 266 $newValue .= $attr[0] . ";" . $attr[1] . ","; 267 } 268 } 269 270 $newValue = substr($newValue, 0,(strlen($newValue) -1 )); 271 272 if( trim($newValue) != "") 273 $query = "UPDATE phpgw_config SET config_value = '".$newValue."' WHERE config_app = 'phpgwapi' AND config_name = 'attributes_org_ldap_jabberit'"; 274 else 275 $query = "DELETE from phpgw_config where config_name = 'attributes_org_ldap_jabberit'"; 276 277 if( $this->db->query($query)) 278 return true; 279 else 280 return false; 281 } 282 return false; 283 } 177 284 } 178 285 ?> -
trunk/jabberit_messenger/inc/class.ldap_im.inc.php
r417 r519 49 49 { 50 50 $GLOBALS['phpgw_info']['server']['ldap_version3'] = true; 51 $this->ldap = $this->common->ldapConnect( $this->ldap_host,$this->ldap_dn,$this->ldap_pass );51 $this->ldap = $this->common->ldapConnect( $this->ldap_host,$this->ldap_dn,$this->ldap_pass, true ); 52 52 } 53 53 } … … 113 113 } 114 114 115 public final function teste()115 public final function list_organizations_ldap() 116 116 { 117 return 'dentro da classe do php'; 117 $result_org = "<organizations>"; 118 119 $this->_connect_ldap(); 120 121 if( $this->ldap ) 122 { 123 $filter="ou=*"; 124 $justthese = array("ou"); 125 $search = ldap_search($this->ldap,$this->ldap_context,$filter,$justthese); 126 $entry = ldap_get_entries($this->ldap, $search); 127 } 128 129 foreach($entry as $tmp) 130 if($tmp['ou'][0] != "") 131 $result_org .= "<ou>" . $tmp['ou'][0] . "</ou>"; 132 133 $result_org .= "</organizations>"; 134 135 return $result_org; 118 136 } 119 137 } -
trunk/jabberit_messenger/inc/controller.xml
r494 r519 32 32 <item ref="contacts_im" alias="list_contacts" class="contacts_im" method="list_contacts" prefix="class." suffix=".inc.php"/> 33 33 <item ref="db_im" alias="getPreferences" class="db_im" method="getPreferences" prefix="class." suffix=".inc.php"/> 34 <item ref="db_im" alias="setAttributesLdap" class="db_im" method="setAttributesLdap" prefix="class." suffix=".inc.php"/> 34 35 <item ref="db_im" alias="setPreferences" class="db_im" method="setPreferences" prefix="class." suffix=".inc.php"/> 36 <item ref="db_im" alias="removeAttributesLdap" class="db_im" method="removeAttributesLdap" prefix="class." suffix=".inc.php"/> 35 37 <item ref="ldap_im" alias="list_organizations_ldap" class="ldap_im" method="list_organizations_ldap" prefix="class." suffix=".inc.php"/> 36 38 <item ref="ldap_im" alias="photo_ldap" class="ldap_im" method="photo_ldap" prefix="class." suffix=".inc.php"/> -
trunk/jabberit_messenger/inc/hook_admin.inc.php
r423 r519 15 15 $file = array( 16 16 'Site Configuration' => $GLOBALS['phpgw']->link('/index.php','menuaction=admin.uiconfig.index&appname=' . $appname), 17 'Enable the Expresso Messenger inside of the modules' => $GLOBALS['phpgw']->link('/index.php','menuaction=jabberit_messenger.uimodule.edit_conf') 17 'Enable the Expresso Messenger inside of the modules' => $GLOBALS['phpgw']->link('/index.php','menuaction=jabberit_messenger.uimodule.edit_conf'), 18 'Configuration of authentication attribute by Organization (OU)' => $GLOBALS['phpgw']->link('/index.php','menuaction=jabberit_messenger.uiconforganization.edit_conf') 18 19 ); 19 20 20 21 //Do not modify below this line 21 22 display_section($appname,$title,$file); 23 22 24 ?> -
trunk/jabberit_messenger/inc/jabberit_sessions.inc.php
r512 r519 40 40 $_SESSION['phpgw_info']['jabberit_messenger']['name_company'] = $GLOBALS['phpgw_info']['server']['name_company_applet_jabberit']; 41 41 $_SESSION['phpgw_info']['jabberit_messenger']['use_attribute_jabberit'] = $GLOBALS['phpgw_info']['server']['use_attribute_jabberit']; 42 $_SESSION['phpgw_info']['jabberit_messenger']['attributes_org_ldap_jabberit'] = $GLOBALS['phpgw_info']['server']['attributes_org_ldap_jabberit']; 42 43 43 44 ?>
Note: See TracChangeset
for help on using the changeset viewer.