Do not show hidden threads to logged out users

svn path=/trunk/boinc/; revision=11749
This commit is contained in:
Rytis Slatkevičius 2006-12-30 18:35:25 +00:00
parent 5f53916665
commit 6342a7e3a0
2 changed files with 81 additions and 72 deletions

View File

@ -13896,3 +13896,9 @@ David 30 Dec 2006
sched/
start
Rytis 30 Dec 2006
- Forum: do not show hidden threads when the user is logged out.
html/user/
forum_thread.php

View File

@ -17,12 +17,23 @@ if ($filter != "false"){
$filter = false;
}
$logged_in_user = re_get_logged_in_user(false);
// Fetch the thread and increment the number of views
$thread = new Thread($threadid);
if ($thread->isHidden()) {
if ((!$logged_in_user) || (($logged_in_user) && (!$logged_in_user->isSpecialUser(S_MODERATOR)))) {
/* If the user logged in is a moderator, show him the
* thread if he goes so far as to name it by ID like this.
* Otherwise, hide the thread.
*/
error_page(tr(FORUM_THREAD_HIDDEN));
}
}
$forum = $thread->getForum();
$category = $forum->getCategory();
$logged_in_user = re_get_logged_in_user(false);
$title = cleanup_title($thread->getTitle());
if (!$sort_style) {
@ -54,18 +65,12 @@ if ($logged_in_user && $logged_in_user->hasJumpToUnread()){
$is_subscribed = $logged_in_user && $thread->isSubscribed($logged_in_user);
show_forum_title($forum, $thread);
if (($thread->isHidden()) && $logged_in_user && (!$logged_in_user->isSpecialUser(S_MODERATOR))) {
/* If the user logged in is a moderator, show him the
* thread if he goes so far as to name it by ID like this.
* Otherwise, hide the thread.
*/
error_page(tr(FORUM_THREAD_HIDDEN));
} else {
if ($thread->getType()!=0 && $thread->getStatus()==0){
$thread_owner = $thread->getOwner();
if ($logged_in_user){
if ($thread_owner->getID() == $logged_in_user->getID()){
if ($thread->getPostCount()==0){} else {
if ($thread->getPostCount()!=0) {
// Show a "this question has been answered" to the author
echo "<div class=\"helpdesk_note\">
<form action=\"forum_thread_status.php\"><input type=\"hidden\" name=\"id\" value=\"".$thread->getID()."\">
@ -142,7 +147,5 @@ if (($thread->isHidden()) && $logged_in_user && (!$logged_in_user->isSpecialUser
show_forum_title($forum, $thread);
$thread->incViews();
}
page_tail();
?>