";
extract($HTTP_GET_VARS);
if (isset($HTTP_POST_VARS)) {
foreach ($HTTP_POST_VARS as $key => $value) {
${$key} = $value;
}
}
if (!$op)
{
// No opcode passed. Show list of private forums.
?>
prefix("bb_forum_access")." (forum_id, user_id, can_post) VALUES ($forum, $curr_userid, 0)";
if (!$result = $xoopsDB->query($sql))
{
echo"";
xoops_cp_footer();
exit();
}
}
}
$op = "showform";
}
else if ($op == "deluser")
{
// Remove a user from the list for this forum.
$sql = sprintf("DELETE FROM %s WHERE forum_id = %u AND user_id = %u", $xoopsDB->prefix("bb_forum_access"), $forum, $op_userid);
if (!$result = $xoopsDB->query($sql))
{
echo"";
xoops_cp_footer();
exit();
}
$op = "showform";
}
else if ($op == "clearusers")
{
// Remove all users from the list for this forum.
$sql = sprintf("DELETE FROM %s WHERE forum_id = %u", $xoopsDB->prefix("bb_forum_access"), $forum);
if (!$result = $xoopsDB->query($sql))
{
echo"";
xoops_cp_footer();
exit();
}
$op = "showform";
}
else if ($op == "grantuserpost")
{
// Add posting rights for this user in this forum.
$sql = sprintf("UPDATE %s SET can_post=1 WHERE forum_id = %u AND user_id = %u", $xoopsDB->prefix("bb_forum_access"), $forum, $op_userid);
if (!$result = $xoopsDB->query($sql))
{
echo"";
xoops_cp_footer();
exit();
}
$op = "showform";
}
else if ($op == "revokeuserpost")
{
// Revoke posting rights for this user in this forum.
$sql = "UPDATE ".$xoopsDB->prefix("bb_forum_access")." SET can_post=0 WHERE forum_id = $forum AND user_id = $op_userid";
if (!$result = $xoopsDB->query($sql))
{
echo"";
xoops_cp_footer();
exit();
}
$op = "showform";
}
// We want this one to be available even after one of the above blocks has executed.
// The above blocks will set $op to "showform" on success, so it goes right back to the form.
// Neato. This is really slick.
if ($op == "showform")
{
// Show the form for the given forum.
$sql = "SELECT forum_name FROM ".$xoopsDB->prefix("bb_forums")." WHERE forum_id = $forum";
if ((!$result = $xoopsDB->query($sql)) || ($forum == -1))
{
echo"";
xoops_cp_footer();
exit();
}
$forum_name = "";
if ($row = $xoopsDB->fetchArray($result))
{
$forum_name = $myts->makeTboxData4Show($row['forum_name']);
}
?>
";
xoops_cp_footer();
exit();
}
$current_users = Array();
while ($row = $xoopsDB->fetchArray($result))
{
$current_users[] = $row[uid];
}
$sql = "SELECT uid, uname FROM ".$xoopsDB->prefix("users")." WHERE (uid > 0 AND level > 0)";
while(list($null, $curr_userid) = each($current_users))
{
$sql .= "AND (uid != $curr_userid) ";
}
$sql .= "ORDER BY uname ASC";
if (!$result = $xoopsDB->query($sql))
{
echo"
";
xoops_cp_footer();
exit();
}
while ($row = $xoopsDB->fetchArray($result))
{
?>
prefix("users")." u, ".$xoopsDB->prefix("bb_forum_access")." f WHERE u.uid = f.user_id AND f.forum_id = $forum ORDER BY u.uid ASC";
if (!$result = $xoopsDB->query($sql))
{
echo"