Merge branch 'nocontent' of git://github.com/doubleface/miniflux
This commit is contained in:
commit
e93517274f
@ -135,6 +135,10 @@ label {
|
|||||||
display: block;
|
display: block;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.inline-label {
|
||||||
|
display: inline;
|
||||||
|
}
|
||||||
|
|
||||||
input {
|
input {
|
||||||
-webkit-appearance: none;
|
-webkit-appearance: none;
|
||||||
}
|
}
|
||||||
|
@ -10,7 +10,7 @@ require 'schema.php';
|
|||||||
require 'model.php';
|
require 'model.php';
|
||||||
|
|
||||||
|
|
||||||
const DB_VERSION = 6;
|
const DB_VERSION = 7;
|
||||||
const APP_VERSION = 'master';
|
const APP_VERSION = 'master';
|
||||||
const APP_USERAGENT = 'Miniflux - http://miniflux.net';
|
const APP_USERAGENT = 'Miniflux - http://miniflux.net';
|
||||||
const HTTP_TIMEOUT = 5;
|
const HTTP_TIMEOUT = 5;
|
||||||
|
@ -361,7 +361,7 @@ Router\get_action('config', function() {
|
|||||||
|
|
||||||
Router\post_action('config', function() {
|
Router\post_action('config', function() {
|
||||||
|
|
||||||
$values = Request\values();
|
$values = Request\values() + array('nocontent' => 0);
|
||||||
list($valid, $errors) = Model\validate_config_update($values);
|
list($valid, $errors) = Model\validate_config_update($values);
|
||||||
|
|
||||||
if ($valid) {
|
if ($valid) {
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
return array(
|
return array(
|
||||||
|
'Do not fetch the content of articles (and remove it content for previous entries)' =>
|
||||||
|
'Ne pas récupérer le contenu des articles (et supprimer ce contenu pour les articles précédents',
|
||||||
'Remove automatically read items' => 'Supprimer automatiquement les éléments lus',
|
'Remove automatically read items' => 'Supprimer automatiquement les éléments lus',
|
||||||
'Never' => 'Jamais',
|
'Never' => 'Jamais',
|
||||||
'After %d day' => 'Après %d jour',
|
'After %d day' => 'Après %d jour',
|
||||||
|
13
model.php
13
model.php
@ -137,7 +137,6 @@ function update_feeds($limit = LIMIT_ALL)
|
|||||||
$feeds_id = get_feeds_id($limit);
|
$feeds_id = get_feeds_id($limit);
|
||||||
|
|
||||||
foreach ($feeds_id as $feed_id) {
|
foreach ($feeds_id as $feed_id) {
|
||||||
|
|
||||||
update_feed($feed_id);
|
update_feed($feed_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -406,6 +405,8 @@ function autoflush()
|
|||||||
|
|
||||||
function update_items($feed_id, array $items)
|
function update_items($feed_id, array $items)
|
||||||
{
|
{
|
||||||
|
$nocontent = (bool)\PicoTools\singleton('db')->table('config')->findOneColumn('nocontent');
|
||||||
|
|
||||||
$items_in_feed = array();
|
$items_in_feed = array();
|
||||||
$db = \PicoTools\singleton('db');
|
$db = \PicoTools\singleton('db');
|
||||||
|
|
||||||
@ -418,6 +419,7 @@ function update_items($feed_id, array $items)
|
|||||||
|
|
||||||
// Insert only new item
|
// Insert only new item
|
||||||
if ($db->table('items')->eq('id', $item->id)->count() !== 1) {
|
if ($db->table('items')->eq('id', $item->id)->count() !== 1) {
|
||||||
|
$content = $nocontent ? '' : $item->content;
|
||||||
|
|
||||||
$db->table('items')->save(array(
|
$db->table('items')->save(array(
|
||||||
'id' => $item->id,
|
'id' => $item->id,
|
||||||
@ -425,7 +427,7 @@ function update_items($feed_id, array $items)
|
|||||||
'url' => $item->url,
|
'url' => $item->url,
|
||||||
'updated' => $item->updated,
|
'updated' => $item->updated,
|
||||||
'author' => $item->author,
|
'author' => $item->author,
|
||||||
'content' => $item->content,
|
'content' => $content,
|
||||||
'status' => 'unread',
|
'status' => 'unread',
|
||||||
'feed_id' => $feed_id
|
'feed_id' => $feed_id
|
||||||
));
|
));
|
||||||
@ -456,7 +458,7 @@ function get_config()
|
|||||||
{
|
{
|
||||||
return \PicoTools\singleton('db')
|
return \PicoTools\singleton('db')
|
||||||
->table('config')
|
->table('config')
|
||||||
->columns('username', 'language', 'autoflush')
|
->columns('username', 'language', 'autoflush', 'nocontent')
|
||||||
->findOne();
|
->findOne();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -551,5 +553,10 @@ function save_config(array $values)
|
|||||||
|
|
||||||
\PicoTools\Translator\load($values['language']);
|
\PicoTools\Translator\load($values['language']);
|
||||||
|
|
||||||
|
// if the user does not want content of feeds, remote it in previous ones
|
||||||
|
if ((bool)$values['nocontent']) {
|
||||||
|
\PicoTools\singleton('db')->table('items')->update(array('content'=>''));
|
||||||
|
}
|
||||||
|
|
||||||
return \PicoTools\singleton('db')->table('config')->update($values);
|
return \PicoTools\singleton('db')->table('config')->update($values);
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,10 @@
|
|||||||
|
|
||||||
namespace Schema;
|
namespace Schema;
|
||||||
|
|
||||||
|
function version_7($pdo)
|
||||||
|
{
|
||||||
|
$pdo->exec('ALTER TABLE config ADD COLUMN nocontent INTEGER');
|
||||||
|
}
|
||||||
|
|
||||||
function version_6($pdo)
|
function version_6($pdo)
|
||||||
{
|
{
|
||||||
|
@ -19,6 +19,9 @@
|
|||||||
<?= Helper\form_label(t('Remove automatically read items'), 'autoflush') ?>
|
<?= Helper\form_label(t('Remove automatically read items'), 'autoflush') ?>
|
||||||
<?= Helper\form_select('autoflush', $autoflush_options, $values, $errors) ?><br/>
|
<?= Helper\form_select('autoflush', $autoflush_options, $values, $errors) ?><br/>
|
||||||
|
|
||||||
|
<?= Helper\form_label(t('Do not fetch the content of articles (and remove it content for previous entries)'), 'nocontent', "inline-label") ?>
|
||||||
|
<?= Helper\form_checkbox('nocontent', $values) ?><br />
|
||||||
|
|
||||||
<div class="form-actions">
|
<div class="form-actions">
|
||||||
<input type="submit" value="<?= t('Update') ?>" class="btn btn-blue"/>
|
<input type="submit" value="<?= t('Update') ?>" class="btn btn-blue"/>
|
||||||
</div>
|
</div>
|
||||||
|
6
vendor/PicoTools/Helper.php
vendored
6
vendor/PicoTools/Helper.php
vendored
@ -182,6 +182,12 @@ function form_radio($name, $label, $value, $selected = false, $class = '')
|
|||||||
return '<label><input type="radio" name="'.$name.'" class="'.$class.'" value="'.escape($value).'" '.($selected ? 'selected="selected"' : '').'>'.escape($label).'</label>';
|
return '<label><input type="radio" name="'.$name.'" class="'.$class.'" value="'.escape($value).'" '.($selected ? 'selected="selected"' : '').'>'.escape($label).'</label>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function form_checkbox($name, $values, $class = '' )
|
||||||
|
{
|
||||||
|
$checkedstr = (bool)$values[$name] ? 'checked' : '';
|
||||||
|
return '<input type="checkbox" value="1" name="'.$name.'" class="'.$class.'"'.$checkedstr.'>';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
function form_label($label, $name, $class = '')
|
function form_label($label, $name, $class = '')
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user