diff options
Diffstat (limited to 'index.php')
-rw-r--r-- | index.php | 15 |
1 files changed, 9 insertions, 6 deletions
@@ -182,9 +182,11 @@ define('STAY_SIGNED_IN_TOKEN', sha1($conf->get('credentials.hash') . $_SERVER['R | |||
182 | $loginManager->checkLoginState($_SESSION, $_COOKIE, WEB_PATH, $clientIpId, STAY_SIGNED_IN_TOKEN); | 182 | $loginManager->checkLoginState($_SESSION, $_COOKIE, WEB_PATH, $clientIpId, STAY_SIGNED_IN_TOKEN); |
183 | 183 | ||
184 | /** | 184 | /** |
185 | * Adapter function for PageBuilder | 185 | * Adapter function to ensure compatibility with third-party templates |
186 | * | 186 | * |
187 | * TODO: update PageBuilder and tests | 187 | * @see https://github.com/shaarli/Shaarli/pull/1086 |
188 | * | ||
189 | * @return bool true when the user is logged in, false otherwise | ||
188 | */ | 190 | */ |
189 | function isLoggedIn() | 191 | function isLoggedIn() |
190 | { | 192 | { |
@@ -383,9 +385,10 @@ function showDailyRSS($conf, $loginManager) { | |||
383 | * @param PageBuilder $pageBuilder Template engine wrapper. | 385 | * @param PageBuilder $pageBuilder Template engine wrapper. |
384 | * @param LinkDB $LINKSDB LinkDB instance. | 386 | * @param LinkDB $LINKSDB LinkDB instance. |
385 | * @param ConfigManager $conf Configuration Manager instance. | 387 | * @param ConfigManager $conf Configuration Manager instance. |
386 | * @param PluginManager $pluginManager Plugin Manager instane. | 388 | * @param PluginManager $pluginManager Plugin Manager instance. |
389 | * @param LoginManager $loginManager Login Manager instance | ||
387 | */ | 390 | */ |
388 | function showDaily($pageBuilder, $LINKSDB, $conf, $pluginManager) | 391 | function showDaily($pageBuilder, $LINKSDB, $conf, $pluginManager, $loginManager) |
389 | { | 392 | { |
390 | $day = date('Ymd', strtotime('-1 day')); // Yesterday, in format YYYYMMDD. | 393 | $day = date('Ymd', strtotime('-1 day')); // Yesterday, in format YYYYMMDD. |
391 | if (isset($_GET['day'])) { | 394 | if (isset($_GET['day'])) { |
@@ -523,7 +526,7 @@ function renderPage($conf, $pluginManager, $LINKSDB, $history, $sessionManager, | |||
523 | die($e->getMessage()); | 526 | die($e->getMessage()); |
524 | } | 527 | } |
525 | 528 | ||
526 | $PAGE = new PageBuilder($conf, $LINKSDB, $sessionManager->generateToken()); | 529 | $PAGE = new PageBuilder($conf, $LINKSDB, $sessionManager->generateToken(), $loginManager->isLoggedIn()); |
527 | $PAGE->assign('linkcount', count($LINKSDB)); | 530 | $PAGE->assign('linkcount', count($LINKSDB)); |
528 | $PAGE->assign('privateLinkcount', count_private($LINKSDB)); | 531 | $PAGE->assign('privateLinkcount', count_private($LINKSDB)); |
529 | $PAGE->assign('plugin_errors', $pluginManager->getErrors()); | 532 | $PAGE->assign('plugin_errors', $pluginManager->getErrors()); |
@@ -708,7 +711,7 @@ function renderPage($conf, $pluginManager, $LINKSDB, $history, $sessionManager, | |||
708 | 711 | ||
709 | // Daily page. | 712 | // Daily page. |
710 | if ($targetPage == Router::$PAGE_DAILY) { | 713 | if ($targetPage == Router::$PAGE_DAILY) { |
711 | showDaily($PAGE, $LINKSDB, $conf, $pluginManager); | 714 | showDaily($PAGE, $LINKSDB, $conf, $pluginManager, $loginManager); |
712 | } | 715 | } |
713 | 716 | ||
714 | // ATOM and RSS feed. | 717 | // ATOM and RSS feed. |