use DateTime;
use Shaarli\Bookmark\Bookmark;
+use Shaarli\Render\TemplatePage;
use Slim\Http\Request;
use Slim\Http\Response;
*/
public function index(Request $request, Response $response): Response
{
- $this->assignView('pagetitle', t('Export') .' - '. $this->container->conf->get('general.title', 'Shaarli'));
+ $this->assignView('pagetitle', t('Export') . ' - ' . $this->container->conf->get('general.title', 'Shaarli'));
- return $response->write($this->render('export'));
+ return $response->write($this->render(TemplatePage::EXPORT));
}
/**
*/
public function export(Request $request, Response $response): Response
{
+ $this->checkToken($request);
+
$selection = $request->getParam('selection');
if (empty($selection)) {
$response = $response->withHeader('Content-Type', 'text/html; charset=utf-8');
$response = $response->withHeader(
'Content-disposition',
- 'attachment; filename=bookmarks_'.$selection.'_'.$now->format(Bookmark::LINK_DATE_FORMAT).'.html'
+ 'attachment; filename=bookmarks_' . $selection . '_' . $now->format(Bookmark::LINK_DATE_FORMAT) . '.html'
);
$this->assignView('date', $now->format(DateTime::RFC822));
$this->assignView('eol', PHP_EOL);
$this->assignView('selection', $selection);
- return $response->write($this->render('export.bookmarks'));
- }
-
- /**
- * @param mixed[] $data Variables passed to the template engine
- *
- * @return mixed[] Template data after active plugins render_picwall hook execution.
- */
- protected function executeHooks(array $data): array
- {
- $this->container->pluginManager->executeHooks(
- 'render_tools',
- $data
- );
-
- return $data;
+ return $response->write($this->render(TemplatePage::NETSCAPE_EXPORT_BOOKMARKS));
}
}