]> git.immae.eu Git - github/shaarli/Shaarli.git/commitdiff
backport: Fix a warning if links sticky status isn't set
authorVirtualTam <virtualtam@flibidi.net>
Mon, 15 Apr 2019 21:57:08 +0000 (23:57 +0200)
committerVirtualTam <virtualtam@flibidi.net>
Mon, 15 Apr 2019 21:57:08 +0000 (23:57 +0200)
- 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)

This is a backport of https://github.com/shaarli/Shaarli/pull/1270

Original author information:

commit b790f900c937d0d8f6eccc15d2b4c26023f3d276
Author: ArthurHoaro <arthur@hoa.ro>
Date:   Sat Feb 9 14:04:16 2019 +0100

Signed-off-by: VirtualTam <virtualtam@flibidi.net>
application/LinkDB.php
index.php

index 4bbc2950e223ab86817cd8fa63c74a866bc7db03..803757cae5c02c1fffed2f5257b57ff798ef5a07 100644 (file)
@@ -259,7 +259,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;
@@ -272,6 +273,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;
@@ -323,6 +325,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'];
index acfcc660bad686182b9f4fe1294b39a51152de87..4deed1975f23ee6d73455e7b08cba573dbcac1cb 100644 (file)
--- a/index.php
+++ b/index.php
@@ -1179,6 +1179,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;