add trivial code to display an RSS feed on the home page of users, feed can be changed in the variables panel

This commit is contained in:
Antoine Beaupré 2008-02-01 23:03:53 +00:00
parent 2fc2361877
commit e8caebb01f
2 changed files with 22 additions and 0 deletions

View File

@ -46,6 +46,25 @@ if ($mem->user["lastfail"]) {
$mem->resetlast(); $mem->resetlast();
# use MagpieRSS to syndicate content from another site if available
# this should work, since the debian package installs it in
# /usr/share/php, which is in the include path
if (include_once('magpierss/rss_fetch.inc')) {
$rss = fetch_rss( variable_get('rss_feed') );
if ($rss) {
echo "<h2>" . _("Latest news") . "</h2>";
foreach ($rss->items as $item) {
$href = $item['link'];
$title = $item['title'];
echo "<h3><a href=$href>$title</a></h3>";
echo $item['summary'];
}
echo "</ul>";
}
}
if($admin->enabled) { if($admin->enabled) {
$expiring = $admin->renew_get_expiring_accounts(); $expiring = $admin->renew_get_expiring_accounts();

View File

@ -419,6 +419,9 @@ the domain "username.example.com".
If this is set to 0 or a "false" string, it will be ignored.'); If this is set to 0 or a "false" string, it will be ignored.');
INSERT IGNORE INTO `variable` (name, value, comment) VALUES ('rss_feed', 0,
'This is an RSS feed that will be displayed on the users homepages when
they log in. Set this to 0 or a "false" string to ignore.');
-- --
-- Table structure for table `dbusers` -- Table structure for table `dbusers`
-- --