exit; } /** * Displays a full list of members allowed to view a conversation. * * @package esoTalk */ $conversation = $data["conversation"]; $names = array(); $count = count($conversation["membersAllowed"]); // Go through the list of members/groups allowed and construct an array of formatted names. foreach ($conversation["membersAllowed"] as $member) { // Format the entity's name depending on its type. if ($member["type"] == "group") { $member["avatarFormat"] = null; $member["name"] = groupName($member["name"], true); } else { $member["name"] = name($member["name"]); } // Add the avatar. $name = "<span class='name'>" . avatar($member["id"], $member["avatarFormat"], "thumb"); // If we're able to remove entities from the list, wrap the name in links that will remove them. if (!empty($data["editable"])) { // Make the entity for the owner of the conversation non-removable unless it's the last name left. if ($count == 1 or $member["id"] != $conversation["startMemberId"] or $member["type"] != "member") { $name .= "<a href='" . URL("conversation/removeMember/{$conversation["conversationId"]}?{$member["type"]}={$member["id"]}&token=" . ET::$session->token) . "' class='deleteLink' data-type='{$member["type"]}' data-id='{$member["id"]}'>{$member["name"]}</a>"; } else { $name .= $member["name"]; } } else { $name .= $member["type"] == "member" ? memberLink($member["id"], $member["name"]) : groupLink($member["name"]);
?> <td><?php echo $form->checkbox("permissions[{$id}][{$k}]", array("class" => "permission-{$k}")); ?> </td> <?php } ?> </tr> <?php } ?> <tr id='permissions-administrators'> <th><?php echo groupName("administrator", true); ?> </th> <?php foreach ($data["permissions"] as $k => $v) { ?> <td><input type='checkbox' checked='checked' disabled='disabled'/></td> <?php } ?> </tr> </tbody> </table> <div class='subText' id='permissions-copy'><?php
echo $form->select("account", $options); ?> </li> <li id='permissionGroups'><label><?php echo T("Groups"); ?> </label> <div class='checkboxGroup'> <?php foreach ($data["groups"] as $group) { ?> <label class='checkbox'> <?php echo $form->checkbox("groups[]", array("value" => $group["groupId"]) + (isset($member["groups"][$group["groupId"]]) ? array("checked" => "checked") : array())); echo groupName($group["name"]); ?> </label> <?php } ?> </div> </li> </ul> </div> <div class='section' id='permissionInfo'> <?php $this->renderView("member/permissionInfo", $data); ?>
array_push($newval, sprintf('%0' . $checkboxgroup_storesize . 'd', $fieldval)); } $value = join(",", $newval); } else { $value = ""; } Sql_Query(sprintf('replace into %s (userid,attributeid,value) values(%d,%d,"%s")', $tables["user_attribute"], $id, $val, $value)); } } if ($usegroups) { Sql_Query("delete from user_group where userid = {$id}"); if (is_array($_POST["groups"])) { foreach ($_POST["groups"] as $group) { Sql_Query(sprintf('insert into user_group (userid,groupid) values(%d,%d)', $id, $group)); print "<br/>" . $GLOBALS['I18N']->get('User added to group') . ' ' . groupName($group); } } } # submitting page now saves everything, so check is not necessary if ($subselect == "") { Sql_Query("delete from {$tables["listuser"]} where userid = {$id}"); } else { # only unsubscribe from the lists of this admin $req = Sql_Query("select id from {$tables["list"]} {$subselect_where}"); while ($row = Sql_Fetch_Row($req)) { Sql_Query("delete from {$tables["listuser"]} where userid = {$id} and listid = {$row['0']}"); } } if (is_array($_POST["subscribe"])) { foreach ($_POST["subscribe"] as $ind => $lst) {
echo "</table>"; } else { //No users? Register then! echo "<p>No users registered on the system, please <a href='./?page=register'>Register</a></p>"; } ?> <?php if (mysqli_num_rows($permissions) > 0) { echo "<h2>Group Management</h2>"; if (mysqli_num_rows($groups) > 0) { print "\n <table border=\"1\">\n <tr>\n <td>Group ID</td>\n <td>Group Name</td>\n <td>Permission Name</td>\n <td>Edit</td>\n <td>Delete</td>\n </tr>"; while ($info = mysqli_fetch_array($groups)) { echo "<trstyle='background-color:#000000;'>"; echo "<td>" . $info['groupID'] . "</td>"; echo "<td>" . $info['groupName'] . "</td>"; echo groupName($db, $info['permissionID']); echo '<td><a href="./?page=edit_group&id=' . $info['groupID'] . '">Edit</a></td>'; echo groupInUse($db, $info['groupID'], "Row"); echo "</tr>"; } echo "</table>"; } else { echo "<p>No groups registered add one below:</p>"; } echo "<h2>Add Group</h2>"; include "includes/group/add_group.php"; } ?> <h2>Permissions Management</h2> <?php
</li> <li class='sep'></li> <li> <label><?php echo T("Member groups"); ?> </label> <div class='subText'><?php echo T("Groups can be used to categorize members and give them certain privileges."); ?> </div> <?php foreach ($groups as $k => $v) { $groups[$k] = "<strong class='group-{$v["name"]}'>" . groupName($v["name"]) . "</strong>"; } echo implode(", ", $groups); ?> <br/> <a href='<?php echo URL("admin/groups"); ?> ' id='manageGroupsLink'><?php echo T("Manage Groups"); ?> </a> </li> <li class='sep'></li>
/** * Return a group's name wrapped in an anchor linking to a list of members in that group. * * @param string $group The name of the group. * @return string */ function groupLink($group) { return "<a href='" . URL("members/?search=" . urlencode($group)) . "'>" . groupName($group, true) . "</a>"; }
} $c++; } } else { $current_groups = array(); if ($id) { $req = Sql_Query("select groupid,type from user_group where userid = {$id}"); $groupsHTML .= '<ol>'; while ($row = Sql_Fetch_Assoc($req)) { ## the config needs to start real types with 1, type index 0 will be considered no-value $membership_type = $GLOBALS['config']['usergroup_types'][$row['type']]; if (empty($membership_type) || empty($row['type'])) { # $membership_type = 'undefined'; an entry "undefined of everyone" was showing in the backend continue; } $groupname = groupName($row['groupid']); $deleteLink = ''; if (strtolower($groupname) != 'everyone') { $deleteLink = PageLink2('user&id=' . $id . '&delgroup=' . $row['groupid'] . '&deltype=' . $row['type'], 'del'); } $groupsHTML .= sprintf('<li><strong>%s</strong> of <i>%s</i> %s</li>', $membership_type, $groupname, $deleteLink); } $groupsHTML .= '</ol>'; } $req = Sql_Query('select * from groups where name != "everyone"'); $c = 1; while ($row = Sql_Fetch_array($req)) { $groups[$row['id']] = $row['name']; } $groupsHTML .= '<hr/>Add new group membership:<br/><br/>'; $groupsHTML .= '<select name="newgrouptype">';