Changeset 563 for trunk/jabberit_messenger/inc
- Timestamp:
- 01/05/09 09:25:35 (15 years ago)
- Location:
- trunk/jabberit_messenger/inc
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/jabberit_messenger/inc/class.db_im.inc.php
r519 r563 126 126 } 127 127 128 return "openWindowJabberit:true ";128 return "openWindowJabberit:true;userOfflineJabberit:true"; 129 129 } 130 130 131 131 public final function setPreferences($pParam) 132 132 { 133 $preferences = $pParam['preferences']; 133 $preferences = $preferences1 = $pParam['preferences1']; 134 135 if(isset($pParam['preferences2'])) 136 { 137 $preferences2 = $pParam['preferences2']; 138 $preferences .= ";". $preferences2; 139 } 140 134 141 $user_id = $this->user_id; 135 142 … … 238 245 return false; 239 246 } 247 248 public final function setGroupsLocked($pGroups) 249 { 250 $groups = ""; 251 252 if( is_array($pGroups) ) 253 { 254 foreach($pGroups as $tmp) 255 if(trim($tmp) != "") 256 $groups .= $tmp . ";"; 257 258 $groups = substr($groups, 0, strlen($groups) - 1 ); 259 } 260 261 if( $this->db ) 262 { 263 $query = "SELECT * FROM phpgw_config WHERE config_app = 'phpgwapi' AND config_name = 'groups_locked_jabberit';"; 264 265 if($this->db->query($query)) 266 { 267 268 if ( $this->db->query($query) ) 269 { 270 while($this->db->next_record()) 271 $result[] = $this->db->row(); 272 } 273 274 if( count($result) == 0 ) 275 { 276 $query = "INSERT INTO phpgw_config(config_app,config_name,config_value) VALUES('phpgwapi','groups_locked_jabberit','".$groups."');"; 277 $this->db->query($query); 278 return true; 279 } 280 else 281 { 282 $query = "UPDATE phpgw_config SET config_value = '".trim($groups)."' WHERE config_app = 'phpgwapi' AND config_name = 'groups_locked_jabberit';"; 283 $this->db->query($query); 284 return true; 285 } 286 } 287 } 288 289 return false; 290 } 291 292 public final function setUseParticipantsExternal($pFlag) 293 { 294 $flag = $pFlag['value']; 295 $return = ""; 296 297 if( $this->db ) 298 { 299 $query = "SELECT * FROM phpgw_config WHERE config_app = 'phpgwapi' AND config_name = 'use_external_participants_jabberit';"; 300 301 if ( $this->db->query($query) ) 302 { 303 while($this->db->next_record()) 304 $result[] = $this->db->row(); 305 } 306 307 if(count($result) == 0) 308 { 309 $query = "INSERT INTO phpgw_config(config_app,config_name,config_value) VALUES('phpgwapi','use_external_participants_jabberit','".$flag."')"; 310 $this->db->query($query); 311 return true; 312 } 313 else 314 { 315 $query = "UPDATE phpgw_config SET config_value = '".$flag."' WHERE config_app = 'phpgwapi' AND config_name = 'use_external_participants_jabberit'"; 316 $this->db->query($query); 317 return true; 318 } 319 } 320 return false; 321 } 322 323 public final function setOrganization($pOrganization) 324 { 325 $organization = $pOrganization['organization']; 326 $orgConfiguration = ""; 327 328 if( $this->db ) 329 { 330 $query = "SELECT * from phpgw_config WHERE config_app = 'phpgwapi' and config_name = 'conf_organization_jabberit'"; 331 332 if ( $this->db->query($query) ) 333 { 334 while($this->db->next_record()) 335 $result[] = $this->db->row(); 336 337 if(count($result) > 0) 338 $orgConfiguration = $result[0]['config_value']; 339 } 340 341 if( trim($orgConfiguration) == "" ) 342 { 343 $query = "INSERT INTO phpgw_config(config_app,config_name,config_value) VALUES('phpgwapi','conf_organization_jabberit','".$organization."')"; 344 $this->db->query($query); 345 346 return "<return><ou attr='".$organization."'>".$organization."</ou></return>"; 347 } 348 else 349 { 350 $orgAux = explode(",",$orgConfiguration); 351 352 foreach( $orgAux as $tmp ) 353 { 354 if(strtolower(trim($tmp)) === strtolower(trim($organization))) 355 return false; 356 } 357 358 $value = $orgConfiguration . "," . $organization; 359 $query = "UPDATE phpgw_config SET config_value = '".$value."' WHERE config_app = 'phpgwapi' AND config_name = 'conf_organization_jabberit'"; 360 $this->db->query($query); 361 362 $return = explode(",",$value); 363 natcasesort($return); 364 365 $values = "<return>"; 366 367 foreach($return as $tmp) 368 $values .= "<ou attr='" . $tmp . "'>" . $tmp . "</ou>"; 369 370 $values .= "</return>"; 371 372 return $values; 373 } 374 } 375 return false; 376 } 240 377 241 378 public final function removeAttributesLdap($pOrg) … … 282 419 return false; 283 420 } 421 422 public final function removeParticipantsExternal($pOrganization) 423 { 424 425 $organization = $pOrganization['participants']; 426 427 if( $this->db ) 428 { 429 $query = "SELECT * from phpgw_config WHERE config_app = 'phpgwapi' and config_name = 'conf_organization_jabberit'"; 430 431 if ( $this->db->query($query) ) 432 { 433 while( $this->db->next_record() ) 434 $result[] = $this->db->row(); 435 436 if( count($result) > 0 ) 437 $valueDB = $result[0]['config_value']; 438 } 439 440 $OrgDB = explode(",", $valueDB); 441 $newValue = ""; 442 443 foreach($OrgDB as $tmp) 444 { 445 if( strtolower(trim($tmp)) != strtolower(trim($organization))) 446 $newValue .= $tmp . ","; 447 } 448 449 $newValue = substr($newValue, 0,(strlen($newValue) -1 )); 450 451 if( trim($newValue) != "") 452 $query = "UPDATE phpgw_config SET config_value = '".$newValue."' WHERE config_app = 'phpgwapi' AND config_name = 'conf_organization_jabberit'"; 453 else 454 $query = "DELETE from phpgw_config where config_name = 'conf_organization_jabberit'"; 455 456 if( $this->db->query($query)) 457 return true; 458 else 459 return false; 460 } 461 return false; 462 } 284 463 } 285 464 ?> -
trunk/jabberit_messenger/inc/class.ldap_im.inc.php
r551 r563 25 25 private $jid; 26 26 private $max_result; 27 private $ou_User; 27 28 28 29 public final function __construct() 29 30 { 30 $this->ldap_host = $_SESSION['phpgw_info']['jabberit_messenger']['server_ldap_jabberit'];31 $this->ldap_context = $_SESSION['phpgw_info']['jabberit_messenger']['context_ldap_jabberit'];32 $this->ldap_dn = $_SESSION['phpgw_info']['jabberit_messenger']['user_ldap_jabberit'];33 $this->ldap_pass = $_SESSION['phpgw_info']['jabberit_messenger']['password_ldap_jabberit'];31 $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']; 32 $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']; 33 $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']; 34 $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']; 34 35 $this->jid = $_SESSION['phpgw_info']['jabberit_messenger']['user']; 35 36 $this->max_result = 50; 37 38 // Ou User 39 $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="))); 36 42 } 37 43 … … 49 55 { 50 56 $GLOBALS['phpgw_info']['server']['ldap_version3'] = true; 51 $this->ldap = $this->common->ldapConnect( $this->ldap_host,$this->ldap_dn,$this->ldap_pass, true );57 $this->ldap = $this->common->ldapConnect( $this->ldap_host,$this->ldap_dn,$this->ldap_pass, false ); 52 58 } 53 59 } … … 150 156 } 151 157 152 public final function list_users_ldap($search, $uidnumber )158 public final function list_users_ldap($search, $uidnumber, $groupsDeny) 153 159 { 154 160 $this->_connect_ldap(); … … 159 165 $justthese = array("uid","uidNumber","cn","mail","phpgwAccountVisible","dn","jpegPhoto"); 160 166 // SERPRO 161 //$justthese = array("uid","uidNumber","cn","mail","description","phpgwAccountVisible","dn","jpegPhoto"); 162 $search = ldap_search($this->ldap,$this->ldap_context,$filter,$justthese, 0, $this->max_result + 1); 167 //$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); 170 else 171 $search = ldap_search($this->ldap,$this->ldap_context,$filter,$justthese, 0, $this->max_result + 1); 163 172 $entry1 = ldap_get_entries($this->ldap,$search); 164 173 $entry = ldap_first_entry( $this->ldap, $search ); … … 243 252 } 244 253 245 public final function list_organizations_ldap() 246 { 247 $result_org = "<organizations>"; 254 public final function listOrganizationsLdap() 255 { 248 256 249 257 $this->_connect_ldap(); … … 259 267 foreach($entry as $tmp) 260 268 if($tmp['ou'][0] != "") 261 $result_org .= "<ou>" . $tmp['ou'][0] . "</ou>"; 262 263 $result_org .= "</organizations>"; 264 269 $result_org[] = $tmp['ou'][0]; 270 265 271 return $result_org; 266 272 } 273 274 public final function getGroupsLdap($pOrg) 275 { 276 $this->_ldapConnect(true); 277 $organization = 'ou=' . $pOrg['ou'] .",". $this->ldap_context; 278 279 if( $this->ldap ) 280 { 281 $filter = "(&(phpgwAccountType=g)(objectClass=posixGroup))"; 282 $justthese = array("cn","gidNumber"); 283 $search = ldap_list($this->ldap, $organization, $filter, $justthese); 284 $entry = ldap_get_entries( $this->ldap, $search ); 285 286 if( $entry ) 287 { 288 $result_groups = "<ldap>"; 289 foreach($entry as $tmp) 290 if( $tmp['gidnumber'][0] != "" ) 291 $result_groups .= "<org><cn>".$tmp['cn'][0]."</cn><gid>".$tmp['gidnumber'][0]."</gid></org>"; 292 293 $result_groups .= "</ldap>"; 294 } 295 } 296 297 return $result_groups; 298 } 299 267 300 } 268 301 -
trunk/jabberit_messenger/inc/class.uiconforganization.inc.php
r526 r563 38 38 $GLOBALS['phpgw_info']['flags']['app_header'] = lang('Admin') .' - ' . 'Configurar o Atributo de Autenticação'; 39 39 40 //if(!@is_object($GLOBALS['phpgw']->js))41 //{42 // $GLOBALS['phpgw']->js = CreateObject('phpgwapi.javascript');43 //}44 45 40 $_SESSION['phpgwinfo']['db_host'] = $GLOBALS['phpgw_info']['server']['db_host']; 46 41 $_SESSION['phpgwinfo']['db_port'] = $GLOBALS['phpgw_info']['server']['db_port']; … … 53 48 $webserver_url = ( !empty($webserver_url) ) ? $webserver_url : '/'; 54 49 55 //$js = array('functions');56 //foreach( $js as $tmp )57 // $GLOBALS['phpgw']->js->validate_file('',$tmp,'jabberit_messenger');58 59 50 $GLOBALS['phpgw']->common->phpgw_header(); 60 51 echo parse_navbar(); -
trunk/jabberit_messenger/inc/controller.xml
r551 r563 19 19 <js path="/var/www/expresso/jabberit_messenger/js" suffix=".js" debug="false"> 20 20 <item ref="connector" js="connector" /> 21 <item ref="dragdrop" js="dragdrop" /> 22 <item ref="editSelect" js="editSelect" /> 23 <item ref="glocked" js="glocked" /> 24 <item ref="images" js="images" /> 25 <item ref="ldap" js="ldap" /> 26 <item ref="load" js="load" /> 27 <item ref="show_hidden" js="show_hidden" /> 28 <item ref="setup" js="setup" path="/var/www/expresso/jabberit_messenger/templates/default"/> 21 29 <item ref="xtools" js="xtools" /> 22 30 <item ref="windows" js="windows" /> 23 <item ref="dragdrop" js="dragdrop" />24 <item ref="ldap" js="ldap" />25 <item ref="load" js="load" />26 <item ref="images" js="images" />27 <item ref="show_hidden" js="show_hidden" />28 <item ref="editSelect" js="editSelect" />29 <item ref="setup" js="setup" path="/var/www/expresso/jabberit_messenger/templates/default"/>30 31 </js> 31 32 <php path="/var/www/expresso/jabberit_messenger/inc" suffix=".class.php"> … … 35 36 <item ref="db_im" alias="setAttributesLdap" class="db_im" method="setAttributesLdap" prefix="class." suffix=".inc.php"/> 36 37 <item ref="db_im" alias="setPreferences" class="db_im" method="setPreferences" prefix="class." suffix=".inc.php"/> 37 <item ref="db_im" alias="removeAttributesLdap" class="db_im" method="removeAttributesLdap" prefix="class." suffix=".inc.php"/> 38 <item ref="db_im" alias="setUseParticipantsExternal" class="db_im" method="setUseParticipantsExternal" prefix="class." suffix=".inc.php"/> 39 <item ref="db_im" alias="setOrganization" class="db_im" method="setOrganization" prefix="class." suffix=".inc.php"/> 40 <item ref="db_im" alias="removeAttributesLdap" class="db_im" method="removeAttributesLdap" prefix="class." suffix=".inc.php"/> 41 <item ref="db_im" alias="removeParticipantsExternal" class="db_im" method="removeParticipantsExternal" prefix="class." suffix=".inc.php"/> 38 42 <item ref="ldap_im" alias="list_organizations_ldap" class="ldap_im" method="list_organizations_ldap" prefix="class." suffix=".inc.php"/> 39 43 <item ref="ldap_im" alias="list_participants_externals" class="ldap_im" method="list_participants_externals" prefix="class." suffix=".inc.php"/> 44 <item ref="ldap_im" alias="getGroupsLdap" class="ldap_im" method="getGroupsLdap" prefix="class." suffix=".inc.php"/> 40 45 <item ref="ldap_im" alias="photo_ldap" class="ldap_im" method="photo_ldap" prefix="class." suffix=".inc.php"/> 41 46 <item ref="ujabber" alias="AddNewContact" class="ujabber" method="AddNewContact" prefix="class." suffix=".inc.php"/> -
trunk/jabberit_messenger/inc/hook_admin.inc.php
r519 r563 16 16 'Site Configuration' => $GLOBALS['phpgw']->link('/index.php','menuaction=admin.uiconfig.index&appname=' . $appname), 17 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 'Configuration of authentication attribute by Organization (OU)' => $GLOBALS['phpgw']->link('/index.php','menuaction=jabberit_messenger.uiconforganization.edit_conf'), 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 19 22 ); 20 23 21 24 //Do not modify below this line 22 25 display_section($appname,$title,$file); -
trunk/jabberit_messenger/inc/jabberit_acl.inc.php
r551 r563 45 45 46 46 $_SESSION['phpgw_info']['jabberit_messenger']['webserver_url'] = $webserver_url; 47 47 48 $ExternalParticipants = ""; 49 if(isset($_SESSION['phpgw_info']['jabberit_messenger']['conf_organization_jabberit'])) 50 $ExternalParticipants = explode(",",$_SESSION['phpgw_info']['jabberit_messenger']['conf_organization_jabberit']); 51 52 if(is_array($ExternalParticipants)) 53 { 54 natcasesort($ExternalParticipants); 55 $ExternalParticipants = implode(",", $ExternalParticipants); 56 } 57 48 58 require_once dirname(__FILE__) . '/load_lang.php'; 49 59 50 print '<script type="text/javascript">var path_jabberit= "'.$webserver_url.'"</script>'; 51 60 print "<script type='text/javascript'>". 61 "var path_jabberit='".$webserver_url."';". 62 "var externalParticipantsJabberit='".$ExternalParticipants."';". 63 "</script>"; 52 64 53 65 $js = array( -
trunk/jabberit_messenger/inc/jabberit_sessions.inc.php
r551 r563 17 17 $_SESSION['phpgw_info']['jabberit_messenger']['mail'] = $GLOBALS['phpgw_info']['user']['email']; 18 18 $_SESSION['phpgw_info']['jabberit_messenger']['fullname'] = $GLOBALS['phpgw_info']['user']['fullname']; 19 $_SESSION['phpgw_info']['jabberit_messenger']['account_dn'] = $GLOBALS['phpgw_info']['user']['account_dn']; 20 21 //Members Group 22 $_SESSION['phpgw_info']['jabberit_messenger']['membership'] = $GLOBALS['phpgw']->accounts->membership(); 23 24 //Groups Locked 25 $_SESSION['phpgw_info']['jabberit_messenger']['groups_locked'] = $GLOBALS['phpgw_info']['server']['groups_locked_jabberit']; 19 26 20 27 //Server http or https … … 47 54 $_SESSION['phpgw_info']['jabberit_messenger']['name_company'] = $GLOBALS['phpgw_info']['server']['name_company_applet_jabberit']; 48 55 $_SESSION['phpgw_info']['jabberit_messenger']['use_attribute_jabberit'] = $GLOBALS['phpgw_info']['server']['use_attribute_jabberit']; 49 $_SESSION['phpgw_info']['jabberit_messenger']['attributes_org_ldap_jabberit'] 56 $_SESSION['phpgw_info']['jabberit_messenger']['attributes_org_ldap_jabberit'] = $GLOBALS['phpgw_info']['server']['attributes_org_ldap_jabberit']; 50 57 $_SESSION['phpgw_info']['jabberit_messenger']['use_external_participants_jabberit'] = $GLOBALS['phpgw_info']['server']['use_external_participants_jabberit']; 58 $_SESSION['phpgw_info']['jabberit_messenger']['conf_organization_jabberit'] = $GLOBALS['phpgw_info']['server']['conf_organization_jabberit']; 51 59 52 60 ?> -
trunk/jabberit_messenger/inc/login.php
r551 r563 13 13 define('PHPGW_API_INC','../../phpgwapi/inc'); 14 14 require_once(PHPGW_API_INC . '/class.Template.inc.php'); 15 require_once('class.db_im.inc.php'); 15 16 16 17 if(isset($_SESSION['phpgw_info']['jabberit_messenger']['name_jabberit'])) … … 19 20 $path = $_SESSION['phpgw_info']['jabberit_messenger']['webserver_url']; 20 21 $SERVER_EXPRESSO = $_SERVER['HTTP_HOST'] . $path; 21 22 // Type Protocol http / https 23 $protocol = trim("http"); 22 23 /** 24 ****** Type Protocol http / https ********************************************************** 25 * Esta variável é carregada no header.inc.php, onde é possível definir 26 * se será com http ou https. Verifique em seu arquivo header.inc.php como está configurada 27 * a variável $GLOBALS['phpgw_info']['server']['use_https']. 28 * Abaixo segue esquema : 29 * Expresso 0 = Sem https 30 * Expresso 1 = Com https apenas no login 31 * Expresso 2 = Completo 32 ********************************************************************************************* 33 **/ 34 35 $PROTOCOL = trim("http"); 24 36 if( $_SESSION['phpgw_info']['jabberit_messenger']['use_https'] === 2 ) 25 $ protocol= trim("https");26 37 $PROTOCOL = trim("https"); 38 27 39 // Uid user 28 40 $uid = $_SESSION['phpgw_info']['jabberit_messenger']['user']; … … 36 48 // FirstName 37 49 $CnName = explode(" ",$_SESSION['phpgw_info']['jabberit_messenger']['fullname']); 50 51 // Preferences 52 $obj = new db_im(); 53 $preferences = $obj->getPreferences(); 54 $preferences = substr($preferences,(strpos($preferences,";") + 1), strlen($preferences)); 55 $preferences = explode(":", $preferences); 38 56 39 57 if(is_array($organization)) … … 78 96 $template->set_var("value_userproxy",$_SESSION['phpgw_info']['jabberit_messenger']['use_proxy_java']); 79 97 $template->set_var("value_expresso",$SERVER_EXPRESSO); 80 $template->set_var("value_use_https", $ protocol);98 $template->set_var("value_use_https", $PROTOCOL); 81 99 $template->set_var("value_company", $_SESSION['phpgw_info']['jabberit_messenger']['name_company']); 82 100 $template->set_var("value_cnname",$CnName[0]); 101 $template->set_var("value_preference_userOfflineJabberit", strtoupper($preferences[1])); 83 102 $template->set_file(Array('jabberit_messenger' => 'jabberIM.tpl')); 84 103 $template->set_block('jabberit_messenger','index');
Note: See TracChangeset
for help on using the changeset viewer.