]> git.immae.eu Git - github/shaarli/Shaarli.git/blobdiff - application/bookmark/LinkDB.php
Make sure that bookmark sort is consistent, even with equal timestamps
[github/shaarli/Shaarli.git] / application / bookmark / LinkDB.php
index efde8468fca97e896f1da161e444993bdd711b4d..f01c7ee6cadaea8422baf7e650ee85e639e84172 100644 (file)
@@ -102,7 +102,7 @@ class LinkDB implements Iterator, Countable, ArrayAccess
         $isLoggedIn,
         $hidePublicLinks
     ) {
-    
+
         $this->datastore = $datastore;
         $this->loggedIn = $isLoggedIn;
         $this->hidePublicLinks = $hidePublicLinks;
@@ -415,7 +415,7 @@ You use the community supported version of the original Shaarli project, by Seba
         $visibility = 'all',
         $untaggedonly = false
     ) {
-    
+
         // Filter link database according to parameters.
         $searchtags = isset($filterRequest['searchtags']) ? escape($filterRequest['searchtags']) : '';
         $searchterm = isset($filterRequest['searchterm']) ? escape($filterRequest['searchterm']) : '';
@@ -533,6 +533,9 @@ You use the community supported version of the original Shaarli project, by Seba
             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;
         });