From 9280eca83b929ad21d6b27c92b63688bb9d83634 Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Fri, 28 Mar 2014 19:18:58 +0000 Subject: [PATCH] old user and group admin, incl. lots of old phplib templates --- admin/inc/class.admin_hooks.inc.php | 9 - admin/inc/class.admin_ui.inc.php | 11 - admin/inc/class.boaccounts.inc.php | 501 ----- admin/inc/class.uiaccounts.inc.php | 1706 ----------------- admin/inc/class.uiaclmanager.inc.php | 10 +- admin/inc/class.uimenuclass.inc.php | 138 -- admin/inc/hook_add_def_pref.inc.php | 8 - admin/setup/setup.inc.php | 1 - admin/templates/default/account_form.tpl | 151 -- admin/templates/default/accounts.tpl | 80 - admin/templates/default/acl_accounts.tpl | 57 - admin/templates/default/delete_account.tpl | 19 - admin/templates/default/delete_cat.tpl | 35 - admin/templates/default/delete_common.tpl | 20 - .../templates/default/form_button_script.tpl | 6 - admin/templates/default/group_form.tpl | 76 - admin/templates/default/group_manager.tpl | 37 - admin/templates/default/groups.tpl | 71 - admin/templates/default/index.tpl | 63 - admin/templates/default/kill_session.tpl | 11 - admin/templates/default/menurow.tpl | 19 - admin/templates/default/message_row.tpl | 5 - admin/templates/default/nntp.tpl | 68 - 23 files changed, 5 insertions(+), 3097 deletions(-) delete mode 100755 admin/inc/class.boaccounts.inc.php delete mode 100755 admin/inc/class.uiaccounts.inc.php delete mode 100644 admin/inc/class.uimenuclass.inc.php delete mode 100755 admin/inc/hook_add_def_pref.inc.php delete mode 100644 admin/templates/default/account_form.tpl delete mode 100644 admin/templates/default/accounts.tpl delete mode 100644 admin/templates/default/acl_accounts.tpl delete mode 100755 admin/templates/default/delete_account.tpl delete mode 100644 admin/templates/default/delete_cat.tpl delete mode 100644 admin/templates/default/delete_common.tpl delete mode 100755 admin/templates/default/form_button_script.tpl delete mode 100644 admin/templates/default/group_form.tpl delete mode 100755 admin/templates/default/group_manager.tpl delete mode 100644 admin/templates/default/groups.tpl delete mode 100755 admin/templates/default/index.tpl delete mode 100644 admin/templates/default/kill_session.tpl delete mode 100644 admin/templates/default/menurow.tpl delete mode 100755 admin/templates/default/message_row.tpl delete mode 100755 admin/templates/default/nntp.tpl diff --git a/admin/inc/class.admin_hooks.inc.php b/admin/inc/class.admin_hooks.inc.php index 1f5e3b04a7..112ad42a8c 100644 --- a/admin/inc/class.admin_hooks.inc.php +++ b/admin/inc/class.admin_hooks.inc.php @@ -60,15 +60,6 @@ class admin_hooks $file['Site Configuration'] = egw::link('/index.php','menuaction=admin.uiconfig.index&appname=admin'); } - if (! $GLOBALS['egw']->acl->check('account_access',1,'admin')) - { - $file['User Accounts'] = array( - 'id' => '/accounts', - 'icon' => common::image('addressbook', 'accounts'), - 'link' => egw::link('/index.php','menuaction=admin.uiaccounts.list_users'), - ); - } - if (! $GLOBALS['egw']->acl->check('account_access',16,'admin')) { $file['Bulk password reset'] = egw::link('/index.php','menuaction=admin.admin_passwordreset.index'); diff --git a/admin/inc/class.admin_ui.inc.php b/admin/inc/class.admin_ui.inc.php index 0ebae879c9..ac93c656bb 100644 --- a/admin/inc/class.admin_ui.inc.php +++ b/admin/inc/class.admin_ui.inc.php @@ -111,13 +111,6 @@ class admin_ui 'add' => array( 'group' => $group, )+$user_actions['add'], - 'edit' => array( - 'onExecute' => 'javaScript:app.admin.group', - 'caption' => 'Edit group', - 'enableId' => '^/groups/-\\d+', - 'url' => 'menuaction=admin.uiaccounts.edit_group&account_id=$id', - 'group' => 2, - ), 'acl' => array( 'onExecute' => 'javaScript:app.admin.group', 'caption' => 'Access control', @@ -422,10 +415,6 @@ if ($app == 'felamimail') continue; // disabled fmail for now, as it break whole $tree['item'][] = self::fix_userdata(array( 'text' => $group['account_lid'], 'id' => $root.'/'.$group['account_id'], - 'link' => egw::link('/index.php', array( - 'menuaction' => 'admin.uiaccounts.edit_group', - 'account_id' => $group['account_id'], - )), )); } } diff --git a/admin/inc/class.boaccounts.inc.php b/admin/inc/class.boaccounts.inc.php deleted file mode 100755 index 43fb90909b..0000000000 --- a/admin/inc/class.boaccounts.inc.php +++ /dev/null @@ -1,501 +0,0 @@ - True, - 'add_user' => True, - 'delete_group' => True, - 'delete_user' => True, - 'edit_group' => True, - 'edit_user' => True - ); - - var $xml_functions = array(); - - var $soap_functions = array( - 'add_user' => array( - 'in' => array('int', 'struct'), - 'out' => array() - ) - ); - - function delete_group($account_id='') - { - if(!$account_id || $GLOBALS['egw']->acl->check('group_access',32,'admin')) - { - return False; - } - - $account_id = (int)$account_id; - - // delete all acl (and memberships) of group - $GLOBALS['egw']->acl->delete_account($account_id); - - // make this information also available in the hook - $lid = $GLOBALS['egw']->accounts->id2name($account_id); - - $GLOBALS['egw']->hooks->process($GLOBALS['hook_values'] = array( - 'account_id' => $account_id, - 'account_name' => $lid, - 'location' => 'deletegroup' - ),False,True); // called for every app now, not only enabled ones) - - $GLOBALS['egw']->accounts->delete($account_id); - - return True; - } - - function delete_user($account_id='',$new_owner='') - { - if(!$account_id || $GLOBALS['egw']->acl->check('account_access',32,'admin')) - { - return False; - } - - $accountid = (int)$account_id; - $account_id = get_account_id($accountid); - // make this information also available in the hook - $lid = $GLOBALS['egw']->accounts->id2name($account_id); - - $GLOBALS['hook_values'] = array( - 'account_id' => $account_id, - 'account_lid' => $lid, - 'new_owner' => (int)$new_owner, - 'location' => 'deleteaccount' - ); - // first all other apps, then preferences and admin - foreach(array_merge(array_diff(array_keys($GLOBALS['egw_info']['apps']),array('preferences','admin')),array('preferences','admin')) as $app) - { - $GLOBALS['egw']->hooks->single($GLOBALS['hook_values'],$app); - } - return True; - } - - function add_group($group_info) - { - if($GLOBALS['egw']->acl->check('group_access',4,'admin')) - { - return False; - } - - $errors = $this->validate_group($group_info); - if(count($errors)) - { - return $errors; - } - - $group =& CreateObject('phpgwapi.accounts',$group_info['account_id'],'g'); - $group->acct_type = 'g'; - $account_info = array( - 'account_type' => 'g', - 'account_lid' => $group_info['account_name'], - 'account_passwd' => '', - 'account_firstname' => $group_info['account_name'], - 'account_lastname' => 'Group', - 'account_status' => 'A', - 'account_expires' => -1, -// 'account_file_space' => $account_file_space_number . "-" . $account_file_space_type, - 'account_email' => $group_info['account_email'], - 'account_members' => $group_info['account_user'] - ); - $group_info['account_id'] = $group->create($account_info); - - // do the following only if we got an id - the create succeeded - if($group_info['account_id']) - { - $group->set_members($group_info['account_user'],$group_info['account_id']); - - $apps =& CreateObject('phpgwapi.applications',$group_info['account_id']); - $apps->update_data(Array()); - reset($group_info['account_apps']); - while(list($app,$value) = each($group_info['account_apps'])) - { - $apps->add($app); - $new_apps[] = $app; - } - $apps->save_repository(); - - $GLOBALS['hook_values'] = $group_info; - $GLOBALS['egw']->hooks->process($GLOBALS['hook_values']+array( - 'location' => 'addgroup' - ),False,True); // called for every app now, not only enabled ones) - - return True; - } - - return False; - } - - function edit_group($group_info) - { - if($GLOBALS['egw']->acl->check('group_access',16,'admin')) - { - return False; - } - - $errors = $this->validate_group($group_info); - if(count($errors)) - { - return $errors; - } - - $group =& CreateObject('phpgwapi.accounts',$group_info['account_id'],'g'); - $old_group_info = $group->read_repository(); - - // Set group apps - $apps =& CreateObject('phpgwapi.applications',$group_info['account_id']); - $apps_before = $apps->read_account_specific(); - $apps->update_data(Array()); - $new_apps = Array(); - if(count($group_info['account_apps'])) - { - reset($group_info['account_apps']); - while(list($app,$value) = each($group_info['account_apps'])) - { - $apps->add($app); - if(!@$apps_before[$app] || @$apps_before == False) - { - $new_apps[] = $app; - } - } - } - $apps->save_repository(); - - $group->set_members($group_info['account_user'],$group_info['account_id']); - - $GLOBALS['hook_values'] = $group_info; - $GLOBALS['hook_values']['old_name'] = $group->id2name($group_info['account_id']); - - // This is down here so we are sure to catch the acl changes - // for LDAP to update the memberuid attribute - $group->data['account_email'] = $group_info['account_email']; - $group->data['account_lid'] = $group_info['account_name']; - $group->save_repository(); - - $GLOBALS['egw']->hooks->process($GLOBALS['hook_values']+array( - 'location' => 'editgroup' - ),False,True); // called for every app now, not only enabled ones) - - return True; - } - - /** - * Process a user edit - * - * @param array $userData - * @param int $required_account_access=16 can be set to 4 for add user - * @return boolean|array with errors or true on success, false on acl failure - */ - function edit_user(&$userData, $required_account_access=16) - { - if($GLOBALS['egw']->acl->check('account_access',$required_account_access,'admin')) - { - return False; - } - //error_log(array2string($userData)); - $accountPrefix = ''; - if(isset($GLOBALS['egw_info']['server']['account_prefix'])) - { - $accountPrefix = $GLOBALS['egw_info']['server']['account_prefix']; - } - if($accountPrefix && strpos($userData['account_lid'], $accountPrefix) !== 0) - { - $userData['account_lid'] = $accountPrefix . $userData['account_lid']; - } - - $errors = $this->validate_user($userData); - - if(!$errors) - { - $new_user = !$userData['account_id']; - $passwd = $userData['account_passwd']; - $errors = $this->save_user($userData); - $GLOBALS['hook_values'] = $userData + ($new_user ? array( - 'new_password' => $passwd, - ) : array()); - $GLOBALS['egw']->hooks->process($GLOBALS['hook_values']+array( - 'location' => $new_user ? 'addaccount' : 'editaccount', - ),False,True); // called for every app now, not only enabled ones) - } - //error_log(__METHOD__."(".array2string($userData).") returning ".array2string($errors ? $errors : true)); - return $errors ? $errors : true; - } - - function validate_group($group_info) - { - $errors = Array(); - - $group =& CreateObject('phpgwapi.accounts',$group_info['account_id'],'g'); - $group->read_repository(); - - if(!$group_info['account_name']) - { - $errors[] = lang('You must enter a group name.'); - } - /* For LDAP */ - if(!$group_info['account_user']) - { - $errors[] = lang('You must select at least one group member.'); - } - - if($group_info['account_name'] != $group->id2name($group_info['account_id'])) - { - if($group->exists($group_info['account_name'])) - { - $errors[] = lang('Sorry, that group name has already been taken.'); - } - } - - /* - if(preg_match("/\D/", $account_file_space_number)) - { - $errors[] = lang('File space must be an integer'); - } - */ - if(count($errors)) - { - return $errors; - } - } - - /** - * checks if the userdata are valid - * - * @return array with errors or empty array if there are none - */ - function validate_user(&$_userData) - { - $errors = array(); - - if($GLOBALS['egw_info']['server']['account_repository'] == 'ldap' && - (!$_userData['account_lastname'] && !$_userData['lastname'])) - { - $errors[] = lang('You must enter a lastname'); - } - - if(!$_userData['account_lid']) - { - $errors[] = lang('You must enter a loginid'); - } - - if(!in_array($_userData['account_primary_group'],$_userData['account_groups'])) - { - $errors[] = lang('The groups must include the primary group'); - } - // Check if an account already exists as system user, and if it does deny creation - // (increase the totalerrors counter and the message thereof) - if ($GLOBALS['egw_info']['server']['account_repository'] == 'ldap' && - !$GLOBALS['egw_info']['server']['ldap_allow_systemusernames'] && !$_userData['account_id'] && - function_exists('posix_getpwnam') && posix_getpwnam($_userData['account_lid'])) - { - $errors[] = lang('There already is a system-user with this name. User\'s should not have the same name as a systemuser'); - } - if($_userData['old_loginid'] != $_userData['account_lid']) - { - if($GLOBALS['egw']->accounts->exists($_userData['account_lid'])) - { - if($GLOBALS['egw']->accounts->exists($_userData['account_lid']) && $GLOBALS['egw']->accounts->get_type($_userData['account_lid'])=='g') - { - $errors[] = lang('There already is a group with this name. Userid\'s can not have the same name as a groupid'); - } - else - { - $errors[] = lang('That loginid has already been taken'); - } - } - } - - if($_userData['account_passwd'] || $_userData['account_passwd_2']) - { - if($_userData['account_passwd'] != $_userData['account_passwd_2']) - { - $errors[] = lang('The two passwords are not the same'); - } - } - - if(!count($_userData['account_permissions']) && !count($_userData['account_groups'])) - { - $errors[] = lang('You must add at least 1 permission or group to this account'); - } - - if($_userData['account_expires_month'] || $_userData['account_expires_day'] || $_userData['account_expires_year'] || $_userData['account_expires_never']) - { - if($_userData['account_expires_never']) - { - $_userData['expires'] = -1; - $_userData['account_expires'] = $_userData['expires']; - } - else - { - if(! checkdate($_userData['account_expires_month'],$_userData['account_expires_day'],$_userData['account_expires_year'])) - { - $errors[] = lang('You have entered an invalid expiration date'); - } - else - { - $_userData['expires'] = mktime(2,0,0,$_userData['account_expires_month'],$_userData['account_expires_day'],$_userData['account_expires_year']); - $_userData['account_expires'] = $_userData['expires']; - } - } - } - else - { - $_userData['expires'] = -1; - $_userData['account_expires'] = $_userData['expires']; - } - - /* - $check_account_file_space = explode('-', $_userData['file_space']); - if(preg_match("/\D/", $check_account_file_space[0])) - { - $errors[] = lang('File space must be an integer'); - } - */ - - return $errors; - } - - /** - * stores the userdata - * - * @param array &$_userData "account_id" got set for new accounts - * @return array with error-messages - */ - function save_user(array &$_userData) - { - //error_log(__METHOD__."(".array2string($_userData).")"); - $errors = array(); - - // do NOT save password via accounts::save, as pw policy violation can happen and we cant/dont report that way - $passwd = $_userData['account_passwd']; - $new_account = !$_userData['account_id']; - unset($_userData['account_passwd']); - unset($_userData['account_passwd_2']); - - if ($new_account && !$GLOBALS['egw']->accounts->save($_userData)) - { - $errors[] = lang('Failed to save user!'); - return $errors; - } - - if ($passwd) - { - $_userData['account_passwd'] = $passwd; - try { - $auth = new auth(); - if ($auth->change_password('', $passwd, $_userData['account_id'])) - { - if ($_userData['account_lastpwd_change']==0 || // AD requires to activate account AFTER setting pw - $new_account && $_userData['account_status'] == 'A' && $GLOBALS['egw']->accounts->require_password_for_enable()) - { - // change password sets the shadow_timestamp/account_lastpwd_change timestamp - // so we need to reset that to 0 as Admin required the change of password upon next login - $GLOBALS['egw']->accounts->save($_userData); - } - } - else - { - $errors[] = lang('Failed to change password.'); - } - } - catch(Exception $e) { - $errors[] = $e->getMessage(); - } - } - $GLOBALS['egw']->accounts->set_memberships($_userData['account_groups'],$_userData['account_id']); - - if (!$new_account && !$GLOBALS['egw']->accounts->save($_userData)) - { - $errors[] = lang('Failed to save user!'); - return $errors; - } - - if ($_userData['account_lastpwd_change']==0) - { - if (!isset($auth)) $auth =& CreateObject('phpgwapi.auth'); - // we call that with NULL for 2nd Parameter as we are doing an admin action. - $auth->setLastPwdChange($_userData['account_id'],NULL, $_userData['account_lastpwd_change']); - } - - $apps = new applications((int)$_userData['account_id']); - if($_userData['account_permissions']) - { - foreach($_userData['account_permissions'] as $app => $enabled) - { - if($enabled) - { - $apps->add($app); - } - } - } - $apps->save_repository(); - - $acl = new acl($_userData['account_id']); - if($_userData['anonymous']) - { - $acl->add_repository('phpgwapi','anonymous',$_userData['account_id'],1); - } - else - { - $acl->delete_repository('phpgwapi','anonymous',$_userData['account_id']); - } - if(!$_userData['changepassword']) - { - $GLOBALS['egw']->acl->add_repository('preferences','nopasswordchange',$_userData['account_id'],1); - } - else - { - $GLOBALS['egw']->acl->delete_repository('preferences','nopasswordchange',$_userData['account_id']); - } - $GLOBALS['egw']->session->delete_cache((int)$_userData['account_id']); - - //error_log(__METHOD__."(".array2string($_userData).") returning ".array2string($errors)); - return $errors; - } - - function load_group_managers($account_id) - { - $temp_user = $GLOBALS['egw']->acl->get_ids_for_location($account_id,EGW_ACL_GROUP_MANAGERS,'phpgw_group'); - if(!$temp_user) - { - return Array(); - } - else - { - $group_user = $temp_user; - } - $account_user = Array(); - while(list($key,$user) = each($group_user)) - { - $account_user[$user] = ' selected'; - } - @reset($account_user); - return $account_user; - } - - function load_group_apps($account_id) - { - $apps =& CreateObject('phpgwapi.applications',(int)$account_id); - $app_list = $apps->read_account_specific(); - $account_apps = Array(); - while(list($key,$app) = each($app_list)) - { - $account_apps[$app['name']] = True; - } - @reset($account_apps); - return $account_apps; - } - } diff --git a/admin/inc/class.uiaccounts.inc.php b/admin/inc/class.uiaccounts.inc.php deleted file mode 100755 index da7449bd5b..0000000000 --- a/admin/inc/class.uiaccounts.inc.php +++ /dev/null @@ -1,1706 +0,0 @@ - True, - 'list_users' => True, - 'add_group' => True, - 'add_user' => True, - 'delete_group' => True, - 'delete_user' => True, - 'edit_user' => True, - 'edit_user_hook' => True, - 'edit_group' => True, - 'view_user' => True, - 'edit_group_hook' => True, - 'edit_view_user_hook' => True, - 'group_manager' => True, - 'set_group_managers' => True - ); - - /** - * Instance of boaccounts - * @var boaccounts - */ - var $bo; - var $nextmatchs; - var $apps_with_acl = array( - 'todo' => True, - 'calendar' => True, - 'projects' => True, - 'infolog' => True, - 'filemanager' => array( - 'menuaction' => 'filemanager.filemanager_ui.file', - 'path' => '/home/$account_lid', - 'tabs' => 'eacl', - 'popup' => '495x400', - ), - 'tts' => True, - 'bookmarks' => True, - 'img' => True, - 'phpbrain' => True, - 'projectmanager' => True, - 'timesheet' => True - ); - - function __construct() - { - $this->bo =& CreateObject('admin.boaccounts'); - $this->nextmatchs =& CreateObject('phpgwapi.nextmatchs'); - @set_time_limit(300); - /* Moved from bo class */ - if (get_magic_quotes_gpc()) // deal with magic_quotes_gpc On - { - $_POST = $this->array_stripslashes($_POST); - } - foreach($GLOBALS['egw']->hooks->process('group_acl','',true) as $app => $data) - { - if ($data) $this->apps_with_acl[$app] = $data; - } - } - - function row_action($action,$type,$account_id) - { - return ' '.lang($action).' '; - } - - function list_groups() - { - $query_types = array( - 'all' => 'all fields', - 'lid' => 'LoginID', - 'start' => 'start with', - 'exact' => 'exact' - ); - - if ($GLOBALS['egw']->acl->check('group_access',1,'admin')) - { - $GLOBALS['egw']->redirect($GLOBALS['egw']->link('/admin/index.php')); - } - - $GLOBALS['cd'] = ($_GET['cd']?$_GET['cd']:0); - - if(isset($_REQUEST['query'])) - { - // limit query to limit characters - //if(preg_match('/^[a-z_0-9]+$/i',$_REQUEST['query'])) - $GLOBALS['query'] = $_REQUEST['query']; - } - - if(isset($_POST['start'])) - { - $start = (int)$_POST['start']; - } - else - { - $start = 0; - } - switch($_REQUEST['order']) - { - case 'account_lid': - $order = $_REQUEST['order']; - break; - default: - $order = 'account_lid'; - break; - } - - switch($_REQUEST['sort']) - { - case 'ASC': - case 'DESC': - $sort = $_REQUEST['sort']; - break; - default: - $sort = 'ASC'; - break; - } - - unset($GLOBALS['egw_info']['flags']['noheader']); - unset($GLOBALS['egw_info']['flags']['nonavbar']); - $GLOBALS['egw_info']['flags']['app_header'] = $GLOBALS['egw_info']['apps']['admin']['title'].' - '. - lang('User groups'); - common::egw_header(); - - $p =& CreateObject('phpgwapi.Template',EGW_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'); - $p->set_block('list','letter_search','letter_search_cells'); - - $search_param = array( - 'type' => 'groups', - 'start' => $start, - 'sort' => $sort, - 'order' => $order, - 'query_type' => $_REQUEST['query_type'] - ); - //_debug_array($search_param); - if (!$GLOBALS['egw']->acl->check('account_access',2,'admin')) - { - $search_param['query'] = $GLOBALS['query']; - } - $account_info = $GLOBALS['egw']->accounts->search($search_param); - $total = $GLOBALS['egw']->accounts->total; - - $link_data = array( - 'menuaction' => 'admin.uiaccounts.list_groups', - //'group_id' => $_REQUEST['group_id'], - 'query_type' => $_REQUEST['query_type'], - 'query' => $GLOBALS['query'], - ); - - $var = Array( - 'left_next_matchs' => $this->nextmatchs->left('/index.php',$start,$total,$link_data), - 'right_next_matchs' => $this->nextmatchs->right('/index.php',$start,$total,$link_data), - 'lang_groups' => lang('%1 - %2 of %3 user groups',$start+1,$start+count($account_info),$total), - 'sort_name' => $this->nextmatchs->show_sort_order($sort,'account_lid',$order,'/index.php',lang('name'),$link_data), - 'header_edit' => lang('Edit'), - 'header_delete' => lang('Delete'), - 'lang_search' => lang('search') // KL 20061128 Text fr den Suchbutton hinzugefeugt - ); - $p->set_var($var); - - if (!count($account_info) || !$total) - { - $p->set_var('message',lang('No matches found')); - $p->parse('rows','row_empty',True); - } - else - { - if (! $GLOBALS['egw']->acl->check('group_access',8,'admin')) - { - $can_view = True; - } - - if (! $GLOBALS['egw']->acl->check('group_access',16,'admin')) - { - $can_edit = True; - } - - if (! $GLOBALS['egw']->acl->check('group_access',32,'admin')) - { - $can_delete = True; - } - - foreach($account_info as $account) - { - $var = Array( - 'class' => $this->nextmatchs->alternate_row_color('', True), - 'group_name' => html::htmlspecialchars($account['account_lid']), - 'delete_link' => $this->row_action('delete','group',$account['account_id']) - ); - $p->set_var($var); - - if ($can_edit) - { - $p->set_var('edit_link',$this->row_action('edit','group',$account['account_id'])); - } - else - { - $p->set_var('edit_link',' '); - } - - if ($can_delete) - { - $p->set_var('delete_link',$this->row_action('delete','group',$account['account_id'])); - } - else - { - $p->set_var('delete_link',' '); - } - - $p->fp('rows','row',True); - } - } - - $link_data += array( - 'order' => $order, - 'sort' => $sort - ); - $p->set_var(array( - 'query' => html::htmlspecialchars($GLOBALS['query']), - 'query_type' => is_array($query_types) ? html::select('query_type',$_REQUEST['query_type'],$query_types) : '', - //'lang_group' => lang('group'), - //'group' => $uiaccountsel->selection('group_id','admin_uiaccount_listusers_group_id',$_REQUEST['group_id'],'groups',0,False,'','this.form.submit();',lang('all')), - 'accounts_url' => $GLOBALS['egw']->link('/index.php',$link_data), - )); - $letters = lang('alphabet'); - $letters = explode(',',substr($letters,-1) != '*' ? $letters : 'a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z'); - $link_data['query_type'] = 'start'; - foreach($letters as $letter) - { - $link_data['query'] = $letter; - $p->set_var(array( - 'letter' => $letter, - 'link' => $GLOBALS['egw']->link('/index.php',$link_data), - 'class' => $GLOBALS['query'] == $letter && $_REQUEST['query_type'] == 'start' ? 'lettersearch_active' : 'lettersearch', - )); - $p->fp('letter_search_cells','letter_search',True); - } - unset($link_data['query']); - unset($link_data['query_type']); - $p->set_var(array( - 'letter' => lang('all'), - 'link' => $GLOBALS['egw']->link('/index.php',$link_data), - 'class' => $_REQUEST['query_type'] != 'start' || !in_array($GLOBALS['query'],$letters) ? 'lettersearch_active' : 'lettersearch', - )); - $p->fp('letter_search_cells','letter_search',True); - - $var = Array( - 'new_action' => $GLOBALS['egw']->link('/index.php','menuaction=admin.uiaccounts.add_group'), - 'search_action' => $GLOBALS['egw']->link('/index.php','menuaction=admin.uiaccounts.list_groups') - ); - $p->set_var($var); - - if (! $GLOBALS['egw']->acl->check('group_access',4,'admin')) - { - $p->set_var('input_add',''); - } - - if (! $GLOBALS['egw']->acl->check('group_access',2,'admin')) - { - $p->set_var('input_search',lang('Search') . ' '); - } - - $p->pfp('out','list'); - } - - function list_users($param_cd='') - { - if ($GLOBALS['egw']->acl->check('account_access',1,'admin')) - { - $GLOBALS['egw']->redirect_link('/admin/index.php'); - } - if($param_cd) - { - $cd = $param_cd; - } - if(isset($_REQUEST['query'])) - { - $GLOBALS['query'] = $_REQUEST['query']; - } - if(isset($_REQUEST['start'])) - { - $start = (int)$_REQUEST['start']; - } - else - { - $start = 0; - } - - switch($_REQUEST['order']) - { - case 'account_lastname': - case 'account_firstname': - case 'account_lid': - case 'account_email': - $order = $_REQUEST['order']; - break; - default: - $order = 'account_lid'; - break; - } - - switch($_REQUEST['sort']) - { - case 'ASC': - case 'DESC': - $sort = $_REQUEST['sort']; - break; - default: - $sort = 'ASC'; - break; - } - - unset($GLOBALS['egw_info']['flags']['noheader']); - unset($GLOBALS['egw_info']['flags']['nonavbar']); - $GLOBALS['egw_info']['flags']['app_header'] = $GLOBALS['egw_info']['apps']['admin']['title'].' - '. - lang('User accounts'); - common::egw_header(); - - $p =& CreateObject('phpgwapi.Template',EGW_APP_TPL); - - $p->set_file( - Array( - 'list' => 'accounts.tpl' - ) - ); - $p->set_block('list','row','rows'); - $p->set_block('list','row_empty','no_rows'); - $p->set_block('list','letter_search','letter_search_cells'); - - $search_param = array( - 'type' => (int)$_REQUEST['group_id'] ? $_REQUEST['group_id'] : 'accounts', - 'start' => $start, - 'sort' => $sort, - 'order' => $order, - 'query_type' => $_REQUEST['query_type'], - 'active' => false, // false = return inactive and expired accounts too - ); - if (!$GLOBALS['egw']->acl->check('account_access',2,'admin')) - { - $search_param['query'] = $GLOBALS['query']; - } - $account_info = $GLOBALS['egw']->accounts->search($search_param); - $total = $GLOBALS['egw']->accounts->total; - - $link_data = array( - 'menuaction' => 'admin.uiaccounts.list_users', - 'group_id' => $_REQUEST['group_id'], - 'query_type' => $_REQUEST['query_type'], - 'query' => $GLOBALS['query'], - ); - $uiaccountsel =& CreateObject('phpgwapi.uiaccountsel'); - $p->set_var(array( - 'left_next_matchs' => $this->nextmatchs->left('/index.php',$start,$total,$link_data), - 'lang_showing' => ($_REQUEST['group_id'] ? common::grab_owner_name($_REQUEST['group_id']).': ' : ''). - ($GLOBALS['query'] ? lang("Search %1 '%2'",lang($uiaccountsel->query_types[$_REQUEST['query_type']]), - html::htmlspecialchars($GLOBALS['query'])).': ' : '') - .$this->nextmatchs->show_hits($total,$start), - 'right_next_matchs' => $this->nextmatchs->right('/index.php',$start,$total,$link_data), - 'lang_loginid' => $this->nextmatchs->show_sort_order($sort,'account_lid',$order,'/index.php',lang('LoginID'),$link_data), - 'lang_lastname' => $this->nextmatchs->show_sort_order($sort,'account_lastname',$order,'/index.php',lang('last name'),$link_data), - 'lang_firstname' => $this->nextmatchs->show_sort_order($sort,'account_firstname',$order,'/index.php',lang('first name'),$link_data), - 'lang_email' => $this->nextmatchs->show_sort_order($sort,'account_email',$order,'/index.php',lang('email'),$link_data), - 'lang_account_active' => lang('Account active')."
".lang('Created')."
".lang('Modified'), - 'lang_edit' => lang('edit'), - 'lang_delete' => lang('delete'), - 'lang_view' => lang('view'), - 'lang_search' => lang('search') - )); - $link_data += array( - 'order' => $order, - 'sort' => $sort, - ); - $p->set_var(array( - 'query' => html::htmlspecialchars($GLOBALS['query']), - 'query_type' => is_array($uiaccountsel->query_types) ? html::select('query_type',$_REQUEST['query_type'],$uiaccountsel->query_types) : '', - 'lang_group' => lang('group'), - 'group' => $uiaccountsel->selection('group_id','admin_uiaccount_listusers_group_id',$_REQUEST['group_id'],'groups',0,False,'','this.form.submit();',lang('all')), - 'accounts_url' => $GLOBALS['egw']->link('/index.php',$link_data), - )); - $letters = lang('alphabet'); - $letters = explode(',',substr($letters,-1) != '*' ? $letters : 'a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z'); - $link_data['query_type'] = 'start'; - foreach($letters as $letter) - { - $link_data['query'] = $letter; - $p->set_var(array( - 'letter' => $letter, - 'link' => $GLOBALS['egw']->link('/index.php',$link_data), - 'class' => $GLOBALS['query'] == $letter && $_REQUEST['query_type'] == 'start' ? 'lettersearch_active' : 'lettersearch', - )); - $p->fp('letter_search_cells','letter_search',True); - } - unset($link_data['query']); - unset($link_data['query_type']); - $p->set_var(array( - 'letter' => lang('all'), - 'link' => $GLOBALS['egw']->link('/index.php',$link_data), - 'class' => $_REQUEST['query_type'] != 'start' || !in_array($GLOBALS['query'],$letters) ? 'lettersearch_active' : 'lettersearch', - )); - $p->fp('letter_search_cells','letter_search',True); - - if (! $GLOBALS['egw']->acl->check('account_access',4,'admin')) - { - $p->set_var('new_action',$GLOBALS['egw']->link('/index.php','menuaction=admin.uiaccounts.add_user')); - $p->set_var('input_add',''); - } - - if (!count($account_info) || !$total) - { - $p->set_var('message',lang('No matches found')); - $p->parse('rows','row_empty',True); - } - else - { - if (! $GLOBALS['egw']->acl->check('account_access',8,'admin')) - { - $can_view = True; - } - - if (! $GLOBALS['egw']->acl->check('account_access',16,'admin')) - { - $can_edit = True; - } - - if (! $GLOBALS['egw']->acl->check('account_access',32,'admin')) - { - $can_delete = True; - } - - foreach($account_info as $account) - { - $p->set_var('class',$this->nextmatchs->alternate_row_color('',True)); - if ($account['account_status']=='A') - { - $account['account_status'] = lang('Enabled'); - } - else - { - $account['account_status'] = '' . lang('Disabled') . ''; - } - if (isset($account['account_created'])) - $account['account_status'].= '
'.common::show_date($account['account_created'],$GLOBALS['egw_info']['user']['preferences']['common']['dateformat']); - if (isset($account['account_modified'])) - $account['account_status'].= '
'.common::show_date($account['account_modified'],$GLOBALS['egw_info']['user']['preferences']['common']['dateformat']); - - - $p->set_var(array( - 'account_id' => $account['account_id'], - 'account_lid' => html::htmlspecialchars($account['account_lid']), - 'account_firstname' => html::htmlspecialchars($account['account_firstname']), - 'account_lastname' => html::htmlspecialchars($account['account_lastname']), - 'account_email' => html::htmlspecialchars($account['account_email']), - )); - - if ($can_edit) - { - $p->set_var('row_edit',$this->row_action('edit','user',$account['account_id'])); - } - else - { - $p->set_var('row_edit',' '); - } - - if ($can_delete) - { - $p->set_var('row_delete',($GLOBALS['egw_info']['user']['userid'] != $account['account_lid']?$this->row_action('delete','user',$account['account_id']):' ')); - } - else - { - $p->set_var('row_delete',' '); - } - - if ($can_view) - { - $p->set_var('row_view',$this->row_action('view','user',$account['account_id'])); - } - else - { - $p->set_var('row_view',' '); - } - $p->parse('rows','row',True); - } - } // End else - $p->pfp('out','list'); - } - - function add_group() - { - if ($GLOBALS['egw']->acl->check('group_access',4,'admin')) - { - $this->list_groups(); - return False; - } - - if($_POST['edit']) - { - $group_permissions = ($_POST['account_apps']?$_POST['account_apps']:Array()); - $account_apps = Array(); - foreach($group_permissions as $key => $value) - { - if($value) - { - $account_apps[$key] = True; - } - } - @reset($account_apps); - - $group_info = Array( - 'account_id' => ($_POST['account_id']?(int)$_POST['account_id']:0), - 'account_name' => ($_POST['account_name']?$_POST['account_name']:''), - 'account_user' => $_POST['account_user'], - 'account_apps' => $account_apps, - 'account_email' => $_POST['account_email'] - ); - $errors = $this->bo->add_group($group_info); - if(is_array($errors)) - { - $this->create_edit_group($group_info,$errors); - common::egw_exit(); - } - $GLOBALS['egw']->redirect($GLOBALS['egw']->link('/index.php','menuaction=admin.uiaccounts.list_groups')); - } - else - { - $group_info = Array( - 'account_id' => $_GET['account_id'], - 'account_name' => '', - 'account_user' => Array(), - 'account_apps' => Array() - ); - $this->create_edit_group($group_info); - } - } - - function add_user() - { - return $this->edit_user('', '', 4); - } - - function delete_group() - { - if ($_POST['no'] || $_POST['yes'] || !@isset($_GET['account_id']) || !@$_GET['account_id'] || $GLOBALS['egw']->acl->check('group_access',32,'admin')) - { - if ($_POST['yes']) - { - $this->bo->delete_group($_POST['account_id']); - } - $GLOBALS['egw']->redirect($GLOBALS['egw']->link('/index.php','menuaction=admin.uiaccounts.list_groups')); - } - - unset($GLOBALS['egw_info']['flags']['noheader']); - unset($GLOBALS['egw_info']['flags']['nonavbar']); - - common::egw_header(); - - $p =& CreateObject('phpgwapi.Template',EGW_APP_TPL); - $p->set_file( - Array( - 'body' => 'delete_common.tpl', - 'message_row' => 'message_row.tpl', - 'form_button' => 'form_button_script.tpl' - ) - ); - - $p->set_var('message_display',lang('Are you sure you want to delete this group ?')); - $p->parse('messages','message_row'); - - if(($old_group_list = $GLOBALS['egw']->accounts->memberships((int)$_GET['account_id'],true))) - { - $group_name = $GLOBALS['egw']->accounts->id2name($_GET['account_id']); - - $p->set_var('message_display','
'); - $p->parse('messages','message_row',True); - - $user_list = ''; - while (list(,$id) = each($old_group_list)) - { - $user_list .= '' . common::grab_owner_name($id) . '
'; - } - $p->set_var('message_display',$user_list); - $p->parse('messages','message_row',True); - - $p->set_var('message_display',lang("Sorry, the above users are still a member of the group %1",$group_name) - . '.
' . lang('They must be removed before you can continue'). '.
' . lang('Remove all users from this group').'?'); - $p->parse('messages','message_row',True); - } - - $var = Array( - 'form_action' => $GLOBALS['egw']->link('/index.php','menuaction=admin.uiaccounts.delete_group'), - 'hidden_vars' => '', - 'yes' => lang('Yes'), - 'no' => lang('No') - ); - $p->set_var($var); -/* - $p->parse('yes','form_button'); - - $var = Array( - 'submit_button' => lang('Submit'), - 'action_url_button' => $GLOBALS['egw']->link('/index.php','menuaction=admin.uiaccounts.list_groups'), - 'action_text_button' => ' '.lang('No'), - 'action_confirm_button' => '', - 'action_extra_field' => '' - ); - $p->set_var($var); - $p->parse('no','form_button'); -*/ - $p->pparse('phpgw_body','body'); - } - - function delete_user() - { - if ($GLOBALS['egw']->acl->check('account_access',32,'admin') || $GLOBALS['egw_info']['user']['account_id'] == $_GET['account_id'] || - $_POST['cancel']) - { - $GLOBALS['egw']->redirect($GLOBALS['egw']->link('/index.php','menuaction=admin.uiaccounts.list_users')); - } - if($_POST['delete_account']) - { - $this->bo->delete_user($_POST['account_id'],$_POST['new_owner']); - $GLOBALS['egw']->redirect($GLOBALS['egw']->link('/index.php','menuaction=admin.uiaccounts.list_users')); - } - - unset($GLOBALS['egw_info']['flags']['noheader']); - unset($GLOBALS['egw_info']['flags']['nonavbar']); - common::egw_header(); - - $t =& CreateObject('phpgwapi.Template',EGW_APP_TPL); - $t->set_file( - Array( - 'form' => 'delete_account.tpl' - ) - ); - $var = Array( - 'form_action' => $GLOBALS['egw']->link('/index.php','menuaction=admin.uiaccounts.delete_user'), - 'account_id' => $_GET['account_id'] - ); - - // the account can have special chars/white spaces, if it is a ldap dn - $account_id = rawurlencode($_GET['account_id']); - - $var['lang_new_owner'] = lang('Who would you like to transfer ALL records owned by the deleted user to?'); - $accountsel = new uiaccountsel(); - $var['new_owner_select'] = $accountsel->selection('new_owner','new_owner',array(''),'accounts',0,$account_id,'size="15"','',lang('Delete all records')); - $var['cancel'] = lang('cancel'); - $var['delete'] = lang('delete'); - $t->set_var($var); - $t->pparse('out','form'); - } - - // (regis) why only for users, it works with groups as well so I add it - // I use it on the workflow app to add monitoring rights for some users - // and we could have history of connexions for members groups. - function edit_group_hook() // (regis) why only for users, it works with groups as well so I add it - { - if ($_GET['account_id'] && // can't set it on add - !$GLOBALS['egw']->acl->check('account_access',64,'admin')) // no rights to set ACL-rights - { - $GLOBALS['menuData'][] = array( - 'description' => 'ACL Rights', - 'url' => '/index.php', - 'extradata' => 'menuaction=admin.uiaclmanager.list_apps' - ); - } - } - - function edit_group($cd='',$account_id='') - { - if ($GLOBALS['egw']->acl->check('group_access',16,'admin')) - { - $GLOBALS['egw']->redirect($GLOBALS['egw']->link('/index.php','menuaction=admin.uiaccounts.list_groups')); - } - - if($_POST['edit']) - { - $group_permissions = ($_POST['account_apps']?$_POST['account_apps']:Array()); - $account_apps = Array(); - foreach($group_permissions as $key => $value) - { - if($value) - { - $account_apps[$key] = True; - } - } - @reset($account_apps); - - $group_info = Array( - 'account_id' => ($_POST['account_id']?(int)$_POST['account_id']:0), - 'account_name' => ($_POST['account_name']?$_POST['account_name']:''), - 'account_user' => $_POST['account_user'], - 'account_apps' => $account_apps, - 'account_email' => $_POST['account_email'] - ); - $errors = $this->bo->edit_group($group_info); - if(is_array($errors)) - { - $this->create_edit_group($group_info,$errors); - common::egw_exit(); - } - $GLOBALS['egw']->redirect($GLOBALS['egw']->link('/index.php','menuaction=admin.uiaccounts.list_groups')); - } - else - { - $cdid = $cd; - settype($cd,'integer'); - $cd = ($_GET['cd']?$_GET['cd']:(int)$cdid); - - $accountid = $account_id; - settype($account_id,'integer'); - $account_id = ($_GET['account_id'] ? $_GET['account_id'] : (int)$accountid); - - // todo - // not needed if i use the same file for new groups too - if (! $account_id) - { - $this->list_groups(); - } - else - { - $group_info = Array( - 'account_id' => (int)$_GET['account_id'], - 'account_name' => $GLOBALS['egw']->accounts->id2name($_GET['account_id']), - 'account_user' => $GLOBALS['egw']->accounts->members($_GET['account_id'], false, false), - 'account_apps' => $this->bo->load_group_apps($_GET['account_id']) - ); - - $this->create_edit_group($group_info); - } - } - } - - function edit_view_user_hook() - { - if (!$GLOBALS['egw']->acl->check('current_sessions_access',1,'admin')) // no rights to view - { - $GLOBALS['menuData'][] = array( - 'description' => 'Login History', - 'url' => '/index.php', - 'extradata' => 'menuaction=admin.admin_accesslog.index' - ); - } - // not sure if this realy belongs here, or only in edit_user - if ($_GET['account_id'] && // can't set it on add - !$GLOBALS['egw']->acl->check('account_access',64,'admin')) // no rights to set ACL-rights - { - $GLOBALS['menuData'][] = array( - 'description' => 'ACL Rights', - 'url' => '/index.php', - 'extradata' => 'menuaction=admin.uiaclmanager.list_apps' - ); - } - - // NDEE210804 - // added for different way of handling ldap entries inside account manager - // we show this only, if accounts are stored in ldap -/* just doublicated EMailAdmin functionality - if ($GLOBALS['egw_info']['server']['account_repository'] == "ldap") - { - $GLOBALS['menuData'][] = array( - 'description' => 'LDAP-MGR', - 'url' => '/index.php', - 'extradata' => 'menuaction=admin.uildap_mgr.editUserData' - ); - } -*/ - //NDEE - } - - function edit_user($cd='',$account_id='', $required_account_access=16) - { - if($GLOBALS['egw']->acl->check('account_access',$required_account_access,'admin') || isset($_POST['cancel'])) - { - $this->list_users(); - return False; - } - - if($_POST['submit']) - { - // use old_loginid, if account_lid is not set in post, because input is disabled - if (!isset($_POST['account_lid'])) $_POST['account_lid'] = $_GET['old_loginid']; - - if(!($email = $_POST['account_email'])) - { - $email = common::email_address($_POST['account_firstname'],$_POST['account_lastname'],$_POST['account_lid']); - } - $userData = array( - 'account_type' => 'u', - 'account_lid' => $_POST['account_lid'], - 'account_firstname' => $_POST['account_firstname'], - 'account_lastname' => $_POST['account_lastname'], - 'account_passwd' => $_POST['account_passwd'], - 'account_status' => $_POST['account_status'] ? 'A' : '', - 'old_loginid' => $_GET['old_loginid'] ? $_GET['old_loginid'] : '', - 'account_id' => $_GET['account_id'] ? $_GET['account_id'] : 0, - 'account_passwd_2' => $_POST['account_passwd_2'], - 'account_groups' => $_POST['account_groups'], - 'account_primary_group' => $_POST['account_primary_group'], - 'anonymous' => $_POST['anonymous'], - 'changepassword' => $_POST['changepassword'], - 'mustchangepassword' => $_POST['mustchangepassword'], - 'account_permissions' => $_POST['account_permissions'], - 'homedirectory' => $_POST['homedirectory'], - 'loginshell' => $_POST['loginshell'], - 'account_expires_never' => $_POST['never_expires'], - 'account_email' => $email, - /* 'file_space' => $_POST['account_file_space_number'] . "-" . $_POST['account_file_space_type'] */ - ); - if ($userData['mustchangepassword']) - { - $userData['account_lastpwd_change']=0; - } - else - { - $accountid = $account_id; - settype($account_id,'integer'); - $account_id = (int)($_GET['account_id'] ? $_GET['account_id'] : $accountid); - - //echo '
#'.$account_id.'#
'; - $prevVal = $GLOBALS['egw']->accounts->id2name($account_id,'account_lastpwd_change'); - //echo '
#'.$prevVal.'#
'; // previous Value was forced password change by admin - if (isset($prevVal) && $prevVal==0) $userData['account_lastpwd_change']=egw_time::to('now','ts'); - } - if($userData['account_primary_group'] && (!isset($userData['account_groups']) || !in_array($userData['account_primary_group'],$userData['account_groups']))) - { - $userData['account_groups'][] = (int)$userData['account_primary_group']; - } - if($_POST['expires'] !== '' && !$_POST['never_expires']) - { - $jscal = new jscalendar(False); - $userData += $jscal->input2date($_POST['expires'],False,'account_expires_day','account_expires_month','account_expires_year'); - } - $errors = $this->bo->edit_user($userData, $required_account_access); - - if(!@is_array($errors)) - { - // check if would create a menu - // if we do, we can't return to the users list, because - // there are also some other plugins - if(!ExecMethod('admin.uimenuclass.createHTMLCode','edit_user')) - { - $GLOBALS['egw']->redirect_link('/index.php',array( // without redirect changes happen only in the next page-view! - 'menuaction' => 'admin.uiaccounts.list_users' - )); - } - else - { - if($userData['account_id'] == $GLOBALS['egw_info']['user']['account_id']) - { - $GLOBALS['egw']->redirect_link('/index.php',array( // without redirect changes happen only in the next page-view! - 'menuaction' => 'admin.uiaccounts.edit_user', - 'account_id' => $_GET['account_id'] - )); - } - $this->create_edit_user($userData['account_id']); - } - } - else - { - $this->create_edit_user($userData['account_id'],$userData,$errors); - } - } - else - { - $cdid = $cd; - settype($cd,'integer'); - $cd = ($_GET['cd']?$_GET['cd']:(int)$cdid); - - $accountid = $account_id; - settype($account_id,'integer'); - $account_id = (int)($_GET['account_id'] ? $_GET['account_id'] : $accountid); - - $this->create_edit_user($account_id); - } - } - - function view_user() - { - if ($GLOBALS['egw']->acl->check('account_access',8,'admin') || ! $_GET['account_id']) - { - $this->list_users(); - return False; - } - unset($GLOBALS['egw_info']['flags']['noheader']); - unset($GLOBALS['egw_info']['flags']['nonavbar']); - common::egw_header(); - - $t =& CreateObject('phpgwapi.Template',EGW_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'); - - $var = Array( - 'tr_color1' => $GLOBALS['egw_info']['theme']['row_on'], - 'tr_color2' => $GLOBALS['egw_info']['theme']['row_off'], - 'lang_action' => lang('View user account'), - 'lang_loginid' => lang('LoginID'), - 'lang_account_active' => lang('Account active'), - 'lang_lastname' => lang('Last Name'), - 'lang_groups' => lang('Groups'), - 'lang_anonymous' => lang('Anonymous user (not shown in list sessions)'), - 'lang_changepassword'=> lang('Can change password'), - 'lang_mustchangepassword'=> lang('Must change password upon next login'), - 'lang_firstname' => lang('First Name'), - 'lang_lastlogin' => lang('Last login'), - 'lang_lastloginfrom' => lang('Last login from'), - 'lang_expires' => lang('Expires'), - 'lang_app' => lang('application'), - 'lang_acl' => lang('enabled'), - ); - - $t->parse('password_fields','form_logininfo',True); - - // invalidate account, before reading it, to code with changed to DB or LDAP outside EGw - accounts::cache_invalidate((int)$_GET['account_id']); - $userData = $GLOBALS['egw']->accounts->read((int)$_GET['account_id'],'u'); - - $var['account_lid'] = html::htmlspecialchars($userData['account_lid']); - $var['account_firstname'] = html::htmlspecialchars($userData['firstname']); - $var['account_lastname'] = html::htmlspecialchars($userData['lastname']); - - $acl =& CreateObject('phpgwapi.acl',(int)$_GET['account_id']); - $var['anonymous'] = $acl->check('anonymous',1,'phpgwapi') ? '  X' : ' '; - $var['changepassword'] = !$acl->check('nopasswordchange',1,'preferences') ? '  X' : ' '; - if (!isset($auth)) $auth =& CreateObject('phpgwapi.auth'); - $accLPWDC = $auth->getLastPwdChange($userData['account_lid']); - if ($accLPWDC !== false) $userData['account_lastpwd_change'] = $accLPWDC; - $var['mustchangepassword']= (isset($userData['account_lastpwd_change']) && ((is_string($userData['account_lastpwd_change']) && $userData['account_lastpwd_change']==="0")||(is_int($userData['account_lastpwd_change']) && $userData['account_lastpwd_change']===0)) ? '  X' : ' '); - unset($acl); - - if ($userData['account_status']) - { - $var['account_status'] = lang('Enabled'); - } - else - { - $var['account_status'] = '' . lang('Disabled') . ''; - } - if (isset($userData['account_created'])) $var['account_status'].= '
'.lang('Created').': '.common::show_date($userData['account_created']); - if (isset($userData['account_modified'])) $var['account_status'].= '
'.lang('Modified').': '.common::show_date($userData['account_modified']); - - - // Last login time - if ($userData['lastlogin']) - { - $var['account_lastlogin'] = common::show_date($userData['lastlogin']); - } - else - { - $var['account_lastlogin'] = lang('Never'); - } - - // Last login IP - if ($userData['lastloginfrom']) - { - $var['account_lastloginfrom'] = $userData['lastloginfrom']; - } - else - { - $var['account_lastloginfrom'] = lang('Never'); - } - - // Account expires - if ($userData['expires'] != -1) - { - $var['input_expires'] = common::show_date($userData['expires']); - } - else - { - $var['input_expires'] = lang('Never'); - } - - // Find out which groups they are members of - $usergroups = $GLOBALS['egw']->accounts->membership((int)$_GET['account_id']); - if(!@is_array($usergroups)) - { - $var['groups_select'] = lang('None'); - } - else - { - while (list(,$group) = each($usergroups)) - { - $group_names[] = html::htmlspecialchars($group['account_name']); - } - $var['groups_select'] = implode(', ',$group_names); - } - - $account_lastlogin = $userData['account_lastlogin']; - $account_lastloginfrom = $userData['account_lastloginfrom']; - $account_status = $userData['account_status']; - - // create list of available app - $i = 0; - - $availableApps = $GLOBALS['egw_info']['apps']; - foreach($availableApps as $app => $data) - { - if (!$data['enabled'] || !$data['status'] || $data['status'] == 3) - { - unset($availableApps[$app]); // do NOT show disabled apps, or our API (status = 3) - } - } - uasort($availableApps,create_function('$a,$b','return strcasecmp($a["title"],$b["title"]);')); - - foreach($availableApps as $app => $data) - { - $perm_display[] = array( - 'appName' => $app, - 'title' => $data['title'], - ); - } - - // create apps output - $apps =& CreateObject('phpgwapi.applications',(int)$_GET['account_id']); - $db_perms = $apps->read_account_specific(); - - @reset($db_perms); - - for ($i=0;$i%s%s",$perm_display[$i]['title'],($_userData['account_permissions'][$perm_display[$i]['appName']] || $db_perms[$perm_display[$i]['appName']]?'  X':' ')); - } - - $i++; - - if ($perm_display[$i]['title']) - { - $part2 = sprintf("%s%s",$perm_display[$i]['title'],($_userData['account_permissions'][$perm_display[$i]['appName']] || $db_perms[$perm_display[$i]['appName']]?'  X':' ')); - } - else - { - $part2 = ' '; - } - - $appRightsOutput .= sprintf("$part1$part2\n",$this->nextmatchs->alternate_row_color('',true)); - } - - $var['permissions_list'] = $appRightsOutput; - - // create the menu on the left, if needed -// $menuClass =& CreateObject('admin.uimenuclass'); - // This is now using ExecMethod() - $var['rows'] = ExecMethod('admin.uimenuclass.createHTMLCode','view_user'); - $t->set_var($var); - $t->pfp('out','form'); - } - - function group_manager($cd='',$account_id='') - { - if ($GLOBALS['egw']->acl->check('group_access',16,'admin')) - { - $this->list_groups(); - return False; - } - - $cdid = $cd; - settype($cd,'integer'); - $cd = ($_GET['cd']?$_GET['cd']:(int)$cdid); - - $accountid = $account_id; - settype($account_id,'integer'); - $account_id = (int)($_GET['account_id'] ? $_GET['account_id'] : $accountid); - - // todo - // not needed if i use the same file for new groups too - if (! $account_id) - { - $this->list_groups(); - } - else - { - $group_info = Array( - 'account_id' => (int)$_GET['account_id'], - 'account_name' => $GLOBALS['egw']->accounts->id2name($_GET['account_id']), - 'account_user' => $GLOBALS['egw']->accounts->member($_GET['account_id']), - 'account_managers' => $this->bo->load_group_managers($_GET['account_id']) - ); - - $this->edit_group_managers($group_info); - } - } - - function create_edit_group($group_info,$_errors='') - { - unset($GLOBALS['egw_info']['flags']['noheader']); - unset($GLOBALS['egw_info']['flags']['nonavbar']); - common::egw_header(); - - $p =& CreateObject('phpgwapi.Template',EGW_APP_TPL); - $p->set_file(Array('edit' => 'group_form.tpl')); - $p->set_block('edit','select'); - $p->set_block('edit','popwin'); - - // invalidate account, before reading it, to code with changed to DB or LDAP outside EGw - accounts::cache_invalidate((int)$_GET['account_id']); - $group_repository = $GLOBALS['egw']->accounts->read((int)$_GET['account_id'],'u'); - - $p->set_var('accounts',$GLOBALS['egw']->uiaccountsel->selection('account_user[]','admin_uiaccounts_user',$group_info['account_user'],'accounts',min(3+count($group_info['account_user']),10),false,'style="width: 300px;"')); - - $var = Array( - 'form_action' => $GLOBALS['egw']->link('/index.php','menuaction=admin.uiaccounts.'.($group_info['account_id']?'edit':'add').'_group'), - 'hidden_vars' => '', - 'lang_group_name' => lang('group name'), - 'group_name_value' => html::htmlspecialchars($group_info['account_name']), - 'lang_include_user' => lang('Select users for inclusion'), - 'error' => (!$_errors?'':'
'.common::error_list($_errors).'
'), - 'lang_permissions' => lang('Permissions this group has') - ); - $p->set_var($var); - - if (!$group_repository['file_space']) - { - $group_repository['file_space'] = $GLOBALS['egw_info']['server']['vfs_default_account_size_number'] . "-" . $GLOBALS['egw_info']['server']['vfs_default_account_size_type']; - } - /* - $file_space_array = explode ('-', $group_repository['file_space']); - $account_file_space_types = array ('gb', 'mb', 'kb', 'b'); - while (list ($num, $type) = each ($account_file_space_types)) - { - $account_file_space_select .= ''."\n"; - } - $p->set_var ('lang_file_space', lang('File space')); - $p->set_var ('account_file_space', ''); - $p->set_var ('account_file_space_select',''."\n"); - */ - // if EGroupware manages a mail server, allow setting an email address for groups - if ($group_repository['mailAllowed'] && $GLOBALS['egw_info']['apps']['emailadmin'] && - $GLOBALS['egw_info']['apps']['felamimail']) - { - if (($default_profile_id = emailadmin_bo::getDefaultProfileID())) - { - $bofelamimail = felamimail_bo::forceEAProfileLoad($default_profile_id); - $ogServer = $bofelamimail->mailPreferences->getOutgoingServer($default_profile_id); - //error_log(__METHOD__."() default_profile_id = $default_profile_id, get_class(ogServer)=".get_class($ogServer)); - if (!in_array(get_class($ogServer), array('defaultsmtp', 'emailadmin_smtp'))) - { - $p->set_var(array( - 'lang_email' => lang('Email'), - 'email' => html::input('account_email',$group_repository['account_email'],'',' style="width: 100%;"'), - )); - } - emailadmin_bo::unsetCachedObjects($default_profile_id); - } - } - $availableApps = $GLOBALS['egw_info']['apps']; - foreach($availableApps as $app => $data) - { - if (!$data['enabled'] || !$data['status'] || $data['status'] == 3 || $app == 'home') - { - unset($availableApps[$app]); // do NOT show disabled apps, or our API (status = 3) - } - } - uasort($availableApps,create_function('$a,$b','return strcasecmp($a["title"],$b["title"]);')); - - foreach ($availableApps as $app => $data) - { - $perm_display[] = Array( - $app, - $data['title'] - ); - } - unset($app); unset($data); - - $perm_html = ''.lang('Application').''.lang('enabled').' / '.lang('ACL').''; - $perm_html = ''. - $perm_html.$perm_html."\n"; - - $tr_color = $GLOBALS['egw_info']['theme']['row_off']; - for ($i=0;$i < count($perm_display);$i++) - { - $app = $perm_display[$i][0]; - if(!($i & 1)) - { - $tr_class = $this->nextmatchs->alternate_row_color('',True); - $perm_html .= ''; - } - $acl_action = self::_acl_action($app,$group_info['account_id'],$group_info['account_name'],$options); - - $perm_html .= '' . $perm_display[$i][1] . '' - . ' ' - . ($acl_action?'':' ').''.($i & 1?'':'')."\n"; - } - if($i & 1) - { - $perm_html .= ' '; - } - - $var = Array( - 'permissions_list' => $perm_html, - 'lang_submit_button' => lang('submit changes') - ); - $p->set_var($var); - - // create the menu on the left, if needed - $p->set_var('rows',ExecMethod('admin.uimenuclass.createHTMLCode','group_manager')); - - $p->set_var('select',''); - $p->set_var('popwin',''); - $p->pfp('out','edit'); - } - - private function _acl_action($app,$account_id,$account_lid,&$options) - { - $options = ''; - if (!($acl_action = $this->apps_with_acl[$app]) || !$account_id) - { - return false; - } - if ($acl_action === true) - { - $acl_action = array( - 'menuaction' => 'preferences.uiaclprefs.index', - 'acl_app' => '$app', - 'owner' => '$account_id', - ); - } - $replacements = array( - '$app' => $app, - '$account_id' => $account_id, - '$account_lid' => $account_lid, - ); - foreach($acl_action as $name => &$value) - { - $value = str_replace(array_keys($replacements),array_values($replacements),$value); - } - if ($acl_action['popup']) - { - list($w,$h) = explode('x',$acl_action['popup']); - $options = ' onclick="window.open(this,this.target,\'width='.(int)$w.',height='.(int)$h.',location=no,menubar=no,toolbar=no,scrollbars=yes,status=yes\'); return false;"'; - unset($acl_action['popup']); - } - return $GLOBALS['egw']->link('/index.php',$acl_action); - } - - function create_edit_user($_account_id,$_userData='',$_errors='') - { - //_debug_array($_userData); - $GLOBALS['egw_info']['flags']['include_xajax'] = true; - - $jscal =& CreateObject('phpgwapi.jscalendar'); - - unset($GLOBALS['egw_info']['flags']['noheader']); - unset($GLOBALS['egw_info']['flags']['nonavbar']); - - common::egw_header(); - - $t =& CreateObject('phpgwapi.Template',EGW_APP_TPL); - $t->set_unknowns('remove'); - - $t->set_file(array('account' => 'account_form.tpl')); - $t->set_block('account', 'ldap_extra'); - if (!$GLOBALS['egw_info']['server']['ldap_extra_attributes'] || $GLOBALS['egw_info']['server']['account_repository'] != 'ldap') - { - $t->set_var('ldap_extra', ''); - } - $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'); - - $theme = $GLOBALS['egw_info']['user']['preferences']['common']['theme']; - $t->set_var('icon_create_edit', ''); - - //print_debug('Type : '.gettype($_userData).'
_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; - } - - $allGroups = $GLOBALS['egw']->accounts->get_list('groups'); - } - elseif(is_string($_userData) && $_userData=='') - { - if($_account_id) - { - // invalidate account, before reading it, to cope with changes to DB or LDAP outside EGw - accounts::cache_invalidate((int)$_account_id); - $userData = $GLOBALS['egw']->accounts->read((int)$_account_id,'u'); - - $userGroups = $GLOBALS['egw']->accounts->membership($_account_id); - $acl =& CreateObject('phpgwapi.acl',$_account_id); - $acl->read_repository(); - $userData['anonymous'] = $acl->check('anonymous',1,'phpgwapi'); - $userData['changepassword'] = !$acl->check('nopasswordchange',1,'preferences'); - if (!isset($auth)) $auth =& CreateObject('phpgwapi.auth'); - $accLPWDC = $auth->getLastPwdChange($userData['account_lid']); - if ($accLPWDC !== false) $userData['account_lastpwd_change'] = $accLPWDC; - $userData['mustchangepassword'] = (isset($userData['account_lastpwd_change']) && ((is_string($userData['account_lastpwd_change']) && $userData['account_lastpwd_change']==="0")||(is_int($userData['account_lastpwd_change']) && $userData['account_lastpwd_change']===0))?true:false); - unset($acl); - } - else - { - $userData = Array(); - $userData['account_status'] = 'A'; - $userGroups = Array(); - $userData['anonymous'] = False; - $userData['changepassword'] = (bool)$GLOBALS['egw_info']['server']['change_pwd_every_x_days']; - $userData['mustchangepassword'] = false; - } - $allGroups = $GLOBALS['egw']->accounts->get_list('groups'); - } - $page_params['menuaction'] = 'admin.uiaccounts.'.($_account_id?'edit':'add').'_user'; - if($_account_id) - { - $page_params['account_id'] = $_account_id; - $page_params['old_loginid'] = $userData['account_lid']; - } - - $var = Array( - 'form_action' => $GLOBALS['egw']->link('/index.php',$page_params), - 'error_messages' => (!$_errors?'':'
'.common::error_list($_errors).'
'), - 'th_bg' => $GLOBALS['egw_info']['theme']['th_bg'], - 'tr_color1' => $GLOBALS['egw_info']['theme']['row_on'], - 'tr_color2' => $GLOBALS['egw_info']['theme']['row_off'], - 'lang_action' => ($_account_id?lang('Edit user account'):lang('Add new account')), - 'lang_loginid' => lang('LoginID'), - 'lang_account_active' => lang('Account active'), - 'lang_email' => lang('email'), - 'lang_password' => lang('Password'), - 'lang_reenter_password' => lang('Re-Enter Password'), - 'lang_lastname' => lang('Last Name'), - 'lang_groups' => lang('Groups'), - 'lang_primary_group' => lang('primary Group'), - 'lang_expires' => lang('Expires'), - 'lang_firstname' => lang('First Name'), - 'lang_anonymous' => lang('Anonymous User (not shown in list sessions)'), - 'lang_changepassword' => lang('Can change password'), - 'lang_mustchangepassword'=> lang('Must change password upon next login'), - 'lang_button' => ($_account_id?lang('Save'):lang('Add')), - 'lang_passwds_unequal' => lang('The two passwords are not the same'), - 'lang_cancel' => lang('Cancel'), - 'cancel_action' => "document.location='".egw::link('/index.php', array('menuaction' => 'admin.uiaccounts.list_users'))."';", - /* 'lang_file_space' => lang('File Space') */ - ); - $t->set_var($var); - $t->parse('form_buttons','form_buttons_',True); - - if ($GLOBALS['egw_info']['server']['ldap_extra_attributes']) - { - $lang_homedir = lang('home directory'); - $lang_shell = lang('login shell'); - $homedirectory = ''; - $loginshell = ''; - } - else - { - $lang_homedir = ''; - $lang_shell = ''; - $homedirectory = ''; - $loginshell = ''; - } - $account_file_space = ''; - /* - if (!$userData['file_space']) - { - $userData['file_space'] = $GLOBALS['egw_info']['server']['vfs_default_account_size_number'] . "-" . $GLOBALS['egw_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 = ''; - $account_file_space_select =''; - - $var = Array( - 'lang_file_space' => 'File space', - 'account_file_space' => $account_file_space, - 'account_file_space_select' => $account_file_space_select - ); - $t->set_var($var); - */ - $accountPrefix = ''; - if(isset($GLOBALS['egw_info']['server']['account_prefix'])) - { - $accountPrefix = $GLOBALS['egw_info']['server']['account_prefix']; - if (preg_match ("/^$accountPrefix(.*)/i", $userData['account_lid'], $matches)) - { - $userData['account_lid'] = $matches[1]; - } - } - $var = Array( - 'input_expires' => $jscal->input('expires',$userData['expires']<0?'':($userData['expires']?$userData['expires']:time()+(60*60*24*7))), - 'lang_never' => lang('Never'), - 'account_lid' => $accountPrefix.html::input('account_lid', $userData['account_lid'], '', - 'id="account" onchange="check_account_email(this.id);" maxlength="64"'. - // disable account_lid input, if backend does not allow to change it - ($GLOBALS['egw']->accounts->change_account_lid_allowed() || !$_account_id ? '' : ' disabled="disabled"')), - 'lang_homedir' => $lang_homedir, - 'lang_shell' => $lang_shell, - 'homedirectory' => $homedirectory, - 'loginshell' => $loginshell, - 'anonymous' => '', - 'changepassword' => '', - 'mustchangepassword' => '', - 'account_status' => '', - 'account_firstname' => '', - 'account_lastname' => '', - 'account_email' => '', - 'account_passwd' => $userData['account_passwd'], - 'account_passwd_2' => $userData['account_passwd_2'], - 'account_file_space' => $account_file_space, - 'account_id' => (int) $userData['account_id'] - ); - if (isset($userData['account_created'])) $var['account_status'].= '
'.lang('Created').': '.common::show_date($userData['account_created']); - if (isset($userData['account_modified'])) $var['account_status'].= '
'.lang('Modified').': '.common::show_date($userData['account_modified']); - - - if($userData['expires'] == -1) - { - $var['never_expires'] = ''; - } - else - { - $var['never_expires'] = ''; - } - - $t->set_var($var); - $t->parse('password_fields','form_passwordinfo',True); - - // set primary group to default, if there is no primary group set; this may fail, if no group "Default" exists - if (!$userData['account_primary_group']) - { - $userData['account_primary_group'] = @$userGroups[0]['account_id'] ? - @$userGroups[0]['account_id'] : $GLOBALS['egw']->accounts->name2id('Default'); - } - // prepare the allGroups array for use with the checkbox-multiselect use - $allGroupsBuff=array(); - while (list($key,$value) = each($allGroups)) - { - $allGroupsBuff[strtolower($value['account_lid'])]=$value; - } - // sort alphabetical - ksort($allGroupsBuff); - $allGroupsSorted=array(); - while (list($key,$value) = each($allGroupsBuff)) - { - $allGroupsSorted[$value['account_id']]=$value['account_lid']; - $primary_group_select .= ''."\n"; - } - - unset($GLOBALS['egw_info']['flags']['noheader']); - unset($GLOBALS['egw_info']['flags']['nonavbar']); - common::egw_header(); - - $t =& CreateObject('phpgwapi.Template',EGW_APP_TPL); - $t->set_unknowns('remove'); - - $t->set_file( - Array( - 'manager' =>'group_manager.tpl' - ) - ); - - $t->set_block('manager','form','form'); - $t->set_block('manager','link_row','link_row'); - - $var['th_bg'] = $GLOBALS['egw_info']['user']['theme']['th_bg']; - $var['lang_group'] = lang('Group'); - $var['group_name'] = $group_info['account_name']; - $var['tr_color1'] = $GLOBALS['egw_info']['user']['theme']['row_on']; - $var['form_action'] = $GLOBALS['egw']->link('/index.php','menuaction=admin.uiaccounts.set_group_managers'); - $var['hidden'] = ''; - $var['lang_select_managers'] = lang('Select Group Managers'); - $var['group_members'] = ''; - $var['form_buttons'] = '  ' - . ''; - $t->set_var($var); - - // create the menu on the left, if needed - $t->set_var('rows',ExecMethod('admin.uimenuclass.createHTMLCode','edit_group')); - - $t->pfp('out','form'); - } - - function set_group_managers() - { - if($GLOBALS['egw']->acl->check('group_access',16,'admin') || $_POST['cancel']) - { - $GLOBALS['egw']->redirect_link('/index.php','menuaction=admin.uiaccounts.list_groups'); - common::egw_exit(); - } - elseif($_POST['submit']) - { - $acl =& CreateObject('phpgwapi.acl',(int)$_POST['account_id']); - - $users = $GLOBALS['egw']->accounts->member($_POST['account_id']); - @reset($users); - while($managers && list($key,$user) = each($users)) - { - $acl->add_repository('phpgw_group',(int)$_POST['account_id'],$user['account_id'],1); - } - $managers = $_POST['managers']; - @reset($managers); - while($managers && list($key,$manager) = each($managers)) - { - $acl->add_repository('phpgw_group',(int)$_POST['account_id'],$manager,(1 + EGW_ACL_GROUP_MANAGERS)); - } - } - $GLOBALS['egw']->redirect($GLOBALS['egw']->link('/index.php','menuaction=admin.uiaccounts.list_groups')); - common::egw_exit(); - } - - /** - * applies stripslashes recursively on each element of an array - * - * @param array &$var - * @return array - */ - function array_stripslashes($var) - { - if(!is_array($var)) - { - return stripslashes($var); - } - foreach($var as $key => $val) - { - $var[$key] = is_array($val) ? $this->array_stripslashes($val) : stripslashes($val); - } - return $var; - } - } -?> diff --git a/admin/inc/class.uiaclmanager.inc.php b/admin/inc/class.uiaclmanager.inc.php index 61f92076a4..7aafecaf46 100644 --- a/admin/inc/class.uiaclmanager.inc.php +++ b/admin/inc/class.uiaclmanager.inc.php @@ -64,7 +64,7 @@ $this->template->set_var('app_name',$GLOBALS['egw_info']['apps'][$app]['title']); $this->template->set_var('a_name',$appname); $this->template->set_var('app_icon',$icon); - + if ($icon) { $this->template->fp('rows','app_row',True); @@ -73,7 +73,7 @@ { $this->template->fp('rows','app_row_noicon',True); } - + if (is_array($locations)) { foreach($locations as $loc => $value) @@ -84,18 +84,18 @@ 'acl_app' => $app, 'account_id' => $this->account_id ); - + $this->template->set_var('link_location',$GLOBALS['egw']->link('/index.php',$link_values)); $this->template->set_var('lang_location',lang($value['name'])); $this->template->fp('rows','link_row',True); } } - + $this->template->parse('rows','spacer_row',True); } } $this->template->set_var(array( - 'cancel_action' => $GLOBALS['egw']->link('/index.php','menuaction=admin.uiaccounts.list_users'), + 'cancel_action' => $GLOBALS['egw']->link('/admin/index.php'), 'lang_cancel' => lang('Cancel') )); $this->template->pfp('out','list'); diff --git a/admin/inc/class.uimenuclass.inc.php b/admin/inc/class.uimenuclass.inc.php deleted file mode 100644 index 149689c8bd..0000000000 --- a/admin/inc/class.uimenuclass.inc.php +++ /dev/null @@ -1,138 +0,0 @@ -t =& CreateObject('phpgwapi.Template',$GLOBALS['egw']->common->get_tpl_dir('admin')); - - $this->t->set_file(array('menurow' => 'menurow.tpl')); - $this->t->set_block('menurow','menu_links','menu_links'); - $this->t->set_block('menurow','link_row','link_row'); - - $this->rowColor[0] = $GLOBALS['egw_info']['theme']['row_on']; - $this->rowColor[1] = $GLOBALS['egw_info']['theme']['row_off']; - } - - function section_item($pref_link='',$pref_text='', $class='',$options='') - { - $this->t->set_var('row_link',$pref_link); - $this->t->set_var('row_text',$pref_text); - $this->t->set_var('class',$class); - $this->t->set_var('row_options',$options); - $this->t->parse('all_rows','link_row',True); - } - - // $file must be in the following format: - // $file = array( - // 'Login History' => array('/index.php','menuaction=admin.uiaccess_history.list') - // ); - // This allows extra data to be sent along - function display_section($_menuData, $_account_id) - { - $i=0; - - // reset the value of all_rows - $this->t->set_var('all_rows',''); - - while(list($key,$value) = each($_menuData)) - { - if (!empty($value['extradata'])) - { - $link = egw::link($value['url'],'account_id=' . $_account_id . '&' . $value['extradata']); - } - else - { - $link = egw::link($value['url'],'account_id=' . get_var('account_id',array('GET','POST'))); - } - $this->section_item($link,lang($value['description']),($i%2) ? "row_on": "row_off",$value['options']); - $i++; - } - - if(strpos($_menuData[0]['extradata'],'user')) - { - $destination = 'users'; - } - else - { - $destination = 'groups'; - } - $this->t->set_var('link_done',$GLOBALS['egw']->link('/index.php','menuaction=admin.uiaccounts.list_'.$destination)); - $this->t->set_var('lang_done',lang('Back')); - - $this->t->set_var('row_on',$this->rowColor[0]); - - $this->t->parse('out','menu_links'); - - return $this->t->get('out','menu_links'); - } - - // create the html code for the menu - function createHTMLCode($_hookname, $_account_id=null) - { - $hook = array('location' => $_hookname); - if (!$_account_id) $_account_id = get_var('account_id',array('GET','POST')); - if ($_account_id) $hook['account_id'] = $_account_id; - - switch ($_hookname) - { - case 'edit_user': - $GLOBALS['menuData'][] = array( - 'description' => 'User Data', - 'url' => '/index.php', - 'extradata' => 'menuaction=admin.uiaccounts.edit_user' - ); - break; - case 'view_user': - $GLOBALS['menuData'][] = array( - 'description' => 'User Data', - 'url' => '/index.php', - 'extradata' => 'menuaction=admin.uiaccounts.view_user' - ); - break; - case 'edit_group': - $GLOBALS['menuData'][] = array( - 'description' => 'Edit Group', - 'url' => '/index.php', - 'extradata' => 'menuaction=admin.uiaccounts.edit_group' - ); - break; - case 'group_manager': - $GLOBALS['menuData'][] = array( - 'description' => 'Group Manager', - 'url' => '/index.php', - 'extradata' => 'menuaction=admin.uiaccounts.group_manager' - ); - break; - } - //_debug_array($hook); - $GLOBALS['egw']->hooks->process($hook); - if (count($GLOBALS['menuData']) >= 1) - { - $result = $this->display_section($GLOBALS['menuData'], $_account_id); - //clear $menuData - $GLOBALS['menuData'] = ''; - return $result; - } - else - { - // clear $menuData - $GLOBALS['menuData'] = ''; - return ''; - } - } - } diff --git a/admin/inc/hook_add_def_pref.inc.php b/admin/inc/hook_add_def_pref.inc.php deleted file mode 100755 index ad46c36e16..0000000000 --- a/admin/inc/hook_add_def_pref.inc.php +++ /dev/null @@ -1,8 +0,0 @@ -change('common','maxmatchs','15'); - $GLOBALS['pref']->change('common','theme','default'); - $GLOBALS['pref']->change('common','tz_offset',0); - $GLOBALS['pref']->change('common','dateformat','m/d/Y'); - $GLOBALS['pref']->change('common','timeformat',12); - $GLOBALS['pref']->change('common','lang','en'); -?> diff --git a/admin/setup/setup.inc.php b/admin/setup/setup.inc.php index 7980b327dc..61ab4d5102 100755 --- a/admin/setup/setup.inc.php +++ b/admin/setup/setup.inc.php @@ -33,7 +33,6 @@ $setup_info['admin']['description'] = 'EGroupware administration application'; /* The hooks this app includes, needed for hooks registration */ $setup_info['admin']['hooks'] = array( 'acl_manager', - 'add_def_pref', 'after_navbar', 'config_validate', 'deleteaccount', diff --git a/admin/templates/default/account_form.tpl b/admin/templates/default/account_form.tpl deleted file mode 100644 index ba3ce5ea55..0000000000 --- a/admin/templates/default/account_form.tpl +++ /dev/null @@ -1,151 +0,0 @@ - -{error_messages} - -
-
- - - - - -
- {rows} - - - - - - - - - - - - - - - - - - - - - - - {password_fields} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - {permissions_list} - - {form_buttons} - -
{lang_action}
{lang_loginid}{account_lid} {lang_account_active}:{account_status}
{lang_firstname}{account_firstname} {lang_lastname}{account_lastname} 
{lang_homedir}{homedirectory} {lang_shell}{loginshell} 
{lang_mustchangepassword}{mustchangepassword}
{lang_changepassword}{changepassword}{lang_anonymous}{anonymous}
{lang_expires}{input_expires} {lang_email}{account_email}
{lang_groups}{groups_select} {lang_primary_group}{primary_group_select} 
{lang_app}{lang_acl}{lang_app}{lang_acl}
-
-
-
- - - - - {lang_password} - - {lang_reenter_password} - - - - - - - - - - - - - - - - {lang_lastlogin} - {account_lastlogin} - - {lang_lastloginfrom} - {account_lastloginfrom} - - - - - -  {row_text} - - diff --git a/admin/templates/default/accounts.tpl b/admin/templates/default/accounts.tpl deleted file mode 100644 index e8bc614780..0000000000 --- a/admin/templates/default/accounts.tpl +++ /dev/null @@ -1,80 +0,0 @@ - -
- - - - - - - - - {left_next_matchs} - - {right_next_matchs} - -
-
- - - -
{lang_group} {group} - {query_type} - - -
-
-
- - - - -
{letter}
-
{lang_showing}
-
-
- - - - - - - - - - - - - - - - - - - - - - - - - -
{lang_loginid}{lang_lastname}{lang_firstname}{lang_email}{lang_account_active}{lang_edit}{lang_delete}{lang_view}
{account_lid}{account_lastname}{account_firstname}{account_email}{account_status}{row_edit}{row_delete}{row_view}
-
- -
- - - - -
-
- {input_add} -
-
-
- - - - - {message} - - diff --git a/admin/templates/default/acl_accounts.tpl b/admin/templates/default/acl_accounts.tpl deleted file mode 100644 index feb1fdafcd..0000000000 --- a/admin/templates/default/acl_accounts.tpl +++ /dev/null @@ -1,57 +0,0 @@ - -{lang_header} -

- -

- - - - - - -
{left_next_matchs} {right_next_matchs}
-
- -
- - - - - - - - - {rows} - -
{lang_loginid}{lang_lastname}{lang_firstname}{lang_access}
-
- -
-
- - - - -
- - - -
-
- - - - - - {row_loginid} - {row_lastname} - {row_firstname} - {row_access} - - - - - - {message} - - diff --git a/admin/templates/default/delete_account.tpl b/admin/templates/default/delete_account.tpl deleted file mode 100755 index a1aa9e087d..0000000000 --- a/admin/templates/default/delete_account.tpl +++ /dev/null @@ -1,19 +0,0 @@ - -
- -
- - - - - - - - - - -
{lang_new_owner}
{new_owner_select}
    
-
-
- - diff --git a/admin/templates/default/delete_cat.tpl b/admin/templates/default/delete_cat.tpl deleted file mode 100644 index af38b9c23a..0000000000 --- a/admin/templates/default/delete_cat.tpl +++ /dev/null @@ -1,35 +0,0 @@ - - - -
-
- {hidden_vars} - - - - - - - - - - - - - - - - -
-

{cat_name}

- {messages} -
{lang_subs} {subs}
- - - - - -
-
- - diff --git a/admin/templates/default/delete_common.tpl b/admin/templates/default/delete_common.tpl deleted file mode 100644 index 188635320c..0000000000 --- a/admin/templates/default/delete_common.tpl +++ /dev/null @@ -1,20 +0,0 @@ - -

-

-
- {hidden_vars} - - {messages} - - - - -
- - - -
-
-
- - diff --git a/admin/templates/default/form_button_script.tpl b/admin/templates/default/form_button_script.tpl deleted file mode 100755 index ca566e0a7d..0000000000 --- a/admin/templates/default/form_button_script.tpl +++ /dev/null @@ -1,6 +0,0 @@ - - -
- {action_extra_field} -
- diff --git a/admin/templates/default/group_form.tpl b/admin/templates/default/group_form.tpl deleted file mode 100644 index 298361b39e..0000000000 --- a/admin/templates/default/group_form.tpl +++ /dev/null @@ -1,76 +0,0 @@ - {error} - - - - - -
- {rows} - - - - {hidden_vars} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
{lang_group_name}
{lang_include_user} - {accounts} -
{lang_email}{email}
{lang_file_space} - {account_file_space}{account_file_space_select} -
{lang_permissions} - {permissions_list} -
- -
-
- - - - - - - - - - - - - - -
- - - - -
- - diff --git a/admin/templates/default/group_manager.tpl b/admin/templates/default/group_manager.tpl deleted file mode 100755 index 7554e2abc2..0000000000 --- a/admin/templates/default/group_manager.tpl +++ /dev/null @@ -1,37 +0,0 @@ - -{error_messages} - -
- - - - - -
- {rows} - - - - - - - - - - {hidden} - - - - - {form_buttons} - -
{lang_group}:{group_name}
{lang_select_managers}{group_members}
-
-
- - - - -  {row_text} - - diff --git a/admin/templates/default/groups.tpl b/admin/templates/default/groups.tpl deleted file mode 100644 index 05907f4bd2..0000000000 --- a/admin/templates/default/groups.tpl +++ /dev/null @@ -1,71 +0,0 @@ - -

- - - - - - {left_next_matchs} - - {right_next_matchs} - -
- - - - -
{letter}
-
{lang_groups}
- - - - - - - - - {rows} - -
{sort_name}{header_edit}{header_delete}
- - - - - - -
-
- {input_add} -
-
- -
- - - -
{lang_group} {group} - {query_type} - - -
-
-
- - - - - {group_name} - {edit_link} - {delete_link} - - - - - - {message} - - diff --git a/admin/templates/default/index.tpl b/admin/templates/default/index.tpl deleted file mode 100755 index 8d693170f8..0000000000 --- a/admin/templates/default/index.tpl +++ /dev/null @@ -1,63 +0,0 @@ - - -

- {rows} -
- - - -
-

{app_name}

-
    - - - -
    -

    {app_name}

    - -
    - diff --git a/admin/templates/default/kill_session.tpl b/admin/templates/default/kill_session.tpl deleted file mode 100644 index 5f9d1eec8a..0000000000 --- a/admin/templates/default/kill_session.tpl +++ /dev/null @@ -1,11 +0,0 @@ -
    - - - - - - - -
    {lang_message} -
    {link_no}{link_yes}
    - diff --git a/admin/templates/default/menurow.tpl b/admin/templates/default/menurow.tpl deleted file mode 100644 index 59a8bc89ba..0000000000 --- a/admin/templates/default/menurow.tpl +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - {all_rows} - - - - - - -
     
     
      {lang_done}
    - - - -   {row_text} - - diff --git a/admin/templates/default/message_row.tpl b/admin/templates/default/message_row.tpl deleted file mode 100755 index 532e73e1e5..0000000000 --- a/admin/templates/default/message_row.tpl +++ /dev/null @@ -1,5 +0,0 @@ - - - {message_display} - - diff --git a/admin/templates/default/nntp.tpl b/admin/templates/default/nntp.tpl deleted file mode 100755 index bcde39b313..0000000000 --- a/admin/templates/default/nntp.tpl +++ /dev/null @@ -1,68 +0,0 @@ - - - -

    {title}
    - - - - - {nml} - {nmr} -
    -
    -
    - {common_hidden_vars} - - - -
    -
    -
    -
    - {common_hidden_vars} - - - - - - - - - {output} - - - - - - - - - - - - - - - - - - -
    {sort_con}{sort_group}{sort_active}
    {con}{group}{active}
      - -
    -
    -
    -