miniflux-legacy/app/controllers/services.php
Frederic Guillot 82df35a59b Change the database structure to have a single database
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
2016-12-26 09:51:38 -05:00

39 lines
1.2 KiB
PHP

<?php
namespace Miniflux\Controller;
use Miniflux\Model;
use Miniflux\Router;
use Miniflux\Response;
use Miniflux\Request;
use Miniflux\Session\SessionStorage;
use Miniflux\Template;
use Miniflux\Helper;
// Display bookmark services page
Router\get_action('services', function () {
$user_id = SessionStorage::getInstance()->getUserId();
Response\html(Template\layout('services', array(
'errors' => array(),
'values' => Model\Config\get_all($user_id) + array('csrf' => Helper\generate_csrf()),
'menu' => 'config',
'title' => t('Preferences')
)));
});
// Update bookmark services
Router\post_action('services', function () {
$user_id = SessionStorage::getInstance()->getUserId();
$values = Request\values() + array('pinboard_enabled' => 0, 'instapaper_enabled' => 0, 'wallabag_enabled' => 0);
Helper\check_csrf_values($values);
if (Model\Config\save($user_id, $values)) {
SessionStorage::getInstance()->setFlashMessage(t('Your preferences are updated.'));
} else {
SessionStorage::getInstance()->setFlashErrorMessage(t('Unable to update your preferences.'));
}
Response\redirect('?action=services');
});