.
require_once("../inc/forum.inc");
require_once("../inc/boinc_db.inc");
require_once("../inc/text_transform.inc");
// return true if the given HTML may contain images or video
//
function contains_image_or_video($x) {
if (strstr($x, "id;
$clause2 = " and hidden=0 ";
if ($userid) $clause2 .= "and user=$userid";
if ($threads_only) {
$posts = BoincPost::enum("thread=$thread->id $clause2 order by id limit 1");
} else {
$posts = BoincPost::enum("thread=$thread->id $clause2 order by timestamp desc limit 1");
}
if (!count($posts)) return;
$post = $posts[0];
$post_date = gmdate('D, d M Y H:i:s',$post->timestamp).' GMT';
$post_user = BOincUser::lookup_id($post->user);
BoincForumPrefs::lookup($post_user);
$options = new output_options();
if (is_admin($post_user)) {
$options->htmlitems = false;
}
$t = output_transform($post->content, $options);
if ($no_images && contains_image_or_video($t)) return;
echo "title))."]]>
$unique_url
$unique_url$post_date
";
}
function forum_rss($forumid, $userid, $threads_only, $ndays) {
$clause = "forum=$forumid ";
if ($userid) {
$user = BoincUser::lookup_id($userid);
if (!$user) error_page("no such user");
$clause .= " and owner=$userid";
}
if ($ndays) {
$tlimit = time() - $ndays*86400;
} else {
$tlimit = 0;
}
if ($threads_only) {
$q = "$clause and hidden=0 and create_time > $tlimit order by create_time desc";
} else {
$q = "$clause and hidden=0 and timestamp > $tlimit order by timestamp desc";
}
$threads = BoincThread::enum($q);
// Get unix time that last modification was made to the news source
//
// Now construct header
//
header ("Expires: " . gmdate('D, d M Y H:i:s', time()+86400) . " GMT");
if (sizeof($threads)) {
$t = $threads[0];
$last_mod_time = $threads_only?$t->create_time:$t->timestamp;
$create_date = gmdate('D, d M Y H:i:s', $last_mod_time) . ' GMT';
header ("Last-Modified: " . $create_date);
} else {
$create_date = gmdate('D, d M Y H:i:s') . ' GMT';
}
header ("Content-Type: application/xml");
$forum=BoincForum::lookup_id($forumid);
// Create channel header and open XML content
//
$description = PROJECT.": $forum->title";
if ($userid) {
$description .= " (posts by $user->name)";
}
$channel_image = secure_url_base() . "rss_image.gif";
$language = "en-us";
echo "
".$description."".$description."
".secure_url_base()."
".COPYRIGHT_HOLDER."".$create_date."".$language."".$channel_image."".PROJECT."
".secure_url_base()."
";
foreach ($threads as $thread) {
show_forum_rss_item($thread, $userid, $threads_only, false);
}
echo "
";
}
?>