aboutsummaryrefslogtreecommitdiffhomepage
path: root/index.php
diff options
context:
space:
mode:
authorVirtualTam <virtualtam@flibidi.net>2016-05-05 19:22:06 +0200
committerVirtualTam <virtualtam@flibidi.net>2016-05-06 16:12:46 +0200
commitbb4a23aa863b63e6148a085c15dedd7c960b4206 (patch)
treed4a484ca0eef729f5c02d95e0b20cc40e120853a /index.php
parent6275a65969a84a360588e0a62b025963e9ec98e0 (diff)
downloadShaarli-bb4a23aa863b63e6148a085c15dedd7c960b4206.tar.gz
Shaarli-bb4a23aa863b63e6148a085c15dedd7c960b4206.tar.zst
Shaarli-bb4a23aa863b63e6148a085c15dedd7c960b4206.zip
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 <virtualtam@flibidi.net>
Diffstat (limited to 'index.php')
-rw-r--r--index.php16
1 files changed, 14 insertions, 2 deletions
diff --git a/index.php b/index.php
index 47bae6e8..408aeae9 100644
--- a/index.php
+++ b/index.php
@@ -1590,8 +1590,9 @@ function renderPage()
1590 exit; 1590 exit;
1591 } 1591 }
1592 1592
1593 // -------- Export as Netscape Bookmarks HTML file.
1594 if ($targetPage == Router::$PAGE_EXPORT) { 1593 if ($targetPage == Router::$PAGE_EXPORT) {
1594 // Export links as a Netscape Bookmarks file
1595
1595 if (empty($_GET['selection'])) { 1596 if (empty($_GET['selection'])) {
1596 $PAGE->assign('linkcount',count($LINKSDB)); 1597 $PAGE->assign('linkcount',count($LINKSDB));
1597 $PAGE->renderPage('export'); 1598 $PAGE->renderPage('export');
@@ -1600,10 +1601,21 @@ function renderPage()
1600 1601
1601 // export as bookmarks_(all|private|public)_YYYYmmdd_HHMMSS.html 1602 // export as bookmarks_(all|private|public)_YYYYmmdd_HHMMSS.html
1602 $selection = $_GET['selection']; 1603 $selection = $_GET['selection'];
1604 if (isset($_GET['prepend_note_url'])) {
1605 $prependNoteUrl = $_GET['prepend_note_url'];
1606 } else {
1607 $prependNoteUrl = false;
1608 }
1609
1603 try { 1610 try {
1604 $PAGE->assign( 1611 $PAGE->assign(
1605 'links', 1612 'links',
1606 NetscapeBookmarkUtils::filterAndFormat($LINKSDB, $selection) 1613 NetscapeBookmarkUtils::filterAndFormat(
1614 $LINKSDB,
1615 $selection,
1616 $prependNoteUrl,
1617 index_url($_SERVER)
1618 )
1607 ); 1619 );
1608 } catch (Exception $exc) { 1620 } catch (Exception $exc) {
1609 header('Content-Type: text/plain; charset=utf-8'); 1621 header('Content-Type: text/plain; charset=utf-8');