opml.php 805 B

1234567891011121314151617181920212223242526272829303132333435
  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 = db_escape_string( $_REQUEST["key"]);
  15. $result = db_query( "SELECT owner_uid
  16. FROM ttrss_access_keys WHERE
  17. access_key = '$key' AND feed_id = 'OPML:Publish'");
  18. if (db_num_rows($result) == 1) {
  19. $owner_uid = db_fetch_result($result, 0, "owner_uid");
  20. $opml = new Opml($_REQUEST);
  21. $opml->opml_export("", $owner_uid, true, false);
  22. } else {
  23. print "<error>User not found</error>";
  24. }
  25. }
  26. ?>