isNotSafeRequest()) { $this->checkHttpReferer(); $this->checkCsrfToken(); } $this->checkRateLimit(); return true; } public function initialize() { $this->navs = $this->getNavs(); $this->seo = $this->getSeo(); $this->site = $this->getSiteSettings(); $this->appInfo = $this->getAppInfo(); $this->authUser = $this->getAuthUser(); $this->seo->setTitle($this->site['title']); $this->view->setVar('seo', $this->seo); $this->view->setVar('site', $this->site); $this->view->setVar('navs', $this->navs); $this->view->setVar('app_info', $this->appInfo); $this->view->setVar('auth_user', $this->authUser); $this->view->setVar('socket_url', $this->getSocketUrl()); } protected function getAuthUser() { /** * @var WebAuth $auth */ $auth = $this->getDI()->get('auth'); return $auth->getCurrentUser(); } protected function getSeo() { return new Seo(); } protected function getNavs() { $cache = new NavCache(); return $cache->get() ?: []; } protected function getSiteSettings() { $cache = new SettingCache(); return $cache->get('site') ?: []; } protected function getAppInfo() { return new AppInfo(); } protected function getSocketUrl() { $config = $this->getDI()->get('config'); return $config->websocket->url; } }