opml.php 800 B

12345678910111213141516171819202122232425262728293031323334353637
  1. <?php
  2. set_include_path(dirname(__FILE__) ."/include" . PATH_SEPARATOR .
  3. get_include_path());
  4. require_once "autoload.php";
  5. require_once "functions.php";
  6. require_once "sessions.php";
  7. require_once "sanity_check.php";
  8. require_once "config.php";
  9. require_once "db.php";
  10. require_once "db-prefs.php";
  11. if (!init_plugins()) return;
  12. $op = $_REQUEST['op'];
  13. if ($op == "publish"){
  14. $key = $_REQUEST["key"];
  15. $pdo = Db::pdo();
  16. $sth = $pdo->prepare( "SELECT owner_uid
  17. FROM ttrss_access_keys WHERE
  18. access_key = ? AND feed_id = 'OPML:Publish'");
  19. $sth->execute([$key]);
  20. if ($row = $sth->fetch()) {
  21. $owner_uid = $row['owner_uid'];
  22. $opml = new Opml($_REQUEST);
  23. $opml->opml_export("", $owner_uid, true, false);
  24. } else {
  25. print "<error>User not found</error>";
  26. }
  27. }
  28. ?>