2016-12-26 15:44:53 +01:00
|
|
|
<?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();
|
|
|
|
|
2017-01-21 20:40:24 +01:00
|
|
|
Response\html(Template\layout('config/services', array(
|
2016-12-26 15:44:53 +01:00
|
|
|
'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();
|
2017-06-11 16:12:29 +02:00
|
|
|
$values = Request\values() + array('pinboard_enabled' => 0,
|
2017-06-12 23:59:51 +02:00
|
|
|
'pinboard_mark_unread' => 0,
|
2017-06-11 16:12:29 +02:00
|
|
|
'instapaper_enabled' => 0,
|
|
|
|
'wallabag_enabled' => 0,
|
|
|
|
'shaarli_enabled' => 0,
|
2017-06-12 23:59:51 +02:00
|
|
|
'shaarli_private' => 0);
|
2016-12-26 15:44:53 +01:00
|
|
|
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');
|
|
|
|
});
|