diff options
Diffstat (limited to 'application/PageBuilder.php')
-rw-r--r-- | application/PageBuilder.php | 37 |
1 files changed, 32 insertions, 5 deletions
diff --git a/application/PageBuilder.php b/application/PageBuilder.php index a4483870..b1abe0d0 100644 --- a/application/PageBuilder.php +++ b/application/PageBuilder.php | |||
@@ -1,6 +1,7 @@ | |||
1 | <?php | 1 | <?php |
2 | 2 | ||
3 | use Shaarli\Config\ConfigManager; | 3 | use Shaarli\Config\ConfigManager; |
4 | use Shaarli\Thumbnailer; | ||
4 | 5 | ||
5 | /** | 6 | /** |
6 | * This class is in charge of building the final page. | 7 | * This class is in charge of building the final page. |
@@ -22,10 +23,20 @@ class PageBuilder | |||
22 | protected $conf; | 23 | protected $conf; |
23 | 24 | ||
24 | /** | 25 | /** |
26 | * @var array $_SESSION | ||
27 | */ | ||
28 | protected $session; | ||
29 | |||
30 | /** | ||
25 | * @var LinkDB $linkDB instance. | 31 | * @var LinkDB $linkDB instance. |
26 | */ | 32 | */ |
27 | protected $linkDB; | 33 | protected $linkDB; |
28 | 34 | ||
35 | /** | ||
36 | * @var null|string XSRF token | ||
37 | */ | ||
38 | protected $token; | ||
39 | |||
29 | /** @var bool $isLoggedIn Whether the user is logged in **/ | 40 | /** @var bool $isLoggedIn Whether the user is logged in **/ |
30 | protected $isLoggedIn = false; | 41 | protected $isLoggedIn = false; |
31 | 42 | ||
@@ -33,14 +44,17 @@ class PageBuilder | |||
33 | * PageBuilder constructor. | 44 | * PageBuilder constructor. |
34 | * $tpl is initialized at false for lazy loading. | 45 | * $tpl is initialized at false for lazy loading. |
35 | * | 46 | * |
36 | * @param ConfigManager $conf Configuration Manager instance (reference). | 47 | * @param ConfigManager $conf Configuration Manager instance (reference). |
37 | * @param LinkDB $linkDB instance. | 48 | * @param array $session $_SESSION array |
38 | * @param string $token Session token | 49 | * @param LinkDB $linkDB instance. |
50 | * @param string $token Session token | ||
51 | * @param bool $isLoggedIn | ||
39 | */ | 52 | */ |
40 | public function __construct(&$conf, $linkDB = null, $token = null, $isLoggedIn = false) | 53 | public function __construct(&$conf, $session, $linkDB = null, $token = null, $isLoggedIn = false) |
41 | { | 54 | { |
42 | $this->tpl = false; | 55 | $this->tpl = false; |
43 | $this->conf = $conf; | 56 | $this->conf = $conf; |
57 | $this->session = $session; | ||
44 | $this->linkDB = $linkDB; | 58 | $this->linkDB = $linkDB; |
45 | $this->token = $token; | 59 | $this->token = $token; |
46 | $this->isLoggedIn = $isLoggedIn; | 60 | $this->isLoggedIn = $isLoggedIn; |
@@ -105,6 +119,19 @@ class PageBuilder | |||
105 | if ($this->linkDB !== null) { | 119 | if ($this->linkDB !== null) { |
106 | $this->tpl->assign('tags', $this->linkDB->linksCountPerTag()); | 120 | $this->tpl->assign('tags', $this->linkDB->linksCountPerTag()); |
107 | } | 121 | } |
122 | |||
123 | $this->tpl->assign( | ||
124 | 'thumbnails_enabled', | ||
125 | $this->conf->get('thumbnails.mode', Thumbnailer::MODE_NONE) !== Thumbnailer::MODE_NONE | ||
126 | ); | ||
127 | $this->tpl->assign('thumbnails_width', $this->conf->get('thumbnails.width')); | ||
128 | $this->tpl->assign('thumbnails_height', $this->conf->get('thumbnails.height')); | ||
129 | |||
130 | if (! empty($_SESSION['warnings'])) { | ||
131 | $this->tpl->assign('global_warnings', $_SESSION['warnings']); | ||
132 | unset($_SESSION['warnings']); | ||
133 | } | ||
134 | |||
108 | // To be removed with a proper theme configuration. | 135 | // To be removed with a proper theme configuration. |
109 | $this->tpl->assign('conf', $this->conf); | 136 | $this->tpl->assign('conf', $this->conf); |
110 | } | 137 | } |