From fabff3835da26e6c95cea56b2a01a03749dec7c8 Mon Sep 17 00:00:00 2001 From: ArthurHoaro Date: Wed, 22 Jul 2020 18:12:10 +0200 Subject: Move PHP and config init to dedicated file in order to keep index.php as minimal as possible --- application/security/SessionManager.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'application/security') 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 @@ -48,6 +48,20 @@ class SessionManager $this->savePath = $savePath; } + /** + * Initialize XSRF token and links per page session variables. + */ + public function initialize(): void + { + if (!isset($this->session['tokens'])) { + $this->session['tokens'] = []; + } + + if (!isset($this->session['LINKS_PER_PAGE'])) { + $this->session['LINKS_PER_PAGE'] = $this->conf->get('general.links_per_page', 20); + } + } + /** * Define whether the user should stay signed in across browser sessions * -- cgit v1.2.3