From bb4a23aa863b63e6148a085c15dedd7c960b4206 Mon Sep 17 00:00:00 2001 From: VirtualTam Date: Thu, 5 May 2016 19:22:06 +0200 Subject: Export: allow prepending notes with the Shaarli instance's URL Relates to #102 Additions: - application: - export: allow prepending note permalinks with the instance's URL - test coverage Modifications: - export template: switch to an HTML form - link selection (all/private/public) - prepend note permalinks with the instance's URL Signed-off-by: VirtualTam --- index.php | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'index.php') diff --git a/index.php b/index.php index 47bae6e8..408aeae9 100644 --- a/index.php +++ b/index.php @@ -1590,8 +1590,9 @@ function renderPage() exit; } - // -------- Export as Netscape Bookmarks HTML file. if ($targetPage == Router::$PAGE_EXPORT) { + // Export links as a Netscape Bookmarks file + if (empty($_GET['selection'])) { $PAGE->assign('linkcount',count($LINKSDB)); $PAGE->renderPage('export'); @@ -1600,10 +1601,21 @@ function renderPage() // export as bookmarks_(all|private|public)_YYYYmmdd_HHMMSS.html $selection = $_GET['selection']; + if (isset($_GET['prepend_note_url'])) { + $prependNoteUrl = $_GET['prepend_note_url']; + } else { + $prependNoteUrl = false; + } + try { $PAGE->assign( 'links', - NetscapeBookmarkUtils::filterAndFormat($LINKSDB, $selection) + NetscapeBookmarkUtils::filterAndFormat( + $LINKSDB, + $selection, + $prependNoteUrl, + index_url($_SERVER) + ) ); } catch (Exception $exc) { header('Content-Type: text/plain; charset=utf-8'); -- cgit v1.2.3