use Shaarli\ApplicationUtils;
use Shaarli\Bookmark\BookmarkServiceInterface;
use Shaarli\Config\ConfigManager;
+use Shaarli\Security\SessionManager;
use Shaarli\Thumbnailer;
/**
$this->tpl->assign('thumbnails_width', $this->conf->get('thumbnails.width'));
$this->tpl->assign('thumbnails_height', $this->conf->get('thumbnails.height'));
- if (!empty($_SESSION['warnings'])) {
- $this->tpl->assign('global_warnings', $_SESSION['warnings']);
- unset($_SESSION['warnings']);
- }
-
$this->tpl->assign('formatter', $this->conf->get('formatter', 'default'));
// To be removed with a proper theme configuration.
$this->tpl->assign('conf', $this->conf);
}
+ /**
+ * Affect variable after controller processing.
+ * Used for alert messages.
+ */
+ protected function finalize(): void
+ {
+ //FIXME - DEV _ REMOVE ME
+ $this->assign('base_path', '/Shaarli');
+ $this->assign('asset_path', '/Shaarli/tpl/default');
+
+ // TODO: use the SessionManager
+ $messageKeys = [
+ SessionManager::KEY_SUCCESS_MESSAGES,
+ SessionManager::KEY_WARNING_MESSAGES,
+ SessionManager::KEY_ERROR_MESSAGES
+ ];
+ foreach ($messageKeys as $messageKey) {
+ if (!empty($_SESSION[$messageKey])) {
+ $this->tpl->assign('global_' . $messageKey, $_SESSION[$messageKey]);
+ unset($_SESSION[$messageKey]);
+ }
+ }
+ }
+
/**
* The following assign() method is basically the same as RainTPL (except lazy loading)
*
$this->initialize();
}
+ $this->finalize();
+
$this->tpl->draw($page);
}
$this->initialize();
}
+ $this->finalize();
+
return $this->tpl->draw($page, true);
}