loadFeed.inc.php
1.35 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
<?php
/*
* Created on 10 Jan 2007
*
* To change the template for this generated file go to
* Window - Preferences - PHPeclipse - PHP - Code Templates
*/
require_once('../../config/dmsDefaults.php');
require_once(KT_DIR. '/plugins/rssplugin/rss2array.inc.php');
require_once(KT_DIR. '/plugins/rssplugin/KTrss.inc.php');
$feed = $_GET["feed"];
$user = $_GET["user"];
// Check if the feed matches a url
if(!preg_match("/^http:\/\/([^\/]+)(.*)$/", $feed, $matches)){
// If not, it is an internal feed
$aRSSArray = KTrss::getInternalFeed($user);
}else{
// If it is a url, it is an external feed
$aRSSArray = rss2array($feed);
}
// Prepare response data to be passed back to page
$reposonse = "<h3>".$aRSSArray[channel][title]."</h3>" .
"<div class='outerContainer' id='outerContainer'>" .
"<table width='80%'>";
for($i=0;$i<count($aRSSArray[items]);$i++){
$reposonse .= "<tr>
<td colspan='2'><strong>".$aRSSArray[items][$i][title]."<strong></td>
</tr>
<tr>
<td>".$aRSSArray[items][$i][description]."</td>
<td>".$aRSSArray[items][$i][pubDate]."</td>
</tr>
<tr>
<td colspan='2'><a href='".$aRSSArray[items][$i][link]."' target='_blank'>... read more</a></td>
</tr>
<tr><td colspan='2'><hr><br></td></tr>";
}
$reposonse .= "</table></div>";
echo $reposonse;
?>