]> git.wh0rd.org Git - tt-rss.git/blob - opml.php
remove $link
[tt-rss.git] / opml.php
1 <?php
2         set_include_path(dirname(__FILE__) ."/include" . PATH_SEPARATOR .
3                 get_include_path());
4
5         require_once "autoload.php";
6         require_once "functions.php";
7         require_once "sessions.php";
8         require_once "sanity_check.php";
9         require_once "config.php";
10         require_once "db.php";
11         require_once "db-prefs.php";
12
13         $link = db_connect(DB_HOST, DB_USER, DB_PASS, DB_NAME);
14
15         if (!init_plugins()) return;
16
17         $op = $_REQUEST['op'];
18
19         if ($op == "publish"){
20                 $key = db_escape_string( $_REQUEST["key"]);
21
22                 $result = db_query( "SELECT owner_uid
23                                 FROM ttrss_access_keys WHERE
24                                 access_key = '$key' AND feed_id = 'OPML:Publish'");
25
26                 if (db_num_rows($result) == 1) {
27                         $owner_uid = db_fetch_result($result, 0, "owner_uid");
28
29                         $opml = new Opml( $_REQUEST);
30                         $opml->opml_export("", $owner_uid, true, false);
31
32                 } else {
33                         print "<error>User not found</error>";
34                 }
35         }
36
37         db_close();
38
39 ?>