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