aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorArthurHoaro <arthur@hoa.ro>2019-02-09 14:04:16 +0100
committerArthurHoaro <arthur@hoa.ro>2019-02-09 14:04:16 +0100
commitb790f900c937d0d8f6eccc15d2b4c26023f3d276 (patch)
tree91b4ee8534b6d82ddf413564e100163b602b56a3
parent905f8675a728841b03b300d2c7dc909a1c4f7f03 (diff)
downloadShaarli-b790f900c937d0d8f6eccc15d2b4c26023f3d276.tar.gz
Shaarli-b790f900c937d0d8f6eccc15d2b4c26023f3d276.tar.zst
Shaarli-b790f900c937d0d8f6eccc15d2b4c26023f3d276.zip
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)
-rw-r--r--application/bookmark/LinkDB.php6
-rw-r--r--index.php2
2 files changed, 7 insertions, 1 deletions
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
271 ), 271 ),
272 'private' => 0, 272 'private' => 0,
273 'created' => new DateTime(), 273 'created' => new DateTime(),
274 'tags' => 'opensource software' 274 'tags' => 'opensource software',
275 'sticky' => false,
275 ); 276 );
276 $link['shorturl'] = link_small_hash($link['created'], $link['id']); 277 $link['shorturl'] = link_small_hash($link['created'], $link['id']);
277 $this->links[1] = $link; 278 $this->links[1] = $link;
@@ -284,6 +285,7 @@ You use the community supported version of the original Shaarli project, by Seba
284 'private' => 1, 285 'private' => 1,
285 'created' => new DateTime('1 minute ago'), 286 'created' => new DateTime('1 minute ago'),
286 'tags' => 'secretstuff', 287 'tags' => 'secretstuff',
288 'sticky' => false,
287 ); 289 );
288 $link['shorturl'] = link_small_hash($link['created'], $link['id']); 290 $link['shorturl'] = link_small_hash($link['created'], $link['id']);
289 $this->links[0] = $link; 291 $this->links[0] = $link;
@@ -335,6 +337,8 @@ You use the community supported version of the original Shaarli project, by Seba
335 $link['real_url'] = $link['url']; 337 $link['real_url'] = $link['url'];
336 } 338 }
337 339
340 $link['sticky'] = isset($link['sticky']) ? $link['sticky'] : false;
341
338 // To be able to load links before running the update, and prepare the update 342 // To be able to load links before running the update, and prepare the update
339 if (!isset($link['created'])) { 343 if (!isset($link['created'])) {
340 $link['id'] = $link['linkdate']; 344 $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,
1181 $link['thumbnail'] = $thumbnailer->get($url); 1181 $link['thumbnail'] = $thumbnailer->get($url);
1182 } 1182 }
1183 1183
1184 $link['sticky'] = isset($link['sticky']) ? $link['sticky'] : false;
1185
1184 $pluginManager->executeHooks('save_link', $link); 1186 $pluginManager->executeHooks('save_link', $link);
1185 1187
1186 $LINKSDB[$id] = $link; 1188 $LINKSDB[$id] = $link;