コード例 #1
0
ファイル: groups.php プロジェクト: adrianbroher/thwboard
} elseif ($action == 'delete') {
    $r_group = query("SELECT nodelete, name FROM {$pref}" . "group WHERE groupid='" . $groupid . "'");
    $group = mysql_fetch_array($r_group);
    /* WARNING: do NOT remove this check unless you know what youre doing .. */
    if ($groupid == $config['default_groupid'] || $groupid == $config['guest_groupid']) {
        print 'Sorry, you cannot delete this group (Are you trying to delete the default or guest group?).';
    } else {
        print 'You are going to delete "' . $group['name'] . '". Are you sure? (Group members will be removed from group)<br><br><a href="groups.php?session=' . $session . '&action=drop&groupid=' . $groupid . '">Yes</a>';
    }
} elseif ($action == 'drop') {
    /* put members into the default group */
    /*query("UPDATE $pref"."user SET groupid=$config[default_groupid] WHERE groupid='$groupid'");*/
    $r_user = query("SELECT userid, groupids FROM {$pref}" . "user WHERE INSTR(groupids, ',{$groupid},')>0");
    while ($user = mysql_fetch_array($r_user)) {
        $user['groupids'] = substr($user['groupids'], 1, strlen($user['groupids']) - 2);
        grouplist_remove($user['groupids'], $groupid);
        $user['groupids'] = ',' . $user['groupids'] . ',';
        query("UPDATE {$pref}" . "user SET groupids='{$user['groupids']}' WHERE userid={$user['userid']}");
    }
    /* delete the group. */
    query("DELETE FROM {$pref}" . "group WHERE groupid='{$groupid}'");
    /* delete group/board*/
    query("DELETE FROM {$pref}" . "groupboard WHERE groupid='{$groupid}'");
    print 'Group has been deleted!';
} elseif ($action == 'edit') {
    $r_group = query("SELECT groupid, name, accessmask, title, titlepriority FROM {$pref}" . "group WHERE groupid='" . $groupid . "'");
    $group = mysql_fetch_array($r_group);
    print '<b>Edit group</b><br><br>';
    group_form($group, 'update');
} elseif ($action == 'editgroupboard') {
    $r_group = query("SELECT groupid, name, accessmask FROM {$pref}" . "group WHERE groupid='{$groupid}'");
コード例 #2
0
ファイル: groups.php プロジェクト: BackupTheBerlios/thwc
    $board = db_result($r_board);
    $r_groupboard = db_query("SELECT\n         groupid,\n         accessmask\n     FROM " . $pref . "groupboard WHERE groupid='{$_GET['groupid']}' AND boardid='{$_GET['boardid']}'");
    if (db_rows($r_groupboard) > 0) {
        $groupboard = db_result($r_groupboard);
        $group['accessmask'] = $groupboard['accessmask'];
        $data['work'] = groupboard_form($groupboard, $board, false);
    } else {
        $data['work'] = groupboard_form($group, $board, false);
    }
} elseif ($action == 'drop') {
    /* put members into the default group */
    /*query("UPDATE $pref"."user SET groupid=$config[default_groupid] WHERE groupid='$groupid'");*/
    $r_user = db_query("SELECT\n         user_id,\n         groupids\n     FROM " . $pref . "user WHERE INSTR(groupids, ',{$_GET['groupid']},')>0");
    while ($user = db_result($r_user)) {
        $user['groupids'] = substr($user['groupids'], 1, strlen($user['groupids']) - 2);
        grouplist_remove($user['groupids'], $_GET['groupid']);
        $user['groupids'] = ',' . $user['groupids'] . ',';
        db_query("UPDATE " . $pref . "user SET\n             groupids='{$user['groupids']}'\n         WHERE userid={$user['user_id']}");
    }
    /* delete the group. */
    db_query("DELETE FROM " . $pref . "group WHERE groupid='{$_GET['groupid']}'");
    /* delete group/board*/
    db_query("DELETE FROM " . $pref . "groupboard WHERE groupid='{$_GET['groupid']}'");
    $data['work'] = 'Group has been deleted!';
} elseif ($action == 'updategroupboard') {
    if ($_POST['useglobal'] == 'yes') {
        db_query("DELETE FROM " . $pref . "groupboard WHERE groupid='{$_POST['groupid']}' AND boardid='{$_POST['boardid']}'");
        $data['work'] = 'Settings gespeichert.<br><br><a href="groups.php?action=boardpermtable&groupid=' . $_POST['groupid'] . '">Back</a>';
    } else {
        // delete old perms, no matter whether they exist or not ..
        db_query("DELETE FROM " . $pref . "groupboard WHERE groupid='{$_POST['groupid']}' AND boardid='{$_POST['boardid']}'");