Changeset 63


Ignore:
Timestamp:
08/29/07 08:55:50 (17 years ago)
Author:
niltonneto
Message:

* empty log message *

Location:
trunk
Files:
1 added
30 edited

Legend:

Unmodified
Added
Removed
  • trunk/expressoAdmin1_2/docs/change_log.txt

    r62 r63  
    8787- Corrigido bug ao adicionar email em grupos 
    8888- Corrigido bug ao adicionar atributos samba a um usuários já existente. 
     89 
     9014/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  
    3030                        'lid'                                           => $_POST['manager_lid'], 
    3131                        'context'                                       => $_POST['context'], 
     32                         
    3233                        'add_users'                                     => $_POST['add_users'], 
    3334                        'edit_users'                            => $_POST['edit_users'], 
     
    3536                        'rename_users'                          => $_POST['rename_users'], 
    3637                        'view_users'                            => $_POST['view_users'], 
     38                        'manipulate_corporative_information' => $_POST['manipulate_corporative_information'], 
    3739                        'add_groups'                            => $_POST['add_groups'], 
    3840                        'edit_groups'                           => $_POST['edit_groups'], 
     
    4244                        'change_users_quote'            => $_POST['change_users_quote'], 
    4345                        'set_user_default_password'     => $_POST['set_user_default_password'], 
     46                        'empty_user_inbox'                      => $_POST['empty_user_inbox'], 
    4447                        'edit_sambausers_attributes'=> $_POST['edit_sambausers_attributes'], 
    4548                        'edit_sambadomains'                     => $_POST['edit_sambadomains'], 
     
    5457                        'create_computers'                      => $_POST['create_computers'], 
    5558                        'edit_computers'                        => $_POST['edit_computers'], 
    56                         'delete_computers'                      => $_POST['delete_computers'],                   
     59                        'delete_computers'                      => $_POST['delete_computers'], 
     60                                         
    5761                        'apps'                                          => $_POST['applications_list'] 
    5862                        ); 
     
    6064                        // Soma os niveis de acesso criando uma ACL 
    6165                        $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']; 
    6367                        $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']; 
    6569                        $acl = $acl + $manager['edit_sambausers_attributes'] + $manager['edit_sambadomains']; 
    6670                        $acl = $acl + $manager['add_email_lists'] + $manager['edit_email_lists'] + $manager['delete_email_lists']; 
     
    102106                        'lid'                                           => $_POST['manager_lid'], 
    103107                        'context'                                       => $_POST['context'], 
     108                         
    104109                        'add_users'                                     => $_POST['add_users'], 
    105110                        'edit_users'                            => $_POST['edit_users'], 
     
    107112                        'rename_users'                          => $_POST['rename_users'], 
    108113                        'view_users'                            => $_POST['view_users'], 
     114                        'manipulate_corporative_information' => $_POST['manipulate_corporative_information'], 
    109115                        'add_groups'                            => $_POST['add_groups'], 
    110116                        'edit_groups'                           => $_POST['edit_groups'], 
     
    114120                        'change_users_quote'            => $_POST['change_users_quote'], 
    115121                        'set_user_default_password'     => $_POST['set_user_default_password'], 
     122                        'empty_user_inbox'                      => $_POST['empty_user_inbox'], 
    116123                        'edit_sambausers_attributes'=> $_POST['edit_sambausers_attributes'], 
    117124                        'edit_sambadomains'                     => $_POST['edit_sambadomains'], 
     
    127134                        'edit_computers'                        => $_POST['edit_computers'], 
    128135                        'delete_computers'                      => $_POST['delete_computers'], 
     136                         
    129137                        'apps'                                          => $_POST['applications_list'] 
    130138                        ); 
     
    132140                        // Soma os niveis de acesso criando uma ACL 
    133141                        $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']; 
    135143                        $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']; 
    137145                        $acl = $acl + $manager['edit_sambausers_attributes'] + $manager['edit_sambadomains']; 
    138146                        $acl = $acl + $manager['add_email_lists'] + $manager['edit_email_lists'] + $manager['delete_email_lists']; 
  • trunk/expressoAdmin1_2/inc/class.functions.inc.php

    r62 r63  
    6666                                                return true; 
    6767                                        break; 
     68                                case manipulate_corporative_information: 
     69                                        if ($array_acl[manipulate_corporative_information]) 
     70                                                return true; 
     71                                        break; 
    6872                                case change_users_password: 
    6973                                        if ($array_acl[change_users_password]) 
     
    7680                                case set_user_default_password: 
    7781                                        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])) 
    7886                                                return true; 
    7987                                        break; 
     
    186194                 
    187195                // 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 
    189197                function make_array_acl($acl) 
    190198                { 
     
    194202                        $array_acl['rename_users'] = $acl & 8388608; 
    195203                        $array_acl['view_users'] = $acl & 33554432; 
     204                        $array_acl['manipulate_corporative_information'] = $acl & 268435456; 
    196205                        $array_acl['add_groups'] = $acl & 16; 
    197206                        $array_acl['edit_groups'] = $acl & 32; 
     
    201210                        $array_acl['change_users_quote'] = $acl & 262144; 
    202211                        $array_acl['set_user_default_password'] = $acl & 524288; 
     212                        $array_acl['empty_user_inbox'] = $acl & 134217728; 
    203213                        $array_acl['edit_sambausers_attributes'] = $acl & 32768; 
    204214                        $array_acl['edit_sambadomains'] = $acl & 16777216; 
  • trunk/expressoAdmin1_2/inc/class.imap_functions.inc.php

    r62 r63  
    11<?php 
     2 
     3include_once('class.functions.inc.php'); 
    24 
    35class imap_functions 
    46{ 
     7        var $functions; 
    58        var $imap; 
    69        var $imapDelimiter; 
     
    1720                $this->imapDelimiter= $_SESSION['phpgw_info']['expresso']['email_server']['imapDelimiter']; 
    1821                $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; 
    1923        } 
    2024         
     
    7276                else 
    7377                { 
    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); 
    7680                } 
    7781                         
     
    116120                return $result; 
    117121        } 
     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        } 
    118181} 
  • trunk/expressoAdmin1_2/inc/class.ldap_functions.inc.php

    r62 r63  
    33define('PHPGW_API_INC','../phpgwapi/inc');       
    44include_once(PHPGW_API_INC.'/class.common.inc.php'); 
     5include_once('class.functions.inc.php'); 
    56 
    67class ldap_functions 
     
    89        var $ldap; 
    910        var $current_config; 
     11        var $functions; 
    1012         
    1113        function ldap_functions(){ 
     
    1416                $common = new common(); 
    1517                $this->ldap = $common->ldapConnect(); 
     18                $this->functions = new functions; 
    1619        } 
    1720         
    1821        function validate_fields($params) 
    1922        { 
     23                $result['status'] = true; 
    2024                $params = unserialize($params['attributes']); 
    2125                $type = $params['type']; 
     
    2428                $mail = $params['mail']; 
    2529                $mailalternateaddress = $params['mailalternateaddress']; 
    26  
    27                 $result['status'] = true; 
    28                  
     30                                 
    2931                if ($_SESSION['phpgw_info']['expresso']['global_denied_users'][$uid]) 
    3032                { 
     
    657659                        array_pop($a_tmp); 
    658660                        $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]; 
    659670                } 
    660671                 
  • trunk/expressoAdmin1_2/inc/class.uiaccounts.inc.php

    r62 r63  
    242242                                'display_spam_uid'                              => 'display:none', 
    243243                                'lang_general_information'              => lang('General Information'), 
     244                                'lang_corporative_information'  => lang('Corporative Information'), 
    244245                                'lang_email_config'                             => lang('Email Config'), 
    245246                                'lang_groups_permission'                => lang('Groups Permission'), 
     
    274275                                'ldap_context'                                  => ldap_dn2ufn($GLOBALS['phpgw_info']['server']['ldap_context']), 
    275276                                 
     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                                 
    276284                                //MAIL 
    277285                                'lang_activeemailaccount'               => lang('Active email account'), 
     
    305313                                 
    306314                                //SAMBA ABA 
     315                                'display_samba_suport'                          => $this->functions->check_acl($manager_lid,'edit_sambausers_attributes') ? '' : 'none', 
    307316                                'lang_samba_config'                                     => lang('Samba Config'), 
    308317                                'lang_use_attrs_samba'                          => lang('Use samba attributes'), 
     
    536545                                'display_input_account_lid'             => 'display:none', 
    537546                                'lang_general_information'              => lang('General Information'), 
     547                                'lang_corporative_information'  => lang('Corporative Information'), 
    538548                                'lang_email_config'                             => lang('Email Config'), 
    539549                                'lang_groups_permission'                => lang('Groups Permission'), 
     
    572582                                'phpgwaccountvisible_checked'   => $user_info['phpgwaccountvisible'] == '-1' ? 'CHECKED' : '', 
    573583 
    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 
    575596                                'disabled_quota_used'                   => 'disabled', 
    576597                                'lang_activeemailaccount'               => lang('Active email account'), 
  • trunk/expressoAdmin1_2/inc/class.uimanagers.inc.php

    r62 r63  
    207207                                'lang_rename_user'                              => lang('Rename users'), 
    208208                                'lang_view_user'                                => lang('View users'), 
     209                                'lang_manipulate_corporative_information' => lang('Manipulate corporative information'), 
    209210                                'lang_add_groups'                               => lang('Add groups'), 
    210211                                'lang_edit_groups'                              => lang('Edit groups'), 
     
    214215                                'lang_change_users_quote'               => lang('Change users quote'), 
    215216                                'lang_set_user_default_password'=> lang('Set default users password'), 
     217                                'lang_empty_user_inbox'                 => lang('Empty user inbox'), 
    216218                                'lang_edit_sambausers_attributes'=> lang('Edit SAMBA users attributes'), 
    217219                                'lang_edit_sambadomains'                => lang('Edit SAMBA domains'), 
     
    233235                                'add_users'                                     => $_POST['add_users'] != '' ? 'checked' : '', 
    234236                                'edit_users'                                    => $_POST['edit_users'] != '' ? 'checked' : '', 
     237                                'view_users'                                    => $_POST['view_users'] != '' ? 'checked' : '', 
     238                                'manipulate_corporative_information' => $_POST['manipulate_corporative_information'] != '' ? 'checked' : '', 
    235239                                'delete_users'                                  => $_POST['delete_users'] != '' ? 'checked' : '', 
    236240                                'add_groups'                                    => $_POST['add_groups'] != '' ? 'checked' : '', 
     
    335339                                $_POST['rename_users']                  = $acl['rename_users']; 
    336340                                $_POST['view_users']                    = $acl['view_users']; 
     341                                $_POST['manipulate_corporative_information'] = $acl['manipulate_corporative_information']; 
    337342                                $_POST['add_groups']                    = $acl['add_groups']; 
    338343                                $_POST['edit_groups']                   = $acl['edit_groups']; 
     
    342347                                $_POST['change_users_quote']    = $acl['change_users_quote']; 
    343348                                $_POST['set_user_default_password']     = $acl['set_user_default_password']; 
     349                                $_POST['empty_user_inbox']              = $acl['empty_user_inbox']; 
    344350                                $_POST['edit_sambausers_attributes'] = $acl['edit_sambausers_attributes']; 
    345351                                $_POST['edit_sambadomains']     = $acl['edit_sambadomains']; 
     
    453459                                'lang_rename_user'                              => lang('Rename users'), 
    454460                                'lang_view_user'                                => lang('View users'), 
     461                                'lang_manipulate_corporative_information' => lang('Manipulate corporative information'), 
    455462                                'lang_add_groups'                               => lang('Add groups'), 
    456463                                'lang_edit_groups'                              => lang('Edit groups'), 
     
    460467                                'lang_change_users_quote'               => lang('Change users quote'), 
    461468                                'lang_set_user_default_password'=> lang('Set default user password'), 
     469                                'lang_empty_user_inbox'                 => lang('Empty user inbox'), 
    462470                                'lang_edit_sambausers_attributes'=> lang('Edit SAMBA users attributes'), 
    463471                                'lang_edit_sambadomains'                => lang('Edit SAMBA domains'), 
     
    483491                                'rename_users'                                  => $_POST['rename_users'] != '' ? 'checked' : '', 
    484492                                'view_users'                                    => $_POST['view_users'] != '' ? 'checked' : '', 
     493                                'manipulate_corporative_information' => $_POST['manipulate_corporative_information'] != '' ? 'checked' : '', 
    485494                                'add_groups'                                    => $_POST['add_groups'] != '' ? 'checked' : '', 
    486495                                'edit_groups'                                   => $_POST['edit_groups'] != '' ? 'checked' : '', 
     
    490499                                'change_users_quote'                    => $_POST['change_users_quote'] != '' ? 'checked' : '', 
    491500                                'set_user_default_password'             => $_POST['set_user_default_password'] != '' ? 'checked' : '', 
     501                                'empty_user_inbox'                              => $_POST['empty_user_inbox'] != '' ? 'checked' : '', 
    492502                                'edit_sambausers_attributes'    => $_POST['edit_sambausers_attributes'] != '' ? 'checked' : '', 
    493503                                'edit_sambadomains'                             => $_POST['edit_sambadomains'] != '' ? 'checked' : '', 
  • trunk/expressoAdmin1_2/inc/class.user.inc.php

    r62 r63  
    117117                                if (($this->current_config['expressoAdmin_samba_support'] == 'true') && ($params['use_attrs_samba'] == 'on')) 
    118118                                { 
    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                                 
    147169                                $result = $this->ldap_functions->ldap_add_entry($dn, $user_info); 
    148170                                if (!$result['status']) 
     
    239261                        $old_values = $this->get_user_info($new_values['uidnumber'], $new_values['manager_context']); 
    240262                        $dn = 'uid=' . $old_values['uid'] . ',' . strtolower($old_values['context']); 
    241                          
     263 
    242264                        $diff = array_diff($new_values, $old_values); 
    243                          
     265 
    244266                        $manager_account_lid = $_SESSION['phpgw_session']['session_lid']; 
    245267                        if ((!$this->functions->check_acl($manager_account_lid,'edit_users')) && 
     
    254276 
    255277                        // 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 gerente 
    262278                        if ($this->functions->check_acl($_SESSION['phpgw_session']['session_lid'], 'edit_users')) 
    263279                        { 
     
    293309                                        $ldap_mod_replace['sn'] = $new_values['sn']; 
    294310                                        $ldap_mod_replace['cn'] = $new_values['givenname'] . ' ' . $new_values['sn']; 
    295                                         $this->db_functions->write_log("alterado sn do usuario",'',$dn,'',''); 
     311                                        $this->db_functions->write_log("altera$ldap_mod_do sn do usuario",'',$dn,'',''); 
    296312                                } 
    297313                                if ($diff['mail']) 
     
    349365                                } 
    350366                        } 
    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                         
    352401                        //Suporte ao SAMBA 
    353402                        if ( ($this->functions->check_acl($_SESSION['phpgw_session']['session_lid'], 'edit_users')) ||  
     
    512561                                } 
    513562                        } 
    514                          
     563 
    515564                        if ( ($this->functions->check_acl($_SESSION['phpgw_session']['session_lid'], 'edit_users')) ||  
    516565                             ($this->functions->check_acl($_SESSION['phpgw_session']['session_lid'], 'edit_sambausers_attributes')) ) 
     
    640689                        if (count($ldap_remove)) 
    641690                        { 
    642                                  
    643691                                $result = $this->ldap_functions->remove_user_attributes($dn, $ldap_remove); 
    644692                                if (!$result['status']) 
     
    727775                        return $return; 
    728776                }                
    729                  
    730777                 
    731778                function get_user_info($uidnumber, $context) 
     
    10761123                        } 
    10771124                } 
     1125                 
     1126                function write_log_from_ajax($params) 
     1127                { 
     1128                        $this->db_functions->write_log($params['_action'],'',$params['userinfo'],'',''); 
     1129                        return true; 
     1130                } 
    10781131        } 
    10791132?> 
  • trunk/expressoAdmin1_2/js/jscode/users.js

    r62 r63  
    4141                return; 
    4242        } 
    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         
    4476        //MAIL 
    4577        document.forms[0].mail.value = document.forms[0].mail.value.toLowerCase(); 
     
    606638        } 
    607639} 
     640 
     641function 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 
     658function 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  
    22 
    33<script type="text/javascript"> 
    4 var tab = new Tabs(6,'activetab','inactivetab','tab','tabcontent','','','tabpage'); 
     4var tab = new Tabs(7,'activetab','inactivetab','tab','tabcontent','','','tabpage'); 
    55function initAll() 
    66{ 
     
    2828        <tr> 
    2929                <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> 
    3536        </tr> 
    3637</table> 
     
    111112</div> 
    112113 
     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 
    113136<!-- The code for Email Config --> 
    114 <div id="tabcontent2" class="inactivetab"> 
     137<div id="tabcontent3" class="inactivetab"> 
    115138        <table width="60%" border="0" cellspacing="4" cellpading="0"> 
    116139                <tr bgcolor={row_off}> 
     
    146169                <tr bgcolor={row_off}> 
    147170                        <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 
    151178        </table> 
    152179</div> 
    153180 
    154181<!-- The code for Group --> 
    155 <div id="tabcontent3" class="inactivetab"> 
     182<div id="tabcontent4" class="inactivetab"> 
    156183        <table width="60%" border="0" cellspacing="4" cellpading="0"> 
    157184                <tr bgcolor={row_on}> 
     
    213240 
    214241<!-- The code for lists Email --> 
    215 <div id="tabcontent4" class="inactivetab"> 
     242<div id="tabcontent5" class="inactivetab"> 
    216243        <table width="60%" border="0" cellspacing="4" cellpading="0"> 
    217244                <tr bgcolor={row_on}> 
     
    265292 
    266293<!-- The code for Apps Tab --> 
    267 <div id="tabcontent5" class="inactivetab"> 
     294<div id="tabcontent6" class="inactivetab"> 
    268295        <table id="ea_table_apps" width="80%" border="0" cellspacing="2" cellpading="0"> 
    269296                {apps} 
     
    272299 
    273300<!-- 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"> 
    275303        <table width="60%" border="0" cellspacing="4" cellpading="0"> 
    276304                <tr bgcolor={row_on}> 
  • trunk/expressoAdmin1_2/templates/default/managers_form.tpl

    r62 r63  
    7676                                                </tr> 
    7777                                                <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'> 
    7882                                                        <td>{lang_view_user}:</td> 
    7983                                                        <td><input type="checkbox" name="view_users" value="33554432" {view_users}></td> 
     
    9094                                                        <td>{lang_set_user_default_password}:</td> 
    9195                                                        <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> 
    92100                                                </tr> 
    93101                                                 
  • trunk/expressoMail1_2/inc/class.imap_functions.inc.php

    r53 r63  
    657657                $tag_list = Array('head','blink','object','frame', 
    658658                        'iframe','layer','ilayer','plaintext','script', 
    659                         'applet','embed','frameset','xml','xmp'); 
     659                        'applet','embed','frameset','xml','xmp','style'); 
    660660 
    661661                $body = $this-> replace_links($body); 
     
    10511051                $attachments = $params['FILES']; 
    10521052                $forwarding_attachments = $params['forwarding_attachments']; 
     1053                  
    10531054                $folder =$params['folder']; 
    10541055                $folder = mb_convert_encoding($folder, "UTF7-IMAP","ISO_8859-1");                
     
    11421143                        foreach($forwarding_attachments as $forwarding_attachment) 
    11431144                        { 
    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                                } 
    11461149                                $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]; 
    11481151                                if(!array_search(trim($fileName),$name_cid_files)) { 
    11491152                                        $mail->AddStringAttachment($fileContent, $fileName, $file_description[4], $this->get_file_type($file_description[2])); 
  • trunk/expressoMail1_2/inc/gotodownload.php

    r27 r63  
    3232                $filename = $idx_file; 
    3333                         
     34        $filename        = $filename    ? $filename     : "attachment.bin"; 
     35        $newfilename = $newfilename ? $newfilename      : $filename; 
    3436        $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); 
    3739    
    3840   function downloadFile($strFileType, $strFileName, $newFileName, $fileContent, $encoding) { 
  • trunk/expressoMail1_2/js/InfoContact.js

    r54 r63  
    1 function emInfoContact() 
     1 function emInfoContact() 
    22{ 
    33        this.email = ""; 
     
    139139 
    140140        var status = IM.infoContact(uid); 
    141         var _return = '<br/><br/>'; 
     141        var _return = '<br/>'; 
    142142 
    143143        if ( status ) 
  • trunk/expressoMail1_2/js/TreeShow.js

    r53 r63  
    5858        Tree_Box.prototype.verify = function(exp) 
    5959        { 
    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                } 
    6365                return true; 
    6466        } 
  • trunk/expressoMail1_2/js/draw_api.js

    r61 r63  
    934934        to_values.id = "to_values_"+ID; 
    935935        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 
    938946        toaddress_array[ID] = info_msg.toaddress2.split(","); 
    939947        if (toaddress_array[ID].length > 1){ 
     
    12201228        td_from.setAttribute("noWrap","true"); 
    12211229        td_from.style.width = "100%"; 
    1222          
     1230                         
    12231231        var sel_from = document.createElement('SELECT');         
    12241232        sel_from.id = "from_"+ID; 
     
    15301538        input_return_receipt.name = "input_return_receipt"; 
    15311539        input_return_receipt.setAttribute("tabIndex","-1"); 
    1532         td_return_receipt.appendChild(input_return_receipt); 
     1540        td_return_receipt.appendChild(input_return_receipt);     
    15331541        tr5.appendChild(td5); 
    15341542        tr5.appendChild(td_return_receipt); 
  • trunk/expressoMail1_2/js/main.js

    r61 r63  
    240240 
    241241function 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. 
    243253        var title = ''; 
    244254        data = []; 
     
    393403                                        tmp = link_attachment.innerHTML.substring(0,link_attachment.innerHTML.lastIndexOf("(")); 
    394404                                        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+"\"/>"; 
    396407                                        divFiles.appendChild(link_attachment); 
    397408                                } 
     
    585596 
    586597                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                                } 
    604617                        } 
    605618                } 
     
    607620        } 
    608621         
     622        var folder = get_current_folder(); 
    609623        if (msgs_to_set == 'get_selected_messages') 
    610624                var msgs_to_set = this.get_selected_messages(); 
     625        else 
     626                folder = Element("input_folder_"+msgs_to_set+"_r").value; 
    611627         
    612628        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); 
    614630        else 
    615631                write_msg(get_lang('No selected message.'));             
     
    618634// By message number 
    619635function set_message_flag(msg_number, flag){ 
     636        var msg_number_folder = Element("new_input_folder_"+msg_number+"_r"); 
    620637        var handler_set_messages_flag = function (data){ 
    621638                if(!verify_session(data)) 
    622639                        return; 
    623                 if (data.status) { 
     640                if (data.status && Element("td_message_answered_"+msg_number)) {         
    624641                        if(flag == 'answered') 
    625642                                Element("td_message_answered_"+msg_number).innerHTML = '<img src=templates/default/images/answered.gif title=Respondida>'; 
     
    628645                } 
    629646        } 
    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); 
    631648} 
    632649 
  • trunk/instant_messenger/IMManager.php

    r55 r63  
    11#!/usr/bin/php -Cq 
    22<?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 
    154   require_once('inc/IMConfigure.php'); 
    165 
     
    187   # definitions of socket - BEGIN 
    198   # 
    20       /*** 
    21        * This file is prepared for receive dependable connections but 
    22        * exists a BUG in the PHP related with the library OpenSSL that 
    23        * doesn't permit the enable crypto in connection created. 
    24        * 
    25        * See [Bug #40993 stream_socket_accept() : accept failed] in 
    26        * http://bugs.php.net/bug.php?id=40993&edit=1 
    27        * 
    28        * 
    29        * It's necessary to remove all the comments made with '//' 
    30        * for safe connection 
    31        * 
    32        * 
    33        * WARNING - DANGER: 
    34        * 
    35        * Before remove all the comments made with '//' for safe 
    36        * connection, it's necessary to remove all the comments 
    37        * made with '//' in the file IMConfigure.php 
    38        * If this will not be made will happen many ERRORS 
    39        ***/ 
    40  
    41       //define("CONTEXT", stream_context_create()); 
    42  
    439      define('URI', '0.0.0.0'); 
    44  
    4510      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 format 
    49       //stream_context_set_option(CONTEXT, 'ssl', 'allow_self_signed', true); 
    50       //stream_context_set_option(CONTEXT, 'ssl', 'verify_peer', false); 
    51  
    5211      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)); 
    5412   # 
    5513   # definitions of socket - END 
    5614   ### 
    5715 
    58    //if ( !SOCKET_NON_SECURITY || !SOCKET_SECURITY ) # It's necessary to remove the next line for safe connection 
     16 
    5917   if ( !SOCKET_NON_SECURITY ) 
    6018   { 
    6119      printf("NON SECURITY:\n(%d) %s", $errno_non_security, $errstr_non_security); 
    62       //printf("SECURITY:\n(%d) %s", $errno_security, $errstr_security); 
    6320      exit(0); 
    6421   } 
     
    6623   include 'inc/Jabberd2.abstract.php'; 
    6724 
    68    //$master = array(SOCKET_NON_SECURITY, SOCKET_SECURITY); # It's necessary to remove the next line for safe connection 
    6925   $master = array(SOCKET_NON_SECURITY); 
    7026 
     
    7935      $_e = NULL; 
    8036        
    81       $mod_fd = @stream_select($read, $_w , $_e , READ_SOCKET_AFTER_OF); 
     37      $mod_fd = @stream_select($read, $_w , $_e , READ_SOCKET_AFTER_OF ); 
    8238 
    8339      if ( $mod_fd === FALSE ) 
     
    8541 
    8642      for ( $i = 0; $i < $mod_fd; ++$i ) 
     43      { 
    8744         if ( $read[$i] === SOCKET_NON_SECURITY ) 
    8845         { 
    8946            $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")); 
    9147            $master[] = &$conn_non_security; 
    9248         } 
    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          //} 
    9949         else 
    10050         { 
     
    10252            if ( strlen($sock_data) === 0 ) 
    10353            { 
    104                printf("Connection closed"); 
    10554               $key_to_del = array_search($read[$i], $master, TRUE); 
    10655               fclose($read[$i]); 
     
    10958            else if ( $sock_data === FALSE ) 
    11059            { 
    111                printf("Something bad happened"); 
    11260               $key_to_del = array_search($read[$i], $master, TRUE); 
    11361               unset($master[$key_to_del]); 
     
    11563            else 
    11664            { 
    117                # printf("\n\n%s\n\n", $sock_data); 
    11865               $headers = (split("\n", $sock_data)); 
    11966 
     
    12168               preg_match('/^Host: \w*:(.+)/', $headers[1], $host); 
    12269 
    123                //if ( (int)$host[1] == PORT_NON_SECURITY )  
    124                   $conn = &$conn_non_security; 
    125                //else 
    126                //   $conn = &$conn_security; 
     70               $conn = &$conn_non_security; 
    12771 
    12872               $request = explode(';', $request[2]); 
    12973 
    13074               if ( $request[0] == CONNECT && isset($request[1]) && !isset($users[$request[1]]) ) 
     75               { 
    13176                  connect($users, $request[1]); 
     77               } 
    13278 
    13379               if ( $request[0] == CLOSE && isset($request[1]) && isset($users[$request[1]]) ) 
    134                   close($request[1]); 
     80               {    
     81                close($request[1]); 
     82               } 
    13583 
    13684               fclose($read[$i]); 
     
    13886            } 
    13987         } 
    140  
     88      }  
     89       
    14190      foreach ( $users as $key => $val ) 
    14291      { 
    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         } 
    15499         else 
    155100         { 
    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"); 
    159115      } 
    160116 
    161       //print_r($users); 
    162    } 
    163  
     117   } 
     118         
     119         
    164120   exit(0); 
    165121 
     122         
    166123   function connect(&$pUsers, $pSession) 
    167124   { 
     
    203160                  $pUsers[$pSession] = array(); 
    204161                  $pUsers[$pSession]['jabber'] = $a; 
    205                   $pUsers[$pSession]['time'] = $_time; 
     162                  $pUsers[$pSession]['time0'] = $_time; 
     163                                                $pUsers[$pSession]['time1'] = 0;                   
    206164                  $pUsers[$pSession]['attempt'] = 0; 
    207165               } 
     
    224182   } 
    225183 
    226    function readSocket(&$pUsers, $pSession) 
    227    { 
     184   //function readSocket(&$pUsers, $pSession) 
     185   function readSocket($pSession) 
     186   { 
     187      global $users; 
    228188      global $send; 
    229189      $sessionpath = explode(';', session_save_path()); 
     
    244204            if ( $is_user ) 
    245205            { 
    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(); 
    248208                
    249209               if ( $readSocket !== false ) 
     
    261221                                                                        if ( !is_null($value) ) 
    262222                                                                        { 
    263                                                                                 $pUsers[$pSession]['jabber']->writeSocket($value); 
     223                                                                                $users[$pSession]['jabber']->writeSocket($value); 
    264224                                                                                $_SESSION['phpgw_info']['instant_messenger']['socket']['out']['message'] = NULL; 
    265225                                                                        } 
     
    271231                                                                                foreach ( $value as $key => $val ) 
    272232                                                                                { 
    273                                                                                         $pUsers[$pSession]['jabber']->getVcard($val); 
     233                                                                                        $users[$pSession]['jabber']->getVcard($val); 
    274234                                                                                        unset($_SESSION['phpgw_info']['instant_messenger']['socket']['out']['vcard'][$key]); 
    275235                                                                                } 
     
    278238                                                                else 
    279239                                                                { 
    280                                                                         if ( method_exists($pUsers[$pSession]['jabber'], $action) ) 
     240                                                                        if ( method_exists($users[$pSession]['jabber'], $action) ) 
    281241                                                                                if ( $value ) 
    282                                                                                         $pUsers[$pSession]['jabber']->$action($value); 
     242                                                                                        $users[$pSession]['jabber']->$action($value); 
    283243                                                                                else 
    284                                                                                         $pUsers[$pSession]['jabber']->$action(); 
     244                                                                                        $users[$pSession]['jabber']->$action(); 
    285245                                                                        unset($_SESSION['phpgw_info']['instant_messenger']['socket']['out'][$action]); 
    286246                                                                } 
  • trunk/instant_messenger/docs/change_log.txt

    r60 r63  
    1919- Corrigido a mudança de status automática 
    2020- Layout do adicionar contato não gera mais scrolls 
     21 
     2223/08/2007 
     23- Arrumado o tipo de cursor no IE na mudança de Status 
  • trunk/instant_messenger/inc/IMConfigure.php

    r55 r63  
    1515   # 
    1616      define('DISCONNECT_AFTERWARDS_OF', 20); 
    17       define('READ_SOCKET_AFTER_OF', 1); 
     17      define('READ_SOCKET_AFTER_OF', 2); 
    1818   # 
    1919   # definitions of time - END 
  • trunk/instant_messenger/inc/Socket.abstract.php

    r55 r63  
    1818abstract class Socket 
    1919{ 
    20         private $log_file = false; 
    21          
    2220        protected final function open( $pSocket = false, $pTimeOut = 1, $pBlockingMode = 0 ) 
    2321        { 
     
    5452      set_magic_quotes_runtime(get_magic_quotes_gpc()); 
    5553 
    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                 } 
    6454 
    6555      if ( $php_errormsg ) 
     
    7767         return false; 
    7868 
    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); 
    8970       
    9071      if ( $php_errormsg ) 
  • trunk/instant_messenger/inc/class.Ujabber.inc.php

    r57 r63  
    1111      $return = null; 
    1212 
    13       $_SESSION['phpgw_info']['instant_messenger']['time'] = time(); 
    14  
     13                $_SESSION['phpgw_info']['instant_messenger']['time'] = time(); 
    1514      $_SESSION['phpgw_info']['instant_messenger']['socket']['block'] = true; 
    1615      $xml = $_SESSION['phpgw_info']['instant_messenger']['socket']['in']; 
  • trunk/instant_messenger/inc/im_acl.inc.php

    r59 r63  
    9292          */ 
    9393           
    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                                 } 
    11194         } 
     95          
    11296         break; 
    11397      } 
  • trunk/instant_messenger/js/im_functions.js

    r57 r63  
    749749                 
    750750                 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;'); 
    752752                 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;'); 
    754754                 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;'); 
    756756                 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;'); 
    758758                 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;'); 
    760760                 
    761761                 func.insEl(option1_image, IM.get_lang('online'), option1_link); 
     762                 func.confEl(option1_link, 'style','cursor:pointer;'); 
    762763                 func.insEl(option1_link, option1); 
     764 
    763765                 func.insEl(option2_image, IM.get_lang('away'), option2_link); 
     766                 func.confEl(option2_link, 'style','cursor:pointer;'); 
    764767                 func.insEl(option2_link, option2); 
     768 
    765769                 func.insEl(option3_image, IM.get_lang('busy'), option3_link); 
     770                 func.confEl(option3_link, 'style','cursor:pointer;'); 
    766771                 func.insEl(option3_link, option3); 
     772 
    767773                 func.insEl(option4_image, IM.get_lang('offline'), option4_link); 
     774                 func.confEl(option4_link, 'style','cursor:pointer;'); 
    768775                 func.insEl(option4_link, option4); 
     776 
    769777                 func.insEl(option5_image, IM.get_lang('Custom message...'), option5_link); 
     778                 func.confEl(option5_link, 'style','cursor:pointer;'); 
    770779                 func.insEl(option5_link, option5); 
    771780                 
  • trunk/instant_messenger/js/im_win.js

    r60 r63  
    102102                        params['body']       = main_menu_all; 
    103103                        params['close']      = true; 
    104                         params['height']     = 260; 
     104                        params['height']     = 270; 
    105105                        params['left']       = 10; 
    106106                        params['id']         = pId; 
    107107                        params['maximize']   = true; 
    108108                        params['style']      = 'visibility:hidden'; 
    109                         params['title']      = ".: " + IM.get_lang("instant_messenger") + " :."; 
     109                        params['title']      = 'Expresso Messenger'; 
    110110                        params['top']        = 10; 
    111                         params['width']      = 200; 
     111                        params['width']      = 210; 
    112112                        this.build(params); 
    113113 
  • trunk/instant_messenger/templates/default/css.css

    r55 r63  
    7272.im-window-resizehandle 
    7373{ 
    74         position: absolute; 
    75         overflow: hidden; 
     74        position: relative; 
     75        overflow: auto; 
    7676        width: 15px; 
    7777        height: 15px; 
  • trunk/instant_messenger/templates/default/index.tpl

    r60 r63  
    5353    <br> 
    5454 
    55         Para acessar o menu "Opções" ( conforme figura 2 ), basta dar um clique com o mouse e abrirá uma 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> ),  
     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> ),  
    5656        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> ). 
    5757     
     
    114114        também possui esta opção ( <b>veja <a href="#menu_right">Preferências Avançadas</a></b>, opção Ver Info). 
    115115 
     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 
    116124    <h2><a name="troca_mens">7. Troca de Mensagens</a></h2> 
    117         ( figura 5 ) 
     125        ( figura 6 ) 
    118126    <img src="templates/default/images/troca_mensagem.png" width="332" height="272" alt="Troca de Mensagens" align="left"> 
    119127    <br clear="all"> 
     
    124132 
    125133    <h2><a name="troca_status">8. Troca de Status</a></h2> 
    126         ( figura 6 ) 
     134        ( figura 7 ) 
    127135    <img src="templates/default/images/troca_status.png" width="449" height="313" alt="Troca de Status" align="left"> 
    128136    <br clear="all"> 
  • trunk/instant_messenger/xsl/window.xsl

    r60 r63  
    1919      <div class="im-windowfantom-des" id="{@id}_im_window_fantom" /> 
    2020      <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;" /> 
    2222   </body> 
    2323   </html> 
  • trunk/phpgwapi/inc/class.common.inc.php

    r62 r63  
    14591459                        if (!$t || (int)$t <= 0) 
    14601460                        { 
    1461                                 $t."GMT"; 
    14621461                                $t = $GLOBALS['phpgw']->datetime->gmtnow; 
    14631462                        } 
    1464                         else 
    1465                                 $t."Não GMT"; 
    14661463                        //  + (date('I') == 1?3600:0) 
    14671464                        $t += $GLOBALS['phpgw']->datetime->tz_offset; 
    1468  
     1465                         
    14691466                        if (! $format) 
    14701467                        { 
     
    14791476                                } 
    14801477                        } 
     1478                         
    14811479                        if((PHP_OS == 'Windows' || PHP_OS == 'WINNT') && (int)$t < 21600) 
    14821480                        /*if(PHP_OS == 'Windows' && (int)$t < 21600)*/ 
Note: See TracChangeset for help on using the changeset viewer.