X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=application%2Ffeed%2FFeedBuilder.php;h=ed62af26e1c4b26ae4eb481e37ab32f0a5d9988a;hb=88a8e284b2825cbd77c75dbbbf3655a961d9eb09;hp=269ad87722cfc5888070ce05dc5c730149a9129b;hpb=301c7ab1a079d937ab41c6f52b8804e5731008e6;p=github%2Fshaarli%2FShaarli.git
diff --git a/application/feed/FeedBuilder.php b/application/feed/FeedBuilder.php
index 269ad877..ed62af26 100644
--- a/application/feed/FeedBuilder.php
+++ b/application/feed/FeedBuilder.php
@@ -1,4 +1,5 @@
linkDB->search($userInput);
+ $linksToDisplay = $this->linkDB->search($userInput ?? [], null, false, false, true);
$nblinksToDisplay = $this->getNbLinks(count($linksToDisplay), $userInput);
// Can't use array_keys() because $link is a LinkDB instance and not a real array.
- $keys = array();
+ $keys = [];
foreach ($linksToDisplay as $key => $value) {
$keys[] = $key;
}
$pageaddr = escape(index_url($this->serverInfo));
$this->formatter->addContextData('index_url', $pageaddr);
- $linkDisplayed = array();
+ $linkDisplayed = [];
for ($i = 0; $i < $nblinksToDisplay && $i < count($keys); $i++) {
$linkDisplayed[$keys[$i]] = $this->buildItem($feedType, $linksToDisplay[$keys[$i]], $pageaddr);
}
@@ -122,9 +123,9 @@ class FeedBuilder
$data['language'] = $this->getTypeLanguage($feedType);
$data['last_update'] = $this->getLatestDateFormatted($feedType);
$data['show_dates'] = !$this->hideDates || $this->isLoggedIn;
- // Remove leading slash from REQUEST_URI.
- $data['self_link'] = escape(server_url($this->serverInfo))
- . escape($this->serverInfo['REQUEST_URI']);
+ // Remove leading path from REQUEST_URI (already contained in $pageaddr).
+ $requestUri = preg_replace('#(.*?/)(feed.*)#', '$2', escape($this->serverInfo['REQUEST_URI']));
+ $data['self_link'] = $pageaddr . $requestUri;
$data['index_url'] = $pageaddr;
$data['usepermalinks'] = $this->usePermalinks === true;
$data['links'] = $linkDisplayed;
@@ -176,9 +177,9 @@ class FeedBuilder
$data = $this->formatter->format($link);
$data['guid'] = rtrim($pageaddr, '/') . '/shaare/' . $data['shorturl'];
if ($this->usePermalinks === true) {
- $permalink = ''. t('Direct link') .'';
+ $permalink = '' . t('Direct link') . '';
} else {
- $permalink = ''. t('Permalink') .'';
+ $permalink = '' . t('Permalink') . '';
}
$data['description'] .= PHP_EOL . PHP_EOL . '
— ' . $permalink;