update.phtml 48 KB

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