aboutsummaryrefslogtreecommitdiffhomepage
path: root/index.php
diff options
context:
space:
mode:
Diffstat (limited to 'index.php')
-rw-r--r--index.php35
1 files changed, 8 insertions, 27 deletions
diff --git a/index.php b/index.php
index 9202cb84..a07de74d 100644
--- a/index.php
+++ b/index.php
@@ -603,38 +603,14 @@ function renderPage($conf, $pluginManager, $bookmarkService, $history, $sessionM
603 603
604 // -------- Thumbnails Update 604 // -------- Thumbnails Update
605 if ($targetPage == Router::$PAGE_THUMBS_UPDATE) { 605 if ($targetPage == Router::$PAGE_THUMBS_UPDATE) {
606 $ids = []; 606 header('Location: ./admin/thumbnails');
607 foreach ($bookmarkService->search() as $bookmark) {
608 // A note or not HTTP(S)
609 if ($bookmark->isNote() || ! startsWith(strtolower($bookmark->getUrl()), 'http')) {
610 continue;
611 }
612 $ids[] = $bookmark->getId();
613 }
614 $PAGE->assign('ids', $ids);
615 $PAGE->assign('pagetitle', t('Thumbnails update') .' - '. $conf->get('general.title', 'Shaarli'));
616 $PAGE->renderPage('thumbnails');
617 exit; 607 exit;
618 } 608 }
619 609
620 // -------- Single Thumbnail Update 610 // -------- Single Thumbnail Update
621 if ($targetPage == Router::$AJAX_THUMB_UPDATE) { 611 if ($targetPage == Router::$AJAX_THUMB_UPDATE) {
622 if (! isset($_POST['id']) || ! ctype_digit($_POST['id'])) { 612 // This route is no longer supported in legacy mode
623 http_response_code(400); 613 http_response_code(404);
624 exit;
625 }
626 $id = (int) $_POST['id'];
627 if (! $bookmarkService->exists($id)) {
628 http_response_code(404);
629 exit;
630 }
631 $thumbnailer = new Thumbnailer($conf);
632 $bookmark = $bookmarkService->get($id);
633 $bookmark->setThumbnail($thumbnailer->get($bookmark->getUrl()));
634 $bookmarkService->set($bookmark);
635
636 $factory = new FormatterFactory($conf, $loginManager->isLoggedIn());
637 echo json_encode($factory->getFormatter('raw')->format($bookmark));
638 exit; 614 exit;
639 } 615 }
640 616
@@ -971,6 +947,10 @@ $app->group('', function () {
971 $this->get('/admin/shaare/delete', '\Shaarli\Front\Controller\Admin\ManageShaareController:deleteBookmark'); 947 $this->get('/admin/shaare/delete', '\Shaarli\Front\Controller\Admin\ManageShaareController:deleteBookmark');
972 $this->get('/admin/shaare/visibility', '\Shaarli\Front\Controller\Admin\ManageShaareController:changeVisibility'); 948 $this->get('/admin/shaare/visibility', '\Shaarli\Front\Controller\Admin\ManageShaareController:changeVisibility');
973 $this->get('/admin/shaare/{id:[0-9]+}/pin', '\Shaarli\Front\Controller\Admin\ManageShaareController:pinBookmark'); 949 $this->get('/admin/shaare/{id:[0-9]+}/pin', '\Shaarli\Front\Controller\Admin\ManageShaareController:pinBookmark');
950 $this->patch(
951 '/admin/shaare/{id:[0-9]+}/update-thumbnail',
952 '\Shaarli\Front\Controller\Admin\ThumbnailsController:ajaxUpdate'
953 );
974 $this->get('/admin/export', '\Shaarli\Front\Controller\Admin\ExportController:index'); 954 $this->get('/admin/export', '\Shaarli\Front\Controller\Admin\ExportController:index');
975 $this->post('/admin/export', '\Shaarli\Front\Controller\Admin\ExportController:export'); 955 $this->post('/admin/export', '\Shaarli\Front\Controller\Admin\ExportController:export');
976 $this->get('/admin/import', '\Shaarli\Front\Controller\Admin\ImportController:index'); 956 $this->get('/admin/import', '\Shaarli\Front\Controller\Admin\ImportController:index');
@@ -978,6 +958,7 @@ $app->group('', function () {
978 $this->get('/admin/plugins', '\Shaarli\Front\Controller\Admin\PluginsController:index'); 958 $this->get('/admin/plugins', '\Shaarli\Front\Controller\Admin\PluginsController:index');
979 $this->post('/admin/plugins', '\Shaarli\Front\Controller\Admin\PluginsController:save'); 959 $this->post('/admin/plugins', '\Shaarli\Front\Controller\Admin\PluginsController:save');
980 $this->get('/admin/token', '\Shaarli\Front\Controller\Admin\TokenController:getToken'); 960 $this->get('/admin/token', '\Shaarli\Front\Controller\Admin\TokenController:getToken');
961 $this->get('/admin/thumbnails', '\Shaarli\Front\Controller\Admin\ThumbnailsController:index');
981 962
982 $this->get('/links-per-page', '\Shaarli\Front\Controller\Admin\SessionFilterController:linksPerPage'); 963 $this->get('/links-per-page', '\Shaarli\Front\Controller\Admin\SessionFilterController:linksPerPage');
983 $this->get('/visibility/{visibility}', '\Shaarli\Front\Controller\Admin\SessionFilterController:visibility'); 964 $this->get('/visibility/{visibility}', '\Shaarli\Front\Controller\Admin\SessionFilterController:visibility');