diff options
author | ArthurHoaro <arthur@hoa.ro> | 2018-06-08 12:50:49 +0200 |
---|---|---|
committer | ArthurHoaro <arthur@hoa.ro> | 2018-07-05 20:34:22 +0200 |
commit | 28f26524609338316cc6e51c743058e6e8c7b12b (patch) | |
tree | e03f1e5dde3779a47a682cf1461151fbd687e4bb /application/PageBuilder.php | |
parent | 787faa42f3a2bcbf83a7853f23f3667a6febf9da (diff) | |
download | Shaarli-28f26524609338316cc6e51c743058e6e8c7b12b.tar.gz Shaarli-28f26524609338316cc6e51c743058e6e8c7b12b.tar.zst Shaarli-28f26524609338316cc6e51c743058e6e8c7b12b.zip |
Add a page to update all thumbnails through AJAX requests in both templates
Diffstat (limited to 'application/PageBuilder.php')
-rw-r--r-- | application/PageBuilder.php | 28 |
1 files changed, 23 insertions, 5 deletions
diff --git a/application/PageBuilder.php b/application/PageBuilder.php index 3dba7677..5da70811 100644 --- a/application/PageBuilder.php +++ b/application/PageBuilder.php | |||
@@ -22,10 +22,20 @@ class PageBuilder | |||
22 | protected $conf; | 22 | protected $conf; |
23 | 23 | ||
24 | /** | 24 | /** |
25 | * @var array $_SESSION | ||
26 | */ | ||
27 | protected $session; | ||
28 | |||
29 | /** | ||
25 | * @var LinkDB $linkDB instance. | 30 | * @var LinkDB $linkDB instance. |
26 | */ | 31 | */ |
27 | protected $linkDB; | 32 | protected $linkDB; |
28 | 33 | ||
34 | /** | ||
35 | * @var null|string XSRF token | ||
36 | */ | ||
37 | protected $token; | ||
38 | |||
29 | /** @var bool $isLoggedIn Whether the user is logged in **/ | 39 | /** @var bool $isLoggedIn Whether the user is logged in **/ |
30 | protected $isLoggedIn = false; | 40 | protected $isLoggedIn = false; |
31 | 41 | ||
@@ -33,14 +43,17 @@ class PageBuilder | |||
33 | * PageBuilder constructor. | 43 | * PageBuilder constructor. |
34 | * $tpl is initialized at false for lazy loading. | 44 | * $tpl is initialized at false for lazy loading. |
35 | * | 45 | * |
36 | * @param ConfigManager $conf Configuration Manager instance (reference). | 46 | * @param ConfigManager $conf Configuration Manager instance (reference). |
37 | * @param LinkDB $linkDB instance. | 47 | * @param array $session $_SESSION array |
38 | * @param string $token Session token | 48 | * @param LinkDB $linkDB instance. |
49 | * @param string $token Session token | ||
50 | * @param bool $isLoggedIn | ||
39 | */ | 51 | */ |
40 | public function __construct(&$conf, $linkDB = null, $token = null, $isLoggedIn = false) | 52 | public function __construct(&$conf, $session, $linkDB = null, $token = null, $isLoggedIn = false) |
41 | { | 53 | { |
42 | $this->tpl = false; | 54 | $this->tpl = false; |
43 | $this->conf = $conf; | 55 | $this->conf = $conf; |
56 | $this->session = $session; | ||
44 | $this->linkDB = $linkDB; | 57 | $this->linkDB = $linkDB; |
45 | $this->token = $token; | 58 | $this->token = $token; |
46 | $this->isLoggedIn = $isLoggedIn; | 59 | $this->isLoggedIn = $isLoggedIn; |
@@ -110,6 +123,11 @@ class PageBuilder | |||
110 | $this->tpl->assign('thumbnails_width', $this->conf->get('thumbnails.width')); | 123 | $this->tpl->assign('thumbnails_width', $this->conf->get('thumbnails.width')); |
111 | $this->tpl->assign('thumbnails_height', $this->conf->get('thumbnails.height')); | 124 | $this->tpl->assign('thumbnails_height', $this->conf->get('thumbnails.height')); |
112 | 125 | ||
126 | if (! empty($_SESSION['warnings'])) { | ||
127 | $this->tpl->assign('global_warnings', $_SESSION['warnings']); | ||
128 | unset($_SESSION['warnings']); | ||
129 | } | ||
130 | |||
113 | // To be removed with a proper theme configuration. | 131 | // To be removed with a proper theme configuration. |
114 | $this->tpl->assign('conf', $this->conf); | 132 | $this->tpl->assign('conf', $this->conf); |
115 | } | 133 | } |