From cf8ee6bd48221e73b515922e75945e9aa763f907 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Sat, 1 Feb 2014 14:04:37 +0100 Subject: Rafraîchissement des flux en cache super rapide MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Contribue à https://github.com/marienfressinaud/FreshRSS/issues/351#issuecomment-31755012 Les flux non-modifiés et en cache ne coûtent maintenant presque plus rien (304, ou délai de cache SimplePie non expiré), alors qu'avant toutes les entrées étaient rechargées --- app/Models/Feed.php | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'app/Models/Feed.php') diff --git a/app/Models/Feed.php b/app/Models/Feed.php index 22c019080..662476b7e 100644 --- a/app/Models/Feed.php +++ b/app/Models/Feed.php @@ -193,10 +193,10 @@ class FreshRSS_Feed extends Minz_Model { } $feed = customSimplePie(); $feed->set_feed_url ($url); - $feed->init (); + $initResult = $feed->init (); - if ($feed->error ()) { - throw new FreshRSS_Feed_Exception ($feed->error . ' [' . $url . ']'); + if ((!$initResult) || $feed->error()) { + throw new FreshRSS_Feed_Exception ($feed->error() . ' [' . $url . ']'); } // si on a utilisé l'auto-discover, notre url va avoir changé @@ -217,11 +217,15 @@ class FreshRSS_Feed extends Minz_Model { $this->_description(html_only_entity_decode($feed->get_description())); } - // et on charge les articles du flux - $this->loadEntries ($feed); + if (($initResult == SIMPLEPIE_INIT_SUCCESS) || $loadDetails) { + $this->loadEntries($feed); // et on charge les articles du flux + } else { + $this->entries = array(); + } } } } + private function loadEntries ($feed) { $entries = array (); -- cgit v1.2.3 From 02d1dac0bb07884b79ddea20980bfcf21131f2d7 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Sat, 1 Feb 2014 20:13:42 +0100 Subject: Rafraîchissement des flux en cache compatible multi-utilisateurs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Compatibilité multi-utilisateurs pour la mise à jour rapide des flux avec cache Correction de https://github.com/marienfressinaud/FreshRSS/commit/cf8ee6bd48221e73b515922e75945e9aa763f907#commitcomment-5247478 Contribue à https://github.com/marienfressinaud/FreshRSS/issues/351#issuecomment-31755012 --- app/Models/Feed.php | 8 +++++--- app/Models/FeedDAO.php | 2 +- lib/SimplePie/SimplePie.php | 25 ++++++++++++------------- lib/SimplePie/SimplePie/Misc.php | 30 +++--------------------------- 4 files changed, 21 insertions(+), 44 deletions(-) (limited to 'app/Models/Feed.php') diff --git a/app/Models/Feed.php b/app/Models/Feed.php index 662476b7e..366c04c67 100644 --- a/app/Models/Feed.php +++ b/app/Models/Feed.php @@ -193,9 +193,9 @@ class FreshRSS_Feed extends Minz_Model { } $feed = customSimplePie(); $feed->set_feed_url ($url); - $initResult = $feed->init (); + $mtime = $feed->init(); - if ((!$initResult) || $feed->error()) { + if ((!$mtime) || $feed->error()) { throw new FreshRSS_Feed_Exception ($feed->error() . ' [' . $url . ']'); } @@ -217,9 +217,11 @@ class FreshRSS_Feed extends Minz_Model { $this->_description(html_only_entity_decode($feed->get_description())); } - if (($initResult == SIMPLEPIE_INIT_SUCCESS) || $loadDetails) { + if (($mtime === true) || ($mtime > $this->lastUpdate)) { + syslog(LOG_DEBUG, 'FreshRSS no cache ' . $mtime . ' > ' . $this->lastUpdate); $this->loadEntries($feed); // et on charge les articles du flux } else { + syslog(LOG_DEBUG, 'FreshRSS use cache for ' . $subscribe_url); $this->entries = array(); } } diff --git a/app/Models/FeedDAO.php b/app/Models/FeedDAO.php index a17ff0718..a2ce0e46f 100644 --- a/app/Models/FeedDAO.php +++ b/app/Models/FeedDAO.php @@ -199,7 +199,7 @@ class FreshRSS_FeedDAO extends Minz_ModelPdo { } public function listFeedsOrderUpdate () { - $sql = 'SELECT id, name, url, pathEntries, httpAuth, keep_history FROM `' . $this->prefix . 'feed` ORDER BY lastUpdate'; + $sql = 'SELECT id, name, url, lastUpdate, pathEntries, httpAuth, keep_history FROM `' . $this->prefix . 'feed` ORDER BY lastUpdate'; $stm = $this->bd->prepare ($sql); $stm->execute (); diff --git a/lib/SimplePie/SimplePie.php b/lib/SimplePie/SimplePie.php index 97b9310db..fe01d382e 100644 --- a/lib/SimplePie/SimplePie.php +++ b/lib/SimplePie/SimplePie.php @@ -402,9 +402,6 @@ define('SIMPLEPIE_FILE_SOURCE_CURL', 8); */ define('SIMPLEPIE_FILE_SOURCE_FILE_GET_CONTENTS', 16); -define('SIMPLEPIE_INIT_FAIL', 0); //FreshRSS -define('SIMPLEPIE_INIT_SUCCESS', 1); //FreshRSS -define('SIMPLEPIE_INIT_CACHE', 2); //FreshRSS /** @@ -1222,14 +1219,14 @@ class SimplePie * configuration options get processed, feeds are fetched, cached, and * parsed, and all of that other good stuff. * - * @return boolean True if successful, false otherwise + * @return positive integer with modification time if using cache, boolean true if otherwise successful, false otherwise */ public function init() { // Check absolute bare minimum requirements. if (!extension_loaded('xml') || !extension_loaded('pcre')) { - return SIMPLEPIE_INIT_FAIL; + return false; } // Then check the xml extension is sane (i.e., libxml 2.7.x issue on PHP < 5.2.9 and libxml 2.7.0 to 2.7.2 on any version) if we don't have xmlreader. elseif (!extension_loaded('xmlreader')) @@ -1244,7 +1241,7 @@ class SimplePie } if (!$xml_is_sane) { - return SIMPLEPIE_INIT_FAIL; + return false; } } @@ -1276,11 +1273,11 @@ class SimplePie } $i++; } - return inval($success); + return (bool) $success; } elseif ($this->feed_url === null && $this->raw_data === null) { - return SIMPLEPIE_INIT_FAIL; + return false; } $this->error = null; @@ -1301,10 +1298,10 @@ class SimplePie // Fetch the data via SimplePie_File into $this->raw_data if (($fetched = $this->fetch_data($cache)) === true) { - return SIMPLEPIE_INIT_CACHE; + return $this->data['mtime']; //FreshRSS } elseif ($fetched === false) { - return SIMPLEPIE_INIT_FAIL; + return false; } list($headers, $sniffed) = $fetched; @@ -1381,7 +1378,7 @@ class SimplePie { $this->error = "A feed could not be found at $this->feed_url. This does not appear to be a valid RSS or Atom feed."; $this->registry->call('Misc', 'error', array($this->error, E_USER_NOTICE, __FILE__, __LINE__)); - return SIMPLEPIE_INIT_FAIL; + return false; } if (isset($headers)) @@ -1389,13 +1386,14 @@ class SimplePie $this->data['headers'] = $headers; } $this->data['build'] = SIMPLEPIE_BUILD; + $this->data['mtime'] = time(); //FreshRSS // Cache the file if caching is enabled if ($cache && !$cache->save($this)) { trigger_error("$this->cache_location is not writeable. Make sure you've set the correct relative or absolute path, and that the location is server-writable.", E_USER_WARNING); } - return SIMPLEPIE_INIT_SUCCESS; + return true; } } } @@ -1412,7 +1410,7 @@ class SimplePie $this->registry->call('Misc', 'error', array($this->error, E_USER_NOTICE, __FILE__, __LINE__)); - return SIMPLEPIE_INIT_FAIL; + return false; } /** @@ -1558,6 +1556,7 @@ class SimplePie if ($cache) { $this->data = array('url' => $this->feed_url, 'feed_url' => $file->url, 'build' => SIMPLEPIE_BUILD); + $this->data['mtime'] = time(); //FreshRSS if (!$cache->save($this)) { trigger_error("$this->cache_location is not writeable. Make sure you've set the correct relative or absolute path, and that the location is server-writable.", E_USER_WARNING); diff --git a/lib/SimplePie/SimplePie/Misc.php b/lib/SimplePie/SimplePie/Misc.php index 347520303..b5812473b 100644 --- a/lib/SimplePie/SimplePie/Misc.php +++ b/lib/SimplePie/SimplePie/Misc.php @@ -2161,36 +2161,12 @@ function embed_wmedia(width, height, link) { /** * Get the SimplePie build timestamp * - * Uses the git index if it exists, otherwise uses the modification time - * of the newest file. + * Return SimplePie.php modification time. */ public static function get_build() { - $root = dirname(dirname(__FILE__)); - if (file_exists($root . '/.git/index')) - { - return filemtime($root . '/.git/index'); - } - elseif (file_exists($root . '/SimplePie')) - { - $time = 0; - foreach (glob($root . '/SimplePie/*.php') as $file) - { - if (($mtime = filemtime($file)) > $time) - { - $time = $mtime; - } - } - return $time; - } - elseif (file_exists(dirname(__FILE__) . '/Core.php')) - { - return filemtime(dirname(__FILE__) . '/Core.php'); - } - else - { - return filemtime(__FILE__); - } + $mtime = @filemtime(dirname(dirname(__FILE__)) . '/SimplePie.php'); //FreshRSS + return $mtime ? $mtime : filemtime(__FILE__); } /** -- cgit v1.2.3 From 9aab83af115de3b210ea41caae49b70a0f82492a Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Sun, 2 Feb 2014 22:09:16 +0100 Subject: SimplePie : Meilleur cache des flux avec signature MD5 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Contribue à https://github.com/marienfressinaud/FreshRSS/issues/351#issuecomment-31755012 Pour les flux qui ne supportent pas les requêtes conditionnelles. Filtre les tags et commentaires gênants avant la signature (style qui change tout le temps sans que le contenu change, , ainsi que les commentaires XML qui détruisent le cache comme ) Il reste quelques flux à débogger dont le cache n'est pas encore optimal. C'est pour cela qu'il reste quelques syslog(LOG_DEBUG, ...). Au passage, évite que SimplePie fasse une double requête pour vérifier le cache si le serveur est un peu lent. Un jour, il faudra nettoyer les changements faits à SimplePie et leur remonter les patchs les plus intéressants. --- CHANGELOG | 1 + app/Models/Feed.php | 2 +- lib/SimplePie/SimplePie.php | 29 ++++++++++++++++++++++++++--- 3 files changed, 28 insertions(+), 4 deletions(-) (limited to 'app/Models/Feed.php') diff --git a/CHANGELOG b/CHANGELOG index f7e15c185..138f7be21 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -3,6 +3,7 @@ ## 2014-0x-xx FreshRSS 0.8 * Mise à jour des flux plus rapide grâce à une meilleure utilisation du cache + * Utilisation d’une signature MD5 du contenu intéressant pour les flux n’implémentant pas les requêtes conditionnelles ## 2014-01-29 FreshRSS 0.7 diff --git a/app/Models/Feed.php b/app/Models/Feed.php index 366c04c67..c71fb41ae 100644 --- a/app/Models/Feed.php +++ b/app/Models/Feed.php @@ -218,7 +218,7 @@ class FreshRSS_Feed extends Minz_Model { } if (($mtime === true) || ($mtime > $this->lastUpdate)) { - syslog(LOG_DEBUG, 'FreshRSS no cache ' . $mtime . ' > ' . $this->lastUpdate); + syslog(LOG_DEBUG, 'FreshRSS no cache ' . $mtime . ' > ' . $this->lastUpdate . ' for ' . $subscribe_url); $this->loadEntries($feed); // et on charge les articles du flux } else { syslog(LOG_DEBUG, 'FreshRSS use cache for ' . $subscribe_url); diff --git a/lib/SimplePie/SimplePie.php b/lib/SimplePie/SimplePie.php index fe01d382e..a23b2b830 100644 --- a/lib/SimplePie/SimplePie.php +++ b/lib/SimplePie/SimplePie.php @@ -1212,6 +1212,10 @@ class SimplePie $this->item_limit = (int) $limit; } + function cleanMd5($rss) { //FreshRSS + return md5(preg_replace(array('#<(lastBuildDate|pubDate|updated|feedDate|dc:date|slash:comments)>[^<]+#', '##s'), '', $rss)); + } + /** * Initialize the feed object * @@ -1305,6 +1309,10 @@ class SimplePie } list($headers, $sniffed) = $fetched; + + if (isset($this->data['md5'])) { //FreshRSS + $md5 = $this->data['md5']; + } } // Set up array of possible encodings @@ -1387,6 +1395,7 @@ class SimplePie } $this->data['build'] = SIMPLEPIE_BUILD; $this->data['mtime'] = time(); //FreshRSS + $this->data['md5'] = empty($md5) ? $this->cleanMd5($this->raw_data) : $md5; //FreshRSS // Cache the file if caching is enabled if ($cache && !$cache->save($this)) @@ -1462,7 +1471,7 @@ class SimplePie elseif ($cache->mtime() + $this->cache_duration < time()) { // If we have last-modified and/or etag set - if (isset($this->data['headers']['last-modified']) || isset($this->data['headers']['etag'])) + //if (isset($this->data['headers']['last-modified']) || isset($this->data['headers']['etag'])) //FreshRSS removed { $headers = array( 'Accept' => 'application/atom+xml, application/rss+xml, application/rdf+xml;q=0.9, application/xml;q=0.8, text/xml;q=0.8, text/html;q=0.7, unknown/unknown;q=0.1, application/unknown;q=0.1, */*;q=0.1', @@ -1476,7 +1485,7 @@ class SimplePie $headers['if-none-match'] = $this->data['headers']['etag']; } - $file = $this->registry->create('File', array($this->feed_url, $this->timeout/10, 5, $headers, $this->useragent, $this->force_fsockopen)); + $file = $this->registry->create('File', array($this->feed_url, $this->timeout, 5, $headers, $this->useragent, $this->force_fsockopen)); //FreshRSS if ($file->success) { @@ -1488,7 +1497,20 @@ class SimplePie } else { - unset($file); + $this->error = $file->error; //FreshRSS + return !empty($this->data); //FreshRSS + //unset($file); //FreshRSS removed + } + } + { //FreshRSS + $md5 = $this->cleanMd5($file->body); + if ($this->data['md5'] === $md5) { + syslog(LOG_DEBUG, 'SimplePie MD5 cache match for ' . $this->feed_url); + $cache->touch(); + return true; //Content unchanged even though server did not send a 304 + } else { + syslog(LOG_DEBUG, 'SimplePie MD5 cache no match for ' . $this->feed_url); + $this->data['md5'] = $md5; } } } @@ -1557,6 +1579,7 @@ class SimplePie { $this->data = array('url' => $this->feed_url, 'feed_url' => $file->url, 'build' => SIMPLEPIE_BUILD); $this->data['mtime'] = time(); //FreshRSS + $this->data['md5'] = empty($md5) ? $this->cleanMd5($file->body) : $md5; //FreshRSS if (!$cache->save($this)) { trigger_error("$this->cache_location is not writeable. Make sure you've set the correct relative or absolute path, and that the location is server-writable.", E_USER_WARNING); -- cgit v1.2.3 From 7fa620cce54f7fd187c477df080ebed33c818b07 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Sat, 8 Feb 2014 15:57:19 +0100 Subject: SimplePie Fuite de mémoire PHP 5.2 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit https://github.com/marienfressinaud/FreshRSS/issues/415 http://simplepie.org/wiki/faq/i_m_getting_memory_leaks (Pas testé) --- app/Controllers/feedController.php | 1 + app/Models/Feed.php | 4 ++++ 2 files changed, 5 insertions(+) (limited to 'app/Models/Feed.php') diff --git a/app/Controllers/feedController.php b/app/Controllers/feedController.php index 918f007fd..056ed96b5 100755 --- a/app/Controllers/feedController.php +++ b/app/Controllers/feedController.php @@ -246,6 +246,7 @@ class FreshRSS_feed_Controller extends Minz_ActionController { $feedDAO->updateFeed($feed->id(), array('url' => $feed->url())); } $feed->faviconPrepare(); + unset($feed); } catch (FreshRSS_Feed_Exception $e) { Minz_Log::record ($e->getMessage (), Minz_Log::NOTICE); $feedDAO->updateLastUpdate ($feed->id (), 1); diff --git a/app/Models/Feed.php b/app/Models/Feed.php index c71fb41ae..e94ae2b3a 100644 --- a/app/Models/Feed.php +++ b/app/Models/Feed.php @@ -224,6 +224,9 @@ class FreshRSS_Feed extends Minz_Model { syslog(LOG_DEBUG, 'FreshRSS use cache for ' . $subscribe_url); $this->entries = array(); } + + $feed->__destruct(); //http://simplepie.org/wiki/faq/i_m_getting_memory_leaks + unset($feed); } } } @@ -273,6 +276,7 @@ class FreshRSS_Feed extends Minz_Model { $entry->loadCompleteContent($this->pathEntries()); $entries[] = $entry; + unset($item); } $this->entries = $entries; -- cgit v1.2.3 From 0cabd1f50dd7d1cf0941a50139e6fbeed6825b4d Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Tue, 11 Feb 2014 21:48:10 +0100 Subject: Mutex par flux pour les actualisations MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Contribue à https://github.com/marienfressinaud/FreshRSS/issues/351 Nouvelle constante TMP_PATH comme répertoire pour stocker des fichiers temporaires (si possible en mémoire et non sur disque, tel tmpfs pour /tmp sur certaines distributions Linux) Requiert PHP 5.2.1+ (contre 5.2.0 auparavant) pour le `sys_get_temp_dir()` --- README.md | 2 +- app/Controllers/feedController.php | 5 +++++ app/Models/Feed.php | 18 ++++++++++++++++++ app/actualize_script.php | 19 ------------------- constants.php | 2 ++ p/i/install.php | 5 +++-- 6 files changed, 29 insertions(+), 22 deletions(-) (limited to 'app/Models/Feed.php') diff --git a/README.md b/README.md index 247d08799..1ed6d8f82 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,7 @@ Privilégiez pour cela des demandes sur GitHub * Serveur modeste, par exemple sous Linux ou Windows * Fonctionne même sur un Raspberry Pi avec des temps de réponse < 1s (testé sur 150 flux, 22k articles, soit 32Mo de données partiellement compressées) * Serveur Web Apache2 ou Nginx (non testé sur les autres) -* PHP 5.2+ (PHP 5.3.7+ recommandé) +* PHP 5.2.1+ (PHP 5.3.7+ recommandé) * Requis : [PDO_MySQL](http://php.net/pdo-mysql), [cURL](http://php.net/curl), [LibXML](http://php.net/xml), [PCRE](http://php.net/pcre), [ctype](http://php.net/ctype) * Recommandés : [JSON](http://php.net/json), [zlib](http://php.net/zlib), [mbstring](http://php.net/mbstring), [iconv](http://php.net/iconv) * MySQL 5.0.3+ (ou SQLite 3.7.4+ à venir) diff --git a/app/Controllers/feedController.php b/app/Controllers/feedController.php index 55e8f76cf..61bfc5919 100755 --- a/app/Controllers/feedController.php +++ b/app/Controllers/feedController.php @@ -189,6 +189,10 @@ class FreshRSS_feed_Controller extends Minz_ActionController { $flux_update = 0; $is_read = $this->view->conf->mark_when['reception'] ? 1 : 0; foreach ($feeds as $feed) { + if (!$feed->lock()) { + Minz_Log::record('Feed already being actualized: ' . $feed->url(), Minz_Log::NOTICE); + continue; + } try { $url = $feed->url(); $feedHistory = $feed->keepHistory(); @@ -251,6 +255,7 @@ class FreshRSS_feed_Controller extends Minz_ActionController { $feedDAO->updateLastUpdate ($feed->id (), 1); } + $feed->unlock(); unset($feed); // On arrête à 10 flux pour ne pas surcharger le serveur diff --git a/app/Models/Feed.php b/app/Models/Feed.php index e94ae2b3a..73f9c32fb 100644 --- a/app/Models/Feed.php +++ b/app/Models/Feed.php @@ -281,4 +281,22 @@ class FreshRSS_Feed extends Minz_Model { $this->entries = $entries; } + + function lock() { + $lock = TMP_PATH . '/' . md5(Minz_Configuration::salt() . $this->url) . '.freshrss.lock'; + if (file_exists($lock) && ((time() - @filemtime($lock)) > 3600)) { + @unlink($lock); + } + if (($handle = @fopen($lock, 'x')) === false) { + return false; + } + //register_shutdown_function('unlink', $lock); + @fclose($handle); + return true; + } + + function unlock() { + $lock = TMP_PATH . '/' . md5(Minz_Configuration::salt() . $this->url) . '.freshrss.lock'; + @unlink($lock); + } } diff --git a/app/actualize_script.php b/app/actualize_script.php index bef9bd218..8d81e0189 100755 --- a/app/actualize_script.php +++ b/app/actualize_script.php @@ -1,24 +1,5 @@ -$lock = DATA_PATH . '/actualize.lock.txt'; -if (file_exists($lock) && ((time() - @filemtime($lock)) > 3600)) { - @unlink($lock); -} -if (($handle = @fopen($lock, 'x')) === false) { - syslog(LOG_NOTICE, 'FreshRSS actualize already running?'); - if (defined('STDERR')) { - fwrite(STDERR, 'FreshRSS actualize already running?' . "\n"); - } - echo 'FreshRSS actualize already running?', "\n"; - return; -} -register_shutdown_function('unlink', $lock); -//Could use http://php.net/function.pcntl-signal.php to catch interruptions -@fclose($handle); -// - require(LIB_PATH . '/lib_rss.php'); //Includes class autoloader session_cache_limiter(''); diff --git a/constants.php b/constants.php index a7c96f47b..4818f1565 100644 --- a/constants.php +++ b/constants.php @@ -15,3 +15,5 @@ define('FRESHRSS_PATH', dirname(__FILE__)); define('LIB_PATH', FRESHRSS_PATH . '/lib'); define('APP_PATH', FRESHRSS_PATH . '/app'); + +define('TMP_PATH', sys_get_temp_dir()); diff --git a/p/i/install.php b/p/i/install.php index bb49e3fdb..4b0b1d194 100644 --- a/p/i/install.php +++ b/p/i/install.php @@ -548,8 +548,9 @@ function checkStep0 () { 'all' => $language ? 'ok' : 'ko' ); } + function checkStep1 () { - $php = version_compare (PHP_VERSION, '5.2.0') >= 0; + $php = version_compare (PHP_VERSION, '5.2.1') >= 0; $minz = file_exists (LIB_PATH . '/Minz'); $curl = extension_loaded ('curl'); $pdo = extension_loaded ('pdo_mysql'); @@ -721,7 +722,7 @@ function printStep1 () {

-

+

-- cgit v1.2.3 From 670ee57b6288549ac611d53d86d8f5ffee641b0e Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Sat, 8 Mar 2014 20:16:10 +0100 Subject: Interface to enable/disable API and unsafe automatic login https://github.com/marienfressinaud/FreshRSS/issues/13 https://github.com/marienfressinaud/FreshRSS/issues/440 --- app/Controllers/usersController.php | 8 +++++++- app/Models/Feed.php | 11 ++++++----- app/i18n/en.php | 2 ++ app/i18n/fr.php | 2 ++ app/views/configure/users.phtml | 21 +++++++++++++++++++++ 5 files changed, 38 insertions(+), 6 deletions(-) (limited to 'app/Models/Feed.php') diff --git a/app/Controllers/usersController.php b/app/Controllers/usersController.php index b03989cd7..fa967cedc 100644 --- a/app/Controllers/usersController.php +++ b/app/Controllers/usersController.php @@ -69,13 +69,19 @@ class FreshRSS_users_Controller extends Minz_ActionController { $anon_refresh = Minz_Request::param('anon_refresh', false); $anon_refresh = ((bool)$anon_refresh) && ($anon_refresh !== 'no'); $auth_type = Minz_Request::param('auth_type', 'none'); + $unsafe_autologin = Minz_Request::param('unsafe_autologin', false); + $api_enabled = Minz_Request::param('api_enabled', false); if ($anon != Minz_Configuration::allowAnonymous() || $auth_type != Minz_Configuration::authType() || - $anon_refresh != Minz_Configuration::allowAnonymousRefresh()) { + $anon_refresh != Minz_Configuration::allowAnonymousRefresh() || + $unsafe_autologin != Minz_Configuration::unsafeAutologinEnabled() || + $api_enabled != Minz_Configuration::apiEnabled()) { Minz_Configuration::_authType($auth_type); Minz_Configuration::_allowAnonymous($anon); Minz_Configuration::_allowAnonymousRefresh($anon_refresh); + Minz_Configuration::_enableAutologin($unsafe_autologin); + Minz_Configuration::_enableApi($api_enabled); $ok &= Minz_Configuration::writeFile(); } } diff --git a/app/Models/Feed.php b/app/Models/Feed.php index 73f9c32fb..bce3bd24f 100644 --- a/app/Models/Feed.php +++ b/app/Models/Feed.php @@ -254,11 +254,12 @@ class FreshRSS_Feed extends Minz_Model { $elinks = array(); foreach ($item->get_enclosures() as $enclosure) { $elink = $enclosure->get_link(); - if (array_key_exists($elink, $elinks)) continue; - $elinks[$elink] = '1'; - $mime = strtolower($enclosure->get_type()); - if (strpos($mime, 'image/') === 0) { - $content .= '
'; + if (empty($elinks[$elink])) { + $elinks[$elink] = '1'; + $mime = strtolower($enclosure->get_type()); + if (strpos($mime, 'image/') === 0) { + $content .= '
'; + } } } diff --git a/app/i18n/en.php b/app/i18n/en.php index d504ffc11..69247165f 100644 --- a/app/i18n/en.php +++ b/app/i18n/en.php @@ -180,6 +180,8 @@ return array ( 'persona_connection_email' => 'Login mail address
(for Mozilla Persona)', 'allow_anonymous' => 'Allow anonymous reading of the articles of the default user (%s)', 'allow_anonymous_refresh' => 'Allow anonymous refresh of the articles', + 'unsafe_autologin' => 'Allow unsafe automatic login using the format: ', + 'api_enabled' => 'Allow API access (required for mobile apps)', 'auth_token' => 'Authentication token', 'explain_token' => 'Allows to access RSS output of the default user without authentication.
%s?output=rss&token=%s', 'login_configuration' => 'Login', diff --git a/app/i18n/fr.php b/app/i18n/fr.php index c5581a78b..e364ed130 100644 --- a/app/i18n/fr.php +++ b/app/i18n/fr.php @@ -180,6 +180,8 @@ return array ( 'persona_connection_email' => 'Adresse courriel de connexion
(pour Mozilla Persona)', 'allow_anonymous' => 'Autoriser la lecture anonyme des articles de l’utilisateur par défaut (%s)', 'allow_anonymous_refresh' => 'Autoriser le rafraîchissement anonyme des flux', + 'unsafe_autologin' => 'Autoriser les connexion automatiques non-sûres au format : ', + 'api_enabled' => 'Autoriser l’accès par API (nécessaire pour les applis mobiles)', 'auth_token' => 'Jeton d’identification', 'explain_token' => 'Permet d’accéder à la sortie RSS de l’utilisateur par défaut sans besoin de s’authentifier.
%s?output=rss&token=%s', 'login_configuration' => 'Identification', diff --git a/app/views/configure/users.phtml b/app/views/configure/users.phtml index 3f3f19418..1a02b0e90 100644 --- a/app/views/configure/users.phtml +++ b/app/views/configure/users.phtml @@ -90,6 +90,17 @@ +
+
+ +
+
+
@@ -102,6 +113,16 @@
+
+
+ +
+
+
-- cgit v1.2.3 From 5bf511c00f49eb9fd066fb903489e43529dd8338 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Sun, 16 Mar 2014 21:15:23 +0100 Subject: Bug feed name with special chars https://github.com/marienfressinaud/FreshRSS/issues/462 --- app/Models/Feed.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'app/Models/Feed.php') diff --git a/app/Models/Feed.php b/app/Models/Feed.php index bce3bd24f..13d3dfe88 100644 --- a/app/Models/Feed.php +++ b/app/Models/Feed.php @@ -210,8 +210,8 @@ class FreshRSS_Feed extends Minz_Model { } if ($loadDetails) { - $title = htmlspecialchars(html_only_entity_decode($feed->get_title()), ENT_COMPAT, 'UTF-8'); - $this->_name ($title === null ? $this->url : $title); + $title = strtr(html_only_entity_decode($feed->get_title()), array('<' => '<', '>' => '>', '"' => '"')); //HTML to HTML-PRE //ENT_COMPAT except & + $this->_name ($title == '' ? $this->url : $title); $this->_website(html_only_entity_decode($feed->get_link())); $this->_description(html_only_entity_decode($feed->get_description())); -- cgit v1.2.3 From 7f1c305c869ee315131b7ade7abc99f23106d95b Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Tue, 13 May 2014 22:30:24 +0200 Subject: Add audio control for podcasts https://github.com/marienfressinaud/FreshRSS/issues/504 --- app/Models/Feed.php | 2 ++ 1 file changed, 2 insertions(+) (limited to 'app/Models/Feed.php') diff --git a/app/Models/Feed.php b/app/Models/Feed.php index 13d3dfe88..116f96562 100644 --- a/app/Models/Feed.php +++ b/app/Models/Feed.php @@ -259,6 +259,8 @@ class FreshRSS_Feed extends Minz_Model { $mime = strtolower($enclosure->get_type()); if (strpos($mime, 'image/') === 0) { $content .= '
'; + } elseif (strpos($mime, 'audio/') === 0) { + $content .= '