]>
git.wh0rd.org - tt-rss.git/blob - api/index.php
770e09780f7067829b0022a1523b915fd000fae9
2 error_reporting(E_ERROR | E_PARSE
);
4 require_once "../config.php";
6 set_include_path(get_include_path() . PATH_SEPARATOR
.
7 dirname(__FILE__
) . PATH_SEPARATOR
.
8 dirname(dirname(__FILE__
)) . PATH_SEPARATOR
.
9 dirname(dirname(__FILE__
)) . "/include" );
13 require_once "db.php";
14 require_once "db-prefs.php";
15 require_once "functions.php";
17 if (defined('ENABLE_GZIP_OUTPUT') && ENABLE_GZIP_OUTPUT
&&
18 function_exists("ob_gzhandler")) {
20 ob_start("ob_gzhandler");
23 $link = db_connect(DB_HOST
, DB_USER
, DB_PASS
, DB_NAME
);
25 $session_expire = SESSION_EXPIRE_TIME
; //seconds
26 $session_name = (!defined('TTRSS_SESSION_NAME')) ?
"ttrss_sid_api" : TTRSS_SESSION_NAME
. "_api";
28 session_name($session_name);
30 $input = file_get_contents("php://input");
32 // Override $_REQUEST with JSON-encoded data if available
34 $input = json_decode($input, true);
36 if ($input) $_REQUEST = $input;
39 if ($_REQUEST["sid"]) {
40 session_id($_REQUEST["sid"]);
45 if (!init_connection($link)) return;
47 $method = strtolower($_REQUEST["op"]);
49 $handler = new API($link, $_REQUEST);
51 if ($handler->before($method)) {
52 if ($method && method_exists($handler, $method)) {
54 } else if (method_exists($handler, 'index')) {
55 $handler->index($method);