mirror of https://github.com/BOINC/boinc.git
- user web: add <team_forums_members_only> config option.
If set, only team members can see team forums svn path=/trunk/boinc/; revision=14297
This commit is contained in:
parent
17949271a1
commit
fc2784895d
|
@ -11623,3 +11623,17 @@ David 23 Nov 2007
|
|||
team_types.inc
|
||||
ops/
|
||||
team_import.php
|
||||
|
||||
David 24 Nov 2007
|
||||
- user web: add <team_forums_members_only> 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
|
||||
|
|
|
@ -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")
|
||||
|
|
|
@ -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 "<tr><td>\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(), "<team_forums_members_only>")) {
|
||||
if (!$user) return false;
|
||||
if ($user->teamid != $forum->category) return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
|
|
|
@ -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("<a href=team_forum.php?teamid=$team->id>Message board</a>",
|
||||
"Threads: $f->threads<br>Posts: $f->posts<br>Last post: ".time_diff_str($f->timestamp, time())
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -39,7 +39,7 @@ if (get_str("forumid",true)){
|
|||
$forumlist="<option value=\"-1\">All</option>";
|
||||
$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.="<option selected value=\"".$forum->id."\">".$forum->title."</option>";
|
||||
|
|
|
@ -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 "<br /><br />";
|
||||
|
@ -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;
|
||||
|
|
|
@ -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(
|
||||
|
|
Loading…
Reference in New Issue