forked from sitracker/sitracker
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathkb_rss.php
More file actions
75 lines (60 loc) · 2.5 KB
/
kb_rss.php
File metadata and controls
75 lines (60 loc) · 2.5 KB
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
<?php
// kb_rss.php - Output an RSS representation showing new kb articles
//
// SiT (Support Incident Tracker) - Support call tracking system
// Copyright (C) 2010-2014 The Support Incident Tracker Project
// Copyright (C) 2006-2009 Salford Software Ltd. and Contributors
//
// This software may be used and distributed according to the terms
// of the GNU General Public License, incorporated herein by reference.
//
// Author: Ivan Lucas <ivanlucas[at]users.sourceforge.net>
require ('core.php');
require (APPLICATION_LIBPATH . 'functions.inc.php');
// This script requires no authentication
// The information it reveals should not be sensitive
$c = clean_dbstring($_GET['c']);
$salt = md5($CONFIG['db_password']);
$usql = "SELECT id FROM `{$dbUsers}` WHERE MD5(CONCAT(`username`, '{$salt}')) = '$c' LIMIT 1";
// $usql = "SELECT id FROM `{$dbUsers}` WHERE username = '$c' LIMIT 1";
$uresult = mysqli_query($db, $usql);
if ($uresult)
{
list($userid) = mysqli_fetch_row($uresult);
}
// $userid = cleanvar($_REQUEST['user']);
if (!is_numeric($userid))
{
header("HTTP/1.1 403 Forbidden");
echo "<html><head><title>403 Forbidden</title></head><body><h1>403 Forbidden</h1></body></html>\n";
exit;
}
if (!empty($_SESSION['lang'])) $lang = $_SESSION['lang'];
else $lang = $CONFIG['default_i18n'];
// Feed stuff goes here (obviously) ;)
$sql = "SELECT * FROM `{$dbKBArticles}` ORDER BY docid DESC LIMIT 20";
$result = mysqli_query($db, $sql);
if (mysqli_error($db)) trigger_error(mysqli_error($db),E_USER_WARNING);
$count = 0;
$pubdate = $now;
$items = array();
while ($kbarticle = mysqli_fetch_object($result))
{
if (empty($kbarticle->title)) $kbarticle->title = $strUntitled;
else $kbarticle->title = $kbarticle->title;
$fi = new FeedItem();
$fi->title = $kbarticle->title;
$fi->author = $kbarticle->author;
$fi->link = "{$CONFIG['application_uriprefix']}{$CONFIG['application_webpath']}kb_view_article.php?id={$kbarticle->docid}";
$fi->description = "{$strKeywords}: {$kbarticle->keywords}";
$fi->pubdate = mysql2date($kbarticle->published);
$items[] = $fi;
}
$feed = new Feed();
$feed->title = "{$CONFIG['application_shortname']} {$strKnowledgeBase}: {$strArticlesPublishedRecently}";
$feed->feedurl = "{$CONFIG['application_uriprefix']}{$CONFIG['application_webpath']}kb.php?mode=RECENT";
$feed->description = "{$CONFIG['application_name']}: {$strKnowledgeBase} {$strFor} ".user_realname($userid)." ({$strActionNeeded})";
$feed->pubdate = $pubdate;
$feed->items = $items;
$feed->generate_feed();
?>