update.phtml 52 KB

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