From b9b9f483f54365ecb88572690f308a29d26da31c Mon Sep 17 00:00:00 2001 From: Romain d'Alverny Date: Fri, 14 Jan 2022 19:10:00 +0100 Subject: Import OPML file directly in admin Allows to backup/restore a full opml list. Maybe related to moonmoon/moonmoon#67. --- admin/index.php | 14 ++++++++++++++ admin/subscriptions.php | 10 +++++++++- 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/admin/index.php b/admin/index.php index 153c2ad..76ebb25 100755 --- a/admin/index.php +++ b/admin/index.php @@ -127,6 +127,20 @@ ob_start(); + +
+

+
+

Beware! This will totally erase and replace the list of your feeds just above.

+
+ + + +
+ +
+
+ verify($_POST['_csrf'], 'feedmanage')) { $opmlFile = $PlanetConfig->getOpmlFile(); -if (isset($_POST['opml']) || isset($_POST['add'])) { +if (isset($_POST['upload']) && + isset($_FILES['opml']) && + is_uploaded_file($_FILES['opml']['tmp_name']) && + $_FILES['opml']['size'] > 0) { + OpmlManager::backup($opmlFile); + $newOpml = new Opml(); + $newOpml->parse(file_get_contents($_FILES['opml']['tmp_name'])); + OpmlManager::save($newOpml, $opmlFile); +} elseif (isset($_POST['opml']) || isset($_POST['add'])) { // Load old OPML $oldOpml = OpmlManager::load($opmlFile); if ($PlanetConfig->getName() === '') { -- cgit v1.2.1