diff --git a/Web/Presenters/OpenVKPresenter.php b/Web/Presenters/OpenVKPresenter.php index 6caf21d5..eed07884 100755 --- a/Web/Presenters/OpenVKPresenter.php +++ b/Web/Presenters/OpenVKPresenter.php @@ -34,10 +34,10 @@ abstract class OpenVKPresenter extends SimplePresenter ])); } - protected function setTempTheme(string $theme): void - { - Session::i()->set("_tempTheme", $theme); - } + protected function setTempTheme(string $theme): void + { + Session::i()->set("_tempTheme", $theme); + } protected function flashFail(string $type, string $title, ?string $message = NULL, ?int $code = NULL): void { @@ -221,25 +221,19 @@ abstract class OpenVKPresenter extends SimplePresenter { parent::onBeforeRender(); - if(!is_null($this->user)) { - $theme = $this->user->identity->getTheme(); - if(!is_null($theme) && $theme->overridesTemplates()) { - $this->template->_templatePath = $theme->getBaseDir() . "/tpl"; - } - } + if(Session::i()->get("_tempTheme")) + $theme = Themepacks::i()[Session::i()->get("_tempTheme", "ovk")]; + else if($this->requestParam("themePreview")) + $theme = Themepacks::i()[$this->requestParam("themePreview")]; + else if($this->user->identity !== null && $this->user->identity->getTheme()) + $theme = $this->user->identity->getTheme(); + + if(!is_null($theme) && $theme->overridesTemplates()) + $this->template->_templatePath = $theme->getBaseDir() . "/tpl"; if(!is_null(Session::i()->get("_error"))) { $this->template->flashMessage = json_decode(Session::i()->get("_error")); Session::i()->set("_error", NULL); } - - if(Session::i()->get("_tempTheme")) - $this->template->theme = Themepacks::i()[Session::i()->get("_tempTheme", "ovk")]; - else if($this->requestParam("themePreview")) - $this->template->theme = Themepacks::i()[$this->requestParam("themePreview")]; - else if($this->user->identity !== null && $this->user->identity->getTheme()) - $this->template->theme = $this->user->identity->getTheme(); - - // Знаю, каша ебаная, целестора рефактор всё равно сделает :))) } }