diff options
Diffstat (limited to 'application/LinkDB.php')
-rw-r--r-- | application/LinkDB.php | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/application/LinkDB.php b/application/LinkDB.php index 19ca6435..9f4d3e3c 100644 --- a/application/LinkDB.php +++ b/application/LinkDB.php | |||
@@ -260,15 +260,19 @@ You use the community supported version of the original Shaarli project, by Seba | |||
260 | } | 260 | } |
261 | } | 261 | } |
262 | 262 | ||
263 | // Keep the list of the mapping URLs-->linkdate up-to-date. | ||
264 | $this->_urls = array(); | 263 | $this->_urls = array(); |
265 | foreach ($this->_links as $link) { | 264 | foreach ($this->_links as &$link) { |
265 | // Keep the list of the mapping URLs-->linkdate up-to-date. | ||
266 | $this->_urls[$link['url']] = $link['linkdate']; | 266 | $this->_urls[$link['url']] = $link['linkdate']; |
267 | } | ||
268 | 267 | ||
269 | // Escape links data | 268 | // Sanitize data fields. |
270 | foreach($this->_links as &$link) { | ||
271 | sanitizeLink($link); | 269 | sanitizeLink($link); |
270 | |||
271 | // Remove private tags if the user is not logged in. | ||
272 | if (! $this->_loggedIn) { | ||
273 | $link['tags'] = preg_replace('/(^| )\.[^($| )]+/', '', $link['tags']); | ||
274 | } | ||
275 | |||
272 | // Do not use the redirector for internal links (Shaarli note URL starting with a '?'). | 276 | // Do not use the redirector for internal links (Shaarli note URL starting with a '?'). |
273 | if (!empty($this->_redirector) && !startsWith($link['url'], '?')) { | 277 | if (!empty($this->_redirector) && !startsWith($link['url'], '?')) { |
274 | $link['real_url'] = $this->_redirector . urlencode($link['url']); | 278 | $link['real_url'] = $this->_redirector . urlencode($link['url']); |
@@ -343,7 +347,7 @@ You use the community supported version of the original Shaarli project, by Seba | |||
343 | * | 347 | * |
344 | * @return array filtered links | 348 | * @return array filtered links |
345 | */ | 349 | */ |
346 | public function filter($type, $request, $casesensitive = false, $privateonly = false) | 350 | public function filter($type = '', $request = '', $casesensitive = false, $privateonly = false) |
347 | { | 351 | { |
348 | $linkFilter = new LinkFilter($this->_links); | 352 | $linkFilter = new LinkFilter($this->_links); |
349 | $requestFilter = is_array($request) ? implode(' ', $request) : $request; | 353 | $requestFilter = is_array($request) ? implode(' ', $request) : $request; |
@@ -381,6 +385,7 @@ You use the community supported version of the original Shaarli project, by Seba | |||
381 | } | 385 | } |
382 | $linkDays = array_keys($linkDays); | 386 | $linkDays = array_keys($linkDays); |
383 | sort($linkDays); | 387 | sort($linkDays); |
388 | |||
384 | return $linkDays; | 389 | return $linkDays; |
385 | } | 390 | } |
386 | } | 391 | } |