diff --git a/checkin_notes b/checkin_notes index 4d72775ed3..093c49fab7 100644 --- a/checkin_notes +++ b/checkin_notes @@ -11623,3 +11623,17 @@ David 23 Nov 2007 team_types.inc ops/ team_import.php + +David 24 Nov 2007 + - user web: add config option. + If set, only team members can see team forums + + html/ + inc/ + forum.inc + team.inc + user/ + forum_search.php + forum_thread.php + forum_forum.php + forum_search_action.php diff --git a/doc/links.php b/doc/links.php index 6261792d9f..2b3baef4cc 100644 --- a/doc/links.php +++ b/doc/links.php @@ -227,6 +227,7 @@ language("Finnish", array( //), )); language("French", array( + site("http://wwww.boinc-2tf.org", "2TF Asso"), site("http://boincfrance.org", "BOINCFRANCE.ORG"), site("http://www.boinc-af.org", "L'Alliance Francophone"), site("http://boinc-quebec.org", "boinc-quebec.org") diff --git a/html/inc/forum.inc b/html/inc/forum.inc index 736d9a6c11..984d85eda1 100644 --- a/html/inc/forum.inc +++ b/html/inc/forum.inc @@ -997,9 +997,10 @@ function show_thread_and_context_header() { // show a 1-line summary of thread and its forum. // Used for search results and subscription list // -function show_thread_and_context($thread) { +function show_thread_and_context($thread, $user) { $thread_forum = BoincForum::lookup_id($thread->forum); - if (!$thread_forum) continue; + if (!$thread_forum) return; + if (!is_forum_visible_to_user($thread_forum, $user)) return; $owner = BoincUser::lookup_id($thread->owner); echo "\n"; switch($thread_forum->parent_type) { @@ -1029,4 +1030,15 @@ function is_subscribed($thread, $subs) { return false; } +function is_forum_visible_to_user($forum, $user) { + if ($forum->parent_type == 1) { + if (parse_config(get_config(), "")) { + if (!$user) return false; + if ($user->teamid != $forum->category) return false; + } + } + return true; +} + + ?> diff --git a/html/inc/team.inc b/html/inc/team.inc index 208f1309ea..6af4486692 100644 --- a/html/inc/team.inc +++ b/html/inc/team.inc @@ -3,6 +3,7 @@ require_once("../inc/util.inc"); require_once("../inc/boinc_db.inc"); require_once("../inc/forum_db.inc"); +require_once("../inc/forum.inc"); require_once("../inc/sanitize_html.inc"); require_once("../inc/countries.inc"); require_once("../inc/credit.inc"); @@ -75,7 +76,8 @@ function display_team_page($team, $user) { row2("Recent average credit", format_credit_large($team->expavg_credit)); row2("Country", $team->country); row2("Type", team_type_name($team->type)); - if ($team->forum) { + + if ($team->forum && is_forum_visible_to_user($team->forum, $user)) { $f = $team->forum; row2("id>Message board", "Threads: $f->threads
Posts: $f->posts
Last post: ".time_diff_str($f->timestamp, time()) diff --git a/html/user/forum_forum.php b/html/user/forum_forum.php index 33ac23f9cd..3e86d14e42 100644 --- a/html/user/forum_forum.php +++ b/html/user/forum_forum.php @@ -14,6 +14,11 @@ if (!$start) $start = 0; $forum = BoincForum::lookup_id($id); $user = get_logged_in_user(false); + +if (!is_forum_visible_to_user($forum, $user)) { + error_page("Not visible"); +} + BoincForumPrefs::lookup($user); if (!$sort_style) { diff --git a/html/user/forum_search.php b/html/user/forum_search.php index 06d94a5fb4..282f5aa992 100644 --- a/html/user/forum_search.php +++ b/html/user/forum_search.php @@ -39,7 +39,7 @@ if (get_str("forumid",true)){ $forumlist=""; $categories = BoincCategory::enum(); foreach ($categories as $category) { - $forums = BoincForum::enum("category=$category->id"); + $forums = BoincForum::enum("parent_type=0 and category=$category->id"); foreach ($forums as $forum) { if ($forum->id==$forumid){ $forumlist.=""; diff --git a/html/user/forum_search_action.php b/html/user/forum_search_action.php index 654e234ef2..4679e8590d 100644 --- a/html/user/forum_search_action.php +++ b/html/user/forum_search_action.php @@ -147,7 +147,7 @@ if (count($threads)){ show_thread_and_context_header(); foreach ($threads as $thread){ if ($thread->hidden) continue; - show_thread_and_context($thread); + show_thread_and_context($thread, $logged_in_user); } end_table(); echo "

"; @@ -172,6 +172,7 @@ if (count($posts)){ if (!$thread) continue; $forum = BoincForum::lookup_id($thread->forum); if (!$forum) continue; + if (!is_forum_visible_to_user($forum, $logged_in_user)) continue; if (($show_hidden_posts == false) && ($thread->hidden)) continue; if (($show_hidden_posts == false) && ($post->hidden)) continue; diff --git a/html/user/forum_thread.php b/html/user/forum_thread.php index 6fc0687214..0f2cd13729 100644 --- a/html/user/forum_thread.php +++ b/html/user/forum_thread.php @@ -24,6 +24,10 @@ if ($logged_in_user) { $thread = BoincThread::lookup_id($threadid); $forum = BoincForum::lookup_id($thread->forum); +if (!is_forum_visible_to_user($forum, $logged_in_user)) { + error_page("Not visible"); +} + if ($thread->hidden) { if (!is_moderator($logged_in_user, $forum)) { error_page(