aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorVirtualTam <virtualtam@flibidi.net>2019-04-15 23:57:08 +0200
committerVirtualTam <virtualtam@flibidi.net>2019-04-15 23:57:08 +0200
commit1cc5eaf9dee0e71aefbce1ff0f28c86ff320c053 (patch)
treec139d7fefc0217b2f18fbb41cb4222879585d3e0
parent0ed9396bfa12f086369b52cdc0742e3fe72273ec (diff)
downloadShaarli-1cc5eaf9dee0e71aefbce1ff0f28c86ff320c053.tar.gz
Shaarli-1cc5eaf9dee0e71aefbce1ff0f28c86ff320c053.tar.zst
Shaarli-1cc5eaf9dee0e71aefbce1ff0f28c86ff320c053.zip
backport: 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) 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>
-rw-r--r--application/LinkDB.php6
-rw-r--r--index.php2
2 files changed, 7 insertions, 1 deletions
diff --git a/application/LinkDB.php b/application/LinkDB.php
index 4bbc2950..803757ca 100644
--- a/application/LinkDB.php
+++ b/application/LinkDB.php
@@ -259,7 +259,8 @@ You use the community supported version of the original Shaarli project, by Seba
259 ), 259 ),
260 'private'=>0, 260 'private'=>0,
261 'created'=> new DateTime(), 261 'created'=> new DateTime(),
262 'tags'=>'opensource software' 262 'tags'=>'opensource software',
263 'sticky' => false,
263 ); 264 );
264 $link['shorturl'] = link_small_hash($link['created'], $link['id']); 265 $link['shorturl'] = link_small_hash($link['created'], $link['id']);
265 $this->links[1] = $link; 266 $this->links[1] = $link;
@@ -272,6 +273,7 @@ You use the community supported version of the original Shaarli project, by Seba
272 'private'=>1, 273 'private'=>1,
273 'created'=> new DateTime('1 minute ago'), 274 'created'=> new DateTime('1 minute ago'),
274 'tags'=>'secretstuff', 275 'tags'=>'secretstuff',
276 'sticky' => false,
275 ); 277 );
276 $link['shorturl'] = link_small_hash($link['created'], $link['id']); 278 $link['shorturl'] = link_small_hash($link['created'], $link['id']);
277 $this->links[0] = $link; 279 $this->links[0] = $link;
@@ -323,6 +325,8 @@ You use the community supported version of the original Shaarli project, by Seba
323 $link['real_url'] = $link['url']; 325 $link['real_url'] = $link['url'];
324 } 326 }
325 327
328 $link['sticky'] = isset($link['sticky']) ? $link['sticky'] : false;
329
326 // To be able to load links before running the update, and prepare the update 330 // To be able to load links before running the update, and prepare the update
327 if (! isset($link['created'])) { 331 if (! isset($link['created'])) {
328 $link['id'] = $link['linkdate']; 332 $link['id'] = $link['linkdate'];
diff --git a/index.php b/index.php
index acfcc660..4deed197 100644
--- a/index.php
+++ b/index.php
@@ -1179,6 +1179,8 @@ function renderPage($conf, $pluginManager, $LINKSDB, $history, $sessionManager,
1179 $link['thumbnail'] = $thumbnailer->get($url); 1179 $link['thumbnail'] = $thumbnailer->get($url);
1180 } 1180 }
1181 1181
1182 $link['sticky'] = isset($link['sticky']) ? $link['sticky'] : false;
1183
1182 $pluginManager->executeHooks('save_link', $link); 1184 $pluginManager->executeHooks('save_link', $link);
1183 1185
1184 $LINKSDB[$id] = $link; 1186 $LINKSDB[$id] = $link;