update.phtml 52 KB

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