]> git.wh0rd.org - tt-rss.git/blob - opml.php
Merge branch 'master' of git://github.com/skikuta/Tiny-Tiny-RSS into skikuta-master
[tt-rss.git] / opml.php
1 <?php
2 set_include_path(dirname(__FILE__) ."/include" . PATH_SEPARATOR .
3 get_include_path());
4
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
12 $link = db_connect(DB_HOST, DB_USER, DB_PASS, DB_NAME);
13
14 if (!init_connection($link)) return;
15
16 $op = $_REQUEST['op'];
17
18 if ($op == "publish"){
19 $key = db_escape_string($link, $_REQUEST["key"]);
20
21 $result = db_query($link, "SELECT owner_uid
22 FROM ttrss_access_keys WHERE
23 access_key = '$key' AND feed_id = 'OPML:Publish'");
24
25 if (db_num_rows($result) == 1) {
26 $owner_uid = db_fetch_result($result, 0, "owner_uid");
27
28 $opml = new Opml($link, $_REQUEST);
29 $opml->opml_export("", $owner_uid, true, false);
30
31 } else {
32 print "<error>User not found</error>";
33 }
34 }
35
36 db_close($link);
37
38 ?>