diff options
Diffstat (limited to 'index.php')
-rw-r--r-- | index.php | 47 |
1 files changed, 3 insertions, 44 deletions
@@ -573,50 +573,7 @@ function renderPage($conf, $pluginManager, $bookmarkService, $history, $sessionM | |||
573 | } | 573 | } |
574 | 574 | ||
575 | if ($targetPage == Router::$PAGE_EXPORT) { | 575 | if ($targetPage == Router::$PAGE_EXPORT) { |
576 | // Export bookmarks as a Netscape Bookmarks file | 576 | header('Location: ./admin/export'); |
577 | |||
578 | if (empty($_GET['selection'])) { | ||
579 | $PAGE->assign('pagetitle', t('Export') .' - '. $conf->get('general.title', 'Shaarli')); | ||
580 | $PAGE->renderPage('export'); | ||
581 | exit; | ||
582 | } | ||
583 | |||
584 | // export as bookmarks_(all|private|public)_YYYYmmdd_HHMMSS.html | ||
585 | $selection = $_GET['selection']; | ||
586 | if (isset($_GET['prepend_note_url'])) { | ||
587 | $prependNoteUrl = $_GET['prepend_note_url']; | ||
588 | } else { | ||
589 | $prependNoteUrl = false; | ||
590 | } | ||
591 | |||
592 | try { | ||
593 | $factory = new FormatterFactory($conf, $loginManager->isLoggedIn()); | ||
594 | $formatter = $factory->getFormatter('raw'); | ||
595 | $PAGE->assign( | ||
596 | 'links', | ||
597 | NetscapeBookmarkUtils::filterAndFormat( | ||
598 | $bookmarkService, | ||
599 | $formatter, | ||
600 | $selection, | ||
601 | $prependNoteUrl, | ||
602 | index_url($_SERVER) | ||
603 | ) | ||
604 | ); | ||
605 | } catch (Exception $exc) { | ||
606 | header('Content-Type: text/plain; charset=utf-8'); | ||
607 | echo $exc->getMessage(); | ||
608 | exit; | ||
609 | } | ||
610 | $now = new DateTime(); | ||
611 | header('Content-Type: text/html; charset=utf-8'); | ||
612 | header( | ||
613 | 'Content-disposition: attachment; filename=bookmarks_' | ||
614 | .$selection.'_'.$now->format(Bookmark::LINK_DATE_FORMAT).'.html' | ||
615 | ); | ||
616 | $PAGE->assign('date', $now->format(DateTime::RFC822)); | ||
617 | $PAGE->assign('eol', PHP_EOL); | ||
618 | $PAGE->assign('selection', $selection); | ||
619 | $PAGE->renderPage('export.bookmarks'); | ||
620 | exit; | 577 | exit; |
621 | } | 578 | } |
622 | 579 | ||
@@ -1105,6 +1062,8 @@ $app->group('', function () { | |||
1105 | $this->get('/admin/shaare/delete', '\Shaarli\Front\Controller\Admin\ManageShaareController:deleteBookmark'); | 1062 | $this->get('/admin/shaare/delete', '\Shaarli\Front\Controller\Admin\ManageShaareController:deleteBookmark'); |
1106 | $this->get('/admin/shaare/visibility', '\Shaarli\Front\Controller\Admin\ManageShaareController:changeVisibility'); | 1063 | $this->get('/admin/shaare/visibility', '\Shaarli\Front\Controller\Admin\ManageShaareController:changeVisibility'); |
1107 | $this->get('/admin/shaare/{id:[0-9]+}/pin', '\Shaarli\Front\Controller\Admin\ManageShaareController:pinBookmark'); | 1064 | $this->get('/admin/shaare/{id:[0-9]+}/pin', '\Shaarli\Front\Controller\Admin\ManageShaareController:pinBookmark'); |
1065 | $this->get('/admin/export', '\Shaarli\Front\Controller\Admin\ExportController:index'); | ||
1066 | $this->post('/admin/export', '\Shaarli\Front\Controller\Admin\ExportController:export'); | ||
1108 | 1067 | ||
1109 | $this->get('/links-per-page', '\Shaarli\Front\Controller\Admin\SessionFilterController:linksPerPage'); | 1068 | $this->get('/links-per-page', '\Shaarli\Front\Controller\Admin\SessionFilterController:linksPerPage'); |
1110 | $this->get('/visibility/{visibility}', '\Shaarli\Front\Controller\Admin\SessionFilterController:visibility'); | 1069 | $this->get('/visibility/{visibility}', '\Shaarli\Front\Controller\Admin\SessionFilterController:visibility'); |