aboutsummaryrefslogtreecommitdiffhomepage
path: root/application
diff options
context:
space:
mode:
Diffstat (limited to 'application')
-rw-r--r--application/render/PageBuilder.php20
-rw-r--r--application/security/SessionManager.php14
2 files changed, 14 insertions, 20 deletions
diff --git a/application/render/PageBuilder.php b/application/render/PageBuilder.php
index 85e1d59d..471724c0 100644
--- a/application/render/PageBuilder.php
+++ b/application/render/PageBuilder.php
@@ -158,10 +158,6 @@ class PageBuilder
158 */ 158 */
159 protected function finalize(): void 159 protected function finalize(): void
160 { 160 {
161 //FIXME - DEV _ REMOVE ME
162 $this->assign('base_path', '/Shaarli');
163 $this->assign('asset_path', '/Shaarli/tpl/default');
164
165 // TODO: use the SessionManager 161 // TODO: use the SessionManager
166 $messageKeys = [ 162 $messageKeys = [
167 SessionManager::KEY_SUCCESS_MESSAGES, 163 SessionManager::KEY_SUCCESS_MESSAGES,
@@ -248,20 +244,4 @@ class PageBuilder
248 244
249 return $this->tpl->draw($page, true); 245 return $this->tpl->draw($page, true);
250 } 246 }
251
252 /**
253 * Render a 404 page (uses the template : tpl/404.tpl)
254 * usage: $PAGE->render404('The link was deleted')
255 *
256 * @param string $message A message to display what is not found
257 */
258 public function render404($message = '')
259 {
260 if (empty($message)) {
261 $message = t('The page you are trying to reach does not exist or has been deleted.');
262 }
263 header($_SERVER['SERVER_PROTOCOL'] . ' ' . t('404 Not Found'));
264 $this->tpl->assign('error_message', $message);
265 $this->renderPage('404');
266 }
267} 247}
diff --git a/application/security/SessionManager.php b/application/security/SessionManager.php
index 46219a3d..76b0afe8 100644
--- a/application/security/SessionManager.php
+++ b/application/security/SessionManager.php
@@ -49,6 +49,20 @@ class SessionManager
49 } 49 }
50 50
51 /** 51 /**
52 * Initialize XSRF token and links per page session variables.
53 */
54 public function initialize(): void
55 {
56 if (!isset($this->session['tokens'])) {
57 $this->session['tokens'] = [];
58 }
59
60 if (!isset($this->session['LINKS_PER_PAGE'])) {
61 $this->session['LINKS_PER_PAGE'] = $this->conf->get('general.links_per_page', 20);
62 }
63 }
64
65 /**
52 * Define whether the user should stay signed in across browser sessions 66 * Define whether the user should stay signed in across browser sessions
53 * 67 *
54 * @param bool $staySignedIn Keep the user signed in 68 * @param bool $staySignedIn Keep the user signed in