- if (!is_writable(DI::basePath() . '/view/smarty3')) {
- DI::logger()->critical(DI::l10n()->t('The folder view/smarty3/ must be writable by webserver.'));
- throw new InternalServerErrorException(DI::l10n()->t('Friendica can\'t display this page at the moment, please contact the administrator or check the Friendica log for errors.'));
+ $work_dir = DI::config()->get('smarty3', 'config_dir');
+ $use_sub_dirs = DI::config()->get('smarty3', 'use_sub_dirs');
+
+ $this->smarty = new FriendicaSmarty($this->theme, $this->theme_info, $work_dir, $use_sub_dirs);
+
+ if (!is_writable($work_dir)) {
+ $admin_message = DI::l10n()->t('The folder %s must be writable by webserver.', $work_dir);
+ DI::logger()->critical($admin_message);
+ $message = DI::app()->isSiteAdmin() ?
+ $admin_message :
+ DI::l10n()->t('Friendica can\'t display this page at the moment, please contact the administrator.');
+ throw new ServiceUnavailableException($message);