public function __construct($environment, $basedir) { global $g_startTime; $g_startTime = microtime(true); if (static::$s_instance) { throw new \RuntimeException('Only one Atk app can be created'); } static::$s_instance = $this; $this->environment = $environment; //load .env variables only in development environment if (file_exists($basedir . '.env') && in_array(strtolower($environment), ['dev', 'develop', 'development'])) { $dotEnv = new Dotenv($basedir); $dotEnv->load(); } require_once 'adodb-time.php'; Config::init(); if (Config::getGlobal('debug') > 0) { ini_set('display_errors', 1); } if (Config::getGlobal('use_atkerrorhandler', true)) { set_error_handler('Sintattica\\Atk\\Core\\Tools::atkErrorHandler'); error_reporting(E_ALL); set_exception_handler('Sintattica\\Atk\\Core\\Tools::atkExceptionHandler'); register_shutdown_function('Sintattica\\Atk\\Core\\Tools::atkFatalHandler'); } // Filter the atkselector REQUEST variable for blacklisted SQL (like UNIONs) SqlWhereclauseBlacklistChecker::filter_request_where_clause('atkselector'); SqlWhereclauseBlacklistChecker::filter_request_where_clause('atkfilter'); // set locale $locale = Tools::atktext('locale', 'atk', '', '', true); if ($locale) { setlocale(LC_TIME, $locale); } $debug = 'Created a new Atk (' . self::VERSION . ') instance.'; $debug .= ' Environment: ' . $environment . '.'; if (isset($_SERVER['SERVER_NAME']) && isset($_SERVER['SERVER_ADDR'])) { $debug .= ' Server info: ' . $_SERVER['SERVER_NAME'] . ' (' . $_SERVER['SERVER_ADDR'] . ')'; } Tools::atkdebug($debug); //load modules $modules = Config::getGlobal('modules'); if (is_array($modules)) { foreach ($modules as $module) { static::$s_instance->registerModule($module); } } }