No longer needed

This commit is contained in:
jengo 2001-09-04 01:25:03 +00:00
parent 8b483a14a4
commit 8c5a988f0f
9 changed files with 0 additions and 2189 deletions

View File

@ -1,119 +0,0 @@
<?php
/**************************************************************************\
* phpGroupWare - administration *
* http://www.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$ */
$phpgw_info = array();
$phpgw_info['flags'] = array('currentapp' => 'admin', 'enable_nextmatchs_class' => True);
include('../header.inc.php');
function account_total($query)
{
global $phpgw;
if ($query)
{
$querymethod = " AND (account_firstname LIKE '%$query%' OR account_lastname LIKE "
. "'%$query%' OR account_lid LIKE '%$query%') ";
}
$phpgw->db->query("SELECT COUNT(*) FROM phpgw_accounts WHERE account_type='u'".$querymethod,__LINE__,__FILE__);
$phpgw->db->next_record();
return $phpgw->db->f(0);
}
$p = CreateObject('phpgwapi.Template',PHPGW_APP_TPL);
$p->set_file(array(
'accounts' => 'accounts.tpl'
));
$p->set_block('accounts','list','list');
$p->set_block('accounts','row','row');
$p->set_block('accounts','row_empty','row_empty');
$total = account_total($query);
$p->set_var('bg_color',$phpgw_info['theme']['bg_color']);
$p->set_var('th_bg',$phpgw_info['theme']['th_bg']);
$p->set_var('left_next_matchs',$phpgw->nextmatchs->left('/admin/accounts.php',$start,$total));
$p->set_var('lang_user_accounts',lang('user accounts'));
$p->set_var('right_next_matchs',$phpgw->nextmatchs->right('/admin/accounts.php',$start,$total));
$p->set_var('lang_loginid',$phpgw->nextmatchs->show_sort_order($sort,'account_lid',$order,'/admin/accounts.php',lang('LoginID')));
$p->set_var('lang_lastname',$phpgw->nextmatchs->show_sort_order($sort,'account_lastname',$order,'/admin/accounts.php',lang('last name')));
$p->set_var('lang_firstname',$phpgw->nextmatchs->show_sort_order($sort,'account_firstname',$order,'/admin/accounts.php',lang('first name')));
$p->set_var('lang_edit',lang('Edit'));
$p->set_var('lang_delete',lang('Delete'));
$p->set_var('lang_view',lang('View'));
$account_info = $phpgw->accounts->get_list('accounts',$start,$sort,$order,$query);
if (! count($account_info))
{
$p->set_var('message',lang('No matchs found'));
$p->parse('rows','row_empty',True);
}
else
{
while (list($null,$account) = each($account_info))
{
$lastname = $account['account_lastname'];
$firstname = $account['account_firstname'];
$account_id = $account['account_id'];
$loginid = $account['account_lid'];
$phpgw->nextmatchs->template_alternate_row_color($p);
if (! $lastname)
{
$lastname = '&nbsp;';
}
if (! $firstname)
{
$firstname = '&nbsp;';
}
$p->set_var('row_loginid',$loginid);
$p->set_var('row_firstname',$firstname);
$p->set_var('row_lastname',$lastname);
$p->set_var('row_edit','<a href="'.$phpgw->link('/admin/editaccount.php','account_id='
. $account_id) . '"> ' . lang('Edit') . ' </a>');
if ($phpgw_info['user']['userid'] != $account['account_lid'])
{
$p->set_var('row_delete','<a href="' . $phpgw->link('/admin/deleteaccount.php','account_id='
. $account_id) . '"> '.lang('Delete').' </a>');
}
else
{
$p->set_var('row_delete','&nbsp;');
}
$p->set_var('row_view','<a href="' . $phpgw->link('/admin/viewaccount.php','account_id='
. $account_id) . '"> ' . lang('View') . ' </a>');
$p->parse('rows','row',True);
}
} // End else
$p->set_var('actionurl',$phpgw->link('/admin/newaccount.php'));
$p->set_var('accounts_url',$phpgw->link('/admin/accounts.php'));
$p->set_var('lang_add',lang('add'));
$p->set_var('lang_search',lang('search'));
$p->pparse('out','list');
$phpgw->common->phpgw_footer();
?>

View File

@ -1,99 +0,0 @@
<?php
/**************************************************************************\
* phpGroupWare - administration *
* http://www.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$ */
$phpgw_info = array();
if ($delete_account || $cancel || !$account_id )
{
$phpgw_info['flags'] = array(
'noheader' => True,
'nonavbar' => True
);
}
$phpgw_info['flags']['currentapp'] = 'admin';
include('../header.inc.php');
// Make sure they are not attempting to delete their own account, or they have cancelled.
// If they are, they should not reach this point anyway.
if($cancel || $phpgw_info['user']['account_id'] == $account_id)
{
Header('Location: '.$phpgw->link('/admin/accounts.php'));
$phpgw->common->phpgw_exit();
}
if ($account_id && !$delete_account)
{
$phpgw->template->set_file(array('form' => 'delete_account.tpl'));
$phpgw->template->set_var('form_action',$phpgw->link('/admin/deleteaccount.php'));
$phpgw->template->set_var('account_id',$account_id);
// the account can have special chars/white spaces, if it is a ldap dn
$account_id = rawurlencode($account_id);
// Find out who the new owner is of the deleted users records...
$str = '<select name="new_owner" size="5">'."\n";
$users = $phpgw->accounts->get_list('accounts');
$c_users = count($users);
$str .= '<option value=0 selected>'.lang('Delete All Records').'</option>'."\n";
for($i=0;$i<$c_users;$i++)
{
$str .= '<option value='.$users[$i]['account_id'].'>'.$phpgw->common->display_fullname($users[$i]['account_lid'],$users[$i]['account_firstname'],$users[$i]['account_lastname']).'</option>'."\n";
}
$str .= '</select>'."\n";
$phpgw->template->set_var('lang_new_owner',lang('Who would you like to transfer ALL records owned by the deleted user to?'));
$phpgw->template->set_var('new_owner_select',$str);
$phpgw->template->set_var('cancel',lang('cancel'));
$phpgw->template->set_var('delete',lang('delete'));
$phpgw->template->pparse('out','form');
$phpgw->common->phpgw_footer();
}
if($delete_account)
{
$accountid = $account_id;
settype($account_id,'integer');
$account_id = get_account_id($accountid);
$lid = $phpgw->accounts->id2name($account_id);
$db = $phpgw->db;
$db->query('SELECT app_name,app_order FROM phpgw_applications WHERE app_enabled!=0 ORDER BY app_order',__LINE__,__FILE__);
if($db->num_rows())
{
while($db->next_record())
{
$appname = $db->f('app_name');
if($appname <> 'admin')
{
$phpgw->common->hook_single('deleteaccount', $appname);
}
}
}
$phpgw->common->hook_single('deleteaccount','preferences');
$phpgw->common->hook_single('deleteaccount','admin');
$basedir = $phpgw_info['server']['files_dir'] . SEP . 'users' . SEP;
if (! @rmdir($basedir . $lid))
{
$cd = 34;
}
else
{
$cd = 29;
}
Header("Location: " . $phpgw->link('/admin/accounts.php',"cd=$cd"));
$phpgw->common->phpgw_exit();
}
?>

View File

@ -1,119 +0,0 @@
<?php
/**************************************************************************\
* phpGroupWare - administration *
* http://www.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$ */
$phpgw_info = array();
$phpgw_info['flags'] = array(
'noheader' => True,
'nonavbar' => True,
'currentapp' => 'admin'
);
if (! $group_id)
{
Header('Location: ' . $phpgw->link('/admin/groups.php'));
}
include('../header.inc.php');
$p = CreateObject('phpgwapi.Template',PHPGW_APP_TPL);
$p->set_file(array(
'body' => 'delete_common.tpl',
'message_row' => 'message_row.tpl'
));
if ((($group_id) && ($confirm)) || $removeusers)
{
if ($removeusers)
{
$old_group_list = $phpgw->acl->get_ids_for_location(intval($group_id),1,'phpgw_group');
@reset($old_group_list);
while($old_group_list && $id = each($old_group_list))
{
$phpgw->acl->delete_repository('phpgw_group',$group_id,intval($id[1]));
}
}
$group_name = $phpgw->accounts->id2name($group_id);
$old_group_list = $phpgw->acl->get_ids_for_location(intval($group_id),1,'phpgw_group');
if ($old_group_list)
{
$phpgw->common->phpgw_header();
echo parse_navbar();
$p->set_var('message_display','<tr><td>'
. lang('Sorry, the follow users are still a member of the group x',$group_name)
. '<br>' . lang('They must be removed before you can continue') . '</td></td>');
$p->parse('messages','message_row',True);
$p->set_var('message_display','<tr><td><table border="0">');
$p->parse('messages','message_row',True);
while (list(,$id) = each($old_group_list))
{
$p->set_var('message_display','<tr><td><a href="' . $phpgw->link('/admin/editaccount.php','account_=' . $id) . '">' . $phpgw->common->grab_owner_name($id) . '</a></tr></td>');
$p->parse('messages','message_row',True);
}
$p->set_var('message_display','</table></center></td></tr><tr><td>'
. '<a href="' . $phpgw->link('/admin/deletegroup.php','group_id=' . $group_id . '&removeusers=True')
. '">' . lang('Remove all users from this group') . '</a></td></tr>');
$p->parse('messages','message_row',True);
$p->set_var('yes','');
$p->set_var('no','');
$p->pparse('out','body');
$phpgw->common->phpgw_footer();
$phpgw->common->phpgw_exit();
}
elseif ($removeusers && !$confirm)
{
Header('Location: ' . $phpgw->link('/admin/deletegroup.php','group_id='.$group_id.'&confirm=True'));
$phpgw->common->phpgw_exit();
}
if ($confirm)
{
$phpgw->db->lock(array('phpgw_accounts','phpgw_acl'));
$phpgw->db->query('DELETE FROM phpgw_accounts WHERE account_id='.$group_id,__LINE__,__FILE__);
$phpgw->acl->delete_repository('%%','run',intval($group_id));
$basedir = $phpgw_info['server']['files_dir'] . SEP . 'groups' . SEP;
if (! @rmdir($basedir . $group_name))
{
$cd = 38;
}
else
{
$cd = 32;
}
$phpgw->db->unlock();
Header('Location: ' . $phpgw->link('/admin/groups.php','cd='.$cd));
$phpgw->common->phpgw_exit();
}
}
else
{
$phpgw->common->phpgw_header();
echo parse_navbar();
$p->set_var('message_display',lang('Are you sure you want to delete this group ?'));
$p->parse('messages','message_row');
$p->set_var('yes','<a href="' . $phpgw->link('/admin/deletegroup.php',"group_id=$group_id&confirm=true") . '">' . lang('Yes') . '</a>');
$p->set_var('no','<a href="' . $phpgw->link('/admin/groups.php') . '">' . lang('No') . '</a>');
$p->pparse('out','body');
$phpgw->common->phpgw_footer();
}
?>

View File

@ -1,527 +0,0 @@
<?php
/**************************************************************************\
* phpGroupWare - administration *
* http://www.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$ */
$phpgw_info['flags'] = array(
'noheader' => True,
'nonavbar' => True,
'currentapp' => 'admin',
'parent_page' => 'accounts.php',
'enable_sbox_class' => True
);
include('../header.inc.php');
// creates the html for the user data
function createPageBody($_account_id,$_userData='',$_errors='')
{
global $phpgw, $phpgw_info;
$t = CreateObject('phpgwapi.Template',PHPGW_APP_TPL);
$t->set_unknowns('remove');
if ($phpgw_info['server']['ldap_extra_attributes'] && ($phpgw_info['server']['account_repository'] == 'ldap'))
{
$t->set_file(array('account' => 'account_form_ldap.tpl'));
}
else
{
$t->set_file(array('account' => 'account_form.tpl'));
}
$t->set_block('account','form','form');
$t->set_block('account','form_passwordinfo','form_passwordinfo');
$t->set_block('account','form_buttons_','form_buttons_');
$t->set_block('account','link_row','link_row');
print_debug('Type : '.gettype($_userData).'<br>_userData(size) = "'.$_userData.'"('.strlen($_userData).')');
if (is_array($_userData))
{
$userData = Array();
$userData=$_userData;
@reset($userData['account_groups']);
while (list($key, $value) = @each($userData['account_groups']))
{
$userGroups[$key]['account_id'] = $value;
}
$account = CreateObject('phpgwapi.accounts');
$allGroups = $account->get_list('groups');
}
elseif(is_string($_userData) && $_userData=='')
{
$account = CreateObject('phpgwapi.accounts',$_account_id);
$userData = $account->read_repository();
$userGroups = $account->membership($_account_id);
$allGroups = $account->get_list('groups');
if ($userData['expires'] == -1)
{
$userData['account_expires_month'] = 0;
$userData['account_expires_day'] = 0;
$userData['account_expires_year'] = 0;
}
else
{
$userData['account_expires_month'] = date('m',$userData['expires']);
$userData['account_expires_day'] = date('d',$userData['expires']);
$userData['account_expires_year'] = date('Y',$userData['expires']);
}
}
$error_messages = '';
if ($_errors)
{
$error_messages = '<center>' . $phpgw->common->error_list($_errors) . '</center>';
}
$var = Array(
'form_action' => $phpgw->link('/admin/editaccount.php','account_id='.$_account_id.'&old_loginid='.rawurlencode($userData['account_lid'])),
'error_messages' => $error_messages,
'th_bg' => $phpgw_info['theme']['th_bg'],
'tr_color1' => $phpgw_info['theme']['row_on'],
'tr_color2' => $phpgw_info['theme']['row_off'],
'lang_action' => lang('Edit user account'),
'lang_loginid' => lang('LoginID'),
'lang_account_active' => lang('Account active'),
'lang_password' => lang('Password'),
'lang_reenter_password' => lang('Re-Enter Password'),
'lang_lastname' => lang('Last Name'),
'lang_groups' => lang('Groups'),
'lang_expires' => lang('Expires'),
'lang_firstname' => lang('First Name'),
'lang_button' => lang('Save')
/* 'lang_file_space' => lang('File Space') */
);
$t->set_var($var);
$t->parse('form_buttons','form_buttons_',True);
if ($phpgw_info['server']['ldap_extra_attributes']) {
$lang_homedir = lang('home directory');
$lang_shell = lang('login shell');
$homedirectory = '<input name="homedirectory" value="' . $userData['homedirectory']. '">';
$loginshell = '<input name="loginshell" value="' . $userData['loginshell']. '">';
}
else
{
$lang_homedir = '';
$lang_shell = '';
$homedirectory = '';
$loginshell = '';
}
$_y = $phpgw->sbox->getyears('account_expires_year',$userData['account_expires_year'],date('Y'),date('Y')+10);
$_m = $phpgw->sbox->getmonthtext('account_expires_month',$userData['account_expires_month']);
$_d = $phpgw->sbox->getdays('account_expires_day',$userData['account_expires_day']);
/*
if (!$userData['file_space'])
{
$userData['file_space'] = $phpgw_info['server']['vfs_default_account_size_number'] . "-" . $phpgw_info['server']['vfs_default_account_size_type'];
}
$file_space_array = explode ("-", $userData['file_space']);
$account_file_space_number = $file_space_array[0];
$account_file_space_type = $file_space_array[1];
$account_file_space_type_selected[$account_file_space_type] = "selected";
$account_file_space = '
<input type=text name="account_file_space_number" value="' . trim($account_file_space_number) . '" size="7">';
$account_file_space_select ='<select name="account_file_space_type">';
$account_file_space_types = array ("gb", "mb", "kb", "b");
while (list ($num, $type) = each ($account_file_space_types))
{
$account_file_space_select .= "<option value=$type " . $account_file_space_type_selected[$type] . ">" . strtoupper ($type) . "</option>";
}
$account_file_space_select .= '</select>';
$t->set_var ('lang_file_space', "File space");
$t->set_var ('account_file_space', $account_file_space);
$t->set_var ('account_file_space_select', $account_file_space_select);
*/
$var = Array(
'input_expires' => $phpgw->common->dateformatorder($_y,$_m,$_d,True),
'account_lid' => '<input name="account_lid" value="' . $userData['account_lid'] . '">',
'lang_homedir' => $lang_homedir,
'lang_shell' => $lang_shell,
'homedirectory' => $homedirectory,
'loginshell' => $loginshell,
'account_passwd' => $account_passwd,
'account_passwd_2' => $account_passwd_2,
'account_file_space' => $account_file_space
);
$t->set_var($var);
$t->parse('password_fields','form_passwordinfo',True);
if ($userData['status'])
{
$account_status = '<input type="checkbox" name="account_status" value="A" checked>';
}
else
{
$account_status = '<input type="checkbox" name="account_status" value="A">';
}
$allAccounts;
$userGroups;
$groups_select = '<select name="account_groups[]" multiple>';
reset($allGroups);
while (list($key,$value) = each($allGroups))
{
$groups_select .= '<option value="' . $value['account_id'] . '"';
for ($i=0; $i<count($userGroups); $i++)
{
/* print "Los1:".$userData["account_id"].$userGroups[$i]['account_id']." : ".$value['account_id']."<br>"; */
if ($userGroups[$i]['account_id'] == $value['account_id'])
{
$groups_select .= ' selected';
}
}
$groups_select .= '>' . $value['account_lid'] . '</option>';
}
$groups_select .= '</select>';
/* create list of available apps */
$i = 0;
$apps = CreateObject('phpgwapi.applications',$_account_id);
$db_perms = $apps->read_account_specific();
@reset($phpgw_info['apps']);
$availableApps = $phpgw_info['apps'];
@asort($availableApps);
@reset($availableApps);
while ($application = each($availableApps))
{
if ($application[1]['enabled'] && $application[1]['status'] != 3)
{
$perm_display[$i]['appName'] = $application[0];
$perm_display[$i]['translatedName'] = $application[1]['title'];
$i++;
}
}
/* create apps output */
@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 = ' checked';
}
if ($perm_display[$i]['translatedName'])
{
$part1 = sprintf('<td>%s</td><td><input type="checkbox" name="account_permissions[%s]" value="True"%s></td>',
lang($perm_display[$i]['translatedName']),
$perm_display[$i]['appName'],
$checked);
}
$i++;
$checked = '';
if ($userData['account_permissions'][$perm_display[$i]['appName']] || $db_perms[$perm_display[$i]['appName']])
{
$checked = ' checked';
}
if ($perm_display[$i]['translatedName'])
{
$part2 = sprintf('<td>%s</td><td><input type="checkbox" name="account_permissions[%s]" value="True"%s></td>',
lang($perm_display[$i]['translatedName']),
$perm_display[$i]['appName'],
$checked);
}
else
{
$part2 = '<td colspan="2">&nbsp;</td>';
}
$appRightsOutput .= sprintf('<tr bgcolor="%s">%s%s</tr>',$phpgw_info['theme']['row_on'], $part1, $part2);
}
$var = Array(
'account_status' => $account_status,
'account_firstname' => '<input name="account_firstname" value="' . $userData['firstname'] . '">',
'account_lastname' => '<input name="account_lastname" value="' . $userData['lastname'] . '">',
'groups_select' => $groups_select,
'permissions_list' => $appRightsOutput
);
$t->set_var($var);
// create the menu on the left, if needed
$menuClass = CreateObject('admin.uimenuclass');
$t->set_var('rows',$menuClass->createHTMLCode('edit_account'));
echo $t->fp('out','form');
}
/* stores the userdata */
function saveUserData($_userData)
{
global $phpgw;
$account = CreateObject('phpgwapi.accounts',$_userData['account_id']);
$account->update_data($_userData);
$account->save_repository();
if ($_userData['account_passwd'])
{
$auth = CreateObject('phpgwapi.auth');
$auth->change_password($old_passwd, $_userData['account_passwd'], $_userData['account_id']);
}
$apps = CreateObject('phpgwapi.applications',array(intval($_userData['account_id']),'u'));
$apps->account_id = $_userData['account_id'];
if ($_userData['account_permissions'])
{
while($app = each($_userData['account_permissions']))
{
if($app[1])
{
$apps->add($app[0]);
}
}
}
$apps->save_repository();
$account = CreateObject('phpgwapi.accounts');
$allGroups = $account->get_list('groups');
if ($_userData['account_groups']) {
reset($_userData['account_groups']);
while (list($key,$value) = each($_userData['account_groups'])) {
$newGroups[$value] = $value;
}
}
$acl = CreateObject('phpgwapi.acl',$_userData['account_id']);
reset($allGroups);
while (list($key,$groupData) = each($allGroups))
{
/* print "$key,". $groupData['account_id'] ."<br>";*/
/* print "$key,". $_userData['account_groups'][1] ."<br>"; */
if ($newGroups[$groupData['account_id']])
{
$acl->add_repository('phpgw_group',$groupData['account_id'],$_userData['account_id'],1);
}
else
{
$acl->delete_repository('phpgw_group',$groupData['account_id'],$_userData['account_id']);
}
}
$phpgw->session->delete_cache(intval($_userData['account_id']));
}
/* checks if the userdata are valid
returns FALSE if the data are correct
otherwise the error array
*/
function userDataInvalid(&$_userData)
{
global $phpgw,$phpgw_info;
$totalerrors = 0;
if ($phpgw_info['server']['account_repository'] == 'ldap' && ! $allow_long_loginids)
{
if (strlen($_userData['account_lid']) > 8)
{
$error[$totalerrors] = lang('The loginid can not be more then 8 characters');
$totalerrors++;
}
}
if ($_userData['old_loginid'] != $_userData['account_lid'])
{
if ($phpgw->accounts->exists($_userData['account_lid']))
{
$error[$totalerrors] = lang('That loginid has already been taken');
$totalerrors++;
}
}
if ($_userData['account_passwd'] || $_userData['account_passwd_2'])
{
if ($_userData['account_passwd'] != $_userData['account_passwd_2'])
{
$error[$totalerrors] = lang('The two passwords are not the same');
$totalerrors++;
}
}
if (!count($_userData['account_permissions']) && !count($_userData['account_groups']))
{
$error[$totalerrors] = lang('You must add at least 1 permission or group to this account');
$totalerrors++;
}
if ($_userData['account_expires_month'] || $_userData['account_expires_day'] || $_userData['account_expires_year'])
{
if (! checkdate($_userData['account_expires_month'],$_userData['account_expires_day'],$_userData['account_expires_year']))
{
$error[$totalerrors] = lang('You have entered an invalid expiration date');
$totalerrors++;
}
else
{
$_userData['expires'] = mktime(2,0,0,$_userData['account_expires_month'],$_userData['account_expires_day'],$_userData['account_expires_year']);
}
}
else
{
$_userData['expires'] = -1;
}
/*
$check_account_file_space = explode ("-", $_userData['file_space']);
if (preg_match ("/\D/", $check_account_file_space[0]))
{
$error[$totalerrors++] = lang ('File space must be an integer');
}
*/
if ($totalerrors == 0)
{
return FALSE;
}
else
{
return $error;
}
}
// todo
// not needed if i use the same file for new users too
if (! $account_id)
{
Header('Location: ' . $phpgw->link('/admin/accounts.php'));
}
if ($submit)
{
$userData = array(
'account_lid' => $account_lid,
'firstname' => $account_firstname,
'lastname' => $account_lastname,
'account_passwd' => $account_passwd,
'status' => $account_status,
'old_loginid' => rawurldecode($old_loginid),
'account_id' => $account_id,
'account_passwd_2' => $account_passwd_2,
'account_groups' => $account_groups,
'account_permissions' => $account_permissions,
'homedirectory' => $homedirectory,
'loginshell' => $loginshell,
'account_expires_month' => $account_expires_month,
'account_expires_day' => $account_expires_day,
'account_expires_year' => $account_expires_year
/* 'file_space' => $account_file_space_number . "-" . $account_file_space_type */
);
if (!$errors = userDataInvalid($userData))
{
saveUserData($userData);
// check if would create a menu
// if we do, we can't return to the users list, because
// there are also some other plugins
$menuClass = CreateObject('admin.uimenuclass');
if (!$menuClass->createHTMLCode('edit_account'))
{
Header('Location: ' . $phpgw->link('/admin/accounts.php', 'cd='.$cd));
$phpgw->common->phpgw_exit();
}
else
{
$linkdata = array
(
'cd' => $cd,
'account_id' => $account_id
);
Header('Location: ' . $phpgw->link('/admin/editaccount.php', $linkdata));
$phpgw->common->phpgw_exit();
}
}
else
{
$phpgw->common->phpgw_header();
echo parse_navbar();
createPageBody($userData['account_id'],$userData,$errors);
$phpgw->common->phpgw_footer();
}
}
else
{
$phpgw->common->phpgw_header();
echo parse_navbar();
createPageBody($account_id);
$phpgw->common->phpgw_footer();
}
return;
/////////////////////////////////////////////////////////////////////////////////////////
//
// the old code
//
/////////////////////////////////////////////////////////////////////////////////////////
// The following sets any default preferences needed for new applications..
// This is smart enough to know if previous preferences were selected, use them.
$pref = CreateObject('phpgwapi.preferences',intval($account_id));
$t = $pref->get_preferences();
$docommit = False;
$after_apps = explode(':',$apps_after);
for ($i=1;$i<count($after_apps) - 1;$i++)
{
if ($after_apps[$i]=='admin')
{
$check = 'common';
}
else
{
$check = $after_apps[$i];
}
if (! $t[$check])
{
$phpgw->common->hook_single('add_def_pref', $after_apps[$i]);
$docommit = True;
}
}
if ($docommit)
{
$pref->commit();
}
// start including other admin tools
while ($app = each($apps_after))
{
$phpgw->common->hook_single('update_user_data', $app[0]);
}
$includedSomething = False;
// start including other admin tools
while($app = each($apps_after))
{
$phpgw->common->hook_single('show_user_data', $app[0]);
}
?>

View File

@ -1,353 +0,0 @@
<?php
/**************************************************************************\
* phpGroupWare - administration *
* http://www.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$ */
$phpgw_info = array();
if ($submit)
{
$phpgw_flags = Array(
'currentapp' => 'admin',
'enable_nextmatchs_class' => True,
'noheader' => True,
'nonavbar' => True
);
}
else
{
$phpgw_flags = Array(
'currentapp' => 'admin',
'enable_nextmatchs_class' => True
);
}
$phpgw_info['flags'] = $phpgw_flags;
include('../header.inc.php');
$apps_with_acl = Array(
'addressbook' => True,
'todo' => True,
'calendar' => True,
'notes' => True,
'projects' => True,
'phonelog' => True,
'infolog' => True,
'phpwebhosting' => True
);
function is_odd($n)
{
$ln = substr($n,-1);
if ($ln == 1 || $ln == 3 || $ln == 5 || $ln == 7 || $ln == 9)
{
return True;
}
else
{
return False;
}
}
if (! $group_id)
{
Header('Location: ' . $phpgw->link('/admin/groups.php'));
}
if ($submit)
{
$group = CreateObject('phpgwapi.accounts',intval($group_id));
$group->read_repository();
$old_group_name = $group->id2name($group_id);
if($n_group != $old_group_name)
{
if ($group->exists($n_group))
{
$error = lang('Sorry, that group name has already been taken.');
}
}
/*
if (preg_match ("/\D/", $account_file_space_number))
{
$error = lang ('File space must be an integer');
}
*/
if (!$error)
{
// Lock tables
$phpgw->db->lock(Array('phpgw_accounts','phpgw_preferences','phpgw_config','phpgw_applications','phpgw_hooks','phpgw_sessions','phpgw_acl'));
// Set group apps
$apps = CreateObject('phpgwapi.applications',intval($group_id));
$apps_before = $apps->read_account_specific();
$apps->update_data(Array());
$new_apps = Array();
if(isset($n_group_permissions))
{
reset($n_group_permissions);
while($app = each($n_group_permissions))
{
if($app[1])
{
$apps->add($app[0]);
if(!@$apps_before[$app[0]] || @$apps_before == False)
{
$new_apps[] = $app[0];
}
}
}
}
$apps->save_repository();
// Set new account_lid, if needed
if($old_group_name <> $n_group)
{
$group->data['account_lid'] = $n_group;
}
// Set group acl
$acl = CreateObject('phpgwapi.acl',$group_id);
$acl->read_repository();
$old_group_list = $acl->get_ids_for_location($group_id,1,'phpgw_group');
@reset($old_group_list);
while($old_group_list && $user_id = each($old_group_list))
{
$acl->delete_repository('phpgw_group',$group_id,$user_id[1]);
}
for ($i=0; $i<count($n_users);$i++)
{
$acl->add_repository('phpgw_group',$group_id,$n_users[$i],1);
// If the user is logged in, it will force a refresh of the session_info
$phpgw->db->query("update phpgw_sessions set session_action='' "
."where session_lid='" . $phpgw->accounts->id2name(intval($n_users[$i])) . "@" . $phpgw_info["user"]["domain"] . "'",__LINE__,__FILE__);
// The following sets any default preferences needed for new applications..
// This is smart enough to know if previous preferences were selected, use them.
$docommit = False;
if($new_apps)
{
$pref = CreateObject('phpgwapi.preferences',intval($n_users[$i]));
$t = $pref->read_repository();
for ($j=1;$j<count($new_apps) - 1;$j++)
{
if($new_apps[$j]=='admin')
{
$check = 'common';
}
else
{
$check = $new_apps[$j];
}
if (!$t[$check])
{
$phpgw->common->hook_single('add_def_pref', $new_apps[$j]);
$docommit = True;
}
}
}
if ($docommit)
{
$pref->save_repository();
}
// This is down here so we are sure to catch the acl changes
// for LDAP to update the memberuid attribute
$group->save_repository();
}
// Update any other options here, since the above save_repository () depends
// on a group having users
$group->data['file_space'] = $account_file_space_number . "-" . $account_file_space_type;
$group->save_repository ();
if ($old_group_name <> $n_group)
{
$basedir = $phpgw_info['server']['files_dir'] . SEP . 'groups' . SEP;
if (! @rename($basedir . $old_group_name, $basedir . $n_group))
{
$cd = 39;
}
else
{
$cd = 33;
}
}
else
{
$cd = 33;
}
$phpgw->db->unlock();
Header('Location: ' . $phpgw->link('/admin/groups.php','cd='.$cd));
$phpgw->common->phpgw_exit();
}
}
$p = CreateObject('phpgwapi.Template',PHPGW_APP_TPL);
$p->set_file(array('form' => 'group_form.tpl'));
if ($error)
{
$phpgw->common->phpgw_header();
echo parse_navbar();
$p->set_var('error','<p><center>'.$error.'</center>');
}
else
{
$p->set_var('error','');
}
if ($submit)
{
// $p->set_var('group_name_value',$n_group_name);
for ($i=0; $i<count($n_users); $i++)
{
$selected_users[$n_user[$i]] = ' selected';
}
}
else
{
$group_user = $phpgw->acl->get_ids_for_location($group_id,1,'phpgw_group');
if (!$group_user) { $group_user = array(); }
while ($user = each($group_user))
{
$selected_users[intval($user[1])] = ' selected';
}
$apps = CreateObject('phpgwapi.applications',intval($group_id));
$db_perms = $apps->read_account_specific();
}
$p->set_var('form_action',$phpgw->link('/admin/editgroup.php'));
$p->set_var('hidden_vars','<input type="hidden" name="group_id" value="' . $group_id . '">');
$p->set_var('lang_group_name',lang('group name'));
$p->set_var('group_name_value',$phpgw->accounts->id2name($group_id));
$accounts = CreateObject('phpgwapi.accounts',$group_id);
$account_list = $accounts->get_list('accounts');
$account_num = count($account_list);
if ($account_num < 5)
{
$p->set_var('select_size',$account_num);
}
else
{
$p->set_var('select_size','5');
}
$p->set_var('lang_include_user',lang('Select users for inclusion'));
while (list($key,$entry) = each($account_list))
{
$user_list .= '<option value="' . $entry['account_id'] . '"'
. $selected_users[intval($entry['account_id'])] . '>'
. $phpgw->common->display_fullname(
$entry['account_lid'],
$entry['account_firstname'],
$entry['account_lastname'])
. '</option>'."\n";
}
$p->set_var('user_list',$user_list);
$group_repository = $accounts->read_repository ();
if (!$group_repository['file_space'])
{
$group_repository['file_space'] = $phpgw_info['server']['vfs_default_account_size_number'] . "-" . $phpgw_info['server']['vfs_default_account_size_type'];
}
/*
$file_space_array = explode ("-", $group_repository['file_space']);
$account_file_space_number = $file_space_array[0];
$account_file_space_type = $file_space_array[1];
$account_file_space_type_selected[$account_file_space_type] = "selected";
$account_file_space = '
<input type=text name="account_file_space_number" value="' . trim($account_file_space_number) . '" size="7">';
$account_file_space_select ='<select name="account_file_space_type">';
$account_file_space_types = array ("gb", "mb", "kb", "b");
while (list ($num, $type) = each ($account_file_space_types))
{
$account_file_space_select .= "<option value=$type " . $account_file_space_type_selected[$type] . ">" . strtoupper ($type) . "</option>";
}
$account_file_space_select .= '</select>';
$p->set_var ('lang_file_space', "File space");
$p->set_var ('account_file_space', $account_file_space);
$p->set_var ('account_file_space_select', $account_file_space_select);
*/
$p->set_var('lang_permissions',lang('Permissions this group has'));
$i = 0;
reset($phpgw_info['apps']);
$sorted_apps = $phpgw_info['apps'];
@asort($sorted_apps);
@reset($sorted_apps);
while ($permission = each($sorted_apps))
{
if ($permission[1]['enabled'] && $permission[1]['status'] != 3)
{
$perm_display[$i][0] = $permission[0];
$perm_display[$i][1] = $permission[1]['title'];
$i++;
}
}
$perm_html = '';
$tr_color = $phpgw_info['theme']['row_off'];
for ($i=0;$perm_display[$i][1];$i++)
{
$app = $perm_display[$i][0];
if(!($i & 1))
{
$tr_color = $phpgw->nextmatchs->alternate_row_color();
$perm_html .= '<tr bgcolor="'.$tr_color.'">';
}
$perm_html .= '<td width="40%">' . lang($perm_display[$i][1]) . '</td>'
. '<td width="5%"><input type="checkbox" name="n_group_permissions['
. $perm_display[$i][0] . ']" value="True"';
if ($n_group_permissions[$app] || $db_perms[$app])
{
$perm_html .= ' checked';
}
$perm_html .= '></td><td width="5%">';
if($apps_with_acl[$app])
{
$perm_html .= '<a href="'.$phpgw->link('/preferences/acl_preferences.php','acl_app='.$app.'&owner='.$group_id).'" target="_blank"><img src="'.$phpgw->common->image('admin','dot.gif').'" border="0" hspace="3" align="absmiddle" alt="'.lang('Grant Access').'"></a>';
}
else
{
$perm_html .= '&nbsp;';
}
$perm_html .= '</td>';
if($i & 1)
{
$perm_html .= '</tr>';
}
}
if($i & 1)
{
$perm_html .= '<td colspan="4">&nbsp;</td></tr>';
}
$p->set_var('permissions_list',$perm_html);
$p->set_var('lang_submit_button',lang('submit changes'));
$p->pfp('out','form');
$phpgw->common->phpgw_footer();
?>

View File

@ -1,92 +0,0 @@
<?php
/**************************************************************************\
* phpGroupWare - administration *
* http://www.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$ */
$phpgw_info = array();
$phpgw_info['flags'] = array(
'currentapp' => 'admin',
'enable_nextmatchs_class' => True
);
include('../header.inc.php');
function account_total($query)
{
global $phpgw;
if ($query) {
$querymethod = " AND account_firstname LIKE '%$query%' OR account_lastname LIKE "
. "'%$query%' OR account_lid LIKE '%$query%' ";
}
$phpgw->db->query("SELECT COUNT(*) FROM phpgw_accounts WHERE account_type='g'".$querymethod,__LINE__,__FILE__);
$phpgw->db->next_record();
return $phpgw->db->f(0);
}
$p = CreateObject('phpgwapi.Template',PHPGW_APP_TPL);
$p->set_file(array(
'groups' => 'groups.tpl'
));
$p->set_block('groups','list','list');
$p->set_block('groups','row','row');
$p->set_block('groups','row_empty','row_empty');
$total = account_total($query);
$p->set_var('th_bg',$phpgw_info['theme']['th_bg']);
$p->set_var('left_next_matchs',$phpgw->nextmatchs->left('/admin/groups.php',$start,$total));
$p->set_var('right_next_matchs',$phpgw->nextmatchs->right('/admin/groups.php',$start,$total));
$p->set_var('lang_groups',lang('user groups'));
$p->set_var('sort_name',$phpgw->nextmatchs->show_sort_order($sort,"account_lid",$order,"/admin/groups.php",lang("name")));
$p->set_var('header_edit',lang('Edit'));
$p->set_var('header_delete',lang('Delete'));
$account_info = $phpgw->accounts->get_list('groups',$start,$sort, $order, $query, $total);
if (! count($account_info))
{
$p->set_var('message',lang('No matchs found'));
$p->parse('rows','row_empty',True);
}
else
{
while (list($null,$account) = each($account_info))
{
$group_id = $account['account_id'];
$group_name = $account['account_lid'];
$tr_color = $phpgw->nextmatchs->alternate_row_color($tr_color);
$p->set_var("tr_color",$tr_color);
if (! $group_name) { $group_name = '&nbsp;'; }
$p->set_var('group_name',$group_name);
$p->set_var('edit_link','<a href="' . $phpgw->link('/admin/editgroup.php','group_id=' . $group_id) . '"> ' . lang('Edit') . ' </a>');
$p->set_var('delete_link','<a href="' . $phpgw->link('/admin/deletegroup.php','group_id=' . $group_id) . '"> ' . lang('Delete') . ' </a>');
$p->parse('rows','row',True);
}
}
$p->set_var('new_action',$phpgw->link('/admin/newgroup.php'));
$p->set_var('lang_add',lang('add'));
$p->set_var('search_action',$phpgw->link('/admin/groups.php'));
$p->set_var('lang_search',lang('search'));
$p->pparse('out','list');
$phpgw->common->phpgw_footer();
?>

View File

@ -1,383 +0,0 @@
<?php
/**************************************************************************\
* phpGroupWare - administration *
* http://www.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$ */
$phpgw_info['flags'] = array(
'currentapp' => 'admin',
'noheader' => True,
'nonavbar' => True,
'parent_page' => 'accounts.php',
'enable_sbox_class' => True
);
include('../header.inc.php');
function is_odd($n)
{
$ln = substr($n,-1);
if ($ln == 1 || $ln == 3 || $ln == 5 || $ln == 7 || $ln == 9)
{
return True;
}
else
{
return False;
}
}
if ($submit)
{
$totalerrors = 0;
if ($phpgw_info['server']['account_repository'] == 'ldap' && ! $allow_long_loginids)
{
if (strlen($n_loginid) > 8)
{
$error[$totalerrors++] = lang('The loginid can not be more then 8 characters');
}
}
if (! $account_lid)
{
$error[$totalerrors++] = lang('You must enter a loginid');
}
if (! $account_passwd)
{
$error[$totalerrors++] = lang('You must enter a password');
}
if ($account_passwd == $account_lid)
{
$error[$totalerrors++] = lang('The login and password can not be the same');
}
if ($account_passwd != $account_passwd_2)
{
$error[$totalerrors++] = lang('The two passwords are not the same');
}
if (!count($account_permissions) && !count($account_groups))
{
$error[$totalerrors++] = lang('You must add at least 1 permission or group to this account');
}
if ($phpgw->accounts->exists($account_lid))
{
$error[$totalerrors++] = lang('That loginid has already been taken');
}
if ($account_expires_month || $account_expires_day || $account_expires_year)
{
if (! checkdate($account_expires_month,$account_expires_day,$account_expires_year))
{
$error[] = lang('You have entered an invalid expiration date');
}
else
{
$account_expires = mktime(2,0,0,$account_expires_month,$account_expires_day,$account_expires_year);
}
}
else
{
$account_expires = -1;
}
if (! $error)
{
$phpgw->db->lock(array(
'phpgw_accounts',
'phpgw_nextid',
'phpgw_preferences',
'phpgw_sessions',
'phpgw_acl',
'phpgw_applications'
));
$account_info = array(
'account_type' => 'u',
'account_lid' => $account_lid,
'account_passwd' => $account_passwd,
'account_firstname' => $account_firstname,
'account_lastname' => $account_lastname,
'account_status' => $account_status,
'account_expires' => $account_expires
);
$phpgw->accounts->create($account_info);
$account_id = $phpgw->accounts->name2id($account_lid);
$apps = CreateObject('phpgwapi.applications',array($account_id,'u'));
$apps->read_installed_apps();
// Read Group Apps
if ($account_groups)
{
$apps->account_type = 'g';
reset($account_groups);
while($groups = each($account_groups))
{
$apps->account_id = $groups[0];
$old_app_groups = $apps->read_account_specific();
@reset($old_app_groups);
while($old_group_app = each($old_app_groups))
{
if (!$apps_after[$old_group_app[0]])
{
$apps_after[$old_group_app[0]] = $old_app_groups[$old_group_app[0]];
}
}
}
}
$apps->account_type = 'u';
$apps->account_id = $account_id;
$apps->account_apps = Array(Array());
if ($account_permissions)
{
@reset($account_permissions);
while ($app = each($account_permissions))
{
if ($app[1])
{
$apps->add($app[0]);
if (!$apps_after[$app[0]])
{
$apps_after[] = $app[0];
}
}
}
}
$apps->save_repository();
// This is not the correct way to do it ... Fix me
$phpgw->db->query("insert into phpgw_acl values ('preferences','changepassword','$account_id','1')",__LINE__,__FILE__);
// Assign user to groups
if ($account_groups)
{
for ($i=0;$i<count($account_groups);$i++)
{
$phpgw->acl->add_repository('phpgw_group',$account_groups[$i],$account_id,1);
}
}
if ($apps_after)
{
$pref = CreateObject('phpgwapi.preferences',$account_id);
$phpgw->common->hook_single('add_def_pref','admin');
while ($apps = each($apps_after))
{
if (strcasecmp ($apps[0], 'admin') != 0)
{
$phpgw->common->hook_single('add_def_pref', $apps[1]);
}
}
$pref->save_repository(False);
}
$apps->account_apps = Array(Array());
$apps_after = Array(Array());
$phpgw->db->unlock();
/*
// start inlcuding other admin tools
while($app = each($apps_after))
{
$phpgw->common->hook_single('add_user_data', $value);
}
*/
Header('Location: ' . $phpgw->link('/admin/accounts.php','cd='.$cd));
$phpgw->common->phpgw_exit();
}
}
else
{
$account_status = 'A';
}
$p = CreateObject('phpgwapi.Template',PHPGW_APP_TPL);
$p->set_unknowns('remove');
if ($phpgw_info["server"]["ldap_extra_attributes"] && $phpgw_info['server']['account_repository'] == 'ldap')
{
$p->set_file(array('account' => 'account_form_ldap.tpl'));
}
else
{
$p->set_file(array('account' => 'account_form.tpl'));
}
$p->set_block('account','form','form');
$p->set_block('account','form_passwordinfo','form_passwordinfo');
$p->set_block('account','form_buttons_','form_buttons_');
$phpgw->common->phpgw_header();
echo parse_navbar();
$p->set_var('lang_action',lang('Add new account'));
if ($totalerrors)
{
$p->set_var('error_messages','<center>' . $phpgw->common->error_list($error) . '</center>');
}
$p->set_var('th_bg',$phpgw_info['theme']['th_bg']);
$p->set_var('tr_color1',$phpgw_info['theme']['row_on']);
$p->set_var('tr_color2',$phpgw_info['theme']['row_off']);
$p->set_var('form_action',$phpgw->link('/admin/newaccount.php'));
$p->set_var('lang_loginid',lang('LoginID'));
if ($account_status)
{
$p->set_var('account_status','<input type="checkbox" name="account_status" value="A" checked>');
}
else
{
$p->set_var('account_status','<input type="checkbox" name="account_status" value="A">');
}
$p->set_var('account_lid','<input name="account_lid" value="' . $account_lid . '">');
$p->set_var('lang_account_active',lang('Account active'));
$p->set_var('lang_password',lang('Password'));
$p->set_var('account_passwd',$account_passwd);
if ($phpgw_info["server"]["ldap_extra_attributes"]) {
$p->set_var("lang_homedir",lang("home directory"));
$p->set_var("lang_shell",lang(" login shell"));
$p->set_var("homedirectory",'<input name="homedirectory" value="' . $phpgw_info["server"]["ldap_account_home"].SEP.$account_lid . '">');
$p->set_var("loginshell",'<input name="loginshell" value="' . $phpgw_info["server"]["ldap_account_shell"] . '">');
}
$p->set_var('lang_reenter_password',lang('Re-Enter Password'));
$p->set_var('account_passwd_2',$account_passwd_2);
$p->parse('password_fields','form_passwordinfo',True);
$p->set_var('lang_firstname',lang('First Name'));
$p->set_var('account_firstname','<input name="account_firstname" value="' . $account_firstname . '">');
$p->set_var('lang_lastname',lang('Last Name'));
$p->set_var('account_lastname','<input name="account_lastname" value="' . $account_lastname . '">');
$p->set_var('lang_groups',lang('Groups'));
$p->set_var('lang_expires',lang('Expires'));
$_y = $phpgw->sbox->getyears('account_expires_year',$account_expires_year,date('Y'),date('Y')+10);
$_m = $phpgw->sbox->getmonthtext('account_expires_month',$account_expires_month);
$_d = $phpgw->sbox->getdays('account_expires_day',$account_expires_day);
$p->set_var('input_expires',$phpgw->common->dateformatorder($_y,$_m,$_d,True));
$p->parse('form_buttons','form_buttons_',True);
/* groups list */
$groups_select = '<select name="account_groups[]" multiple>';
$groups = $phpgw->accounts->get_list('groups');
while (list(,$group) = each($groups))
{
$groups_select .= '<option value="' . $group['account_id'] . '"';
while (list(,$ags) = @each($account_groups))
{
if ($group['account_id'] == $ags)
{
$groups_select .= ' selected';
}
}
@reset($account_groups);
$groups_select .= '>' . $group['account_lid'] . '</option>';
$groups_select .= "\n";
}
$groups_select .= '</select>';
$p->set_var('groups_select',$groups_select);
/* end groups list */
$i = 0;
$phpgw->applications->read_installed_apps();
$sorted_apps = $phpgw_info['apps'];
@asort($sorted_apps);
@reset($sorted_apps);
while ($permission = each($sorted_apps))
{
if ($permission[1]['enabled'] && $permission[1]['status'] != 3)
{
$perm_display[$i][0] = $permission[0];
$perm_display[$i][1] = $permission[1]['title'];
$i++;
}
}
// The $i<200 is only used for a brake
for ($i=0;$i<200;)
{
if (! $perm_display[$i][1])
{
break;
}
$perms_html .= '<tr bgcolor="' . $phpgw_info['theme']['row_on'] . '"><td>' . lang($perm_display[$i][1]) . '</td>'
. '<td><input type="checkbox" name="account_permissions['
. $perm_display[$i][0] . ']" value="True"';
if ($account_permissions[$perm_display[$i][0]])
{
$perms_html .= ' checked';
}
$perms_html .= '></td>';
$i++;
if ($i == count($perm_display) && is_odd(count($perm_display)))
{
$perms_html .= '<td colspan="2">&nbsp;</td></tr>';
}
if (! $perm_display[$i][1])
{
break;
}
$perms_html .= '<td>' . lang($perm_display[$i][1]) . '</td>'
. '<td><input type="checkbox" name="account_permissions['
. $perm_display[$i][0] . ']" value="True"';
if ($account_permissions[$perm_display[$i][0]])
{
$perms_html .= ' checked';
}
$perms_html .= '></td></tr>';
$i++;
}
$p->set_var('permissions_list',$perms_html);
$includedSomething = False;
// Skeeter: I don't see this as a player, if creating new accounts...
// start inlcuding other admin tools
// while(list($key,$value) = each($phpgw_info["user"]["app_perms"]))
// {
// check if we have something included, when not ne need to set
// {gui_hooks} to ""
// if ($phpgw->common->hook_single("show_newuser_data", $value)) $includedSomething="true";
// }
$p->set_var('lang_button',Lang('Add'));
$p->pfp('out','form');
$phpgw->common->phpgw_footer();
?>

View File

@ -1,301 +0,0 @@
<?php
/**************************************************************************\
* phpGroupWare - administration *
* http://www.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$ */
$phpgw_info = array();
if ($submit)
{
$phpgw_info['flags'] = array(
'noheader' => True,
'nonavbar' => True
);
}
$phpgw_info['flags']['currentapp'] = 'admin';
include('../header.inc.php');
function is_odd($n)
{
$ln = substr($n,-1);
if ($ln == 1 || $ln == 3 || $ln == 5 || $ln == 7 || $ln == 9)
{
return True;
}
else
{
return False;
}
}
if ($submit)
{
if (!$n_group)
{
$error = '<br>' . lang('You must enter a group name.');
}
else
{
if ($phpgw->accounts->exists($n_group))
{
$error = '<br>' . lang('Sorry, that group name has already been taken.');
}
}
if ($account_expires_month || $account_expires_day || $account_expires_year)
{
if (! checkdate($account_expires_month,$account_expires_day,$account_expires_year))
{
$error[] = lang('You have entered an invalid expiration date');
}
else
{
$account_expires = mktime(2,0,0,$account_expires_month,$account_expires_day,$account_expires_year);
}
}
else
{
$account_expires = -1;
}
/*
if (preg_match ("/\D/", $account_file_space_number))
{
$error = lang ('File space must be an integer');
}
*/
if (!$error)
{
$phpgw->db->lock(array(
'phpgw_accounts',
'phpgw_nextid',
'phpgw_preferences',
'phpgw_sessions',
'phpgw_acl',
'phpgw_applications'
));
$group = CreateObject('phpgwapi.accounts',$group_id);
$account_info = array(
'account_type' => 'g',
'account_lid' => $n_group,
'account_passwd' => '',
'account_firstname' => $n_group,
'account_lastname' => 'Group',
'account_status' => 'A',
'account_expires' => $account_expires,
'account_file_space' => $account_file_space_number . "-" . $account_file_space_type,
);
$group->create($account_info);
$group_id = $phpgw->accounts->name2id($n_group);
$apps = CreateObject('phpgwapi.applications',intval($group_id));
$apps->update_data(Array());
@reset($n_group_permissions);
if (count($n_group_permissions))
{
while($app = each($n_group_permissions))
{
if ($app[1])
{
$apps->add($app[0]);
$new_apps[] = $app[0];
}
}
$apps->save_repository();
}
$acl = CreateObject('phpgwapi.acl',$group_id);
$acl->read_repository();
for ($i=0; $i<count($n_users);$i++)
{
$acl->add_repository('phpgw_group',$group_id,$n_users[$i],1);
// If the user is logged in, it will force a refresh of the session_info
# $phpgw->db->query("update phpgw_sessions set session_info='' "
# ."where session_lid='" . $phpgw->accounts->id2name(intval($n_users[$i])) . "@" . $phpgw_info["user"]["domain"] . "'",__LINE__,__FILE__);
$pref = CreateObject('phpgwapi.preferences',intval($n_users[$i]));
$t = $pref->read_repository();
$docommit = False;
for ($j=0;$j<count($new_apps);$j++)
{
if($new_apps[$j]=="admin")
{
$check = "common";
}
else
{
$check = $new_apps[$j];
}
if (!$t["$check"])
{
$phpgw->common->hook_single("add_def_pref", $new_apps[$j]);
$docommit = True;
}
}
if ($docommit)
{
$pref->save_repository();
}
}
$basedir = $phpgw_info["server"]["files_dir"] . SEP . "groups" . SEP;
$cd = 31;
umask(000);
if (! @mkdir ($basedir . $n_group, 0707))
{
$cd = 37;
}
$phpgw->db->unlock();
Header("Location: " . $phpgw->link("/admin/groups.php","cd=$cd"));
$phpgw->common->phpgw_exit();
}
}
$p = CreateObject('phpgwapi.Template',PHPGW_APP_TPL);
$p->set_file(array("form" => "group_form.tpl"));
if ($error)
{
$phpgw->common->phpgw_header();
echo parse_navbar();
$p->set_var("error","<p><center>$error</center>");
}
else
{
$p->set_var("error","");
}
$p->set_var("form_action",$phpgw->link("/admin/newgroup.php"));
$p->set_var("hidden_vars","");
$p->set_var("lang_group_name",lang("New group name"));
$p->set_var("group_name_value",$n_group);
$accounts = CreateObject('phpgwapi.accounts',$group_id);
$account_list = $accounts->get_list('accounts');
$account_num = count($account_list);
if ($account_num < 5)
{
$p->set_var('select_size',$account_num);
}
else
{
$p->set_var('select_size','5');
}
$p->set_var("lang_include_user",lang("Select users for inclusion"));
for ($i=0; $i<count($n_users); $i++)
{
$selected_users[$n_users[$i]] = " selected";
}
while (list($key,$entry) = each($account_list))
{
$user_list .= '<option value="' . $entry['account_id'] . '"'
. $selected_users[intval($entry['account_id'])] . '>'
. $phpgw->common->display_fullname(
$entry['account_lid'],
$entry['account_firstname'],
$entry['account_lastname'])
. '</option>'."\n";
}
$p->set_var("user_list",$user_list);
if (!$account_file_space_number)
{
$account_file_space_number = $phpgw_info['server']['vfs_default_account_size_number'];
}
if (!$account_file_space_type)
{
$account_file_space_type = $phpgw_info['server']['vfs_default_account_size_type'];
}
$account_file_space_type_selected[$account_file_space_type] = "selected";
$account_file_space = '
<input type=text name="account_file_space_number" value="' . $account_file_space_number . '" size="7">';
$account_file_space_select ='<select name="account_file_space_type">';
$account_file_space_types = array ("gb", "mb", "kb", "b");
while (list ($num, $type) = each ($account_file_space_types))
{
$account_file_space_select .= "<option value=$type " . $account_file_space_type_selected[$type] . ">" . strtoupper ($type) . "</option>";
}
$account_file_space_select .= '</select>';
/*
$p->set_var ('lang_file_space', "File space");
$p->set_var ('account_file_space', $account_file_space);
$p->set_var ('account_file_space_select', $account_file_space_select);
*/
$p->set_var("lang_permissions",lang("Permissions this group has"));
$i = 0;
$phpgw->applications->read_installed_apps();
$sorted_apps = $phpgw_info["apps"];
@asort($sorted_apps);
@reset($sorted_apps);
while ($permission = each($sorted_apps))
{
if ($permission[1]['enabled'] && $permission[1]['status'] != 3)
{
$perm_display[$i][0] = $permission[0];
$perm_display[$i][1] = $permission[1]['title'];
$i++;
}
}
$perm_html = "";
for ($i=0;$i<200;) // The $i<200 is only used for a brake
{
if (! $perm_display[$i][1]) break;
$perm_html .= '<tr bgcolor="'.$phpgw_info["theme"]["row_on"].'"><td>' . lang($perm_display[$i][1]) . '</td>'
. '<td><input type="checkbox" name="n_group_permissions['
. $perm_display[$i][0] . ']" value="True"';
if ($n_group_permissions[$perm_display[$i][0]])
{
$perm_html .= " checked";
}
$perm_html .= "></td>";
$i++;
if ($i == count($perm_display) && is_odd(count($perm_display)))
{
$perm_html .= '<td colspan="2">&nbsp;</td></tr>';
}
if (! $perm_display[$i][1]) break;
$perm_html .= '<td>' . lang($perm_display[$i][1]) . '</td>'
. '<td><input type="checkbox" name="n_group_permissions['
. $perm_display[$i][0] . ']" value="True"';
if ($n_group_permissions[$perm_display[$i][0]])
{
$perm_html .= " checked";
}
$perm_html .= "></td></tr>\n";
$i++;
}
$p->set_var('permissions_list',$perm_html);
$p->set_var('lang_submit_button',lang('Create Group'));
$p->pfp('out','form');
$phpgw->common->phpgw_footer();
?>

View File

@ -1,196 +0,0 @@
<?php
/**************************************************************************\
* 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)
{
Header('Location: ' . $phpgw->link('/admin/accounts.php'));
}
$t = CreateObject('phpgwapi.Template',PHPGW_APP_TPL);
$t->set_unknowns('remove');
$t->set_file(array('account' => 'account_form.tpl'));
$t->set_block('account','form','form');
$t->set_block('account','form_logininfo');
$t->set_block('account','link_row');
$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'));
$t->set_var('lang_expires',lang('Expires'));
$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
if ($userData['lastlogin'])
{
$t->set_var('account_lastlogin',$phpgw->common->show_date($userData['lastlogin']));
}
else
{
$t->set_var('account_lastlogin',lang('Never'));
}
// Last login IP
if ($userData['lastloginfrom'])
{
$t->set_var('account_lastloginfrom',$userData['lastloginfrom']);
}
else
{
$t->set_var('account_lastloginfrom',lang('Never'));
}
$t->parse('password_fields','form_logininfo',True);
// 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'));
}
// Find out which groups they are members of
$usergroups = $account->membership(intval($account_id));
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))
{
if ($application[1]['enabled'] && $application[1]['status'] != 2)
{
$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 = '&nbsp;&nbsp;X';
}
else
{
$checked = '&nbsp;';
}
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 = '&nbsp;&nbsp;X';
}
else
{
$checked = '&nbsp;';
}
if ($perm_display[$i]['translatedName'])
{
$part2 = sprintf("<td>%s</td><td>%s</td>",lang($perm_display[$i]['translatedName']),$checked);
}
else
{
$part2 = '<td colspan="2">&nbsp;</td>';
}
$appRightsOutput .= sprintf("<tr bgcolor=\"%s\">$part1$part2</tr>\n",$phpgw_info["theme"]["row_on"]);
}
$t->set_var('permissions_list',$appRightsOutput);
// create the menu on the left, if needed
$menuClass = CreateObject('admin.uimenuclass');
$t->set_var('rows',$menuClass->createHTMLCode('view_account'));
$t->pfp('out','form');
$phpgw->common->phpgw_footer();
?>