2004-06-09 21:42:23 +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/>.
|
2004-05-31 17:37:22 +00:00
|
|
|
|
2009-12-16 22:35:08 +00:00
|
|
|
require_once("../project/project.inc");
|
|
|
|
|
2009-12-19 18:14:04 +00:00
|
|
|
function news_item($date, $title, $post) {
|
2009-12-17 00:17:37 +00:00
|
|
|
echo "<p>";
|
2009-12-16 22:35:08 +00:00
|
|
|
if ($title) {
|
2009-12-19 17:52:49 +00:00
|
|
|
echo "<span class=news_title>$title</span><br>\n";
|
2009-12-16 22:35:08 +00:00
|
|
|
}
|
|
|
|
$d = time_str($date);
|
2009-12-22 18:39:40 +00:00
|
|
|
if (is_string($post)) {
|
|
|
|
$forum_link = false;
|
2010-05-11 19:25:13 +00:00
|
|
|
$text = output_transform($post);
|
2009-12-22 18:39:40 +00:00
|
|
|
} else {
|
|
|
|
$forum_link = true;
|
2010-05-11 19:25:13 +00:00
|
|
|
$text = output_transform($post->content);
|
2009-12-22 18:39:40 +00:00
|
|
|
}
|
2008-09-19 18:08:17 +00:00
|
|
|
echo "
|
2009-12-19 18:14:04 +00:00
|
|
|
<span class=news_content>$text</span>
|
2009-12-24 22:47:53 +00:00
|
|
|
<span class=news_date>$d
|
2009-12-22 18:39:40 +00:00
|
|
|
";
|
|
|
|
if ($forum_link) {
|
|
|
|
echo "
|
|
|
|
· <a href=".URL_BASE."forum_thread.php?id=$post->thread> ".tra("Comment")."</a>
|
|
|
|
";
|
|
|
|
}
|
|
|
|
echo "</span>
|
2009-12-24 22:47:53 +00:00
|
|
|
<br clear=all>
|
|
|
|
<hr size=0 class=news_line>
|
2007-01-09 20:48:41 +00:00
|
|
|
";
|
2004-05-31 17:37:22 +00:00
|
|
|
}
|
|
|
|
|
2010-01-12 18:39:59 +00:00
|
|
|
function news_forum() {
|
2009-12-16 22:35:08 +00:00
|
|
|
if (defined("NEWS_FORUM_NAME")) {
|
|
|
|
$forum_name = NEWS_FORUM_NAME;
|
|
|
|
} else {
|
|
|
|
$forum_name = "News";
|
2004-05-31 17:37:22 +00:00
|
|
|
}
|
2010-01-12 18:39:59 +00:00
|
|
|
return BoincForum::lookup("parent_type=0 and title = '$forum_name'");
|
|
|
|
}
|
|
|
|
|
2011-02-28 19:02:59 +00:00
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
2010-01-12 18:39:59 +00:00
|
|
|
function show_news($start, $count) {
|
|
|
|
$forum = news_forum();
|
2009-12-16 22:35:08 +00:00
|
|
|
if (!$forum) {
|
|
|
|
echo "
|
|
|
|
No news forum. Run html/ops/create_forums.php.
|
|
|
|
";
|
|
|
|
return;
|
2004-05-31 17:37:22 +00:00
|
|
|
}
|
2010-05-11 19:25:13 +00:00
|
|
|
|
|
|
|
if (is_array($start)) {
|
|
|
|
echo "You have not changed show_news() to use 0 instead of
|
|
|
|
deprecated \$project_news as the first param.";
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2009-12-16 22:35:08 +00:00
|
|
|
$lim = "";
|
|
|
|
if ($start) {
|
|
|
|
if ($count) {
|
|
|
|
$lim = "limit $start, $count";
|
|
|
|
} else {
|
|
|
|
$lim = "limit $start, 99999999";
|
|
|
|
}
|
|
|
|
} else if ($count) {
|
|
|
|
$lim = "limit $count";
|
|
|
|
}
|
2010-01-04 17:06:54 +00:00
|
|
|
$threads = BoincThread::enum("forum = $forum->id and hidden=0 order by id desc $lim");
|
2009-12-16 22:35:08 +00:00
|
|
|
|
|
|
|
foreach ($threads as $thread) {
|
|
|
|
$posts = BoincPost::enum("thread=$thread->id order by id limit 1");
|
|
|
|
$post = $posts[0];
|
2009-12-21 19:38:50 +00:00
|
|
|
if (strstr($post->content, $thread->title) == $post->content) {
|
2009-12-16 22:35:08 +00:00
|
|
|
$title = null;
|
|
|
|
} else {
|
|
|
|
$title = $thread->title;
|
|
|
|
}
|
2009-12-19 18:14:04 +00:00
|
|
|
news_item($thread->create_time, $title, $post);
|
2004-05-31 17:37:22 +00:00
|
|
|
}
|
2009-12-16 22:35:08 +00:00
|
|
|
|
|
|
|
if ($count) {
|
2009-12-25 01:27:29 +00:00
|
|
|
echo "<a href=".URL_BASE."old_news.php>... more</a>";
|
2009-12-16 22:35:08 +00:00
|
|
|
}
|
|
|
|
echo "
|
2009-12-17 00:17:37 +00:00
|
|
|
<br><br><p class=\"smalltext\">
|
2009-12-16 22:35:08 +00:00
|
|
|
";
|
2009-12-17 00:17:37 +00:00
|
|
|
printf(tra("News is available as an %sRSS feed%s"),
|
|
|
|
"<a href=rss_main.php>",
|
2009-12-24 22:47:53 +00:00
|
|
|
" <img src=\"img/rss_icon.gif\" alt=\"RSS\"></a>"
|
2009-12-17 00:17:37 +00:00
|
|
|
);
|
2004-05-31 17:37:22 +00:00
|
|
|
}
|
|
|
|
|
2008-08-05 22:43:14 +00:00
|
|
|
$cvs_version_tracker[]="\$Id$"; //Generated automatically - do not edit
|
2004-05-31 17:37:22 +00:00
|
|
|
?>
|