[2] | 1 | <?php |
---|
| 2 | /***********************************************************************************\ |
---|
| 3 | * Expresso Administração * |
---|
| 4 | * by Joao Alfredo Knopik Junior (joao.alfredo@gmail.com, jakjr@celepar.pr.gov.br) * |
---|
| 5 | * ----------------------------------------------------------------------------------* |
---|
| 6 | * This program is free software; you can redistribute it and/or modify it * |
---|
| 7 | * under the terms of the GNU General Public License as published by the * |
---|
| 8 | * Free Software Foundation; either version 2 of the License, or (at your * |
---|
| 9 | * option) any later version. * |
---|
| 10 | \***********************************************************************************/ |
---|
| 11 | |
---|
| 12 | class uiaccounts |
---|
| 13 | { |
---|
| 14 | var $public_functions = array |
---|
| 15 | ( |
---|
| 16 | 'list_users' => True, |
---|
| 17 | 'add_users' => True, |
---|
| 18 | 'edit_user' => True, |
---|
[32] | 19 | 'view_user' => True, |
---|
[2] | 20 | 'show_photo' => True, |
---|
| 21 | 'show_access_log' => True, |
---|
| 22 | 'css' => True |
---|
| 23 | ); |
---|
| 24 | |
---|
| 25 | var $nextmatchs; |
---|
| 26 | var $user; |
---|
| 27 | var $functions; |
---|
| 28 | var $current_config; |
---|
[9] | 29 | var $ldap_functions; |
---|
[11] | 30 | var $db_functions; |
---|
[2] | 31 | |
---|
| 32 | function uiaccounts() |
---|
| 33 | { |
---|
| 34 | $this->user = CreateObject('expressoAdmin1_2.user'); |
---|
| 35 | $this->nextmatchs = CreateObject('phpgwapi.nextmatchs'); |
---|
| 36 | $this->functions = CreateObject('expressoAdmin1_2.functions'); |
---|
[9] | 37 | $this->ldap_functions = CreateObject('expressoAdmin1_2.ldap_functions'); |
---|
[11] | 38 | $this->db_functions = CreateObject('expressoAdmin1_2.db_functions'); |
---|
[2] | 39 | |
---|
| 40 | $c = CreateObject('phpgwapi.config','expressoAdmin1_2'); |
---|
| 41 | $c->read_repository(); |
---|
| 42 | $this->current_config = $c->config_data; |
---|
| 43 | |
---|
| 44 | if(!@is_object($GLOBALS['phpgw']->js)) |
---|
| 45 | { |
---|
| 46 | $GLOBALS['phpgw']->js = CreateObject('phpgwapi.javascript'); |
---|
| 47 | } |
---|
| 48 | $GLOBALS['phpgw']->js->validate_file('jscode','connector','expressoAdmin1_2');#diretorio, arquivo.js, aplicacao |
---|
| 49 | $GLOBALS['phpgw']->js->validate_file('jscode','expressoadmin','expressoAdmin1_2'); |
---|
| 50 | $GLOBALS['phpgw']->js->validate_file('jscode','tabs','expressoAdmin1_2'); |
---|
| 51 | $GLOBALS['phpgw']->js->validate_file('jscode','users','expressoAdmin1_2'); |
---|
| 52 | } |
---|
| 53 | |
---|
| 54 | function list_users() |
---|
| 55 | { |
---|
| 56 | $account_lid = $GLOBALS['phpgw']->accounts->data['account_lid']; |
---|
[64] | 57 | $acl = $this->functions->read_acl($account_lid); |
---|
| 58 | $raw_context = $acl['raw_context']; |
---|
| 59 | $contexts = $acl['contexts']; |
---|
| 60 | foreach ($acl['contexts_display'] as $index=>$tmp_context) |
---|
| 61 | { |
---|
| 62 | $context_display .= '<br>'.$tmp_context; |
---|
| 63 | } |
---|
[2] | 64 | |
---|
| 65 | // Verifica se o administrador tem acesso. |
---|
| 66 | if (!$this->functions->check_acl($account_lid,'list_users')) |
---|
| 67 | { |
---|
| 68 | $GLOBALS['phpgw']->redirect($GLOBALS['phpgw']->link('/expressoAdmin1_2/inc/access_denied.php')); |
---|
| 69 | } |
---|
| 70 | |
---|
| 71 | if(isset($_POST['query'])) |
---|
| 72 | { |
---|
| 73 | // limit query to limit characters |
---|
| 74 | if(eregi('^[a-z_0-9_-].+$',$_POST['query'])) |
---|
| 75 | { |
---|
| 76 | $GLOBALS['query'] = $_POST['query']; |
---|
| 77 | } |
---|
| 78 | } |
---|
| 79 | |
---|
| 80 | unset($GLOBALS['phpgw_info']['flags']['noheader']); |
---|
| 81 | unset($GLOBALS['phpgw_info']['flags']['nonavbar']); |
---|
| 82 | $GLOBALS['phpgw_info']['flags']['app_header'] = $GLOBALS['phpgw_info']['apps']['expressoAdmin1_2']['title'].' - '.lang('User accounts'); |
---|
| 83 | $GLOBALS['phpgw']->common->phpgw_header(); |
---|
| 84 | |
---|
| 85 | $p = CreateObject('phpgwapi.Template',PHPGW_APP_TPL); |
---|
| 86 | $p->set_file(Array('accounts' => 'accounts.tpl')); |
---|
| 87 | $p->set_block('accounts','body'); |
---|
| 88 | $p->set_block('accounts','row'); |
---|
| 89 | $p->set_block('accounts','row_empty'); |
---|
| 90 | |
---|
| 91 | $var = Array( |
---|
| 92 | 'bg_color' => $GLOBALS['phpgw_info']['theme']['bg_color'], |
---|
| 93 | 'th_bg' => $GLOBALS['phpgw_info']['theme']['th_bg'], |
---|
| 94 | 'accounts_url' => $GLOBALS['phpgw']->link('/index.php','menuaction=expressoAdmin1_2.uiaccounts.list_users'), |
---|
| 95 | 'back_url' => $GLOBALS['phpgw']->link('/expressoAdmin1_2/index.php'), |
---|
| 96 | 'add_action' => $GLOBALS['phpgw']->link('/index.php','menuaction=expressoAdmin1_2.uiaccounts.add_users'), |
---|
| 97 | |
---|
| 98 | 'create_user_disabled' => $this->functions->check_acl($account_lid,'add_users') ? '' : 'disabled', |
---|
[64] | 99 | 'context' => $raw_context, |
---|
[2] | 100 | 'context_display' => $context_display, |
---|
[13] | 101 | 'imapDelimiter' => $_SESSION['phpgw_info']['expresso']['email_server']['imapDelimiter'], |
---|
[2] | 102 | |
---|
[283] | 103 | 'lang_create_user' => lang('Create user'), |
---|
| 104 | 'lang_loginid' => lang('Login'), |
---|
[2] | 105 | 'lang_cn' => lang('Name'), |
---|
| 106 | 'lang_mail' => lang('E-mail'), |
---|
[283] | 107 | 'lang_edit' => lang('Edit'), |
---|
| 108 | 'lang_rename' => lang('Rename'), |
---|
[2] | 109 | 'lang_search' => lang('Search'), |
---|
[283] | 110 | 'lang_back' => lang('Back'), |
---|
| 111 | 'lang_contexts' => lang('Contexts'), |
---|
| 112 | 'lang_delete_user' => lang('Delete user?'), |
---|
| 113 | 'lang_delete' => lang('Delete'), |
---|
| 114 | 'lang_sucess' => lang('User deleted successfully!'), |
---|
| 115 | 'lang_rename_user' => lang('Rename user'), |
---|
| 116 | 'lang_rename_success' => lang('User renamed successfully!'), |
---|
| 117 | 'login_field_contains_not_allowed' => lang('Login field contains invalid characters'), |
---|
| 118 | 'lang_to' => lang('to:') |
---|
[2] | 119 | ); |
---|
| 120 | $p->set_var($var); |
---|
| 121 | |
---|
| 122 | // Save query |
---|
| 123 | $p->set_var('query', $GLOBALS['query']); |
---|
| 124 | |
---|
| 125 | //Admin make a search |
---|
| 126 | if ($GLOBALS['query'] != '') |
---|
| 127 | { |
---|
[64] | 128 | $account_info = $this->functions->get_list('accounts', $GLOBALS['query'], $contexts); |
---|
[2] | 129 | } |
---|
| 130 | |
---|
| 131 | if (!count($account_info) && $GLOBALS['query'] != '') |
---|
| 132 | { |
---|
| 133 | $p->set_var('message',lang('No matches found')); |
---|
| 134 | $p->parse('rows','row_empty',True); |
---|
| 135 | } |
---|
| 136 | else if (count($account_info)) |
---|
| 137 | { // Can edit, delete or rename users ?? |
---|
| 138 | if (($this->functions->check_acl($account_lid,'edit_users')) || |
---|
| 139 | ($this->functions->check_acl($account_lid,'change_users_password')) || |
---|
| 140 | ($this->functions->check_acl($account_lid,'edit_sambausers_attributes')) || |
---|
[64] | 141 | ($this->functions->check_acl($account_lid,'change_users_quote')) || |
---|
| 142 | ($this->functions->check_acl($account_lid,'manipulate_corporative_information')) |
---|
| 143 | ) |
---|
[2] | 144 | $can_edit = True; |
---|
[32] | 145 | elseif ($this->functions->check_acl($account_lid,'view_users')) |
---|
| 146 | $can_view = True; |
---|
[2] | 147 | if ($this->functions->check_acl($account_lid,'delete_users')) |
---|
| 148 | $can_delete = True; |
---|
| 149 | if ($this->functions->check_acl($account_lid,'rename_users')) |
---|
| 150 | $can_rename = True; |
---|
| 151 | |
---|
| 152 | while (list($null,$account) = each($account_info)) |
---|
| 153 | { |
---|
| 154 | $this->nextmatchs->template_alternate_row_color($p); |
---|
| 155 | |
---|
| 156 | $var = array( |
---|
| 157 | 'row_loginid' => $account['account_lid'], |
---|
| 158 | 'row_cn' => $account['account_cn'], |
---|
| 159 | 'row_mail' => (!$account['account_mail']?'<font color=red>Sem E-mail</font>':$account['account_mail']) |
---|
| 160 | ); |
---|
| 161 | $p->set_var($var); |
---|
| 162 | |
---|
| 163 | if ($can_edit) |
---|
| 164 | $p->set_var('row_edit',$this->row_action('edit','user',$account['account_id'])); |
---|
[32] | 165 | elseif ($can_view) |
---|
| 166 | $p->set_var('row_edit',$this->row_action('view','user',$account['account_id'])); |
---|
[2] | 167 | else |
---|
| 168 | $p->set_var('row_edit',' '); |
---|
| 169 | |
---|
| 170 | if ($can_rename) |
---|
[283] | 171 | $p->set_var('row_rename',"<a href='#' onClick='javascript:rename_user(\"".$account['account_lid']."\",\"".$account['account_id']."\");'>".lang('Rename')."</a>"); |
---|
[2] | 172 | else |
---|
| 173 | $p->set_var('row_rename',' '); |
---|
| 174 | |
---|
| 175 | if ($can_delete) |
---|
| 176 | { |
---|
[283] | 177 | $p->set_var('row_delete',"<a href='#' onClick='javascript:delete_user(\"".$account['account_lid']."\",\"".$account['account_id']."\");'>".lang('Delete')."</a>"); |
---|
[2] | 178 | } |
---|
| 179 | else |
---|
| 180 | $p->set_var('row_delete',' '); |
---|
| 181 | |
---|
| 182 | $p->parse('rows','row',True); |
---|
| 183 | } |
---|
| 184 | } |
---|
| 185 | $p->pfp('out','body'); |
---|
| 186 | } |
---|
| 187 | |
---|
| 188 | function add_users() |
---|
| 189 | { |
---|
[33] | 190 | $GLOBALS['phpgw']->js->validate_file('jscode','users','expressoAdmin1_2'); |
---|
[64] | 191 | |
---|
[2] | 192 | $GLOBALS['phpgw']->js->set_onload('get_available_groups(document.forms[0].context.value);'); |
---|
| 193 | $GLOBALS['phpgw']->js->set_onload('get_available_maillists(document.forms[0].context.value);'); |
---|
[33] | 194 | if ($this->current_config['expressoAdmin_samba_support'] == 'true') |
---|
| 195 | $GLOBALS['phpgw']->js->set_onload('get_available_sambadomains(document.forms[0].context.value, \'create_user\');'); |
---|
[64] | 196 | |
---|
[2] | 197 | $manager_lid = $GLOBALS['phpgw']->accounts->data['account_lid']; |
---|
[64] | 198 | $acl = $this->functions->read_acl($manager_lid); |
---|
| 199 | |
---|
| 200 | $manager_contexts = $acl['contexts']; |
---|
| 201 | |
---|
[2] | 202 | // Verifica se tem acesso a este modulo |
---|
| 203 | if (!$this->functions->check_acl($manager_lid,'add_users')) |
---|
| 204 | { |
---|
| 205 | $GLOBALS['phpgw']->redirect($GLOBALS['phpgw']->link('/expressoAdmin1_2/inc/access_denied.php')); |
---|
| 206 | } |
---|
| 207 | |
---|
| 208 | // Imprime nav_bar |
---|
| 209 | unset($GLOBALS['phpgw_info']['flags']['noheader']); |
---|
| 210 | unset($GLOBALS['phpgw_info']['flags']['nonavbar']); |
---|
| 211 | $GLOBALS['phpgw_info']['flags']['app_header'] = $GLOBALS['phpgw_info']['apps']['expressoAdmin1_2']['title'].' - '.lang('Create User'); |
---|
| 212 | $GLOBALS['phpgw']->common->phpgw_header(); |
---|
| 213 | |
---|
| 214 | // Seta template |
---|
| 215 | $GLOBALS['phpgw']->js = CreateObject('phpgwapi.javascript'); |
---|
| 216 | $t = CreateObject('phpgwapi.Template',PHPGW_APP_TPL); |
---|
| 217 | $t->set_file(array("body" => "accounts_form.tpl")); |
---|
| 218 | $t->set_block('body','main'); |
---|
[233] | 219 | |
---|
[2] | 220 | |
---|
| 221 | // Pega combo das organizações e seleciona, caso seja um post, o setor que o usuario selecionou. |
---|
[64] | 222 | foreach ($manager_contexts as $index=>$context) |
---|
[208] | 223 | $combo_manager_org .= $this->functions->get_organizations($context); |
---|
| 224 | $combo_all_orgs = $this->functions->get_organizations($GLOBALS['phpgw_info']['server']['ldap_context'], '', true, true, true); |
---|
[2] | 225 | |
---|
| 226 | // Chama funcao para criar lista de aplicativos disponiveis. |
---|
[64] | 227 | $applications_list = $this->functions->make_list_app($manager_lid); |
---|
[2] | 228 | |
---|
[27] | 229 | // Cria combo de dominio samba |
---|
| 230 | if ($this->current_config['expressoAdmin_samba_support'] == 'true') |
---|
| 231 | { |
---|
| 232 | $a_sambadomains = $this->db_functions->get_sambadomains_list(); |
---|
| 233 | $sambadomainname_options = ''; |
---|
| 234 | if (count($a_sambadomains)) |
---|
| 235 | { |
---|
| 236 | foreach ($a_sambadomains as $a_sambadomain) |
---|
| 237 | { |
---|
[33] | 238 | // So mostra os sambaDomainName do contexto do manager |
---|
[64] | 239 | if ($this->ldap_functions->exist_sambadomains($manager_contexts, $a_sambadomain['samba_domain_name'])) |
---|
[33] | 240 | $sambadomainname_options .= "<option value='" . $a_sambadomain['samba_domain_sid'] . "'>" . $a_sambadomain['samba_domain_name'] . "</option>"; |
---|
[27] | 241 | } |
---|
| 242 | } |
---|
| 243 | } |
---|
| 244 | |
---|
[2] | 245 | // Valores default. |
---|
| 246 | $var = Array( |
---|
[283] | 247 | 'back_url' => $GLOBALS['phpgw']->link('/index.php','menuaction=expressoAdmin1_2.uiaccounts.list_users'), |
---|
| 248 | 'photo_bin' => $GLOBALS['phpgw_info']['server']['webserver_url'].'/expressoAdmin1_2/templates/default/images/photo_celepar.png', |
---|
[2] | 249 | 'row_on' => "#DDDDDD", |
---|
| 250 | 'row_off' => "#EEEEEE", |
---|
| 251 | 'color_bg1' => "#E8F0F0", |
---|
| 252 | 'type' => 'create_user', |
---|
[64] | 253 | 'display_samba_suport' => $this->current_config['expressoAdmin_samba_support'] == 'true' ? '' : 'none', |
---|
[283] | 254 | 'disabled_access_button' => 'disabled', |
---|
| 255 | 'display_access_records' => 'none', |
---|
[2] | 256 | |
---|
| 257 | // First ABA |
---|
| 258 | 'display_spam_uid' => 'display:none', |
---|
[283] | 259 | 'lang_general_information' => lang('General information'), |
---|
| 260 | 'lang_corporative_information' => lang('Corporative information'), |
---|
| 261 | 'lang_email_config' => lang('E-mail config'), |
---|
| 262 | 'lang_groups_permission' => lang('Group permissions'), |
---|
| 263 | 'lang_lists_permission' => lang('E-mail lists'), |
---|
| 264 | 'lang_aplication_permission' => lang('Application permissions'), |
---|
| 265 | 'lang_search_organization' => lang('Search organization'), |
---|
[2] | 266 | 'lang_organizations' => lang('Organizations'), |
---|
| 267 | 'lang_sector' => lang('Sector'), |
---|
[283] | 268 | 'lang_account_lid' => lang('Login'), |
---|
| 269 | 'lang_firstname' => lang('First name'), |
---|
| 270 | 'lang_lastname' => lang('Last name'), |
---|
[2] | 271 | 'lang_password' => lang('Password'), |
---|
[283] | 272 | 'lang_re-password' => lang('Re-password'), |
---|
[72] | 273 | 'lang_passwd_expired' => lang('Password expired'), |
---|
[2] | 274 | 'lang_changepassword' => lang('Change password'), |
---|
| 275 | 'lang_phone' => lang('Phone'), |
---|
| 276 | 'lang_photo' => lang('Photo'), |
---|
[283] | 277 | 'lang_account_active' => lang('Enabled account'), |
---|
| 278 | 'lang_account_invisible' => lang('Hidden account'), |
---|
| 279 | 'lang_never' => lang('Never'), |
---|
[2] | 280 | 'lang_back' => lang('Back'), |
---|
| 281 | 'lang_save' => lang('Save'), |
---|
[208] | 282 | 'sectors' => $combo_manager_org, |
---|
| 283 | 'combo_organizations' => $combo_manager_org, |
---|
| 284 | 'combo_all_orgs' => $combo_all_orgs, |
---|
[72] | 285 | 'passwd_expired_checked' => 'CHECKED', |
---|
[2] | 286 | 'changepassword_checked' => 'CHECKED', |
---|
| 287 | 'phpgwaccountstatus_checked' => 'CHECKED', |
---|
[107] | 288 | 'display_picture' => $this->functions->check_acl($manager_lid,'edit_users_picture') ? '' : 'none', |
---|
[2] | 289 | 'display_tr_default_password' => 'none', |
---|
| 290 | 'minimumSizeLogin' => $this->current_config['expressoAdmin_minimumSizeLogin'], |
---|
| 291 | 'defaultDomain' => $this->current_config['expressoAdmin_defaultDomain'], |
---|
| 292 | 'concatenateDomain' => $this->current_config['expressoAdmin_concatenateDomain'], |
---|
| 293 | 'ldap_context' => ldap_dn2ufn($GLOBALS['phpgw_info']['server']['ldap_context']), |
---|
| 294 | |
---|
[63] | 295 | // Corporative Information |
---|
| 296 | 'display_corporative_information' => $this->functions->check_acl($manager_lid,'manipulate_corporative_information') ? '' : 'none', |
---|
| 297 | 'lang_employeenumber' => lang('Employee number'), |
---|
[283] | 298 | 'lang_cpf' => lang('CPF'), |
---|
| 299 | 'lang_rg' => lang('RG'), |
---|
| 300 | 'lang_rguf' => lang('RG UF'), |
---|
[63] | 301 | |
---|
[2] | 302 | //MAIL |
---|
[283] | 303 | 'lang_activeemailaccount' => lang('Active e-mail account'), |
---|
[2] | 304 | 'lang_email' => lang('E-mail'), |
---|
[283] | 305 | 'lang_aliasemail' => lang('E-mail alias'), |
---|
| 306 | 'lang_forwardingemail' => lang('Forwarding e-mail'), |
---|
| 307 | 'lang_email_quota' => lang('E-mail quota in MB'), |
---|
[2] | 308 | 'lang_onlyforwarding' => lang('Only forwarding'), |
---|
[283] | 309 | 'lang_quote_message' => lang('Leave empty for no quota'), |
---|
| 310 | 'lang_email_quota_used' => lang('Used quota in MB'), |
---|
[2] | 311 | 'accountstatus_checked' => 'CHECKED', |
---|
| 312 | 'mailquota' => $this->current_config['expressoAdmin_defaultUserQuota'], |
---|
| 313 | 'changequote_disabled' => $this->functions->check_acl($manager_lid,'change_users_quote') ? '' : 'readonly', |
---|
| 314 | 'imapDelimiter' => $_SESSION['phpgw_info']['expresso']['email_server']['imapDelimiter'], |
---|
[81] | 315 | 'input_mailalternateaddress_fields' => '<input type="text" name="mailalternateaddress[]" id="mailalternateaddress" autocomplete="off" value="{mailalternateaddress}" {disabled} size=30>', |
---|
| 316 | 'input_mailforwardingaddress_fields'=> '<input type="text" name="mailforwardingaddress[]" id="mailforwardingaddress" autocomplete="off" value="{mailforwardingaddress}" {disabled} size=30>', |
---|
[2] | 317 | |
---|
| 318 | //Third ABA |
---|
| 319 | 'lang_groups' => lang('Groups'), |
---|
[283] | 320 | 'lang_user_groups' => lang('Selected user groups'), |
---|
| 321 | 'lang_available_groups' => lang('Available groups'), |
---|
| 322 | 'lang_listGroups' => lang('List groups'), |
---|
| 323 | 'lang_primary_group' => lang('Primary group'), |
---|
[2] | 324 | 'lang_add' => lang('Add'), |
---|
| 325 | 'lang_rem' => lang('Remove'), |
---|
| 326 | |
---|
| 327 | //Fourd ABA |
---|
[283] | 328 | 'lang_user_mail_lists' => lang('Selected e-mail lists'), |
---|
| 329 | 'lang_available_mail_lists' => lang('Available e-mail lists'), |
---|
[2] | 330 | |
---|
| 331 | //Five ABA |
---|
| 332 | 'apps' => $applications_list, |
---|
| 333 | |
---|
| 334 | //SAMBA ABA |
---|
[283] | 335 | 'lang_samba_config' => lang('Samba config'), |
---|
| 336 | 'lang_use_attrs_samba' => lang('Use Samba attributes'), |
---|
[27] | 337 | 'lang_sambadomain' => lang('Domain'), |
---|
[283] | 338 | 'lang_sambaAcctFlags' => lang('Samba account flags'), |
---|
| 339 | 'lang_sambaLogonScript' => lang('Logon script'), |
---|
| 340 | 'lang_sambaHomeDirectory' => lang('Home directory'), |
---|
| 341 | 'lang_active_user' => lang('Enabled Samba user'), |
---|
| 342 | 'lang_desactive_user' => lang('Disabled Samba user'), |
---|
[2] | 343 | 'use_attrs_samba_checked' => 'CHECKED', |
---|
[27] | 344 | 'sambadomainname_options' => $sambadomainname_options, |
---|
[2] | 345 | 'sambalogonscript' => $this->current_config['expressoAdmin_defaultLogonScript'] != '' ? $this->current_config['expressoAdmin_defaultLogonScript'] : '', |
---|
| 346 | 'use_suggestion_in_logon_script' => $this->current_config['expressoAdmin_defaultLogonScript'] == '' ? 'true' : 'false', |
---|
[283] | 347 | |
---|
| 348 | 'login_field_empty' => lang('Login field is empty'), |
---|
| 349 | 'login_field_must_have' => lang('Login field must have more than'), |
---|
| 350 | 'characters' => lang('characters'), |
---|
| 351 | 'password_field_empty' => lang('Password field is empty'), |
---|
| 352 | 're-pass_field_empty' => lang('Re-password field is empty'), |
---|
| 353 | 'pass_re-pass_diferents' => lang('Password and Re-password are differentes'), |
---|
| 354 | 'register_field_contains_not_allowed' => lang('Field register contains invalid characters. Only numbers are allowed'), |
---|
| 355 | 'cpf_field_not_allowed' => lang('Field CPF contains invalid characters. Only numbers are allowed'), |
---|
| 356 | 'email_field_empty' => lang('Email field is empty'), |
---|
| 357 | 'first_name_empty' => lang('First name field is empty'), |
---|
| 358 | 'first_name_not_valid' => lang('First name field is invalid'), |
---|
| 359 | 'last_name_empty' => lang('Last name field is empty'), |
---|
| 360 | 'last_name_not_valid' => lang('Last name field is not valid'), |
---|
| 361 | 'telephone_empty' => lang('Telephone field is empty'), |
---|
| 362 | 'redirect_email_empty' => lang('Redirect email field is empty'), |
---|
| 363 | 'without_quota' => lang('User without quota'), |
---|
| 364 | 'no_group_selected' => lang('No groups selected'), |
---|
| 365 | 'user_logon_script_empty' => lang('User logon script is empty'), |
---|
| 366 | 'user_home_path_empty' => lang('User home path is empty'), |
---|
| 367 | 'user_successfully_created' => lang('User successfully created!'), |
---|
| 368 | 'user_successfully_saved' => lang('User successfully saved!'), |
---|
| 369 | 'default_password_registered' => lang('Default password successfully registered'), |
---|
| 370 | 'user_password_returned_with_success' => lang('User password returned with success'), |
---|
| 371 | 'user_deleted_with_success' => lang('User deleted successfully!'), |
---|
| 372 | 'login_field_contains_not_allowed' => lang('Login field contains not allowed characters'), |
---|
| 373 | 'page_not_found' => lang('Page Not Found!'), |
---|
| 374 | 'type_name_new_manager' => lang('Type in the new managers name'), |
---|
| 375 | 'email_field_not_valid' => lang('E-mail field is invalid'), |
---|
| 376 | 'searching' => lang('Searching...'), |
---|
| 377 | 'delete_the_list' => lang('Delete list '), |
---|
| 378 | 'delete_the_group' => lang('Delete group '), |
---|
| 379 | 'cpf_invalid_field' => lang('Invalid CPF field'), |
---|
| 380 | 'incorrect_telephone_field' => lang('Incorrect Telephone Field'), |
---|
| 381 | 'change_user_login' => lang('Change user login'), |
---|
| 382 | 'to' => lang('to'), |
---|
| 383 | 'removed' => lang('removed'), |
---|
| 384 | 'lang_search_group' => lang('Search group'), |
---|
| 385 | 'lang_search_list' => lang('Search list'), |
---|
| 386 | 'lang_clear_inbox_user' => lang('Clear'), |
---|
| 387 | 'lang_inbox_user' => lang('User inbox'), |
---|
| 388 | 'display_tr_inbox_user' => 'none', |
---|
| 389 | 'lang_access_records' => lang('Show access records'), |
---|
| 390 | 'cpf_field_invalid' => lang('CPF field is invalid') |
---|
[2] | 391 | ); |
---|
| 392 | $t->set_var($var); |
---|
| 393 | $t->pfp('out','main'); |
---|
| 394 | } |
---|
| 395 | |
---|
[32] | 396 | function view_user() |
---|
| 397 | { |
---|
| 398 | ExecMethod('expressoAdmin1_2.uiaccounts.edit_user'); |
---|
| 399 | return; |
---|
| 400 | } |
---|
| 401 | |
---|
[2] | 402 | function edit_user() |
---|
| 403 | { |
---|
| 404 | $manager_account_lid = $GLOBALS['phpgw']->accounts->data['account_lid']; |
---|
[64] | 405 | $acl = $this->functions->read_acl($manager_account_lid); |
---|
| 406 | $raw_context = $acl['raw_context']; |
---|
| 407 | $contexts = $acl['contexts']; |
---|
[9] | 408 | $alert_warning = ''; |
---|
[2] | 409 | |
---|
| 410 | // Verifica se tem acesso a este modulo |
---|
| 411 | $disabled = 'disabled'; |
---|
| 412 | $disabled_password = 'disabled'; |
---|
| 413 | $disabled_samba = 'disabled'; |
---|
[180] | 414 | $disabled_edit_photo = 'disabled'; |
---|
| 415 | $display_picture = 'none'; |
---|
[2] | 416 | if ((!$this->functions->check_acl($manager_account_lid,'edit_users')) && |
---|
| 417 | (!$this->functions->check_acl($manager_account_lid,'change_users_password')) && |
---|
[32] | 418 | (!$this->functions->check_acl($manager_account_lid,'edit_sambausers_attributes')) && |
---|
[64] | 419 | (!$this->functions->check_acl($manager_account_lid,'view_users')) && |
---|
| 420 | (!$this->functions->check_acl($manager_account_lid,'manipulate_corporative_information')) |
---|
[32] | 421 | ) |
---|
[2] | 422 | { |
---|
| 423 | $GLOBALS['phpgw']->redirect($GLOBALS['phpgw']->link('/expressoAdmin1_2/inc/access_denied.php')); |
---|
| 424 | } |
---|
| 425 | // SOMENTE ALTERAÇÃO DE SENHA |
---|
| 426 | if ((!$this->functions->check_acl($manager_account_lid,'edit_users')) && ($this->functions->check_acl($manager_account_lid,'change_users_password'))) |
---|
| 427 | { |
---|
| 428 | $disabled = 'disabled'; |
---|
| 429 | $disabled_password = ''; |
---|
| 430 | } |
---|
| 431 | // SOMENTE ALTERAÇÃO DOS ATRIBUTOS SAMBA |
---|
| 432 | if ((!$this->functions->check_acl($manager_account_lid,'edit_users')) && ($this->functions->check_acl($manager_account_lid,'edit_sambausers_attributes'))) |
---|
| 433 | { |
---|
| 434 | $disabled = 'disabled'; |
---|
| 435 | $disabled_samba = ''; |
---|
| 436 | } |
---|
[27] | 437 | // TOTAIS MENOS O SAMBA |
---|
| 438 | if (($this->functions->check_acl($manager_account_lid,'edit_users')) && (!$this->functions->check_acl($manager_account_lid,'edit_sambausers_attributes'))) |
---|
| 439 | { |
---|
| 440 | $disabled = ''; |
---|
| 441 | $disabled_password = ''; |
---|
| 442 | $disabled_samba = 'disabled'; |
---|
| 443 | } |
---|
[2] | 444 | // TOTAIS |
---|
[27] | 445 | elseif ($this->functions->check_acl($manager_account_lid,'edit_users')) |
---|
[2] | 446 | { |
---|
| 447 | $disabled = ''; |
---|
| 448 | $disabled_password = ''; |
---|
| 449 | $disabled_samba = ''; |
---|
| 450 | } |
---|
| 451 | |
---|
| 452 | if (!$this->functions->check_acl($manager_account_lid,'change_users_quote')) |
---|
| 453 | $disabled_quote = 'readonly'; |
---|
| 454 | |
---|
[180] | 455 | if ($this->functions->check_acl($manager_account_lid,'edit_users_picture')) |
---|
| 456 | { |
---|
| 457 | $disabled_edit_photo = ''; |
---|
| 458 | $display_picture = ''; |
---|
| 459 | } |
---|
[2] | 460 | // GET all infomations about the user. |
---|
[64] | 461 | $user_info = $this->user->get_user_info($_GET['account_id']); |
---|
[2] | 462 | |
---|
| 463 | // JavaScript |
---|
| 464 | $GLOBALS['phpgw']->js->validate_file("jscode","users","expressoAdmin1_2"); |
---|
| 465 | $GLOBALS['phpgw']->js->set_onload("get_available_groups(document.forms[0].context.value);"); |
---|
| 466 | $GLOBALS['phpgw']->js->set_onload("get_available_maillists(document.forms[0].context.value);"); |
---|
| 467 | $GLOBALS['phpgw']->js->set_onload("use_samba_attrs('".$user_info['sambaUser']."');"); |
---|
| 468 | |
---|
| 469 | // Seta header. |
---|
| 470 | unset($GLOBALS['phpgw_info']['flags']['noheader']); |
---|
| 471 | unset($GLOBALS['phpgw_info']['flags']['nonavbar']); |
---|
| 472 | |
---|
[283] | 473 | $GLOBALS['phpgw_info']['flags']['app_header'] = $GLOBALS['phpgw_info']['apps']['expressoAdmin1_2']['title'].' - '.lang('Edit user'); |
---|
[2] | 474 | $GLOBALS['phpgw']->common->phpgw_header(); |
---|
| 475 | |
---|
| 476 | // Seta templates. |
---|
| 477 | $t = CreateObject('phpgwapi.Template',PHPGW_APP_TPL); |
---|
| 478 | $t->set_file(array("body" => "accounts_form.tpl")); |
---|
| 479 | $t->set_block('body','main'); |
---|
| 480 | |
---|
| 481 | // ORGANIZATIONS |
---|
[208] | 482 | /* |
---|
[64] | 483 | foreach ($contexts as $index=>$context) |
---|
| 484 | $orgs .= $this->functions->get_organizations($context, $user_info['context']); |
---|
[208] | 485 | */ |
---|
| 486 | |
---|
| 487 | foreach ($contexts as $index=>$context) |
---|
| 488 | $combo_manager_org .= $this->functions->get_organizations($context, $user_info['context']); |
---|
| 489 | $combo_all_orgs = $this->functions->get_organizations($GLOBALS['phpgw_info']['server']['ldap_context'], $user_info['context'], true, true, true); |
---|
[2] | 490 | |
---|
[208] | 491 | |
---|
[2] | 492 | // GROUPS. |
---|
| 493 | if (count($user_info['groups_info']) > 0) |
---|
| 494 | { |
---|
| 495 | foreach ($user_info['groups_info'] as $group) |
---|
| 496 | { |
---|
| 497 | $array_groups[$group['gidnumber']] = $group['cn']; |
---|
| 498 | } |
---|
| 499 | natcasesort($array_groups); |
---|
| 500 | foreach ($array_groups as $gidnumber=>$cn) |
---|
| 501 | { |
---|
[11] | 502 | // Grupo existe no Banco mas não no Ldap, excluimos grupo do Banco. |
---|
| 503 | /* |
---|
| 504 | if (!$this->ldap_functions->group_exist($gidnumber)) |
---|
| 505 | { |
---|
| 506 | $this->db_functions->delete_group($gidnumber); |
---|
| 507 | $this->db_functions->write_log("expressoAdmin deletou o grupo $gidnumber do banco, pois não existia no ldap.",'','','',''); |
---|
| 508 | continue; |
---|
| 509 | } |
---|
| 510 | */ |
---|
[9] | 511 | |
---|
| 512 | // O memberUid do usuário está somente no Banco, então adicionamos o memberUid no Ldap. |
---|
| 513 | if (is_null($user_info['groups_ldap'][$gidnumber])) |
---|
| 514 | { |
---|
| 515 | $this->ldap_functions->add_user2group($gidnumber, $user_info['uid']); |
---|
| 516 | $ea_select_user_groups_options .= "<option value=" . $gidnumber . ">" . $cn . " [Incluido memberUid no Ldap]</option>"; |
---|
[11] | 517 | |
---|
[9] | 518 | if ($alert_warning == '') |
---|
[283] | 519 | $alert_warning = lang("The ExpressoAdmin fixed the following inconsistencies:\n"); |
---|
[46] | 520 | $alert_warning .= "Incluido atributo memberUid do usuário no grupo:\\n$cn - gidnumber: $gidnumber."; |
---|
[9] | 521 | } |
---|
| 522 | else |
---|
[11] | 523 | $ea_select_user_groups_options .= "<option value=" . $gidnumber . ">" . $cn . "</option>"; |
---|
[9] | 524 | |
---|
[2] | 525 | if ($gidnumber == $user_info['gidnumber']) |
---|
| 526 | { |
---|
| 527 | $ea_combo_primary_user_group_options .= "<option value=" . $gidnumber . " selected>" . $cn . "</option>"; |
---|
| 528 | } |
---|
| 529 | else |
---|
| 530 | { |
---|
| 531 | $ea_combo_primary_user_group_options .= "<option value=" . $gidnumber . ">" . $cn . "</option>"; |
---|
| 532 | } |
---|
| 533 | } |
---|
[9] | 534 | |
---|
[11] | 535 | // O memberUid do usuário está somente no Ldap. |
---|
[9] | 536 | $groups_db = array_flip($user_info['groups']); |
---|
| 537 | foreach ($user_info['groups_ldap'] as $gidnumber=>$cn) |
---|
| 538 | { |
---|
| 539 | if (is_null($groups_db[$gidnumber])) |
---|
| 540 | { |
---|
[11] | 541 | /* |
---|
[9] | 542 | $this->ldap_functions->remove_user2group($gidnumber, $user_info['uid']); |
---|
| 543 | if ($alert_warning == '') |
---|
| 544 | $alert_warning = "O expressoAdmin corrigiu as seguintes inconsistências:\\n"; |
---|
| 545 | $alert_warning .= "Removido atributo memberUid do usuário do grupo $cn.\\n"; |
---|
[11] | 546 | */ |
---|
| 547 | $ea_select_user_groups_options .= "<option value=" . $gidnumber . ">" . $cn . " [Somente no LDAP]</option>"; |
---|
[9] | 548 | } |
---|
[11] | 549 | } |
---|
[2] | 550 | } |
---|
| 551 | |
---|
| 552 | // MAILLISTS |
---|
| 553 | if (count($user_info['maillists_info']) > 0) |
---|
| 554 | { |
---|
| 555 | foreach ($user_info['maillists_info'] as $maillist) |
---|
| 556 | { |
---|
[208] | 557 | $array_maillist[$maillist['uid']] = $maillist['uid'] . " (" . $maillist['mail'] . ") "; |
---|
[2] | 558 | } |
---|
| 559 | natcasesort($array_maillist); |
---|
[208] | 560 | foreach ($array_maillist as $uid=>$option) |
---|
[2] | 561 | { |
---|
[208] | 562 | $ea_select_user_maillists_options .= "<option value=" . $uid . ">" . $option . "</option>"; |
---|
[2] | 563 | } |
---|
| 564 | } |
---|
| 565 | |
---|
| 566 | // APPS. |
---|
| 567 | if ($disabled == 'disabled') |
---|
[64] | 568 | $apps = $this->functions->make_list_app($manager_account_lid, $user_info['apps'], 'disabled'); |
---|
[2] | 569 | else |
---|
[64] | 570 | $apps = $this->functions->make_list_app($manager_account_lid, $user_info['apps']); |
---|
[2] | 571 | |
---|
| 572 | //PHOTO |
---|
| 573 | if ($user_info['photo_exist']) |
---|
| 574 | { |
---|
[64] | 575 | $photo_bin = "./index.php?menuaction=expressoAdmin1_2.uiaccounts.show_photo&uidNumber=".$_GET['account_id']; |
---|
[2] | 576 | } |
---|
| 577 | else |
---|
| 578 | { |
---|
| 579 | $photo_bin = $GLOBALS['phpgw_info']['server']['webserver_url'] . '/expressoAdmin1_2/templates/default/images/photo_celepar.png'; |
---|
| 580 | $disabled_delete_photo = 'disabled'; |
---|
| 581 | } |
---|
| 582 | |
---|
[27] | 583 | // Cria combo de dominios do samba |
---|
| 584 | if ($this->current_config['expressoAdmin_samba_support'] == 'true') |
---|
| 585 | { |
---|
| 586 | $a_sambadomains = $this->db_functions->get_sambadomains_list(); |
---|
| 587 | $sambadomainname_options = ''; |
---|
| 588 | if (count($a_sambadomains)) |
---|
| 589 | { |
---|
| 590 | foreach ($a_sambadomains as $a_sambadomain) |
---|
| 591 | { |
---|
| 592 | if ($a_sambadomain['samba_domain_sid'] == $user_info['sambasid']) |
---|
| 593 | $sambadomainname_options .= "<option value='" . $a_sambadomain['samba_domain_sid'] . "' SELECTED>" . $a_sambadomain['samba_domain_name'] . "</option>"; |
---|
| 594 | else |
---|
| 595 | $sambadomainname_options .= "<option value='" . $a_sambadomain['samba_domain_sid'] . "'>" . $a_sambadomain['samba_domain_name'] . "</option>"; |
---|
| 596 | } |
---|
| 597 | } |
---|
| 598 | } |
---|
[81] | 599 | |
---|
| 600 | // Mail Alternate & Forwarding |
---|
| 601 | if (is_array($user_info['mailalternateaddress'])) |
---|
| 602 | { |
---|
| 603 | for ($i = 0; $i < $user_info['mailalternateaddress']['count']; $i++) |
---|
| 604 | { |
---|
| 605 | if ($i > 0) |
---|
| 606 | $input_mailalternateaddress_fields .= '<br>'; |
---|
| 607 | $input_mailalternateaddress_fields .= '<input type="text" name="mailalternateaddress[]" id="mailalternateaddress" autocomplete="off" value="'.$user_info['mailalternateaddress'][$i].'" {disabled} size=30>'; |
---|
| 608 | } |
---|
| 609 | } |
---|
| 610 | else |
---|
| 611 | { |
---|
| 612 | $input_mailalternateaddress_fields = '<input type="text" name="mailalternateaddress[]" id="mailalternateaddress" autocomplete="off" value="" {disabled} size=30>'; |
---|
| 613 | } |
---|
[27] | 614 | |
---|
[81] | 615 | if (is_array($user_info['mailforwardingaddress'])) |
---|
| 616 | { |
---|
| 617 | for ($i = 0; $i < $user_info['mailforwardingaddress']['count']; $i++) |
---|
| 618 | { |
---|
| 619 | if ($i > 0) |
---|
| 620 | $input_mailforwardingaddress_fields .= '<br>'; |
---|
| 621 | $input_mailforwardingaddress_fields .= '<input type="text" name="mailforwardingaddress[]" id="mailforwardingaddress" autocomplete="off" value="'.$user_info['mailforwardingaddress'][$i].'" {disabled} size=30>'; |
---|
| 622 | } |
---|
| 623 | } |
---|
| 624 | else |
---|
| 625 | { |
---|
| 626 | $input_mailforwardingaddress_fields = '<input type="text" name="mailforwardingaddress[]" id="mailforwardingaddress" autocomplete="off" value="" {disabled} size=30>'; |
---|
| 627 | } |
---|
| 628 | |
---|
[9] | 629 | if ($alert_warning != '') |
---|
| 630 | $alert_warning = "alert('". $alert_warning ."')"; |
---|
[2] | 631 | $var = Array( |
---|
| 632 | 'uidnumber' => $_GET['account_id'], |
---|
| 633 | 'type' => 'edit_user', |
---|
| 634 | 'photo_exist' => $user_info['photo_exist'], |
---|
| 635 | 'departmentnumber' => $user_info['departmentnumber'], |
---|
| 636 | 'user_context' => $user_info['context'], |
---|
| 637 | |
---|
| 638 | 'row_on' => "#DDDDDD", |
---|
| 639 | 'row_off' => "#EEEEEE", |
---|
| 640 | 'color_bg1' => "#E8F0F0", |
---|
| 641 | 'action' => $GLOBALS['phpgw']->link('/index.php','menuaction=expressoAdmin1_2.uiaccounts.validate_user_data_edit'), |
---|
| 642 | 'back_url' => './index.php?menuaction=expressoAdmin1_2.uiaccounts.list_users', |
---|
| 643 | 'disabled' => $disabled, |
---|
| 644 | 'disabled_password' => $disabled_password, |
---|
| 645 | 'disabled_samba' => $disabled_samba, |
---|
| 646 | 'changequote_disabled' => $disabled_quote, |
---|
| 647 | |
---|
[64] | 648 | // Display ABAS |
---|
| 649 | 'display_corporative_information'=> $this->functions->check_acl($manager_account_lid,'manipulate_corporative_information') ? '' : 'none', |
---|
| 650 | 'display_applications' => $this->functions->check_acl($manager_account_lid,'display_applications') ? '' : 'none', |
---|
| 651 | 'display_emaillists' => $this->functions->check_acl($manager_account_lid,'display_emaillists') ? '' : 'none', |
---|
| 652 | 'display_groups' => $this->functions->check_acl($manager_account_lid,'display_groups') ? '' : 'none', |
---|
| 653 | 'display_emailconfig' => $this->functions->check_acl($manager_account_lid,'display_emailconfig') ? '' : 'none', |
---|
| 654 | |
---|
[2] | 655 | // First ABA |
---|
[9] | 656 | 'alert_warning' => "$alert_warning", |
---|
[2] | 657 | 'display_input_account_lid' => 'display:none', |
---|
[283] | 658 | 'lang_general_information' => lang('General information'), |
---|
| 659 | 'lang_corporative_information' => lang('Corporative information'), |
---|
| 660 | 'lang_email_config' => lang('E-mail config'), |
---|
| 661 | 'lang_groups_permission' => lang('Group permissions'), |
---|
| 662 | 'lang_lists_permission' => lang('E-mail lists'), |
---|
| 663 | 'lang_aplication_permission' => lang('Application permissions'), |
---|
[2] | 664 | 'lang_organizations' => lang('Organizations'), |
---|
[283] | 665 | 'lang_search_organization' => lang('Search organization'), |
---|
[2] | 666 | 'lang_sector' => lang('Sector'), |
---|
[283] | 667 | 'lang_account_lid' => lang('Login'), |
---|
| 668 | 'lang_firstname' => lang('First name'), |
---|
| 669 | 'lang_lastname' => lang('Last name'), |
---|
[72] | 670 | 'lang_passwd_expired' => lang('Password expired'), |
---|
[2] | 671 | 'lang_password' => lang('Password'), |
---|
| 672 | 'lang_phone' => lang('Phone'), |
---|
| 673 | 'lang_photo' => lang('Photo'), |
---|
[283] | 674 | 'lang_re-password' => lang('Re-password'), |
---|
[2] | 675 | 'lang_changepassword' => lang('Change password'), |
---|
[283] | 676 | 'lang_account_active' => lang('Enabled account'), |
---|
| 677 | 'lang_account_invisible' => lang('Hidden account'), |
---|
[2] | 678 | 'lang_back' => lang('Back'), |
---|
| 679 | 'lang_save' => lang('Save'), |
---|
[283] | 680 | 'lang_delete_photo' => lang('Delete photo'), |
---|
[2] | 681 | |
---|
[208] | 682 | 'sectors' => $combo_manager_org, |
---|
| 683 | 'combo_organizations' => $combo_manager_org, |
---|
| 684 | 'combo_all_orgs' => $combo_all_orgs, |
---|
[2] | 685 | |
---|
| 686 | 'uid' => $user_info['uid'], |
---|
| 687 | 'givenname' => $user_info['givenname'], |
---|
| 688 | 'mail1' => $user_info['mail'], |
---|
| 689 | 'sn' => $user_info['sn'], |
---|
| 690 | 'telephonenumber' => $user_info['telephonenumber'], |
---|
| 691 | 'photo_bin' => $photo_bin, |
---|
[180] | 692 | 'disabled_edit_photo' => $disabled_edit_photo, |
---|
| 693 | //'display_picture' => $this->functions->check_acl($manager_account_lid,'edit_users_picture') ? '' : 'none', |
---|
| 694 | 'display_picture' => $display_picture, |
---|
[2] | 695 | |
---|
| 696 | 'display_tr_default_password' => $this->functions->check_acl($manager_account_lid,'set_user_default_password') ? '' : 'none', |
---|
| 697 | |
---|
[72] | 698 | 'passwd_expired_checked' => $user_info['passwd_expired'] == '0' ? 'CHECKED' : '', |
---|
[2] | 699 | 'changepassword_checked' => $user_info['changepassword'] == '1' ? 'CHECKED' : '', |
---|
| 700 | 'phpgwaccountstatus_checked' => $user_info['phpgwaccountstatus'] == 'A' ? 'CHECKED' : '', |
---|
| 701 | 'phpgwaccountvisible_checked' => $user_info['phpgwaccountvisible'] == '-1' ? 'CHECKED' : '', |
---|
| 702 | |
---|
[63] | 703 | // Corporative Information |
---|
| 704 | 'lang_employeenumber' => lang('Employee number'), |
---|
[283] | 705 | 'lang_cpf' => lang('CPF'), |
---|
| 706 | 'lang_rg' => lang('RG'), |
---|
| 707 | 'lang_rguf' => lang('RG UF'), |
---|
| 708 | 'cpf_field_invalid' => lang('CPF field is invalid'), |
---|
| 709 | |
---|
[63] | 710 | 'corporative_information_employeenumber' => $user_info['corporative_information_employeenumber'], |
---|
| 711 | 'corporative_information_cpf' => $user_info['corporative_information_cpf'], |
---|
| 712 | 'corporative_information_rg' => $user_info['corporative_information_rg'], |
---|
| 713 | 'corporative_information_rguf' => $user_info['corporative_information_rguf'], |
---|
| 714 | |
---|
| 715 | //MAIL |
---|
[64] | 716 | 'disabled_quota_used' => 'disabled', |
---|
[283] | 717 | 'lang_activeemailaccount' => lang('Active e-mail account'), |
---|
[64] | 718 | 'lang_email' => lang('E-mail'), |
---|
[283] | 719 | 'lang_aliasemail' => lang('E-mail alias'), |
---|
| 720 | 'lang_forwardingemail' => lang('Forwarding e-mail'), |
---|
| 721 | 'lang_email_quota' => lang('E-mail quota in MB'), |
---|
[64] | 722 | 'lang_onlyforwarding' => lang('Only forwarding'), |
---|
[283] | 723 | 'lang_email_quota_used' => lang('Used quota in MB'), |
---|
| 724 | 'lang_clear_inbox_user' => lang('Clear'), |
---|
| 725 | 'lang_inbox_user' => lang('User inbox'), |
---|
| 726 | 'display_tr_inbox_user' => '', |
---|
| 727 | |
---|
[2] | 728 | |
---|
| 729 | 'accountstatus_checked' => $user_info['accountstatus'] == 'active' ? 'CHECKED' : '', |
---|
| 730 | 'mail' => $user_info['mail'], |
---|
[81] | 731 | |
---|
| 732 | //'mailalternateaddress' => $user_info['mailalternateaddress'], |
---|
| 733 | //'mailforwardingaddress' => $user_info['mailforwardingaddress'], |
---|
| 734 | 'input_mailalternateaddress_fields' => $input_mailalternateaddress_fields, |
---|
[283] | 735 | 'input_mailforwardingaddress_fields' => $input_mailforwardingaddress_fields, |
---|
[81] | 736 | |
---|
[2] | 737 | 'deliverymode_checked' => $user_info['deliverymode'] == 'forwardOnly' ? 'CHECKED' : '', |
---|
| 738 | 'mailquota' => $user_info['mailquota'], |
---|
| 739 | 'mailquota_used' => $user_info['mailquota_used'], |
---|
| 740 | |
---|
| 741 | //Third ABA |
---|
| 742 | 'lang_groups' => lang('Groups'), |
---|
[283] | 743 | 'lang_user_groups' => lang('Selected user groups'), |
---|
| 744 | 'lang_available_groups' => lang('Available groups'), |
---|
| 745 | 'lang_primary_group' => lang('Primary group'), |
---|
[2] | 746 | 'lang_add' => lang('Add'), |
---|
| 747 | 'lang_rem' => lang('Remove'), |
---|
| 748 | 'ea_select_user_groups_options' => $ea_select_user_groups_options, |
---|
| 749 | 'ea_combo_primary_user_group_options' => $ea_combo_primary_user_group_options, |
---|
| 750 | |
---|
| 751 | //Fourd ABA |
---|
[283] | 752 | 'lang_user_mail_lists' => lang('Selected e-mail lists'), |
---|
| 753 | 'lang_available_mail_lists' => lang('Available e-mail lists'), |
---|
[2] | 754 | 'ea_select_user_maillists_options' => $ea_select_user_maillists_options, |
---|
| 755 | |
---|
| 756 | //Five ABA |
---|
| 757 | 'apps' => $apps, |
---|
| 758 | |
---|
| 759 | //SAMBA ABA |
---|
[283] | 760 | 'lang_samba_config' => lang('Samba config'), |
---|
| 761 | 'lang_use_attrs_samba' => lang('Use Samba attributes'), |
---|
[27] | 762 | 'lang_sambadomain' => lang('Domain'), |
---|
[283] | 763 | 'lang_sambaAcctFlags' => lang('Samba account flags'), |
---|
| 764 | 'lang_sambaLogonScript' => lang('Logon script'), |
---|
| 765 | 'lang_sambaHomeDirectory' => lang('Home directory'), |
---|
| 766 | 'lang_active_user' => lang('Enabled Samba user'), |
---|
| 767 | 'lang_desactive_user' => lang('Disabled Samba user'), |
---|
[2] | 768 | |
---|
| 769 | 'userSamba' => $user_info['sambaUser'], |
---|
[27] | 770 | 'sambadomainname_options' => $sambadomainname_options, |
---|
[2] | 771 | 'use_attrs_samba_checked' => $user_info['sambaUser'] ? 'CHECKED' : '', |
---|
| 772 | 'active_user_selected' => $user_info['sambaaccflags'] == '[U ]' ? 'selected' : '', |
---|
| 773 | 'desactive_user_selected' => $user_info['sambaaccflags'] == '[DU ]' ? 'selected' : '', |
---|
| 774 | 'sambalogonscript' => $user_info['sambalogonscript'], |
---|
| 775 | 'sambahomedirectory' => $user_info['homedirectory'], |
---|
| 776 | 'defaultLogonScript' => $this->current_config['expressoAdmin_defaultLogonScript'], |
---|
[283] | 777 | 'use_suggestion_in_logon_script' => $this->current_config['expressoAdmin_defaultLogonScript'] == '' ? 'true' : 'false', |
---|
| 778 | |
---|
| 779 | 'login_field_empty' => lang('Login field is empty'), |
---|
| 780 | 'password_field_empty' => lang('Password field is empty'), |
---|
| 781 | 're-pass_field_empty' => lang('Re-password field is empty'), |
---|
| 782 | 'pass_re-pass_diferents' => lang('Password and Re-password are differentes'), |
---|
| 783 | 'register_field_contains_not_allowed' => lang('Field register contains invalid characters. Only numbers are allowed'), |
---|
| 784 | 'cpf_field_not_allowed' => lang('Field CPF contains invalid characters. Only numbers are allowed'), |
---|
| 785 | 'email_field_empty' => lang('Email field is empty'), |
---|
| 786 | 'first_name_empty' => lang('First name field is empty'), |
---|
| 787 | 'first_name_not_valid' => lang('First name field is invalid'), |
---|
| 788 | 'last_name_empty' => lang('Last name field is empty'), |
---|
| 789 | 'last_name_not_valid' => lang('Last name field is not valid'), |
---|
| 790 | 'telephone_empty' => lang('Telephone field is empty'), |
---|
| 791 | 'redirect_email_empty' => lang('Redirect email field is empty'), |
---|
| 792 | 'without_quota' => lang('User without quota'), |
---|
| 793 | 'no_group_selected' => lang('No groups selected'), |
---|
| 794 | 'user_logon_script_empty' => lang('User logon script is empty'), |
---|
| 795 | 'user_home_path_empty' => lang('User home path is empty'), |
---|
| 796 | 'user_successfully_created' => lang('User successfully created!'), |
---|
| 797 | 'user_successfully_saved' => lang('User successfully saved!'), |
---|
| 798 | 'default_password_registered' => lang('Default password successfully registered'), |
---|
| 799 | 'user_password_returned_with_success' => lang('User password returned with success'), |
---|
| 800 | 'user_deleted_with_success' => lang('User deleted successfully!'), |
---|
| 801 | 'login_field_contains_not_allowed' => lang('Login field contains invalid characters'), |
---|
| 802 | 'page_not_found' => lang('Page Not Found!'), |
---|
| 803 | 'type_name_new_manager' => lang('Type in the new managers name'), |
---|
| 804 | 'email_field_not_valid' => lang('E-mail field is invalid'), |
---|
| 805 | 'searching' => lang('Searching...'), |
---|
| 806 | 'delete_the_list' => lang('Delete list '), |
---|
| 807 | 'delete_the_group' => lang('Delete group '), |
---|
| 808 | 'cpf_invalid_field' => lang('Invalid CPF field'), |
---|
| 809 | 'incorrect_telephone_field' => lang('Incorrect Telephone Field'), |
---|
| 810 | 'change_user_login' => lang('Change user login'), |
---|
| 811 | 'to' => lang('to'), |
---|
| 812 | 'user_renamed_success' => lang('User renamed with success!'), |
---|
| 813 | 'removed' => lang('removed'), |
---|
| 814 | 'mb_from_the_user_mailbox' => lang('mb_from_the_user_mailbox'), |
---|
| 815 | 'cleaning_users_inbox' => lang('Cleaning users inbox'), |
---|
| 816 | 'lang_insert_password_default' => lang('Insert default password'), |
---|
| 817 | 'lang_restore_user_password' => lang('Restore user password'), |
---|
| 818 | 'lang_access_records' => lang('Show access records'), |
---|
| 819 | 'lang_search_group' => lang('Search group'), |
---|
| 820 | 'lang_search_list' => lang('Search list') |
---|
[2] | 821 | ); |
---|
[283] | 822 | |
---|
[2] | 823 | $t->set_var($var); |
---|
[64] | 824 | |
---|
| 825 | // Devo mostrar aba SAMBA ?? |
---|
| 826 | if ( ($this->current_config['expressoAdmin_samba_support'] == 'true') && ($this->functions->check_acl($manager_account_lid,'edit_sambausers_attributes')) ) |
---|
| 827 | $t->set_var('display_samba_suport', ''); |
---|
| 828 | else |
---|
| 829 | $t->set_var('display_samba_suport', 'none'); |
---|
| 830 | |
---|
[2] | 831 | $t->pfp('out','body'); |
---|
| 832 | } |
---|
| 833 | |
---|
| 834 | function row_action($action,$type,$account_id) |
---|
| 835 | { |
---|
| 836 | return '<a href="'.$GLOBALS['phpgw']->link('/index.php',Array( |
---|
| 837 | 'menuaction' => 'expressoAdmin1_2.uiaccounts.'.$action.'_'.$type, |
---|
| 838 | 'account_id' => $account_id |
---|
| 839 | )).'"> '.lang($action).' </a>'; |
---|
| 840 | } |
---|
| 841 | |
---|
| 842 | function css() |
---|
| 843 | { |
---|
| 844 | $appCSS = |
---|
| 845 | 'th.activetab |
---|
| 846 | { |
---|
| 847 | color:#000000; |
---|
| 848 | background-color:#D3DCE3; |
---|
| 849 | border-top-width : 1px; |
---|
| 850 | border-top-style : solid; |
---|
| 851 | border-top-color : Black; |
---|
| 852 | border-left-width : 1px; |
---|
| 853 | border-left-style : solid; |
---|
| 854 | border-left-color : Black; |
---|
| 855 | border-right-width : 1px; |
---|
| 856 | border-right-style : solid; |
---|
| 857 | border-right-color : Black; |
---|
| 858 | font-size: 12px; |
---|
| 859 | font-family: Tahoma, Arial, Helvetica, sans-serif; |
---|
| 860 | } |
---|
| 861 | |
---|
| 862 | th.inactivetab |
---|
| 863 | { |
---|
| 864 | color:#000000; |
---|
| 865 | background-color:#E8F0F0; |
---|
| 866 | border-bottom-width : 1px; |
---|
| 867 | border-bottom-style : solid; |
---|
| 868 | border-bottom-color : Black; |
---|
| 869 | font-size: 12px; |
---|
| 870 | font-family: Tahoma, Arial, Helvetica, sans-serif; |
---|
| 871 | } |
---|
| 872 | |
---|
| 873 | .td_left {border-left:1px solid Gray; border-top:1px solid Gray; border-bottom:1px solid Gray;} |
---|
| 874 | .td_right {border-right:1px solid Gray; border-top:1px solid Gray; border-bottom:1px solid Gray;} |
---|
| 875 | |
---|
| 876 | div.activetab{ display:inline; } |
---|
| 877 | div.inactivetab{ display:none; }'; |
---|
| 878 | |
---|
| 879 | return $appCSS; |
---|
| 880 | } |
---|
| 881 | |
---|
| 882 | function show_photo() |
---|
| 883 | { |
---|
| 884 | $uidNumber = $_GET['uidNumber']; |
---|
[64] | 885 | $photo = $this->get_photo($uidNumber); |
---|
[2] | 886 | |
---|
| 887 | if ($photo) |
---|
| 888 | { |
---|
| 889 | header("Content-Type: image/jpeg"); |
---|
| 890 | $width = imagesx($photo); |
---|
| 891 | $height = imagesy($photo); |
---|
| 892 | $twidth = 80; |
---|
| 893 | $theight = 106; |
---|
| 894 | $small_photo = imagecreatetruecolor ($twidth, $theight); |
---|
| 895 | imagecopyresampled($small_photo, $photo, 0, 0, 0, 0,$twidth, $theight, $width, $height); |
---|
| 896 | imagejpeg($small_photo,"",100); |
---|
| 897 | return; |
---|
| 898 | } |
---|
| 899 | } |
---|
| 900 | |
---|
[64] | 901 | function get_photo($uidNumber) |
---|
[2] | 902 | { |
---|
| 903 | $ldap_conn = $GLOBALS['phpgw']->common->ldapConnect(); |
---|
| 904 | $filter="(&(phpgwAccountType=u)(uidNumber=".$uidNumber."))"; |
---|
| 905 | $justthese = array("jpegphoto"); |
---|
| 906 | |
---|
[64] | 907 | $search = ldap_search($ldap_conn, $GLOBALS['phpgw_info']['server']['ldap_context'], $filter, $justthese); |
---|
[2] | 908 | $entry = ldap_first_entry($ldap_conn, $search); |
---|
| 909 | $jpeg_data = ldap_get_values_len($ldap_conn, $entry, "jpegphoto"); |
---|
| 910 | $jpegphoto = imagecreatefromstring($jpeg_data[0]); |
---|
| 911 | return $jpegphoto; |
---|
| 912 | } |
---|
| 913 | |
---|
| 914 | function show_access_log() |
---|
| 915 | { |
---|
| 916 | $account_id = $_GET['account_id']; |
---|
| 917 | |
---|
| 918 | $manager_account_lid = $GLOBALS['phpgw']->accounts->data['account_lid']; |
---|
| 919 | $tmp = $this->functions->read_acl($manager_account_lid); |
---|
| 920 | $manager_context = $tmp[0]['context']; |
---|
| 921 | |
---|
| 922 | // Verifica se tem acesso a este modulo |
---|
| 923 | if ((!$this->functions->check_acl($manager_account_lid,'edit_users')) && (!$this->functions->check_acl($manager_account_lid,'change_users_password'))) |
---|
| 924 | { |
---|
| 925 | $GLOBALS['phpgw']->redirect($GLOBALS['phpgw']->link('/expressoAdmin1_2/inc/access_denied.php')); |
---|
| 926 | } |
---|
| 927 | |
---|
| 928 | // Seta header. |
---|
| 929 | unset($GLOBALS['phpgw_info']['flags']['noheader']); |
---|
| 930 | unset($GLOBALS['phpgw_info']['flags']['nonavbar']); |
---|
| 931 | |
---|
| 932 | $GLOBALS['phpgw_info']['flags']['app_header'] = $GLOBALS['phpgw_info']['apps']['expressoAdmin1_2']['title'].' - '.lang('Access Log'); |
---|
| 933 | $GLOBALS['phpgw']->common->phpgw_header(); |
---|
| 934 | |
---|
| 935 | // Seta templates. |
---|
| 936 | $t = CreateObject('phpgwapi.Template',PHPGW_APP_TPL); |
---|
| 937 | $t->set_file(array("body" => "accesslog.tpl")); |
---|
| 938 | $t->set_block('body','main'); |
---|
| 939 | $t->set_block('body','row','row'); |
---|
| 940 | |
---|
| 941 | // GET access log from the user. |
---|
| 942 | $GLOBALS['phpgw']->db->limit_query("select loginid,ip,li,lo,account_id,sessionid from phpgw_access_log WHERE account_id=".$account_id." order by li desc",$start,__LINE__,__FILE__); |
---|
| 943 | while ($GLOBALS['phpgw']->db->next_record()) |
---|
| 944 | { |
---|
| 945 | $records[] = array( |
---|
| 946 | 'loginid' => $GLOBALS['phpgw']->db->f('loginid'), |
---|
| 947 | 'ip' => $GLOBALS['phpgw']->db->f('ip'), |
---|
| 948 | 'li' => $GLOBALS['phpgw']->db->f('li'), |
---|
| 949 | 'lo' => $GLOBALS['phpgw']->db->f('lo'), |
---|
| 950 | 'account_id' => $GLOBALS['phpgw']->db->f('account_id'), |
---|
| 951 | 'sessionid' => $GLOBALS['phpgw']->db->f('sessionid') |
---|
| 952 | ); |
---|
| 953 | } |
---|
| 954 | |
---|
| 955 | // Seta as vcariaveis |
---|
| 956 | while (is_array($records) && list(,$record) = each($records)) |
---|
| 957 | { |
---|
| 958 | $var = array( |
---|
| 959 | 'row_loginid' => $record['loginid'], |
---|
| 960 | 'row_ip' => $record['ip'], |
---|
| 961 | 'row_li' => date("d/m/Y - H:i:s", $record['li']), |
---|
| 962 | 'row_lo' => $record['lo'] == 0 ? 0 : date("d/m/Y - H:i:s", $record['lo']) |
---|
| 963 | ); |
---|
| 964 | $t->set_var($var); |
---|
| 965 | $t->fp('rows','row',True); |
---|
| 966 | } |
---|
| 967 | |
---|
| 968 | $var = Array( |
---|
| 969 | 'th_bg' => $GLOBALS['phpgw_info']['theme']['th_bg'], |
---|
[283] | 970 | 'lang_back' => lang('Back'), |
---|
[2] | 971 | 'back_url' => "./index.php?menuaction=expressoAdmin1_2.uiaccounts.edit_user&account_id=$account_id", |
---|
[283] | 972 | 'lang_loginid' => lang('Login'), |
---|
[2] | 973 | 'lang_ip' => lang('IP'), |
---|
[283] | 974 | 'lang_login' => lang('Log in'), |
---|
| 975 | 'lang_logout' => lang('Log out') |
---|
[2] | 976 | ); |
---|
| 977 | $t->set_var($var); |
---|
| 978 | $t->pfp('out','body'); |
---|
| 979 | } |
---|
| 980 | } |
---|
| 981 | ?> |
---|