82df35a59b
This is a major change for the next release of Miniflux. - There is now only one database that can supports multiple users - There is no automated schema migration for this release - A migration procedure is available in the ChangeLog file
41 lines
1.2 KiB
PHP
41 lines
1.2 KiB
PHP
<?php
|
|
|
|
namespace Miniflux\Controller;
|
|
|
|
use Exception;
|
|
use Miniflux\Router;
|
|
use Miniflux\Response;
|
|
use Miniflux\Request;
|
|
use Miniflux\Session\SessionStorage;
|
|
use Miniflux\Template;
|
|
use Miniflux\Handler;
|
|
|
|
// OPML export
|
|
Router\get_action('export', function () {
|
|
$user_id = SessionStorage::getInstance()->getUserId();
|
|
Response\force_download('feeds.opml');
|
|
Response\xml(Handler\Opml\export_all_feeds($user_id));
|
|
});
|
|
|
|
// OPML import form
|
|
Router\get_action('import', function () {
|
|
Response\html(Template\layout('import', array(
|
|
'errors' => array(),
|
|
'menu' => 'feeds',
|
|
'title' => t('OPML Import')
|
|
)));
|
|
});
|
|
|
|
// OPML importation
|
|
Router\post_action('import', function () {
|
|
try {
|
|
$user_id = SessionStorage::getInstance()->getUserId();
|
|
Handler\Opml\import_opml($user_id, Request\file_content('file'));
|
|
SessionStorage::getInstance()->setFlashMessage(t('Your feeds have been imported.'));
|
|
Response\redirect('?action=feeds');
|
|
} catch (Exception $e) {
|
|
SessionStorage::getInstance()->setFlashErrorMessage(t('Unable to import your OPML file.').' ('.$e->getMessage().')');
|
|
Response\redirect('?action=import');
|
|
}
|
|
});
|