update.phtml 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383
  1. <div class="post">
  2. <h1><?= $this->feed->name() ?></h1>
  3. <div>
  4. <a href="<?= _url('index', 'index', 'get', 'f_' . $this->feed->id()) ?>"><?= _i('link') ?> <?= _t('gen.action.filter') ?></a>
  5. <?= _t('gen.short.or') ?>
  6. <a href="<?= _url('stats', 'repartition', 'id', $this->feed->id()) ?>"><?= _i('stats') ?> <?= _t('sub.feed.stats') ?></a>
  7. </div>
  8. <p><?= sanitizeHTML($this->feed->description()) ?></p>
  9. <?php $nbEntries = $this->feed->nbEntries(); ?>
  10. <?php if ($this->feed->inError()) { ?>
  11. <p class="alert alert-error"><span class="alert-head"><?= _t('gen.short.damn') ?></span> <?= _t('sub.feed.error') ?></p>
  12. <?php } elseif ($nbEntries === 0) { ?>
  13. <p class="alert alert-warn"><?= _t('sub.feed.empty') ?></p>
  14. <?php } ?>
  15. <form method="post" action="<?= _url('subscription', 'feed', 'id', $this->feed->id()) ?>" autocomplete="off">
  16. <input type="hidden" name="_csrf" value="<?= FreshRSS_Auth::csrfToken() ?>" />
  17. <legend><?= _t('sub.feed.information') ?></legend>
  18. <div class="form-group">
  19. <label class="group-name" for="name"><?= _t('sub.feed.title') ?></label>
  20. <div class="group-controls">
  21. <input type="text" name="name" id="name" class="extend" value="<?= $this->feed->name() ?>" />
  22. </div>
  23. </div>
  24. <div class="form-group">
  25. <label class="group-name" for="description"><?= _t('sub.feed.description') ?></label>
  26. <div class="group-controls">
  27. <textarea name="description" id="description"><?= htmlspecialchars($this->feed->description(), ENT_NOQUOTES, 'UTF-8') ?></textarea>
  28. </div>
  29. </div>
  30. <div class="form-group">
  31. <label class="group-name" for="website"><?= _t('sub.feed.website') ?></label>
  32. <div class="group-controls">
  33. <div class="stick">
  34. <input type="text" name="website" id="website" class="extend" value="<?= $this->feed->website() ?>" />
  35. <a class="btn" target="_blank" rel="noreferrer" href="<?= $this->feed->website() ?>"><?= _i('link') ?></a>
  36. </div>
  37. </div>
  38. </div>
  39. <div class="form-group">
  40. <label class="group-name" for="url"><?= _t('sub.feed.url') ?></label>
  41. <div class="group-controls">
  42. <div class="stick">
  43. <input type="text" name="url" id="url" class="extend" value="<?= $this->feed->url() ?>" />
  44. <a class="btn" target="_blank" rel="noreferrer" href="<?= $this->feed->url() ?>"><?= _i('link') ?></a>
  45. </div>
  46. <a class="btn" target="_blank" rel="noreferrer" href="https://validator.w3.org/feed/check.cgi?url=<?= rawurlencode(htmlspecialchars_decode($this->feed->url(), ENT_QUOTES)) ?>"><?= _t('sub.feed.validator') ?></a>
  47. </div>
  48. </div>
  49. <div class="form-group">
  50. <label class="group-name" for="category"><?= _t('sub.category') ?></label>
  51. <div class="group-controls">
  52. <select name="category" id="category">
  53. <?php foreach ($this->categories as $cat) { ?>
  54. <option value="<?= $cat->id() ?>"<?= $cat->id()== $this->feed->category() ? ' selected="selected"' : '' ?>>
  55. <?= $cat->name() ?>
  56. </option>
  57. <?php } ?>
  58. </select>
  59. </div>
  60. </div>
  61. <div class="form-group">
  62. <label class="group-name" for="priority"><?= _t('sub.feed.priority') ?></label>
  63. <div class="group-controls">
  64. <select name="priority" id="priority">
  65. <option value='<?= FreshRSS_Feed::PRIORITY_MAIN_STREAM ?>' <?php if (FreshRSS_Feed::PRIORITY_MAIN_STREAM === $this->feed->priority()) {echo 'selected="selected"';}?>><?= _t('sub.feed.priority.main_stream') ?></option>
  66. <option value='<?= FreshRSS_Feed::PRIORITY_NORMAL ?>' <?php if (FreshRSS_Feed::PRIORITY_NORMAL === $this->feed->priority()) {echo 'selected="selected"';}?>><?= _t('sub.feed.priority.normal') ?></option>
  67. <option value='<?= FreshRSS_Feed::PRIORITY_ARCHIVED ?>' <?php if (FreshRSS_Feed::PRIORITY_ARCHIVED === $this->feed->priority()) {echo 'selected="selected"';}?>><?= _t('sub.feed.priority.archived') ?></option>
  68. </select>
  69. </div>
  70. </div>
  71. <div class="form-group form-actions">
  72. <div class="group-controls">
  73. <button class="btn btn-important"><?= _t('gen.action.submit') ?></button>
  74. <button type="reset" class="btn"><?= _t('gen.action.cancel') ?></button>
  75. <button class="btn btn-attention confirm"
  76. data-str-confirm="<?= _t('gen.js.confirm_action_feed_cat') ?>"
  77. formaction="<?= _url('feed', 'delete', 'id', $this->feed->id()) ?>"
  78. formmethod="post"><?= _t('gen.action.remove') ?></button>
  79. </div>
  80. </div>
  81. <legend><?= _t('sub.feed.archiving') ?></legend>
  82. <div class="form-group">
  83. <div class="group-controls">
  84. <div class="stick">
  85. <input type="text" value="<?= _t('sub.feed.number_entries', $nbEntries) ?>" disabled="disabled" />
  86. <a class="btn" href="<?= _url('feed', 'actualize', 'id', $this->feed->id()) ?>">
  87. <?= _i('refresh') ?> <?= _t('gen.action.actualize') ?>
  88. </a>
  89. </div>
  90. </div>
  91. </div>
  92. <?php
  93. $archiving = $this->feed->attributes('archiving');
  94. if (empty($archiving)) {
  95. $archiving = [ 'default' => true ];
  96. } else {
  97. $archiving['default'] = false;
  98. }
  99. $volatile = [
  100. 'enable_keep_period' => false,
  101. 'keep_period_count' => '3',
  102. 'keep_period_unit' => 'P1M',
  103. ];
  104. if (!empty($archiving['keep_period'])) {
  105. if (preg_match('/^PT?(?P<count>\d+)[YMWDH]$/', $archiving['keep_period'], $matches)) {
  106. $volatile['enable_keep_period'] = true;
  107. $volatile['keep_period_count'] = $matches['count'];
  108. $volatile['keep_period_unit'] = str_replace($matches['count'], '1', $archiving['keep_period']);
  109. }
  110. }
  111. //Defaults
  112. if (!isset($archiving['keep_max'])) {
  113. $archiving['keep_max'] = false;
  114. }
  115. if (!isset($archiving['keep_min'])) {
  116. $archiving['keep_min'] = 50;
  117. }
  118. if (!isset($archiving['keep_favourites'])) {
  119. $archiving['keep_favourites'] = true;
  120. }
  121. if (!isset($archiving['keep_labels'])) {
  122. $archiving['keep_labels'] = true;
  123. }
  124. if (!isset($archiving['keep_unreads'])) {
  125. $archiving['keep_unreads'] = false;
  126. }
  127. ?>
  128. <p class="alert alert-warn">
  129. <?= _t('conf.archiving.policy_warning') ?>
  130. </p>
  131. <div class="form-group">
  132. <label class="group-name"><?= _t('conf.archiving.policy') ?></label>
  133. <div class="group-controls">
  134. <label class="checkbox">
  135. <input type="checkbox" name="use_default_purge_options" id="use_default_purge_options" value="1"<?= $archiving['default'] ? ' checked="checked"' : '' ?> data-leave-validation="<?= $archiving['default'] ? 1 : 0 ?>" />
  136. <?= _t('gen.short.by_default') ?>
  137. </label>
  138. </div>
  139. </div>
  140. <div class="form-group archiving"<?= $archiving['default'] ? ' hidden="hidden"' : '' ?>>
  141. <div class="group-controls">
  142. <label class="checkbox" for="enable_keep_max">
  143. <input type="checkbox" name="enable_keep_max" id="enable_keep_max" value="1"<?= empty($archiving['keep_max']) ? '' : ' checked="checked"' ?> data-leave-validation="<?= empty($archiving['keep_max']) ? 0 : 1 ?>"/>
  144. <?= _t('conf.archiving.keep_max') ?>
  145. <input type="number" id="keep_max" name="keep_max" min="0" value="<?= empty($archiving['keep_max']) ? 200 : $archiving['keep_max'] ?>" data-leave-validation="<?= empty($archiving['keep_max']) ? 200 : $archiving['keep_max'] ?>"/>
  146. </label>
  147. </div>
  148. </div>
  149. <div class="form-group archiving"<?= $archiving['default'] ? ' hidden="hidden"' : '' ?>>
  150. <div class="group-controls">
  151. <label class="checkbox" for="enable_keep_period">
  152. <input type="checkbox" name="enable_keep_period" id="enable_keep_period" value="1"<?= $volatile['enable_keep_period'] ? ' checked="checked"' : '' ?> data-leave-validation="<?= $volatile['enable_keep_period'] ? 1 : 0 ?>"/>
  153. <?= _t('conf.archiving.keep_period') ?>
  154. <input type="number" id="keep_period_count" name="keep_period_count" min="0" value="<?= $volatile['keep_period_count'] ?>" data-leave-validation="<?= $volatile['keep_period_count'] ?>"/>
  155. <select class="number" name="keep_period_unit" id="keep_period_unit" data-leave-validation="<?= $volatile['keep_period_unit'] ?>">
  156. <option></option>
  157. <option value="P1Y" <?= 'P1Y' === $volatile['keep_period_unit'] ? 'selected="selected"' : '' ?>><?= _t('gen.period.years') ?></option>
  158. <option value="P1M" <?= 'P1M' === $volatile['keep_period_unit'] ? 'selected="selected"' : '' ?>><?= _t('gen.period.months') ?></option>
  159. <option value="P1W" <?= 'P1W' === $volatile['keep_period_unit'] ? 'selected="selected"' : '' ?>><?= _t('gen.period.weeks') ?></option>
  160. <option value="P1D" <?= 'P1D' === $volatile['keep_period_unit'] ? 'selected="selected"' : '' ?>><?= _t('gen.period.days') ?></option>
  161. <option value="PT1H" <?= 'PT1H' === $volatile['keep_period_unit'] ? 'selected="selected"' : '' ?>><?= _t('gen.period.hours') ?></option>
  162. </select>
  163. </label>
  164. </div>
  165. </div>
  166. <div class="form-group archiving"<?= $archiving['default'] ? ' hidden="hidden"' : '' ?>>
  167. <label class="group-name"><?= _t('conf.archiving.exception') ?></label>
  168. <div class="group-controls">
  169. <label class="checkbox" for="keep_favourites">
  170. <input type="checkbox" name="keep_favourites" id="keep_favourites" value="1"<?= $archiving['keep_favourites'] ? ' checked="checked"' : '' ?> data-leave-validation="<?= $archiving['keep_favourites'] ? 1 : 0 ?>"/>
  171. <?= _t('conf.archiving.keep_favourites') ?>
  172. </label>
  173. </div>
  174. </div>
  175. <div class="form-group archiving"<?= $archiving['default'] ? ' hidden="hidden"' : '' ?>>
  176. <div class="group-controls">
  177. <label class="checkbox" for="keep_labels">
  178. <input type="checkbox" name="keep_labels" id="keep_labels" value="1"<?= $archiving['keep_labels'] ? ' checked="checked"' : '' ?> data-leave-validation="<?= $archiving['keep_labels'] ? 1 : 0 ?>"/>
  179. <?= _t('conf.archiving.keep_labels') ?>
  180. </label>
  181. </div>
  182. </div>
  183. <div class="form-group archiving"<?= $archiving['default'] ? ' hidden="hidden"' : '' ?>>
  184. <div class="group-controls">
  185. <label class="checkbox" for="keep_unreads">
  186. <input type="checkbox" name="keep_unreads" id="keep_unreads" value="1"<?= $archiving['keep_unreads'] ? ' checked="checked"' : '' ?> data-leave-validation="<?= $archiving['keep_unreads'] ?>"/>
  187. <?= _t('conf.archiving.keep_unreads') ?>
  188. </label>
  189. </div>
  190. </div>
  191. <div class="form-group archiving"<?= $archiving['default'] ? ' hidden="hidden"' : '' ?>>
  192. <div class="group-controls">
  193. <label for="keep_min"><?= _t('sub.feed.keep_min') ?>
  194. <input type="number" id="keep_min" name="keep_min" min="0" value="<?= $archiving['keep_min'] ?>" data-leave-validation="<?= $archiving['keep_min'] ?>">
  195. </label>
  196. </div>
  197. </div>
  198. <div class="form-group">
  199. <label class="group-name" for="ttl"><?= _t('sub.feed.ttl') ?></label>
  200. <div class="group-controls">
  201. <select class="number" name="ttl" id="ttl" required="required"><?php
  202. $found = false;
  203. foreach (array(FreshRSS_Feed::TTL_DEFAULT => _t('gen.short.by_default'), 900 => '15min', 1200 => '20min', 1500 => '25min', 1800 => '30min', 2700 => '45min',
  204. 3600 => '1h', 5400 => '1.5h', 7200 => '2h', 10800 => '3h', 14400 => '4h', 18800 => '5h', 21600 => '6h', 25200 => '7h', 28800 => '8h',
  205. 36000 => '10h', 43200 => '12h', 64800 => '18h',
  206. 86400 => '1d', 129600 => '1.5d', 172800 => '2d', 259200 => '3d', 345600 => '4d', 432000 => '5d', 518400 => '6d',
  207. 604800 => '1wk', 1209600 => '2wk', 1814400 => '3wk', 2419200 => '4wk', 2629744 => '1mo') as $v => $t) {
  208. echo '<option value="' . $v . ($this->feed->ttl() === $v ? '" selected="selected' : '') . '">' . $t . '</option>';
  209. if ($this->feed->ttl() == $v) {
  210. $found = true;
  211. }
  212. }
  213. if (!$found) {
  214. echo '<option value="' . intval($this->feed->ttl()) . '" selected="selected">' . intval($this->feed->ttl()) . 's</option>';
  215. }
  216. ?></select>
  217. <label for="mute">
  218. <input type="checkbox" name="mute" id="mute" value="1"<?= $this->feed->mute() ? ' checked="checked"' : '' ?> />
  219. <?= _t('sub.feed.mute') ?>
  220. </label>
  221. </div>
  222. </div>
  223. <?php if ($this->feed->pubSubHubbubEnabled()) { ?>
  224. <div class="form-group">
  225. <div class="group-controls">
  226. <label class="checkbox" for="pubsubhubbub">
  227. <input type="checkbox" name="pubsubhubbub" id="pubsubhubbub" disabled="disabled" value="1" checked />
  228. <?= _t('sub.feed.websub') ?>
  229. </label>
  230. </div>
  231. </div>
  232. <?php } ?>
  233. <div class="form-group form-actions">
  234. <div class="group-controls">
  235. <button class="btn btn-important"><?= _t('gen.action.submit') ?></button>
  236. <button type="reset" class="btn"><?= _t('gen.action.cancel') ?></button>
  237. <button class="btn btn-attention confirm" formmethod="post" formaction="<?= _url('feed', 'truncate', 'id', $this->feed->id()) ?>"><?= _t('gen.action.truncate') ?></button>
  238. </div>
  239. </div>
  240. <legend><?= _t('sub.feed.auth.configuration') ?></legend>
  241. <?php $auth = $this->feed->httpAuth(false); ?>
  242. <div class="form-group">
  243. <label class="group-name" for="http_user_feed<?= $this->feed->id() ?>"><?= _t('sub.feed.auth.username') ?></label>
  244. <div class="group-controls">
  245. <input type="text" name="http_user_feed<?= $this->feed->id() ?>" id="http_user_feed<?= $this->feed->id() ?>" class="extend" value="<?= empty($auth['username']) ? ' ' : $auth['username'] ?>" autocomplete="off" />
  246. <p class="help"><?= _i('help') ?> <?= _t('sub.feed.auth.help') ?></p>
  247. </div>
  248. <label class="group-name" for="http_pass_feed<?= $this->feed->id() ?>"><?= _t('sub.feed.auth.password') ?></label>
  249. <div class="group-controls">
  250. <input type="password" name="http_pass_feed<?= $this->feed->id() ?>" id="http_pass_feed<?= $this->feed->id() ?>" class="extend" value="<?= $auth['password'] ?>" autocomplete="new-password" />
  251. </div>
  252. </div>
  253. <div class="form-group form-actions">
  254. <div class="group-controls">
  255. <button type="submit" class="btn btn-important"><?= _t('gen.action.submit') ?></button>
  256. <button type="reset" class="btn"><?= _t('gen.action.cancel') ?></button>
  257. </div>
  258. </div>
  259. <legend><?= _t('sub.feed.advanced') ?></legend>
  260. <div class="form-group">
  261. <label class="group-name" for="path_entries"><?= _t('sub.feed.css_path') ?></label>
  262. <div class="group-controls">
  263. <div class="stick">
  264. <input type="text" name="path_entries" id="path_entries" class="extend" value="<?= $this->feed->pathEntries() ?>" placeholder="<?= _t('gen.short.blank_to_disable') ?>" />
  265. <a id="popup-preview-selector" class="btn" href="<?= _url('feed', 'contentSelectorPreview', 'id', $this->feed->id(), 'selector', 'selector-token') ?>"><?= _i('look') ?></a>
  266. </div>
  267. <p class="help"><?= _i('help') ?> <?= _t('sub.feed.css_help') ?></p>
  268. </div>
  269. </div>
  270. <div class="form-group">
  271. <label class="group-name" for="mark_updated_article_unread"><?= _t('conf.reading.mark_updated_article_unread') ?></label>
  272. <div class="group-controls">
  273. <label class="checkbox" for="mark_updated_article_unread">
  274. <select name="mark_updated_article_unread" id="mark_updated_article_unread">
  275. <option value=""<?= $this->feed->attributes('mark_updated_article_unread') === null ? ' selected="selected"' : '' ?>><?= _t('gen.short.by_default') ?></option>
  276. <option value="0"<?= $this->feed->attributes('mark_updated_article_unread') === false ? ' selected="selected"' : '' ?>><?= _t('gen.short.no') ?></option>
  277. <option value="1"<?= $this->feed->attributes('mark_updated_article_unread') === true ? ' selected="selected"' : '' ?>><?= _t('gen.short.yes') ?></option>
  278. </select>
  279. </label>
  280. </div>
  281. </div>
  282. <div class="form-group">
  283. <label class="group-name" for="read_upon_reception"><?= _t('conf.reading.read.when') ?></label>
  284. <div class="group-controls">
  285. <label class="checkbox" for="read_upon_reception">
  286. <select name="read_upon_reception" id="read_upon_reception">
  287. <option value=""<?= $this->feed->attributes('read_upon_reception') === null ? ' selected="selected"' : '' ?>><?= _t('gen.short.by_default') ?></option>
  288. <option value="0"<?= $this->feed->attributes('read_upon_reception') === false ? ' selected="selected"' : '' ?>><?= _t('gen.short.no') ?></option>
  289. <option value="1"<?= $this->feed->attributes('read_upon_reception') === true ? ' selected="selected"' : '' ?>><?= _t('gen.short.yes') ?></option>
  290. </select>
  291. <?= _t('conf.reading.read.upon_reception') ?>
  292. </label>
  293. </div>
  294. </div>
  295. <div class="form-group">
  296. <div class="group-controls">
  297. <label class="checkbox" for="clear_cache">
  298. <input type="checkbox" name="clear_cache" id="clear_cache" value="1"<?= $this->feed->attributes('clear_cache') ? ' checked="checked"' : '' ?> />
  299. <?= _t('sub.feed.clear_cache') ?>
  300. </label>
  301. </div>
  302. </div>
  303. <?php if (FreshRSS_Auth::hasAccess('admin')) { ?>
  304. <div class="form-group">
  305. <label class="group-name" for="timeout"><?= _t('sub.feed.timeout') ?></label>
  306. <div class="group-controls">
  307. <input type="number" name="timeout" id="timeout" min="3" max="120" value="<?= $this->feed->attributes('timeout') ?>" placeholder="<?= _t('gen.short.by_default') ?>" />
  308. </div>
  309. </div>
  310. <div class="form-group">
  311. <label class="group-name" for="ssl_verify"><?= _t('sub.feed.ssl_verify') ?></label>
  312. <div class="group-controls">
  313. <label class="checkbox" for="ssl_verify">
  314. <select name="ssl_verify" id="ssl_verify">
  315. <option value=""<?= $this->feed->attributes('ssl_verify') === null ? ' selected="selected"' : '' ?>><?= _t('gen.short.by_default') ?></option>
  316. <option value="0"<?= $this->feed->attributes('ssl_verify') === false ? ' selected="selected"' : '' ?>><?= _t('gen.short.no') ?></option>
  317. <option value="1"<?= $this->feed->attributes('ssl_verify') === true ? ' selected="selected"' : '' ?>><?= _t('gen.short.yes') ?></option>
  318. </select>
  319. </label>
  320. </div>
  321. </div>
  322. <?php } ?>
  323. <legend><?= _t('sub.feed.filteractions') ?></legend>
  324. <div class="form-group">
  325. <label class="group-name" for="filteractions_read"><?= _t('conf.reading.read.when') ?></label>
  326. <div class="group-controls">
  327. <textarea name="filteractions_read" id="filteractions_read"><?php
  328. foreach ($this->feed->filtersAction('read') as $filterRead) {
  329. echo htmlspecialchars($filterRead->getRawInput(), ENT_NOQUOTES, 'UTF-8'), PHP_EOL;
  330. }
  331. ?></textarea>
  332. <p class="help"><?= _i('help') ?> <?= _t('sub.feed.filteractions.help') ?></p>
  333. </div>
  334. </div>
  335. <div class="form-group form-actions">
  336. <div class="group-controls">
  337. <button type="submit" class="btn btn-important"><?= _t('gen.action.submit') ?></button>
  338. <button type="reset" class="btn"><?= _t('gen.action.cancel') ?></button>
  339. </div>
  340. </div>
  341. <legend><?= _t('sub.feed.maintenance.title') ?></legend>
  342. <div class="form-group">
  343. <div class="group-controls">
  344. <a class="btn btn-important" href="<?= _url('feed', 'clearCache', 'id', $this->feed->id()) ?>">
  345. <?= _t('sub.feed.maintenance.clear_cache') ?>
  346. </a>
  347. <p class="help"><?= _i('help') ?> <?= _t('sub.feed.maintenance.clear_cache_help') ?></p>
  348. </div>
  349. <div class="group-controls">
  350. <a class="btn btn-important" href="<?= _url('feed', 'reload', 'id', $this->feed->id()) ?>">
  351. <?= _t('sub.feed.maintenance.reload_articles') ?>
  352. </a>
  353. <p class="help"><?= _i('help') ?> <?= _t('sub.feed.maintenance.reload_articles_help') ?></p>
  354. </div>
  355. </div>
  356. </form>
  357. </div>