aboutsummaryrefslogtreecommitdiff
path: root/app/views
diff options
context:
space:
mode:
authorGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2024-02-26 09:01:03 +0100
committerGravatar GitHub <noreply@github.com> 2024-02-26 09:01:03 +0100
commit39cc1c11ec596176e842cc98e6a54337e3c04d7e (patch)
treedab89beb80268acb5e4bd58dfc55297bd30a8486 /app/views
parent25166c218be4e1ce1cb098de274a231b623d527e (diff)
New feature: shareable user query (#6052)
* New feature: shareable user query Share the output of a user query by RSS / HTML / OPML with other people through unique URLs. Replaces the global admin token, which was the only option (but unsafe) to share RSS outputs with other people. Also add a new HTML output for people without an RSS reader. fix https://github.com/FreshRSS/FreshRSS/issues/3066#issuecomment-648977890 fix https://github.com/FreshRSS/FreshRSS/issues/3178#issuecomment-769435504 * Remove unused method * Fix token saving * Implement HTML view * Update i18n for master token * Revert i18n get_favorite * Fix missing i18n for user queries from before this PR * Remove irrelevant tests * Add link to RSS version * Fix getGet * Fix getState * Fix getSearch * Alternative getSearch * Default getOrder * Explicit default state * Fix test * Add OPML sharing * Remove many redundant SQL queries from original implementation of user queries * Fix article tags * Use default user settings * Prepare public search * Fixes * Allow user search on article tags * Implement user search * Revert filter bug * Revert wrong SQL left outer join change * Implement checkboxes * Safe check of OPML * Fix label * Remove RSS button to favour new sharing method That sharing button was using a global admin token * First version of HTTP 304 * Disallow some recusrivity fix https://github.com/FreshRSS/FreshRSS/issues/6086 * Draft of nav * Minor httpConditional * Add support for offset for pagination * Fix offset pagination * Fix explicit order ASC * Add documentation * Help links i18n * Note about deprecated master token * Typo * Doc about format
Diffstat (limited to 'app/views')
-rw-r--r--app/views/configure/queries.phtml3
-rw-r--r--app/views/helpers/configure/query.phtml67
-rw-r--r--app/views/helpers/export/articles.phtml2
-rw-r--r--app/views/helpers/feed/update.phtml3
-rw-r--r--app/views/helpers/htmlPagination.phtml21
-rw-r--r--app/views/helpers/index/article.phtml117
-rw-r--r--app/views/helpers/index/normal/entry_header.phtml3
-rw-r--r--app/views/helpers/index/tags.phtml42
-rw-r--r--app/views/index/html.phtml32
-rw-r--r--app/views/index/normal.phtml102
-rw-r--r--app/views/index/reader.phtml194
-rw-r--r--app/views/index/rss.phtml6
-rw-r--r--app/views/user/profile.phtml1
13 files changed, 292 insertions, 301 deletions
diff --git a/app/views/configure/queries.phtml b/app/views/configure/queries.phtml
index 2a55eb1b2..26534307e 100644
--- a/app/views/configure/queries.phtml
+++ b/app/views/configure/queries.phtml
@@ -18,6 +18,9 @@
<div class="box-title">
<a class="configure open-slider" href="<?= _url('configure', 'query', 'id', '' . $key) ?>"><?= _i('configure') ?></a><h2><?= $query->getName() ?></h2>
<input type="hidden" id="queries_<?= $key ?>_name" name="queries[<?= $key ?>][name]" value="<?= $query->getName() ?>"/>
+ <input type="hidden" id="queries_<?= $key ?>_token" name="queries[<?= $key ?>][token]" value="<?= $query->getToken() ?>"/>
+ <input type="hidden" id="queries_<?= $key ?>_shareRss" name="queries[<?= $key ?>][token]" value="<?= $query->shareRss() ?>"/>
+ <input type="hidden" id="queries_<?= $key ?>_shareOpml" name="queries[<?= $key ?>][token]" value="<?= $query->shareOpml() ?>"/>
<input type="hidden" id="queries_<?= $key ?>_url" name="queries[<?= $key ?>][url]" value="<?= $query->getUrl() ?>"/>
<input type="hidden" id="queries_<?= $key ?>_search" name="queries[<?= $key ?>][search]" value="<?= urlencode($query->getSearch()->getRawInput()) ?>"/>
<input type="hidden" id="queries_<?= $key ?>_state" name="queries[<?= $key ?>][state]" value="<?= $query->getState() ?>"/>
diff --git a/app/views/helpers/configure/query.phtml b/app/views/helpers/configure/query.phtml
index 145425271..49ffbad87 100644
--- a/app/views/helpers/configure/query.phtml
+++ b/app/views/helpers/configure/query.phtml
@@ -7,7 +7,6 @@
?>
<div class="post">
<h2><?= $this->query->getName() ?></h2>
-
<div>
<a href="<?= $this->query->getUrl() ?>"><?= _i('link') ?> <?= _t('gen.action.filter') ?></a>
</div>
@@ -18,15 +17,53 @@
<div class="form-group">
<label class="group-name" for="name"><?= _t('conf.query.name') ?></label>
<div class="group-controls">
- <input type="text" name="name" id="name" value="<?= $this->query->getName() ?>" />
+ <input type="text" name="name" id="name" value="<?= $this->query->getName() ?>" />
+ <input type="hidden" name="query[token]" id="query_token" value="<?= $this->query->getToken() ?>" />
</div>
</div>
- <legend><?= _t('conf.query.filter') ?></legend>
+ <legend><?= _t('conf.query.share') ?></legend>
+ <div class="form-group">
+ <div class="group-controls">
+ <label class="checkbox" for="shareRss">
+ <input type="checkbox" name="query[shareRss]" id="shareRss" value="1" <?= $this->query->shareRss() ? 'checked="checked"' : ''?> />
+ <?= _t('conf.query.filter.shareRss') ?>
+ </label>
+ <?php if ($this->query->sharedUrlRss() !== ''): ?>
+ <ul>
+ <li><a href="<?= $this->query->sharedUrlHtml() ?>"><?= _i('link') ?> <?= _t('conf.query.share.html') ?></a></li>
+ <li><a href="<?= $this->query->sharedUrlRss() ?>"><?= _i('link') ?> <?= _t('conf.query.share.rss') ?></a></li>
+ </ul>
+ <?php endif; ?>
+ </div>
+ <div class="group-controls">
+ <label class="checkbox" for="shareOpml">
+ <input type="checkbox" name="query[shareOpml]" id="shareOpml" value="1" <?= $this->query->shareOpml() && $this->query->safeForOpml() ? 'checked="checked"' : '' ?>
+ <?= $this->query->safeForOpml() ? '' : 'disabled="disabled"' ?> />
+ <?= _t('conf.query.filter.shareOpml') ?>
+ </label>
+ <?php if ($this->query->sharedUrlOpml() !== ''): ?>
+ <ul>
+ <li><a href="<?= $this->query->sharedUrlOpml() ?>"><?= _i('link') ?> <?= _t('conf.query.share.opml') ?></a></li>
+ </ul>
+ <?php endif; ?>
+ </div>
+ <p class="help"><?= _i('help') ?> <?= _t('conf.query.share.help') ?></a></p>
+ <p class="help"><?= _i('help') ?> <?= _t('conf.query.help') ?></a></p>
+ </div>
+
+ <div class="form-group form-actions">
+ <div class="group-controls">
+ <button type="submit" class="btn btn-important"><?= _t('gen.action.submit') ?></button>
+ </div>
+ </div>
+
+ <legend><?= _t('conf.query.filter') ?></legend>
<div class="form-group">
<label class="group-name" for=""><?= _t('conf.query.filter.search') ?></label>
<div class="group-controls">
<input type="text" id="query_search" name="query[search]" value="<?= htmlspecialchars($this->query->getSearch()->getRawInput(), ENT_COMPAT, 'UTF-8') ?>"/>
+ <p class="help"><?= _i('help') ?> <?= _t('gen.menu.search_help') ?></a></p>
</div>
</div>
<div class="form-group">
@@ -58,22 +95,24 @@
<label class="group-name" for="query_get"><?= _t('conf.query.filter.type') ?></label>
<div class="group-controls">
<select name="query[get]" id="query_get" size="10">
- <option value=""></option>
- <option value="s" <?= 's' === $this->query->getGet() ? 'selected="selected"' : '' ?>><?= _t('conf.query.get_favorite') ?></option>
+ <option value="a" <?= in_array($this->query->getGet(), ['', 'a'], true) ? 'selected="selected"' : '' ?>><?= _t('index.feed.title') ?></option>
+ <option value="i" <?= 'i' === $this->query->getGet() ? 'selected="selected"' : '' ?>><?= _t('index.menu.important') ?></option>
+ <option value="s" <?= 's' === $this->query->getGet() ? 'selected="selected"' : '' ?>><?= _t('index.feed.title_fav') ?></option>
+ <option value="T" <?= 'T' === $this->query->getGet() ? 'selected="selected"' : '' ?>><?= _t('index.menu.tags') ?></option>
+ <optgroup label="<?= _t('conf.query.filter.tags') ?>">
+ <?php foreach ($this->tags as $tag): ?>
+ <option value="t_<?= $tag->id() ?>" <?= "t_{$tag->id()}" === $this->query->getGet() ? 'selected="selected"' : '' ?>><?= $tag->name() ?></option>
+ <?php endforeach?>
+ </optgroup>
<optgroup label="<?= _t('conf.query.filter.categories') ?>">
<?php foreach ($this->categories as $category): ?>
<option value="c_<?= $category->id() ?>" <?= "c_{$category->id()}" === $this->query->getGet() ? 'selected="selected"' : '' ?>><?= $category->name() ?></option>
<?php endforeach?>
</optgroup>
<optgroup label="<?= _t('conf.query.filter.feeds') ?>">
- <?php foreach ($this->feeds as $feed): ?>
- <option value="f_<?= $feed->id() ?>" <?= "f_{$feed->id()}" === $this->query->getGet() ? 'selected="selected"' : '' ?>><?= $feed->name() ?></option>
- <?php endforeach?>
- </optgroup>
- <optgroup label="<?= _t('conf.query.filter.tags') ?>">
- <?php foreach ($this->tags as $tag): ?>
- <option value="t_<?= $tag->id() ?>" <?= "t_{$tag->id()}" === $this->query->getGet() ? 'selected="selected"' : '' ?>><?= $tag->name() ?></option>
- <?php endforeach?>
+ <?php foreach ($this->feeds as $feed): ?>
+ <option value="f_<?= $feed->id() ?>" <?= "f_{$feed->id()}" === $this->query->getGet() ? 'selected="selected"' : '' ?>><?= $feed->name() ?></option>
+ <?php endforeach?>
</optgroup>
</select>
</div>
@@ -83,8 +122,8 @@
<div class="group-controls">
<select name="query[order]" id="query_order">
<option value=""></option>
- <option value="ASC" <?= 'ASC' === $this->query->getOrder() ? 'selected="selected"' : '' ?>><?= _t('conf.query.order_asc') ?></option>
<option value="DESC" <?= 'DESC' === $this->query->getOrder() ? 'selected="selected"' : '' ?>><?= _t('conf.query.order_desc') ?></option>
+ <option value="ASC" <?= 'ASC' === $this->query->getOrder() ? 'selected="selected"' : '' ?>><?= _t('conf.query.order_asc') ?></option>
</select>
</div>
</div>
diff --git a/app/views/helpers/export/articles.phtml b/app/views/helpers/export/articles.phtml
index 6903c3c69..40390d832 100644
--- a/app/views/helpers/export/articles.phtml
+++ b/app/views/helpers/export/articles.phtml
@@ -24,7 +24,7 @@ foreach ($this->entries as $entry) {
continue;
}
- $feed = $this->feed ?? FreshRSS_CategoryDAO::findFeed($this->categories, $entry->feedId());
+ $feed = $this->feed ?? FreshRSS_Category::findFeed($this->categories, $entry->feedId());
$entry->_feed($feed);
$article = $entry->toGReader('freshrss', $this->entryIdsTagNames['e_' . $entry->id()] ?? []);
diff --git a/app/views/helpers/feed/update.phtml b/app/views/helpers/feed/update.phtml
index 13a751c09..9d3aa59fa 100644
--- a/app/views/helpers/feed/update.phtml
+++ b/app/views/helpers/feed/update.phtml
@@ -1,9 +1,6 @@
<?php
declare(strict_types=1);
/** @var FreshRSS_View $this */
- if ($this->feed === null) {
- throw new FreshRSS_Context_Exception('Feed not initialised!');
- }
?>
<div class="post" id="feed_update">
<h1><?= $this->feed->name() ?></h1>
diff --git a/app/views/helpers/htmlPagination.phtml b/app/views/helpers/htmlPagination.phtml
new file mode 100644
index 000000000..d1f895425
--- /dev/null
+++ b/app/views/helpers/htmlPagination.phtml
@@ -0,0 +1,21 @@
+<?php
+ declare(strict_types=1);
+ /** @var FreshRSS_View $this */
+?>
+<nav class="nav-pagination nav-list">
+ <ul class="pagination">
+ <?php if (FreshRSS_Context::$offset > 0): ?>
+ <li class="item pager-first">
+ <a href="<?= $this->userQuery->sharedUrlHtml() . '&nb=' . FreshRSS_Context::$number ?>">« <?= _t('conf.logs.pagination.first') ?></a>
+ </li>
+ <li class="item pager-previous">
+ <a href="<?= $this->userQuery->sharedUrlHtml() . '&nb=' . FreshRSS_Context::$number .
+ '&offset=' . max(0, FreshRSS_Context::$offset - FreshRSS_Context::$number) ?>">‹ <?= _t('conf.logs.pagination.previous') ?></a>
+ </li>
+ <?php endif; ?>
+ <li class="item pager-next">
+ <a href="<?= $this->userQuery->sharedUrlHtml() . '&nb=' . FreshRSS_Context::$number .
+ '&offset=' . (FreshRSS_Context::$offset + FreshRSS_Context::$number) ?>"><?= _t('conf.logs.pagination.next') ?> ›</a>
+ </li>
+ </ul>
+</nav>
diff --git a/app/views/helpers/index/article.phtml b/app/views/helpers/index/article.phtml
new file mode 100644
index 000000000..caf06359d
--- /dev/null
+++ b/app/views/helpers/index/article.phtml
@@ -0,0 +1,117 @@
+<?php
+ declare(strict_types=1);
+ /** @var FreshRSS_View $this */
+ $entry = $this->entry;
+ $feed = $this->feed;
+?>
+<article class="flux_content" dir="auto">
+<div class="content <?= FreshRSS_Context::userConf()->content_width ?>">
+ <header>
+ <?php
+ $favoriteUrl = ['c' => 'entry', 'a' => 'bookmark', 'params' => ['id' => $entry->id()]];
+ if ($entry->isFavorite()) {
+ $favoriteUrl['params']['is_favorite'] = 0;
+ }
+ $readUrl = ['c' => 'entry', 'a' => 'read', 'params' => ['id' => $entry->id()]];
+ if ($entry->isRead()) {
+ $readUrl['params']['is_read'] = 0;
+ }
+ ?>
+ <div class="article-header-topline">
+ <?php if (FreshRSS_Auth::hasAccess()) { ?>
+ <a class="read" href="<?= Minz_Url::display($readUrl) ?>" title="<?= _t('conf.shortcut.mark_read') ?>"><?= _i($entry->isRead() ? 'read' : 'unread') ?></a>
+ <a class="bookmark" href="<?= Minz_Url::display($favoriteUrl) ?>" title="<?= _t('conf.shortcut.mark_favorite') ?>"><?= _i($entry->isFavorite() ? 'starred' : 'non-starred') ?></a>
+ <?php } ?>
+ <?php if (FreshRSS_Context::userConf()->show_feed_name === 't') { ?>
+ <a class="website" href="<?= _url('index', 'reader', 'get', 'f_' . $feed->id()) ?>" title="<?= _t('gen.action.filter') ?>">
+ <?php if (FreshRSS_Context::userConf()->show_favicons): ?>
+ <img class="favicon" src="<?= $feed->favicon() ?>" alt="✇" loading="lazy" /><?php
+ endif; ?><span><?= $feed->name() ?></span></a>
+ <?php } ?>
+ </div>
+
+ <?php
+ if (in_array(FreshRSS_Context::userConf()->show_tags, ['b', 'h'], true)) {
+ $this->renderHelper('index/tags');
+ }
+ ?>
+
+ <h1 class="title"><a target="_blank" rel="noreferrer" class="go_website" href="<?= $entry->link() ?>"><?= $entry->title() ?></a></h1>
+ <?php if (FreshRSS_Context::userConf()->show_author_date === 'h' || FreshRSS_Context::userConf()->show_author_date === 'b') { ?>
+ <div class="subtitle">
+ <?php if (FreshRSS_Context::userConf()->show_feed_name === 'a') { ?>
+ <div class="website"><a href="<?= $this->internal_rendering ? $feed->website() : _url('index', 'reader', 'get', 'f_' . $feed->id()) ?>" title="<?= _t('gen.action.filter') ?>">
+ <?php if (FreshRSS_Context::userConf()->show_favicons): ?>
+ <img class="favicon" src="<?= $feed->favicon() ?>" alt="✇" loading="lazy" /><?php
+ endif; ?><span><?= $feed->name() ?></span></a></div>
+ <?php } ?>
+ <div class="author"><?php
+ $authors = $entry->authors();
+ if (is_array($authors)) {
+ if ($this->internal_rendering):
+ foreach ($authors as $author): ?>
+ <?= $author ?>
+ <?php endforeach;
+ else:
+ foreach ($authors as $author): ?>
+ <a href="<?= Minz_Url::display(Minz_Request::modifiedCurrentRequest(['search' => 'author:' . str_replace(' ', '+', htmlspecialchars_decode($author, ENT_QUOTES))])) ?>">
+ <?= $author ?>
+ </a>
+ <?php endforeach;
+ endif;
+ } ?>
+ </div>
+ <div class="date">
+ <time datetime="<?= $entry->machineReadableDate() ?>"><?= $entry->date() ?></time>
+ </div>
+ </div>
+ <?php } ?>
+ </header>
+
+ <div class="text">
+ <?= $entry->content(true) ?>
+ </div>
+ <?php
+ $display_authors_date = in_array(FreshRSS_Context::userConf()->show_author_date, ['b', 'f'], true);
+ $display_tags = in_array(FreshRSS_Context::userConf()->show_tags, ['b', 'f'], true);
+
+ if ($display_authors_date || $display_tags) {
+ ?>
+ <footer>
+ <?php if ($display_authors_date) { ?>
+ <div class="subtitle">
+ <?php if (FreshRSS_Context::userConf()->show_feed_name === 'a') { ?>
+ <div class="website"><a href="<?= _url('index', 'reader', 'get', 'f_' . $feed->id()) ?>" title="<?= _t('gen.action.filter') ?>">
+ <?php if (FreshRSS_Context::userConf()->show_favicons): ?>
+ <img class="favicon" src="<?= $feed->favicon() ?>" alt="✇" loading="lazy" /><?php
+ endif; ?><span><?= $feed->name() ?></span></a></div>
+ <?php } ?>
+ <div class="author"><?php
+ $authors = $entry->authors();
+ if (is_array($authors)) {
+ foreach ($authors as $author) {
+ ?>
+ <a href="<?= Minz_Url::display(Minz_Request::modifiedCurrentRequest(['search' => 'author:' . str_replace(' ', '+', htmlspecialchars_decode($author, ENT_QUOTES))])) ?>">
+ <?= $author ?>
+ </a>
+ <?php
+ }
+ }
+ ?>
+ </div>
+ <div class="date">
+ <time datetime="<?= $entry->machineReadableDate() ?>"><?= $entry->date() ?></time>
+ </div>
+ </div>
+ <?php
+ }
+
+ if ($display_tags) {
+ $this->renderHelper('index/tags');
+ }
+ ?>
+ </footer>
+ <?php
+ } ?>
+</div>
+</article>
diff --git a/app/views/helpers/index/normal/entry_header.phtml b/app/views/helpers/index/normal/entry_header.phtml
index b324a5949..f550dfa21 100644
--- a/app/views/helpers/index/normal/entry_header.phtml
+++ b/app/views/helpers/index/normal/entry_header.phtml
@@ -1,9 +1,6 @@
<?php
declare(strict_types=1);
/** @var FreshRSS_View $this */
- if ($this->feed === null) {
- throw new FreshRSS_Context_Exception('Feed not initialised!');
- }
$topline_read = FreshRSS_Context::userConf()->topline_read;
$topline_favorite = FreshRSS_Context::userConf()->topline_favorite;
$topline_website = FreshRSS_Context::userConf()->topline_website;
diff --git a/app/views/helpers/index/tags.phtml b/app/views/helpers/index/tags.phtml
new file mode 100644
index 000000000..8f67784dd
--- /dev/null
+++ b/app/views/helpers/index/tags.phtml
@@ -0,0 +1,42 @@
+<?php
+ declare(strict_types=1);
+ /** @var FreshRSS_View $this */
+ [$firstTags,$remainingTags] = $this->entry->tagsFormattingHelper();
+?>
+<div class="tags">
+<?php if (!empty($firstTags)): ?>
+ <?= _i('tag') ?><ul class="list-tags">
+ <?php if (Minz_Request::controllerName() === 'index'): ?>
+ <?php foreach ($firstTags as $tag): ?>
+ <li class="item tag"><a class="link-tag" href="<?= _url('index', 'index', 'search', '#' . str_replace(' ', '+', htmlspecialchars_decode($tag, ENT_QUOTES))) ?>" title="<?= _t('gen.action.filter') ?>">#<?= $tag ?></a></li>
+ <?php endforeach; ?>
+ <?php else: // API public access ?>
+ <?php foreach ($firstTags as $tag): ?>
+ <li class="item tag"><a class="link-tag" href="<?= $this->html_url . '&search=%23' . str_replace(' ', '+', htmlspecialchars_decode($tag, ENT_QUOTES)) ?>" title="<?= _t('gen.action.filter') ?>">#<?= $tag ?></a></li>
+ <?php endforeach; ?>
+ <?php endif; ?>
+
+ <?php if (!empty($remainingTags)): // more than 7 tags: show dropdown menu ?>
+ <li class="item tag">
+ <div class="dropdown">
+ <div id="dropdown-tags2-<?= $this->entry->id() ?>" class="dropdown-target"></div>
+ <a class="dropdown-toggle" href="#dropdown-tags2-<?= $this->entry->id() ?>"><?= _i('down') ?></a>
+ <ul class="dropdown-menu">
+ <li class="dropdown-header"><?= _t('index.tag.related') ?></li>
+ <?php if (Minz_Request::controllerName() === 'index'): ?>
+ <?php foreach ($remainingTags as $tag): ?>
+ <li class="item"><a href="<?= _url('index', 'index', 'search', '#' . str_replace(' ', '+', htmlspecialchars_decode($tag, ENT_QUOTES))) ?>" title="<?= _t('gen.action.filter') ?>">#<?= $tag ?></a></li>
+ <?php endforeach; ?>
+ <?php else: ?>
+ <?php foreach ($remainingTags as $tag): ?>
+ <li class="item tag"><a class="link-tag" href="<?= $this->html_url . '&search=%23' . str_replace(' ', '+', htmlspecialchars_decode($tag, ENT_QUOTES)) ?>" title="<?= _t('gen.action.filter') ?>">#<?= $tag ?></a></li>
+ <?php endforeach; ?>
+ <?php endif; ?>
+ </ul>
+ <a class="dropdown-close" href="#close">❌</a>
+ </div>
+ </li>
+ <?php endif; ?>
+ </ul>
+<?php endif; ?>
+</div>
diff --git a/app/views/index/html.phtml b/app/views/index/html.phtml
new file mode 100644
index 000000000..149bebee4
--- /dev/null
+++ b/app/views/index/html.phtml
@@ -0,0 +1,32 @@
+<?php
+ declare(strict_types=1);
+ /** @var FreshRSS_View $this */
+ // Override some layout preferences for the public API output
+ FreshRSS_Context::userConf()->content_width = 'large';
+ FreshRSS_Context::userConf()->show_author_date = FreshRSS_UserConfiguration::default()->show_author_date;
+ FreshRSS_Context::userConf()->show_favicons = FreshRSS_UserConfiguration::default()->show_favicons;
+ FreshRSS_Context::userConf()->show_feed_name = FreshRSS_UserConfiguration::default()->show_feed_name;
+ FreshRSS_Context::userConf()->show_tags = FreshRSS_UserConfiguration::default()->show_tags;
+ FreshRSS_Context::userConf()->show_tags_max = FreshRSS_UserConfiguration::default()->show_tags_max;
+?>
+<?php $this->renderHelper('htmlPagination'); ?>
+<main id="stream" class="reader api">
+ <h2>
+ <a href="<?= $this->html_url ?>"><?= FreshRSS_View::title() ?></a> ·
+ <a class="view-rss" href="<?= $this->rss_url ?>" title="<?= _t('index.menu.rss_view') ?>">
+ <?= _i('rss') ?>
+ </a>
+ </h2>
+ <?php
+ foreach ($this->entries as $entry):
+ $this->entry = $entry;
+ $this->feed = $this->feeds[$entry->feedId()] ??
+ FreshRSS_Category::findFeed($this->categories, $entry->feedId()) ??
+ FreshRSS_Feed::default();
+ ?>
+ <div class="flux">
+ <?php $this->renderHelper('index/article'); ?>
+ </div>
+ <?php endforeach; ?>
+</main>
+<?php $this->renderHelper('htmlPagination'); ?>
diff --git a/app/views/index/normal.phtml b/app/views/index/normal.phtml
index 26e38dc91..9596ebc89 100644
--- a/app/views/index/normal.phtml
+++ b/app/views/index/normal.phtml
@@ -11,23 +11,18 @@ call_user_func($this->callbackBeforeEntries, $this);
$display_today = true;
$display_yesterday = true;
$display_others = true;
-$hidePosts = !FreshRSS_Context::userConf()->display_posts;
-$lazyload = FreshRSS_Context::userConf()->lazyload;
-$content_width = FreshRSS_Context::userConf()->content_width;
-$MAX_TAGS_DISPLAYED = (int)FreshRSS_Context::userConf()->show_tags_max;
$useKeepUnreadImportant = !FreshRSS_Context::isImportant() && !FreshRSS_Context::isFeed();
$today = @strtotime('today');
?>
-<main id="stream" class="normal<?= $hidePosts ? ' hide_posts' : '' ?>">
+<main id="stream" class="normal<?= FreshRSS_Context::userConf()->display_posts ? '' : ' hide_posts' ?>">
<h1 class="title_hidden"><?= _t('conf.reading.view.normal') ?></h1>
<div id="new-article">
<a href="<?= Minz_Url::display(Minz_Request::currentRequest()) ?>"><?= _t('gen.js.new_article'); /* TODO: move string in JS*/ ?></a>
</div><?php
$lastEntry = null;
$nbEntries = 0;
- /** @var FreshRSS_Entry */
foreach ($this->entries as $item):
$lastEntry = $item;
$nbEntries++;
@@ -40,8 +35,8 @@ $today = @strtotime('today');
$this->entry = $item;
// We most likely already have the feed object in cache, otherwise make a request
- $this->feed = FreshRSS_CategoryDAO::findFeed($this->categories, $this->entry->feedId()) ??
- $this->entry->feed() ?? FreshRSS_Feed::example();
+ $this->feed = FreshRSS_Category::findFeed($this->categories, $this->entry->feedId()) ??
+ $this->entry->feed() ?? FreshRSS_Feed::default();
if ($display_today && $this->entry->isDay(FreshRSS_Days::TODAY, $today)) {
?><div class="day" id="day_today"><?php
@@ -74,27 +69,8 @@ $today = @strtotime('today');
?>" data-priority="<?= $this->feed->priority()
?>"><?php
$this->renderHelper('index/normal/entry_header');
- if ($this->feed === null) {
- throw new FreshRSS_Context_Exception('Feed not initialised!');
- }
-
- $tags = null;
- $firstTags = array();
- $remainingTags = array();
-
- if (FreshRSS_Context::userConf()->show_tags === 'h' || FreshRSS_Context::userConf()->show_tags === 'f' || FreshRSS_Context::userConf()->show_tags === 'b') {
- $tags = $this->entry->tags();
- if (!empty($tags)) {
- if ($MAX_TAGS_DISPLAYED > 0) {
- $firstTags = array_slice($tags, 0, $MAX_TAGS_DISPLAYED);
- $remainingTags = array_slice($tags, $MAX_TAGS_DISPLAYED);
- } else {
- $firstTags = $tags;
- }
- }
- }
?><article class="flux_content" dir="auto">
- <div class="content <?= $content_width ?>">
+ <div class="content <?= FreshRSS_Context::userConf()->content_width ?>">
<header>
<?php if (FreshRSS_Context::userConf()->show_feed_name === 't') { ?>
<div class="website"><a href="<?= _url('index', 'index', 'get', 'f_' . $this->feed->id()) ?>" title="<?= _t('gen.action.filter') ?>">
@@ -103,36 +79,8 @@ $today = @strtotime('today');
endif; ?><span><?= $this->feed->name() ?></span></a>
</div>
<?php } ?>
- <?php if (FreshRSS_Context::userConf()->show_tags === 'h' || FreshRSS_Context::userConf()->show_tags === 'b') { ?>
- <div class="tags">
- <?php
- if (!empty($tags)) {
- ?><?= _i('tag') ?><ul class="list-tags"><?php
- foreach ($firstTags as $tag) {
- ?><li class="item tag"><a class="link-tag" href="<?= _url('index', 'index', 'search', '#' . str_replace(' ', '+', htmlspecialchars_decode($tag, ENT_QUOTES))) ?>" title="<?= _t('gen.action.filter') ?>">#<?= $tag ?></a></li><?php
- }
-
- if (!empty($remainingTags)) { // more than 7 tags: show dropdown menu ?>
- <li class="item tag">
- <div class="dropdown">
- <div id="dropdown-tags2-<?= $this->entry->id() ?>" class="dropdown-target"></div>
- <a class="dropdown-toggle" href="#dropdown-tags2-<?= $this->entry->id() ?>"><?= _i('down') ?></a>
- <ul class="dropdown-menu">
- <li class="dropdown-header"><?= _t('index.tag.related') ?></li>
- <?php
- foreach ($remainingTags as $tag) {
- ?><li class="item"><a href="<?= _url('index', 'index', 'search', '#' . str_replace(' ', '+', htmlspecialchars_decode($tag, ENT_QUOTES))) ?>" title="<?= _t('gen.action.filter') ?>"><?= $tag ?></a></li><?php
- } ?>
- </ul>
- <a class="dropdown-close" href="#close">❌</a>
- </div>
- </li>
- <?php
- } ?>
- </ul><?php
- } ?>
- </div>
- <?php
+ <?php if (FreshRSS_Context::userConf()->show_tags === 'h' || FreshRSS_Context::userConf()->show_tags === 'b') {
+ $this->renderHelper('index/tags');
} ?>
<h1 class="title"><a target="_blank" rel="noreferrer" class="go_website" href="<?= $this->entry->link() ?>" title="<?= _t('conf.shortcut.see_on_website')?>"><?= $this->entry->title() ?></a></h1>
<?php if (FreshRSS_Context::userConf()->show_author_date === 'h' || FreshRSS_Context::userConf()->show_author_date === 'b') { ?>
@@ -163,8 +111,8 @@ $today = @strtotime('today');
</div>
<?php } ?>
</header>
- <div class="text"><?php
- echo $lazyload && $hidePosts ? lazyimg($this->entry->content(true)) : $this->entry->content(true);
+ <div class="text"><?=
+ FreshRSS_Context::userConf()->lazyload && !FreshRSS_Context::userConf()->display_posts ? lazyimg($this->entry->content(true)) : $this->entry->content(true)
?></div>
<?php
$display_authors_date = FreshRSS_Context::userConf()->show_author_date === 'f' || FreshRSS_Context::userConf()->show_author_date === 'b';
@@ -201,36 +149,10 @@ $today = @strtotime('today');
</div>
<?php
}
- if ($display_tags) { ?>
- <div class="tags">
- <?php
- if (!empty($tags)) {
- ?><?= _i('tag') ?><ul class="list-tags"><?php
- foreach ($firstTags as $tag) {
- ?><li class="item tag"><a class="link-tag" href="<?= _url('index', 'index', 'search', '#' . str_replace(' ', '+', htmlspecialchars_decode($tag, ENT_QUOTES))) ?>" title="<?= _t('gen.action.filter') ?>">#<?= $tag ?></a></li><?php
- }
- if (!empty($remainingTags)) { ?>
- <li class="item tag">
- <div class="dropdown">
- <div id="dropdown-tags3-<?= $this->entry->id() ?>" class="dropdown-target"></div>
- <a class="dropdown-toggle" href="#dropdown-tags3-<?= $this->entry->id() ?>"><?= _i('down') ?></a>
- <ul class="dropdown-menu">
- <li class="dropdown-header"><?= _t('index.tag.related') ?></li>
- <?php
- foreach ($remainingTags as $tag) {
- ?><li class="item"><a href="<?= _url('index', 'index', 'search', '#' . str_replace(' ', '+', htmlspecialchars_decode($tag, ENT_QUOTES))) ?>" title="<?= _t('gen.action.filter') ?>"><?= $tag ?></a></li><?php
- } ?>
- </ul>
- <a class="dropdown-close" href="#close">❌</a>
- </div>
- </li>
- <?php
- } ?>
- </ul><?php
- } ?>
- </div>
- <?php
- } ?>
+ if ($display_tags) {
+ $this->renderHelper('index/tags');
+ }
+ ?>
</footer>
<?php
} ?>
diff --git a/app/views/index/reader.phtml b/app/views/index/reader.phtml
index af51933cf..ccca9e50c 100644
--- a/app/views/index/reader.phtml
+++ b/app/views/index/reader.phtml
@@ -9,8 +9,6 @@ if (!Minz_Request::paramBoolean('ajax')) {
call_user_func($this->callbackBeforeEntries, $this);
$lazyload = FreshRSS_Context::userConf()->lazyload;
-$content_width = FreshRSS_Context::userConf()->content_width;
-$MAX_TAGS_DISPLAYED = (int)FreshRSS_Context::userConf()->show_tags_max;
?>
<main id="stream" class="reader">
<h1 class="title_hidden"><?= _t('conf.reading.view.reader') ?></h1>
@@ -19,197 +17,21 @@ $MAX_TAGS_DISPLAYED = (int)FreshRSS_Context::userConf()->show_tags_max;
</div><?php
$lastEntry = null;
$nbEntries = 0;
- /** @var FreshRSS_Entry */
- foreach ($this->entries as $item):
- $lastEntry = $item;
+ foreach ($this->entries as $entry):
+ $lastEntry = $entry;
$nbEntries++;
ob_flush();
/** @var FreshRSS_Entry */
- $item = Minz_ExtensionManager::callHook('entry_before_display', $item);
- if ($item == null) {
+ $entry = Minz_ExtensionManager::callHook('entry_before_display', $entry);
+ if ($entry == null) {
continue;
}
- $this->entry = $item;
-
- $tags = null;
- $firstTags = array();
- $remainingTags = array();
-
- if (FreshRSS_Context::userConf()->show_tags == 'h' || FreshRSS_Context::userConf()->show_tags == 'f' || FreshRSS_Context::userConf()->show_tags == 'b') {
- $tags = $this->entry->tags();
- if (!empty($tags)) {
- if ($MAX_TAGS_DISPLAYED > 0) {
- $firstTags = array_slice($tags, 0, $MAX_TAGS_DISPLAYED);
- $remainingTags = array_slice($tags, $MAX_TAGS_DISPLAYED);
- } else {
- $firstTags = $tags;
- }
- }
- }
+ $this->entry = $entry;
//We most likely already have the feed object in cache, otherwise make a request
- $feed = FreshRSS_CategoryDAO::findFeed($this->categories, $item->feedId()) ?? $item->feed() ?? FreshRSS_Feed::example();
- ?><div class="flux<?= !$item->isRead() ? ' not_read' : '' ?><?= $item->isFavorite() ? ' favorite' : '' ?>" id="flux_<?= $item->id() ?>" data-priority="<?= $feed->priority() ?>">
- <article class="flux_content" dir="auto">
-
- <div class="content <?= $content_width ?>">
- <header>
- <?php
- $favoriteUrl = array('c' => 'entry', 'a' => 'bookmark', 'params' => array('id' => $item->id()));
- if ($item->isFavorite()) {
- $favoriteUrl['params']['is_favorite'] = 0;
- }
- $readUrl = array('c' => 'entry', 'a' => 'read', 'params' => array('id' => $item->id()));
- if ($item->isRead()) {
- $readUrl['params']['is_read'] = 0;
- }
- ?>
- <div class="article-header-topline">
- <?php if (FreshRSS_Auth::hasAccess()) { ?>
- <a class="read" href="<?= Minz_Url::display($readUrl) ?>" title="<?= _t('conf.shortcut.mark_read') ?>"><?= _i($item->isRead() ? 'read' : 'unread') ?></a>
- <a class="bookmark" href="<?= Minz_Url::display($favoriteUrl) ?>" title="<?= _t('conf.shortcut.mark_favorite') ?>"><?= _i($item->isFavorite() ? 'starred' : 'non-starred') ?></a>
- <?php } ?>
- <?php if (FreshRSS_Context::userConf()->show_feed_name === 't') { ?>
- <a class="website" href="<?= _url('index', 'reader', 'get', 'f_' . $feed->id()) ?>" title="<?= _t('gen.action.filter') ?>">
- <?php if (FreshRSS_Context::userConf()->show_favicons): ?>
- <img class="favicon" src="<?= $feed->favicon() ?>" alt="✇" loading="lazy" /><?php
- endif; ?><span><?= $feed->name() ?></span></a>
- <?php } ?>
- </div>
-
- <?php if (FreshRSS_Context::userConf()->show_tags === 'h' || FreshRSS_Context::userConf()->show_tags === 'b') { ?>
- <div class="tags">
- <?php
- if (!empty($tags)) {
- ?><?= _i('tag') ?><ul class="list-tags"><?php
- foreach ($firstTags as $tag) {
- ?><li class="item tag"><a class="link-tag" href="<?= _url('index', 'index', 'search', '#' . str_replace(' ', '+', htmlspecialchars_decode($tag, ENT_QUOTES))) ?>" title="<?= _t('gen.action.filter') ?>">#<?= $tag ?></a></li><?php
- }
-
- if (!empty($remainingTags)) { // more than 7 tags: show dropdown menu ?>
- <li class="item tag">
- <div class="dropdown">
- <div id="dropdown-tags-<?= $this->entry->id() ?>" class="dropdown-target"></div>
- <a class="dropdown-toggle" href="#dropdown-tags-<?= $this->entry->id() ?>"><?= _i('down') ?></a>
- <ul class="dropdown-menu">
- <li class="dropdown-header"><?= _t('index.tag.related') ?></li>
- <?php
- foreach ($remainingTags as $tag) {
- ?><li class="item"><a href="<?= _url('index', 'index', 'search', '#' . str_replace(' ', '+', htmlspecialchars_decode($tag, ENT_QUOTES))) ?>" title="<?= _t('gen.action.filter') ?>"><?= $tag ?></a></li><?php
- } ?>
- </ul>
- <a class="dropdown-close" href="#close">❌</a>
- </div>
- </li>
- <?php
- } ?>
- </ul><?php
- } ?>
- </div>
- <?php } ?>
-
- <h1 class="title"><a target="_blank" rel="noreferrer" class="go_website" href="<?= $item->link() ?>"><?= $item->title() ?></a></h1>
- <?php if (FreshRSS_Context::userConf()->show_author_date === 'h' || FreshRSS_Context::userConf()->show_author_date === 'b') { ?>
- <div class="subtitle">
- <?php if (FreshRSS_Context::userConf()->show_feed_name === 'a') { ?>
- <div class="website"><a href="<?= _url('index', 'reader', 'get', 'f_' . $feed->id()) ?>" title="<?= _t('gen.action.filter') ?>">
- <?php if (FreshRSS_Context::userConf()->show_favicons): ?>
- <img class="favicon" src="<?= $feed->favicon() ?>" alt="✇" loading="lazy" /><?php
- endif; ?><span><?= $feed->name() ?></span></a></div>
- <?php } ?>
- <div class="author"><?php
- $authors = $item->authors();
- if (is_array($authors)) {
- foreach ($authors as $author) {
- ?>
- <a href="<?= Minz_Url::display(Minz_Request::modifiedCurrentRequest(['search' => 'author:' . str_replace(' ', '+', htmlspecialchars_decode($author, ENT_QUOTES))])) ?>">
- <?= $author ?>
- </a>
- <?php
- }
- }
- ?>
- </div>
- <div class="date">
- <time datetime="<?= $item->machineReadableDate() ?>"><?= $item->date() ?></time>
- </div>
- </div>
- <?php } ?>
- </header>
-
- <div class="text">
- <?= $item->content(true) ?>
- </div>
- <?php
- $display_authors_date = FreshRSS_Context::userConf()->show_author_date === 'f' || FreshRSS_Context::userConf()->show_author_date === 'b';
- $display_tags = FreshRSS_Context::userConf()->show_tags === 'f' || FreshRSS_Context::userConf()->show_tags === 'b';
-
- if ($display_authors_date || $display_tags) {
- ?>
- <footer>
- <?php if ($display_authors_date) { ?>
- <div class="subtitle">
- <?php if (FreshRSS_Context::userConf()->show_feed_name === 'a') { ?>
- <div class="website"><a href="<?= _url('index', 'reader', 'get', 'f_' . $feed->id()) ?>" title="<?= _t('gen.action.filter') ?>">
- <?php if (FreshRSS_Context::userConf()->show_favicons): ?>
- <img class="favicon" src="<?= $feed->favicon() ?>" alt="✇" loading="lazy" /><?php
- endif; ?><span><?= $feed->name() ?></span></a></div>
- <?php } ?>
- <div class="author"><?php
- $authors = $item->authors();
- if (is_array($authors)) {
- foreach ($authors as $author) {
- ?>
- <a href="<?= Minz_Url::display(Minz_Request::modifiedCurrentRequest(['search' => 'author:' . str_replace(' ', '+', htmlspecialchars_decode($author, ENT_QUOTES))])) ?>">
- <?= $author ?>
- </a>
- <?php
- }
- }
- ?>
- </div>
- <div class="date">
- <time datetime="<?= $item->machineReadableDate() ?>"><?= $item->date() ?></time>
- </div>
- </div>
- <?php
- }
-
- if ($display_tags) { ?>
- <div class="tags">
- <?php
- if (!empty($tags)) {
- ?><?= _i('tag') ?><ul class="list-tags"><?php
- foreach ($firstTags as $tag) {
- ?><li class="item tag"><a class="link-tag" href="<?= _url('index', 'index', 'search', '#' . str_replace(' ', '+', htmlspecialchars_decode($tag, ENT_QUOTES))) ?>" title="<?= _t('gen.action.filter') ?>">#<?= $tag ?></a></li><?php
- }
-
- if (!empty($remainingTags)) { // more than 7 tags: show dropdown menu ?>
- <li class="item tag">
- <div class="dropdown">
- <div id="dropdown-tags2-<?= $this->entry->id() ?>" class="dropdown-target"></div>
- <a class="dropdown-toggle" href="#dropdown-tags2-<?= $this->entry->id() ?>"><?= _i('down') ?></a>
- <ul class="dropdown-menu">
- <li class="dropdown-header"><?= _t('index.tag.related') ?></li>
- <?php
- foreach ($remainingTags as $tag) {
- ?><li class="item"><a href="<?= _url('index', 'index', 'search', '#' . str_replace(' ', '+', htmlspecialchars_decode($tag, ENT_QUOTES))) ?>" title="<?= _t('gen.action.filter') ?>"><?= $tag ?></a></li><?php
- } ?>
- </ul>
- <a class="dropdown-close" href="#close">❌</a>
- </div>
- </li>
- <?php
- } ?>
- </ul><?php
- } ?>
- </div>
- <?php } ?>
- </footer>
- <?php
- } ?>
- </div>
- </article>
+ $this->feed = FreshRSS_Category::findFeed($this->categories, $entry->feedId()) ?? $entry->feed() ?? FreshRSS_Feed::default();
+ ?><div class="flux<?= !$entry->isRead() ? ' not_read' : '' ?><?= $entry->isFavorite() ? ' favorite' : '' ?>" id="flux_<?= $entry->id() ?>" data-priority="<?= $this->feed->priority() ?>">
+ <?php $this->renderHelper('index/article'); ?>
</div><?php
endforeach;
diff --git a/app/views/index/rss.phtml b/app/views/index/rss.phtml
index 1c036abd2..80768c5b7 100644
--- a/app/views/index/rss.phtml
+++ b/app/views/index/rss.phtml
@@ -8,14 +8,12 @@
>
<channel>
<title><?= $this->rss_title ?></title>
- <link><?= $this->internal_rendering ? htmlspecialchars($this->rss_url, ENT_NOQUOTES, 'UTF-8') : Minz_Url::display('', 'html', true) ?></link>
+ <link><?= $this->html_url ?></link>
<description><?= _t('index.feed.rss_of', $this->rss_title) ?></description>
<pubDate><?= date('D, d M Y H:i:s O') ?></pubDate>
<lastBuildDate><?= gmdate('D, d M Y H:i:s') ?> GMT</lastBuildDate>
- <atom:link href="<?= $this->internal_rendering ? htmlspecialchars($this->rss_url, ENT_COMPAT, 'UTF-8') :
- Minz_Url::display($this->rss_url, 'html', true) ?>" rel="self" type="application/rss+xml" />
+ <atom:link href="<?= $this->rss_url ?>" rel="self" type="application/rss+xml" />
<?php
-/** @var FreshRSS_Entry */
foreach ($this->entries as $item) {
if (!$this->internal_rendering) {
/** @var FreshRSS_Entry */
diff --git a/app/views/user/profile.phtml b/app/views/user/profile.phtml
index 576e821b2..1ce964365 100644
--- a/app/views/user/profile.phtml
+++ b/app/views/user/profile.phtml
@@ -62,6 +62,7 @@
<p class="help"><?= _i('help') ?> <?= _t('admin.auth.token_help') ?></p>
<kbd><?= Minz_Url::display(array('a' => 'rss', 'params' => array('user' => Minz_User::name(),
'token' => $token, 'hours' => FreshRSS_Context::userConf()->since_hours_posts_per_rss)), 'html', true) ?></kbd>
+ <p class="help"><?= _i('help') ?> <?= _t('conf.query.help') ?></a></p>
</div>
</div>
<?php } ?>