aboutsummaryrefslogtreecommitdiffhomepage
path: root/index.php
diff options
context:
space:
mode:
authorArthurHoaro <arthur@hoa.ro>2020-01-26 11:15:15 +0100
committerArthurHoaro <arthur@hoa.ro>2020-07-23 21:19:21 +0200
commit485b168a9677d160b0c0426e4f282b9bd0c632c1 (patch)
treec7c21ea01096bfe28622b3a23c5c76d1cb2435fa /index.php
parentbee33239ed444f9724422fe5234cd79997500519 (diff)
downloadShaarli-485b168a9677d160b0c0426e4f282b9bd0c632c1.tar.gz
Shaarli-485b168a9677d160b0c0426e4f282b9bd0c632c1.tar.zst
Shaarli-485b168a9677d160b0c0426e4f282b9bd0c632c1.zip
Process picwall rendering through Slim controller + UT
Diffstat (limited to 'index.php')
-rw-r--r--index.php33
1 files changed, 2 insertions, 31 deletions
diff --git a/index.php b/index.php
index d3cb33d3..c639a3bc 100644
--- a/index.php
+++ b/index.php
@@ -610,37 +610,7 @@ function renderPage($conf, $pluginManager, $bookmarkService, $history, $sessionM
610 610
611 // -------- Picture wall 611 // -------- Picture wall
612 if ($targetPage == Router::$PAGE_PICWALL) { 612 if ($targetPage == Router::$PAGE_PICWALL) {
613 $PAGE->assign('pagetitle', t('Picture wall') .' - '. $conf->get('general.title', 'Shaarli')); 613 header('Location: ./picture-wall');
614 if (! $conf->get('thumbnails.mode', Thumbnailer::MODE_NONE) === Thumbnailer::MODE_NONE) {
615 $PAGE->assign('linksToDisplay', []);
616 $PAGE->renderPage('picwall');
617 exit;
618 }
619
620 // Optionally filter the results:
621 $links = $bookmarkService->search($_GET);
622 $linksToDisplay = [];
623
624 // Get only bookmarks which have a thumbnail.
625 // Note: we do not retrieve thumbnails here, the request is too heavy.
626 $factory = new FormatterFactory($conf, $loginManager->isLoggedIn());
627 $formatter = $factory->getFormatter();
628 foreach ($links as $key => $link) {
629 if ($link->getThumbnail() !== false) {
630 $linksToDisplay[] = $formatter->format($link);
631 }
632 }
633
634 $data = [
635 'linksToDisplay' => $linksToDisplay,
636 ];
637 $pluginManager->executeHooks('render_picwall', $data, ['loggedin' => $loginManager->isLoggedIn()]);
638
639 foreach ($data as $key => $value) {
640 $PAGE->assign($key, $value);
641 }
642
643 $PAGE->renderPage('picwall');
644 exit; 614 exit;
645 } 615 }
646 616
@@ -1944,6 +1914,7 @@ $app->group('/api/v1', function () {
1944 1914
1945$app->group('', function () { 1915$app->group('', function () {
1946 $this->get('/login', '\Shaarli\Front\Controller\LoginController:index')->setName('login'); 1916 $this->get('/login', '\Shaarli\Front\Controller\LoginController:index')->setName('login');
1917 $this->get('/picture-wall', '\Shaarli\Front\Controller\PictureWallController:index')->setName('picwall');
1947})->add('\Shaarli\Front\ShaarliMiddleware'); 1918})->add('\Shaarli\Front\ShaarliMiddleware');
1948 1919
1949$response = $app->run(true); 1920$response = $app->run(true);