index.phtml 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. <?php
  2. declare(strict_types=1);
  3. /** @var FreshRSS_View $this */
  4. $this->partial('aside_subscription');
  5. ?>
  6. <main class="post ">
  7. <h1><?= _t('sub.menu.import_export') ?></h1>
  8. <h2><?= _t('sub.category.dynamic_opml') ?></h2>
  9. <div class="form-group form-actions">
  10. <div class="group-controls">
  11. <ul>
  12. <li><a href="<?= _url('subscription', 'add') ?>"><?= _t('sub.title.add_dynamic_opml') ?> <?= _i('opml-dyn') ?></a></li>
  13. </ul>
  14. </div>
  15. </div>
  16. <h2><?= _t('sub.import_export.import') ?></h2>
  17. <form method="post" action="<?= _url('importExport', 'import') ?>" enctype="multipart/form-data">
  18. <input type="hidden" name="_csrf" value="<?= FreshRSS_Auth::csrfToken() ?>" />
  19. <div class="form-group">
  20. <label class="group-name" for="file">
  21. <?= extension_loaded('zip') ? _t('sub.import_export.file_to_import') : _t('sub.import_export.file_to_import_no_zip') ?>
  22. </label>
  23. <div class="group-controls">
  24. <input type="file" name="file" id="file" />
  25. </div>
  26. </div>
  27. <div class="form-group form-actions">
  28. <div class="group-controls">
  29. <button type="submit" class="btn btn-important"><?= _t('gen.action.import') ?></button>
  30. </div>
  31. </div>
  32. </form>
  33. <h2><?= _t('sub.import_export.export') ?></h2>
  34. <?php if (count($this->feeds) > 0) { ?>
  35. <form method="post" action="<?= _url('importExport', 'export') ?>">
  36. <input type="hidden" name="_csrf" value="<?= FreshRSS_Auth::csrfToken() ?>" />
  37. <div class="form-group">
  38. <div class="group-controls">
  39. <label class="checkbox" for="export_opml">
  40. <input type="checkbox" name="export_opml" id="export_opml" value="1" checked="checked" />
  41. <?= _t('sub.import_export.export_opml') ?>
  42. </label>
  43. <label class="checkbox" for="export_labelled">
  44. <input type="checkbox" name="export_labelled" id="export_labelled" value="1" <?= extension_loaded('zip') ? 'checked="checked"' : '' ?> />
  45. <?= _t('sub.import_export.export_labelled') ?>
  46. </label>
  47. <label class="checkbox" for="export_starred">
  48. <input type="checkbox" name="export_starred" id="export_starred" value="1" <?= extension_loaded('zip') ? 'checked="checked"' : '' ?> />
  49. <?= _t('sub.import_export.export_starred') ?>
  50. </label>
  51. <?php
  52. $select_args = '';
  53. if (extension_loaded('zip')) {
  54. $select_args = ' size="' . min(10, count($this->feeds)) . '" multiple="multiple"';
  55. }
  56. ?>
  57. <select name="export_feeds[]"<?= $select_args ?>>
  58. <?= extension_loaded('zip') ? '' : '<option></option>' ?>
  59. <?php foreach ($this->feeds as $feed) { ?>
  60. <option value="<?= $feed->id() ?>"><?= $feed->name() ?></option>
  61. <?php } ?>
  62. </select>
  63. </div>
  64. </div>
  65. <div class="form-group form-actions">
  66. <div class="group-controls">
  67. <button type="submit" class="btn btn-important"><?= _t('gen.action.export') ?></button>
  68. </div>
  69. </div>
  70. </form>
  71. <?php } ?>
  72. <h2><?= _t('sub.import_export.export.sqlite') ?></h2>
  73. <?php if (count($this->sqliteArchives ?? []) === 0): ?>
  74. <p class="alert alert-warn">
  75. <?= _t('gen.short.not_applicable') ?>
  76. </p>
  77. <?php else: ?>
  78. <form method="post" action="<?= _url('importExport', 'sqlite') ?>">
  79. <input type="hidden" name="_csrf" value="<?= FreshRSS_Auth::csrfToken() ?>" />
  80. <div class="form-group">
  81. <div class="group-controls">
  82. <select name="sqlite">
  83. <?php foreach ($this->sqliteArchives ?? [] as $sqliteArchive): ?>
  84. <option value="<?= htmlspecialchars($sqliteArchive['name'], ENT_COMPAT, 'UTF-8') ?>">
  85. <?= htmlspecialchars($sqliteArchive['name'], ENT_NOQUOTES, 'UTF-8') ?>
  86. <small>(<?= format_bytes($sqliteArchive['size']) ?> · <?= date('c', $sqliteArchive['mtime']) ?>)</small>
  87. </option>
  88. <?php endforeach; ?>
  89. </select>
  90. </div>
  91. </div>
  92. <div class="form-group form-actions">
  93. <div class="group-controls">
  94. <button type="submit" class="btn btn-important"><?= _t('gen.action.download') ?></button>
  95. </div>
  96. </div>
  97. </form>
  98. <?php endif; ?>
  99. </main>