diff --git a/lib/classes/api/api_includes.inc.php b/lib/classes/api/api_includes.inc.php index f7446b51..daea22b7 100644 --- a/lib/classes/api/api_includes.inc.php +++ b/lib/classes/api/api_includes.inc.php @@ -17,6 +17,32 @@ */ if (! defined('FROXLOR_INSTALL_DIR')) { define('FROXLOR_INSTALL_DIR', dirname(dirname(dirname(__DIR__)))); + // ensure that default timezone is set + if (function_exists("date_default_timezone_set") && function_exists("date_default_timezone_get")) { + @date_default_timezone_set(@date_default_timezone_get()); + } + $installed = true; + // check whether the userdata file exists + if (! @file_exists(FROXLOR_INSTALL_DIR . '/lib/userdata.inc.php')) { + $installed = false; + } + // check whether we can read the userdata file + if ($installed && ! @is_readable(FROXLOR_INSTALL_DIR . '/lib/userdata.inc.php')) { + $installed = false; + } + if ($installed) { + // include userdata for content-check + require FROXLOR_INSTALL_DIR . '/lib/userdata.inc.php'; + if (! isset($sql) || ! is_array($sql)) { + $installed = false; + } + } + // do not try to do anything if we have no installed/configured froxlor + if (! $installed) { + header("Status: 404 Not found", 404); + header($_SERVER["SERVER_PROTOCOL"] . " 404 Not found", 404); + exit(); + } require_once FROXLOR_INSTALL_DIR . '/lib/tables.inc.php'; require_once FROXLOR_INSTALL_DIR . '/lib/functions.php'; }