<commit_before><?php require 'ldapconnect.php'; ?>
<?php
    if (!isUserInGroup($con, $user, "gsag")) {
        header( 'Location: index.php' );
    }

    $pageTitle = ' - Groups';

    if (isset($_GET['group'])) {
        $editGroup = TRUE;
        $gname = $_GET['group'];
        $pageTitle = " - Group: $gname";
        

        if (isset($_POST['newuser'])) {
            $newmember = $_POST['newuser'];
            $entry['memberuid'] = $newmember;
            ldap_mod_add($con, "cn=$gname,ou=groups,dc=geeksoc,dc=org", $entry);
            if (ldap_error($con) != "Success") {
                $error = ldap_error($con);
            }
            $success = "Added $newmember to group $gname.";

        } elseif (isset($_GET['remove'])) {
            $member = $_GET['remove'];
            $entry['memberuid'] = $member;
            ldap_mod_del($con, "cn=$gname,ou=groups,dc=geeksoc,dc=org", $entry);
            if (ldap_error($con) != "Success") {
                $error = ldap_error($con);
            }
            $success = "Removed $member from group $gname.";
        }


        $group = NULL;
        foreach(getAllGroups($con) as $g) {
            if ($g['cn'][0] == $gname) $group = $g;
        }

    }

?>
<?php require 'header.php'; ?>
<?php require 'menu.php'; ?>

    <div class="span5">
                <?php if (isset($error)) : ?>
                  <div class="alert alert-error">
                    <?php echo "$error"; ?>
                  </div>
                <?php elseif (isset($success)) : ?>
                  <div class="alert alert-success">
                    <?php echo "$success"; ?>
                  </div>
                <?php endif; ?>

                <legend><?php echo $gname; ?></legend>
                <table class="table">
                    <thead>
                        <th></th>
                        <th>Member</th>
                    </thead>
                    <tbody>
                        <?php foreach (array_slice($group['memberuid'], 1) as $member) : ?>
                            <tr>
                            <td><a href="editgroup.php?remove=<?php echo $member?>&group=<?php echo $gname ?>" class="btn btn-mini btn-danger">Remove</a>
</td>
                                <td><?php echo $member."\n"; ?></td>
                            </tr>
                        <?php endforeach; ?>
                    </tbody><commit_msg>Links from gorup member list to user edit page<commit_after><?php require 'ldapconnect.php'; ?>
<?php
    if (!isUserInGroup($con, $user, "gsag")) {
        header( 'Location: index.php' );
    }

    $pageTitle = ' - Groups';

    if (isset($_GET['group'])) {
        $editGroup = TRUE;
        $gname = $_GET['group'];
        $pageTitle = " - Group: $gname";
        

        if (isset($_POST['newuser'])) {
            $newmember = $_POST['newuser'];
            $entry['memberuid'] = $newmember;
            ldap_mod_add($con, "cn=$gname,ou=groups,dc=geeksoc,dc=org", $entry);
            if (ldap_error($con) != "Success") {
                $error = ldap_error($con);
            }
            $success = "Added $newmember to group $gname.";

        } elseif (isset($_GET['remove'])) {
            $member = $_GET['remove'];
            $entry['memberuid'] = $member;
            ldap_mod_del($con, "cn=$gname,ou=groups,dc=geeksoc,dc=org", $entry);
            if (ldap_error($con) != "Success") {
                $error = ldap_error($con);
            }
            $success = "Removed $member from group $gname.";
        }


        $group = NULL;
        foreach(getAllGroups($con) as $g) {
            if ($g['cn'][0] == $gname) $group = $g;
        }

    }

?>
<?php require 'header.php'; ?>
<?php require 'menu.php'; ?>

    <div class="span5">
                <?php if (isset($error)) : ?>
                  <div class="alert alert-error">
                    <?php echo "$error"; ?>
                  </div>
                <?php elseif (isset($success)) : ?>
                  <div class="alert alert-success">
                    <?php echo "$success"; ?>
                  </div>
                <?php endif; ?>

                <legend><?php echo $gname; ?></legend>
                <table class="table">
                    <thead>
                        <th></th>
                        <th>Member</th>
                    </thead>
                    <tbody>
                        <?php foreach (array_slice($group['memberuid'], 1) as $member) : ?>
                            <tr>
                            <td><a href="editgroup.php?remove=<?php echo $member?>&group=<?php echo $gname ?>" class="btn btn-mini btn-danger">Remove</a>
</td>
                                <td><a href="edit.php?user=<?php echo $member; ?>"><?php echo $member; ?></a></td>
                            </tr>
                        <?php endforeach; ?>
                    </tbody>
{'fraction_non_alphanumeric': 0.17627878540859995, 'fraction_numerical': 0.0012227430201752598, 'mean_word_length': 1.4165435745937962, 'pattern_counts': {'":': 0, '<': 84, '<?xml version=': 0, '>': 84, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6147984', 'n_tokens_mistral': 1462, 'n_tokens_neox': 1396, 'n_words': 287}