Take back my plugin - fix a bunch of bugs which counters not updating,

clean things up, sync back with ttrss source
This commit is contained in:
Grant Pannell
2017-05-16 01:10:32 +09:30
parent a7fd1e385e
commit 6d26584d34
3 changed files with 976 additions and 1028 deletions

View File

@@ -1,59 +1,67 @@
<?php
// do not support refresh command, this could take ages.
if (isset($_REQUEST["refresh"]))
{
exit;
}
// do not support refresh command, this could take ages.
if (isset($_REQUEST["refresh"]))
{
exit;
}
/* api/index.php */
error_reporting(E_ERROR | E_PARSE);
error_reporting(E_ERROR | E_PARSE);
require_once "../../config.php";
set_include_path(dirname(__FILE__) . PATH_SEPARATOR .
dirname(dirname(dirname(__FILE__))) . PATH_SEPARATOR .
dirname(dirname(dirname(__FILE__))) . "/include" . PATH_SEPARATOR .
get_include_path());
$tt_root = dirname(dirname(dirname($_SERVER['SCRIPT_FILENAME'])));
$tt_root2 = $tt_root;
if (file_exists($tt_root."/config.php")) {
require_once $tt_root."/config.php";
} else { //if (file_exists("../../config.php")) {
$tt_root = "../..";
$tt_root2 = dirname(dirname(dirname(__FILE__)));
require_once $tt_root."/config.php";
}
chdir("../..");
set_include_path(dirname(__FILE__) . PATH_SEPARATOR .
$tt_root2 . PATH_SEPARATOR .
$tt_root2 . "/include" . PATH_SEPARATOR .
get_include_path());
define('TTRSS_SESSION_NAME', 'ttrss_api_sid');
define('NO_SESSION_AUTOSTART', true);
chdir($tt_root);
require_once "autoload.php";
require_once "db.php";
require_once "db-prefs.php";
require_once "functions.php";
require_once "sessions.php";
require_once "fever_api.php";
define('NO_SESSION_AUTOSTART', true);
ini_set("session.gc_maxlifetime", 86400);
require_once "autoload.php";
require_once "db.php";
require_once "db-prefs.php";
require_once "functions.php";
require_once "fever_api.php";
define('AUTH_DISABLE_OTP', true);
define('AUTH_DISABLE_OTP', true);
if (defined('ENABLE_GZIP_OUTPUT') && ENABLE_GZIP_OUTPUT &&
function_exists("ob_gzhandler")) {
if (defined('ENABLE_GZIP_OUTPUT') && ENABLE_GZIP_OUTPUT &&
function_exists("ob_gzhandler")) {
ob_start("ob_gzhandler");
} else {
ob_start();
}
if ($_REQUEST["sid"]) {
session_id($_REQUEST["sid"]);
@session_start();
} else if (defined('_API_DEBUG_HTTP_ENABLED')) {
@session_start();
}
startup_gettext();
ob_start("ob_gzhandler");
} else {
ob_start();
}
if (!init_plugins()) return;
$handler = new FeverAPI($_REQUEST);
if (!init_plugins()) return;
if ($handler->before()) {
if (method_exists($handler, 'index')) {
$handler->index();
}
$handler->after();
}
header("Api-Content-Length: " . ob_get_length());
$handler = new FeverAPI(Db::get(), $_REQUEST);
if ($handler->before($method)) {
if (method_exists($handler, 'index')) {
$handler->index($method);
}
$handler->after();
}
ob_end_flush();
?>
ob_end_flush();
?>