aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2014-03-22 13:22:55 +0100
committerGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2014-03-22 13:22:55 +0100
commit69deb27f654a0d5d5e6fe77733d56a9c4fd29e03 (patch)
treed6fbc0511d76263881cafaa187ce7cca523b9811
parentd1c5db7461ecb69c529149536718baf9b73a1f2c (diff)
parent72ae58d45534b4c8b49ea0ac33a9a9ec9df4bdb1 (diff)
Merge remote-tracking branch 'origin/dev' into 163-export
-rw-r--r--app/Models/Feed.php4
-rw-r--r--app/views/configure/categorize.phtml4
-rw-r--r--lib/Minz/Cache.php116
-rw-r--r--lib/Minz/Configuration.php22
-rw-r--r--lib/Minz/Dispatcher.php57
5 files changed, 25 insertions, 178 deletions
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('<' => '&lt;', '>' => '&gt;', '"' => '&quot;')); //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()));
diff --git a/app/views/configure/categorize.phtml b/app/views/configure/categorize.phtml
index a564e8cdd..c0171d2dc 100644
--- a/app/views/configure/categorize.phtml
+++ b/app/views/configure/categorize.phtml
@@ -17,11 +17,11 @@
<input type="text" id="cat_<?php echo $cat->id (); ?>" name="categories[]" value="<?php echo $cat->name (); ?>" />
<?php if ($cat->nbFeed () > 0) { ?>
- <a class="confirm" href="<?php echo _url ('feed', 'delete', 'id', $cat->id (), 'type', 'category'); ?>"><?php echo Minz_Translate::t ('ask_empty'); ?></a>
+ <button type="submit" class="btn btn-attention confirm" formaction="<?php echo _url ('feed', 'delete', 'id', $cat->id (), 'type', 'category'); ?>"><?php echo Minz_Translate::t ('ask_empty'); ?></button>
<?php } ?>
(<?php echo Minz_Translate::t ('number_feeds', $cat->nbFeed ()); ?>)
- <?php if ($cat->id () == $this->defaultCategory->id ()) { ?>
+ <?php if ($cat->id () === $this->defaultCategory->id ()) { ?>
<?php echo FreshRSS_Themes::icon('help'); ?> <?php echo Minz_Translate::t ('can_not_be_deleted'); ?>
<?php } ?>
diff --git a/lib/Minz/Cache.php b/lib/Minz/Cache.php
deleted file mode 100644
index fcb627eb2..000000000
--- a/lib/Minz/Cache.php
+++ /dev/null
@@ -1,116 +0,0 @@
-<?php
-/**
- * MINZ - Copyright 2011 Marien Fressinaud
- * Sous licence AGPL3 <http://www.gnu.org/licenses/>
-*/
-
-/**
- * La classe Cache permet de gérer facilement les pages en cache
- */
-class Minz_Cache {
- /**
- * $expire timestamp auquel expire le cache de $url
- */
- private $expire = 0;
-
- /**
- * $file est le nom du fichier de cache
- */
- private $file = '';
-
- /**
- * $enabled permet de déterminer si le cache est activé
- */
- private static $enabled = true;
-
- /**
- * Constructeur
- */
- public function __construct () {
- $this->_fileName ();
- $this->_expire ();
- }
-
- /**
- * Setteurs
- */
- public function _fileName () {
- $file = md5 (Minz_Request::getURI ());
-
- $this->file = CACHE_PATH . '/'.$file;
- }
-
- public function _expire () {
- if ($this->exist ()) {
- $this->expire = filemtime ($this->file)
- + Minz_Configuration::delayCache ();
- }
- }
-
- /**
- * Permet de savoir si le cache est activé
- * @return true si activé, false sinon
- */
- public static function isEnabled () {
- return Minz_Configuration::cacheEnabled () && self::$enabled;
- }
-
- /**
- * Active / désactive le cache
- */
- public static function switchOn () {
- self::$enabled = true;
- }
- public static function switchOff () {
- self::$enabled = false;
- }
-
- /**
- * Détermine si le cache de $url a expiré ou non
- * @return true si il a expiré, false sinon
- */
- public function expired () {
- return time () > $this->expire;
- }
-
- /**
- * Affiche le contenu du cache
- * @print le code html du cache
- */
- public function render () {
- if ($this->exist ()) {
- include ($this->file);
- }
- }
-
- /**
- * Enregistre $html en cache
- * @param $html le html à mettre en cache
- */
- public function cache ($html) {
- file_put_contents ($this->file, $html);
- }
-
- /**
- * Permet de savoir si le cache existe
- * @return true si il existe, false sinon
- */
- public function exist () {
- return file_exists ($this->file);
- }
-
- /**
- * Nettoie le cache en supprimant tous les fichiers
- */
- public static function clean () {
- $files = opendir (CACHE_PATH);
-
- while ($fic = readdir ($files)) {
- if ($fic != '.' && $fic != '..') {
- unlink (CACHE_PATH.'/'.$fic);
- }
- }
-
- closedir ($files);
- }
-}
diff --git a/lib/Minz/Configuration.php b/lib/Minz/Configuration.php
index 324aae881..d905f6ddd 100644
--- a/lib/Minz/Configuration.php
+++ b/lib/Minz/Configuration.php
@@ -34,8 +34,6 @@ class Minz_Configuration {
* $base_url le chemin de base pour accéder à l'application
* $title le nom de l'application
* $language la langue par défaut de l'application
- * $cacheEnabled permet de savoir si le cache doit être activé
- * $delayCache la limite de cache
* $db paramètres pour la base de données (tableau)
* - host le serveur de la base
* - user nom d'utilisateur
@@ -48,8 +46,6 @@ class Minz_Configuration {
private static $use_url_rewriting = false;
private static $title = '';
private static $language = 'en';
- private static $cache_enabled = false;
- private static $delay_cache = 3600;
private static $default_user = '';
private static $allow_anonymous = false;
private static $allow_anonymous_refresh = false;
@@ -103,12 +99,6 @@ class Minz_Configuration {
public static function language () {
return self::$language;
}
- public static function cacheEnabled () {
- return self::$cache_enabled;
- }
- public static function delayCache () {
- return self::$delay_cache;
- }
public static function dataBase () {
return self::$db;
}
@@ -282,18 +272,6 @@ class Minz_Configuration {
if (isset ($general['language'])) {
self::$language = $general['language'];
}
- if (isset ($general['cache_enabled'])) {
- self::$cache_enabled = $general['cache_enabled'];
- if (CACHE_PATH === false && self::$cache_enabled) {
- throw new FileNotExistException (
- 'CACHE_PATH',
- Minz_Exception::ERROR
- );
- }
- }
- if (isset ($general['delay_cache'])) {
- self::$delay_cache = inval($general['delay_cache']);
- }
if (isset ($general['default_user'])) {
self::$default_user = $general['default_user'];
}
diff --git a/lib/Minz/Dispatcher.php b/lib/Minz/Dispatcher.php
index 71dfe8ac6..819f4cd5c 100644
--- a/lib/Minz/Dispatcher.php
+++ b/lib/Minz/Dispatcher.php
@@ -41,7 +41,6 @@ class Minz_Dispatcher {
* @exception Minz_Exception
*/
public function run ($ob = true) {
- $cache = new Minz_Cache();
// Le ob_start est dupliqué : sans ça il y a un bug sous Firefox
// ici on l'appelle avec 'ob_gzhandler', après sans.
// Vraisemblablement la compression fonctionne mais c'est sale
@@ -50,45 +49,31 @@ class Minz_Dispatcher {
ob_start ('ob_gzhandler');
}
- if (Minz_Cache::isEnabled () && !$cache->expired ()) {
- if ($ob) {
- ob_start ();
- }
- $cache->render ();
- if ($ob) {
- $text = ob_get_clean();
- }
- } else {
- $text = ''; //TODO: Clean this code
- while (Minz_Request::$reseted) {
- Minz_Request::$reseted = false;
+ $text = ''; //TODO: Clean this code
+ while (Minz_Request::$reseted) {
+ Minz_Request::$reseted = false;
- try {
- $this->createController ('FreshRSS_' . Minz_Request::controllerName () . '_Controller');
- $this->controller->init ();
- $this->controller->firstAction ();
- $this->launchAction (
- Minz_Request::actionName ()
- . 'Action'
- );
- $this->controller->lastAction ();
+ try {
+ $this->createController ('FreshRSS_' . Minz_Request::controllerName () . '_Controller');
+ $this->controller->init ();
+ $this->controller->firstAction ();
+ $this->launchAction (
+ Minz_Request::actionName ()
+ . 'Action'
+ );
+ $this->controller->lastAction ();
- if (!Minz_Request::$reseted) {
- if ($ob) {
- ob_start ();
- }
- $this->controller->view ()->build ();
- if ($ob) {
- $text = ob_get_clean();
- }
+ if (!Minz_Request::$reseted) {
+ if ($ob) {
+ ob_start ();
+ }
+ $this->controller->view ()->build ();
+ if ($ob) {
+ $text = ob_get_clean();
}
- } catch (Minz_Exception $e) {
- throw $e;
}
- }
-
- if (Minz_Cache::isEnabled ()) {
- $cache->cache ($text);
+ } catch (Minz_Exception $e) {
+ throw $e;
}
}