X-Git-Url: https://git.wh0rd.org/?a=blobdiff_plain;f=opml.php;h=bdee88e081694a516cc711290023b3a7d0e09854;hb=e2b8c9273e09091c235959c25d8e4d8122aa6ca8;hp=9adeb4025ca99379d8df687e5ee78a50e6b36abc;hpb=66581886f8ace4076d2c08431904974d3f1a4f7a;p=tt-rss.git
diff --git a/opml.php b/opml.php
index 9adeb402..bdee88e0 100644
--- a/opml.php
+++ b/opml.php
@@ -1,158 +1,37 @@
-
- session_start();
+";
- }
-
require_once "config.php";
require_once "db.php";
require_once "db-prefs.php";
-// $_SESSION["uid"] = PLACEHOLDER_UID; // FIXME: placeholder
-
- $link = db_connect(DB_HOST, DB_USER, DB_PASS, DB_NAME);
-
- if (DB_TYPE == "pgsql") {
- pg_query($link, "set client_encoding = 'utf-8'");
- }
-
- if ($op == "Export") {
- print "
";
+ if (!init_plugins()) return;
- } else {
-
- $result = db_query($link, "INSERT INTO ttrss_feeds (title, feed_url,owner_uid) VALUES
- ('$title', '$url', '".$_SESSION["uid"]."')");
+ $op = $_REQUEST['op'];
- print "Done.
";
+ 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]);
- if ($link) db_close($link);
+ if ($row = $sth->fetch()) {
+ $owner_uid = $row['owner_uid'];
- }
- }
-
- function endElement($parser, $name) {
-
-
- }
-
- if ($op == "Import") {
-
- print "
-
- Return to preferences";
-
- return;
-
- }
- }
-
- xml_parser_free($xml_parser);
- fclose($fp);
-
- } else {
- print("Error: Could not open OPML input.");
- }
-
- } else {
- print "Error: please upload OPML file.";
+ } else {
+ print "
- Return to preferences"; - - print "