-
Notifications
You must be signed in to change notification settings - Fork 343
/
feed.php
executable file
·53 lines (47 loc) · 1.68 KB
/
feed.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
<?php
/**
* This file is part of ILIAS, a powerful learning management system
* published by ILIAS open source e-Learning e.V.
*
* ILIAS is licensed with the GPL-3.0,
* see https://www.gnu.org/licenses/gpl-3.0.en.html
* You should have received a copy of said license along with the
* source code, too.
*
* If this is not the case or you just want to try ILIAS, you'll find
* us at:
* https://www.ilias.de
* https://github.com/ILIAS-eLearning
*
*********************************************************************/
/**
* News feed script.
* @author Alexander Killing <[email protected]>
*/
include_once "Services/Context/classes/class.ilContext.php";
ilContext::init(ilContext::CONTEXT_RSS);
require_once("Services/Init/classes/class.ilInitialisation.php");
ilInitialisation::initILIAS();
global $DIC;
$getPar = static function (string $key, string $func) {
global $DIC;
return $DIC->http()->wrapper()->query()->has($key)
? $DIC->http()->wrapper()->query()->retrieve(
$key,
$DIC->refinery()->kindlyTo()->$func()
) : ($func === "int" ? 0 : '');
};
$requested_user_id = $getPar("user_id", "int");
$requested_ref_id = $getPar("ref_id", "int");
$requested_purpose = $getPar("purpose", "string");
$requested_blog_id = $getPar("blog_id", "string");
$requested_hash = $getPar("hash", "string");
if ($requested_user_id > 0) {
$writer = new ilUserFeedWriter($requested_user_id, $requested_hash);
$writer->showFeed();
} elseif ($requested_ref_id > 0) {
$writer = new ilObjectFeedWriter($requested_ref_id, false, $requested_purpose);
$writer->showFeed();
} elseif ($requested_blog_id > 0) {
ilObjBlog::deliverRSS($requested_blog_id);
}