update.phtml 54 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992
  1. <?php
  2. declare(strict_types=1);
  3. /** @var FreshRSS_View $this */
  4. if ($this->feed === null) {
  5. return;
  6. }
  7. ?>
  8. <div class="post" id="feed_update" data-feed-id="<?= $this->feed->id() ?>">
  9. <h1><?= $this->feed->name() ?></h1>
  10. <div>
  11. <a href="<?= _url('index', 'index', 'get', 'f_' . $this->feed->id()) ?>"><?= _i('link') ?> <?= _t('gen.action.filter') ?></a>
  12. <?= _t('gen.short.or') ?>
  13. <a href="<?= _url('stats', 'repartition', 'id', $this->feed->id()) ?>"><?= _i('stats') ?> <?= _t('sub.feed.stats') ?></a>
  14. </div>
  15. <?php if ($this->feed->inError()): ?>
  16. <p class="alert alert-error">
  17. <span class="alert-head"><?= _t('gen.short.damn') ?></span>
  18. <?= _t('sub.feed.error') ?><br />
  19. <?php if ($this->feed->lastError() > 1) { ?>
  20. <?= _t('sub.feed.last-error-date', timestampToMachineDate($this->feed->lastError()), timeago($this->feed->lastError())) ?><br />
  21. <?php } ?>
  22. <?php else: ?>
  23. <p class="alert alert-success">
  24. <?php endif; ?>
  25. <?= _t('sub.feed.last-update', timestampToMachineDate($this->feed->lastUpdate()), timeago($this->feed->lastUpdate())) ?>
  26. <?php if ($this->feed->newestArticleReceivedDate() > 0): ?><br />
  27. <?= _t('sub.feed.last-entry-received-date', timestampToMachineDate($this->feed->newestArticleReceivedDate()), timeago($this->feed->newestArticleReceivedDate())) ?>
  28. <?php endif; ?>
  29. <?php if ($this->feed->newestArticlePublicationDate() > 0): ?><br />
  30. <?= _t('sub.feed.last-entry-publication-date', timestampToMachineDate($this->feed->newestArticlePublicationDate()), timeago($this->feed->newestArticlePublicationDate())) ?>
  31. <?php endif; ?>
  32. </p>
  33. <?php $nbEntries = $this->feed->nbEntries(); ?>
  34. <?php if ($nbEntries === 0): ?>
  35. <p class="alert alert-warn"><?= _t('sub.feed.empty') ?></p>
  36. <?php endif; ?>
  37. <?php
  38. $from = Minz_Request::paramString('from');
  39. $slider = ['#', 'slider'];
  40. $ajax = Minz_Request::paramBoolean('ajax') || $this->displaySlider;
  41. if (!$ajax) {
  42. $from = 'feed';
  43. $slider = [];
  44. } elseif ($from === '') {
  45. $from = $this->cfrom ?: 'index';
  46. }
  47. if ($from === '') {
  48. $url = _url('subscription', 'feed', 'id', $this->feed->id(), ...$slider);
  49. } else {
  50. $get = Minz_Request::paramString('get');
  51. if ($get === '') {
  52. $url = _url('subscription', 'feed', 'id', $this->feed->id(), 'from', $from, 'error', Minz_Request::paramBoolean('error') ? 1 : 0, ...$slider);
  53. } else {
  54. $url = _url('subscription', 'feed', 'id', $this->feed->id(), 'from', $from, 'get', $get, ...$slider);
  55. }
  56. }
  57. ?>
  58. <form method="post" action="<?= $url ?>" autocomplete="off" enctype="multipart/form-data" data-auto-leave-validation="1">
  59. <input type="hidden" name="_csrf" value="<?= FreshRSS_Auth::csrfToken() ?>" />
  60. <fieldset>
  61. <legend><?= _t('sub.feed.information') ?></legend>
  62. <div class="form-group">
  63. <?php
  64. $currentIconUrl = $this->feed->favicon();
  65. $originalIconUrl = '';
  66. if ($this->feed->customFavicon()) {
  67. $this->feed->_attribute('customFavicon', false);
  68. $this->feed->resetFaviconHash();
  69. }
  70. $originalIconUrl = $this->feed->favicon();
  71. $this->feed->_attribute('customFavicon', $currentIconUrl !== $originalIconUrl);
  72. $this->feed->resetFaviconHash();
  73. $ext_url = Minz_ExtensionManager::callHook(Minz_HookType::CustomFaviconBtnUrl, $this->feed);
  74. ?>
  75. <div class="group-name"><?= _t('sub.feed.icon') ?></div>
  76. <div class="group-controls">
  77. <img class="favicon upload" src="<?= $currentIconUrl ?>" data-initial-src="<?= $currentIconUrl ?>" data-original-icon="<?= $originalIconUrl ?>" alt="✇" loading="lazy" />
  78. <div class="favicon-controls">
  79. <input id="favicon-upload" name="newFavicon" type="file" accept="image/*" />
  80. <label for="favicon-upload" class="btn"><?= _t('sub.feed.change_favicon') ?></label>
  81. <button id="reset-favicon" class="btn"<?= $this->feed->customFavicon() ? '' : ' disabled="disabled"'?>><?= _t('sub.feed.reset_favicon') ?></button>
  82. <?php if (is_string($ext_url)) { ?>
  83. <button id="favicon-ext-btn" class="btn" data-extension-url="<?= htmlspecialchars(html_entity_decode($ext_url), ENT_COMPAT, 'UTF-8') ?>"><?= _t('sub.feed.ext_favicon') ?></button>
  84. <?php } ?>
  85. </div>
  86. <p id="favicon-ext" class="<?= $this->feed->customFaviconExt() !== null ? '' : 'hidden' ?>"><?= _t('sub.feed.favicon_changed_by_ext', htmlspecialchars($this->feed->customFaviconExt() ?? '', ENT_NOQUOTES, 'UTF-8')) ?></p>
  87. <p id="favicon-error" class="error"></p>
  88. </div>
  89. </div>
  90. <div class="form-group">
  91. <label class="group-name" for="name"><?= _t('sub.feed.title') ?></label>
  92. <div class="group-controls">
  93. <input type="text" name="name" id="name" class="w100" value="<?= $this->feed->name(true) ?>" required="required" />
  94. </div>
  95. </div>
  96. <div class="form-group">
  97. <label class="group-name" for="description"><?= _t('sub.feed.description') ?></label>
  98. <div class="group-controls">
  99. <textarea name="description" id="description" class="w100"><?= htmlspecialchars($this->feed->description(), ENT_NOQUOTES, 'UTF-8') ?></textarea>
  100. </div>
  101. </div>
  102. <div class="form-group">
  103. <label class="group-name" for="website"><?= _t('sub.feed.website') ?></label>
  104. <div class="group-controls">
  105. <div class="stick w100">
  106. <input type="url" name="website" id="website" value="<?= $this->feed->website() ?>" />
  107. <a class="btn open-url" target="_blank" rel="noreferrer" href="<?= $this->feed->website() ?>" data-input="website" title="<?= _t('gen.action.open_url') ?>"><?= _i('link') ?></a>
  108. </div>
  109. </div>
  110. </div>
  111. <div class="form-group">
  112. <label class="group-name" for="url"><?= _t('sub.feed.url') ?></label>
  113. <div class="group-controls">
  114. <div class="stick w100">
  115. <input type="url" name="url" id="url" value="<?= $this->feed->url() ?>" required="required" />
  116. <a class="btn open-url" target="_blank" rel="noreferrer" href="<?= $this->feed->url() ?>" data-input="url" title="<?= _t('gen.action.open_url') ?>"><?= _i('link') ?></a>
  117. </div>
  118. <a class="btn open-url" target="_blank" rel="noreferrer" data-input="url" data-prefix="https://validator.w3.org/feed/check.cgi?url=" data-encode="1" href="https://validator.w3.org/feed/check.cgi?url=<?=
  119. rawurlencode(htmlspecialchars_decode($this->feed->url(), ENT_QUOTES)) ?>"><?= _t('sub.feed.validator') ?></a>
  120. </div>
  121. </div>
  122. <div class="form-group">
  123. <label class="group-name" for="category"><?= _t('sub.category') ?></label>
  124. <div class="group-controls">
  125. <select name="category" id="category" class="w100">
  126. <?php foreach ($this->categories as $cat) { ?>
  127. <option value="<?= $cat->id() ?>"<?= $cat->id() == $this->feed->categoryId() ? ' selected="selected"' : '' ?>>
  128. <?= $cat->name() ?>
  129. </option>
  130. <?php } ?>
  131. </select>
  132. </div>
  133. </div>
  134. <div class="form-group">
  135. <label class="group-name" for="priority"><?= _t('sub.feed.priority') ?></label>
  136. <div class="group-controls">
  137. <select name="priority" id="priority" class="w50">
  138. <option value="<?= FreshRSS_Feed::PRIORITY_IMPORTANT ?>" <?=
  139. FreshRSS_Feed::PRIORITY_IMPORTANT === $this->feed->priority() ? 'selected="selected"' : '' ?>><?= _t('sub.feed.priority.important') ?></option>
  140. <option value="<?= FreshRSS_Feed::PRIORITY_MAIN_STREAM ?>" <?=
  141. FreshRSS_Feed::PRIORITY_MAIN_STREAM === $this->feed->priority() ? 'selected="selected"' : '' ?>><?= _t('sub.feed.priority.main_stream') ?></option>
  142. <option value="<?= FreshRSS_Feed::PRIORITY_CATEGORY ?>" <?=
  143. FreshRSS_Feed::PRIORITY_CATEGORY === $this->feed->priority() ? 'selected="selected"' : '' ?>><?= _t('sub.feed.priority.category') ?></option>
  144. <option value="<?= FreshRSS_Feed::PRIORITY_FEED ?>" <?=
  145. FreshRSS_Feed::PRIORITY_FEED === $this->feed->priority() ? 'selected="selected"' : '' ?>><?= _t('sub.feed.priority.feed') ?></option>
  146. <option value="<?= FreshRSS_Feed::PRIORITY_HIDDEN ?>" <?=
  147. FreshRSS_Feed::PRIORITY_HIDDEN === $this->feed->priority() ? 'selected="selected"' : '' ?>><?= _t('sub.feed.priority.hidden') ?></option>
  148. </select>
  149. <?= _i('important') ?>
  150. </div>
  151. </div>
  152. <?php
  153. $suc = $this->feed->attributeBoolean('show_unread_count');
  154. $sucLocked = $this->feed->priority() >= FreshRSS_Feed::PRIORITY_IMPORTANT &&
  155. FreshRSS_Context::userConf()->show_unread_count !== 'none';
  156. ?>
  157. <div class="form-group">
  158. <label class="group-name" for="show_unread_count"><?= _t('conf.display.show_unread_count') ?></label>
  159. <div class="group-controls">
  160. <select name="show_unread_count" id="show_unread_count" class="w50"<?= $sucLocked ? ' disabled="disabled"' : '' ?>>
  161. <option value=""<?= $suc === null && !$sucLocked ? ' selected="selected"' : '' ?>><?= _t('gen.short.by_default') ?></option>
  162. <option value="0"<?= $suc === false && !$sucLocked ? ' selected="selected"' : '' ?>><?= _t('gen.short.no') ?></option>
  163. <option value="1"<?= $suc === true || $sucLocked ? ' selected="selected"' : '' ?>><?= _t('gen.short.yes') ?></option>
  164. </select>
  165. <?php if ($sucLocked): ?>
  166. <small><?= _t('conf.display.show_unread_count.important_locked') ?></small>
  167. <?php endif; ?>
  168. </div>
  169. </div>
  170. <?php
  171. $feedDefaultSort = $this->feed->defaultSort();
  172. $feedDefaultOrder = $this->feed->defaultOrder();
  173. $feedDefaultSortOrder = $feedDefaultSort !== null
  174. ? ($feedDefaultSort === 'rand' ? 'rand' : $feedDefaultSort . '_' . strtolower($feedDefaultOrder ?? 'desc'))
  175. : '';
  176. ?>
  177. <div class="form-group">
  178. <label class="group-name" for="defaultSortOrder"><?= _t('index.menu.sort.primary') ?></label>
  179. <div class="group-controls">
  180. <select name="defaultSortOrder" id="defaultSortOrderFeed" class="w50">
  181. <option value=""></option>
  182. <option value="id_desc" <?= $feedDefaultSortOrder === 'id_desc' ? 'selected="selected"' : '' ?>><?= _t('index.menu.sort.id_desc') ?></option>
  183. <option value="date_desc" <?= $feedDefaultSortOrder === 'date_desc' ? 'selected="selected"' : '' ?>><?= _t('index.menu.sort.date_desc') ?></option>
  184. <option value="length_desc" <?= $feedDefaultSortOrder === 'length_desc' ? 'selected="selected"' : '' ?>><?= _t('index.menu.sort.length_desc') ?></option>
  185. <option value="link_desc" <?= $feedDefaultSortOrder === 'link_desc' ? 'selected="selected"' : '' ?>><?= _t('index.menu.sort.link_desc') ?></option>
  186. <option value="title_desc" <?= $feedDefaultSortOrder === 'title_desc' ? 'selected="selected"' : '' ?>><?= _t('index.menu.sort.title_desc') ?></option>
  187. <option disabled="disabled">────────────────</option>
  188. <option value="rand" <?= $feedDefaultSortOrder === 'rand' ? 'selected="selected"' : '' ?>><?= _t('index.menu.sort.rand') ?></option>
  189. <option disabled="disabled">────────────────</option>
  190. <option value="id_asc" <?= $feedDefaultSortOrder === 'id_asc' ? 'selected="selected"' : '' ?>><?= _t('index.menu.sort.id_asc') ?></option>
  191. <option value="date_asc" <?= $feedDefaultSortOrder === 'date_asc' ? 'selected="selected"' : '' ?>><?= _t('index.menu.sort.date_asc') ?></option>
  192. <option value="length_asc" <?= $feedDefaultSortOrder === 'length_asc' ? 'selected="selected"' : '' ?>><?= _t('index.menu.sort.length_asc') ?></option>
  193. <option value="link_asc" <?= $feedDefaultSortOrder === 'link_asc' ? 'selected="selected"' : '' ?>><?= _t('index.menu.sort.link_asc') ?></option>
  194. <option value="title_asc" <?= $feedDefaultSortOrder === 'title_asc' ? 'selected="selected"' : '' ?>><?= _t('index.menu.sort.title_asc') ?></option>
  195. </select>
  196. </div>
  197. </div>
  198. <div class="form-group">
  199. <label class="group-name" for="unicityCriteria"><?= _t('sub.feed.unicityCriteria') ?></label>
  200. <?php
  201. $unicityCriteria = $this->feed->attributeString('unicityCriteria');
  202. if ($this->feed->attributeBoolean('hasBadGuids')) { // Legacy
  203. $unicityCriteria = 'link';
  204. }
  205. ?>
  206. <div class="group-controls">
  207. <select class="w50" name="unicityCriteria" id="unicityCriteria" required="required">
  208. <option value="id" <?= $unicityCriteria == null ? 'selected="selected"' : '' ?>><?= _t('sub.feed.unicityCriteria.id') ?></option>
  209. <option value="link" <?= $unicityCriteria === 'link' ? 'selected="selected"' : '' ?>><?= _t('sub.feed.unicityCriteria.link') ?></option>
  210. <option value="sha1:link_published" <?= $unicityCriteria === 'sha1:link_published' ? 'selected="selected"' : '' ?>><?= _t('sub.feed.unicityCriteria.sha1:link_published') ?></option>
  211. <option value="sha1:link_published_title" <?= $unicityCriteria === 'sha1:link_published_title' ? 'selected="selected"' : '' ?>><?= _t('sub.feed.unicityCriteria.sha1:link_published_title') ?></option>
  212. <option value="sha1:link_published_title_content" <?= $unicityCriteria === 'sha1:link_published_title_content' ? 'selected="selected"' : '' ?>><?= _t('sub.feed.unicityCriteria.sha1:link_published_title_content') ?></option>
  213. <option value="sha1:title" <?= $unicityCriteria === 'sha1:title' ? 'selected="selected"' : '' ?>><?= _t('sub.feed.unicityCriteria.sha1:title') ?></option>
  214. <option value="sha1:title_published" <?= $unicityCriteria === 'sha1:title_published' ? 'selected="selected"' : '' ?>><?= _t('sub.feed.unicityCriteria.sha1:title_published') ?></option>
  215. <option value="sha1:title_published_content" <?= $unicityCriteria === 'sha1:title_published_content' ? 'selected="selected"' : '' ?>><?= _t('sub.feed.unicityCriteria.sha1:title_published_content') ?></option>
  216. <option value="sha1:content" <?= $unicityCriteria === 'sha1:content' ? 'selected="selected"' : '' ?>><?= _t('sub.feed.unicityCriteria.sha1:content') ?></option>
  217. <option value="sha1:content_published" <?= $unicityCriteria === 'sha1:content_published' ? 'selected="selected"' : '' ?>><?= _t('sub.feed.unicityCriteria.sha1:content_published') ?></option>
  218. <option value="sha1:published" <?= $unicityCriteria === 'sha1:published' ? 'selected="selected"' : '' ?>><?= _t('sub.feed.unicityCriteria.sha1:published') ?></option>
  219. </select>
  220. <label for="unicityCriteriaForced" class="inline">
  221. <input type="checkbox" name="unicityCriteriaForced" id="unicityCriteriaForced" value="1"<?= $this->feed->attributeBoolean('unicityCriteriaForced') ? ' checked="checked"' : '' ?> />
  222. <?= _t('sub.feed.unicityCriteria.forced') ?>
  223. </label>
  224. <p class="help"><?= _i('help') ?> <?= _t('sub.feed.unicityCriteria.help') ?></p>
  225. </div>
  226. </div>
  227. <div class="form-group">
  228. <label class="group-name" for="ttl"><?= _t('sub.feed.ttl') ?></label>
  229. <div class="group-controls">
  230. <select class="w50" name="ttl" id="ttl" required="required"><?php
  231. $found = false;
  232. foreach ([FreshRSS_Feed::TTL_DEFAULT => _t('gen.short.by_default'), 900 => '15min', 1200 => '20min', 1500 => '25min', 1800 => '30min', 2700 => '45min',
  233. 3600 => '1h', 5400 => '1.5h', 7200 => '2h', 10800 => '3h', 14400 => '4h', 18800 => '5h', 21600 => '6h', 25200 => '7h', 28800 => '8h',
  234. 36000 => '10h', 43200 => '12h', 64800 => '18h',
  235. 86400 => '1d', 129600 => '1.5d', 172800 => '2d', 259200 => '3d', 345600 => '4d', 432000 => '5d', 518400 => '6d',
  236. 604800 => '1wk', 1209600 => '2wk', 1814400 => '3wk', 2419200 => '4wk', 2629744 => '1mo'] as $v => $t) {
  237. echo '<option value="' . $v . ($this->feed->ttl() === $v ? '" selected="selected' : '') . '">' . $t . '</option>';
  238. if ($this->feed->ttl() == $v) {
  239. $found = true;
  240. }
  241. }
  242. if (!$found) {
  243. echo '<option value="' . intval($this->feed->ttl()) . '" selected="selected">' . intval($this->feed->ttl()) . 's</option>';
  244. }
  245. ?></select>
  246. <label for="mute">
  247. <input type="checkbox" name="mute" id="mute" value="1"<?= $this->feed->mute() ? ' checked="checked"' : '' ?> />
  248. <?= _t('sub.feed.mute') ?>
  249. </label>
  250. </div>
  251. </div>
  252. <?php if ($this->feed->pubSubHubbubEnabled()) { ?>
  253. <div class="form-group">
  254. <div class="group-controls">
  255. <label class="checkbox" for="pubsubhubbub">
  256. <input type="checkbox" name="pubsubhubbub" id="pubsubhubbub" disabled="disabled" value="1" checked="checked" />
  257. <?= _t('sub.feed.websub') ?>
  258. </label>
  259. </div>
  260. </div>
  261. <?php } ?>
  262. <div class="form-group form-actions">
  263. <div class="group-controls">
  264. <button type="submit" class="btn btn-important"><?= _t('gen.action.submit') ?></button>
  265. <button type="reset" class="btn"><?= _t('gen.action.cancel') ?></button>
  266. <?php
  267. if ($from === '') {
  268. $url = _url('feed', 'delete', 'id', $this->feed->id());
  269. } else {
  270. $url = _url('feed', 'delete', 'id', $this->feed->id(), 'from', $from);
  271. }
  272. ?>
  273. <button type="submit" class="btn btn-attention confirm"
  274. data-str-confirm="<?= _t('gen.js.confirm_action_feed_cat') ?>"
  275. formaction="<?= $url ?>"
  276. formmethod="post"><?= _t('gen.action.remove') ?></button>
  277. </div>
  278. </div>
  279. </fieldset>
  280. <fieldset>
  281. <legend><?= _t('sub.feed.auth.configuration') ?></legend>
  282. <?php $auth = $this->feed->httpAuth(false); ?>
  283. <div class="form-group">
  284. <label class="group-name" for="http_user_feed<?= $this->feed->id() ?>"><?= _t('sub.feed.auth.username') ?></label>
  285. <div class="group-controls">
  286. <input type="text" name="http_user_feed<?= $this->feed->id() ?>" id="http_user_feed<?= $this->feed->id() ?>" class="w50" value="<?=
  287. empty($auth['username']) ? '' : $auth['username'] ?>" autocomplete="off" />
  288. <p class="help"><?= _i('help') ?> <?= _t('sub.feed.auth.help') ?></p>
  289. </div>
  290. </div>
  291. <div class="form-group">
  292. <label class="group-name" for="http_pass_feed<?= $this->feed->id() ?>"><?= _t('sub.feed.auth.password') ?></label>
  293. <div class="group-controls">
  294. <div class="stick w50">
  295. <input type="password" name="http_pass_feed<?= $this->feed->id() ?>" id="http_pass_feed<?= $this->feed->id() ?>" value="<?=
  296. $auth['password'] ?>" autocomplete="new-password" />
  297. <button type="button" class="btn toggle-password"><?= _i('key') ?></button>
  298. </div>
  299. </div>
  300. </div>
  301. <div class="form-group form-actions">
  302. <div class="group-controls">
  303. <button type="submit" class="btn btn-important"><?= _t('gen.action.submit') ?></button>
  304. <button type="reset" class="btn"><?= _t('gen.action.cancel') ?></button>
  305. </div>
  306. </div>
  307. </fieldset>
  308. <fieldset>
  309. <legend><?= _t('sub.feed.filteractions') ?></legend>
  310. <div class="form-group">
  311. <label class="group-name" for="mark_updated_article_unread"><?= _t('conf.reading.mark_updated_article_unread') ?></label>
  312. <div class="group-controls">
  313. <select name="mark_updated_article_unread" id="mark_updated_article_unread" class="w50">
  314. <option value=""<?= $this->feed->attributeBoolean('mark_updated_article_unread') === null ? ' selected="selected"' : '' ?>><?= _t('gen.short.by_default') ?></option>
  315. <option value="0"<?= $this->feed->attributeBoolean('mark_updated_article_unread') === false ? ' selected="selected"' : '' ?>><?= _t('gen.short.no') ?></option>
  316. <option value="1"<?= $this->feed->attributeBoolean('mark_updated_article_unread') === true ? ' selected="selected"' : '' ?>><?= _t('gen.short.yes') ?></option>
  317. </select>
  318. </div>
  319. </div>
  320. <div class="form-group">
  321. <label class="group-name" for="read_when_same_title_in_feed"><?= _t('conf.reading.read.when') ?></label>
  322. <div class="group-controls">
  323. <select name="read_when_same_title_in_feed" id="read_when_same_title_in_feed" class="w50">
  324. <option value=""<?= $this->feed->hasAttribute('read_when_same_title_in_feed') ? '' : ' selected="selected"' ?>><?= _t('gen.short.by_default') ?></option>
  325. <option value="0"<?= $this->feed->attributeBoolean('read_when_same_title_in_feed') === false ? ' selected="selected"' : '' ?>><?= _t('gen.short.no') ?></option>
  326. <option value="10"<?= $this->feed->attributeInt('read_when_same_title_in_feed') == 10 ? ' selected="selected"' : '' ?>>10</option>
  327. <option value="25"<?= $this->feed->attributeInt('read_when_same_title_in_feed') == 25 ? ' selected="selected"' : '' ?>>25</option>
  328. <option value="100"<?= $this->feed->attributeInt('read_when_same_title_in_feed') == 100 ? ' selected="selected"' : '' ?>>100</option>
  329. <option value="1000"<?= $this->feed->attributeInt('read_when_same_title_in_feed') == 1000 ? ' selected="selected"' : '' ?>>1 000</option>
  330. </select>
  331. <?= _t('conf.reading.read.when_same_title_in_feed') ?>
  332. </div>
  333. </div>
  334. <div class="form-group">
  335. <label class="group-name" for="read_upon_reception"><?= _t('conf.reading.read.when') ?></label>
  336. <div class="group-controls">
  337. <select name="read_upon_reception" id="read_upon_reception" class="w50">
  338. <option value=""<?= $this->feed->attributeBoolean('read_upon_reception') === null ? ' selected="selected"' : '' ?>><?= _t('gen.short.by_default') ?></option>
  339. <option value="0"<?= $this->feed->attributeBoolean('read_upon_reception') === false ? ' selected="selected"' : '' ?>><?= _t('gen.short.no') ?></option>
  340. <option value="1"<?= $this->feed->attributeBoolean('read_upon_reception') === true ? ' selected="selected"' : '' ?>><?= _t('gen.short.yes') ?></option>
  341. </select>
  342. <?= _t('conf.reading.read.upon_reception') ?>
  343. </div>
  344. </div>
  345. <div class="form-group">
  346. <label class="group-name" for="read_upon_gone"><?= _t('conf.reading.read.when') ?></label>
  347. <div class="group-controls">
  348. <select name="read_upon_gone" id="read_upon_gone" class="w50">
  349. <option value=""<?= $this->feed->attributeBoolean('read_upon_gone') === null ? ' selected="selected"' : '' ?>><?= _t('gen.short.by_default') ?></option>
  350. <option value="0"<?= $this->feed->attributeBoolean('read_upon_gone') === false ? ' selected="selected"' : '' ?>><?= _t('gen.short.no') ?></option>
  351. <option value="1"<?= $this->feed->attributeBoolean('read_upon_gone') === true ? ' selected="selected"' : '' ?>><?= _t('gen.short.yes') ?></option>
  352. </select>
  353. <?= _t('conf.reading.read.upon_gone') ?>
  354. </div>
  355. </div>
  356. <div class="form-group">
  357. <label class="group-name" for="filteractions_read"><?= _t('conf.reading.read.when') ?></label>
  358. <div class="group-controls">
  359. <textarea name="filteractions_read" id="filteractions_read" class="w100"
  360. placeholder="<?= _t('gen.short.blank_to_disable') ?>"><?php
  361. foreach ($this->feed->filtersAction('read') as $filterRead) {
  362. echo htmlspecialchars($filterRead->toString(expandUserQueries: false), ENT_NOQUOTES, 'UTF-8'), PHP_EOL;
  363. }
  364. ?></textarea>
  365. <p class="help"><?= _i('help') ?> <?= _t('sub.feed.filteractions.help') ?></p>
  366. <p>
  367. <button class="btn" formaction="<?= _url('subscription', 'viewFilter', 'id', $this->feed->id()); ?>" formtarget="_blank">
  368. <?= _t('sub.feed.filteractions.view_filter') ?>
  369. </button>
  370. </p>
  371. </div>
  372. </div>
  373. <div class="form-group">
  374. <label class="group-name" for="keep_max_n_unread"><?= _t('conf.reading.read.keep_max_n_unread') ?></label>
  375. <div class="group-controls">
  376. <input type="number" name="keep_max_n_unread" id="keep_max_n_unread" class="w50" min="1" max="10000000"
  377. value="<?= $this->feed->attributeInt('keep_max_n_unread') ?>"
  378. placeholder="<?= _t('gen.short.by_default') ?>" />
  379. </div>
  380. </div>
  381. <div class="form-group form-actions">
  382. <div class="group-controls">
  383. <button type="submit" class="btn btn-important"><?= _t('gen.action.submit') ?></button>
  384. <button type="reset" class="btn"><?= _t('gen.action.cancel') ?></button>
  385. </div>
  386. </div>
  387. </fieldset>
  388. <fieldset>
  389. <legend><?= _t('sub.feed.archiving') ?></legend>
  390. <div class="form-group">
  391. <div class="group-controls">
  392. <?= _t('sub.feed.number_entries', $nbEntries) ?>
  393. <a class="btn" href="<?= _url('feed', 'actualize', 'id', $this->feed->id(), '#', 'slider') ?>">
  394. <?= _i('refresh') ?> <?= _t('gen.action.actualize') ?>
  395. </a>
  396. </div>
  397. </div>
  398. <?php
  399. $archiving = $this->feed->attributeArray('archiving');
  400. /** @var array{default?:bool,keep_period?:string,keep_max?:int,keep_min?:int,keep_favourites?:bool,keep_labels?:bool,keep_unreads?:bool}|null $archiving */
  401. if (empty($archiving)) {
  402. $archiving = [ 'default' => true ];
  403. } else {
  404. $archiving['default'] = false;
  405. }
  406. $volatile = [
  407. 'enable_keep_period' => false,
  408. 'keep_period_count' => '3',
  409. 'keep_period_unit' => 'P1M',
  410. ];
  411. if (!empty($archiving['keep_period']) && is_string($archiving['keep_period'])) {
  412. if (preg_match('/^PT?(?P<count>\d+)[YMWDH]$/', $archiving['keep_period'], $matches)) {
  413. $volatile['enable_keep_period'] = true;
  414. $volatile['keep_period_count'] = $matches['count'];
  415. $volatile['keep_period_unit'] = str_replace($matches['count'], '1', $archiving['keep_period']);
  416. }
  417. }
  418. //Defaults
  419. if (!isset($archiving['keep_max']) || !is_int($archiving['keep_max'])) {
  420. $archiving['keep_max'] = 0;
  421. }
  422. if (!isset($archiving['keep_min']) || !is_int($archiving['keep_min'])) {
  423. $archiving['keep_min'] = 50;
  424. }
  425. if (!isset($archiving['keep_favourites']) || !is_bool($archiving['keep_favourites'])) {
  426. $archiving['keep_favourites'] = true;
  427. }
  428. if (!isset($archiving['keep_labels']) || !is_bool($archiving['keep_labels'])) {
  429. $archiving['keep_labels'] = true;
  430. }
  431. if (!isset($archiving['keep_unreads']) || !is_bool($archiving['keep_unreads'])) {
  432. $archiving['keep_unreads'] = false;
  433. }
  434. ?>
  435. <p class="alert alert-warn">
  436. <?= _t('conf.archiving.policy_warning') ?>
  437. </p>
  438. <div class="form-group">
  439. <div class="group-name"><?= _t('conf.archiving.policy') ?></div>
  440. <div class="group-controls">
  441. <label class="checkbox">
  442. <input type="checkbox" name="use_default_purge_options" id="use_default_purge_options" value="1"<?= $archiving['default'] ? ' checked="checked"' : '' ?> />
  443. <?= _t('gen.short.by_default') ?>
  444. </label>
  445. </div>
  446. </div>
  447. <div class="form-group archiving"<?= $archiving['default'] ? ' hidden="hidden"' : '' ?>>
  448. <div class="group-controls">
  449. <label class="checkbox" for="enable_keep_max">
  450. <input type="checkbox" name="enable_keep_max" id="enable_keep_max" value="1"<?= empty($archiving['keep_max']) ? '' : ' checked="checked"' ?> />
  451. <?= _t('conf.archiving.keep_max') ?>
  452. <input type="number" id="keep_max" name="keep_max" min="0" value="<?= empty($archiving['keep_max']) ? 200 : $archiving['keep_max'] ?>" />
  453. </label>
  454. </div>
  455. </div>
  456. <div class="form-group archiving"<?= $archiving['default'] ? ' hidden="hidden"' : '' ?>>
  457. <div class="group-controls">
  458. <label class="checkbox" for="enable_keep_period">
  459. <input type="checkbox" name="enable_keep_period" id="enable_keep_period" value="1"<?= $volatile['enable_keep_period'] ? ' checked="checked"' : '' ?> />
  460. <?= _t('conf.archiving.keep_period') ?>
  461. <input type="number" id="keep_period_count" name="keep_period_count" min="0" value="<?= $volatile['keep_period_count'] ?>" />
  462. <select class="number" name="keep_period_unit" id="keep_period_unit">
  463. <option></option>
  464. <option value="P1Y" <?= 'P1Y' === $volatile['keep_period_unit'] ? 'selected="selected"' : '' ?>><?= _t('gen.period.years') ?></option>
  465. <option value="P1M" <?= 'P1M' === $volatile['keep_period_unit'] ? 'selected="selected"' : '' ?>><?= _t('gen.period.months') ?></option>
  466. <option value="P1W" <?= 'P1W' === $volatile['keep_period_unit'] ? 'selected="selected"' : '' ?>><?= _t('gen.period.weeks') ?></option>
  467. <option value="P1D" <?= 'P1D' === $volatile['keep_period_unit'] ? 'selected="selected"' : '' ?>><?= _t('gen.period.days') ?></option>
  468. <option value="PT1H" <?= 'PT1H' === $volatile['keep_period_unit'] ? 'selected="selected"' : '' ?>><?= _t('gen.period.hours') ?></option>
  469. </select>
  470. </label>
  471. </div>
  472. </div>
  473. <div class="form-group archiving"<?= $archiving['default'] ? ' hidden="hidden"' : '' ?>>
  474. <div class="group-name"><?= _t('conf.archiving.exception') ?></div>
  475. <div class="group-controls">
  476. <label class="checkbox" for="keep_favourites">
  477. <input type="checkbox" name="keep_favourites" id="keep_favourites" value="1"<?= $archiving['keep_favourites'] ? ' checked="checked"' : '' ?> />
  478. <?= _t('conf.archiving.keep_favourites') ?>
  479. </label>
  480. </div>
  481. </div>
  482. <div class="form-group archiving"<?= $archiving['default'] ? ' hidden="hidden"' : '' ?>>
  483. <div class="group-controls">
  484. <label class="checkbox" for="keep_labels">
  485. <input type="checkbox" name="keep_labels" id="keep_labels" value="1"<?= $archiving['keep_labels'] ? ' checked="checked"' : '' ?> />
  486. <?= _t('conf.archiving.keep_labels') ?>
  487. </label>
  488. </div>
  489. </div>
  490. <div class="form-group archiving"<?= $archiving['default'] ? ' hidden="hidden"' : '' ?>>
  491. <div class="group-controls">
  492. <label class="checkbox" for="keep_unreads">
  493. <input type="checkbox" name="keep_unreads" id="keep_unreads" value="1"<?= $archiving['keep_unreads'] ? ' checked="checked"' : '' ?> />
  494. <?= _t('conf.archiving.keep_unreads') ?>
  495. </label>
  496. </div>
  497. </div>
  498. <div class="form-group archiving"<?= $archiving['default'] ? ' hidden="hidden"' : '' ?>>
  499. <div class="group-controls">
  500. <label for="keep_min"><?= _t('sub.feed.keep_min') ?>
  501. <input type="number" id="keep_min" name="keep_min" min="0" value="<?= $archiving['keep_min'] ?>" />
  502. </label>
  503. </div>
  504. </div>
  505. <div class="form-group form-actions">
  506. <div class="group-controls">
  507. <button type="submit" class="btn btn-important"><?= _t('gen.action.submit') ?></button>
  508. <button type="reset" class="btn"><?= _t('gen.action.cancel') ?></button>
  509. <button type="submit" class="btn btn-attention confirm" formmethod="post" formaction="<?= _url('feed', 'truncate', 'id', $this->feed->id(), '#', 'slider') ?>"><?= _t('gen.action.truncate') ?></button>
  510. </div>
  511. </div>
  512. </fieldset>
  513. <fieldset>
  514. <legend><?= _t('sub.feed.kind') ?></legend>
  515. <div class="form-group">
  516. <label class="group-name" for="feed_kind"><?= _t('sub.feed.kind') ?></label>
  517. <div class="group-controls">
  518. <select name="feed_kind" id="feed_kind" class="select-show w100">
  519. <option value="<?= FreshRSS_Feed::KIND_RSS ?>" <?= $this->feed->kind() === FreshRSS_Feed::KIND_RSS ? 'selected="selected"' : '' ?>><?= _t('sub.feed.kind.rss') ?></option>
  520. <option value="<?= FreshRSS_Feed::KIND_HTML_XPATH ?>" <?= $this->feed->kind() === FreshRSS_Feed::KIND_HTML_XPATH ? 'selected="selected"' : '' ?> data-show="html_xpath"><?= _t('sub.feed.kind.html_xpath') ?></option>
  521. <option value="<?= FreshRSS_Feed::KIND_XML_XPATH ?>" <?= $this->feed->kind() === FreshRSS_Feed::KIND_XML_XPATH ? 'selected="selected"' : '' ?> data-show="html_xpath"><?= _t('sub.feed.kind.xml_xpath') ?></option>
  522. <option value="<?= FreshRSS_Feed::KIND_JSONFEED ?>" <?= $this->feed->kind() === FreshRSS_Feed::KIND_JSONFEED ? 'selected="selected"' : '' ?>><?= _t('sub.feed.kind.jsonfeed') ?></option>
  523. <option value="<?= FreshRSS_Feed::KIND_JSON_DOTNOTATION ?>" <?= $this->feed->kind() === FreshRSS_Feed::KIND_JSON_DOTNOTATION ? 'selected="selected"' : '' ?>
  524. data-show="json_dotnotation"><?= _t('sub.feed.kind.json_dotnotation') ?></option>
  525. <option value="<?= FreshRSS_Feed::KIND_HTML_XPATH_JSON_DOTNOTATION ?>" <?= $this->feed->kind() === FreshRSS_Feed::KIND_HTML_XPATH_JSON_DOTNOTATION ? 'selected="selected"' : '' ?>
  526. data-show="json_dotnotation xPathToJsonGroup"><?= _t('sub.feed.kind.html_json') ?></option>
  527. </select>
  528. </div>
  529. </div>
  530. </fieldset>
  531. <fieldset id="html_xpath">
  532. <?php
  533. /** @var array<string> $xpath */
  534. $xpath = Minz_Helper::htmlspecialchars_utf8($this->feed->attributeArray('xpath') ?? []);
  535. ?>
  536. <p class="help"><?= _i('help') ?> <?= _t('sub.feed.kind.html_xpath.help') ?></p>
  537. <div class="form-group">
  538. <label class="group-name" for="xPathItem"><small><?= _t('sub.feed.kind.html_xpath.xpath') ?></small><br />
  539. <?= _t('sub.feed.kind.html_xpath.item') ?></label>
  540. <div class="group-controls">
  541. <textarea class="valid-xpath w100" name="xPathItem" id="xPathItem" rows="2" cols="64" spellcheck="false"><?= $xpath['item'] ?? '' ?></textarea>
  542. <p class="help"><?= _i('help') ?> <?= _t('sub.feed.kind.html_xpath.item.help') ?></p>
  543. </div>
  544. </div>
  545. <div class="form-group">
  546. <label class="group-name" for="xPathItemTitle"><small><?= _t('sub.feed.kind.html_xpath.relative') ?></small><br />
  547. <?= _t('sub.feed.kind.html_xpath.item_title') ?></label>
  548. <div class="group-controls">
  549. <textarea class="valid-xpath w100" name="xPathItemTitle" id="xPathItemTitle" rows="2" cols="64" spellcheck="false"><?= $xpath['itemTitle'] ?? '' ?></textarea>
  550. <p class="help"><?= _i('help') ?> <?= _t('sub.feed.kind.html_xpath.item_title.help') ?></p>
  551. </div>
  552. </div>
  553. <div class="form-group">
  554. <label class="group-name" for="xPathItemContent"><small><?= _t('sub.feed.kind.html_xpath.relative') ?></small><br />
  555. <?= _t('sub.feed.kind.html_xpath.item_content') ?></label>
  556. <div class="group-controls">
  557. <textarea class="valid-xpath w100" name="xPathItemContent" id="xPathItemContent" rows="2" cols="64" spellcheck="false"><?= $xpath['itemContent'] ?? '' ?></textarea>
  558. <p class="help"><?= _i('help') ?> <?= _t('sub.feed.kind.html_xpath.item_content.help') ?></p>
  559. </div>
  560. </div>
  561. <div class="form-group">
  562. <label class="group-name" for="xPathItemUri"><small><?= _t('sub.feed.kind.html_xpath.relative') ?></small><br />
  563. <?= _t('sub.feed.kind.html_xpath.item_uri') ?></label>
  564. <div class="group-controls">
  565. <textarea class="valid-xpath w100" name="xPathItemUri" id="xPathItemUri" rows="2" cols="64" spellcheck="false"><?= $xpath['itemUri'] ?? '' ?></textarea>
  566. <p class="help"><?= _i('help') ?> <?= _t('sub.feed.kind.html_xpath.item_uri.help') ?></p>
  567. </div>
  568. </div>
  569. <div class="form-group">
  570. <label class="group-name" for="xPathItemThumbnail"><small><?= _t('sub.feed.kind.html_xpath.relative') ?></small><br />
  571. <?= _t('sub.feed.kind.html_xpath.item_thumbnail') ?></label>
  572. <div class="group-controls">
  573. <textarea class="valid-xpath w100" name="xPathItemThumbnail" id="xPathItemThumbnail" rows="2" cols="64" spellcheck="false"><?= $xpath['itemThumbnail'] ?? '' ?></textarea>
  574. <p class="help"><?= _i('help') ?> <?= _t('sub.feed.kind.html_xpath.item_thumbnail.help') ?></p>
  575. </div>
  576. </div>
  577. <div class="form-group">
  578. <label class="group-name" for="xPathItemAuthor"><small><?= _t('sub.feed.kind.html_xpath.relative') ?></small><br />
  579. <?= _t('sub.feed.kind.html_xpath.item_author') ?></label>
  580. <div class="group-controls">
  581. <textarea class="valid-xpath w100" name="xPathItemAuthor" id="xPathItemAuthor" rows="2" cols="64" spellcheck="false"><?= $xpath['itemAuthor'] ?? '' ?></textarea>
  582. <p class="help"><?= _i('help') ?> <?= _t('sub.feed.kind.html_xpath.item_author.help') ?></p>
  583. </div>
  584. </div>
  585. <div class="form-group">
  586. <label class="group-name" for="xPathItemTimestamp"><small><?= _t('sub.feed.kind.html_xpath.relative') ?></small><br />
  587. <?= _t('sub.feed.kind.html_xpath.item_timestamp') ?></label>
  588. <div class="group-controls">
  589. <textarea class="valid-xpath w100" name="xPathItemTimestamp" id="xPathItemTimestamp" rows="2" cols="64" spellcheck="false"><?= $xpath['itemTimestamp'] ?? '' ?></textarea>
  590. <p class="help"><?= _i('help') ?> <?= _t('sub.feed.kind.html_xpath.item_timestamp.help') ?></p>
  591. </div>
  592. </div>
  593. <div class="form-group">
  594. <label class="group-name" for="xPathItemTimeFormat">
  595. <?= _t('sub.feed.kind.html_xpath.item_timeFormat') ?></label>
  596. <div class="group-controls">
  597. <textarea class="w100" name="xPathItemTimeFormat" id="xPathItemTimeFormat" rows="2" cols="64" spellcheck="false"><?= $xpath['itemTimeFormat'] ?? '' ?></textarea>
  598. <p class="help"><?= _i('help') ?> <?= _t('sub.feed.kind.html_xpath.item_timeFormat.help') ?></p>
  599. </div>
  600. </div>
  601. <div class="form-group">
  602. <label class="group-name" for="xPathItemCategories"><small><?= _t('sub.feed.kind.html_xpath.relative') ?></small><br />
  603. <?= _t('sub.feed.kind.html_xpath.item_categories') ?></label>
  604. <div class="group-controls">
  605. <textarea class="valid-xpath w100" name="xPathItemCategories" id="xPathItemCategories" rows="2" cols="64" spellcheck="false"><?= $xpath['itemCategories'] ?? '' ?></textarea>
  606. </div>
  607. </div>
  608. <div class="form-group">
  609. <label class="group-name" for="xPathItemUid"><small><?= _t('sub.feed.kind.html_xpath.relative') ?></small><br />
  610. <?= _t('sub.feed.kind.html_xpath.item_uid') ?></label>
  611. <div class="group-controls">
  612. <textarea class="valid-xpath w100" name="xPathItemUid" id="xPathItemUid" rows="2" cols="64" spellcheck="false"><?= $xpath['itemUid'] ?? '' ?></textarea>
  613. </div>
  614. </div>
  615. </fieldset>
  616. <fieldset id="json_dotnotation">
  617. <?php
  618. /** @var array<string,string> $jsonSettings */
  619. $jsonSettings = Minz_Helper::htmlspecialchars_utf8($this->feed->attributeArray('json_dotnotation') ?? []);
  620. $xPathToJson = Minz_Helper::htmlspecialchars_utf8($this->feed->attributeString('xPathToJson'));
  621. ?>
  622. <div class="form-group" id="xPathToJsonGroup">
  623. <label class="group-name" for="xPathToJson"><?= _t('sub.feed.kind.html_json.xpath') ?></label>
  624. <div class="group-controls">
  625. <textarea class="valid-xpath w100" name="xPathToJson" id="xPathToJson" rows="2" cols="64" spellcheck="false"><?= $xPathToJson ?? '' ?></textarea>
  626. <p class="help"><?= _i('help') ?> <?= _t('sub.feed.kind.html_json.xpath.help') ?></p>
  627. </div>
  628. </div>
  629. <p class="help"><?= _i('help') ?> <?= _t('sub.feed.kind.json_dotnotation.help') ?></p>
  630. <div class="form-group">
  631. <label class="group-name" for="jsonItem"><small><?= _t('sub.feed.kind.json_dotnotation.json') ?></small><br />
  632. <?= _t('sub.feed.kind.json_dotnotation.item') ?></label>
  633. <div class="group-controls">
  634. <textarea class="valid-json w100" name="jsonItem" id="jsonItem" rows="2" cols="64" spellcheck="false"><?= $jsonSettings['item'] ?? '' ?></textarea>
  635. <p class="help"><?= _i('help') ?> <?= _t('sub.feed.kind.json_dotnotation.item.help') ?></p>
  636. </div>
  637. </div>
  638. <div class="form-group">
  639. <label class="group-name" for="jsonItemTitle"><small><?= _t('sub.feed.kind.json_dotnotation.relative') ?></small><br />
  640. <?= _t('sub.feed.kind.json_dotnotation.item_title') ?></label>
  641. <div class="group-controls">
  642. <textarea class="valid-json w100" name="jsonItemTitle" id="jsonItemTitle" rows="2" cols="64" spellcheck="false"><?= $jsonSettings['itemTitle'] ?? '' ?></textarea>
  643. </div>
  644. </div>
  645. <div class="form-group">
  646. <label class="group-name" for="jsonItemContent"><small><?= _t('sub.feed.kind.json_dotnotation.relative') ?></small><br />
  647. <?= _t('sub.feed.kind.json_dotnotation.item_content') ?></label>
  648. <div class="group-controls">
  649. <textarea class="valid-json w100" name="jsonItemContent" id="jsonItemContent" rows="2" cols="64" spellcheck="false"><?= $jsonSettings['itemContent'] ?? '' ?></textarea>
  650. <p class="help"><?= _i('help') ?> <?= _t('sub.feed.kind.json_dotnotation.item_content.help') ?></p>
  651. </div>
  652. </div>
  653. <div class="form-group">
  654. <label class="group-name" for="jsonItemUri"><small><?= _t('sub.feed.kind.json_dotnotation.relative') ?></small><br />
  655. <?= _t('sub.feed.kind.json_dotnotation.item_uri') ?></label>
  656. <div class="group-controls">
  657. <textarea class="valid-json w100" name="jsonItemUri" id="jsonItemUri" rows="2" cols="64" spellcheck="false"><?= $jsonSettings['itemUri'] ?? '' ?></textarea>
  658. <p class="help"><?= _i('help') ?> <?= _t('sub.feed.kind.json_dotnotation.item_uri.help') ?></p>
  659. </div>
  660. </div>
  661. <div class="form-group">
  662. <label class="group-name" for="jsonItemThumbnail"><small><?= _t('sub.feed.kind.json_dotnotation.relative') ?></small><br />
  663. <?= _t('sub.feed.kind.json_dotnotation.item_thumbnail') ?></label>
  664. <div class="group-controls">
  665. <textarea class="valid-json w100" name="jsonItemThumbnail" id="jsonItemThumbnail" rows="2" cols="64" spellcheck="false"><?= $jsonSettings['itemThumbnail'] ?? '' ?></textarea>
  666. <p class="help"><?= _i('help') ?> <?= _t('sub.feed.kind.json_dotnotation.item_thumbnail.help') ?></p>
  667. </div>
  668. </div>
  669. <div class="form-group">
  670. <label class="group-name" for="jsonItemAuthor"><small><?= _t('sub.feed.kind.json_dotnotation.relative') ?></small><br />
  671. <?= _t('sub.feed.kind.json_dotnotation.item_author') ?></label>
  672. <div class="group-controls">
  673. <textarea class="valid-json w100" name="jsonItemAuthor" id="jsonItemAuthor" rows="2" cols="64" spellcheck="false"><?= $jsonSettings['itemAuthor'] ?? '' ?></textarea>
  674. </div>
  675. </div>
  676. <div class="form-group">
  677. <label class="group-name" for="jsonItemTimestamp"><small><?= _t('sub.feed.kind.json_dotnotation.relative') ?></small><br />
  678. <?= _t('sub.feed.kind.json_dotnotation.item_timestamp') ?></label>
  679. <div class="group-controls">
  680. <textarea class="valid-json w100" name="jsonItemTimestamp" id="jsonItemTimestamp" rows="2" cols="64" spellcheck="false"><?= $jsonSettings['itemTimestamp'] ?? '' ?></textarea>
  681. <p class="help"><?= _i('help') ?> <?= _t('sub.feed.kind.json_dotnotation.item_timestamp.help') ?></p>
  682. </div>
  683. </div>
  684. <div class="form-group">
  685. <label class="group-name" for="jsonItemTimeFormat">
  686. <?= _t('sub.feed.kind.json_dotnotation.item_timeFormat') ?></label>
  687. <div class="group-controls">
  688. <textarea class="w100" name="jsonItemTimeFormat" id="jsonItemTimeFormat" rows="2" cols="64" spellcheck="false"><?= $jsonSettings['itemTimeFormat'] ?? '' ?></textarea>
  689. <p class="help"><?= _i('help') ?> <?= _t('sub.feed.kind.json_dotnotation.item_timeFormat.help') ?></p>
  690. </div>
  691. </div>
  692. <div class="form-group">
  693. <label class="group-name" for="jsonItemCategories"><small><?= _t('sub.feed.kind.json_dotnotation.relative') ?></small><br />
  694. <?= _t('sub.feed.kind.json_dotnotation.item_categories') ?></label>
  695. <div class="group-controls">
  696. <textarea class="valid-json w100" name="jsonItemCategories" id="jsonItemCategories" rows="2" cols="64" spellcheck="false"><?= $jsonSettings['itemCategories'] ?? '' ?></textarea>
  697. </div>
  698. </div>
  699. <div class="form-group">
  700. <label class="group-name" for="jsonItemUid"><small><?= _t('sub.feed.kind.json_dotnotation.relative') ?></small><br />
  701. <?= _t('sub.feed.kind.json_dotnotation.item_uid') ?></label>
  702. <div class="group-controls">
  703. <textarea class="valid-json w100" name="jsonItemUid" id="jsonItemUid" rows="2" cols="64" spellcheck="false"><?= $jsonSettings['itemUid'] ?? '' ?></textarea>
  704. </div>
  705. </div>
  706. <div class="form-group form-actions">
  707. <div class="group-controls">
  708. <button class="btn btn-important"><?= _t('gen.action.submit') ?></button>
  709. <button type="reset" class="btn"><?= _t('gen.action.cancel') ?></button>
  710. </div>
  711. </div>
  712. </fieldset>
  713. <fieldset>
  714. <legend><?= _t('sub.feed.content_retrieval') ?></legend>
  715. <div class="form-group">
  716. <label class="group-name" for="path_entries"><?= _t('sub.feed.css_path') ?></label>
  717. <div class="group-controls">
  718. <div class="stick w100">
  719. <input type="text" name="path_entries" id="path_entries" class="w100" value="<?= $this->feed->pathEntries() ?>" placeholder="<?= _t('gen.short.blank_to_disable') ?>" />
  720. <a id="popup-preview-selector" class="btn" href="<?=
  721. _url('feed', 'contentSelectorPreview', 'id', $this->feed->id(), 'selector', 'selector-token', 'selector_filter', 'selector-filter-token', '#', 'slider') ?>"><?= _i('look') ?></a>
  722. </div>
  723. <p class="help"><?= _i('help') ?> <?= _t('sub.feed.css_help') ?></p>
  724. </div>
  725. </div>
  726. <div class="form-group">
  727. <label class="group-name" for="path_entries_conditions"><?= _t('sub.feed.path_entries_conditions') ?></label>
  728. <div class="group-controls">
  729. <textarea class="w100" id="path_entries_conditions" name="path_entries_conditions"
  730. rows="3" cols="64" spellcheck="false" placeholder="<?= _t('gen.short.blank_to_disable') ?>"><?php
  731. foreach ($this->feed->attributeArray('path_entries_conditions') ?? [] as $condition) {
  732. if (is_string($condition)) {
  733. echo htmlspecialchars($condition, ENT_NOQUOTES, 'UTF-8'), PHP_EOL;
  734. }
  735. }
  736. ?></textarea>
  737. <p class="help"><?= _i('help') ?> <?= _t('sub.feed.filteractions.help') ?></p>
  738. </div>
  739. </div>
  740. </fieldset>
  741. <fieldset>
  742. <legend><?= _t('sub.feed.advanced') ?></legend>
  743. <div class="form-group">
  744. <?php
  745. $path_entries_filter = Minz_Helper::htmlspecialchars_utf8($this->feed->attributeString('path_entries_filter') ?? '');
  746. ?>
  747. <label class="group-name" for="path_entries_filter"><?= _t('sub.feed.css_path_filter') ?></label>
  748. <div class="group-controls">
  749. <div class="w100">
  750. <input type="text" name="path_entries_filter" id="path_entries_filter" class="w100" value="<?= $path_entries_filter ?>" placeholder="<?= _t('gen.short.blank_to_disable') ?>" />
  751. </div>
  752. <p class="help"><?= _i('help') ?> <?= _t('sub.feed.css_path_filter.help') ?></p>
  753. </div>
  754. </div>
  755. <div class="form-group">
  756. <?php
  757. /** @var array<int,int|string> $curlParams */
  758. $curlParams = $this->feed->attributeArray('curl_params') ?? [];
  759. ?>
  760. <label class="group-name" for="curl_params_cookie"><?= _t('sub.feed.css_cookie') ?></label>
  761. <div class="group-controls">
  762. <input type="text" name="curl_params_cookie" id="curl_params_cookie" class="w100" value="<?=
  763. htmlspecialchars((string)($curlParams[CURLOPT_COOKIE] ?? ''), ENT_COMPAT, 'UTF-8')
  764. ?>" placeholder="<?= _t('gen.short.blank_to_disable') ?>" />
  765. <p class="help"><?= _i('help') ?> <?= _t('sub.feed.css_cookie_help') ?></p>
  766. <label for="curl_params_cookiefile">
  767. <input type="checkbox" name="curl_params_cookiefile" id="curl_params_cookiefile" value="1"<?=
  768. isset($curlParams[CURLOPT_COOKIEFILE]) ? ' checked="checked"' : ''
  769. ?> />
  770. <?= _t('sub.feed.accept_cookies') ?>
  771. </label>
  772. <p class="help"><?= _i('help') ?> <?= _t('sub.feed.accept_cookies_help') ?></p>
  773. </div>
  774. </div>
  775. <div class="form-group">
  776. <label class="group-name" for="curl_params_redirects"><?= _t('sub.feed.max_http_redir') ?></label>
  777. <div class="group-controls">
  778. <input type="number" name="curl_params_redirects" id="curl_params_redirects" class="w50" min="-1" value="<?=
  779. !empty($curlParams[CURLOPT_MAXREDIRS]) ? $curlParams[CURLOPT_MAXREDIRS] : ''
  780. ?>" placeholder="<?= _t('gen.short.blank_to_disable') ?>" />
  781. <p class="help"><?= _i('help') ?> <?= _t('sub.feed.max_http_redir_help') ?></p>
  782. </div>
  783. </div>
  784. <div class="form-group">
  785. <label class="group-name" for="content_action"><?= _t('sub.feed.content_action') ?></label>
  786. <div class="group-controls">
  787. <select name="content_action" id="content_action" class="w50">
  788. <option value="replace"<?= 'replace' === $this->feed->attributeString('content_action') ? ' selected="selected"' : '' ?>><?= _t('sub.feed.content_action.replace') ?></option>
  789. <option value="prepend"<?= 'prepend' === $this->feed->attributeString('content_action') ? ' selected="selected"' : '' ?>><?= _t('sub.feed.content_action.prepend') ?></option>
  790. <option value="append"<?= 'append' === $this->feed->attributeString('content_action') ? ' selected="selected"' : '' ?>><?= _t('sub.feed.content_action.append') ?></option>
  791. </select>
  792. </div>
  793. </div>
  794. <div class="form-group">
  795. <label class="group-name" for="curl_params_useragent"><?= _t('sub.feed.useragent') ?></label>
  796. <div class="group-controls">
  797. <input type="text" name="curl_params_useragent" id="curl_params_useragent" class="w100" value="<?=
  798. htmlspecialchars((string)($curlParams[CURLOPT_USERAGENT] ?? ''), ENT_COMPAT, 'UTF-8')
  799. ?>" placeholder="<?= _t('gen.short.by_default') ?>" />
  800. <p class="help"><?= _i('help') ?> <?= _t('sub.feed.useragent_help') ?></p>
  801. </div>
  802. </div>
  803. <div class="form-group">
  804. <label class="group-name" for="proxy_type"><?= _t('sub.feed.proxy') ?></label>
  805. <div class="group-controls">
  806. <select name="proxy_type" id="proxy_type"><?php
  807. defined('CURLPROXY_HTTPS') or define('CURLPROXY_HTTPS', 2); // Compatibility cURL 7.51
  808. $type = $curlParams[CURLOPT_PROXYTYPE] ?? '';
  809. if ($type === 3) { // Legacy for NONE
  810. $type = -1;
  811. }
  812. foreach (['' => '', -1 => 'NONE', CURLPROXY_HTTP => 'HTTP', CURLPROXY_HTTPS => 'HTTPS',
  813. CURLPROXY_SOCKS4 => 'SOCKS4', CURLPROXY_SOCKS4A => 'SOCKS4A', CURLPROXY_SOCKS5 => 'SOCKS5',
  814. CURLPROXY_SOCKS5_HOSTNAME => 'SOCKS5H'] as $k => $v) {
  815. echo '<option value="' . $k . ($type === $k ? '" selected="selected' : '' ) . '">' . $v . '</option>';
  816. }
  817. ?>
  818. </select>
  819. <input type="text" name="curl_params" id="curl_params" value="<?=
  820. htmlspecialchars((string)($curlParams[CURLOPT_PROXY] ?? ''), ENT_COMPAT, 'UTF-8')
  821. ?>" placeholder="<?= _t('gen.short.by_default') ?>" />
  822. <p class="help"><?= _i('help') ?> <?= _t('sub.feed.proxy_help') ?></p>
  823. </div>
  824. </div>
  825. <div class="form-group">
  826. <label class="group-name" for="curl_method"><?= _t('sub.feed.method') ?></label>
  827. <div class="group-controls">
  828. <select class="number" name="curl_method" id="curl_method"><?php
  829. $curl_method = 'GET';
  830. if ($this->feed->attributeArray('curl_params') !== null && !empty($this->feed->attributeArray('curl_params')[CURLOPT_POST])) {
  831. $curl_method = 'POST';
  832. }
  833. foreach (['GET' => 'GET', 'POST' => 'POST'] as $k => $v) {
  834. echo '<option value="' . $k . ($curl_method === $k ? '" selected="selected' : '') . '">' . $v . '</option>';
  835. }
  836. ?>
  837. </select>
  838. <div class="stick">
  839. <?php
  840. $postFields = $this->feed->attributeArray('curl_params')[CURLOPT_POSTFIELDS] ?? '';
  841. if (!is_string($postFields)) {
  842. $postFields = '';
  843. }
  844. ?>
  845. <input type="text" name="curl_fields" id="curl_fields" value="<?=
  846. htmlspecialchars($postFields, ENT_COMPAT, 'UTF-8')
  847. ?>" placeholder="<?= _t('sub.feed.method_postparams') ?>" />
  848. </div>
  849. <p class="help"><?= _i('help') ?> <?= _t('sub.feed.method_help') ?></p>
  850. </div>
  851. </div>
  852. <div class="form-group">
  853. <label class="group-name" for="timeout"><?= _t('sub.feed.timeout') ?></label>
  854. <div class="group-controls">
  855. <input type="number" name="timeout" id="timeout" class="w50" min="3" max="900" value="<?= $this->feed->attributeInt('timeout') ?>" placeholder="<?= _t('gen.short.by_default') ?>" />
  856. </div>
  857. </div>
  858. <div class="form-group">
  859. <label class="group-name" for="ssl_verify"><?= _t('sub.feed.ssl_verify') ?></label>
  860. <div class="group-controls">
  861. <select name="ssl_verify" id="ssl_verify" class="w50">
  862. <option value=""<?= $this->feed->attributeBoolean('ssl_verify') === null ? ' selected="selected"' : '' ?>><?= _t('gen.short.by_default') ?></option>
  863. <option value="0"<?= $this->feed->attributeBoolean('ssl_verify') === false ? ' selected="selected"' : '' ?>><?= _t('gen.short.no') ?></option>
  864. <option value="1"<?= $this->feed->attributeBoolean('ssl_verify') === true ? ' selected="selected"' : '' ?>><?= _t('gen.short.yes') ?></option>
  865. </select>
  866. </div>
  867. </div>
  868. <div class="form-group">
  869. <label class="group-name" for="http_headers"><?= _t('sub.feed.http_headers') ?></label>
  870. <div class="group-controls">
  871. <?php
  872. $httpHeaders = $this->feed->attributeArray('curl_params')[CURLOPT_HTTPHEADER] ?? [];
  873. if (!is_array($httpHeaders)) {
  874. $httpHeaders = [];
  875. }
  876. $httpHeaders = array_filter($httpHeaders, 'is_string');
  877. // Remove headers problematic for security
  878. $httpHeaders = array_filter($httpHeaders,
  879. fn(string $header) => !preg_match('/^(Remote-User|X-WebAuth-User)\\s*:/i', $header));
  880. ?>
  881. <textarea class="w100" id="http_headers" name="http_headers" rows="3" spellcheck="false"><?php
  882. foreach ($httpHeaders as $header) {
  883. echo htmlspecialchars($header, ENT_NOQUOTES, 'UTF-8'), PHP_EOL;
  884. }
  885. ?></textarea>
  886. <p class="help"><?= _i('help') ?> <?= _t('sub.feed.http_headers_help') ?></p>
  887. </div>
  888. </div>
  889. <div class="form-group">
  890. <div class="group-controls">
  891. <label class="checkbox" for="clear_cache">
  892. <input type="checkbox" name="clear_cache" id="clear_cache" value="1"<?= $this->feed->attributeBoolean('clear_cache') ? ' checked="checked"' : '' ?> />
  893. <?= _t('sub.feed.clear_cache') ?>
  894. </label>
  895. </div>
  896. </div>
  897. <div class="form-group form-actions">
  898. <div class="group-controls">
  899. <button type="submit" class="btn btn-important"><?= _t('gen.action.submit') ?></button>
  900. <button type="reset" class="btn"><?= _t('gen.action.cancel') ?></button>
  901. </div>
  902. </div>
  903. </fieldset>
  904. </form>
  905. <h2><?= _t('sub.feed.maintenance.title') ?></h2>
  906. <div class="form-group">
  907. <div class="group-controls">
  908. <button class="btn btn-important" form="post-csrf" formaction="<?= _url('feed', 'clearCache', 'id', $this->feed->id(), '#', 'slider') ?>">
  909. <?= _t('sub.feed.maintenance.clear_cache') ?>
  910. </button>
  911. <p class="help"><?= _i('help') ?> <?= _t('sub.feed.maintenance.clear_cache_help') ?></p>
  912. </div>
  913. <div class="group-controls">
  914. <form method="post" action="<?= _url('feed', 'reload', '#', 'slider') ?>">
  915. <input type="hidden" name="_csrf" value="<?= FreshRSS_Auth::csrfToken() ?>" />
  916. <input type="hidden" name="id" value="<?= $this->feed->id() ?>" />
  917. <button type="submit" class="btn btn-important">
  918. <?= _t('sub.feed.maintenance.reload_articles') ?>
  919. </button>
  920. <input type="number" name="reload_limit" min="1" value="10" />
  921. <p class="help"><?= _i('help') ?> <?= _t('sub.feed.maintenance.reload_articles_help') ?></p>
  922. </form>
  923. </div>
  924. </div>
  925. <h2><?= _t('sub.import_export.export') ?></h2>
  926. <div class="form-group">
  927. <div class="group-name"><?= _t('sub.feed.export-as-opml.label') ?></div>
  928. <div class="group-controls">
  929. <a class="btn btn-important" href="<?= _url('index', 'opml', 'get', 'f_' . $this->feed->id()) ?>" download="f_<?= $this->feed->id() ?> <?= $this->feed->name(true) ?>.opml.xml">
  930. <?= _t('sub.feed.export-as-opml.download') ?>
  931. </a>
  932. <p class="help"><?= _i('help') ?> <?= _t('sub.feed.export-as-opml.help') ?></p>
  933. </div>
  934. </div>
  935. </div>
  936. <div id="popup">
  937. <div id="popup-content">
  938. <div id="popup-close" class="popup-row"><?= _i('close') ?></div>
  939. <div id="popup-iframe-container" class="popup-row">
  940. <div id="popup-iframe-sub">
  941. <iframe id="popup-iframe" frameborder="0"></iframe>
  942. </div>
  943. </div>
  944. </div>
  945. </div>