$user_host = trim(@$_REQUEST['uhost']);
$bp_add_h = (int) @$_REQUEST['bp_add_h'];
$bp_del_h = (int) @$_REQUEST['bp_del_h'];
$group = (int) @$_REQUEST['group'];
$sort = @$_REQUEST['sort'];
if (!in_array($sort, array('user', 'name', 'ext', 'email', 'host'))) {
    $sort = 'name';
}
$sortorder = @$_REQUEST['sortorder'];
if (!in_array($sortorder, array('ASC', 'DESC'))) {
    $sortorder = 'ASC';
}
$pen_avail = range(0, 9);
if ($edit_user) {
    if ($action === 'insert-group') {
        $ret = gs_group_member_add($group, $edit_user);
        if (isGsError($ret)) {
            echo '<div class="errorbox">', $ret->getMsg(), '</div>', "\n";
        }
        sleep(1);
        //FIXME
        $action = 'view';
    }
    if ($action === 'remove-group') {
        $ret = gs_group_member_del($group, $edit_user);
        if (isGsError($ret)) {
            echo '<div class="errorbox">', $ret->getMsg(), '</div>', "\n";
        }
        sleep(1);
        //FIXME
        $action = 'view';
	`joinempty`=\'' . $joinempty . '\',
	`leavewhenempty`=\'' . $leavewhenempty . '\',
	`_min_agents`=\'' . $min_agents . '\'
WHERE `_id`=' . $queue_id);
    }
    $action = 'edit';
}
#####################################################################
#                               save }
#####################################################################
####################################################################
#                              groups {
###################################################################
if ($action === 'insert-group') {
    $queue_name = $DB->executeGetOne('SELECT `name` FROM `ast_queues` WHERE ' . '`_id`=' . $queue_id);
    $ret = gs_group_member_add($group, $queue_name);
    if (isGsError($ret)) {
        echo '<div class="errorbox">', $ret->getMsg(), '</div>', "\n";
    }
    sleep(1);
    //FIXME
    $action = 'edit';
}
if ($action === 'remove-group') {
    $queue_name = $DB->executeGetOne('SELECT `name` FROM `ast_queues` WHERE ' . '`_id`=' . $queue_id);
    $ret = gs_group_member_del($group, $queue_name);
    if (isGsError($ret)) {
        echo '<div class="errorbox">', $ret->getMsg(), '</div>', "\n";
    }
    sleep(1);
    //FIXME
        if (@$section['id']) {
            if (array_key_exists('m' . $section['id'], $_REQUEST) && (int) $_REQUEST['m' . $section['id']] == 1) {
                if (!in_array($section['id'], $group_members)) {
                    gs_group_member_add($group_id, $section['id']);
                }
            } else {
                if (in_array($section['id'], $group_members)) {
                    gs_group_member_del($group_id, $section['id']);
                }
            }
        }
        if (array_key_exists('sub', $section)) {
            foreach ($section['sub'] as $module) {
                if (array_key_exists('m' . $module['id'], $_REQUEST) && (int) $_REQUEST['m' . $module['id']] == 1) {
                    if (!in_array($module['id'], $group_members)) {
                        gs_group_member_add($group_id, $module['id']);
                    }
                } else {
                    if (in_array($module['id'], $group_members)) {
                        gs_group_member_del($group_id, $module['id']);
                    }
                }
            }
        }
    }
    $action = '';
}
if ($action == 'edit' && $group_id > 0) {
    $group_members = gs_group_members_get(array($group_id));
    ?>
<table cellspacing="1">
$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&uuml;ssen mindestens einen Benutzer mit Adminrechten anlegen. Mit diesem Benutzer k&ouml;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">';
    echo '<input type="hidden" name="action" value="useradd" />';
    echo '<table><thead><tr>';
    echo '<th colspan="5">', __('Angelegte Aministratoren'), '</th></tr><tr>';
    echo '<th>', __('Benutzer'), '</th>';
예제 #5
0
    if (isGsError($ret)) {
        echo '<div class="errorbox">', $ret->getMsg(), '</div>', "\n";
    } elseif (!$ret) {
        echo '<div class="errorbox">', __('Berechtigung konnte nicht entfernt werden.'), '</div>', "\n";
    }
    sleep(1);
    // FIXME
    $action = 'edit';
    # view
}
#####################################################################
# add member to a group
#####################################################################
if ($action === 'insert-member') {
    $pg_member = trim(@$_REQUEST['member']);
    $ret = gs_group_member_add($group_id, $pg_member);
    if (isGsError($ret)) {
        echo '<div class="errorbox">', $ret->getMsg(), '</div>', "\n";
    } elseif (!$ret) {
        echo '<div class="errorbox">', __('Mitglied konnte nicht hinzugef&uuml;gt werden.'), '</div>', "\n";
    }
    sleep(1);
    // FIXME
    $action = 'edit';
    # view
}
#####################################################################
# remove member from a group
#####################################################################
if ($action === 'remove-member') {
    $pg_member = trim(@$_REQUEST['member']);