Skip to content

Commit

Permalink
Fix a warning if links sticky status isn't set
Browse files Browse the repository at this point in the history
  - 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)
  • Loading branch information
ArthurHoaro committed Feb 9, 2019
1 parent 905f867 commit b790f90
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 5 additions & 1 deletion application/bookmark/LinkDB.php
Expand Up @@ -271,7 +271,8 @@ private function check()
),
'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;
Expand All @@ -284,6 +285,7 @@ private function check()
'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;
Expand Down Expand Up @@ -335,6 +337,8 @@ private function read()
$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'];
Expand Down
2 changes: 2 additions & 0 deletions index.php
Expand Up @@ -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;
Expand Down

0 comments on commit b790f90

Please sign in to comment.