From b790f900c937d0d8f6eccc15d2b4c26023f3d276 Mon Sep 17 00:00:00 2001 From: ArthurHoaro Date: Sat, 9 Feb 2019 14:04:16 +0100 Subject: [PATCH] Fix a warning if links sticky status isn't set - initiate its status to false when the link is created - if not defined, initiate its status to false (can happen if the updater hasn't run) --- application/bookmark/LinkDB.php | 6 +++++- index.php | 2 ++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/application/bookmark/LinkDB.php b/application/bookmark/LinkDB.php index c13a1141..41d5591f 100644 --- a/application/bookmark/LinkDB.php +++ b/application/bookmark/LinkDB.php @@ -271,7 +271,8 @@ You use the community supported version of the original Shaarli project, by Seba ), 'private' => 0, 'created' => new DateTime(), - 'tags' => 'opensource software' + 'tags' => 'opensource software', + 'sticky' => false, ); $link['shorturl'] = link_small_hash($link['created'], $link['id']); $this->links[1] = $link; @@ -284,6 +285,7 @@ You use the community supported version of the original Shaarli project, by Seba 'private' => 1, 'created' => new DateTime('1 minute ago'), 'tags' => 'secretstuff', + 'sticky' => false, ); $link['shorturl'] = link_small_hash($link['created'], $link['id']); $this->links[0] = $link; @@ -335,6 +337,8 @@ You use the community supported version of the original Shaarli project, by Seba $link['real_url'] = $link['url']; } + $link['sticky'] = isset($link['sticky']) ? $link['sticky'] : false; + // To be able to load links before running the update, and prepare the update if (!isset($link['created'])) { $link['id'] = $link['linkdate']; diff --git a/index.php b/index.php index 633ab89e..1d505305 100644 --- a/index.php +++ b/index.php @@ -1181,6 +1181,8 @@ function renderPage($conf, $pluginManager, $LINKSDB, $history, $sessionManager, $link['thumbnail'] = $thumbnailer->get($url); } + $link['sticky'] = isset($link['sticky']) ? $link['sticky'] : false; + $pluginManager->executeHooks('save_link', $link); $LINKSDB[$id] = $link; -- 2.41.0