Example #1
0
}
$userid = get_int('userid');
$auth = get_str('auth');
$since_time = time() - 30 * 86400;
$user = BoincUser::lookup_id($userid);
if (!$user) {
    xml_error();
}
// the auth in the URL includes "userid_"
//
$x = $user->id . "_" . notify_rss_auth($user);
if ($x != $auth) {
    xml_error(-155, 'Invalid authenticator');
}
$since_clause = "and create_time > {$since_time}";
$notifies = BoincNotify::enum("userid = {$userid} {$since_clause}");
$forum = news_forum();
if ($forum) {
    $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;
Example #2
0
require_once "../inc/boinc_db.inc";
require_once "../inc/xml.inc";
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);