function __construct() { if (Config\Main::$dbEnabled) { DB::init('default', Config\Database::$data); } $vars = new NextFW\Vars(); // Get and Post as array $this->get = $vars['get']; $this->post = $vars['post']; $this->tpl = new View(); $this->tpl['path'] = PATH . "view" . DIRECTORY_SEPARATOR . Config\Main::$template . DIRECTORY_SEPARATOR; $this->tpl->set("THEME", DIRECTORY_SEPARATOR . "view" . DIRECTORY_SEPARATOR . Config\Main::$template . DIRECTORY_SEPARATOR); $username = isset($_SESSION['username']) ? $_SESSION['username'] : '******'; if (!Route::is_ajax()) { $loadTpl = 'index.tpl'; $this->tpl->loadTpl($loadTpl); $this->tpl->getBlocks(['content', 'breadcrumb']); $this->tpl->set('username', $username); } // module init $controller = "NextFW\\Module\\" . Route::getUrl()[0]; $className = str_replace("nextfw", "", strtolower(ltrim($controller, '\\'))); $fileName = ''; if ($lastNsPos = strrpos($className, '\\')) { $namespace = substr($className, 0, $lastNsPos); $className = substr($className, $lastNsPos + 1); $fileName = str_replace('\\', DIRECTORY_SEPARATOR, $namespace) . DIRECTORY_SEPARATOR; } $fileName .= str_replace('_', DIRECTORY_SEPARATOR, $className) . '.php'; if (file_exists(PATH . "/" . $fileName)) { /* @var object $controller */ $this->mod = new $controller(); } // end module init }
{ if (isset(self::${$offset})) { return (array) self::${$offset}; } else { return (array) $this->{$offset}; } } } Vars::init(); /* end global set */ /* init section */ header("Content-type: text/html; Charset=utf-8"); if (Config\Main::$debug) { ini_set('display_errors', 'On'); ini_set('html_errors', 'Off'); error_reporting(-1); } else { ini_set('display_errors', 'Off'); ini_set('html_errors', 'Off'); error_reporting(E_ALL); } ob_start(); register_shutdown_function(function () { $error = new Engine\Error(); $error->fatal_error_handler(); }); set_error_handler(["NextFW\\Engine\\Error", "error_handler"]); /* init section */ /* start application */ Engine\Route::init(Config\Main::$initPage);