add.phtml 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294
  1. <?php
  2. /** @var FreshRSS_View $this */
  3. $this->partial('aside_subscription');
  4. ?>
  5. <main class="post drop-section">
  6. <div class="link-back-wrapper">
  7. <a class="link-back" href="<?= _url('index', 'index') ?>"><?= _t('gen.action.back_to_rss_feeds') ?></a>
  8. </div>
  9. <h1><?= _t('sub.menu.add') ?></h1>
  10. <h2><?= _t('sub.title.add_category') ?></h2>
  11. <form action="<?= _url('category', 'create') ?>" method="post">
  12. <input type="hidden" name="_csrf" value="<?= FreshRSS_Auth::csrfToken() ?>" />
  13. <div class="form-group">
  14. <label class="group-name" for="new-category"><?= _t('sub.category') ?></label>
  15. <div class="group-controls">
  16. <input id="new-category" name="new-category" type="text" required="required" autocomplete="off" />
  17. </div>
  18. </div>
  19. <div class="form-group form-actions">
  20. <div class="group-controls">
  21. <button type="submit" class="btn btn-important"><?= _t('gen.action.add') ?></button>
  22. </div>
  23. </div>
  24. </form>
  25. <h2><?= _t('sub.title.add_feed') ?></h2>
  26. <form id="add_rss" method="post" action="<?= _url('feed', 'add') ?>" autocomplete="off">
  27. <input type="hidden" name="_csrf" value="<?= FreshRSS_Auth::csrfToken() ?>" />
  28. <div class="form-group">
  29. <label class="group-name" for="url_rss"><?= _t('sub.feed.url') ?></label>
  30. <div class="group-controls">
  31. <div class="stick">
  32. <input id="url_rss" name="url_rss" type="url" required="required" autocomplete="off" class="long" autofocus="autofocus" />
  33. <a class="btn open-url" target="_blank" rel="noreferrer" href="" data-input="url_rss" title="<?= _t('gen.action.open_url') ?>"><?= _i('link') ?></a>
  34. </div>
  35. </div>
  36. </div>
  37. <div class="form-group">
  38. <label class="group-name" for="category"><?= _t('sub.category') ?></label>
  39. <div class="group-controls">
  40. <select name="category" id="category">
  41. <?php
  42. foreach ($this->categories as $cat) {
  43. if ($cat->kind() == FreshRSS_Category::KIND_DYNAMIC_OPML) {
  44. continue;
  45. }
  46. ?>
  47. <option value="<?= $cat->id() ?>"<?= $cat->id() === (Minz_Request::paramInt('cat_id') ?: 1) ? ' selected="selected"' : '' ?>>
  48. <?= $cat->name() ?>
  49. </option>
  50. <?php } ?>
  51. </select>
  52. </div>
  53. </div>
  54. <details class="form-advanced">
  55. <summary class="form-advanced-title">
  56. <?= _t('sub.feed.kind') ?>
  57. </summary>
  58. <div class="form-group">
  59. <label class="group-name" for="feed_kind"><?= _t('sub.feed.kind') ?></label>
  60. <div class="group-controls">
  61. <select name="feed_kind" id="feed_kind" class="select-show">
  62. <option value="<?= FreshRSS_Feed::KIND_RSS ?>" selected="selected"><?= _t('sub.feed.kind.rss') ?></option>
  63. <option value="<?= FreshRSS_Feed::KIND_HTML_XPATH ?>" data-show="html_xpath"><?= _t('sub.feed.kind.html_xpath') ?></option>
  64. <option value="<?= FreshRSS_Feed::KIND_XML_XPATH ?>" data-show="html_xpath"><?= _t('sub.feed.kind.xml_xpath') ?></option>
  65. </select>
  66. </div>
  67. </div>
  68. <fieldset id="html_xpath">
  69. <p class="help"><?= _i('help') ?> <?= _t('sub.feed.kind.html_xpath.help') ?></p>
  70. <div class="form-group">
  71. <label class="group-name" for="xPathFeedTitle"><small><?= _t('sub.feed.kind.html_xpath.xpath') ?></small><br />
  72. <?= _t('sub.feed.kind.html_xpath.feed_title') ?></label>
  73. <div class="group-controls">
  74. <textarea class="valid-xpath" name="xPathFeedTitle" id="xPathFeedTitle" rows="2" cols="64" spellcheck="false">//title</textarea>
  75. <p class="help"><?= _i('help') ?> <?= _t('sub.feed.kind.html_xpath.feed_title.help') ?></p>
  76. </div>
  77. </div>
  78. <div class="form-group">
  79. <label class="group-name" for="xPathItem"><small><?= _t('sub.feed.kind.html_xpath.xpath') ?></small><br />
  80. <?= _t('sub.feed.kind.html_xpath.item') ?></label>
  81. <div class="group-controls">
  82. <textarea class="valid-xpath" name="xPathItem" id="xPathItem" rows="2" cols="64" spellcheck="false"></textarea>
  83. <p class="help"><?= _i('help') ?> <?= _t('sub.feed.kind.html_xpath.item.help') ?></p>
  84. </div>
  85. </div>
  86. <div class="form-group">
  87. <label class="group-name" for="xPathItemTitle"><small><?= _t('sub.feed.kind.html_xpath.relative') ?></small><br />
  88. <?= _t('sub.feed.kind.html_xpath.item_title') ?></label>
  89. <div class="group-controls">
  90. <textarea class="valid-xpath" name="xPathItemTitle" id="xPathItemTitle" rows="2" cols="64" spellcheck="false"></textarea>
  91. <p class="help"><?= _i('help') ?> <?= _t('sub.feed.kind.html_xpath.item_title.help') ?></p>
  92. </div>
  93. </div>
  94. <div class="form-group">
  95. <label class="group-name" for="xPathItemContent"><small><?= _t('sub.feed.kind.html_xpath.relative') ?></small><br />
  96. <?= _t('sub.feed.kind.html_xpath.item_content') ?></label>
  97. <div class="group-controls">
  98. <textarea class="valid-xpath" name="xPathItemContent" id="xPathItemContent" rows="2" cols="64" spellcheck="false"></textarea>
  99. <p class="help"><?= _i('help') ?> <?= _t('sub.feed.kind.html_xpath.item_content.help') ?></p>
  100. </div>
  101. </div>
  102. <div class="form-group">
  103. <label class="group-name" for="xPathItemUri"><small><?= _t('sub.feed.kind.html_xpath.relative') ?></small><br />
  104. <?= _t('sub.feed.kind.html_xpath.item_uri') ?></label>
  105. <div class="group-controls">
  106. <textarea class="valid-xpath" name="xPathItemUri" id="xPathItemUri" rows="2" cols="64" spellcheck="false"></textarea>
  107. <p class="help"><?= _i('help') ?> <?= _t('sub.feed.kind.html_xpath.item_uri.help') ?></p>
  108. </div>
  109. </div>
  110. <div class="form-group">
  111. <label class="group-name" for="xPathItemThumbnail"><small><?= _t('sub.feed.kind.html_xpath.relative') ?></small><br />
  112. <?= _t('sub.feed.kind.html_xpath.item_thumbnail') ?></label>
  113. <div class="group-controls">
  114. <textarea class="valid-xpath" name="xPathItemThumbnail" id="xPathItemThumbnail" rows="2" cols="64" spellcheck="false"></textarea>
  115. <p class="help"><?= _i('help') ?> <?= _t('sub.feed.kind.html_xpath.item_thumbnail.help') ?></p>
  116. </div>
  117. </div>
  118. <div class="form-group">
  119. <label class="group-name" for="xPathItemAuthor"><small><?= _t('sub.feed.kind.html_xpath.relative') ?></small><br />
  120. <?= _t('sub.feed.kind.html_xpath.item_author') ?></label>
  121. <div class="group-controls">
  122. <textarea class="valid-xpath" name="xPathItemAuthor" id="xPathItemAuthor" rows="2" cols="64" spellcheck="false"></textarea>
  123. <p class="help"><?= _i('help') ?> <?= _t('sub.feed.kind.html_xpath.item_author.help') ?></p>
  124. </div>
  125. </div>
  126. <div class="form-group">
  127. <label class="group-name" for="xPathItemTimestamp"><small><?= _t('sub.feed.kind.html_xpath.relative') ?></small><br />
  128. <?= _t('sub.feed.kind.html_xpath.item_timestamp') ?></label>
  129. <div class="group-controls">
  130. <textarea class="valid-xpath" name="xPathItemTimestamp" id="xPathItemTimestamp" rows="2" cols="64" spellcheck="false"></textarea>
  131. <p class="help"><?= _i('help') ?> <?= _t('sub.feed.kind.html_xpath.item_timestamp.help') ?></p>
  132. </div>
  133. </div>
  134. <div class="form-group">
  135. <label class="group-name" for="xPathItemTimeFormat">
  136. <?= _t('sub.feed.kind.html_xpath.item_timeFormat') ?></label>
  137. <div class="group-controls">
  138. <textarea name="xPathItemTimeFormat" id="xPathItemTimeFormat" rows="2" cols="64" spellcheck="false"></textarea>
  139. <p class="help"><?= _i('help') ?> <?= _t('sub.feed.kind.html_xpath.item_timeFormat.help') ?></p>
  140. </div>
  141. </div>
  142. <div class="form-group">
  143. <label class="group-name" for="xPathItemCategories"><small><?= _t('sub.feed.kind.html_xpath.relative') ?></small><br />
  144. <?= _t('sub.feed.kind.html_xpath.item_categories') ?></label>
  145. <div class="group-controls">
  146. <textarea class="valid-xpath" name="xPathItemCategories" id="xPathItemCategories" rows="2" cols="64" spellcheck="false"></textarea>
  147. </div>
  148. </div>
  149. <div class="form-group">
  150. <label class="group-name" for="xPathItemUid"><small><?= _t('sub.feed.kind.html_xpath.relative') ?></small><br />
  151. <?= _t('sub.feed.kind.html_xpath.item_uid') ?></label>
  152. <div class="group-controls">
  153. <textarea class="valid-xpath" name="xPathItemUid" id="xPathItemUid" rows="2" cols="64" spellcheck="false"></textarea>
  154. </div>
  155. </div>
  156. </fieldset>
  157. </details>
  158. <details class="form-advanced">
  159. <summary class="form-advanced-title">
  160. <?= _t('sub.feed.advanced') ?>
  161. </summary>
  162. <div class="form-group">
  163. <label class="group-name" for="http_user"><?= _t('sub.feed.auth.username') ?></label>
  164. <div class="group-controls">
  165. <input id="http_user" name="http_user" type="text" autocomplete="off"/>
  166. </div>
  167. </div>
  168. <div class="form-group">
  169. <label class="group-name" for="http_pass"><?= _t('sub.feed.auth.password') ?></label>
  170. <div class="group-controls">
  171. <div class="stick">
  172. <input id="http_pass" name="http_pass" type="password" value="" autocomplete="new-password" />
  173. <button type="button" class="btn toggle-password" data-toggle="http_pass"><?= _i('key') ?></button>
  174. </div>
  175. </div>
  176. </div>
  177. <div class="form-group">
  178. <label class="group-name" for="curl_params_cookie"><?= _t('sub.feed.css_cookie') ?></label>
  179. <div class="group-controls">
  180. <input type="text" name="curl_params_cookie" id="curl_params_cookie" value="" placeholder="<?= _t('gen.short.blank_to_disable') ?>" />
  181. <p class="help"><?= _i('help') ?> <?= _t('sub.feed.css_cookie_help') ?></p>
  182. <label for="curl_params_cookiefile">
  183. <input type="checkbox" name="curl_params_cookiefile" id="curl_params_cookiefile" value="1" />
  184. <?= _t('sub.feed.accept_cookies') ?>
  185. </label>
  186. <p class="help"><?= _i('help') ?> <?= _t('sub.feed.accept_cookies_help') ?></p>
  187. </div>
  188. </div>
  189. <div class="form-group">
  190. <label class="group-name" for="curl_params_redirects"><?= _t('sub.feed.max_http_redir') ?></label>
  191. <div class="group-controls">
  192. <input type="number" name="curl_params_redirects" id="curl_params_redirects" min="-1" value="" placeholder="<?= _t('gen.short.blank_to_disable') ?>" />
  193. <p class="help"><?= _i('help') ?> <?= _t('sub.feed.max_http_redir_help') ?></p>
  194. </div>
  195. </div>
  196. <div class="form-group">
  197. <label class="group-name" for="curl_params_useragent"><?= _t('sub.feed.useragent') ?></label>
  198. <div class="group-controls">
  199. <div class="stick">
  200. <input type="text" name="curl_params_useragent" id="curl_params_useragent" value="" placeholder="<?= _t('gen.short.blank_to_disable') ?>" />
  201. </div>
  202. <p class="help"><?= _i('help') ?> <?= _t('sub.feed.useragent_help') ?></p>
  203. </div>
  204. </div>
  205. <div class="form-group">
  206. <label class="group-name" for="proxy_type"><?= _t('sub.feed.proxy') ?></label>
  207. <div class="group-controls">
  208. <select class="number" name="proxy_type" id="proxy_type"><?php
  209. foreach(['' => '', 3 => 'NONE', 0 => 'HTTP', 2 => 'HTTPS', 4 => 'SOCKS4', 6 => 'SOCKS4A', 5 => 'SOCKS5', 7 => 'SOCKS5H'] as $k => $v) {
  210. echo '<option value="' . $k . '">' . $v . '</option>';
  211. }
  212. ?>
  213. </select>
  214. <div class="stick">
  215. <input type="text" name="curl_params" id="curl_params" value="" placeholder="<?= _t('gen.short.blank_to_disable') ?>" />
  216. </div>
  217. <p class="help"><?= _i('help') ?> <?= _t('sub.feed.proxy_help') ?></p>
  218. </div>
  219. </div>
  220. <div class="form-group">
  221. <label class="group-name" for="timeout"><?= _t('sub.feed.timeout') ?></label>
  222. <div class="group-controls">
  223. <input type="number" name="timeout" id="timeout" min="3" max="900" value="" placeholder="<?= _t('gen.short.by_default') ?>" />
  224. </div>
  225. </div>
  226. <div class="form-group">
  227. <label class="group-name" for="ssl_verify"><?= _t('sub.feed.ssl_verify') ?></label>
  228. <div class="group-controls">
  229. <select name="ssl_verify" id="ssl_verify">
  230. <option value=""><?= _t('gen.short.by_default') ?></option>
  231. <option value="0"><?= _t('gen.short.no') ?></option>
  232. <option value="1"><?= _t('gen.short.yes') ?></option>
  233. </select>
  234. </div>
  235. </div>
  236. </details>
  237. <div class="form-group form-actions">
  238. <div class="group-controls">
  239. <button type="submit" class="btn btn-important"><?= _t('gen.action.add') ?></button>
  240. </div>
  241. </div>
  242. </form>
  243. <h2>
  244. <?= _t('sub.title.add_dynamic_opml') ?>
  245. <?= _i('opml-dyn') ?>
  246. </h2>
  247. <form action="<?= _url('category', 'create') ?>" method="post">
  248. <input type="hidden" name="_csrf" value="<?= FreshRSS_Auth::csrfToken() ?>" />
  249. <div class="form-group">
  250. <label class="group-name" for="new-category"><?= _t('sub.category') ?></label>
  251. <div class="group-controls">
  252. <input id="new-category" name="new-category" type="text" required="required" autocomplete="off" />
  253. </div>
  254. </div>
  255. <div class="form-group">
  256. <label class="group-name" for="opml_url"><?= _t('sub.category.opml_url') ?></label>
  257. <div class="group-controls">
  258. <div class="stick">
  259. <input id="opml_url" name="opml_url" type="url" required="required" autocomplete="off" class="long" />
  260. <a class="btn open-url" target="_blank" rel="noreferrer" href="" data-input="opml_url" title="<?= _t('gen.action.open_url') ?>"><?= _i('link') ?></a>
  261. </div>
  262. <p class="help"><?= _i('help') ?> <?= _t('sub.category.dynamic_opml.help') ?></p>
  263. </div>
  264. </div>
  265. <div class="form-group form-actions">
  266. <div class="group-controls">
  267. <button type="submit" class="btn btn-important"><?= _t('gen.action.add') ?></button>
  268. </div>
  269. </div>
  270. </form>
  271. </main>