예제 #1
0
/**
* Edits an existing group in the database and sets the admin
* @param none
*/
function edit_group()
{
    global $db;
    $data = check_group_data(CmnFns::cleanPostVals());
    $db->edit_group($data['groupid'], $data['group_name'], $data['group_admin']);
    print_success();
}
예제 #2
0
    if (!$edit && !(bool) $conf['app']['allowSelfRegistration']) {
        $isAdmin = $curUser->is_group_admin(array($id)) || Auth::isAdmin();
        if (!$isAdmin) {
            // Only the administrator can create users
            CmnFns::do_error_box(translate('This is only accessable to the administrator'), '', true);
        }
    }
}
// If we are editing and have not yet submitted an update
if ($edit && !isset($_POST['update'])) {
    $user = new User($id);
    $data = $user->get_user_data();
    $data['emailaddress'] = $data['email'];
    // Needed to be the same as the form
} else {
    $data = CmnFns::cleanPostVals();
}
if (isset($_POST['register'])) {
    // New registration
    $data['lang'] = determine_language();
    $adminCreated = Auth::is_logged_in() && Auth::isAdmin();
    $msg = $auth->do_register_user($data, $adminCreated);
    $show_form = false;
} else {
    if (isset($_POST['update'])) {
        // Update registration
        $adminUpdate = $curUser->get_id() != $id && (Auth::isAdmin() || $curUser->is_group_admin(array($id)));
        $msg = $auth->do_edit_user($data, $adminUpdate);
        $show_form = false;
    }
}