Changeset 63
- Timestamp:
- 08/29/07 08:55:50 (17 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 30 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/expressoAdmin1_2/docs/change_log.txt
r62 r63 87 87 - Corrigido bug ao adicionar email em grupos 88 88 - Corrigido bug ao adicionar atributos samba a um usuários já existente. 89 90 14/08/2007 91 - Criado aba Informações Corporativas, com os campo employeeNumber, cpf, rg, rgUf 92 - Melhorado classe user.inc.php. -
trunk/expressoAdmin1_2/inc/class.bomanagers.inc.php
r62 r63 30 30 'lid' => $_POST['manager_lid'], 31 31 'context' => $_POST['context'], 32 32 33 'add_users' => $_POST['add_users'], 33 34 'edit_users' => $_POST['edit_users'], … … 35 36 'rename_users' => $_POST['rename_users'], 36 37 'view_users' => $_POST['view_users'], 38 'manipulate_corporative_information' => $_POST['manipulate_corporative_information'], 37 39 'add_groups' => $_POST['add_groups'], 38 40 'edit_groups' => $_POST['edit_groups'], … … 42 44 'change_users_quote' => $_POST['change_users_quote'], 43 45 'set_user_default_password' => $_POST['set_user_default_password'], 46 'empty_user_inbox' => $_POST['empty_user_inbox'], 44 47 'edit_sambausers_attributes'=> $_POST['edit_sambausers_attributes'], 45 48 'edit_sambadomains' => $_POST['edit_sambadomains'], … … 54 57 'create_computers' => $_POST['create_computers'], 55 58 'edit_computers' => $_POST['edit_computers'], 56 'delete_computers' => $_POST['delete_computers'], 59 'delete_computers' => $_POST['delete_computers'], 60 57 61 'apps' => $_POST['applications_list'] 58 62 ); … … 60 64 // Soma os niveis de acesso criando uma ACL 61 65 $acl = 0; 62 $acl = $acl + $manager['add_users'] + $manager['edit_users'] + $manager['delete_users'] + $manager['rename_users'] + $manager['view_users'] ;66 $acl = $acl + $manager['add_users'] + $manager['edit_users'] + $manager['delete_users'] + $manager['rename_users'] + $manager['view_users'] + $manager['manipulate_corporative_information']; 63 67 $acl = $acl + $manager['add_groups'] + $manager['edit_groups'] + $manager['delete_groups'] + $manager['edit_email_groups']; 64 $acl = $acl + $manager['change_users_password'] + $manager['change_users_quote'] + $manager['set_user_default_password'] ;68 $acl = $acl + $manager['change_users_password'] + $manager['change_users_quote'] + $manager['set_user_default_password'] + $manager['empty_user_inbox']; 65 69 $acl = $acl + $manager['edit_sambausers_attributes'] + $manager['edit_sambadomains']; 66 70 $acl = $acl + $manager['add_email_lists'] + $manager['edit_email_lists'] + $manager['delete_email_lists']; … … 102 106 'lid' => $_POST['manager_lid'], 103 107 'context' => $_POST['context'], 108 104 109 'add_users' => $_POST['add_users'], 105 110 'edit_users' => $_POST['edit_users'], … … 107 112 'rename_users' => $_POST['rename_users'], 108 113 'view_users' => $_POST['view_users'], 114 'manipulate_corporative_information' => $_POST['manipulate_corporative_information'], 109 115 'add_groups' => $_POST['add_groups'], 110 116 'edit_groups' => $_POST['edit_groups'], … … 114 120 'change_users_quote' => $_POST['change_users_quote'], 115 121 'set_user_default_password' => $_POST['set_user_default_password'], 122 'empty_user_inbox' => $_POST['empty_user_inbox'], 116 123 'edit_sambausers_attributes'=> $_POST['edit_sambausers_attributes'], 117 124 'edit_sambadomains' => $_POST['edit_sambadomains'], … … 127 134 'edit_computers' => $_POST['edit_computers'], 128 135 'delete_computers' => $_POST['delete_computers'], 136 129 137 'apps' => $_POST['applications_list'] 130 138 ); … … 132 140 // Soma os niveis de acesso criando uma ACL 133 141 $acl = 0; 134 $acl = $acl + $manager['add_users'] + $manager['edit_users'] + $manager['delete_users'] + $manager['rename_users'] + $manager['view_users'] ;142 $acl = $acl + $manager['add_users'] + $manager['edit_users'] + $manager['delete_users'] + $manager['rename_users'] + $manager['view_users'] + $manager['manipulate_corporative_information']; 135 143 $acl = $acl + $manager['add_groups'] + $manager['edit_groups'] + $manager['delete_groups'] + $manager['edit_email_groups']; 136 $acl = $acl + $manager['change_users_password'] + $manager['change_users_quote'] + $manager['set_user_default_password'] ;144 $acl = $acl + $manager['change_users_password'] + $manager['change_users_quote'] + $manager['set_user_default_password'] + $manager['empty_user_inbox']; 137 145 $acl = $acl + $manager['edit_sambausers_attributes'] + $manager['edit_sambadomains']; 138 146 $acl = $acl + $manager['add_email_lists'] + $manager['edit_email_lists'] + $manager['delete_email_lists']; -
trunk/expressoAdmin1_2/inc/class.functions.inc.php
r62 r63 66 66 return true; 67 67 break; 68 case manipulate_corporative_information: 69 if ($array_acl[manipulate_corporative_information]) 70 return true; 71 break; 68 72 case change_users_password: 69 73 if ($array_acl[change_users_password]) … … 76 80 case set_user_default_password: 77 81 if ($array_acl[set_user_default_password]) 82 return true; 83 break; 84 case empty_user_inbox: 85 if (($array_acl[empty_user_inbox]) && ($array_acl[edit_users])) 78 86 return true; 79 87 break; … … 186 194 187 195 // Make a array read humam 188 // Last acl: 33.554.432, 67.108.864 196 // Last acl: 33.554.432, 67.108.864, 134.217.728, 134.217.728, 268.435.456 189 197 function make_array_acl($acl) 190 198 { … … 194 202 $array_acl['rename_users'] = $acl & 8388608; 195 203 $array_acl['view_users'] = $acl & 33554432; 204 $array_acl['manipulate_corporative_information'] = $acl & 268435456; 196 205 $array_acl['add_groups'] = $acl & 16; 197 206 $array_acl['edit_groups'] = $acl & 32; … … 201 210 $array_acl['change_users_quote'] = $acl & 262144; 202 211 $array_acl['set_user_default_password'] = $acl & 524288; 212 $array_acl['empty_user_inbox'] = $acl & 134217728; 203 213 $array_acl['edit_sambausers_attributes'] = $acl & 32768; 204 214 $array_acl['edit_sambadomains'] = $acl & 16777216; -
trunk/expressoAdmin1_2/inc/class.imap_functions.inc.php
r62 r63 1 1 <?php 2 3 include_once('class.functions.inc.php'); 2 4 3 5 class imap_functions 4 6 { 7 var $functions; 5 8 var $imap; 6 9 var $imapDelimiter; … … 17 20 $this->imapDelimiter= $_SESSION['phpgw_info']['expresso']['email_server']['imapDelimiter']; 18 21 $this->imap = imap_open('{'.$this->imap_server.':'.$this->imap_port.'/novalidate-cert}', $this->imap_admin, $this->imap_passwd, OP_HALFOPEN); 22 $this->functions = new functions; 19 23 } 20 24 … … 72 76 else 73 77 { 74 $quota['mailquota'] = ($get_quota['limit'] / 1024);75 $quota['mailquota_used'] = ($get_quota['usage'] / 1024);78 $quota['mailquota'] = round (($get_quota['limit'] / 1024), 2); 79 $quota['mailquota_used'] = round (($get_quota['usage'] / 1024), 2); 76 80 } 77 81 … … 116 120 return $result; 117 121 } 122 123 function empty_inbox($params) 124 { 125 // Verifica o acesso do gerente 126 if (!$this->functions->check_acl($_SESSION['phpgw_session']['session_lid'], 'empty_user_inbox')) 127 { 128 $result['status'] = false; 129 $result['msg'] = 'Você não tem acesso para executar esta operação.'; 130 return $result; 131 } 132 133 if ($_SESSION['phpgw_info']['expressomail']['email_server']['imapTLSEncryption'] == 'yes') 134 { 135 $imap_options = '/tls/novalidate-cert'; 136 } 137 else 138 { 139 $imap_options = '/notls/novalidate-cert'; 140 } 141 142 143 $result['status'] = true; 144 $uid = $params['uid']; 145 146 $return_setacl = imap_setacl($this->imap, "user" . $this->imapDelimiter . $uid, $this->imap_admin, 'lrswipcda'); 147 148 if ($return_setacl) 149 { 150 //$mbox_stream = imap_open('{'.$this->imap_server.':'.$this->imap_port.$imap_options.'/user="'.$uid.'"}', $this->imap_admin, $this->imap_passwd); 151 $mbox_stream = imap_open('{'.$this->imap_server.':'.$this->imap_port.$imap_options .'}user'. $this->imapDelimiter . $uid, $this->imap_admin, $this->imap_passwd); 152 153 $check = imap_mailboxmsginfo($mbox_stream); 154 $inbox_size = (string)(round ((($check->Size)/(1024*1024)), 2)); 155 156 $return_imap_delete = imap_delete($mbox_stream,'1:*'); 157 imap_close($mbox_stream, CL_EXPUNGE); 158 159 imap_setacl ($this->imap, "user" . $this->imapDelimiter . $uid, $this->imap_admin, ''); 160 161 if ($return_imap_delete) 162 { 163 $result['inbox_size'] = $inbox_size; 164 165 $get_user_quota = @imap_get_quotaroot($this->imap,"user" . $this->imapDelimiter . $uid); 166 $result['mailquota_used'] = (string)(round(($get_user_quota['usage']/1024), 2)); 167 } 168 else 169 { 170 $result['status'] = false; 171 $result['msg'] = "Nao foi possivel esvaziar a caixa postal do usuario:\n" . imap_last_error(); 172 } 173 } 174 else 175 { 176 $result['status'] = false; 177 $result['msg'] = "Nao foi possivel modificar a acl do usuario:\n" . imap_last_error(); 178 } 179 return $result; 180 } 118 181 } -
trunk/expressoAdmin1_2/inc/class.ldap_functions.inc.php
r62 r63 3 3 define('PHPGW_API_INC','../phpgwapi/inc'); 4 4 include_once(PHPGW_API_INC.'/class.common.inc.php'); 5 include_once('class.functions.inc.php'); 5 6 6 7 class ldap_functions … … 8 9 var $ldap; 9 10 var $current_config; 11 var $functions; 10 12 11 13 function ldap_functions(){ … … 14 16 $common = new common(); 15 17 $this->ldap = $common->ldapConnect(); 18 $this->functions = new functions; 16 19 } 17 20 18 21 function validate_fields($params) 19 22 { 23 $result['status'] = true; 20 24 $params = unserialize($params['attributes']); 21 25 $type = $params['type']; … … 24 28 $mail = $params['mail']; 25 29 $mailalternateaddress = $params['mailalternateaddress']; 26 27 $result['status'] = true; 28 30 29 31 if ($_SESSION['phpgw_info']['expresso']['global_denied_users'][$uid]) 30 32 { … … 657 659 array_pop($a_tmp); 658 660 $result['sambasid'] = implode("-", $a_tmp); 661 } 662 663 // Verifica o acesso do gerente aos atributos corporativos 664 if ($this->functions->check_acl($_SESSION['phpgw_session']['session_lid'], 'manipulate_corporative_information')) 665 { 666 $result['corporative_information_employeenumber']= $entry[0]['employeenumber'][0]; 667 $result['corporative_information_cpf'] = $entry[0]['cpf'][0]; 668 $result['corporative_information_rg'] = $entry[0]['rg'][0]; 669 $result['corporative_information_rguf'] = $entry[0]['rguf'][0]; 659 670 } 660 671 -
trunk/expressoAdmin1_2/inc/class.uiaccounts.inc.php
r62 r63 242 242 'display_spam_uid' => 'display:none', 243 243 'lang_general_information' => lang('General Information'), 244 'lang_corporative_information' => lang('Corporative Information'), 244 245 'lang_email_config' => lang('Email Config'), 245 246 'lang_groups_permission' => lang('Groups Permission'), … … 274 275 'ldap_context' => ldap_dn2ufn($GLOBALS['phpgw_info']['server']['ldap_context']), 275 276 277 // Corporative Information 278 'display_corporative_information' => $this->functions->check_acl($manager_lid,'manipulate_corporative_information') ? '' : 'none', 279 'lang_employeenumber' => lang('Employee number'), 280 'lang_cpf' => lang('cpf'), 281 'lang_rg' => lang('rg'), 282 'lang_rguf' => lang('rguf'), 283 276 284 //MAIL 277 285 'lang_activeemailaccount' => lang('Active email account'), … … 305 313 306 314 //SAMBA ABA 315 'display_samba_suport' => $this->functions->check_acl($manager_lid,'edit_sambausers_attributes') ? '' : 'none', 307 316 'lang_samba_config' => lang('Samba Config'), 308 317 'lang_use_attrs_samba' => lang('Use samba attributes'), … … 536 545 'display_input_account_lid' => 'display:none', 537 546 'lang_general_information' => lang('General Information'), 547 'lang_corporative_information' => lang('Corporative Information'), 538 548 'lang_email_config' => lang('Email Config'), 539 549 'lang_groups_permission' => lang('Groups Permission'), … … 572 582 'phpgwaccountvisible_checked' => $user_info['phpgwaccountvisible'] == '-1' ? 'CHECKED' : '', 573 583 574 //MAIL BORD 584 // Corporative Information 585 'display_corporative_information'=> $this->functions->check_acl($manager_account_lid,'edit_sambausers_attributes') ? '' : 'none', 586 'lang_employeenumber' => lang('Employee number'), 587 'lang_cpf' => lang('cpf'), 588 'lang_rg' => lang('rg'), 589 'lang_rguf' => lang('rguf'), 590 'corporative_information_employeenumber' => $user_info['corporative_information_employeenumber'], 591 'corporative_information_cpf' => $user_info['corporative_information_cpf'], 592 'corporative_information_rg' => $user_info['corporative_information_rg'], 593 'corporative_information_rguf' => $user_info['corporative_information_rguf'], 594 595 //MAIL 575 596 'disabled_quota_used' => 'disabled', 576 597 'lang_activeemailaccount' => lang('Active email account'), -
trunk/expressoAdmin1_2/inc/class.uimanagers.inc.php
r62 r63 207 207 'lang_rename_user' => lang('Rename users'), 208 208 'lang_view_user' => lang('View users'), 209 'lang_manipulate_corporative_information' => lang('Manipulate corporative information'), 209 210 'lang_add_groups' => lang('Add groups'), 210 211 'lang_edit_groups' => lang('Edit groups'), … … 214 215 'lang_change_users_quote' => lang('Change users quote'), 215 216 'lang_set_user_default_password'=> lang('Set default users password'), 217 'lang_empty_user_inbox' => lang('Empty user inbox'), 216 218 'lang_edit_sambausers_attributes'=> lang('Edit SAMBA users attributes'), 217 219 'lang_edit_sambadomains' => lang('Edit SAMBA domains'), … … 233 235 'add_users' => $_POST['add_users'] != '' ? 'checked' : '', 234 236 'edit_users' => $_POST['edit_users'] != '' ? 'checked' : '', 237 'view_users' => $_POST['view_users'] != '' ? 'checked' : '', 238 'manipulate_corporative_information' => $_POST['manipulate_corporative_information'] != '' ? 'checked' : '', 235 239 'delete_users' => $_POST['delete_users'] != '' ? 'checked' : '', 236 240 'add_groups' => $_POST['add_groups'] != '' ? 'checked' : '', … … 335 339 $_POST['rename_users'] = $acl['rename_users']; 336 340 $_POST['view_users'] = $acl['view_users']; 341 $_POST['manipulate_corporative_information'] = $acl['manipulate_corporative_information']; 337 342 $_POST['add_groups'] = $acl['add_groups']; 338 343 $_POST['edit_groups'] = $acl['edit_groups']; … … 342 347 $_POST['change_users_quote'] = $acl['change_users_quote']; 343 348 $_POST['set_user_default_password'] = $acl['set_user_default_password']; 349 $_POST['empty_user_inbox'] = $acl['empty_user_inbox']; 344 350 $_POST['edit_sambausers_attributes'] = $acl['edit_sambausers_attributes']; 345 351 $_POST['edit_sambadomains'] = $acl['edit_sambadomains']; … … 453 459 'lang_rename_user' => lang('Rename users'), 454 460 'lang_view_user' => lang('View users'), 461 'lang_manipulate_corporative_information' => lang('Manipulate corporative information'), 455 462 'lang_add_groups' => lang('Add groups'), 456 463 'lang_edit_groups' => lang('Edit groups'), … … 460 467 'lang_change_users_quote' => lang('Change users quote'), 461 468 'lang_set_user_default_password'=> lang('Set default user password'), 469 'lang_empty_user_inbox' => lang('Empty user inbox'), 462 470 'lang_edit_sambausers_attributes'=> lang('Edit SAMBA users attributes'), 463 471 'lang_edit_sambadomains' => lang('Edit SAMBA domains'), … … 483 491 'rename_users' => $_POST['rename_users'] != '' ? 'checked' : '', 484 492 'view_users' => $_POST['view_users'] != '' ? 'checked' : '', 493 'manipulate_corporative_information' => $_POST['manipulate_corporative_information'] != '' ? 'checked' : '', 485 494 'add_groups' => $_POST['add_groups'] != '' ? 'checked' : '', 486 495 'edit_groups' => $_POST['edit_groups'] != '' ? 'checked' : '', … … 490 499 'change_users_quote' => $_POST['change_users_quote'] != '' ? 'checked' : '', 491 500 'set_user_default_password' => $_POST['set_user_default_password'] != '' ? 'checked' : '', 501 'empty_user_inbox' => $_POST['empty_user_inbox'] != '' ? 'checked' : '', 492 502 'edit_sambausers_attributes' => $_POST['edit_sambausers_attributes'] != '' ? 'checked' : '', 493 503 'edit_sambadomains' => $_POST['edit_sambadomains'] != '' ? 'checked' : '', -
trunk/expressoAdmin1_2/inc/class.user.inc.php
r62 r63 117 117 if (($this->current_config['expressoAdmin_samba_support'] == 'true') && ($params['use_attrs_samba'] == 'on')) 118 118 { 119 //Verifica se o binario para criar as senhas do samba exite. 120 if (!is_file('/home/expressolivre/mkntpwd')) 121 { 122 $return['status'] = false; 123 $return['msg'] .= "O arquivo binário /home/expressolivre/mkntpwd não exite.\\nEle é necessário para a criação das senhas usadas pelo SAMBA.\\nInforme o administrador ExpressoLivre sobre isto."; 124 } 125 else 126 { 127 $user_info['objectClass'][] = 'sambaSamAccount'; 128 $user_info['loginShell'] = '/bin/bash'; 129 130 $user_info['sambaSID'] = $params['sambadomain'] . '-' . ((2 * $id)+1000); 131 $user_info['sambaPrimaryGroupSID'] = $params['sambadomain'] . '-' . ((2 * $user_info['gidNumber'])+1001); 132 133 $user_info['sambaAcctFlags'] = $params['sambaacctflags']; 134 135 $user_info['sambaLogonScript'] = $params['sambalogonscript']; 136 $user_info['homeDirectory'] = $params['sambahomedirectory']; 137 138 $user_info['sambaLMPassword'] = exec('/home/expressolivre/mkntpwd -L '.$params['password1']); 139 $user_info['sambaNTPassword'] = exec('/home/expressolivre/mkntpwd -N '.$params['password1']); 140 $user_info['sambaPasswordHistory'] = '0000000000000000000000000000000000000000000000000000000000000000'; 141 142 $user_info['sambaPwdCanChange'] = strtotime("now"); 143 $user_info['sambaPwdLastSet'] = strtotime("now"); 144 $user_info['sambaPwdMustChange'] = '2147483647'; 145 } 146 } 119 // Verifica o acesso do gerente aos atributos samba 120 if ($this->functions->check_acl($_SESSION['phpgw_session']['session_lid'], 'edit_sambausers_attributes')) 121 { 122 //Verifica se o binario para criar as senhas do samba exite. 123 if (!is_file('/home/expressolivre/mkntpwd')) 124 { 125 $return['status'] = false; 126 $return['msg'] .= "O arquivo binário /home/expressolivre/mkntpwd não exite.\\nEle é necessário para a criação das senhas usadas pelo SAMBA.\\nInforme o administrador ExpressoLivre sobre isto."; 127 } 128 else 129 { 130 $user_info['objectClass'][] = 'sambaSamAccount'; 131 $user_info['loginShell'] = '/bin/bash'; 132 133 $user_info['sambaSID'] = $params['sambadomain'] . '-' . ((2 * $id)+1000); 134 $user_info['sambaPrimaryGroupSID'] = $params['sambadomain'] . '-' . ((2 * $user_info['gidNumber'])+1001); 135 136 $user_info['sambaAcctFlags'] = $params['sambaacctflags']; 137 138 $user_info['sambaLogonScript'] = $params['sambalogonscript']; 139 $user_info['homeDirectory'] = $params['sambahomedirectory']; 140 141 $user_info['sambaLMPassword'] = exec('/home/expressolivre/mkntpwd -L '.$params['password1']); 142 $user_info['sambaNTPassword'] = exec('/home/expressolivre/mkntpwd -N '.$params['password1']); 143 $user_info['sambaPasswordHistory'] = '0000000000000000000000000000000000000000000000000000000000000000'; 144 145 $user_info['sambaPwdCanChange'] = strtotime("now"); 146 $user_info['sambaPwdLastSet'] = strtotime("now"); 147 $user_info['sambaPwdMustChange'] = '2147483647'; 148 } 149 } 150 } 151 152 // Verifica o acesso do gerente aos atributos corporativos 153 if ($this->functions->check_acl($_SESSION['phpgw_session']['session_lid'], 'manipulate_corporative_information')) 154 { 155 foreach ($params as $atribute=>$value) 156 { 157 $pos = strrpos($atribute, 'corporative_information_'); 158 if ($pos !== false) 159 { 160 if ($params[$atribute]) 161 { 162 $ldap_atribute = str_replace("corporative_information_", "", $atribute); 163 $user_info[$ldap_atribute] = $params[$atribute]; 164 } 165 } 166 } 167 } 168 147 169 $result = $this->ldap_functions->ldap_add_entry($dn, $user_info); 148 170 if (!$result['status']) … … 239 261 $old_values = $this->get_user_info($new_values['uidnumber'], $new_values['manager_context']); 240 262 $dn = 'uid=' . $old_values['uid'] . ',' . strtolower($old_values['context']); 241 263 242 264 $diff = array_diff($new_values, $old_values); 243 265 244 266 $manager_account_lid = $_SESSION['phpgw_session']['session_lid']; 245 267 if ((!$this->functions->check_acl($manager_account_lid,'edit_users')) && … … 254 276 255 277 // Verifica o acesso do gerente 256 if (!$this->functions->check_acl($_SESSION['phpgw_session']['session_lid'], 'edit_users'))257 {258 259 }260 261 // Verifica o acesso do gerente262 278 if ($this->functions->check_acl($_SESSION['phpgw_session']['session_lid'], 'edit_users')) 263 279 { … … 293 309 $ldap_mod_replace['sn'] = $new_values['sn']; 294 310 $ldap_mod_replace['cn'] = $new_values['givenname'] . ' ' . $new_values['sn']; 295 $this->db_functions->write_log("altera do sn do usuario",'',$dn,'','');311 $this->db_functions->write_log("altera$ldap_mod_do sn do usuario",'',$dn,'',''); 296 312 } 297 313 if ($diff['mail']) … … 349 365 } 350 366 } 351 367 368 // REPLACE, ADD & REMOVE COPORATIVEs ATRIBUTES 369 // Verifica o acesso do gerente aos atributos corporativos 370 if ($this->functions->check_acl($_SESSION['phpgw_session']['session_lid'], 'manipulate_corporative_information')) 371 { 372 foreach ($new_values as $atribute=>$value) 373 { 374 $pos = strrpos($atribute, 'corporative_information_'); 375 if ($pos !== false) 376 { 377 $ldap_atribute = str_replace("corporative_information_", "", $atribute); 378 // REPLACE ATTRS OF CORPORATIVE 379 if (($diff[$atribute]) && ($old_values[$atribute] != '')) 380 { 381 $ldap_atribute = str_replace("corporative_information_", "", $atribute); 382 $ldap_mod_replace[$ldap_atribute] = $new_values[$atribute]; 383 $this->db_functions->write_log("alterado $ldap_atribute do usuario",'',$dn,'',''); 384 } 385 //ADD ATTRS OF CORPORATIVE 386 elseif (($old_values[$atribute] == '') && ($new_values[$atribute] != '')) 387 { 388 $ldap_add[$ldap_atribute] = $new_values[$atribute]; 389 $this->db_functions->write_log("adicionado $ldap_atribute ao usuario",'',$dn,'',''); 390 } 391 //REMOVE ATTRS OF CORPORATIVE 392 elseif (($old_values[$atribute] != '') && ($new_values[$atribute] == '')) 393 { 394 $ldap_remove[$ldap_atribute] = array(); 395 $this->db_functions->write_log("removido $ldap_atribute do usuario",'',$dn,'',''); 396 } 397 } 398 } 399 } 400 352 401 //Suporte ao SAMBA 353 402 if ( ($this->functions->check_acl($_SESSION['phpgw_session']['session_lid'], 'edit_users')) || … … 512 561 } 513 562 } 514 563 515 564 if ( ($this->functions->check_acl($_SESSION['phpgw_session']['session_lid'], 'edit_users')) || 516 565 ($this->functions->check_acl($_SESSION['phpgw_session']['session_lid'], 'edit_sambausers_attributes')) ) … … 640 689 if (count($ldap_remove)) 641 690 { 642 643 691 $result = $this->ldap_functions->remove_user_attributes($dn, $ldap_remove); 644 692 if (!$result['status']) … … 727 775 return $return; 728 776 } 729 730 777 731 778 function get_user_info($uidnumber, $context) … … 1076 1123 } 1077 1124 } 1125 1126 function write_log_from_ajax($params) 1127 { 1128 $this->db_functions->write_log($params['_action'],'',$params['userinfo'],'',''); 1129 return true; 1130 } 1078 1131 } 1079 1132 ?> -
trunk/expressoAdmin1_2/js/jscode/users.js
r62 r63 41 41 return; 42 42 } 43 43 44 // Corporative Information 45 if (document.forms[0].corporative_information_employeenumber.value != "") 46 { 47 var re_employeenumber = /^([0-9])+$/; 48 49 if(!re_employeenumber.test(document.forms[0].corporative_information_employeenumber.value)) 50 { 51 alert('Campo matrícula contém caracteres não permitidos. Somente números são permitidos.'); 52 document.forms[0].corporative_information_employeenumber.focus(); 53 return; 54 } 55 } 56 57 if (document.forms[0].corporative_information_cpf.value != "") 58 { 59 var re_cpf = /^([0-9])+$/; 60 61 if(!re_cpf.test(document.forms[0].corporative_information_cpf.value)) 62 { 63 alert('Campo cpf contém caracteres não permitidos. Somente números são permitidos'); 64 document.forms[0].corporative_information_employeenumber.focus(); 65 return; 66 } 67 68 if (! validarCPF(document.forms[0].corporative_information_cpf.value) ) 69 { 70 alert("Campo CPF invalido."); 71 document.forms[0].corporative_information_cpf.focus(); 72 return; 73 } 74 } 75 44 76 //MAIL 45 77 document.forms[0].mail.value = document.forms[0].mail.value.toLowerCase(); … … 606 638 } 607 639 } 640 641 function empty_inbox(uid) 642 { 643 var action = "Limpado INBOX do usuario"; 644 var handler_write_log = function(){} 645 var handler_empty_inbox = function(data) 646 { 647 if (!data.status) 648 alert(data.msg); 649 else{ 650 cExecute ('$this.user.write_log_from_ajax&_action='+action+'&userinfo='+uid, handler_write_log); 651 alert("Esvaziados '" + data.inbox_size + "' MB da caixa postal do usuário"); 652 document.getElementById('mailquota_used').value = data.mailquota_used; 653 } 654 } 655 cExecute ('$this.imap_functions.empty_inbox&uid='+uid, handler_empty_inbox); 656 } 657 658 function validarCPF(cpf) 659 { 660 if(cpf.length != 11 || cpf == "00000000000" || cpf == "11111111111" || 661 cpf == "22222222222" || cpf == "33333333333" || cpf == "44444444444" || 662 cpf == "55555555555" || cpf == "66666666666" || cpf == "77777777777" || 663 cpf == "88888888888" || cpf == "99999999999"){ 664 return false; 665 } 666 667 soma = 0; 668 for(i = 0; i < 9; i++) 669 soma += parseInt(cpf.charAt(i)) * (10 - i); 670 resto = 11 - (soma % 11); 671 if(resto == 10 || resto == 11) 672 resto = 0; 673 if(resto != parseInt(cpf.charAt(9))) 674 { 675 return false; 676 } 677 678 soma = 0; 679 for(i = 0; i < 10; i ++) 680 soma += parseInt(cpf.charAt(i)) * (11 - i); 681 resto = 11 - (soma % 11); 682 if(resto == 10 || resto == 11) 683 resto = 0; 684 if(resto != parseInt(cpf.charAt(10))){ 685 return false; 686 } 687 return true; 688 } -
trunk/expressoAdmin1_2/templates/default/accounts_form.tpl
r62 r63 2 2 3 3 <script type="text/javascript"> 4 var tab = new Tabs( 6,'activetab','inactivetab','tab','tabcontent','','','tabpage');4 var tab = new Tabs(7,'activetab','inactivetab','tab','tabcontent','','','tabpage'); 5 5 function initAll() 6 6 { … … 28 28 <tr> 29 29 <th id="tab1" class="activetab" onclick="javascript:tab.display(1);"><a href="#" tabindex="0" accesskey="1" onfocus="tab.display(1);" onclick="tab.display(1); return(false);">{lang_general_information}</a></th> 30 <th id="tab2" class="activetab" onclick="javascript:tab.display(2);"><a href="#" tabindex="0" accesskey="2" onfocus="tab.display(2);" onclick="tab.display(2); return(false);">{lang_email_config}</a></th> 31 <th id="tab3" class="activetab" onclick="javascript:tab.display(3);"><a href="#" tabindex="0" accesskey="3" onfocus="tab.display(3);" onclick="tab.display(3); return(false);">{lang_groups_permission}</a></th> 32 <th id="tab4" class="activetab" onclick="javascript:tab.display(4);"><a href="#" tabindex="0" accesskey="4" onfocus="tab.display(4);" onclick="tab.display(4); return(false);">{lang_lists_permission}</a></th> 33 <th id="tab5" class="activetab" onclick="javascript:tab.display(5);"><a href="#" tabindex="0" accesskey="5" onfocus="tab.display(5);" onclick="tab.display(5); return(false);">{lang_aplication_permission}</a></th> 34 <th style="{display_samba_suport}" id="tab6" class="activetab" onclick="javascript:tab.display(6);"><a href="#" tabindex="0" accesskey="6" onfocus="tab.display(6);" onclick="tab.display(6); return(false);">{lang_samba_config}</a></th> 30 <th id="tab2" class="activetab" style="display:{display_corporative_information}"onclick="javascript:tab.display(2);"><a href="#" tabindex="0" accesskey="2" onfocus="tab.display(2);" onclick="tab.display(2); return(false);">{lang_corporative_information}</a></th> 31 <th id="tab3" class="activetab" onclick="javascript:tab.display(3);"><a href="#" tabindex="0" accesskey="3" onfocus="tab.display(3);" onclick="tab.display(3); return(false);">{lang_email_config}</a></th> 32 <th id="tab4" class="activetab" onclick="javascript:tab.display(4);"><a href="#" tabindex="0" accesskey="4" onfocus="tab.display(4);" onclick="tab.display(4); return(false);">{lang_groups_permission}</a></th> 33 <th id="tab5" class="activetab" onclick="javascript:tab.display(5);"><a href="#" tabindex="0" accesskey="5" onfocus="tab.display(5);" onclick="tab.display(5); return(false);">{lang_lists_permission}</a></th> 34 <th id="tab6" class="activetab" onclick="javascript:tab.display(6);"><a href="#" tabindex="0" accesskey="6" onfocus="tab.display(6);" onclick="tab.display(6); return(false);">{lang_aplication_permission}</a></th> 35 <th id="tab7" class="activetab" style="display:{display_samba_suport}" onclick="javascript:tab.display(7);"><a href="#" tabindex="0" accesskey="7" onfocus="tab.display(7);" onclick="tab.display(7); return(false);">{lang_samba_config}</a></th> 35 36 </tr> 36 37 </table> … … 111 112 </div> 112 113 114 <!-- The code for Corporative Information --> 115 <div id="tabcontent2" class="inactivetab"> 116 <table width="60%" border="0" cellspacing="4" cellpading="0"> 117 <tr bgcolor={row_on}> 118 <td>{lang_employeenumber}:</td> 119 <td><input type="text" name="corporative_information_employeenumber" autocomplete="off" value="{corporative_information_employeenumber}" size="30"></td> 120 </tr> 121 <tr bgcolor={row_off}> 122 <td>{lang_cpf}:</td> 123 <td><input type="text" name="corporative_information_cpf" autocomplete="off" value="{corporative_information_cpf}" size="30"></td> 124 </tr> 125 <tr bgcolor={row_on}> 126 <td>{lang_rg}:</td> 127 <td><input type="text" name="corporative_information_rg" autocomplete="off" value="{corporative_information_rg}" size="30"></td> 128 </tr> 129 <tr bgcolor={row_off}> 130 <td>{lang_rguf}:</td> 131 <td><input type="text" name="corporative_information_rguf" autocomplete="off" value="{corporative_information_rguf}" size="30"></td> 132 </tr> 133 </table> 134 </div> 135 113 136 <!-- The code for Email Config --> 114 <div id="tabcontent 2" class="inactivetab">137 <div id="tabcontent3" class="inactivetab"> 115 138 <table width="60%" border="0" cellspacing="4" cellpading="0"> 116 139 <tr bgcolor={row_off}> … … 146 169 <tr bgcolor={row_off}> 147 170 <td>{lang_email_quota_used}:</td> 148 <td><input type="text" name="mailquota_used" value="{mailquota_used}" disabled size=10></td> 149 </tr> 150 171 <td><input type="text" name="mailquota_used" id="mailquota_used" value="{mailquota_used}" disabled size=10></td> 172 </tr> 173 174 <tr bgcolor={row_on}> 175 <td><input type='button' {disabled} {disabled_empty_inbox} value='Limpar INBOX do usuário' onclick="javascript:empty_inbox(uid.value);"></td> 176 </tr> 177 151 178 </table> 152 179 </div> 153 180 154 181 <!-- The code for Group --> 155 <div id="tabcontent 3" class="inactivetab">182 <div id="tabcontent4" class="inactivetab"> 156 183 <table width="60%" border="0" cellspacing="4" cellpading="0"> 157 184 <tr bgcolor={row_on}> … … 213 240 214 241 <!-- The code for lists Email --> 215 <div id="tabcontent 4" class="inactivetab">242 <div id="tabcontent5" class="inactivetab"> 216 243 <table width="60%" border="0" cellspacing="4" cellpading="0"> 217 244 <tr bgcolor={row_on}> … … 265 292 266 293 <!-- The code for Apps Tab --> 267 <div id="tabcontent 5" class="inactivetab">294 <div id="tabcontent6" class="inactivetab"> 268 295 <table id="ea_table_apps" width="80%" border="0" cellspacing="2" cellpading="0"> 269 296 {apps} … … 272 299 273 300 <!-- The code for SAMBA --> 274 <div id="tabcontent6" class="inactivetab" style="{display_samba_suport}"> 301 <!--<div id="tabcontent7" class="inactivetab" style="{display_samba_suport}">--> 302 <div id="tabcontent7" class="inactivetab"> 275 303 <table width="60%" border="0" cellspacing="4" cellpading="0"> 276 304 <tr bgcolor={row_on}> -
trunk/expressoAdmin1_2/templates/default/managers_form.tpl
r62 r63 76 76 </tr> 77 77 <tr bgcolor="{color_font1}" align='right'> 78 <td>{lang_manipulate_corporative_information}:</td> 79 <td><input type="checkbox" name="manipulate_corporative_information" value="268435456" {manipulate_corporative_information}></td> 80 </tr> 81 <tr bgcolor="{color_font1}" align='right'> 78 82 <td>{lang_view_user}:</td> 79 83 <td><input type="checkbox" name="view_users" value="33554432" {view_users}></td> … … 90 94 <td>{lang_set_user_default_password}:</td> 91 95 <td><input type="checkbox" name="set_user_default_password" value="524288" {set_user_default_password}></td> 96 </tr> 97 <tr bgcolor="{color_font1}" align='right'> 98 <td>{lang_empty_user_inbox}:</td> 99 <td><input type="checkbox" name="empty_user_inbox" value="134217728" {empty_user_inbox}></td> 92 100 </tr> 93 101 -
trunk/expressoMail1_2/inc/class.imap_functions.inc.php
r53 r63 657 657 $tag_list = Array('head','blink','object','frame', 658 658 'iframe','layer','ilayer','plaintext','script', 659 'applet','embed','frameset','xml','xmp' );659 'applet','embed','frameset','xml','xmp','style'); 660 660 661 661 $body = $this-> replace_links($body); … … 1051 1051 $attachments = $params['FILES']; 1052 1052 $forwarding_attachments = $params['forwarding_attachments']; 1053 1053 1054 $folder =$params['folder']; 1054 1055 $folder = mb_convert_encoding($folder, "UTF7-IMAP","ISO_8859-1"); … … 1142 1143 foreach($forwarding_attachments as $forwarding_attachment) 1143 1144 { 1144 $tmp_forwarding_attachment = str_replace("'", "", $forwarding_attachment); 1145 $file_description = explode(",", $tmp_forwarding_attachment); 1145 $file_description = unserialize(rawurldecode($forwarding_attachment)); 1146 foreach($file_description as $i => $descriptor){ 1147 $file_description[$i] = eregi_replace('\'*\'','',$descriptor); 1148 } 1146 1149 $fileContent = $this->get_forwarding_attachment($file_description[0], $file_description[1], $file_description[3],$file_description[4]); 1147 $fileName = rawurldecode($file_description[2]);1150 $fileName = $file_description[2]; 1148 1151 if(!array_search(trim($fileName),$name_cid_files)) { 1149 1152 $mail->AddStringAttachment($fileContent, $fileName, $file_description[4], $this->get_file_type($file_description[2])); -
trunk/expressoMail1_2/inc/gotodownload.php
r27 r63 32 32 $filename = $idx_file; 33 33 34 $filename = $filename ? $filename : "attachment.bin"; 35 $newfilename = $newfilename ? $newfilename : $filename; 34 36 $strFileType = strrev(substr(strrev(strtolower($filename)),0,4)); 35 36 downloadFile($strFileType, $filename, $newfilename ? $newfilename : $filename, $fileContent, $encoding);37 38 downloadFile($strFileType, $filename, $newfilename, $fileContent, $encoding); 37 39 38 40 function downloadFile($strFileType, $strFileName, $newFileName, $fileContent, $encoding) { -
trunk/expressoMail1_2/js/InfoContact.js
r54 r63 1 function emInfoContact()1 function emInfoContact() 2 2 { 3 3 this.email = ""; … … 139 139 140 140 var status = IM.infoContact(uid); 141 var _return = '<br/> <br/>';141 var _return = '<br/>'; 142 142 143 143 if ( status ) -
trunk/expressoMail1_2/js/TreeShow.js
r53 r63 58 58 Tree_Box.prototype.verify = function(exp) 59 59 { 60 //var reTipo = /^[A-Z-a-z-0-9-_]+$/; 61 //if(reTipo.test(exp)){return true;} 62 //else{return false;} 60 var reTipo = /^(.*)(\/)(.*)$/; 61 62 if(reTipo.test(exp)){ 63 return false; 64 } 63 65 return true; 64 66 } -
trunk/expressoMail1_2/js/draw_api.js
r61 r63 934 934 to_values.id = "to_values_"+ID; 935 935 to_values.type = "HIDDEN"; 936 to_values.value = info_msg.toaddress2; //Veio do IMAP, sem images nem links. 937 936 to_values.value = info_msg.toaddress2; //Veio do IMAP, sem images nem links. 937 938 // Salva a pasta da mensagem 939 var input_current_folder = document.createElement('input'); 940 input_current_folder.id = "input_folder_"+ID; 941 input_current_folder.name = "input_folder"; 942 input_current_folder.type = "hidden"; 943 input_current_folder.value = info_msg.msg_folder; 944 td2.appendChild(input_current_folder); 945 // fim 938 946 toaddress_array[ID] = info_msg.toaddress2.split(","); 939 947 if (toaddress_array[ID].length > 1){ … … 1220 1228 td_from.setAttribute("noWrap","true"); 1221 1229 td_from.style.width = "100%"; 1222 1230 1223 1231 var sel_from = document.createElement('SELECT'); 1224 1232 sel_from.id = "from_"+ID; … … 1530 1538 input_return_receipt.name = "input_return_receipt"; 1531 1539 input_return_receipt.setAttribute("tabIndex","-1"); 1532 td_return_receipt.appendChild(input_return_receipt); 1540 td_return_receipt.appendChild(input_return_receipt); 1533 1541 tr5.appendChild(td5); 1534 1542 tr5.appendChild(td_return_receipt); -
trunk/expressoMail1_2/js/main.js
r61 r63 240 240 241 241 function new_message(type, border_ID){ 242 var new_border_ID = draw_new_message(); 242 var new_border_ID = draw_new_message(); 243 // Salva a pasta da mensagem respondida ou encaminhada: 244 var folder_message = Element("input_folder_"+border_ID); 245 if(folder_message) { 246 var input_current_folder = document.createElement('input'); 247 input_current_folder.id = "new_input_folder_"+border_ID; 248 input_current_folder.name = "input_folder"; 249 input_current_folder.type = "hidden"; 250 input_current_folder.value = folder_message.value; 251 Element("content_id_" + new_border_ID).appendChild(input_current_folder); 252 }//Fim. 243 253 var title = ''; 244 254 data = []; … … 393 403 tmp = link_attachment.innerHTML.substring(0,link_attachment.innerHTML.lastIndexOf("(")); 394 404 a_tmp[2] = "'"+tmp.substring(0,tmp.length-1)+"'"; 395 divFiles.innerHTML += "<input style='border:0' type='CHECKBOX' name='forwarding_attachments[]' checked value=\""+a_tmp.join(',')+"\"/>"; 405 s_tmp = escape(connector.serialize(a_tmp)); 406 divFiles.innerHTML += "<input style='border:0' type='CHECKBOX' name='forwarding_attachments[]' checked value=\""+s_tmp+"\"/>"; 396 407 divFiles.appendChild(link_attachment); 397 408 } … … 585 596 586 597 for (var i=0; i<msgs_to_set.length; i++){ 587 switch(data.flag){ 588 case "unseen": 589 set_msg_class_to_unread(msgs_to_set[i]); 590 Element("check_box_message_" + msgs_to_set[i]).checked = false; 591 break; 592 case "seen": 593 set_msg_class_to_read(msgs_to_set[i], false); 594 Element("check_box_message_" + msgs_to_set[i]).checked = false; 595 break; 596 case "flagged": 597 set_msg_class_to_flagged(msgs_to_set[i]); 598 document.getElementById("check_box_message_" + msgs_to_set[i]).checked = false; 599 break; 600 case "unflagged": 601 set_msg_class_to_unflagged(msgs_to_set[i]); 602 Element("check_box_message_" + msgs_to_set[i]).checked = false; 603 break; 598 if(Element("check_box_message_" + msgs_to_set[i])){ 599 switch(data.flag){ 600 case "unseen": 601 set_msg_class_to_unread(msgs_to_set[i]); 602 Element("check_box_message_" + msgs_to_set[i]).checked = false; 603 break; 604 case "seen": 605 set_msg_class_to_read(msgs_to_set[i], false); 606 Element("check_box_message_" + msgs_to_set[i]).checked = false; 607 break; 608 case "flagged": 609 set_msg_class_to_flagged(msgs_to_set[i]); 610 document.getElementById("check_box_message_" + msgs_to_set[i]).checked = false; 611 break; 612 case "unflagged": 613 set_msg_class_to_unflagged(msgs_to_set[i]); 614 Element("check_box_message_" + msgs_to_set[i]).checked = false; 615 break; 616 } 604 617 } 605 618 } … … 607 620 } 608 621 622 var folder = get_current_folder(); 609 623 if (msgs_to_set == 'get_selected_messages') 610 624 var msgs_to_set = this.get_selected_messages(); 625 else 626 folder = Element("input_folder_"+msgs_to_set+"_r").value; 611 627 612 628 if (msgs_to_set) 613 cExecute ("$this.imap_functions.set_messages_flag&folder="+ get_current_folder()+"&msgs_to_set="+msgs_to_set+"&flag="+flag, handler_set_messages_flag);629 cExecute ("$this.imap_functions.set_messages_flag&folder="+folder+"&msgs_to_set="+msgs_to_set+"&flag="+flag, handler_set_messages_flag); 614 630 else 615 631 write_msg(get_lang('No selected message.')); … … 618 634 // By message number 619 635 function set_message_flag(msg_number, flag){ 636 var msg_number_folder = Element("new_input_folder_"+msg_number+"_r"); 620 637 var handler_set_messages_flag = function (data){ 621 638 if(!verify_session(data)) 622 639 return; 623 if (data.status ) {640 if (data.status && Element("td_message_answered_"+msg_number)) { 624 641 if(flag == 'answered') 625 642 Element("td_message_answered_"+msg_number).innerHTML = '<img src=templates/default/images/answered.gif title=Respondida>'; … … 628 645 } 629 646 } 630 cExecute ("$this.imap_functions.set_messages_flag&folder="+ get_current_folder()+"&msgs_to_set="+msg_number+"&flag="+flag, handler_set_messages_flag);647 cExecute ("$this.imap_functions.set_messages_flag&folder="+( msg_number_folder ? msg_number_folder.value : get_current_folder() )+"&msgs_to_set="+msg_number+"&flag="+flag, handler_set_messages_flag); 631 648 } 632 649 -
trunk/instant_messenger/IMManager.php
r55 r63 1 1 #!/usr/bin/php -Cq 2 2 <?php 3 //error_reporting(0); 4 //ini_set( 'track_errors', '1' ); 5 ### 6 # This file is prepared for receive dependable connections but 7 # exists a BUG in the PHP related with the library OpenSSL that 8 # doesn't permit the enable crypto in connection created. 9 # 10 # See [Bug #40993 stream_socket_accept() : accept failed] in 11 # http://bugs.php.net/bug.php?id=40993&edit=1 12 # 13 # 14 ### 3 15 4 require_once('inc/IMConfigure.php'); 16 5 … … 18 7 # definitions of socket - BEGIN 19 8 # 20 /***21 * This file is prepared for receive dependable connections but22 * exists a BUG in the PHP related with the library OpenSSL that23 * doesn't permit the enable crypto in connection created.24 *25 * See [Bug #40993 stream_socket_accept() : accept failed] in26 * http://bugs.php.net/bug.php?id=40993&edit=127 *28 *29 * It's necessary to remove all the comments made with '//'30 * for safe connection31 *32 *33 * WARNING - DANGER:34 *35 * Before remove all the comments made with '//' for safe36 * connection, it's necessary to remove all the comments37 * made with '//' in the file IMConfigure.php38 * If this will not be made will happen many ERRORS39 ***/40 41 //define("CONTEXT", stream_context_create());42 43 9 define('URI', '0.0.0.0'); 44 45 10 define('TARGET_NON_SECURITY', TRANSPORT_NON_SECURITY . '://' . URI . ':' . PORT_NON_SECURITY); 46 //define('TARGET_SECURITY', TRANSPORT_SECURITY . '://' . URI . ':' . PORT_SECURITY);47 48 //stream_context_set_option(CONTEXT, 'ssl', 'local_cert', './apache.pem'); # local_cert must be in PEM format49 //stream_context_set_option(CONTEXT, 'ssl', 'allow_self_signed', true);50 //stream_context_set_option(CONTEXT, 'ssl', 'verify_peer', false);51 52 11 define('SOCKET_NON_SECURITY', stream_socket_server(TARGET_NON_SECURITY, $errno_non_security, $errstr_non_security, STREAM_SERVER_BIND | STREAM_SERVER_LISTEN)); 53 //define('SOCKET_SECURITY', stream_socket_server(TARGET_SECURITY, $errno_security, $errstr_security, STREAM_SERVER_BIND | STREAM_SERVER_LISTEN, CONTEXT));54 12 # 55 13 # definitions of socket - END 56 14 ### 57 15 58 //if ( !SOCKET_NON_SECURITY || !SOCKET_SECURITY ) # It's necessary to remove the next line for safe connection 16 59 17 if ( !SOCKET_NON_SECURITY ) 60 18 { 61 19 printf("NON SECURITY:\n(%d) %s", $errno_non_security, $errstr_non_security); 62 //printf("SECURITY:\n(%d) %s", $errno_security, $errstr_security);63 20 exit(0); 64 21 } … … 66 23 include 'inc/Jabberd2.abstract.php'; 67 24 68 //$master = array(SOCKET_NON_SECURITY, SOCKET_SECURITY); # It's necessary to remove the next line for safe connection69 25 $master = array(SOCKET_NON_SECURITY); 70 26 … … 79 35 $_e = NULL; 80 36 81 $mod_fd = @stream_select($read, $_w , $_e , READ_SOCKET_AFTER_OF );37 $mod_fd = @stream_select($read, $_w , $_e , READ_SOCKET_AFTER_OF ); 82 38 83 39 if ( $mod_fd === FALSE ) … … 85 41 86 42 for ( $i = 0; $i < $mod_fd; ++$i ) 43 { 87 44 if ( $read[$i] === SOCKET_NON_SECURITY ) 88 45 { 89 46 $conn_non_security = stream_socket_accept(SOCKET_NON_SECURITY); 90 # fwrite($conn_non_security, "Hello! The time is " . date("n/j/Y g:i:s a"));91 47 $master[] = &$conn_non_security; 92 48 } 93 //else if ( $read[$i] === SOCKET_SECURITY )94 //{95 // $conn_security = stream_socket_accept(SOCKET_SECURITY);96 // fwrite($conn_security, "Hello! The time is " . date("n/j/Y g:i:s a")."\n");97 // $master[] = &$conn_security;98 //}99 49 else 100 50 { … … 102 52 if ( strlen($sock_data) === 0 ) 103 53 { 104 printf("Connection closed");105 54 $key_to_del = array_search($read[$i], $master, TRUE); 106 55 fclose($read[$i]); … … 109 58 else if ( $sock_data === FALSE ) 110 59 { 111 printf("Something bad happened");112 60 $key_to_del = array_search($read[$i], $master, TRUE); 113 61 unset($master[$key_to_del]); … … 115 63 else 116 64 { 117 # printf("\n\n%s\n\n", $sock_data);118 65 $headers = (split("\n", $sock_data)); 119 66 … … 121 68 preg_match('/^Host: \w*:(.+)/', $headers[1], $host); 122 69 123 //if ( (int)$host[1] == PORT_NON_SECURITY ) 124 $conn = &$conn_non_security; 125 //else 126 // $conn = &$conn_security; 70 $conn = &$conn_non_security; 127 71 128 72 $request = explode(';', $request[2]); 129 73 130 74 if ( $request[0] == CONNECT && isset($request[1]) && !isset($users[$request[1]]) ) 75 { 131 76 connect($users, $request[1]); 77 } 132 78 133 79 if ( $request[0] == CLOSE && isset($request[1]) && isset($users[$request[1]]) ) 134 close($request[1]); 80 { 81 close($request[1]); 82 } 135 83 136 84 fclose($read[$i]); … … 138 86 } 139 87 } 140 88 } 89 141 90 foreach ( $users as $key => $val ) 142 91 { 143 if ( (time() - $users[$key]['time'] > DISCONNECT_AFTERWARDS_OF) ) 144 if ( $users[$key]['attempt'] > 2 ) 145 { 146 $users[$key]['attempt'] = 0; 147 close($key); 148 } 149 else 150 { 151 $users[$key]['attempt']++; 152 readSocket($users, $key); 153 } 92 if($users[$key]['time0'] != $users[$key]['time1'] ) 93 { 94 $users[$key]['time1'] = $users[$key]['time0']; 95 $users[$key]['attempt'] = 0; 96 readSocket($key); 97 //readSocket($users, $key); 98 } 154 99 else 155 100 { 156 $users[$key]['attempt'] = 0; 157 readSocket($users, $key); 158 } 101 $users[$key]['attempt']++; 102 if( $users[$key]['attempt'] > 5 ) 103 { 104 $users[$key]['jabber']->disconnect(); 105 unset($users[$key]); 106 } 107 else 108 { 109 readSocket($key); 110 //readSocket($users, $key); 111 } 112 } 113 114 //print_r("Session : " . $key . " | Count : " . count($users) . " | time 0 : " . $users[$key]['time0'] . " | time 1 : " . $users[$key]['time1'] . " | tentativas : " . $users[$key]['attempt'] . " \n"); 159 115 } 160 116 161 //print_r($users);162 } 163 117 } 118 119 164 120 exit(0); 165 121 122 166 123 function connect(&$pUsers, $pSession) 167 124 { … … 203 160 $pUsers[$pSession] = array(); 204 161 $pUsers[$pSession]['jabber'] = $a; 205 $pUsers[$pSession]['time'] = $_time; 162 $pUsers[$pSession]['time0'] = $_time; 163 $pUsers[$pSession]['time1'] = 0; 206 164 $pUsers[$pSession]['attempt'] = 0; 207 165 } … … 224 182 } 225 183 226 function readSocket(&$pUsers, $pSession) 227 { 184 //function readSocket(&$pUsers, $pSession) 185 function readSocket($pSession) 186 { 187 global $users; 228 188 global $send; 229 189 $sessionpath = explode(';', session_save_path()); … … 244 204 if ( $is_user ) 245 205 { 246 $ pUsers[$pSession]['time'] = $_SESSION['phpgw_info']['instant_messenger']['time'];247 $readSocket = @$pUsers[$pSession]['jabber']->readSocket();206 $users[$pSession]['time0'] = $_SESSION['phpgw_info']['instant_messenger']['time']; 207 $readSocket = $users[$pSession]['jabber']->readSocket(); 248 208 249 209 if ( $readSocket !== false ) … … 261 221 if ( !is_null($value) ) 262 222 { 263 $ pUsers[$pSession]['jabber']->writeSocket($value);223 $users[$pSession]['jabber']->writeSocket($value); 264 224 $_SESSION['phpgw_info']['instant_messenger']['socket']['out']['message'] = NULL; 265 225 } … … 271 231 foreach ( $value as $key => $val ) 272 232 { 273 $ pUsers[$pSession]['jabber']->getVcard($val);233 $users[$pSession]['jabber']->getVcard($val); 274 234 unset($_SESSION['phpgw_info']['instant_messenger']['socket']['out']['vcard'][$key]); 275 235 } … … 278 238 else 279 239 { 280 if ( method_exists($ pUsers[$pSession]['jabber'], $action) )240 if ( method_exists($users[$pSession]['jabber'], $action) ) 281 241 if ( $value ) 282 $ pUsers[$pSession]['jabber']->$action($value);242 $users[$pSession]['jabber']->$action($value); 283 243 else 284 $ pUsers[$pSession]['jabber']->$action();244 $users[$pSession]['jabber']->$action(); 285 245 unset($_SESSION['phpgw_info']['instant_messenger']['socket']['out'][$action]); 286 246 } -
trunk/instant_messenger/docs/change_log.txt
r60 r63 19 19 - Corrigido a mudança de status automática 20 20 - Layout do adicionar contato não gera mais scrolls 21 22 23/08/2007 23 - Arrumado o tipo de cursor no IE na mudança de Status -
trunk/instant_messenger/inc/IMConfigure.php
r55 r63 15 15 # 16 16 define('DISCONNECT_AFTERWARDS_OF', 20); 17 define('READ_SOCKET_AFTER_OF', 1);17 define('READ_SOCKET_AFTER_OF', 2); 18 18 # 19 19 # definitions of time - END -
trunk/instant_messenger/inc/Socket.abstract.php
r55 r63 18 18 abstract class Socket 19 19 { 20 private $log_file = false;21 22 20 protected final function open( $pSocket = false, $pTimeOut = 1, $pBlockingMode = 0 ) 23 21 { … … 54 52 set_magic_quotes_runtime(get_magic_quotes_gpc()); 55 53 56 if( $this->log_file )57 {58 if ( !empty($return) && $fp = fopen ('read.log', "a+") )59 {60 fwrite($fp, $return . "\n");61 fclose($fp);62 }63 }64 54 65 55 if ( $php_errormsg ) … … 77 67 return false; 78 68 79 if( $this->log_file) 80 { 81 if ( $fp = fopen ('write.log', "a+") ) 82 { 83 fwrite($fp, $pData . "\n"); 84 fclose($fp); 85 } 86 } 87 88 $return = @fwrite($pSocket, $pData); 69 $return = @fwrite($pSocket, $pData); 89 70 90 71 if ( $php_errormsg ) -
trunk/instant_messenger/inc/class.Ujabber.inc.php
r57 r63 11 11 $return = null; 12 12 13 $_SESSION['phpgw_info']['instant_messenger']['time'] = time(); 14 13 $_SESSION['phpgw_info']['instant_messenger']['time'] = time(); 15 14 $_SESSION['phpgw_info']['instant_messenger']['socket']['block'] = true; 16 15 $xml = $_SESSION['phpgw_info']['instant_messenger']['socket']['in']; -
trunk/instant_messenger/inc/im_acl.inc.php
r59 r63 92 92 */ 93 93 94 }else{95 $user = "niltonneto";96 97 if(trim($_SESSION['phpgw_info']['instant_messenger']['user']) == $user)98 {99 ini_set ( "session.save_path", "/php_sessions/");100 $path = ini_get("session.save_path");101 102 $log = date('m/d/Y H:i:s'). " - Erro na conexao com: ". $SERVER . " - Erros : " . $errstr . " : " . $errno. "\n";103 104 $ff = fopen ($path."conexao_jabber.log", "a+");105 if ( $ff )106 {107 fwrite($ff, $log);108 fclose($ff);109 }110 }111 94 } 95 112 96 break; 113 97 } -
trunk/instant_messenger/js/im_functions.js
r57 r63 749 749 750 750 func.confEl(option1_image, 'src', img_available.src); 751 func.confEl(option1_image, 'style', 'width:16px;height:16px; ');751 func.confEl(option1_image, 'style', 'width:16px;height:16px;cursor:pointer;'); 752 752 func.confEl(option2_image, 'src', img_xa.src); 753 func.confEl(option2_image, 'style', 'width:16px;height:16px; ');753 func.confEl(option2_image, 'style', 'width:16px;height:16px;cursor:pointer;'); 754 754 func.confEl(option3_image, 'src', img_dnd.src); 755 func.confEl(option3_image, 'style', 'width:16px;height:16px; ');755 func.confEl(option3_image, 'style', 'width:16px;height:16px;cursor:pointer;'); 756 756 func.confEl(option4_image, 'src', img_unavailable.src); 757 func.confEl(option4_image, 'style', 'width:16px;height:16px; ');757 func.confEl(option4_image, 'style', 'width:16px;height:16px;cursor:pointer;'); 758 758 func.confEl(option5_image, 'src', img_edit.src); 759 func.confEl(option5_image, 'style', 'width:16px;height:16px; ');759 func.confEl(option5_image, 'style', 'width:16px;height:16px;cursor:pointer;'); 760 760 761 761 func.insEl(option1_image, IM.get_lang('online'), option1_link); 762 func.confEl(option1_link, 'style','cursor:pointer;'); 762 763 func.insEl(option1_link, option1); 764 763 765 func.insEl(option2_image, IM.get_lang('away'), option2_link); 766 func.confEl(option2_link, 'style','cursor:pointer;'); 764 767 func.insEl(option2_link, option2); 768 765 769 func.insEl(option3_image, IM.get_lang('busy'), option3_link); 770 func.confEl(option3_link, 'style','cursor:pointer;'); 766 771 func.insEl(option3_link, option3); 772 767 773 func.insEl(option4_image, IM.get_lang('offline'), option4_link); 774 func.confEl(option4_link, 'style','cursor:pointer;'); 768 775 func.insEl(option4_link, option4); 776 769 777 func.insEl(option5_image, IM.get_lang('Custom message...'), option5_link); 778 func.confEl(option5_link, 'style','cursor:pointer;'); 770 779 func.insEl(option5_link, option5); 771 780 -
trunk/instant_messenger/js/im_win.js
r60 r63 102 102 params['body'] = main_menu_all; 103 103 params['close'] = true; 104 params['height'] = 2 60;104 params['height'] = 270; 105 105 params['left'] = 10; 106 106 params['id'] = pId; 107 107 params['maximize'] = true; 108 108 params['style'] = 'visibility:hidden'; 109 params['title'] = ".: " + IM.get_lang("instant_messenger") + " :.";109 params['title'] = 'Expresso Messenger'; 110 110 params['top'] = 10; 111 params['width'] = 2 00;111 params['width'] = 210; 112 112 this.build(params); 113 113 -
trunk/instant_messenger/templates/default/css.css
r55 r63 72 72 .im-window-resizehandle 73 73 { 74 position: absolute;75 overflow: hidden;74 position: relative; 75 overflow: auto; 76 76 width: 15px; 77 77 height: 15px; -
trunk/instant_messenger/templates/default/index.tpl
r60 r63 53 53 <br> 54 54 55 Para acessar o menu "Opções" ( conforme figura 2 ), basta dar um clique com o mouse e abrirá um amenu com as opções de Adicionar Contato ( <b>veja <a href="#useradd">Adicionando um novo contato</a></b> ), Remover Contato ( <b>veja <a href="#userdel">Removendo um contato</a></b> ),55 Para acessar o menu "Opções" ( conforme figura 2 ), basta dar um clique com o mouse e abrirá um menu com as opções de Adicionar Contato ( <b>veja <a href="#useradd">Adicionando um novo contato</a></b> ), Remover Contato ( <b>veja <a href="#userdel">Removendo um contato</a></b> ), 56 56 Informações Adicionais ( <b>veja <a href="#info_ad">Informações Adicionais</a></b> ) e Preferências ( <b>veja <a href="#info_prefe">Preferências</a></b> ). 57 57 … … 114 114 também possui esta opção ( <b>veja <a href="#menu_right">Preferências Avançadas</a></b>, opção Ver Info). 115 115 116 <h2><a name="info_prefe">6. Preferências</a></h2> 117 ( figura 5 ) 118 <img src="templates/default/images/preferencias.png" width="356" height="270" alt="Preferências" align="left"> 119 <br clear="all"> 120 <br> 121 122 Personalize seu tempo para ficar ausente, se em sua lista de contato aparecerá seus contatos offline e um tipo de aviso para uma nova mensagem. 123 116 124 <h2><a name="troca_mens">7. Troca de Mensagens</a></h2> 117 ( figura 5)125 ( figura 6 ) 118 126 <img src="templates/default/images/troca_mensagem.png" width="332" height="272" alt="Troca de Mensagens" align="left"> 119 127 <br clear="all"> … … 124 132 125 133 <h2><a name="troca_status">8. Troca de Status</a></h2> 126 ( figura 6)134 ( figura 7 ) 127 135 <img src="templates/default/images/troca_status.png" width="449" height="313" alt="Troca de Status" align="left"> 128 136 <br clear="all"> -
trunk/instant_messenger/xsl/window.xsl
r60 r63 19 19 <div class="im-windowfantom-des" id="{@id}_im_window_fantom" /> 20 20 <div class="im-windowfantom-des" id="{@id}_im_window_movable" /> 21 <div class="im-window-resizehandle" id="{@id}_im_window_resize" />21 <div class="im-window-resizehandle" id="{@id}_im_window_resize" style="visibility:hidden;" /> 22 22 </body> 23 23 </html> -
trunk/phpgwapi/inc/class.common.inc.php
r62 r63 1459 1459 if (!$t || (int)$t <= 0) 1460 1460 { 1461 $t."GMT";1462 1461 $t = $GLOBALS['phpgw']->datetime->gmtnow; 1463 1462 } 1464 else1465 $t."Não GMT";1466 1463 // + (date('I') == 1?3600:0) 1467 1464 $t += $GLOBALS['phpgw']->datetime->tz_offset; 1468 1465 1469 1466 if (! $format) 1470 1467 { … … 1479 1476 } 1480 1477 } 1478 1481 1479 if((PHP_OS == 'Windows' || PHP_OS == 'WINNT') && (int)$t < 21600) 1482 1480 /*if(PHP_OS == 'Windows' && (int)$t < 21600)*/
Note: See TracChangeset
for help on using the changeset viewer.