2006-06-16 23:53:56 +00:00
< ? php
2008-08-05 22:43:14 +00:00
// This file is part of BOINC.
// http://boinc.berkeley.edu
2014-04-18 22:54:28 +00:00
// Copyright (C) 2014 University of California
2008-08-05 22:43:14 +00:00
//
// BOINC is free software; you can redistribute it and/or modify it
// under the terms of the GNU Lesser General Public License
// as published by the Free Software Foundation,
// either version 3 of the License, or (at your option) any later version.
//
// BOINC is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
// See the GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with BOINC. If not, see <http://www.gnu.org/licenses/>.
2006-06-16 23:53:56 +00:00
2007-11-12 20:57:15 +00:00
// Forum index
// shows the categories and the forums in each category
2006-06-16 23:53:56 +00:00
2007-11-12 20:57:15 +00:00
require_once ( '../inc/forum.inc' );
require_once ( '../inc/pm.inc' );
require_once ( '../inc/time.inc' );
2007-07-18 15:48:07 +00:00
2011-02-09 22:11:34 +00:00
check_get_args ( array ( " read " , " return " , " tnow " , " ttok " ));
2007-11-12 20:57:15 +00:00
$user = get_logged_in_user ( false );
2014-04-18 22:54:28 +00:00
BoincForumPrefs :: lookup ( $user );
if ( DISABLE_FORUMS && ! is_admin ( $user )) {
error_page ( " Forums are disabled " );
}
2007-11-12 20:57:15 +00:00
2007-12-01 01:22:14 +00:00
// Process request to mark all posts as read
//
2007-11-12 20:57:15 +00:00
if (( get_int ( " read " , true ) == 1 )) {
if ( $user ) {
check_tokens ( $user -> authenticator );
$now = time ();
$user -> prefs -> update ( " mark_as_read_timestamp= $now " );
Header ( " Location: " . get_str ( " return " , true ));
}
2007-07-18 15:48:07 +00:00
}
2007-04-29 14:22:28 +00:00
2016-12-07 19:32:25 +00:00
function show_forum_summary ( $forum ) {
2007-11-16 01:14:55 +00:00
switch ( $forum -> parent_type ) {
case 0 :
$t = $forum -> title ;
$d = $forum -> description ;
break ;
case 1 :
$team = BoincTeam :: lookup_id ( $forum -> category );
2007-11-16 22:23:16 +00:00
$t = $forum -> title ;
if ( ! strlen ( $t )) $t = $team -> name ;
$d = $forum -> description ;
2011-08-25 22:12:48 +00:00
if ( ! strlen ( $d )) $d = tra ( " Discussion among members of %1 " , $team -> name );
2007-11-16 01:14:55 +00:00
break ;
}
2007-10-22 19:36:01 +00:00
echo "
2016-11-11 20:36:27 +00:00
< tr >
2006-06-16 23:53:56 +00:00
< td >
2008-08-12 17:08:14 +00:00
< a href = \ " forum_forum.php?id= $forum->id\ " > $t </ a >
2014-10-02 19:15:54 +00:00
< br >< small > $d </ small >
2006-06-16 23:53:56 +00:00
</ td >
2016-11-11 20:36:27 +00:00
< td > $forum -> threads </ td >
< td > $forum -> posts </ td >
< td > " .time_diff_str( $forum->timestamp , time()). " </ td >
2007-10-22 19:36:01 +00:00
</ tr > " ;
2006-06-16 23:53:56 +00:00
}
2016-11-11 20:36:27 +00:00
page_head ( tra ( " Message boards " ));
2006-07-28 19:02:48 +00:00
2007-11-15 00:27:02 +00:00
show_forum_header ( $user );
2006-06-16 23:53:56 +00:00
2014-09-24 16:38:19 +00:00
if ( defined ( 'FORUM_QA_MERGED_MODE' ) && FORUM_QA_MERGED_MODE ){
2009-01-25 12:17:24 +00:00
$categories = BoincCategory :: enum ( " true order by orderID " );
} else {
2010-11-04 18:20:57 +00:00
echo " <p> "
2017-07-04 11:13:01 +00:00
. tra ( " If you have a question or problem, please use the %1 Questions & Answers %2 section of the message boards. " , " <a href= \" forum_help_desk.php \" > " , " </a> " )
2010-11-04 18:20:57 +00:00
. " </p> "
;
2009-01-25 12:17:24 +00:00
$categories = BoincCategory :: enum ( " is_helpdesk=0 order by orderID " );
}
2007-11-15 00:27:02 +00:00
$first = true ;
2007-11-12 20:57:15 +00:00
foreach ( $categories as $category ) {
2007-11-15 00:27:02 +00:00
if ( $first ) {
$first = false ;
2010-11-04 18:20:57 +00:00
echo " <p> " ;
2007-11-15 00:27:02 +00:00
show_forum_title ( $category , NULL , NULL );
2007-11-20 19:23:26 +00:00
echo " <p> " ;
2008-09-27 08:19:30 +00:00
show_mark_as_read_button ( $user );
2016-12-08 02:46:11 +00:00
start_table ( 'table-striped' );
2018-05-29 07:26:26 +00:00
row_heading_array (
array (
tra ( " Topic " ),
tra ( " Threads " ),
tra ( " Posts " ),
tra ( " Last post " )
),
array ( " width=30% " , " " , " " , " " )
);
2007-11-15 00:27:02 +00:00
}
if ( strlen ( $category -> name )) {
echo '
2016-11-11 20:36:27 +00:00
< tr >
2016-11-15 05:58:12 +00:00
< th class = " info " colspan = " 4 " > '.$category->name.' </ th >
2007-11-15 00:27:02 +00:00
</ tr >
' ;
}
2007-11-12 20:57:15 +00:00
$forums = BoincForum :: enum ( " parent_type=0 and category= $category->id order by orderID " );
foreach ( $forums as $forum ) {
2016-12-07 19:32:25 +00:00
show_forum_summary ( $forum );
2007-11-16 01:14:55 +00:00
}
}
if ( $user && $user -> teamid ) {
$forum = BoincForum :: lookup ( " parent_type=1 and category= $user->teamid " );
if ( $forum ) {
2016-12-07 19:32:25 +00:00
show_forum_summary ( $forum );
2006-06-16 23:53:56 +00:00
}
}
end_table ();
2007-11-22 04:13:59 +00:00
if ( $user ) {
$subs = BoincSubscription :: enum ( " userid= $user->id " );
if ( count ( $subs )) {
2016-11-11 20:36:27 +00:00
echo " <p><h3> " . tra ( " Subscribed threads " ) . " </h3><p> " ;
2007-11-22 04:13:59 +00:00
show_thread_and_context_header ();
foreach ( $subs as $sub ) {
$thread = BoincThread :: lookup_id ( $sub -> threadid );
2008-04-21 14:04:01 +00:00
if ( ! $thread ) {
BoincSubscription :: delete ( $user -> id , $sub -> threadid );
continue ;
}
2007-11-22 04:13:59 +00:00
if ( $thread -> hidden ) continue ;
2016-12-07 19:32:25 +00:00
show_thread_and_context ( $thread , $user );
2007-11-22 04:13:59 +00:00
}
end_table ();
}
}
2006-06-16 23:53:56 +00:00
page_tail ();
2007-11-12 20:57:15 +00:00
BoincForumLogging :: cleanup ();
$cvs_version_tracker [] = " \$ Id $ " ; //Generated automatically - do not edit
2006-06-16 23:53:56 +00:00
?>