['ogg', 'mp3'], 'BackgroundImage' => ['img'], 'ForegroundImage' => ['img'], ]); error_reporting(YTKNS_DEBUG ? -1 : 0); mb_internal_encoding('UTF-8'); date_default_timezone_set('GMT'); // Display exception report set_exception_handler(function(\Throwable $ex) { if(YTKNS_CLI) { echo (string)$ex; exit; } http_response_code(500); $out = file_get_contents(YTKNS_TPL . (YTKNS_DEBUG ? '/debug/index.html' : '/errors/500.html')); echo strtr($out, [ ':raw_ex' => (string)$ex, ':type' => get_class($ex), ':msg' => $ex->getMessage(), ]); exit; }); // Turn uncaught errors into uncaught exceptions. set_error_handler(function(int $errno, string $errstr, string $errfile, int $errline) { throw new \ErrorException($errstr, 0, $errno, $errfile, $errline); return true; }, -1); $cfg = FileConfig::fromFile(YTKNS_ROOT . '/ytkns.cfg'); $db = DbTools::create($cfg->getString('database:dsn', 'null:')); $db->execute('SET SESSION time_zone = \'+00:00\', sql_mode = \'STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION\''); $ctx = new YtknsContext($cfg, $db); DB::init( $cfg->getString('pdo:dsn'), $cfg->getString('pdo:user'), $cfg->getString('pdo:pass'), DB::FLAGS );