This repository has been archived by the owner on Oct 15, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
rss.php
48 lines (36 loc) · 1.62 KB
/
rss.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
<?php
require("lib/bootstrap.php");
require(PATH."/lib/classes/rss.class.php");
if (!empty($_GET["p"]) && !empty($_GET["t"])) {
$pid = $utilities->deobfuscate($utilities->filter($_GET["p"]));
$tid = $utilities->deobfuscate($utilities->filter($_GET["t"]));
if ($pid > 0 && $tid > 0) {
$project = $projects->getProject($pid);
$task = $tasks->getTask($pid, $tid);
$taskUpdates = $updates->listAllTaskUpdates($pid, $tid);
$feed = new RSS();
$feed->title = $project[0]["title"]." / ".$task[0]["title"]." Latest updates";
$feed->link = ROOT."";
$feed->description = $task[0]["description"];
for ($i=0; $i < count($taskUpdates); $i++) {
$description = $taskUpdates[$i]["description"];
$project = $taskUpdates[$i]["project"];
$task = $taskUpdates[$i]["task"];
$author = $taskUpdates[$i]["author"];
$published = date("D, d M Y H:i:s", $taskUpdates[$i]["created"]);
$html = "<p>".$description."</p><br/><br/>Published: ".$published;
$item = new RSSItem();
$item->title = $projects->getProjectTitle($taskUpdates[$i]["project"])." - ".$tasks->getTaskTitle($taskUpdates[$i]["task"]);
$item->link = ROOT."task.php?pid=".$project."&tid=".$task;
$item->setPubDate($taskUpdates[$i]["created"]);
$item->description = "<![CDATA[$html]]>";
$feed->addItem($item);
}
echo $feed->serve();
} else {
die("Cannot access. You need access key");
}
} else {
die("Nothing specified");
}
?>