2006-06-16 23:53:56 +00:00
|
|
|
<?php
|
|
|
|
|
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
|
|
|
|
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
|
|
|
|
2007-11-16 01:14:55 +00:00
|
|
|
function show_forum_summary($forum) {
|
|
|
|
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;
|
|
|
|
}
|
2007-10-22 19:36:01 +00:00
|
|
|
echo "
|
|
|
|
<tr class=\"row1\">
|
2006-06-16 23:53:56 +00:00
|
|
|
<td>
|
|
|
|
<em>
|
2007-11-16 01:14:55 +00:00
|
|
|
<a href=\"forum_forum.php?id=$forum->id\">$t
|
2006-06-16 23:53:56 +00:00
|
|
|
</a></em>
|
2007-11-16 01:14:55 +00:00
|
|
|
<br><span class=\"smalltext\">$d</span>
|
2006-06-16 23:53:56 +00:00
|
|
|
</td>
|
2007-11-12 20:57:15 +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
|
|
|
}
|
|
|
|
|
2007-11-02 14:43:02 +00:00
|
|
|
page_head(tra("%1 Message boards", PROJECT));
|
2006-07-28 19:02:48 +00:00
|
|
|
|
|
|
|
echo "
|
|
|
|
<p>
|
|
|
|
If you have a question or problem, please use the
|
|
|
|
<a href=forum_help_desk.php>Questions & answers</a>
|
|
|
|
area instead of the Message boards.
|
2007-02-24 16:05:41 +00:00
|
|
|
</p>
|
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
|
|
|
|
2007-11-12 20:57:15 +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;
|
|
|
|
show_forum_title($category, NULL, NULL);
|
2007-12-01 01:22:14 +00:00
|
|
|
if ($user) {
|
|
|
|
$return = urlencode(current_url());
|
|
|
|
$tokens = url_tokens($user->authenticator);
|
|
|
|
$url = "forum_index.php?read=1$tokens&return=$return";
|
|
|
|
show_button($url, "Mark all threads as read", "Mark all threads in all message boards as 'read'.");
|
|
|
|
}
|
|
|
|
|
2007-11-20 19:23:26 +00:00
|
|
|
echo "<p>";
|
2007-11-15 00:27:02 +00:00
|
|
|
start_forum_table(
|
|
|
|
array(tra("Topic"), tra("Threads"), tra("Posts"), tra("Last post"))
|
|
|
|
);
|
|
|
|
}
|
|
|
|
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");
|
|
|
|
foreach ($forums as $forum) {
|
2007-11-16 01:14:55 +00:00
|
|
|
show_forum_summary($forum);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($user && $user->teamid) {
|
|
|
|
$forum = BoincForum::lookup("parent_type=1 and category=$user->teamid");
|
|
|
|
if ($forum) {
|
|
|
|
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)) {
|
|
|
|
echo "<h3>Subscribed threads</h2>";
|
|
|
|
show_thread_and_context_header();
|
|
|
|
foreach ($subs as $sub) {
|
|
|
|
$thread = BoincThread::lookup_id($sub->threadid);
|
|
|
|
if ($thread->hidden) continue;
|
2007-11-25 04:52:01 +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();
|
|
|
|
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
|
|
|
?>
|