$threads = BoincThread::enum("forum = {$forum->id} and hidden=0 and status=0 {$since_clause}"); } // there may be a better way to do this $items = array(); foreach ($notifies as $n) { $i = null; $i->type = 0; $i->time = $n->create_time; $i->val = $n; $items[] = $i; } foreach ($threads as $t) { $i = null; $i->type = 1; $i->time = $t->create_time; $i->val = $t; $items[] = $i; } usort($items, 'notice_cmp'); notices_rss_start(); foreach ($items as $item) { switch ($item->type) { case 0: show_notify_rss_item($item->val); break; case 1: show_forum_rss_item($item->val, 0, 1, 0); break; } } notices_rss_end();
require_once "../inc/pm.inc"; require_once "../inc/friend.inc"; require_once "../inc/notify.inc"; require_once "../project/project.inc"; $userid = get_int('userid'); $auth = get_str('auth'); $user = BoincUser::lookup_id($userid); if (!$user) { xml_error(); } if (notify_rss_auth($user) != $auth) { xml_error(); } $notifies = BoincNotify::enum("userid = {$userid} order by create_time desc"); if (count($notifies)) { $last_mod_time = $notifies[0]->create_time; } else { $last_mod_time = time(); } $create_date = gmdate('D, d M Y H:i:s', $last_mod_time) . ' GMT'; header("Expires: " . gmdate('D, d M Y H:i:s', time()) . " GMT"); header("Last-Modified: " . $create_date); header("Content-Type: application/xml"); $description = "Community notifications"; $channel_image = URL_BASE . "rss_image.gif"; $language = "en-us"; echo "<?xml version=\"1.0\" encoding=\"ISO-8859-1\" ?>\n <rss version=\"2.0\" xmlns:atom=\"http://www.w3.org/2005/Atom\">\n <channel>\n <title>" . PROJECT . "</title>\n <link>" . URL_BASE . "</link>\n <atom:link href=\"" . URL_BASE . "notify_rss.php\" rel=\"self\" type=\"application/rss+xml\" />\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>" . URL_BASE . "</link>\n </image>\n"; foreach ($notifies as $notify) { show_notify_rss_item($notify); } echo "\n </channel>\n </rss>\n";