True,
'add_users' => True,
'edit_user' => True,
'view_user' => True,
'show_photo' => True,
'show_access_log' => True,
'css' => True
);
var $nextmatchs;
var $user;
var $functions;
var $current_config;
var $ldap_functions;
var $db_functions;
function uiaccounts()
{
$this->user = CreateObject('expressoAdmin1_2.user');
$this->nextmatchs = CreateObject('phpgwapi.nextmatchs');
$this->functions = CreateObject('expressoAdmin1_2.functions');
$this->ldap_functions = CreateObject('expressoAdmin1_2.ldap_functions');
$this->db_functions = CreateObject('expressoAdmin1_2.db_functions');
$c = CreateObject('phpgwapi.config','expressoAdmin1_2');
$c->read_repository();
$this->current_config = $c->config_data;
if(!@is_object($GLOBALS['phpgw']->js))
{
$GLOBALS['phpgw']->js = CreateObject('phpgwapi.javascript');
}
$GLOBALS['phpgw']->js->validate_file('jscode','connector','expressoAdmin1_2');#diretorio, arquivo.js, aplicacao
$GLOBALS['phpgw']->js->validate_file('jscode','expressoadmin','expressoAdmin1_2');
$GLOBALS['phpgw']->js->validate_file('jscode','tabs','expressoAdmin1_2');
$GLOBALS['phpgw']->js->validate_file('jscode','users','expressoAdmin1_2');
}
function list_users()
{
$account_lid = $GLOBALS['phpgw']->accounts->data['account_lid'];
$tmp = $this->functions->read_acl($account_lid);
$context = $tmp[0]['context'];
$context_display = $tmp[0]['context_display'];
// Verifica se o administrador tem acesso.
if (!$this->functions->check_acl($account_lid,'list_users'))
{
$GLOBALS['phpgw']->redirect($GLOBALS['phpgw']->link('/expressoAdmin1_2/inc/access_denied.php'));
}
if(isset($_POST['query']))
{
// limit query to limit characters
if(eregi('^[a-z_0-9_-].+$',$_POST['query']))
{
$GLOBALS['query'] = $_POST['query'];
}
}
unset($GLOBALS['phpgw_info']['flags']['noheader']);
unset($GLOBALS['phpgw_info']['flags']['nonavbar']);
$GLOBALS['phpgw_info']['flags']['app_header'] = $GLOBALS['phpgw_info']['apps']['expressoAdmin1_2']['title'].' - '.lang('User accounts');
$GLOBALS['phpgw']->common->phpgw_header();
$p = CreateObject('phpgwapi.Template',PHPGW_APP_TPL);
$p->set_file(Array('accounts' => 'accounts.tpl'));
$p->set_block('accounts','body');
$p->set_block('accounts','row');
$p->set_block('accounts','row_empty');
$var = Array(
'bg_color' => $GLOBALS['phpgw_info']['theme']['bg_color'],
'th_bg' => $GLOBALS['phpgw_info']['theme']['th_bg'],
'accounts_url' => $GLOBALS['phpgw']->link('/index.php','menuaction=expressoAdmin1_2.uiaccounts.list_users'),
'back_url' => $GLOBALS['phpgw']->link('/expressoAdmin1_2/index.php'),
'add_action' => $GLOBALS['phpgw']->link('/index.php','menuaction=expressoAdmin1_2.uiaccounts.add_users'),
'create_user_disabled' => $this->functions->check_acl($account_lid,'add_users') ? '' : 'disabled',
'context' => $context,
'context_display' => $context_display,
'imapDelimiter' => $_SESSION['phpgw_info']['expresso']['email_server']['imapDelimiter'],
'lang_create_user' => lang('Create User'),
'lang_loginid' => lang('LoginID'),
'lang_cn' => lang('Name'),
'lang_mail' => lang('E-mail'),
'lang_edit' => lang('edit'),
'lang_rename' => lang('rename'),
'lang_delete' => lang('delete'),
'lang_search' => lang('Search'),
'lang_back' => lang('back'),
'lang_context' => lang('Context')
);
$p->set_var($var);
// Save query
$p->set_var('query', $GLOBALS['query']);
//Admin make a search
if ($GLOBALS['query'] != '')
{
$account_info = $this->functions->get_list('accounts', $GLOBALS['query'], $context);
}
if (!count($account_info) && $GLOBALS['query'] != '')
{
$p->set_var('message',lang('No matches found'));
$p->parse('rows','row_empty',True);
}
else if (count($account_info))
{ // Can edit, delete or rename users ??
if (($this->functions->check_acl($account_lid,'edit_users')) ||
($this->functions->check_acl($account_lid,'change_users_password')) ||
($this->functions->check_acl($account_lid,'edit_sambausers_attributes')) ||
($this->functions->check_acl($account_lid,'change_users_quote')))
$can_edit = True;
elseif ($this->functions->check_acl($account_lid,'view_users'))
$can_view = True;
if ($this->functions->check_acl($account_lid,'delete_users'))
$can_delete = True;
if ($this->functions->check_acl($account_lid,'rename_users'))
$can_rename = True;
while (list($null,$account) = each($account_info))
{
$this->nextmatchs->template_alternate_row_color($p);
$var = array(
'row_loginid' => $account['account_lid'],
'row_cn' => $account['account_cn'],
'row_mail' => (!$account['account_mail']?'Sem E-mail':$account['account_mail']),
'row_create' => $account['account_expresso']
);
$p->set_var($var);
if ($can_edit)
//$p->set_var('row_edit',$this->row_action('edit','user',$account['account_id']));
if($account['account_deleted'])
$p->set_var('row_edit',' ');
else
$p->set_var('row_edit',$this->row_action($account['account_expresso']?'edit':'create_e','user',$account['account_id']));
elseif ($can_view)
$p->set_var('row_edit',$this->row_action('view','user',$account['account_id']));
else
$p->set_var('row_edit',' ');
if ($can_rename)
$p->set_var('row_rename',"Renomear");
else
$p->set_var('row_rename',' ');
if ($can_delete)
{
$p->set_var('row_delete',$account['account_deleted']?"Excluir":"Excluir");
}
else
$p->set_var('row_delete',' ');
$p->parse('rows','row',True);
}
}
$p->pfp('out','body');
}
function add_users()
{
$GLOBALS['phpgw']->js->validate_file('jscode','users','expressoAdmin1_2');
$GLOBALS['phpgw']->js->set_onload('get_available_groups(document.forms[0].context.value);');
$GLOBALS['phpgw']->js->set_onload('get_available_maillists(document.forms[0].context.value);');
if ($this->current_config['expressoAdmin_samba_support'] == 'true')
$GLOBALS['phpgw']->js->set_onload('get_available_sambadomains(document.forms[0].context.value, \'create_user\');');
$manager_lid = $GLOBALS['phpgw']->accounts->data['account_lid'];
$tmp = $this->functions->read_acl($manager_lid);
$manager_context = $tmp[0]['context'];
// Verifica se tem acesso a este modulo
if (!$this->functions->check_acl($manager_lid,'add_users'))
{
$GLOBALS['phpgw']->redirect($GLOBALS['phpgw']->link('/expressoAdmin1_2/inc/access_denied.php'));
}
// Imprime nav_bar
unset($GLOBALS['phpgw_info']['flags']['noheader']);
unset($GLOBALS['phpgw_info']['flags']['nonavbar']);
$GLOBALS['phpgw_info']['flags']['app_header'] = $GLOBALS['phpgw_info']['apps']['expressoAdmin1_2']['title'].' - '.lang('Create User');
$GLOBALS['phpgw']->common->phpgw_header();
// Seta template
$GLOBALS['phpgw']->js = CreateObject('phpgwapi.javascript');
$t = CreateObject('phpgwapi.Template',PHPGW_APP_TPL);
$t->set_file(array("body" => "accounts_form.tpl"));
$t->set_block('body','main');
// Pega combo das organiza��es e seleciona, caso seja um post, o setor que o usuario selecionou.
$sectors = $this->functions->get_organizations($manager_context);
// Chama funcao para criar lista de aplicativos disponiveis.
//$app_list['applications_list'] = $_POST['applications_list'];
$applications_list = $this->functions->make_list_app($manager_lid, $manager_context, $app_list);
// Cria combo de dominio samba
if ($this->current_config['expressoAdmin_samba_support'] == 'true')
{
$a_sambadomains = $this->db_functions->get_sambadomains_list();
$sambadomainname_options = '';
if (count($a_sambadomains))
{
foreach ($a_sambadomains as $a_sambadomain)
{
// So mostra os sambaDomainName do contexto do manager
if ($this->ldap_functions->exist_sambadomains($manager_context, $a_sambadomain['samba_domain_name']))
$sambadomainname_options .= "";
}
}
}
// Valores default.
$var = Array(
'row_on' => "#DDDDDD",
'row_off' => "#EEEEEE",
'color_bg1' => "#E8F0F0",
'manager_context' => $manager_context,
'type' => 'create_user',
'back_url' => $GLOBALS['phpgw']->link('/index.php','menuaction=expressoAdmin1_2.uiaccounts.list_users'),
'display_samba_suport' => $this->current_config['expressoAdmin_samba_support'] == 'true' ? '' : 'display:none',
'disabled_access_button'=> 'disabled',
// First ABA
'display_spam_uid' => 'display:none',
'lang_general_information' => lang('General Information'),
'lang_email_config' => lang('Email Config'),
'lang_groups_permission' => lang('Groups Permission'),
'lang_lists_permission' => lang('Email Lists'),
'lang_aplication_permission' => lang('Aplication Permission'),
'lang_organizations' => lang('Organizations'),
'lang_sector' => lang('Sector'),
'lang_account_lid' => lang('Login ID'),
'lang_firstname' => lang('First Name'),
'lang_lastname' => lang('Last Name'),
'lang_password' => lang('Password'),
'lang_re-password' => lang('Re-Password'),
'lang_changepassword' => lang('Change password'),
'lang_phone' => lang('Phone'),
'lang_photo' => lang('Photo'),
'lang_account_active' => lang('Account Active'),
'lang_account_invisible' => lang('Account Invisible'),
'lang_never' => lang('never'),
'lang_back' => lang('Back'),
'lang_save' => lang('Save'),
'sectors' => $sectors,
'combo_organizations' => $sectors,
'changepassword_checked' => 'CHECKED',
'phpgwaccountstatus_checked' => 'CHECKED',
'photo_bin' => $GLOBALS['phpgw_info']['server']['webserver_url'].'/expressoAdmin1_2/templates/default/images/photo_celepar.png',
'disabled_delete_photo' => 'disabled',
'display_tr_default_password' => 'none',
'minimumSizeLogin' => $this->current_config['expressoAdmin_minimumSizeLogin'],
'defaultDomain' => $this->current_config['expressoAdmin_defaultDomain'],
'concatenateDomain' => $this->current_config['expressoAdmin_concatenateDomain'],
'ldap_context' => ldap_dn2ufn($GLOBALS['phpgw_info']['server']['ldap_context']),
//MAIL
'lang_activeemailaccount' => lang('Active email account'),
'lang_email' => lang('E-mail'),
'lang_aliasemail' => lang('Alias email'),
'lang_forwardingemail' => lang('Forwarding email'),
'lang_email_quota' => lang('Email quota in MB'),
'lang_onlyforwarding' => lang('Only forwarding'),
'lang_quote_message' => lang('leave empty for no quota'),
'lang_email_quota_used' => lang('Quota used in MB'),
'accountstatus_checked' => 'CHECKED',
'mailquota' => $this->current_config['expressoAdmin_defaultUserQuota'],
'changequote_disabled' => $this->functions->check_acl($manager_lid,'change_users_quote') ? '' : 'readonly',
'imapDelimiter' => $_SESSION['phpgw_info']['expresso']['email_server']['imapDelimiter'],
//Third ABA
'lang_groups' => lang('Groups'),
'lang_user_groups' => 'Grupos do Usu�rio',
'lang_available_groups' => 'Grupos dispon�veis',
'lang_listGroups' => lang('ListGroups'),
'lang_primary_group' => lang('Primary Group'),
'lang_add' => lang('Add'),
'lang_rem' => lang('Remove'),
//Fourd ABA
'lang_user_mail_lists' => 'O usu�rio participa destas Listas de E-mail',
'lang_available_mail_lists' => 'Listas de E-mail dispon�veis',
//Five ABA
'apps' => $applications_list,
//SAMBA ABA
'lang_samba_config' => lang('Samba Config'),
'lang_use_attrs_samba' => lang('Use samba attributes'),
'lang_sambadomain' => lang('Domain'),
'lang_sambaAcctFlags' => lang('AcctFlags'),
'lang_sambaLogonScript' => lang('Logon Script'),
'lang_sambaHomeDirectory' => lang('Home Directory'),
'lang_active_user' => lang('Samba User Active'),
'lang_desactive_user' => lang('Samba User Desactive'),
'use_attrs_samba_checked' => 'CHECKED',
'sambadomainname_options' => $sambadomainname_options,
'sambalogonscript' => $this->current_config['expressoAdmin_defaultLogonScript'] != '' ? $this->current_config['expressoAdmin_defaultLogonScript'] : '',
'use_suggestion_in_logon_script' => $this->current_config['expressoAdmin_defaultLogonScript'] == '' ? 'true' : 'false',
);
$t->set_var($var);
$t->pfp('out','main');
}
function view_user()
{
ExecMethod('expressoAdmin1_2.uiaccounts.edit_user');
return;
}
function edit_user()
{
$manager_account_lid = $GLOBALS['phpgw']->accounts->data['account_lid'];
$tmp = $this->functions->read_acl($manager_account_lid);
$manager_context = $tmp[0]['context'];
$alert_warning = '';
// Verifica se tem acesso a este modulo
$disabled = 'disabled';
$disabled_password = 'disabled';
$disabled_samba = 'disabled';
if ((!$this->functions->check_acl($manager_account_lid,'edit_users')) &&
(!$this->functions->check_acl($manager_account_lid,'change_users_password')) &&
(!$this->functions->check_acl($manager_account_lid,'edit_sambausers_attributes')) &&
(!$this->functions->check_acl($manager_account_lid,'view_users'))
)
{
$GLOBALS['phpgw']->redirect($GLOBALS['phpgw']->link('/expressoAdmin1_2/inc/access_denied.php'));
}
// SOMENTE ALTERA��O DE SENHA
if ((!$this->functions->check_acl($manager_account_lid,'edit_users')) && ($this->functions->check_acl($manager_account_lid,'change_users_password')))
{
$disabled = 'disabled';
$disabled_password = '';
}
// SOMENTE ALTERA��O DOS ATRIBUTOS SAMBA
if ((!$this->functions->check_acl($manager_account_lid,'edit_users')) && ($this->functions->check_acl($manager_account_lid,'edit_sambausers_attributes')))
{
$disabled = 'disabled';
$disabled_samba = '';
}
// TOTAIS MENOS O SAMBA
if (($this->functions->check_acl($manager_account_lid,'edit_users')) && (!$this->functions->check_acl($manager_account_lid,'edit_sambausers_attributes')))
{
$disabled = '';
$disabled_password = '';
$disabled_samba = 'disabled';
}
// TOTAIS
elseif ($this->functions->check_acl($manager_account_lid,'edit_users'))
{
$disabled = '';
$disabled_password = '';
$disabled_samba = '';
}
if (!$this->functions->check_acl($manager_account_lid,'change_users_quote'))
$disabled_quote = 'readonly';
// GET all infomations about the user.
//$user_info = $this->user->get_user_info($_GET['account_id'], $manager_context);
$user_info = $this->user->get_user_info_serpro($_GET['account_id'], $manager_context);
// Grupos do Serpro
$params="";
$params['context']=$GLOBALS['phpgw_info']['server']['ldap_group_context'];
$groups="";
$groups = $this->ldap_functions->get_available_groups($params);
// Listas do Serpro
$params="";
$params['context']=$GLOBALS['phpgw_info']['server']['ldap_group_context'];
$lists="";
$lists = $this->ldap_functions->get_available_maillists($params);
// JavaScript
$GLOBALS['phpgw']->js->validate_file("jscode","users","expressoAdmin1_2");
//$GLOBALS['phpgw']->js->set_onload("get_available_groups(document.forms[0].context.value);");
//$GLOBALS['phpgw']->js->set_onload("get_available_maillists(document.forms[0].context.value);");
$GLOBALS['phpgw']->js->set_onload("use_samba_attrs('".$user_info['sambaUser']."');");
// Seta header.
unset($GLOBALS['phpgw_info']['flags']['noheader']);
unset($GLOBALS['phpgw_info']['flags']['nonavbar']);
$GLOBALS['phpgw_info']['flags']['app_header'] = $GLOBALS['phpgw_info']['apps']['expressoAdmin1_2']['title'].' - '.lang('Edit User');
$GLOBALS['phpgw']->common->phpgw_header();
// Seta templates.
$t = CreateObject('phpgwapi.Template',PHPGW_APP_TPL);
$t->set_file(array("body" => "accounts_form.tpl"));
$t->set_block('body','main');
// ORGANIZATIONS
//$orgs = $this->functions->get_organizations($manager_context, $user_info['context']);
// GROUPS.
if (count($user_info['groups_info']) > 0)
{
foreach ($user_info['groups_info'] as $group)
{
$array_groups[$group['gidnumber']] = $group['cn'];
}
natcasesort($array_groups);
foreach ($array_groups as $gidnumber=>$cn)
{
// Grupo existe no Banco mas n�o no Ldap, excluimos grupo do Banco.
if (!$this->ldap_functions->group_exist($gidnumber))
{
$this->db_functions->delete_group($gidnumber);
$this->db_functions->write_log("expressoAdmin deletou o grupo $gidnumber do banco, pois n�o existia no ldap.",'','','','');
continue;
}
// O memberUid do usu�rio est� somente no Banco, ent�o adicionamos o memberUid no Ldap.
if (is_null($user_info['groups_ldap'][$gidnumber]))
{
$this->ldap_functions->add_user2group($gidnumber, $user_info['uid']);
$ea_select_user_groups_options .= "";
if ($alert_warning == '')
$alert_warning = "O expressoAdmin corrigiu as seguintes inconsist�ncias:\\n";
$alert_warning .= "Incluido atributo memberUid do usu�rio no grupo:\\n$cn - gidnumber: $gidnumber.";
}
else
$ea_select_user_groups_options .= "";
if ($gidnumber == $user_info['gidnumber'])
{
$ea_combo_primary_user_group_options .= "";
}
else
{
$ea_combo_primary_user_group_options .= "";
}
}
// O memberUid do usu�rio est� somente no Ldap.
$groups_db = array_flip($user_info['groups']);
foreach ($user_info['groups_ldap'] as $gidnumber=>$cn)
{
if (is_null($groups_db[$gidnumber]))
{
/*
$this->ldap_functions->remove_user2group($gidnumber, $user_info['uid']);
if ($alert_warning == '')
$alert_warning = "O expressoAdmin corrigiu as seguintes inconsist�ncias:\\n";
$alert_warning .= "Removido atributo memberUid do usu�rio do grupo $cn.\\n";
*/
$ea_select_user_groups_options .= "";
}
}
}
// MAILLISTS
if (count($user_info['maillists_info']) > 0)
{
foreach ($user_info['maillists_info'] as $maillist)
{
$array_maillist[$maillist['uidnumber']] = $maillist['uid'] . " (" . $maillist['mail'] . ") ";
}
natcasesort($array_maillist);
foreach ($array_maillist as $uidnumber=>$option)
{
$ea_select_user_maillists_options .= "";
}
}
// APPS.
if ($disabled == 'disabled')
$apps = $this->functions->make_list_app($manager_account_lid, $manager_context, $user_info['apps'], 'disabled');
else
$apps = $this->functions->make_list_app($manager_account_lid, $manager_context, $user_info['apps']);
//PHOTO
if ($user_info['photo_exist'])
{
$photo_bin = "./index.php?menuaction=expressoAdmin1_2.uiaccounts.show_photo&uidNumber=".$_GET['account_id']."&manager_context=$manager_context";
}
else
{
$photo_bin = $GLOBALS['phpgw_info']['server']['webserver_url'] . '/expressoAdmin1_2/templates/default/images/photo_celepar.png';
$disabled_delete_photo = 'disabled';
}
// Cria combo de dominios do samba
if ($this->current_config['expressoAdmin_samba_support'] == 'true')
{
$a_sambadomains = $this->db_functions->get_sambadomains_list();
$sambadomainname_options = '';
if (count($a_sambadomains))
{
foreach ($a_sambadomains as $a_sambadomain)
{
if ($a_sambadomain['samba_domain_sid'] == $user_info['sambasid'])
$sambadomainname_options .= "";
else
$sambadomainname_options .= "";
}
}
}
if ($alert_warning != '')
$alert_warning = "alert('". $alert_warning ."')";
if(!$user_info['mailquota'])
$mailquota=$this->current_config['expressoAdmin_defaultUserQuota'];
else
$mailquota=$user_info['mailquota'];
$var = Array(
'uidnumber' => $_GET['account_id'],
'manager_context' => $manager_context,
'type' => 'edit_user',
'photo_exist' => $user_info['photo_exist'],
'departmentnumber' => $user_info['departmentnumber'],
'user_context' => $user_info['context'],
'row_on' => "#DDDDDD",
'row_off' => "#EEEEEE",
'color_bg1' => "#E8F0F0",
'action' => $GLOBALS['phpgw']->link('/index.php','menuaction=expressoAdmin1_2.uiaccounts.validate_user_data_edit'),
'back_url' => './index.php?menuaction=expressoAdmin1_2.uiaccounts.list_users',
'display_samba_suport' => $this->current_config['expressoAdmin_samba_support'] == 'true' ? '' : 'display:none',
'disabled' => $disabled,
'disabled_password' => $disabled_password,
'disabled_samba' => $disabled_samba,
'changequote_disabled' => $disabled_quote,
// First ABA
'alert_warning' => "$alert_warning",
'display_input_account_lid' => 'display:none',
'lang_general_information' => lang('General Information'),
'lang_email_config' => lang('Email Config'),
'lang_groups_permission' => lang('Groups Permission'),
'lang_lists_permission' => lang('Email Lists'),
'lang_aplication_permission' => lang('Aplication Permission'),
'lang_organizations' => lang('Organizations'),
'lang_sector' => lang('Sector'),
'lang_account_lid' => lang('Login ID'),
'lang_firstname' => lang('First Name'),
'lang_lastname' => lang('Last Name'),
'lang_password' => lang('Password'),
'lang_phone' => lang('Phone'),
'lang_photo' => lang('Photo'),
'lang_re-password' => lang('Re-Password'),
'lang_changepassword' => lang('Change password'),
'lang_account_active' => lang('Account Active'),
'lang_account_invisible' => lang('Account Invisible'),
'lang_back' => lang('Back'),
'lang_save' => lang('Save'),
//'sectors' => $orgs,
//'combo_organizations' => $orgs,
'sectors' => $user_info['ou'],
'uid' => $user_info['uid'],
'givenname' => $user_info['givenname'],
'mail1' => $user_info['mail'],
'sn' => $user_info['sn'],
'telephonenumber' => $user_info['telephonenumber'],
'mobile' => $user_info['mobile'],
'pager' => $user_info['pager'],
'photo_bin' => $photo_bin,
'disabled_delete_photo' => $disabled_delete_photo,
'display_tr_default_password' => $this->functions->check_acl($manager_account_lid,'set_user_default_password') ? '' : 'none',
'changepassword_checked' => $user_info['changepassword'] == '1' ? 'CHECKED' : '',
'phpgwaccountstatus_checked' => $user_info['phpgwaccountstatus'] == 'A' ? 'CHECKED' : '',
'phpgwaccountvisible_checked' => $user_info['phpgwaccountvisible'] == '-1' ? 'CHECKED' : '',
//MAIL BORD
'disabled_quota_used' => 'disabled',
'lang_activeemailaccount' => lang('Active email account'),
'lang_email' => lang('E-mail'),
'lang_aliasemail' => lang('Alias email'),
'lang_forwardingemail' => lang('Forwarding email'),
'lang_email_quota' => lang('Email quota in MB'),
'lang_onlyforwarding' => lang('Only forwarding'),
'lang_email_quota_used' => lang('Quota used in MB'),
'accountstatus_checked' => $user_info['accountstatus'] == 'active' ? 'CHECKED' : '',
'mail' => $user_info['mail'],
'mailalternateaddress' => $user_info['mailalternateaddress'],
'mailforwardingaddress' => $user_info['mailforwardingaddress'],
'deliverymode_checked' => $user_info['deliverymode'] == 'forwardOnly' ? 'CHECKED' : '',
'mailquota' => $mailquota,
'mailquota_used' => $user_info['mailquota_used'],
//Third ABA
'lang_groups' => lang('Groups'),
'lang_user_groups' => 'Grupos do Usu�rio',
'lang_available_groups' => 'Grupos dispon�veis',
'lang_primary_group' => lang('Primary Group'),
'lang_add' => lang('Add'),
'lang_rem' => lang('Remove'),
'groups' => $groups,
'ea_select_user_groups_options' => $ea_select_user_groups_options,
'ea_combo_primary_user_group_options' => $ea_combo_primary_user_group_options,
//Fourd ABA
'lang_user_mail_lists' => 'O usu�rio participa destas Listas de E-mail',
'lang_available_mail_lists' => 'Listas de E-mail dispon�veis',
'ea_select_user_maillists_options' => $ea_select_user_maillists_options,
'lists' => $lists,
//Five ABA
'apps' => $apps,
//SAMBA ABA
'lang_samba_config' => lang('Samba Config'),
'lang_use_attrs_samba' => lang('Use samba attributes'),
'lang_sambadomain' => lang('Domain'),
'lang_sambaAcctFlags' => lang('AcctFlags'),
'lang_sambaLogonScript' => lang('Logon Script'),
'lang_sambaHomeDirectory' => lang('Home Directory'),
'lang_active_user' => lang('Samba User Active'),
'lang_desactive_user' => lang('Samba User Desactive'),
'userSamba' => $user_info['sambaUser'],
'sambadomainname_options' => $sambadomainname_options,
'use_attrs_samba_checked' => $user_info['sambaUser'] ? 'CHECKED' : '',
'active_user_selected' => $user_info['sambaaccflags'] == '[U ]' ? 'selected' : '',
'desactive_user_selected' => $user_info['sambaaccflags'] == '[DU ]' ? 'selected' : '',
'sambalogonscript' => $user_info['sambalogonscript'],
'sambahomedirectory' => $user_info['homedirectory'],
'defaultLogonScript' => $this->current_config['expressoAdmin_defaultLogonScript'],
'use_suggestion_in_logon_script' => $this->current_config['expressoAdmin_defaultLogonScript'] == '' ? 'true' : 'false'
);
$t->set_var($var);
$t->pfp('out','body');
}
function row_action($action,$type,$account_id)
{
if ($action == "create_e")
{
return ' '.lang('create').' ';
}
else
{
return ' '.lang($action).' ';
}
}
function css()
{
$appCSS =
'th.activetab
{
color:#000000;
background-color:#D3DCE3;
border-top-width : 1px;
border-top-style : solid;
border-top-color : Black;
border-left-width : 1px;
border-left-style : solid;
border-left-color : Black;
border-right-width : 1px;
border-right-style : solid;
border-right-color : Black;
font-size: 12px;
font-family: Tahoma, Arial, Helvetica, sans-serif;
}
th.inactivetab
{
color:#000000;
background-color:#E8F0F0;
border-bottom-width : 1px;
border-bottom-style : solid;
border-bottom-color : Black;
font-size: 12px;
font-family: Tahoma, Arial, Helvetica, sans-serif;
}
.td_left {border-left:1px solid Gray; border-top:1px solid Gray; border-bottom:1px solid Gray;}
.td_right {border-right:1px solid Gray; border-top:1px solid Gray; border-bottom:1px solid Gray;}
div.activetab{ display:inline; }
div.inactivetab{ display:none; }';
return $appCSS;
}
function show_photo()
{
$uidNumber = $_GET['uidNumber'];
$manager_context = $_GET['manager_context'];
$photo = $this->get_photo($uidNumber, $manager_context);
if ($photo)
{
header("Content-Type: image/jpeg");
$width = imagesx($photo);
$height = imagesy($photo);
$twidth = 80;
$theight = 106;
$small_photo = imagecreatetruecolor ($twidth, $theight);
imagecopyresampled($small_photo, $photo, 0, 0, 0, 0,$twidth, $theight, $width, $height);
imagejpeg($small_photo,"",100);
return;
}
}
function get_photo($uidNumber, $manager_context)
{
$ldap_conn = $GLOBALS['phpgw']->common->ldapConnect();
$filter="(&(phpgwAccountType=u)(uidNumber=".$uidNumber."))";
$justthese = array("jpegphoto");
$search = ldap_search($ldap_conn, $manager_context, $filter, $justthese);
$entry = ldap_first_entry($ldap_conn, $search);
$jpeg_data = ldap_get_values_len($ldap_conn, $entry, "jpegphoto");
$jpegphoto = imagecreatefromstring($jpeg_data[0]);
return $jpegphoto;
}
function show_access_log()
{
$account_id = $_GET['account_id'];
$manager_account_lid = $GLOBALS['phpgw']->accounts->data['account_lid'];
$tmp = $this->functions->read_acl($manager_account_lid);
$manager_context = $tmp[0]['context'];
// Verifica se tem acesso a este modulo
if ((!$this->functions->check_acl($manager_account_lid,'edit_users')) && (!$this->functions->check_acl($manager_account_lid,'change_users_password')))
{
$GLOBALS['phpgw']->redirect($GLOBALS['phpgw']->link('/expressoAdmin1_2/inc/access_denied.php'));
}
// Seta header.
unset($GLOBALS['phpgw_info']['flags']['noheader']);
unset($GLOBALS['phpgw_info']['flags']['nonavbar']);
$GLOBALS['phpgw_info']['flags']['app_header'] = $GLOBALS['phpgw_info']['apps']['expressoAdmin1_2']['title'].' - '.lang('Access Log');
$GLOBALS['phpgw']->common->phpgw_header();
// Seta templates.
$t = CreateObject('phpgwapi.Template',PHPGW_APP_TPL);
$t->set_file(array("body" => "accesslog.tpl"));
$t->set_block('body','main');
$t->set_block('body','row','row');
// GET access log from the user.
$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__);
while ($GLOBALS['phpgw']->db->next_record())
{
$records[] = array(
'loginid' => $GLOBALS['phpgw']->db->f('loginid'),
'ip' => $GLOBALS['phpgw']->db->f('ip'),
'li' => $GLOBALS['phpgw']->db->f('li'),
'lo' => $GLOBALS['phpgw']->db->f('lo'),
'account_id' => $GLOBALS['phpgw']->db->f('account_id'),
'sessionid' => $GLOBALS['phpgw']->db->f('sessionid')
);
}
// Seta as vcariaveis
while (is_array($records) && list(,$record) = each($records))
{
$var = array(
'row_loginid' => $record['loginid'],
'row_ip' => $record['ip'],
'row_li' => date("d/m/Y - H:i:s", $record['li']),
'row_lo' => $record['lo'] == 0 ? 0 : date("d/m/Y - H:i:s", $record['lo'])
);
$t->set_var($var);
$t->fp('rows','row',True);
}
$var = Array(
'th_bg' => $GLOBALS['phpgw_info']['theme']['th_bg'],
'lang_back' => 'Back',
'back_url' => "./index.php?menuaction=expressoAdmin1_2.uiaccounts.edit_user&account_id=$account_id",
'lang_loginid' => lang('Login ID'),
'lang_ip' => lang('IP'),
'lang_login' => lang('Log IN'),
'lang_logout' => lang('Log OUT')
);
$t->set_var($var);
$t->pfp('out','body');
}
}
?>