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, |
---|
19 | 'view_user' => True, |
---|
20 | 'show_photo' => True, |
---|
21 | 'show_access_log' => True, |
---|
22 | 'css' => True, |
---|
23 | 'list_inactive_users' => True |
---|
24 | ); |
---|
25 | |
---|
26 | var $nextmatchs; |
---|
27 | var $user; |
---|
28 | var $functions; |
---|
29 | var $current_config; |
---|
30 | var $ldap_functions; |
---|
31 | var $db_functions; |
---|
32 | |
---|
33 | function uiaccounts() |
---|
34 | { |
---|
35 | $this->user = CreateObject('expressoAdmin1_2.user'); |
---|
36 | $this->nextmatchs = CreateObject('phpgwapi.nextmatchs'); |
---|
37 | $this->functions = CreateObject('expressoAdmin1_2.functions'); |
---|
38 | $this->ldap_functions = CreateObject('expressoAdmin1_2.ldap_functions'); |
---|
39 | $this->db_functions = CreateObject('expressoAdmin1_2.db_functions'); |
---|
40 | |
---|
41 | $c = CreateObject('phpgwapi.config','expressoAdmin1_2'); |
---|
42 | $c->read_repository(); |
---|
43 | $this->current_config = $c->config_data; |
---|
44 | |
---|
45 | if(!@is_object($GLOBALS['phpgw']->js)) |
---|
46 | { |
---|
47 | $GLOBALS['phpgw']->js = CreateObject('phpgwapi.javascript'); |
---|
48 | } |
---|
49 | $GLOBALS['phpgw']->js->validate_file('jscode','connector','expressoAdmin1_2');#diretorio, arquivo.js, aplicacao |
---|
50 | $GLOBALS['phpgw']->js->validate_file('jscode','finder','expressoAdmin1_2'); |
---|
51 | $GLOBALS['phpgw']->js->validate_file('jscode','expressoadmin','expressoAdmin1_2'); |
---|
52 | $GLOBALS['phpgw']->js->validate_file('jscode','tabs','expressoAdmin1_2'); |
---|
53 | $GLOBALS['phpgw']->js->validate_file('jscode','users','expressoAdmin1_2'); |
---|
54 | } |
---|
55 | |
---|
56 | function list_inactive_users() { |
---|
57 | |
---|
58 | $context = $_GET["context"]; |
---|
59 | |
---|
60 | unset($GLOBALS['phpgw_info']['flags']['noheader']); |
---|
61 | unset($GLOBALS['phpgw_info']['flags']['nonavbar']); |
---|
62 | $GLOBALS['phpgw_info']['flags']['app_header'] = $GLOBALS['phpgw_info']['apps']['expressoAdmin1_2']['title'].' - '. lang('list inactives'); |
---|
63 | $GLOBALS['phpgw']->common->phpgw_header(); |
---|
64 | |
---|
65 | $p = CreateObject('phpgwapi.Template',PHPGW_APP_TPL); |
---|
66 | $p->set_file(array('inactive_users' => 'list_inactives.tpl')); |
---|
67 | $p->set_block('inactive_users','list','list'); |
---|
68 | $p->set_block('inactive_users','row','row'); |
---|
69 | $p->set_block('inactive_users','row_empty','row_empty'); |
---|
70 | $contexts = array(); |
---|
71 | array_push($contexts,$context); |
---|
72 | |
---|
73 | $usuarios = $this->functions->get_inactive_users($contexts); |
---|
74 | |
---|
75 | |
---|
76 | |
---|
77 | $var = Array( |
---|
78 | 'th_bg' => $GLOBALS['phpgw_info']['theme']['th_bg'], |
---|
79 | 'back_url' => $GLOBALS['phpgw']->link('/index.php?menuaction=expressoAdmin1_2.uisectors.list_sectors'), |
---|
80 | 'context_display' => $context_display, |
---|
81 | 'lang_idusuario' => lang('uidNumber'), |
---|
82 | 'lang_login' => lang('user login'), |
---|
83 | 'lang_ultimo_login' => lang('last login'), |
---|
84 | 'lang_back' => lang('back') |
---|
85 | ); |
---|
86 | $p->set_var($var); |
---|
87 | |
---|
88 | if (!count($usuarios)) |
---|
89 | { |
---|
90 | $p->set_var('message',lang('No matches found')); |
---|
91 | } |
---|
92 | else |
---|
93 | { |
---|
94 | foreach($usuarios as $usuario) |
---|
95 | { |
---|
96 | $tr_color = $this->nextmatchs->alternate_row_color($tr_color); |
---|
97 | |
---|
98 | $var = Array( |
---|
99 | 'tr_color' => $tr_color, |
---|
100 | 'id' => $usuario["uidNumber"], |
---|
101 | 'login' => $usuario["login"], |
---|
102 | 'data_ultimo_login' => date("d/m/Y",$usuario["li"]) |
---|
103 | ); |
---|
104 | $p->set_var($var); |
---|
105 | |
---|
106 | $p->fp('rows','row',True); |
---|
107 | } |
---|
108 | } |
---|
109 | $p->parse('rows','row_empty',True); |
---|
110 | $p->pfp('out','list'); |
---|
111 | |
---|
112 | |
---|
113 | } |
---|
114 | |
---|
115 | function list_users() |
---|
116 | { |
---|
117 | $account_lid = $GLOBALS['phpgw']->accounts->data['account_lid']; |
---|
118 | $acl = $this->functions->read_acl($account_lid); |
---|
119 | $raw_context = $acl['raw_context']; |
---|
120 | $contexts = $acl['contexts']; |
---|
121 | foreach ($acl['contexts_display'] as $index=>$tmp_context) |
---|
122 | { |
---|
123 | $context_display .= '<br>'.$tmp_context; |
---|
124 | } |
---|
125 | // Verifica se o administrador tem acesso. |
---|
126 | if (!$this->functions->check_acl($account_lid,'list_users')) |
---|
127 | { |
---|
128 | $GLOBALS['phpgw']->redirect($GLOBALS['phpgw']->link('/expressoAdmin1_2/inc/access_denied.php')); |
---|
129 | } |
---|
130 | |
---|
131 | if(isset($_POST['query'])) |
---|
132 | { |
---|
133 | // limit query to limit characters |
---|
134 | if(preg_match('/^[a-z_0-9_-].+$/i',$_POST['query'])) |
---|
135 | { |
---|
136 | $GLOBALS['query'] = $_POST['query']; |
---|
137 | } |
---|
138 | } |
---|
139 | |
---|
140 | unset($GLOBALS['phpgw_info']['flags']['noheader']); |
---|
141 | unset($GLOBALS['phpgw_info']['flags']['nonavbar']); |
---|
142 | $GLOBALS['phpgw_info']['flags']['app_header'] = $GLOBALS['phpgw_info']['apps']['expressoAdmin1_2']['title'].' - '.lang('User accounts'); |
---|
143 | $GLOBALS['phpgw']->common->phpgw_header(); |
---|
144 | |
---|
145 | $p = CreateObject('phpgwapi.Template',PHPGW_APP_TPL); |
---|
146 | $p->set_file(Array('accounts' => 'accounts.tpl')); |
---|
147 | $p->set_block('accounts','body'); |
---|
148 | $p->set_block('accounts','row'); |
---|
149 | $p->set_block('accounts','row_empty'); |
---|
150 | |
---|
151 | $var = Array( |
---|
152 | 'bg_color' => $GLOBALS['phpgw_info']['theme']['bg_color'], |
---|
153 | 'th_bg' => $GLOBALS['phpgw_info']['theme']['th_bg'], |
---|
154 | 'accounts_url' => $GLOBALS['phpgw']->link('/index.php','menuaction=expressoAdmin1_2.uiaccounts.list_users'), |
---|
155 | 'back_url' => $GLOBALS['phpgw']->link('/expressoAdmin1_2/index.php'), |
---|
156 | 'add_action' => $GLOBALS['phpgw']->link('/index.php','menuaction=expressoAdmin1_2.uiaccounts.add_users'), |
---|
157 | 'create_user_disabled' => $this->functions->check_acl($account_lid,'add_users') ? '' : 'disabled', |
---|
158 | 'context' => $raw_context, |
---|
159 | 'context_display' => $context_display, |
---|
160 | 'imapDelimiter' => $_SESSION['phpgw_info']['expresso']['email_server']['imapDelimiter'] |
---|
161 | ); |
---|
162 | $p->set_var($var); |
---|
163 | $p->set_var($this->functions->make_dinamic_lang($p, 'body')); |
---|
164 | |
---|
165 | $p->set_var('query', $GLOBALS['query']); |
---|
166 | |
---|
167 | //Admin make a search |
---|
168 | if ($GLOBALS['query'] != '') |
---|
169 | { |
---|
170 | $account_info = $this->functions->get_list('accounts', $GLOBALS['query'], $contexts); |
---|
171 | } |
---|
172 | |
---|
173 | if (!count($account_info) && $GLOBALS['query'] != '') |
---|
174 | { |
---|
175 | $p->set_var('message',lang('No matches found')); |
---|
176 | $p->parse('rows','row_empty',True); |
---|
177 | } |
---|
178 | else if (count($account_info)) |
---|
179 | { // Can edit, delete or rename users ?? |
---|
180 | if (($this->functions->check_acl($account_lid,'edit_users')) || |
---|
181 | ($this->functions->check_acl($account_lid,'change_users_password')) || |
---|
182 | ($this->functions->check_acl($account_lid,'edit_sambausers_attributes')) || |
---|
183 | ($this->functions->check_acl($account_lid,'change_users_quote')) || |
---|
184 | ($this->functions->check_acl($account_lid,'manipulate_corporative_information')) || |
---|
185 | ($this->functions->check_acl($account_lid,'edit_users_phonenumber')) |
---|
186 | ) |
---|
187 | $can_edit = True; |
---|
188 | elseif ($this->functions->check_acl($account_lid,'view_users')) |
---|
189 | $can_view = True; |
---|
190 | if ($this->functions->check_acl($account_lid,'delete_users')) |
---|
191 | $can_delete = True; |
---|
192 | if ($this->functions->check_acl($account_lid,'rename_users')) |
---|
193 | $can_rename = True; |
---|
194 | |
---|
195 | while (list($null,$account) = each($account_info)) |
---|
196 | { |
---|
197 | $this->nextmatchs->template_alternate_row_color($p); |
---|
198 | |
---|
199 | $var = array( |
---|
200 | 'row_loginid' => $account['account_lid'], |
---|
201 | 'row_cn' => $account['account_cn'], |
---|
202 | 'row_mail' => (!$account['account_mail']?'<font color=red>Sem E-mail</font>':$account['account_mail']) |
---|
203 | ); |
---|
204 | $p->set_var($var); |
---|
205 | |
---|
206 | if ($can_edit) |
---|
207 | $p->set_var('row_edit',$this->row_action('edit','user',$account['account_id'])); |
---|
208 | elseif ($can_view) |
---|
209 | $p->set_var('row_edit',$this->row_action('view','user',$account['account_id'])); |
---|
210 | else |
---|
211 | $p->set_var('row_edit',' '); |
---|
212 | |
---|
213 | if ($can_rename) |
---|
214 | $p->set_var('row_rename',"<a href='#' onClick='javascript:rename_user(\"".$account['account_lid']."\",\"".$account['account_id']."\");'>".lang('to rename')."</a>"); |
---|
215 | else |
---|
216 | $p->set_var('row_rename',' '); |
---|
217 | |
---|
218 | if ($can_delete) |
---|
219 | { |
---|
220 | $p->set_var('row_delete',"<a href='#' onClick='javascript:delete_user(\"".$account['account_lid']."\",\"".$account['account_id']."\");'>".lang('to delete')."</a>"); |
---|
221 | } |
---|
222 | else |
---|
223 | $p->set_var('row_delete',' '); |
---|
224 | |
---|
225 | $p->parse('rows','row',True); |
---|
226 | } |
---|
227 | } |
---|
228 | $p->pfp('out','body'); |
---|
229 | } |
---|
230 | |
---|
231 | function add_users() |
---|
232 | { |
---|
233 | $GLOBALS['phpgw']->js->validate_file('jscode','users','expressoAdmin1_2'); |
---|
234 | |
---|
235 | $GLOBALS['phpgw']->js->set_onload('get_available_groups(document.forms[0].context.value);'); |
---|
236 | $GLOBALS['phpgw']->js->set_onload('get_available_maillists(document.forms[0].context.value);'); |
---|
237 | $GLOBALS['phpgw']->js->set_onload('get_associated_domain(document.forms[0].context.value);'); |
---|
238 | if ($this->current_config['expressoAdmin_samba_support'] == 'true') |
---|
239 | $GLOBALS['phpgw']->js->set_onload('get_available_sambadomains(document.forms[0].context.value, \'create_user\');'); |
---|
240 | |
---|
241 | $manager_lid = $GLOBALS['phpgw']->accounts->data['account_lid']; |
---|
242 | $acl = $this->functions->read_acl($manager_lid); |
---|
243 | |
---|
244 | $manager_contexts = $acl['contexts']; |
---|
245 | |
---|
246 | // Verifica se tem acesso a este modulo |
---|
247 | if (!$this->functions->check_acl($manager_lid,'add_users')) |
---|
248 | { |
---|
249 | $GLOBALS['phpgw']->redirect($GLOBALS['phpgw']->link('/expressoAdmin1_2/inc/access_denied.php')); |
---|
250 | } |
---|
251 | |
---|
252 | // Imprime nav_bar |
---|
253 | unset($GLOBALS['phpgw_info']['flags']['noheader']); |
---|
254 | unset($GLOBALS['phpgw_info']['flags']['nonavbar']); |
---|
255 | $GLOBALS['phpgw_info']['flags']['app_header'] = $GLOBALS['phpgw_info']['apps']['expressoAdmin1_2']['title'].' - '.lang('Create User'); |
---|
256 | $GLOBALS['phpgw']->common->phpgw_header(); |
---|
257 | |
---|
258 | // Seta template |
---|
259 | $GLOBALS['phpgw']->js = CreateObject('phpgwapi.javascript'); |
---|
260 | $t = CreateObject('phpgwapi.Template',PHPGW_APP_TPL); |
---|
261 | $t->set_file(array("body" => "accounts_form.tpl")); |
---|
262 | $t->set_block('body','main'); |
---|
263 | |
---|
264 | // Pega combo das organizações e seleciona, caso seja um post, o setor que o usuario selecionou. |
---|
265 | foreach ($manager_contexts as $index=>$context) |
---|
266 | $combo_manager_org .= $this->functions->get_organizations($context); |
---|
267 | $combo_all_orgs = $this->functions->get_organizations($GLOBALS['phpgw_info']['server']['ldap_context'], '', true, true, true); |
---|
268 | |
---|
269 | // Chama funcao para criar lista de aplicativos disponiveis. |
---|
270 | $applications_list = $this->functions->make_list_app($manager_lid); |
---|
271 | |
---|
272 | // Cria combo de dominio samba |
---|
273 | if ($this->current_config['expressoAdmin_samba_support'] == 'true') |
---|
274 | { |
---|
275 | $a_sambadomains = $this->db_functions->get_sambadomains_list(); |
---|
276 | $sambadomainname_options = ''; |
---|
277 | if (count($a_sambadomains)) |
---|
278 | { |
---|
279 | foreach ($a_sambadomains as $a_sambadomain) |
---|
280 | { |
---|
281 | // So mostra os sambaDomainName do contexto do manager |
---|
282 | if ($this->ldap_functions->exist_sambadomains($manager_contexts, $a_sambadomain['samba_domain_name'])) |
---|
283 | $sambadomainname_options .= "<option value='" . $a_sambadomain['samba_domain_sid'] . "'>" . $a_sambadomain['samba_domain_name'] . "</option>"; |
---|
284 | } |
---|
285 | } |
---|
286 | } |
---|
287 | |
---|
288 | // Valores default. |
---|
289 | $var = Array( |
---|
290 | 'row_on' => "#DDDDDD", |
---|
291 | 'row_off' => "#EEEEEE", |
---|
292 | 'color_bg1' => "#E8F0F0", |
---|
293 | //'manager_context' => $manager_context, |
---|
294 | 'type' => 'create_user', |
---|
295 | 'back_url' => $GLOBALS['phpgw']->link('/index.php','menuaction=expressoAdmin1_2.uiaccounts.list_users'), |
---|
296 | 'display_samba_suport' => $this->current_config['expressoAdmin_samba_support'] == 'true' ? '' : 'none', |
---|
297 | 'disabled_access_button'=> 'disabled', |
---|
298 | 'display_access_log_button' => 'none', |
---|
299 | 'display_access_log_button' => 'none', |
---|
300 | 'display_empty_user_inbox' =>'none', |
---|
301 | 'display_quota_used' => 'none', |
---|
302 | |
---|
303 | // First ABA |
---|
304 | 'display_spam_uid' => 'display:none', |
---|
305 | 'lang_generate_login' => lang('Generate login'), |
---|
306 | 'start_coment_expired' => "<!--", |
---|
307 | 'end_coment_expired' => "-->", |
---|
308 | 'sectors' => $combo_manager_org, |
---|
309 | 'combo_organizations' => $combo_manager_org, |
---|
310 | 'combo_all_orgs' => $combo_all_orgs, |
---|
311 | 'passwd_expired_checked' => 'CHECKED', |
---|
312 | 'changepassword_checked' => 'CHECKED', |
---|
313 | 'phpgwaccountstatus_checked' => 'CHECKED', |
---|
314 | 'photo_bin' => $GLOBALS['phpgw_info']['server']['webserver_url'].'/expressoAdmin1_2/templates/default/images/photo_celepar.png', |
---|
315 | 'display_picture' => $this->functions->check_acl($manager_lid,'edit_users_picture') ? '' : 'none', |
---|
316 | 'display_tr_default_password' => 'none', |
---|
317 | 'minimumSizeLogin' => $this->current_config['expressoAdmin_minimumSizeLogin'], |
---|
318 | 'defaultDomain' => $this->current_config['expressoAdmin_defaultDomain'], |
---|
319 | 'concatenateDomain' => $this->current_config['expressoAdmin_concatenateDomain'], |
---|
320 | 'ldap_context' => ldap_dn2ufn($GLOBALS['phpgw_info']['server']['ldap_context']), |
---|
321 | |
---|
322 | // Corporative Information |
---|
323 | 'display_corporative_information' => $this->functions->check_acl($manager_lid,'manipulate_corporative_information') ? '' : 'none', |
---|
324 | |
---|
325 | //MAIL |
---|
326 | 'accountstatus_checked' => 'CHECKED', |
---|
327 | 'mailquota' => $this->current_config['expressoAdmin_defaultUserQuota'], |
---|
328 | 'changequote_disabled' => $this->functions->check_acl($manager_lid,'change_users_quote') ? '' : 'readonly', |
---|
329 | 'imapDelimiter' => $_SESSION['phpgw_info']['expresso']['email_server']['imapDelimiter'], |
---|
330 | 'input_mailalternateaddress_fields' => '<input type="text" name="mailalternateaddress[]" id="mailalternateaddress" autocomplete="off" value="{mailalternateaddress}" {disabled} size=30>', |
---|
331 | 'input_mailforwardingaddress_fields'=> '<input type="text" name="mailforwardingaddress[]" id="mailforwardingaddress" autocomplete="off" value="{mailforwardingaddress}" {disabled} size=30>', |
---|
332 | |
---|
333 | 'apps' => $applications_list, |
---|
334 | |
---|
335 | //SAMBA ABA |
---|
336 | 'use_attrs_samba_checked' => 'CHECKED', |
---|
337 | 'sambadomainname_options' => $sambadomainname_options, |
---|
338 | 'sambalogonscript' => $this->current_config['expressoAdmin_defaultLogonScript'] != '' ? $this->current_config['expressoAdmin_defaultLogonScript'] : '', |
---|
339 | 'use_suggestion_in_logon_script' => $this->current_config['expressoAdmin_defaultLogonScript'] == '' ? 'true' : 'false', |
---|
340 | ); |
---|
341 | |
---|
342 | if( (isset($this->current_config['expressoAdmin_loginGenScript'])) && |
---|
343 | ($this->current_config['expressoAdmin_loginGenScript'])) { |
---|
344 | $var['input_uid_disabled'] = 'disabled'; |
---|
345 | $var['comment_button'] = ' '; |
---|
346 | $var['end_comment_button'] = ' '; |
---|
347 | } |
---|
348 | else { |
---|
349 | $var['input_uid_disabled'] = ' '; |
---|
350 | $var['comment_button'] = '<!--'; |
---|
351 | $var['end_comment_button'] = '-->'; |
---|
352 | } |
---|
353 | |
---|
354 | $t->set_var($var); |
---|
355 | $t->set_var($this->functions->make_dinamic_lang($t, 'main')); |
---|
356 | $t->pfp('out','main'); |
---|
357 | } |
---|
358 | |
---|
359 | function view_user() |
---|
360 | { |
---|
361 | ExecMethod('expressoAdmin1_2.uiaccounts.edit_user'); |
---|
362 | return; |
---|
363 | } |
---|
364 | |
---|
365 | function edit_user() |
---|
366 | { |
---|
367 | $manager_account_lid = $GLOBALS['phpgw']->accounts->data['account_lid']; |
---|
368 | $acl = $this->functions->read_acl($manager_account_lid); |
---|
369 | $raw_context = $acl['raw_context']; |
---|
370 | $contexts = $acl['contexts']; |
---|
371 | $alert_warning = ''; |
---|
372 | |
---|
373 | // Verifica se tem acesso a este modulo |
---|
374 | $disabled = 'disabled'; |
---|
375 | $disabled_password = 'disabled'; |
---|
376 | $disabled_samba = 'disabled'; |
---|
377 | $disabled_edit_photo = 'disabled'; |
---|
378 | $disabled_phonenumber = 'disabled'; |
---|
379 | $disabled_group = 'disabled'; |
---|
380 | |
---|
381 | $display_picture = 'none'; |
---|
382 | if ((!$this->functions->check_acl($manager_account_lid,'edit_users')) && |
---|
383 | (!$this->functions->check_acl($manager_account_lid,'change_users_password')) && |
---|
384 | (!$this->functions->check_acl($manager_account_lid,'edit_sambausers_attributes')) && |
---|
385 | (!$this->functions->check_acl($manager_account_lid,'view_users')) && |
---|
386 | (!$this->functions->check_acl($manager_account_lid,'manipulate_corporative_information')) && |
---|
387 | (!$this->functions->check_acl($manager_account_lid,'edit_users_phonenumber')) |
---|
388 | ) |
---|
389 | { |
---|
390 | $GLOBALS['phpgw']->redirect($GLOBALS['phpgw']->link('/expressoAdmin1_2/inc/access_denied.php')); |
---|
391 | } |
---|
392 | // SOMENTE ALTERAÇÃO DE SENHA |
---|
393 | if ((!$this->functions->check_acl($manager_account_lid,'edit_users')) && ($this->functions->check_acl($manager_account_lid,'change_users_password'))) |
---|
394 | { |
---|
395 | $disabled = 'disabled'; |
---|
396 | $disabled_password = ''; |
---|
397 | } |
---|
398 | // SOMENTE ALTERAÇÃO DOS ATRIBUTOS SAMBA |
---|
399 | if ((!$this->functions->check_acl($manager_account_lid,'edit_users')) && ($this->functions->check_acl($manager_account_lid,'edit_sambausers_attributes'))) |
---|
400 | { |
---|
401 | $disabled = 'disabled'; |
---|
402 | $disabled_samba = ''; |
---|
403 | } |
---|
404 | // SOMENTE ALTERAÇÃO DE TELEFONE |
---|
405 | if ((!$this->functions->check_acl($manager_account_lid,'edit_users')) && ($this->functions->check_acl($manager_account_lid,'edit_users_phonenumber'))) |
---|
406 | { |
---|
407 | $disabled = 'disabled'; |
---|
408 | $disabled_phonenumber = ''; |
---|
409 | } |
---|
410 | // SOMENTE GRUPOS |
---|
411 | if ((!$this->functions->check_acl($manager_account_lid,'edit_users')) && ($this->functions->check_acl($manager_account_lid,'edit_groups'))) |
---|
412 | { |
---|
413 | $disabled = 'disabled'; |
---|
414 | $disabled_group = ''; |
---|
415 | } |
---|
416 | // TOTAIS MENOS O SAMBA |
---|
417 | if (($this->functions->check_acl($manager_account_lid,'edit_users')) && (!$this->functions->check_acl($manager_account_lid,'edit_sambausers_attributes'))) |
---|
418 | { |
---|
419 | $disabled = ''; |
---|
420 | $disabled_password = ''; |
---|
421 | $disabled_samba = 'disabled'; |
---|
422 | $disabled_group = ''; |
---|
423 | } |
---|
424 | // TOTAIS |
---|
425 | elseif ($this->functions->check_acl($manager_account_lid,'edit_users')) |
---|
426 | { |
---|
427 | $disabled = ''; |
---|
428 | $disabled_password = ''; |
---|
429 | $disabled_samba = ''; |
---|
430 | $disabled_phonenumber = ''; |
---|
431 | $disabled_group = ''; |
---|
432 | } |
---|
433 | |
---|
434 | if (!$this->functions->check_acl($manager_account_lid,'change_users_quote')) |
---|
435 | $disabled_quote = 'readonly'; |
---|
436 | |
---|
437 | if ($this->functions->check_acl($manager_account_lid,'edit_users_picture')) |
---|
438 | { |
---|
439 | $disabled_edit_photo = ''; |
---|
440 | $display_picture = ''; |
---|
441 | } |
---|
442 | // GET all infomations about the user. |
---|
443 | $user_info = $this->user->get_user_info($_GET['account_id']); |
---|
444 | |
---|
445 | // Formata o CPF |
---|
446 | if ($user_info['corporative_information_cpf'] != '') |
---|
447 | { |
---|
448 | if (strlen($user_info['corporative_information_cpf']) < 11) |
---|
449 | { |
---|
450 | while (strlen($user_info['corporative_information_cpf']) < 11) |
---|
451 | { |
---|
452 | $user_info['corporative_information_cpf'] = '0' . $user_info['corporative_information_cpf']; |
---|
453 | } |
---|
454 | } |
---|
455 | if (strlen($user_info['corporative_information_cpf']) == 11) |
---|
456 | { |
---|
457 | // Compatível com o php4. |
---|
458 | //$cpf_tmp = str_split($user_info['corporative_information_cpf'], 3); |
---|
459 | $cpf_tmp[0] = $user_info['corporative_information_cpf'][0] . $user_info['corporative_information_cpf'][1] . $user_info['corporative_information_cpf'][2]; |
---|
460 | $cpf_tmp[1] = $user_info['corporative_information_cpf'][3] . $user_info['corporative_information_cpf'][4] . $user_info['corporative_information_cpf'][5]; |
---|
461 | $cpf_tmp[2] = $user_info['corporative_information_cpf'][6] . $user_info['corporative_information_cpf'][7] . $user_info['corporative_information_cpf'][8]; |
---|
462 | $cpf_tmp[3] = $user_info['corporative_information_cpf'][9] . $user_info['corporative_information_cpf'][10]; |
---|
463 | $user_info['corporative_information_cpf'] = $cpf_tmp[0] . '.' . $cpf_tmp[1] . '.' . $cpf_tmp[2] . '-' . $cpf_tmp[3]; |
---|
464 | } |
---|
465 | } |
---|
466 | // JavaScript |
---|
467 | $GLOBALS['phpgw']->js->validate_file("jscode","users","expressoAdmin1_2"); |
---|
468 | $GLOBALS['phpgw']->js->set_onload("get_available_groups(document.forms[0].context.value);"); |
---|
469 | $GLOBALS['phpgw']->js->set_onload("get_available_maillists(document.forms[0].context.value);"); |
---|
470 | $GLOBALS['phpgw']->js->set_onload("use_samba_attrs('".$user_info['sambaUser']."');"); |
---|
471 | |
---|
472 | // Seta header. |
---|
473 | unset($GLOBALS['phpgw_info']['flags']['noheader']); |
---|
474 | unset($GLOBALS['phpgw_info']['flags']['nonavbar']); |
---|
475 | |
---|
476 | $GLOBALS['phpgw_info']['flags']['app_header'] = $GLOBALS['phpgw_info']['apps']['expressoAdmin1_2']['title'].' - '.lang('Edit User'); |
---|
477 | $GLOBALS['phpgw']->common->phpgw_header(); |
---|
478 | |
---|
479 | // Seta templates. |
---|
480 | $t = CreateObject('phpgwapi.Template',PHPGW_APP_TPL); |
---|
481 | $t->set_file(array("body" => "accounts_form.tpl")); |
---|
482 | $t->set_block('body','main'); |
---|
483 | |
---|
484 | foreach ($contexts as $index=>$context) |
---|
485 | $combo_manager_org .= $this->functions->get_organizations($context, $user_info['context']); |
---|
486 | $combo_all_orgs = $this->functions->get_organizations($GLOBALS['phpgw_info']['server']['ldap_context'], $user_info['context'], true, true, true); |
---|
487 | |
---|
488 | // GROUPS. |
---|
489 | if (count($user_info['groups_info']) > 0) |
---|
490 | { |
---|
491 | foreach ($user_info['groups_info'] as $group) |
---|
492 | { |
---|
493 | $array_groups[$group['gidnumber']] = $group['cn'].'('.$group['uid'].')'; |
---|
494 | } |
---|
495 | natcasesort($array_groups); |
---|
496 | foreach ($array_groups as $gidnumber=>$cn) |
---|
497 | { |
---|
498 | //Não foi possível encontrar o grupo do usuário, portanto excluimos o usuário(não tem inserir no grupo do Ldap se não possui grupo) |
---|
499 | if (is_null($user_info['groups_ldap'][$gidnumber])) |
---|
500 | { |
---|
501 | $this->db_functions->remove_user2group($gidnumber, $_GET['account_id']); |
---|
502 | if ($alert_warning == '') |
---|
503 | $alert_warning = lang("the expressoadmin corrected the following inconsistencies") . ":\\n"; |
---|
504 | $alert_warning .= lang("user excluded because the group do not was found") . ":\\n$cn - gidnumber: $gidnumber."; |
---|
505 | } |
---|
506 | else |
---|
507 | $ea_select_user_groups_options .= "<option value=" . $gidnumber . ">" . $cn . "</option>"; |
---|
508 | |
---|
509 | if ($gidnumber == $user_info['gidnumber']) |
---|
510 | { |
---|
511 | $ea_combo_primary_user_group_options .= "<option value=" . $gidnumber . " selected>" . $cn . "</option>"; |
---|
512 | } |
---|
513 | else |
---|
514 | { |
---|
515 | $ea_combo_primary_user_group_options .= "<option value=" . $gidnumber . ">" . $cn . "</option>"; |
---|
516 | } |
---|
517 | } |
---|
518 | |
---|
519 | // O memberUid do usuário está somente no Ldap. |
---|
520 | $groups_db = array_flip($user_info['groups']); |
---|
521 | foreach ($user_info['groups_ldap'] as $gidnumber=>$cn) |
---|
522 | { |
---|
523 | if (is_null($groups_db[$gidnumber])) |
---|
524 | { |
---|
525 | /* |
---|
526 | $this->ldap_functions->remove_user2group($gidnumber, $user_info['uid']); |
---|
527 | if ($alert_warning == '') |
---|
528 | $alert_warning = "O expressoAdmin corrigiu as seguintes inconsistências:\\n"; |
---|
529 | $alert_warning .= "Removido atributo memberUid do usuário do grupo $cn.\\n"; |
---|
530 | */ |
---|
531 | $ea_select_user_groups_options .= "<option value=" . $gidnumber . ">" . $cn . " [".lang('only on ldap')."]</option>"; |
---|
532 | } |
---|
533 | } |
---|
534 | } |
---|
535 | |
---|
536 | // MAILLISTS |
---|
537 | if (count($user_info['maillists_info']) > 0) |
---|
538 | { |
---|
539 | foreach ($user_info['maillists_info'] as $maillist) |
---|
540 | { |
---|
541 | $array_maillist[$maillist['uid']] = $maillist['uid'] . " (" . $maillist['mail'] . ") "; |
---|
542 | } |
---|
543 | natcasesort($array_maillist); |
---|
544 | foreach ($array_maillist as $uid=>$option) |
---|
545 | { |
---|
546 | $ea_select_user_maillists_options .= "<option value=" . $uid . ">" . $option.'('.$uid . ")</option>"; |
---|
547 | } |
---|
548 | } |
---|
549 | |
---|
550 | // APPS. |
---|
551 | if ($disabled == 'disabled') |
---|
552 | $apps = $this->functions->make_list_app($manager_account_lid, $user_info['apps'], 'disabled'); |
---|
553 | else |
---|
554 | $apps = $this->functions->make_list_app($manager_account_lid, $user_info['apps']); |
---|
555 | |
---|
556 | //PHOTO |
---|
557 | if ($user_info['photo_exist']) |
---|
558 | { |
---|
559 | $photo_bin = "./index.php?menuaction=expressoAdmin1_2.uiaccounts.show_photo&uidNumber=".$_GET['account_id']; |
---|
560 | } |
---|
561 | else |
---|
562 | { |
---|
563 | $photo_bin = $GLOBALS['phpgw_info']['server']['webserver_url'] . '/expressoAdmin1_2/templates/default/images/photo_celepar.png'; |
---|
564 | $disabled_delete_photo = 'disabled'; |
---|
565 | } |
---|
566 | |
---|
567 | // Cria combo de dominios do samba |
---|
568 | if ($this->current_config['expressoAdmin_samba_support'] == 'true') |
---|
569 | { |
---|
570 | $a_sambadomains = $this->db_functions->get_sambadomains_list(); |
---|
571 | $sambadomainname_options = ''; |
---|
572 | if (count($a_sambadomains)) |
---|
573 | { |
---|
574 | foreach ($a_sambadomains as $a_sambadomain) |
---|
575 | { |
---|
576 | if ($a_sambadomain['samba_domain_sid'] == $user_info['sambasid']) |
---|
577 | $sambadomainname_options .= "<option value='" . $a_sambadomain['samba_domain_sid'] . "' SELECTED>" . $a_sambadomain['samba_domain_name'] . "</option>"; |
---|
578 | else |
---|
579 | $sambadomainname_options .= "<option value='" . $a_sambadomain['samba_domain_sid'] . "'>" . $a_sambadomain['samba_domain_name'] . "</option>"; |
---|
580 | } |
---|
581 | } |
---|
582 | } |
---|
583 | |
---|
584 | // Mail Alternate & Forwarding |
---|
585 | if (is_array($user_info['mailalternateaddress'])) |
---|
586 | { |
---|
587 | for ($i = 0; $i < $user_info['mailalternateaddress']['count']; ++$i) |
---|
588 | { |
---|
589 | if ($i > 0) |
---|
590 | $input_mailalternateaddress_fields .= '<br>'; |
---|
591 | $input_mailalternateaddress_fields .= '<input type="text" name="mailalternateaddress[]" id="mailalternateaddress" autocomplete="off" value="'.$user_info['mailalternateaddress'][$i].'" {disabled} size=30>'; |
---|
592 | } |
---|
593 | } |
---|
594 | else |
---|
595 | { |
---|
596 | $input_mailalternateaddress_fields = '<input type="text" name="mailalternateaddress[]" id="mailalternateaddress" autocomplete="off" value="" {disabled} size=30>'; |
---|
597 | } |
---|
598 | |
---|
599 | if (is_array($user_info['mailforwardingaddress'])) |
---|
600 | { |
---|
601 | for ($i = 0; $i < $user_info['mailforwardingaddress']['count']; ++$i) |
---|
602 | { |
---|
603 | if ($i > 0) |
---|
604 | $input_mailforwardingaddress_fields .= '<br>'; |
---|
605 | $input_mailforwardingaddress_fields .= '<input type="text" name="mailforwardingaddress[]" id="mailforwardingaddress" autocomplete="off" value="'.$user_info['mailforwardingaddress'][$i].'" {disabled} size=30>'; |
---|
606 | } |
---|
607 | } |
---|
608 | else |
---|
609 | { |
---|
610 | $input_mailforwardingaddress_fields = '<input type="text" name="mailforwardingaddress[]" id="mailforwardingaddress" autocomplete="off" value="" {disabled} size=30>'; |
---|
611 | } |
---|
612 | |
---|
613 | $start_coment = "<!--"; |
---|
614 | $end_coment = "-->"; |
---|
615 | $time_to_expire = $GLOBALS['phpgw_info']['server']['time_to_account_expires']; |
---|
616 | if(isset($time_to_expire)) { |
---|
617 | if ($GLOBALS['phpgw']->session->get_last_access_on_history($user_info["uidnumber"])+($time_to_expire*86400) < time()) |
---|
618 | { |
---|
619 | $start_coment = ""; |
---|
620 | $end_coment = ""; |
---|
621 | } |
---|
622 | } |
---|
623 | |
---|
624 | if ($alert_warning != '') |
---|
625 | $alert_warning = "alert('". $alert_warning ."')"; |
---|
626 | |
---|
627 | $var = Array( |
---|
628 | 'uidnumber' => $_GET['account_id'], |
---|
629 | 'type' => 'edit_user', |
---|
630 | 'photo_exist' => $user_info['photo_exist'], |
---|
631 | 'departmentnumber' => $user_info['departmentnumber'], |
---|
632 | 'user_context' => $user_info['context'], |
---|
633 | |
---|
634 | 'row_on' => "#DDDDDD", |
---|
635 | 'row_off' => "#EEEEEE", |
---|
636 | 'color_bg1' => "#E8F0F0", |
---|
637 | 'action' => $GLOBALS['phpgw']->link('/index.php','menuaction=expressoAdmin1_2.uiaccounts.validate_user_data_edit'), |
---|
638 | 'back_url' => './index.php?menuaction=expressoAdmin1_2.uiaccounts.list_users', |
---|
639 | 'disabled' => $disabled, |
---|
640 | 'disabled_password' => $disabled_password, |
---|
641 | 'disabled_samba' => $disabled_samba, |
---|
642 | 'changequote_disabled' => $disabled_quote, |
---|
643 | 'disable_phonenumber' => $disabled_phonenumber, |
---|
644 | 'disable_group' => $disabled_group, |
---|
645 | 'lang_account_expired' => lang('lang_account_expired'), |
---|
646 | 'lang_yes' => lang('yes'), |
---|
647 | 'lang_no' => lang('no'), |
---|
648 | 'start_coment_expired' => $start_coment, |
---|
649 | 'end_coment_expired' => $end_coment, |
---|
650 | |
---|
651 | // Display ABAS |
---|
652 | 'display_corporative_information'=> $this->functions->check_acl($manager_account_lid,'manipulate_corporative_information') ? '' : 'none', |
---|
653 | 'display_applications' => $this->functions->check_acl($manager_account_lid,'display_applications') ? '' : 'none', |
---|
654 | 'display_emaillists' => $this->functions->check_acl($manager_account_lid,'display_emaillists') ? '' : 'none', |
---|
655 | 'display_groups' => $this->functions->check_acl($manager_account_lid,'display_groups') ? '' : 'none', |
---|
656 | 'display_emailconfig' => $this->functions->check_acl($manager_account_lid,'display_emailconfig') ? '' : 'none', |
---|
657 | |
---|
658 | // First ABA |
---|
659 | 'alert_warning' => "$alert_warning", |
---|
660 | 'display_input_account_lid' => 'display:none', |
---|
661 | 'sectors' => $combo_manager_org, |
---|
662 | 'combo_organizations' => $combo_manager_org, |
---|
663 | 'combo_all_orgs' => $combo_all_orgs, |
---|
664 | 'uid' => $user_info['uid'], |
---|
665 | 'givenname' => $user_info['givenname'], |
---|
666 | 'mail1' => $user_info['mail'], |
---|
667 | 'sn' => $user_info['sn'], |
---|
668 | 'telephonenumber' => $user_info['telephonenumber'], |
---|
669 | 'photo_bin' => $photo_bin, |
---|
670 | 'disabled_edit_photo' => $disabled_edit_photo, |
---|
671 | 'display_picture' => $display_picture, |
---|
672 | 'display_tr_default_password' => $this->functions->check_acl($manager_account_lid,'set_user_default_password') ? '' : 'none', |
---|
673 | 'passwd_expired_checked' => $user_info['passwd_expired'] == '0' ? 'CHECKED' : '', |
---|
674 | 'changepassword_checked' => $user_info['changepassword'] == '1' ? 'CHECKED' : '', |
---|
675 | 'phpgwaccountstatus_checked' => $user_info['phpgwaccountstatus'] == 'A' ? 'CHECKED' : '', |
---|
676 | 'phpgwaccountvisible_checked' => $user_info['phpgwaccountvisible'] == '-1' ? 'CHECKED' : '', |
---|
677 | |
---|
678 | // Corporative Information |
---|
679 | 'corporative_information_employeenumber' => $user_info['corporative_information_employeenumber'], |
---|
680 | 'corporative_information_cpf' => $user_info['corporative_information_cpf'], |
---|
681 | 'corporative_information_rg' => $user_info['corporative_information_rg'], |
---|
682 | 'corporative_information_rguf' => $user_info['corporative_information_rguf'], |
---|
683 | 'corporative_information_description' => $user_info['corporative_information_description'], |
---|
684 | |
---|
685 | //MAIL |
---|
686 | 'disabled_quota_used' => 'disabled', |
---|
687 | 'accountstatus_checked' => $user_info['accountstatus'] == 'active' ? 'CHECKED' : '', |
---|
688 | 'mail' => $user_info['mail'], |
---|
689 | 'input_mailalternateaddress_fields' => $input_mailalternateaddress_fields, |
---|
690 | 'input_mailforwardingaddress_fields'=> $input_mailforwardingaddress_fields, |
---|
691 | 'deliverymode_checked' => $user_info['deliverymode'] == 'forwardOnly' ? 'CHECKED' : '', |
---|
692 | 'mailquota' => $user_info['mailquota'] == '-1' ? '' : $user_info['mailquota'], |
---|
693 | 'mailquota_used' => $user_info['mailquota_used'] == '-1' ? lang('without quota') : $user_info['mailquota_used'], |
---|
694 | |
---|
695 | //Third ABA |
---|
696 | 'ea_select_user_groups_options' => $ea_select_user_groups_options, |
---|
697 | 'ea_combo_primary_user_group_options' => $ea_combo_primary_user_group_options, |
---|
698 | |
---|
699 | //Fourd ABA |
---|
700 | 'ea_select_user_maillists_options' => $ea_select_user_maillists_options, |
---|
701 | |
---|
702 | //Five ABA |
---|
703 | 'apps' => $apps, |
---|
704 | |
---|
705 | //SAMBA ABA |
---|
706 | 'userSamba' => $user_info['sambaUser'], |
---|
707 | 'sambadomainname_options' => $sambadomainname_options, |
---|
708 | 'use_attrs_samba_checked' => $user_info['sambaUser'] ? 'CHECKED' : '', |
---|
709 | 'active_user_selected' => $user_info['sambaaccflags'] == '[U ]' ? 'selected' : '', |
---|
710 | 'desactive_user_selected' => $user_info['sambaaccflags'] == '[DU ]' ? 'selected' : '', |
---|
711 | 'sambalogonscript' => $user_info['sambalogonscript'], |
---|
712 | 'sambahomedirectory' => $user_info['homedirectory'], |
---|
713 | 'defaultLogonScript' => $this->current_config['expressoAdmin_defaultLogonScript'], |
---|
714 | 'use_suggestion_in_logon_script' => $this->current_config['expressoAdmin_defaultLogonScript'] == '' ? 'true' : 'false' |
---|
715 | ); |
---|
716 | $t->set_var($var); |
---|
717 | $t->set_var($this->functions->make_dinamic_lang($t, 'main')); |
---|
718 | |
---|
719 | // Devo mostrar aba SAMBA ?? |
---|
720 | if ( ($this->current_config['expressoAdmin_samba_support'] == 'true') && ($this->functions->check_acl($manager_account_lid,'edit_sambausers_attributes')) ) |
---|
721 | $t->set_var('display_samba_suport', ''); |
---|
722 | else |
---|
723 | $t->set_var('display_samba_suport', 'none'); |
---|
724 | |
---|
725 | $t->pfp('out','body'); |
---|
726 | } |
---|
727 | |
---|
728 | function row_action($action,$type,$account_id) |
---|
729 | { |
---|
730 | return '<a href="'.$GLOBALS['phpgw']->link('/index.php',Array( |
---|
731 | 'menuaction' => 'expressoAdmin1_2.uiaccounts.'.$action.'_'.$type, |
---|
732 | 'account_id' => $account_id |
---|
733 | )).'"> '.lang($action).' </a>'; |
---|
734 | } |
---|
735 | |
---|
736 | function css() |
---|
737 | { |
---|
738 | $appCSS = |
---|
739 | 'th.activetab |
---|
740 | { |
---|
741 | color:#000000; |
---|
742 | background-color:#D3DCE3; |
---|
743 | border-top-width : 1px; |
---|
744 | border-top-style : solid; |
---|
745 | border-top-color : Black; |
---|
746 | border-left-width : 1px; |
---|
747 | border-left-style : solid; |
---|
748 | border-left-color : Black; |
---|
749 | border-right-width : 1px; |
---|
750 | border-right-style : solid; |
---|
751 | border-right-color : Black; |
---|
752 | font-size: 12px; |
---|
753 | font-family: Tahoma, Arial, Helvetica, sans-serif; |
---|
754 | } |
---|
755 | |
---|
756 | th.inactivetab |
---|
757 | { |
---|
758 | color:#000000; |
---|
759 | background-color:#E8F0F0; |
---|
760 | border-bottom-width : 1px; |
---|
761 | border-bottom-style : solid; |
---|
762 | border-bottom-color : Black; |
---|
763 | font-size: 12px; |
---|
764 | font-family: Tahoma, Arial, Helvetica, sans-serif; |
---|
765 | } |
---|
766 | |
---|
767 | .td_left {border-left:1px solid Gray; border-top:1px solid Gray; border-bottom:1px solid Gray;} |
---|
768 | .td_right {border-right:1px solid Gray; border-top:1px solid Gray; border-bottom:1px solid Gray;} |
---|
769 | |
---|
770 | div.activetab{ display:inline; } |
---|
771 | div.inactivetab{ display:none; }'; |
---|
772 | |
---|
773 | return $appCSS; |
---|
774 | } |
---|
775 | |
---|
776 | function show_photo() |
---|
777 | { |
---|
778 | $uidNumber = $_GET['uidNumber']; |
---|
779 | $photo = $this->get_photo($uidNumber); |
---|
780 | |
---|
781 | if ($photo) |
---|
782 | { |
---|
783 | header("Content-Type: image/jpeg"); |
---|
784 | $width = imagesx($photo); |
---|
785 | $height = imagesy($photo); |
---|
786 | $twidth = 80; |
---|
787 | $theight = 106; |
---|
788 | $small_photo = imagecreatetruecolor ($twidth, $theight); |
---|
789 | imagecopyresampled($small_photo, $photo, 0, 0, 0, 0,$twidth, $theight, $width, $height); |
---|
790 | imagejpeg($small_photo,"",100); |
---|
791 | return; |
---|
792 | } |
---|
793 | } |
---|
794 | |
---|
795 | function get_photo($uidNumber) |
---|
796 | { |
---|
797 | $ldap_conn = $GLOBALS['phpgw']->common->ldapConnect(); |
---|
798 | $filter="(&(phpgwAccountType=u)(uidNumber=".$uidNumber."))"; |
---|
799 | $justthese = array("jpegphoto"); |
---|
800 | |
---|
801 | $search = ldap_search($ldap_conn, $GLOBALS['phpgw_info']['server']['ldap_context'], $filter, $justthese); |
---|
802 | $entry = ldap_first_entry($ldap_conn, $search); |
---|
803 | $jpeg_data = ldap_get_values_len($ldap_conn, $entry, "jpegphoto"); |
---|
804 | $jpegphoto = imagecreatefromstring($jpeg_data[0]); |
---|
805 | return $jpegphoto; |
---|
806 | } |
---|
807 | |
---|
808 | function show_access_log() |
---|
809 | { |
---|
810 | $account_id = $_GET['account_id']; |
---|
811 | |
---|
812 | $manager_account_lid = $GLOBALS['phpgw']->accounts->data['account_lid']; |
---|
813 | $tmp = $this->functions->read_acl($manager_account_lid); |
---|
814 | $manager_context = $tmp[0]['context']; |
---|
815 | |
---|
816 | // Verifica se tem acesso a este modulo |
---|
817 | if ((!$this->functions->check_acl($manager_account_lid,'edit_users')) && (!$this->functions->check_acl($manager_account_lid,'change_users_password'))) |
---|
818 | { |
---|
819 | $GLOBALS['phpgw']->redirect($GLOBALS['phpgw']->link('/expressoAdmin1_2/inc/access_denied.php')); |
---|
820 | } |
---|
821 | |
---|
822 | // Seta header. |
---|
823 | unset($GLOBALS['phpgw_info']['flags']['noheader']); |
---|
824 | unset($GLOBALS['phpgw_info']['flags']['nonavbar']); |
---|
825 | |
---|
826 | $GLOBALS['phpgw_info']['flags']['app_header'] = $GLOBALS['phpgw_info']['apps']['expressoAdmin1_2']['title'].' - '.lang('Access Log'); |
---|
827 | $GLOBALS['phpgw']->common->phpgw_header(); |
---|
828 | |
---|
829 | // Seta templates. |
---|
830 | $t = CreateObject('phpgwapi.Template',PHPGW_APP_TPL); |
---|
831 | $t->set_file(array("body" => "accesslog.tpl")); |
---|
832 | $t->set_block('body','main'); |
---|
833 | $t->set_block('body','row','row'); |
---|
834 | |
---|
835 | // GET access log from the user. |
---|
836 | $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__); |
---|
837 | while ($GLOBALS['phpgw']->db->next_record()) |
---|
838 | { |
---|
839 | $records[] = array( |
---|
840 | 'loginid' => $GLOBALS['phpgw']->db->f('loginid'), |
---|
841 | 'ip' => $GLOBALS['phpgw']->db->f('ip'), |
---|
842 | 'li' => $GLOBALS['phpgw']->db->f('li'), |
---|
843 | 'lo' => $GLOBALS['phpgw']->db->f('lo'), |
---|
844 | 'account_id' => $GLOBALS['phpgw']->db->f('account_id'), |
---|
845 | 'sessionid' => $GLOBALS['phpgw']->db->f('sessionid') |
---|
846 | ); |
---|
847 | } |
---|
848 | |
---|
849 | // Seta as vcariaveis |
---|
850 | while (is_array($records) && list(,$record) = each($records)) |
---|
851 | { |
---|
852 | $var = array( |
---|
853 | 'row_loginid' => $record['loginid'], |
---|
854 | 'row_ip' => $record['ip'], |
---|
855 | 'row_li' => date("d/m/Y - H:i:s", $record['li']), |
---|
856 | 'row_lo' => $record['lo'] == 0 ? 0 : date("d/m/Y - H:i:s", $record['lo']) |
---|
857 | ); |
---|
858 | $t->set_var($var); |
---|
859 | $t->fp('rows','row',True); |
---|
860 | } |
---|
861 | |
---|
862 | $var = Array( |
---|
863 | 'th_bg' => $GLOBALS['phpgw_info']['theme']['th_bg'], |
---|
864 | 'back_url' => "./index.php?menuaction=expressoAdmin1_2.uiaccounts.edit_user&account_id=$account_id", |
---|
865 | ); |
---|
866 | $t->set_var($var); |
---|
867 | $t->set_var($this->functions->make_dinamic_lang($t, 'body')); |
---|
868 | $t->pfp('out','body'); |
---|
869 | } |
---|
870 | } |
---|
871 | ?> |
---|