update.phtml 30 KB

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