*** empty log message ***

svn path=/trunk/boinc/; revision=3482
This commit is contained in:
David Anderson 2004-05-31 17:37:22 +00:00
parent e6aecfc118
commit 7134a969cb
8 changed files with 133 additions and 11 deletions

View File

@ -12855,3 +12855,23 @@ David May 30 2004
top_hosts.php
top_teams.php
top_users.php
David May 31 2004
- Web: changed project news mechanism to use RSS
(Really Simple Syndication), described here:
http://blogs.law.harvard.edu/tech/rss
All projects now offer news feed at rss_main.php
- SETI@home public site: made front page cached
- added index on profile.uotd_time
db/
constraints.sql
html/
inc/
cache.inc
util.inc
news.inc (new)
user/
rss_main.php
sample_index.php
old_news.php (new)

View File

@ -95,6 +95,7 @@ alter table host
alter table profile
add fulltext index profile_reponse(response1, response2),
add index pro_uotd (uotd_time desc);
add unique profile_userid(userid);
alter table subscriptions

View File

@ -2,7 +2,7 @@
// mechanism for caching commonly-accessed pages
function start_cache($max_age, $unique_parameter_string){
function start_cache($max_age, $unique_parameter_string=""){
$cache_dir="../cache";
$path = $cache_dir.$_SERVER["PHP_SELF"]."_".urlencode($unique_parameter_string);
@ -22,7 +22,7 @@ function start_cache($max_age, $unique_parameter_string){
// write output buffer both to client and to cache
//
function end_cache($unique_parameter_string){
function end_cache($unique_parameter_string=""){
$cache_dir="../cache";
$path = $cache_dir.$_SERVER["PHP_SELF"]."_".urlencode($unique_parameter_string);

26
html/inc/news.inc Normal file
View File

@ -0,0 +1,26 @@
<?
function news_item($date, $text) {
echo "<b>$date</b>
<br>
$text
<br><br>
";
}
function show_news($items, $n) {
if ($n > count($items)) {
$n = count($items);
}
for ($i=0; $i<$n; $i++) {
news_item($items[$i][0], $items[$i][1]);
}
}
function show_old_news($items, $n) {
for ($i=$n; $i<count($items); $i++) {
news_item($items[$i][0], $items[$i][1]);
}
}
?>

View File

@ -449,12 +449,4 @@ function host_link($hostid) {
}
}
function news_item($date, $text) {
echo "<b>$date</b>
<br>
$text
<br><br>
";
}
?>

13
html/user/old_news.php Normal file
View File

@ -0,0 +1,13 @@
<?
require_once("../inc/util.inc");
require_once("../inc/news.inc");
require_once("../project/project_news.inc");
page_head("News archive");
show_old_news($project_news, 6);
page_tail();
?>

65
html/user/rss_main.php Normal file
View File

@ -0,0 +1,65 @@
<?php
// rss_main.php:
// RSS 2.0 feed for BOINC default server installation.
// Channel Main show the current news on project mainpage
// - for more informations about RSS see RSS 2.0 Specification:
// http://blogs.law.harvard.edu/tech/rss
// Create and send out http header
//
header ("Expires: " . gmdate('D, d M Y H:i:s', time()) . " GMT");
header ("Last-Modified: " . gmdate('D, d M Y H:i:s') . " GMT");
header ("Content-Type: text/xml");
// Get or set display options
// - from 1 to 9 News could be set by option news, default is up to 9
//
$news = $_GET["news"];
if (!$news) {
$news = "9";
} else {
if($news < "1" or $news > "9") {
$news = "9";
}
}
// inclue project constants and news file
//
require_once("../project/project.inc");
require_once("../project/project_news.inc");
// Create channel header and open XML content
//
$description = "BOINC project ".PROJECT.": Main page News";
$channel_image = MASTER_URL . "rss_image.jpg";
$create_date = gmdate('D, d M Y H:i:s') . ' GMT';
$language = "en-us";
echo "<?xml version=\"1.0\" encoding=\"ISO-8859-1\" ?>\n"
."<rss version=\"2.0\">\n<channel>\n <title>"
.PROJECT."</title>\n <link>"
.MASTER_URL."</link>\n <description>"
.$description."</description>\n <copyright>"
.COPYRIGHT_HOLDER."</copyright>\n <lastBuildDate>"
.$create_date."</lastBuildDate>\n <language>"
.$language."</language>\n <image>\n <url>"
.$channel_image."</url>\n <title>"
.PROJECT."</title>\n <link>"
.MASTER_URL."</link>\n </image>\n";
// - Create news items
//
$news = min( count($project_news), $news);
for( $item=0; $item < $news; $item++ ) {
if( count($project_news[$item]) == 2) {
echo " <item>\n <title>Project News "
.strip_tags($project_news[$item][0])."</title>\n <link>"
.MASTER_URL."</link>\n <description>"
.strip_tags($project_news[$item][1])."</description>\n </item>";
}
}
// Close XML content
//
echo "</channel>\n</rss>";
?>

View File

@ -1,7 +1,9 @@
<?php
require_once("../inc/db.inc");
require_once("../inc/util.inc");
require_once("../inc/news.inc");
require_once("../project/project.inc");
require_once("../project/project_news.inc");
// don't want to use DB here, because master page won't be visible
// if DB is down
@ -72,7 +74,10 @@ echo "
<h3>News</h3>
</center>
";
project_news();
show_news($project_news, 5);
if (count($project_news > 5)) {
echo "<a href=old_news.php>...more</a>\n";
}
echo "
</td>
</tr></table>