diff options
Diffstat (limited to 'application')
-rw-r--r-- | application/LinkDB.php | 3 | ||||
-rw-r--r-- | application/PageBuilder.php | 2 | ||||
-rw-r--r-- | application/Router.php | 6 | ||||
-rw-r--r-- | application/Updater.php | 20 |
4 files changed, 30 insertions, 1 deletions
diff --git a/application/LinkDB.php b/application/LinkDB.php index cd0f2967..cdd68cfb 100644 --- a/application/LinkDB.php +++ b/application/LinkDB.php | |||
@@ -537,6 +537,9 @@ You use the community supported version of the original Shaarli project, by Seba | |||
537 | $order = $order === 'ASC' ? -1 : 1; | 537 | $order = $order === 'ASC' ? -1 : 1; |
538 | // Reorder array by dates. | 538 | // Reorder array by dates. |
539 | usort($this->links, function($a, $b) use ($order) { | 539 | usort($this->links, function($a, $b) use ($order) { |
540 | if (isset($a['sticky']) && isset($b['sticky']) && $a['sticky'] !== $b['sticky']) { | ||
541 | return $a['sticky'] ? -1 : 1; | ||
542 | } | ||
540 | return $a['created'] < $b['created'] ? 1 * $order : -1 * $order; | 543 | return $a['created'] < $b['created'] ? 1 * $order : -1 * $order; |
541 | }); | 544 | }); |
542 | 545 | ||
diff --git a/application/PageBuilder.php b/application/PageBuilder.php index b1abe0d0..0efd24c3 100644 --- a/application/PageBuilder.php +++ b/application/PageBuilder.php | |||
@@ -101,7 +101,7 @@ class PageBuilder | |||
101 | 'version_hash', | 101 | 'version_hash', |
102 | ApplicationUtils::getVersionHash(SHAARLI_VERSION, $this->conf->get('credentials.salt')) | 102 | ApplicationUtils::getVersionHash(SHAARLI_VERSION, $this->conf->get('credentials.salt')) |
103 | ); | 103 | ); |
104 | $this->tpl->assign('scripturl', index_url($_SERVER)); | 104 | $this->tpl->assign('index_url', index_url($_SERVER)); |
105 | $visibility = ! empty($_SESSION['visibility']) ? $_SESSION['visibility'] : ''; | 105 | $visibility = ! empty($_SESSION['visibility']) ? $_SESSION['visibility'] : ''; |
106 | $this->tpl->assign('visibility', $visibility); | 106 | $this->tpl->assign('visibility', $visibility); |
107 | $this->tpl->assign('untaggedonly', !empty($_SESSION['untaggedonly'])); | 107 | $this->tpl->assign('untaggedonly', !empty($_SESSION['untaggedonly'])); |
diff --git a/application/Router.php b/application/Router.php index bf86b884..beb3165b 100644 --- a/application/Router.php +++ b/application/Router.php | |||
@@ -37,6 +37,8 @@ class Router | |||
37 | 37 | ||
38 | public static $PAGE_DELETELINK = 'delete_link'; | 38 | public static $PAGE_DELETELINK = 'delete_link'; |
39 | 39 | ||
40 | public static $PAGE_PINLINK = 'pin'; | ||
41 | |||
40 | public static $PAGE_EXPORT = 'export'; | 42 | public static $PAGE_EXPORT = 'export'; |
41 | 43 | ||
42 | public static $PAGE_IMPORT = 'import'; | 44 | public static $PAGE_IMPORT = 'import'; |
@@ -146,6 +148,10 @@ class Router | |||
146 | return self::$PAGE_DELETELINK; | 148 | return self::$PAGE_DELETELINK; |
147 | } | 149 | } |
148 | 150 | ||
151 | if (startsWith($query, 'do='. self::$PAGE_PINLINK)) { | ||
152 | return self::$PAGE_PINLINK; | ||
153 | } | ||
154 | |||
149 | if (startsWith($query, 'do='. self::$PAGE_EXPORT)) { | 155 | if (startsWith($query, 'do='. self::$PAGE_EXPORT)) { |
150 | return self::$PAGE_EXPORT; | 156 | return self::$PAGE_EXPORT; |
151 | } | 157 | } |
diff --git a/application/Updater.php b/application/Updater.php index 480bff82..5dde47cb 100644 --- a/application/Updater.php +++ b/application/Updater.php | |||
@@ -517,6 +517,26 @@ class Updater | |||
517 | 517 | ||
518 | return true; | 518 | return true; |
519 | } | 519 | } |
520 | |||
521 | /** | ||
522 | * Set sticky = false on all links | ||
523 | * | ||
524 | * @return bool true if the update is successful, false otherwise. | ||
525 | */ | ||
526 | public function updateMethodSetSticky() | ||
527 | { | ||
528 | foreach ($this->linkDB as $key => $link) { | ||
529 | if (isset($link['sticky'])) { | ||
530 | return true; | ||
531 | } | ||
532 | $link['sticky'] = false; | ||
533 | $this->linkDB[$key] = $link; | ||
534 | } | ||
535 | |||
536 | $this->linkDB->save($this->conf->get('resource.page_cache')); | ||
537 | |||
538 | return true; | ||
539 | } | ||
520 | } | 540 | } |
521 | 541 | ||
522 | /** | 542 | /** |