} $groups = gs_group_info_get(false, 'user'); $groups_my = gs_group_members_groups_get(array($uid), 'user', false); } if ($action === 'del') { if ($delete_user) { $ret = gs_user_del($delete_user); if (isGsError($ret)) { echo '<div class="errorbox">', $ret->getMsg(), '</div>', "\n"; } } $action = 'list'; } if ($action === 'add' || $action === 'add-and-view') { if ($user_name) { $ret = gs_user_add($user_name, $user_ext, $user_pin, $user_fname, $user_lname, $user_host, $user_email); if (isGsError($ret)) { echo '<div class="errorbox">', $ret->getMsg(), '</div>', "\n"; } if ($action === 'add-and-view') { $action = 'view'; $edit_user = $user_name; $uid = (int) $DB->executeGetOne('SELECT `id` FROM `users` WHERE `user`=\'' . $DB->escape($edit_user) . '\''); if ($uid == 0) { echo '<div class="errorbox">', "Error. User not Found.", '</div>', "\n"; } $groups = gs_group_info_get(false, 'user'); $groups_my = gs_group_members_groups_get(array($uid), 'user'); } else { $action = 'list'; }
echo '<div style="width:550px; border:1px solid #ccc; margin: 2em auto; padding:0 1em 1em 1em; background-color:#eee;">'; $nuser = trim(@$_REQUEST['uuser']); $nfname = trim(@$_REQUEST['ufname']); $nlname = trim(@$_REQUEST['ulname']); $nexten = (int) trim(@$_REQUEST['uexten']); $npin = (int) trim(@$_REQUEST['upin']); $action = trim(@$_REQUEST['action']); if (!$db) { return new GsError('Could not connect to database.'); } if (!in_array($action, array('list', 'useradd'), true)) { $action = 'list'; } $group_id = gs_group_id_get('admins'); if ($action === 'useradd') { $ret = gs_user_add($nuser, $nexten, $npin, $nfname, $nlname, '1', ''); if (isGsError($ret)) { echo '<div class="errorbox">', $ret->getMsg(), '</div>', "\n"; } else { $ret = gs_group_member_add($group_id, $nuser); if (isGsError($ret)) { echo '<div class="errorbox">', $ret->getMsg(), '</div>', "\n"; } } $action = 'list'; } if ($action === 'list') { echo '<h1>', __('Administratoren'), '</h1>'; echo __('Sie müssen mindestens einen Benutzer mit Adminrechten anlegen. Mit diesem Benutzer könnem Sie sich am normalen Web-Interface anmelden. Pflichtfelder sind: Benutzername, Durchwahl und PIN.'); echo '<p>'; echo '<form method="post" action="', GS_URL_PATH, 'setup/?step=user">';