update.phtml 54 KB

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