$isLoggedIn,
$hidePublicLinks
) {
-
+
$this->datastore = $datastore;
$this->loggedIn = $isLoggedIn;
$this->hidePublicLinks = $hidePublicLinks;
),
'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;
'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;
$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'];
$visibility = 'all',
$untaggedonly = false
) {
-
+
// Filter link database according to parameters.
$searchtags = isset($filterRequest['searchtags']) ? escape($filterRequest['searchtags']) : '';
$searchterm = isset($filterRequest['searchterm']) ? escape($filterRequest['searchterm']) : '';
if (isset($a['sticky']) && isset($b['sticky']) && $a['sticky'] !== $b['sticky']) {
return $a['sticky'] ? -1 : 1;
}
+ if ($a['created'] == $b['created']) {
+ return $a['id'] < $b['id'] ? 1 * $order : -1 * $order;
+ }
return $a['created'] < $b['created'] ? 1 * $order : -1 * $order;
});