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
// Copyright (C) 2008 University of California
//
// 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 );
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 );
BoincForumPrefs :: lookup ( $user );
$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
2008-08-07 20:43:52 +00:00
function show_forum_summary ( $forum , $i ) {
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 ;
if ( ! strlen ( $d )) $d = " Discussion among members of $team->name " ;
2007-11-16 01:14:55 +00:00
break ;
}
2008-08-07 20:43:52 +00:00
$j = $i % 2 ;
2007-10-22 19:36:01 +00:00
echo "
2008-08-07 20:43:52 +00:00
< tr class = \ " row $j\ " >
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 >
2007-11-16 01:14:55 +00:00
< br >< span class = \ " smalltext \" > $d </span>
2006-06-16 23:53:56 +00:00
</ td >
2008-08-12 17:08:14 +00:00
< td class = \ " numbers \" > $forum->threads </td>
< td class = \ " numbers \" > $forum->posts </td>
< td class = \ " lastpost \" > " . time_diff_str ( $forum -> timestamp , time ()) . " </td>
2007-10-22 19:36:01 +00:00
</ tr > " ;
2006-06-16 23:53:56 +00:00
}
2007-11-02 14:43:02 +00:00
page_head ( tra ( " %1 Message boards " , PROJECT ));
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
2009-01-25 12:17:24 +00:00
if ( FORUM_QA_MERGED_MODE === true ){
$categories = BoincCategory :: enum ( " true order by orderID " );
} else {
2010-11-04 18:20:57 +00:00
echo " <p> "
. tra ( " If you have a question or problem, please use the %1Questions & Answers%2 section of the message boards. " , " <a href= \" forum_help_desk.php \" > " , " </a> " )
. " </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 );
2011-02-10 22:45:39 +00:00
start_forum_table ( array (
tra ( " Topic " ),
tra ( " Threads " ),
tra ( " Posts " ),
tra ( " Last post " )
));
2007-11-15 00:27:02 +00:00
}
if ( strlen ( $category -> name )) {
echo '
< tr class = " subtitle " >
2007-11-12 20:57:15 +00:00
< td class = " category " colspan = " 4 " > '.$category->name.' </ td >
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 " );
2008-08-07 20:43:52 +00:00
$i = 0 ;
2007-11-12 20:57:15 +00:00
foreach ( $forums as $forum ) {
2008-08-07 20:43:52 +00:00
show_forum_summary ( $forum , $i ++ );
2007-11-16 01:14:55 +00:00
}
}
if ( $user && $user -> teamid ) {
$forum = BoincForum :: lookup ( " parent_type=1 and category= $user->teamid " );
if ( $forum ) {
2008-08-07 20:43:52 +00:00
show_forum_summary ( $forum , $i ++ );
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 )) {
2008-08-07 20:43:52 +00:00
echo " <p><span class=title>Subscribed threads</span><p> " ;
2007-11-22 04:13:59 +00:00
show_thread_and_context_header ();
2008-08-07 20:43:52 +00:00
$i = 0 ;
2007-11-22 04:13:59 +00:00
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 ;
2008-08-07 20:43:52 +00:00
show_thread_and_context ( $thread , $user , $i ++ );
2007-11-22 04:13:59 +00:00
}
end_table ();
}
}
2006-06-16 23:53:56 +00:00
page_tail ();
flush ();
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
?>