diff options
author | ArthurHoaro <arthur@hoa.ro> | 2020-05-27 13:35:48 +0200 |
---|---|---|
committer | ArthurHoaro <arthur@hoa.ro> | 2020-07-23 21:19:21 +0200 |
commit | ef00f9d2033f6de11e71bf3a909399cae6f73a9f (patch) | |
tree | 96f47312084bab73be34495eed4280110a8ff258 /application/render/PageBuilder.php | |
parent | ba43064ddb7771fc97df135a32f9b0d5e373dd36 (diff) | |
download | Shaarli-ef00f9d2033f6de11e71bf3a909399cae6f73a9f.tar.gz Shaarli-ef00f9d2033f6de11e71bf3a909399cae6f73a9f.tar.zst Shaarli-ef00f9d2033f6de11e71bf3a909399cae6f73a9f.zip |
Process password change controller through Slim
Diffstat (limited to 'application/render/PageBuilder.php')
-rw-r--r-- | application/render/PageBuilder.php | 26 |
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; | |||
7 | use Shaarli\ApplicationUtils; | 7 | use Shaarli\ApplicationUtils; |
8 | use Shaarli\Bookmark\BookmarkServiceInterface; | 8 | use Shaarli\Bookmark\BookmarkServiceInterface; |
9 | use Shaarli\Config\ConfigManager; | 9 | use Shaarli\Config\ConfigManager; |
10 | use Shaarli\Security\SessionManager; | ||
10 | use Shaarli\Thumbnailer; | 11 | use 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 | ||