aboutsummaryrefslogtreecommitdiff
path: root/app/views/helpers/index/article.phtml
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/helpers/index/article.phtml
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/helpers/index/article.phtml')
-rw-r--r--app/views/helpers/index/article.phtml117
1 files changed, 117 insertions, 0 deletions
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>