Browse Source

Merge branch 'dev' into 334-new-i18n

Marien Fressinaud 11 năm trước cách đây
mục cha
commit
50a926d32d

+ 14 - 1
CHANGELOG

@@ -1,11 +1,24 @@
 # Journal des modifications
 
-## Dev
+## 2014-12-xx FreshRSS 0.9.3 (beta)
 
 * SimplePie
 	* Support for content-type application/x-rss+xml
 	* New force_feed option (for feeds sent with the wrong content-type / MIME) by adding #force_feed at the end of the feed URL
 	* Improved error messages
+* Statistics
+	* Add information on feed repartition pages
+	* Add percent repartition for the bigger feeds
+* UI
+	* New theme selector
+	* Update Screwdriver theme
+	* Add BlueLagoon theme by Mister aiR
+* Misc.
+	* Add option to remove articles after reading them
+	* Add comments
+	* Refactor i18n system to not load unnecessary strings
+	* Fix security issue in Minz_Error::error() method
+	* Fix redirection after refreshing a given feed
 
 
 ## 2014-10-31 FreshRSS 0.9.2 (beta)

+ 3 - 2
app/Controllers/feedController.php

@@ -392,8 +392,9 @@ class FreshRSS_feed_Controller extends Minz_ActionController {
 		// Redirect to the main page with correct notification.
 		if ($updated_feeds === 1) {
 			$feed = reset($feeds);
-			Minz_Request::good(_t('feed_actualized', $feed->name()),
-			                   array('get' => 'f_' . $feed->id()));
+			Minz_Request::good(_t('feed_actualized', $feed->name()), array(
+				'params' => array('get' => 'f_' . $feed->id())
+			));
 		} elseif ($updated_feeds > 1) {
 			Minz_Request::good(_t('n_feeds_actualized', $updated_feeds), array());
 		} else {

+ 77 - 0
app/Models/EntryDAO.php

@@ -80,6 +80,16 @@ class FreshRSS_EntryDAO extends Minz_ModelPdo {
 		return -1;
 	}
 
+	/**
+	 * Toggle favorite marker on one or more article
+	 *
+	 * @todo simplify the query by removing the str_repeat. I am pretty sure
+	 * there is an other way to do that.
+	 *
+	 * @param integer|array $ids
+	 * @param boolean $is_favorite
+	 * @return false|integer
+	 */
 	public function markFavorite($ids, $is_favorite = true) {
 		if (!is_array($ids)) {
 			$ids = array($ids);
@@ -99,6 +109,17 @@ class FreshRSS_EntryDAO extends Minz_ModelPdo {
 		}
 	}
 
+	/**
+	 * Update the unread article cache held on every feed details.
+	 * Depending on the parameters, it updates the cache on one feed, on all
+	 * feeds from one category or on all feeds.
+	 *
+	 * @todo It can use the query builder refactoring to build that query
+	 *
+	 * @param false|integer $catId category ID
+	 * @param false|integer $feedId feed ID
+	 * @return boolean
+	 */
 	protected function updateCacheUnreads($catId = false, $feedId = false) {
 		$sql = 'UPDATE `' . $this->prefix . 'feed` f '
 		 . 'LEFT OUTER JOIN ('
@@ -129,6 +150,19 @@ class FreshRSS_EntryDAO extends Minz_ModelPdo {
 		}
 	}
 
+	/**
+	 * Toggle the read marker on one or more article.
+	 * Then the cache is updated.
+	 *
+	 * @todo change the way the query is build because it seems there is
+	 * unnecessary code in here. For instance, the part with the str_repeat.
+	 * @todo remove code duplication. It seems the code is basically the
+	 * same if it is an array or not.
+	 *
+	 * @param integer|array $ids
+	 * @param boolean $is_read
+	 * @return integer affected rows
+	 */
 	public function markRead($ids, $is_read = true) {
 		if (is_array($ids)) {	//Many IDs at once (used by API)
 			if (count($ids) < 6) {	//Speed heuristics
@@ -172,6 +206,27 @@ class FreshRSS_EntryDAO extends Minz_ModelPdo {
 		}
 	}
 
+	/**
+	 * Mark all entries as read depending on parameters.
+	 * If $onlyFavorites is true, it is used when the user mark as read in
+	 * the favorite pseudo-category.
+	 * If $priorityMin is greater than 0, it is used when the user mark as
+	 * read in the main feed pseudo-category.
+	 * Then the cache is updated.
+	 *
+	 * If $idMax equals 0, a deprecated debug message is logged
+	 *
+	 * @todo refactor this method along with markReadCat and markReadFeed
+	 * since they are all doing the same thing. I think we need to build a
+	 * tool to generate the query instead of having queries all over the
+	 * place. It will be reused also for the filtering making every thing
+	 * separated.
+	 *
+	 * @param integer $idMax fail safe article ID
+	 * @param boolean $onlyFavorites
+	 * @param integer $priorityMin
+	 * @return integer affected rows
+	 */
 	public function markReadEntries($idMax = 0, $onlyFavorites = false, $priorityMin = 0) {
 		if ($idMax == 0) {
 			$idMax = time() . '000000';
@@ -200,6 +255,17 @@ class FreshRSS_EntryDAO extends Minz_ModelPdo {
 		return $affected;
 	}
 
+	/**
+	 * Mark all the articles in a category as read.
+	 * There is a fail safe to prevent to mark as read articles that are
+	 * loaded during the mark as read action. Then the cache is updated.
+	 *
+	 * If $idMax equals 0, a deprecated debug message is logged
+	 *
+	 * @param integer $id category ID
+	 * @param integer $idMax fail safe article ID
+	 * @return integer affected rows
+	 */
 	public function markReadCat($id, $idMax = 0) {
 		if ($idMax == 0) {
 			$idMax = time() . '000000';
@@ -223,6 +289,17 @@ class FreshRSS_EntryDAO extends Minz_ModelPdo {
 		return $affected;
 	}
 
+	/**
+	 * Mark all the articles in a feed as read.
+	 * There is a fail safe to prevent to mark as read articles that are
+	 * loaded during the mark as read action. Then the cache is updated.
+	 *
+	 * If $idMax equals 0, a deprecated debug message is logged
+	 *
+	 * @param integer $id feed ID
+	 * @param integer $idMax fail safe article ID
+	 * @return integer affected rows
+	 */
 	public function markReadFeed($id, $idMax = 0) {
 		if ($idMax == 0) {
 			$idMax = time() . '000000';

+ 45 - 0
app/Models/EntryDAOSQLite.php

@@ -31,6 +31,19 @@ class FreshRSS_EntryDAOSQLite extends FreshRSS_EntryDAO {
 		}
 	}
 
+	/**
+	 * Toggle the read marker on one or more article.
+	 * Then the cache is updated.
+	 *
+	 * @todo change the way the query is build because it seems there is
+	 * unnecessary code in here. For instance, the part with the str_repeat.
+	 * @todo remove code duplication. It seems the code is basically the
+	 * same if it is an array or not.
+	 *
+	 * @param integer|array $ids
+	 * @param boolean $is_read
+	 * @return integer affected rows
+	 */
 	public function markRead($ids, $is_read = true) {
 		if (is_array($ids)) {	//Many IDs at once (used by API)
 			if (true) {	//Speed heuristics	//TODO: Not implemented yet for SQLite (so always call IDs one by one)
@@ -69,6 +82,27 @@ class FreshRSS_EntryDAOSQLite extends FreshRSS_EntryDAO {
 		}
 	}
 
+	/**
+	 * Mark all entries as read depending on parameters.
+	 * If $onlyFavorites is true, it is used when the user mark as read in
+	 * the favorite pseudo-category.
+	 * If $priorityMin is greater than 0, it is used when the user mark as
+	 * read in the main feed pseudo-category.
+	 * Then the cache is updated.
+	 *
+	 * If $idMax equals 0, a deprecated debug message is logged
+	 *
+	 * @todo refactor this method along with markReadCat and markReadFeed
+	 * since they are all doing the same thing. I think we need to build a
+	 * tool to generate the query instead of having queries all over the
+	 * place. It will be reused also for the filtering making every thing
+	 * separated.
+	 *
+	 * @param integer $idMax fail safe article ID
+	 * @param boolean $onlyFavorites
+	 * @param integer $priorityMin
+	 * @return integer affected rows
+	 */
 	public function markReadEntries($idMax = 0, $onlyFavorites = false, $priorityMin = 0) {
 		if ($idMax == 0) {
 			$idMax = time() . '000000';
@@ -95,6 +129,17 @@ class FreshRSS_EntryDAOSQLite extends FreshRSS_EntryDAO {
 		return $affected;
 	}
 
+	/**
+	 * Mark all the articles in a category as read.
+	 * There is a fail safe to prevent to mark as read articles that are
+	 * loaded during the mark as read action. Then the cache is updated.
+	 *
+	 * If $idMax equals 0, a deprecated debug message is logged
+	 *
+	 * @param integer $id category ID
+	 * @param integer $idMax fail safe article ID
+	 * @return integer affected rows
+	 */
 	public function markReadCat($id, $idMax = 0) {
 		if ($idMax == 0) {
 			$idMax = time() . '000000';

+ 1 - 0
app/i18n/en/gen.php

@@ -62,6 +62,7 @@ return array(
 	'author' => 'Author',
 	'auto_load_more' => 'Load next articles at the page bottom',
 	'auto_read_when' => 'Mark article as read…',
+	'auto_remove_article' => 'Hide articles after reading',
 	'auto_share' => 'Share',
 	'auto_share_help' => 'If there is only one sharing mode, it is used. Else modes are accessible by their number.',
 	'back_to_rss_feeds' => '← Go back to your RSS feeds',

+ 1 - 0
app/i18n/fr/gen.php

@@ -62,6 +62,7 @@ return array(
 	'author' => 'Auteur',
 	'auto_load_more' => 'Charger les articles suivants en bas de page',
 	'auto_read_when' => 'Marquer un article comme lu…',
+	'auto_remove_article' => 'Cacher les articles après lecture',
 	'auto_share' => 'Partager',
 	'auto_share_help' => 'S’il n’y a qu’un mode de partage, celui-ci est utilisé automatiquement. Sinon ils sont accessibles par leur numéro.',
 	'back_to_rss_feeds' => '← Retour à vos flux RSS',

+ 1 - 1
lib/Minz/Error.php

@@ -19,7 +19,7 @@ class Minz_Error {
 	*      > $logs['notice']
 	* @param $redirect indique s'il faut forcer la redirection (les logs ne seront pas transmis)
 	*/
-	public static function error ($code = 404, $logs = array (), $redirect = false) {
+	public static function error ($code = 404, $logs = array (), $redirect = true) {
 		$logs = self::processLogs ($logs);
 		$error_filename = APP_PATH . '/Controllers/errorController.php';
 

+ 8 - 0
p/scripts/main.js

@@ -689,6 +689,14 @@ function init_stream(divStream) {
 
 	divStream.on('click', '.flux a.read', function () {
 		var active = $(this).parents(".flux");
+		if (context['auto_remove_article'] && active.hasClass('not_read')) {
+			var p = active.prev();
+			var n = active.next();
+			if (p.hasClass('day') && n.hasClass('day')) {
+				p.remove();
+			}
+			active.remove();
+		}
 		mark_read(active, false);
 		return false;
 	});