OPML export

This commit is contained in:
Andrew Dolgov 2005-09-02 11:18:45 +01:00
parent 10c5820d08
commit 9a4506c87d
4 changed files with 37 additions and 14 deletions

View File

@ -572,11 +572,10 @@
href=\"javascript:updateFeedList()\">Refresh</a>&nbsp;
OPML:
<a class=\"button\"
href=\"javascript:exportOPML()\">Import</a>&nbsp;
href=\"opml.php?op=import\">Import</a>&nbsp;
<a class=\"button\"
href=\"javascript:exportOPML()\">Export</a>";
href=\"opml.php?op=export\">Export</a>";
}
}

34
opml.php Normal file
View File

@ -0,0 +1,34 @@
<?
// FIXME there are some brackets issues here
$op = $_GET["op"];
if ($op == "export") {
header("Content-type: application/xml");
}
require_once "config.php";
require_once "functions.php";
$link = pg_connect(DB_CONN);
pg_query($link, "set client_encoding = 'utf-8'");
if ($op == "export") {
print "<?xml version=\"1.0\"?>";
print "<opml version=\"1.0\">";
print "<head><dateCreated>" . date("r", time()) . "</dateCreated></head>";
print "<body>";
$result = pg_query("SELECT * FROM ttrss_feeds ORDER BY title");
while ($line = pg_fetch_assoc($result)) {
$title = $line["title"];
$url = $line["feed_url"];
print "<outline text=\"$title\" xmlUrl=\"$url\"/>";
}
print "</body></opml>";
}
?>

View File

@ -297,17 +297,6 @@ function localPiggieFunction(enable) {
}
}
function exportOPML() {
}
function importOPML() {
}
function init() {
// IE kludge

View File

@ -36,6 +36,7 @@ create table ttrss_entries (id serial not null primary key,
content text not null,
content_hash varchar(250) not null,
last_read timestamp,
marked boolean not null default false,
date_entered timestamp not null default NOW(),
no_orig_date boolean not null default false,
comments varchar(250) not null default '',