mirror of
https://github.com/FreshRSS/FreshRSS.git
synced 2026-04-04 22:53:27 -04:00
Merge branch 'dev' into 411-update-system
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
* UI
|
||||
* Hide categories/feeds with unread articles when showing only unread articles
|
||||
* Dynamic favicon showing the number of unread articles
|
||||
* New theme: Screwdriver by Mister aiR
|
||||
* Statistics
|
||||
* New page with article repartition
|
||||
* Improvements
|
||||
@@ -12,6 +13,7 @@
|
||||
* Basic protection against XSRF (Cross-Site Request Forgery) based on HTTP Referer (POST requests only)
|
||||
* Misc.
|
||||
* Changed lazyload implementation
|
||||
* Support of HTML5 notifications for new upcoming articles
|
||||
* Bux fixes in export function, add/remove users, keyboard shortcuts, etc.
|
||||
|
||||
|
||||
|
||||
@@ -184,6 +184,7 @@ class FreshRSS_configure_Controller extends Minz_ActionController {
|
||||
$this->view->conf->_default_view((int)Minz_Request::param('default_view', FreshRSS_Entry::STATE_ALL));
|
||||
$this->view->conf->_auto_load_more(Minz_Request::param('auto_load_more', false));
|
||||
$this->view->conf->_display_posts(Minz_Request::param('display_posts', false));
|
||||
$this->view->conf->_hide_read_feeds(Minz_Request::param('hide_read_feeds', false));
|
||||
$this->view->conf->_onread_jump_next(Minz_Request::param('onread_jump_next', false));
|
||||
$this->view->conf->_lazyload(Minz_Request::param('lazyload', false));
|
||||
$this->view->conf->_sticky_post(Minz_Request::param('sticky_post', false));
|
||||
|
||||
@@ -17,6 +17,7 @@ class FreshRSS_Configuration {
|
||||
'default_view' => FreshRSS_Entry::STATE_NOT_READ,
|
||||
'auto_load_more' => true,
|
||||
'display_posts' => false,
|
||||
'hide_read_feeds' => true,
|
||||
'onread_jump_next' => true,
|
||||
'lazyload' => true,
|
||||
'sticky_post' => true,
|
||||
@@ -141,6 +142,9 @@ class FreshRSS_Configuration {
|
||||
public function _display_posts ($value) {
|
||||
$this->data['display_posts'] = ((bool)$value) && $value !== 'no';
|
||||
}
|
||||
public function _hide_read_feeds($value) {
|
||||
$this->data['hide_read_feeds'] = (bool)$value;
|
||||
}
|
||||
public function _onread_jump_next ($value) {
|
||||
$this->data['onread_jump_next'] = ((bool)$value) && $value !== 'no';
|
||||
}
|
||||
|
||||
@@ -4,18 +4,21 @@ class FreshRSS_UserDAO extends Minz_ModelPdo {
|
||||
public function createUser($username) {
|
||||
$db = Minz_Configuration::dataBase();
|
||||
require_once(APP_PATH . '/SQL/install.sql.' . $db['type'] . '.php');
|
||||
|
||||
if (defined('SQL_CREATE_TABLES')) {
|
||||
|
||||
$userPDO = new Minz_ModelPdo($username);
|
||||
|
||||
$ok = false;
|
||||
if (defined('SQL_CREATE_TABLES')) { //E.g. MySQL
|
||||
$sql = sprintf(SQL_CREATE_TABLES, $db['prefix'] . $username . '_', Minz_Translate::t('default_category'));
|
||||
$stm = $this->bd->prepare($sql);
|
||||
$stm = $userPDO->bd->prepare($sql);
|
||||
$ok = $stm && $stm->execute();
|
||||
} else {
|
||||
} else { //E.g. SQLite
|
||||
global $SQL_CREATE_TABLES;
|
||||
if (is_array($SQL_CREATE_TABLES)) {
|
||||
$ok = true;
|
||||
foreach ($SQL_CREATE_TABLES as $instruction) {
|
||||
$sql = sprintf($instruction, '', Minz_Translate::t('default_category'));
|
||||
$stm = $c->prepare($sql);
|
||||
$stm = $userPDO->bd->prepare($sql);
|
||||
$ok &= ($stm && $stm->execute());
|
||||
}
|
||||
}
|
||||
@@ -24,7 +27,7 @@ class FreshRSS_UserDAO extends Minz_ModelPdo {
|
||||
if ($ok) {
|
||||
return true;
|
||||
} else {
|
||||
$info = $stm == null ? array(2 => 'syntax error') : $stm->errorInfo();
|
||||
$info = empty($stm) ? array(2 => 'syntax error') : $stm->errorInfo();
|
||||
Minz_Log::record ('SQL error : ' . $info[2], Minz_Log::ERROR);
|
||||
return false;
|
||||
}
|
||||
@@ -34,14 +37,20 @@ class FreshRSS_UserDAO extends Minz_ModelPdo {
|
||||
$db = Minz_Configuration::dataBase();
|
||||
require_once(APP_PATH . '/SQL/install.sql.' . $db['type'] . '.php');
|
||||
|
||||
$sql = sprintf(SQL_DROP_TABLES, $db['prefix'] . $username . '_');
|
||||
$stm = $this->bd->prepare($sql);
|
||||
if ($stm && $stm->execute()) {
|
||||
return true;
|
||||
if ($db['type'] === 'sqlite') {
|
||||
return unlink(DATA_PATH . '/' . $username . '.sqlite');
|
||||
} else {
|
||||
$info = $stm == null ? array(2 => 'syntax error') : $stm->errorInfo();
|
||||
Minz_Log::record ('SQL error : ' . $info[2], Minz_Log::ERROR);
|
||||
return false;
|
||||
$userPDO = new Minz_ModelPdo($username);
|
||||
|
||||
$sql = sprintf(SQL_DROP_TABLES, $db['prefix'] . $username . '_');
|
||||
$stm = $userPDO->bd->prepare($sql);
|
||||
if ($stm && $stm->execute()) {
|
||||
return true;
|
||||
} else {
|
||||
$info = $stm == null ? array(2 => 'syntax error') : $stm->errorInfo();
|
||||
Minz_Log::record ('SQL error : ' . $info[2], Minz_Log::ERROR);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
global $SQL_CREATE_TABLES;
|
||||
$SQL_CREATE_TABLES = array(
|
||||
'CREATE TABLE IF NOT EXISTS `%1$scategory` (
|
||||
`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
|
||||
|
||||
@@ -262,6 +262,7 @@ return array (
|
||||
'sort_order' => 'Sort order',
|
||||
'auto_load_more' => 'Load next articles at the page bottom',
|
||||
'display_articles_unfolded' => 'Show articles unfolded by default',
|
||||
'hide_read_feeds' => 'Hide categories & feeds with no unread article (only in “unread articles” display mode)',
|
||||
'after_onread' => 'After “mark all as read”,',
|
||||
'jump_next' => 'jump to next unread sibling (feed or category)',
|
||||
'article_icons' => 'Article icons',
|
||||
|
||||
@@ -262,6 +262,7 @@ return array (
|
||||
'sort_order' => 'Ordre de tri',
|
||||
'auto_load_more' => 'Charger les articles suivants en bas de page',
|
||||
'display_articles_unfolded' => 'Afficher les articles dépliés par défaut',
|
||||
'hide_read_feeds' => 'Cacher les catégories & flux sans article non-lu (uniquement en affichage “articles non lus”)',
|
||||
'after_onread' => 'Après “marquer tout comme lu”,',
|
||||
'jump_next' => 'sauter au prochain voisin non lu (flux ou catégorie)',
|
||||
'article_icons' => 'Icônes d’article',
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<div class="aside aside_flux<?php if (($this->state & FreshRSS_Entry::STATE_NOT_READ) && !($this->state & FreshRSS_Entry::STATE_READ)) echo ' state_unread'; ?>" id="aside_flux">
|
||||
<div class="aside aside_flux<?php if ($this->conf->hide_read_feeds && ($this->state & FreshRSS_Entry::STATE_NOT_READ) && !($this->state & FreshRSS_Entry::STATE_READ)) echo ' state_unread'; ?>" id="aside_flux">
|
||||
<a class="toggle_aside" href="#close"><?php echo FreshRSS_Themes::icon('close'); ?></a>
|
||||
|
||||
<ul class="categories">
|
||||
|
||||
@@ -221,7 +221,9 @@
|
||||
|
||||
<?php
|
||||
$url_output['params']['output'] = 'rss';
|
||||
$url_output['params']['token'] = $this->conf->token;
|
||||
if ($this->conf->token) {
|
||||
$url_output['params']['token'] = $this->conf->token;
|
||||
}
|
||||
?>
|
||||
<a class="view_rss btn" target="_blank" title="<?php echo Minz_Translate::t ('rss_view'); ?>" href="<?php echo Minz_Url::display($url_output); ?>">
|
||||
<?php echo FreshRSS_Themes::icon('rss'); ?>
|
||||
|
||||
@@ -44,10 +44,9 @@
|
||||
|
||||
<div class="form-group">
|
||||
<div class="group-controls">
|
||||
<label class="checkbox" for="auto_load_more">
|
||||
<input type="checkbox" name="auto_load_more" id="auto_load_more" value="1"<?php echo $this->conf->auto_load_more ? ' checked="checked"' : ''; ?> />
|
||||
<?php echo Minz_Translate::t ('auto_load_more'); ?>
|
||||
<noscript> — <strong><?php echo Minz_Translate::t ('javascript_should_be_activated'); ?></strong></noscript>
|
||||
<label class="checkbox" for="hide_read_feeds">
|
||||
<input type="checkbox" name="hide_read_feeds" id="hide_read_feeds" value="1"<?php echo $this->conf->hide_read_feeds ? ' checked="checked"' : ''; ?> />
|
||||
<?php echo Minz_Translate::t('hide_read_feeds'); ?>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
@@ -64,9 +63,9 @@
|
||||
|
||||
<div class="form-group">
|
||||
<div class="group-controls">
|
||||
<label class="checkbox" for="lazyload">
|
||||
<input type="checkbox" name="lazyload" id="lazyload" value="1"<?php echo $this->conf->lazyload ? ' checked="checked"' : ''; ?> />
|
||||
<?php echo Minz_Translate::t ('img_with_lazyload'); ?>
|
||||
<label class="checkbox" for="sticky_post">
|
||||
<input type="checkbox" name="sticky_post" id="sticky_post" value="1"<?php echo $this->conf->sticky_post ? ' checked="checked"' : ''; ?> />
|
||||
<?php echo Minz_Translate::t ('sticky_post'); ?>
|
||||
<noscript> — <strong><?php echo Minz_Translate::t ('javascript_should_be_activated'); ?></strong></noscript>
|
||||
</label>
|
||||
</div>
|
||||
@@ -74,9 +73,19 @@
|
||||
|
||||
<div class="form-group">
|
||||
<div class="group-controls">
|
||||
<label class="checkbox" for="sticky_post">
|
||||
<input type="checkbox" name="sticky_post" id="sticky_post" value="1"<?php echo $this->conf->sticky_post ? ' checked="checked"' : ''; ?> />
|
||||
<?php echo Minz_Translate::t ('sticky_post'); ?>
|
||||
<label class="checkbox" for="auto_load_more">
|
||||
<input type="checkbox" name="auto_load_more" id="auto_load_more" value="1"<?php echo $this->conf->auto_load_more ? ' checked="checked"' : ''; ?> />
|
||||
<?php echo Minz_Translate::t ('auto_load_more'); ?>
|
||||
<noscript> — <strong><?php echo Minz_Translate::t ('javascript_should_be_activated'); ?></strong></noscript>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<div class="group-controls">
|
||||
<label class="checkbox" for="lazyload">
|
||||
<input type="checkbox" name="lazyload" id="lazyload" value="1"<?php echo $this->conf->lazyload ? ' checked="checked"' : ''; ?> />
|
||||
<?php echo Minz_Translate::t ('img_with_lazyload'); ?>
|
||||
<noscript> — <strong><?php echo Minz_Translate::t ('javascript_should_be_activated'); ?></strong></noscript>
|
||||
</label>
|
||||
</div>
|
||||
|
||||
@@ -30,18 +30,18 @@
|
||||
</label>
|
||||
|
||||
<label class="checkbox" for="export_starred">
|
||||
<input type="checkbox" name="export_starred" id="export_starred" value="1" checked="checked" />
|
||||
<input type="checkbox" name="export_starred" id="export_starred" value="1" <?php echo extension_loaded('zip') ? 'checked="checked"' : ''; ?> />
|
||||
<?php echo _t('export_starred'); ?>
|
||||
</label>
|
||||
|
||||
<?php
|
||||
$select_args = '';
|
||||
if (extension_loaded('zip')) {
|
||||
$select_args = ' size="<?php echo min(10, count($this->feeds)); ?>" multiple="multiple"';
|
||||
$select_args = ' size="' . min(10, count($this->feeds)) .'" multiple="multiple"';
|
||||
}
|
||||
?>
|
||||
<select name="export_feeds[]"<?php echo $select_arg; ?>>
|
||||
<?php echo extension_loaded('zip')? '': '<option></option>'; ?>
|
||||
<select name="export_feeds[]"<?php echo $select_args; ?>>
|
||||
<?php echo extension_loaded('zip') ? '' : '<option></option>'; ?>
|
||||
<?php foreach ($this->feeds as $feed) { ?>
|
||||
<option value="<?php echo $feed->id(); ?>"><?php echo $feed->name(); ?></option>
|
||||
<?php } ?>
|
||||
|
||||
@@ -33,8 +33,8 @@ class Minz_ModelPdo {
|
||||
* Créé la connexion à la base de données à l'aide des variables
|
||||
* HOST, BASE, USER et PASS définies dans le fichier de configuration
|
||||
*/
|
||||
public function __construct() {
|
||||
if (self::$useSharedBd && self::$sharedBd != null) {
|
||||
public function __construct($currentUser = null) {
|
||||
if (self::$useSharedBd && self::$sharedBd != null && $currentUser === null) {
|
||||
$this->bd = self::$sharedBd;
|
||||
$this->prefix = self::$sharedPrefix;
|
||||
return;
|
||||
@@ -42,6 +42,10 @@ class Minz_ModelPdo {
|
||||
|
||||
$db = Minz_Configuration::dataBase();
|
||||
|
||||
if ($currentUser === null) {
|
||||
$currentUser = Minz_Session::param('currentUser', '_');
|
||||
}
|
||||
|
||||
try {
|
||||
$type = $db['type'];
|
||||
if ($type === 'mysql') {
|
||||
@@ -51,9 +55,9 @@ class Minz_ModelPdo {
|
||||
$driver_options = array(
|
||||
PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8',
|
||||
);
|
||||
$this->prefix = $db['prefix'] . Minz_Session::param('currentUser', '_') . '_';
|
||||
$this->prefix = $db['prefix'] . $currentUser . '_';
|
||||
} elseif ($type === 'sqlite') {
|
||||
$string = 'sqlite:' . DATA_PATH . '/' . Minz_Session::param('currentUser', '_') . '.sqlite';
|
||||
$string = 'sqlite:' . DATA_PATH . '/' . $currentUser . '.sqlite';
|
||||
$driver_options = array(
|
||||
//PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
|
||||
);
|
||||
@@ -67,7 +71,7 @@ class Minz_ModelPdo {
|
||||
self::$sharedDbType = $type;
|
||||
self::$sharedPrefix = $this->prefix;
|
||||
|
||||
$this->bd = new FreshPDO(
|
||||
$this->bd = new MinzPDO(
|
||||
$string,
|
||||
$db['user'],
|
||||
$db['password'],
|
||||
@@ -98,7 +102,7 @@ class Minz_ModelPdo {
|
||||
}
|
||||
}
|
||||
|
||||
class FreshPDO extends PDO {
|
||||
class MinzPDO extends PDO {
|
||||
private static function check($statement) {
|
||||
if (preg_match('/^(?:UPDATE|INSERT|DELETE)/i', $statement)) {
|
||||
invalidateHttpCache();
|
||||
@@ -106,12 +110,12 @@ class FreshPDO extends PDO {
|
||||
}
|
||||
|
||||
public function prepare($statement, $driver_options = array()) {
|
||||
FreshPDO::check($statement);
|
||||
MinzPDO::check($statement);
|
||||
return parent::prepare($statement, $driver_options);
|
||||
}
|
||||
|
||||
public function exec($statement) {
|
||||
FreshPDO::check($statement);
|
||||
MinzPDO::check($statement);
|
||||
return parent::exec($statement);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user