Beispiel #1
0
    echo "<?xml version=\"1.0\" encoding=\"ISO-8859-1\" ?>\n        <rss version=\"2.0\">\n        <channel>\n        <title>" . PROJECT . " notices</title>\n        <link>" . URL_BASE . "</link>\n        <description>Notices</description>\n        <lastBuildDate>{$t}</lastBuildDate>\n    ";
}
function notices_rss_end()
{
    echo "\n        </channel>\n        </rss>\n    ";
}
$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;
// You should have received a copy of the GNU Lesser General Public License
// along with BOINC.  If not, see <http://www.gnu.org/licenses/>.
// RSS feed for per-user notifications
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";