]> git.wh0rd.org - tt-rss.git/blame - opml.php
OPML export
[tt-rss.git] / opml.php
CommitLineData
9a4506c8
AD
1<?
2 // FIXME there are some brackets issues here
3
4 $op = $_GET["op"];
5 if ($op == "export") {
6 header("Content-type: application/xml");
7 }
8
9 require_once "config.php";
10 require_once "functions.php";
11
12 $link = pg_connect(DB_CONN);
13
14 pg_query($link, "set client_encoding = 'utf-8'");
15
16 if ($op == "export") {
17 print "<?xml version=\"1.0\"?>";
18 print "<opml version=\"1.0\">";
19 print "<head><dateCreated>" . date("r", time()) . "</dateCreated></head>";
20 print "<body>";
21
22 $result = pg_query("SELECT * FROM ttrss_feeds ORDER BY title");
23
24 while ($line = pg_fetch_assoc($result)) {
25 $title = $line["title"];
26 $url = $line["feed_url"];
27
28 print "<outline text=\"$title\" xmlUrl=\"$url\"/>";
29 }
30
31 print "</body></opml>";
32 }
33
34?>