2000-08-18 05:24:22 +02:00
|
|
|
<?php
|
2001-02-26 16:50:51 +01:00
|
|
|
/**************************************************************************\
|
|
|
|
* phpGroupWare - administration *
|
|
|
|
* http://www.phpgroupware.org *
|
|
|
|
* Written by Joseph Engo <jengo@phpgroupware.org> *
|
|
|
|
* -------------------------------------------- *
|
|
|
|
* This program is free software; you can redistribute it and/or modify it *
|
|
|
|
* under the terms of the GNU General Public License as published by the *
|
|
|
|
* Free Software Foundation; either version 2 of the License, or (at your *
|
|
|
|
* option) any later version. *
|
|
|
|
\**************************************************************************/
|
|
|
|
|
|
|
|
/* $Id$ */
|
|
|
|
|
|
|
|
if (! $account_id)
|
|
|
|
{
|
|
|
|
$phpgw_info['flags'] = array(
|
|
|
|
'nonavbar' => True,
|
|
|
|
'noheader' => True
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
$phpgw_info['flags']['enable_nextmatchs_class'] = True;
|
|
|
|
$phpgw_info['flags']['currentapp'] = 'admin';
|
|
|
|
$phpgw_info['flags']['parent_page'] = 'accounts.php';
|
|
|
|
|
|
|
|
include('../header.inc.php');
|
|
|
|
|
|
|
|
if (! $account_id)
|
|
|
|
{
|
2001-03-09 00:32:22 +01:00
|
|
|
Header('Location: ' . $phpgw->link('/admin/accounts.php'));
|
2001-02-26 16:50:51 +01:00
|
|
|
}
|
|
|
|
|
2001-05-11 15:07:04 +02:00
|
|
|
$t = CreateObject('phpgwapi.Template',PHPGW_APP_TPL);
|
2001-02-26 16:50:51 +01:00
|
|
|
$t->set_unknowns('remove');
|
2001-05-11 14:49:08 +02:00
|
|
|
$t->set_file(array('account' => 'account_form.tpl'));
|
|
|
|
$t->set_block('account','form','form');
|
2001-07-13 09:02:34 +02:00
|
|
|
$t->set_block('account','form_logininfo');
|
|
|
|
$t->set_block('account','link_row');
|
2001-02-26 16:50:51 +01:00
|
|
|
|
|
|
|
$t->set_var('th_bg',$phpgw_info['theme']['th_bg']);
|
|
|
|
$t->set_var('tr_color1',$phpgw_info['theme']['row_on']);
|
|
|
|
$t->set_var('tr_color2',$phpgw_info['theme']['row_off']);
|
|
|
|
$t->set_var('lang_action',lang('View user account'));
|
|
|
|
$t->set_var('lang_loginid',lang('LoginID'));
|
|
|
|
$t->set_var('lang_account_active',lang('Account active'));
|
|
|
|
$t->set_var('lang_password',lang('Password'));
|
|
|
|
$t->set_var('lang_reenter_password',lang('Re-Enter Password'));
|
|
|
|
$t->set_var('lang_lastname',lang('Last Name'));
|
|
|
|
$t->set_var('lang_groups',lang('Groups'));
|
|
|
|
$t->set_var('lang_firstname',lang('First Name'));
|
|
|
|
$t->set_var('lang_lastlogin',lang('Last login'));
|
|
|
|
$t->set_var('lang_lastloginfrom',lang('Last login from'));
|
2001-05-06 13:20:02 +02:00
|
|
|
$t->set_var('lang_expires',lang('Expires'));
|
2001-02-26 16:50:51 +01:00
|
|
|
|
|
|
|
$account = CreateObject('phpgwapi.accounts',$account_id);
|
|
|
|
$userData = $account->read_repository();
|
|
|
|
|
|
|
|
$t->set_var('account_lid',$userData['account_lid']);
|
|
|
|
$t->set_var('account_firstname',$userData['firstname']);
|
|
|
|
$t->set_var('account_lastname',$userData['lastname']);
|
|
|
|
|
|
|
|
// Account status
|
|
|
|
if ($userData['status'])
|
|
|
|
{
|
|
|
|
$t->set_var('account_status',lang('Enabled'));
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$t->set_var('account_status','<b>' . lang('Disabled') . '</b>');
|
|
|
|
}
|
|
|
|
|
|
|
|
// Last login time
|
2001-04-07 14:08:39 +02:00
|
|
|
if ($userData['lastlogin'])
|
2001-02-26 16:50:51 +01:00
|
|
|
{
|
|
|
|
$t->set_var('account_lastlogin',$phpgw->common->show_date($userData['lastlogin']));
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$t->set_var('account_lastlogin',lang('Never'));
|
|
|
|
}
|
|
|
|
|
|
|
|
// Last login IP
|
2001-04-07 14:08:39 +02:00
|
|
|
if ($userData['lastloginfrom'])
|
2001-02-26 16:50:51 +01:00
|
|
|
{
|
|
|
|
$t->set_var('account_lastloginfrom',$userData['lastloginfrom']);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$t->set_var('account_lastloginfrom',lang('Never'));
|
|
|
|
}
|
|
|
|
$t->parse('password_fields','form_logininfo',True);
|
|
|
|
|
2001-05-06 13:20:02 +02:00
|
|
|
// Account expires
|
|
|
|
if ($userData['expires'] != -1)
|
|
|
|
{
|
|
|
|
$t->set_var('input_expires',$phpgw->common->show_date($userData['expires']));
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$t->set_var('input_expires',lang('Never'));
|
|
|
|
}
|
2001-02-26 16:50:51 +01:00
|
|
|
|
|
|
|
// Find out which groups they are members of
|
2001-08-04 16:26:10 +02:00
|
|
|
$usergroups = $account->membership(intval($account_id));
|
2001-02-26 16:50:51 +01:00
|
|
|
if (gettype($usergroups) != 'array')
|
|
|
|
{
|
|
|
|
$t->set_var('groups_select',lang('None'));
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
while (list(,$group) = each($usergroups))
|
|
|
|
{
|
|
|
|
$group_names[] = $group['account_name'];
|
|
|
|
}
|
|
|
|
$t->set_var('groups_select',implode(',',$group_names));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
$loginid = $userData["account_lid"];
|
|
|
|
$account_lastlogin = $userData["account_lastlogin"];
|
|
|
|
$account_lastloginfrom = $userData["account_lastloginfrom"];
|
|
|
|
$account_status = $userData["account_status"];
|
|
|
|
|
|
|
|
|
|
|
|
// create list of available app
|
|
|
|
$i = 0;
|
|
|
|
|
|
|
|
$availableApps = $phpgw_info['apps'];
|
|
|
|
@asort($availableApps);
|
|
|
|
@reset($availableApps);
|
|
|
|
while ($application = each($availableApps))
|
|
|
|
{
|
2001-06-03 23:22:10 +02:00
|
|
|
if ($application[1]['enabled'] && $application[1]['status'] != 2)
|
2001-02-26 16:50:51 +01:00
|
|
|
{
|
|
|
|
$perm_display[$i]['appName'] = $application[0];
|
|
|
|
$perm_display[$i]['translatedName'] = $application[1]['title'];
|
|
|
|
$i++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// create apps output
|
|
|
|
$apps = CreateObject('phpgwapi.applications',intval($account_id));
|
|
|
|
$db_perms = $apps->read_account_specific();
|
|
|
|
|
|
|
|
@reset($db_perms);
|
|
|
|
|
|
|
|
for ($i=0;$i<=count($perm_display);$i++)
|
|
|
|
{
|
|
|
|
$checked = '';
|
|
|
|
if ($_userData['account_permissions'][$perm_display[$i]['appName']] || $db_perms[$perm_display[$i]['appName']])
|
|
|
|
{
|
|
|
|
$checked = ' X';
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$checked = ' ';
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($perm_display[$i]['translatedName'])
|
|
|
|
{
|
|
|
|
$part1 = sprintf("<td>%s</td><td>%s</td>",lang($perm_display[$i]['translatedName']),$checked);
|
|
|
|
}
|
|
|
|
|
|
|
|
$i++;
|
|
|
|
|
|
|
|
if ($_userData['account_permissions'][$perm_display[$i]['appName']] || $db_perms[$perm_display[$i]['appName']])
|
|
|
|
{
|
|
|
|
$checked = ' X';
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$checked = ' ';
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($perm_display[$i]['translatedName'])
|
|
|
|
{
|
|
|
|
$part2 = sprintf("<td>%s</td><td>%s</td>",lang($perm_display[$i]['translatedName']),$checked);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$part2 = '<td colspan="2"> </td>';
|
|
|
|
}
|
|
|
|
|
|
|
|
$appRightsOutput .= sprintf("<tr bgcolor=\"%s\">$part1$part2</tr>\n",$phpgw_info["theme"]["row_on"]);
|
|
|
|
}
|
|
|
|
|
|
|
|
$t->set_var('permissions_list',$appRightsOutput);
|
|
|
|
|
2001-08-28 23:50:10 +02:00
|
|
|
// create the menu on the left, if needed
|
|
|
|
$menuClass = CreateObject('admin.uimenuclass');
|
|
|
|
$t->set_var('rows',$menuClass->createHTMLCode('view_account'));
|
|
|
|
|
2001-02-26 16:50:51 +01:00
|
|
|
$t->pfp('out','form');
|
|
|
|
$phpgw->common->phpgw_footer();
|
2001-05-11 14:49:08 +02:00
|
|
|
?>
|