From e3de9d7dd1331f9718e04cc98e9ca7cfa27cf4aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20L=C3=A9cureuil?= Date: Sun, 17 May 2020 14:46:00 +0200 Subject: Sync with master of moonmoon ( version 9.0.0-rc) Source from https://github.com/Emmafrs/moonmoon/ --- common/admin/subscriptions.php | 30 ++++++++++++++++++++---------- 1 file changed, 20 insertions(+), 10 deletions(-) (limited to 'common/admin/subscriptions.php') diff --git a/common/admin/subscriptions.php b/common/admin/subscriptions.php index ea2f113..f0fd896 100755 --- a/common/admin/subscriptions.php +++ b/common/admin/subscriptions.php @@ -1,21 +1,24 @@ verify($_POST['_csrf'], 'feedmanage')) { + die('Invalid CSRF token!'); +} + if (isset($_POST['opml']) || isset($_POST['add'])) { - // Load config and old OPML - $conf = Spyc::YAMLLoad(dirname(__FILE__).'/../custom/config.yml'); - $PlanetConfig = new PlanetConfig($conf); + // Load old OPML + $oldOpml = OpmlManager::load(__DIR__.'/../custom/people.opml'); if ($PlanetConfig->getName() === '') { $PlanetConfig->setName($oldOpml->getTitle()); } - $oldOpml = OpmlManager::load(dirname(__FILE__).'/../custom/people.opml'); - $newOpml = new opml(); + $newOpml = new Opml(); $newOpml->title = $PlanetConfig->getName(); // Remove slashes if needed @@ -43,11 +46,18 @@ if (isset($_POST['opml']) || isset($_POST['add'])) { $feed = new SimplePie(); $feed->enable_cache(false); $feed->set_feed_url($_POST['url']); + if ($conf['checkcerts'] === false) { + $feed->set_curl_options([ + CURLOPT_SSL_VERIFYHOST => false, + CURLOPT_SSL_VERIFYPEER => false + ]); + } $feed->init(); $feed->handle_content_type(); - $person['name'] = $feed->get_title(); + $person['name'] = html_entity_decode($feed->get_title()); $person['website'] = $feed->get_permalink(); $person['feed'] = $feed->feed_url; + $person['isDown'] = '0'; $oldOpml->entries[] = $person; } @@ -55,10 +65,10 @@ if (isset($_POST['opml']) || isset($_POST['add'])) { } // Backup old OPML - OpmlManager::backup(dirname(__FILE__).'/../custom/people.opml'); + OpmlManager::backup(__DIR__.'/../custom/people.opml'); // Save new OPML - OpmlManager::save($newOpml, dirname(__FILE__).'/../custom/people.opml'); + OpmlManager::save($newOpml, __DIR__.'/../custom/people.opml'); } header("Location: index.php"); die(); -- cgit v1.2.1