From a7a8b2d5f382254d2e92f8d313c9d47497701b0f Mon Sep 17 00:00:00 2001 From: David Anderson Date: Mon, 12 Jan 2009 19:26:44 +0000 Subject: [PATCH] - web: add Eric's script (not finished yet) for forum RSS svn path=/trunk/boinc/; revision=16886 --- checkin_notes | 20 +++++--- html/user/forum_rss.php | 103 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 116 insertions(+), 7 deletions(-) create mode 100644 html/user/forum_rss.php diff --git a/checkin_notes b/checkin_notes index a2fde250c1..cf9c42e67b 100644 --- a/checkin_notes +++ b/checkin_notes @@ -151,10 +151,16 @@ Rom 12 Jan 2009 really think this is it, but i'm running out of ideas. win_build/installerv2/redist/Windows/src/boinccas/ - boinccas.rc - win_build/installerv2/redist/Windows/Win32/ - boinccas.dll - boinccas95.dll - win_build/installerv2/redist/Windows/x64/ - boinccas.dll - boinccas95.dll + boinccas.rc + win_build/installerv2/redist/Windows/Win32/ + boinccas.dll + boinccas95.dll + win_build/installerv2/redist/Windows/x64/ + boinccas.dll + boinccas95.dll + +David 12 Jan 2009 + - web: add Eric's script (not finished yet) for forum RSS + + html/user/ + forum_rss.php diff --git a/html/user/forum_rss.php b/html/user/forum_rss.php new file mode 100644 index 0000000000..ff53de69bd --- /dev/null +++ b/html/user/forum_rss.php @@ -0,0 +1,103 @@ + "9") { + $nitems = "9"; +} + +if ($userid) { + $user = BoincUser.lookup_id($user); + if (!$user) error_page("no such user"); +} + +$last_mod_time = BoincThread.get_int("max(timestamp)", + "where owner=$userid and forum=$forumid and status=0 and hidden=0 and sticky=0" +); +//$query="select max(timestamp) from thread where owner=".$userid." and forum=".$forumid." and status=0 and hidden=0 and sticky=0"; +//$result=mysql_query($query); +if ($result) { + $last_mod_time=mysql_fetch_object($result); +} else { + echo "error in ".$query." + "; + exit(1); +} + +$threads = BoincThread::enum_fields("id,create_time,title", "where owner=$userid and forum=$forumid and status=0 and hidden=0 and sticky=0 order by create_time desc limit $news" +); +//$query="select id,create_time,title from thread where owner=".$userid." and forum=".$forumid." and status=0 and hidden=0 and sticky=0 order by create_time desc limit ".$news; + +//$result=mysql_query($query); +if (!$result) { + echo "error in ".$query." + "; + exit(1); +} + +// Get unix time that last modification was made to the news source +// +$create_date = gmdate('D, d M Y H:i:s', $last_mod_time) . ' GMT'; + +// Now construct header +// +header ("Expires: " . gmdate('D, d M Y H:i:s', time()+86400) . " GMT"); +header ("Last-Modified: " . $create_date); +header ("Content-Type: application/xml"); + + +// Create channel header and open XML content +// +$description=$username->name."'s ".PROJECT." Blog"; +$channel_image = URL_BASE . "rss_image.gif"; +$language = "en-us"; +echo " + + + ".$description." + ".URL_BASE." + ".$description." + ".COPYRIGHT_HOLDER." + ".$create_date." + ".$language." + + ".$channel_image." + ".PROJECT." + ".URL_BASE." + +"; + +// write news items +// +foreach ($threads as $thread) { + $post_date=gmdate('D, d M Y H:i:s',$thread->create_time).' GMT'; + $unique_url=URL_BASE."forum_thread.php?id=".$thread->id; + + $posts = BoincPost::enum("thread=$thread->id and user=$userid order by timestamp limit 1"); + $post = $posts[0]; + echo " + ".strip_tags($thread->title)." + $unique_url + $unique_url + ".substr(strip_tags($post->content),0,255)." . . . + $post_date + +"; +} + +// Close XML content +// +echo " + + +"; + +?>