diff --git a/index.php b/index.php index 6954eb5..6601805 100644 --- a/index.php +++ b/index.php @@ -9,14 +9,25 @@ /* api/index.php */ 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()); + + chdir($tt_root); define('TTRSS_SESSION_NAME', 'ttrss_api_sid'); define('NO_SESSION_AUTOSTART', true);