update.phtml 35 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676
  1. <?php
  2. declare(strict_types=1);
  3. /** @var FreshRSS_View $this */
  4. ?>
  5. <div class="post" id="feed_update">
  6. <h1><?= $this->feed->name() ?></h1>
  7. <div>
  8. <a href="<?= _url('index', 'index', 'get', 'f_' . $this->feed->id()) ?>"><?= _i('link') ?> <?= _t('gen.action.filter') ?></a>
  9. <?= _t('gen.short.or') ?>
  10. <a href="<?= _url('stats', 'repartition', 'id', $this->feed->id()) ?>"><?= _i('stats') ?> <?= _t('sub.feed.stats') ?></a>
  11. </div>
  12. <?php $nbEntries = $this->feed->nbEntries(); ?>
  13. <?php if ($this->feed->inError()) { ?>
  14. <p class="alert alert-error"><span class="alert-head"><?= _t('gen.short.damn') ?></span> <?= _t('sub.feed.error') ?></p>
  15. <?php } elseif ($nbEntries === 0) { ?>
  16. <p class="alert alert-warn"><?= _t('sub.feed.empty') ?></p>
  17. <?php } ?>
  18. <?php
  19. $from = Minz_Request::paramString('from');
  20. if ($from === '') {
  21. $url = _url('subscription', 'feed', 'id', $this->feed->id(), '#', 'slider');
  22. } else {
  23. $get = Minz_Request::paramString('get');
  24. if ($get === '') {
  25. $url = _url('subscription', 'feed', 'id', $this->feed->id(), 'from', $from, '#', 'slider');
  26. } else {
  27. $url = _url('subscription', 'feed', 'id', $this->feed->id(), 'from', $from, 'get', $get, '#', 'slider');
  28. }
  29. }
  30. ?>
  31. <form method="post" action="<?= $url ?>" autocomplete="off">
  32. <input type="hidden" name="_csrf" value="<?= FreshRSS_Auth::csrfToken() ?>" />
  33. <legend><?= _t('sub.feed.information') ?></legend>
  34. <div class="form-group">
  35. <label class="group-name" for="name"><?= _t('sub.feed.title') ?></label>
  36. <div class="group-controls">
  37. <input type="text" name="name" id="name" class="w100" value="<?= $this->feed->name(true) ?>" required="required" />
  38. </div>
  39. </div>
  40. <div class="form-group">
  41. <label class="group-name" for="description"><?= _t('sub.feed.description') ?></label>
  42. <div class="group-controls">
  43. <textarea name="description" id="description" class="w100"><?= htmlspecialchars($this->feed->description(), ENT_NOQUOTES, 'UTF-8') ?></textarea>
  44. </div>
  45. </div>
  46. <div class="form-group">
  47. <label class="group-name" for="website"><?= _t('sub.feed.website') ?></label>
  48. <div class="group-controls">
  49. <div class="stick w100">
  50. <input type="url" name="website" id="website" value="<?= $this->feed->website() ?>" />
  51. <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>
  52. </div>
  53. </div>
  54. </div>
  55. <div class="form-group">
  56. <label class="group-name" for="url"><?= _t('sub.feed.url') ?></label>
  57. <div class="group-controls">
  58. <div class="stick w100">
  59. <input type="url" name="url" id="url" value="<?= $this->feed->url() ?>" required="required" />
  60. <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>
  61. </div>
  62. <a class="btn" target="_blank" rel="noreferrer" href="https://validator.w3.org/feed/check.cgi?url=<?=
  63. rawurlencode(htmlspecialchars_decode($this->feed->url(), ENT_QUOTES)) ?>"><?= _t('sub.feed.validator') ?></a>
  64. </div>
  65. </div>
  66. <div class="form-group">
  67. <label class="group-name" for="category"><?= _t('sub.category') ?></label>
  68. <div class="group-controls">
  69. <select name="category" id="category" class="w100">
  70. <?php foreach ($this->categories as $cat) { ?>
  71. <option value="<?= $cat->id() ?>"<?= $cat->id() == $this->feed->categoryId() ? ' selected="selected"' : '' ?>>
  72. <?= $cat->name() ?>
  73. </option>
  74. <?php } ?>
  75. </select>
  76. </div>
  77. </div>
  78. <div class="form-group">
  79. <label class="group-name" for="priority"><?= _t('sub.feed.priority') ?></label>
  80. <div class="group-controls">
  81. <select name="priority" id="priority" class="w50">
  82. <option value='<?= FreshRSS_Feed::PRIORITY_IMPORTANT ?>' <?php
  83. if (FreshRSS_Feed::PRIORITY_IMPORTANT === $this->feed->priority()) {echo 'selected="selected"';}?>><?= _t('sub.feed.priority.important') ?></option>
  84. <option value='<?= FreshRSS_Feed::PRIORITY_MAIN_STREAM ?>' <?php
  85. if (FreshRSS_Feed::PRIORITY_MAIN_STREAM === $this->feed->priority()) {echo 'selected="selected"';}?>><?= _t('sub.feed.priority.main_stream') ?></option>
  86. <option value='<?= FreshRSS_Feed::PRIORITY_CATEGORY ?>' <?php
  87. if (FreshRSS_Feed::PRIORITY_CATEGORY === $this->feed->priority()) {echo 'selected="selected"';}?>><?= _t('sub.feed.priority.category') ?></option>
  88. <option value='<?= FreshRSS_Feed::PRIORITY_ARCHIVED ?>' <?php
  89. if (FreshRSS_Feed::PRIORITY_ARCHIVED === $this->feed->priority()) {echo 'selected="selected"';}?>><?= _t('sub.feed.priority.archived') ?></option>
  90. </select>
  91. <?= _i('important') ?>
  92. </div>
  93. </div>
  94. <div class="form-group">
  95. <label class="group-name" for="ttl"><?= _t('sub.feed.ttl') ?></label>
  96. <div class="group-controls">
  97. <select class="w50" name="ttl" id="ttl" required="required"><?php
  98. $found = false;
  99. foreach (array(FreshRSS_Feed::TTL_DEFAULT => _t('gen.short.by_default'), 900 => '15min', 1200 => '20min', 1500 => '25min', 1800 => '30min', 2700 => '45min',
  100. 3600 => '1h', 5400 => '1.5h', 7200 => '2h', 10800 => '3h', 14400 => '4h', 18800 => '5h', 21600 => '6h', 25200 => '7h', 28800 => '8h',
  101. 36000 => '10h', 43200 => '12h', 64800 => '18h',
  102. 86400 => '1d', 129600 => '1.5d', 172800 => '2d', 259200 => '3d', 345600 => '4d', 432000 => '5d', 518400 => '6d',
  103. 604800 => '1wk', 1209600 => '2wk', 1814400 => '3wk', 2419200 => '4wk', 2629744 => '1mo') as $v => $t) {
  104. echo '<option value="' . $v . ($this->feed->ttl() === $v ? '" selected="selected' : '') . '">' . $t . '</option>';
  105. if ($this->feed->ttl() == $v) {
  106. $found = true;
  107. }
  108. }
  109. if (!$found) {
  110. echo '<option value="' . intval($this->feed->ttl()) . '" selected="selected">' . intval($this->feed->ttl()) . 's</option>';
  111. }
  112. ?></select>
  113. <label for="mute">
  114. <input type="checkbox" name="mute" id="mute" value="1"<?= $this->feed->mute() ? ' checked="checked"' : '' ?> />
  115. <?= _t('sub.feed.mute') ?>
  116. </label>
  117. </div>
  118. </div>
  119. <?php if ($this->feed->pubSubHubbubEnabled()) { ?>
  120. <div class="form-group">
  121. <div class="group-controls">
  122. <label class="checkbox" for="pubsubhubbub">
  123. <input type="checkbox" name="pubsubhubbub" id="pubsubhubbub" disabled="disabled" value="1" checked="checked" />
  124. <?= _t('sub.feed.websub') ?>
  125. </label>
  126. </div>
  127. </div>
  128. <?php } ?>
  129. <div class="form-group form-actions">
  130. <div class="group-controls">
  131. <button type="submit" class="btn btn-important"><?= _t('gen.action.submit') ?></button>
  132. <button type="reset" class="btn"><?= _t('gen.action.cancel') ?></button>
  133. <?php
  134. if ($from === '') {
  135. $url = _url('feed', 'delete', 'id', $this->feed->id());
  136. } else {
  137. $url = _url('feed', 'delete', 'id', $this->feed->id(), 'from', $from);
  138. }
  139. ?>
  140. <button type="submit" class="btn btn-attention confirm"
  141. data-str-confirm="<?= _t('gen.js.confirm_action_feed_cat') ?>"
  142. formaction="<?= $url ?>"
  143. formmethod="post"><?= _t('gen.action.remove') ?></button>
  144. </div>
  145. </div>
  146. <legend><?= _t('sub.feed.auth.configuration') ?></legend>
  147. <?php $auth = $this->feed->httpAuth(false); ?>
  148. <div class="form-group">
  149. <label class="group-name" for="http_user_feed<?= $this->feed->id() ?>"><?= _t('sub.feed.auth.username') ?></label>
  150. <div class="group-controls">
  151. <input type="text" name="http_user_feed<?= $this->feed->id() ?>" id="http_user_feed<?= $this->feed->id() ?>" class="w50" value="<?=
  152. empty($auth['username']) ? '' : $auth['username'] ?>" autocomplete="off" />
  153. <p class="help"><?= _i('help') ?> <?= _t('sub.feed.auth.help') ?></p>
  154. </div>
  155. </div>
  156. <div class="form-group">
  157. <label class="group-name" for="http_pass_feed<?= $this->feed->id() ?>"><?= _t('sub.feed.auth.password') ?></label>
  158. <div class="group-controls">
  159. <div class="stick w50">
  160. <input type="password" name="http_pass_feed<?= $this->feed->id() ?>" id="http_pass_feed<?= $this->feed->id() ?>" value="<?=
  161. $auth['password'] ?>" autocomplete="new-password" />
  162. <button type="button" class="btn toggle-password" data-toggle="http_pass_feed<?= $this->feed->id() ?>"><?= _i('key') ?></button>
  163. </div>
  164. </div>
  165. </div>
  166. <div class="form-group form-actions">
  167. <div class="group-controls">
  168. <button type="submit" class="btn btn-important"><?= _t('gen.action.submit') ?></button>
  169. <button type="reset" class="btn"><?= _t('gen.action.cancel') ?></button>
  170. </div>
  171. </div>
  172. <legend><?= _t('sub.feed.filteractions') ?></legend>
  173. <div class="form-group">
  174. <label class="group-name" for="mark_updated_article_unread"><?= _t('conf.reading.mark_updated_article_unread') ?></label>
  175. <div class="group-controls">
  176. <select name="mark_updated_article_unread" id="mark_updated_article_unread" class="w50">
  177. <option value=""<?= $this->feed->attributes('mark_updated_article_unread') === null ? ' selected="selected"' : '' ?>><?= _t('gen.short.by_default') ?></option>
  178. <option value="0"<?= $this->feed->attributes('mark_updated_article_unread') === false ? ' selected="selected"' : '' ?>><?= _t('gen.short.no') ?></option>
  179. <option value="1"<?= $this->feed->attributes('mark_updated_article_unread') === true ? ' selected="selected"' : '' ?>><?= _t('gen.short.yes') ?></option>
  180. </select>
  181. </div>
  182. </div>
  183. <div class="form-group">
  184. <label class="group-name" for="read_when_same_title_in_feed"><?= _t('conf.reading.read.when') ?></label>
  185. <div class="group-controls">
  186. <select name="read_when_same_title_in_feed" id="read_when_same_title_in_feed" class="w50">
  187. <option value=""<?= $this->feed->attributes('read_when_same_title_in_feed') === null ? ' selected="selected"' : '' ?>><?= _t('gen.short.by_default') ?></option>
  188. <option value="0"<?= $this->feed->attributes('read_when_same_title_in_feed') === false ? ' selected="selected"' : '' ?>><?= _t('gen.short.no') ?></option>
  189. <option value="10"<?= $this->feed->attributes('read_when_same_title_in_feed') == 10 ? ' selected="selected"' : '' ?>>10</option>
  190. <option value="25"<?= $this->feed->attributes('read_when_same_title_in_feed') == 25 ? ' selected="selected"' : '' ?>>25</option>
  191. <option value="100"<?= $this->feed->attributes('read_when_same_title_in_feed') == 100 ? ' selected="selected"' : '' ?>>100</option>
  192. <option value="1000"<?= $this->feed->attributes('read_when_same_title_in_feed') == 1000 ? ' selected="selected"' : '' ?>>1 000</option>
  193. </select>
  194. <?= _t('conf.reading.read.when_same_title') ?>
  195. </div>
  196. </div>
  197. <div class="form-group">
  198. <label class="group-name" for="read_upon_reception"><?= _t('conf.reading.read.when') ?></label>
  199. <div class="group-controls">
  200. <select name="read_upon_reception" id="read_upon_reception" class="w50">
  201. <option value=""<?= $this->feed->attributes('read_upon_reception') === null ? ' selected="selected"' : '' ?>><?= _t('gen.short.by_default') ?></option>
  202. <option value="0"<?= $this->feed->attributes('read_upon_reception') === false ? ' selected="selected"' : '' ?>><?= _t('gen.short.no') ?></option>
  203. <option value="1"<?= $this->feed->attributes('read_upon_reception') === true ? ' selected="selected"' : '' ?>><?= _t('gen.short.yes') ?></option>
  204. </select>
  205. <?= _t('conf.reading.read.upon_reception') ?>
  206. </div>
  207. </div>
  208. <div class="form-group">
  209. <label class="group-name" for="read_upon_gone"><?= _t('conf.reading.read.when') ?></label>
  210. <div class="group-controls">
  211. <select name="read_upon_gone" id="read_upon_gone" class="w50">
  212. <option value=""<?= $this->feed->attributes('read_upon_gone') === null ? ' selected="selected"' : '' ?>><?= _t('gen.short.by_default') ?></option>
  213. <option value="0"<?= $this->feed->attributes('read_upon_gone') === false ? ' selected="selected"' : '' ?>><?= _t('gen.short.no') ?></option>
  214. <option value="1"<?= $this->feed->attributes('read_upon_gone') === true ? ' selected="selected"' : '' ?>><?= _t('gen.short.yes') ?></option>
  215. </select>
  216. <?= _t('conf.reading.read.upon_gone') ?>
  217. </div>
  218. </div>
  219. <div class="form-group">
  220. <label class="group-name" for="filteractions_read"><?= _t('conf.reading.read.when') ?></label>
  221. <div class="group-controls">
  222. <textarea name="filteractions_read" id="filteractions_read" class="w100"><?php
  223. foreach ($this->feed->filtersAction('read') as $filterRead) {
  224. echo $filterRead->getRawInput(), PHP_EOL;
  225. }
  226. ?></textarea>
  227. <p class="help"><?= _i('help') ?> <?= _t('sub.feed.filteractions.help') ?></p>
  228. </div>
  229. </div>
  230. <div class="form-group">
  231. <label class="group-name" for="keep_max_n_unread"><?= _t('conf.reading.read.keep_max_n_unread') ?></label>
  232. <div class="group-controls">
  233. <input type="number" name="keep_max_n_unread" id="keep_max_n_unread" class="w50" min="1" max="10000000" value="<?= $this->feed->attributes('keep_max_n_unread') ?>" placeholder="<?= _t('gen.short.by_default') ?>" />
  234. </div>
  235. </div>
  236. <div class="form-group form-actions">
  237. <div class="group-controls">
  238. <button type="submit" class="btn btn-important"><?= _t('gen.action.submit') ?></button>
  239. <button type="reset" class="btn"><?= _t('gen.action.cancel') ?></button>
  240. </div>
  241. </div>
  242. <legend><?= _t('sub.feed.archiving') ?></legend>
  243. <div class="form-group">
  244. <div class="group-controls">
  245. <?= _t('sub.feed.number_entries', $nbEntries) ?>
  246. <a class="btn" href="<?= _url('feed', 'actualize', 'id', $this->feed->id(), '#', 'slider') ?>">
  247. <?= _i('refresh') ?> <?= _t('gen.action.actualize') ?>
  248. </a>
  249. </div>
  250. </div>
  251. <?php
  252. $archiving = $this->feed->attributes('archiving');
  253. if (empty($archiving)) {
  254. $archiving = [ 'default' => true ];
  255. } else {
  256. $archiving['default'] = false;
  257. }
  258. $volatile = [
  259. 'enable_keep_period' => false,
  260. 'keep_period_count' => '3',
  261. 'keep_period_unit' => 'P1M',
  262. ];
  263. if (!empty($archiving['keep_period'])) {
  264. if (preg_match('/^PT?(?P<count>\d+)[YMWDH]$/', $archiving['keep_period'], $matches)) {
  265. $volatile['enable_keep_period'] = true;
  266. $volatile['keep_period_count'] = $matches['count'];
  267. $volatile['keep_period_unit'] = str_replace($matches['count'], '1', $archiving['keep_period']);
  268. }
  269. }
  270. //Defaults
  271. if (!isset($archiving['keep_max'])) {
  272. $archiving['keep_max'] = false;
  273. }
  274. if (!isset($archiving['keep_min'])) {
  275. $archiving['keep_min'] = 50;
  276. }
  277. if (!isset($archiving['keep_favourites'])) {
  278. $archiving['keep_favourites'] = true;
  279. }
  280. if (!isset($archiving['keep_labels'])) {
  281. $archiving['keep_labels'] = true;
  282. }
  283. if (!isset($archiving['keep_unreads'])) {
  284. $archiving['keep_unreads'] = false;
  285. }
  286. ?>
  287. <p class="alert alert-warn">
  288. <?= _t('conf.archiving.policy_warning') ?>
  289. </p>
  290. <div class="form-group">
  291. <div class="group-name"><?= _t('conf.archiving.policy') ?></div>
  292. <div class="group-controls">
  293. <label class="checkbox">
  294. <input type="checkbox" name="use_default_purge_options" id="use_default_purge_options" value="1"<?= $archiving['default'] ? ' checked="checked"' : '' ?>
  295. data-leave-validation="<?= $archiving['default'] ? 1 : 0 ?>" />
  296. <?= _t('gen.short.by_default') ?>
  297. </label>
  298. </div>
  299. </div>
  300. <div class="form-group archiving"<?= $archiving['default'] ? ' hidden="hidden"' : '' ?>>
  301. <div class="group-controls">
  302. <label class="checkbox" for="enable_keep_max">
  303. <input type="checkbox" name="enable_keep_max" id="enable_keep_max" value="1"<?= empty($archiving['keep_max']) ? '' : ' checked="checked"' ?>
  304. data-leave-validation="<?= empty($archiving['keep_max']) ? 0 : 1 ?>"/>
  305. <?= _t('conf.archiving.keep_max') ?>
  306. <input type="number" id="keep_max" name="keep_max" min="0" value="<?= empty($archiving['keep_max']) ? 200 : $archiving['keep_max'] ?>"
  307. data-leave-validation="<?= empty($archiving['keep_max']) ? 200 : $archiving['keep_max'] ?>"/>
  308. </label>
  309. </div>
  310. </div>
  311. <div class="form-group archiving"<?= $archiving['default'] ? ' hidden="hidden"' : '' ?>>
  312. <div class="group-controls">
  313. <label class="checkbox" for="enable_keep_period">
  314. <input type="checkbox" name="enable_keep_period" id="enable_keep_period" value="1"<?= $volatile['enable_keep_period'] ? ' checked="checked"' : '' ?>
  315. data-leave-validation="<?= $volatile['enable_keep_period'] ? 1 : 0 ?>"/>
  316. <?= _t('conf.archiving.keep_period') ?>
  317. <input type="number" id="keep_period_count" name="keep_period_count" min="0" value="<?= $volatile['keep_period_count'] ?>"
  318. data-leave-validation="<?= $volatile['keep_period_count'] ?>"/>
  319. <select class="number" name="keep_period_unit" id="keep_period_unit" data-leave-validation="<?= $volatile['keep_period_unit'] ?>">
  320. <option></option>
  321. <option value="P1Y" <?= 'P1Y' === $volatile['keep_period_unit'] ? 'selected="selected"' : '' ?>><?= _t('gen.period.years') ?></option>
  322. <option value="P1M" <?= 'P1M' === $volatile['keep_period_unit'] ? 'selected="selected"' : '' ?>><?= _t('gen.period.months') ?></option>
  323. <option value="P1W" <?= 'P1W' === $volatile['keep_period_unit'] ? 'selected="selected"' : '' ?>><?= _t('gen.period.weeks') ?></option>
  324. <option value="P1D" <?= 'P1D' === $volatile['keep_period_unit'] ? 'selected="selected"' : '' ?>><?= _t('gen.period.days') ?></option>
  325. <option value="PT1H" <?= 'PT1H' === $volatile['keep_period_unit'] ? 'selected="selected"' : '' ?>><?= _t('gen.period.hours') ?></option>
  326. </select>
  327. </label>
  328. </div>
  329. </div>
  330. <div class="form-group archiving"<?= $archiving['default'] ? ' hidden="hidden"' : '' ?>>
  331. <div class="group-name"><?= _t('conf.archiving.exception') ?></div>
  332. <div class="group-controls">
  333. <label class="checkbox" for="keep_favourites">
  334. <input type="checkbox" name="keep_favourites" id="keep_favourites" value="1"<?= $archiving['keep_favourites'] ? ' checked="checked"' : '' ?>
  335. data-leave-validation="<?= $archiving['keep_favourites'] ? 1 : 0 ?>"/>
  336. <?= _t('conf.archiving.keep_favourites') ?>
  337. </label>
  338. </div>
  339. </div>
  340. <div class="form-group archiving"<?= $archiving['default'] ? ' hidden="hidden"' : '' ?>>
  341. <div class="group-controls">
  342. <label class="checkbox" for="keep_labels">
  343. <input type="checkbox" name="keep_labels" id="keep_labels" value="1"<?= $archiving['keep_labels'] ? ' checked="checked"' : '' ?>
  344. data-leave-validation="<?= $archiving['keep_labels'] ? 1 : 0 ?>"/>
  345. <?= _t('conf.archiving.keep_labels') ?>
  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="keep_unreads">
  352. <input type="checkbox" name="keep_unreads" id="keep_unreads" value="1"<?= $archiving['keep_unreads'] ? ' checked="checked"' : '' ?>
  353. data-leave-validation="<?= $archiving['keep_unreads'] ?>"/>
  354. <?= _t('conf.archiving.keep_unreads') ?>
  355. </label>
  356. </div>
  357. </div>
  358. <div class="form-group archiving"<?= $archiving['default'] ? ' hidden="hidden"' : '' ?>>
  359. <div class="group-controls">
  360. <label for="keep_min"><?= _t('sub.feed.keep_min') ?>
  361. <input type="number" id="keep_min" name="keep_min" min="0" value="<?= $archiving['keep_min'] ?>"
  362. data-leave-validation="<?= $archiving['keep_min'] ?>">
  363. </label>
  364. </div>
  365. </div>
  366. <div class="form-group form-actions">
  367. <div class="group-controls">
  368. <button type="submit" class="btn btn-important"><?= _t('gen.action.submit') ?></button>
  369. <button type="reset" class="btn"><?= _t('gen.action.cancel') ?></button>
  370. <button type="submit" class="btn btn-attention confirm" formmethod="post" formaction="<?= _url('feed', 'truncate', 'id', $this->feed->id(), '#', 'slider') ?>"><?= _t('gen.action.truncate') ?></button>
  371. </div>
  372. </div>
  373. <legend><?= _t('sub.feed.kind') ?></legend>
  374. <div class="form-group">
  375. <label class="group-name" for="feed_kind"><?= _t('sub.feed.kind') ?></label>
  376. <div class="group-controls">
  377. <select name="feed_kind" id="feed_kind" class="select-show w100">
  378. <option value="<?= FreshRSS_Feed::KIND_RSS ?>" <?= $this->feed->kind() === FreshRSS_Feed::KIND_RSS ? 'selected="selected"' : '' ?>><?= _t('sub.feed.kind.rss') ?></option>
  379. <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>
  380. <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>
  381. </select>
  382. </div>
  383. </div>
  384. <fieldset id="html_xpath">
  385. <?php
  386. $xpath = Minz_Helper::htmlspecialchars_utf8((array)($this->feed->attributes('xpath')));
  387. ?>
  388. <p class="help"><?= _i('help') ?> <?= _t('sub.feed.kind.html_xpath.help') ?></p>
  389. <div class="form-group">
  390. <label class="group-name" for="xPathItem"><small><?= _t('sub.feed.kind.html_xpath.xpath') ?></small><br />
  391. <?= _t('sub.feed.kind.html_xpath.item') ?></label>
  392. <div class="group-controls">
  393. <textarea class="valid-xpath w100" name="xPathItem" id="xPathItem" rows="2" cols="64" spellcheck="false"
  394. data-leave-validation="<?= $xpath['item'] ?? '' ?>"><?= $xpath['item'] ?? '' ?></textarea>
  395. <p class="help"><?= _i('help') ?> <?= _t('sub.feed.kind.html_xpath.item.help') ?></p>
  396. </div>
  397. </div>
  398. <div class="form-group">
  399. <label class="group-name" for="xPathItemTitle"><small><?= _t('sub.feed.kind.html_xpath.relative') ?></small><br />
  400. <?= _t('sub.feed.kind.html_xpath.item_title') ?></label>
  401. <div class="group-controls">
  402. <textarea class="valid-xpath w100" name="xPathItemTitle" id="xPathItemTitle" rows="2" cols="64" spellcheck="false"
  403. data-leave-validation="<?= $xpath['itemTitle'] ?? '' ?>"><?= $xpath['itemTitle'] ?? '' ?></textarea>
  404. <p class="help"><?= _i('help') ?> <?= _t('sub.feed.kind.html_xpath.item_title.help') ?></p>
  405. </div>
  406. </div>
  407. <div class="form-group">
  408. <label class="group-name" for="xPathItemContent"><small><?= _t('sub.feed.kind.html_xpath.relative') ?></small><br />
  409. <?= _t('sub.feed.kind.html_xpath.item_content') ?></label>
  410. <div class="group-controls">
  411. <textarea class="valid-xpath w100" name="xPathItemContent" id="xPathItemContent" rows="2" cols="64" spellcheck="false"
  412. data-leave-validation="<?= $xpath['itemContent'] ?? '' ?>"><?= $xpath['itemContent'] ?? '' ?></textarea>
  413. <p class="help"><?= _i('help') ?> <?= _t('sub.feed.kind.html_xpath.item_content.help') ?></p>
  414. </div>
  415. </div>
  416. <div class="form-group">
  417. <label class="group-name" for="xPathItemUri"><small><?= _t('sub.feed.kind.html_xpath.relative') ?></small><br />
  418. <?= _t('sub.feed.kind.html_xpath.item_uri') ?></label>
  419. <div class="group-controls">
  420. <textarea class="valid-xpath w100" name="xPathItemUri" id="xPathItemUri" rows="2" cols="64" spellcheck="false"
  421. data-leave-validation="<?= $xpath['itemUri'] ?? '' ?>"><?= $xpath['itemUri'] ?? '' ?></textarea>
  422. <p class="help"><?= _i('help') ?> <?= _t('sub.feed.kind.html_xpath.item_uri.help') ?></p>
  423. </div>
  424. </div>
  425. <div class="form-group">
  426. <label class="group-name" for="xPathItemThumbnail"><small><?= _t('sub.feed.kind.html_xpath.relative') ?></small><br />
  427. <?= _t('sub.feed.kind.html_xpath.item_thumbnail') ?></label>
  428. <div class="group-controls">
  429. <textarea class="valid-xpath w100" name="xPathItemThumbnail" id="xPathItemThumbnail" rows="2" cols="64" spellcheck="false"
  430. data-leave-validation="<?= $xpath['itemThumbnail'] ?? '' ?>"><?= $xpath['itemThumbnail'] ?? '' ?></textarea>
  431. <p class="help"><?= _i('help') ?> <?= _t('sub.feed.kind.html_xpath.item_thumbnail.help') ?></p>
  432. </div>
  433. </div>
  434. <div class="form-group">
  435. <label class="group-name" for="xPathItemAuthor"><small><?= _t('sub.feed.kind.html_xpath.relative') ?></small><br />
  436. <?= _t('sub.feed.kind.html_xpath.item_author') ?></label>
  437. <div class="group-controls">
  438. <textarea class="valid-xpath w100" name="xPathItemAuthor" id="xPathItemAuthor" rows="2" cols="64" spellcheck="false"
  439. data-leave-validation="<?= $xpath['itemAuthor'] ?? '' ?>"><?= $xpath['itemAuthor'] ?? '' ?></textarea>
  440. <p class="help"><?= _i('help') ?> <?= _t('sub.feed.kind.html_xpath.item_author.help') ?></p>
  441. </div>
  442. </div>
  443. <div class="form-group">
  444. <label class="group-name" for="xPathItemTimestamp"><small><?= _t('sub.feed.kind.html_xpath.relative') ?></small><br />
  445. <?= _t('sub.feed.kind.html_xpath.item_timestamp') ?></label>
  446. <div class="group-controls">
  447. <textarea class="valid-xpath w100" name="xPathItemTimestamp" id="xPathItemTimestamp" rows="2" cols="64" spellcheck="false"
  448. data-leave-validation="<?= $xpath['itemTimestamp'] ?? '' ?>"><?= $xpath['itemTimestamp'] ?? '' ?></textarea>
  449. <p class="help"><?= _i('help') ?> <?= _t('sub.feed.kind.html_xpath.item_timestamp.help') ?></p>
  450. </div>
  451. </div>
  452. <div class="form-group">
  453. <label class="group-name" for="xPathItemTimeFormat">
  454. <?= _t('sub.feed.kind.html_xpath.item_timeFormat') ?></label>
  455. <div class="group-controls">
  456. <textarea class="w100" name="xPathItemTimeFormat" id="xPathItemTimeFormat" rows="2" cols="64" spellcheck="false"
  457. data-leave-validation="<?= $xpath['itemTimeFormat'] ?? '' ?>"><?= $xpath['itemTimeFormat'] ?? '' ?></textarea>
  458. <p class="help"><?= _i('help') ?> <?= _t('sub.feed.kind.html_xpath.item_timeFormat.help') ?></p>
  459. </div>
  460. </div>
  461. <div class="form-group">
  462. <label class="group-name" for="xPathItemCategories"><small><?= _t('sub.feed.kind.html_xpath.relative') ?></small><br />
  463. <?= _t('sub.feed.kind.html_xpath.item_categories') ?></label>
  464. <div class="group-controls">
  465. <textarea class="valid-xpath w100" name="xPathItemCategories" id="xPathItemCategories" rows="2" cols="64" spellcheck="false"
  466. data-leave-validation="<?= $xpath['itemCategories'] ?? '' ?>"><?= $xpath['itemCategories'] ?? '' ?></textarea>
  467. </div>
  468. </div>
  469. <div class="form-group">
  470. <label class="group-name" for="xPathItemUid"><small><?= _t('sub.feed.kind.html_xpath.relative') ?></small><br />
  471. <?= _t('sub.feed.kind.html_xpath.item_uid') ?></label>
  472. <div class="group-controls">
  473. <textarea class="valid-xpath w100" name="xPathItemUid" id="xPathItemUid" rows="2" cols="64" spellcheck="false"
  474. data-leave-validation="<?= $xpath['itemUid'] ?? '' ?>"><?= $xpath['itemUid'] ?? '' ?></textarea>
  475. </div>
  476. </div>
  477. </fieldset>
  478. <div class="form-group form-actions">
  479. <div class="group-controls">
  480. <button class="btn btn-important"><?= _t('gen.action.submit') ?></button>
  481. <button type="reset" class="btn"><?= _t('gen.action.cancel') ?></button>
  482. </div>
  483. </div>
  484. <legend><?= _t('sub.feed.advanced') ?></legend>
  485. <div class="form-group">
  486. <label class="group-name" for="path_entries"><?= _t('sub.feed.css_path') ?></label>
  487. <div class="group-controls">
  488. <div class="stick w100">
  489. <input type="text" name="path_entries" id="path_entries" class="w100" value="<?= $this->feed->pathEntries() ?>"
  490. data-leave-validation="<?= $this->feed->pathEntries() ?>" placeholder="<?= _t('gen.short.blank_to_disable') ?>" />
  491. <a id="popup-preview-selector" class="btn" href="<?=
  492. _url('feed', 'contentSelectorPreview', 'id', $this->feed->id(), 'selector', 'selector-token', 'selector_filter', 'selector-filter-token', '#', 'slider') ?>"><?= _i('look') ?></a>
  493. </div>
  494. <p class="help"><?= _i('help') ?> <?= _t('sub.feed.css_help') ?></p>
  495. </div>
  496. </div>
  497. <div class="form-group">
  498. <?php
  499. $path_entries_filter = Minz_Helper::htmlspecialchars_utf8((string)($this->feed->attributes('path_entries_filter')));
  500. ?>
  501. <label class="group-name" for="path_entries_filter"><?= _t('sub.feed.css_path_filter') ?></label>
  502. <div class="group-controls">
  503. <div class="w100">
  504. <input type="text" name="path_entries_filter" id="path_entries_filter" class="w100" value="<?= $path_entries_filter ?>"
  505. data-leave-validation="<?= $path_entries_filter ?>" placeholder="<?= _t('gen.short.blank_to_disable') ?>" />
  506. </div>
  507. <p class="help"><?= _i('help') ?> <?= _t('sub.feed.css_path_filter.help') ?></p>
  508. </div>
  509. </div>
  510. <div class="form-group">
  511. <label class="group-name" for="curl_params_cookie"><?= _t('sub.feed.css_cookie') ?></label>
  512. <div class="group-controls">
  513. <input type="text" name="curl_params_cookie" id="curl_params_cookie" class="w100" value="<?=
  514. is_array($this->feed->attributes('curl_params')) && !empty($this->feed->attributes('curl_params')[CURLOPT_COOKIE]) ?
  515. $this->feed->attributes('curl_params')[CURLOPT_COOKIE] : ''
  516. ?>" placeholder="<?= _t('gen.short.blank_to_disable') ?>" />
  517. <p class="help"><?= _i('help') ?> <?= _t('sub.feed.css_cookie_help') ?></p>
  518. <label for="curl_params_cookiefile">
  519. <input type="checkbox" name="curl_params_cookiefile" id="curl_params_cookiefile" value="1"<?=
  520. is_array($this->feed->attributes('curl_params')) && isset($this->feed->attributes('curl_params')[CURLOPT_COOKIEFILE]) ?
  521. ' checked="checked"' : ''
  522. ?> />
  523. <?= _t('sub.feed.accept_cookies') ?>
  524. </label>
  525. <p class="help"><?= _i('help') ?> <?= _t('sub.feed.accept_cookies_help') ?></p>
  526. </div>
  527. </div>
  528. <div class="form-group">
  529. <label class="group-name" for="curl_params_redirects"><?= _t('sub.feed.max_http_redir') ?></label>
  530. <div class="group-controls">
  531. <input type="number" name="curl_params_redirects" id="curl_params_redirects" class="w50" min="-1" value="<?=
  532. is_array($this->feed->attributes('curl_params')) && !empty($this->feed->attributes('curl_params')[CURLOPT_MAXREDIRS]) ?
  533. $this->feed->attributes('curl_params')[CURLOPT_MAXREDIRS] : ''
  534. ?>" placeholder="<?= _t('gen.short.blank_to_disable') ?>" />
  535. <p class="help"><?= _i('help') ?> <?= _t('sub.feed.max_http_redir_help') ?></p>
  536. </div>
  537. </div>
  538. <div class="form-group">
  539. <label class="group-name" for="content_action"><?= _t('sub.feed.content_action') ?></label>
  540. <div class="group-controls">
  541. <select name="content_action" id="content_action" class="w50">
  542. <option value="replace"<?= 'replace' === $this->feed->attributes('content_action') ? ' selected="selected"' : '' ?>><?= _t('sub.feed.content_action.replace') ?></option>
  543. <option value="prepend"<?= 'prepend' === $this->feed->attributes('content_action') ? ' selected="selected"' : '' ?>><?= _t('sub.feed.content_action.prepend') ?></option>
  544. <option value="append"<?= 'append' === $this->feed->attributes('content_action') ? ' selected="selected"' : '' ?>><?= _t('sub.feed.content_action.append') ?></option>
  545. </select>
  546. </div>
  547. </div>
  548. <div class="form-group">
  549. <label class="group-name" for="curl_params_useragent"><?= _t('sub.feed.useragent') ?></label>
  550. <div class="group-controls">
  551. <input type="text" name="curl_params_useragent" id="curl_params_useragent" class="w100" value="<?=
  552. is_array($this->feed->attributes('curl_params')) && !empty($this->feed->attributes('curl_params')[CURLOPT_USERAGENT]) ?
  553. $this->feed->attributes('curl_params')[CURLOPT_USERAGENT] : ''
  554. ?>" placeholder="<?= _t('gen.short.blank_to_disable') ?>" />
  555. <p class="help"><?= _i('help') ?> <?= _t('sub.feed.useragent_help') ?></p>
  556. </div>
  557. </div>
  558. <div class="form-group">
  559. <label class="group-name" for="proxy_type"><?= _t('sub.feed.proxy') ?></label>
  560. <div class="group-controls">
  561. <select name="proxy_type" id="proxy_type"><?php
  562. $type = '';
  563. if (is_array($this->feed->attributes('curl_params')) && isset($this->feed->attributes('curl_params')[CURLOPT_PROXYTYPE])) {
  564. $type = $this->feed->attributes('curl_params')[CURLOPT_PROXYTYPE];
  565. }
  566. foreach(['' => '', 3 => 'NONE', 0 => 'HTTP', 2 => 'HTTPS', 4 => 'SOCKS4', 6 => 'SOCKS4A', 5 => 'SOCKS5', 7 => 'SOCKS5H'] as $k => $v) {
  567. echo '<option value="' . $k . ($type === $k ? '" selected="selected' : '' ) . '">' . $v . '</option>';
  568. }
  569. ?>
  570. </select>
  571. <input type="text" name="curl_params" id="curl_params" value="<?=
  572. is_array($this->feed->attributes('curl_params')) && !empty($this->feed->attributes('curl_params')[CURLOPT_PROXY]) ?
  573. $this->feed->attributes('curl_params')[CURLOPT_PROXY] : ''
  574. ?>" placeholder="<?= _t('gen.short.blank_to_disable') ?>" />
  575. <p class="help"><?= _i('help') ?> <?= _t('sub.feed.proxy_help') ?></p>
  576. </div>
  577. </div>
  578. <div class="form-group">
  579. <label class="group-name" for="timeout"><?= _t('sub.feed.timeout') ?></label>
  580. <div class="group-controls">
  581. <input type="number" name="timeout" id="timeout" class="w50" min="3" max="900" value="<?= $this->feed->attributes('timeout') ?>" placeholder="<?= _t('gen.short.by_default') ?>" />
  582. </div>
  583. </div>
  584. <div class="form-group">
  585. <label class="group-name" for="ssl_verify"><?= _t('sub.feed.ssl_verify') ?></label>
  586. <div class="group-controls">
  587. <select name="ssl_verify" id="ssl_verify" class="w50">
  588. <option value=""<?= $this->feed->attributes('ssl_verify') === null ? ' selected="selected"' : '' ?>><?= _t('gen.short.by_default') ?></option>
  589. <option value="0"<?= $this->feed->attributes('ssl_verify') === false ? ' selected="selected"' : '' ?>><?= _t('gen.short.no') ?></option>
  590. <option value="1"<?= $this->feed->attributes('ssl_verify') === true ? ' selected="selected"' : '' ?>><?= _t('gen.short.yes') ?></option>
  591. </select>
  592. </div>
  593. </div>
  594. <div class="form-group">
  595. <div class="group-controls">
  596. <label class="checkbox" for="clear_cache">
  597. <input type="checkbox" name="clear_cache" id="clear_cache" value="1"<?= $this->feed->attributes('clear_cache') ? ' checked="checked"' : '' ?> />
  598. <?= _t('sub.feed.clear_cache') ?>
  599. </label>
  600. </div>
  601. </div>
  602. <div class="form-group form-actions">
  603. <div class="group-controls">
  604. <button type="submit" class="btn btn-important"><?= _t('gen.action.submit') ?></button>
  605. <button type="reset" class="btn"><?= _t('gen.action.cancel') ?></button>
  606. </div>
  607. </div>
  608. </form>
  609. <legend><?= _t('sub.feed.maintenance.title') ?></legend>
  610. <div class="form-group">
  611. <div class="group-controls">
  612. <a class="btn btn-important" href="<?= _url('feed', 'clearCache', 'id', $this->feed->id(), '#', 'slider') ?>">
  613. <?= _t('sub.feed.maintenance.clear_cache') ?>
  614. </a>
  615. <p class="help"><?= _i('help') ?> <?= _t('sub.feed.maintenance.clear_cache_help') ?></p>
  616. </div>
  617. <div class="group-controls">
  618. <form method="post" action="<?= _url('feed', 'reload', '#', 'slider') ?>">
  619. <input type="hidden" name="_csrf" value="<?= FreshRSS_Auth::csrfToken() ?>" />
  620. <input type="hidden" name="id" value="<?= $this->feed->id() ?>" />
  621. <button type="submit" class="btn btn-important">
  622. <?= _t('sub.feed.maintenance.reload_articles') ?>
  623. </button>
  624. <input type="number" name="reload_limit" min="1" value="10" />
  625. <p class="help"><?= _i('help') ?> <?= _t('sub.feed.maintenance.reload_articles_help') ?></p>
  626. </form>
  627. </div>
  628. </div>
  629. </div>
  630. <div id="popup">
  631. <div id="popup-content">
  632. <div id="popup-close" class="popup-row"><?= _i('close') ?></div>
  633. <div id="popup-iframe-container" class="popup-row">
  634. <div id="popup-iframe-sub">
  635. <iframe id="popup-iframe" frameborder="0"></iframe>
  636. </div>
  637. </div>
  638. </div>
  639. </div>