update.phtml 44 KB

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