Issues (1963)

html/inc/notify.inc (3 issues)

1
<?php
2
// This file is part of BOINC.
3
// https://boinc.berkeley.edu
4
// Copyright (C) 2024 University of California
5
//
6
// BOINC is free software; you can redistribute it and/or modify it
7
// under the terms of the GNU Lesser General Public License
8
// as published by the Free Software Foundation,
9
// either version 3 of the License, or (at your option) any later version.
10
//
11
// BOINC is distributed in the hope that it will be useful,
12
// but WITHOUT ANY WARRANTY; without even the implied warranty of
13
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14
// See the GNU Lesser General Public License for more details.
15
//
16
// You should have received a copy of the GNU Lesser General Public License
17
// along with BOINC.  If not, see <http://www.gnu.org/licenses/>.
18
19
// notifications as an RSS feed
20
21
require_once("../project/project.inc");
22
23
function notify_rss_auth($user) {
24
    return md5($user->authenticator.$user->passwd_hash."notify_rss");
25
}
26
27
function notify_rss_url($user) {
28
    return secure_url_base()."notify_rss.php?userid=$user->id&auth=".notify_rss_auth($user);
29
}
30
31
function show_notify_rss_item($notify) {
32
    switch ($notify->type) {
33
    case NOTIFY_FRIEND_REQ:
34
        friend_req_rss($notify, $title, $msg, $url);
35
        break;
36
    case NOTIFY_FRIEND_ACCEPT:
37
        friend_accept_rss($notify, $title, $msg, $url);
38
        break;
39
    case NOTIFY_PM:
40
        pm_rss($notify, $title, $msg, $url);
41
        break;
42
    case NOTIFY_SUBSCRIBED_THREAD:
43
        [$title, $msg, $url] = subscribe_rss($notify);
44
        break;
45
    }
46
    if (!$msg) {
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable $msg does not seem to be defined for all execution paths leading up to this point.
Loading history...
47
        $notify->delete();
48
        return;
49
    }
50
51
    $news_date=gmdate('D, d M Y H:i:s',$notify->create_time) . ' GMT';
52
    echo "<item>
53
        <title><![CDATA[$title]]></title>
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable $title does not seem to be defined for all execution paths leading up to this point.
Loading history...
54
        <guid>".url_base()."_notify_$notify->id</guid>
55
        <link>".htmlentities($url)."</link>
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable $url does not seem to be defined for all execution paths leading up to this point.
Loading history...
56
        <description><![CDATA[$msg]]></description>
57
        <pubDate>$news_date</pubDate>
58
        </item>
59
    ";
60
}
61
62
?>
63