.
function news_item($date, $title, $post) {
echo "
";
if ($title) {
echo "$title
\n";
}
$d = time_str($date);
$options = new output_options();
$options->htmlitems = false;
if (is_string($post)) {
$forum_link = false;
$text = output_transform($post, $options);
} else {
$forum_link = true;
$text = output_transform($post->content, $options);
}
echo "
$text
$d
";
if ($forum_link && !DISABLE_FORUMS) {
echo "
· thread\"> ".tra("Discuss")."
";
}
echo "
";
}
function news_forum() {
if (defined("NEWS_FORUM_NAME")) {
$forum_name = NEWS_FORUM_NAME;
} else {
$forum_name = "News";
}
return BoincForum::lookup("parent_type=0 and title = '$forum_name'");
}
function is_news_forum($forum) {
if (defined("NEWS_FORUM_NAME")) {
$forum_name = NEWS_FORUM_NAME;
} else {
$forum_name = "News";
}
return $forum->parent_type == 0 && ($forum->title === $forum_name);
}
function show_news($start, $count) {
$forum = news_forum();
if (!$forum) {
echo "
No news forum. Run html/ops/create_forums.php.
";
return;
}
if (is_array($start)) {
echo "You have not changed show_news() to use 0 instead of
deprecated \$project_news as the first param.";
return;
}
$lim = "";
if ($start) {
if ($count) {
$lim = "limit $start, $count";
} else {
$lim = "limit $start, 99999999";
}
} else if ($count) {
$lim = "limit $count";
}
$threads = BoincThread::enum("forum = $forum->id and hidden=0 order by id desc $lim");
foreach ($threads as $thread) {
$posts = BoincPost::enum("thread=$thread->id order by id limit 1");
$post = $posts[0];
if (strstr($post->content, $thread->title) == $post->content) {
$title = null;
} else {
$title = $thread->title;
}
news_item($thread->create_time, $title, $post);
}
if ($count) {
echo "... more";
}
echo "
";
printf(tra("News is available as an %sRSS feed%s"),
"",
" "
);
echo "
";
}
$cvs_version_tracker[]="\$Id$"; //Generated automatically - do not edit
?>