00001 <?php 00002 // kb_rss.php - Output an RSS representation showing new kb articles 00003 // 00004 // SiT (Support Incident Tracker) - Support call tracking system 00005 // Copyright (C) 2010-2011 The Support Incident Tracker Project 00006 // Copyright (C) 2006-2009 Salford Software Ltd. and Contributors 00007 // 00008 // This software may be used and distributed according to the terms 00009 // of the GNU General Public License, incorporated herein by reference. 00010 // 00011 00012 // Author: Ivan Lucas <ivanlucas[at]users.sourceforge.net> 00013 00014 require ('core.php'); 00015 require (APPLICATION_LIBPATH . 'functions.inc.php'); 00016 00017 // This script requires no authentication 00018 // The information it reveals should not be sensitive 00019 00020 $c = cleanvar($_GET['c']); 00021 $salt = md5($CONFIG['db_password']); 00022 $usql = "SELECT id FROM `{$dbUsers}` WHERE MD5(CONCAT(`username`, '{$salt}')) = '$c' LIMIT 1"; 00023 // $usql = "SELECT id FROM `{$dbUsers}` WHERE username = '$c' LIMIT 1"; 00024 $uresult = mysql_query($usql); 00025 00026 if ($uresult) 00027 { 00028 list($userid) = mysql_fetch_row($uresult); 00029 } 00030 00031 // $userid = cleanvar($_REQUEST['user']); 00032 00033 if (!is_numeric($userid)) 00034 { 00035 header("HTTP/1.1 403 Forbidden"); 00036 echo "<html><head><title>403 Forbidden</title></head><body><h1>403 Forbidden</h1></body></html>\n"; 00037 exit; 00038 } 00039 00040 if (!empty($_SESSION['lang'])) $lang = $_SESSION['lang']; 00041 else $lang = $CONFIG['default_i18n']; 00042 00043 // Feed stuff goes here (obviously) ;) 00044 $sql = "SELECT * FROM `{$dbKBArticles}` ORDER BY docid DESC LIMIT 20"; 00045 $result = mysql_query($sql); 00046 if (mysql_error()) trigger_error(mysql_error(),E_USER_WARNING); 00047 00048 $count = 0; 00049 $pubdate = $now; 00050 00051 $items = array(); 00052 00053 while ($kbarticle = mysql_fetch_object($result)) 00054 { 00055 if (empty($kbarticle->title)) $kbarticle->title = $strUntitled; 00056 else $kbarticle->title = $kbarticle->title; 00057 $fi = new FeedItem(); 00058 $fi->title = $kbarticle->title; 00059 $fi->author = $kbarticle->author; 00060 $fi->link = "{$CONFIG['application_uriprefix']}{$CONFIG['application_webpath']}kb_view_article.php?id={$kbarticle->docid}"; 00061 $fi->description = "{$strKeywords}: {$kbarticle->keywords}"; 00062 $fi->pubdate = mysql2date($kbarticle->published); 00063 $items[] = $fi; 00064 } 00065 00066 $feed = new Feed(); 00067 $feed->title = "{$CONFIG['application_shortname']} {$strKnowledgeBase}: {$strArticlesPublishedRecently}"; 00068 $feed->feedurl = "{$CONFIG['application_uriprefix']}{$CONFIG['application_webpath']}kb.php?mode=RECENT"; 00069 $feed->description = "{$CONFIG['application_name']}: {$strKnowledgeBase} {$strFor} ".user_realname($userid)." ({$strActionNeeded})"; 00070 $feed->pubdate = $pubdate; 00071 $feed->items = $items; 00072 00073 $feed->generate_feed(); 00074 00075 ?>
For more help developing with SiT! see http://sitracker.org/wiki/DevelopmentHowTo