From b8a69e8c939dfb6278077cc88d8213f13207c568 Mon Sep 17 00:00:00 2001 From: "Paul S. Owen" Date: Sun, 3 Jun 2001 02:09:33 +0000 Subject: [PATCH] Some basic Forum Auth control git-svn-id: file:///svn/phpbb/trunk@415 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/admin/forumauth.php | 280 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 280 insertions(+) create mode 100644 phpBB/admin/forumauth.php diff --git a/phpBB/admin/forumauth.php b/phpBB/admin/forumauth.php new file mode 100644 index 0000000000..d1ea8f5d2d --- /dev/null +++ b/phpBB/admin/forumauth.php @@ -0,0 +1,280 @@ + array(0, 0, 0, 0, 0, 0, 0, 0, 0), + 1 => array(0, 0, 1, 1, 1, 1, 1, 1, 1), + 2 => array(1, 1, 1, 1, 1, 1, 1, 1, 1), + 3 => array(0, 2, 2, 2, 2, 2, 2, 2, 2), + 4 => array(2, 2, 2, 2, 2, 2, 2, 2, 2), + 5 => array(0, 3, 3, 3, 3, 3, 3, 3, 3), + 6 => array(3, 3, 3, 3, 3, 3, 3, 3, 3), + 7 => array(0, 0, 3, 0, 0, 0, 3, 3, 3), + 8 => array(0, 0, 3, 1, 0, 0, 3, 3, 3) +); + +$simple_auth_types = array("Public", "Registered", "Registered [Hidden]", "Private", "Private_[Hidden]", "Moderators", "Moderators [Hidden]", "Mod Post, All Reply", "Mod Post, Reg Reply"); + +$forum_auth_levels = array("ALL", "REG", "ACL", "MOD", "ADMIN"); +$forum_auth_const = array(AUTH_ALL, AUTH_REG, AUTH_ACL, AUTH_MOD, AUTH_ADMIN); + +$forum_auth_fields = array("auth_view", "auth_read", "auth_post", "auth_reply", "auth_edit", "auth_delete", "auth_votecreate", "auth_vote", "auth_attachments"); + +if(isset($HTTP_GET_VARS[POST_FORUM_URL])) +{ + $forum_id = $HTTP_GET_VARS[POST_FORUM_URL]; + $forum_sql = "WHERE forum_id = $forum_id"; +} +else +{ + $forum_sql = ""; +} + +// +// Start output +// +$sql = "SELECT * + FROM ".FORUMS_TABLE." + $forum_sql + ORDER BY forum_id ASC"; +$f_result = $db->sql_query($sql); + +$forum_rows = $db->sql_fetchrowset($f_result); + +$sql = "SELECT f.forum_id, u.username, u.user_id + FROM ".FORUMS_TABLE." f, ".USERS_TABLE." u, ".USER_GROUP_TABLE." ug, ".AUTH_ACCESS_TABLE." aa + WHERE aa.forum_id = f.forum_id + AND aa.auth_mod = 1 + AND ug.group_id = aa.group_id + AND u.user_id = ug.user_id + ORDER BY f.forum_id, u.user_id"; +if(!$q_forum_mods = $db->sql_query($sql)) +{ + error_die(SQL_QUERY, "Could not query forum moderator information.", __LINE__, __FILE__); +} +$forum_mods_list = $db->sql_fetchrowset($q_forum_mods); + +for($i = 0; $i < count($forum_mods_list); $i++) +{ + $forum_mods['forum_'.$forum_mods_list[$i]['forum_id'].'_name'][] = $forum_mods_list[$i]['username']; + $forum_mods['forum_'.$forum_mods_list[$i]['forum_id'].'_id'][] = $forum_mods_list[$i]['user_id']; +} + +// +// Show data +// +?> + + + +phpBB - auth testing + + + + +

Forum Authorisation Control

+ + +

Forum :

+ + +
+ + + + + + +".preg_replace("/auth_/", "", $forum_auth_fields[$j])."\n"; + } +?> + +" . $forum_rows[$i]['forum_name'] . ""; + + unset($moderators_links); + for($mods = 0; $mods < count($forum_mods['forum_'.$forum_rows[$i]['forum_id'].'_id']); $mods++) + { + if(isset($moderators_links)) + { + $moderators_links .= ", "; + } + if(!($mods % 2) && $mods != 0) + { + $moderators_links .= "
"; + } + $moderators_links .= "".$forum_mods['forum_'.$forum_rows[$i]['forum_id'].'_name'][$mods].""; + } + + reset($simple_auth_ary); + while(list($key, $auth_levels) = each($simple_auth_ary)) + { + $matched = 1; + for($k = 0; $k < count($auth_levels); $k++) + { + $matched_type = $key; + if($forum_rows[$i][$forum_auth_fields[$k]] != $auth_levels[$k]) + { + $matched = 0; + } + } + if($matched) + break; + } + + // + // Determine whether the current + // forum auth fields match a preset 'simple' + // type + // + $simple_auth = (isset($forum_id)) ? "" : ""; + + // + // Output values of individual + // fields + // + for($j = 0; $j < count($forum_auth_fields); $j++) + { + $custom_auth[$j] = (isset($forum_id)) ? "" : ""; + + } + + echo "\n"; + + if(empty($forum_id)) + { + echo "\n"; + echo "\n"; + } + echo "\n"; + + for($j = 0; $j < count($custom_auth); $j++) + { + echo "\n"; + } + + echo "\n"; + + } + + if(isset($forum_id)) + { +?> + + + + + +
Forum TitleModerator/sSimple Auth
".$forum_name."".$moderators_links."".$simple_auth."".$custom_auth[$j]."
+ + + + + +
+ + +
+
+Powered By phpBB +
+ +Copyright © 2001 phpBB Group, All Rights Reserved +
+ + + \ No newline at end of file