]> git.wh0rd.org - tt-rss.git/commitdiff
OPML export
authorAndrew Dolgov <fox@bah.spb.su>
Fri, 2 Sep 2005 10:18:45 +0000 (11:18 +0100)
committerAndrew Dolgov <fox@bah.spb.su>
Fri, 2 Sep 2005 10:18:45 +0000 (11:18 +0100)
backend.php
opml.php [new file with mode: 0644]
prefs.js
ttrss_schema.sql

index 5b996316aa1a26b910d8a4178945553f0c4ea0b5..94ddb22ff24c4b220652b6f8f4e5650771caea39 100644 (file)
                                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>";
                
-
                        }
 
        }
diff --git a/opml.php b/opml.php
new file mode 100644 (file)
index 0000000..05ad194
--- /dev/null
+++ b/opml.php
@@ -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>";
+       }
+
+?>
index 075d85a0b3bd8989a4d5153cafe86e3b0e60929d..b468a362ad33d73d733623fc96578ae352a4722f 100644 (file)
--- a/prefs.js
+++ b/prefs.js
@@ -297,17 +297,6 @@ function localPiggieFunction(enable) {
        }
 }
 
-function exportOPML() {
-
-
-}
-
-function importOPML() {
-
-
-}
-
-
 function init() {
 
        // IE kludge
index 8be0d3daeacab61f163f7eab60efed94c1686a21..364087f17fb209e911cc1652ef94e63f0fee5cc3 100644 (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 '',