aboutsummaryrefslogtreecommitdiffhomepage
path: root/application/render
diff options
context:
space:
mode:
Diffstat (limited to 'application/render')
-rw-r--r--application/render/PageBuilder.php26
1 files changed, 21 insertions, 5 deletions
diff --git a/application/render/PageBuilder.php b/application/render/PageBuilder.php
index f4fefda8..264cd33b 100644
--- a/application/render/PageBuilder.php
+++ b/application/render/PageBuilder.php
@@ -7,6 +7,7 @@ use RainTPL;
7use Shaarli\ApplicationUtils; 7use Shaarli\ApplicationUtils;
8use Shaarli\Bookmark\BookmarkServiceInterface; 8use Shaarli\Bookmark\BookmarkServiceInterface;
9use Shaarli\Config\ConfigManager; 9use Shaarli\Config\ConfigManager;
10use Shaarli\Security\SessionManager;
10use Shaarli\Thumbnailer; 11use Shaarli\Thumbnailer;
11 12
12/** 13/**
@@ -136,17 +137,28 @@ class PageBuilder
136 $this->tpl->assign('thumbnails_width', $this->conf->get('thumbnails.width')); 137 $this->tpl->assign('thumbnails_width', $this->conf->get('thumbnails.width'));
137 $this->tpl->assign('thumbnails_height', $this->conf->get('thumbnails.height')); 138 $this->tpl->assign('thumbnails_height', $this->conf->get('thumbnails.height'));
138 139
139 if (!empty($_SESSION['warnings'])) {
140 $this->tpl->assign('global_warnings', $_SESSION['warnings']);
141 unset($_SESSION['warnings']);
142 }
143
144 $this->tpl->assign('formatter', $this->conf->get('formatter', 'default')); 140 $this->tpl->assign('formatter', $this->conf->get('formatter', 'default'));
145 141
146 // To be removed with a proper theme configuration. 142 // To be removed with a proper theme configuration.
147 $this->tpl->assign('conf', $this->conf); 143 $this->tpl->assign('conf', $this->conf);
148 } 144 }
149 145
146 protected function finalize(): void
147 {
148 // TODO: use the SessionManager
149 $messageKeys = [
150 SessionManager::KEY_SUCCESS_MESSAGES,
151 SessionManager::KEY_WARNING_MESSAGES,
152 SessionManager::KEY_ERROR_MESSAGES
153 ];
154 foreach ($messageKeys as $messageKey) {
155 if (!empty($_SESSION[$messageKey])) {
156 $this->tpl->assign('global_' . $messageKey, $_SESSION[$messageKey]);
157 unset($_SESSION[$messageKey]);
158 }
159 }
160 }
161
150 /** 162 /**
151 * The following assign() method is basically the same as RainTPL (except lazy loading) 163 * The following assign() method is basically the same as RainTPL (except lazy loading)
152 * 164 *
@@ -196,6 +208,8 @@ class PageBuilder
196 $this->initialize(); 208 $this->initialize();
197 } 209 }
198 210
211 $this->finalize();
212
199 $this->tpl->draw($page); 213 $this->tpl->draw($page);
200 } 214 }
201 215
@@ -213,6 +227,8 @@ class PageBuilder
213 $this->initialize(); 227 $this->initialize();
214 } 228 }
215 229
230 $this->finalize();
231
216 return $this->tpl->draw($page, true); 232 return $this->tpl->draw($page, true);
217 } 233 }
218 234