Add some checking to locate config.php for obscure setups

This commit is contained in:
Grant Pannell
2018-01-23 03:41:29 +10:30
parent ffd88080ce
commit 6eca51dcab

View File

@@ -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);