opml.php 800 Bytes
Newer Older
1
<?php
2 3
	set_include_path(dirname(__FILE__) ."/include" . PATH_SEPARATOR .
		get_include_path());
4

5
	require_once "autoload.php";
6
	require_once "functions.php";
7 8 9 10 11 12
	require_once "sessions.php";
	require_once "sanity_check.php";
	require_once "config.php";
	require_once "db.php";
	require_once "db-prefs.php";

13
	if (!init_plugins()) return;
14

15
	$op = $_REQUEST['op'];
16

17
	if ($op == "publish"){
18 19
		$key = $_REQUEST["key"];
		$pdo = Db::pdo();
20

21
		$sth = $pdo->prepare( "SELECT owner_uid
22
				FROM ttrss_access_keys WHERE
23 24
				access_key = ? AND feed_id = 'OPML:Publish'");
		$sth->execute([$key]);
25

26 27
		if ($row = $sth->fetch()) {
			$owner_uid = $row['owner_uid'];
28

29
			$opml = new Opml($_REQUEST);
30
			$opml->opml_export("", $owner_uid, true, false);
31

32 33
		} else {
			print "<error>User not found</error>";
34 35 36 37
		}
	}

?>