.
require_once("../project/project.inc");
function news_item($date, $title, $post) {
echo "
";
if ($title) {
echo "$title
\n";
}
$d = time_str($date);
if (is_string($post)) {
$forum_link = false;
$text = bb2html($post);
} else {
$forum_link = true;
$text = bb2html($post->content);
}
echo "
$text
$d
";
if ($forum_link) {
echo "
· thread> ".tra("Comment")."
";
}
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 show_news($start, $count) {
$forum = news_forum();
if (!$forum) {
echo "
No news forum. Run html/ops/create_forums.php.
";
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"),
"",
" "
);
}
$cvs_version_tracker[]="\$Id$"; //Generated automatically - do not edit
?>