forked from fwmiller/aggregation.co
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfeeds.php
69 lines (59 loc) · 1.62 KB
/
feeds.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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
<?php
require("include/db.php");
require("include/header.php");
require("include/nav.php");
// Get all the user's feeds
$query = "SELECT * FROM feeds";
$rows = Query($db, $query);
function FeedIcon($link)
{
// Feed favicon.ico
$url = preg_replace('/^https?:\/\//', '', $link);
if ($url != "") {
$imgurl = "https://www.google.com/s2/favicons?domain=";
$imgurl .= $url;
echo "<div class=\"feedsListIcon\">";
"\" type=\"image/x-icon\"></div>\n";
echo '<img src="';
echo $imgurl;
echo '" width="16" height="16" />';
echo "</div>\n";
}
}
// Create an array of links and titles
foreach ($rows as $row) {
echo "<article>";
$rss = simplexml_load_file($row['link']);
if ($rss) {
FeedIcon($row['link']);
if (strlen($rss->channel->title) == 0) {
echo "<span class=\"feedsListTitle\">" .
"<a href=\"http://aggregation.co/?feed=" .
$row['id'] .
"\">" .
$row['link'] .
"</a></span>\n";
/*
echo "<span class=\"feedsListTitle\">" .
$row['link'] . "</span>\n";
*/
} else {
echo "<span class=\"feedsListTitle\">" .
"<a href=\"http://aggregation.co/?feed=" .
$row['id'] .
"\">" .
$rss->channel->title .
"</a></span>\n";
/*
echo "<span class=\"feedsListTitle\">" .
$rss->channel->title . "</span>\n";
*/
}
echo "<div class=\"feedsListLink\">" . $row['link'] .
"</div>\n";
} else {
echo "<div>" . $row['link'] . " not found</div>\n";
}
echo "</article>\n";
}
require("include/footer.php");