X-Git-Url: https://git.wh0rd.org/?a=blobdiff_plain;f=opml.php;h=bdee88e081694a516cc711290023b3a7d0e09854;hb=50052fb78a3a9d1bb3fa488e7fd7b23125c38124;hp=c178211309b5c8c60bfffde9cc4f1c6bc91f88b9;hpb=eac7480c09689647e2f1cd0c1b4f9304bd217aa3;p=tt-rss.git
diff --git a/opml.php b/opml.php
index c1782113..bdee88e0 100644
--- a/opml.php
+++ b/opml.php
@@ -1,128 +1,37 @@
-
- // FIXME there are some brackets issues here
+";
- }
-
- require_once "config.php";
+ require_once "autoload.php";
require_once "functions.php";
+ require_once "sessions.php";
+ require_once "sanity_check.php";
+ require_once "config.php";
+ require_once "db.php";
+ require_once "db-prefs.php";
- $link = pg_connect(DB_CONN);
-
- pg_query($link, "set client_encoding = 'utf-8'");
-
- if ($op == "Export") {
- print "
";
-
- } else {
-
- $result = pg_query("INSERT INTO ttrss_feeds (title, feed_url) VALUES
- ('$title', '$url')");
-
- print "Done.
";
-
- }
-
- }
- }
-
- function endElement($parser, $name) {
-
-
- }
-
- if ($op == "Import") {
-
- print "
-
- Return to preferences";
+ $op = $_REQUEST['op'];
- return;
+ if ($op == "publish"){
+ $key = $_REQUEST["key"];
+ $pdo = Db::pdo();
- }
- }
+ $sth = $pdo->prepare( "SELECT owner_uid
+ FROM ttrss_access_keys WHERE
+ access_key = ? AND feed_id = 'OPML:Publish'");
+ $sth->execute([$key]);
- xml_parser_free($xml_parser);
- fclose($fp);
+ if ($row = $sth->fetch()) {
+ $owner_uid = $row['owner_uid'];
- } else {
- print("Error: Could not open OPML input.");
- }
+ $opml = new Opml($_REQUEST);
+ $opml->opml_export("", $owner_uid, true, false);
- } else {
- print "Error: please upload OPML file.";
+ } else {
+ print "
- Return to preferences"; - - print "