From 97c3c7575a586382ea87f8faa1e9e78afb64710a Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Sun, 10 Nov 2013 19:45:48 +0100 Subject: Suppression des warnings liés à filemtime MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ajout de "@" pour éviter les warnings, touch.txt sera créé un peu plus tard --- app/App_FrontController.php | 10 +++++----- app/controllers/indexController.php | 4 ++-- public/index.php | 10 ++++++---- 3 files changed, 13 insertions(+), 11 deletions(-) diff --git a/app/App_FrontController.php b/app/App_FrontController.php index 82499ada3..5569d73a3 100644 --- a/app/App_FrontController.php +++ b/app/App_FrontController.php @@ -54,18 +54,18 @@ class App_FrontController extends FrontController { $theme = RSSThemes::get_infos($this->conf->theme()); if ($theme) { foreach($theme["files"] as $file) { - View::appendStyle (Url::display ('/themes/' . $theme['path'] . '/' . $file . '?' . filemtime(PUBLIC_PATH . '/themes/' . $theme['path'] . '/' . $file))); + View::appendStyle (Url::display ('/themes/' . $theme['path'] . '/' . $file . '?' . @filemtime(PUBLIC_PATH . '/themes/' . $theme['path'] . '/' . $file))); } } - View::appendStyle (Url::display ('/themes/printer/style.css?' . filemtime(PUBLIC_PATH . '/themes/printer/style.css')), 'print'); + View::appendStyle (Url::display ('/themes/printer/style.css?' . @filemtime(PUBLIC_PATH . '/themes/printer/style.css')), 'print'); if (login_is_conf ($this->conf)) { View::appendScript ('https://login.persona.org/include.js'); } - View::appendScript (Url::display ('/scripts/jquery.min.js?' . filemtime(PUBLIC_PATH . '/scripts/jquery.min.js'))); + View::appendScript (Url::display ('/scripts/jquery.min.js?' . @filemtime(PUBLIC_PATH . '/scripts/jquery.min.js'))); if ($this->conf->lazyload () === 'yes' && ($this->conf->displayPosts () === 'yes' || Request::param ('output') === 'reader')) { - View::appendScript (Url::display ('/scripts/jquery.lazyload.min.js?' . filemtime(PUBLIC_PATH . '/scripts/jquery.lazyload.min.js'))); + View::appendScript (Url::display ('/scripts/jquery.lazyload.min.js?' . @filemtime(PUBLIC_PATH . '/scripts/jquery.lazyload.min.js'))); } - View::appendScript (Url::display ('/scripts/main.js?' . filemtime(PUBLIC_PATH . '/scripts/main.js'))); + View::appendScript (Url::display ('/scripts/main.js?' . @filemtime(PUBLIC_PATH . '/scripts/main.js'))); } private function loadNotifications () { diff --git a/app/controllers/indexController.php b/app/controllers/indexController.php index ee40ff9d2..2f86034ee 100755 --- a/app/controllers/indexController.php +++ b/app/controllers/indexController.php @@ -49,10 +49,10 @@ class indexController extends ActionController { Request::_param ('output', $output); } - View::appendScript (Url::display ('/scripts/shortcut.js?' . filemtime(PUBLIC_PATH . '/scripts/shortcut.js'))); + View::appendScript (Url::display ('/scripts/shortcut.js?' . @filemtime(PUBLIC_PATH . '/scripts/shortcut.js'))); if ($output == 'global') { - View::appendScript (Url::display ('/scripts/global_view.js?' . filemtime(PUBLIC_PATH . '/scripts/global_view.js'))); + View::appendScript (Url::display ('/scripts/global_view.js?' . @filemtime(PUBLIC_PATH . '/scripts/global_view.js'))); } } diff --git a/public/index.php b/public/index.php index b5333c5c0..d3b752905 100755 --- a/public/index.php +++ b/public/index.php @@ -30,11 +30,13 @@ if (file_exists (PUBLIC_PATH . '/install.php')) { } else { session_cache_limiter(''); require (LIB_PATH . '/http-conditional.php'); - $dateLastModification = max(filemtime(PUBLIC_PATH . '/data/touch.txt'), + $dateLastModification = max( + @filemtime(PUBLIC_PATH . '/data/touch.txt'), @filemtime(LOG_PATH . '/application.log'), - filemtime(PUBLIC_PATH . '/data/Configuration.array.php'), - filemtime(APP_PATH . '/configuration/application.ini'), - time() - 14400); + @filemtime(PUBLIC_PATH . '/data/Configuration.array.php'), + @filemtime(APP_PATH . '/configuration/application.ini'), + time() - 14400 + ); if (httpConditional($dateLastModification, 0, 0, false, false, true)) { exit(); //No need to send anything } -- cgit v1.2.3 From 3bd4e808789b53ed6b338f4dbe42494b00ae1251 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Sun, 10 Nov 2013 20:19:41 +0100 Subject: Suppression limitateur de cache MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Le cache semble bien fonctionner. Suppression de la limite de 4 heures utilisée pour la 0.6 --- public/index.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/public/index.php b/public/index.php index d3b752905..dc6da259d 100755 --- a/public/index.php +++ b/public/index.php @@ -34,8 +34,7 @@ if (file_exists (PUBLIC_PATH . '/install.php')) { @filemtime(PUBLIC_PATH . '/data/touch.txt'), @filemtime(LOG_PATH . '/application.log'), @filemtime(PUBLIC_PATH . '/data/Configuration.array.php'), - @filemtime(APP_PATH . '/configuration/application.ini'), - time() - 14400 + @filemtime(APP_PATH . '/configuration/application.ini') ); if (httpConditional($dateLastModification, 0, 0, false, false, true)) { exit(); //No need to send anything -- cgit v1.2.3 From 76a027c9bbfc646c9690f00d63be49cc4287b9c3 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Sun, 10 Nov 2013 22:45:58 +0100 Subject: Amélioration des performances de small_hash MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/lib_rss.php | 8 ++------ public/install.php | 7 ++----- 2 files changed, 4 insertions(+), 11 deletions(-) diff --git a/lib/lib_rss.php b/lib/lib_rss.php index 7f22c8244..2f694fc12 100644 --- a/lib/lib_rss.php +++ b/lib/lib_rss.php @@ -9,14 +9,10 @@ function login_is_conf ($conf) { return $conf->mailLogin () != false; } -// tiré de Shaarli de Seb Sauvage +// tiré de Shaarli de Seb Sauvage //Format RFC 4648 base64url function small_hash ($txt) { $t = rtrim (base64_encode (hash ('crc32', $txt, true)), '='); - $t = str_replace ('+', '-', $t); // Get rid of characters which need encoding in URLs. - $t = str_replace ('/', '_', $t); - $t = str_replace ('=', '@', $t); - - return $t; + return strtr ($t, '+/', '-_'); } function timestamptodate ($t, $hour = true) { diff --git a/public/install.php b/public/install.php index 5b0618c37..0c39a031e 100644 --- a/public/install.php +++ b/public/install.php @@ -66,13 +66,10 @@ function writeArray ($f, $array) { } } +// tiré de Shaarli de Seb Sauvage //Format RFC 4648 base64url function small_hash ($txt) { $t = rtrim (base64_encode (hash ('crc32', $txt, true)), '='); - $t = str_replace ('+', '-', $t); // Get rid of characters which need encoding in URLs. - $t = str_replace ('/', '_', $t); - $t = str_replace ('=', '@', $t); - - return $t; + return strtr ($t, '+/', '-_'); } // gestion internationalisation -- cgit v1.2.3 From a4fc7becb8553198d132633d775989c89c8116cd Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Mon, 11 Nov 2013 17:40:28 +0100 Subject: Décode les entités HTML en conservant les entités XML MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit N'ayant pas trouvé comment régler SimplePie pour ne pas avoir d'entités HTML comme `é`, voici un patch qui les décode en sortie de SimplePie tout en conservant les entités XML comme `&`. Contribue à https://github.com/marienfressinaud/FreshRSS/issues/247 --- app/models/Feed.php | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/app/models/Feed.php b/app/models/Feed.php index 7f53d7be8..41750d43e 100644 --- a/app/models/Feed.php +++ b/app/models/Feed.php @@ -241,12 +241,22 @@ class Feed extends Model { } } } + static function html_only_entity_decode($text) { + static $htmlEntitiesOnly = null; + if ($htmlEntitiesOnly === null) { + $htmlEntitiesOnly = array_flip(array_diff( + get_html_translation_table(HTML_ENTITIES, ENT_NOQUOTES, 'UTF-8'), //Decode HTML entities + get_html_translation_table(HTML_SPECIALCHARS, ENT_NOQUOTES, 'UTF-8') //Preserve XML entities + )); + } + return strtr($text, $htmlEntitiesOnly); + } private function loadEntries ($feed) { $entries = array (); foreach ($feed->get_items () as $item) { - $title = strip_tags($item->get_title ()); - $author = $item->get_author (); + $title = self::html_only_entity_decode (strip_tags ($item->get_title ())); + $author = self::html_only_entity_decode ($item->get_author ()); $link = $item->get_permalink (); $date = strtotime ($item->get_date ()); @@ -255,11 +265,12 @@ class Feed extends Model { $tags = array (); if (!is_null ($tags_tmp)) { foreach ($tags_tmp as $tag) { - $tags[] = $tag->get_label (); + $tags[] = self::html_only_entity_decode ($tag->get_label ()); } } - $content = $item->get_content (); + $content = self::html_only_entity_decode ($item->get_content ()); + $elinks = array(); foreach ($item->get_enclosures() as $enclosure) { $elink = $enclosure->get_link(); -- cgit v1.2.3 From a664b85372770155e2d9c4b500194f050a0c1685 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Mon, 11 Nov 2013 17:53:22 +0100 Subject: Remplace entité nbsp par son équivalent Unicode MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Chasse aux entités ! Nous devrions maintenant avoir des pages sans entités HTML (mais bien sûr des entités XML) ni depuis FreshRSS ni depuis le contenu. --- app/layout/aside_feed.phtml | 2 +- app/layout/aside_flux.phtml | 2 +- app/layout/header.phtml | 2 +- app/layout/nav_menu.phtml | 4 ++-- app/views/configure/display.phtml | 8 ++++---- app/views/helpers/view/normal_view.phtml | 20 ++++++++++---------- 6 files changed, 19 insertions(+), 19 deletions(-) diff --git a/app/layout/aside_feed.phtml b/app/layout/aside_feed.phtml index 1f60e3ada..3cfce61c5 100644 --- a/app/layout/aside_feed.phtml +++ b/app/layout/aside_feed.phtml @@ -9,7 +9,7 @@ diff --git a/app/views/helpers/pagination.phtml b/app/views/helpers/pagination.phtml index 408cfca1b..d4983a32e 100755 --- a/app/views/helpers/pagination.phtml +++ b/app/views/helpers/pagination.phtml @@ -1,25 +1,25 @@
  • nextId)) { ?> nextId; ?> - + -
    +

    - +
    -
    +
  • diff --git a/app/views/helpers/view/global_view.phtml b/app/views/helpers/view/global_view.phtml index ac17d608a..bc6e24e37 100644 --- a/app/views/helpers/view/global_view.phtml +++ b/app/views/helpers/view/global_view.phtml @@ -32,5 +32,5 @@
    conf->displayPosts () === 'no' ? ' class="hide_posts"' : ''; ?>> - +
    \ No newline at end of file diff --git a/app/views/helpers/view/normal_view.phtml b/app/views/helpers/view/normal_view.phtml index 1a7efa58f..094017957 100644 --- a/app/views/helpers/view/normal_view.phtml +++ b/app/views/helpers/view/normal_view.phtml @@ -24,23 +24,23 @@ if (!empty($this->entries)) { ?> entries as $item) { ?> - isDay (Days::TODAY)) { ?> + isDay (FreshRSS_Days::TODAY)) { ?>
    - + - currentName; ?>
    - isDay (Days::YESTERDAY)) { ?> + isDay (FreshRSS_Days::YESTERDAY)) { ?>
    - + - currentName; ?>
    - isDay (Days::BEFORE_YESTERDAY)) { ?> + isDay (FreshRSS_Days::BEFORE_YESTERDAY)) { ?>
    - + currentName; ?>
    @@ -51,13 +51,13 @@ if (!empty($this->entries)) { if ($this->conf->toplineRead ()) { ?>
  • isRead () ? 'read' : 'unread'); ?>isRead () ? 'read' : 'unread'); ?>
  • conf->toplineFavorite ()) { ?>
  • isFavorite () ? 'starred' : 'non-starred'); ?>isFavorite () ? 'starred' : 'non-starred'); ?>
  • entries)) {
  • ✇ name(); ?>
  • title (); ?>
  • conf->toplineDate ()) { ?>
  • date (); ?> 
  • - conf->toplineLink ()) { ?> + conf->toplineLink ()) { ?>
@@ -75,7 +75,7 @@ if (!empty($this->entries)) {

title (); ?>

author (); - echo $author != '' ? '
' . Translate::t ('by_author', $author) . '
' : ''; + echo $author != '' ? '
' . Minz_Translate::t ('by_author', $author) . '
' : ''; if($this->conf->lazyload() == 'yes') { echo lazyimg($item->content ()); } else { @@ -83,19 +83,18 @@ if (!empty($this->entries)) { } ?>
-
    conf) || is_logged ()) { if ($this->conf->bottomlineRead ()) { ?>
  • isRead () ? 'read' : 'unread'); ?>isRead () ? 'read' : 'unread'); ?>
  • conf->bottomlineFavorite ()) { ?>
  • isFavorite () ? 'starred' : 'non-starred'); ?>isFavorite () ? 'starred' : 'non-starred'); ?>
  • @@ -111,8 +110,8 @@ if (!empty($this->entries)) { @@ -204,6 +203,6 @@ if (!empty($this->entries)) {
    - +
    \ No newline at end of file diff --git a/app/views/helpers/view/reader_view.phtml b/app/views/helpers/view/reader_view.phtml index 30226af42..29b2be04c 100644 --- a/app/views/helpers/view/reader_view.phtml +++ b/app/views/helpers/view/reader_view.phtml @@ -21,7 +21,7 @@ if (!empty($this->entries)) {
    author (); ?> - + date (); ?>
    @@ -42,6 +42,6 @@ if (!empty($this->entries)) {
    - +
    \ No newline at end of file diff --git a/app/views/helpers/view/rss_view.phtml b/app/views/helpers/view/rss_view.phtml index 460146dc0..620bf1388 100755 --- a/app/views/helpers/view/rss_view.phtml +++ b/app/views/helpers/view/rss_view.phtml @@ -2,11 +2,11 @@ <?php echo $this->rss_title; ?> - - rss_title); ?> + + rss_title); ?> GMT - + entries as $item) { ?> diff --git a/app/views/index/about.phtml b/app/views/index/about.phtml index fa799154b..b5c00a1ed 100644 --- a/app/views/index/about.phtml +++ b/app/views/index/about.phtml @@ -1,24 +1,24 @@
    - + -

    +

    -
    +
    -
    -
    Marien Fressinaud -
    +
    +
    Marien Fressinaud -
    -
    -
    +
    +
    -
    -
    +
    +
    -

    +

    -

    -

    +

    +

    diff --git a/app/views/index/index.phtml b/app/views/index/index.phtml index bd18d2d77..cf98060c4 100644 --- a/app/views/index/index.phtml +++ b/app/views/index/index.phtml @@ -1,8 +1,8 @@ conf->token(); -$token_param = Request::param ('token', ''); +$token_param = Minz_Request::param ('token', ''); $token_is_ok = ($token != '' && $token == $token_param); if(!login_is_conf ($this->conf) || @@ -21,9 +21,9 @@ if(!login_is_conf ($this->conf) || } else { ?>
    -

    -

    -

    +

    +

    +

    - + -

    +

    - +

    logsPaginator->items (); ?> @@ -20,6 +20,6 @@ logsPaginator->render ('logs_pagination.phtml','page'); ?> -

    +

    diff --git a/app/views/javascript/actualize.phtml b/app/views/javascript/actualize.phtml index f39540a9a..69689133c 100644 --- a/app/views/javascript/actualize.phtml +++ b/app/views/javascript/actualize.phtml @@ -1,12 +1,12 @@ var feeds = new Array (); feeds as $feed) { ?> -feeds.push (" 'feed', 'a' => 'actualize', 'params' => array ('id' => $feed->id (), 'ajax' => '1')), 'php'); ?>"); +feeds.push (" 'feed', 'a' => 'actualize', 'params' => array ('id' => $feed->id (), 'ajax' => '1')), 'php'); ?>"); function initProgressBar (init) { if (init) { $("body").after ("\
    \ - 0 / " + feeds.length + "
    \ + 0 / " + feeds.length + "
    \ \
    "); } else { diff --git a/lib/Minz/ActionException.php b/lib/Minz/ActionException.php new file mode 100644 index 000000000..c566a076f --- /dev/null +++ b/lib/Minz/ActionException.php @@ -0,0 +1,9 @@ + +*/ + +/** + * 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/ControllerNotActionControllerException.php b/lib/Minz/ControllerNotActionControllerException.php new file mode 100644 index 000000000..535a1377e --- /dev/null +++ b/lib/Minz/ControllerNotActionControllerException.php @@ -0,0 +1,9 @@ + +*/ + +/** + * La classe Log permet de logger des erreurs + */ +class Minz_Log { + /** + * Les différents niveau de log + * ERROR erreurs bloquantes de l'application + * WARNING erreurs pouvant géner le bon fonctionnement, mais non bloquantes + * NOTICE erreurs mineures ou messages d'informations + * DEBUG Informations affichées pour le déboggage + */ + const ERROR = 2; + const WARNING = 4; + const NOTICE = 8; + const DEBUG = 16; + + /** + * Enregistre un message dans un fichier de log spécifique + * Message non loggué si + * - environment = SILENT + * - level = WARNING et environment = PRODUCTION + * - level = NOTICE et environment = PRODUCTION + * @param $information message d'erreur / information à enregistrer + * @param $level niveau d'erreur + * @param $file_name fichier de log, par défaut LOG_PATH/application.log + */ + public static function record ($information, $level, $file_name = null) { + $env = Minz_Configuration::environment (); + + if (! ($env === Minz_Configuration::SILENT + || ($env === Minz_Configuration::PRODUCTION + && ($level >= Minz_Log::NOTICE)))) { + if (is_null ($file_name)) { + $file_name = LOG_PATH . '/application.log'; + } + + switch ($level) { + case Minz_Log::ERROR : + $level_label = 'error'; + break; + case Minz_Log::WARNING : + $level_label = 'warning'; + break; + case Minz_Log::NOTICE : + $level_label = 'notice'; + break; + case Minz_Log::DEBUG : + $level_label = 'debug'; + break; + default : + $level_label = 'unknown'; + } + + if ($env == Minz_Configuration::PRODUCTION) { + $file = @fopen ($file_name, 'a'); + } else { + $file = fopen ($file_name, 'a'); + } + + if ($file !== false) { + $log = '[' . date('r') . ']'; + $log .= ' [' . $level_label . ']'; + $log .= ' --- ' . $information . "\n"; + fwrite ($file, $log); + fclose ($file); + } else { + throw new Minz_PermissionDeniedException ( + $file_name, + Minz_Exception::ERROR + ); + } + } + } + + /** + * Automatise le log des variables globales $_GET et $_POST + * Fait appel à la fonction record(...) + * Ne fonctionne qu'en environnement "development" + * @param $file_name fichier de log, par défaut LOG_PATH/application.log + */ + public static function recordRequest($file_name = null) { + $msg_get = str_replace("\n", '', '$_GET content : ' . print_r($_GET, true)); + $msg_post = str_replace("\n", '', '$_POST content : ' . print_r($_POST, true)); + + self::record($msg_get, Minz_Log::DEBUG, $file_name); + self::record($msg_post, Minz_Log::DEBUG, $file_name); + } +} diff --git a/lib/Minz/ModelArray.php b/lib/Minz/ModelArray.php new file mode 100644 index 000000000..4ba022143 --- /dev/null +++ b/lib/Minz/ModelArray.php @@ -0,0 +1,122 @@ + +*/ + +/** + * La classe Model_array représente le modèle interragissant avec les fichiers de type texte gérant des tableaux php + */ +class Minz_ModelArray extends Minz_ModelTxt { + /** + * $array Le tableau php contenu dans le fichier $nameFile + */ + protected $array = array (); + + /** + * Ouvre le fichier indiqué, charge le tableau dans $array et le $nameFile + * @param $nameFile le nom du fichier à ouvrir contenant un tableau + * Remarque : $array sera obligatoirement un tableau + */ + public function __construct ($nameFile) { + parent::__construct ($nameFile); + + if (!$this->getLock ('read')) { + throw new Minz_PermissionDeniedException ($this->filename); + } else { + $this->array = include ($this->filename); + $this->releaseLock (); + + if (!is_array ($this->array)) { + $this->array = array (); + } + + $this->array = $this->decodeArray ($this->array); + } + } + + /** + * Écrit un tableau dans le fichier $nameFile + * @param $array le tableau php à enregistrer + **/ + public function writeFile ($array) { + if (!$this->getLock ('write')) { + throw new Minz_PermissionDeniedException ($this->namefile); + } else { + $this->erase (); + + $this->writeLine ('writeLine ('return ', false); + $this->writeArray ($array); + $this->writeLine (';'); + + $this->releaseLock (); + } + } + + private function writeArray ($array, $profondeur = 0) { + $tab = ''; + for ($i = 0; $i < $profondeur; $i++) { + $tab .= "\t"; + } + $this->writeLine ('array ('); + + foreach ($array as $key => $value) { + if (is_int ($key)) { + $this->writeLine ($tab . "\t" . $key . ' => ', false); + } else { + $this->writeLine ($tab . "\t" . '\'' . $key . '\'' . ' => ', false); + } + + if (is_array ($value)) { + $this->writeArray ($value, $profondeur + 1); + $this->writeLine (','); + } else { + if (is_numeric ($value)) { + $this->writeLine ($value . ','); + } else { + $this->writeLine ('\'' . addslashes ($value) . '\','); + } + } + } + + $this->writeLine ($tab . ')', false); + } + + private function decodeArray ($array) { + $new_array = array (); + + foreach ($array as $key => $value) { + if (is_array ($value)) { + $new_array[$key] = $this->decodeArray ($value); + } else { + $new_array[$key] = stripslashes ($value); + } + } + + return $new_array; + } + + private function getLock ($type) { + if ($type == 'write') { + $lock = LOCK_EX; + } else { + $lock = LOCK_SH; + } + + $count = 1; + while (!flock ($this->file, $lock) && $count <= 50) { + $count++; + } + + if ($count >= 50) { + return false; + } else { + return true; + } + } + + private function releaseLock () { + flock ($this->file, LOCK_UN); + } +} diff --git a/lib/Minz/ModelPdo.php b/lib/Minz/ModelPdo.php new file mode 100644 index 000000000..9655539b2 --- /dev/null +++ b/lib/Minz/ModelPdo.php @@ -0,0 +1,111 @@ + +*/ + +/** + * La classe Model_sql représente le modèle interragissant avec les bases de données + * Seul la connexion MySQL est prise en charge pour le moment + */ +class Minz_ModelPdo { + + /** + * Partage la connexion à la base de données entre toutes les instances. + */ + public static $useSharedBd = true; + private static $sharedBd = null; + private static $sharedPrefix; + + /** + * $bd variable représentant la base de données + */ + protected $bd; + + protected $prefix; + + /** + * 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) { + $this->bd = self::$sharedBd; + $this->prefix = self::$sharedPrefix; + return; + } + + $db = Minz_Configuration::dataBase (); + $driver_options = null; + + try { + $type = $db['type']; + if($type == 'mysql') { + $string = $type + . ':host=' . $db['host'] + . ';dbname=' . $db['base'] + . ';charset=utf8'; + $driver_options = array( + PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8' + ); + } elseif($type == 'sqlite') { + $string = $type . ':/' . DATA_PATH . $db['base'] . '.sqlite'; //TODO: DEBUG UTF-8 http://www.siteduzero.com/forum/sujet/sqlite-connexion-utf-8-18797 + } + + $this->bd = new FreshPDO ( + $string, + $db['user'], + $db['password'], + $driver_options + ); + self::$sharedBd = $this->bd; + + $userPrefix = Minz_Configuration::currentUser (); + $this->prefix = $db['prefix'] . (empty($userPrefix) ? '' : ($userPrefix . '_')); + self::$sharedPrefix = $this->prefix; + } catch (Exception $e) { + throw new Minz_PDOConnectionException ( + $string, + $db['user'], Minz_Exception::ERROR + ); + } + } + + public function beginTransaction() { + $this->bd->beginTransaction(); + } + public function commit() { + $this->bd->commit(); + } + public function rollBack() { + $this->bd->rollBack(); + } + + public function size() { + $db = Minz_Configuration::dataBase (); + $sql = 'SELECT SUM(data_length + index_length) FROM information_schema.TABLES WHERE table_schema = ?'; + $stm = $this->bd->prepare ($sql); + $values = array ($db['base']); + $stm->execute ($values); + $res = $stm->fetchAll(PDO::FETCH_COLUMN, 0); + return $res[0]; + } +} + +class FreshPDO extends PDO { + private static function check($statement) { + if (preg_match('/^(?:UPDATE|INSERT|DELETE)/i', $statement)) { + invalidateHttpCache(); + } + } + + public function prepare ($statement, $driver_options = array()) { + FreshPDO::check($statement); + return parent::prepare($statement, $driver_options); + } + + public function exec ($statement) { + FreshPDO::check($statement); + return parent::exec($statement); + } +} diff --git a/lib/Minz/ModelTxt.php b/lib/Minz/ModelTxt.php new file mode 100644 index 000000000..8c5973f4d --- /dev/null +++ b/lib/Minz/ModelTxt.php @@ -0,0 +1,84 @@ + +*/ + +/** + * La classe Model_txt représente le modèle interragissant avec les fichiers de type texte + */ +class Minz_ModelTxt { + /** + * $file représente le fichier à ouvrir + */ + protected $file; + + /** + * $filename est le nom du fichier + */ + protected $filename; + + /** + * Ouvre un fichier dans $file + * @param $nameFile nom du fichier à ouvrir + * @param $mode mode d'ouverture du fichier ('a+' par défaut) + * @exception FileNotExistException si le fichier n'existe pas + * > ou ne peux pas être ouvert + */ + public function __construct ($nameFile, $mode = 'a+') { + $this->filename = $nameFile; + if (!file_exists($this->filename)) { + throw new Minz_FileNotExistException ( + $this->filename, + Minz_Exception::WARNING + ); + } + + $this->file = @fopen ($this->filename, $mode); + + if (!$this->file) { + throw new Minz_PermissionDeniedException ( + $this->filename, + Minz_Exception::WARNING + ); + } + } + + /** + * Lit une ligne de $file + * @return une ligne du fichier + */ + public function readLine () { + return fgets ($this->file); + } + + /** + * Écrit une ligne dans $file + * @param $line la ligne à écrire + */ + public function writeLine ($line, $newLine = true) { + $char = ''; + if ($newLine) { + $char = "\n"; + } + + fwrite ($this->file, $line . $char); + } + + /** + * Efface le fichier $file + * @return true en cas de succès, false sinon + */ + public function erase () { + return ftruncate ($this->file, 0); + } + + /** + * Ferme $file + */ + public function __destruct () { + if (isset ($this->file)) { + fclose ($this->file); + } + } +} diff --git a/lib/Minz/PDOConnectionException.php b/lib/Minz/PDOConnectionException.php new file mode 100644 index 000000000..faf2e0fe9 --- /dev/null +++ b/lib/Minz/PDOConnectionException.php @@ -0,0 +1,9 @@ +route = $route; + + $message = 'Route `' . $route . '` not found'; + + parent::__construct ($message, $code); + } + + public function route () { + return $this->route; + } +} diff --git a/lib/SimplePie_autoloader.php b/lib/SimplePie_autoloader.php deleted file mode 100644 index 3f67635b0..000000000 --- a/lib/SimplePie_autoloader.php +++ /dev/null @@ -1,86 +0,0 @@ -path = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'SimplePie'; - } - - /** - * Autoloader - * - * @param string $class The name of the class to attempt to load. - */ - public function autoload($class) - { - // Only load the class if it starts with "SimplePie" - if (strpos($class, 'SimplePie') !== 0) - { - return; - } - - $filename = $this->path . DIRECTORY_SEPARATOR . str_replace('_', DIRECTORY_SEPARATOR, $class) . '.php'; - include $filename; - } -} diff --git a/lib/lib_rss.php b/lib/lib_rss.php index 4f5b90b61..2fdfd4bd8 100644 --- a/lib/lib_rss.php +++ b/lib/lib_rss.php @@ -15,6 +15,31 @@ if (!function_exists('json_encode')) { } } +// +function classAutoloader($class) { + if (strpos($class, 'FreshRSS') === 0) { + $components = explode('_', $class); + switch (count($components)) { + case 1: + include(APP_PATH . '/' . $components[0] . '.php'); + return; + case 2: + include(APP_PATH . '/Models/' . $components[1] . '.php'); + return; + case 3: //Controllers, Exceptions + include(APP_PATH . '/' . $components[2] . 's/' . $components[1] . $components[2] . '.php'); + return; + } + } elseif (strpos($class, 'Minz') === 0) { + include(LIB_PATH . '/' . str_replace('_', '/', $class) . '.php'); + } elseif (strpos($class, 'SimplePie') === 0) { + include(LIB_PATH . '/SimplePie/' . str_replace('_', '/', $class) . '.php'); + } +} + +spl_autoload_register('classAutoloader'); +// + function checkUrl($url) { if (empty ($url)) { return ''; @@ -33,7 +58,7 @@ function checkUrl($url) { // vérifie qu'on est connecté function is_logged () { - return Session::param ('mail') != false; + return Minz_Session::param ('mail') != false; } // vérifie que le système d'authentification est configuré @@ -63,11 +88,11 @@ function formatBytes($bytes, $precision = 2, $system = 'IEC') { } function timestamptodate ($t, $hour = true) { - $month = Translate::t (date('M', $t)); + $month = Minz_Translate::t (date('M', $t)); if ($hour) { - $date = Translate::t ('format_date_hour', $month); + $date = Minz_Translate::t ('format_date_hour', $month); } else { - $date = Translate::t ('format_date', $month); + $date = Minz_Translate::t ('format_date', $month); } return @date ($date, $t); @@ -123,10 +148,10 @@ function opml_import ($xml) { $opml = simplexml_import_dom($dom); if (!$opml) { - throw new OpmlException (); + throw new FreshRSS_Opml_Exception (); } - $catDAO = new CategoryDAO(); + $catDAO = new FreshRSS_CategoryDAO(); $catDAO->checkDefault(); $defCat = $catDAO->getDefault(); @@ -152,10 +177,10 @@ function opml_import ($xml) { // Y ne sera pas ajouté et le flux non plus vu que l'id // de sa catégorie n'exisera pas $title = htmlspecialchars($title, ENT_QUOTES, 'UTF-8'); - $catDAO = new CategoryDAO (); + $catDAO = new FreshRSS_CategoryDAO (); $cat = $catDAO->searchByName ($title); if ($cat === false) { - $cat = new Category ($title); + $cat = new FreshRSS_Category ($title); $values = array ( 'name' => $cat->name (), 'color' => $cat->color () @@ -204,7 +229,7 @@ function getFeed ($outline, $cat_id) { $title = (string) $outline['title']; } $title = htmlspecialchars($title, ENT_QUOTES, 'UTF-8'); - $feed = new Feed ($url); + $feed = new FreshRSS_Feed ($url); $feed->_category ($cat_id); $feed->_name ($title); if (isset($outline['htmlUrl'])) { @@ -250,7 +275,7 @@ function get_content_by_parsing ($url, $path) { function lazyimg($content) { return preg_replace( '/]+?)src=[\'"]([^"\']+)[\'"]([^>]*)>/i', - '', + '', $content ); } diff --git a/lib/minz/ActionController.php b/lib/minz/ActionController.php index ab9389dbd..409d9611f 100755 --- a/lib/minz/ActionController.php +++ b/lib/minz/ActionController.php @@ -7,7 +7,7 @@ /** * La classe ActionController représente le contrôleur de l'application */ -class ActionController { +class Minz_ActionController { protected $router; protected $view; @@ -18,7 +18,7 @@ class ActionController { */ public function __construct ($router) { $this->router = $router; - $this->view = new View (); + $this->view = new Minz_View (); $this->view->attributeParams (); } diff --git a/lib/minz/Configuration.php b/lib/minz/Configuration.php index 7d6e3743e..9fc913964 100755 --- a/lib/minz/Configuration.php +++ b/lib/minz/Configuration.php @@ -7,7 +7,7 @@ /** * La classe Configuration permet de gérer la configuration de l'application */ -class Configuration { +class Minz_Configuration { const CONF_PATH_NAME = '/application.ini'; /** @@ -43,7 +43,7 @@ class Configuration { * - base le nom de la base de données */ private static $sel_application = ''; - private static $environment = Configuration::PRODUCTION; + private static $environment = Minz_Configuration::PRODUCTION; private static $base_url = ''; private static $use_url_rewriting = false; private static $title = ''; @@ -99,30 +99,30 @@ class Configuration { /** * Initialise les variables de configuration - * @exception FileNotExistException si le CONF_PATH_NAME n'existe pas - * @exception BadConfigurationException si CONF_PATH_NAME mal formaté + * @exception Minz_FileNotExistException si le CONF_PATH_NAME n'existe pas + * @exception Minz_BadConfigurationException si CONF_PATH_NAME mal formaté */ public static function init () { try { self::parseFile (); self::setReporting (); - } catch (FileNotExistException $e) { + } catch (Minz_FileNotExistException $e) { throw $e; - } catch (BadConfigurationException $e) { + } catch (Minz_BadConfigurationException $e) { throw $e; } } /** * Parse un fichier de configuration de type ".ini" - * @exception FileNotExistException si le CONF_PATH_NAME n'existe pas - * @exception BadConfigurationException si CONF_PATH_NAME mal formaté + * @exception Minz_FileNotExistException si le CONF_PATH_NAME n'existe pas + * @exception Minz_BadConfigurationException si CONF_PATH_NAME mal formaté */ private static function parseFile () { if (!file_exists (DATA_PATH . self::CONF_PATH_NAME)) { - throw new FileNotExistException ( + throw new Minz_FileNotExistException ( DATA_PATH . self::CONF_PATH_NAME, - MinzException::ERROR + Minz_Exception::ERROR ); } @@ -132,17 +132,17 @@ class Configuration { ); if (!$ini_array) { - throw new PermissionDeniedException ( + throw new Minz_PermissionDeniedException ( DATA_PATH . self::CONF_PATH_NAME, - MinzException::ERROR + Minz_Exception::ERROR ); } // [general] est obligatoire if (!isset ($ini_array['general'])) { - throw new BadConfigurationException ( + throw new Minz_BadConfigurationException ( '[general]', - MinzException::ERROR + Minz_Exception::ERROR ); } $general = $ini_array['general']; @@ -150,9 +150,9 @@ class Configuration { // sel_application est obligatoire if (!isset ($general['sel_application'])) { - throw new BadConfigurationException ( + throw new Minz_BadConfigurationException ( 'sel_application', - MinzException::ERROR + Minz_Exception::ERROR ); } self::$sel_application = $general['sel_application']; @@ -160,18 +160,18 @@ class Configuration { if (isset ($general['environment'])) { switch ($general['environment']) { case 'silent': - self::$environment = Configuration::SILENT; + self::$environment = Minz_Configuration::SILENT; break; case 'development': - self::$environment = Configuration::DEVELOPMENT; + self::$environment = Minz_Configuration::DEVELOPMENT; break; case 'production': - self::$environment = Configuration::PRODUCTION; + self::$environment = Minz_Configuration::PRODUCTION; break; default: - throw new BadConfigurationException ( + throw new Minz_BadConfigurationException ( 'environment', - MinzException::ERROR + Minz_Exception::ERROR ); } @@ -194,7 +194,7 @@ class Configuration { if (CACHE_PATH === false && self::$cache_enabled) { throw new FileNotExistException ( 'CACHE_PATH', - MinzException::ERROR + Minz_Exception::ERROR ); } } @@ -213,27 +213,27 @@ class Configuration { } if ($db) { if (!isset ($db['host'])) { - throw new BadConfigurationException ( + throw new Minz_BadConfigurationException ( 'host', - MinzException::ERROR + Minz_Exception::ERROR ); } if (!isset ($db['user'])) { - throw new BadConfigurationException ( + throw new Minz_BadConfigurationException ( 'user', - MinzException::ERROR + Minz_Exception::ERROR ); } if (!isset ($db['password'])) { - throw new BadConfigurationException ( + throw new Minz_BadConfigurationException ( 'password', - MinzException::ERROR + Minz_Exception::ERROR ); } if (!isset ($db['base'])) { - throw new BadConfigurationException ( + throw new Minz_BadConfigurationException ( 'base', - MinzException::ERROR + Minz_Exception::ERROR ); } diff --git a/lib/minz/Dispatcher.php b/lib/minz/Dispatcher.php index 0cfdd8e75..2898b5f00 100644 --- a/lib/minz/Dispatcher.php +++ b/lib/minz/Dispatcher.php @@ -9,8 +9,8 @@ * déterminée dans la Request * C'est un singleton */ -class Dispatcher { - const CONTROLLERS_PATH_NAME = '/controllers'; +class Minz_Dispatcher { + const CONTROLLERS_PATH_NAME = '/Controllers'; /* singleton */ private static $instance = null; @@ -23,7 +23,7 @@ class Dispatcher { */ public static function getInstance ($router) { if (is_null (self::$instance)) { - self::$instance = new Dispatcher ($router); + self::$instance = new Minz_Dispatcher ($router); } return self::$instance; } @@ -38,7 +38,7 @@ class Dispatcher { /** * Lance le controller indiqué dans Request * Remplit le body de Response à partir de la Vue - * @exception MinzException + * @exception Minz_Exception */ public function run () { $cache = new Minz_Cache(); @@ -53,29 +53,25 @@ class Dispatcher { $cache->render (); $text = ob_get_clean(); } else { - while (Request::$reseted) { - Request::$reseted = false; + while (Minz_Request::$reseted) { + Minz_Request::$reseted = false; try { - $this->createController ( - Request::controllerName () - . 'Controller' - ); - + $this->createController ('FreshRSS_' . Minz_Request::controllerName () . '_Controller'); $this->controller->init (); $this->controller->firstAction (); $this->launchAction ( - Request::actionName () + Minz_Request::actionName () . 'Action' ); $this->controller->lastAction (); - if (!Request::$reseted) { + if (!Minz_Request::$reseted) { ob_start (); $this->controller->view ()->build (); $text = ob_get_clean(); } - } catch (MinzException $e) { + } catch (Minz_Exception $e) { throw $e; } } @@ -85,14 +81,12 @@ class Dispatcher { } } - Response::setBody ($text); + Minz_Response::setBody ($text); } /** * Instancie le Controller * @param $controller_name le nom du controller à instancier - * @exception FileNotExistException le fichier correspondant au - * > controller n'existe pas * @exception ControllerNotExistException le controller n'existe pas * @exception ControllerNotActionControllerException controller n'est * > pas une instance de ActionController @@ -101,26 +95,18 @@ class Dispatcher { $filename = APP_PATH . self::CONTROLLERS_PATH_NAME . '/' . $controller_name . '.php'; - if (!file_exists ($filename)) { - throw new FileNotExistException ( - $filename, - MinzException::ERROR - ); - } - require_once ($filename); - if (!class_exists ($controller_name)) { - throw new ControllerNotExistException ( + throw new Minz_ControllerNotExistException ( $controller_name, - MinzException::ERROR + Minz_Exception::ERROR ); } $this->controller = new $controller_name ($this->router); - if (! ($this->controller instanceof ActionController)) { - throw new ControllerNotActionControllerException ( + if (! ($this->controller instanceof Minz_ActionController)) { + throw new Minz_ControllerNotActionControllerException ( $controller_name, - MinzException::ERROR + Minz_Exception::ERROR ); } } @@ -129,18 +115,18 @@ class Dispatcher { * Lance l'action sur le controller du dispatcher * @param $action_name le nom de l'action * @exception ActionException si on ne peut pas exécuter l'action sur - * > le controller + * le controller */ private function launchAction ($action_name) { - if (!Request::$reseted) { + if (!Minz_Request::$reseted) { if (!is_callable (array ( $this->controller, $action_name ))) { - throw new ActionException ( + throw new Minz_ActionException ( get_class ($this->controller), $action_name, - MinzException::ERROR + Minz_Exception::ERROR ); } call_user_func (array ( diff --git a/lib/minz/Error.php b/lib/minz/Error.php index 0e8c2f60b..1ad0d313c 100755 --- a/lib/minz/Error.php +++ b/lib/minz/Error.php @@ -1,5 +1,5 @@ */ @@ -7,7 +7,7 @@ /** * La classe Error permet de lancer des erreurs HTTP */ -class Error { +class Minz_Error { public function __construct () { } /** @@ -21,28 +21,28 @@ class Error { */ public static function error ($code = 404, $logs = array (), $redirect = false) { $logs = self::processLogs ($logs); - $error_filename = APP_PATH . '/controllers/errorController.php'; - + $error_filename = APP_PATH . '/Controllers/ErrorController.php'; + if (file_exists ($error_filename)) { $params = array ( 'code' => $code, 'logs' => $logs ); - - Response::setHeader ($code); + + Minz_Response::setHeader ($code); if ($redirect) { - Request::forward (array ( + Minz_Request::forward (array ( 'c' => 'error' ), true); } else { - Request::forward (array ( + Minz_Request::forward (array ( 'c' => 'error', 'params' => $params ), false); } } else { $text = '

    An error occured

    '."\n"; - + if (!empty ($logs)) { $text .= '
      '."\n"; foreach ($logs as $log) { @@ -50,14 +50,14 @@ class Error { } $text .= '
    '."\n"; } - - Response::setHeader ($code); - Response::setBody ($text); - Response::send (); + + Minz_Response::setHeader ($code); + Minz_Response::setBody ($text); + Minz_Response::send (); exit (); } } - + /** * Permet de retourner les logs de façon à n'avoir que * ceux que l'on veut réellement @@ -66,12 +66,12 @@ class Error { * > en fonction de l'environment */ private static function processLogs ($logs) { - $env = Configuration::environment (); + $env = Minz_Configuration::environment (); $logs_ok = array (); $error = array (); $warning = array (); $notice = array (); - + if (isset ($logs['error'])) { $error = $logs['error']; } @@ -81,14 +81,14 @@ class Error { if (isset ($logs['notice'])) { $notice = $logs['notice']; } - - if ($env == Configuration::PRODUCTION) { + + if ($env == Minz_Configuration::PRODUCTION) { $logs_ok = $error; } - if ($env == Configuration::DEVELOPMENT) { + if ($env == Minz_Configuration::DEVELOPMENT) { $logs_ok = array_merge ($error, $warning, $notice); } - + return $logs_ok; } } diff --git a/lib/minz/FrontController.php b/lib/minz/FrontController.php index d48d43d04..eb9835fe5 100755 --- a/lib/minz/FrontController.php +++ b/lib/minz/FrontController.php @@ -2,109 +2,79 @@ # ***** BEGIN LICENSE BLOCK ***** # MINZ - a free PHP Framework like Zend Framework # Copyright (C) 2011 Marien Fressinaud -# +# # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as # published by the Free Software Foundation, either version 3 of the # License, or (at your option) any later version. -# +# # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. -# +# # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . # # ***** END LICENSE BLOCK ***** /** - * La classe FrontController est le noyau du framework, elle lance l'application + * La classe FrontController est le Dispatcher du framework, elle lance l'application * Elle est appelée en général dans le fichier index.php à la racine du serveur */ -class FrontController { +class Minz_FrontController { protected $dispatcher; protected $router; - + /** * Constructeur * Initialise le router et le dispatcher */ public function __construct () { - $this->loadLib (); - if (LOG_PATH === false) { $this->killApp ('Path doesn\'t exist : LOG_PATH'); } - + try { - Configuration::init (); + Minz_Configuration::init (); - Request::init (); + Minz_Request::init (); - $this->router = new Router (); + $this->router = new Minz_Router (); $this->router->init (); - } catch (RouteNotFoundException $e) { + } catch (Minz_RouteNotFoundException $e) { Minz_Log::record ($e->getMessage (), Minz_Log::ERROR); - Error::error ( + Minz_Error::error ( 404, array ('error' => array ($e->getMessage ())) ); - } catch (MinzException $e) { + } catch (Minz_Exception $e) { Minz_Log::record ($e->getMessage (), Minz_Log::ERROR); $this->killApp ($e->getMessage ()); } - - $this->dispatcher = Dispatcher::getInstance ($this->router); - } - - /** - * Inclue les fichiers de la librairie - */ - private function loadLib () { - require ('ActionController.php'); - require ('Minz_Cache.php'); - require ('Configuration.php'); - require ('Dispatcher.php'); - require ('Error.php'); - require ('Helper.php'); - require ('Minz_Log.php'); - require ('Model.php'); - require ('Paginator.php'); - require ('Request.php'); - require ('Response.php'); - require ('Router.php'); - require ('Session.php'); - require ('Translate.php'); - require ('Url.php'); - require ('View.php'); - - require ('dao/Model_pdo.php'); - require ('dao/Model_txt.php'); - require ('dao/Model_array.php'); - - require ('exceptions/MinzException.php'); + + $this->dispatcher = Minz_Dispatcher::getInstance ($this->router); } - + /** * Démarre l'application (lance le dispatcher et renvoie la réponse */ public function run () { try { $this->dispatcher->run (); - Response::send (); - } catch (MinzException $e) { + Minz_Response::send (); + } catch (Minz_Exception $e) { try { Minz_Log::record ($e->getMessage (), Minz_Log::ERROR); - } catch (PermissionDeniedException $e) { + } catch (Minz_PermissionDeniedException $e) { $this->killApp ($e->getMessage ()); } - if ($e instanceof FileNotExistException || - $e instanceof ControllerNotExistException || - $e instanceof ControllerNotActionControllerException || - $e instanceof ActionException) { - Error::error ( + if ($e instanceof Minz_FileNotExistException || + $e instanceof Minz_ControllerNotExistException || + $e instanceof Minz_ControllerNotActionControllerException || + $e instanceof Minz_ActionException) { + Minz_Error::error ( 404, array ('error' => array ($e->getMessage ())), true @@ -114,7 +84,7 @@ class FrontController { } } } - + /** * Permet d'arrêter le programme en urgence */ diff --git a/lib/minz/Helper.php b/lib/minz/Helper.php index 4f64ba218..b058211d3 100755 --- a/lib/minz/Helper.php +++ b/lib/minz/Helper.php @@ -7,7 +7,7 @@ /** * La classe Helper représente une aide pour des tâches récurrentes */ -class Helper { +class Minz_Helper { /** * Annule les effets des magic_quotes pour une variable donnée * @param $var variable à traiter (tableau ou simple variable) diff --git a/lib/minz/Minz_Cache.php b/lib/minz/Minz_Cache.php deleted file mode 100644 index 6848e3350..000000000 --- a/lib/minz/Minz_Cache.php +++ /dev/null @@ -1,116 +0,0 @@ - -*/ - -/** - * 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 (Request::getURI ()); - - $this->file = CACHE_PATH . '/'.$file; - } - - public function _expire () { - if ($this->exist ()) { - $this->expire = filemtime ($this->file) - + Configuration::delayCache (); - } - } - - /** - * Permet de savoir si le cache est activé - * @return true si activé, false sinon - */ - public static function isEnabled () { - return 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/Minz_Log.php b/lib/minz/Minz_Log.php deleted file mode 100644 index 12005aa88..000000000 --- a/lib/minz/Minz_Log.php +++ /dev/null @@ -1,94 +0,0 @@ - -*/ - -/** - * La classe Log permet de logger des erreurs - */ -class Minz_Log { - /** - * Les différents niveau de log - * ERROR erreurs bloquantes de l'application - * WARNING erreurs pouvant géner le bon fonctionnement, mais non bloquantes - * NOTICE erreurs mineures ou messages d'informations - * DEBUG Informations affichées pour le déboggage - */ - const ERROR = 2; - const WARNING = 4; - const NOTICE = 8; - const DEBUG = 16; - - /** - * Enregistre un message dans un fichier de log spécifique - * Message non loggué si - * - environment = SILENT - * - level = WARNING et environment = PRODUCTION - * - level = NOTICE et environment = PRODUCTION - * @param $information message d'erreur / information à enregistrer - * @param $level niveau d'erreur - * @param $file_name fichier de log, par défaut LOG_PATH/application.log - */ - public static function record ($information, $level, $file_name = null) { - $env = Configuration::environment (); - - if (! ($env === Configuration::SILENT - || ($env === Configuration::PRODUCTION - && ($level >= Minz_Log::NOTICE)))) { - if (is_null ($file_name)) { - $file_name = LOG_PATH . '/application.log'; - } - - switch ($level) { - case Minz_Log::ERROR : - $level_label = 'error'; - break; - case Minz_Log::WARNING : - $level_label = 'warning'; - break; - case Minz_Log::NOTICE : - $level_label = 'notice'; - break; - case Minz_Log::DEBUG : - $level_label = 'debug'; - break; - default : - $level_label = 'unknown'; - } - - if ($env == Configuration::PRODUCTION) { - $file = @fopen ($file_name, 'a'); - } else { - $file = fopen ($file_name, 'a'); - } - - if ($file !== false) { - $log = '[' . date('r') . ']'; - $log .= ' [' . $level_label . ']'; - $log .= ' --- ' . $information . "\n"; - fwrite ($file, $log); - fclose ($file); - } else { - throw new PermissionDeniedException ( - $file_name, - MinzException::ERROR - ); - } - } - } - - /** - * Automatise le log des variables globales $_GET et $_POST - * Fait appel à la fonction record(...) - * Ne fonctionne qu'en environnement "development" - * @param $file_name fichier de log, par défaut LOG_PATH/application.log - */ - public static function recordRequest($file_name = null) { - $msg_get = str_replace("\n", '', '$_GET content : ' . print_r($_GET, true)); - $msg_post = str_replace("\n", '', '$_POST content : ' . print_r($_POST, true)); - - self::record($msg_get, Minz_Log::DEBUG, $file_name); - self::record($msg_post, Minz_Log::DEBUG, $file_name); - } -} diff --git a/lib/minz/Model.php b/lib/minz/Model.php index 37fc19ed1..adbaba942 100755 --- a/lib/minz/Model.php +++ b/lib/minz/Model.php @@ -7,6 +7,6 @@ /** * La classe Model représente un modèle de l'application (représentation MVC) */ -class Model { +class Minz_Model { } diff --git a/lib/minz/Paginator.php b/lib/minz/Paginator.php index 1a8376e75..5858e76a5 100755 --- a/lib/minz/Paginator.php +++ b/lib/minz/Paginator.php @@ -7,7 +7,7 @@ /** * La classe Paginator permet de gérer la pagination de l'application facilement */ -class Paginator { +class Minz_Paginator { /** * $items tableau des éléments à afficher/gérer */ diff --git a/lib/minz/Request.php b/lib/minz/Request.php index 3e508d8f1..c8ffa4a42 100644 --- a/lib/minz/Request.php +++ b/lib/minz/Request.php @@ -7,7 +7,7 @@ /** * Request représente la requête http */ -class Request { +class Minz_Request { private static $controller_name = ''; private static $action_name = ''; private static $params = array (); @@ -96,7 +96,7 @@ class Request { * @return la base de l'url */ public static function getBaseUrl () { - return Configuration::baseUrl (); + return Minz_Configuration::baseUrl (); } /** @@ -124,10 +124,10 @@ class Request { * > sinon, le dispatcher recharge en interne */ public static function forward ($url = array (), $redirect = false) { - $url = Url::checkUrl ($url); + $url = Minz_Url::checkUrl ($url); if ($redirect) { - header ('Location: ' . Url::display ($url, 'php')); + header ('Location: ' . Minz_Url::display ($url, 'php')); exit (); } else { self::$reseted = true; @@ -185,9 +185,9 @@ class Request { */ private static function magicQuotesOff () { if (get_magic_quotes_gpc ()) { - $_GET = Helper::stripslashes_r ($_GET); - $_POST = Helper::stripslashes_r ($_POST); - $_COOKIE = Helper::stripslashes_r ($_COOKIE); + $_GET = Minz_Helper::stripslashes_r ($_GET); + $_POST = Minz_Helper::stripslashes_r ($_POST); + $_COOKIE = Minz_Helper::stripslashes_r ($_COOKIE); } } @@ -195,5 +195,3 @@ class Request { return !empty ($_POST) || !empty ($_FILES); } } - - diff --git a/lib/minz/Response.php b/lib/minz/Response.php index fcf53c5b1..f8ea3d946 100644 --- a/lib/minz/Response.php +++ b/lib/minz/Response.php @@ -7,7 +7,7 @@ /** * Response représente la requête http renvoyée à l'utilisateur */ -class Response { +class Minz_Response { private static $header = 'HTTP/1.0 200 OK'; private static $body = ''; diff --git a/lib/minz/Router.php b/lib/minz/Router.php index c5d6f5baa..1ccd72597 100755 --- a/lib/minz/Router.php +++ b/lib/minz/Router.php @@ -8,7 +8,7 @@ * La classe Router gère le routage de l'application * Les routes sont définies dans APP_PATH.'/configuration/routes.php' */ -class Router { +class Minz_Router { const ROUTES_PATH_NAME = '/configuration/routes.php'; private $routes = array (); @@ -19,7 +19,7 @@ class Router { * et que l'on utilise l'url rewriting */ public function __construct () { - if (Configuration::useUrlRewriting ()) { + if (Minz_Configuration::useUrlRewriting ()) { if (file_exists (APP_PATH . self::ROUTES_PATH_NAME)) { $routes = include ( APP_PATH . self::ROUTES_PATH_NAME @@ -34,9 +34,9 @@ class Router { $routes ); } else { - throw new FileNotExistException ( + throw new Minz_FileNotExistException ( self::ROUTES_PATH_NAME, - MinzException::ERROR + Minz_Exception::ERROR ); } } @@ -51,10 +51,10 @@ class Router { public function init () { $url = array (); - if (Configuration::useUrlRewriting ()) { + if (Minz_Configuration::useUrlRewriting ()) { try { $url = $this->buildWithRewriting (); - } catch (RouteNotFoundException $e) { + } catch (Minz_RouteNotFoundException $e) { throw $e; } } else { @@ -63,10 +63,10 @@ class Router { $url['params'] = array_merge ( $url['params'], - Request::fetchPOST () + Minz_Request::fetchPOST () ); - Request::forward ($url); + Minz_Request::forward ($url); } /** @@ -77,15 +77,15 @@ class Router { public function buildWithoutRewriting () { $url = array (); - $url['c'] = Request::fetchGET ( + $url['c'] = Minz_Request::fetchGET ( 'c', - Request::defaultControllerName () + Minz_Request::defaultControllerName () ); - $url['a'] = Request::fetchGET ( + $url['a'] = Minz_Request::fetchGET ( 'a', - Request::defaultActionName () + Minz_Request::defaultActionName () ); - $url['params'] = Request::fetchGET (); + $url['params'] = Minz_Request::fetchGET (); // post-traitement unset ($url['params']['c']); @@ -103,7 +103,7 @@ class Router { */ public function buildWithRewriting () { $url = array (); - $uri = Request::getURI (); + $uri = Minz_Request::getURI (); $find = false; foreach ($this->routes as $route) { @@ -121,14 +121,14 @@ class Router { } if (!$find && $uri != '/') { - throw new RouteNotFoundException ( + throw new Minz_RouteNotFoundException ( $uri, - MinzException::ERROR + Minz_Exception::ERROR ); } // post-traitement - $url = Url::checkUrl ($url); + $url = Minz_Url::checkUrl ($url); return $url; } diff --git a/lib/minz/Session.php b/lib/minz/Session.php index f9c9c6754..878caa556 100755 --- a/lib/minz/Session.php +++ b/lib/minz/Session.php @@ -4,7 +4,7 @@ * La classe Session gère la session utilisateur * C'est un singleton */ -class Session { +class Minz_Session { /** * $session stocke les variables de session */ @@ -15,7 +15,7 @@ class Session { */ public static function init () { // démarre la session - session_name (md5 (Configuration::selApplication ())); + session_name (md5 (Minz_Configuration::selApplication ())); session_start (); if (isset ($_SESSION)) { @@ -55,7 +55,7 @@ class Session { if($p == 'language') { // reset pour remettre à jour le fichier de langue à utiliser - Translate::reset (); + Minz_Translate::reset (); } } } diff --git a/lib/minz/Translate.php b/lib/minz/Translate.php index e8cbe4852..e14f783f7 100644 --- a/lib/minz/Translate.php +++ b/lib/minz/Translate.php @@ -8,7 +8,7 @@ * La classe Translate se charge de la traduction * Utilise les fichiers du répertoire /app/i18n/ */ -class Translate { +class Minz_Translate { /** * $language est la langue à afficher */ @@ -25,8 +25,8 @@ class Translate { * l'enregistre dans $translates */ public static function init () { - $l = Configuration::language (); - self::$language = Session::param ('language', $l); + $l = Minz_Configuration::language (); + self::$language = Minz_Session::param ('language', $l); $l_path = APP_PATH . '/i18n/' . self::$language . '.php'; diff --git a/lib/minz/Url.php b/lib/minz/Url.php index ce051ebd9..30f7f6231 100755 --- a/lib/minz/Url.php +++ b/lib/minz/Url.php @@ -3,7 +3,7 @@ /** * La classe Url permet de gérer les URL à travers MINZ */ -class Url { +class Minz_Url { /** * Affiche une Url formatée selon que l'on utilise l'url_rewriting ou non * si oui, on cherche dans la table de routage la correspondance pour formater @@ -29,16 +29,16 @@ class Url { } else { $protocol = 'http:'; } - $url_string = $protocol . '//' . Request::getDomainName () . Request::getBaseUrl (); + $url_string = $protocol . '//' . Minz_Request::getDomainName () . Minz_Request::getBaseUrl (); } else { $url_string = '.'; } if (is_array ($url)) { - $router = new Router (); + $router = new Minz_Router (); - if (Configuration::useUrlRewriting ()) { + if (Minz_Configuration::useUrlRewriting ()) { $url_string .= $router->printUriRewrited ($url); } else { $url_string .= self::printUri ($url, $encodage); @@ -67,13 +67,13 @@ class Url { } if (isset ($url['c']) - && $url['c'] != Request::defaultControllerName ()) { + && $url['c'] != Minz_Request::defaultControllerName ()) { $uri .= $separator . 'c=' . $url['c']; $separator = $and; } if (isset ($url['a']) - && $url['a'] != Request::defaultActionName ()) { + && $url['a'] != Minz_Request::defaultActionName ()) { $uri .= $separator . 'a=' . $url['a']; $separator = $and; } @@ -98,10 +98,10 @@ class Url { if (is_array ($url)) { if (!isset ($url['c'])) { - $url_checked['c'] = Request::defaultControllerName (); + $url_checked['c'] = Minz_Request::defaultControllerName (); } if (!isset ($url['a'])) { - $url_checked['a'] = Request::defaultActionName (); + $url_checked['a'] = Minz_Request::defaultActionName (); } if (!isset ($url['params'])) { $url_checked['params'] = array (); @@ -125,5 +125,5 @@ function _url ($controller, $action) { $params[$args[$i]] = $args[$i + 1]; } - return Url::display (array ('c' => $controller, 'a' => $action, 'params' => $params)); + return Minz_Url::display (array ('c' => $controller, 'a' => $action, 'params' => $params)); } diff --git a/lib/minz/View.php b/lib/minz/View.php index 12202542f..c8d0aefed 100755 --- a/lib/minz/View.php +++ b/lib/minz/View.php @@ -7,7 +7,7 @@ /** * La classe View représente la vue de l'application */ -class View { +class Minz_View { const VIEWS_PATH_NAME = '/views'; const LAYOUT_PATH_NAME = '/layout'; const LAYOUT_FILENAME = '/layout.phtml'; @@ -28,8 +28,8 @@ class View { public function __construct () { $this->view_filename = APP_PATH . self::VIEWS_PATH_NAME . '/' - . Request::controllerName () . '/' - . Request::actionName () . '.phtml'; + . Minz_Request::controllerName () . '/' + . Minz_Request::actionName () . '.phtml'; if (file_exists (APP_PATH . self::LAYOUT_PATH_NAME @@ -37,7 +37,7 @@ class View { $this->use_layout = true; } - self::$title = Configuration::title (); + self::$title = Minz_Configuration::title (); } /** @@ -232,7 +232,7 @@ class View { self::$params[$key] = $value; } public function attributeParams () { - foreach (View::$params as $key => $value) { + foreach (Minz_View::$params as $key => $value) { $this->$key = $value; } } diff --git a/lib/minz/dao/Model_array.php b/lib/minz/dao/Model_array.php deleted file mode 100755 index 0b9ccf071..000000000 --- a/lib/minz/dao/Model_array.php +++ /dev/null @@ -1,122 +0,0 @@ - -*/ - -/** - * La classe Model_array représente le modèle interragissant avec les fichiers de type texte gérant des tableaux php - */ -class Model_array extends Model_txt { - /** - * $array Le tableau php contenu dans le fichier $nameFile - */ - protected $array = array (); - - /** - * Ouvre le fichier indiqué, charge le tableau dans $array et le $nameFile - * @param $nameFile le nom du fichier à ouvrir contenant un tableau - * Remarque : $array sera obligatoirement un tableau - */ - public function __construct ($nameFile) { - parent::__construct ($nameFile); - - if (!$this->getLock ('read')) { - throw new PermissionDeniedException ($this->filename); - } else { - $this->array = include ($this->filename); - $this->releaseLock (); - - if (!is_array ($this->array)) { - $this->array = array (); - } - - $this->array = $this->decodeArray ($this->array); - } - } - - /** - * Écrit un tableau dans le fichier $nameFile - * @param $array le tableau php à enregistrer - **/ - public function writeFile ($array) { - if (!$this->getLock ('write')) { - throw new PermissionDeniedException ($this->namefile); - } else { - $this->erase (); - - $this->writeLine ('writeLine ('return ', false); - $this->writeArray ($array); - $this->writeLine (';'); - - $this->releaseLock (); - } - } - - private function writeArray ($array, $profondeur = 0) { - $tab = ''; - for ($i = 0; $i < $profondeur; $i++) { - $tab .= "\t"; - } - $this->writeLine ('array ('); - - foreach ($array as $key => $value) { - if (is_int ($key)) { - $this->writeLine ($tab . "\t" . $key . ' => ', false); - } else { - $this->writeLine ($tab . "\t" . '\'' . $key . '\'' . ' => ', false); - } - - if (is_array ($value)) { - $this->writeArray ($value, $profondeur + 1); - $this->writeLine (','); - } else { - if (is_numeric ($value)) { - $this->writeLine ($value . ','); - } else { - $this->writeLine ('\'' . addslashes ($value) . '\','); - } - } - } - - $this->writeLine ($tab . ')', false); - } - - private function decodeArray ($array) { - $new_array = array (); - - foreach ($array as $key => $value) { - if (is_array ($value)) { - $new_array[$key] = $this->decodeArray ($value); - } else { - $new_array[$key] = stripslashes ($value); - } - } - - return $new_array; - } - - private function getLock ($type) { - if ($type == 'write') { - $lock = LOCK_EX; - } else { - $lock = LOCK_SH; - } - - $count = 1; - while (!flock ($this->file, $lock) && $count <= 50) { - $count++; - } - - if ($count >= 50) { - return false; - } else { - return true; - } - } - - private function releaseLock () { - flock ($this->file, LOCK_UN); - } -} diff --git a/lib/minz/dao/Model_pdo.php b/lib/minz/dao/Model_pdo.php deleted file mode 100755 index a93291fc8..000000000 --- a/lib/minz/dao/Model_pdo.php +++ /dev/null @@ -1,111 +0,0 @@ - -*/ - -/** - * La classe Model_sql représente le modèle interragissant avec les bases de données - * Seul la connexion MySQL est prise en charge pour le moment - */ -class Model_pdo { - - /** - * Partage la connexion à la base de données entre toutes les instances. - */ - public static $useSharedBd = true; - private static $sharedBd = null; - private static $sharedPrefix; - - /** - * $bd variable représentant la base de données - */ - protected $bd; - - protected $prefix; - - /** - * 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) { - $this->bd = self::$sharedBd; - $this->prefix = self::$sharedPrefix; - return; - } - - $db = Configuration::dataBase (); - $driver_options = null; - - try { - $type = $db['type']; - if($type == 'mysql') { - $string = $type - . ':host=' . $db['host'] - . ';dbname=' . $db['base'] - . ';charset=utf8'; - $driver_options = array( - PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8' - ); - } elseif($type == 'sqlite') { - $string = $type . ':/' . DATA_PATH . $db['base'] . '.sqlite'; //TODO: DEBUG UTF-8 http://www.siteduzero.com/forum/sujet/sqlite-connexion-utf-8-18797 - } - - $this->bd = new FreshPDO ( - $string, - $db['user'], - $db['password'], - $driver_options - ); - self::$sharedBd = $this->bd; - - $userPrefix = Configuration::currentUser (); - $this->prefix = $db['prefix'] . (empty($userPrefix) ? '' : ($userPrefix . '_')); - self::$sharedPrefix = $this->prefix; - } catch (Exception $e) { - throw new PDOConnectionException ( - $string, - $db['user'], MinzException::ERROR - ); - } - } - - public function beginTransaction() { - $this->bd->beginTransaction(); - } - public function commit() { - $this->bd->commit(); - } - public function rollBack() { - $this->bd->rollBack(); - } - - public function size() { - $db = Configuration::dataBase (); - $sql = 'SELECT SUM(data_length + index_length) FROM information_schema.TABLES WHERE table_schema = ?'; - $stm = $this->bd->prepare ($sql); - $values = array ($db['base']); - $stm->execute ($values); - $res = $stm->fetchAll(PDO::FETCH_COLUMN, 0); - return $res[0]; - } -} - -class FreshPDO extends PDO { - private static function check($statement) { - if (preg_match('/^(?:UPDATE|INSERT|DELETE)/i', $statement)) { - invalidateHttpCache(); - } - } - - public function prepare ($statement, $driver_options = array()) { - FreshPDO::check($statement); - return parent::prepare($statement, $driver_options); - } - - public function exec ($statement) { - FreshPDO::check($statement); - return parent::exec($statement); - } -} diff --git a/lib/minz/dao/Model_txt.php b/lib/minz/dao/Model_txt.php deleted file mode 100755 index aed653068..000000000 --- a/lib/minz/dao/Model_txt.php +++ /dev/null @@ -1,84 +0,0 @@ - -*/ - -/** - * La classe Model_txt représente le modèle interragissant avec les fichiers de type texte - */ -class Model_txt { - /** - * $file représente le fichier à ouvrir - */ - protected $file; - - /** - * $filename est le nom du fichier - */ - protected $filename; - - /** - * Ouvre un fichier dans $file - * @param $nameFile nom du fichier à ouvrir - * @param $mode mode d'ouverture du fichier ('a+' par défaut) - * @exception FileNotExistException si le fichier n'existe pas - * > ou ne peux pas être ouvert - */ - public function __construct ($nameFile, $mode = 'a+') { - $this->filename = $nameFile; - if (!file_exists($this->filename)) { - throw new FileNotExistException ( - $this->filename, - MinzException::WARNING - ); - } - - $this->file = @fopen ($this->filename, $mode); - - if (!$this->file) { - throw new PermissionDeniedException ( - $this->filename, - MinzException::WARNING - ); - } - } - - /** - * Lit une ligne de $file - * @return une ligne du fichier - */ - public function readLine () { - return fgets ($this->file); - } - - /** - * Écrit une ligne dans $file - * @param $line la ligne à écrire - */ - public function writeLine ($line, $newLine = true) { - $char = ''; - if ($newLine) { - $char = "\n"; - } - - fwrite ($this->file, $line . $char); - } - - /** - * Efface le fichier $file - * @return true en cas de succès, false sinon - */ - public function erase () { - return ftruncate ($this->file, 0); - } - - /** - * Ferme $file - */ - public function __destruct () { - if (isset ($this->file)) { - fclose ($this->file); - } - } -} diff --git a/lib/minz/exceptions/MinzException.php b/lib/minz/exceptions/MinzException.php deleted file mode 100644 index 4568c4da8..000000000 --- a/lib/minz/exceptions/MinzException.php +++ /dev/null @@ -1,94 +0,0 @@ -route = $route; - - $message = 'Route `' . $route . '` not found'; - - parent::__construct ($message, $code); - } - - public function route () { - return $this->route; - } -} -class PDOConnectionException extends MinzException { - public function __construct ($string_connection, $user, $code = self::ERROR) { - $message = 'Access to database is denied for `' . $user . '`' - . ' (`' . $string_connection . '`)'; - - parent::__construct ($message, $code); - } -} -class CurrentPagePaginationException extends MinzException { - public function __construct ($page) { - $message = 'Page number `' . $page . '` doesn\'t exist'; - - parent::__construct ($message, self::ERROR); - } -} diff --git a/public/index.php b/public/index.php index 3a2bcd3ae..829e418f9 100755 --- a/public/index.php +++ b/public/index.php @@ -37,18 +37,10 @@ if (file_exists ('install.php')) { } } - set_include_path (get_include_path () - . PATH_SEPARATOR - . LIB_PATH - . PATH_SEPARATOR - . LIB_PATH . '/minz' - . PATH_SEPARATOR - . APP_PATH); - - require (APP_PATH . '/App_FrontController.php'); + require(LIB_PATH . '/lib_rss.php'); //Includes class autoloader try { - $front_controller = new App_FrontController (); + $front_controller = new FreshRSS(); $front_controller->init (); $front_controller->run (); } catch (Exception $e) { -- cgit v1.2.3 From 755fdd9026c7d8c38fa34586a52bc80a97d81aaa Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Sun, 15 Dec 2013 03:38:17 +0100 Subject: Refactorisation : fichier oublié MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Suite de https://github.com/marienfressinaud/FreshRSS/commit/878e96202e8a22e4857b98e29b0a1fce68eccbc9 --- actualize_script.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/actualize_script.php b/actualize_script.php index 942070ccc..b6baa0a30 100755 --- a/actualize_script.php +++ b/actualize_script.php @@ -14,10 +14,10 @@ set_include_path (get_include_path () . PATH_SEPARATOR . APP_PATH); -require (APP_PATH . '/App_FrontController.php'); +require(LIB_PATH . '/lib_rss.php'); //Includes class autoloader -$front_controller = new App_FrontController (); +$front_controller = new FreshRSS (); $front_controller->init (); -Session::_param('mail', true); // permet de se passer de la phase de connexion +Minz_Session::_param('mail', true); // permet de se passer de la phase de connexion $front_controller->run (); invalidateHttpCache(); -- cgit v1.2.3 From 96bf9e5159df8a1217b2dbcff3210505c5c9ac1d Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Sun, 15 Dec 2013 03:39:59 +0100 Subject: set_include_path oublié MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Suite de https://github.com/marienfressinaud/FreshRSS/commit/755fdd9026c7d8c38fa34586a52bc80a97d81aaa --- actualize_script.php | 8 -------- 1 file changed, 8 deletions(-) diff --git a/actualize_script.php b/actualize_script.php index b6baa0a30..7986ba0b5 100755 --- a/actualize_script.php +++ b/actualize_script.php @@ -6,14 +6,6 @@ $_GET['a'] = 'actualize'; $_GET['force'] = true; $_SERVER['HTTP_HOST'] = ''; -set_include_path (get_include_path () - . PATH_SEPARATOR - . LIB_PATH - . PATH_SEPARATOR - . LIB_PATH . '/minz' - . PATH_SEPARATOR - . APP_PATH); - require(LIB_PATH . '/lib_rss.php'); //Includes class autoloader $front_controller = new FreshRSS (); -- cgit v1.2.3 From 83e8c68b6f9fc563230920ee520eae138898a2c1 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Sun, 15 Dec 2013 04:03:32 +0100 Subject: Refactorisation : oubli --- app/controllers/configureController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/configureController.php b/app/controllers/configureController.php index 0e7fbbdde..62fead315 100755 --- a/app/controllers/configureController.php +++ b/app/controllers/configureController.php @@ -249,7 +249,7 @@ class FreshRSS_configure_Controller extends Minz_ActionController { Minz_Session::_param ('mail', $this->view->conf->mailLogin ()); Minz_Session::_param ('language', $this->view->conf->language ()); - Translate::reset (); + Minz_Translate::reset (); // notif $notif = array ( -- cgit v1.2.3 From 7e64cda41548500c25825cca29bb7e0167249b83 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Sun, 15 Dec 2013 04:07:12 +0100 Subject: Date minimum pour afficher les articles MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Implémente décision https://github.com/marienfressinaud/FreshRSS/issues/323 --- app/Models/EntryDAO.php | 7 +++++-- app/controllers/feedController.php | 6 +++--- app/controllers/indexController.php | 8 ++++++-- 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/app/Models/EntryDAO.php b/app/Models/EntryDAO.php index 8c18150b6..b61b97624 100644 --- a/app/Models/EntryDAO.php +++ b/app/Models/EntryDAO.php @@ -259,7 +259,7 @@ class FreshRSS_EntryDAO extends Minz_ModelPdo { return isset ($entries[0]) ? $entries[0] : false; } - public function listWhere($type = 'a', $id = '', $state = 'all', $order = 'DESC', $limit = 1, $firstId = -1, $filter = '') { + public function listWhere($type = 'a', $id = '', $state = 'all', $order = 'DESC', $limit = 1, $firstId = '', $filter = '', $date_min = 0) { $where = ''; $values = array(); switch ($type) { @@ -299,9 +299,12 @@ class FreshRSS_EntryDAO extends Minz_ModelPdo { default: throw new FreshRSS_EntriesGetter_Exception ('Bad order in Entry->listByType: [' . $order . ']!'); } - if ($firstId > 0) { + if ($firstId !== '') { $where .= 'AND e.id ' . ($order === 'DESC' ? '<=' : '>=') . $firstId . ' '; } + if ($date_min > 0) { + $where .= 'AND e.id >= ' . $date_min . '000000 '; + } $terms = array_unique(explode(' ', trim($filter))); sort($terms); //Put #tags first $having = ''; diff --git a/app/controllers/feedController.php b/app/controllers/feedController.php index e4014c326..a85877724 100755 --- a/app/controllers/feedController.php +++ b/app/controllers/feedController.php @@ -96,7 +96,7 @@ class FreshRSS_feed_Controller extends Minz_ActionController { // on calcule la date des articles les plus anciens qu'on accepte $nb_month_old = $this->view->conf->oldEntries (); - $date_min = time () - (60 * 60 * 24 * 30 * $nb_month_old); + $date_min = time () - (3600 * 24 * 30 * $nb_month_old); $transactionStarted = true; $feedDAO->beginTransaction (); @@ -196,7 +196,7 @@ class FreshRSS_feed_Controller extends Minz_ActionController { // on calcule la date des articles les plus anciens qu'on accepte $nb_month_old = $this->view->conf->oldEntries (); - $date_min = time () - (60 * 60 * 24 * 30 * $nb_month_old); + $date_min = time () - (3600 * 24 * 30 * $nb_month_old); $i = 0; $flux_update = 0; @@ -310,7 +310,7 @@ class FreshRSS_feed_Controller extends Minz_ActionController { // on calcule la date des articles les plus anciens qu'on accepte $nb_month_old = $this->view->conf->oldEntries (); - $date_min = time () - (60 * 60 * 24 * 30 * $nb_month_old); + $date_min = time () - (3600 * 24 * 30 * $nb_month_old); // la variable $error permet de savoir si une erreur est survenue // Le but est de ne pas arrêter l'import même en cas d'erreur diff --git a/app/controllers/indexController.php b/app/controllers/indexController.php index 16a053ba3..92070590a 100755 --- a/app/controllers/indexController.php +++ b/app/controllers/indexController.php @@ -124,15 +124,19 @@ class FreshRSS_index_Controller extends Minz_ActionController { } } + // on calcule la date des articles les plus anciens qu'on affiche + $nb_month_old = $this->view->conf->oldEntries (); + $date_min = time () - (3600 * 24 * 30 * $nb_month_old); + try { - $entries = $this->entryDAO->listWhere($getType, $getId, $state, $order, $nb + 1, $first, $filter); + $entries = $this->entryDAO->listWhere($getType, $getId, $state, $order, $nb + 1, $first, $filter, $date_min); // Si on a récupéré aucun article "non lus" // on essaye de récupérer tous les articles if ($state === 'not_read' && empty($entries)) { //TODO: Remove in v0.8 Minz_Log::record ('Conflicting information about nbNotRead!', Minz_Log::DEBUG); $this->view->state = 'all'; - $entries = $this->entryDAO->listWhere($getType, $getId, 'all', $order, $nb, $first, $filter); + $entries = $this->entryDAO->listWhere($getType, $getId, 'all', $order, $nb, $first, $filter, $date_min); } if (count($entries) <= $nb) { -- cgit v1.2.3 From 74bceb2e2cdf0e3da5fb36990f3ee54e745e3d09 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Sun, 15 Dec 2013 04:20:23 +0100 Subject: Date minimum : cas des favoris et de l'historique complet Suite de https://github.com/marienfressinaud/FreshRSS/issues/323 --- app/Models/EntryDAO.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Models/EntryDAO.php b/app/Models/EntryDAO.php index b61b97624..1bce6cbf2 100644 --- a/app/Models/EntryDAO.php +++ b/app/Models/EntryDAO.php @@ -303,7 +303,7 @@ class FreshRSS_EntryDAO extends Minz_ModelPdo { $where .= 'AND e.id ' . ($order === 'DESC' ? '<=' : '>=') . $firstId . ' '; } if ($date_min > 0) { - $where .= 'AND e.id >= ' . $date_min . '000000 '; + $where .= 'AND (e.id >= ' . $date_min . '000000 OR e.is_favorite = 1 OR f.keep_history = 1) '; } $terms = array_unique(explode(' ', trim($filter))); sort($terms); //Put #tags first -- cgit v1.2.3 From 803d69bc4f1c02bf7ab252d963d2c6120b8d7080 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Sun, 15 Dec 2013 11:19:19 +0100 Subject: Delete ActionController.php --- lib/minz/ActionController.php | 42 ------------------------------------------ 1 file changed, 42 deletions(-) delete mode 100755 lib/minz/ActionController.php diff --git a/lib/minz/ActionController.php b/lib/minz/ActionController.php deleted file mode 100755 index 409d9611f..000000000 --- a/lib/minz/ActionController.php +++ /dev/null @@ -1,42 +0,0 @@ - -*/ - -/** - * La classe ActionController représente le contrôleur de l'application - */ -class Minz_ActionController { - protected $router; - protected $view; - - /** - * Constructeur - * @param $controller nom du controller - * @param $action nom de l'action à lancer - */ - public function __construct ($router) { - $this->router = $router; - $this->view = new Minz_View (); - $this->view->attributeParams (); - } - - /** - * Getteur - */ - public function view () { - return $this->view; - } - - /** - * Méthodes à redéfinir (ou non) par héritage - * firstAction est la première méthode exécutée par le Dispatcher - * lastAction est la dernière - */ - public function init () { } - public function firstAction () { } - public function lastAction () { } -} - - -- cgit v1.2.3 From 651d2a74f3d3c37f01726f2345cb2536e8e6b873 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Sun, 15 Dec 2013 11:19:30 +0100 Subject: Delete Configuration.php --- lib/minz/Configuration.php | 262 --------------------------------------------- 1 file changed, 262 deletions(-) delete mode 100755 lib/minz/Configuration.php diff --git a/lib/minz/Configuration.php b/lib/minz/Configuration.php deleted file mode 100755 index 9fc913964..000000000 --- a/lib/minz/Configuration.php +++ /dev/null @@ -1,262 +0,0 @@ - -*/ - -/** - * La classe Configuration permet de gérer la configuration de l'application - */ -class Minz_Configuration { - const CONF_PATH_NAME = '/application.ini'; - - /** - * VERSION est la version actuelle de MINZ - */ - const VERSION = '1.3.1.freshrss'; // version spéciale FreshRSS - - /** - * valeurs possibles pour l'"environment" - * SILENT rend l'application muette (pas de log) - * PRODUCTION est recommandée pour une appli en production - * (log les erreurs critiques) - * DEVELOPMENT log toutes les erreurs - */ - const SILENT = 0; - const PRODUCTION = 1; - const DEVELOPMENT = 2; - - /** - * définition des variables de configuration - * $sel_application une chaîne de caractères aléatoires (obligatoire) - * $environment gère le niveau d'affichage pour log et erreurs - * $use_url_rewriting indique si on utilise l'url_rewriting - * $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 - * - password mot de passe de l'utilisateur - * - base le nom de la base de données - */ - private static $sel_application = ''; - private static $environment = Minz_Configuration::PRODUCTION; - private static $base_url = ''; - 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 $current_user = ''; - - private static $db = array ( - 'host' => false, - 'user' => false, - 'password' => false, - 'base' => false - ); - - /* - * Getteurs - */ - public static function selApplication () { - return self::$sel_application; - } - public static function environment () { - return self::$environment; - } - public static function baseUrl () { - return self::$base_url; - } - public static function useUrlRewriting () { - return self::$use_url_rewriting; - } - public static function title () { - return stripslashes(self::$title); - } - 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; - } - public static function defaultUser () { - return self::$default_user; - } - public static function currentUser () { - return self::$current_user; - } - - /** - * Initialise les variables de configuration - * @exception Minz_FileNotExistException si le CONF_PATH_NAME n'existe pas - * @exception Minz_BadConfigurationException si CONF_PATH_NAME mal formaté - */ - public static function init () { - try { - self::parseFile (); - self::setReporting (); - } catch (Minz_FileNotExistException $e) { - throw $e; - } catch (Minz_BadConfigurationException $e) { - throw $e; - } - } - - /** - * Parse un fichier de configuration de type ".ini" - * @exception Minz_FileNotExistException si le CONF_PATH_NAME n'existe pas - * @exception Minz_BadConfigurationException si CONF_PATH_NAME mal formaté - */ - private static function parseFile () { - if (!file_exists (DATA_PATH . self::CONF_PATH_NAME)) { - throw new Minz_FileNotExistException ( - DATA_PATH . self::CONF_PATH_NAME, - Minz_Exception::ERROR - ); - } - - $ini_array = parse_ini_file ( - DATA_PATH . self::CONF_PATH_NAME, - true - ); - - if (!$ini_array) { - throw new Minz_PermissionDeniedException ( - DATA_PATH . self::CONF_PATH_NAME, - Minz_Exception::ERROR - ); - } - - // [general] est obligatoire - if (!isset ($ini_array['general'])) { - throw new Minz_BadConfigurationException ( - '[general]', - Minz_Exception::ERROR - ); - } - $general = $ini_array['general']; - - - // sel_application est obligatoire - if (!isset ($general['sel_application'])) { - throw new Minz_BadConfigurationException ( - 'sel_application', - Minz_Exception::ERROR - ); - } - self::$sel_application = $general['sel_application']; - - if (isset ($general['environment'])) { - switch ($general['environment']) { - case 'silent': - self::$environment = Minz_Configuration::SILENT; - break; - case 'development': - self::$environment = Minz_Configuration::DEVELOPMENT; - break; - case 'production': - self::$environment = Minz_Configuration::PRODUCTION; - break; - default: - throw new Minz_BadConfigurationException ( - 'environment', - Minz_Exception::ERROR - ); - } - - } - if (isset ($general['base_url'])) { - self::$base_url = $general['base_url']; - } - if (isset ($general['use_url_rewriting'])) { - self::$use_url_rewriting = $general['use_url_rewriting']; - } - - if (isset ($general['title'])) { - self::$title = $general['title']; - } - 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 = $general['delay_cache']; - } - if (isset ($general['default_user'])) { - self::$default_user = $general['default_user']; - self::$current_user = self::$default_user; - } - - // Base de données - $db = false; - if (isset ($ini_array['db'])) { - $db = $ini_array['db']; - } - if ($db) { - if (!isset ($db['host'])) { - throw new Minz_BadConfigurationException ( - 'host', - Minz_Exception::ERROR - ); - } - if (!isset ($db['user'])) { - throw new Minz_BadConfigurationException ( - 'user', - Minz_Exception::ERROR - ); - } - if (!isset ($db['password'])) { - throw new Minz_BadConfigurationException ( - 'password', - Minz_Exception::ERROR - ); - } - if (!isset ($db['base'])) { - throw new Minz_BadConfigurationException ( - 'base', - Minz_Exception::ERROR - ); - } - - self::$db['type'] = isset ($db['type']) ? $db['type'] : 'mysql'; - self::$db['host'] = $db['host']; - self::$db['user'] = $db['user']; - self::$db['password'] = $db['password']; - self::$db['base'] = $db['base']; - self::$db['prefix'] = isset ($db['prefix']) ? $db['prefix'] : ''; - } - } - - private static function setReporting () { - if (self::environment () == self::DEVELOPMENT) { - error_reporting (E_ALL); - ini_set ('display_errors','On'); - ini_set('log_errors', 'On'); - } elseif (self::environment () == self::PRODUCTION) { - error_reporting(E_ALL); - ini_set('display_errors','Off'); - ini_set('log_errors', 'On'); - } else { - error_reporting(0); - } - } -} -- cgit v1.2.3 From d0c855ffc288faed7bba81ed393688f5a86e9a10 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Sun, 15 Dec 2013 11:19:38 +0100 Subject: Delete Dispatcher.php --- lib/minz/Dispatcher.php | 138 ------------------------------------------------ 1 file changed, 138 deletions(-) delete mode 100644 lib/minz/Dispatcher.php diff --git a/lib/minz/Dispatcher.php b/lib/minz/Dispatcher.php deleted file mode 100644 index 2898b5f00..000000000 --- a/lib/minz/Dispatcher.php +++ /dev/null @@ -1,138 +0,0 @@ - -*/ - -/** - * Le Dispatcher s'occupe d'initialiser le Controller et d'executer l'action - * déterminée dans la Request - * C'est un singleton - */ -class Minz_Dispatcher { - const CONTROLLERS_PATH_NAME = '/Controllers'; - - /* singleton */ - private static $instance = null; - - private $router; - private $controller; - - /** - * Récupère l'instance du Dispatcher - */ - public static function getInstance ($router) { - if (is_null (self::$instance)) { - self::$instance = new Minz_Dispatcher ($router); - } - return self::$instance; - } - - /** - * Constructeur - */ - private function __construct ($router) { - $this->router = $router; - } - - /** - * Lance le controller indiqué dans Request - * Remplit le body de Response à partir de la Vue - * @exception Minz_Exception - */ - public function run () { - $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 - // J'ignore les effets de bord :( - ob_start ('ob_gzhandler'); - - if (Minz_Cache::isEnabled () && !$cache->expired ()) { - ob_start (); - $cache->render (); - $text = ob_get_clean(); - } else { - 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 (); - - if (!Minz_Request::$reseted) { - ob_start (); - $this->controller->view ()->build (); - $text = ob_get_clean(); - } - } catch (Minz_Exception $e) { - throw $e; - } - } - - if (Minz_Cache::isEnabled ()) { - $cache->cache ($text); - } - } - - Minz_Response::setBody ($text); - } - - /** - * Instancie le Controller - * @param $controller_name le nom du controller à instancier - * @exception ControllerNotExistException le controller n'existe pas - * @exception ControllerNotActionControllerException controller n'est - * > pas une instance de ActionController - */ - private function createController ($controller_name) { - $filename = APP_PATH . self::CONTROLLERS_PATH_NAME . '/' - . $controller_name . '.php'; - - if (!class_exists ($controller_name)) { - throw new Minz_ControllerNotExistException ( - $controller_name, - Minz_Exception::ERROR - ); - } - $this->controller = new $controller_name ($this->router); - - if (! ($this->controller instanceof Minz_ActionController)) { - throw new Minz_ControllerNotActionControllerException ( - $controller_name, - Minz_Exception::ERROR - ); - } - } - - /** - * Lance l'action sur le controller du dispatcher - * @param $action_name le nom de l'action - * @exception ActionException si on ne peut pas exécuter l'action sur - * le controller - */ - private function launchAction ($action_name) { - if (!Minz_Request::$reseted) { - if (!is_callable (array ( - $this->controller, - $action_name - ))) { - throw new Minz_ActionException ( - get_class ($this->controller), - $action_name, - Minz_Exception::ERROR - ); - } - call_user_func (array ( - $this->controller, - $action_name - )); - } - } -} -- cgit v1.2.3 From cd4e6e152d33d5304fd4e62696979afffe0c3049 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Sun, 15 Dec 2013 11:19:53 +0100 Subject: Delete Error.php --- lib/minz/Error.php | 94 ------------------------------------------------------ 1 file changed, 94 deletions(-) delete mode 100755 lib/minz/Error.php diff --git a/lib/minz/Error.php b/lib/minz/Error.php deleted file mode 100755 index 1ad0d313c..000000000 --- a/lib/minz/Error.php +++ /dev/null @@ -1,94 +0,0 @@ - -*/ - -/** - * La classe Error permet de lancer des erreurs HTTP - */ -class Minz_Error { - public function __construct () { } - - /** - * Permet de lancer une erreur - * @param $code le type de l'erreur, par défaut 404 (page not found) - * @param $logs logs d'erreurs découpés de la forme - * > $logs['error'] - * > $logs['warning'] - * > $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) { - $logs = self::processLogs ($logs); - $error_filename = APP_PATH . '/Controllers/ErrorController.php'; - - if (file_exists ($error_filename)) { - $params = array ( - 'code' => $code, - 'logs' => $logs - ); - - Minz_Response::setHeader ($code); - if ($redirect) { - Minz_Request::forward (array ( - 'c' => 'error' - ), true); - } else { - Minz_Request::forward (array ( - 'c' => 'error', - 'params' => $params - ), false); - } - } else { - $text = '

    An error occured

    '."\n"; - - if (!empty ($logs)) { - $text .= '
      '."\n"; - foreach ($logs as $log) { - $text .= '
    • ' . $log . '
    • '."\n"; - } - $text .= '
    '."\n"; - } - - Minz_Response::setHeader ($code); - Minz_Response::setBody ($text); - Minz_Response::send (); - exit (); - } - } - - /** - * Permet de retourner les logs de façon à n'avoir que - * ceux que l'on veut réellement - * @param $logs les logs rangés par catégories (error, warning, notice) - * @return la liste des logs, sans catégorie, - * > en fonction de l'environment - */ - private static function processLogs ($logs) { - $env = Minz_Configuration::environment (); - $logs_ok = array (); - $error = array (); - $warning = array (); - $notice = array (); - - if (isset ($logs['error'])) { - $error = $logs['error']; - } - if (isset ($logs['warning'])) { - $warning = $logs['warning']; - } - if (isset ($logs['notice'])) { - $notice = $logs['notice']; - } - - if ($env == Minz_Configuration::PRODUCTION) { - $logs_ok = $error; - } - if ($env == Minz_Configuration::DEVELOPMENT) { - $logs_ok = array_merge ($error, $warning, $notice); - } - - return $logs_ok; - } -} -- cgit v1.2.3 From 76b316766e1e1be57b96aa68178006152b704201 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Sun, 15 Dec 2013 11:20:00 +0100 Subject: Delete FrontController.php --- lib/minz/FrontController.php | 97 -------------------------------------------- 1 file changed, 97 deletions(-) delete mode 100755 lib/minz/FrontController.php diff --git a/lib/minz/FrontController.php b/lib/minz/FrontController.php deleted file mode 100755 index eb9835fe5..000000000 --- a/lib/minz/FrontController.php +++ /dev/null @@ -1,97 +0,0 @@ -. -# -# ***** END LICENSE BLOCK ***** - -/** - * La classe FrontController est le Dispatcher du framework, elle lance l'application - * Elle est appelée en général dans le fichier index.php à la racine du serveur - */ -class Minz_FrontController { - protected $dispatcher; - protected $router; - - /** - * Constructeur - * Initialise le router et le dispatcher - */ - public function __construct () { - if (LOG_PATH === false) { - $this->killApp ('Path doesn\'t exist : LOG_PATH'); - } - - try { - Minz_Configuration::init (); - - Minz_Request::init (); - - $this->router = new Minz_Router (); - $this->router->init (); - } catch (Minz_RouteNotFoundException $e) { - Minz_Log::record ($e->getMessage (), Minz_Log::ERROR); - Minz_Error::error ( - 404, - array ('error' => array ($e->getMessage ())) - ); - } catch (Minz_Exception $e) { - Minz_Log::record ($e->getMessage (), Minz_Log::ERROR); - $this->killApp ($e->getMessage ()); - } - - $this->dispatcher = Minz_Dispatcher::getInstance ($this->router); - } - - /** - * Démarre l'application (lance le dispatcher et renvoie la réponse - */ - public function run () { - try { - $this->dispatcher->run (); - Minz_Response::send (); - } catch (Minz_Exception $e) { - try { - Minz_Log::record ($e->getMessage (), Minz_Log::ERROR); - } catch (Minz_PermissionDeniedException $e) { - $this->killApp ($e->getMessage ()); - } - - if ($e instanceof Minz_FileNotExistException || - $e instanceof Minz_ControllerNotExistException || - $e instanceof Minz_ControllerNotActionControllerException || - $e instanceof Minz_ActionException) { - Minz_Error::error ( - 404, - array ('error' => array ($e->getMessage ())), - true - ); - } else { - $this->killApp (); - } - } - } - - /** - * Permet d'arrêter le programme en urgence - */ - private function killApp ($txt = '') { - if ($txt == '') { - $txt = 'See logs files'; - } - exit ('### Application problem ###
    '."\n".$txt); - } -} -- cgit v1.2.3 From c58d95b464ddc1671c311189d88917935fe522bb Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Sun, 15 Dec 2013 11:20:06 +0100 Subject: Delete Helper.php --- lib/minz/Helper.php | 22 ---------------------- 1 file changed, 22 deletions(-) delete mode 100755 lib/minz/Helper.php diff --git a/lib/minz/Helper.php b/lib/minz/Helper.php deleted file mode 100755 index b058211d3..000000000 --- a/lib/minz/Helper.php +++ /dev/null @@ -1,22 +0,0 @@ - -*/ - -/** - * La classe Helper représente une aide pour des tâches récurrentes - */ -class Minz_Helper { - /** - * Annule les effets des magic_quotes pour une variable donnée - * @param $var variable à traiter (tableau ou simple variable) - */ - public static function stripslashes_r ($var) { - if (is_array ($var)){ - return array_map (array ('Helper', 'stripslashes_r'), $var); - } else { - return stripslashes($var); - } - } -} -- cgit v1.2.3 From c2d86edd730e2b9a28acec365446b8659cc5522d Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Sun, 15 Dec 2013 11:20:11 +0100 Subject: Delete Model.php --- lib/minz/Model.php | 12 ------------ 1 file changed, 12 deletions(-) delete mode 100755 lib/minz/Model.php diff --git a/lib/minz/Model.php b/lib/minz/Model.php deleted file mode 100755 index adbaba942..000000000 --- a/lib/minz/Model.php +++ /dev/null @@ -1,12 +0,0 @@ - -*/ - -/** - * La classe Model représente un modèle de l'application (représentation MVC) - */ -class Minz_Model { - -} -- cgit v1.2.3 From d8db9d15a8848795f11590955e45fa5cde37fc2f Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Sun, 15 Dec 2013 11:20:18 +0100 Subject: Delete Paginator.php --- lib/minz/Paginator.php | 196 ------------------------------------------------- 1 file changed, 196 deletions(-) delete mode 100755 lib/minz/Paginator.php diff --git a/lib/minz/Paginator.php b/lib/minz/Paginator.php deleted file mode 100755 index 5858e76a5..000000000 --- a/lib/minz/Paginator.php +++ /dev/null @@ -1,196 +0,0 @@ - -*/ - -/** - * La classe Paginator permet de gérer la pagination de l'application facilement - */ -class Minz_Paginator { - /** - * $items tableau des éléments à afficher/gérer - */ - private $items = array (); - - /** - * $nbItemsPerPage le nombre d'éléments par page - */ - private $nbItemsPerPage = 10; - - /** - * $currentPage page actuelle à gérer - */ - private $currentPage = 1; - - /** - * $nbPage le nombre de pages de pagination - */ - private $nbPage = 1; - - /** - * $nbItems le nombre d'éléments - */ - private $nbItems = 0; - - /** - * Constructeur - * @param $items les éléments à gérer - */ - public function __construct ($items) { - $this->_items ($items); - $this->_nbItems (count ($this->items (true))); - $this->_nbItemsPerPage ($this->nbItemsPerPage); - $this->_currentPage ($this->currentPage); - } - - /** - * Permet d'afficher la pagination - * @param $view nom du fichier de vue situé dans /app/views/helpers/ - * @param $getteur variable de type $_GET[] permettant de retrouver la page - */ - public function render ($view, $getteur) { - $view = APP_PATH . '/views/helpers/'.$view; - - if (file_exists ($view)) { - include ($view); - } - } - - /** - * Permet de retrouver la page d'un élément donné - * @param $item l'élément à retrouver - * @return la page à laquelle se trouve l'élément (false si non trouvé) - */ - public function pageByItem ($item) { - $page = false; - $i = 0; - - do { - if ($item == $this->items[$i]) { - $page = ceil (($i + 1) / $this->nbItemsPerPage); - } - - $i++; - } while (!$page && $i < $this->nbItems ()); - - return $page; - } - - /** - * Permet de retrouver la position d'un élément donné (à partir de 0) - * @param $item l'élément à retrouver - * @return la position à laquelle se trouve l'élément (false si non trouvé) - */ - public function positionByItem ($item) { - $find = false; - $i = 0; - - do { - if ($item == $this->items[$i]) { - $find = true; - } else { - $i++; - } - } while (!$find && $i < $this->nbItems ()); - - return $i; - } - - /** - * Permet de récupérer un item par sa position - * @param $pos la position de l'élément - * @return l'item situé à $pos (dernier item si $pos<0, 1er si $pos>=count($items)) - */ - public function itemByPosition ($pos) { - if ($pos < 0) { - $pos = $this->nbItems () - 1; - } - if ($pos >= count($this->items)) { - $pos = 0; - } - - return $this->items[$pos]; - } - - /** - * GETTEURS - */ - /** - * @param $all si à true, retourne tous les éléments sans prendre en compte la pagination - */ - public function items ($all = false) { - $array = array (); - $nbItems = $this->nbItems (); - - if ($nbItems <= $this->nbItemsPerPage || $all) { - $array = $this->items; - } else { - $begin = ($this->currentPage - 1) * $this->nbItemsPerPage; - $counter = 0; - $i = 0; - - foreach ($this->items as $key => $item) { - if ($i >= $begin) { - $array[$key] = $item; - $counter++; - } - if ($counter >= $this->nbItemsPerPage) { - break; - } - $i++; - } - } - - return $array; - } - public function nbItemsPerPage () { - return $this->nbItemsPerPage; - } - public function currentPage () { - return $this->currentPage; - } - public function nbPage () { - return $this->nbPage; - } - public function nbItems () { - return $this->nbItems; - } - - /** - * SETTEURS - */ - public function _items ($items) { - if (is_array ($items)) { - $this->items = $items; - } - - $this->_nbPage (); - } - public function _nbItemsPerPage ($nbItemsPerPage) { - if ($nbItemsPerPage > $this->nbItems ()) { - $nbItemsPerPage = $this->nbItems (); - } - if ($nbItemsPerPage < 0) { - $nbItemsPerPage = 0; - } - - $this->nbItemsPerPage = $nbItemsPerPage; - $this->_nbPage (); - } - public function _currentPage ($page) { - if($page < 1 || ($page > $this->nbPage && $this->nbPage > 0)) { - throw new CurrentPagePaginationException ($page); - } - - $this->currentPage = $page; - } - private function _nbPage () { - if ($this->nbItemsPerPage > 0) { - $this->nbPage = ceil ($this->nbItems () / $this->nbItemsPerPage); - } - } - public function _nbItems ($value) { - $this->nbItems = $value; - } -} -- cgit v1.2.3 From c15908b67f8b148beff45e3bd556ab06cd24358f Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Sun, 15 Dec 2013 11:20:24 +0100 Subject: Delete Request.php --- lib/minz/Request.php | 197 --------------------------------------------------- 1 file changed, 197 deletions(-) delete mode 100644 lib/minz/Request.php diff --git a/lib/minz/Request.php b/lib/minz/Request.php deleted file mode 100644 index c8ffa4a42..000000000 --- a/lib/minz/Request.php +++ /dev/null @@ -1,197 +0,0 @@ - -*/ - -/** - * Request représente la requête http - */ -class Minz_Request { - private static $controller_name = ''; - private static $action_name = ''; - private static $params = array (); - - private static $default_controller_name = 'index'; - private static $default_action_name = 'index'; - - public static $reseted = true; - - /** - * Getteurs - */ - public static function controllerName () { - return self::$controller_name; - } - public static function actionName () { - return self::$action_name; - } - public static function params () { - return self::$params; - } - static function htmlspecialchars_utf8 ($p) { - return htmlspecialchars($p, ENT_QUOTES, 'UTF-8'); - } - public static function param ($key, $default = false, $specialchars = false) { - if (isset (self::$params[$key])) { - $p = self::$params[$key]; - if(is_object($p) || $specialchars) { - return $p; - } elseif(is_array($p)) { - return array_map('self::htmlspecialchars_utf8', $p); - } else { - return self::htmlspecialchars_utf8($p); - } - } else { - return $default; - } - } - public static function defaultControllerName () { - return self::$default_controller_name; - } - public static function defaultActionName () { - return self::$default_action_name; - } - - /** - * Setteurs - */ - public static function _controllerName ($controller_name) { - self::$controller_name = $controller_name; - } - public static function _actionName ($action_name) { - self::$action_name = $action_name; - } - public static function _params ($params) { - if (!is_array($params)) { - $params = array ($params); - } - - self::$params = $params; - } - public static function _param ($key, $value = false) { - if ($value === false) { - unset (self::$params[$key]); - } else { - self::$params[$key] = $value; - } - } - - /** - * Initialise la Request - */ - public static function init () { - self::magicQuotesOff (); - } - - /** - * Retourn le nom de domaine du site - */ - public static function getDomainName () { - return $_SERVER['HTTP_HOST']; - } - - /** - * Détermine la base de l'url - * @return la base de l'url - */ - public static function getBaseUrl () { - return Minz_Configuration::baseUrl (); - } - - /** - * Récupère l'URI de la requête - * @return l'URI - */ - public static function getURI () { - if (isset ($_SERVER['REQUEST_URI'])) { - $base_url = self::getBaseUrl (); - $uri = $_SERVER['REQUEST_URI']; - - $len_base_url = strlen ($base_url); - $real_uri = substr ($uri, $len_base_url); - } else { - $real_uri = ''; - } - - return $real_uri; - } - - /** - * Relance une requête - * @param $url l'url vers laquelle est relancée la requête - * @param $redirect si vrai, force la redirection http - * > sinon, le dispatcher recharge en interne - */ - public static function forward ($url = array (), $redirect = false) { - $url = Minz_Url::checkUrl ($url); - - if ($redirect) { - header ('Location: ' . Minz_Url::display ($url, 'php')); - exit (); - } else { - self::$reseted = true; - - self::_controllerName ($url['c']); - self::_actionName ($url['a']); - self::_params (array_merge ( - self::$params, - $url['params'] - )); - } - } - - /** - * Permet de récupérer une variable de type $_GET - * @param $param nom de la variable - * @param $default valeur par défaut à attribuer à la variable - * @return $_GET[$param] - * $_GET si $param = false - * $default si $_GET[$param] n'existe pas - */ - public static function fetchGET ($param = false, $default = false) { - if ($param === false) { - return $_GET; - } elseif (isset ($_GET[$param])) { - return $_GET[$param]; - } else { - return $default; - } - } - - /** - * Permet de récupérer une variable de type $_POST - * @param $param nom de la variable - * @param $default valeur par défaut à attribuer à la variable - * @return $_POST[$param] - * $_POST si $param = false - * $default si $_POST[$param] n'existe pas - */ - public static function fetchPOST ($param = false, $default = false) { - if ($param === false) { - return $_POST; - } elseif (isset ($_POST[$param])) { - return $_POST[$param]; - } else { - return $default; - } - } - - /** - * Méthode désactivant les magic_quotes pour les variables - * $_GET - * $_POST - * $_COOKIE - */ - private static function magicQuotesOff () { - if (get_magic_quotes_gpc ()) { - $_GET = Minz_Helper::stripslashes_r ($_GET); - $_POST = Minz_Helper::stripslashes_r ($_POST); - $_COOKIE = Minz_Helper::stripslashes_r ($_COOKIE); - } - } - - public static function isPost () { - return !empty ($_POST) || !empty ($_FILES); - } -} -- cgit v1.2.3 From ab02cd9ec054a9756c40f324ab282320c06a3e59 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Sun, 15 Dec 2013 11:20:30 +0100 Subject: Delete Response.php --- lib/minz/Response.php | 60 --------------------------------------------------- 1 file changed, 60 deletions(-) delete mode 100644 lib/minz/Response.php diff --git a/lib/minz/Response.php b/lib/minz/Response.php deleted file mode 100644 index f8ea3d946..000000000 --- a/lib/minz/Response.php +++ /dev/null @@ -1,60 +0,0 @@ - -*/ - -/** - * Response représente la requête http renvoyée à l'utilisateur - */ -class Minz_Response { - private static $header = 'HTTP/1.0 200 OK'; - private static $body = ''; - - /** - * Mets à jour le body de la Response - * @param $text le texte à incorporer dans le body - */ - public static function setBody ($text) { - self::$body = $text; - } - - /** - * Mets à jour le header de la Response - * @param $code le code HTTP, valeurs possibles - * - 200 (OK) - * - 403 (Forbidden) - * - 404 (Forbidden) - * - 500 (Forbidden) -> par défaut si $code erroné - * - 503 (Forbidden) - */ - public static function setHeader ($code) { - switch ($code) { - case 200 : - self::$header = 'HTTP/1.0 200 OK'; - break; - case 403 : - self::$header = 'HTTP/1.0 403 Forbidden'; - break; - case 404 : - self::$header = 'HTTP/1.0 404 Not Found'; - break; - case 500 : - self::$header = 'HTTP/1.0 500 Internal Server Error'; - break; - case 503 : - self::$header = 'HTTP/1.0 503 Service Unavailable'; - break; - default : - self::$header = 'HTTP/1.0 500 Internal Server Error'; - } - } - - /** - * Envoie la Response à l'utilisateur - */ - public static function send () { - header (self::$header); - echo self::$body; - } -} -- cgit v1.2.3 From e249a70593fb04d22dcb90f04bda0494a1681f8b Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Sun, 15 Dec 2013 11:20:36 +0100 Subject: Delete Router.php --- lib/minz/Router.php | 209 ---------------------------------------------------- 1 file changed, 209 deletions(-) delete mode 100755 lib/minz/Router.php diff --git a/lib/minz/Router.php b/lib/minz/Router.php deleted file mode 100755 index 1ccd72597..000000000 --- a/lib/minz/Router.php +++ /dev/null @@ -1,209 +0,0 @@ - -*/ - -/** - * La classe Router gère le routage de l'application - * Les routes sont définies dans APP_PATH.'/configuration/routes.php' - */ -class Minz_Router { - const ROUTES_PATH_NAME = '/configuration/routes.php'; - - private $routes = array (); - - /** - * Constructeur - * @exception FileNotExistException si ROUTES_PATH_NAME n'existe pas - * et que l'on utilise l'url rewriting - */ - public function __construct () { - if (Minz_Configuration::useUrlRewriting ()) { - if (file_exists (APP_PATH . self::ROUTES_PATH_NAME)) { - $routes = include ( - APP_PATH . self::ROUTES_PATH_NAME - ); - - if (!is_array ($routes)) { - $routes = array (); - } - - $this->routes = array_map ( - array ('Url', 'checkUrl'), - $routes - ); - } else { - throw new Minz_FileNotExistException ( - self::ROUTES_PATH_NAME, - Minz_Exception::ERROR - ); - } - } - } - - /** - * Initialise le Router en déterminant le couple Controller / Action - * Mets à jour la Request - * @exception RouteNotFoundException si l'uri n'est pas présente dans - * > la table de routage - */ - public function init () { - $url = array (); - - if (Minz_Configuration::useUrlRewriting ()) { - try { - $url = $this->buildWithRewriting (); - } catch (Minz_RouteNotFoundException $e) { - throw $e; - } - } else { - $url = $this->buildWithoutRewriting (); - } - - $url['params'] = array_merge ( - $url['params'], - Minz_Request::fetchPOST () - ); - - Minz_Request::forward ($url); - } - - /** - * Retourne un tableau représentant l'url passée par la barre d'adresses - * Ne se base PAS sur la table de routage - * @return tableau représentant l'url - */ - public function buildWithoutRewriting () { - $url = array (); - - $url['c'] = Minz_Request::fetchGET ( - 'c', - Minz_Request::defaultControllerName () - ); - $url['a'] = Minz_Request::fetchGET ( - 'a', - Minz_Request::defaultActionName () - ); - $url['params'] = Minz_Request::fetchGET (); - - // post-traitement - unset ($url['params']['c']); - unset ($url['params']['a']); - - return $url; - } - - /** - * Retourne un tableau représentant l'url passée par la barre d'adresses - * Se base sur la table de routage - * @return tableau représentant l'url - * @exception RouteNotFoundException si l'uri n'est pas présente dans - * > la table de routage - */ - public function buildWithRewriting () { - $url = array (); - $uri = Minz_Request::getURI (); - $find = false; - - foreach ($this->routes as $route) { - $regex = '*^' . $route['route'] . '$*'; - if (preg_match ($regex, $uri, $matches)) { - $url['c'] = $route['controller']; - $url['a'] = $route['action']; - $url['params'] = $this->getParams ( - $route['params'], - $matches - ); - $find = true; - break; - } - } - - if (!$find && $uri != '/') { - throw new Minz_RouteNotFoundException ( - $uri, - Minz_Exception::ERROR - ); - } - - // post-traitement - $url = Minz_Url::checkUrl ($url); - - return $url; - } - - /** - * Retourne l'uri d'une url en se basant sur la table de routage - * @param l'url sous forme de tableau - * @return l'uri formatée (string) selon une route trouvée - */ - public function printUriRewrited ($url) { - $route = $this->searchRoute ($url); - - if ($route !== false) { - return $this->replaceParams ($route, $url['params']); - } - - return ''; - } - - /** - * Recherche la route correspondante à une url - * @param l'url sous forme de tableau - * @return la route telle que spécifiée dans la table de routage, - * false si pas trouvée - */ - public function searchRoute ($url) { - foreach ($this->routes as $route) { - if ($route['controller'] == $url['c'] - && $route['action'] == $url['a']) { - // calcule la différence des tableaux de params - $params = array_flip ($route['params']); - $difference_params = array_diff_key ( - $params, - $url['params'] - ); - - // vérifie que pas de différence - // et le cas où $params est vide et pas $url['params'] - if (empty ($difference_params) - && (!empty ($params) || empty ($url['params']))) { - return $route; - } - } - } - - return false; - } - - /** - * Récupère un tableau dont - * - les clés sont définies dans $params_route - * - les valeurs sont situées dans $matches - * Le tableau $matches est décalé de +1 par rapport à $params_route - */ - private function getParams($params_route, $matches) { - $params = array (); - - for ($i = 0; $i < count ($params_route); $i++) { - $param = $params_route[$i]; - $params[$param] = $matches[$i + 1]; - } - - return $params; - } - - /** - * Remplace les éléments de la route par les valeurs contenues dans $params - */ - private function replaceParams ($route, $params_replace) { - $uri = $route['route']; - $params = array(); - foreach($route['params'] as $param) { - $uri = preg_replace('#\((.+)\)#U', $params_replace[$param], $uri, 1); - } - - return stripslashes($uri); - } -} -- cgit v1.2.3 From 20cfb9f4d7fa76a977c1d9730435575f851a2b5c Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Sun, 15 Dec 2013 11:20:44 +0100 Subject: Delete Session.php --- lib/minz/Session.php | 78 ---------------------------------------------------- 1 file changed, 78 deletions(-) delete mode 100755 lib/minz/Session.php diff --git a/lib/minz/Session.php b/lib/minz/Session.php deleted file mode 100755 index 878caa556..000000000 --- a/lib/minz/Session.php +++ /dev/null @@ -1,78 +0,0 @@ - Date: Sun, 15 Dec 2013 11:20:49 +0100 Subject: Delete Translate.php --- lib/minz/Translate.php | 71 -------------------------------------------------- 1 file changed, 71 deletions(-) delete mode 100644 lib/minz/Translate.php diff --git a/lib/minz/Translate.php b/lib/minz/Translate.php deleted file mode 100644 index e14f783f7..000000000 --- a/lib/minz/Translate.php +++ /dev/null @@ -1,71 +0,0 @@ - - */ - -/** - * La classe Translate se charge de la traduction - * Utilise les fichiers du répertoire /app/i18n/ - */ -class Minz_Translate { - /** - * $language est la langue à afficher - */ - private static $language; - - /** - * $translates est le tableau de correspondance - * $key => $traduction - */ - private static $translates = array (); - - /** - * Inclus le fichier de langue qui va bien - * l'enregistre dans $translates - */ - public static function init () { - $l = Minz_Configuration::language (); - self::$language = Minz_Session::param ('language', $l); - - $l_path = APP_PATH . '/i18n/' . self::$language . '.php'; - - if (file_exists ($l_path)) { - self::$translates = include ($l_path); - } - } - - /** - * Alias de init - */ - public static function reset () { - self::init (); - } - - /** - * Traduit une clé en sa valeur du tableau $translates - * @param $key la clé à traduire - * @return la valeur correspondante à la clé - * > si non présente dans le tableau, on retourne la clé elle-même - */ - public static function t ($key) { - $translate = $key; - - if (isset (self::$translates[$key])) { - $translate = self::$translates[$key]; - } - - $args = func_get_args (); - unset($args[0]); - - return vsprintf ($translate, $args); - } - - /** - * Retourne la langue utilisée actuellement - * @return la langue - */ - public static function language () { - return self::$language; - } -} -- cgit v1.2.3 From d202a648f9eb45aa479a86ebb8db326eae944b4c Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Sun, 15 Dec 2013 11:20:55 +0100 Subject: Delete Url.php --- lib/minz/Url.php | 129 ------------------------------------------------------- 1 file changed, 129 deletions(-) delete mode 100755 lib/minz/Url.php diff --git a/lib/minz/Url.php b/lib/minz/Url.php deleted file mode 100755 index 30f7f6231..000000000 --- a/lib/minz/Url.php +++ /dev/null @@ -1,129 +0,0 @@ -printUriRewrited ($url); - } else { - $url_string .= self::printUri ($url, $encodage); - } - } else { - $url_string .= $url; - } - - return $url_string; - } - - /** - * Construit l'URI d'une URL sans url rewriting - * @param l'url sous forme de tableau - * @param $encodage pour indiquer comment encoder les & (& ou & pour html) - * @return l'uri sous la forme ?key=value&key2=value2 - */ - private static function printUri ($url, $encodage) { - $uri = ''; - $separator = '/?'; - - if($encodage == 'html') { - $and = '&'; - } else { - $and = '&'; - } - - if (isset ($url['c']) - && $url['c'] != Minz_Request::defaultControllerName ()) { - $uri .= $separator . 'c=' . $url['c']; - $separator = $and; - } - - if (isset ($url['a']) - && $url['a'] != Minz_Request::defaultActionName ()) { - $uri .= $separator . 'a=' . $url['a']; - $separator = $and; - } - - if (isset ($url['params'])) { - foreach ($url['params'] as $key => $param) { - $uri .= $separator . $key . '=' . $param; - $separator = $and; - } - } - - return $uri; - } - - /** - * Vérifie que les éléments du tableau représentant une url soit ok - * @param l'url sous forme de tableau (sinon renverra directement $url) - * @return l'url vérifié - */ - public static function checkUrl ($url) { - $url_checked = $url; - - if (is_array ($url)) { - if (!isset ($url['c'])) { - $url_checked['c'] = Minz_Request::defaultControllerName (); - } - if (!isset ($url['a'])) { - $url_checked['a'] = Minz_Request::defaultActionName (); - } - if (!isset ($url['params'])) { - $url_checked['params'] = array (); - } - } - - return $url_checked; - } -} - -function _url ($controller, $action) { - $nb_args = func_num_args (); - - if($nb_args < 2 || $nb_args % 2 != 0) { - return false; - } - - $args = func_get_args (); - $params = array (); - for($i = 2; $i < $nb_args; $i = $i + 2) { - $params[$args[$i]] = $args[$i + 1]; - } - - return Minz_Url::display (array ('c' => $controller, 'a' => $action, 'params' => $params)); -} -- cgit v1.2.3 From edd766f4b3bd64ec62b7e193c66837936d0d4631 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Sun, 15 Dec 2013 11:21:01 +0100 Subject: Delete View.php --- lib/minz/View.php | 241 ------------------------------------------------------ 1 file changed, 241 deletions(-) delete mode 100755 lib/minz/View.php diff --git a/lib/minz/View.php b/lib/minz/View.php deleted file mode 100755 index c8d0aefed..000000000 --- a/lib/minz/View.php +++ /dev/null @@ -1,241 +0,0 @@ - -*/ - -/** - * La classe View représente la vue de l'application - */ -class Minz_View { - const VIEWS_PATH_NAME = '/views'; - const LAYOUT_PATH_NAME = '/layout'; - const LAYOUT_FILENAME = '/layout.phtml'; - - private $view_filename = ''; - private $use_layout = false; - - private static $title = ''; - private static $styles = array (); - private static $scripts = array (); - - private static $params = array (); - - /** - * Constructeur - * Détermine si on utilise un layout ou non - */ - public function __construct () { - $this->view_filename = APP_PATH - . self::VIEWS_PATH_NAME . '/' - . Minz_Request::controllerName () . '/' - . Minz_Request::actionName () . '.phtml'; - - if (file_exists (APP_PATH - . self::LAYOUT_PATH_NAME - . self::LAYOUT_FILENAME)) { - $this->use_layout = true; - } - - self::$title = Minz_Configuration::title (); - } - - /** - * Construit la vue - */ - public function build () { - if ($this->use_layout) { - $this->buildLayout (); - } else { - $this->render (); - } - } - - /** - * Construit le layout - */ - public function buildLayout () { - include ( - APP_PATH - . self::LAYOUT_PATH_NAME - . self::LAYOUT_FILENAME - ); - } - - /** - * Affiche la Vue en elle-même - */ - public function render () { - if (file_exists ($this->view_filename)) { - include ($this->view_filename); - } else { - Minz_Log::record ('File doesn\'t exist : `' - . $this->view_filename . '`', - Minz_Log::NOTICE); - } - } - - /** - * Ajoute un élément du layout - * @param $part l'élément partial à ajouter - */ - public function partial ($part) { - $fic_partial = APP_PATH - . self::LAYOUT_PATH_NAME . '/' - . $part . '.phtml'; - - if (file_exists ($fic_partial)) { - include ($fic_partial); - } else { - Minz_Log::record ('File doesn\'t exist : `' - . $fic_partial . '`', - Minz_Log::WARNING); - } - } - - /** - * Affiche un élément graphique situé dans APP./views/helpers/ - * @param $helper l'élément à afficher - */ - public function renderHelper ($helper) { - $fic_helper = APP_PATH - . '/views/helpers/' - . $helper . '.phtml'; - - if (file_exists ($fic_helper)) { - include ($fic_helper); - } else { - Minz_Log::record ('File doesn\'t exist : `' - . $fic_helper . '`', - Minz_Log::WARNING); - } - } - - /** - * Permet de choisir si on souhaite utiliser le layout - * @param $use true si on souhaite utiliser le layout, false sinon - */ - public function _useLayout ($use) { - $this->use_layout = $use; - } - - /** - * Gestion du titre - */ - public static function title () { - return self::$title; - } - public static function headTitle () { - return '' . self::$title . '' . "\n"; - } - public static function _title ($title) { - self::$title = $title; - } - public static function prependTitle ($title) { - self::$title = $title . self::$title; - } - public static function appendTitle ($title) { - self::$title = self::$title . $title; - } - - /** - * Gestion des feuilles de style - */ - public static function headStyle () { - $styles = ''; - - foreach(self::$styles as $style) { - $cond = $style['cond']; - if ($cond) { - $styles .= ''; - } - - $styles .= "\n"; - } - - return $styles; - } - public static function prependStyle ($url, $media = 'all', $cond = false) { - array_unshift (self::$styles, array ( - 'url' => $url, - 'media' => $media, - 'cond' => $cond - )); - } - public static function appendStyle ($url, $media = 'all', $cond = false) { - self::$styles[] = array ( - 'url' => $url, - 'media' => $media, - 'cond' => $cond - ); - } - - /** - * Gestion des scripts JS - */ - public static function headScript () { - $scripts = ''; - - foreach (self::$scripts as $script) { - $cond = $script['cond']; - if ($cond) { - $scripts .= ''; - } - - $scripts .= "\n"; - } - - return $scripts; - } - public static function prependScript ($url, $cond = false, $defer = true, $async = true) { - array_unshift(self::$scripts, array ( - 'url' => $url, - 'cond' => $cond, - 'defer' => $defer, - 'async' => $async, - )); - } - public static function appendScript ($url, $cond = false, $defer = true, $async = true) { - self::$scripts[] = array ( - 'url' => $url, - 'cond' => $cond, - 'defer' => $defer, - 'async' => $async, - ); - } - - /** - * Gestion des paramètres ajoutés à la vue - */ - public static function _param ($key, $value) { - self::$params[$key] = $value; - } - public function attributeParams () { - foreach (Minz_View::$params as $key => $value) { - $this->$key = $value; - } - } -} - - -- cgit v1.2.3 From 02452e6a5ccf287dd3a08c3bb14c0395cab2d926 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Sun, 15 Dec 2013 11:21:44 +0100 Subject: Delete Category.php --- app/models/Category.php | 85 ------------------------------------------------- 1 file changed, 85 deletions(-) delete mode 100755 app/models/Category.php diff --git a/app/models/Category.php b/app/models/Category.php deleted file mode 100755 index e70d1303f..000000000 --- a/app/models/Category.php +++ /dev/null @@ -1,85 +0,0 @@ -_name ($name); - $this->_color ($color); - if (isset ($feeds)) { - $this->_feeds ($feeds); - $this->nbFeed = 0; - $this->nbNotRead = 0; - foreach ($feeds as $feed) { - $this->nbFeed++; - $this->nbNotRead += $feed->nbNotRead (); - } - } - } - - public function id () { - return $this->id; - } - public function name () { - return $this->name; - } - public function color () { - return $this->color; - } - public function nbFeed () { - if ($this->nbFeed < 0) { - $catDAO = new FreshRSS_CategoryDAO (); - $this->nbFeed = $catDAO->countFeed ($this->id ()); - } - - return $this->nbFeed; - } - public function nbNotRead () { - if ($this->nbNotRead < 0) { - $catDAO = new FreshRSS_CategoryDAO (); - $this->nbNotRead = $catDAO->countNotRead ($this->id ()); - } - - return $this->nbNotRead; - } - public function feeds () { - if (is_null ($this->feeds)) { - $feedDAO = new FreshRSS_FeedDAO (); - $this->feeds = $feedDAO->listByCategory ($this->id ()); - $this->nbFeed = 0; - $this->nbNotRead = 0; - foreach ($this->feeds as $feed) { - $this->nbFeed++; - $this->nbNotRead += $feed->nbNotRead (); - } - } - - return $this->feeds; - } - - public function _id ($value) { - $this->id = $value; - } - public function _name ($value) { - $this->name = $value; - } - public function _color ($value) { - if (preg_match ('/^#([0-9a-f]{3}|[0-9a-f]{6})$/i', $value)) { - $this->color = $value; - } else { - $this->color = '#0062BE'; - } - } - public function _feeds ($values) { - if (!is_array ($values)) { - $values = array ($values); - } - - $this->feeds = $values; - } -} -- cgit v1.2.3 From 16c2696f2ada2c22e0ac6392bd27365f10e66004 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Sun, 15 Dec 2013 11:21:49 +0100 Subject: Delete Days.php --- app/models/Days.php | 7 ------- 1 file changed, 7 deletions(-) delete mode 100644 app/models/Days.php diff --git a/app/models/Days.php b/app/models/Days.php deleted file mode 100644 index 2d770c30b..000000000 --- a/app/models/Days.php +++ /dev/null @@ -1,7 +0,0 @@ - Date: Sun, 15 Dec 2013 11:21:55 +0100 Subject: Delete Entry.php --- app/models/Entry.php | 193 --------------------------------------------------- 1 file changed, 193 deletions(-) delete mode 100755 app/models/Entry.php diff --git a/app/models/Entry.php b/app/models/Entry.php deleted file mode 100755 index ba0fb48f4..000000000 --- a/app/models/Entry.php +++ /dev/null @@ -1,193 +0,0 @@ -_guid ($guid); - $this->_title ($title); - $this->_author ($author); - $this->_content ($content); - $this->_link ($link); - $this->_date ($pubdate); - $this->_isRead ($is_read); - $this->_isFavorite ($is_favorite); - $this->_feed ($feed); - $this->_tags (preg_split('/[\s#]/', $tags)); - } - - public function id () { - return $this->id; - } - public function guid () { - return $this->guid; - } - public function title () { - return $this->title; - } - public function author () { - if (is_null ($this->author)) { - return ''; - } else { - return $this->author; - } - } - public function content () { - return $this->content; - } - public function link () { - return $this->link; - } - public function date ($raw = false) { - if ($raw) { - return $this->date; - } else { - return timestamptodate ($this->date); - } - } - public function dateAdded ($raw = false) { - $date = intval(substr($this->id, 0, -6)); - if ($raw) { - return $date; - } else { - return timestamptodate ($date); - } - } - public function isRead () { - return $this->is_read; - } - public function isFavorite () { - return $this->is_favorite; - } - public function feed ($object = false) { - if ($object) { - $feedDAO = new FreshRSS_FeedDAO (); - return $feedDAO->searchById ($this->feed); - } else { - return $this->feed; - } - } - public function tags ($inString = false) { - if ($inString) { - return empty ($this->tags) ? '' : '#' . implode(' #', $this->tags); - } else { - return $this->tags; - } - } - - public function _id ($value) { - $this->id = $value; - } - public function _guid ($value) { - $this->guid = $value; - } - public function _title ($value) { - $this->title = $value; - } - public function _author ($value) { - $this->author = $value; - } - public function _content ($value) { - $this->content = $value; - } - public function _link ($value) { - $this->link = $value; - } - public function _date ($value) { - if (ctype_digit ($value)) { - $this->date = intval ($value); - } else { - $this->date = time (); - } - } - public function _isRead ($value) { - $this->is_read = $value; - } - public function _isFavorite ($value) { - $this->is_favorite = $value; - } - public function _feed ($value) { - $this->feed = $value; - } - public function _tags ($value) { - if (!is_array ($value)) { - $value = array ($value); - } - - foreach ($value as $key => $t) { - if (!$t) { - unset ($value[$key]); - } - } - - $this->tags = $value; - } - - public function isDay ($day) { - $date = $this->dateAdded(true); - $today = @strtotime('today'); - $yesterday = $today - 86400; - - if ($day === FreshRSS_Days::TODAY && - $date >= $today && $date < $today + 86400) { - return true; - } elseif ($day === FreshRSS_Days::YESTERDAY && - $date >= $yesterday && $date < $yesterday + 86400) { - return true; - } elseif ($day === FreshRSS_Days::BEFORE_YESTERDAY && $date < $yesterday) { - return true; - } else { - return false; - } - } - - public function loadCompleteContent($pathEntries) { - // Gestion du contenu - // On cherche à récupérer les articles en entier... même si le flux ne le propose pas - if ($pathEntries) { - $entryDAO = new FreshRSS_EntryDAO(); - $entry = $entryDAO->searchByGuid($this->feed, $this->guid); - - if($entry) { - // l'article existe déjà en BDD, en se contente de recharger ce contenu - $this->content = $entry->content(); - } else { - try { - // l'article n'est pas en BDD, on va le chercher sur le site - $this->content = get_content_by_parsing( - $this->link(), $pathEntries - ); - } catch (Exception $e) { - // rien à faire, on garde l'ancien contenu (requête a échoué) - } - } - } - } - - public function toArray () { - return array ( - 'id' => $this->id (), - 'guid' => $this->guid (), - 'title' => $this->title (), - 'author' => $this->author (), - 'content' => $this->content (), - 'link' => $this->link (), - 'date' => $this->date (true), - 'is_read' => $this->isRead (), - 'is_favorite' => $this->isFavorite (), - 'id_feed' => $this->feed (), - 'tags' => $this->tags (true), - ); - } -} -- cgit v1.2.3 From a29dad13761208bfdf024e7f6703023d85428695 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Sun, 15 Dec 2013 11:22:02 +0100 Subject: Delete Feed.php --- app/models/Feed.php | 319 ---------------------------------------------------- 1 file changed, 319 deletions(-) delete mode 100644 app/models/Feed.php diff --git a/app/models/Feed.php b/app/models/Feed.php deleted file mode 100644 index e63ac8c7a..000000000 --- a/app/models/Feed.php +++ /dev/null @@ -1,319 +0,0 @@ -_url ($url); - } else { - $this->url = $url; - } - } - - public function id () { - return $this->id; - } - public function url () { - return $this->url; - } - public function category () { - return $this->category; - } - public function entries () { - if (!is_null ($this->entries)) { - return $this->entries; - } else { - return array (); - } - } - public function name () { - return $this->name; - } - public function website () { - return $this->website; - } - public function description () { - return $this->description; - } - public function lastUpdate () { - return $this->lastUpdate; - } - public function priority () { - return $this->priority; - } - public function pathEntries () { - return $this->pathEntries; - } - public function httpAuth ($raw = true) { - if ($raw) { - return $this->httpAuth; - } else { - $pos_colon = strpos ($this->httpAuth, ':'); - $user = substr ($this->httpAuth, 0, $pos_colon); - $pass = substr ($this->httpAuth, $pos_colon + 1); - - return array ( - 'username' => $user, - 'password' => $pass - ); - } - } - public function inError () { - return $this->error; - } - public function keepHistory () { - return $this->keep_history; - } - public function nbEntries () { - if ($this->nbEntries < 0) { - $feedDAO = new FreshRSS_FeedDAO (); - $this->nbEntries = $feedDAO->countEntries ($this->id ()); - } - - return $this->nbEntries; - } - public function nbNotRead () { - if ($this->nbNotRead < 0) { - $feedDAO = new FreshRSS_FeedDAO (); - $this->nbNotRead = $feedDAO->countNotRead ($this->id ()); - } - - return $this->nbNotRead; - } - public function faviconPrepare() { - $file = DATA_PATH . '/favicons/' . $this->id () . '.txt'; - if (!file_exists ($file)) { - $t = $this->website; - if (empty($t)) { - $t = $this->url; - } - file_put_contents($file, $t); - } - } - public static function faviconDelete($id) { - $path = DATA_PATH . '/favicons/' . $id; - @unlink($path . '.ico'); - @unlink($path . '.txt'); - } - public function favicon () { - return Minz_Url::display ('/f.php?' . $this->id ()); - } - - public function _id ($value) { - $this->id = $value; - } - public function _url ($value, $validate=true) { - if ($validate) { - $value = checkUrl($value); - } - if (empty ($value)) { - throw new FreshRSS_BadUrl_Exception ($value); - } - $this->url = $value; - } - public function _category ($value) { - $this->category = $value; - } - public function _name ($value) { - if (is_null ($value)) { - $value = ''; - } - $this->name = $value; - } - public function _website ($value, $validate=true) { - if ($validate) { - $value = checkUrl($value); - } - if (empty ($value)) { - $value = ''; - } - $this->website = $value; - } - public function _description ($value) { - if (is_null ($value)) { - $value = ''; - } - $this->description = $value; - } - public function _lastUpdate ($value) { - $this->lastUpdate = $value; - } - public function _priority ($value) { - $this->priority = ctype_digit ($value) ? intval ($value) : 10; - } - public function _pathEntries ($value) { - $this->pathEntries = $value; - } - public function _httpAuth ($value) { - $this->httpAuth = $value; - } - public function _error ($value) { - if ($value) { - $value = true; - } else { - $value = false; - } - $this->error = $value; - } - public function _keepHistory ($value) { - if ($value) { - $value = true; - } else { - $value = false; - } - $this->keep_history = $value; - } - public function _nbNotRead ($value) { - $this->nbNotRead = ctype_digit ($value) ? intval ($value) : -1; - } - public function _nbEntries ($value) { - $this->nbEntries = ctype_digit ($value) ? intval ($value) : -1; - } - - public function load () { - if (!is_null ($this->url)) { - if (CACHE_PATH === false) { - throw new Minz_FileNotExistException ( - 'CACHE_PATH', - Minz_Exception::ERROR - ); - } else { - $feed = new SimplePie (); - $feed->set_useragent(Minz_Translate::t ('freshrss') . '/' . FRESHRSS_VERSION . ' (' . PHP_OS . '; ' . FRESHRSS_WEBSITE . ') ' . SIMPLEPIE_NAME . '/' . SIMPLEPIE_VERSION); - $url = htmlspecialchars_decode ($this->url, ENT_QUOTES); - if ($this->httpAuth != '') { - $url = preg_replace ('#((.+)://)(.+)#', '${1}' . $this->httpAuth . '@${3}', $url); - } - - $feed->set_feed_url ($url); - $feed->set_cache_location (CACHE_PATH); - $feed->set_cache_duration(1500); - $feed->strip_htmltags (array ( - 'base', 'blink', 'body', 'doctype', 'embed', - 'font', 'form', 'frame', 'frameset', 'html', - 'input', 'marquee', 'meta', 'noscript', - 'object', 'param', 'plaintext', 'script', 'style', - )); - $feed->strip_attributes(array_merge($feed->strip_attributes, array( - 'autoplay', 'onload', 'onunload', 'onclick', 'ondblclick', 'onmousedown', 'onmouseup', - 'onmouseover', 'onmousemove', 'onmouseout', 'onfocus', 'onblur', - 'onkeypress', 'onkeydown', 'onkeyup', 'onselect', 'onchange', 'seamless'))); - $feed->add_attributes(array( - 'img' => array('lazyload' => ''), //http://www.w3.org/TR/resource-priorities/ - 'audio' => array('preload' => 'none'), - 'iframe' => array('postpone' => '', 'sandbox' => 'allow-scripts allow-same-origin'), - 'video' => array('postpone' => '', 'preload' => 'none'), - )); - $feed->set_url_replacements(array( - 'a' => 'href', - 'area' => 'href', - 'audio' => 'src', - 'blockquote' => 'cite', - 'del' => 'cite', - 'form' => 'action', - 'iframe' => 'src', - 'img' => array( - 'longdesc', - 'src' - ), - 'input' => 'src', - 'ins' => 'cite', - 'q' => 'cite', - 'source' => 'src', - 'track' => 'src', - 'video' => array( - 'poster', - 'src', - ), - )); - $feed->init (); - - if ($feed->error ()) { - throw new FreshRSS_Feed_Exception ($feed->error . ' [' . $url . ']'); - } - - // si on a utilisé l'auto-discover, notre url va avoir changé - $subscribe_url = $feed->subscribe_url (); - if (!is_null ($subscribe_url) && $subscribe_url != $this->url) { - if ($this->httpAuth != '') { - // on enlève les id si authentification HTTP - $subscribe_url = preg_replace ('#((.+)://)((.+)@)(.+)#', '${1}${5}', $subscribe_url); - } - $this->_url ($subscribe_url); - } - - $title = $feed->get_title (); - $this->_name (!is_null ($title) ? $title : $this->url); - - $this->_website ($feed->get_link ()); - $this->_description ($feed->get_description ()); - - // et on charge les articles du flux - $this->loadEntries ($feed); - } - } - } - private function loadEntries ($feed) { - $entries = array (); - - foreach ($feed->get_items () as $item) { - $title = html_only_entity_decode (strip_tags ($item->get_title ())); - $author = $item->get_author (); - $link = $item->get_permalink (); - $date = @strtotime ($item->get_date ()); - - // gestion des tags (catégorie == tag) - $tags_tmp = $item->get_categories (); - $tags = array (); - if (!is_null ($tags_tmp)) { - foreach ($tags_tmp as $tag) { - $tags[] = html_only_entity_decode ($tag->get_label ()); - } - } - - $content = html_only_entity_decode ($item->get_content ()); - - $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 .= '
    '; - } - } - - $entry = new FreshRSS_Entry ( - $this->id (), - $item->get_id (), - !is_null ($title) ? $title : '', - !is_null ($author) ? html_only_entity_decode ($author->name) : '', - !is_null ($content) ? $content : '', - !is_null ($link) ? $link : '', - $date ? $date : time () - ); - $entry->_tags ($tags); - // permet de récupérer le contenu des flux tronqués - $entry->loadCompleteContent($this->pathEntries()); - - $entries[] = $entry; - } - - $this->entries = $entries; - } -} -- cgit v1.2.3 From 4ee4f16ffe06e247d2cb79a2054ab5d5315d82b2 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Sun, 15 Dec 2013 11:24:14 +0100 Subject: Problème de casse renommage répertoire MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Models/Category.php | 85 +++++++++++ app/Models/Days.php | 7 + app/Models/Entry.php | 193 +++++++++++++++++++++++++ app/Models/Feed.php | 319 ++++++++++++++++++++++++++++++++++++++++++ lib/Minz/ActionController.php | 42 ++++++ lib/Minz/Configuration.php | 262 ++++++++++++++++++++++++++++++++++ lib/Minz/Dispatcher.php | 138 ++++++++++++++++++ lib/Minz/Error.php | 94 +++++++++++++ lib/Minz/FrontController.php | 97 +++++++++++++ lib/Minz/Helper.php | 22 +++ lib/Minz/Model.php | 12 ++ lib/Minz/Paginator.php | 196 ++++++++++++++++++++++++++ lib/Minz/Request.php | 197 ++++++++++++++++++++++++++ lib/Minz/Response.php | 60 ++++++++ lib/Minz/Router.php | 209 +++++++++++++++++++++++++++ lib/Minz/Session.php | 78 +++++++++++ lib/Minz/Translate.php | 71 ++++++++++ lib/Minz/Url.php | 129 +++++++++++++++++ lib/Minz/View.php | 241 +++++++++++++++++++++++++++++++ 19 files changed, 2452 insertions(+) create mode 100644 app/Models/Category.php create mode 100644 app/Models/Days.php create mode 100644 app/Models/Entry.php create mode 100644 app/Models/Feed.php create mode 100644 lib/Minz/ActionController.php create mode 100644 lib/Minz/Configuration.php create mode 100644 lib/Minz/Dispatcher.php create mode 100644 lib/Minz/Error.php create mode 100644 lib/Minz/FrontController.php create mode 100644 lib/Minz/Helper.php create mode 100644 lib/Minz/Model.php create mode 100644 lib/Minz/Paginator.php create mode 100644 lib/Minz/Request.php create mode 100644 lib/Minz/Response.php create mode 100644 lib/Minz/Router.php create mode 100644 lib/Minz/Session.php create mode 100644 lib/Minz/Translate.php create mode 100644 lib/Minz/Url.php create mode 100644 lib/Minz/View.php diff --git a/app/Models/Category.php b/app/Models/Category.php new file mode 100644 index 000000000..e70d1303f --- /dev/null +++ b/app/Models/Category.php @@ -0,0 +1,85 @@ +_name ($name); + $this->_color ($color); + if (isset ($feeds)) { + $this->_feeds ($feeds); + $this->nbFeed = 0; + $this->nbNotRead = 0; + foreach ($feeds as $feed) { + $this->nbFeed++; + $this->nbNotRead += $feed->nbNotRead (); + } + } + } + + public function id () { + return $this->id; + } + public function name () { + return $this->name; + } + public function color () { + return $this->color; + } + public function nbFeed () { + if ($this->nbFeed < 0) { + $catDAO = new FreshRSS_CategoryDAO (); + $this->nbFeed = $catDAO->countFeed ($this->id ()); + } + + return $this->nbFeed; + } + public function nbNotRead () { + if ($this->nbNotRead < 0) { + $catDAO = new FreshRSS_CategoryDAO (); + $this->nbNotRead = $catDAO->countNotRead ($this->id ()); + } + + return $this->nbNotRead; + } + public function feeds () { + if (is_null ($this->feeds)) { + $feedDAO = new FreshRSS_FeedDAO (); + $this->feeds = $feedDAO->listByCategory ($this->id ()); + $this->nbFeed = 0; + $this->nbNotRead = 0; + foreach ($this->feeds as $feed) { + $this->nbFeed++; + $this->nbNotRead += $feed->nbNotRead (); + } + } + + return $this->feeds; + } + + public function _id ($value) { + $this->id = $value; + } + public function _name ($value) { + $this->name = $value; + } + public function _color ($value) { + if (preg_match ('/^#([0-9a-f]{3}|[0-9a-f]{6})$/i', $value)) { + $this->color = $value; + } else { + $this->color = '#0062BE'; + } + } + public function _feeds ($values) { + if (!is_array ($values)) { + $values = array ($values); + } + + $this->feeds = $values; + } +} diff --git a/app/Models/Days.php b/app/Models/Days.php new file mode 100644 index 000000000..2d770c30b --- /dev/null +++ b/app/Models/Days.php @@ -0,0 +1,7 @@ +_guid ($guid); + $this->_title ($title); + $this->_author ($author); + $this->_content ($content); + $this->_link ($link); + $this->_date ($pubdate); + $this->_isRead ($is_read); + $this->_isFavorite ($is_favorite); + $this->_feed ($feed); + $this->_tags (preg_split('/[\s#]/', $tags)); + } + + public function id () { + return $this->id; + } + public function guid () { + return $this->guid; + } + public function title () { + return $this->title; + } + public function author () { + if (is_null ($this->author)) { + return ''; + } else { + return $this->author; + } + } + public function content () { + return $this->content; + } + public function link () { + return $this->link; + } + public function date ($raw = false) { + if ($raw) { + return $this->date; + } else { + return timestamptodate ($this->date); + } + } + public function dateAdded ($raw = false) { + $date = intval(substr($this->id, 0, -6)); + if ($raw) { + return $date; + } else { + return timestamptodate ($date); + } + } + public function isRead () { + return $this->is_read; + } + public function isFavorite () { + return $this->is_favorite; + } + public function feed ($object = false) { + if ($object) { + $feedDAO = new FreshRSS_FeedDAO (); + return $feedDAO->searchById ($this->feed); + } else { + return $this->feed; + } + } + public function tags ($inString = false) { + if ($inString) { + return empty ($this->tags) ? '' : '#' . implode(' #', $this->tags); + } else { + return $this->tags; + } + } + + public function _id ($value) { + $this->id = $value; + } + public function _guid ($value) { + $this->guid = $value; + } + public function _title ($value) { + $this->title = $value; + } + public function _author ($value) { + $this->author = $value; + } + public function _content ($value) { + $this->content = $value; + } + public function _link ($value) { + $this->link = $value; + } + public function _date ($value) { + if (ctype_digit ($value)) { + $this->date = intval ($value); + } else { + $this->date = time (); + } + } + public function _isRead ($value) { + $this->is_read = $value; + } + public function _isFavorite ($value) { + $this->is_favorite = $value; + } + public function _feed ($value) { + $this->feed = $value; + } + public function _tags ($value) { + if (!is_array ($value)) { + $value = array ($value); + } + + foreach ($value as $key => $t) { + if (!$t) { + unset ($value[$key]); + } + } + + $this->tags = $value; + } + + public function isDay ($day) { + $date = $this->dateAdded(true); + $today = @strtotime('today'); + $yesterday = $today - 86400; + + if ($day === FreshRSS_Days::TODAY && + $date >= $today && $date < $today + 86400) { + return true; + } elseif ($day === FreshRSS_Days::YESTERDAY && + $date >= $yesterday && $date < $yesterday + 86400) { + return true; + } elseif ($day === FreshRSS_Days::BEFORE_YESTERDAY && $date < $yesterday) { + return true; + } else { + return false; + } + } + + public function loadCompleteContent($pathEntries) { + // Gestion du contenu + // On cherche à récupérer les articles en entier... même si le flux ne le propose pas + if ($pathEntries) { + $entryDAO = new FreshRSS_EntryDAO(); + $entry = $entryDAO->searchByGuid($this->feed, $this->guid); + + if($entry) { + // l'article existe déjà en BDD, en se contente de recharger ce contenu + $this->content = $entry->content(); + } else { + try { + // l'article n'est pas en BDD, on va le chercher sur le site + $this->content = get_content_by_parsing( + $this->link(), $pathEntries + ); + } catch (Exception $e) { + // rien à faire, on garde l'ancien contenu (requête a échoué) + } + } + } + } + + public function toArray () { + return array ( + 'id' => $this->id (), + 'guid' => $this->guid (), + 'title' => $this->title (), + 'author' => $this->author (), + 'content' => $this->content (), + 'link' => $this->link (), + 'date' => $this->date (true), + 'is_read' => $this->isRead (), + 'is_favorite' => $this->isFavorite (), + 'id_feed' => $this->feed (), + 'tags' => $this->tags (true), + ); + } +} diff --git a/app/Models/Feed.php b/app/Models/Feed.php new file mode 100644 index 000000000..e63ac8c7a --- /dev/null +++ b/app/Models/Feed.php @@ -0,0 +1,319 @@ +_url ($url); + } else { + $this->url = $url; + } + } + + public function id () { + return $this->id; + } + public function url () { + return $this->url; + } + public function category () { + return $this->category; + } + public function entries () { + if (!is_null ($this->entries)) { + return $this->entries; + } else { + return array (); + } + } + public function name () { + return $this->name; + } + public function website () { + return $this->website; + } + public function description () { + return $this->description; + } + public function lastUpdate () { + return $this->lastUpdate; + } + public function priority () { + return $this->priority; + } + public function pathEntries () { + return $this->pathEntries; + } + public function httpAuth ($raw = true) { + if ($raw) { + return $this->httpAuth; + } else { + $pos_colon = strpos ($this->httpAuth, ':'); + $user = substr ($this->httpAuth, 0, $pos_colon); + $pass = substr ($this->httpAuth, $pos_colon + 1); + + return array ( + 'username' => $user, + 'password' => $pass + ); + } + } + public function inError () { + return $this->error; + } + public function keepHistory () { + return $this->keep_history; + } + public function nbEntries () { + if ($this->nbEntries < 0) { + $feedDAO = new FreshRSS_FeedDAO (); + $this->nbEntries = $feedDAO->countEntries ($this->id ()); + } + + return $this->nbEntries; + } + public function nbNotRead () { + if ($this->nbNotRead < 0) { + $feedDAO = new FreshRSS_FeedDAO (); + $this->nbNotRead = $feedDAO->countNotRead ($this->id ()); + } + + return $this->nbNotRead; + } + public function faviconPrepare() { + $file = DATA_PATH . '/favicons/' . $this->id () . '.txt'; + if (!file_exists ($file)) { + $t = $this->website; + if (empty($t)) { + $t = $this->url; + } + file_put_contents($file, $t); + } + } + public static function faviconDelete($id) { + $path = DATA_PATH . '/favicons/' . $id; + @unlink($path . '.ico'); + @unlink($path . '.txt'); + } + public function favicon () { + return Minz_Url::display ('/f.php?' . $this->id ()); + } + + public function _id ($value) { + $this->id = $value; + } + public function _url ($value, $validate=true) { + if ($validate) { + $value = checkUrl($value); + } + if (empty ($value)) { + throw new FreshRSS_BadUrl_Exception ($value); + } + $this->url = $value; + } + public function _category ($value) { + $this->category = $value; + } + public function _name ($value) { + if (is_null ($value)) { + $value = ''; + } + $this->name = $value; + } + public function _website ($value, $validate=true) { + if ($validate) { + $value = checkUrl($value); + } + if (empty ($value)) { + $value = ''; + } + $this->website = $value; + } + public function _description ($value) { + if (is_null ($value)) { + $value = ''; + } + $this->description = $value; + } + public function _lastUpdate ($value) { + $this->lastUpdate = $value; + } + public function _priority ($value) { + $this->priority = ctype_digit ($value) ? intval ($value) : 10; + } + public function _pathEntries ($value) { + $this->pathEntries = $value; + } + public function _httpAuth ($value) { + $this->httpAuth = $value; + } + public function _error ($value) { + if ($value) { + $value = true; + } else { + $value = false; + } + $this->error = $value; + } + public function _keepHistory ($value) { + if ($value) { + $value = true; + } else { + $value = false; + } + $this->keep_history = $value; + } + public function _nbNotRead ($value) { + $this->nbNotRead = ctype_digit ($value) ? intval ($value) : -1; + } + public function _nbEntries ($value) { + $this->nbEntries = ctype_digit ($value) ? intval ($value) : -1; + } + + public function load () { + if (!is_null ($this->url)) { + if (CACHE_PATH === false) { + throw new Minz_FileNotExistException ( + 'CACHE_PATH', + Minz_Exception::ERROR + ); + } else { + $feed = new SimplePie (); + $feed->set_useragent(Minz_Translate::t ('freshrss') . '/' . FRESHRSS_VERSION . ' (' . PHP_OS . '; ' . FRESHRSS_WEBSITE . ') ' . SIMPLEPIE_NAME . '/' . SIMPLEPIE_VERSION); + $url = htmlspecialchars_decode ($this->url, ENT_QUOTES); + if ($this->httpAuth != '') { + $url = preg_replace ('#((.+)://)(.+)#', '${1}' . $this->httpAuth . '@${3}', $url); + } + + $feed->set_feed_url ($url); + $feed->set_cache_location (CACHE_PATH); + $feed->set_cache_duration(1500); + $feed->strip_htmltags (array ( + 'base', 'blink', 'body', 'doctype', 'embed', + 'font', 'form', 'frame', 'frameset', 'html', + 'input', 'marquee', 'meta', 'noscript', + 'object', 'param', 'plaintext', 'script', 'style', + )); + $feed->strip_attributes(array_merge($feed->strip_attributes, array( + 'autoplay', 'onload', 'onunload', 'onclick', 'ondblclick', 'onmousedown', 'onmouseup', + 'onmouseover', 'onmousemove', 'onmouseout', 'onfocus', 'onblur', + 'onkeypress', 'onkeydown', 'onkeyup', 'onselect', 'onchange', 'seamless'))); + $feed->add_attributes(array( + 'img' => array('lazyload' => ''), //http://www.w3.org/TR/resource-priorities/ + 'audio' => array('preload' => 'none'), + 'iframe' => array('postpone' => '', 'sandbox' => 'allow-scripts allow-same-origin'), + 'video' => array('postpone' => '', 'preload' => 'none'), + )); + $feed->set_url_replacements(array( + 'a' => 'href', + 'area' => 'href', + 'audio' => 'src', + 'blockquote' => 'cite', + 'del' => 'cite', + 'form' => 'action', + 'iframe' => 'src', + 'img' => array( + 'longdesc', + 'src' + ), + 'input' => 'src', + 'ins' => 'cite', + 'q' => 'cite', + 'source' => 'src', + 'track' => 'src', + 'video' => array( + 'poster', + 'src', + ), + )); + $feed->init (); + + if ($feed->error ()) { + throw new FreshRSS_Feed_Exception ($feed->error . ' [' . $url . ']'); + } + + // si on a utilisé l'auto-discover, notre url va avoir changé + $subscribe_url = $feed->subscribe_url (); + if (!is_null ($subscribe_url) && $subscribe_url != $this->url) { + if ($this->httpAuth != '') { + // on enlève les id si authentification HTTP + $subscribe_url = preg_replace ('#((.+)://)((.+)@)(.+)#', '${1}${5}', $subscribe_url); + } + $this->_url ($subscribe_url); + } + + $title = $feed->get_title (); + $this->_name (!is_null ($title) ? $title : $this->url); + + $this->_website ($feed->get_link ()); + $this->_description ($feed->get_description ()); + + // et on charge les articles du flux + $this->loadEntries ($feed); + } + } + } + private function loadEntries ($feed) { + $entries = array (); + + foreach ($feed->get_items () as $item) { + $title = html_only_entity_decode (strip_tags ($item->get_title ())); + $author = $item->get_author (); + $link = $item->get_permalink (); + $date = @strtotime ($item->get_date ()); + + // gestion des tags (catégorie == tag) + $tags_tmp = $item->get_categories (); + $tags = array (); + if (!is_null ($tags_tmp)) { + foreach ($tags_tmp as $tag) { + $tags[] = html_only_entity_decode ($tag->get_label ()); + } + } + + $content = html_only_entity_decode ($item->get_content ()); + + $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 .= '
    '; + } + } + + $entry = new FreshRSS_Entry ( + $this->id (), + $item->get_id (), + !is_null ($title) ? $title : '', + !is_null ($author) ? html_only_entity_decode ($author->name) : '', + !is_null ($content) ? $content : '', + !is_null ($link) ? $link : '', + $date ? $date : time () + ); + $entry->_tags ($tags); + // permet de récupérer le contenu des flux tronqués + $entry->loadCompleteContent($this->pathEntries()); + + $entries[] = $entry; + } + + $this->entries = $entries; + } +} diff --git a/lib/Minz/ActionController.php b/lib/Minz/ActionController.php new file mode 100644 index 000000000..409d9611f --- /dev/null +++ b/lib/Minz/ActionController.php @@ -0,0 +1,42 @@ + +*/ + +/** + * La classe ActionController représente le contrôleur de l'application + */ +class Minz_ActionController { + protected $router; + protected $view; + + /** + * Constructeur + * @param $controller nom du controller + * @param $action nom de l'action à lancer + */ + public function __construct ($router) { + $this->router = $router; + $this->view = new Minz_View (); + $this->view->attributeParams (); + } + + /** + * Getteur + */ + public function view () { + return $this->view; + } + + /** + * Méthodes à redéfinir (ou non) par héritage + * firstAction est la première méthode exécutée par le Dispatcher + * lastAction est la dernière + */ + public function init () { } + public function firstAction () { } + public function lastAction () { } +} + + diff --git a/lib/Minz/Configuration.php b/lib/Minz/Configuration.php new file mode 100644 index 000000000..9fc913964 --- /dev/null +++ b/lib/Minz/Configuration.php @@ -0,0 +1,262 @@ + +*/ + +/** + * La classe Configuration permet de gérer la configuration de l'application + */ +class Minz_Configuration { + const CONF_PATH_NAME = '/application.ini'; + + /** + * VERSION est la version actuelle de MINZ + */ + const VERSION = '1.3.1.freshrss'; // version spéciale FreshRSS + + /** + * valeurs possibles pour l'"environment" + * SILENT rend l'application muette (pas de log) + * PRODUCTION est recommandée pour une appli en production + * (log les erreurs critiques) + * DEVELOPMENT log toutes les erreurs + */ + const SILENT = 0; + const PRODUCTION = 1; + const DEVELOPMENT = 2; + + /** + * définition des variables de configuration + * $sel_application une chaîne de caractères aléatoires (obligatoire) + * $environment gère le niveau d'affichage pour log et erreurs + * $use_url_rewriting indique si on utilise l'url_rewriting + * $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 + * - password mot de passe de l'utilisateur + * - base le nom de la base de données + */ + private static $sel_application = ''; + private static $environment = Minz_Configuration::PRODUCTION; + private static $base_url = ''; + 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 $current_user = ''; + + private static $db = array ( + 'host' => false, + 'user' => false, + 'password' => false, + 'base' => false + ); + + /* + * Getteurs + */ + public static function selApplication () { + return self::$sel_application; + } + public static function environment () { + return self::$environment; + } + public static function baseUrl () { + return self::$base_url; + } + public static function useUrlRewriting () { + return self::$use_url_rewriting; + } + public static function title () { + return stripslashes(self::$title); + } + 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; + } + public static function defaultUser () { + return self::$default_user; + } + public static function currentUser () { + return self::$current_user; + } + + /** + * Initialise les variables de configuration + * @exception Minz_FileNotExistException si le CONF_PATH_NAME n'existe pas + * @exception Minz_BadConfigurationException si CONF_PATH_NAME mal formaté + */ + public static function init () { + try { + self::parseFile (); + self::setReporting (); + } catch (Minz_FileNotExistException $e) { + throw $e; + } catch (Minz_BadConfigurationException $e) { + throw $e; + } + } + + /** + * Parse un fichier de configuration de type ".ini" + * @exception Minz_FileNotExistException si le CONF_PATH_NAME n'existe pas + * @exception Minz_BadConfigurationException si CONF_PATH_NAME mal formaté + */ + private static function parseFile () { + if (!file_exists (DATA_PATH . self::CONF_PATH_NAME)) { + throw new Minz_FileNotExistException ( + DATA_PATH . self::CONF_PATH_NAME, + Minz_Exception::ERROR + ); + } + + $ini_array = parse_ini_file ( + DATA_PATH . self::CONF_PATH_NAME, + true + ); + + if (!$ini_array) { + throw new Minz_PermissionDeniedException ( + DATA_PATH . self::CONF_PATH_NAME, + Minz_Exception::ERROR + ); + } + + // [general] est obligatoire + if (!isset ($ini_array['general'])) { + throw new Minz_BadConfigurationException ( + '[general]', + Minz_Exception::ERROR + ); + } + $general = $ini_array['general']; + + + // sel_application est obligatoire + if (!isset ($general['sel_application'])) { + throw new Minz_BadConfigurationException ( + 'sel_application', + Minz_Exception::ERROR + ); + } + self::$sel_application = $general['sel_application']; + + if (isset ($general['environment'])) { + switch ($general['environment']) { + case 'silent': + self::$environment = Minz_Configuration::SILENT; + break; + case 'development': + self::$environment = Minz_Configuration::DEVELOPMENT; + break; + case 'production': + self::$environment = Minz_Configuration::PRODUCTION; + break; + default: + throw new Minz_BadConfigurationException ( + 'environment', + Minz_Exception::ERROR + ); + } + + } + if (isset ($general['base_url'])) { + self::$base_url = $general['base_url']; + } + if (isset ($general['use_url_rewriting'])) { + self::$use_url_rewriting = $general['use_url_rewriting']; + } + + if (isset ($general['title'])) { + self::$title = $general['title']; + } + 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 = $general['delay_cache']; + } + if (isset ($general['default_user'])) { + self::$default_user = $general['default_user']; + self::$current_user = self::$default_user; + } + + // Base de données + $db = false; + if (isset ($ini_array['db'])) { + $db = $ini_array['db']; + } + if ($db) { + if (!isset ($db['host'])) { + throw new Minz_BadConfigurationException ( + 'host', + Minz_Exception::ERROR + ); + } + if (!isset ($db['user'])) { + throw new Minz_BadConfigurationException ( + 'user', + Minz_Exception::ERROR + ); + } + if (!isset ($db['password'])) { + throw new Minz_BadConfigurationException ( + 'password', + Minz_Exception::ERROR + ); + } + if (!isset ($db['base'])) { + throw new Minz_BadConfigurationException ( + 'base', + Minz_Exception::ERROR + ); + } + + self::$db['type'] = isset ($db['type']) ? $db['type'] : 'mysql'; + self::$db['host'] = $db['host']; + self::$db['user'] = $db['user']; + self::$db['password'] = $db['password']; + self::$db['base'] = $db['base']; + self::$db['prefix'] = isset ($db['prefix']) ? $db['prefix'] : ''; + } + } + + private static function setReporting () { + if (self::environment () == self::DEVELOPMENT) { + error_reporting (E_ALL); + ini_set ('display_errors','On'); + ini_set('log_errors', 'On'); + } elseif (self::environment () == self::PRODUCTION) { + error_reporting(E_ALL); + ini_set('display_errors','Off'); + ini_set('log_errors', 'On'); + } else { + error_reporting(0); + } + } +} diff --git a/lib/Minz/Dispatcher.php b/lib/Minz/Dispatcher.php new file mode 100644 index 000000000..2898b5f00 --- /dev/null +++ b/lib/Minz/Dispatcher.php @@ -0,0 +1,138 @@ + +*/ + +/** + * Le Dispatcher s'occupe d'initialiser le Controller et d'executer l'action + * déterminée dans la Request + * C'est un singleton + */ +class Minz_Dispatcher { + const CONTROLLERS_PATH_NAME = '/Controllers'; + + /* singleton */ + private static $instance = null; + + private $router; + private $controller; + + /** + * Récupère l'instance du Dispatcher + */ + public static function getInstance ($router) { + if (is_null (self::$instance)) { + self::$instance = new Minz_Dispatcher ($router); + } + return self::$instance; + } + + /** + * Constructeur + */ + private function __construct ($router) { + $this->router = $router; + } + + /** + * Lance le controller indiqué dans Request + * Remplit le body de Response à partir de la Vue + * @exception Minz_Exception + */ + public function run () { + $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 + // J'ignore les effets de bord :( + ob_start ('ob_gzhandler'); + + if (Minz_Cache::isEnabled () && !$cache->expired ()) { + ob_start (); + $cache->render (); + $text = ob_get_clean(); + } else { + 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 (); + + if (!Minz_Request::$reseted) { + ob_start (); + $this->controller->view ()->build (); + $text = ob_get_clean(); + } + } catch (Minz_Exception $e) { + throw $e; + } + } + + if (Minz_Cache::isEnabled ()) { + $cache->cache ($text); + } + } + + Minz_Response::setBody ($text); + } + + /** + * Instancie le Controller + * @param $controller_name le nom du controller à instancier + * @exception ControllerNotExistException le controller n'existe pas + * @exception ControllerNotActionControllerException controller n'est + * > pas une instance de ActionController + */ + private function createController ($controller_name) { + $filename = APP_PATH . self::CONTROLLERS_PATH_NAME . '/' + . $controller_name . '.php'; + + if (!class_exists ($controller_name)) { + throw new Minz_ControllerNotExistException ( + $controller_name, + Minz_Exception::ERROR + ); + } + $this->controller = new $controller_name ($this->router); + + if (! ($this->controller instanceof Minz_ActionController)) { + throw new Minz_ControllerNotActionControllerException ( + $controller_name, + Minz_Exception::ERROR + ); + } + } + + /** + * Lance l'action sur le controller du dispatcher + * @param $action_name le nom de l'action + * @exception ActionException si on ne peut pas exécuter l'action sur + * le controller + */ + private function launchAction ($action_name) { + if (!Minz_Request::$reseted) { + if (!is_callable (array ( + $this->controller, + $action_name + ))) { + throw new Minz_ActionException ( + get_class ($this->controller), + $action_name, + Minz_Exception::ERROR + ); + } + call_user_func (array ( + $this->controller, + $action_name + )); + } + } +} diff --git a/lib/Minz/Error.php b/lib/Minz/Error.php new file mode 100644 index 000000000..1ad0d313c --- /dev/null +++ b/lib/Minz/Error.php @@ -0,0 +1,94 @@ + +*/ + +/** + * La classe Error permet de lancer des erreurs HTTP + */ +class Minz_Error { + public function __construct () { } + + /** + * Permet de lancer une erreur + * @param $code le type de l'erreur, par défaut 404 (page not found) + * @param $logs logs d'erreurs découpés de la forme + * > $logs['error'] + * > $logs['warning'] + * > $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) { + $logs = self::processLogs ($logs); + $error_filename = APP_PATH . '/Controllers/ErrorController.php'; + + if (file_exists ($error_filename)) { + $params = array ( + 'code' => $code, + 'logs' => $logs + ); + + Minz_Response::setHeader ($code); + if ($redirect) { + Minz_Request::forward (array ( + 'c' => 'error' + ), true); + } else { + Minz_Request::forward (array ( + 'c' => 'error', + 'params' => $params + ), false); + } + } else { + $text = '

    An error occured

    '."\n"; + + if (!empty ($logs)) { + $text .= '
      '."\n"; + foreach ($logs as $log) { + $text .= '
    • ' . $log . '
    • '."\n"; + } + $text .= '
    '."\n"; + } + + Minz_Response::setHeader ($code); + Minz_Response::setBody ($text); + Minz_Response::send (); + exit (); + } + } + + /** + * Permet de retourner les logs de façon à n'avoir que + * ceux que l'on veut réellement + * @param $logs les logs rangés par catégories (error, warning, notice) + * @return la liste des logs, sans catégorie, + * > en fonction de l'environment + */ + private static function processLogs ($logs) { + $env = Minz_Configuration::environment (); + $logs_ok = array (); + $error = array (); + $warning = array (); + $notice = array (); + + if (isset ($logs['error'])) { + $error = $logs['error']; + } + if (isset ($logs['warning'])) { + $warning = $logs['warning']; + } + if (isset ($logs['notice'])) { + $notice = $logs['notice']; + } + + if ($env == Minz_Configuration::PRODUCTION) { + $logs_ok = $error; + } + if ($env == Minz_Configuration::DEVELOPMENT) { + $logs_ok = array_merge ($error, $warning, $notice); + } + + return $logs_ok; + } +} diff --git a/lib/Minz/FrontController.php b/lib/Minz/FrontController.php new file mode 100644 index 000000000..eb9835fe5 --- /dev/null +++ b/lib/Minz/FrontController.php @@ -0,0 +1,97 @@ +. +# +# ***** END LICENSE BLOCK ***** + +/** + * La classe FrontController est le Dispatcher du framework, elle lance l'application + * Elle est appelée en général dans le fichier index.php à la racine du serveur + */ +class Minz_FrontController { + protected $dispatcher; + protected $router; + + /** + * Constructeur + * Initialise le router et le dispatcher + */ + public function __construct () { + if (LOG_PATH === false) { + $this->killApp ('Path doesn\'t exist : LOG_PATH'); + } + + try { + Minz_Configuration::init (); + + Minz_Request::init (); + + $this->router = new Minz_Router (); + $this->router->init (); + } catch (Minz_RouteNotFoundException $e) { + Minz_Log::record ($e->getMessage (), Minz_Log::ERROR); + Minz_Error::error ( + 404, + array ('error' => array ($e->getMessage ())) + ); + } catch (Minz_Exception $e) { + Minz_Log::record ($e->getMessage (), Minz_Log::ERROR); + $this->killApp ($e->getMessage ()); + } + + $this->dispatcher = Minz_Dispatcher::getInstance ($this->router); + } + + /** + * Démarre l'application (lance le dispatcher et renvoie la réponse + */ + public function run () { + try { + $this->dispatcher->run (); + Minz_Response::send (); + } catch (Minz_Exception $e) { + try { + Minz_Log::record ($e->getMessage (), Minz_Log::ERROR); + } catch (Minz_PermissionDeniedException $e) { + $this->killApp ($e->getMessage ()); + } + + if ($e instanceof Minz_FileNotExistException || + $e instanceof Minz_ControllerNotExistException || + $e instanceof Minz_ControllerNotActionControllerException || + $e instanceof Minz_ActionException) { + Minz_Error::error ( + 404, + array ('error' => array ($e->getMessage ())), + true + ); + } else { + $this->killApp (); + } + } + } + + /** + * Permet d'arrêter le programme en urgence + */ + private function killApp ($txt = '') { + if ($txt == '') { + $txt = 'See logs files'; + } + exit ('### Application problem ###
    '."\n".$txt); + } +} diff --git a/lib/Minz/Helper.php b/lib/Minz/Helper.php new file mode 100644 index 000000000..b058211d3 --- /dev/null +++ b/lib/Minz/Helper.php @@ -0,0 +1,22 @@ + +*/ + +/** + * La classe Helper représente une aide pour des tâches récurrentes + */ +class Minz_Helper { + /** + * Annule les effets des magic_quotes pour une variable donnée + * @param $var variable à traiter (tableau ou simple variable) + */ + public static function stripslashes_r ($var) { + if (is_array ($var)){ + return array_map (array ('Helper', 'stripslashes_r'), $var); + } else { + return stripslashes($var); + } + } +} diff --git a/lib/Minz/Model.php b/lib/Minz/Model.php new file mode 100644 index 000000000..adbaba942 --- /dev/null +++ b/lib/Minz/Model.php @@ -0,0 +1,12 @@ + +*/ + +/** + * La classe Model représente un modèle de l'application (représentation MVC) + */ +class Minz_Model { + +} diff --git a/lib/Minz/Paginator.php b/lib/Minz/Paginator.php new file mode 100644 index 000000000..5858e76a5 --- /dev/null +++ b/lib/Minz/Paginator.php @@ -0,0 +1,196 @@ + +*/ + +/** + * La classe Paginator permet de gérer la pagination de l'application facilement + */ +class Minz_Paginator { + /** + * $items tableau des éléments à afficher/gérer + */ + private $items = array (); + + /** + * $nbItemsPerPage le nombre d'éléments par page + */ + private $nbItemsPerPage = 10; + + /** + * $currentPage page actuelle à gérer + */ + private $currentPage = 1; + + /** + * $nbPage le nombre de pages de pagination + */ + private $nbPage = 1; + + /** + * $nbItems le nombre d'éléments + */ + private $nbItems = 0; + + /** + * Constructeur + * @param $items les éléments à gérer + */ + public function __construct ($items) { + $this->_items ($items); + $this->_nbItems (count ($this->items (true))); + $this->_nbItemsPerPage ($this->nbItemsPerPage); + $this->_currentPage ($this->currentPage); + } + + /** + * Permet d'afficher la pagination + * @param $view nom du fichier de vue situé dans /app/views/helpers/ + * @param $getteur variable de type $_GET[] permettant de retrouver la page + */ + public function render ($view, $getteur) { + $view = APP_PATH . '/views/helpers/'.$view; + + if (file_exists ($view)) { + include ($view); + } + } + + /** + * Permet de retrouver la page d'un élément donné + * @param $item l'élément à retrouver + * @return la page à laquelle se trouve l'élément (false si non trouvé) + */ + public function pageByItem ($item) { + $page = false; + $i = 0; + + do { + if ($item == $this->items[$i]) { + $page = ceil (($i + 1) / $this->nbItemsPerPage); + } + + $i++; + } while (!$page && $i < $this->nbItems ()); + + return $page; + } + + /** + * Permet de retrouver la position d'un élément donné (à partir de 0) + * @param $item l'élément à retrouver + * @return la position à laquelle se trouve l'élément (false si non trouvé) + */ + public function positionByItem ($item) { + $find = false; + $i = 0; + + do { + if ($item == $this->items[$i]) { + $find = true; + } else { + $i++; + } + } while (!$find && $i < $this->nbItems ()); + + return $i; + } + + /** + * Permet de récupérer un item par sa position + * @param $pos la position de l'élément + * @return l'item situé à $pos (dernier item si $pos<0, 1er si $pos>=count($items)) + */ + public function itemByPosition ($pos) { + if ($pos < 0) { + $pos = $this->nbItems () - 1; + } + if ($pos >= count($this->items)) { + $pos = 0; + } + + return $this->items[$pos]; + } + + /** + * GETTEURS + */ + /** + * @param $all si à true, retourne tous les éléments sans prendre en compte la pagination + */ + public function items ($all = false) { + $array = array (); + $nbItems = $this->nbItems (); + + if ($nbItems <= $this->nbItemsPerPage || $all) { + $array = $this->items; + } else { + $begin = ($this->currentPage - 1) * $this->nbItemsPerPage; + $counter = 0; + $i = 0; + + foreach ($this->items as $key => $item) { + if ($i >= $begin) { + $array[$key] = $item; + $counter++; + } + if ($counter >= $this->nbItemsPerPage) { + break; + } + $i++; + } + } + + return $array; + } + public function nbItemsPerPage () { + return $this->nbItemsPerPage; + } + public function currentPage () { + return $this->currentPage; + } + public function nbPage () { + return $this->nbPage; + } + public function nbItems () { + return $this->nbItems; + } + + /** + * SETTEURS + */ + public function _items ($items) { + if (is_array ($items)) { + $this->items = $items; + } + + $this->_nbPage (); + } + public function _nbItemsPerPage ($nbItemsPerPage) { + if ($nbItemsPerPage > $this->nbItems ()) { + $nbItemsPerPage = $this->nbItems (); + } + if ($nbItemsPerPage < 0) { + $nbItemsPerPage = 0; + } + + $this->nbItemsPerPage = $nbItemsPerPage; + $this->_nbPage (); + } + public function _currentPage ($page) { + if($page < 1 || ($page > $this->nbPage && $this->nbPage > 0)) { + throw new CurrentPagePaginationException ($page); + } + + $this->currentPage = $page; + } + private function _nbPage () { + if ($this->nbItemsPerPage > 0) { + $this->nbPage = ceil ($this->nbItems () / $this->nbItemsPerPage); + } + } + public function _nbItems ($value) { + $this->nbItems = $value; + } +} diff --git a/lib/Minz/Request.php b/lib/Minz/Request.php new file mode 100644 index 000000000..c8ffa4a42 --- /dev/null +++ b/lib/Minz/Request.php @@ -0,0 +1,197 @@ + +*/ + +/** + * Request représente la requête http + */ +class Minz_Request { + private static $controller_name = ''; + private static $action_name = ''; + private static $params = array (); + + private static $default_controller_name = 'index'; + private static $default_action_name = 'index'; + + public static $reseted = true; + + /** + * Getteurs + */ + public static function controllerName () { + return self::$controller_name; + } + public static function actionName () { + return self::$action_name; + } + public static function params () { + return self::$params; + } + static function htmlspecialchars_utf8 ($p) { + return htmlspecialchars($p, ENT_QUOTES, 'UTF-8'); + } + public static function param ($key, $default = false, $specialchars = false) { + if (isset (self::$params[$key])) { + $p = self::$params[$key]; + if(is_object($p) || $specialchars) { + return $p; + } elseif(is_array($p)) { + return array_map('self::htmlspecialchars_utf8', $p); + } else { + return self::htmlspecialchars_utf8($p); + } + } else { + return $default; + } + } + public static function defaultControllerName () { + return self::$default_controller_name; + } + public static function defaultActionName () { + return self::$default_action_name; + } + + /** + * Setteurs + */ + public static function _controllerName ($controller_name) { + self::$controller_name = $controller_name; + } + public static function _actionName ($action_name) { + self::$action_name = $action_name; + } + public static function _params ($params) { + if (!is_array($params)) { + $params = array ($params); + } + + self::$params = $params; + } + public static function _param ($key, $value = false) { + if ($value === false) { + unset (self::$params[$key]); + } else { + self::$params[$key] = $value; + } + } + + /** + * Initialise la Request + */ + public static function init () { + self::magicQuotesOff (); + } + + /** + * Retourn le nom de domaine du site + */ + public static function getDomainName () { + return $_SERVER['HTTP_HOST']; + } + + /** + * Détermine la base de l'url + * @return la base de l'url + */ + public static function getBaseUrl () { + return Minz_Configuration::baseUrl (); + } + + /** + * Récupère l'URI de la requête + * @return l'URI + */ + public static function getURI () { + if (isset ($_SERVER['REQUEST_URI'])) { + $base_url = self::getBaseUrl (); + $uri = $_SERVER['REQUEST_URI']; + + $len_base_url = strlen ($base_url); + $real_uri = substr ($uri, $len_base_url); + } else { + $real_uri = ''; + } + + return $real_uri; + } + + /** + * Relance une requête + * @param $url l'url vers laquelle est relancée la requête + * @param $redirect si vrai, force la redirection http + * > sinon, le dispatcher recharge en interne + */ + public static function forward ($url = array (), $redirect = false) { + $url = Minz_Url::checkUrl ($url); + + if ($redirect) { + header ('Location: ' . Minz_Url::display ($url, 'php')); + exit (); + } else { + self::$reseted = true; + + self::_controllerName ($url['c']); + self::_actionName ($url['a']); + self::_params (array_merge ( + self::$params, + $url['params'] + )); + } + } + + /** + * Permet de récupérer une variable de type $_GET + * @param $param nom de la variable + * @param $default valeur par défaut à attribuer à la variable + * @return $_GET[$param] + * $_GET si $param = false + * $default si $_GET[$param] n'existe pas + */ + public static function fetchGET ($param = false, $default = false) { + if ($param === false) { + return $_GET; + } elseif (isset ($_GET[$param])) { + return $_GET[$param]; + } else { + return $default; + } + } + + /** + * Permet de récupérer une variable de type $_POST + * @param $param nom de la variable + * @param $default valeur par défaut à attribuer à la variable + * @return $_POST[$param] + * $_POST si $param = false + * $default si $_POST[$param] n'existe pas + */ + public static function fetchPOST ($param = false, $default = false) { + if ($param === false) { + return $_POST; + } elseif (isset ($_POST[$param])) { + return $_POST[$param]; + } else { + return $default; + } + } + + /** + * Méthode désactivant les magic_quotes pour les variables + * $_GET + * $_POST + * $_COOKIE + */ + private static function magicQuotesOff () { + if (get_magic_quotes_gpc ()) { + $_GET = Minz_Helper::stripslashes_r ($_GET); + $_POST = Minz_Helper::stripslashes_r ($_POST); + $_COOKIE = Minz_Helper::stripslashes_r ($_COOKIE); + } + } + + public static function isPost () { + return !empty ($_POST) || !empty ($_FILES); + } +} diff --git a/lib/Minz/Response.php b/lib/Minz/Response.php new file mode 100644 index 000000000..f8ea3d946 --- /dev/null +++ b/lib/Minz/Response.php @@ -0,0 +1,60 @@ + +*/ + +/** + * Response représente la requête http renvoyée à l'utilisateur + */ +class Minz_Response { + private static $header = 'HTTP/1.0 200 OK'; + private static $body = ''; + + /** + * Mets à jour le body de la Response + * @param $text le texte à incorporer dans le body + */ + public static function setBody ($text) { + self::$body = $text; + } + + /** + * Mets à jour le header de la Response + * @param $code le code HTTP, valeurs possibles + * - 200 (OK) + * - 403 (Forbidden) + * - 404 (Forbidden) + * - 500 (Forbidden) -> par défaut si $code erroné + * - 503 (Forbidden) + */ + public static function setHeader ($code) { + switch ($code) { + case 200 : + self::$header = 'HTTP/1.0 200 OK'; + break; + case 403 : + self::$header = 'HTTP/1.0 403 Forbidden'; + break; + case 404 : + self::$header = 'HTTP/1.0 404 Not Found'; + break; + case 500 : + self::$header = 'HTTP/1.0 500 Internal Server Error'; + break; + case 503 : + self::$header = 'HTTP/1.0 503 Service Unavailable'; + break; + default : + self::$header = 'HTTP/1.0 500 Internal Server Error'; + } + } + + /** + * Envoie la Response à l'utilisateur + */ + public static function send () { + header (self::$header); + echo self::$body; + } +} diff --git a/lib/Minz/Router.php b/lib/Minz/Router.php new file mode 100644 index 000000000..1ccd72597 --- /dev/null +++ b/lib/Minz/Router.php @@ -0,0 +1,209 @@ + +*/ + +/** + * La classe Router gère le routage de l'application + * Les routes sont définies dans APP_PATH.'/configuration/routes.php' + */ +class Minz_Router { + const ROUTES_PATH_NAME = '/configuration/routes.php'; + + private $routes = array (); + + /** + * Constructeur + * @exception FileNotExistException si ROUTES_PATH_NAME n'existe pas + * et que l'on utilise l'url rewriting + */ + public function __construct () { + if (Minz_Configuration::useUrlRewriting ()) { + if (file_exists (APP_PATH . self::ROUTES_PATH_NAME)) { + $routes = include ( + APP_PATH . self::ROUTES_PATH_NAME + ); + + if (!is_array ($routes)) { + $routes = array (); + } + + $this->routes = array_map ( + array ('Url', 'checkUrl'), + $routes + ); + } else { + throw new Minz_FileNotExistException ( + self::ROUTES_PATH_NAME, + Minz_Exception::ERROR + ); + } + } + } + + /** + * Initialise le Router en déterminant le couple Controller / Action + * Mets à jour la Request + * @exception RouteNotFoundException si l'uri n'est pas présente dans + * > la table de routage + */ + public function init () { + $url = array (); + + if (Minz_Configuration::useUrlRewriting ()) { + try { + $url = $this->buildWithRewriting (); + } catch (Minz_RouteNotFoundException $e) { + throw $e; + } + } else { + $url = $this->buildWithoutRewriting (); + } + + $url['params'] = array_merge ( + $url['params'], + Minz_Request::fetchPOST () + ); + + Minz_Request::forward ($url); + } + + /** + * Retourne un tableau représentant l'url passée par la barre d'adresses + * Ne se base PAS sur la table de routage + * @return tableau représentant l'url + */ + public function buildWithoutRewriting () { + $url = array (); + + $url['c'] = Minz_Request::fetchGET ( + 'c', + Minz_Request::defaultControllerName () + ); + $url['a'] = Minz_Request::fetchGET ( + 'a', + Minz_Request::defaultActionName () + ); + $url['params'] = Minz_Request::fetchGET (); + + // post-traitement + unset ($url['params']['c']); + unset ($url['params']['a']); + + return $url; + } + + /** + * Retourne un tableau représentant l'url passée par la barre d'adresses + * Se base sur la table de routage + * @return tableau représentant l'url + * @exception RouteNotFoundException si l'uri n'est pas présente dans + * > la table de routage + */ + public function buildWithRewriting () { + $url = array (); + $uri = Minz_Request::getURI (); + $find = false; + + foreach ($this->routes as $route) { + $regex = '*^' . $route['route'] . '$*'; + if (preg_match ($regex, $uri, $matches)) { + $url['c'] = $route['controller']; + $url['a'] = $route['action']; + $url['params'] = $this->getParams ( + $route['params'], + $matches + ); + $find = true; + break; + } + } + + if (!$find && $uri != '/') { + throw new Minz_RouteNotFoundException ( + $uri, + Minz_Exception::ERROR + ); + } + + // post-traitement + $url = Minz_Url::checkUrl ($url); + + return $url; + } + + /** + * Retourne l'uri d'une url en se basant sur la table de routage + * @param l'url sous forme de tableau + * @return l'uri formatée (string) selon une route trouvée + */ + public function printUriRewrited ($url) { + $route = $this->searchRoute ($url); + + if ($route !== false) { + return $this->replaceParams ($route, $url['params']); + } + + return ''; + } + + /** + * Recherche la route correspondante à une url + * @param l'url sous forme de tableau + * @return la route telle que spécifiée dans la table de routage, + * false si pas trouvée + */ + public function searchRoute ($url) { + foreach ($this->routes as $route) { + if ($route['controller'] == $url['c'] + && $route['action'] == $url['a']) { + // calcule la différence des tableaux de params + $params = array_flip ($route['params']); + $difference_params = array_diff_key ( + $params, + $url['params'] + ); + + // vérifie que pas de différence + // et le cas où $params est vide et pas $url['params'] + if (empty ($difference_params) + && (!empty ($params) || empty ($url['params']))) { + return $route; + } + } + } + + return false; + } + + /** + * Récupère un tableau dont + * - les clés sont définies dans $params_route + * - les valeurs sont situées dans $matches + * Le tableau $matches est décalé de +1 par rapport à $params_route + */ + private function getParams($params_route, $matches) { + $params = array (); + + for ($i = 0; $i < count ($params_route); $i++) { + $param = $params_route[$i]; + $params[$param] = $matches[$i + 1]; + } + + return $params; + } + + /** + * Remplace les éléments de la route par les valeurs contenues dans $params + */ + private function replaceParams ($route, $params_replace) { + $uri = $route['route']; + $params = array(); + foreach($route['params'] as $param) { + $uri = preg_replace('#\((.+)\)#U', $params_replace[$param], $uri, 1); + } + + return stripslashes($uri); + } +} diff --git a/lib/Minz/Session.php b/lib/Minz/Session.php new file mode 100644 index 000000000..878caa556 --- /dev/null +++ b/lib/Minz/Session.php @@ -0,0 +1,78 @@ + + */ + +/** + * La classe Translate se charge de la traduction + * Utilise les fichiers du répertoire /app/i18n/ + */ +class Minz_Translate { + /** + * $language est la langue à afficher + */ + private static $language; + + /** + * $translates est le tableau de correspondance + * $key => $traduction + */ + private static $translates = array (); + + /** + * Inclus le fichier de langue qui va bien + * l'enregistre dans $translates + */ + public static function init () { + $l = Minz_Configuration::language (); + self::$language = Minz_Session::param ('language', $l); + + $l_path = APP_PATH . '/i18n/' . self::$language . '.php'; + + if (file_exists ($l_path)) { + self::$translates = include ($l_path); + } + } + + /** + * Alias de init + */ + public static function reset () { + self::init (); + } + + /** + * Traduit une clé en sa valeur du tableau $translates + * @param $key la clé à traduire + * @return la valeur correspondante à la clé + * > si non présente dans le tableau, on retourne la clé elle-même + */ + public static function t ($key) { + $translate = $key; + + if (isset (self::$translates[$key])) { + $translate = self::$translates[$key]; + } + + $args = func_get_args (); + unset($args[0]); + + return vsprintf ($translate, $args); + } + + /** + * Retourne la langue utilisée actuellement + * @return la langue + */ + public static function language () { + return self::$language; + } +} diff --git a/lib/Minz/Url.php b/lib/Minz/Url.php new file mode 100644 index 000000000..30f7f6231 --- /dev/null +++ b/lib/Minz/Url.php @@ -0,0 +1,129 @@ +printUriRewrited ($url); + } else { + $url_string .= self::printUri ($url, $encodage); + } + } else { + $url_string .= $url; + } + + return $url_string; + } + + /** + * Construit l'URI d'une URL sans url rewriting + * @param l'url sous forme de tableau + * @param $encodage pour indiquer comment encoder les & (& ou & pour html) + * @return l'uri sous la forme ?key=value&key2=value2 + */ + private static function printUri ($url, $encodage) { + $uri = ''; + $separator = '/?'; + + if($encodage == 'html') { + $and = '&'; + } else { + $and = '&'; + } + + if (isset ($url['c']) + && $url['c'] != Minz_Request::defaultControllerName ()) { + $uri .= $separator . 'c=' . $url['c']; + $separator = $and; + } + + if (isset ($url['a']) + && $url['a'] != Minz_Request::defaultActionName ()) { + $uri .= $separator . 'a=' . $url['a']; + $separator = $and; + } + + if (isset ($url['params'])) { + foreach ($url['params'] as $key => $param) { + $uri .= $separator . $key . '=' . $param; + $separator = $and; + } + } + + return $uri; + } + + /** + * Vérifie que les éléments du tableau représentant une url soit ok + * @param l'url sous forme de tableau (sinon renverra directement $url) + * @return l'url vérifié + */ + public static function checkUrl ($url) { + $url_checked = $url; + + if (is_array ($url)) { + if (!isset ($url['c'])) { + $url_checked['c'] = Minz_Request::defaultControllerName (); + } + if (!isset ($url['a'])) { + $url_checked['a'] = Minz_Request::defaultActionName (); + } + if (!isset ($url['params'])) { + $url_checked['params'] = array (); + } + } + + return $url_checked; + } +} + +function _url ($controller, $action) { + $nb_args = func_num_args (); + + if($nb_args < 2 || $nb_args % 2 != 0) { + return false; + } + + $args = func_get_args (); + $params = array (); + for($i = 2; $i < $nb_args; $i = $i + 2) { + $params[$args[$i]] = $args[$i + 1]; + } + + return Minz_Url::display (array ('c' => $controller, 'a' => $action, 'params' => $params)); +} diff --git a/lib/Minz/View.php b/lib/Minz/View.php new file mode 100644 index 000000000..c8d0aefed --- /dev/null +++ b/lib/Minz/View.php @@ -0,0 +1,241 @@ + +*/ + +/** + * La classe View représente la vue de l'application + */ +class Minz_View { + const VIEWS_PATH_NAME = '/views'; + const LAYOUT_PATH_NAME = '/layout'; + const LAYOUT_FILENAME = '/layout.phtml'; + + private $view_filename = ''; + private $use_layout = false; + + private static $title = ''; + private static $styles = array (); + private static $scripts = array (); + + private static $params = array (); + + /** + * Constructeur + * Détermine si on utilise un layout ou non + */ + public function __construct () { + $this->view_filename = APP_PATH + . self::VIEWS_PATH_NAME . '/' + . Minz_Request::controllerName () . '/' + . Minz_Request::actionName () . '.phtml'; + + if (file_exists (APP_PATH + . self::LAYOUT_PATH_NAME + . self::LAYOUT_FILENAME)) { + $this->use_layout = true; + } + + self::$title = Minz_Configuration::title (); + } + + /** + * Construit la vue + */ + public function build () { + if ($this->use_layout) { + $this->buildLayout (); + } else { + $this->render (); + } + } + + /** + * Construit le layout + */ + public function buildLayout () { + include ( + APP_PATH + . self::LAYOUT_PATH_NAME + . self::LAYOUT_FILENAME + ); + } + + /** + * Affiche la Vue en elle-même + */ + public function render () { + if (file_exists ($this->view_filename)) { + include ($this->view_filename); + } else { + Minz_Log::record ('File doesn\'t exist : `' + . $this->view_filename . '`', + Minz_Log::NOTICE); + } + } + + /** + * Ajoute un élément du layout + * @param $part l'élément partial à ajouter + */ + public function partial ($part) { + $fic_partial = APP_PATH + . self::LAYOUT_PATH_NAME . '/' + . $part . '.phtml'; + + if (file_exists ($fic_partial)) { + include ($fic_partial); + } else { + Minz_Log::record ('File doesn\'t exist : `' + . $fic_partial . '`', + Minz_Log::WARNING); + } + } + + /** + * Affiche un élément graphique situé dans APP./views/helpers/ + * @param $helper l'élément à afficher + */ + public function renderHelper ($helper) { + $fic_helper = APP_PATH + . '/views/helpers/' + . $helper . '.phtml'; + + if (file_exists ($fic_helper)) { + include ($fic_helper); + } else { + Minz_Log::record ('File doesn\'t exist : `' + . $fic_helper . '`', + Minz_Log::WARNING); + } + } + + /** + * Permet de choisir si on souhaite utiliser le layout + * @param $use true si on souhaite utiliser le layout, false sinon + */ + public function _useLayout ($use) { + $this->use_layout = $use; + } + + /** + * Gestion du titre + */ + public static function title () { + return self::$title; + } + public static function headTitle () { + return '' . self::$title . '' . "\n"; + } + public static function _title ($title) { + self::$title = $title; + } + public static function prependTitle ($title) { + self::$title = $title . self::$title; + } + public static function appendTitle ($title) { + self::$title = self::$title . $title; + } + + /** + * Gestion des feuilles de style + */ + public static function headStyle () { + $styles = ''; + + foreach(self::$styles as $style) { + $cond = $style['cond']; + if ($cond) { + $styles .= ''; + } + + $styles .= "\n"; + } + + return $styles; + } + public static function prependStyle ($url, $media = 'all', $cond = false) { + array_unshift (self::$styles, array ( + 'url' => $url, + 'media' => $media, + 'cond' => $cond + )); + } + public static function appendStyle ($url, $media = 'all', $cond = false) { + self::$styles[] = array ( + 'url' => $url, + 'media' => $media, + 'cond' => $cond + ); + } + + /** + * Gestion des scripts JS + */ + public static function headScript () { + $scripts = ''; + + foreach (self::$scripts as $script) { + $cond = $script['cond']; + if ($cond) { + $scripts .= ''; + } + + $scripts .= "\n"; + } + + return $scripts; + } + public static function prependScript ($url, $cond = false, $defer = true, $async = true) { + array_unshift(self::$scripts, array ( + 'url' => $url, + 'cond' => $cond, + 'defer' => $defer, + 'async' => $async, + )); + } + public static function appendScript ($url, $cond = false, $defer = true, $async = true) { + self::$scripts[] = array ( + 'url' => $url, + 'cond' => $cond, + 'defer' => $defer, + 'async' => $async, + ); + } + + /** + * Gestion des paramètres ajoutés à la vue + */ + public static function _param ($key, $value) { + self::$params[$key] = $value; + } + public function attributeParams () { + foreach (Minz_View::$params as $key => $value) { + $this->$key = $value; + } + } +} + + -- cgit v1.2.3 From b4463cb69e64ff2dfe840ef69f1b825ecdbee43e Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Sun, 15 Dec 2013 11:28:27 +0100 Subject: Problème casse renommage répertoire MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Controllers/configureController.php | 415 ++++++++++++++++++++++++++++++ app/Controllers/entryController.php | 112 ++++++++ app/Controllers/errorController.php | 26 ++ app/Controllers/feedController.php | 428 +++++++++++++++++++++++++++++++ app/Controllers/indexController.php | 277 ++++++++++++++++++++ app/Controllers/javascriptController.php | 13 + app/controllers/configureController.php | 415 ------------------------------ app/controllers/entryController.php | 112 -------- app/controllers/errorController.php | 26 -- app/controllers/feedController.php | 428 ------------------------------- app/controllers/indexController.php | 277 -------------------- app/controllers/javascriptController.php | 13 - 12 files changed, 1271 insertions(+), 1271 deletions(-) create mode 100755 app/Controllers/configureController.php create mode 100755 app/Controllers/entryController.php create mode 100644 app/Controllers/errorController.php create mode 100755 app/Controllers/feedController.php create mode 100755 app/Controllers/indexController.php create mode 100755 app/Controllers/javascriptController.php delete mode 100755 app/controllers/configureController.php delete mode 100755 app/controllers/entryController.php delete mode 100644 app/controllers/errorController.php delete mode 100755 app/controllers/feedController.php delete mode 100755 app/controllers/indexController.php delete mode 100755 app/controllers/javascriptController.php diff --git a/app/Controllers/configureController.php b/app/Controllers/configureController.php new file mode 100755 index 000000000..62fead315 --- /dev/null +++ b/app/Controllers/configureController.php @@ -0,0 +1,415 @@ +view->conf) && !is_logged ()) { + Minz_Error::error ( + 403, + array ('error' => array (Minz_Translate::t ('access_denied'))) + ); + } + + $catDAO = new FreshRSS_CategoryDAO (); + $catDAO->checkDefault (); + } + + public function categorizeAction () { + $feedDAO = new FreshRSS_FeedDAO (); + $catDAO = new FreshRSS_CategoryDAO (); + $catDAO->checkDefault (); + $defaultCategory = $catDAO->getDefault (); + $defaultId = $defaultCategory->id (); + + if (Minz_Request::isPost ()) { + $cats = Minz_Request::param ('categories', array ()); + $ids = Minz_Request::param ('ids', array ()); + $newCat = trim (Minz_Request::param ('new_category', '')); + + foreach ($cats as $key => $name) { + if (strlen ($name) > 0) { + $cat = new FreshRSS_Category ($name); + $values = array ( + 'name' => $cat->name (), + 'color' => $cat->color () + ); + $catDAO->updateCategory ($ids[$key], $values); + } elseif ($ids[$key] != $defaultId) { + $feedDAO->changeCategory ($ids[$key], $defaultId); + $catDAO->deleteCategory ($ids[$key]); + } + } + + if ($newCat != '') { + $cat = new FreshRSS_Category ($newCat); + $values = array ( + 'id' => $cat->id (), + 'name' => $cat->name (), + 'color' => $cat->color () + ); + + if ($catDAO->searchByName ($newCat) == false) { + $catDAO->addCategory ($values); + } + } + + // notif + $notif = array ( + 'type' => 'good', + 'content' => Minz_Translate::t ('categories_updated') + ); + Minz_Session::_param ('notification', $notif); + + Minz_Request::forward (array ('c' => 'configure', 'a' => 'categorize'), true); + } + + $this->view->categories = $catDAO->listCategories (false); + $this->view->defaultCategory = $catDAO->getDefault (); + $this->view->feeds = $feedDAO->listFeeds (); + $this->view->flux = false; + + Minz_View::prependTitle (Minz_Translate::t ('categories_management') . ' - '); + } + + public function feedAction () { + $catDAO = new FreshRSS_CategoryDAO (); + $this->view->categories = $catDAO->listCategories (false); + + $feedDAO = new FreshRSS_FeedDAO (); + $this->view->feeds = $feedDAO->listFeeds (); + + $id = Minz_Request::param ('id'); + if ($id == false && !empty ($this->view->feeds)) { + $id = current ($this->view->feeds)->id (); + } + + $this->view->flux = false; + if ($id != false) { + $this->view->flux = $this->view->feeds[$id]; + + if (!$this->view->flux) { + Minz_Error::error ( + 404, + array ('error' => array (Minz_Translate::t ('page_not_found'))) + ); + } else { + if (Minz_Request::isPost () && $this->view->flux) { + $name = Minz_Request::param ('name', ''); + $description = Minz_Request::param('description', ''); + $website = Minz_Request::param('website', ''); + $url = Minz_Request::param('url', ''); + $hist = Minz_Request::param ('keep_history', 'no'); + $cat = Minz_Request::param ('category', 0); + $path = Minz_Request::param ('path_entries', ''); + $priority = Minz_Request::param ('priority', 0); + $user = Minz_Request::param ('http_user', ''); + $pass = Minz_Request::param ('http_pass', ''); + + $keep_history = false; + if ($hist == 'yes') { + $keep_history = true; + } + + $httpAuth = ''; + if ($user != '' || $pass != '') { + $httpAuth = $user . ':' . $pass; + } + + $values = array ( + 'name' => $name, + 'description' => $description, + 'website' => $website, + 'url' => $url, + 'category' => $cat, + 'pathEntries' => $path, + 'priority' => $priority, + 'httpAuth' => $httpAuth, + 'keep_history' => $keep_history + ); + + if ($feedDAO->updateFeed ($id, $values)) { + $this->view->flux->_category ($cat); + + $notif = array ( + 'type' => 'good', + 'content' => Minz_Translate::t ('feed_updated') + ); + } else { + $notif = array ( + 'type' => 'bad', + 'content' => Minz_Translate::t ('error_occurred_update') + ); + } + + Minz_Session::_param ('notification', $notif); + Minz_Request::forward (array ('c' => 'configure', 'a' => 'feed', 'params' => array ('id' => $id)), true); + } + + Minz_View::prependTitle (Minz_Translate::t ('rss_feed_management') . ' - ' . $this->view->flux->name () . ' - '); + } + } else { + Minz_View::prependTitle (Minz_Translate::t ('rss_feed_management') . ' - '); + } + } + + public function displayAction () { + if (Minz_Request::isPost ()) { + $current_token = $this->view->conf->token (); + + $language = Minz_Request::param ('language', 'en'); + $nb = Minz_Request::param ('posts_per_page', 10); + $mode = Minz_Request::param ('view_mode', 'normal'); + $view = Minz_Request::param ('default_view', 'a'); + $auto_load_more = Minz_Request::param ('auto_load_more', 'no'); + $display = Minz_Request::param ('display_posts', 'no'); + $onread_jump_next = Minz_Request::param ('onread_jump_next', 'no'); + $lazyload = Minz_Request::param ('lazyload', 'no'); + $sort = Minz_Request::param ('sort_order', 'DESC'); + $old = Minz_Request::param ('old_entries', 3); + $mail = Minz_Request::param ('mail_login', false); + $anon = Minz_Request::param ('anon_access', 'no'); + $token = Minz_Request::param ('token', $current_token); + $openArticle = Minz_Request::param ('mark_open_article', 'no'); + $openSite = Minz_Request::param ('mark_open_site', 'no'); + $scroll = Minz_Request::param ('mark_scroll', 'no'); + $reception = Minz_Request::param ('mark_upon_reception', 'no'); + $theme = Minz_Request::param ('theme', 'default'); + $topline_read = Minz_Request::param ('topline_read', 'no'); + $topline_favorite = Minz_Request::param ('topline_favorite', 'no'); + $topline_date = Minz_Request::param ('topline_date', 'no'); + $topline_link = Minz_Request::param ('topline_link', 'no'); + $bottomline_read = Minz_Request::param ('bottomline_read', 'no'); + $bottomline_favorite = Minz_Request::param ('bottomline_favorite', 'no'); + $bottomline_sharing = Minz_Request::param ('bottomline_sharing', 'no'); + $bottomline_tags = Minz_Request::param ('bottomline_tags', 'no'); + $bottomline_date = Minz_Request::param ('bottomline_date', 'no'); + $bottomline_link = Minz_Request::param ('bottomline_link', 'no'); + + $this->view->conf->_language ($language); + $this->view->conf->_postsPerPage (intval ($nb)); + $this->view->conf->_viewMode ($mode); + $this->view->conf->_defaultView ($view); + $this->view->conf->_autoLoadMore ($auto_load_more); + $this->view->conf->_displayPosts ($display); + $this->view->conf->_onread_jump_next ($onread_jump_next); + $this->view->conf->_lazyload ($lazyload); + $this->view->conf->_sortOrder ($sort); + $this->view->conf->_oldEntries ($old); + $this->view->conf->_mailLogin ($mail); + $this->view->conf->_anonAccess ($anon); + $this->view->conf->_token ($token); + $this->view->conf->_markWhen (array ( + 'article' => $openArticle, + 'site' => $openSite, + 'scroll' => $scroll, + 'reception' => $reception, + )); + $this->view->conf->_theme ($theme); + $this->view->conf->_topline_read ($topline_read); + $this->view->conf->_topline_favorite ($topline_favorite); + $this->view->conf->_topline_date ($topline_date); + $this->view->conf->_topline_link ($topline_link); + $this->view->conf->_bottomline_read ($bottomline_read); + $this->view->conf->_bottomline_favorite ($bottomline_favorite); + $this->view->conf->_bottomline_sharing ($bottomline_sharing); + $this->view->conf->_bottomline_tags ($bottomline_tags); + $this->view->conf->_bottomline_date ($bottomline_date); + $this->view->conf->_bottomline_link ($bottomline_link); + + $values = array ( + 'language' => $this->view->conf->language (), + 'posts_per_page' => $this->view->conf->postsPerPage (), + 'view_mode' => $this->view->conf->viewMode (), + 'default_view' => $this->view->conf->defaultView (), + 'auto_load_more' => $this->view->conf->autoLoadMore (), + 'display_posts' => $this->view->conf->displayPosts (), + 'onread_jump_next' => $this->view->conf->onread_jump_next (), + 'lazyload' => $this->view->conf->lazyload (), + 'sort_order' => $this->view->conf->sortOrder (), + 'old_entries' => $this->view->conf->oldEntries (), + 'mail_login' => $this->view->conf->mailLogin (), + 'anon_access' => $this->view->conf->anonAccess (), + 'token' => $this->view->conf->token (), + 'mark_when' => $this->view->conf->markWhen (), + 'theme' => $this->view->conf->theme (), + 'topline_read' => $this->view->conf->toplineRead () ? 'yes' : 'no', + 'topline_favorite' => $this->view->conf->toplineFavorite () ? 'yes' : 'no', + 'topline_date' => $this->view->conf->toplineDate () ? 'yes' : 'no', + 'topline_link' => $this->view->conf->toplineLink () ? 'yes' : 'no', + 'bottomline_read' => $this->view->conf->bottomlineRead () ? 'yes' : 'no', + 'bottomline_favorite' => $this->view->conf->bottomlineFavorite () ? 'yes' : 'no', + 'bottomline_sharing' => $this->view->conf->bottomlineSharing () ? 'yes' : 'no', + 'bottomline_tags' => $this->view->conf->bottomlineTags () ? 'yes' : 'no', + 'bottomline_date' => $this->view->conf->bottomlineDate () ? 'yes' : 'no', + 'bottomline_link' => $this->view->conf->bottomlineLink () ? 'yes' : 'no', + ); + + $confDAO = new FreshRSS_ConfigurationDAO (); + $confDAO->update ($values); + Minz_Session::_param ('conf', $this->view->conf); + Minz_Session::_param ('mail', $this->view->conf->mailLogin ()); + + Minz_Session::_param ('language', $this->view->conf->language ()); + Minz_Translate::reset (); + + // notif + $notif = array ( + 'type' => 'good', + 'content' => Minz_Translate::t ('configuration_updated') + ); + Minz_Session::_param ('notification', $notif); + + Minz_Request::forward (array ('c' => 'configure', 'a' => 'display'), true); + } + + $this->view->themes = FreshRSS_Themes::get(); + + Minz_View::prependTitle (Minz_Translate::t ('general_and_reading_management') . ' - '); + + $entryDAO = new FreshRSS_EntryDAO (); + $this->view->nb_total = $entryDAO->count (); + $this->view->size_total = $entryDAO->size (); + } + + public function sharingAction () { + if (Minz_Request::isPost ()) { + $this->view->conf->_sharing (array ( + 'shaarli' => Minz_Request::param ('shaarli', ''), + 'poche' => Minz_Request::param ('poche', ''), + 'diaspora' => Minz_Request::param ('diaspora', ''), + 'twitter' => Minz_Request::param ('twitter', 'no') === 'yes', + 'g+' => Minz_Request::param ('g+', 'no') === 'yes', + 'facebook' => Minz_Request::param ('facebook', 'no') === 'yes', + 'email' => Minz_Request::param ('email', 'no') === 'yes', + 'print' => Minz_Request::param ('print', 'no') === 'yes' + )); + + $confDAO = new FreshRSS_ConfigurationDAO (); + $confDAO->update ($this->view->conf->sharing ()); + Minz_Session::_param ('conf', $this->view->conf); + + // notif + $notif = array ( + 'type' => 'good', + 'content' => Minz_Translate::t ('configuration_updated') + ); + Minz_Session::_param ('notification', $notif); + + Minz_Request::forward (array ('c' => 'configure', 'a' => 'sharing'), true); + } + + Minz_View::prependTitle (Minz_Translate::t ('sharing_management') . ' - '); + + $entryDAO = new FreshRSS_EntryDAO (); + $this->view->nb_total = $entryDAO->count (); + } + + public function importExportAction () { + $catDAO = new FreshRSS_CategoryDAO (); + $this->view->categories = $catDAO->listCategories (); + + $this->view->req = Minz_Request::param ('q'); + + if ($this->view->req == 'export') { + Minz_View::_title ('freshrss_feeds.opml'); + + $this->view->_useLayout (false); + header('Content-Type: application/xml; charset=utf-8'); + header('Content-disposition: attachment; filename=freshrss_feeds.opml'); + + $feedDAO = new FreshRSS_FeedDAO (); + $catDAO = new FreshRSS_CategoryDAO (); + + $list = array (); + foreach ($catDAO->listCategories () as $key => $cat) { + $list[$key]['name'] = $cat->name (); + $list[$key]['feeds'] = $feedDAO->listByCategory ($cat->id ()); + } + + $this->view->categories = $list; + } elseif ($this->view->req == 'import' && Minz_Request::isPost ()) { + if ($_FILES['file']['error'] == 0) { + // on parse le fichier OPML pour récupérer les catégories et les flux associés + try { + list ($categories, $feeds) = opml_import ( + file_get_contents ($_FILES['file']['tmp_name']) + ); + + // On redirige vers le controller feed qui va se charger d'insérer les flux en BDD + // les flux sont mis au préalable dans des variables de Request + Minz_Request::_param ('q', 'null'); + Minz_Request::_param ('categories', $categories); + Minz_Request::_param ('feeds', $feeds); + Minz_Request::forward (array ('c' => 'feed', 'a' => 'massiveImport')); + } catch (FreshRSS_Opml_Exception $e) { + Minz_Log::record ($e->getMessage (), Minz_Log::WARNING); + + $notif = array ( + 'type' => 'bad', + 'content' => Minz_Translate::t ('bad_opml_file') + ); + Minz_Session::_param ('notification', $notif); + + Minz_Request::forward (array ( + 'c' => 'configure', + 'a' => 'importExport' + ), true); + } + } + } + + $feedDAO = new FreshRSS_FeedDAO (); + $this->view->feeds = $feedDAO->listFeeds (); + + // au niveau de la vue, permet de ne pas voir un flux sélectionné dans la liste + $this->view->flux = false; + + Minz_View::prependTitle (Translate::t ('import_export_opml') . ' - '); + } + + public function shortcutAction () { + $list_keys = array ('a', 'b', 'backspace', 'c', 'd', 'delete', 'down', 'e', 'end', 'enter', + 'escape', 'f', 'g', 'h', 'i', 'insert', 'j', 'k', 'l', 'left', + 'm', 'n', 'o', 'p', 'page_down', 'page_up', 'q', 'r', 'return', 'right', + 's', 'space', 't', 'tab', 'u', 'up', 'v', 'w', 'x', 'y', + 'z', '0', '1', '2', '3', '4', '5', '6', '7', '8', + '9', 'f1', 'f2', 'f3', 'f4', 'f5', 'f6', 'f7', 'f8', 'f9', + 'f10', 'f11', 'f12'); + $this->view->list_keys = $list_keys; + $list_names = array ('mark_read', 'mark_favorite', 'go_website', 'next_entry', + 'prev_entry', 'next_page', 'prev_page', 'collapse_entry', + 'load_more'); + + if (Minz_Request::isPost ()) { + $shortcuts = Minz_Request::param ('shortcuts'); + $shortcuts_ok = array (); + + foreach ($shortcuts as $key => $value) { + if (in_array ($key, $list_names) + && in_array ($value, $list_keys)) { + $shortcuts_ok[$key] = $value; + } + } + + $this->view->conf->_shortcuts ($shortcuts_ok); + + $values = array ( + 'shortcuts' => $this->view->conf->shortcuts () + ); + + $confDAO = new FreshRSS_ConfigurationDAO (); + $confDAO->update ($values); + Minz_Session::_param ('conf', $this->view->conf); + + // notif + $notif = array ( + 'type' => 'good', + 'content' => Minz_Translate::t ('shortcuts_updated') + ); + Minz_Session::_param ('notification', $notif); + + Minz_Request::forward (array ('c' => 'configure', 'a' => 'shortcut'), true); + } + + Minz_View::prependTitle (Minz_Translate::t ('shortcuts_management') . ' - '); + } +} diff --git a/app/Controllers/entryController.php b/app/Controllers/entryController.php new file mode 100755 index 000000000..a332ca8a9 --- /dev/null +++ b/app/Controllers/entryController.php @@ -0,0 +1,112 @@ +view->conf) && !is_logged ()) { + Minz_Error::error ( + 403, + array ('error' => array (Minz_Translate::t ('access_denied'))) + ); + } + + $this->params = array (); + $this->redirect = false; + $ajax = Minz_Request::param ('ajax'); + if ($ajax) { + $this->view->_useLayout (false); + } + } + public function lastAction () { + $ajax = Minz_Request::param ('ajax'); + if (!$ajax && $this->redirect) { + Minz_Request::forward (array ( + 'c' => 'index', + 'a' => 'index', + 'params' => $this->params + ), true); + } else { + Minz_Request::_param ('ajax'); + } + } + + public function readAction () { + $this->redirect = true; + + $id = Minz_Request::param ('id'); + $is_read = Minz_Request::param ('is_read'); + $get = Minz_Request::param ('get'); + $nextGet = Minz_Request::param ('nextGet', $get); + $idMax = Minz_Request::param ('idMax', 0); + + $is_read = !!$is_read; + + $entryDAO = new FreshRSS_EntryDAO (); + if ($id == false) { + if (!$get) { + $entryDAO->markReadEntries ($idMax); + } else { + $typeGet = $get[0]; + $get = substr ($get, 2); + switch ($typeGet) { + case 'c': + $entryDAO->markReadCat ($get, $idMax); + break; + case 'f': + $entryDAO->markReadFeed ($get, $idMax); + break; + case 's': + $entryDAO->markReadEntries ($idMax, true); + break; + case 'a': + $entryDAO->markReadEntries ($idMax); + break; + } + if ($nextGet !== 'a') { + $this->params = array ('get' => $nextGet); + } + } + + $notif = array ( + 'type' => 'good', + 'content' => Minz_Translate::t ('feeds_marked_read') + ); + Minz_Session::_param ('notification', $notif); + } else { + $entryDAO->markRead ($id, $is_read); + } + } + + public function bookmarkAction () { + $this->redirect = true; + + $id = Minz_Request::param ('id'); + if ($id) { + $entryDAO = new FreshRSS_EntryDAO (); + $entryDAO->markFavorite ($id, Minz_Request::param ('is_favorite')); + } + } + + public function optimizeAction() { + @set_time_limit(300); + invalidateHttpCache(); + + // La table des entrées a tendance à grossir énormément + // Cette action permet d'optimiser cette table permettant de grapiller un peu de place + // Cette fonctionnalité n'est à appeler qu'occasionnellement + $entryDAO = new FreshRSS_EntryDAO(); + $entryDAO->optimizeTable(); + + invalidateHttpCache(); + + $notif = array ( + 'type' => 'good', + 'content' => Minz_Translate::t ('optimization_complete') + ); + Minz_Session::_param ('notification', $notif); + + Minz_Request::forward(array( + 'c' => 'configure', + 'a' => 'display' + ), true); + } +} diff --git a/app/Controllers/errorController.php b/app/Controllers/errorController.php new file mode 100644 index 000000000..d1c2f8fec --- /dev/null +++ b/app/Controllers/errorController.php @@ -0,0 +1,26 @@ +view->code = 'Error 403 - Forbidden'; + break; + case 404: + $this->view->code = 'Error 404 - Not found'; + break; + case 500: + $this->view->code = 'Error 500 - Internal Server Error'; + break; + case 503: + $this->view->code = 'Error 503 - Service Unavailable'; + break; + default: + $this->view->code = 'Error 404 - Not found'; + } + + $this->view->logs = Minz_Request::param ('logs'); + + Minz_View::prependTitle ($this->view->code . ' - '); + } +} diff --git a/app/Controllers/feedController.php b/app/Controllers/feedController.php new file mode 100755 index 000000000..a85877724 --- /dev/null +++ b/app/Controllers/feedController.php @@ -0,0 +1,428 @@ +view->conf->token(); + $token_param = Minz_Request::param ('token', ''); + $token_is_ok = ($token != '' && $token == $token_param); + $action = Minz_Request::actionName (); + + if (login_is_conf ($this->view->conf) && + !is_logged () && + !($token_is_ok && $action == 'actualize')) { + Minz_Error::error ( + 403, + array ('error' => array (Minz_Translate::t ('access_denied'))) + ); + } + + $this->catDAO = new FreshRSS_CategoryDAO (); + $this->catDAO->checkDefault (); + } + + private static function entryDateComparer($e1, $e2) { + $d1 = $e1->date(true); + $d2 = $e2->date(true); + if ($d1 === $d2) { + return 0; + } + return ($d1 < $d2) ? -1 : 1; + } + + public function addAction () { + @set_time_limit(300); + + if (Minz_Request::isPost ()) { + $url = Minz_Request::param ('url_rss'); + $cat = Minz_Request::param ('category', false); + if ($cat === false) { + $def_cat = $this->catDAO->getDefault (); + $cat = $def_cat->id (); + } + + $user = Minz_Request::param ('username'); + $pass = Minz_Request::param ('password'); + $params = array (); + + $transactionStarted = false; + try { + $feed = new FreshRSS_Feed ($url); + $feed->_category ($cat); + + $httpAuth = ''; + if ($user != '' || $pass != '') { + $httpAuth = $user . ':' . $pass; + } + $feed->_httpAuth ($httpAuth); + + $feed->load (); + + $feedDAO = new FreshRSS_FeedDAO (); + $values = array ( + 'url' => $feed->url (), + 'category' => $feed->category (), + 'name' => $feed->name (), + 'website' => $feed->website (), + 'description' => $feed->description (), + 'lastUpdate' => time (), + 'httpAuth' => $feed->httpAuth (), + ); + + if ($feedDAO->searchByUrl ($values['url'])) { + // on est déjà abonné à ce flux + $notif = array ( + 'type' => 'bad', + 'content' => Minz_Translate::t ('already_subscribed', $feed->name ()) + ); + Minz_Session::_param ('notification', $notif); + } else { + $id = $feedDAO->addFeed ($values); + if (!$id) { + // problème au niveau de la base de données + $notif = array ( + 'type' => 'bad', + 'content' => Minz_Translate::t ('feed_not_added', $feed->name ()) + ); + Minz_Session::_param ('notification', $notif); + } else { + $feed->_id ($id); + $feed->faviconPrepare(); + + $is_read = $this->view->conf->markUponReception() === 'yes' ? 1 : 0; + + $entryDAO = new FreshRSS_EntryDAO (); + $entries = $feed->entries (); + usort($entries, 'self::entryDateComparer'); + + // on calcule la date des articles les plus anciens qu'on accepte + $nb_month_old = $this->view->conf->oldEntries (); + $date_min = time () - (3600 * 24 * 30 * $nb_month_old); + + $transactionStarted = true; + $feedDAO->beginTransaction (); + // on ajoute les articles en masse sans vérification + foreach ($entries as $entry) { + if ($entry->date (true) >= $date_min || + $feed->keepHistory ()) { + $values = $entry->toArray (); + $values['id_feed'] = $feed->id (); + $values['id'] = min(time(), $entry->date (true)) . uSecString(); + $values['is_read'] = $is_read; + $entryDAO->addEntry ($values); + } + } + $feedDAO->updateLastUpdate ($feed->id ()); + $feedDAO->commit (); + $transactionStarted = false; + + // ok, ajout terminé + $notif = array ( + 'type' => 'good', + 'content' => Minz_Translate::t ('feed_added', $feed->name ()) + ); + Minz_Session::_param ('notification', $notif); + + // permet de rediriger vers la page de conf du flux + $params['id'] = $feed->id (); + } + } + } catch (FreshRSS_BadUrl_Exception $e) { + Minz_Log::record ($e->getMessage (), Minz_Log::WARNING); + $notif = array ( + 'type' => 'bad', + 'content' => Minz_Translate::t ('invalid_url', $url) + ); + Minz_Session::_param ('notification', $notif); + } catch (FreshRSS_Feed_Exception $e) { + Minz_Log::record ($e->getMessage (), Minz_Log::WARNING); + $notif = array ( + 'type' => 'bad', + 'content' => Minz_Translate::t ('internal_problem_feed') + ); + Minz_Session::_param ('notification', $notif); + } catch (Minz_FileNotExistException $e) { + // Répertoire de cache n'existe pas + Minz_Log::record ($e->getMessage (), Minz_Log::ERROR); + $notif = array ( + 'type' => 'bad', + 'content' => Minz_Translate::t ('internal_problem_feed') + ); + Minz_Session::_param ('notification', $notif); + } + if ($transactionStarted) { + $feedDAO->rollBack (); + } + + Minz_Request::forward (array ('c' => 'configure', 'a' => 'feed', 'params' => $params), true); + } + } + + public function truncateAction () { + if (Minz_Request::isPost ()) { + $id = Minz_Request::param ('id'); + $feedDAO = new FreshRSS_FeedDAO (); + $n = $feedDAO->truncate($id); + $notif = array( + 'type' => $n === false ? 'bad' : 'good', + 'content' => Minz_Translate::t ('n_entries_deleted', $n) + ); + Minz_Session::_param ('notification', $notif); + invalidateHttpCache(); + Minz_Request::forward (array ('c' => 'configure', 'a' => 'feed', 'params' => array('id' => $id)), true); + } + } + + public function actualizeAction () { + @set_time_limit(300); + + $feedDAO = new FreshRSS_FeedDAO (); + $entryDAO = new FreshRSS_EntryDAO (); + + $id = Minz_Request::param ('id'); + $force = Minz_Request::param ('force', false); + + // on créé la liste des flux à mettre à actualiser + // si on veut mettre un flux à jour spécifiquement, on le met + // dans la liste, mais seul (permet d'automatiser le traitement) + $feeds = array (); + if ($id) { + $feed = $feedDAO->searchById ($id); + if ($feed) { + $feeds = array ($feed); + } + } else { + $feeds = $feedDAO->listFeedsOrderUpdate (); + } + + // on calcule la date des articles les plus anciens qu'on accepte + $nb_month_old = $this->view->conf->oldEntries (); + $date_min = time () - (3600 * 24 * 30 * $nb_month_old); + + $i = 0; + $flux_update = 0; + foreach ($feeds as $feed) { + try { + $feed->load (); + $feed->faviconPrepare(); + $entries = $feed->entries (); + usort($entries, 'self::entryDateComparer'); + + $is_read = $this->view->conf->markUponReception() === 'yes' ? 1 : 0; + + //For this feed, check last n entry GUIDs already in database + $existingGuids = array_fill_keys ($entryDAO->listLastGuidsByFeed ($feed->id (), count($entries) + 10), 1); + + // On ne vérifie pas strictement que l'article n'est pas déjà en BDD + // La BDD refusera l'ajout car (id_feed, guid) doit être unique + $feedDAO->beginTransaction (); + foreach ($entries as $entry) { + if ((!isset ($existingGuids[$entry->guid ()])) && + ($entry->date (true) >= $date_min || + $feed->keepHistory ())) { + $values = $entry->toArray (); + //Use declared date at first import, otherwise use discovery date + $values['id'] = empty($existingGuids) ? min(time(), $entry->date (true)) . uSecString() : uTimeString(); + $values['is_read'] = $is_read; + $entryDAO->addEntry ($values); + } + } + + if ((!$feed->keepHistory()) && (rand(0, 30) === 1)) { + $nb = $feedDAO->cleanOldEntries ($feed->id (), $date_min, count($entries) + 10); + Minz_Log::record ($nb . ' old entries cleaned in feed ' . $feed->id (), Minz_Log::DEBUG); + } + + // on indique que le flux vient d'être mis à jour en BDD + $feedDAO->updateLastUpdate ($feed->id ()); + $feedDAO->commit (); + $flux_update++; + } catch (FreshRSS_Feed_Exception $e) { + Minz_Log::record ($e->getMessage (), Minz_Log::NOTICE); + $feedDAO->updateLastUpdate ($feed->id (), 1); + } + + // On arrête à 10 flux pour ne pas surcharger le serveur + // sauf si le paramètre $force est à vrai + $i++; + if ($i >= 10 && !$force) { + break; + } + } + + $url = array (); + if ($flux_update === 1) { + // on a mis un seul flux à jour + $notif = array ( + 'type' => 'good', + 'content' => Minz_Translate::t ('feed_actualized', $feed->name ()) + ); + } elseif ($flux_update > 1) { + // plusieurs flux on été mis à jour + $notif = array ( + 'type' => 'good', + 'content' => Minz_Translate::t ('n_feeds_actualized', $flux_update) + ); + } else { + // aucun flux n'a été mis à jour, oups + $notif = array ( + 'type' => 'bad', + 'content' => Minz_Translate::t ('no_feed_actualized') + ); + } + + if ($i === 1) { + // Si on a voulu mettre à jour qu'un flux + // on filtre l'affichage par ce flux + $feed = reset ($feeds); + $url['params'] = array ('get' => 'f_' . $feed->id ()); + } + + if (Minz_Request::param ('ajax', 0) === 0) { + Minz_Session::_param ('notification', $notif); + Minz_Request::forward ($url, true); + } else { + // Une requête Ajax met un seul flux à jour. + // Comme en principe plusieurs requêtes ont lieu, + // on indique que "plusieurs flux ont été mis à jour". + // Cela permet d'avoir une notification plus proche du + // ressenti utilisateur + $notif = array ( + 'type' => 'good', + 'content' => Minz_Translate::t ('feeds_actualized') + ); + Minz_Session::_param ('notification', $notif); + // et on désactive le layout car ne sert à rien + $this->view->_useLayout (false); + } + } + + public function massiveImportAction () { + @set_time_limit(300); + + $entryDAO = new FreshRSS_EntryDAO (); + $feedDAO = new FreshRSS_FeedDAO (); + + $categories = Minz_Request::param ('categories', array (), true); + $feeds = Minz_Request::param ('feeds', array (), true); + + // on ajoute les catégories en masse dans une fonction à part + $this->addCategories ($categories); + + // on calcule la date des articles les plus anciens qu'on accepte + $nb_month_old = $this->view->conf->oldEntries (); + $date_min = time () - (3600 * 24 * 30 * $nb_month_old); + + // la variable $error permet de savoir si une erreur est survenue + // Le but est de ne pas arrêter l'import même en cas d'erreur + // L'utilisateur sera mis au courant s'il y a eu des erreurs, mais + // ne connaîtra pas les détails. Ceux-ci seront toutefois logguées + $error = false; + $i = 0; + foreach ($feeds as $feed) { + try { + $values = array ( + 'id' => $feed->id (), + 'url' => $feed->url (), + 'category' => $feed->category (), + 'name' => $feed->name (), + 'website' => $feed->website (), + 'description' => $feed->description (), + 'lastUpdate' => 0, + 'httpAuth' => $feed->httpAuth () + ); + + // ajout du flux que s'il n'est pas déjà en BDD + if (!$feedDAO->searchByUrl ($values['url'])) { + $id = $feedDAO->addFeed ($values); + if ($id) { + $feed->_id ($id); + $feed->faviconPrepare(); + } else { + $error = true; + } + } + } catch (FreshRSS_Feed_Exception $e) { + $error = true; + Minz_Log::record ($e->getMessage (), Minz_Log::WARNING); + } + } + + if ($error) { + $res = Minz_Translate::t ('feeds_imported_with_errors'); + } else { + $res = Minz_Translate::t ('feeds_imported'); + } + + $notif = array ( + 'type' => 'good', + 'content' => $res + ); + Minz_Session::_param ('notification', $notif); + Minz_Session::_param ('actualize_feeds', true); + + // et on redirige vers la page d'accueil + Minz_Request::forward (array ( + 'c' => 'index', + 'a' => 'index' + ), true); + } + + public function deleteAction () { + if (Minz_Request::isPost ()) { + $type = Minz_Request::param ('type', 'feed'); + $id = Minz_Request::param ('id'); + + $feedDAO = new FreshRSS_FeedDAO (); + if ($type == 'category') { + if ($feedDAO->deleteFeedByCategory ($id)) { + $notif = array ( + 'type' => 'good', + 'content' => Minz_Translate::t ('category_emptied') + ); + //TODO: Delete old favicons + } else { + $notif = array ( + 'type' => 'bad', + 'content' => Minz_Translate::t ('error_occured') + ); + } + } else { + if ($feedDAO->deleteFeed ($id)) { + $notif = array ( + 'type' => 'good', + 'content' => Minz_Translate::t ('feed_deleted') + ); + Feed::faviconDelete($id); + } else { + $notif = array ( + 'type' => 'bad', + 'content' => Minz_Translate::t ('error_occured') + ); + } + } + + Minz_Session::_param ('notification', $notif); + + if ($type == 'category') { + Minz_Request::forward (array ('c' => 'configure', 'a' => 'categorize'), true); + } else { + Minz_Request::forward (array ('c' => 'configure', 'a' => 'feed'), true); + } + } + } + + private function addCategories ($categories) { + $catDAO = new FreshRSS_CategoryDAO (); + + foreach ($categories as $cat) { + if (!$catDAO->searchByName ($cat->name ())) { + $values = array ( + 'id' => $cat->id (), + 'name' => $cat->name (), + 'color' => $cat->color () + ); + $catDAO->addCategory ($values); + } + } + } +} diff --git a/app/Controllers/indexController.php b/app/Controllers/indexController.php new file mode 100755 index 000000000..92070590a --- /dev/null +++ b/app/Controllers/indexController.php @@ -0,0 +1,277 @@ +entryDAO = new FreshRSS_EntryDAO (); + $this->feedDAO = new FreshRSS_FeedDAO (); + $this->catDAO = new FreshRSS_CategoryDAO (); + } + + public function indexAction () { + $output = Minz_Request::param ('output'); + + $token = $this->view->conf->token(); + $token_param = Minz_Request::param ('token', ''); + $token_is_ok = ($token != '' && $token === $token_param); + + // check if user is log in + if(login_is_conf ($this->view->conf) && + !is_logged() && + $this->view->conf->anonAccess() === 'no' && + !($output === 'rss' && $token_is_ok)) { + return; + } + + // construction of RSS url of this feed + $params = Minz_Request::params (); + $params['output'] = 'rss'; + if (isset ($params['search'])) { + $params['search'] = urlencode ($params['search']); + } + if (login_is_conf($this->view->conf) && + $this->view->conf->anonAccess() === 'no' && + $token != '') { + $params['token'] = $token; + } + $this->view->rss_url = array ( + 'c' => 'index', + 'a' => 'index', + 'params' => $params + ); + + if ($output === 'rss') { + // no layout for RSS output + $this->view->_useLayout (false); + header('Content-Type: application/rss+xml; charset=utf-8'); + } else { + Minz_View::appendScript (Minz_Url::display ('/scripts/shortcut.js?' . @filemtime(PUBLIC_PATH . '/scripts/shortcut.js'))); + + if ($output === 'global') { + Minz_View::appendScript (Minz_Url::display ('/scripts/global_view.js?' . @filemtime(PUBLIC_PATH . '/scripts/global_view.js'))); + } + } + + $this->view->cat_aside = $this->catDAO->listCategories (); + $this->view->nb_favorites = $this->entryDAO->countUnreadReadFavorites (); + $this->view->currentName = ''; + + $this->view->get_c = ''; + $this->view->get_f = ''; + + $get = Minz_Request::param ('get', 'a'); + $getType = $get[0]; + $getId = substr ($get, 2); + if (!$this->checkAndProcessType ($getType, $getId)) { + Minz_Log::record ('Not found [' . $getType . '][' . $getId . ']', Minz_Log::DEBUG); + Minz_Error::error ( + 404, + array ('error' => array (Minz_Translate::t ('page_not_found'))) + ); + return; + } + + $this->view->nb_not_read = HelperCategory::CountUnreads($this->view->cat_aside, 1); + + // mise à jour des titres + $this->view->rss_title = $this->view->currentName . ' | ' . Minz_View::title(); + if ($this->view->nb_not_read > 0) { + Minz_View::appendTitle (' (' . $this->view->nb_not_read . ')'); + } + Minz_View::prependTitle ( + $this->view->currentName . + ($this->nb_not_read_cat > 0 ? ' (' . $this->nb_not_read_cat . ')' : '') . + ' - ' + ); + + // On récupère les différents éléments de filtrage + $this->view->state = $state = Minz_Request::param ('state', $this->view->conf->defaultView ()); + $filter = Minz_Request::param ('search', ''); + if (!empty($filter)) { + $state = 'all'; //Search always in read and unread articles + } + $this->view->order = $order = Minz_Request::param ('order', $this->view->conf->sortOrder ()); + $nb = Minz_Request::param ('nb', $this->view->conf->postsPerPage ()); + $first = Minz_Request::param ('next', ''); + + if ($state === 'not_read') { //Any unread article in this category at all? + switch ($getType) { + case 'a': + $hasUnread = $this->view->nb_not_read > 0; + break; + case 's': + $hasUnread = $this->view->nb_favorites['unread'] > 0; + break; + case 'c': + $hasUnread = (!isset($this->view->cat_aside[$getId])) || ($this->view->cat_aside[$getId]->nbNotRead() > 0); + break; + case 'f': + $myFeed = HelperCategory::findFeed($this->view->cat_aside, $getId); + $hasUnread = ($myFeed === null) || ($myFeed->nbNotRead() > 0); + break; + default: + $hasUnread = true; + break; + } + if (!$hasUnread) { + $this->view->state = $state = 'all'; + } + } + + // on calcule la date des articles les plus anciens qu'on affiche + $nb_month_old = $this->view->conf->oldEntries (); + $date_min = time () - (3600 * 24 * 30 * $nb_month_old); + + try { + $entries = $this->entryDAO->listWhere($getType, $getId, $state, $order, $nb + 1, $first, $filter, $date_min); + + // Si on a récupéré aucun article "non lus" + // on essaye de récupérer tous les articles + if ($state === 'not_read' && empty($entries)) { //TODO: Remove in v0.8 + Minz_Log::record ('Conflicting information about nbNotRead!', Minz_Log::DEBUG); + $this->view->state = 'all'; + $entries = $this->entryDAO->listWhere($getType, $getId, 'all', $order, $nb, $first, $filter, $date_min); + } + + if (count($entries) <= $nb) { + $this->view->nextId = ''; + } else { //We have more elements for pagination + $lastEntry = array_pop($entries); + $this->view->nextId = $lastEntry->id(); + } + + $this->view->entries = $entries; + } catch (FreshRSS_EntriesGetter_Exception $e) { + Minz_Log::record ($e->getMessage (), Minz_Log::NOTICE); + Minz_Error::error ( + 404, + array ('error' => array (Minz_Translate::t ('page_not_found'))) + ); + } + } + + /* + * Vérifie que la catégorie / flux sélectionné existe + * + Initialise correctement les variables de vue get_c et get_f + * + Met à jour la variable $this->nb_not_read_cat + */ + private function checkAndProcessType ($getType, $getId) { + switch ($getType) { + case 'a': + $this->view->currentName = Minz_Translate::t ('your_rss_feeds'); + $this->view->get_c = $getType; + return true; + case 's': + $this->view->currentName = Minz_Translate::t ('your_favorites'); + $this->view->get_c = $getType; + return true; + case 'c': + $cat = isset($this->view->cat_aside[$getId]) ? $this->view->cat_aside[$getId] : null; + if ($cat === null) { + $cat = $this->catDAO->searchById ($getId); + } + if ($cat) { + $this->view->currentName = $cat->name (); + $this->nb_not_read_cat = $cat->nbNotRead (); + $this->view->get_c = $getId; + return true; + } else { + return false; + } + case 'f': + $feed = HelperCategory::findFeed($this->view->cat_aside, $getId); + if (empty($feed)) { + $feed = $this->feedDAO->searchById ($getId); + } + if ($feed) { + $this->view->currentName = $feed->name (); + $this->nb_not_read_cat = $feed->nbNotRead (); + $this->view->get_f = $getId; + $this->view->get_c = $feed->category (); + return true; + } else { + return false; + } + default: + return false; + } + } + + public function aboutAction () { + Minz_View::prependTitle (Minz_Translate::t ('about') . ' - '); + } + + public function logsAction () { + if (login_is_conf ($this->view->conf) && !is_logged ()) { + Minz_Error::error ( + 403, + array ('error' => array (Minz_Translate::t ('access_denied'))) + ); + } + + Minz_View::prependTitle (Minz_Translate::t ('logs') . ' - '); + + if (Minz_Request::isPost ()) { + file_put_contents(LOG_PATH . '/application.log', ''); + } + + $logs = array(); + try { + $logDAO = new FreshRSS_LogDAO (); + $logs = $logDAO->lister (); + $logs = array_reverse ($logs); + } catch (Minz_FileNotExistException $e) { + + } + + //gestion pagination + $page = Minz_Request::param ('page', 1); + $this->view->logsPaginator = new Minz_Paginator ($logs); + $this->view->logsPaginator->_nbItemsPerPage (50); + $this->view->logsPaginator->_currentPage ($page); + } + + public function loginAction () { + $this->view->_useLayout (false); + + $url = 'https://verifier.login.persona.org/verify'; + $assert = Minz_Request::param ('assertion'); + $params = 'assertion=' . $assert . '&audience=' . + urlencode (Minz_Url::display (null, 'php', true)); + $ch = curl_init (); + $options = array ( + CURLOPT_URL => $url, + CURLOPT_RETURNTRANSFER => TRUE, + CURLOPT_POST => 2, + CURLOPT_POSTFIELDS => $params + ); + curl_setopt_array ($ch, $options); + $result = curl_exec ($ch); + curl_close ($ch); + + $res = json_decode ($result, true); + if ($res['status'] === 'okay' && $res['email'] === $this->view->conf->mailLogin ()) { + Minz_Session::_param ('mail', $res['email']); + invalidateHttpCache(); + } else { + $res = array (); + $res['status'] = 'failure'; + $res['reason'] = Minz_Translate::t ('invalid_login'); + } + + header('Content-Type: application/json; charset=UTF-8'); + $this->view->res = json_encode ($res); + } + + public function logoutAction () { + $this->view->_useLayout (false); + Minz_Session::_param ('mail'); + invalidateHttpCache(); + } +} diff --git a/app/Controllers/javascriptController.php b/app/Controllers/javascriptController.php new file mode 100755 index 000000000..e7e25f656 --- /dev/null +++ b/app/Controllers/javascriptController.php @@ -0,0 +1,13 @@ +view->_useLayout (false); + header('Content-type: text/javascript'); + } + + public function actualizeAction () { + $feedDAO = new FreshRSS_FeedDAO (); + $this->view->feeds = $feedDAO->listFeeds (); + } +} diff --git a/app/controllers/configureController.php b/app/controllers/configureController.php deleted file mode 100755 index 62fead315..000000000 --- a/app/controllers/configureController.php +++ /dev/null @@ -1,415 +0,0 @@ -view->conf) && !is_logged ()) { - Minz_Error::error ( - 403, - array ('error' => array (Minz_Translate::t ('access_denied'))) - ); - } - - $catDAO = new FreshRSS_CategoryDAO (); - $catDAO->checkDefault (); - } - - public function categorizeAction () { - $feedDAO = new FreshRSS_FeedDAO (); - $catDAO = new FreshRSS_CategoryDAO (); - $catDAO->checkDefault (); - $defaultCategory = $catDAO->getDefault (); - $defaultId = $defaultCategory->id (); - - if (Minz_Request::isPost ()) { - $cats = Minz_Request::param ('categories', array ()); - $ids = Minz_Request::param ('ids', array ()); - $newCat = trim (Minz_Request::param ('new_category', '')); - - foreach ($cats as $key => $name) { - if (strlen ($name) > 0) { - $cat = new FreshRSS_Category ($name); - $values = array ( - 'name' => $cat->name (), - 'color' => $cat->color () - ); - $catDAO->updateCategory ($ids[$key], $values); - } elseif ($ids[$key] != $defaultId) { - $feedDAO->changeCategory ($ids[$key], $defaultId); - $catDAO->deleteCategory ($ids[$key]); - } - } - - if ($newCat != '') { - $cat = new FreshRSS_Category ($newCat); - $values = array ( - 'id' => $cat->id (), - 'name' => $cat->name (), - 'color' => $cat->color () - ); - - if ($catDAO->searchByName ($newCat) == false) { - $catDAO->addCategory ($values); - } - } - - // notif - $notif = array ( - 'type' => 'good', - 'content' => Minz_Translate::t ('categories_updated') - ); - Minz_Session::_param ('notification', $notif); - - Minz_Request::forward (array ('c' => 'configure', 'a' => 'categorize'), true); - } - - $this->view->categories = $catDAO->listCategories (false); - $this->view->defaultCategory = $catDAO->getDefault (); - $this->view->feeds = $feedDAO->listFeeds (); - $this->view->flux = false; - - Minz_View::prependTitle (Minz_Translate::t ('categories_management') . ' - '); - } - - public function feedAction () { - $catDAO = new FreshRSS_CategoryDAO (); - $this->view->categories = $catDAO->listCategories (false); - - $feedDAO = new FreshRSS_FeedDAO (); - $this->view->feeds = $feedDAO->listFeeds (); - - $id = Minz_Request::param ('id'); - if ($id == false && !empty ($this->view->feeds)) { - $id = current ($this->view->feeds)->id (); - } - - $this->view->flux = false; - if ($id != false) { - $this->view->flux = $this->view->feeds[$id]; - - if (!$this->view->flux) { - Minz_Error::error ( - 404, - array ('error' => array (Minz_Translate::t ('page_not_found'))) - ); - } else { - if (Minz_Request::isPost () && $this->view->flux) { - $name = Minz_Request::param ('name', ''); - $description = Minz_Request::param('description', ''); - $website = Minz_Request::param('website', ''); - $url = Minz_Request::param('url', ''); - $hist = Minz_Request::param ('keep_history', 'no'); - $cat = Minz_Request::param ('category', 0); - $path = Minz_Request::param ('path_entries', ''); - $priority = Minz_Request::param ('priority', 0); - $user = Minz_Request::param ('http_user', ''); - $pass = Minz_Request::param ('http_pass', ''); - - $keep_history = false; - if ($hist == 'yes') { - $keep_history = true; - } - - $httpAuth = ''; - if ($user != '' || $pass != '') { - $httpAuth = $user . ':' . $pass; - } - - $values = array ( - 'name' => $name, - 'description' => $description, - 'website' => $website, - 'url' => $url, - 'category' => $cat, - 'pathEntries' => $path, - 'priority' => $priority, - 'httpAuth' => $httpAuth, - 'keep_history' => $keep_history - ); - - if ($feedDAO->updateFeed ($id, $values)) { - $this->view->flux->_category ($cat); - - $notif = array ( - 'type' => 'good', - 'content' => Minz_Translate::t ('feed_updated') - ); - } else { - $notif = array ( - 'type' => 'bad', - 'content' => Minz_Translate::t ('error_occurred_update') - ); - } - - Minz_Session::_param ('notification', $notif); - Minz_Request::forward (array ('c' => 'configure', 'a' => 'feed', 'params' => array ('id' => $id)), true); - } - - Minz_View::prependTitle (Minz_Translate::t ('rss_feed_management') . ' - ' . $this->view->flux->name () . ' - '); - } - } else { - Minz_View::prependTitle (Minz_Translate::t ('rss_feed_management') . ' - '); - } - } - - public function displayAction () { - if (Minz_Request::isPost ()) { - $current_token = $this->view->conf->token (); - - $language = Minz_Request::param ('language', 'en'); - $nb = Minz_Request::param ('posts_per_page', 10); - $mode = Minz_Request::param ('view_mode', 'normal'); - $view = Minz_Request::param ('default_view', 'a'); - $auto_load_more = Minz_Request::param ('auto_load_more', 'no'); - $display = Minz_Request::param ('display_posts', 'no'); - $onread_jump_next = Minz_Request::param ('onread_jump_next', 'no'); - $lazyload = Minz_Request::param ('lazyload', 'no'); - $sort = Minz_Request::param ('sort_order', 'DESC'); - $old = Minz_Request::param ('old_entries', 3); - $mail = Minz_Request::param ('mail_login', false); - $anon = Minz_Request::param ('anon_access', 'no'); - $token = Minz_Request::param ('token', $current_token); - $openArticle = Minz_Request::param ('mark_open_article', 'no'); - $openSite = Minz_Request::param ('mark_open_site', 'no'); - $scroll = Minz_Request::param ('mark_scroll', 'no'); - $reception = Minz_Request::param ('mark_upon_reception', 'no'); - $theme = Minz_Request::param ('theme', 'default'); - $topline_read = Minz_Request::param ('topline_read', 'no'); - $topline_favorite = Minz_Request::param ('topline_favorite', 'no'); - $topline_date = Minz_Request::param ('topline_date', 'no'); - $topline_link = Minz_Request::param ('topline_link', 'no'); - $bottomline_read = Minz_Request::param ('bottomline_read', 'no'); - $bottomline_favorite = Minz_Request::param ('bottomline_favorite', 'no'); - $bottomline_sharing = Minz_Request::param ('bottomline_sharing', 'no'); - $bottomline_tags = Minz_Request::param ('bottomline_tags', 'no'); - $bottomline_date = Minz_Request::param ('bottomline_date', 'no'); - $bottomline_link = Minz_Request::param ('bottomline_link', 'no'); - - $this->view->conf->_language ($language); - $this->view->conf->_postsPerPage (intval ($nb)); - $this->view->conf->_viewMode ($mode); - $this->view->conf->_defaultView ($view); - $this->view->conf->_autoLoadMore ($auto_load_more); - $this->view->conf->_displayPosts ($display); - $this->view->conf->_onread_jump_next ($onread_jump_next); - $this->view->conf->_lazyload ($lazyload); - $this->view->conf->_sortOrder ($sort); - $this->view->conf->_oldEntries ($old); - $this->view->conf->_mailLogin ($mail); - $this->view->conf->_anonAccess ($anon); - $this->view->conf->_token ($token); - $this->view->conf->_markWhen (array ( - 'article' => $openArticle, - 'site' => $openSite, - 'scroll' => $scroll, - 'reception' => $reception, - )); - $this->view->conf->_theme ($theme); - $this->view->conf->_topline_read ($topline_read); - $this->view->conf->_topline_favorite ($topline_favorite); - $this->view->conf->_topline_date ($topline_date); - $this->view->conf->_topline_link ($topline_link); - $this->view->conf->_bottomline_read ($bottomline_read); - $this->view->conf->_bottomline_favorite ($bottomline_favorite); - $this->view->conf->_bottomline_sharing ($bottomline_sharing); - $this->view->conf->_bottomline_tags ($bottomline_tags); - $this->view->conf->_bottomline_date ($bottomline_date); - $this->view->conf->_bottomline_link ($bottomline_link); - - $values = array ( - 'language' => $this->view->conf->language (), - 'posts_per_page' => $this->view->conf->postsPerPage (), - 'view_mode' => $this->view->conf->viewMode (), - 'default_view' => $this->view->conf->defaultView (), - 'auto_load_more' => $this->view->conf->autoLoadMore (), - 'display_posts' => $this->view->conf->displayPosts (), - 'onread_jump_next' => $this->view->conf->onread_jump_next (), - 'lazyload' => $this->view->conf->lazyload (), - 'sort_order' => $this->view->conf->sortOrder (), - 'old_entries' => $this->view->conf->oldEntries (), - 'mail_login' => $this->view->conf->mailLogin (), - 'anon_access' => $this->view->conf->anonAccess (), - 'token' => $this->view->conf->token (), - 'mark_when' => $this->view->conf->markWhen (), - 'theme' => $this->view->conf->theme (), - 'topline_read' => $this->view->conf->toplineRead () ? 'yes' : 'no', - 'topline_favorite' => $this->view->conf->toplineFavorite () ? 'yes' : 'no', - 'topline_date' => $this->view->conf->toplineDate () ? 'yes' : 'no', - 'topline_link' => $this->view->conf->toplineLink () ? 'yes' : 'no', - 'bottomline_read' => $this->view->conf->bottomlineRead () ? 'yes' : 'no', - 'bottomline_favorite' => $this->view->conf->bottomlineFavorite () ? 'yes' : 'no', - 'bottomline_sharing' => $this->view->conf->bottomlineSharing () ? 'yes' : 'no', - 'bottomline_tags' => $this->view->conf->bottomlineTags () ? 'yes' : 'no', - 'bottomline_date' => $this->view->conf->bottomlineDate () ? 'yes' : 'no', - 'bottomline_link' => $this->view->conf->bottomlineLink () ? 'yes' : 'no', - ); - - $confDAO = new FreshRSS_ConfigurationDAO (); - $confDAO->update ($values); - Minz_Session::_param ('conf', $this->view->conf); - Minz_Session::_param ('mail', $this->view->conf->mailLogin ()); - - Minz_Session::_param ('language', $this->view->conf->language ()); - Minz_Translate::reset (); - - // notif - $notif = array ( - 'type' => 'good', - 'content' => Minz_Translate::t ('configuration_updated') - ); - Minz_Session::_param ('notification', $notif); - - Minz_Request::forward (array ('c' => 'configure', 'a' => 'display'), true); - } - - $this->view->themes = FreshRSS_Themes::get(); - - Minz_View::prependTitle (Minz_Translate::t ('general_and_reading_management') . ' - '); - - $entryDAO = new FreshRSS_EntryDAO (); - $this->view->nb_total = $entryDAO->count (); - $this->view->size_total = $entryDAO->size (); - } - - public function sharingAction () { - if (Minz_Request::isPost ()) { - $this->view->conf->_sharing (array ( - 'shaarli' => Minz_Request::param ('shaarli', ''), - 'poche' => Minz_Request::param ('poche', ''), - 'diaspora' => Minz_Request::param ('diaspora', ''), - 'twitter' => Minz_Request::param ('twitter', 'no') === 'yes', - 'g+' => Minz_Request::param ('g+', 'no') === 'yes', - 'facebook' => Minz_Request::param ('facebook', 'no') === 'yes', - 'email' => Minz_Request::param ('email', 'no') === 'yes', - 'print' => Minz_Request::param ('print', 'no') === 'yes' - )); - - $confDAO = new FreshRSS_ConfigurationDAO (); - $confDAO->update ($this->view->conf->sharing ()); - Minz_Session::_param ('conf', $this->view->conf); - - // notif - $notif = array ( - 'type' => 'good', - 'content' => Minz_Translate::t ('configuration_updated') - ); - Minz_Session::_param ('notification', $notif); - - Minz_Request::forward (array ('c' => 'configure', 'a' => 'sharing'), true); - } - - Minz_View::prependTitle (Minz_Translate::t ('sharing_management') . ' - '); - - $entryDAO = new FreshRSS_EntryDAO (); - $this->view->nb_total = $entryDAO->count (); - } - - public function importExportAction () { - $catDAO = new FreshRSS_CategoryDAO (); - $this->view->categories = $catDAO->listCategories (); - - $this->view->req = Minz_Request::param ('q'); - - if ($this->view->req == 'export') { - Minz_View::_title ('freshrss_feeds.opml'); - - $this->view->_useLayout (false); - header('Content-Type: application/xml; charset=utf-8'); - header('Content-disposition: attachment; filename=freshrss_feeds.opml'); - - $feedDAO = new FreshRSS_FeedDAO (); - $catDAO = new FreshRSS_CategoryDAO (); - - $list = array (); - foreach ($catDAO->listCategories () as $key => $cat) { - $list[$key]['name'] = $cat->name (); - $list[$key]['feeds'] = $feedDAO->listByCategory ($cat->id ()); - } - - $this->view->categories = $list; - } elseif ($this->view->req == 'import' && Minz_Request::isPost ()) { - if ($_FILES['file']['error'] == 0) { - // on parse le fichier OPML pour récupérer les catégories et les flux associés - try { - list ($categories, $feeds) = opml_import ( - file_get_contents ($_FILES['file']['tmp_name']) - ); - - // On redirige vers le controller feed qui va se charger d'insérer les flux en BDD - // les flux sont mis au préalable dans des variables de Request - Minz_Request::_param ('q', 'null'); - Minz_Request::_param ('categories', $categories); - Minz_Request::_param ('feeds', $feeds); - Minz_Request::forward (array ('c' => 'feed', 'a' => 'massiveImport')); - } catch (FreshRSS_Opml_Exception $e) { - Minz_Log::record ($e->getMessage (), Minz_Log::WARNING); - - $notif = array ( - 'type' => 'bad', - 'content' => Minz_Translate::t ('bad_opml_file') - ); - Minz_Session::_param ('notification', $notif); - - Minz_Request::forward (array ( - 'c' => 'configure', - 'a' => 'importExport' - ), true); - } - } - } - - $feedDAO = new FreshRSS_FeedDAO (); - $this->view->feeds = $feedDAO->listFeeds (); - - // au niveau de la vue, permet de ne pas voir un flux sélectionné dans la liste - $this->view->flux = false; - - Minz_View::prependTitle (Translate::t ('import_export_opml') . ' - '); - } - - public function shortcutAction () { - $list_keys = array ('a', 'b', 'backspace', 'c', 'd', 'delete', 'down', 'e', 'end', 'enter', - 'escape', 'f', 'g', 'h', 'i', 'insert', 'j', 'k', 'l', 'left', - 'm', 'n', 'o', 'p', 'page_down', 'page_up', 'q', 'r', 'return', 'right', - 's', 'space', 't', 'tab', 'u', 'up', 'v', 'w', 'x', 'y', - 'z', '0', '1', '2', '3', '4', '5', '6', '7', '8', - '9', 'f1', 'f2', 'f3', 'f4', 'f5', 'f6', 'f7', 'f8', 'f9', - 'f10', 'f11', 'f12'); - $this->view->list_keys = $list_keys; - $list_names = array ('mark_read', 'mark_favorite', 'go_website', 'next_entry', - 'prev_entry', 'next_page', 'prev_page', 'collapse_entry', - 'load_more'); - - if (Minz_Request::isPost ()) { - $shortcuts = Minz_Request::param ('shortcuts'); - $shortcuts_ok = array (); - - foreach ($shortcuts as $key => $value) { - if (in_array ($key, $list_names) - && in_array ($value, $list_keys)) { - $shortcuts_ok[$key] = $value; - } - } - - $this->view->conf->_shortcuts ($shortcuts_ok); - - $values = array ( - 'shortcuts' => $this->view->conf->shortcuts () - ); - - $confDAO = new FreshRSS_ConfigurationDAO (); - $confDAO->update ($values); - Minz_Session::_param ('conf', $this->view->conf); - - // notif - $notif = array ( - 'type' => 'good', - 'content' => Minz_Translate::t ('shortcuts_updated') - ); - Minz_Session::_param ('notification', $notif); - - Minz_Request::forward (array ('c' => 'configure', 'a' => 'shortcut'), true); - } - - Minz_View::prependTitle (Minz_Translate::t ('shortcuts_management') . ' - '); - } -} diff --git a/app/controllers/entryController.php b/app/controllers/entryController.php deleted file mode 100755 index a332ca8a9..000000000 --- a/app/controllers/entryController.php +++ /dev/null @@ -1,112 +0,0 @@ -view->conf) && !is_logged ()) { - Minz_Error::error ( - 403, - array ('error' => array (Minz_Translate::t ('access_denied'))) - ); - } - - $this->params = array (); - $this->redirect = false; - $ajax = Minz_Request::param ('ajax'); - if ($ajax) { - $this->view->_useLayout (false); - } - } - public function lastAction () { - $ajax = Minz_Request::param ('ajax'); - if (!$ajax && $this->redirect) { - Minz_Request::forward (array ( - 'c' => 'index', - 'a' => 'index', - 'params' => $this->params - ), true); - } else { - Minz_Request::_param ('ajax'); - } - } - - public function readAction () { - $this->redirect = true; - - $id = Minz_Request::param ('id'); - $is_read = Minz_Request::param ('is_read'); - $get = Minz_Request::param ('get'); - $nextGet = Minz_Request::param ('nextGet', $get); - $idMax = Minz_Request::param ('idMax', 0); - - $is_read = !!$is_read; - - $entryDAO = new FreshRSS_EntryDAO (); - if ($id == false) { - if (!$get) { - $entryDAO->markReadEntries ($idMax); - } else { - $typeGet = $get[0]; - $get = substr ($get, 2); - switch ($typeGet) { - case 'c': - $entryDAO->markReadCat ($get, $idMax); - break; - case 'f': - $entryDAO->markReadFeed ($get, $idMax); - break; - case 's': - $entryDAO->markReadEntries ($idMax, true); - break; - case 'a': - $entryDAO->markReadEntries ($idMax); - break; - } - if ($nextGet !== 'a') { - $this->params = array ('get' => $nextGet); - } - } - - $notif = array ( - 'type' => 'good', - 'content' => Minz_Translate::t ('feeds_marked_read') - ); - Minz_Session::_param ('notification', $notif); - } else { - $entryDAO->markRead ($id, $is_read); - } - } - - public function bookmarkAction () { - $this->redirect = true; - - $id = Minz_Request::param ('id'); - if ($id) { - $entryDAO = new FreshRSS_EntryDAO (); - $entryDAO->markFavorite ($id, Minz_Request::param ('is_favorite')); - } - } - - public function optimizeAction() { - @set_time_limit(300); - invalidateHttpCache(); - - // La table des entrées a tendance à grossir énormément - // Cette action permet d'optimiser cette table permettant de grapiller un peu de place - // Cette fonctionnalité n'est à appeler qu'occasionnellement - $entryDAO = new FreshRSS_EntryDAO(); - $entryDAO->optimizeTable(); - - invalidateHttpCache(); - - $notif = array ( - 'type' => 'good', - 'content' => Minz_Translate::t ('optimization_complete') - ); - Minz_Session::_param ('notification', $notif); - - Minz_Request::forward(array( - 'c' => 'configure', - 'a' => 'display' - ), true); - } -} diff --git a/app/controllers/errorController.php b/app/controllers/errorController.php deleted file mode 100644 index d1c2f8fec..000000000 --- a/app/controllers/errorController.php +++ /dev/null @@ -1,26 +0,0 @@ -view->code = 'Error 403 - Forbidden'; - break; - case 404: - $this->view->code = 'Error 404 - Not found'; - break; - case 500: - $this->view->code = 'Error 500 - Internal Server Error'; - break; - case 503: - $this->view->code = 'Error 503 - Service Unavailable'; - break; - default: - $this->view->code = 'Error 404 - Not found'; - } - - $this->view->logs = Minz_Request::param ('logs'); - - Minz_View::prependTitle ($this->view->code . ' - '); - } -} diff --git a/app/controllers/feedController.php b/app/controllers/feedController.php deleted file mode 100755 index a85877724..000000000 --- a/app/controllers/feedController.php +++ /dev/null @@ -1,428 +0,0 @@ -view->conf->token(); - $token_param = Minz_Request::param ('token', ''); - $token_is_ok = ($token != '' && $token == $token_param); - $action = Minz_Request::actionName (); - - if (login_is_conf ($this->view->conf) && - !is_logged () && - !($token_is_ok && $action == 'actualize')) { - Minz_Error::error ( - 403, - array ('error' => array (Minz_Translate::t ('access_denied'))) - ); - } - - $this->catDAO = new FreshRSS_CategoryDAO (); - $this->catDAO->checkDefault (); - } - - private static function entryDateComparer($e1, $e2) { - $d1 = $e1->date(true); - $d2 = $e2->date(true); - if ($d1 === $d2) { - return 0; - } - return ($d1 < $d2) ? -1 : 1; - } - - public function addAction () { - @set_time_limit(300); - - if (Minz_Request::isPost ()) { - $url = Minz_Request::param ('url_rss'); - $cat = Minz_Request::param ('category', false); - if ($cat === false) { - $def_cat = $this->catDAO->getDefault (); - $cat = $def_cat->id (); - } - - $user = Minz_Request::param ('username'); - $pass = Minz_Request::param ('password'); - $params = array (); - - $transactionStarted = false; - try { - $feed = new FreshRSS_Feed ($url); - $feed->_category ($cat); - - $httpAuth = ''; - if ($user != '' || $pass != '') { - $httpAuth = $user . ':' . $pass; - } - $feed->_httpAuth ($httpAuth); - - $feed->load (); - - $feedDAO = new FreshRSS_FeedDAO (); - $values = array ( - 'url' => $feed->url (), - 'category' => $feed->category (), - 'name' => $feed->name (), - 'website' => $feed->website (), - 'description' => $feed->description (), - 'lastUpdate' => time (), - 'httpAuth' => $feed->httpAuth (), - ); - - if ($feedDAO->searchByUrl ($values['url'])) { - // on est déjà abonné à ce flux - $notif = array ( - 'type' => 'bad', - 'content' => Minz_Translate::t ('already_subscribed', $feed->name ()) - ); - Minz_Session::_param ('notification', $notif); - } else { - $id = $feedDAO->addFeed ($values); - if (!$id) { - // problème au niveau de la base de données - $notif = array ( - 'type' => 'bad', - 'content' => Minz_Translate::t ('feed_not_added', $feed->name ()) - ); - Minz_Session::_param ('notification', $notif); - } else { - $feed->_id ($id); - $feed->faviconPrepare(); - - $is_read = $this->view->conf->markUponReception() === 'yes' ? 1 : 0; - - $entryDAO = new FreshRSS_EntryDAO (); - $entries = $feed->entries (); - usort($entries, 'self::entryDateComparer'); - - // on calcule la date des articles les plus anciens qu'on accepte - $nb_month_old = $this->view->conf->oldEntries (); - $date_min = time () - (3600 * 24 * 30 * $nb_month_old); - - $transactionStarted = true; - $feedDAO->beginTransaction (); - // on ajoute les articles en masse sans vérification - foreach ($entries as $entry) { - if ($entry->date (true) >= $date_min || - $feed->keepHistory ()) { - $values = $entry->toArray (); - $values['id_feed'] = $feed->id (); - $values['id'] = min(time(), $entry->date (true)) . uSecString(); - $values['is_read'] = $is_read; - $entryDAO->addEntry ($values); - } - } - $feedDAO->updateLastUpdate ($feed->id ()); - $feedDAO->commit (); - $transactionStarted = false; - - // ok, ajout terminé - $notif = array ( - 'type' => 'good', - 'content' => Minz_Translate::t ('feed_added', $feed->name ()) - ); - Minz_Session::_param ('notification', $notif); - - // permet de rediriger vers la page de conf du flux - $params['id'] = $feed->id (); - } - } - } catch (FreshRSS_BadUrl_Exception $e) { - Minz_Log::record ($e->getMessage (), Minz_Log::WARNING); - $notif = array ( - 'type' => 'bad', - 'content' => Minz_Translate::t ('invalid_url', $url) - ); - Minz_Session::_param ('notification', $notif); - } catch (FreshRSS_Feed_Exception $e) { - Minz_Log::record ($e->getMessage (), Minz_Log::WARNING); - $notif = array ( - 'type' => 'bad', - 'content' => Minz_Translate::t ('internal_problem_feed') - ); - Minz_Session::_param ('notification', $notif); - } catch (Minz_FileNotExistException $e) { - // Répertoire de cache n'existe pas - Minz_Log::record ($e->getMessage (), Minz_Log::ERROR); - $notif = array ( - 'type' => 'bad', - 'content' => Minz_Translate::t ('internal_problem_feed') - ); - Minz_Session::_param ('notification', $notif); - } - if ($transactionStarted) { - $feedDAO->rollBack (); - } - - Minz_Request::forward (array ('c' => 'configure', 'a' => 'feed', 'params' => $params), true); - } - } - - public function truncateAction () { - if (Minz_Request::isPost ()) { - $id = Minz_Request::param ('id'); - $feedDAO = new FreshRSS_FeedDAO (); - $n = $feedDAO->truncate($id); - $notif = array( - 'type' => $n === false ? 'bad' : 'good', - 'content' => Minz_Translate::t ('n_entries_deleted', $n) - ); - Minz_Session::_param ('notification', $notif); - invalidateHttpCache(); - Minz_Request::forward (array ('c' => 'configure', 'a' => 'feed', 'params' => array('id' => $id)), true); - } - } - - public function actualizeAction () { - @set_time_limit(300); - - $feedDAO = new FreshRSS_FeedDAO (); - $entryDAO = new FreshRSS_EntryDAO (); - - $id = Minz_Request::param ('id'); - $force = Minz_Request::param ('force', false); - - // on créé la liste des flux à mettre à actualiser - // si on veut mettre un flux à jour spécifiquement, on le met - // dans la liste, mais seul (permet d'automatiser le traitement) - $feeds = array (); - if ($id) { - $feed = $feedDAO->searchById ($id); - if ($feed) { - $feeds = array ($feed); - } - } else { - $feeds = $feedDAO->listFeedsOrderUpdate (); - } - - // on calcule la date des articles les plus anciens qu'on accepte - $nb_month_old = $this->view->conf->oldEntries (); - $date_min = time () - (3600 * 24 * 30 * $nb_month_old); - - $i = 0; - $flux_update = 0; - foreach ($feeds as $feed) { - try { - $feed->load (); - $feed->faviconPrepare(); - $entries = $feed->entries (); - usort($entries, 'self::entryDateComparer'); - - $is_read = $this->view->conf->markUponReception() === 'yes' ? 1 : 0; - - //For this feed, check last n entry GUIDs already in database - $existingGuids = array_fill_keys ($entryDAO->listLastGuidsByFeed ($feed->id (), count($entries) + 10), 1); - - // On ne vérifie pas strictement que l'article n'est pas déjà en BDD - // La BDD refusera l'ajout car (id_feed, guid) doit être unique - $feedDAO->beginTransaction (); - foreach ($entries as $entry) { - if ((!isset ($existingGuids[$entry->guid ()])) && - ($entry->date (true) >= $date_min || - $feed->keepHistory ())) { - $values = $entry->toArray (); - //Use declared date at first import, otherwise use discovery date - $values['id'] = empty($existingGuids) ? min(time(), $entry->date (true)) . uSecString() : uTimeString(); - $values['is_read'] = $is_read; - $entryDAO->addEntry ($values); - } - } - - if ((!$feed->keepHistory()) && (rand(0, 30) === 1)) { - $nb = $feedDAO->cleanOldEntries ($feed->id (), $date_min, count($entries) + 10); - Minz_Log::record ($nb . ' old entries cleaned in feed ' . $feed->id (), Minz_Log::DEBUG); - } - - // on indique que le flux vient d'être mis à jour en BDD - $feedDAO->updateLastUpdate ($feed->id ()); - $feedDAO->commit (); - $flux_update++; - } catch (FreshRSS_Feed_Exception $e) { - Minz_Log::record ($e->getMessage (), Minz_Log::NOTICE); - $feedDAO->updateLastUpdate ($feed->id (), 1); - } - - // On arrête à 10 flux pour ne pas surcharger le serveur - // sauf si le paramètre $force est à vrai - $i++; - if ($i >= 10 && !$force) { - break; - } - } - - $url = array (); - if ($flux_update === 1) { - // on a mis un seul flux à jour - $notif = array ( - 'type' => 'good', - 'content' => Minz_Translate::t ('feed_actualized', $feed->name ()) - ); - } elseif ($flux_update > 1) { - // plusieurs flux on été mis à jour - $notif = array ( - 'type' => 'good', - 'content' => Minz_Translate::t ('n_feeds_actualized', $flux_update) - ); - } else { - // aucun flux n'a été mis à jour, oups - $notif = array ( - 'type' => 'bad', - 'content' => Minz_Translate::t ('no_feed_actualized') - ); - } - - if ($i === 1) { - // Si on a voulu mettre à jour qu'un flux - // on filtre l'affichage par ce flux - $feed = reset ($feeds); - $url['params'] = array ('get' => 'f_' . $feed->id ()); - } - - if (Minz_Request::param ('ajax', 0) === 0) { - Minz_Session::_param ('notification', $notif); - Minz_Request::forward ($url, true); - } else { - // Une requête Ajax met un seul flux à jour. - // Comme en principe plusieurs requêtes ont lieu, - // on indique que "plusieurs flux ont été mis à jour". - // Cela permet d'avoir une notification plus proche du - // ressenti utilisateur - $notif = array ( - 'type' => 'good', - 'content' => Minz_Translate::t ('feeds_actualized') - ); - Minz_Session::_param ('notification', $notif); - // et on désactive le layout car ne sert à rien - $this->view->_useLayout (false); - } - } - - public function massiveImportAction () { - @set_time_limit(300); - - $entryDAO = new FreshRSS_EntryDAO (); - $feedDAO = new FreshRSS_FeedDAO (); - - $categories = Minz_Request::param ('categories', array (), true); - $feeds = Minz_Request::param ('feeds', array (), true); - - // on ajoute les catégories en masse dans une fonction à part - $this->addCategories ($categories); - - // on calcule la date des articles les plus anciens qu'on accepte - $nb_month_old = $this->view->conf->oldEntries (); - $date_min = time () - (3600 * 24 * 30 * $nb_month_old); - - // la variable $error permet de savoir si une erreur est survenue - // Le but est de ne pas arrêter l'import même en cas d'erreur - // L'utilisateur sera mis au courant s'il y a eu des erreurs, mais - // ne connaîtra pas les détails. Ceux-ci seront toutefois logguées - $error = false; - $i = 0; - foreach ($feeds as $feed) { - try { - $values = array ( - 'id' => $feed->id (), - 'url' => $feed->url (), - 'category' => $feed->category (), - 'name' => $feed->name (), - 'website' => $feed->website (), - 'description' => $feed->description (), - 'lastUpdate' => 0, - 'httpAuth' => $feed->httpAuth () - ); - - // ajout du flux que s'il n'est pas déjà en BDD - if (!$feedDAO->searchByUrl ($values['url'])) { - $id = $feedDAO->addFeed ($values); - if ($id) { - $feed->_id ($id); - $feed->faviconPrepare(); - } else { - $error = true; - } - } - } catch (FreshRSS_Feed_Exception $e) { - $error = true; - Minz_Log::record ($e->getMessage (), Minz_Log::WARNING); - } - } - - if ($error) { - $res = Minz_Translate::t ('feeds_imported_with_errors'); - } else { - $res = Minz_Translate::t ('feeds_imported'); - } - - $notif = array ( - 'type' => 'good', - 'content' => $res - ); - Minz_Session::_param ('notification', $notif); - Minz_Session::_param ('actualize_feeds', true); - - // et on redirige vers la page d'accueil - Minz_Request::forward (array ( - 'c' => 'index', - 'a' => 'index' - ), true); - } - - public function deleteAction () { - if (Minz_Request::isPost ()) { - $type = Minz_Request::param ('type', 'feed'); - $id = Minz_Request::param ('id'); - - $feedDAO = new FreshRSS_FeedDAO (); - if ($type == 'category') { - if ($feedDAO->deleteFeedByCategory ($id)) { - $notif = array ( - 'type' => 'good', - 'content' => Minz_Translate::t ('category_emptied') - ); - //TODO: Delete old favicons - } else { - $notif = array ( - 'type' => 'bad', - 'content' => Minz_Translate::t ('error_occured') - ); - } - } else { - if ($feedDAO->deleteFeed ($id)) { - $notif = array ( - 'type' => 'good', - 'content' => Minz_Translate::t ('feed_deleted') - ); - Feed::faviconDelete($id); - } else { - $notif = array ( - 'type' => 'bad', - 'content' => Minz_Translate::t ('error_occured') - ); - } - } - - Minz_Session::_param ('notification', $notif); - - if ($type == 'category') { - Minz_Request::forward (array ('c' => 'configure', 'a' => 'categorize'), true); - } else { - Minz_Request::forward (array ('c' => 'configure', 'a' => 'feed'), true); - } - } - } - - private function addCategories ($categories) { - $catDAO = new FreshRSS_CategoryDAO (); - - foreach ($categories as $cat) { - if (!$catDAO->searchByName ($cat->name ())) { - $values = array ( - 'id' => $cat->id (), - 'name' => $cat->name (), - 'color' => $cat->color () - ); - $catDAO->addCategory ($values); - } - } - } -} diff --git a/app/controllers/indexController.php b/app/controllers/indexController.php deleted file mode 100755 index 92070590a..000000000 --- a/app/controllers/indexController.php +++ /dev/null @@ -1,277 +0,0 @@ -entryDAO = new FreshRSS_EntryDAO (); - $this->feedDAO = new FreshRSS_FeedDAO (); - $this->catDAO = new FreshRSS_CategoryDAO (); - } - - public function indexAction () { - $output = Minz_Request::param ('output'); - - $token = $this->view->conf->token(); - $token_param = Minz_Request::param ('token', ''); - $token_is_ok = ($token != '' && $token === $token_param); - - // check if user is log in - if(login_is_conf ($this->view->conf) && - !is_logged() && - $this->view->conf->anonAccess() === 'no' && - !($output === 'rss' && $token_is_ok)) { - return; - } - - // construction of RSS url of this feed - $params = Minz_Request::params (); - $params['output'] = 'rss'; - if (isset ($params['search'])) { - $params['search'] = urlencode ($params['search']); - } - if (login_is_conf($this->view->conf) && - $this->view->conf->anonAccess() === 'no' && - $token != '') { - $params['token'] = $token; - } - $this->view->rss_url = array ( - 'c' => 'index', - 'a' => 'index', - 'params' => $params - ); - - if ($output === 'rss') { - // no layout for RSS output - $this->view->_useLayout (false); - header('Content-Type: application/rss+xml; charset=utf-8'); - } else { - Minz_View::appendScript (Minz_Url::display ('/scripts/shortcut.js?' . @filemtime(PUBLIC_PATH . '/scripts/shortcut.js'))); - - if ($output === 'global') { - Minz_View::appendScript (Minz_Url::display ('/scripts/global_view.js?' . @filemtime(PUBLIC_PATH . '/scripts/global_view.js'))); - } - } - - $this->view->cat_aside = $this->catDAO->listCategories (); - $this->view->nb_favorites = $this->entryDAO->countUnreadReadFavorites (); - $this->view->currentName = ''; - - $this->view->get_c = ''; - $this->view->get_f = ''; - - $get = Minz_Request::param ('get', 'a'); - $getType = $get[0]; - $getId = substr ($get, 2); - if (!$this->checkAndProcessType ($getType, $getId)) { - Minz_Log::record ('Not found [' . $getType . '][' . $getId . ']', Minz_Log::DEBUG); - Minz_Error::error ( - 404, - array ('error' => array (Minz_Translate::t ('page_not_found'))) - ); - return; - } - - $this->view->nb_not_read = HelperCategory::CountUnreads($this->view->cat_aside, 1); - - // mise à jour des titres - $this->view->rss_title = $this->view->currentName . ' | ' . Minz_View::title(); - if ($this->view->nb_not_read > 0) { - Minz_View::appendTitle (' (' . $this->view->nb_not_read . ')'); - } - Minz_View::prependTitle ( - $this->view->currentName . - ($this->nb_not_read_cat > 0 ? ' (' . $this->nb_not_read_cat . ')' : '') . - ' - ' - ); - - // On récupère les différents éléments de filtrage - $this->view->state = $state = Minz_Request::param ('state', $this->view->conf->defaultView ()); - $filter = Minz_Request::param ('search', ''); - if (!empty($filter)) { - $state = 'all'; //Search always in read and unread articles - } - $this->view->order = $order = Minz_Request::param ('order', $this->view->conf->sortOrder ()); - $nb = Minz_Request::param ('nb', $this->view->conf->postsPerPage ()); - $first = Minz_Request::param ('next', ''); - - if ($state === 'not_read') { //Any unread article in this category at all? - switch ($getType) { - case 'a': - $hasUnread = $this->view->nb_not_read > 0; - break; - case 's': - $hasUnread = $this->view->nb_favorites['unread'] > 0; - break; - case 'c': - $hasUnread = (!isset($this->view->cat_aside[$getId])) || ($this->view->cat_aside[$getId]->nbNotRead() > 0); - break; - case 'f': - $myFeed = HelperCategory::findFeed($this->view->cat_aside, $getId); - $hasUnread = ($myFeed === null) || ($myFeed->nbNotRead() > 0); - break; - default: - $hasUnread = true; - break; - } - if (!$hasUnread) { - $this->view->state = $state = 'all'; - } - } - - // on calcule la date des articles les plus anciens qu'on affiche - $nb_month_old = $this->view->conf->oldEntries (); - $date_min = time () - (3600 * 24 * 30 * $nb_month_old); - - try { - $entries = $this->entryDAO->listWhere($getType, $getId, $state, $order, $nb + 1, $first, $filter, $date_min); - - // Si on a récupéré aucun article "non lus" - // on essaye de récupérer tous les articles - if ($state === 'not_read' && empty($entries)) { //TODO: Remove in v0.8 - Minz_Log::record ('Conflicting information about nbNotRead!', Minz_Log::DEBUG); - $this->view->state = 'all'; - $entries = $this->entryDAO->listWhere($getType, $getId, 'all', $order, $nb, $first, $filter, $date_min); - } - - if (count($entries) <= $nb) { - $this->view->nextId = ''; - } else { //We have more elements for pagination - $lastEntry = array_pop($entries); - $this->view->nextId = $lastEntry->id(); - } - - $this->view->entries = $entries; - } catch (FreshRSS_EntriesGetter_Exception $e) { - Minz_Log::record ($e->getMessage (), Minz_Log::NOTICE); - Minz_Error::error ( - 404, - array ('error' => array (Minz_Translate::t ('page_not_found'))) - ); - } - } - - /* - * Vérifie que la catégorie / flux sélectionné existe - * + Initialise correctement les variables de vue get_c et get_f - * + Met à jour la variable $this->nb_not_read_cat - */ - private function checkAndProcessType ($getType, $getId) { - switch ($getType) { - case 'a': - $this->view->currentName = Minz_Translate::t ('your_rss_feeds'); - $this->view->get_c = $getType; - return true; - case 's': - $this->view->currentName = Minz_Translate::t ('your_favorites'); - $this->view->get_c = $getType; - return true; - case 'c': - $cat = isset($this->view->cat_aside[$getId]) ? $this->view->cat_aside[$getId] : null; - if ($cat === null) { - $cat = $this->catDAO->searchById ($getId); - } - if ($cat) { - $this->view->currentName = $cat->name (); - $this->nb_not_read_cat = $cat->nbNotRead (); - $this->view->get_c = $getId; - return true; - } else { - return false; - } - case 'f': - $feed = HelperCategory::findFeed($this->view->cat_aside, $getId); - if (empty($feed)) { - $feed = $this->feedDAO->searchById ($getId); - } - if ($feed) { - $this->view->currentName = $feed->name (); - $this->nb_not_read_cat = $feed->nbNotRead (); - $this->view->get_f = $getId; - $this->view->get_c = $feed->category (); - return true; - } else { - return false; - } - default: - return false; - } - } - - public function aboutAction () { - Minz_View::prependTitle (Minz_Translate::t ('about') . ' - '); - } - - public function logsAction () { - if (login_is_conf ($this->view->conf) && !is_logged ()) { - Minz_Error::error ( - 403, - array ('error' => array (Minz_Translate::t ('access_denied'))) - ); - } - - Minz_View::prependTitle (Minz_Translate::t ('logs') . ' - '); - - if (Minz_Request::isPost ()) { - file_put_contents(LOG_PATH . '/application.log', ''); - } - - $logs = array(); - try { - $logDAO = new FreshRSS_LogDAO (); - $logs = $logDAO->lister (); - $logs = array_reverse ($logs); - } catch (Minz_FileNotExistException $e) { - - } - - //gestion pagination - $page = Minz_Request::param ('page', 1); - $this->view->logsPaginator = new Minz_Paginator ($logs); - $this->view->logsPaginator->_nbItemsPerPage (50); - $this->view->logsPaginator->_currentPage ($page); - } - - public function loginAction () { - $this->view->_useLayout (false); - - $url = 'https://verifier.login.persona.org/verify'; - $assert = Minz_Request::param ('assertion'); - $params = 'assertion=' . $assert . '&audience=' . - urlencode (Minz_Url::display (null, 'php', true)); - $ch = curl_init (); - $options = array ( - CURLOPT_URL => $url, - CURLOPT_RETURNTRANSFER => TRUE, - CURLOPT_POST => 2, - CURLOPT_POSTFIELDS => $params - ); - curl_setopt_array ($ch, $options); - $result = curl_exec ($ch); - curl_close ($ch); - - $res = json_decode ($result, true); - if ($res['status'] === 'okay' && $res['email'] === $this->view->conf->mailLogin ()) { - Minz_Session::_param ('mail', $res['email']); - invalidateHttpCache(); - } else { - $res = array (); - $res['status'] = 'failure'; - $res['reason'] = Minz_Translate::t ('invalid_login'); - } - - header('Content-Type: application/json; charset=UTF-8'); - $this->view->res = json_encode ($res); - } - - public function logoutAction () { - $this->view->_useLayout (false); - Minz_Session::_param ('mail'); - invalidateHttpCache(); - } -} diff --git a/app/controllers/javascriptController.php b/app/controllers/javascriptController.php deleted file mode 100755 index e7e25f656..000000000 --- a/app/controllers/javascriptController.php +++ /dev/null @@ -1,13 +0,0 @@ -view->_useLayout (false); - header('Content-type: text/javascript'); - } - - public function actualizeAction () { - $feedDAO = new FreshRSS_FeedDAO (); - $this->view->feeds = $feedDAO->listFeeds (); - } -} -- cgit v1.2.3 From ce3801e5acf22e64cb53cfad21ced1b962674a91 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Sun, 15 Dec 2013 12:17:20 +0100 Subject: Message debug nettoyage MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message dans le log uniquement lorsque des articles ont été supprimés https://github.com/marienfressinaud/FreshRSS/issues/323 --- app/Controllers/feedController.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/Controllers/feedController.php b/app/Controllers/feedController.php index a85877724..18476d559 100755 --- a/app/Controllers/feedController.php +++ b/app/Controllers/feedController.php @@ -229,7 +229,9 @@ class FreshRSS_feed_Controller extends Minz_ActionController { if ((!$feed->keepHistory()) && (rand(0, 30) === 1)) { $nb = $feedDAO->cleanOldEntries ($feed->id (), $date_min, count($entries) + 10); - Minz_Log::record ($nb . ' old entries cleaned in feed ' . $feed->id (), Minz_Log::DEBUG); + if ($nb > 0) { + Minz_Log::record ($nb . ' old entries cleaned in feed ' . $feed->id (), Minz_Log::DEBUG); + } } // on indique que le flux vient d'être mis à jour en BDD -- cgit v1.2.3 From a2421185d0bc9a0e177b6ecbf98bb17086d43386 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Sun, 15 Dec 2013 16:01:37 +0100 Subject: SQL : Petite amélioration de la requête principale MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit En particulier pour les favoris, où cela évite une jointure. --- app/Models/EntryDAO.php | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/app/Models/EntryDAO.php b/app/Models/EntryDAO.php index 1bce6cbf2..f80fe9b77 100644 --- a/app/Models/EntryDAO.php +++ b/app/Models/EntryDAO.php @@ -261,20 +261,23 @@ class FreshRSS_EntryDAO extends Minz_ModelPdo { public function listWhere($type = 'a', $id = '', $state = 'all', $order = 'DESC', $limit = 1, $firstId = '', $filter = '', $date_min = 0) { $where = ''; + $joinFeed = false; $values = array(); switch ($type) { case 'a': - $where .= 'priority > 0 '; + $where .= 'f.priority > 0 '; + $joinFeed = true; break; case 's': - $where .= 'is_favorite = 1 '; + $where .= 'e.is_favorite = 1 '; break; case 'c': - $where .= 'category = ? '; + $where .= 'f.category = ? '; $values[] = intval($id); + $joinFeed = true; break; case 'f': - $where .= 'id_feed = ? '; + $where .= 'e.id_feed = ? '; $values[] = intval($id); break; default: @@ -284,10 +287,10 @@ class FreshRSS_EntryDAO extends Minz_ModelPdo { case 'all': break; case 'not_read': - $where .= 'AND is_read = 0 '; + $where .= 'AND e.is_read = 0 '; break; case 'read': - $where .= 'AND is_read = 1 '; + $where .= 'AND e.is_read = 1 '; break; default: throw new FreshRSS_EntriesGetter_Exception ('Bad state in Entry->listByType: [' . $state . ']!'); @@ -302,8 +305,9 @@ class FreshRSS_EntryDAO extends Minz_ModelPdo { if ($firstId !== '') { $where .= 'AND e.id ' . ($order === 'DESC' ? '<=' : '>=') . $firstId . ' '; } - if ($date_min > 0) { + if (($date_min > 0) && ($type !== 's')) { $where .= 'AND (e.id >= ' . $date_min . '000000 OR e.is_favorite = 1 OR f.keep_history = 1) '; + $joinFeed = true; } $terms = array_unique(explode(' ', trim($filter))); sort($terms); //Put #tags first @@ -311,7 +315,7 @@ class FreshRSS_EntryDAO extends Minz_ModelPdo { foreach ($terms as $word) { if (!empty($word)) { if ($word[0] === '#' && isset($word[1])) { - $having .= 'AND tags LIKE ? '; + $having .= 'AND e.tags LIKE ? '; $values[] = '%' . $word .'%'; } elseif (!empty($word)) { $having .= 'AND (e.title LIKE ? OR content LIKE ?) '; @@ -323,7 +327,8 @@ class FreshRSS_EntryDAO extends Minz_ModelPdo { $sql = 'SELECT e.id, e.guid, e.title, e.author, UNCOMPRESS(e.content_bin) AS content, e.link, e.date, e.is_read, e.is_favorite, e.id_feed, e.tags ' . 'FROM `' . $this->prefix . 'entry` e ' - . 'INNER JOIN `' . $this->prefix . 'feed` f ON e.id_feed = f.id WHERE ' . $where + . ($joinFeed ? 'INNER JOIN `' . $this->prefix . 'feed` f ON e.id_feed = f.id ' : '') + . 'WHERE ' . $where . (empty($having) ? '' : 'HAVING' . substr($having, 3)) . 'ORDER BY e.id ' . $order; -- cgit v1.2.3 From 529d6bcd15f7351cb7bdcf2f74c6a44930b0de55 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Mon, 16 Dec 2013 00:50:24 +0100 Subject: SQL : performances MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Tentative de reformulation de la requête principale pour améliorer les performances. Utilisation d'une sous-jointure qui retourne uniquement e.id. Sur mon serveur avec 13000 articles, la requête de la page d'accueil sans article non lu mettait 1.38s avant le patch, contre 0.08s après (en désactivant bien sûr le cache SQL). Il faudra re-tester et tenter d'autres optimisations (notamment sur les index) avec un nombre d'articles plus important. Avant : SELECT SQL_NO_CACHE e.id, e.guid, e.title, e.author, UNCOMPRESS(e.content_bin) AS content, e.link, e.date, e.is_read, e.is_favorite, e.id_feed, e.tags FROM `freshrss_alex_entry` e INNER JOIN `freshrss_alex_feed` f ON e.id_feed = f.id WHERE f.priority > 0 AND (e.id >= 1371597014000000 OR e.is_favorite = 1 OR f.keep_history = 1) ORDER BY e.id DESC LIMIT 33; Après : SELECT SQL_NO_CACHE e.id, e.guid, e.title, e.author, UNCOMPRESS(e.content_bin) AS content, e.link, e.date, e.is_read, e.is_favorite, e.id_feed, e.tags FROM `freshrss_alex_entry` e INNER JOIN (SELECT e1.id FROM `freshrss_alex_entry` e1 INNER JOIN `freshrss_alex_feed` f ON e1.id_feed = f.id WHERE f.priority > 0 AND (e1.id >= 1371597014000000 OR e1.is_favorite = 1 OR f.keep_history = 1) ORDER BY e1.id DESC LIMIT 33) e2 ON e2.id = e.id ORDER BY e.id DESC; --- app/Controllers/indexController.php | 4 +++- app/Models/EntryDAO.php | 30 +++++++++++++++--------------- 2 files changed, 18 insertions(+), 16 deletions(-) diff --git a/app/Controllers/indexController.php b/app/Controllers/indexController.php index 92070590a..cc474302e 100755 --- a/app/Controllers/indexController.php +++ b/app/Controllers/indexController.php @@ -124,9 +124,11 @@ class FreshRSS_index_Controller extends Minz_ActionController { } } + $today = @strtotime('today'); + // on calcule la date des articles les plus anciens qu'on affiche $nb_month_old = $this->view->conf->oldEntries (); - $date_min = time () - (3600 * 24 * 30 * $nb_month_old); + $date_min = $today - (3600 * 24 * 30 * $nb_month_old); //Do not use a fast changing value such as time() to allow SQL caching try { $entries = $this->entryDAO->listWhere($getType, $getId, $state, $order, $nb + 1, $first, $filter, $date_min); diff --git a/app/Models/EntryDAO.php b/app/Models/EntryDAO.php index f80fe9b77..5a34573db 100644 --- a/app/Models/EntryDAO.php +++ b/app/Models/EntryDAO.php @@ -269,7 +269,7 @@ class FreshRSS_EntryDAO extends Minz_ModelPdo { $joinFeed = true; break; case 's': - $where .= 'e.is_favorite = 1 '; + $where .= 'e1.is_favorite = 1 '; break; case 'c': $where .= 'f.category = ? '; @@ -277,7 +277,7 @@ class FreshRSS_EntryDAO extends Minz_ModelPdo { $joinFeed = true; break; case 'f': - $where .= 'e.id_feed = ? '; + $where .= 'e1.id_feed = ? '; $values[] = intval($id); break; default: @@ -287,10 +287,10 @@ class FreshRSS_EntryDAO extends Minz_ModelPdo { case 'all': break; case 'not_read': - $where .= 'AND e.is_read = 0 '; + $where .= 'AND e1.is_read = 0 '; break; case 'read': - $where .= 'AND e.is_read = 1 '; + $where .= 'AND e1.is_read = 1 '; break; default: throw new FreshRSS_EntriesGetter_Exception ('Bad state in Entry->listByType: [' . $state . ']!'); @@ -303,10 +303,10 @@ class FreshRSS_EntryDAO extends Minz_ModelPdo { throw new FreshRSS_EntriesGetter_Exception ('Bad order in Entry->listByType: [' . $order . ']!'); } if ($firstId !== '') { - $where .= 'AND e.id ' . ($order === 'DESC' ? '<=' : '>=') . $firstId . ' '; + $where .= 'AND e1.id ' . ($order === 'DESC' ? '<=' : '>=') . $firstId . ' '; } if (($date_min > 0) && ($type !== 's')) { - $where .= 'AND (e.id >= ' . $date_min . '000000 OR e.is_favorite = 1 OR f.keep_history = 1) '; + $where .= 'AND (e1.id >= ' . $date_min . '000000 OR e1.is_favorite = 1 OR f.keep_history = 1) '; $joinFeed = true; } $terms = array_unique(explode(' ', trim($filter))); @@ -315,10 +315,10 @@ class FreshRSS_EntryDAO extends Minz_ModelPdo { foreach ($terms as $word) { if (!empty($word)) { if ($word[0] === '#' && isset($word[1])) { - $having .= 'AND e.tags LIKE ? '; + $having .= 'AND e1.tags LIKE ? '; $values[] = '%' . $word .'%'; } elseif (!empty($word)) { - $having .= 'AND (e.title LIKE ? OR content LIKE ?) '; + $having .= 'AND (e1.title LIKE ? OR content LIKE ?) '; $values[] = '%' . $word .'%'; $values[] = '%' . $word .'%'; } @@ -327,15 +327,15 @@ class FreshRSS_EntryDAO extends Minz_ModelPdo { $sql = 'SELECT e.id, e.guid, e.title, e.author, UNCOMPRESS(e.content_bin) AS content, e.link, e.date, e.is_read, e.is_favorite, e.id_feed, e.tags ' . 'FROM `' . $this->prefix . 'entry` e ' - . ($joinFeed ? 'INNER JOIN `' . $this->prefix . 'feed` f ON e.id_feed = f.id ' : '') - . 'WHERE ' . $where - . (empty($having) ? '' : 'HAVING' . substr($having, 3)) + . 'INNER JOIN (SELECT e1.id FROM `' . $this->prefix . 'entry` e1 ' + . ($joinFeed ? 'INNER JOIN `' . $this->prefix . 'feed` f ON e1.id_feed = f.id ' : '') + . 'WHERE ' . $where + . (empty($having) ? '' : 'HAVING' . substr($having, 3)) + . 'ORDER BY e1.id ' . $order + . ($limit > 0 ? ' LIMIT ' . $limit : '') //TODO: See http://explainextended.com/2009/10/23/mysql-order-by-limit-performance-late-row-lookups/ + . ') e2 ON e2.id = e.id ' . 'ORDER BY e.id ' . $order; - if ($limit > 0) { - $sql .= ' LIMIT ' . $limit; //TODO: See http://explainextended.com/2009/10/23/mysql-order-by-limit-performance-late-row-lookups/ - } - $stm = $this->bd->prepare ($sql); $stm->execute ($values); -- cgit v1.2.3 From 847de9b3292ad854b281d7e12cc36ac93e745139 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Mon, 16 Dec 2013 00:54:13 +0100 Subject: PHP : performances fonction isDay MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Amélioration des performances de Entry->isDay() --- app/Controllers/indexController.php | 1 + app/Models/Entry.php | 27 +++++++++++++-------------- app/layout/nav_menu.phtml | 2 +- app/views/helpers/view/normal_view.phtml | 7 ++++--- 4 files changed, 19 insertions(+), 18 deletions(-) diff --git a/app/Controllers/indexController.php b/app/Controllers/indexController.php index cc474302e..22c5683ea 100755 --- a/app/Controllers/indexController.php +++ b/app/Controllers/indexController.php @@ -125,6 +125,7 @@ class FreshRSS_index_Controller extends Minz_ActionController { } $today = @strtotime('today'); + $this->view->today = $today; // on calcule la date des articles les plus anciens qu'on affiche $nb_month_old = $this->view->conf->oldEntries (); diff --git a/app/Models/Entry.php b/app/Models/Entry.php index ba0fb48f4..983f94727 100644 --- a/app/Models/Entry.php +++ b/app/Models/Entry.php @@ -134,21 +134,20 @@ class FreshRSS_Entry extends Minz_Model { $this->tags = $value; } - public function isDay ($day) { + public function isDay ($day, $today) { $date = $this->dateAdded(true); - $today = @strtotime('today'); - $yesterday = $today - 86400; - - if ($day === FreshRSS_Days::TODAY && - $date >= $today && $date < $today + 86400) { - return true; - } elseif ($day === FreshRSS_Days::YESTERDAY && - $date >= $yesterday && $date < $yesterday + 86400) { - return true; - } elseif ($day === FreshRSS_Days::BEFORE_YESTERDAY && $date < $yesterday) { - return true; - } else { - return false; + switch ($day) { + case FreshRSS_Days::TODAY: + $tomorrow = $today + 86400; + return $date >= $today && $date < $tomorrow; + case FreshRSS_Days::YESTERDAY: + $yesterday = $today - 86400; + return $date >= $yesterday && $date < $today; + case FreshRSS_Days::BEFORE_YESTERDAY: + $yesterday = $today - 86400; + return $date < $yesterday; + default: + return false; } } diff --git a/app/layout/nav_menu.phtml b/app/layout/nav_menu.phtml index 92a987aed..045f391f9 100644 --- a/app/layout/nav_menu.phtml +++ b/app/layout/nav_menu.phtml @@ -72,7 +72,7 @@
  • today; $one_week = $today - 604800; ?>
  • diff --git a/app/views/helpers/view/normal_view.phtml b/app/views/helpers/view/normal_view.phtml index 094017957..d5328651d 100644 --- a/app/views/helpers/view/normal_view.phtml +++ b/app/views/helpers/view/normal_view.phtml @@ -21,24 +21,25 @@ if (!empty($this->entries)) { $facebook = $this->conf->sharing ('facebook'); $email = $this->conf->sharing ('email'); $print = $this->conf->sharing ('print'); + $today = $this->today; ?> entries as $item) { ?> - isDay (FreshRSS_Days::TODAY)) { ?> + isDay (FreshRSS_Days::TODAY, $today)) { ?>
    - currentName; ?>
    - isDay (FreshRSS_Days::YESTERDAY)) { ?> + isDay (FreshRSS_Days::YESTERDAY, $today)) { ?>
    - currentName; ?>
    - isDay (FreshRSS_Days::BEFORE_YESTERDAY)) { ?> + isDay (FreshRSS_Days::BEFORE_YESTERDAY, $today)) { ?>
    currentName; ?> -- cgit v1.2.3 From 8abeeaf65e79a464aae6d40f8868ecd29889df4c Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Mon, 16 Dec 2013 17:45:57 +0100 Subject: SQL : correction recherche MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Oups, mon précédent changement SQL avait cassé la recherche. Patch rapide en attendant une ré-optimisation en particulier pour le cas de recherche sur plusieurs mots --- app/Models/EntryDAO.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/Models/EntryDAO.php b/app/Models/EntryDAO.php index 5a34573db..c4eb0a84a 100644 --- a/app/Models/EntryDAO.php +++ b/app/Models/EntryDAO.php @@ -311,14 +311,14 @@ class FreshRSS_EntryDAO extends Minz_ModelPdo { } $terms = array_unique(explode(' ', trim($filter))); sort($terms); //Put #tags first - $having = ''; + $search = ''; foreach ($terms as $word) { if (!empty($word)) { if ($word[0] === '#' && isset($word[1])) { - $having .= 'AND e1.tags LIKE ? '; + $search .= 'AND e1.tags LIKE ? '; $values[] = '%' . $word .'%'; } elseif (!empty($word)) { - $having .= 'AND (e1.title LIKE ? OR content LIKE ?) '; + $search .= 'AND (e1.title LIKE ? OR UNCOMPRESS(e1.content_bin) LIKE ?) '; $values[] = '%' . $word .'%'; $values[] = '%' . $word .'%'; } @@ -330,7 +330,7 @@ class FreshRSS_EntryDAO extends Minz_ModelPdo { . 'INNER JOIN (SELECT e1.id FROM `' . $this->prefix . 'entry` e1 ' . ($joinFeed ? 'INNER JOIN `' . $this->prefix . 'feed` f ON e1.id_feed = f.id ' : '') . 'WHERE ' . $where - . (empty($having) ? '' : 'HAVING' . substr($having, 3)) + . $search . 'ORDER BY e1.id ' . $order . ($limit > 0 ? ' LIMIT ' . $limit : '') //TODO: See http://explainextended.com/2009/10/23/mysql-order-by-limit-performance-late-row-lookups/ . ') e2 ON e2.id = e.id ' -- cgit v1.2.3 From a1f8bade6176f03a6e2399d5de24975bb47d09d6 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Mon, 16 Dec 2013 21:58:47 +0100 Subject: SQL : petits changement recherche MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Traite mieux les caractères spéciaux. Permet par exemple une recherche sur des mots contenant des apostrophes, ou le signe pourcentage, etc. Il faudra toujours essayer d'améliorer la recherche en particulier lorsque plusieurs mots sont fournis --- app/Models/EntryDAO.php | 28 +++++++++++++++++----------- lib/Minz/Request.php | 2 +- 2 files changed, 18 insertions(+), 12 deletions(-) diff --git a/app/Models/EntryDAO.php b/app/Models/EntryDAO.php index c4eb0a84a..2af511527 100644 --- a/app/Models/EntryDAO.php +++ b/app/Models/EntryDAO.php @@ -309,18 +309,24 @@ class FreshRSS_EntryDAO extends Minz_ModelPdo { $where .= 'AND (e1.id >= ' . $date_min . '000000 OR e1.is_favorite = 1 OR f.keep_history = 1) '; $joinFeed = true; } - $terms = array_unique(explode(' ', trim($filter))); - sort($terms); //Put #tags first $search = ''; - foreach ($terms as $word) { - if (!empty($word)) { - if ($word[0] === '#' && isset($word[1])) { - $search .= 'AND e1.tags LIKE ? '; - $values[] = '%' . $word .'%'; - } elseif (!empty($word)) { - $search .= 'AND (e1.title LIKE ? OR UNCOMPRESS(e1.content_bin) LIKE ?) '; - $values[] = '%' . $word .'%'; - $values[] = '%' . $word .'%'; + if ($filter !== '') { + $filter = trim($filter); + $filter = addcslashes($filter, '\\%_'); + $terms = array_unique(explode(' ', $filter)); + sort($terms); //Put #tags first + foreach ($terms as $word) { + $word = trim($word); + if (strlen($word) > 0) { + if ($word[0] === '#') { + if (isset($word[1])) { + $search .= 'AND e1.tags LIKE ? '; + $values[] = '%' . $word .'%'; + } + } else { + $search .= 'AND CONCAT(e1.title, UNCOMPRESS(e1.content_bin)) LIKE ? '; + $values[] = '%' . $word .'%'; + } } } } diff --git a/lib/Minz/Request.php b/lib/Minz/Request.php index c8ffa4a42..fb48bd7a2 100644 --- a/lib/Minz/Request.php +++ b/lib/Minz/Request.php @@ -30,7 +30,7 @@ class Minz_Request { return self::$params; } static function htmlspecialchars_utf8 ($p) { - return htmlspecialchars($p, ENT_QUOTES, 'UTF-8'); + return htmlspecialchars($p, ENT_COMPAT, 'UTF-8'); } public static function param ($key, $default = false, $specialchars = false) { if (isset (self::$params[$key])) { -- cgit v1.2.3 From ba71d7747a8b0847ad59ff56870378b341c5171d Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Mon, 16 Dec 2013 22:03:16 +0100 Subject: SQL : permet recherche du caractère dièse MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Models/EntryDAO.php | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/app/Models/EntryDAO.php b/app/Models/EntryDAO.php index 2af511527..d1f595d42 100644 --- a/app/Models/EntryDAO.php +++ b/app/Models/EntryDAO.php @@ -318,11 +318,9 @@ class FreshRSS_EntryDAO extends Minz_ModelPdo { foreach ($terms as $word) { $word = trim($word); if (strlen($word) > 0) { - if ($word[0] === '#') { - if (isset($word[1])) { - $search .= 'AND e1.tags LIKE ? '; - $values[] = '%' . $word .'%'; - } + if ($word[0] === '#' && isset($word[1])) { + $search .= 'AND e1.tags LIKE ? '; + $values[] = '%' . $word .'%'; } else { $search .= 'AND CONCAT(e1.title, UNCOMPRESS(e1.content_bin)) LIKE ? '; $values[] = '%' . $word .'%'; -- cgit v1.2.3 From e29be10556e1994083bce7398eee0a3edc017a9d Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Mon, 16 Dec 2013 22:22:56 +0100 Subject: Recherches spéciales intitle: ou inurl: ou author: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Permet de chercher en utilisant intitle: ou inurl: ou author: comme dans certains moteurs de recherche. Pour l'instant, un seul de ces mots clefs à la fois peut être spécifié en tout début de chaîne de recherche et sera appliqué à l'ensemble du reste de la recherche. NB: À ajouter à la documentation, wiki --- app/Models/EntryDAO.php | 37 +++++++++++++++++++++++++++++++++---- 1 file changed, 33 insertions(+), 4 deletions(-) diff --git a/app/Models/EntryDAO.php b/app/Models/EntryDAO.php index d1f595d42..c9989622a 100644 --- a/app/Models/EntryDAO.php +++ b/app/Models/EntryDAO.php @@ -313,17 +313,46 @@ class FreshRSS_EntryDAO extends Minz_ModelPdo { if ($filter !== '') { $filter = trim($filter); $filter = addcslashes($filter, '\\%_'); + if (stripos($filter, 'intitle:') === 0) { + $filter = substr($filter, strlen('intitle:')); + $intitle = true; + } else { + $intitle = false; + } + if (stripos($filter, 'inurl:') === 0) { + $filter = substr($filter, strlen('inurl:')); + $inurl = true; + } else { + $inurl = false; + } + if (stripos($filter, 'author:') === 0) { + $filter = substr($filter, strlen('author:')); + $author = true; + } else { + $author = false; + } $terms = array_unique(explode(' ', $filter)); sort($terms); //Put #tags first foreach ($terms as $word) { $word = trim($word); if (strlen($word) > 0) { - if ($word[0] === '#' && isset($word[1])) { - $search .= 'AND e1.tags LIKE ? '; + if ($intitle) { + $search .= 'AND e1.title LIKE ? '; $values[] = '%' . $word .'%'; - } else { - $search .= 'AND CONCAT(e1.title, UNCOMPRESS(e1.content_bin)) LIKE ? '; + } elseif ($inurl) { + $search .= 'AND CONCAT(e1.link, e1.guid) LIKE ? '; $values[] = '%' . $word .'%'; + } elseif ($author) { + $search .= 'AND e1.author LIKE ? '; + $values[] = '%' . $word .'%'; + } else { + if ($word[0] === '#' && isset($word[1])) { + $search .= 'AND e1.tags LIKE ? '; + $values[] = '%' . $word .'%'; + } else { + $search .= 'AND CONCAT(e1.title, UNCOMPRESS(e1.content_bin)) LIKE ? '; + $values[] = '%' . $word .'%'; + } } } } -- cgit v1.2.3 From 8f002eb042d06abc464466bdc4cacb37b63a8f7e Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Wed, 18 Dec 2013 22:44:52 +0100 Subject: CSS : style pour les titres trop longs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit En réponse à https://github.com/marienfressinaud/FreshRSS/pull/322 --- public/themes/default/freshrss.css | 6 ++++++ public/themes/flat-design/freshrss.css | 9 +++++++++ 2 files changed, 15 insertions(+) diff --git a/public/themes/default/freshrss.css b/public/themes/default/freshrss.css index a4abbf22b..4fe028e3c 100644 --- a/public/themes/default/freshrss.css +++ b/public/themes/default/freshrss.css @@ -286,6 +286,12 @@ overflow: hidden; white-space: nowrap; text-overflow: ellipsis; + } + .flux .item.title:hover { + background: #FFF; + overflow: visible; + padding-right: 1.5em; + position: absolute; } .flux .item.title a { color: #000; diff --git a/public/themes/flat-design/freshrss.css b/public/themes/flat-design/freshrss.css index 7ce67ef22..cecb4cc06 100644 --- a/public/themes/flat-design/freshrss.css +++ b/public/themes/flat-design/freshrss.css @@ -220,6 +220,9 @@ body { .flux { border-left: 3px solid #ecf0f1; } + .flux:hover { + background: #fff; + } .flux.not_read { border-left-color: #FF5300; background: #FFF3ED; @@ -265,6 +268,12 @@ body { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; + } + .flux .item.title:hover { + background: #FFF; + overflow: visible; + padding-right: 1.5em; + position: absolute; } .flux .item.title a { color: #333; -- cgit v1.2.3 From 5c779a09eb32507fb85e96d647ed1358a93678f2 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Wed, 18 Dec 2013 22:52:45 +0100 Subject: CSS : style pour les titres trop longs (correction) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Correction de https://github.com/marienfressinaud/FreshRSS/commit/8f002eb042d06abc464466bdc4cacb37b63a8f7e En réponse à https://github.com/marienfressinaud/FreshRSS/pull/322 --- public/themes/default/freshrss.css | 5 +++-- public/themes/flat-design/freshrss.css | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/public/themes/default/freshrss.css b/public/themes/default/freshrss.css index 4fe028e3c..ed5f35ba6 100644 --- a/public/themes/default/freshrss.css +++ b/public/themes/default/freshrss.css @@ -251,6 +251,7 @@ } .flux_header { + background: inherit; height: 25px; font-size: 12px; border-top: 1px solid #ddd; @@ -283,15 +284,15 @@ height: 40px; } .flux .item.title { + background: inherit; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; } .flux .item.title:hover { - background: #FFF; overflow: visible; - padding-right: 1.5em; position: absolute; + padding-right: 1.5em; } .flux .item.title a { color: #000; diff --git a/public/themes/flat-design/freshrss.css b/public/themes/flat-design/freshrss.css index cecb4cc06..055e8bf8b 100644 --- a/public/themes/flat-design/freshrss.css +++ b/public/themes/flat-design/freshrss.css @@ -237,6 +237,7 @@ body { } .flux_header { + background: inherit; height: 25px; font-size: 12px; border-top: 1px solid #ecf0f1; @@ -265,15 +266,15 @@ body { padding: 5px; } .flux .item.title { + background: inherit; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; } .flux .item.title:hover { - background: #FFF; overflow: visible; - padding-right: 1.5em; position: absolute; + padding-right: 1.5em; } .flux .item.title a { color: #333; -- cgit v1.2.3 From 3280b14ed6208a672c4c86878e3b80e3fcb14c32 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Wed, 18 Dec 2013 23:49:51 +0100 Subject: CSS : style pour les titres trop long (corrections 2) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Correction de https://github.com/marienfressinaud/FreshRSS/commit/5c779a09eb32507fb85e96d647ed1358a93678f2 En réponse à https://github.com/marienfressinaud/FreshRSS/pull/322 --- public/scripts/main.js | 4 ++-- public/themes/default/freshrss.css | 4 ++-- public/themes/flat-design/freshrss.css | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/public/scripts/main.js b/public/scripts/main.js index 022e0f86f..3bd23a669 100644 --- a/public/scripts/main.js +++ b/public/scripts/main.js @@ -388,9 +388,9 @@ function init_shortcuts() { } function init_stream_delegates(divStream) { - divStream.on('click', '.flux_header>.item.title, .flux_header>.item.date', function (e) { //flux_header_toggle + divStream.on('click', '.flux_header', function (e) { //flux_header_toggle var old_active = $(".flux.current"), - new_active = $(this).parent().parent(); + new_active = $(this).parent(); isCollapsed = true; if (e.target.tagName.toUpperCase() === 'A') { //Leave real links alone if (auto_mark_article) { diff --git a/public/themes/default/freshrss.css b/public/themes/default/freshrss.css index ed5f35ba6..b53702c07 100644 --- a/public/themes/default/freshrss.css +++ b/public/themes/default/freshrss.css @@ -289,10 +289,10 @@ white-space: nowrap; text-overflow: ellipsis; } - .flux .item.title:hover { + .flux:hover .item.title { overflow: visible; - position: absolute; padding-right: 1.5em; + position: absolute; } .flux .item.title a { color: #000; diff --git a/public/themes/flat-design/freshrss.css b/public/themes/flat-design/freshrss.css index 055e8bf8b..bbe477c04 100644 --- a/public/themes/flat-design/freshrss.css +++ b/public/themes/flat-design/freshrss.css @@ -271,10 +271,10 @@ body { white-space: nowrap; text-overflow: ellipsis; } - .flux .item.title:hover { + .flux:hover .item.title { overflow: visible; - position: absolute; padding-right: 1.5em; + position: absolute; } .flux .item.title a { color: #333; -- cgit v1.2.3 From 6b7d96d0ea97579720ee6d560224cd80c2329d07 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Thu, 19 Dec 2013 21:19:45 +0100 Subject: Refactorisation : correction classes oubliées MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Controllers/indexController.php | 6 +++--- app/Models/CategoryDAO.php | 16 +++++++--------- app/Models/EntryDAO.php | 8 +++----- app/Models/FeedDAO.php | 12 +++++------- app/views/helpers/view/normal_view.phtml | 2 +- app/views/helpers/view/reader_view.phtml | 2 +- 6 files changed, 20 insertions(+), 26 deletions(-) diff --git a/app/Controllers/indexController.php b/app/Controllers/indexController.php index 22c5683ea..e3c253518 100755 --- a/app/Controllers/indexController.php +++ b/app/Controllers/indexController.php @@ -77,7 +77,7 @@ class FreshRSS_index_Controller extends Minz_ActionController { return; } - $this->view->nb_not_read = HelperCategory::CountUnreads($this->view->cat_aside, 1); + $this->view->nb_not_read = FreshRSS_CategoryDAO::CountUnreads($this->view->cat_aside, 1); // mise à jour des titres $this->view->rss_title = $this->view->currentName . ' | ' . Minz_View::title(); @@ -112,7 +112,7 @@ class FreshRSS_index_Controller extends Minz_ActionController { $hasUnread = (!isset($this->view->cat_aside[$getId])) || ($this->view->cat_aside[$getId]->nbNotRead() > 0); break; case 'f': - $myFeed = HelperCategory::findFeed($this->view->cat_aside, $getId); + $myFeed = FreshRSS_CategoryDAO::findFeed($this->view->cat_aside, $getId); $hasUnread = ($myFeed === null) || ($myFeed->nbNotRead() > 0); break; default: @@ -188,7 +188,7 @@ class FreshRSS_index_Controller extends Minz_ActionController { return false; } case 'f': - $feed = HelperCategory::findFeed($this->view->cat_aside, $getId); + $feed = FreshRSS_CategoryDAO::findFeed($this->view->cat_aside, $getId); if (empty($feed)) { $feed = $this->feedDAO->searchById ($getId); } diff --git a/app/Models/CategoryDAO.php b/app/Models/CategoryDAO.php index 793e593c3..3a810e9f0 100644 --- a/app/Models/CategoryDAO.php +++ b/app/Models/CategoryDAO.php @@ -60,7 +60,7 @@ class FreshRSS_CategoryDAO extends Minz_ModelPdo { $stm->execute ($values); $res = $stm->fetchAll (PDO::FETCH_ASSOC); - $cat = HelperCategory::daoToCategory ($res); + $cat = self::daoToCategory ($res); if (isset ($cat[0])) { return $cat[0]; @@ -76,7 +76,7 @@ class FreshRSS_CategoryDAO extends Minz_ModelPdo { $stm->execute ($values); $res = $stm->fetchAll (PDO::FETCH_ASSOC); - $cat = HelperCategory::daoToCategory ($res); + $cat = self::daoToCategory ($res); if (isset ($cat[0])) { return $cat[0]; @@ -96,12 +96,12 @@ class FreshRSS_CategoryDAO extends Minz_ModelPdo { . 'ORDER BY c.name, f.name'; $stm = $this->bd->prepare ($sql); $stm->execute (); - return HelperCategory::daoToCategoryPrepopulated ($stm->fetchAll (PDO::FETCH_ASSOC)); + return self::daoToCategoryPrepopulated ($stm->fetchAll (PDO::FETCH_ASSOC)); } else { $sql = 'SELECT * FROM `' . $this->prefix . 'category` ORDER BY name'; $stm = $this->bd->prepare ($sql); $stm->execute (); - return HelperCategory::daoToCategory ($stm->fetchAll (PDO::FETCH_ASSOC)); + return self::daoToCategory ($stm->fetchAll (PDO::FETCH_ASSOC)); } } @@ -111,7 +111,7 @@ class FreshRSS_CategoryDAO extends Minz_ModelPdo { $stm->execute (); $res = $stm->fetchAll (PDO::FETCH_ASSOC); - $cat = HelperCategory::daoToCategory ($res); + $cat = self::daoToCategory ($res); if (isset ($cat[0])) { return $cat[0]; @@ -164,9 +164,7 @@ class FreshRSS_CategoryDAO extends Minz_ModelPdo { return $res[0]['count']; } -} -class HelperCategory { public static function findFeed($categories, $feed_id) { foreach ($categories as $category) { foreach ($category->feeds () as $feed) { @@ -205,7 +203,7 @@ class HelperCategory { $cat = new FreshRSS_Category ( $previousLine['c_name'], isset($previousLine['c_color']) ? $previousLine['c_color'] : '', - HelperFeed::daoToFeed ($feedsDao, $previousLine['c_id']) + FreshRSS_FeedDAO::daoToFeed ($feedsDao, $previousLine['c_id']) ); $cat->_id ($previousLine['c_id']); $list[$previousLine['c_id']] = $cat; @@ -222,7 +220,7 @@ class HelperCategory { $cat = new FreshRSS_Category ( $previousLine['c_name'], isset($previousLine['c_color']) ? $previousLine['c_color'] : '', - HelperFeed::daoToFeed ($feedsDao, $previousLine['c_id']) + FreshRSS_FeedDAO::daoToFeed ($feedsDao, $previousLine['c_id']) ); $cat->_id ($previousLine['c_id']); $list[$previousLine['c_id']] = $cat; diff --git a/app/Models/EntryDAO.php b/app/Models/EntryDAO.php index c9989622a..d8bc869ae 100644 --- a/app/Models/EntryDAO.php +++ b/app/Models/EntryDAO.php @@ -242,7 +242,7 @@ class FreshRSS_EntryDAO extends Minz_ModelPdo { $stm->execute ($values); $res = $stm->fetchAll (PDO::FETCH_ASSOC); - $entries = HelperEntry::daoToEntry ($res); + $entries = self::daoToEntry ($res); return isset ($entries[0]) ? $entries[0] : false; } @@ -255,7 +255,7 @@ class FreshRSS_EntryDAO extends Minz_ModelPdo { $stm->execute ($values); $res = $stm->fetchAll (PDO::FETCH_ASSOC); - $entries = HelperEntry::daoToEntry ($res); + $entries = self::daoToEntry ($res); return isset ($entries[0]) ? $entries[0] : false; } @@ -372,7 +372,7 @@ class FreshRSS_EntryDAO extends Minz_ModelPdo { $stm = $this->bd->prepare ($sql); $stm->execute ($values); - return HelperEntry::daoToEntry ($stm->fetchAll (PDO::FETCH_ASSOC)); + return self::daoToEntry ($stm->fetchAll (PDO::FETCH_ASSOC)); } public function listLastGuidsByFeed($id, $n) { @@ -430,9 +430,7 @@ class FreshRSS_EntryDAO extends Minz_ModelPdo { $stm = $this->bd->prepare ($sql); $stm->execute (); } -} -class HelperEntry { public static function daoToEntry ($listDAO) { $list = array (); diff --git a/app/Models/FeedDAO.php b/app/Models/FeedDAO.php index 8f59b1c76..9ebea4a47 100644 --- a/app/Models/FeedDAO.php +++ b/app/Models/FeedDAO.php @@ -158,7 +158,7 @@ class FreshRSS_FeedDAO extends Minz_ModelPdo { $stm->execute ($values); $res = $stm->fetchAll (PDO::FETCH_ASSOC); - $feed = HelperFeed::daoToFeed ($res); + $feed = self::daoToFeed ($res); if (isset ($feed[$id])) { return $feed[$id]; @@ -174,7 +174,7 @@ class FreshRSS_FeedDAO extends Minz_ModelPdo { $stm->execute ($values); $res = $stm->fetchAll (PDO::FETCH_ASSOC); - $feed = current (HelperFeed::daoToFeed ($res)); + $feed = current (self::daoToFeed ($res)); if (isset ($feed)) { return $feed; @@ -188,7 +188,7 @@ class FreshRSS_FeedDAO extends Minz_ModelPdo { $stm = $this->bd->prepare ($sql); $stm->execute (); - return HelperFeed::daoToFeed ($stm->fetchAll (PDO::FETCH_ASSOC)); + return self::daoToFeed ($stm->fetchAll (PDO::FETCH_ASSOC)); } public function listFeedsOrderUpdate () { @@ -196,7 +196,7 @@ class FreshRSS_FeedDAO extends Minz_ModelPdo { $stm = $this->bd->prepare ($sql); $stm->execute (); - return HelperFeed::daoToFeed ($stm->fetchAll (PDO::FETCH_ASSOC)); + return self::daoToFeed ($stm->fetchAll (PDO::FETCH_ASSOC)); } public function listByCategory ($cat) { @@ -207,7 +207,7 @@ class FreshRSS_FeedDAO extends Minz_ModelPdo { $stm->execute ($values); - return HelperFeed::daoToFeed ($stm->fetchAll (PDO::FETCH_ASSOC)); + return self::daoToFeed ($stm->fetchAll (PDO::FETCH_ASSOC)); } public function countEntries ($id) { @@ -299,9 +299,7 @@ class FreshRSS_FeedDAO extends Minz_ModelPdo { return false; } } -} -class HelperFeed { public static function daoToFeed ($listDAO, $catID = null) { $list = array (); diff --git a/app/views/helpers/view/normal_view.phtml b/app/views/helpers/view/normal_view.phtml index d5328651d..f21a2bdd9 100644 --- a/app/views/helpers/view/normal_view.phtml +++ b/app/views/helpers/view/normal_view.phtml @@ -62,7 +62,7 @@ if (!empty($this->entries)) { ?>cat_aside, $item->feed ()); //We most likely already have the feed object in cache + $feed = FreshRSS_CategoryDAO::findFeed($this->cat_aside, $item->feed ()); //We most likely already have the feed object in cache if (empty($feed)) $feed = $item->feed (true); ?>
  • ✇ name(); ?>
  • diff --git a/app/views/helpers/view/reader_view.phtml b/app/views/helpers/view/reader_view.phtml index 29b2be04c..e28af6ade 100644 --- a/app/views/helpers/view/reader_view.phtml +++ b/app/views/helpers/view/reader_view.phtml @@ -11,7 +11,7 @@ if (!empty($this->entries)) {
    cat_aside, $item->feed ()); //We most likely already have the feed object in cache + $feed = FreshRSS_CategoryDAO::findFeed($this->cat_aside, $item->feed ()); //We most likely already have the feed object in cache if (empty($feed)) $feed = $item->feed (true); ?> -- cgit v1.2.3 From 6ff4845a47b2e8ccc72c912585de435ca967031b Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Thu, 19 Dec 2013 21:29:55 +0100 Subject: Install : début de mise à jour MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit https://github.com/marienfressinaud/FreshRSS/issues/255 Et majuscule au répertoire Minz --- public/install.php | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 52 insertions(+), 2 deletions(-) diff --git a/public/install.php b/public/install.php index a8a9c93fb..026e9098c 100644 --- a/public/install.php +++ b/public/install.php @@ -265,7 +265,7 @@ function checkStep0 () { } function checkStep1 () { $php = version_compare (PHP_VERSION, '5.2.0') >= 0; - $minz = file_exists (LIB_PATH . '/minz'); + $minz = file_exists (LIB_PATH . '/Minz'); $curl = extension_loaded ('curl'); $pdo = extension_loaded ('pdo_mysql'); $dom = class_exists('DOMDocument'); @@ -287,7 +287,54 @@ function checkStep1 () { 'all' => $php && $minz && $curl && $pdo && $dom && $data && $cache && $log && $favicons ? 'ok' : 'ko' ); } + +function moveOldFiles() { + $mvs = array( + '/app/configuration/application.ini' => '/data/application.ini', + '/public/data/Configuration.array.php' => '/data/Configuration.array.php', + ); + $ok = true; + foreach ($mvs as $fFrom => $fTo) { + if (file_exists(FRESHRSS_PATH . $fFrom)) { + if (copy(FRESHRSS_PATH . $fFrom, FRESHRSS_PATH . $fTo)) { + @unlink(FRESHRSS_PATH . $fFrom); + } else { + $ok = false; + } + } + } + return $ok; +} + +function delTree($dir) { //http://php.net/rmdir#110489 + if (!is_dir($dir)) { + return true; + } + $files = array_diff(scandir($dir), array('.', '..')); + foreach ($files as $file) { + $f = $dir . '/' . $file; + if (is_dir($f)) { + @chmod($f, 0777); + delTree($f); + } + else unlink($f); + } + return rmdir($dir); +} + +function removeOldFiles() { + $oldDirs = array('/app/configuration/', '/cache/', '/log/', '/public/data/', '/public/themes/printer/'); + + $ok = true; + foreach ($oldDirs as $oldDir) { + $ok &= delTree(FRESHRSS_PATH . $oldDir); + } + return $ok; +} + function checkStep2 () { + moveOldFiles() && removeOldFiles(); + $conf = isset ($_SESSION['sel']) && isset ($_SESSION['base_url']) && isset ($_SESSION['title']) && @@ -299,6 +346,9 @@ function checkStep2 () { $defaultUser = empty($_SESSION['default_user']) ? '' : $_SESSION['default_user']; } $data = file_exists (DATA_PATH . '/' . $defaultUser . '_user.php'); + if ($data) { + @unlink(DATA_PATH . '/Configuration.array.php'); //v0.6 + } return array ( 'conf' => $conf ? 'ok' : 'ko', @@ -434,7 +484,7 @@ function printStep1 () {

    -

    +

    -- cgit v1.2.3 From c013ecd0ae37db685d38b4a743f14bd55e437cf6 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Thu, 19 Dec 2013 21:34:13 +0100 Subject: Refactorisation : Minz_Translate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Un préfixe Minz_ oublié --- app/Controllers/configureController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Controllers/configureController.php b/app/Controllers/configureController.php index 62fead315..ef03d9e1d 100755 --- a/app/Controllers/configureController.php +++ b/app/Controllers/configureController.php @@ -363,7 +363,7 @@ class FreshRSS_configure_Controller extends Minz_ActionController { // au niveau de la vue, permet de ne pas voir un flux sélectionné dans la liste $this->view->flux = false; - Minz_View::prependTitle (Translate::t ('import_export_opml') . ' - '); + Minz_View::prependTitle (Minz_Translate::t ('import_export_opml') . ' - '); } public function shortcutAction () { -- cgit v1.2.3 From 1c0e7a49528d1fb972a0fa0e9551d70dc5636442 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Thu, 19 Dec 2013 21:53:21 +0100 Subject: Refactorisation : FreshRSS_Feed MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Un préfixe FreshRSS_ oublié --- app/Controllers/feedController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Controllers/feedController.php b/app/Controllers/feedController.php index 18476d559..27b76dd42 100755 --- a/app/Controllers/feedController.php +++ b/app/Controllers/feedController.php @@ -394,7 +394,7 @@ class FreshRSS_feed_Controller extends Minz_ActionController { 'type' => 'good', 'content' => Minz_Translate::t ('feed_deleted') ); - Feed::faviconDelete($id); + FreshRSS_Feed::faviconDelete($id); } else { $notif = array ( 'type' => 'bad', -- cgit v1.2.3 From daefb8f095f1abe591347e99fcb09ab53701d39d Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Thu, 19 Dec 2013 22:11:58 +0100 Subject: Caractères spéciaux feed->description MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Feed->description est en HTML, il faut protéger les caractères spéciaux lors de certaines sorties. --- app/views/configure/feed.phtml | 2 +- lib/lib_rss.php | 2 +- public/themes/default/freshrss.css | 2 +- public/themes/flat-design/freshrss.css | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/views/configure/feed.phtml b/app/views/configure/feed.phtml index 191e44b9b..4504b8d76 100644 --- a/app/views/configure/feed.phtml +++ b/app/views/configure/feed.phtml @@ -22,7 +22,7 @@
    - +
    diff --git a/lib/lib_rss.php b/lib/lib_rss.php index 2fdfd4bd8..8b64eb7b9 100644 --- a/lib/lib_rss.php +++ b/lib/lib_rss.php @@ -116,7 +116,7 @@ function opml_export ($cats) { $txt .= '' . "\n"; foreach ($cat['feeds'] as $feed) { - $txt .= "\t" . '' . "\n"; + $txt .= "\t" . '' . "\n"; } $txt .= '' . "\n"; diff --git a/public/themes/default/freshrss.css b/public/themes/default/freshrss.css index b53702c07..a63fc44bf 100644 --- a/public/themes/default/freshrss.css +++ b/public/themes/default/freshrss.css @@ -291,7 +291,7 @@ } .flux:hover .item.title { overflow: visible; - padding-right: 1.5em; + padding-right: 2em; position: absolute; } .flux .item.title a { diff --git a/public/themes/flat-design/freshrss.css b/public/themes/flat-design/freshrss.css index bbe477c04..839626227 100644 --- a/public/themes/flat-design/freshrss.css +++ b/public/themes/flat-design/freshrss.css @@ -273,7 +273,7 @@ body { } .flux:hover .item.title { overflow: visible; - padding-right: 1.5em; + padding-right: 2em; position: absolute; } .flux .item.title a { -- cgit v1.2.3 From f3a50c3ce81e547e1e2c723db30c57ec160730ae Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Thu, 19 Dec 2013 22:21:44 +0100 Subject: Import feed->description en HTML MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Ne pas protéger feed->description à l'import OPML, car c'est potentiellement du HTML. Il faudrait faire du sanitize néanmoins. --- lib/lib_rss.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/lib_rss.php b/lib/lib_rss.php index 8b64eb7b9..c7b8b4beb 100644 --- a/lib/lib_rss.php +++ b/lib/lib_rss.php @@ -236,7 +236,7 @@ function getFeed ($outline, $cat_id) { $feed->_website(htmlspecialchars((string)$outline['htmlUrl'], ENT_QUOTES, 'UTF-8')); } if (isset($outline['description'])) { - $feed->_description(htmlspecialchars((string)$outline['description'], ENT_QUOTES, 'UTF-8')); + $feed->_description((string)$outline['description']); } return $feed; } -- cgit v1.2.3 From 3dc50cbd6627f9dfeb35c8e656eaf35f1f77495a Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Thu, 19 Dec 2013 23:32:24 +0100 Subject: Compatibilité contenu HTML pour Feed->description MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Implémente https://github.com/marienfressinaud/FreshRSS/issues/325 --- app/Controllers/configureController.php | 2 +- lib/lib_rss.php | 18 +++++++++++++----- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/app/Controllers/configureController.php b/app/Controllers/configureController.php index ef03d9e1d..8d3e02d3e 100755 --- a/app/Controllers/configureController.php +++ b/app/Controllers/configureController.php @@ -94,7 +94,7 @@ class FreshRSS_configure_Controller extends Minz_ActionController { } else { if (Minz_Request::isPost () && $this->view->flux) { $name = Minz_Request::param ('name', ''); - $description = Minz_Request::param('description', ''); + $description = sanitizeHTML(Minz_Request::param('description', '', true)); $website = Minz_Request::param('website', ''); $url = Minz_Request::param('url', ''); $hist = Minz_Request::param ('keep_history', 'no'); diff --git a/lib/lib_rss.php b/lib/lib_rss.php index c7b8b4beb..4ef06ddbc 100644 --- a/lib/lib_rss.php +++ b/lib/lib_rss.php @@ -136,6 +136,14 @@ function html_only_entity_decode($text) { return strtr($text, $htmlEntitiesOnly); } +function sanitizeHTML($data) { + static $simplePie = null; + if ($simplePie == null) { + $simplePie = new SimplePie(); + } + return html_only_entity_decode($simplePie->sanitize->sanitize($data, SIMPLEPIE_CONSTRUCT_MAYBE_HTML)); +} + function opml_import ($xml) { $xml = html_only_entity_decode($xml); //!\ Assume UTF-8 @@ -176,7 +184,7 @@ function opml_import ($xml) { // alors qu'il existe déjà la catégorie X mais avec l'id Z // Y ne sera pas ajouté et le flux non plus vu que l'id // de sa catégorie n'exisera pas - $title = htmlspecialchars($title, ENT_QUOTES, 'UTF-8'); + $title = htmlspecialchars($title, ENT_COMPAT, 'UTF-8'); $catDAO = new FreshRSS_CategoryDAO (); $cat = $catDAO->searchByName ($title); if ($cat === false) { @@ -221,22 +229,22 @@ function getFeedsOutline ($outline, $cat_id) { function getFeed ($outline, $cat_id) { $url = (string) $outline['xmlUrl']; - $url = htmlspecialchars($url, ENT_QUOTES, 'UTF-8'); + $url = htmlspecialchars($url, ENT_COMPAT, 'UTF-8'); $title = ''; if (isset ($outline['text'])) { $title = (string) $outline['text']; } elseif (isset ($outline['title'])) { $title = (string) $outline['title']; } - $title = htmlspecialchars($title, ENT_QUOTES, 'UTF-8'); + $title = htmlspecialchars($title, ENT_COMPAT, 'UTF-8'); $feed = new FreshRSS_Feed ($url); $feed->_category ($cat_id); $feed->_name ($title); if (isset($outline['htmlUrl'])) { - $feed->_website(htmlspecialchars((string)$outline['htmlUrl'], ENT_QUOTES, 'UTF-8')); + $feed->_website(htmlspecialchars((string)$outline['htmlUrl'], ENT_COMPAT, 'UTF-8')); } if (isset($outline['description'])) { - $feed->_description((string)$outline['description']); + $feed->_description(sanitizeHTML((string)$outline['description'])); } return $feed; } -- cgit v1.2.3 From 3e64c3689efa42d2d7f82dd40ccad59747b54c63 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Sat, 21 Dec 2013 11:31:38 +0100 Subject: CSS : style titres longs Changements bordure droite https://github.com/marienfressinaud/FreshRSS/pull/322 --- public/themes/default/freshrss.css | 4 ++-- public/themes/flat-design/freshrss.css | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/public/themes/default/freshrss.css b/public/themes/default/freshrss.css index a63fc44bf..e3c4c3c3b 100644 --- a/public/themes/default/freshrss.css +++ b/public/themes/default/freshrss.css @@ -290,8 +290,8 @@ text-overflow: ellipsis; } .flux:hover .item.title { - overflow: visible; - padding-right: 2em; + border-right: 2px solid rgba(127, 127, 127, 0.1); + padding-right: 1em; position: absolute; } .flux .item.title a { diff --git a/public/themes/flat-design/freshrss.css b/public/themes/flat-design/freshrss.css index 839626227..fa1ed13e6 100644 --- a/public/themes/flat-design/freshrss.css +++ b/public/themes/flat-design/freshrss.css @@ -272,8 +272,8 @@ body { text-overflow: ellipsis; } .flux:hover .item.title { - overflow: visible; - padding-right: 2em; + border-right: 2px solid rgba(127, 127, 127, 0.1); + padding-right: 1em; position: absolute; } .flux .item.title a { -- cgit v1.2.3 From 385b5b1b40ee029f6f828c4c3076d2a6949d600c Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Sat, 21 Dec 2013 14:33:21 +0100 Subject: Install.php : permet d'être relancé sur une installation existante en chargeant les paramètres existants MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Contribue à https://github.com/marienfressinaud/FreshRSS/issues/255 Vérifier base_url et token, que je n'ai pas re-testés. --- README.md | 28 +++---- lib/Minz/FrontController.php | 2 +- public/install.php | 194 ++++++++++++++++++++++++------------------- 3 files changed, 124 insertions(+), 100 deletions(-) diff --git a/README.md b/README.md index d2ef8d92f..2eb9ca03a 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ # FreshRSS -FreshRSS est un agrégateur de flux RSS à auto-héberger à l'image de [Leed](http://projet.idleman.fr/leed/) ou de [Kriss Feed](http://tontof.net/kriss/feed/). Il se veut léger et facile à prendre en main tout en étant un outil puissant et paramétrable. +FreshRSS est un agrégateur de flux RSS à auto-héberger à l’image de [Leed](http://projet.idleman.fr/leed/) ou de [Kriss Feed](http://tontof.net/kriss/feed/). Il se veut léger et facile à prendre en main tout en étant un outil puissant et paramétrable. * Site officiel : http://marienfressinaud.github.io/FreshRSS/ * Démo : http://marienfressinaud.fr/projets/freshrss/ @@ -11,9 +11,9 @@ FreshRSS est un agrégateur de flux RSS à auto-héberger à l'image de [Leed](h ![Logo de FreshRSS](http://marienfressinaud.fr/data/images/freshrss/freshrss_title.png) # Disclaimer -Cette application a été développée pour s'adapter à des besoins personnels et non professionels. +Cette application a été développée pour s’adapter à des besoins personnels et non professionels. Je ne garantis en aucun cas la sécurité de celle-ci, ni son bon fonctionnement. -Je m'engage néanmoins à répondre dans la mesure du possible aux demandes d'évolution si celles-ci me semblent justifiées. +Je m’engage néanmoins à répondre dans la mesure du possible aux demandes d’évolution si celles-ci me semblent justifiées. Privilégiez pour cela des demandes sur GitHub (https://github.com/marienfressinaud/FreshRSS/issues) ou par mail (dev@marienfressinaud.fr) @@ -26,20 +26,20 @@ Privilégiez pour cela des demandes sur GitHub * Un navigateur Web récent tel Firefox, Chrome, Opera, Safari, Internet Explorer 9+ * Fonctionne aussi sur mobile -![Capture d'écran de FreshRSS](http://marienfressinaud.fr/data/images/freshrss/freshrss_default-design.png) +![Capture d’écran de FreshRSS](http://marienfressinaud.fr/data/images/freshrss/freshrss_default-design.png) # Installation -1. Récupérez l'application FreshRSS via la commande git ou [en téléchargeant l'archive](https://github.com/marienfressinaud/FreshRSS/archive/master.zip) -2. Déplacez l'application où vous voulez sur votre serveur (attention, la partie accessible se trouve dans le répertoire `./public`) -3. Accédez à FreshRSS à travers votre navigateur web et suivez les instructions d'installation -4. Tout devrait fonctionner :) En cas de problème, n'hésitez pas à me contacter. +1. Récupérez l’application FreshRSS via la commande git ou [en téléchargeant l’archive](https://github.com/marienfressinaud/FreshRSS/archive/master.zip) +2. Placez l’application sur votre serveur (la partie à exposer au Web est le répertoire `./public`) +3. Accédez à FreshRSS à travers votre navigateur Web et suivez les instructions d’installation +4. Tout devrait fonctionner :) En cas de problème, n’hésitez pas à me contacter. -# Sécurité et conseils -1. Pour une meilleure sécurité, faites en sorte que seul le répertoire `./public` soit accessible par le navigateur. Faites pointer un sous-domaine sur le répertoire `./public` par exemple -2. Dans tous les cas, assurez-vous que `./data/application.ini` ne puisse pas être téléchargé ! -3. Le fichier de log peut être utile à lire si vous avez des soucis -4. Le fichier `./public/index.php` défini les chemins d'accès aux répertoires clés de l'application. Si vous les bougez, tout se passe ici. -5. Vous pouvez ajouter une tâche CRON sur le script d'actualisation des flux. Il s'agit d'un script PHP à exécuter avec la commande `php`. Par exemple, pour exécuter le script toutes les heures : +# Conseils +1. Pour une meilleure sécurité, faites en sorte que seul le répertoire `./public` soit accessible depuis le Web, par exemple en faisant pointer un sous-domaine sur le répertoire `./public`. +2. Les données sensibles se trouvent dans le répertoire `./data/` (déjà protégé par un .htaccess pour Apache - vérifiez que cela fonctionne -, à protéger vous-même dans le cas d’autres serveurs Web). +3. En cas de problème, les logs peuvent être utile à lire, soit depuis l’interface de FreshRSS, soit manuellement depuis `./data/log/*.log`. +4. Le fichier `./constants.php` définit les chemins d’accès aux répertoires clés de l’application. Si vous les bougez, tout se passe ici. +5. Vous pouvez ajouter une tâche CRON sur le script d’actualisation des flux. Il s’agit d’un script PHP à exécuter avec la commande `php`. Par exemple, pour exécuter le script toutes les heures : ``` 7 * * * * php /chemin/vers/freshrss/actualize_script.php >/dev/null 2>&1 ``` diff --git a/lib/Minz/FrontController.php b/lib/Minz/FrontController.php index eb9835fe5..8e9c511a6 100644 --- a/lib/Minz/FrontController.php +++ b/lib/Minz/FrontController.php @@ -32,7 +32,7 @@ class Minz_FrontController { */ public function __construct () { if (LOG_PATH === false) { - $this->killApp ('Path doesn\'t exist : LOG_PATH'); + $this->killApp ('Path doesn’t exist : LOG_PATH'); } try { diff --git a/public/install.php b/public/install.php index 026e9098c..8d8613e38 100644 --- a/public/install.php +++ b/public/install.php @@ -88,11 +88,7 @@ function initTranslate () { global $translates; global $actual; - $l = getBetterLanguage ('en'); - if (isset ($_SESSION['language'])) { - $l = $_SESSION['language']; - } - $actual = $l; + $actual = isset($_SESSION['language']) ? $_SESSION['language'] : getBetterLanguage('en'); $file = APP_PATH . '/i18n/' . $actual . '.php'; if (file_exists ($file)) { @@ -148,10 +144,7 @@ function saveStep2 () { return false; } - $_SESSION['sel'] = md5 ( - uniqid (mt_rand (), true).implode ('', stat (__FILE__)) - ); - $_SESSION['base_url'] = addslashes ($_POST['base_url']); + $_SESSION['sel_application'] = sha1(uniqid(mt_rand(), true).implode('', stat(__FILE__))); $_SESSION['title'] = addslashes ($_POST['title']); $_SESSION['old_entries'] = $_POST['old_entries']; if (!is_int (intval ($_SESSION['old_entries'])) || @@ -163,8 +156,7 @@ function saveStep2 () { $token = ''; if ($_SESSION['mail_login']) { - $token = small_hash (time () . $_SESSION['sel']) - . small_hash ($_SESSION['base_url'] . $_SESSION['sel']); + $token = sha1($_SESSION['sel_application'] . $_SESSION['mail_login']); } $file_data = DATA_PATH . '/' . $_SESSION['default_user'] . '_user.php'; @@ -196,25 +188,25 @@ function saveStep3 () { $_SESSION['bd_type'] = isset ($_POST['type']) ? $_POST['type'] : 'mysql'; $_SESSION['bd_host'] = addslashes ($_POST['host']); $_SESSION['bd_user'] = addslashes ($_POST['user']); - $_SESSION['bd_pass'] = addslashes ($_POST['pass']); - $_SESSION['bd_name'] = addslashes ($_POST['base']); + $_SESSION['bd_password'] = addslashes ($_POST['pass']); + $_SESSION['bd_base'] = addslashes ($_POST['base']); $_SESSION['bd_prefix'] = addslashes ($_POST['prefix']); $file_conf = DATA_PATH . '/application.ini'; $f = fopen ($file_conf, 'w'); writeLine ($f, '[general]'); - writeLine ($f, 'environment = "production"'); + writeLine ($f, 'environment = "' . empty($_SESSION['environment']) ? 'production' : $_SESSION['environment'] . '"'); writeLine ($f, 'use_url_rewriting = false'); - writeLine ($f, 'sel_application = "' . $_SESSION['sel'] . '"'); - writeLine ($f, 'base_url = "' . $_SESSION['base_url'] . '"'); + writeLine ($f, 'sel_application = "' . $_SESSION['sel_application'] . '"'); + writeLine ($f, 'base_url = ""'); writeLine ($f, 'title = "' . $_SESSION['title'] . '"'); writeLine ($f, 'default_user = "' . $_SESSION['default_user'] . '"'); writeLine ($f, '[db]'); writeLine ($f, 'type = "' . $_SESSION['bd_type'] . '"'); writeLine ($f, 'host = "' . $_SESSION['bd_host'] . '"'); writeLine ($f, 'user = "' . $_SESSION['bd_user'] . '"'); - writeLine ($f, 'password = "' . $_SESSION['bd_pass'] . '"'); - writeLine ($f, 'base = "' . $_SESSION['bd_name'] . '"'); + writeLine ($f, 'password = "' . $_SESSION['bd_password'] . '"'); + writeLine ($f, 'base = "' . $_SESSION['bd_base'] . '"'); writeLine ($f, 'prefix = "' . $_SESSION['bd_prefix'] . '"'); fclose ($f); @@ -237,6 +229,50 @@ function deleteInstall () { } } +function moveOldFiles() { + $mvs = array( + '/app/configuration/application.ini' => '/data/application.ini', //v0.6 + '/public/data/Configuration.array.php' => '/data/Configuration.array.php', //v0.6 + ); + $ok = true; + foreach ($mvs as $fFrom => $fTo) { + if (file_exists(FRESHRSS_PATH . $fFrom)) { + if (copy(FRESHRSS_PATH . $fFrom, FRESHRSS_PATH . $fTo)) { + @unlink(FRESHRSS_PATH . $fFrom); + } else { + $ok = false; + } + } + } + return $ok; +} + +function delTree($dir) { //http://php.net/rmdir#110489 + if (!is_dir($dir)) { + return true; + } + $files = array_diff(scandir($dir), array('.', '..')); + foreach ($files as $file) { + $f = $dir . '/' . $file; + if (is_dir($f)) { + @chmod($f, 0777); + delTree($f); + } + else unlink($f); + } + return rmdir($dir); +} + +function removeOldFiles() { + $oldDirs = array('/app/configuration/', '/cache/', '/log/', '/public/data/', '/public/themes/printer/'); //v0.6 + + $ok = true; + foreach ($oldDirs as $oldDir) { + $ok &= delTree(FRESHRSS_PATH . $oldDir); + } + return $ok; +} + /*** VÉRIFICATIONS ***/ function checkStep () { $s0 = checkStep0 (); @@ -254,6 +290,47 @@ function checkStep () { } } function checkStep0 () { + moveOldFiles() && removeOldFiles(); + + if (file_exists(DATA_PATH . '/application.ini')) { + $ini_array = parse_ini_file(DATA_PATH . '/application.ini', true); + if ($ini_array) { + $ini_general = isset($ini_array['general']) ? $ini_array['general'] : null; + if ($ini_general) { + $keys = array('environment', 'sel_application', 'title', 'default_user'); + foreach ($keys as $key) { + if ((empty($_SESSION[$key])) && isset($ini_general[$key])) { + $_SESSION[$key] = $ini_general[$key]; + } + } + } + $ini_db = isset($ini_array['db']) ? $ini_array['db'] : null; + if ($ini_db) { + $keys = array('type', 'host', 'user', 'password', 'base', 'prefix'); + foreach ($keys as $key) { + if ((!isset($_SESSION['bd_' . $key])) && isset($ini_db[$key])) { + $_SESSION['bd_' . $key] = $ini_db[$key]; + } + } + } + } + } + + if (isset($_SESSION['default_user']) && file_exists(DATA_PATH . '/' . $_SESSION['default_user'] . '_user.php')) { + $userConfig = include(DATA_PATH . '/' . $_SESSION['default_user'] . '_user.php'); + } elseif (file_exists(DATA_PATH . '/Configuration.array.php')) { + $userConfig = include(DATA_PATH . '/Configuration.array.php'); //v0.6 + } else { + $userConfig = array(); + } + + $keys = array('language', 'old_entries', 'mail_login'); + foreach ($keys as $key) { + if ((!isset($_SESSION[$key])) && isset($userConfig[$key])) { + $_SESSION[$key] = $userConfig[$key]; + } + } + $languages = availableLanguages (); $language = isset ($_SESSION['language']) && isset ($languages[$_SESSION['language']]); @@ -288,55 +365,8 @@ function checkStep1 () { ); } -function moveOldFiles() { - $mvs = array( - '/app/configuration/application.ini' => '/data/application.ini', - '/public/data/Configuration.array.php' => '/data/Configuration.array.php', - ); - $ok = true; - foreach ($mvs as $fFrom => $fTo) { - if (file_exists(FRESHRSS_PATH . $fFrom)) { - if (copy(FRESHRSS_PATH . $fFrom, FRESHRSS_PATH . $fTo)) { - @unlink(FRESHRSS_PATH . $fFrom); - } else { - $ok = false; - } - } - } - return $ok; -} - -function delTree($dir) { //http://php.net/rmdir#110489 - if (!is_dir($dir)) { - return true; - } - $files = array_diff(scandir($dir), array('.', '..')); - foreach ($files as $file) { - $f = $dir . '/' . $file; - if (is_dir($f)) { - @chmod($f, 0777); - delTree($f); - } - else unlink($f); - } - return rmdir($dir); -} - -function removeOldFiles() { - $oldDirs = array('/app/configuration/', '/cache/', '/log/', '/public/data/', '/public/themes/printer/'); - - $ok = true; - foreach ($oldDirs as $oldDir) { - $ok &= delTree(FRESHRSS_PATH . $oldDir); - } - return $ok; -} - function checkStep2 () { - moveOldFiles() && removeOldFiles(); - - $conf = isset ($_SESSION['sel']) && - isset ($_SESSION['base_url']) && + $conf = isset ($_SESSION['sel_application']) && isset ($_SESSION['title']) && isset ($_SESSION['old_entries']) && isset ($_SESSION['mail_login']) && @@ -358,11 +388,13 @@ function checkStep2 () { } function checkStep3 () { $conf = file_exists (DATA_PATH . '/application.ini'); + $bd = isset ($_SESSION['bd_type']) && isset ($_SESSION['bd_host']) && isset ($_SESSION['bd_user']) && - isset ($_SESSION['bd_pass']) && - isset ($_SESSION['bd_name']); + isset ($_SESSION['bd_password']) && + isset ($_SESSION['bd_base']) && + isset ($_SESSION['bd_prefix']); $conn = !isset ($_SESSION['bd_error']) || !$_SESSION['bd_error']; return array ( @@ -387,21 +419,21 @@ function checkBD () { $str = 'mysql:host=' . $_SESSION['bd_host'] . ';'; $c = new PDO ($str, $_SESSION['bd_user'], - $_SESSION['bd_pass'], + $_SESSION['bd_password'], $driver_options); - $sql = sprintf (SQL_REQ_CREATE_DB, $_SESSION['bd_name']); + $sql = sprintf (SQL_REQ_CREATE_DB, $_SESSION['bd_base']); $res = $c->query ($sql); // on écrase la précédente connexion en sélectionnant la nouvelle BDD - $str = 'mysql:host=' . $_SESSION['bd_host'] . ';dbname=' . $_SESSION['bd_name']; + $str = 'mysql:host=' . $_SESSION['bd_host'] . ';dbname=' . $_SESSION['bd_base']; } elseif($_SESSION['bd_type'] == 'sqlite') { - $str = 'sqlite:' . DATA_PATH . $_SESSION['bd_name'] . '.sqlite'; + $str = 'sqlite:' . DATA_PATH . $_SESSION['bd_base'] . '.sqlite'; } $c = new PDO ($str, $_SESSION['bd_user'], - $_SESSION['bd_pass'], + $_SESSION['bd_password'], $driver_options); $sql = sprintf (SQL_REQ_CAT, $_SESSION['bd_prefix_user']); @@ -549,13 +581,6 @@ function printStep2 () { -
    @@ -643,14 +668,14 @@ function printStep3 () {
    - +
    - +
    @@ -687,10 +712,10 @@ function printStep5 () { - -- cgit v1.2.3 From 7ad124c69f774a96663132b24c8e309142d57b01 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Sun, 22 Dec 2013 04:40:22 +0100 Subject: Mise à jour possible depuis la v0.6 vers la v0.7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Implémente https://github.com/marienfressinaud/FreshRSS/issues/255 Il manque un peu de i18n et un peu de test, mais le gros est fait. --- public/install.php | 377 +++++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 295 insertions(+), 82 deletions(-) diff --git a/public/install.php b/public/install.php index 8d8613e38..2823a269a 100644 --- a/public/install.php +++ b/public/install.php @@ -10,61 +10,125 @@ if (isset ($_GET['step'])) { define ('STEP', 1); } -define ('SQL_REQ_CREATE_DB', 'CREATE DATABASE %s DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;'); - -define ('SQL_REQ_CAT', 'CREATE TABLE IF NOT EXISTS `%scategory` ( - `id` SMALLINT NOT NULL AUTO_INCREMENT, -- v0.7 - `name` varchar(255) NOT NULL, - `color` char(7) NOT NULL, - PRIMARY KEY (`id`), - UNIQUE KEY (`name`) -- v0.7 +define ('SQL_CREATE_DB', 'CREATE DATABASE %1$s DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;'); + +define ('SQL_CAT', 'CREATE TABLE IF NOT EXISTS `%1$scategory` ( + `id` SMALLINT NOT NULL AUTO_INCREMENT, -- v0.7 + `name` varchar(255) NOT NULL, + `color` char(7), + PRIMARY KEY (`id`), + UNIQUE KEY (`name`) -- v0.7 ) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = INNODB;'); -define ('SQL_REQ_FEED', 'CREATE TABLE IF NOT EXISTS `%sfeed` ( - `id` SMALLINT NOT NULL AUTO_INCREMENT, -- v0.7 - `url` varchar(511) CHARACTER SET latin1 NOT NULL, - `category` SMALLINT DEFAULT 0, -- v0.7 - `name` varchar(255) NOT NULL, - `website` varchar(255) CHARACTER SET latin1 NOT NULL, - `description` text NOT NULL, - `lastUpdate` int(11) NOT NULL, - `priority` tinyint(2) NOT NULL DEFAULT 10, - `pathEntries` varchar(511) DEFAULT NULL, - `httpAuth` varchar(511) DEFAULT NULL, - `error` boolean NOT NULL DEFAULT 0, - `keep_history` boolean NOT NULL DEFAULT 0, - `cache_nbEntries` int NOT NULL DEFAULT 0, -- v0.7 - `cache_nbUnreads` int NOT NULL DEFAULT 0, -- v0.7 - PRIMARY KEY (`id`), - FOREIGN KEY (`category`) REFERENCES `%scategory`(`id`) ON DELETE SET NULL ON UPDATE CASCADE, - UNIQUE KEY (`url`), -- v0.7 - INDEX (`name`), -- v0.7 - INDEX (`priority`), -- v0.7 - INDEX (`keep_history`) -- v0.7 +define ('SQL_FEED', 'CREATE TABLE IF NOT EXISTS `%1$sfeed` ( + `id` SMALLINT NOT NULL AUTO_INCREMENT, -- v0.7 + `url` varchar(511) CHARACTER SET latin1 NOT NULL, + `category` SMALLINT DEFAULT 0, -- v0.7 + `name` varchar(255) NOT NULL, + `website` varchar(255) CHARACTER SET latin1, + `description` text, + `lastUpdate` int(11) DEFAULT 0, + `priority` tinyint(2) NOT NULL DEFAULT 10, + `pathEntries` varchar(511) DEFAULT NULL, + `httpAuth` varchar(511) DEFAULT NULL, + `error` boolean DEFAULT 0, + `keep_history` boolean NOT NULL DEFAULT 0, + `cache_nbEntries` int DEFAULT 0, -- v0.7 + `cache_nbUnreads` int DEFAULT 0, -- v0.7 + PRIMARY KEY (`id`), + FOREIGN KEY (`category`) REFERENCES `%1$scategory`(`id`) ON DELETE SET NULL ON UPDATE CASCADE, + UNIQUE KEY (`url`), -- v0.7 + INDEX (`name`), -- v0.7 + INDEX (`priority`), -- v0.7 + INDEX (`keep_history`) -- v0.7 ) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = INNODB;'); -define ('SQL_REQ_ENTRY', 'CREATE TABLE IF NOT EXISTS `%sentry` ( - `id` bigint NOT NULL, -- v0.7 - `guid` varchar(760) CHARACTER SET latin1 NOT NULL, -- Maximum for UNIQUE is 767B - `title` varchar(255) NOT NULL, - `author` varchar(255) NOT NULL, - `content_bin` blob NOT NULL, -- v0.7 - `link` varchar(1023) CHARACTER SET latin1 NOT NULL, - `date` int(11) NOT NULL, - `is_read` boolean NOT NULL DEFAULT 0, - `is_favorite` boolean NOT NULL DEFAULT 0, - `id_feed` SMALLINT NOT NULL, -- v0.7 - `tags` varchar(1023) NOT NULL, - PRIMARY KEY (`id`), - FOREIGN KEY (`id_feed`) REFERENCES `%sfeed`(`id`) ON DELETE CASCADE ON UPDATE CASCADE, - UNIQUE KEY (`id_feed`,`guid`), -- v0.7 - INDEX (`is_favorite`), -- v0.7 - INDEX (`is_read`) -- v0.7 +define ('SQL_ENTRY', 'CREATE TABLE IF NOT EXISTS `%1$sentry` ( + `id` bigint NOT NULL, -- v0.7 + `guid` varchar(760) CHARACTER SET latin1 NOT NULL, -- Maximum for UNIQUE is 767B + `title` varchar(255) NOT NULL, + `author` varchar(255), + `content_bin` blob, -- v0.7 + `link` varchar(1023) CHARACTER SET latin1 NOT NULL, + `date` int(11), + `is_read` boolean NOT NULL DEFAULT 0, + `is_favorite` boolean NOT NULL DEFAULT 0, + `id_feed` SMALLINT, -- v0.7 + `tags` varchar(1023), + PRIMARY KEY (`id`), + FOREIGN KEY (`id_feed`) REFERENCES `%1$sfeed`(`id`) ON DELETE CASCADE ON UPDATE CASCADE, + UNIQUE KEY (`id_feed`,`guid`), -- v0.7 + INDEX (`is_favorite`), -- v0.7 + INDEX (`is_read`) -- v0.7 ) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = INNODB;'); +// +define('SQL_SHOW_TABLES', 'SHOW tables;'); + +define('SQL_BACKUP006', 'RENAME TABLE `%1$scategory` TO `%1$scategory006`, `%1$sfeed` TO `%1$sfeed006`, `%1$sentry` TO `%1$sentry006`;'); + +define('SQL_SHOW_COLUMNS_UPDATEv006', 'SHOW columns FROM `%1$sentry006` LIKE "id2";'); + +define('SQL_UPDATEv006', ' +ALTER TABLE `%1$scategory006` ADD id2 SMALLINT; + +SET @i = 0; +UPDATE `%1$scategory006` SET id2=(@i:=@i+1) ORDER BY id; + +ALTER TABLE `%1$sfeed006` ADD id2 SMALLINT, ADD category2 SMALLINT; + +SET @i = 0; +UPDATE `%1$sfeed006` SET id2=(@i:=@i+1) ORDER BY name; + +UPDATE `%1$sfeed006` f +INNER JOIN `%1$scategory006` c ON f.category = c.id +SET f.category2 = c.id2; + +INSERT IGNORE INTO `%2$scategory` (name, color) +SELECT name, color +FROM `%1$scategory006` +ORDER BY id2; + +INSERT IGNORE INTO `%2$sfeed` (url, category, name, website, description, priority, pathEntries, httpAuth, keep_history) +SELECT url, category2, name, website, description, priority, pathEntries, httpAuth, keep_history +FROM `%1$sfeed006` +ORDER BY id2; + +ALTER TABLE `%1$sentry006` ADD id2 bigint; + +UPDATE `%1$sentry006` SET id2 = ((date * 1000000) + (rand() * 100000000)); + +INSERT IGNORE INTO `%2$sentry` (id, guid, title, author, link, date, is_read, is_favorite, id_feed, tags) +SELECT e0.id2, e0.guid, e0.title, e0.author, e0.link, e0.date, e0.is_read, e0.is_favorite, f0.id2, e0.tags +FROM `%1$sentry006` e0 +INNER JOIN `%1$sfeed006` f0 ON e0.id_feed = f0.id; +'); + +define('SQL_CONVERT_SELECTv006', ' +SELECT e0.id2, e0.content +FROM `%1$sentry006` e0 +INNER JOIN `%2$sentry` e1 ON e0.id2 = e1.id +WHERE e1.content_bin IS NULL'); + +define('SQL_CONVERT_UPDATEv006', 'UPDATE `%1$sentry` SET content_bin=COMPRESS(?) WHERE id=?;'); + +define('SQL_UPDATE_CACHED_VALUESv006', ' +UPDATE `%1$sfeed` f +INNER JOIN ( + SELECT e.id_feed, + COUNT(CASE WHEN e.is_read = 0 THEN 1 END) AS nbUnreads, + COUNT(e.id) AS nbEntries + FROM `%1$sentry` e + GROUP BY e.id_feed +) x ON x.id_feed=f.id +SET f.cache_nbEntries=x.nbEntries, f.cache_nbUnreads=x.nbUnreads +'); + +define('SQL_DROP_BACKUPv006', 'DROP TABLE IF EXISTS `%1$sentry006`, `%1$sfeed006`, `%1$scategory006`;'); +// function writeLine ($f, $line) { fwrite ($f, $line . "\n"); @@ -191,6 +255,7 @@ function saveStep3 () { $_SESSION['bd_password'] = addslashes ($_POST['pass']); $_SESSION['bd_base'] = addslashes ($_POST['base']); $_SESSION['bd_prefix'] = addslashes ($_POST['prefix']); + $_SESSION['bd_prefix_user'] = $_SESSION['bd_prefix'] . (empty($_SESSION['default_user']) ? '' : ($_SESSION['default_user'] . '_')); $file_conf = DATA_PATH . '/application.ini'; $f = fopen ($file_conf, 'w'); @@ -210,7 +275,6 @@ function saveStep3 () { writeLine ($f, 'prefix = "' . $_SESSION['bd_prefix'] . '"'); fclose ($f); - $_SESSION['bd_prefix_user'] = $_SESSION['bd_prefix'] . (empty($_SESSION['default_user']) ? '' : ($_SESSION['default_user'] . '_')); $res = checkBD (); if ($res) { @@ -222,11 +286,125 @@ function saveStep3 () { } invalidateHttpCache(); } + +function updateDatabase($perform = false) { + $needs = array('bd_type', 'bd_host', 'bd_base', 'bd_user', 'bd_password', 'bd_prefix', 'bd_prefix_user'); + foreach ($needs as $need) { + if (!isset($_SESSION[$need])) { + return false; + } + } + + try { + $str = ''; + switch ($_SESSION['bd_type']) { + case 'mysql': + $str = 'mysql:host=' . $_SESSION['bd_host'] . ';dbname=' . $_SESSION['bd_base']; + $driver_options = array( + PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8', + ); + break; + case 'sqlite': + $str = 'sqlite:' . DATA_PATH . $_SESSION['bd_base'] . '.sqlite'; + $driver_options = null; + break; + default: + return false; + } + + $c = new PDO($str, $_SESSION['bd_user'], $_SESSION['bd_password'], $driver_options); + + $stm = $c->prepare(SQL_SHOW_TABLES); + $stm->execute(); + $res = $stm->fetchAll(PDO::FETCH_COLUMN, 0); + if (!in_array($_SESSION['bd_prefix'] . 'entry006', $res)) { + return false; + } + + $sql = sprintf(SQL_SHOW_COLUMNS_UPDATEv006, $_SESSION['bd_prefix']); + $stm = $c->prepare($sql); + $stm->execute(); + $res = $stm->fetchAll(PDO::FETCH_COLUMN, 0); + if (!in_array('id2', $res)) { + if (!$perform) { + return true; + } + $sql = sprintf(SQL_UPDATEv006, $_SESSION['bd_prefix'], $_SESSION['bd_prefix_user']); + $stm = $c->prepare($sql, array(PDO::ATTR_EMULATE_PREPARES => true)); + $stm->execute(); + } + + $sql = sprintf(SQL_UPDATE_CACHED_VALUESv006, $_SESSION['bd_prefix_user']); + $stm = $c->prepare($sql); + $stm->execute(); + + $sql = sprintf(SQL_CONVERT_SELECTv006, $_SESSION['bd_prefix'], $_SESSION['bd_prefix_user']); + if (!$perform) { + $sql .= ' LIMIT 1'; + } + $stm = $c->prepare($sql); + $stm->execute(); + if (!$perform) { + $res = $stm->fetchAll(PDO::FETCH_COLUMN, 0); + return count($res) > 0; + } else { + @set_time_limit(300); + } + + $c2 = new PDO($str, $_SESSION['bd_user'], $_SESSION['bd_password'], $driver_options); + $sql = sprintf(SQL_CONVERT_UPDATEv006, $_SESSION['bd_prefix_user']); + $stm2 = $c2->prepare($sql); + while ($row = $stm->fetch(PDO::FETCH_ASSOC)) { + $id = $row['id2']; + $content = unserialize(gzinflate(base64_decode($row['content']))); + $stm2->execute(array($content, $id)); + } + return true; + } catch (PDOException $e) { + return false; + } + return false; +} + function deleteInstall () { $res = unlink (PUBLIC_PATH . '/install.php'); if ($res) { header ('Location: index.php'); } + + $needs = array('bd_type', 'bd_host', 'bd_base', 'bd_user', 'bd_password', 'bd_prefix'); + foreach ($needs as $need) { + if (!isset($_SESSION[$need])) { + return false; + } + } + + try { + switch ($_SESSION['bd_type']) { + case 'mysql': + $str = 'mysql:host=' . $_SESSION['bd_host'] . ';dbname=' . $_SESSION['bd_base']; + $driver_options = array( + PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8', + ); + break; + case 'sqlite': + $str = 'sqlite:' . DATA_PATH . $_SESSION['bd_base'] . '.sqlite'; + $driver_options = null; + break; + default: + return false; + } + + $c = new PDO($str, $_SESSION['bd_user'], $_SESSION['bd_password'], $driver_options); + $sql = sprintf(SQL_DROP_BACKUPv006, $_SESSION['bd_prefix']); + $stm = $c->prepare($sql); + $stm->execute(); + + return true; + } catch (PDOException $e) { + return false; + } + return false; } function moveOldFiles() { @@ -366,11 +544,11 @@ function checkStep1 () { } function checkStep2 () { - $conf = isset ($_SESSION['sel_application']) && - isset ($_SESSION['title']) && - isset ($_SESSION['old_entries']) && - isset ($_SESSION['mail_login']) && - isset ($_SESSION['default_user']); + $conf = !empty($_SESSION['sel_application']) && + !empty($_SESSION['title']) && + !empty($_SESSION['old_entries']) && + isset($_SESSION['mail_login']) && + !empty($_SESSION['default_user']); $defaultUser = empty($_POST['default_user']) ? null : $_POST['default_user']; if ($defaultUser === null) { $defaultUser = empty($_SESSION['default_user']) ? '' : $_SESSION['default_user']; @@ -394,7 +572,8 @@ function checkStep3 () { isset ($_SESSION['bd_user']) && isset ($_SESSION['bd_password']) && isset ($_SESSION['bd_base']) && - isset ($_SESSION['bd_prefix']); + isset ($_SESSION['bd_prefix']) && + isset ($_SESSION['bd_error']); $conn = !isset ($_SESSION['bd_error']) || !$_SESSION['bd_error']; return array ( @@ -410,47 +589,54 @@ function checkBD () { try { $str = ''; $driver_options = null; - if($_SESSION['bd_type'] == 'mysql') { - $driver_options = array( - PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8' - ); - - // on ouvre une connexion juste pour créer la base si elle n'existe pas - $str = 'mysql:host=' . $_SESSION['bd_host'] . ';'; - $c = new PDO ($str, - $_SESSION['bd_user'], - $_SESSION['bd_password'], - $driver_options); - - $sql = sprintf (SQL_REQ_CREATE_DB, $_SESSION['bd_base']); - $res = $c->query ($sql); - - // on écrase la précédente connexion en sélectionnant la nouvelle BDD - $str = 'mysql:host=' . $_SESSION['bd_host'] . ';dbname=' . $_SESSION['bd_base']; - } elseif($_SESSION['bd_type'] == 'sqlite') { - $str = 'sqlite:' . DATA_PATH . $_SESSION['bd_base'] . '.sqlite'; + switch ($_SESSION['bd_type']) { + case 'mysql': + $driver_options = array( + PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8' + ); + + // on ouvre une connexion juste pour créer la base si elle n'existe pas + $str = 'mysql:host=' . $_SESSION['bd_host'] . ';'; + $c = new PDO ($str, $_SESSION['bd_user'], $_SESSION['bd_password'], $driver_options); + + $sql = sprintf (SQL_CREATE_DB, $_SESSION['bd_base']); + $res = $c->query ($sql); + + // on écrase la précédente connexion en sélectionnant la nouvelle BDD + $str = 'mysql:host=' . $_SESSION['bd_host'] . ';dbname=' . $_SESSION['bd_base']; + break; + case 'sqlite': + $str = 'sqlite:' . DATA_PATH . $_SESSION['bd_base'] . '.sqlite'; + break; + default: + return false; } - $c = new PDO ($str, - $_SESSION['bd_user'], - $_SESSION['bd_password'], - $driver_options); + $c = new PDO ($str, $_SESSION['bd_user'], $_SESSION['bd_password'], $driver_options); + + $stm = $c->prepare(SQL_SHOW_TABLES); + $stm->execute(); + $res = $stm->fetchAll(PDO::FETCH_COLUMN, 0); + if (in_array($_SESSION['bd_prefix'] . 'entry', $res) && !in_array($_SESSION['bd_prefix'] . 'entry006', $res)) { + $sql = sprintf(SQL_BACKUP006, $_SESSION['bd_prefix']); //v0.6 + $res = $c->query($sql); //Backup tables + } - $sql = sprintf (SQL_REQ_CAT, $_SESSION['bd_prefix_user']); + $sql = sprintf (SQL_CAT, $_SESSION['bd_prefix_user']); $res = $c->query ($sql); if (!$res) { $error = true; } - $sql = sprintf (SQL_REQ_FEED, $_SESSION['bd_prefix_user'], $_SESSION['bd_prefix_user']); + $sql = sprintf (SQL_FEED, $_SESSION['bd_prefix_user']); $res = $c->query ($sql); if (!$res) { $error = true; } - $sql = sprintf (SQL_REQ_ENTRY, $_SESSION['bd_prefix_user'], $_SESSION['bd_prefix_user']); + $sql = sprintf (SQL_ENTRY, $_SESSION['bd_prefix_user']); $res = $c->query ($sql); if (!$res) { @@ -701,12 +887,30 @@ function printStep3 () { function printStep4 () { ?> -

    -
    +
    + +
    +
    + + + (This can take a long time, depending on the size of your database. You may have to wait for this page to time out (~5 minutes) and then refresh this page.) + + + +
    +
    +
    +

    + +

    ">
  • -
  • +
  • +
@@ -786,6 +996,9 @@ case 5: case 5: printStep5 (); break; + case 6: + printStep6 (); + break; } ?>
-- cgit v1.2.3 From b90a6be35f8996b27719cf493b47d1592d09ae6d Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Sun, 22 Dec 2013 14:54:10 +0100 Subject: i18n install.php pour mise à jour MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Termine https://github.com/marienfressinaud/FreshRSS/issues/255 Sépare i18n de install.php dans des fichiers dédiés --- app/i18n/en.php | 56 --------------------------------------------- app/i18n/fr.php | 56 --------------------------------------------- app/i18n/install.en.php | 61 +++++++++++++++++++++++++++++++++++++++++++++++++ app/i18n/install.fr.php | 61 +++++++++++++++++++++++++++++++++++++++++++++++++ public/install.php | 16 +++++++++---- 5 files changed, 133 insertions(+), 117 deletions(-) create mode 100644 app/i18n/install.en.php create mode 100644 app/i18n/install.fr.php diff --git a/app/i18n/en.php b/app/i18n/en.php index 580e68c41..d450bf30f 100644 --- a/app/i18n/en.php +++ b/app/i18n/en.php @@ -271,60 +271,4 @@ return array ( // format for date() function, %s allows to indicate month in letter 'format_date' => '%s dS Y', 'format_date_hour' => '%s dS Y \a\t H\.i', - - // INSTALLATION - 'freshrss_installation' => 'Installation - FreshRSS', - 'freshrss' => 'FreshRSS', - 'installation_step' => 'Installation - step %d', - 'steps' => 'Steps', - 'checks' => 'Checks', - 'bdd_configuration' => 'Database configuration', - 'bdd_type' => 'Type of database', - 'this_is_the_end' => 'This is the end', - - 'ok' => 'Ok!', - 'congratulations' => 'Congratulations!', - 'attention' => 'Attention!', - 'damn' => 'Damn!', - 'oops' => 'Oops!', - 'next_step' => 'Go to the next step', - - 'language_defined' => 'Language has been defined.', - 'choose_language' => 'Choose a language for FreshRSS', - - 'javascript_is_better' => 'FreshRSS is more pleasant with JavaScript enabled', - 'php_is_ok' => 'Your PHP version is %s and it’s compatible with FreshRSS', - 'php_is_nok' => 'Your PHP version is %s. You must have at least version %s', - 'minz_is_ok' => 'You have Minz framework', - 'minz_is_nok' => 'You haven’t Minz framework. You should execute build.sh script or download it on Github and install in %s directory the content of its /lib directory.', - 'curl_is_ok' => 'You have version %s of cURL', - 'curl_is_nok' => 'You haven’t cURL', - 'pdomysql_is_ok' => 'You have PDO and its driver for MySQL', - 'pdomysql_is_nok' => 'You haven’t PDO or its driver for MySQL', - 'dom_is_ok' => 'You have the necessary to browse the DOM', - 'dom_is_nok' => 'You haven’t the necessary to browse the DOM (php-xml package can be useful)', - 'cache_is_ok' => 'Permissions on cache directory are good', - 'log_is_ok' => 'Permissions on logs directory are good', - 'favicons_is_ok' => 'Permissions on favicons directory are good', - 'data_is_ok' => 'Permissions on data directory are good', - 'file_is_nok' => 'Check permissions on %s directory. HTTP server must have rights to write into', - 'fix_errors_before' => 'Fix errors before skip to the next step.', - - 'general_conf_is_ok' => 'General configuration has been saved.', - 'random_string' => 'Random string', - 'change_value' => 'You should change this value by any other', - 'base_url' => 'Base URL', - 'do_not_change_if_doubt' => 'Don’t change if you doubt about it', - - 'bdd_conf_is_ok' => 'Database configuration has been saved.', - 'bdd_conf_is_ko' => 'Verify your database information.', - 'host' => 'Host', - 'username' => 'Username', - 'password' => 'Password', - 'bdd' => 'Database', - 'prefix' => 'Table prefix', - - 'installation_is_ok' => 'Installation process is finished. You must delete install.php file to access FreshRSS… or simply click on following button :)', - 'finish_installation' => 'Finish installation', - 'install_not_deleted' => 'Something was going wrong, you must delete the file %s manually.', ); diff --git a/app/i18n/fr.php b/app/i18n/fr.php index 262e7700c..f65fa9fbc 100644 --- a/app/i18n/fr.php +++ b/app/i18n/fr.php @@ -271,60 +271,4 @@ return array ( // format pour la fonction date(), %s permet d'indiquer le mois en toutes lettres 'format_date' => 'd %s Y', 'format_date_hour' => '\l\e d %s Y \à H\:i', - - // INSTALLATION - 'freshrss_installation' => 'Installation - FreshRSS', - 'freshrss' => 'FreshRSS', - 'installation_step' => 'Installation - étape %d', - 'steps' => 'Étapes', - 'checks' => 'Vérifications', - 'bdd_configuration' => 'Configuration de la base de données', - 'bdd_type' => 'Type de base de données', - 'this_is_the_end' => 'This is the end', - - 'ok' => 'Ok !', - 'congratulations' => 'Félicitations !', - 'attention' => 'Attention !', - 'damn' => 'Arf !', - 'oops' => 'Oups !', - 'next_step' => 'Passer à l’étape suivante', - - 'language_defined' => 'La langue a bien été définie.', - 'choose_language' => 'Choisissez la langue pour FreshRSS', - - 'javascript_is_better' => 'FreshRSS est plus agréable à utiliser avec JavaScript activé', - 'php_is_ok' => 'Votre version de PHP est la %s qui est compatible avec FreshRSS', - 'php_is_nok' => 'Votre version de PHP est la %s mais FreshRSS requiert au moins la version %s', - 'minz_is_ok' => 'Vous disposez du framework Minz', - 'minz_is_nok' => 'Vous ne disposez pas de la librairie Minz. Vous devriez exécuter le script build.sh ou bien la télécharger sur Github et installer dans le répertoire %s le contenu de son répertoire /lib.', - 'curl_is_ok' => 'Vous disposez de cURL dans sa version %s', - 'curl_is_nok' => 'Vous ne disposez pas de cURL', - 'pdomysql_is_ok' => 'Vous disposez de PDO et de son driver pour MySQL', - 'pdomysql_is_nok' => 'Vous ne disposez pas de PDO ou de son driver pour MySQL', - 'dom_is_ok' => 'Vous disposez du nécessaire pour parcourir le DOM', - 'dom_is_nok' => 'Vous ne disposez pas du nécessaire pour parcourir le DOM (voir du côté du paquet php-xml ?)', - 'cache_is_ok' => 'Les droits sur le répertoire de cache sont bons', - 'log_is_ok' => 'Les droits sur le répertoire des logs sont bons', - 'favicons_is_ok' => 'Les droits sur le répertoire des favicons sont bons', - 'data_is_ok' => 'Les droits sur le répertoire de data sont bons', - 'file_is_nok' => 'Veuillez vérifier les droits sur le répertoire %s. Le serveur HTTP doit être capable d’écrire dedans', - 'fix_errors_before' => 'Veuillez corriger les erreurs avant de passer à l’étape suivante.', - - 'general_conf_is_ok' => 'La configuration générale a été enregistrée.', - 'random_string' => 'Chaîne aléatoire', - 'change_value' => 'Vous devriez changer cette valeur par n’importe quelle autre', - 'base_url' => 'Base de l’url', - 'do_not_change_if_doubt' => 'Laissez tel quel dans le doute', - - 'bdd_conf_is_ok' => 'La configuration de la base de données a été enregistrée.', - 'bdd_conf_is_ko' => 'Vérifiez les informations d’accès à la base de données.', - 'host' => 'Hôte', - 'username' => 'Nom utilisateur', - 'password' => 'Mot de passe', - 'bdd' => 'Base de données', - 'prefix' => 'Préfixe des tables', - - 'installation_is_ok' => 'L’installation s’est bien passée. Il faut maintenant supprimer le fichier install.php pour pouvoir accéder à FreshRSS… ou simplement cliquer sur le bouton ci-dessous :)', - 'finish_installation' => 'Terminer l’installation', - 'install_not_deleted' => 'Quelque chose s’est mal passé, vous devez supprimer le fichier %s à la main.', ); diff --git a/app/i18n/install.en.php b/app/i18n/install.en.php new file mode 100644 index 000000000..74245d63b --- /dev/null +++ b/app/i18n/install.en.php @@ -0,0 +1,61 @@ + 'Installation - FreshRSS', + 'freshrss' => 'FreshRSS', + 'installation_step' => 'Installation - step %d', + 'steps' => 'Steps', + 'checks' => 'Checks', + 'bdd_configuration' => 'Database configuration', + 'bdd_type' => 'Type of database', + 'version_update' => 'Update', + 'this_is_the_end' => 'This is the end', + + 'ok' => 'Ok!', + 'congratulations' => 'Congratulations!', + 'attention' => 'Attention!', + 'damn' => 'Damn!', + 'oops' => 'Oops!', + 'next_step' => 'Go to the next step', + + 'language_defined' => 'Language has been defined.', + 'choose_language' => 'Choose a language for FreshRSS', + + 'javascript_is_better' => 'FreshRSS is more pleasant with JavaScript enabled', + 'php_is_ok' => 'Your PHP version is %s, which is compatible with FreshRSS', + 'php_is_nok' => 'Your PHP version is %s but FreshRSS requires at least version %s', + 'minz_is_ok' => 'You have the Minz framework', + 'minz_is_nok' => 'You lack the Minz framework. You should execute build.sh script or download it on Github and install in %s directory the content of its /lib directory.', + 'curl_is_ok' => 'You have version %s of cURL', + 'curl_is_nok' => 'You lack cURL (php5-curl package)', + 'pdomysql_is_ok' => 'You have PDO and its driver for MySQL', + 'pdomysql_is_nok' => 'You lack PDO or its driver for MySQL (php5-mysql package)', + 'dom_is_ok' => 'You have the required library to browse the DOM', + 'dom_is_nok' => 'You lack a required library to browse the DOM (php-xml package)', + 'cache_is_ok' => 'Permissions on cache directory are good', + 'log_is_ok' => 'Permissions on logs directory are good', + 'favicons_is_ok' => 'Permissions on favicons directory are good', + 'data_is_ok' => 'Permissions on data directory are good', + 'file_is_nok' => 'Check permissions on %s directory. HTTP server must have rights to write into', + 'fix_errors_before' => 'Fix errors before skip to the next step.', + + 'general_conf_is_ok' => 'General configuration has been saved.', + 'random_string' => 'Random string', + 'change_value' => 'You should change this value by any other', + 'base_url' => 'Base URL', + 'do_not_change_if_doubt' => 'Don’t change if you doubt about it', + + 'bdd_conf_is_ok' => 'Database configuration has been saved.', + 'bdd_conf_is_ko' => 'Verify your database information.', + 'host' => 'Host', + 'username' => 'Username', + 'password' => 'Password', + 'bdd' => 'Database', + 'prefix' => 'Table prefix', + + 'update_start' => 'Start update process', + 'update_long' => 'This can take a long time, depending on the size of your database. You may have to wait for this page to time out (~5 minutes) and then refresh this page.', + + 'installation_is_ok' => 'The installation process was successful.
The final step will now attempt to delete the ./public/install.php file and any database backup created during the update process.
You may choose to skip this step and delete ./public/install.php manually.', + 'finish_installation' => 'Complete installation', + 'install_not_deleted' => 'Something went wrong; you must delete the file %s manually.', +); diff --git a/app/i18n/install.fr.php b/app/i18n/install.fr.php new file mode 100644 index 000000000..9b7a9bdff --- /dev/null +++ b/app/i18n/install.fr.php @@ -0,0 +1,61 @@ + 'Installation - FreshRSS', + 'freshrss' => 'FreshRSS', + 'installation_step' => 'Installation - étape %d', + 'steps' => 'Étapes', + 'checks' => 'Vérifications', + 'bdd_configuration' => 'Base de données', + 'bdd_type' => 'Type de base de données', + 'version_update' => 'Mise à jour', + 'this_is_the_end' => 'This is the end', + + 'ok' => 'Ok !', + 'congratulations' => 'Félicitations !', + 'attention' => 'Attention !', + 'damn' => 'Arf !', + 'oops' => 'Oups !', + 'next_step' => 'Passer à l’étape suivante', + + 'language_defined' => 'La langue a bien été définie.', + 'choose_language' => 'Choisissez la langue pour FreshRSS', + + 'javascript_is_better' => 'FreshRSS est plus agréable à utiliser avec JavaScript activé', + 'php_is_ok' => 'Votre version de PHP est la %s, qui est compatible avec FreshRSS', + 'php_is_nok' => 'Votre version de PHP est la %s mais FreshRSS requiert au moins la version %s', + 'minz_is_ok' => 'Vous disposez du framework Minz', + 'minz_is_nok' => 'Vous ne disposez pas de la librairie Minz. Vous devriez exécuter le script build.sh ou bien la télécharger sur Github et installer dans le répertoire %s le contenu de son répertoire /lib.', + 'curl_is_ok' => 'Vous disposez de cURL dans sa version %s', + 'curl_is_nok' => 'Vous ne disposez pas de cURL (librairie php5-curl)', + 'pdomysql_is_ok' => 'Vous disposez de PDO et de son driver pour MySQL (librairie php5-mysql)', + 'pdomysql_is_nok' => 'Vous ne disposez pas de PDO ou de son driver pour MySQL', + 'dom_is_ok' => 'Vous disposez du nécessaire pour parcourir le DOM', + 'dom_is_nok' => 'Vous ne disposez pas du nécessaire pour parcourir le DOM (librairie php-xml)', + 'cache_is_ok' => 'Les droits sur le répertoire de cache sont bons', + 'log_is_ok' => 'Les droits sur le répertoire des logs sont bons', + 'favicons_is_ok' => 'Les droits sur le répertoire des favicons sont bons', + 'data_is_ok' => 'Les droits sur le répertoire de data sont bons', + 'file_is_nok' => 'Veuillez vérifier les droits sur le répertoire %s. Le serveur HTTP doit être capable d’écrire dedans', + 'fix_errors_before' => 'Veuillez corriger les erreurs avant de passer à l’étape suivante.', + + 'general_conf_is_ok' => 'La configuration générale a été enregistrée.', + 'random_string' => 'Chaîne aléatoire', + 'change_value' => 'Vous devriez changer cette valeur par n’importe quelle autre', + 'base_url' => 'Base de l’url', + 'do_not_change_if_doubt' => 'Laissez tel quel dans le doute', + + 'bdd_conf_is_ok' => 'La configuration de la base de données a été enregistrée.', + 'bdd_conf_is_ko' => 'Vérifiez les informations d’accès à la base de données.', + 'host' => 'Hôte', + 'username' => 'Nom utilisateur', + 'password' => 'Mot de passe', + 'bdd' => 'Base de données', + 'prefix' => 'Préfixe des tables', + + 'update_start' => 'Lancer la mise à jour', + 'update_long' => 'Ce processus peut prendre longtemps, selon la taille de votre base de données. Vous aurez peut-être à attendre que cette page dépasse son temps maximum d’exécution (~5 minutes) puis à la recharger.', + + 'installation_is_ok' => 'L’installation s’est bien passée.
La dernière étape va maintenant tenter de supprimer le fichier /public/install.php, ainsi que d’éventuelles copies de base de données créées durant le processus de mise à jour.
Vous pouvez choisir de sauter cette étape et de supprimer /public/install.php manuellement.', + 'finish_installation' => 'Terminer l’installation', + 'install_not_deleted' => 'Quelque chose s’est mal passé, vous devez supprimer le fichier %s à la main.', +); diff --git a/public/install.php b/public/install.php index 2823a269a..133e7fbe4 100644 --- a/public/install.php +++ b/public/install.php @@ -155,8 +155,13 @@ function initTranslate () { $actual = isset($_SESSION['language']) ? $_SESSION['language'] : getBetterLanguage('en'); $file = APP_PATH . '/i18n/' . $actual . '.php'; - if (file_exists ($file)) { - $translates = include ($file); + if (file_exists($file)) { + $translates = array_merge($translates, include($file)); + } + + $file = APP_PATH . '/i18n/install.' . $actual . '.php'; + if (file_exists($file)) { + $translates = array_merge($translates, include($file)); } } function getBetterLanguage ($fallback) { @@ -888,12 +893,13 @@ function printStep3 () { function printStep4 () { ?>
- +
- (This can take a long time, depending on the size of your database. You may have to wait for this page to time out (~5 minutes) and then refresh this page.) + +

@@ -970,7 +976,7 @@ case 6:
  • -
  • +
  • -- cgit v1.2.3 From 4bcfd591f0192aaa17f934e9f56291c453815134 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Sun, 22 Dec 2013 15:00:54 +0100 Subject: Chargement automatique activé par défaut MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Clôture https://github.com/marienfressinaud/FreshRSS/issues/308 --- app/Models/ConfigurationDAO.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Models/ConfigurationDAO.php b/app/Models/ConfigurationDAO.php index fec58d234..57fc98047 100644 --- a/app/Models/ConfigurationDAO.php +++ b/app/Models/ConfigurationDAO.php @@ -38,7 +38,7 @@ class FreshRSS_ConfigurationDAO extends Minz_ModelArray { public $theme = 'default'; public $anon_access = 'no'; public $token = ''; - public $auto_load_more = 'no'; + public $auto_load_more = 'yes'; public $topline_read = 'yes'; public $topline_favorite = 'yes'; public $topline_date = 'yes'; -- cgit v1.2.3 From 3a4260b8744a0deb331e78cff43567a386c8d9a8 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Sun, 22 Dec 2013 15:09:29 +0100 Subject: Titre application maximum 25 caractères MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Implémente https://github.com/marienfressinaud/FreshRSS/issues/274 --- public/install.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/public/install.php b/public/install.php index 133e7fbe4..7fbae3436 100644 --- a/public/install.php +++ b/public/install.php @@ -214,10 +214,9 @@ function saveStep2 () { } $_SESSION['sel_application'] = sha1(uniqid(mt_rand(), true).implode('', stat(__FILE__))); - $_SESSION['title'] = addslashes ($_POST['title']); + $_SESSION['title'] = addslashes(substr(trim($_POST['title']), 0, 25)); $_SESSION['old_entries'] = $_POST['old_entries']; - if (!is_int (intval ($_SESSION['old_entries'])) || - $_SESSION['old_entries'] < 1) { + if ((!ctype_digit($_SESSION['old_entries'])) || ($_SESSION['old_entries'] < 1)) { $_SESSION['old_entries'] = 3; } $_SESSION['mail_login'] = addslashes ($_POST['mail_login']); @@ -588,6 +587,7 @@ function checkStep3 () { 'all' => $bd && $conn && $conf ? 'ok' : 'ko' ); } + function checkBD () { $error = false; -- cgit v1.2.3 From 415d7a5a716726759c30151af11bd588d52acbb2 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Sun, 22 Dec 2013 16:08:24 +0100 Subject: config.php plutôt que application.ini MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Implémente https://github.com/marienfressinaud/FreshRSS/issues/272 --- data/.gitignore | 1 + lib/Minz/Configuration.php | 8 ++--- public/index.php | 2 +- public/install.php | 80 +++++++++++++++++++++++++--------------------- 4 files changed, 48 insertions(+), 43 deletions(-) diff --git a/data/.gitignore b/data/.gitignore index 677c8f58c..a8091901a 100644 --- a/data/.gitignore +++ b/data/.gitignore @@ -1,4 +1,5 @@ application.ini +config.php *_user.php *.sqlite touch.txt diff --git a/lib/Minz/Configuration.php b/lib/Minz/Configuration.php index 9fc913964..1b108dcdf 100644 --- a/lib/Minz/Configuration.php +++ b/lib/Minz/Configuration.php @@ -8,7 +8,7 @@ * La classe Configuration permet de gérer la configuration de l'application */ class Minz_Configuration { - const CONF_PATH_NAME = '/application.ini'; + const CONF_PATH_NAME = '/config.php'; /** * VERSION est la version actuelle de MINZ @@ -126,10 +126,7 @@ class Minz_Configuration { ); } - $ini_array = parse_ini_file ( - DATA_PATH . self::CONF_PATH_NAME, - true - ); + $ini_array = include(DATA_PATH . self::CONF_PATH_NAME); if (!$ini_array) { throw new Minz_PermissionDeniedException ( @@ -147,7 +144,6 @@ class Minz_Configuration { } $general = $ini_array['general']; - // sel_application est obligatoire if (!isset ($general['sel_application'])) { throw new Minz_BadConfigurationException ( diff --git a/public/index.php b/public/index.php index 829e418f9..c8b15b3d9 100755 --- a/public/index.php +++ b/public/index.php @@ -29,7 +29,7 @@ if (file_exists ('install.php')) { $dateLastModification = max( @filemtime(DATA_PATH . '/touch.txt'), @filemtime(LOG_PATH . '/application.log'), - @filemtime(DATA_PATH . '/application.ini') + @filemtime(DATA_PATH . '/config.php') ); $_SERVER['QUERY_STRING'] .= '&utime=' . file_get_contents(DATA_PATH . '/touch.txt'); //For ETag if (httpConditional($dateLastModification, 0, 0, false, false, true)) { diff --git a/public/install.php b/public/install.php index 7fbae3436..dbbecb1a3 100644 --- a/public/install.php +++ b/public/install.php @@ -261,23 +261,29 @@ function saveStep3 () { $_SESSION['bd_prefix'] = addslashes ($_POST['prefix']); $_SESSION['bd_prefix_user'] = $_SESSION['bd_prefix'] . (empty($_SESSION['default_user']) ? '' : ($_SESSION['default_user'] . '_')); - $file_conf = DATA_PATH . '/application.ini'; - $f = fopen ($file_conf, 'w'); - writeLine ($f, '[general]'); - writeLine ($f, 'environment = "' . empty($_SESSION['environment']) ? 'production' : $_SESSION['environment'] . '"'); - writeLine ($f, 'use_url_rewriting = false'); - writeLine ($f, 'sel_application = "' . $_SESSION['sel_application'] . '"'); - writeLine ($f, 'base_url = ""'); - writeLine ($f, 'title = "' . $_SESSION['title'] . '"'); - writeLine ($f, 'default_user = "' . $_SESSION['default_user'] . '"'); - writeLine ($f, '[db]'); - writeLine ($f, 'type = "' . $_SESSION['bd_type'] . '"'); - writeLine ($f, 'host = "' . $_SESSION['bd_host'] . '"'); - writeLine ($f, 'user = "' . $_SESSION['bd_user'] . '"'); - writeLine ($f, 'password = "' . $_SESSION['bd_password'] . '"'); - writeLine ($f, 'base = "' . $_SESSION['bd_base'] . '"'); - writeLine ($f, 'prefix = "' . $_SESSION['bd_prefix'] . '"'); - fclose ($f); + $ini_array = array( + 'general' => array( + 'environment' => empty($_SESSION['environment']) ? 'production' : $_SESSION['environment'], + 'use_url_rewriting' => false, + 'sel_application' => $_SESSION['sel_application'], + 'base_url' => '', + 'title' => $_SESSION['title'], + 'default_user' => $_SESSION['default_user'], + ), + 'db' => array( + 'type' => $_SESSION['bd_type'], + 'host' => $_SESSION['bd_host'], + 'user' => $_SESSION['bd_user'], + 'password' => $_SESSION['bd_password'], + 'base' => $_SESSION['bd_base'], + 'prefix' => $_SESSION['bd_prefix'], + ), + ); + file_put_contents(DATA_PATH . '/config.php', " Date: Sun, 22 Dec 2013 16:16:22 +0100 Subject: Correction bugs config.php Corrections bugs pour https://github.com/marienfressinaud/FreshRSS/issues/272 --- public/install.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/public/install.php b/public/install.php index dbbecb1a3..478650d65 100644 --- a/public/install.php +++ b/public/install.php @@ -279,7 +279,7 @@ function saveStep3 () { 'prefix' => $_SESSION['bd_prefix'], ), ); - file_put_contents(DATA_PATH . '/config.php', " Date: Sun, 22 Dec 2013 16:39:08 +0100 Subject: Install.php : default_user obligatoire --- public/install.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/public/install.php b/public/install.php index 478650d65..377b2916d 100644 --- a/public/install.php +++ b/public/install.php @@ -209,7 +209,8 @@ function saveLanguage () { function saveStep2 () { if (!empty ($_POST)) { if (empty ($_POST['title']) || - empty ($_POST['old_entries'])) { + empty ($_POST['old_entries']) || + empty ($_POST['default_user']) { return false; } @@ -244,6 +245,7 @@ function saveStep2 () { header ('Location: index.php?step=3'); } } + function saveStep3 () { if (!empty ($_POST)) { if (empty ($_POST['type']) || -- cgit v1.2.3 From 11b1d06b8c4672f7dab98f8de5a7f7f95eeeec12 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Mon, 23 Dec 2013 00:01:00 +0100 Subject: Chargement différé des iframe MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Implémente https://github.com/marienfressinaud/FreshRSS/issues/313 (uniquement pour la vue en articles repliés) --- app/views/helpers/view/normal_view.phtml | 42 ++++++++++++++++---------------- app/views/helpers/view/reader_view.phtml | 3 ++- lib/lib_rss.php | 8 ++++++ public/scripts/main.js | 2 +- 4 files changed, 32 insertions(+), 23 deletions(-) diff --git a/app/views/helpers/view/normal_view.phtml b/app/views/helpers/view/normal_view.phtml index f21a2bdd9..4307c2113 100644 --- a/app/views/helpers/view/normal_view.phtml +++ b/app/views/helpers/view/normal_view.phtml @@ -4,25 +4,25 @@ $this->partial ('aside_flux'); $this->partial ('nav_menu'); if (!empty($this->entries)) { -?> + $display_today = true; + $display_yesterday = true; + $display_others = true; -
    - conf) || is_logged (); + $shaarli = $this->conf->sharing ('shaarli'); + $poche = $this->conf->sharing ('poche'); + $diaspora = $this->conf->sharing ('diaspora'); + $twitter = $this->conf->sharing ('twitter'); + $google_plus = $this->conf->sharing ('g+'); + $facebook = $this->conf->sharing ('facebook'); + $email = $this->conf->sharing ('email'); + $print = $this->conf->sharing ('print'); + $today = $this->today; + $hidePosts = $this->conf->displayPosts() === 'no'; + $lazyload = $this->conf->lazyload() === 'yes'; +?> - $logged = !login_is_conf ($this->conf) || is_logged (); - $shaarli = $this->conf->sharing ('shaarli'); - $poche = $this->conf->sharing ('poche'); - $diaspora = $this->conf->sharing ('diaspora'); - $twitter = $this->conf->sharing ('twitter'); - $google_plus = $this->conf->sharing ('g+'); - $facebook = $this->conf->sharing ('facebook'); - $email = $this->conf->sharing ('email'); - $print = $this->conf->sharing ('print'); - $today = $this->today; - ?> +
    entries as $item) { ?> isDay (FreshRSS_Days::TODAY, $today)) { ?> @@ -48,7 +48,7 @@ if (!empty($this->entries)) {
      conf) || is_logged ()) { + if ($logged) { if ($this->conf->bottomlineRead ()) { ?>
    • partial ('nav_menu'); if (!empty($this->entries)) { + $lazyload = $this->conf->lazyload() === 'yes'; ?>
      @@ -26,7 +27,7 @@ if (!empty($this->entries)) {
      conf->lazyload() == 'yes') { + if ($lazyload) { echo lazyimg($item->content ()); } else { echo $item->content(); diff --git a/lib/lib_rss.php b/lib/lib_rss.php index 4ef06ddbc..a1fadcb24 100644 --- a/lib/lib_rss.php +++ b/lib/lib_rss.php @@ -288,6 +288,14 @@ function lazyimg($content) { ); } +function lazyIframe($content) { + return preg_replace( + '/]+?)src=[\'"]([^"\']+)[\'"]([^>]*)>/i', + '', + $content + ); +} + function uTimeString() { $t = @gettimeofday(); return $t['sec'] . str_pad($t['usec'], 6, '0'); diff --git a/public/scripts/main.js b/public/scripts/main.js index 3bd23a669..ef05eb2fb 100644 --- a/public/scripts/main.js +++ b/public/scripts/main.js @@ -136,7 +136,7 @@ function mark_favorite(active) { function toggleContent(new_active, old_active) { if (does_lazyload) { - new_active.find('img[data-original]').each(function () { + new_active.find('img[data-original], iframe[data-original]').each(function () { this.setAttribute('src', this.getAttribute('data-original')); this.removeAttribute('data-original'); }); -- cgit v1.2.3 From 7d0c3fc56643ebc018acf0a567dad1ca1978d4b7 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Mon, 23 Dec 2013 01:21:46 +0100 Subject: i18n et README --- README.md | 32 +++++++++++++++++++++----------- app/i18n/en.php | 2 +- app/i18n/fr.php | 2 +- 3 files changed, 23 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index 2eb9ca03a..14b007c4e 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,6 @@ # FreshRSS -FreshRSS est un agrégateur de flux RSS à auto-héberger à l’image de [Leed](http://projet.idleman.fr/leed/) ou de [Kriss Feed](http://tontof.net/kriss/feed/). Il se veut léger et facile à prendre en main tout en étant un outil puissant et paramétrable. +FreshRSS est un agrégateur de flux RSS à auto-héberger à l’image de [Leed](http://projet.idleman.fr/leed/) ou de [Kriss Feed](http://tontof.net/kriss/feed/). +Il se veut léger et facile à prendre en main tout en étant un outil puissant et paramétrable. * Site officiel : http://marienfressinaud.github.io/FreshRSS/ * Démo : http://marienfressinaud.fr/projets/freshrss/ @@ -11,7 +12,7 @@ FreshRSS est un agrégateur de flux RSS à auto-héberger à l’image de [Leed] ![Logo de FreshRSS](http://marienfressinaud.fr/data/images/freshrss/freshrss_title.png) # Disclaimer -Cette application a été développée pour s’adapter à des besoins personnels et non professionels. +Cette application a été développée pour s’adapter à des besoins personnels et non professionnels. Je ne garantis en aucun cas la sécurité de celle-ci, ni son bon fonctionnement. Je m’engage néanmoins à répondre dans la mesure du possible aux demandes d’évolution si celles-ci me semblent justifiées. Privilégiez pour cela des demandes sur GitHub @@ -30,16 +31,25 @@ Privilégiez pour cela des demandes sur GitHub # Installation 1. Récupérez l’application FreshRSS via la commande git ou [en téléchargeant l’archive](https://github.com/marienfressinaud/FreshRSS/archive/master.zip) -2. Placez l’application sur votre serveur (la partie à exposer au Web est le répertoire `./public`) -3. Accédez à FreshRSS à travers votre navigateur Web et suivez les instructions d’installation -4. Tout devrait fonctionner :) En cas de problème, n’hésitez pas à me contacter. +2. Placez l’application sur votre serveur (la partie à exposer au Web est le répertoire `./public/`) +3. Le serveur Web doit avoir les droits d’écriture dans le répertoire `./data/` +4. Accédez à FreshRSS à travers votre navigateur Web et suivez les instructions d’installation +5. Tout devrait fonctionner :) En cas de problème, n’hésitez pas à me contacter. -# Conseils -1. Pour une meilleure sécurité, faites en sorte que seul le répertoire `./public` soit accessible depuis le Web, par exemple en faisant pointer un sous-domaine sur le répertoire `./public`. -2. Les données sensibles se trouvent dans le répertoire `./data/` (déjà protégé par un .htaccess pour Apache - vérifiez que cela fonctionne -, à protéger vous-même dans le cas d’autres serveurs Web). -3. En cas de problème, les logs peuvent être utile à lire, soit depuis l’interface de FreshRSS, soit manuellement depuis `./data/log/*.log`. -4. Le fichier `./constants.php` définit les chemins d’accès aux répertoires clés de l’application. Si vous les bougez, tout se passe ici. -5. Vous pouvez ajouter une tâche CRON sur le script d’actualisation des flux. Il s’agit d’un script PHP à exécuter avec la commande `php`. Par exemple, pour exécuter le script toutes les heures : +# Contrôle d’accès +Il est recommandé de limiter l’accès à votre FreshRSS, soit : +* En utilisant l’identification par [Mozilla Persona](https://login.persona.org/about) incluse dans FreshRSS +* En utilisant un contrôle d’accès défini par votre serveur Web + * Voir par exemple la [documentation d’Apache sur l’authentification](http://httpd.apache.org/docs/trunk/howto/auth.html) + +# Rafraîchissement automatique des flux +* Vous pouvez ajouter une tâche CRON sur le script d’actualisation des flux. Par exemple, pour exécuter le script toutes les heures : ``` 7 * * * * php /chemin/vers/freshrss/actualize_script.php >/dev/null 2>&1 ``` + +# Conseils +* Pour une meilleure sécurité, faites en sorte que seul le répertoire `./public` soit accessible depuis le Web, par exemple en faisant pointer un sous-domaine sur le répertoire `./public`. +* Les données personnelles se trouvent dans le répertoire `./data/` (déjà protégé par un .htaccess pour Apache - vérifiez que cela fonctionne -, à protéger vous-même dans le cas d’autres serveurs Web). +* Le fichier `./constants.php` définit les chemins d’accès aux répertoires clés de l’application. Si vous les bougez, tout se passe ici. +* En cas de problème, les logs peuvent être utile à lire, soit depuis l’interface de FreshRSS, soit manuellement depuis `./data/log/*.log`. diff --git a/app/i18n/en.php b/app/i18n/en.php index d450bf30f..9c30573e8 100644 --- a/app/i18n/en.php +++ b/app/i18n/en.php @@ -157,7 +157,7 @@ return array ( 'general_configuration' => 'General configuration', 'language' => 'Language', - 'delete_articles_every' => 'Remove articles every', + 'delete_articles_every' => 'Remove articles after', 'month' => 'months', 'default_user' => 'Username of the default user (maximum 16 alphanumeric characters)', 'persona_connection_email' => 'Login mail address (use
      Mozilla Persona)', diff --git a/app/i18n/fr.php b/app/i18n/fr.php index f65fa9fbc..85bbeb4b7 100644 --- a/app/i18n/fr.php +++ b/app/i18n/fr.php @@ -157,7 +157,7 @@ return array ( 'general_configuration' => 'Configuration générale', 'language' => 'Langue', - 'delete_articles_every' => 'Supprimer les articles tous les', + 'delete_articles_every' => 'Supprimer les articles après', 'month' => 'mois', 'default_user' => 'Nom de l’utilisateur par défaut (16 caractères alphanumériques maximum)', 'persona_connection_email' => 'Adresse courriel de connexion (utilise Mozilla Persona)', -- cgit v1.2.3 From 0fadecd4621cc80f9bc71b57ea8a1ab69d067daa Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Mon, 23 Dec 2013 01:33:23 +0100 Subject: README : Lien licence --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 14b007c4e..a45c8e67c 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ Il se veut léger et facile à prendre en main tout en étant un outil puissant * Développeur : Marien Fressinaud * Version actuelle : 0.7-dev * Date de publication 2013-12-xx -* License AGPL3 +* License [GNU AGPL 3](http://www.gnu.org/licenses/agpl-3.0.html) ![Logo de FreshRSS](http://marienfressinaud.fr/data/images/freshrss/freshrss_title.png) -- cgit v1.2.3 From f829d0bd19845b080aa40ae9e1e2ed9093872c69 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Mon, 23 Dec 2013 01:36:32 +0100 Subject: README : logo AGPLv3 --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index a45c8e67c..e10502571 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ Il se veut léger et facile à prendre en main tout en étant un outil puissant * Développeur : Marien Fressinaud * Version actuelle : 0.7-dev * Date de publication 2013-12-xx -* License [GNU AGPL 3](http://www.gnu.org/licenses/agpl-3.0.html) +* License [GNU AGPL 3](http://www.gnu.org/licenses/agpl-3.0.html) ![Logo AGPLv3](http://www.gnu.org/graphics/agplv3-155x51.png) ![Logo de FreshRSS](http://marienfressinaud.fr/data/images/freshrss/freshrss_title.png) -- cgit v1.2.3 From 9e46c1ee7fc7f9ad9e2c07f0cf826573dd4c9766 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Mon, 23 Dec 2013 01:37:11 +0100 Subject: Revert "README : logo AGPLv3" This reverts commit f829d0bd19845b080aa40ae9e1e2ed9093872c69. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index e10502571..a45c8e67c 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ Il se veut léger et facile à prendre en main tout en étant un outil puissant * Développeur : Marien Fressinaud * Version actuelle : 0.7-dev * Date de publication 2013-12-xx -* License [GNU AGPL 3](http://www.gnu.org/licenses/agpl-3.0.html) ![Logo AGPLv3](http://www.gnu.org/graphics/agplv3-155x51.png) +* License [GNU AGPL 3](http://www.gnu.org/licenses/agpl-3.0.html) ![Logo de FreshRSS](http://marienfressinaud.fr/data/images/freshrss/freshrss_title.png) -- cgit v1.2.3 From 6552cf0da648aa4daf2ea1e57d78a87e57087ff8 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Mon, 23 Dec 2013 13:32:28 +0100 Subject: Fin fusion 0.7-dev --- README.md | 4 ++-- lib/lib_rss.php | 13 ------------- 2 files changed, 2 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index a45c8e67c..87ed9de99 100644 --- a/README.md +++ b/README.md @@ -5,8 +5,8 @@ Il se veut léger et facile à prendre en main tout en étant un outil puissant * Site officiel : http://marienfressinaud.github.io/FreshRSS/ * Démo : http://marienfressinaud.fr/projets/freshrss/ * Développeur : Marien Fressinaud -* Version actuelle : 0.7-dev -* Date de publication 2013-12-xx +* Version actuelle : 0.7-beta +* Date de publication 2014-01-xx * License [GNU AGPL 3](http://www.gnu.org/licenses/agpl-3.0.html) ![Logo de FreshRSS](http://marienfressinaud.fr/data/images/freshrss/freshrss_title.png) diff --git a/lib/lib_rss.php b/lib/lib_rss.php index dda576b98..a1fadcb24 100644 --- a/lib/lib_rss.php +++ b/lib/lib_rss.php @@ -309,16 +309,3 @@ function uSecString() { function invalidateHttpCache() { file_put_contents(DATA_PATH . '/touch.txt', uTimeString()); } - -/** - * Add support of image lazy loading - * Move content from src attribute to data-original - * @param content is the text we want to parse - */ -function lazyimg($content) { - return preg_replace( - '//i', - '', - $content - ); -} -- cgit v1.2.3 From 7b7acf5c8738e949109672748dbd9f39a6e5a2c4 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Mon, 23 Dec 2013 13:35:54 +0100 Subject: Synchronisation quelques lignes blanches --- README.md | 4 ++-- app/Models/CategoryDAO.php | 1 + app/Models/Configuration.php | 1 + app/Models/ConfigurationDAO.php | 1 + app/Models/Entry.php | 1 + app/Models/EntryDAO.php | 1 + app/Models/Feed.php | 1 + app/Models/FeedDAO.php | 1 + app/Models/LogDAO.php | 1 + public/install.php | 1 + 10 files changed, 11 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index a45c8e67c..87ed9de99 100644 --- a/README.md +++ b/README.md @@ -5,8 +5,8 @@ Il se veut léger et facile à prendre en main tout en étant un outil puissant * Site officiel : http://marienfressinaud.github.io/FreshRSS/ * Démo : http://marienfressinaud.fr/projets/freshrss/ * Développeur : Marien Fressinaud -* Version actuelle : 0.7-dev -* Date de publication 2013-12-xx +* Version actuelle : 0.7-beta +* Date de publication 2014-01-xx * License [GNU AGPL 3](http://www.gnu.org/licenses/agpl-3.0.html) ![Logo de FreshRSS](http://marienfressinaud.fr/data/images/freshrss/freshrss_title.png) diff --git a/app/Models/CategoryDAO.php b/app/Models/CategoryDAO.php index 3a810e9f0..6b07ab063 100644 --- a/app/Models/CategoryDAO.php +++ b/app/Models/CategoryDAO.php @@ -1,4 +1,5 @@ prefix . 'category` (name, color) VALUES(?, ?)'; diff --git a/app/Models/Configuration.php b/app/Models/Configuration.php index 7ef76b522..d5f69601f 100644 --- a/app/Models/Configuration.php +++ b/app/Models/Configuration.php @@ -1,4 +1,5 @@ 'English', diff --git a/app/Models/ConfigurationDAO.php b/app/Models/ConfigurationDAO.php index 57fc98047..0eebf2d90 100644 --- a/app/Models/ConfigurationDAO.php +++ b/app/Models/ConfigurationDAO.php @@ -1,4 +1,5 @@ prefix . 'entry`(id, guid, title, author, content_bin, link, date, is_read, is_favorite, id_feed, tags) ' diff --git a/app/Models/Feed.php b/app/Models/Feed.php index e63ac8c7a..70efb0fa3 100644 --- a/app/Models/Feed.php +++ b/app/Models/Feed.php @@ -1,4 +1,5 @@ prefix . 'feed` (url, category, name, website, description, lastUpdate, priority, httpAuth, error, keep_history) VALUES(?, ?, ?, ?, ?, ?, 10, ?, 0, 0)'; diff --git a/app/Models/LogDAO.php b/app/Models/LogDAO.php index bf043fd6d..06855ec66 100644 --- a/app/Models/LogDAO.php +++ b/app/Models/LogDAO.php @@ -1,4 +1,5 @@ Date: Mon, 23 Dec 2013 14:57:59 +0100 Subject: CHANGELOG 0.7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Unicode pour le reste du texte Correction diverses typos Et mise à jour du site officiel en faveur de http://freshrss.org --- CHANGELOG | 152 +++++++++++++++++++++++++++++++++++++++++----------------- constants.php | 4 +- 2 files changed, 109 insertions(+), 47 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index c8bf43237..0b7350b2e 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,97 +1,158 @@ -# Changelog -## 2013-11-21 changes with FreshRSS 0.6.1 +# Journal des modifications + +## 2014-01-xx FreshRSS 0.7 + +* Installeur + * Nouvel utilisateur par défaut, en prévision du futur support multi-utilisateurs + * Supporte une mise à jour depuis la version 0.6 + * Juste placer application.ini et Configuration.array.php dans le nouveau répertoire “./data/” +* Importation OPML instantanée et plus tolérante + * Nouvelle gestion des favicons et téléchargement en parallèle +* Nouvelles options + * Améliorations partage vers Shaarli, Poche, Diaspora*, Facebook, Twitter, Google+, courriel + * Permet la suppression de tous les articles d’un flux + * Option pour marquer les articles comme lus dès la réception + * Permet de modifier la description et l’adresse d’un flux RSS ainsi que le site Web associé + * Nouveau raccourci pour ouvrir/fermer un article (‘c’ par défaut) + * Bouton pour effacer les logs +* SQL : + * Nouveau moteur de recherche, aussi accessible depuis la vue mobile + * Mots clefs de recherche “intitle:”, “inurl:”, “author:” + * Les articles sont triés selon la date de leur ajout dans FreshRSS plutôt que la date déclarée (souvent erronée) + * Permet de marquer tout comme lu sans affecter les nouveaux articles arrivés en cours de lecture + * Refactorisation + * Les tables sont préfixées avec le nom d’utilisateur en prévision du futur support multi-utilisateurs + * Amélioration des performances + * Tolère un beaucoup plus grand nombre d’articles + * Compression des données côté MySQL plutôt que côté PHP + * Incompatible avec la version 0.6 (nécessite une mise à jour grâce à l’installeur) + * Affichage de la taille de la base de données dans FreshRSS + * Correction problème de marquage de tous les favoris comme lus +* HTML5 : + * Support des balises HTML5 audio, video, et éléments associés (preload="none", et réécriture correcte des adresses, aussi en HTTPS) + * Protection HTML5 des iframe (sandbox="allow-scripts allow-same-origin") + * Filtrage des object et embed + * Chargement différé HTML5 (postpone="") pour iframe et video + * Chargement différé JavaScript pour iframe +* CSS : + * Meilleur support des longs titres d’articles sur des écrans étroits + * Meilleure accessibilité + * FreshRSS fonctionne aussi en mode dégradé sans images (alternatives Unicode) et/ou sans CSS + * Diverses améliorations mineures +* PHP : + * Meilleure gestion des caractères spéciaux dans différents cas + * Amélioration des performances + * Chargement automatique des classes + * Alternative dans le cas d’absence de librairie JSON + * Pour le développement, le cache HTTP peut être désactivé en créant un fichier “./no-cache.txt” +* Réorganisation des fichiers et répertoires, en particulier : + * Tous les fichiers utilisateur sont dans “./data/” (y compris “cache”, “favicons”, et “log”) + * Déplacement de “./app/configuration/application.ini” vers “./data/config.php” + * Déplacement de “./public/data/Configuration.array.php” vers “./data/*_user.php” +* Divers : + * Nouvel “agent utilisateur” utilisé lors du téléchargement des flux, par exemple : + * “FreshRSS/0.7 (Linux; http://freshrss.org) SimplePie/1.3.1” + + +## 2013-11-21 FreshRSS 0.6.1 * Corrige bug chargement du JavaScript -* Affiche un message d'erreur plus explicite si fichier de configuration inaccessible +* Affiche un message d’erreur plus explicite si fichier de configuration inaccessible + -## 2013-11-17 changes with FreshRSS 0.6 +## 2013-11-17 FreshRSS 0.6 * Nettoyage du code JavaScript + optimisations -* Utilisation d'adresses relatives +* Utilisation d’adresses relatives * Amélioration des performances coté client -* Mise à jour automatique du nombre d'articles non lus +* Mise à jour automatique du nombre d’articles non lus * Corrections traductions * Mise en cache de FreshRSS -* Amélioration des retours utilisateur lorsque la configuration n'est pas bonne +* Amélioration des retours utilisateur lorsque la configuration n’est pas bonne * Actualisation des flux après une importation OPML * Meilleure prise en charge des flux RSS invalides * Amélioration de la vue globale * Possibilité de personnaliser les icônes de lecture -* Suppression de champs lors de l'installation (base_url et sel) +* Suppression de champs lors de l’installation (base_url et sel) * Correction bugs divers -## 2013-10-15 changes with FreshRSS 0.5.1 + +## 2013-10-15 FreshRSS 0.5.1 * Correction bug des catégories disparues * Correction traduction i18n/fr et i18n/en * Suppression de certains appels à la feuille de style fallback.css -## 2013-10-12 changes with FreshRSS 0.5.0 -* Possibilité d'interdire la lecture anonyme -* Option pour garder l'historique d'un flux -* Lors d'un clic sur "Marquer tous les articles comme lus", FreshRSS peut désormais sauter à la prochaine catégorie / prochain flux avec des articles non lus. -* Ajout d'un token pour accéder aux flux RSS générés par FreshRSS sans nécessiter de connexion +## 2013-10-12 FreshRSS 0.5.0 + +* Possibilité d’interdire la lecture anonyme +* Option pour garder l’historique d’un flux +* Lors d’un clic sur “Marquer tous les articles comme lus”, FreshRSS peut désormais sauter à la prochaine catégorie / prochain flux avec des articles non lus. +* Ajout d’un token pour accéder aux flux RSS générés par FreshRSS sans nécessiter de connexion * Possibilité de partager vers Facebook, Twitter et Google+ * Possibilité de changer de thème * Le menu de navigation (article précédent / suivant / haut de page) a été ajouté à la vue non mobile * La police OpenSans est désormais appliquée * Amélioration de la page de configuration -* Une meilleure sortie pour l'imprimante +* Une meilleure sortie pour l’imprimante * Quelques retouches du design par défaut -* Les vidéos ne dépassent plus du cadre de l'écran +* Les vidéos ne dépassent plus du cadre de l’écran * Nouveau logo -* Possibilité d'ajouter un préfixe aux tables lors de l'installation -* Ajout d'un champ en base de données keep_history à la table feed -* Si possible, création automatique de la base de données si elle n'existe pas lors de l'installation -* L'utilisation d'UTF-8 est forcée +* Possibilité d’ajouter un préfixe aux tables lors de l’installation +* Ajout d’un champ en base de données keep_history à la table feed +* Si possible, création automatique de la base de données si elle n’existe pas lors de l’installation +* L’utilisation d’UTF-8 est forcée * Le marquage automatique au défilement de la page a été amélioré * La vue globale a été énormément améliorée et est beaucoup plus utile * Amélioration des requêtes SQL -* Amélioration du Javascript +* Amélioration du JavaScript * Correction bugs divers -## 2013-07-02 changes with FreshRSS 0.4.0 -* Correction bug et ajout notification lors de la phase d'installation -* Affichage d'erreur si fichier OPML invalide +## 2013-07-02 FreshRSS 0.4.0 + +* Correction bug et ajout notification lors de la phase d’installation +* Affichage d’erreur si fichier OPML invalide * Les tags sont maintenant cliquables pour filtrer dessus -* Amélioration vue mobile (boutons plus gros et ajout d'une barre de navigation) -* Possibilité d'ajouter directement un flux dans une catégorie dès son ajout +* Amélioration vue mobile (boutons plus gros et ajout d’une barre de navigation) +* Possibilité d’ajouter directement un flux dans une catégorie dès son ajout * Affichage des flux en erreur (injoignable par exemple) en rouge pour les différencier -* Possiblité de changer les noms des flux -* Ajout d'une option (désactivable donc) pour charger les images en lazyload permettant de ne pas charger toutes les images d'un coup -* Le framework Minz est maintenant directement inclus dans l'archive (plus besoin de passer par ./build.sh) +* Possibilité de changer les noms des flux +* Ajout d’une option (désactivable donc) pour charger les images en lazyload permettant de ne pas charger toutes les images d’un coup +* Le framework Minz est maintenant directement inclus dans l’archive (plus besoin de passer par ./build.sh) * Amélioration des performances pour la récupération des flux tronqués -* Possibilité d'importer des flux sans catégorie lors de l'import OPML -* Suppression de "l'API" (qui était de toutes façons très basique) et de la fonctionnalité de "notes" -* Amélioration de la recherche (garde en mémoire si l'on a sélectionné une catégorie) par exemple +* Possibilité d’importer des flux sans catégorie lors de l’import OPML +* Suppression de “l’API” (qui était de toute façon très basique) et de la fonctionnalité de “notes” +* Amélioration de la recherche (garde en mémoire si l’on a sélectionné une catégorie) par exemple * Modification apparence des balises hr et pre * Meilleure vérification des champs de formulaire -* Remise en place du mode "endless" (permettant de simplement charger les articles qui suivent plutôt que de charger une nouvelle page) -* Ajout d'une page de visualisation des logs -* Ajout d'une option pour optimiser la BDD (diminue sa taille) +* Remise en place du mode “endless” (permettant de simplement charger les articles qui suivent plutôt que de charger une nouvelle page) +* Ajout d’une page de visualisation des logs +* Ajout d’une option pour optimiser la BDD (diminue sa taille) * Ajout des vues lecture et globale (assez basique) -* Les vidéos Youtube ne débordent plus du cadre sur les petits écrans -* Ajout d'une option pour marquer les articles comme lus lors du défilement (et suppression de celle au chargement de la page) +* Les vidéos YouTube ne débordent plus du cadre sur les petits écrans +* Ajout d’une option pour marquer les articles comme lus lors du défilement (et suppression de celle au chargement de la page) + -## 2013-05-05 changes with FreshRSS 0.3.0 +## 2013-05-05 FreshRSS 0.3.0 * Fallback pour les icônes SVG (utilisation de PNG à la place) * Fallback pour les propriétés CSS3 (utilisation de préfixes) * Affichage des tags associés aux articles -* Internationalisation de l'application (gestion des langues anglaise et française) +* Internationalisation de l’application (gestion des langues anglaise et française) * Gestion des flux protégés par authentification HTTP * Mise en cache des favicons -* Création d'un logo *temporaire* +* Création d’un logo *temporaire* * Affichage des vidéos dans les articles * Gestion de la recherche et filtre par tags pleinement fonctionnels -* Création d'un vrai script CRON permettant de mettre tous les flux à jour +* Création d’un vrai script CRON permettant de mettre tous les flux à jour * Correction bugs divers -## 2013-04-17 changes with FreshRSS 0.2.0 -* Création d'un installateur +## 2013-04-17 FreshRSS 0.2.0 + +* Création d’un installateur * Actualisation des flux en Ajax * Partage par mail et Shaarli ajouté * Export par flux RSS @@ -106,6 +167,7 @@ * Flux sans auteurs gérés normalement * Correction bugs divers -## 2013-04-08 changes with FreshRSS 0.1.0 -* "Première" version +## 2013-04-08 FreshRSS 0.1.0 + +* “Première” version diff --git a/constants.php b/constants.php index 05d60b242..304351823 100644 --- a/constants.php +++ b/constants.php @@ -1,6 +1,6 @@ Date: Mon, 23 Dec 2013 15:12:32 +0100 Subject: Typo install.php --- CHANGELOG | 2 +- public/install.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 0b7350b2e..af6936204 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -50,7 +50,7 @@ * Déplacement de “./app/configuration/application.ini” vers “./data/config.php” * Déplacement de “./public/data/Configuration.array.php” vers “./data/*_user.php” * Divers : - * Nouvel “agent utilisateur” utilisé lors du téléchargement des flux, par exemple : + * Nouvel “agent utilisateur” exposé lors du téléchargement des flux, par exemple : * “FreshRSS/0.7 (Linux; http://freshrss.org) SimplePie/1.3.1” diff --git a/public/install.php b/public/install.php index 642692cd0..56d626cc5 100644 --- a/public/install.php +++ b/public/install.php @@ -211,7 +211,7 @@ function saveStep2 () { if (!empty ($_POST)) { if (empty ($_POST['title']) || empty ($_POST['old_entries']) || - empty ($_POST['default_user']) { + empty ($_POST['default_user'])) { return false; } -- cgit v1.2.3 From ffbe676d7d33f8e075018bfa35f0d919e3e1a9bf Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Mon, 23 Dec 2013 22:20:05 +0100 Subject: SQL : f.keep_history en MEDIUMINT MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Passage de keep_history en MEDIUMINT plutôt que BOOLEAN (TINYINT) en prévision d'un historique plus personnalisable --- public/install.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/install.php b/public/install.php index 56d626cc5..afef7e473 100644 --- a/public/install.php +++ b/public/install.php @@ -33,7 +33,7 @@ define ('SQL_FEED', 'CREATE TABLE IF NOT EXISTS `%1$sfeed` ( `pathEntries` varchar(511) DEFAULT NULL, `httpAuth` varchar(511) DEFAULT NULL, `error` boolean DEFAULT 0, - `keep_history` boolean NOT NULL DEFAULT 0, + `keep_history` MEDIUMINT NOT NULL DEFAULT 0, `cache_nbEntries` int DEFAULT 0, -- v0.7 `cache_nbUnreads` int DEFAULT 0, -- v0.7 PRIMARY KEY (`id`), -- cgit v1.2.3 From 87bfa195a6ff4ff73baadd3c04b7b6f28c9f9b73 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Tue, 24 Dec 2013 01:21:11 +0100 Subject: Permet de configurer plus finement le nombre d’articles minimum à conserver par flux MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG | 1 + app/Controllers/feedController.php | 20 ++++++++------------ app/Models/EntryDAO.php | 2 +- app/Models/Feed.php | 17 +++++------------ app/Models/FeedDAO.php | 4 ++-- app/i18n/en.php | 7 +++++-- app/i18n/fr.php | 8 ++++++-- app/views/configure/display.phtml | 29 +++++++++++++++++++++-------- app/views/configure/feed.phtml | 22 ++++++++++++++++++---- public/install.php | 2 +- 10 files changed, 68 insertions(+), 44 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index af6936204..0c816dbd7 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -12,6 +12,7 @@ * Améliorations partage vers Shaarli, Poche, Diaspora*, Facebook, Twitter, Google+, courriel * Permet la suppression de tous les articles d’un flux * Option pour marquer les articles comme lus dès la réception + * Permet de configurer plus finement le nombre d’articles minimum à conserver par flux * Permet de modifier la description et l’adresse d’un flux RSS ainsi que le site Web associé * Nouveau raccourci pour ouvrir/fermer un article (‘c’ par défaut) * Bouton pour effacer les logs diff --git a/app/Controllers/feedController.php b/app/Controllers/feedController.php index 27b76dd42..e7d9c97c3 100755 --- a/app/Controllers/feedController.php +++ b/app/Controllers/feedController.php @@ -102,14 +102,11 @@ class FreshRSS_feed_Controller extends Minz_ActionController { $feedDAO->beginTransaction (); // on ajoute les articles en masse sans vérification foreach ($entries as $entry) { - if ($entry->date (true) >= $date_min || - $feed->keepHistory ()) { - $values = $entry->toArray (); - $values['id_feed'] = $feed->id (); - $values['id'] = min(time(), $entry->date (true)) . uSecString(); - $values['is_read'] = $is_read; - $entryDAO->addEntry ($values); - } + $values = $entry->toArray (); + $values['id_feed'] = $feed->id (); + $values['id'] = min(time(), $entry->date (true)) . uSecString(); + $values['is_read'] = $is_read; + $entryDAO->addEntry ($values); } $feedDAO->updateLastUpdate ($feed->id ()); $feedDAO->commit (); @@ -217,8 +214,7 @@ class FreshRSS_feed_Controller extends Minz_ActionController { $feedDAO->beginTransaction (); foreach ($entries as $entry) { if ((!isset ($existingGuids[$entry->guid ()])) && - ($entry->date (true) >= $date_min || - $feed->keepHistory ())) { + ($entry->date (true) >= $date_min)) { $values = $entry->toArray (); //Use declared date at first import, otherwise use discovery date $values['id'] = empty($existingGuids) ? min(time(), $entry->date (true)) . uSecString() : uTimeString(); @@ -227,8 +223,8 @@ class FreshRSS_feed_Controller extends Minz_ActionController { } } - if ((!$feed->keepHistory()) && (rand(0, 30) === 1)) { - $nb = $feedDAO->cleanOldEntries ($feed->id (), $date_min, count($entries) + 10); + if (($feed->keepHistory() >= 0) && (rand(0, 30) === 1)) { + $nb = $feedDAO->cleanOldEntries ($feed->id (), $date_min, max($feed->keepHistory(), count($entries) + 10)); if ($nb > 0) { Minz_Log::record ($nb . ' old entries cleaned in feed ' . $feed->id (), Minz_Log::DEBUG); } diff --git a/app/Models/EntryDAO.php b/app/Models/EntryDAO.php index c6bd5c404..f0207e96d 100644 --- a/app/Models/EntryDAO.php +++ b/app/Models/EntryDAO.php @@ -307,7 +307,7 @@ class FreshRSS_EntryDAO extends Minz_ModelPdo { $where .= 'AND e1.id ' . ($order === 'DESC' ? '<=' : '>=') . $firstId . ' '; } if (($date_min > 0) && ($type !== 's')) { - $where .= 'AND (e1.id >= ' . $date_min . '000000 OR e1.is_favorite = 1 OR f.keep_history = 1) '; + $where .= 'AND (e1.id >= ' . $date_min . '000000 OR e1.is_favorite = 1 OR f.keep_history <> 0) '; $joinFeed = true; } $search = ''; diff --git a/app/Models/Feed.php b/app/Models/Feed.php index 70efb0fa3..5bdf5e6d7 100644 --- a/app/Models/Feed.php +++ b/app/Models/Feed.php @@ -15,7 +15,7 @@ class FreshRSS_Feed extends Minz_Model { private $pathEntries = ''; private $httpAuth = ''; private $error = false; - private $keep_history = false; + private $keep_history = 0; public function __construct ($url, $validate=true) { if ($validate) { @@ -163,19 +163,12 @@ class FreshRSS_Feed extends Minz_Model { $this->httpAuth = $value; } public function _error ($value) { - if ($value) { - $value = true; - } else { - $value = false; - } - $this->error = $value; + $this->error = (bool)$value; } public function _keepHistory ($value) { - if ($value) { - $value = true; - } else { - $value = false; - } + $value = intval($value); + $value = min($value, 1000000); + $value = max($value, -1); $this->keep_history = $value; } public function _nbNotRead ($value) { diff --git a/app/Models/FeedDAO.php b/app/Models/FeedDAO.php index 9bd480544..451fc3850 100644 --- a/app/Models/FeedDAO.php +++ b/app/Models/FeedDAO.php @@ -193,7 +193,7 @@ class FreshRSS_FeedDAO extends Minz_ModelPdo { } public function listFeedsOrderUpdate () { - $sql = 'SELECT * FROM `' . $this->prefix . 'feed` ORDER BY lastUpdate'; + $sql = 'SELECT id, url, pathEntries, httpAuth, keep_history FROM `' . $this->prefix . 'feed` ORDER BY lastUpdate'; $stm = $this->bd->prepare ($sql); $stm->execute (); @@ -326,7 +326,7 @@ class FreshRSS_FeedDAO extends Minz_ModelPdo { $myFeed->_pathEntries (isset($dao['pathEntries']) ? $dao['pathEntries'] : ''); $myFeed->_httpAuth (isset($dao['httpAuth']) ? base64_decode ($dao['httpAuth']) : ''); $myFeed->_error ($dao['error']); - $myFeed->_keepHistory (isset($dao['keep_history']) ? $dao['keep_history'] : ''); + $myFeed->_keepHistory (isset($dao['keep_history']) ? $dao['keep_history'] : 0); $myFeed->_nbNotRead ($dao['cache_nbUnreads']); $myFeed->_nbEntries ($dao['cache_nbEntries']); if (isset ($dao['id'])) { diff --git a/app/i18n/en.php b/app/i18n/en.php index 9c30573e8..b6417d8db 100644 --- a/app/i18n/en.php +++ b/app/i18n/en.php @@ -137,7 +137,8 @@ return array ( 'feed_url' => 'Feed URL', 'articles' => 'articles', 'number_articles' => 'Number of articles', - 'keep_history' => 'Keep old articles?', + 'keep_history' => 'Minimum number of articles to keep', + 'keep_history_help' => 'Set to -1 to keep everything', 'categorize' => 'Store in a category', 'truncate' => 'Delete all articles', 'advanced' => 'Advanced', @@ -157,13 +158,15 @@ return array ( 'general_configuration' => 'General configuration', 'language' => 'Language', - 'delete_articles_every' => 'Remove articles after', 'month' => 'months', 'default_user' => 'Username of the default user (maximum 16 alphanumeric characters)', 'persona_connection_email' => 'Login mail address (use Mozilla Persona)', 'allow_anonymous' => 'Allow anonymous reading', 'auth_token' => 'Authentication token', 'explain_token' => 'Allows to access RSS output without authentication.
      %s?token=%s', + 'archiving_configuration' => 'Archiving configuration', + 'delete_articles_every' => 'Remove articles after', + 'archiving_configuration_help' => 'More options are available in the individual stream settings', 'reading_configuration' => 'Reading configuration', 'articles_per_page' => 'Number of articles per page', 'default_view' => 'Default view', diff --git a/app/i18n/fr.php b/app/i18n/fr.php index 85bbeb4b7..b27f29940 100644 --- a/app/i18n/fr.php +++ b/app/i18n/fr.php @@ -137,7 +137,8 @@ return array ( 'feed_url' => 'URL du flux', 'articles' => 'articles', 'number_articles' => 'Nombre d’articles', - 'keep_history' => 'Garder les vieux articles ?', + 'keep_history' => 'Nombre minimum d’articles à conserver', + 'keep_history_help' => 'Mettre à -1 pour tout conserver', 'categorize' => 'Ranger dans une catégorie', 'truncate' => 'Supprimer tous les articles', 'advanced' => 'Avancé', @@ -157,13 +158,16 @@ return array ( 'general_configuration' => 'Configuration générale', 'language' => 'Langue', - 'delete_articles_every' => 'Supprimer les articles après', + 'month' => 'mois', 'default_user' => 'Nom de l’utilisateur par défaut (16 caractères alphanumériques maximum)', 'persona_connection_email' => 'Adresse courriel de connexion (utilise Mozilla Persona)', 'allow_anonymous' => 'Autoriser la lecture anonyme', 'auth_token' => 'Jeton d’identification', 'explain_token' => 'Permet d’accéder à la sortie RSS sans besoin de s’authentifier.
      %s?output=rss&token=%s', + 'archiving_configuration' => 'Configuration de l’archivage', + 'delete_articles_every' => 'Supprimer les articles après', + 'archiving_configuration_help' => 'D’autres options sont disponibles dans la configuration individuelle des flux', 'reading_configuration' => 'Configuration de lecture', 'articles_per_page' => 'Nombre d’articles par page', 'default_view' => 'Vue par défaut', diff --git a/app/views/configure/display.phtml b/app/views/configure/display.phtml index ad35d7c71..68ef26bbf 100644 --- a/app/views/configure/display.phtml +++ b/app/views/configure/display.phtml @@ -31,13 +31,6 @@
    -
    - -
    - -
    -
    -
    conf->mailLogin (); ?> @@ -59,7 +52,27 @@
    - + + + +
    + +
    + + + + + + + + + + +
    + +
    +
    +
    diff --git a/app/views/configure/feed.phtml b/app/views/configure/feed.phtml index 4504b8d76..3fe7d1b3a 100644 --- a/app/views/configure/feed.phtml +++ b/app/views/configure/feed.phtml @@ -52,6 +52,9 @@
    + + +
    @@ -64,10 +67,21 @@
    flux->nbEntries (); ?> - +
    +
    +
    + +
    + + + + + + + + + +
    diff --git a/public/install.php b/public/install.php index afef7e473..3885f143e 100644 --- a/public/install.php +++ b/public/install.php @@ -93,7 +93,7 @@ FROM `%1$scategory006` ORDER BY id2; INSERT IGNORE INTO `%2$sfeed` (url, category, name, website, description, priority, pathEntries, httpAuth, keep_history) -SELECT url, category2, name, website, description, priority, pathEntries, httpAuth, keep_history +SELECT url, category2, name, website, description, priority, pathEntries, httpAuth, -1 * keep_history FROM `%1$sfeed006` ORDER BY id2; -- cgit v1.2.3 From 2e9a5cfb69b726ea1b11b8b5d45a78d38d4e1896 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Wed, 25 Dec 2013 14:15:40 +0100 Subject: Préparation 0.7-beta2 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 4 ++-- constants.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 87ed9de99..716859ccf 100644 --- a/README.md +++ b/README.md @@ -2,10 +2,10 @@ FreshRSS est un agrégateur de flux RSS à auto-héberger à l’image de [Leed](http://projet.idleman.fr/leed/) ou de [Kriss Feed](http://tontof.net/kriss/feed/). Il se veut léger et facile à prendre en main tout en étant un outil puissant et paramétrable. -* Site officiel : http://marienfressinaud.github.io/FreshRSS/ +* Site officiel : http://freshrss.org * Démo : http://marienfressinaud.fr/projets/freshrss/ * Développeur : Marien Fressinaud -* Version actuelle : 0.7-beta +* Version actuelle : 0.7-beta2 * Date de publication 2014-01-xx * License [GNU AGPL 3](http://www.gnu.org/licenses/agpl-3.0.html) diff --git a/constants.php b/constants.php index 304351823..d310e8f00 100644 --- a/constants.php +++ b/constants.php @@ -1,5 +1,5 @@ Date: Wed, 25 Dec 2013 14:16:48 +0100 Subject: Évite realpath pour problème open_basedir MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit https://github.com/marienfressinaud/FreshRSS/issues/331 À tester plus --- constants.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/constants.php b/constants.php index d310e8f00..272647947 100644 --- a/constants.php +++ b/constants.php @@ -3,7 +3,8 @@ define('FRESHRSS_VERSION', '0.7-beta2'); define('FRESHRSS_WEBSITE', 'http://freshrss.org'); // Constantes de chemins -define ('FRESHRSS_PATH', realpath (dirname (__FILE__))); +define ('FRESHRSS_PATH', dirname(__FILE__)); + define ('PUBLIC_PATH', FRESHRSS_PATH . '/public'); define ('DATA_PATH', FRESHRSS_PATH . '/data'); define ('LIB_PATH', FRESHRSS_PATH . '/lib'); -- cgit v1.2.3 From 7e6d2eb6f4236b4f04bfb7c976f135a1f33cc107 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Wed, 25 Dec 2013 14:21:29 +0100 Subject: Encore plus de flux tolérés avec leurs erreurs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Corrige https://github.com/marienfressinaud/FreshRSS/issues/332 --- CHANGELOG | 1 + lib/SimplePie/SimplePie.php | 13 +++++++------ lib/SimplePie/SimplePie/Parser.php | 30 ++++++++++++++++++++---------- 3 files changed, 28 insertions(+), 16 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 0c816dbd7..05d3a50ec 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -43,6 +43,7 @@ * PHP : * Meilleure gestion des caractères spéciaux dans différents cas * Amélioration des performances + * Encore plus tolérant pour les flux comportant des erreurs * Chargement automatique des classes * Alternative dans le cas d’absence de librairie JSON * Pour le développement, le cache HTTP peut être désactivé en créant un fichier “./no-cache.txt” diff --git a/lib/SimplePie/SimplePie.php b/lib/SimplePie/SimplePie.php index d20ab5430..f02037c10 100644 --- a/lib/SimplePie/SimplePie.php +++ b/lib/SimplePie/SimplePie.php @@ -1313,7 +1313,7 @@ class SimplePie // First check to see if input has been overridden. if ($this->input_encoding !== false) { - $encodings[] = $this->input_encoding; + $encodings[] = strtoupper($this->input_encoding); } $application_types = array('application/xml', 'application/xml-dtd', 'application/xml-external-parsed-entity'); @@ -1330,18 +1330,18 @@ class SimplePie } else { - $encodings[] = ''; //Let the DOM parser decide first + $encodings[] = ''; //FreshRSS: Let the DOM parser decide first } } elseif (in_array($sniffed, $text_types) || substr($sniffed, 0, 5) === 'text/' && substr($sniffed, -4) === '+xml') { if (isset($headers['content-type']) && preg_match('/;\x20?charset=([^;]*)/i', $headers['content-type'], $charset)) { - $encodings[] = $charset[1]; + $encodings[] = strtoupper($charset[1]); } else { - $encodings[] = ''; + $encodings[] = ''; //FreshRSS: Let the DOM parser decide first } $encodings[] = 'US-ASCII'; } @@ -1364,13 +1364,14 @@ class SimplePie foreach ($encodings as $encoding) { // Change the encoding to UTF-8 (as we always use UTF-8 internally) - if ($utf8_data = (empty($encoding) || $encoding === 'UTF-8') ? $this->raw_data : $this->registry->call('Misc', 'change_encoding', array($this->raw_data, $encoding, 'UTF-8'))) + if ($utf8_data = (empty($encoding) || $encoding === 'UTF-8') ? $this->raw_data : //FreshRSS + $this->registry->call('Misc', 'change_encoding', array($this->raw_data, $encoding, 'UTF-8'))) { // Create new parser $parser = $this->registry->create('Parser'); // If it's parsed fine - if ($parser->parse($utf8_data, 'UTF-8')) + if ($parser->parse($utf8_data, empty($encoding) ? '' : 'UTF-8')) //FreshRSS { $this->data = $parser->get_data(); if (!($this->get_type() & ~SIMPLEPIE_TYPE_NONE)) diff --git a/lib/SimplePie/SimplePie/Parser.php b/lib/SimplePie/SimplePie/Parser.php index c4c732787..bd6c4efd8 100644 --- a/lib/SimplePie/SimplePie/Parser.php +++ b/lib/SimplePie/SimplePie/Parser.php @@ -77,6 +77,8 @@ class SimplePie_Parser public function parse(&$data, $encoding) { + $xmlEncoding = ''; + if (!empty($encoding)) { // Use UTF-8 if we get passed US-ASCII, as every US-ASCII character is a UTF-8 character @@ -121,6 +123,7 @@ class SimplePie_Parser $declaration = $this->registry->create('XML_Declaration_Parser', array(substr($data, 5, $pos - 5))); if ($declaration->parse()) { + $xmlEncoding = strtoupper($declaration->encoding); //FreshRSS $data = substr($data, $pos + 2); $data = 'version . '" encoding="' . $encoding . '" standalone="' . (($declaration->standalone) ? 'yes' : 'no') . '"?>' . $data; } @@ -132,17 +135,24 @@ class SimplePie_Parser } } - try //FreshRSS - { - $dom = new DOMDocument(); - $dom->recover = true; - $dom->strictErrorChecking = false; - $dom->loadXML($data); - $this->encoding = $encoding = $dom->encoding = 'UTF-8'; - $data = $dom->saveXML(); - } - catch (Exception $e) + if ($xmlEncoding === '' || $xmlEncoding === 'UTF-8') //FreshRSS: case of no explicit HTTP encoding, and lax UTF-8 { + try + { + $dom = new DOMDocument(); + $dom->recover = true; + $dom->strictErrorChecking = false; + $dom->loadXML($data); + $this->encoding = $encoding = $dom->encoding = 'UTF-8'; + $data2 = $dom->saveXML(); + if (strlen($data2) > (strlen($data) / 2.0)) + { + $data = $data2; + } + } + catch (Exception $e) + { + } } $return = true; -- cgit v1.2.3 From a4b890b67fb4d97c97a2b1b455c327ce4b905194 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Wed, 25 Dec 2013 14:29:29 +0100 Subject: Suite gestion plus fine de l'historique --- app/Controllers/configureController.php | 7 +------ app/Models/FeedDAO.php | 2 +- app/views/configure/display.phtml | 37 ++++++++++++++++++++++++++------- app/views/configure/feed.phtml | 12 +++++++---- 4 files changed, 39 insertions(+), 19 deletions(-) diff --git a/app/Controllers/configureController.php b/app/Controllers/configureController.php index 8d3e02d3e..b83501f0b 100755 --- a/app/Controllers/configureController.php +++ b/app/Controllers/configureController.php @@ -97,18 +97,13 @@ class FreshRSS_configure_Controller extends Minz_ActionController { $description = sanitizeHTML(Minz_Request::param('description', '', true)); $website = Minz_Request::param('website', ''); $url = Minz_Request::param('url', ''); - $hist = Minz_Request::param ('keep_history', 'no'); + $keep_history = intval(Minz_Request::param ('keep_history', 0)); $cat = Minz_Request::param ('category', 0); $path = Minz_Request::param ('path_entries', ''); $priority = Minz_Request::param ('priority', 0); $user = Minz_Request::param ('http_user', ''); $pass = Minz_Request::param ('http_pass', ''); - $keep_history = false; - if ($hist == 'yes') { - $keep_history = true; - } - $httpAuth = ''; if ($user != '' || $pass != '') { $httpAuth = $user . ':' . $pass; diff --git a/app/Models/FeedDAO.php b/app/Models/FeedDAO.php index 451fc3850..7d91a032a 100644 --- a/app/Models/FeedDAO.php +++ b/app/Models/FeedDAO.php @@ -193,7 +193,7 @@ class FreshRSS_FeedDAO extends Minz_ModelPdo { } public function listFeedsOrderUpdate () { - $sql = 'SELECT id, url, pathEntries, httpAuth, keep_history FROM `' . $this->prefix . 'feed` ORDER BY lastUpdate'; + $sql = 'SELECT id, name, url, pathEntries, httpAuth, keep_history FROM `' . $this->prefix . 'feed` ORDER BY lastUpdate'; $stm = $this->bd->prepare ($sql); $stm->execute (); diff --git a/app/views/configure/display.phtml b/app/views/configure/display.phtml index 68ef26bbf..8995dc839 100644 --- a/app/views/configure/display.phtml +++ b/app/views/configure/display.phtml @@ -53,6 +53,13 @@
    +
    +
    + + +
    +
    +
    @@ -73,6 +80,13 @@
    +
    +
    + + +
    +
    +
    @@ -173,6 +187,13 @@
    +
    +
    + + +
    +
    +
    @@ -206,7 +227,14 @@ -
    conf->bottomlineLink () ? ' checked="checked"' : ''; ?> />
    +
    +
    + +
    +
    + + +
    @@ -220,12 +248,5 @@ - -
    -
    - - -
    -
    diff --git a/app/views/configure/feed.phtml b/app/views/configure/feed.phtml index 3fe7d1b3a..5940055ed 100644 --- a/app/views/configure/feed.phtml +++ b/app/views/configure/feed.phtml @@ -52,6 +52,12 @@ +
    +
    + + +
    +
    @@ -84,9 +90,9 @@ -
    - +
    +
    @@ -123,11 +129,9 @@
    -
    -
    -- cgit v1.2.3 From 06d4b8d10247146d9c6f7c78ff9fc584438dd8fe Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Wed, 25 Dec 2013 17:37:52 +0100 Subject: Option globale pour la taille minimale de l'historique par défaut MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Plus une réorganisation des options --- app/Controllers/configureController.php | 5 ++- app/Controllers/feedController.php | 9 +++-- app/Controllers/indexController.php | 5 +-- app/Models/Configuration.php | 14 +++++++- app/Models/ConfigurationDAO.php | 8 +++-- app/Models/EntryDAO.php | 8 +++-- app/Models/Feed.php | 4 +-- app/Models/FeedDAO.php | 4 +-- app/i18n/en.php | 8 +++-- app/i18n/fr.php | 8 +++-- app/views/configure/display.phtml | 35 ++++++++++++------- app/views/configure/feed.phtml | 62 ++++++++++++++++++--------------- public/install.php | 4 +-- public/themes/default/freshrss.css | 4 +++ public/themes/default/global.css | 3 ++ public/themes/flat-design/freshrss.css | 4 +++ public/themes/flat-design/global.css | 3 ++ 17 files changed, 124 insertions(+), 64 deletions(-) diff --git a/app/Controllers/configureController.php b/app/Controllers/configureController.php index b83501f0b..762134dd0 100755 --- a/app/Controllers/configureController.php +++ b/app/Controllers/configureController.php @@ -97,7 +97,7 @@ class FreshRSS_configure_Controller extends Minz_ActionController { $description = sanitizeHTML(Minz_Request::param('description', '', true)); $website = Minz_Request::param('website', ''); $url = Minz_Request::param('url', ''); - $keep_history = intval(Minz_Request::param ('keep_history', 0)); + $keep_history = intval(Minz_Request::param ('keep_history', -2)); $cat = Minz_Request::param ('category', 0); $path = Minz_Request::param ('path_entries', ''); $priority = Minz_Request::param ('priority', 0); @@ -160,6 +160,7 @@ class FreshRSS_configure_Controller extends Minz_ActionController { $lazyload = Minz_Request::param ('lazyload', 'no'); $sort = Minz_Request::param ('sort_order', 'DESC'); $old = Minz_Request::param ('old_entries', 3); + $keepHistoryDefault = Minz_Request::param('keep_history_default', 0); $mail = Minz_Request::param ('mail_login', false); $anon = Minz_Request::param ('anon_access', 'no'); $token = Minz_Request::param ('token', $current_token); @@ -189,6 +190,7 @@ class FreshRSS_configure_Controller extends Minz_ActionController { $this->view->conf->_lazyload ($lazyload); $this->view->conf->_sortOrder ($sort); $this->view->conf->_oldEntries ($old); + $this->view->conf->_keepHistoryDefault($keepHistoryDefault); $this->view->conf->_mailLogin ($mail); $this->view->conf->_anonAccess ($anon); $this->view->conf->_token ($token); @@ -221,6 +223,7 @@ class FreshRSS_configure_Controller extends Minz_ActionController { 'lazyload' => $this->view->conf->lazyload (), 'sort_order' => $this->view->conf->sortOrder (), 'old_entries' => $this->view->conf->oldEntries (), + 'keep_history_default' => $this->view->conf->keepHistoryDefault(), 'mail_login' => $this->view->conf->mailLogin (), 'anon_access' => $this->view->conf->anonAccess (), 'token' => $this->view->conf->token (), diff --git a/app/Controllers/feedController.php b/app/Controllers/feedController.php index e7d9c97c3..836044da6 100755 --- a/app/Controllers/feedController.php +++ b/app/Controllers/feedController.php @@ -223,8 +223,13 @@ class FreshRSS_feed_Controller extends Minz_ActionController { } } - if (($feed->keepHistory() >= 0) && (rand(0, 30) === 1)) { - $nb = $feedDAO->cleanOldEntries ($feed->id (), $date_min, max($feed->keepHistory(), count($entries) + 10)); + $feedHistory = $feed->keepHistory(); + if ($feedHistory == -2) { //default + $feedHistory = $this->view->conf->keepHistoryDefault(); + } + + if (($feedHistory >= 0) && (rand(0, 30) === 1)) { + $nb = $feedDAO->cleanOldEntries ($feed->id (), $date_min, max($feedHistory, count($entries) + 10)); if ($nb > 0) { Minz_Log::record ($nb . ' old entries cleaned in feed ' . $feed->id (), Minz_Log::DEBUG); } diff --git a/app/Controllers/indexController.php b/app/Controllers/indexController.php index e3c253518..6c0ba9058 100755 --- a/app/Controllers/indexController.php +++ b/app/Controllers/indexController.php @@ -130,16 +130,17 @@ class FreshRSS_index_Controller extends Minz_ActionController { // on calcule la date des articles les plus anciens qu'on affiche $nb_month_old = $this->view->conf->oldEntries (); $date_min = $today - (3600 * 24 * 30 * $nb_month_old); //Do not use a fast changing value such as time() to allow SQL caching + $keepHistoryDefault = $this->view->conf->keepHistoryDefault(); try { - $entries = $this->entryDAO->listWhere($getType, $getId, $state, $order, $nb + 1, $first, $filter, $date_min); + $entries = $this->entryDAO->listWhere($getType, $getId, $state, $order, $nb + 1, $first, $filter, $date_min, $keepHistoryDefault); // Si on a récupéré aucun article "non lus" // on essaye de récupérer tous les articles if ($state === 'not_read' && empty($entries)) { //TODO: Remove in v0.8 Minz_Log::record ('Conflicting information about nbNotRead!', Minz_Log::DEBUG); $this->view->state = 'all'; - $entries = $this->entryDAO->listWhere($getType, $getId, 'all', $order, $nb, $first, $filter, $date_min); + $entries = $this->entryDAO->listWhere($getType, $getId, 'all', $order, $nb, $first, $filter, $date_min, $keepHistoryDefault); } if (count($entries) <= $nb) { diff --git a/app/Models/Configuration.php b/app/Models/Configuration.php index d5f69601f..47509636f 100644 --- a/app/Models/Configuration.php +++ b/app/Models/Configuration.php @@ -14,6 +14,7 @@ class FreshRSS_Configuration extends Minz_Model { private $lazyload; private $sort_order; private $old_entries; + private $keep_history_default; private $shortcuts = array (); private $mail_login = ''; private $mark_when = array (); @@ -44,6 +45,7 @@ class FreshRSS_Configuration extends Minz_Model { $this->_lazyload ($confDAO->lazyload); $this->_sortOrder ($confDAO->sort_order); $this->_oldEntries ($confDAO->old_entries); + $this->_keepHistoryDefault($confDAO->keep_history_default); $this->_shortcuts ($confDAO->shortcuts); $this->_mailLogin ($confDAO->mail_login); $this->_markWhen ($confDAO->mark_when); @@ -95,6 +97,9 @@ class FreshRSS_Configuration extends Minz_Model { public function oldEntries () { return $this->old_entries; } + public function keepHistoryDefault() { + return $this->keep_history_default; + } public function shortcuts () { return $this->shortcuts; } @@ -217,11 +222,18 @@ class FreshRSS_Configuration extends Minz_Model { } public function _oldEntries ($value) { if (ctype_digit ($value) && $value > 0) { - $this->old_entries = $value; + $this->old_entries = intval($value); } else { $this->old_entries = 3; } } + public function _keepHistoryDefault($value) { + if (ctype_digit($value) && $value >= -1) { + $this->keep_history_default = intval($value); + } else { + $this->keep_history_default = 0; + } + } public function _shortcuts ($values) { foreach ($values as $key => $value) { $this->shortcuts[$key] = $value; diff --git a/app/Models/ConfigurationDAO.php b/app/Models/ConfigurationDAO.php index 0eebf2d90..91210e701 100644 --- a/app/Models/ConfigurationDAO.php +++ b/app/Models/ConfigurationDAO.php @@ -10,6 +10,7 @@ class FreshRSS_ConfigurationDAO extends Minz_ModelArray { public $lazyload = 'yes'; public $sort_order = 'DESC'; public $old_entries = 3; + public $keep_history_default = 0; public $shortcuts = array ( 'mark_read' => 'r', 'mark_favorite' => 'f', @@ -62,7 +63,7 @@ class FreshRSS_ConfigurationDAO extends Minz_ModelArray { $this->language = $this->array['language']; } if (isset ($this->array['posts_per_page'])) { - $this->posts_per_page = $this->array['posts_per_page']; + $this->posts_per_page = intval($this->array['posts_per_page']); } if (isset ($this->array['view_mode'])) { $this->view_mode = $this->array['view_mode']; @@ -83,7 +84,10 @@ class FreshRSS_ConfigurationDAO extends Minz_ModelArray { $this->sort_order = $this->array['sort_order']; } if (isset ($this->array['old_entries'])) { - $this->old_entries = $this->array['old_entries']; + $this->old_entries = intval($this->array['old_entries']); + } + if (isset ($this->array['keep_history_default'])) { + $this->keep_history_default = intval($this->array['keep_history_default']); } if (isset ($this->array['shortcuts'])) { $this->shortcuts = array_merge ( diff --git a/app/Models/EntryDAO.php b/app/Models/EntryDAO.php index f0207e96d..14d3ddcff 100644 --- a/app/Models/EntryDAO.php +++ b/app/Models/EntryDAO.php @@ -260,7 +260,7 @@ class FreshRSS_EntryDAO extends Minz_ModelPdo { return isset ($entries[0]) ? $entries[0] : false; } - public function listWhere($type = 'a', $id = '', $state = 'all', $order = 'DESC', $limit = 1, $firstId = '', $filter = '', $date_min = 0) { + public function listWhere($type = 'a', $id = '', $state = 'all', $order = 'DESC', $limit = 1, $firstId = '', $filter = '', $date_min = 0, $keepHistoryDefault = 0) { $where = ''; $joinFeed = false; $values = array(); @@ -307,7 +307,11 @@ class FreshRSS_EntryDAO extends Minz_ModelPdo { $where .= 'AND e1.id ' . ($order === 'DESC' ? '<=' : '>=') . $firstId . ' '; } if (($date_min > 0) && ($type !== 's')) { - $where .= 'AND (e1.id >= ' . $date_min . '000000 OR e1.is_favorite = 1 OR f.keep_history <> 0) '; + $where .= 'AND (e1.id >= ' . $date_min . '000000 OR e1.is_favorite = 1 OR (f.keep_history <> 0'; + if (intval($keepHistoryDefault) === 0) { + $where .= ' AND f.keep_history <> -2'; //default + } + $where .= ')) '; $joinFeed = true; } $search = ''; diff --git a/app/Models/Feed.php b/app/Models/Feed.php index 5bdf5e6d7..ef554e083 100644 --- a/app/Models/Feed.php +++ b/app/Models/Feed.php @@ -15,7 +15,7 @@ class FreshRSS_Feed extends Minz_Model { private $pathEntries = ''; private $httpAuth = ''; private $error = false; - private $keep_history = 0; + private $keep_history = -2; public function __construct ($url, $validate=true) { if ($validate) { @@ -168,7 +168,7 @@ class FreshRSS_Feed extends Minz_Model { public function _keepHistory ($value) { $value = intval($value); $value = min($value, 1000000); - $value = max($value, -1); + $value = max($value, -2); $this->keep_history = $value; } public function _nbNotRead ($value) { diff --git a/app/Models/FeedDAO.php b/app/Models/FeedDAO.php index 7d91a032a..c1d1f24e8 100644 --- a/app/Models/FeedDAO.php +++ b/app/Models/FeedDAO.php @@ -2,7 +2,7 @@ class FreshRSS_FeedDAO extends Minz_ModelPdo { public function addFeed ($valuesTmp) { - $sql = 'INSERT INTO `' . $this->prefix . 'feed` (url, category, name, website, description, lastUpdate, priority, httpAuth, error, keep_history) VALUES(?, ?, ?, ?, ?, ?, 10, ?, 0, 0)'; + $sql = 'INSERT INTO `' . $this->prefix . 'feed` (url, category, name, website, description, lastUpdate, priority, httpAuth, error, keep_history) VALUES(?, ?, ?, ?, ?, ?, 10, ?, 0, -2)'; $stm = $this->bd->prepare ($sql); $values = array ( @@ -326,7 +326,7 @@ class FreshRSS_FeedDAO extends Minz_ModelPdo { $myFeed->_pathEntries (isset($dao['pathEntries']) ? $dao['pathEntries'] : ''); $myFeed->_httpAuth (isset($dao['httpAuth']) ? base64_decode ($dao['httpAuth']) : ''); $myFeed->_error ($dao['error']); - $myFeed->_keepHistory (isset($dao['keep_history']) ? $dao['keep_history'] : 0); + $myFeed->_keepHistory(isset($dao['keep_history']) ? $dao['keep_history'] : -2); $myFeed->_nbNotRead ($dao['cache_nbUnreads']); $myFeed->_nbEntries ($dao['cache_nbEntries']); if (isset ($dao['id'])) { diff --git a/app/i18n/en.php b/app/i18n/en.php index b6417d8db..ca72d885c 100644 --- a/app/i18n/en.php +++ b/app/i18n/en.php @@ -137,8 +137,9 @@ return array ( 'feed_url' => 'Feed URL', 'articles' => 'articles', 'number_articles' => 'Number of articles', + 'by_feed' => 'by feed', + 'by_default' => 'By default', 'keep_history' => 'Minimum number of articles to keep', - 'keep_history_help' => 'Set to -1 to keep everything', 'categorize' => 'Store in a category', 'truncate' => 'Delete all articles', 'advanced' => 'Advanced', @@ -164,10 +165,11 @@ return array ( 'allow_anonymous' => 'Allow anonymous reading', 'auth_token' => 'Authentication token', 'explain_token' => 'Allows to access RSS output without authentication.
    %s?token=%s', - 'archiving_configuration' => 'Archiving configuration', + 'login_configuration' => 'Login', + 'archiving_configuration' => 'Archiving', 'delete_articles_every' => 'Remove articles after', 'archiving_configuration_help' => 'More options are available in the individual stream settings', - 'reading_configuration' => 'Reading configuration', + 'reading_configuration' => 'Reading', 'articles_per_page' => 'Number of articles per page', 'default_view' => 'Default view', 'sort_order' => 'Sort order', diff --git a/app/i18n/fr.php b/app/i18n/fr.php index b27f29940..053a97c8a 100644 --- a/app/i18n/fr.php +++ b/app/i18n/fr.php @@ -137,8 +137,9 @@ return array ( 'feed_url' => 'URL du flux', 'articles' => 'articles', 'number_articles' => 'Nombre d’articles', + 'by_feed' => 'par flux', + 'by_default' => 'Par défaut', 'keep_history' => 'Nombre minimum d’articles à conserver', - 'keep_history_help' => 'Mettre à -1 pour tout conserver', 'categorize' => 'Ranger dans une catégorie', 'truncate' => 'Supprimer tous les articles', 'advanced' => 'Avancé', @@ -165,10 +166,11 @@ return array ( 'allow_anonymous' => 'Autoriser la lecture anonyme', 'auth_token' => 'Jeton d’identification', 'explain_token' => 'Permet d’accéder à la sortie RSS sans besoin de s’authentifier.
    %s?output=rss&token=%s', - 'archiving_configuration' => 'Configuration de l’archivage', + 'login_configuration' => 'Identification', + 'archiving_configuration' => 'Archivage', 'delete_articles_every' => 'Supprimer les articles après', 'archiving_configuration_help' => 'D’autres options sont disponibles dans la configuration individuelle des flux', - 'reading_configuration' => 'Configuration de lecture', + 'reading_configuration' => 'Lecture', 'articles_per_page' => 'Nombre d’articles par page', 'default_view' => 'Vue par défaut', 'sort_order' => 'Ordre de tri', diff --git a/app/views/configure/display.phtml b/app/views/configure/display.phtml index 8995dc839..3280f657f 100644 --- a/app/views/configure/display.phtml +++ b/app/views/configure/display.phtml @@ -31,6 +31,15 @@ +
    +
    + + +
    +
    + + +
    conf->mailLogin (); ?> @@ -61,22 +70,22 @@
    - +

    +
    - - - - - - - - - - -
    - + +
    +
    +
    + +
    +
    diff --git a/app/views/configure/feed.phtml b/app/views/configure/feed.phtml index 5940055ed..e738ab64f 100644 --- a/app/views/configure/feed.phtml +++ b/app/views/configure/feed.phtml @@ -52,6 +52,15 @@ +
    + +
    + +
    +
    @@ -78,16 +87,11 @@
    - - - - - - - - - - +
    @@ -97,24 +101,7 @@
    - -
    - -
    - -
    -
    -
    - -
    - - -
    -
    - + flux->httpAuth (false); ?>
    @@ -131,7 +118,24 @@
    - + + +
    +
    + + +
    + +
    + + +
    +
    + +
    +
    + +
    diff --git a/public/install.php b/public/install.php index 3885f143e..13abb010b 100644 --- a/public/install.php +++ b/public/install.php @@ -33,7 +33,7 @@ define ('SQL_FEED', 'CREATE TABLE IF NOT EXISTS `%1$sfeed` ( `pathEntries` varchar(511) DEFAULT NULL, `httpAuth` varchar(511) DEFAULT NULL, `error` boolean DEFAULT 0, - `keep_history` MEDIUMINT NOT NULL DEFAULT 0, + `keep_history` MEDIUMINT NOT NULL DEFAULT -2, -- v0.7, -2 = default `cache_nbEntries` int DEFAULT 0, -- v0.7 `cache_nbUnreads` int DEFAULT 0, -- v0.7 PRIMARY KEY (`id`), @@ -93,7 +93,7 @@ FROM `%1$scategory006` ORDER BY id2; INSERT IGNORE INTO `%2$sfeed` (url, category, name, website, description, priority, pathEntries, httpAuth, keep_history) -SELECT url, category2, name, website, description, priority, pathEntries, httpAuth, -1 * keep_history +SELECT url, category2, name, website, description, priority, pathEntries, httpAuth, IF(keep_history = 1, -1, -2) FROM `%1$sfeed006` ORDER BY id2; diff --git a/public/themes/default/freshrss.css b/public/themes/default/freshrss.css index e3c4c3c3b..2b157b27a 100644 --- a/public/themes/default/freshrss.css +++ b/public/themes/default/freshrss.css @@ -667,6 +667,10 @@ padding:.5em; } +select.number option { + text-align:right; +} + @media(max-width: 840px) { .header, .aside .btn-important, diff --git a/public/themes/default/global.css b/public/themes/default/global.css index 1c554d2dc..440fc6e41 100644 --- a/public/themes/default/global.css +++ b/public/themes/default/global.css @@ -99,6 +99,9 @@ input, select, textarea { vertical-align: middle; box-shadow: 0 2px 2px #eee inset; } + option { + padding:0 .5em 0 .5em; + } input[type="radio"], input[type="checkbox"] { width: 15px !important; diff --git a/public/themes/flat-design/freshrss.css b/public/themes/flat-design/freshrss.css index fa1ed13e6..7e3f4c81a 100644 --- a/public/themes/flat-design/freshrss.css +++ b/public/themes/flat-design/freshrss.css @@ -662,6 +662,10 @@ body { padding:.5em; } +select.number option { + text-align:right; +} + @media(max-width: 840px) { .header, .aside .btn-important, diff --git a/public/themes/flat-design/global.css b/public/themes/flat-design/global.css index 8cf6412b3..90b59d002 100644 --- a/public/themes/flat-design/global.css +++ b/public/themes/flat-design/global.css @@ -101,6 +101,9 @@ input, select, textarea { vertical-align: middle; border-radius: 5px; } + option { + padding:0 .5em 0 .5em; + } input[type="radio"], input[type="checkbox"] { width: 15px !important; -- cgit v1.2.3 From c2375265c040da5b71c4acf2871f5479fab3044c Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Wed, 25 Dec 2013 18:18:14 +0100 Subject: Fin taille historique MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Permet d'éviter les problèmes de flux vides à l'importation https://github.com/marienfressinaud/FreshRSS/issues/332 , ou de nombre d'articles non-lus qui ne correspondent pas au nombre d'articles affichés --- app/Models/EntryDAO.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Models/EntryDAO.php b/app/Models/EntryDAO.php index 14d3ddcff..99aaf3a0d 100644 --- a/app/Models/EntryDAO.php +++ b/app/Models/EntryDAO.php @@ -307,7 +307,7 @@ class FreshRSS_EntryDAO extends Minz_ModelPdo { $where .= 'AND e1.id ' . ($order === 'DESC' ? '<=' : '>=') . $firstId . ' '; } if (($date_min > 0) && ($type !== 's')) { - $where .= 'AND (e1.id >= ' . $date_min . '000000 OR e1.is_favorite = 1 OR (f.keep_history <> 0'; + $where .= 'AND (e1.id >= ' . $date_min . '000000 OR e1.is_read = 0 OR e1.is_favorite = 1 OR (f.keep_history <> 0'; if (intval($keepHistoryDefault) === 0) { $where .= ' AND f.keep_history <> -2'; //default } -- cgit v1.2.3 From 0b3d79745d7b8db5dc684f91e0bbad6c1a03d0ee Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Wed, 25 Dec 2013 18:50:05 +0100 Subject: Encodage titre flux pour cas Glazman --- app/Models/Feed.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/Models/Feed.php b/app/Models/Feed.php index ef554e083..dcf97d4ec 100644 --- a/app/Models/Feed.php +++ b/app/Models/Feed.php @@ -250,11 +250,11 @@ class FreshRSS_Feed extends Minz_Model { $this->_url ($subscribe_url); } - $title = $feed->get_title (); + $title = htmlspecialchars(html_only_entity_decode($feed->get_title()), ENT_COMPAT, 'UTF-8'); $this->_name (!is_null ($title) ? $title : $this->url); - $this->_website ($feed->get_link ()); - $this->_description ($feed->get_description ()); + $this->_website(html_only_entity_decode($feed->get_link())); + $this->_description(html_only_entity_decode($feed->get_description())); // et on charge les articles du flux $this->loadEntries ($feed); -- cgit v1.2.3 From 7eda2793bbc3210ae37aa66511fd7ad7661c2149 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Wed, 25 Dec 2013 19:53:09 +0100 Subject: Nouveau bouton pour lancer manuellement la purge des vieux articles MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Attention, si on supprime des articles qui sont encore dans les flux RSS, ils risquent de réapparaitre en cas de date manquante ou erronée, ou si l'utilisateur augmente la date d'expiration. Ce bouton est plus strict que la purge automatique qui conserve toujours au moins le même nombre d'articles que dans le flux RSS en cours + 10. --- app/Controllers/entryController.php | 41 +++++++++++++++++++++++++++++++++++++ app/Controllers/feedController.php | 2 +- app/Models/FeedDAO.php | 27 +++++++++++++----------- app/i18n/en.php | 2 ++ app/i18n/fr.php | 2 ++ app/views/configure/display.phtml | 1 + 6 files changed, 62 insertions(+), 13 deletions(-) diff --git a/app/Controllers/entryController.php b/app/Controllers/entryController.php index a332ca8a9..1c3c56c4d 100755 --- a/app/Controllers/entryController.php +++ b/app/Controllers/entryController.php @@ -109,4 +109,45 @@ class FreshRSS_entry_Controller extends Minz_ActionController { 'a' => 'display' ), true); } + + public function purgeAction() { + @set_time_limit(300); + + $nb_month_old = max($this->view->conf->oldEntries(), 1); + $date_min = time() - (3600 * 24 * 30 * $nb_month_old); + + $feedDAO = new FreshRSS_FeedDAO(); + $feeds = $feedDAO->listFeedsOrderUpdate(); + $nbTotal = 0; + + invalidateHttpCache(); + + foreach ($feeds as $feed) { + $feedHistory = $feed->keepHistory(); + if ($feedHistory == -2) { //default + $feedHistory = $this->view->conf->keepHistoryDefault(); + } + if ($feedHistory >= 0) { + $nb = $feedDAO->cleanOldEntries($feed->id(), $date_min, $feedHistory); + if ($nb > 0) { + $nbTotal += $nb; + Minz_Log::record($nb . ' old entries cleaned in feed ' . $feed->id(), Minz_Log::DEBUG); + $feedDAO->updateLastUpdate($feed->id()); + } + } + } + + invalidateHttpCache(); + + $notif = array( + 'type' => 'good', + 'content' => Minz_Translate::t('purge_completed', $nbTotal) + ); + Minz_Session::_param('notification', $notif); + + Minz_Request::forward(array( + 'c' => 'configure', + 'a' => 'display' + ), true); + } } diff --git a/app/Controllers/feedController.php b/app/Controllers/feedController.php index 836044da6..04d0aa98b 100755 --- a/app/Controllers/feedController.php +++ b/app/Controllers/feedController.php @@ -192,7 +192,7 @@ class FreshRSS_feed_Controller extends Minz_ActionController { } // on calcule la date des articles les plus anciens qu'on accepte - $nb_month_old = $this->view->conf->oldEntries (); + $nb_month_old = max($this->view->conf->oldEntries(), 1); $date_min = time () - (3600 * 24 * 30 * $nb_month_old); $i = 0; diff --git a/app/Models/FeedDAO.php b/app/Models/FeedDAO.php index c1d1f24e8..d517f9580 100644 --- a/app/Models/FeedDAO.php +++ b/app/Models/FeedDAO.php @@ -315,20 +315,23 @@ class FreshRSS_FeedDAO extends Minz_ModelPdo { if (isset ($dao['id'])) { $key = $dao['id']; } + if ($catID === null) { + $catID = isset($dao['category']) ? $dao['category'] : 0; + } - $myFeed = new FreshRSS_Feed (isset($dao['url']) ? $dao['url'] : '', false); - $myFeed->_category ($catID === null ? $dao['category'] : $catID); - $myFeed->_name ($dao['name']); - $myFeed->_website ($dao['website'], false); - $myFeed->_description (isset($dao['description']) ? $dao['description'] : ''); - $myFeed->_lastUpdate (isset($dao['lastUpdate']) ? $dao['lastUpdate'] : 0); - $myFeed->_priority ($dao['priority']); - $myFeed->_pathEntries (isset($dao['pathEntries']) ? $dao['pathEntries'] : ''); - $myFeed->_httpAuth (isset($dao['httpAuth']) ? base64_decode ($dao['httpAuth']) : ''); - $myFeed->_error ($dao['error']); + $myFeed = new FreshRSS_Feed(isset($dao['url']) ? $dao['url'] : '', false); + $myFeed->_category(intval($catID)); + $myFeed->_name($dao['name']); + $myFeed->_website(isset($dao['website']) ? $dao['website'] : '', false); + $myFeed->_description(isset($dao['description']) ? $dao['description'] : ''); + $myFeed->_lastUpdate(isset($dao['lastUpdate']) ? $dao['lastUpdate'] : 0); + $myFeed->_priority(isset($dao['priority']) ? $dao['priority'] : 10); + $myFeed->_pathEntries(isset($dao['pathEntries']) ? $dao['pathEntries'] : ''); + $myFeed->_httpAuth(isset($dao['httpAuth']) ? base64_decode ($dao['httpAuth']) : ''); + $myFeed->_error(isset($dao['error']) ? $dao['error'] : 0); $myFeed->_keepHistory(isset($dao['keep_history']) ? $dao['keep_history'] : -2); - $myFeed->_nbNotRead ($dao['cache_nbUnreads']); - $myFeed->_nbEntries ($dao['cache_nbEntries']); + $myFeed->_nbNotRead(isset($dao['cache_nbUnreads']) ? $dao['cache_nbUnreads'] : 0); + $myFeed->_nbEntries(isset($dao['cache_nbEntries']) ? $dao['cache_nbEntries'] : 0); if (isset ($dao['id'])) { $myFeed->_id ($dao['id']); } diff --git a/app/i18n/en.php b/app/i18n/en.php index ca72d885c..498fccd14 100644 --- a/app/i18n/en.php +++ b/app/i18n/en.php @@ -168,6 +168,8 @@ return array ( 'login_configuration' => 'Login', 'archiving_configuration' => 'Archiving', 'delete_articles_every' => 'Remove articles after', + 'purge_now' => 'Purge now', + 'purge_completed' => 'Purge completed (%d articles deleted)', 'archiving_configuration_help' => 'More options are available in the individual stream settings', 'reading_configuration' => 'Reading', 'articles_per_page' => 'Number of articles per page', diff --git a/app/i18n/fr.php b/app/i18n/fr.php index 053a97c8a..c918daa44 100644 --- a/app/i18n/fr.php +++ b/app/i18n/fr.php @@ -169,6 +169,8 @@ return array ( 'login_configuration' => 'Identification', 'archiving_configuration' => 'Archivage', 'delete_articles_every' => 'Supprimer les articles après', + 'purge_now' => 'Purger maintenant', + 'purge_completed' => 'Purge effectuée (%d articles supprimés)', 'archiving_configuration_help' => 'D’autres options sont disponibles dans la configuration individuelle des flux', 'reading_configuration' => 'Lecture', 'articles_per_page' => 'Nombre d’articles par page', diff --git a/app/views/configure/display.phtml b/app/views/configure/display.phtml index 3280f657f..fca533752 100644 --- a/app/views/configure/display.phtml +++ b/app/views/configure/display.phtml @@ -76,6 +76,7 @@
    +  
    -- cgit v1.2.3 From d24b1e963e208a03f08b1d17ed9f319bd59a36ad Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Wed, 25 Dec 2013 21:46:24 +0100 Subject: Lancer automatiquement le raffraîchissement des flux après une mise à jour de FreshRSS MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit https://github.com/marienfressinaud/FreshRSS/issues/330 --- app/FreshRSS.php | 2 +- app/views/helpers/javascript_vars.phtml | 7 ++++--- constants.php | 2 +- lib/Minz/Session.php | 30 ++++++++++++++++-------------- public/install.php | 4 +++- 5 files changed, 25 insertions(+), 20 deletions(-) diff --git a/app/FreshRSS.php b/app/FreshRSS.php index 90548793d..60610e352 100644 --- a/app/FreshRSS.php +++ b/app/FreshRSS.php @@ -1,7 +1,7 @@ loadParamsView (); diff --git a/app/views/helpers/javascript_vars.phtml b/app/views/helpers/javascript_vars.phtml index 0c1af45fc..d008e2e48 100644 --- a/app/views/helpers/javascript_vars.phtml +++ b/app/views/helpers/javascript_vars.phtml @@ -39,7 +39,8 @@ echo 'str_confirmation="', Minz_Translate::t('confirm_action'), '"', ",\n"; - echo 'auto_actualize_feeds=', Minz_Session::param('actualize_feeds', false) ? 'true' : 'false', ";\n"; - if (Minz_Session::param('actualize_feeds', false)) { - Minz_Session::_param('actualize_feeds'); + $autoActualise = Minz_Session::param('actualize_feeds', false); + echo 'auto_actualize_feeds=', $autoActualise ? 'true' : 'false', ";\n"; + if ($autoActualise) { + Minz_Session::_param('actualize_feeds', false); } diff --git a/constants.php b/constants.php index 272647947..c22209efe 100644 --- a/constants.php +++ b/constants.php @@ -1,5 +1,5 @@ 3 && $s3['all'] != 'ok') { header ('Location: index.php?step=3'); } + $_SESSION['actualize_feeds'] = true; } function checkStep0 () { moveOldFiles() && removeOldFiles(); -- cgit v1.2.3 From 1da74b1eddfafd9191548e0fde150690b80f694b Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Wed, 25 Dec 2013 23:57:02 +0100 Subject: Affichage version dans "à propos" MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/i18n/en.php | 1 + app/i18n/fr.php | 1 + app/views/index/about.phtml | 3 +++ 3 files changed, 5 insertions(+) diff --git a/app/i18n/en.php b/app/i18n/en.php index 498fccd14..40c634f7c 100644 --- a/app/i18n/en.php +++ b/app/i18n/en.php @@ -239,6 +239,7 @@ return array ( 'freshrss_description' => 'FreshRSS is a RSS feeds aggregator to self-host like Kriss Feed or Leed. It is light and easy to take in hand while being powerful and configurable tool.', 'credits' => 'Credits', 'credits_content' => 'Some design elements come from Bootstrap although FreshRSS doesn’t use this framework. Icons come from GNOME project. Open Sans font police used has been created by Steve Matteson. Favicons are collected with getFavicon API. FreshRSS is based on Minz, a PHP framework.', + 'version' => 'Version', 'logs' => 'Logs', 'logs_empty' => 'Log file is empty', diff --git a/app/i18n/fr.php b/app/i18n/fr.php index c918daa44..14160bb7e 100644 --- a/app/i18n/fr.php +++ b/app/i18n/fr.php @@ -240,6 +240,7 @@ return array ( 'freshrss_description' => 'FreshRSS est un agrégateur de flux RSS à auto-héberger à l’image de Kriss Feed ou Leed. Il se veut léger et facile à prendre en main tout en étant un outil puissant et paramétrable.', 'credits' => 'Crédits', 'credits_content' => 'Des éléments de design sont issus du projet Bootstrap bien que FreshRSS n’utilise pas ce framework. Les icônes sont issues du projet GNOME. La police Open Sans utilisée a été créée par Steve Matteson. Les favicons sont récupérés grâce au site getFavicon. FreshRSS repose sur Minz, un framework PHP.', + 'version' => 'Version', 'logs' => 'Logs', 'logs_empty' => 'Les logs sont vides', diff --git a/app/views/index/about.phtml b/app/views/index/about.phtml index b5c00a1ed..ae64727d7 100644 --- a/app/views/index/about.phtml +++ b/app/views/index/about.phtml @@ -15,6 +15,9 @@
    + +
    +

    -- cgit v1.2.3 From 58300c36ad77e8d788e99825d509fe8657a36854 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Thu, 26 Dec 2013 01:56:58 +0100 Subject: Cookie : sous-répertoire pour index (changements de répertoires !) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Implémente https://github.com/marienfressinaud/FreshRSS/issues/333 /public/ est renommé /p/ /public/index.php est déplacé dans /p/i/index.php Le cookie de session est limité à /p/i/ --- README.md | 4 +- constants.php | 17 +- index.html | 5 +- index.php | 3 + lib/Minz/Session.php | 1 + lib/Minz/Url.php | 15 +- p/.htaccess | 48 ++ p/f.php | 70 ++ p/favicon.ico | Bin 0 -> 1150 bytes p/favicon.png | Bin 0 -> 694 bytes p/i/index.php | 51 ++ p/i/install.php | 1020 ++++++++++++++++++++++++ p/index.html | 12 + p/index.php | 3 + p/robots.txt | 2 + p/scripts/global_view.js | 71 ++ p/scripts/jquery-2.0.3.min.map | 1 + p/scripts/jquery.lazyload.min.js | 15 + p/scripts/jquery.min.js | 6 + p/scripts/main.js | 693 +++++++++++++++++ p/scripts/shortcut.js | 223 ++++++ p/themes/default/freshrss.css | 894 +++++++++++++++++++++ p/themes/default/global.css | 493 ++++++++++++ p/themes/default/loader.gif | Bin 0 -> 4167 bytes p/themes/default/metadata.json | 7 + p/themes/flat-design/freshrss.css | 827 ++++++++++++++++++++ p/themes/flat-design/global.css | 485 ++++++++++++ p/themes/flat-design/icons/add.svg | 30 + p/themes/flat-design/icons/all.svg | 32 + p/themes/flat-design/icons/close.svg | 28 + p/themes/flat-design/icons/configure.svg | 31 + p/themes/flat-design/icons/down.svg | 31 + p/themes/flat-design/icons/next.svg | 31 + p/themes/flat-design/icons/prev.svg | 31 + p/themes/flat-design/icons/refresh.svg | 31 + p/themes/flat-design/icons/search.svg | 32 + p/themes/flat-design/icons/up.svg | 31 + p/themes/flat-design/loader.gif | Bin 0 -> 4251 bytes p/themes/flat-design/metadata.json | 7 + p/themes/fonts/openSans.woff | Bin 0 -> 21956 bytes p/themes/icons/add.svg | 30 + p/themes/icons/all.svg | 32 + p/themes/icons/bookmark.svg | 32 + p/themes/icons/category-white.svg | 31 + p/themes/icons/category.svg | 31 + p/themes/icons/close.svg | 28 + p/themes/icons/configure.svg | 31 + p/themes/icons/down.svg | 31 + p/themes/icons/grey.gif | Bin 0 -> 56 bytes p/themes/icons/help.svg | 32 + p/themes/icons/icon.svg | 213 +++++ p/themes/icons/link.svg | 33 + p/themes/icons/login.svg | 33 + p/themes/icons/logout.svg | 33 + p/themes/icons/next.svg | 31 + p/themes/icons/non-starred.svg | 32 + p/themes/icons/prev.svg | 31 + p/themes/icons/read.svg | 31 + p/themes/icons/refresh.svg | 31 + p/themes/icons/rss.svg | 32 + p/themes/icons/search.svg | 32 + p/themes/icons/share.svg | 34 + p/themes/icons/starred.svg | 32 + p/themes/icons/tag.svg | 134 ++++ p/themes/icons/unread.svg | 30 + p/themes/icons/up.svg | 31 + public/.htaccess | 48 -- public/f.php | 70 -- public/favicon.ico | Bin 1150 -> 0 bytes public/favicon.png | Bin 694 -> 0 bytes public/index.php | 51 -- public/install.php | 1029 ------------------------- public/robots.txt | 2 - public/scripts/global_view.js | 71 -- public/scripts/jquery-2.0.3.min.map | 1 - public/scripts/jquery.lazyload.min.js | 15 - public/scripts/jquery.min.js | 6 - public/scripts/main.js | 693 ----------------- public/scripts/shortcut.js | 223 ------ public/themes/default/freshrss.css | 894 --------------------- public/themes/default/global.css | 493 ------------ public/themes/default/loader.gif | Bin 4167 -> 0 bytes public/themes/default/metadata.json | 7 - public/themes/flat-design/freshrss.css | 827 -------------------- public/themes/flat-design/global.css | 485 ------------ public/themes/flat-design/icons/add.svg | 30 - public/themes/flat-design/icons/all.svg | 32 - public/themes/flat-design/icons/close.svg | 28 - public/themes/flat-design/icons/configure.svg | 31 - public/themes/flat-design/icons/down.svg | 31 - public/themes/flat-design/icons/next.svg | 31 - public/themes/flat-design/icons/prev.svg | 31 - public/themes/flat-design/icons/refresh.svg | 31 - public/themes/flat-design/icons/search.svg | 32 - public/themes/flat-design/icons/up.svg | 31 - public/themes/flat-design/loader.gif | Bin 4251 -> 0 bytes public/themes/flat-design/metadata.json | 7 - public/themes/fonts/openSans.woff | Bin 21956 -> 0 bytes public/themes/icons/add.svg | 30 - public/themes/icons/all.svg | 32 - public/themes/icons/bookmark.svg | 32 - public/themes/icons/category-white.svg | 31 - public/themes/icons/category.svg | 31 - public/themes/icons/close.svg | 28 - public/themes/icons/configure.svg | 31 - public/themes/icons/down.svg | 31 - public/themes/icons/grey.gif | Bin 56 -> 0 bytes public/themes/icons/help.svg | 32 - public/themes/icons/icon.svg | 213 ----- public/themes/icons/link.svg | 33 - public/themes/icons/login.svg | 33 - public/themes/icons/logout.svg | 33 - public/themes/icons/next.svg | 31 - public/themes/icons/non-starred.svg | 32 - public/themes/icons/prev.svg | 31 - public/themes/icons/read.svg | 31 - public/themes/icons/refresh.svg | 31 - public/themes/icons/rss.svg | 32 - public/themes/icons/search.svg | 32 - public/themes/icons/share.svg | 34 - public/themes/icons/starred.svg | 32 - public/themes/icons/tag.svg | 134 ---- public/themes/icons/unread.svg | 30 - public/themes/icons/up.svg | 31 - 124 files changed, 6334 insertions(+), 6319 deletions(-) create mode 100644 index.php create mode 100644 p/.htaccess create mode 100644 p/f.php create mode 100644 p/favicon.ico create mode 100644 p/favicon.png create mode 100755 p/i/index.php create mode 100644 p/i/install.php create mode 100644 p/index.html create mode 100644 p/index.php create mode 100644 p/robots.txt create mode 100644 p/scripts/global_view.js create mode 100644 p/scripts/jquery-2.0.3.min.map create mode 100644 p/scripts/jquery.lazyload.min.js create mode 100644 p/scripts/jquery.min.js create mode 100644 p/scripts/main.js create mode 100644 p/scripts/shortcut.js create mode 100644 p/themes/default/freshrss.css create mode 100644 p/themes/default/global.css create mode 100644 p/themes/default/loader.gif create mode 100644 p/themes/default/metadata.json create mode 100644 p/themes/flat-design/freshrss.css create mode 100644 p/themes/flat-design/global.css create mode 100644 p/themes/flat-design/icons/add.svg create mode 100644 p/themes/flat-design/icons/all.svg create mode 100644 p/themes/flat-design/icons/close.svg create mode 100644 p/themes/flat-design/icons/configure.svg create mode 100644 p/themes/flat-design/icons/down.svg create mode 100644 p/themes/flat-design/icons/next.svg create mode 100644 p/themes/flat-design/icons/prev.svg create mode 100644 p/themes/flat-design/icons/refresh.svg create mode 100644 p/themes/flat-design/icons/search.svg create mode 100644 p/themes/flat-design/icons/up.svg create mode 100644 p/themes/flat-design/loader.gif create mode 100644 p/themes/flat-design/metadata.json create mode 100644 p/themes/fonts/openSans.woff create mode 100644 p/themes/icons/add.svg create mode 100644 p/themes/icons/all.svg create mode 100644 p/themes/icons/bookmark.svg create mode 100644 p/themes/icons/category-white.svg create mode 100644 p/themes/icons/category.svg create mode 100644 p/themes/icons/close.svg create mode 100644 p/themes/icons/configure.svg create mode 100644 p/themes/icons/down.svg create mode 100644 p/themes/icons/grey.gif create mode 100644 p/themes/icons/help.svg create mode 100644 p/themes/icons/icon.svg create mode 100644 p/themes/icons/link.svg create mode 100644 p/themes/icons/login.svg create mode 100644 p/themes/icons/logout.svg create mode 100644 p/themes/icons/next.svg create mode 100644 p/themes/icons/non-starred.svg create mode 100644 p/themes/icons/prev.svg create mode 100644 p/themes/icons/read.svg create mode 100644 p/themes/icons/refresh.svg create mode 100644 p/themes/icons/rss.svg create mode 100644 p/themes/icons/search.svg create mode 100644 p/themes/icons/share.svg create mode 100644 p/themes/icons/starred.svg create mode 100644 p/themes/icons/tag.svg create mode 100644 p/themes/icons/unread.svg create mode 100644 p/themes/icons/up.svg delete mode 100644 public/.htaccess delete mode 100644 public/f.php delete mode 100644 public/favicon.ico delete mode 100644 public/favicon.png delete mode 100755 public/index.php delete mode 100644 public/install.php delete mode 100644 public/robots.txt delete mode 100644 public/scripts/global_view.js delete mode 100644 public/scripts/jquery-2.0.3.min.map delete mode 100644 public/scripts/jquery.lazyload.min.js delete mode 100644 public/scripts/jquery.min.js delete mode 100644 public/scripts/main.js delete mode 100644 public/scripts/shortcut.js delete mode 100644 public/themes/default/freshrss.css delete mode 100644 public/themes/default/global.css delete mode 100644 public/themes/default/loader.gif delete mode 100644 public/themes/default/metadata.json delete mode 100644 public/themes/flat-design/freshrss.css delete mode 100644 public/themes/flat-design/global.css delete mode 100644 public/themes/flat-design/icons/add.svg delete mode 100644 public/themes/flat-design/icons/all.svg delete mode 100644 public/themes/flat-design/icons/close.svg delete mode 100644 public/themes/flat-design/icons/configure.svg delete mode 100644 public/themes/flat-design/icons/down.svg delete mode 100644 public/themes/flat-design/icons/next.svg delete mode 100644 public/themes/flat-design/icons/prev.svg delete mode 100644 public/themes/flat-design/icons/refresh.svg delete mode 100644 public/themes/flat-design/icons/search.svg delete mode 100644 public/themes/flat-design/icons/up.svg delete mode 100644 public/themes/flat-design/loader.gif delete mode 100644 public/themes/flat-design/metadata.json delete mode 100644 public/themes/fonts/openSans.woff delete mode 100644 public/themes/icons/add.svg delete mode 100644 public/themes/icons/all.svg delete mode 100644 public/themes/icons/bookmark.svg delete mode 100644 public/themes/icons/category-white.svg delete mode 100644 public/themes/icons/category.svg delete mode 100644 public/themes/icons/close.svg delete mode 100644 public/themes/icons/configure.svg delete mode 100644 public/themes/icons/down.svg delete mode 100644 public/themes/icons/grey.gif delete mode 100644 public/themes/icons/help.svg delete mode 100644 public/themes/icons/icon.svg delete mode 100644 public/themes/icons/link.svg delete mode 100644 public/themes/icons/login.svg delete mode 100644 public/themes/icons/logout.svg delete mode 100644 public/themes/icons/next.svg delete mode 100644 public/themes/icons/non-starred.svg delete mode 100644 public/themes/icons/prev.svg delete mode 100644 public/themes/icons/read.svg delete mode 100644 public/themes/icons/refresh.svg delete mode 100644 public/themes/icons/rss.svg delete mode 100644 public/themes/icons/search.svg delete mode 100644 public/themes/icons/share.svg delete mode 100644 public/themes/icons/starred.svg delete mode 100644 public/themes/icons/tag.svg delete mode 100644 public/themes/icons/unread.svg delete mode 100644 public/themes/icons/up.svg diff --git a/README.md b/README.md index 716859ccf..62d7e0c25 100644 --- a/README.md +++ b/README.md @@ -31,7 +31,7 @@ Privilégiez pour cela des demandes sur GitHub # Installation 1. Récupérez l’application FreshRSS via la commande git ou [en téléchargeant l’archive](https://github.com/marienfressinaud/FreshRSS/archive/master.zip) -2. Placez l’application sur votre serveur (la partie à exposer au Web est le répertoire `./public/`) +2. Placez l’application sur votre serveur (la partie à exposer au Web est le répertoire `./p/`) 3. Le serveur Web doit avoir les droits d’écriture dans le répertoire `./data/` 4. Accédez à FreshRSS à travers votre navigateur Web et suivez les instructions d’installation 5. Tout devrait fonctionner :) En cas de problème, n’hésitez pas à me contacter. @@ -49,7 +49,7 @@ Il est recommandé de limiter l’accès à votre FreshRSS, soit : ``` # Conseils -* Pour une meilleure sécurité, faites en sorte que seul le répertoire `./public` soit accessible depuis le Web, par exemple en faisant pointer un sous-domaine sur le répertoire `./public`. +* Pour une meilleure sécurité, faites en sorte que seul le répertoire `./p/` soit accessible depuis le Web, par exemple en faisant pointer un sous-domaine sur le répertoire `./public`. * Les données personnelles se trouvent dans le répertoire `./data/` (déjà protégé par un .htaccess pour Apache - vérifiez que cela fonctionne -, à protéger vous-même dans le cas d’autres serveurs Web). * Le fichier `./constants.php` définit les chemins d’accès aux répertoires clés de l’application. Si vous les bougez, tout se passe ici. * En cas de problème, les logs peuvent être utile à lire, soit depuis l’interface de FreshRSS, soit manuellement depuis `./data/log/*.log`. diff --git a/constants.php b/constants.php index c22209efe..0c7adc57e 100644 --- a/constants.php +++ b/constants.php @@ -3,12 +3,15 @@ define('FRESHRSS_VERSION', '0.7-beta3'); define('FRESHRSS_WEBSITE', 'http://freshrss.org'); // Constantes de chemins -define ('FRESHRSS_PATH', dirname(__FILE__)); +define('FRESHRSS_PATH', dirname(__FILE__)); -define ('PUBLIC_PATH', FRESHRSS_PATH . '/public'); -define ('DATA_PATH', FRESHRSS_PATH . '/data'); -define ('LIB_PATH', FRESHRSS_PATH . '/lib'); -define ('APP_PATH', FRESHRSS_PATH . '/app'); + define('PUBLIC_PATH', FRESHRSS_PATH . '/p'); + define('INDEX_PATH', PUBLIC_PATH . '/i'); + define('PUBLIC_RELATIVE', '..'); -define ('LOG_PATH', DATA_PATH . '/log'); -define ('CACHE_PATH', DATA_PATH . '/cache'); + define('DATA_PATH', FRESHRSS_PATH . '/data'); + define('LOG_PATH', DATA_PATH . '/log'); + define('CACHE_PATH', DATA_PATH . '/cache'); + + define('LIB_PATH', FRESHRSS_PATH . '/lib'); + define('APP_PATH', FRESHRSS_PATH . '/app'); diff --git a/index.html b/index.html index 937659d57..bbea573c7 100644 --- a/index.html +++ b/index.html @@ -2,12 +2,11 @@ - + Redirection - -

    FreshRSS

    +

    FreshRSS

    diff --git a/index.php b/index.php new file mode 100644 index 000000000..3fdae4285 --- /dev/null +++ b/index.php @@ -0,0 +1,3 @@ + + DirectoryIndex index.php index.html + + +FileETag None +AddDefaultCharset UTF-8 + + + AddType application/json .map + AddType application/font-woff .woff + + AddCharset UTF-8 .css + AddCharset UTF-8 .js + AddCharset UTF-8 .map + AddCharset UTF-8 .svg + + + + AddOutputFilterByType DEFLATE application/javascript application/json image/svg+xml text/css text/javascript + + + + ExpiresActive on + ExpiresByType application/font-woff "access plus 1 month" + ExpiresByType application/javascript "access plus 1 month" + ExpiresByType application/json "access plus 1 month" + ExpiresByType image/gif "access plus 1 month" + ExpiresByType image/png "access plus 1 month" + ExpiresByType image/svg+xml "access plus 1 month" + ExpiresByType image/x-icon "access plus 1 month" + ExpiresByType text/css "access plus 1 month" + ExpiresByType text/javascript "access plus 1 month" + + ExpiresActive Off + + + + + + Header merge Cache-Control "public" + + + + + Order Deny,Allow + Allow from all + Satisfy Any + diff --git a/p/f.php b/p/f.php new file mode 100644 index 000000000..a56d58617 --- /dev/null +++ b/p/f.php @@ -0,0 +1,70 @@ + $icoMTime)) { + if ($txtMTime == false) { + header('HTTP/1.1 404 Not Found'); + header('Content-Type: image/gif'); + readfile(PUBLIC_PATH . '/themes/icons/grey.gif'); //TODO: Better 404 favicon + die(); + } + $url = file_get_contents($txt); + if (!download_favicon($url, $ico)) { + die(); + } +} + +require(LIB_PATH . '/http-conditional.php'); + +header('Content-Type: image/x-icon'); +header('Content-Disposition: inline; filename="' . $id . '.ico"'); + +if (!httpConditional($icoMTime, 2592000, 2)) { + readfile($ico); +} diff --git a/p/favicon.ico b/p/favicon.ico new file mode 100644 index 000000000..f7ae0a5b9 Binary files /dev/null and b/p/favicon.ico differ diff --git a/p/favicon.png b/p/favicon.png new file mode 100644 index 000000000..3038dc3d1 Binary files /dev/null and b/p/favicon.png differ diff --git a/p/i/index.php b/p/i/index.php new file mode 100755 index 000000000..6c25b2c54 --- /dev/null +++ b/p/i/index.php @@ -0,0 +1,51 @@ +. +# +# ***** END LICENSE BLOCK ***** + +if (file_exists ('install.php')) { + require('install.php'); +} else { + require('../../constants.php'); + + session_cache_limiter(''); + if (!file_exists(DATA_PATH . '/no-cache.txt')) { + require (LIB_PATH . '/http-conditional.php'); + $dateLastModification = max( + @filemtime(DATA_PATH . '/touch.txt'), + @filemtime(LOG_PATH . '/application.log'), + @filemtime(DATA_PATH . '/config.php') + ); + $_SERVER['QUERY_STRING'] .= '&utime=' . file_get_contents(DATA_PATH . '/touch.txt'); //For ETag + if (httpConditional($dateLastModification, 0, 0, false, false, true)) { + exit(); //No need to send anything + } + } + + require(LIB_PATH . '/lib_rss.php'); //Includes class autoloader + + try { + $front_controller = new FreshRSS(); + $front_controller->init (); + $front_controller->run (); + } catch (Exception $e) { + echo '### Fatal error! ###
    ', "\n"; + Minz_Log::record ($e->getMessage (), Minz_Log::ERROR); + echo 'See logs files.'; + } +} diff --git a/p/i/install.php b/p/i/install.php new file mode 100644 index 000000000..fa37ae19a --- /dev/null +++ b/p/i/install.php @@ -0,0 +1,1020 @@ + +define('SQL_SHOW_TABLES', 'SHOW tables;'); + +define('SQL_BACKUP006', 'RENAME TABLE `%1$scategory` TO `%1$scategory006`, `%1$sfeed` TO `%1$sfeed006`, `%1$sentry` TO `%1$sentry006`;'); + +define('SQL_SHOW_COLUMNS_UPDATEv006', 'SHOW columns FROM `%1$sentry006` LIKE "id2";'); + +define('SQL_UPDATEv006', ' +ALTER TABLE `%1$scategory006` ADD id2 SMALLINT; + +SET @i = 0; +UPDATE `%1$scategory006` SET id2=(@i:=@i+1) ORDER BY id; + +ALTER TABLE `%1$sfeed006` ADD id2 SMALLINT, ADD category2 SMALLINT; + +SET @i = 0; +UPDATE `%1$sfeed006` SET id2=(@i:=@i+1) ORDER BY name; + +UPDATE `%1$sfeed006` f +INNER JOIN `%1$scategory006` c ON f.category = c.id +SET f.category2 = c.id2; + +INSERT IGNORE INTO `%2$scategory` (name, color) +SELECT name, color +FROM `%1$scategory006` +ORDER BY id2; + +INSERT IGNORE INTO `%2$sfeed` (url, category, name, website, description, priority, pathEntries, httpAuth, keep_history) +SELECT url, category2, name, website, description, priority, pathEntries, httpAuth, IF(keep_history = 1, -1, -2) +FROM `%1$sfeed006` +ORDER BY id2; + +ALTER TABLE `%1$sentry006` ADD id2 bigint; + +UPDATE `%1$sentry006` SET id2 = ((date * 1000000) + (rand() * 100000000)); + +INSERT IGNORE INTO `%2$sentry` (id, guid, title, author, link, date, is_read, is_favorite, id_feed, tags) +SELECT e0.id2, e0.guid, e0.title, e0.author, e0.link, e0.date, e0.is_read, e0.is_favorite, f0.id2, e0.tags +FROM `%1$sentry006` e0 +INNER JOIN `%1$sfeed006` f0 ON e0.id_feed = f0.id; +'); + +define('SQL_CONVERT_SELECTv006', ' +SELECT e0.id2, e0.content +FROM `%1$sentry006` e0 +INNER JOIN `%2$sentry` e1 ON e0.id2 = e1.id +WHERE e1.content_bin IS NULL'); + +define('SQL_CONVERT_UPDATEv006', 'UPDATE `%1$sentry` SET content_bin=COMPRESS(?) WHERE id=?;'); + +define('SQL_UPDATE_CACHED_VALUESv006', ' +UPDATE `%1$sfeed` f +INNER JOIN ( + SELECT e.id_feed, + COUNT(CASE WHEN e.is_read = 0 THEN 1 END) AS nbUnreads, + COUNT(e.id) AS nbEntries + FROM `%1$sentry` e + GROUP BY e.id_feed +) x ON x.id_feed=f.id +SET f.cache_nbEntries=x.nbEntries, f.cache_nbUnreads=x.nbUnreads +'); + +define('SQL_DROP_BACKUPv006', 'DROP TABLE IF EXISTS `%1$sentry006`, `%1$sfeed006`, `%1$scategory006`;'); +// + +function writeLine ($f, $line) { + fwrite ($f, $line . "\n"); +} +function writeArray ($f, $array) { + foreach ($array as $key => $val) { + if (is_array ($val)) { + writeLine ($f, '\'' . $key . '\' => array ('); + writeArray ($f, $val); + writeLine ($f, '),'); + } else { + writeLine ($f, '\'' . $key . '\' => \'' . $val . '\','); + } + } +} + +// gestion internationalisation +$translates = array (); +$actual = 'en'; +function initTranslate () { + global $translates; + global $actual; + + $actual = isset($_SESSION['language']) ? $_SESSION['language'] : getBetterLanguage('en'); + + $file = APP_PATH . '/i18n/' . $actual . '.php'; + if (file_exists($file)) { + $translates = array_merge($translates, include($file)); + } + + $file = APP_PATH . '/i18n/install.' . $actual . '.php'; + if (file_exists($file)) { + $translates = array_merge($translates, include($file)); + } +} + +function getBetterLanguage ($fallback) { + $available = availableLanguages (); + $accept = $_SERVER['HTTP_ACCEPT_LANGUAGE']; + $language = strtolower (substr ($accept, 0, 2)); + + if (isset ($available[$language])) { + return $language; + } else { + return $fallback; + } +} +function availableLanguages () { + return array ( + 'en' => 'English', + 'fr' => 'Français' + ); +} +function _t ($key) { + global $translates; + $translate = $key; + if (isset ($translates[$key])) { + $translate = $translates[$key]; + } + + $args = func_get_args (); + unset($args[0]); + + return vsprintf ($translate, $args); +} + +/*** SAUVEGARDES ***/ +function saveLanguage () { + if (!empty ($_POST)) { + if (!isset ($_POST['language'])) { + return false; + } + + $_SESSION['language'] = $_POST['language']; + + header ('Location: index.php?step=1'); + } +} +function saveStep2 () { + if (!empty ($_POST)) { + if (empty ($_POST['title']) || + empty ($_POST['old_entries']) || + empty ($_POST['default_user'])) { + return false; + } + + $_SESSION['sel_application'] = sha1(uniqid(mt_rand(), true).implode('', stat(__FILE__))); + $_SESSION['title'] = addslashes(substr(trim($_POST['title']), 0, 25)); + $_SESSION['old_entries'] = $_POST['old_entries']; + if ((!ctype_digit($_SESSION['old_entries'])) || ($_SESSION['old_entries'] < 1)) { + $_SESSION['old_entries'] = 3; + } + $_SESSION['mail_login'] = addslashes ($_POST['mail_login']); + $_SESSION['default_user'] = substr(preg_replace ('/[^a-zA-Z0-9]/', '', $_POST['default_user']), 0, 16); + + $token = ''; + if ($_SESSION['mail_login']) { + $token = sha1($_SESSION['sel_application'] . $_SESSION['mail_login']); + } + + $file_data = DATA_PATH . '/' . $_SESSION['default_user'] . '_user.php'; + + $f = fopen ($file_data, 'w'); + writeLine ($f, ' $_SESSION['language'], + 'old_entries' => $_SESSION['old_entries'], + 'mail_login' => $_SESSION['mail_login'], + 'token' => $token + )); + writeLine ($f, ');'); + fclose ($f); + + header ('Location: index.php?step=3'); + } +} + +function saveStep3 () { + if (!empty ($_POST)) { + if (empty ($_POST['type']) || + empty ($_POST['host']) || + empty ($_POST['user']) || + empty ($_POST['base'])) { + $_SESSION['bd_error'] = true; + } + + $_SESSION['bd_type'] = isset ($_POST['type']) ? $_POST['type'] : 'mysql'; + $_SESSION['bd_host'] = addslashes ($_POST['host']); + $_SESSION['bd_user'] = addslashes ($_POST['user']); + $_SESSION['bd_password'] = addslashes ($_POST['pass']); + $_SESSION['bd_base'] = addslashes ($_POST['base']); + $_SESSION['bd_prefix'] = addslashes ($_POST['prefix']); + $_SESSION['bd_prefix_user'] = $_SESSION['bd_prefix'] . (empty($_SESSION['default_user']) ? '' : ($_SESSION['default_user'] . '_')); + + $ini_array = array( + 'general' => array( + 'environment' => empty($_SESSION['environment']) ? 'production' : $_SESSION['environment'], + 'use_url_rewriting' => false, + 'sel_application' => $_SESSION['sel_application'], + 'base_url' => '', + 'title' => $_SESSION['title'], + 'default_user' => $_SESSION['default_user'], + ), + 'db' => array( + 'type' => $_SESSION['bd_type'], + 'host' => $_SESSION['bd_host'], + 'user' => $_SESSION['bd_user'], + 'password' => $_SESSION['bd_password'], + 'base' => $_SESSION['bd_base'], + 'prefix' => $_SESSION['bd_prefix'], + ), + ); + file_put_contents(DATA_PATH . '/config.php', " 'SET NAMES utf8', + ); + break; + case 'sqlite': + $str = 'sqlite:' . DATA_PATH . $_SESSION['bd_base'] . '.sqlite'; + $driver_options = null; + break; + default: + return false; + } + + $c = new PDO($str, $_SESSION['bd_user'], $_SESSION['bd_password'], $driver_options); + + $stm = $c->prepare(SQL_SHOW_TABLES); + $stm->execute(); + $res = $stm->fetchAll(PDO::FETCH_COLUMN, 0); + if (!in_array($_SESSION['bd_prefix'] . 'entry006', $res)) { + return false; + } + + $sql = sprintf(SQL_SHOW_COLUMNS_UPDATEv006, $_SESSION['bd_prefix']); + $stm = $c->prepare($sql); + $stm->execute(); + $res = $stm->fetchAll(PDO::FETCH_COLUMN, 0); + if (!in_array('id2', $res)) { + if (!$perform) { + return true; + } + $sql = sprintf(SQL_UPDATEv006, $_SESSION['bd_prefix'], $_SESSION['bd_prefix_user']); + $stm = $c->prepare($sql, array(PDO::ATTR_EMULATE_PREPARES => true)); + $stm->execute(); + } + + $sql = sprintf(SQL_UPDATE_CACHED_VALUESv006, $_SESSION['bd_prefix_user']); + $stm = $c->prepare($sql); + $stm->execute(); + + $sql = sprintf(SQL_CONVERT_SELECTv006, $_SESSION['bd_prefix'], $_SESSION['bd_prefix_user']); + if (!$perform) { + $sql .= ' LIMIT 1'; + } + $stm = $c->prepare($sql); + $stm->execute(); + if (!$perform) { + $res = $stm->fetchAll(PDO::FETCH_COLUMN, 0); + return count($res) > 0; + } else { + @set_time_limit(300); + } + + $c2 = new PDO($str, $_SESSION['bd_user'], $_SESSION['bd_password'], $driver_options); + $sql = sprintf(SQL_CONVERT_UPDATEv006, $_SESSION['bd_prefix_user']); + $stm2 = $c2->prepare($sql); + while ($row = $stm->fetch(PDO::FETCH_ASSOC)) { + $id = $row['id2']; + $content = unserialize(gzinflate(base64_decode($row['content']))); + $stm2->execute(array($content, $id)); + } + return true; + } catch (PDOException $e) { + return false; + } + return false; +} + +function deleteInstall () { + $res = unlink (INDEX_PATH . '/install.php'); + if ($res) { + header ('Location: index.php'); + } + + $needs = array('bd_type', 'bd_host', 'bd_base', 'bd_user', 'bd_password', 'bd_prefix'); + foreach ($needs as $need) { + if (!isset($_SESSION[$need])) { + return false; + } + } + + try { + switch ($_SESSION['bd_type']) { + case 'mysql': + $str = 'mysql:host=' . $_SESSION['bd_host'] . ';dbname=' . $_SESSION['bd_base']; + $driver_options = array( + PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8', + ); + break; + case 'sqlite': + $str = 'sqlite:' . DATA_PATH . $_SESSION['bd_base'] . '.sqlite'; + $driver_options = null; + break; + default: + return false; + } + + $c = new PDO($str, $_SESSION['bd_user'], $_SESSION['bd_password'], $driver_options); + $sql = sprintf(SQL_DROP_BACKUPv006, $_SESSION['bd_prefix']); + $stm = $c->prepare($sql); + $stm->execute(); + + return true; + } catch (PDOException $e) { + return false; + } + return false; +} + +function moveOldFiles() { + $mvs = array( + '/app/configuration/application.ini' => '/data/application.ini', //v0.6 + '/public/data/Configuration.array.php' => '/data/Configuration.array.php', //v0.6 + ); + $ok = true; + foreach ($mvs as $fFrom => $fTo) { + if (file_exists(FRESHRSS_PATH . $fFrom)) { + if (copy(FRESHRSS_PATH . $fFrom, FRESHRSS_PATH . $fTo)) { + @unlink(FRESHRSS_PATH . $fFrom); + } else { + $ok = false; + } + } + } + return $ok; +} + +function delTree($dir) { //http://php.net/rmdir#110489 + if (!is_dir($dir)) { + return true; + } + $files = array_diff(scandir($dir), array('.', '..')); + foreach ($files as $file) { + $f = $dir . '/' . $file; + if (is_dir($f)) { + @chmod($f, 0777); + delTree($f); + } + else unlink($f); + } + return rmdir($dir); +} + +/*** VÉRIFICATIONS ***/ +function checkStep () { + $s0 = checkStep0 (); + $s1 = checkStep1 (); + $s2 = checkStep2 (); + $s3 = checkStep3 (); + if (STEP > 0 && $s0['all'] != 'ok') { + header ('Location: index.php?step=0'); + } elseif (STEP > 1 && $s1['all'] != 'ok') { + header ('Location: index.php?step=1'); + } elseif (STEP > 2 && $s2['all'] != 'ok') { + header ('Location: index.php?step=2'); + } elseif (STEP > 3 && $s3['all'] != 'ok') { + header ('Location: index.php?step=3'); + } + $_SESSION['actualize_feeds'] = true; +} +function checkStep0 () { + moveOldFiles(); + + if (file_exists(DATA_PATH . '/config.php')) { + $ini_array = include(DATA_PATH . '/config.php'); + } elseif (file_exists(DATA_PATH . '/application.ini')) { + $ini_array = parse_ini_file(DATA_PATH . '/application.ini', true); + } else { + $ini_array = null; + } + + if ($ini_array) { + $ini_general = isset($ini_array['general']) ? $ini_array['general'] : null; + if ($ini_general) { + $keys = array('environment', 'sel_application', 'title', 'default_user'); + foreach ($keys as $key) { + if ((empty($_SESSION[$key])) && isset($ini_general[$key])) { + $_SESSION[$key] = $ini_general[$key]; + } + } + } + $ini_db = isset($ini_array['db']) ? $ini_array['db'] : null; + if ($ini_db) { + $keys = array('type', 'host', 'user', 'password', 'base', 'prefix'); + foreach ($keys as $key) { + if ((!isset($_SESSION['bd_' . $key])) && isset($ini_db[$key])) { + $_SESSION['bd_' . $key] = $ini_db[$key]; + } + } + } + } + + if (isset($_SESSION['default_user']) && file_exists(DATA_PATH . '/' . $_SESSION['default_user'] . '_user.php')) { + $userConfig = include(DATA_PATH . '/' . $_SESSION['default_user'] . '_user.php'); + } elseif (file_exists(DATA_PATH . '/Configuration.array.php')) { + $userConfig = include(DATA_PATH . '/Configuration.array.php'); //v0.6 + } else { + $userConfig = array(); + } + + $keys = array('language', 'old_entries', 'mail_login'); + foreach ($keys as $key) { + if ((!isset($_SESSION[$key])) && isset($userConfig[$key])) { + $_SESSION[$key] = $userConfig[$key]; + } + } + + $languages = availableLanguages (); + $language = isset ($_SESSION['language']) && + isset ($languages[$_SESSION['language']]); + + return array ( + 'language' => $language ? 'ok' : 'ko', + 'all' => $language ? 'ok' : 'ko' + ); +} +function checkStep1 () { + $php = version_compare (PHP_VERSION, '5.2.0') >= 0; + $minz = file_exists (LIB_PATH . '/Minz'); + $curl = extension_loaded ('curl'); + $pdo = extension_loaded ('pdo_mysql'); + $dom = class_exists('DOMDocument'); + $data = DATA_PATH && is_writable (DATA_PATH); + $cache = CACHE_PATH && is_writable (CACHE_PATH); + $log = LOG_PATH && is_writable (LOG_PATH); + $favicons = is_writable (DATA_PATH . '/favicons'); + + return array ( + 'php' => $php ? 'ok' : 'ko', + 'minz' => $minz ? 'ok' : 'ko', + 'curl' => $curl ? 'ok' : 'ko', + 'pdo-mysql' => $pdo ? 'ok' : 'ko', + 'dom' => $dom ? 'ok' : 'ko', + 'data' => $data ? 'ok' : 'ko', + 'cache' => $cache ? 'ok' : 'ko', + 'log' => $log ? 'ok' : 'ko', + 'favicons' => $favicons ? 'ok' : 'ko', + 'all' => $php && $minz && $curl && $pdo && $dom && $data && $cache && $log && $favicons ? 'ok' : 'ko' + ); +} + +function checkStep2 () { + $conf = !empty($_SESSION['sel_application']) && + !empty($_SESSION['title']) && + !empty($_SESSION['old_entries']) && + isset($_SESSION['mail_login']) && + !empty($_SESSION['default_user']); + $defaultUser = empty($_POST['default_user']) ? null : $_POST['default_user']; + if ($defaultUser === null) { + $defaultUser = empty($_SESSION['default_user']) ? '' : $_SESSION['default_user']; + } + $data = file_exists (DATA_PATH . '/' . $defaultUser . '_user.php'); + if ($data) { + @unlink(DATA_PATH . '/Configuration.array.php'); //v0.6 + } + + return array ( + 'conf' => $conf ? 'ok' : 'ko', + 'data' => $data ? 'ok' : 'ko', + 'all' => $conf && $data ? 'ok' : 'ko' + ); +} +function checkStep3 () { + $conf = file_exists (DATA_PATH . '/config.php'); + + $bd = isset ($_SESSION['bd_type']) && + isset ($_SESSION['bd_host']) && + isset ($_SESSION['bd_user']) && + isset ($_SESSION['bd_password']) && + isset ($_SESSION['bd_base']) && + isset ($_SESSION['bd_prefix']) && + isset ($_SESSION['bd_error']); + $conn = !isset ($_SESSION['bd_error']) || !$_SESSION['bd_error']; + + return array ( + 'bd' => $bd ? 'ok' : 'ko', + 'conn' => $conn ? 'ok' : 'ko', + 'conf' => $conf ? 'ok' : 'ko', + 'all' => $bd && $conn && $conf ? 'ok' : 'ko' + ); +} + +function checkBD () { + $error = false; + + try { + $str = ''; + $driver_options = null; + switch ($_SESSION['bd_type']) { + case 'mysql': + $driver_options = array( + PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8' + ); + + // on ouvre une connexion juste pour créer la base si elle n'existe pas + $str = 'mysql:host=' . $_SESSION['bd_host'] . ';'; + $c = new PDO ($str, $_SESSION['bd_user'], $_SESSION['bd_password'], $driver_options); + + $sql = sprintf (SQL_CREATE_DB, $_SESSION['bd_base']); + $res = $c->query ($sql); + + // on écrase la précédente connexion en sélectionnant la nouvelle BDD + $str = 'mysql:host=' . $_SESSION['bd_host'] . ';dbname=' . $_SESSION['bd_base']; + break; + case 'sqlite': + $str = 'sqlite:' . DATA_PATH . $_SESSION['bd_base'] . '.sqlite'; + break; + default: + return false; + } + + $c = new PDO ($str, $_SESSION['bd_user'], $_SESSION['bd_password'], $driver_options); + + $stm = $c->prepare(SQL_SHOW_TABLES); + $stm->execute(); + $res = $stm->fetchAll(PDO::FETCH_COLUMN, 0); + if (in_array($_SESSION['bd_prefix'] . 'entry', $res) && !in_array($_SESSION['bd_prefix'] . 'entry006', $res)) { + $sql = sprintf(SQL_BACKUP006, $_SESSION['bd_prefix']); //v0.6 + $res = $c->query($sql); //Backup tables + } + + $sql = sprintf (SQL_CAT, $_SESSION['bd_prefix_user']); + $res = $c->query ($sql); + + if (!$res) { + $error = true; + } + + $sql = sprintf (SQL_FEED, $_SESSION['bd_prefix_user']); + $res = $c->query ($sql); + + if (!$res) { + $error = true; + } + + $sql = sprintf (SQL_ENTRY, $_SESSION['bd_prefix_user']); + $res = $c->query ($sql); + + if (!$res) { + $error = true; + } + } catch (PDOException $e) { + $error = true; + } + + if ($error && file_exists (DATA_PATH . '/config.php')) { + unlink (DATA_PATH . '/config.php'); + } + + return !$error; +} + +/*** AFFICHAGE ***/ +function printStep0 () { + global $actual; +?> + +

    + + +
    + +
    + +
    + +
    +
    + +
    +
    + + + + + +
    +
    +
    + + + + +

    + +

    + + + +

    + +

    + + + + +

    + +

    + + + +

    + +

    + + + +

    + +

    + + + +

    + +

    + + + +

    + +

    + + + +

    + +

    + + + +

    + +

    + + + + + +

    + + + +

    + + +
    + + + +
    + +
    + +
    +
    + +
    + +
    + +
    +
    + +
    + +
    + +
    +
    + +
    + +
    + + +
    +
    + +
    +
    + + + + + +
    +
    +
    + + +

    + +

    + + +
    + +
    + +
    + +
    +
    + +
    + +
    + +
    +
    + +
    + +
    + +
    +
    + +
    + +
    + +
    +
    + +
    + +
    + +
    +
    + +
    + +
    + +
    +
    + +
    +
    + + + + + +
    +
    +
    + +
    + +
    +
    + + + +

    + + + +
    +
    +
    + +

    + + +

    + + + + + + + <?php echo _t ('freshrss_installation'); ?> + + + + + +
    +
    +

    +

    +
    +
    + +
    + + +
    + +
    +
    + + diff --git a/p/index.html b/p/index.html new file mode 100644 index 000000000..af91b717e --- /dev/null +++ b/p/index.html @@ -0,0 +1,12 @@ + + + + + +Redirection + + + +

    FreshRSS

    + + diff --git a/p/index.php b/p/index.php new file mode 100644 index 000000000..e90662078 --- /dev/null +++ b/p/index.php @@ -0,0 +1,3 @@ +' + window.iconClose + ''); + init_close_panel(); + $("#panel").slideToggle(); + $("#overlay").fadeOut(); + + return false; + }); +} + +function init_global_view() { + $("#stream .box-category a").click(function () { + var link = $(this).attr("href"); + + load_panel(link); + + return false; + }); + + $(".nav_menu #nav_menu_read_all, .nav_menu .toggle_aside").remove(); + + init_stream_delegates($("#panel")); +} + +function init_all_global_view() { + if (!(window.$ && window.init_stream_delegates)) { + window.setTimeout(init_all_global_view, 50); //Wait for all js to be loaded + return; + } + init_global_view(); + init_close_panel(); +} + +if (document.readyState && document.readyState !== 'loading') { + init_all_global_view(); +} else if (document.addEventListener) { + document.addEventListener('DOMContentLoaded', function () { + init_all_global_view(); + }, false); +} diff --git a/p/scripts/jquery-2.0.3.min.map b/p/scripts/jquery-2.0.3.min.map new file mode 100644 index 000000000..472d71bb0 --- /dev/null +++ b/p/scripts/jquery-2.0.3.min.map @@ -0,0 +1 @@ +{"version":3,"file":"jquery-2.0.3.min.js","sources":["jquery-2.0.3.js"],"names":["window","undefined","rootjQuery","readyList","core_strundefined","location","document","docElem","documentElement","_jQuery","jQuery","_$","$","class2type","core_deletedIds","core_version","core_concat","concat","core_push","push","core_slice","slice","core_indexOf","indexOf","core_toString","toString","core_hasOwn","hasOwnProperty","core_trim","trim","selector","context","fn","init","core_pnum","source","core_rnotwhite","rquickExpr","rsingleTag","rmsPrefix","rdashAlpha","fcamelCase","all","letter","toUpperCase","completed","removeEventListener","ready","prototype","jquery","constructor","match","elem","this","charAt","length","exec","find","merge","parseHTML","nodeType","ownerDocument","test","isPlainObject","isFunction","attr","getElementById","parentNode","makeArray","toArray","call","get","num","pushStack","elems","ret","prevObject","each","callback","args","promise","done","apply","arguments","first","eq","last","i","len","j","map","end","sort","splice","extend","options","name","src","copy","copyIsArray","clone","target","deep","isArray","expando","Math","random","replace","noConflict","isReady","readyWait","holdReady","hold","wait","resolveWith","trigger","off","obj","type","Array","isWindow","isNumeric","isNaN","parseFloat","isFinite","String","e","isEmptyObject","error","msg","Error","data","keepScripts","parsed","scripts","createElement","buildFragment","remove","childNodes","parseJSON","JSON","parse","parseXML","xml","tmp","DOMParser","parseFromString","getElementsByTagName","noop","globalEval","code","script","indirect","eval","text","head","appendChild","removeChild","camelCase","string","nodeName","toLowerCase","value","isArraylike","arr","results","Object","inArray","second","l","grep","inv","retVal","arg","guid","proxy","access","key","chainable","emptyGet","raw","bulk","now","Date","swap","old","style","Deferred","readyState","setTimeout","addEventListener","split","support","cachedruns","Expr","getText","isXML","compile","outermostContext","sortInput","setDocument","documentIsHTML","rbuggyQSA","rbuggyMatches","matches","contains","preferredDoc","dirruns","classCache","createCache","tokenCache","compilerCache","hasDuplicate","sortOrder","a","b","strundefined","MAX_NEGATIVE","hasOwn","pop","push_native","booleans","whitespace","characterEncoding","identifier","attributes","pseudos","rtrim","RegExp","rcomma","rcombinators","rsibling","rattributeQuotes","rpseudo","ridentifier","matchExpr","ID","CLASS","TAG","ATTR","PSEUDO","CHILD","bool","needsContext","rnative","rinputs","rheader","rescape","runescape","funescape","_","escaped","escapedWhitespace","high","fromCharCode","els","Sizzle","seed","m","groups","nid","newContext","newSelector","id","getElementsByClassName","qsa","tokenize","getAttribute","setAttribute","toSelector","join","querySelectorAll","qsaError","removeAttribute","select","keys","cache","cacheLength","shift","markFunction","assert","div","addHandle","attrs","handler","attrHandle","siblingCheck","cur","diff","sourceIndex","nextSibling","createInputPseudo","createButtonPseudo","createPositionalPseudo","argument","matchIndexes","node","doc","parent","defaultView","attachEvent","top","className","createComment","innerHTML","firstChild","getById","getElementsByName","filter","attrId","getAttributeNode","tag","input","matchesSelector","webkitMatchesSelector","mozMatchesSelector","oMatchesSelector","msMatchesSelector","disconnectedMatch","compareDocumentPosition","adown","bup","compare","sortDetached","aup","ap","bp","unshift","expr","elements","val","specified","uniqueSort","duplicates","detectDuplicates","sortStable","textContent","nodeValue","selectors","createPseudo","relative",">","dir"," ","+","~","preFilter","excess","unquoted","nodeNameSelector","pattern","operator","check","result","what","simple","forward","ofType","outerCache","nodeIndex","start","useCache","lastChild","pseudo","setFilters","idx","matched","not","matcher","unmatched","has","innerText","lang","elemLang","hash","root","focus","activeElement","hasFocus","href","tabIndex","enabled","disabled","checked","selected","selectedIndex","empty","header","button","even","odd","lt","gt","radio","checkbox","file","password","image","submit","reset","filters","parseOnly","tokens","soFar","preFilters","cached","addCombinator","combinator","base","checkNonElements","doneName","dirkey","elementMatcher","matchers","condense","newUnmatched","mapped","setMatcher","postFilter","postFinder","postSelector","temp","preMap","postMap","preexisting","multipleContexts","matcherIn","matcherOut","matcherFromTokens","checkContext","leadingRelative","implicitRelative","matchContext","matchAnyContext","matcherFromGroupMatchers","elementMatchers","setMatchers","matcherCachedRuns","bySet","byElement","superMatcher","expandContext","setMatched","matchedCount","outermost","contextBackup","dirrunsUnique","group","contexts","token","div1","defaultValue","unique","isXMLDoc","optionsCache","createOptions","object","flag","Callbacks","memory","fired","firing","firingStart","firingLength","firingIndex","list","stack","once","fire","stopOnFalse","self","disable","add","index","lock","locked","fireWith","func","tuples","state","always","deferred","fail","then","fns","newDefer","tuple","action","returned","resolve","reject","progress","notify","pipe","stateString","when","subordinate","resolveValues","remaining","updateFunc","values","progressValues","notifyWith","progressContexts","resolveContexts","fragment","createDocumentFragment","opt","checkOn","optSelected","reliableMarginRight","boxSizingReliable","pixelPosition","noCloneChecked","cloneNode","optDisabled","radioValue","checkClone","focusinBubbles","backgroundClip","clearCloneStyle","container","marginDiv","divReset","body","cssText","zoom","boxSizing","offsetWidth","getComputedStyle","width","marginRight","data_user","data_priv","rbrace","rmultiDash","Data","defineProperty","uid","accepts","owner","descriptor","unlock","defineProperties","set","prop","stored","camel","hasData","discard","acceptData","removeData","_data","_removeData","dataAttr","camelKey","queue","dequeue","startLength","hooks","_queueHooks","next","stop","setter","delay","time","fx","speeds","timeout","clearTimeout","clearQueue","count","defer","nodeHook","boolHook","rclass","rreturn","rfocusable","removeAttr","removeProp","propFix","addClass","classes","clazz","proceed","removeClass","toggleClass","stateVal","classNames","hasClass","valHooks","option","one","max","optionSet","nType","attrHooks","propName","attrNames","for","class","notxml","propHooks","hasAttribute","getter","rkeyEvent","rmouseEvent","rfocusMorph","rtypenamespace","returnTrue","returnFalse","safeActiveElement","err","event","global","types","handleObjIn","eventHandle","events","t","handleObj","special","handlers","namespaces","origType","elemData","handle","triggered","dispatch","delegateType","bindType","namespace","delegateCount","setup","mappedTypes","origCount","teardown","removeEvent","onlyHandlers","bubbleType","ontype","eventPath","Event","isTrigger","namespace_re","noBubble","parentWindow","isPropagationStopped","preventDefault","isDefaultPrevented","_default","fix","handlerQueue","delegateTarget","preDispatch","currentTarget","isImmediatePropagationStopped","stopPropagation","postDispatch","sel","props","fixHooks","keyHooks","original","which","charCode","keyCode","mouseHooks","eventDoc","pageX","clientX","scrollLeft","clientLeft","pageY","clientY","scrollTop","clientTop","originalEvent","fixHook","load","blur","click","beforeunload","returnValue","simulate","bubble","isSimulated","defaultPrevented","getPreventDefault","timeStamp","stopImmediatePropagation","mouseenter","mouseleave","orig","related","relatedTarget","attaches","on","origFn","triggerHandler","isSimple","rparentsprev","rneedsContext","guaranteedUnique","children","contents","prev","targets","winnow","is","closest","pos","prevAll","addBack","sibling","parents","parentsUntil","until","nextAll","nextUntil","prevUntil","siblings","contentDocument","reverse","truncate","n","qualifier","rxhtmlTag","rtagName","rhtml","rnoInnerhtml","manipulation_rcheckableType","rchecked","rscriptType","rscriptTypeMasked","rcleanScript","wrapMap","thead","col","tr","td","optgroup","tbody","tfoot","colgroup","caption","th","append","createTextNode","domManip","manipulationTarget","prepend","insertBefore","before","after","keepData","cleanData","getAll","setGlobalEval","dataAndEvents","deepDataAndEvents","html","replaceWith","detach","allowIntersection","hasScripts","iNoClone","disableScript","restoreScript","_evalUrl","appendTo","prependTo","insertAfter","replaceAll","insert","srcElements","destElements","inPage","fixInput","cloneCopyEvent","selection","wrap","nodes","url","ajax","dataType","async","throws","content","refElements","dest","pdataOld","pdataCur","udataOld","udataCur","wrapAll","firstElementChild","wrapInner","unwrap","curCSS","iframe","rdisplayswap","rmargin","rnumsplit","rnumnonpx","rrelNum","elemdisplay","BODY","cssShow","position","visibility","display","cssNormalTransform","letterSpacing","fontWeight","cssExpand","cssPrefixes","vendorPropName","capName","origName","isHidden","el","css","getStyles","showHide","show","hidden","css_defaultDisplay","styles","hide","toggle","cssHooks","opacity","computed","cssNumber","columnCount","fillOpacity","lineHeight","order","orphans","widows","zIndex","cssProps","float","extra","_computed","minWidth","maxWidth","getPropertyValue","setPositiveNumber","subtract","augmentWidthOrHeight","isBorderBox","getWidthOrHeight","valueIsBorderBox","offsetHeight","actualDisplay","contentWindow","write","close","visible","margin","padding","border","prefix","suffix","expand","expanded","parts","r20","rbracket","rCRLF","rsubmitterTypes","rsubmittable","serialize","param","serializeArray","traditional","s","encodeURIComponent","ajaxSettings","buildParams","v","hover","fnOver","fnOut","bind","unbind","delegate","undelegate","ajaxLocParts","ajaxLocation","ajax_nonce","ajax_rquery","rhash","rts","rheaders","rlocalProtocol","rnoContent","rprotocol","rurl","_load","prefilters","transports","allTypes","addToPrefiltersOrTransports","structure","dataTypeExpression","dataTypes","inspectPrefiltersOrTransports","originalOptions","jqXHR","inspected","seekingTransport","inspect","prefilterOrFactory","dataTypeOrTransport","ajaxExtend","flatOptions","params","response","responseText","complete","status","active","lastModified","etag","isLocal","processData","contentType","*","json","responseFields","converters","* text","text html","text json","text xml","ajaxSetup","settings","ajaxPrefilter","ajaxTransport","transport","cacheURL","responseHeadersString","responseHeaders","timeoutTimer","fireGlobals","callbackContext","globalEventContext","completeDeferred","statusCode","requestHeaders","requestHeadersNames","strAbort","getResponseHeader","getAllResponseHeaders","setRequestHeader","lname","overrideMimeType","mimeType","abort","statusText","finalText","success","method","crossDomain","hasContent","ifModified","headers","beforeSend","send","nativeStatusText","responses","isSuccess","modified","ajaxHandleResponses","ajaxConvert","rejectWith","getJSON","getScript","ct","finalDataType","firstDataType","conv2","current","conv","dataFilter","text script","charset","scriptCharset","evt","oldCallbacks","rjsonp","jsonp","jsonpCallback","originalSettings","callbackName","overwritten","responseContainer","jsonProp","xhr","XMLHttpRequest","xhrSupported","xhrSuccessStatus",1223,"xhrId","xhrCallbacks","ActiveXObject","cors","open","username","xhrFields","onload","onerror","fxNow","timerId","rfxtypes","rfxnum","rrun","animationPrefilters","defaultPrefilter","tweeners","tween","createTween","unit","scale","maxIterations","createFxNow","animation","collection","Animation","properties","stopped","tick","currentTime","startTime","duration","percent","tweens","run","opts","specialEasing","originalProperties","Tween","easing","gotoEnd","propFilter","timer","anim","tweener","prefilter","oldfire","dataShow","unqueued","overflow","overflowX","overflowY","eased","step","cssFn","speed","animate","genFx","fadeTo","to","optall","doAnimation","finish","stopQueue","timers","includeWidth","height","slideDown","slideUp","slideToggle","fadeIn","fadeOut","fadeToggle","linear","p","swing","cos","PI","interval","setInterval","clearInterval","slow","fast","animated","offset","setOffset","win","box","left","getBoundingClientRect","getWindow","pageYOffset","pageXOffset","curPosition","curLeft","curCSSTop","curTop","curOffset","curCSSLeft","calculatePosition","curElem","using","offsetParent","parentOffset","scrollTo","Height","Width","defaultExtra","funcName","size","andSelf","module","exports","define","amd"],"mappings":";;;CAaA,SAAWA,EAAQC,WAOnB,GAECC,GAGAC,EAIAC,QAA2BH,WAG3BI,EAAWL,EAAOK,SAClBC,EAAWN,EAAOM,SAClBC,EAAUD,EAASE,gBAGnBC,EAAUT,EAAOU,OAGjBC,EAAKX,EAAOY,EAGZC,KAGAC,KAEAC,EAAe,QAGfC,EAAcF,EAAgBG,OAC9BC,EAAYJ,EAAgBK,KAC5BC,EAAaN,EAAgBO,MAC7BC,EAAeR,EAAgBS,QAC/BC,EAAgBX,EAAWY,SAC3BC,EAAcb,EAAWc,eACzBC,EAAYb,EAAac,KAGzBnB,EAAS,SAAUoB,EAAUC,GAE5B,MAAO,IAAIrB,GAAOsB,GAAGC,KAAMH,EAAUC,EAAS7B,IAI/CgC,EAAY,sCAAsCC,OAGlDC,EAAiB,OAKjBC,EAAa,sCAGbC,EAAa,6BAGbC,EAAY,QACZC,EAAa,eAGbC,EAAa,SAAUC,EAAKC,GAC3B,MAAOA,GAAOC,eAIfC,EAAY,WACXvC,EAASwC,oBAAqB,mBAAoBD,GAAW,GAC7D7C,EAAO8C,oBAAqB,OAAQD,GAAW,GAC/CnC,EAAOqC,QAGTrC,GAAOsB,GAAKtB,EAAOsC,WAElBC,OAAQlC,EAERmC,YAAaxC,EACbuB,KAAM,SAAUH,EAAUC,EAAS7B,GAClC,GAAIiD,GAAOC,CAGX,KAAMtB,EACL,MAAOuB,KAIR,IAAyB,gBAAbvB,GAAwB,CAUnC,GAPCqB,EAF2B,MAAvBrB,EAASwB,OAAO,IAAyD,MAA3CxB,EAASwB,OAAQxB,EAASyB,OAAS,IAAezB,EAASyB,QAAU,GAE7F,KAAMzB,EAAU,MAGlBO,EAAWmB,KAAM1B,IAIrBqB,IAAUA,EAAM,IAAOpB,EA+CrB,OAAMA,GAAWA,EAAQkB,QACtBlB,GAAW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ACX7hB,EAAKwd,KAAM,SAAW5a,GAAQyM,EAAK,SAAWzM,GAC9C5C,EAAKwd,KAAM,SAAW5a,GAAQyM,EAAK,SAAWzM,GAC9CyM,EAAK,SAAWzM,KAIXkE,IAAUjK,UAEhBS,EAAO4yB,IAAKlwB,EAAMkE,EAAMstB,GAGxBl0B,EAAOgL,MAAOtI,EAAMkE,EAAM4C,EAAO0qB,IAChCttB,EAAM4D,EAAY2qB,EAAS51B,UAAWiL,EAAW,WAQvDxK,EAAOsB,GAAG2jC,KAAO,WAChB,MAAOtiC,MAAKE,QAGb7C,EAAOsB,GAAG4jC,QAAUllC,EAAOsB,GAAGyqB,QAGP,gBAAXoZ,SAAuBA,QAAoC,gBAAnBA,QAAOC,QAK1DD,OAAOC,QAAUplC,EASM,kBAAXqlC,SAAyBA,OAAOC,KAC3CD,OAAQ,YAAc,WAAc,MAAOrlC,KAMtB,gBAAXV,IAAkD,gBAApBA,GAAOM,WAChDN,EAAOU,OAASV,EAAOY,EAAIF,KAGxBV"} \ No newline at end of file diff --git a/p/scripts/jquery.lazyload.min.js b/p/scripts/jquery.lazyload.min.js new file mode 100644 index 000000000..8dd097dc3 --- /dev/null +++ b/p/scripts/jquery.lazyload.min.js @@ -0,0 +1,15 @@ +/* + * Lazy Load - jQuery plugin for lazy loading images + * + * Copyright (c) 2007-2013 Mika Tuupola + * + * Licensed under the MIT license: + * http://www.opensource.org/licenses/mit-license.php + * + * Project home: + * http://www.appelsiini.net/projects/lazyload + * + * Version: 1.9.0 + * + */ +!function(a,b,c,d){var e=a(b);a.fn.lazyload=function(f){function g(){var b=0;i.each(function(){var c=a(this);if(!j.skip_invisible||c.is(":visible"))if(a.abovethetop(this,j)||a.leftofbegin(this,j));else if(a.belowthefold(this,j)||a.rightoffold(this,j)){if(++b>j.failure_limit)return!1}else c.trigger("appear"),b=0})}var h,i=this,j={threshold:0,failure_limit:0,event:"scroll",effect:"show",container:b,data_attribute:"original",skip_invisible:!0,appear:null,load:null,placeholder:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXYzh8+PB/AAffA0nNPuCLAAAAAElFTkSuQmCC"};return f&&(d!==f.failurelimit&&(f.failure_limit=f.failurelimit,delete f.failurelimit),d!==f.effectspeed&&(f.effect_speed=f.effectspeed,delete f.effectspeed),a.extend(j,f)),h=j.container===d||j.container===b?e:a(j.container),0===j.event.indexOf("scroll")&&h.bind(j.event,function(){return g()}),this.each(function(){var b=this,c=a(b);b.loaded=!1,(c.attr("src")===d||c.attr("src")===!1)&&c.attr("src",j.placeholder),c.one("appear",function(){if(!this.loaded){if(j.appear){var d=i.length;j.appear.call(b,d,j)}a("").bind("load",function(){var d=c.data(j.data_attribute);c.hide(),c.is("img")?c.attr("src",d):c.css("background-image","url('"+d+"')"),c[j.effect](j.effect_speed),b.loaded=!0;var e=a.grep(i,function(a){return!a.loaded});if(i=a(e),j.load){var f=i.length;j.load.call(b,f,j)}}).attr("src",c.data(j.data_attribute))}}),0!==j.event.indexOf("scroll")&&c.bind(j.event,function(){b.loaded||c.trigger("appear")})}),e.bind("resize",function(){g()}),/iphone|ipod|ipad.*os 5/gi.test(navigator.appVersion)&&e.bind("pageshow",function(b){b.originalEvent&&b.originalEvent.persisted&&i.each(function(){a(this).trigger("appear")})}),a(c).ready(function(){g()}),this},a.belowthefold=function(c,f){var g;return g=f.container===d||f.container===b?(b.innerHeight?b.innerHeight:e.height())+e.scrollTop():a(f.container).offset().top+a(f.container).height(),g<=a(c).offset().top-f.threshold},a.rightoffold=function(c,f){var g;return g=f.container===d||f.container===b?e.width()+e.scrollLeft():a(f.container).offset().left+a(f.container).width(),g<=a(c).offset().left-f.threshold},a.abovethetop=function(c,f){var g;return g=f.container===d||f.container===b?e.scrollTop():a(f.container).offset().top,g>=a(c).offset().top+f.threshold+a(c).height()},a.leftofbegin=function(c,f){var g;return g=f.container===d||f.container===b?e.scrollLeft():a(f.container).offset().left,g>=a(c).offset().left+f.threshold+a(c).width()},a.inviewport=function(b,c){return!(a.rightoffold(b,c)||a.leftofbegin(b,c)||a.belowthefold(b,c)||a.abovethetop(b,c))},a.extend(a.expr[":"],{"below-the-fold":function(b){return a.belowthefold(b,{threshold:0})},"above-the-top":function(b){return!a.belowthefold(b,{threshold:0})},"right-of-screen":function(b){return a.rightoffold(b,{threshold:0})},"left-of-screen":function(b){return!a.rightoffold(b,{threshold:0})},"in-viewport":function(b){return a.inviewport(b,{threshold:0})},"above-the-fold":function(b){return!a.belowthefold(b,{threshold:0})},"right-of-fold":function(b){return a.rightoffold(b,{threshold:0})},"left-of-fold":function(b){return!a.rightoffold(b,{threshold:0})}})}(jQuery,window,document); \ No newline at end of file diff --git a/p/scripts/jquery.min.js b/p/scripts/jquery.min.js new file mode 100644 index 000000000..2be209dd2 --- /dev/null +++ b/p/scripts/jquery.min.js @@ -0,0 +1,6 @@ +/*! jQuery v2.0.3 | (c) 2005, 2013 jQuery Foundation, Inc. | jquery.org/license +//@ sourceMappingURL=jquery-2.0.3.min.map +*/ +(function(e,undefined){var t,n,r=typeof undefined,i=e.location,o=e.document,s=o.documentElement,a=e.jQuery,u=e.$,l={},c=[],p="2.0.3",f=c.concat,h=c.push,d=c.slice,g=c.indexOf,m=l.toString,y=l.hasOwnProperty,v=p.trim,x=function(e,n){return new x.fn.init(e,n,t)},b=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,w=/\S+/g,T=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,C=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,k=/^-ms-/,N=/-([\da-z])/gi,E=function(e,t){return t.toUpperCase()},S=function(){o.removeEventListener("DOMContentLoaded",S,!1),e.removeEventListener("load",S,!1),x.ready()};x.fn=x.prototype={jquery:p,constructor:x,init:function(e,t,n){var r,i;if(!e)return this;if("string"==typeof e){if(r="<"===e.charAt(0)&&">"===e.charAt(e.length-1)&&e.length>=3?[null,e,null]:T.exec(e),!r||!r[1]&&t)return!t||t.jquery?(t||n).find(e):this.constructor(t).find(e);if(r[1]){if(t=t instanceof x?t[0]:t,x.merge(this,x.parseHTML(r[1],t&&t.nodeType?t.ownerDocument||t:o,!0)),C.test(r[1])&&x.isPlainObject(t))for(r in t)x.isFunction(this[r])?this[r](t[r]):this.attr(r,t[r]);return this}return i=o.getElementById(r[2]),i&&i.parentNode&&(this.length=1,this[0]=i),this.context=o,this.selector=e,this}return e.nodeType?(this.context=this[0]=e,this.length=1,this):x.isFunction(e)?n.ready(e):(e.selector!==undefined&&(this.selector=e.selector,this.context=e.context),x.makeArray(e,this))},selector:"",length:0,toArray:function(){return d.call(this)},get:function(e){return null==e?this.toArray():0>e?this[this.length+e]:this[e]},pushStack:function(e){var t=x.merge(this.constructor(),e);return t.prevObject=this,t.context=this.context,t},each:function(e,t){return x.each(this,e,t)},ready:function(e){return x.ready.promise().done(e),this},slice:function(){return this.pushStack(d.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(e){var t=this.length,n=+e+(0>e?t:0);return this.pushStack(n>=0&&t>n?[this[n]]:[])},map:function(e){return this.pushStack(x.map(this,function(t,n){return e.call(t,n,t)}))},end:function(){return this.prevObject||this.constructor(null)},push:h,sort:[].sort,splice:[].splice},x.fn.init.prototype=x.fn,x.extend=x.fn.extend=function(){var e,t,n,r,i,o,s=arguments[0]||{},a=1,u=arguments.length,l=!1;for("boolean"==typeof s&&(l=s,s=arguments[1]||{},a=2),"object"==typeof s||x.isFunction(s)||(s={}),u===a&&(s=this,--a);u>a;a++)if(null!=(e=arguments[a]))for(t in e)n=s[t],r=e[t],s!==r&&(l&&r&&(x.isPlainObject(r)||(i=x.isArray(r)))?(i?(i=!1,o=n&&x.isArray(n)?n:[]):o=n&&x.isPlainObject(n)?n:{},s[t]=x.extend(l,o,r)):r!==undefined&&(s[t]=r));return s},x.extend({expando:"jQuery"+(p+Math.random()).replace(/\D/g,""),noConflict:function(t){return e.$===x&&(e.$=u),t&&e.jQuery===x&&(e.jQuery=a),x},isReady:!1,readyWait:1,holdReady:function(e){e?x.readyWait++:x.ready(!0)},ready:function(e){(e===!0?--x.readyWait:x.isReady)||(x.isReady=!0,e!==!0&&--x.readyWait>0||(n.resolveWith(o,[x]),x.fn.trigger&&x(o).trigger("ready").off("ready")))},isFunction:function(e){return"function"===x.type(e)},isArray:Array.isArray,isWindow:function(e){return null!=e&&e===e.window},isNumeric:function(e){return!isNaN(parseFloat(e))&&isFinite(e)},type:function(e){return null==e?e+"":"object"==typeof e||"function"==typeof e?l[m.call(e)]||"object":typeof e},isPlainObject:function(e){if("object"!==x.type(e)||e.nodeType||x.isWindow(e))return!1;try{if(e.constructor&&!y.call(e.constructor.prototype,"isPrototypeOf"))return!1}catch(t){return!1}return!0},isEmptyObject:function(e){var t;for(t in e)return!1;return!0},error:function(e){throw Error(e)},parseHTML:function(e,t,n){if(!e||"string"!=typeof e)return null;"boolean"==typeof t&&(n=t,t=!1),t=t||o;var r=C.exec(e),i=!n&&[];return r?[t.createElement(r[1])]:(r=x.buildFragment([e],t,i),i&&x(i).remove(),x.merge([],r.childNodes))},parseJSON:JSON.parse,parseXML:function(e){var t,n;if(!e||"string"!=typeof e)return null;try{n=new DOMParser,t=n.parseFromString(e,"text/xml")}catch(r){t=undefined}return(!t||t.getElementsByTagName("parsererror").length)&&x.error("Invalid XML: "+e),t},noop:function(){},globalEval:function(e){var t,n=eval;e=x.trim(e),e&&(1===e.indexOf("use strict")?(t=o.createElement("script"),t.text=e,o.head.appendChild(t).parentNode.removeChild(t)):n(e))},camelCase:function(e){return e.replace(k,"ms-").replace(N,E)},nodeName:function(e,t){return e.nodeName&&e.nodeName.toLowerCase()===t.toLowerCase()},each:function(e,t,n){var r,i=0,o=e.length,s=j(e);if(n){if(s){for(;o>i;i++)if(r=t.apply(e[i],n),r===!1)break}else for(i in e)if(r=t.apply(e[i],n),r===!1)break}else if(s){for(;o>i;i++)if(r=t.call(e[i],i,e[i]),r===!1)break}else for(i in e)if(r=t.call(e[i],i,e[i]),r===!1)break;return e},trim:function(e){return null==e?"":v.call(e)},makeArray:function(e,t){var n=t||[];return null!=e&&(j(Object(e))?x.merge(n,"string"==typeof e?[e]:e):h.call(n,e)),n},inArray:function(e,t,n){return null==t?-1:g.call(t,e,n)},merge:function(e,t){var n=t.length,r=e.length,i=0;if("number"==typeof n)for(;n>i;i++)e[r++]=t[i];else while(t[i]!==undefined)e[r++]=t[i++];return e.length=r,e},grep:function(e,t,n){var r,i=[],o=0,s=e.length;for(n=!!n;s>o;o++)r=!!t(e[o],o),n!==r&&i.push(e[o]);return i},map:function(e,t,n){var r,i=0,o=e.length,s=j(e),a=[];if(s)for(;o>i;i++)r=t(e[i],i,n),null!=r&&(a[a.length]=r);else for(i in e)r=t(e[i],i,n),null!=r&&(a[a.length]=r);return f.apply([],a)},guid:1,proxy:function(e,t){var n,r,i;return"string"==typeof t&&(n=e[t],t=e,e=n),x.isFunction(e)?(r=d.call(arguments,2),i=function(){return e.apply(t||this,r.concat(d.call(arguments)))},i.guid=e.guid=e.guid||x.guid++,i):undefined},access:function(e,t,n,r,i,o,s){var a=0,u=e.length,l=null==n;if("object"===x.type(n)){i=!0;for(a in n)x.access(e,t,a,n[a],!0,o,s)}else if(r!==undefined&&(i=!0,x.isFunction(r)||(s=!0),l&&(s?(t.call(e,r),t=null):(l=t,t=function(e,t,n){return l.call(x(e),n)})),t))for(;u>a;a++)t(e[a],n,s?r:r.call(e[a],a,t(e[a],n)));return i?e:l?t.call(e):u?t(e[0],n):o},now:Date.now,swap:function(e,t,n,r){var i,o,s={};for(o in t)s[o]=e.style[o],e.style[o]=t[o];i=n.apply(e,r||[]);for(o in t)e.style[o]=s[o];return i}}),x.ready.promise=function(t){return n||(n=x.Deferred(),"complete"===o.readyState?setTimeout(x.ready):(o.addEventListener("DOMContentLoaded",S,!1),e.addEventListener("load",S,!1))),n.promise(t)},x.each("Boolean Number String Function Array Date RegExp Object Error".split(" "),function(e,t){l["[object "+t+"]"]=t.toLowerCase()});function j(e){var t=e.length,n=x.type(e);return x.isWindow(e)?!1:1===e.nodeType&&t?!0:"array"===n||"function"!==n&&(0===t||"number"==typeof t&&t>0&&t-1 in e)}t=x(o),function(e,undefined){var t,n,r,i,o,s,a,u,l,c,p,f,h,d,g,m,y,v="sizzle"+-new Date,b=e.document,w=0,T=0,C=st(),k=st(),N=st(),E=!1,S=function(e,t){return e===t?(E=!0,0):0},j=typeof undefined,D=1<<31,A={}.hasOwnProperty,L=[],q=L.pop,H=L.push,O=L.push,F=L.slice,P=L.indexOf||function(e){var t=0,n=this.length;for(;n>t;t++)if(this[t]===e)return t;return-1},R="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",M="[\\x20\\t\\r\\n\\f]",W="(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",$=W.replace("w","w#"),B="\\["+M+"*("+W+")"+M+"*(?:([*^$|!~]?=)"+M+"*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|("+$+")|)|)"+M+"*\\]",I=":("+W+")(?:\\(((['\"])((?:\\\\.|[^\\\\])*?)\\3|((?:\\\\.|[^\\\\()[\\]]|"+B.replace(3,8)+")*)|.*)\\)|)",z=RegExp("^"+M+"+|((?:^|[^\\\\])(?:\\\\.)*)"+M+"+$","g"),_=RegExp("^"+M+"*,"+M+"*"),X=RegExp("^"+M+"*([>+~]|"+M+")"+M+"*"),U=RegExp(M+"*[+~]"),Y=RegExp("="+M+"*([^\\]'\"]*)"+M+"*\\]","g"),V=RegExp(I),G=RegExp("^"+$+"$"),J={ID:RegExp("^#("+W+")"),CLASS:RegExp("^\\.("+W+")"),TAG:RegExp("^("+W.replace("w","w*")+")"),ATTR:RegExp("^"+B),PSEUDO:RegExp("^"+I),CHILD:RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+M+"*(even|odd|(([+-]|)(\\d*)n|)"+M+"*(?:([+-]|)"+M+"*(\\d+)|))"+M+"*\\)|)","i"),bool:RegExp("^(?:"+R+")$","i"),needsContext:RegExp("^"+M+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+M+"*((?:-\\d)?\\d*)"+M+"*\\)|)(?=[^-]|$)","i")},Q=/^[^{]+\{\s*\[native \w/,K=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,Z=/^(?:input|select|textarea|button)$/i,et=/^h\d$/i,tt=/'|\\/g,nt=RegExp("\\\\([\\da-f]{1,6}"+M+"?|("+M+")|.)","ig"),rt=function(e,t,n){var r="0x"+t-65536;return r!==r||n?t:0>r?String.fromCharCode(r+65536):String.fromCharCode(55296|r>>10,56320|1023&r)};try{O.apply(L=F.call(b.childNodes),b.childNodes),L[b.childNodes.length].nodeType}catch(it){O={apply:L.length?function(e,t){H.apply(e,F.call(t))}:function(e,t){var n=e.length,r=0;while(e[n++]=t[r++]);e.length=n-1}}}function ot(e,t,r,i){var o,s,a,u,l,f,g,m,x,w;if((t?t.ownerDocument||t:b)!==p&&c(t),t=t||p,r=r||[],!e||"string"!=typeof e)return r;if(1!==(u=t.nodeType)&&9!==u)return[];if(h&&!i){if(o=K.exec(e))if(a=o[1]){if(9===u){if(s=t.getElementById(a),!s||!s.parentNode)return r;if(s.id===a)return r.push(s),r}else if(t.ownerDocument&&(s=t.ownerDocument.getElementById(a))&&y(t,s)&&s.id===a)return r.push(s),r}else{if(o[2])return O.apply(r,t.getElementsByTagName(e)),r;if((a=o[3])&&n.getElementsByClassName&&t.getElementsByClassName)return O.apply(r,t.getElementsByClassName(a)),r}if(n.qsa&&(!d||!d.test(e))){if(m=g=v,x=t,w=9===u&&e,1===u&&"object"!==t.nodeName.toLowerCase()){f=gt(e),(g=t.getAttribute("id"))?m=g.replace(tt,"\\$&"):t.setAttribute("id",m),m="[id='"+m+"'] ",l=f.length;while(l--)f[l]=m+mt(f[l]);x=U.test(e)&&t.parentNode||t,w=f.join(",")}if(w)try{return O.apply(r,x.querySelectorAll(w)),r}catch(T){}finally{g||t.removeAttribute("id")}}}return kt(e.replace(z,"$1"),t,r,i)}function st(){var e=[];function t(n,r){return e.push(n+=" ")>i.cacheLength&&delete t[e.shift()],t[n]=r}return t}function at(e){return e[v]=!0,e}function ut(e){var t=p.createElement("div");try{return!!e(t)}catch(n){return!1}finally{t.parentNode&&t.parentNode.removeChild(t),t=null}}function lt(e,t){var n=e.split("|"),r=e.length;while(r--)i.attrHandle[n[r]]=t}function ct(e,t){var n=t&&e,r=n&&1===e.nodeType&&1===t.nodeType&&(~t.sourceIndex||D)-(~e.sourceIndex||D);if(r)return r;if(n)while(n=n.nextSibling)if(n===t)return-1;return e?1:-1}function pt(e){return function(t){var n=t.nodeName.toLowerCase();return"input"===n&&t.type===e}}function ft(e){return function(t){var n=t.nodeName.toLowerCase();return("input"===n||"button"===n)&&t.type===e}}function ht(e){return at(function(t){return t=+t,at(function(n,r){var i,o=e([],n.length,t),s=o.length;while(s--)n[i=o[s]]&&(n[i]=!(r[i]=n[i]))})})}s=ot.isXML=function(e){var t=e&&(e.ownerDocument||e).documentElement;return t?"HTML"!==t.nodeName:!1},n=ot.support={},c=ot.setDocument=function(e){var t=e?e.ownerDocument||e:b,r=t.defaultView;return t!==p&&9===t.nodeType&&t.documentElement?(p=t,f=t.documentElement,h=!s(t),r&&r.attachEvent&&r!==r.top&&r.attachEvent("onbeforeunload",function(){c()}),n.attributes=ut(function(e){return e.className="i",!e.getAttribute("className")}),n.getElementsByTagName=ut(function(e){return e.appendChild(t.createComment("")),!e.getElementsByTagName("*").length}),n.getElementsByClassName=ut(function(e){return e.innerHTML="
    ",e.firstChild.className="i",2===e.getElementsByClassName("i").length}),n.getById=ut(function(e){return f.appendChild(e).id=v,!t.getElementsByName||!t.getElementsByName(v).length}),n.getById?(i.find.ID=function(e,t){if(typeof t.getElementById!==j&&h){var n=t.getElementById(e);return n&&n.parentNode?[n]:[]}},i.filter.ID=function(e){var t=e.replace(nt,rt);return function(e){return e.getAttribute("id")===t}}):(delete i.find.ID,i.filter.ID=function(e){var t=e.replace(nt,rt);return function(e){var n=typeof e.getAttributeNode!==j&&e.getAttributeNode("id");return n&&n.value===t}}),i.find.TAG=n.getElementsByTagName?function(e,t){return typeof t.getElementsByTagName!==j?t.getElementsByTagName(e):undefined}:function(e,t){var n,r=[],i=0,o=t.getElementsByTagName(e);if("*"===e){while(n=o[i++])1===n.nodeType&&r.push(n);return r}return o},i.find.CLASS=n.getElementsByClassName&&function(e,t){return typeof t.getElementsByClassName!==j&&h?t.getElementsByClassName(e):undefined},g=[],d=[],(n.qsa=Q.test(t.querySelectorAll))&&(ut(function(e){e.innerHTML="",e.querySelectorAll("[selected]").length||d.push("\\["+M+"*(?:value|"+R+")"),e.querySelectorAll(":checked").length||d.push(":checked")}),ut(function(e){var n=t.createElement("input");n.setAttribute("type","hidden"),e.appendChild(n).setAttribute("t",""),e.querySelectorAll("[t^='']").length&&d.push("[*^$]="+M+"*(?:''|\"\")"),e.querySelectorAll(":enabled").length||d.push(":enabled",":disabled"),e.querySelectorAll("*,:x"),d.push(",.*:")})),(n.matchesSelector=Q.test(m=f.webkitMatchesSelector||f.mozMatchesSelector||f.oMatchesSelector||f.msMatchesSelector))&&ut(function(e){n.disconnectedMatch=m.call(e,"div"),m.call(e,"[s!='']:x"),g.push("!=",I)}),d=d.length&&RegExp(d.join("|")),g=g.length&&RegExp(g.join("|")),y=Q.test(f.contains)||f.compareDocumentPosition?function(e,t){var n=9===e.nodeType?e.documentElement:e,r=t&&t.parentNode;return e===r||!(!r||1!==r.nodeType||!(n.contains?n.contains(r):e.compareDocumentPosition&&16&e.compareDocumentPosition(r)))}:function(e,t){if(t)while(t=t.parentNode)if(t===e)return!0;return!1},S=f.compareDocumentPosition?function(e,r){if(e===r)return E=!0,0;var i=r.compareDocumentPosition&&e.compareDocumentPosition&&e.compareDocumentPosition(r);return i?1&i||!n.sortDetached&&r.compareDocumentPosition(e)===i?e===t||y(b,e)?-1:r===t||y(b,r)?1:l?P.call(l,e)-P.call(l,r):0:4&i?-1:1:e.compareDocumentPosition?-1:1}:function(e,n){var r,i=0,o=e.parentNode,s=n.parentNode,a=[e],u=[n];if(e===n)return E=!0,0;if(!o||!s)return e===t?-1:n===t?1:o?-1:s?1:l?P.call(l,e)-P.call(l,n):0;if(o===s)return ct(e,n);r=e;while(r=r.parentNode)a.unshift(r);r=n;while(r=r.parentNode)u.unshift(r);while(a[i]===u[i])i++;return i?ct(a[i],u[i]):a[i]===b?-1:u[i]===b?1:0},t):p},ot.matches=function(e,t){return ot(e,null,null,t)},ot.matchesSelector=function(e,t){if((e.ownerDocument||e)!==p&&c(e),t=t.replace(Y,"='$1']"),!(!n.matchesSelector||!h||g&&g.test(t)||d&&d.test(t)))try{var r=m.call(e,t);if(r||n.disconnectedMatch||e.document&&11!==e.document.nodeType)return r}catch(i){}return ot(t,p,null,[e]).length>0},ot.contains=function(e,t){return(e.ownerDocument||e)!==p&&c(e),y(e,t)},ot.attr=function(e,t){(e.ownerDocument||e)!==p&&c(e);var r=i.attrHandle[t.toLowerCase()],o=r&&A.call(i.attrHandle,t.toLowerCase())?r(e,t,!h):undefined;return o===undefined?n.attributes||!h?e.getAttribute(t):(o=e.getAttributeNode(t))&&o.specified?o.value:null:o},ot.error=function(e){throw Error("Syntax error, unrecognized expression: "+e)},ot.uniqueSort=function(e){var t,r=[],i=0,o=0;if(E=!n.detectDuplicates,l=!n.sortStable&&e.slice(0),e.sort(S),E){while(t=e[o++])t===e[o]&&(i=r.push(o));while(i--)e.splice(r[i],1)}return e},o=ot.getText=function(e){var t,n="",r=0,i=e.nodeType;if(i){if(1===i||9===i||11===i){if("string"==typeof e.textContent)return e.textContent;for(e=e.firstChild;e;e=e.nextSibling)n+=o(e)}else if(3===i||4===i)return e.nodeValue}else for(;t=e[r];r++)n+=o(t);return n},i=ot.selectors={cacheLength:50,createPseudo:at,match:J,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(nt,rt),e[3]=(e[4]||e[5]||"").replace(nt,rt),"~="===e[2]&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),"nth"===e[1].slice(0,3)?(e[3]||ot.error(e[0]),e[4]=+(e[4]?e[5]+(e[6]||1):2*("even"===e[3]||"odd"===e[3])),e[5]=+(e[7]+e[8]||"odd"===e[3])):e[3]&&ot.error(e[0]),e},PSEUDO:function(e){var t,n=!e[5]&&e[2];return J.CHILD.test(e[0])?null:(e[3]&&e[4]!==undefined?e[2]=e[4]:n&&V.test(n)&&(t=gt(n,!0))&&(t=n.indexOf(")",n.length-t)-n.length)&&(e[0]=e[0].slice(0,t),e[2]=n.slice(0,t)),e.slice(0,3))}},filter:{TAG:function(e){var t=e.replace(nt,rt).toLowerCase();return"*"===e?function(){return!0}:function(e){return e.nodeName&&e.nodeName.toLowerCase()===t}},CLASS:function(e){var t=C[e+" "];return t||(t=RegExp("(^|"+M+")"+e+"("+M+"|$)"))&&C(e,function(e){return t.test("string"==typeof e.className&&e.className||typeof e.getAttribute!==j&&e.getAttribute("class")||"")})},ATTR:function(e,t,n){return function(r){var i=ot.attr(r,e);return null==i?"!="===t:t?(i+="","="===t?i===n:"!="===t?i!==n:"^="===t?n&&0===i.indexOf(n):"*="===t?n&&i.indexOf(n)>-1:"$="===t?n&&i.slice(-n.length)===n:"~="===t?(" "+i+" ").indexOf(n)>-1:"|="===t?i===n||i.slice(0,n.length+1)===n+"-":!1):!0}},CHILD:function(e,t,n,r,i){var o="nth"!==e.slice(0,3),s="last"!==e.slice(-4),a="of-type"===t;return 1===r&&0===i?function(e){return!!e.parentNode}:function(t,n,u){var l,c,p,f,h,d,g=o!==s?"nextSibling":"previousSibling",m=t.parentNode,y=a&&t.nodeName.toLowerCase(),x=!u&&!a;if(m){if(o){while(g){p=t;while(p=p[g])if(a?p.nodeName.toLowerCase()===y:1===p.nodeType)return!1;d=g="only"===e&&!d&&"nextSibling"}return!0}if(d=[s?m.firstChild:m.lastChild],s&&x){c=m[v]||(m[v]={}),l=c[e]||[],h=l[0]===w&&l[1],f=l[0]===w&&l[2],p=h&&m.childNodes[h];while(p=++h&&p&&p[g]||(f=h=0)||d.pop())if(1===p.nodeType&&++f&&p===t){c[e]=[w,h,f];break}}else if(x&&(l=(t[v]||(t[v]={}))[e])&&l[0]===w)f=l[1];else while(p=++h&&p&&p[g]||(f=h=0)||d.pop())if((a?p.nodeName.toLowerCase()===y:1===p.nodeType)&&++f&&(x&&((p[v]||(p[v]={}))[e]=[w,f]),p===t))break;return f-=i,f===r||0===f%r&&f/r>=0}}},PSEUDO:function(e,t){var n,r=i.pseudos[e]||i.setFilters[e.toLowerCase()]||ot.error("unsupported pseudo: "+e);return r[v]?r(t):r.length>1?(n=[e,e,"",t],i.setFilters.hasOwnProperty(e.toLowerCase())?at(function(e,n){var i,o=r(e,t),s=o.length;while(s--)i=P.call(e,o[s]),e[i]=!(n[i]=o[s])}):function(e){return r(e,0,n)}):r}},pseudos:{not:at(function(e){var t=[],n=[],r=a(e.replace(z,"$1"));return r[v]?at(function(e,t,n,i){var o,s=r(e,null,i,[]),a=e.length;while(a--)(o=s[a])&&(e[a]=!(t[a]=o))}):function(e,i,o){return t[0]=e,r(t,null,o,n),!n.pop()}}),has:at(function(e){return function(t){return ot(e,t).length>0}}),contains:at(function(e){return function(t){return(t.textContent||t.innerText||o(t)).indexOf(e)>-1}}),lang:at(function(e){return G.test(e||"")||ot.error("unsupported lang: "+e),e=e.replace(nt,rt).toLowerCase(),function(t){var n;do if(n=h?t.lang:t.getAttribute("xml:lang")||t.getAttribute("lang"))return n=n.toLowerCase(),n===e||0===n.indexOf(e+"-");while((t=t.parentNode)&&1===t.nodeType);return!1}}),target:function(t){var n=e.location&&e.location.hash;return n&&n.slice(1)===t.id},root:function(e){return e===f},focus:function(e){return e===p.activeElement&&(!p.hasFocus||p.hasFocus())&&!!(e.type||e.href||~e.tabIndex)},enabled:function(e){return e.disabled===!1},disabled:function(e){return e.disabled===!0},checked:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&!!e.checked||"option"===t&&!!e.selected},selected:function(e){return e.parentNode&&e.parentNode.selectedIndex,e.selected===!0},empty:function(e){for(e=e.firstChild;e;e=e.nextSibling)if(e.nodeName>"@"||3===e.nodeType||4===e.nodeType)return!1;return!0},parent:function(e){return!i.pseudos.empty(e)},header:function(e){return et.test(e.nodeName)},input:function(e){return Z.test(e.nodeName)},button:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&"button"===e.type||"button"===t},text:function(e){var t;return"input"===e.nodeName.toLowerCase()&&"text"===e.type&&(null==(t=e.getAttribute("type"))||t.toLowerCase()===e.type)},first:ht(function(){return[0]}),last:ht(function(e,t){return[t-1]}),eq:ht(function(e,t,n){return[0>n?n+t:n]}),even:ht(function(e,t){var n=0;for(;t>n;n+=2)e.push(n);return e}),odd:ht(function(e,t){var n=1;for(;t>n;n+=2)e.push(n);return e}),lt:ht(function(e,t,n){var r=0>n?n+t:n;for(;--r>=0;)e.push(r);return e}),gt:ht(function(e,t,n){var r=0>n?n+t:n;for(;t>++r;)e.push(r);return e})}},i.pseudos.nth=i.pseudos.eq;for(t in{radio:!0,checkbox:!0,file:!0,password:!0,image:!0})i.pseudos[t]=pt(t);for(t in{submit:!0,reset:!0})i.pseudos[t]=ft(t);function dt(){}dt.prototype=i.filters=i.pseudos,i.setFilters=new dt;function gt(e,t){var n,r,o,s,a,u,l,c=k[e+" "];if(c)return t?0:c.slice(0);a=e,u=[],l=i.preFilter;while(a){(!n||(r=_.exec(a)))&&(r&&(a=a.slice(r[0].length)||a),u.push(o=[])),n=!1,(r=X.exec(a))&&(n=r.shift(),o.push({value:n,type:r[0].replace(z," ")}),a=a.slice(n.length));for(s in i.filter)!(r=J[s].exec(a))||l[s]&&!(r=l[s](r))||(n=r.shift(),o.push({value:n,type:s,matches:r}),a=a.slice(n.length));if(!n)break}return t?a.length:a?ot.error(e):k(e,u).slice(0)}function mt(e){var t=0,n=e.length,r="";for(;n>t;t++)r+=e[t].value;return r}function yt(e,t,n){var i=t.dir,o=n&&"parentNode"===i,s=T++;return t.first?function(t,n,r){while(t=t[i])if(1===t.nodeType||o)return e(t,n,r)}:function(t,n,a){var u,l,c,p=w+" "+s;if(a){while(t=t[i])if((1===t.nodeType||o)&&e(t,n,a))return!0}else while(t=t[i])if(1===t.nodeType||o)if(c=t[v]||(t[v]={}),(l=c[i])&&l[0]===p){if((u=l[1])===!0||u===r)return u===!0}else if(l=c[i]=[p],l[1]=e(t,n,a)||r,l[1]===!0)return!0}}function vt(e){return e.length>1?function(t,n,r){var i=e.length;while(i--)if(!e[i](t,n,r))return!1;return!0}:e[0]}function xt(e,t,n,r,i){var o,s=[],a=0,u=e.length,l=null!=t;for(;u>a;a++)(o=e[a])&&(!n||n(o,r,i))&&(s.push(o),l&&t.push(a));return s}function bt(e,t,n,r,i,o){return r&&!r[v]&&(r=bt(r)),i&&!i[v]&&(i=bt(i,o)),at(function(o,s,a,u){var l,c,p,f=[],h=[],d=s.length,g=o||Ct(t||"*",a.nodeType?[a]:a,[]),m=!e||!o&&t?g:xt(g,f,e,a,u),y=n?i||(o?e:d||r)?[]:s:m;if(n&&n(m,y,a,u),r){l=xt(y,h),r(l,[],a,u),c=l.length;while(c--)(p=l[c])&&(y[h[c]]=!(m[h[c]]=p))}if(o){if(i||e){if(i){l=[],c=y.length;while(c--)(p=y[c])&&l.push(m[c]=p);i(null,y=[],l,u)}c=y.length;while(c--)(p=y[c])&&(l=i?P.call(o,p):f[c])>-1&&(o[l]=!(s[l]=p))}}else y=xt(y===s?y.splice(d,y.length):y),i?i(null,s,y,u):O.apply(s,y)})}function wt(e){var t,n,r,o=e.length,s=i.relative[e[0].type],a=s||i.relative[" "],l=s?1:0,c=yt(function(e){return e===t},a,!0),p=yt(function(e){return P.call(t,e)>-1},a,!0),f=[function(e,n,r){return!s&&(r||n!==u)||((t=n).nodeType?c(e,n,r):p(e,n,r))}];for(;o>l;l++)if(n=i.relative[e[l].type])f=[yt(vt(f),n)];else{if(n=i.filter[e[l].type].apply(null,e[l].matches),n[v]){for(r=++l;o>r;r++)if(i.relative[e[r].type])break;return bt(l>1&&vt(f),l>1&&mt(e.slice(0,l-1).concat({value:" "===e[l-2].type?"*":""})).replace(z,"$1"),n,r>l&&wt(e.slice(l,r)),o>r&&wt(e=e.slice(r)),o>r&&mt(e))}f.push(n)}return vt(f)}function Tt(e,t){var n=0,o=t.length>0,s=e.length>0,a=function(a,l,c,f,h){var d,g,m,y=[],v=0,x="0",b=a&&[],T=null!=h,C=u,k=a||s&&i.find.TAG("*",h&&l.parentNode||l),N=w+=null==C?1:Math.random()||.1;for(T&&(u=l!==p&&l,r=n);null!=(d=k[x]);x++){if(s&&d){g=0;while(m=e[g++])if(m(d,l,c)){f.push(d);break}T&&(w=N,r=++n)}o&&((d=!m&&d)&&v--,a&&b.push(d))}if(v+=x,o&&x!==v){g=0;while(m=t[g++])m(b,y,l,c);if(a){if(v>0)while(x--)b[x]||y[x]||(y[x]=q.call(f));y=xt(y)}O.apply(f,y),T&&!a&&y.length>0&&v+t.length>1&&ot.uniqueSort(f)}return T&&(w=N,u=C),b};return o?at(a):a}a=ot.compile=function(e,t){var n,r=[],i=[],o=N[e+" "];if(!o){t||(t=gt(e)),n=t.length;while(n--)o=wt(t[n]),o[v]?r.push(o):i.push(o);o=N(e,Tt(i,r))}return o};function Ct(e,t,n){var r=0,i=t.length;for(;i>r;r++)ot(e,t[r],n);return n}function kt(e,t,r,o){var s,u,l,c,p,f=gt(e);if(!o&&1===f.length){if(u=f[0]=f[0].slice(0),u.length>2&&"ID"===(l=u[0]).type&&n.getById&&9===t.nodeType&&h&&i.relative[u[1].type]){if(t=(i.find.ID(l.matches[0].replace(nt,rt),t)||[])[0],!t)return r;e=e.slice(u.shift().value.length)}s=J.needsContext.test(e)?0:u.length;while(s--){if(l=u[s],i.relative[c=l.type])break;if((p=i.find[c])&&(o=p(l.matches[0].replace(nt,rt),U.test(u[0].type)&&t.parentNode||t))){if(u.splice(s,1),e=o.length&&mt(u),!e)return O.apply(r,o),r;break}}}return a(e,f)(o,t,!h,r,U.test(e)),r}n.sortStable=v.split("").sort(S).join("")===v,n.detectDuplicates=E,c(),n.sortDetached=ut(function(e){return 1&e.compareDocumentPosition(p.createElement("div"))}),ut(function(e){return e.innerHTML="","#"===e.firstChild.getAttribute("href")})||lt("type|href|height|width",function(e,t,n){return n?undefined:e.getAttribute(t,"type"===t.toLowerCase()?1:2)}),n.attributes&&ut(function(e){return e.innerHTML="",e.firstChild.setAttribute("value",""),""===e.firstChild.getAttribute("value")})||lt("value",function(e,t,n){return n||"input"!==e.nodeName.toLowerCase()?undefined:e.defaultValue}),ut(function(e){return null==e.getAttribute("disabled")})||lt(R,function(e,t,n){var r;return n?undefined:(r=e.getAttributeNode(t))&&r.specified?r.value:e[t]===!0?t.toLowerCase():null}),x.find=ot,x.expr=ot.selectors,x.expr[":"]=x.expr.pseudos,x.unique=ot.uniqueSort,x.text=ot.getText,x.isXMLDoc=ot.isXML,x.contains=ot.contains}(e);var D={};function A(e){var t=D[e]={};return x.each(e.match(w)||[],function(e,n){t[n]=!0}),t}x.Callbacks=function(e){e="string"==typeof e?D[e]||A(e):x.extend({},e);var t,n,r,i,o,s,a=[],u=!e.once&&[],l=function(p){for(t=e.memory&&p,n=!0,s=i||0,i=0,o=a.length,r=!0;a&&o>s;s++)if(a[s].apply(p[0],p[1])===!1&&e.stopOnFalse){t=!1;break}r=!1,a&&(u?u.length&&l(u.shift()):t?a=[]:c.disable())},c={add:function(){if(a){var n=a.length;(function s(t){x.each(t,function(t,n){var r=x.type(n);"function"===r?e.unique&&c.has(n)||a.push(n):n&&n.length&&"string"!==r&&s(n)})})(arguments),r?o=a.length:t&&(i=n,l(t))}return this},remove:function(){return a&&x.each(arguments,function(e,t){var n;while((n=x.inArray(t,a,n))>-1)a.splice(n,1),r&&(o>=n&&o--,s>=n&&s--)}),this},has:function(e){return e?x.inArray(e,a)>-1:!(!a||!a.length)},empty:function(){return a=[],o=0,this},disable:function(){return a=u=t=undefined,this},disabled:function(){return!a},lock:function(){return u=undefined,t||c.disable(),this},locked:function(){return!u},fireWith:function(e,t){return!a||n&&!u||(t=t||[],t=[e,t.slice?t.slice():t],r?u.push(t):l(t)),this},fire:function(){return c.fireWith(this,arguments),this},fired:function(){return!!n}};return c},x.extend({Deferred:function(e){var t=[["resolve","done",x.Callbacks("once memory"),"resolved"],["reject","fail",x.Callbacks("once memory"),"rejected"],["notify","progress",x.Callbacks("memory")]],n="pending",r={state:function(){return n},always:function(){return i.done(arguments).fail(arguments),this},then:function(){var e=arguments;return x.Deferred(function(n){x.each(t,function(t,o){var s=o[0],a=x.isFunction(e[t])&&e[t];i[o[1]](function(){var e=a&&a.apply(this,arguments);e&&x.isFunction(e.promise)?e.promise().done(n.resolve).fail(n.reject).progress(n.notify):n[s+"With"](this===r?n.promise():this,a?[e]:arguments)})}),e=null}).promise()},promise:function(e){return null!=e?x.extend(e,r):r}},i={};return r.pipe=r.then,x.each(t,function(e,o){var s=o[2],a=o[3];r[o[1]]=s.add,a&&s.add(function(){n=a},t[1^e][2].disable,t[2][2].lock),i[o[0]]=function(){return i[o[0]+"With"](this===i?r:this,arguments),this},i[o[0]+"With"]=s.fireWith}),r.promise(i),e&&e.call(i,i),i},when:function(e){var t=0,n=d.call(arguments),r=n.length,i=1!==r||e&&x.isFunction(e.promise)?r:0,o=1===i?e:x.Deferred(),s=function(e,t,n){return function(r){t[e]=this,n[e]=arguments.length>1?d.call(arguments):r,n===a?o.notifyWith(t,n):--i||o.resolveWith(t,n)}},a,u,l;if(r>1)for(a=Array(r),u=Array(r),l=Array(r);r>t;t++)n[t]&&x.isFunction(n[t].promise)?n[t].promise().done(s(t,l,n)).fail(o.reject).progress(s(t,u,a)):--i;return i||o.resolveWith(l,n),o.promise()}}),x.support=function(t){var n=o.createElement("input"),r=o.createDocumentFragment(),i=o.createElement("div"),s=o.createElement("select"),a=s.appendChild(o.createElement("option"));return n.type?(n.type="checkbox",t.checkOn=""!==n.value,t.optSelected=a.selected,t.reliableMarginRight=!0,t.boxSizingReliable=!0,t.pixelPosition=!1,n.checked=!0,t.noCloneChecked=n.cloneNode(!0).checked,s.disabled=!0,t.optDisabled=!a.disabled,n=o.createElement("input"),n.value="t",n.type="radio",t.radioValue="t"===n.value,n.setAttribute("checked","t"),n.setAttribute("name","t"),r.appendChild(n),t.checkClone=r.cloneNode(!0).cloneNode(!0).lastChild.checked,t.focusinBubbles="onfocusin"in e,i.style.backgroundClip="content-box",i.cloneNode(!0).style.backgroundClip="",t.clearCloneStyle="content-box"===i.style.backgroundClip,x(function(){var n,r,s="padding:0;margin:0;border:0;display:block;-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box",a=o.getElementsByTagName("body")[0];a&&(n=o.createElement("div"),n.style.cssText="border:0;width:0;height:0;position:absolute;top:0;left:-9999px;margin-top:1px",a.appendChild(n).appendChild(i),i.innerHTML="",i.style.cssText="-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;padding:1px;border:1px;display:block;width:4px;margin-top:1%;position:absolute;top:1%",x.swap(a,null!=a.style.zoom?{zoom:1}:{},function(){t.boxSizing=4===i.offsetWidth}),e.getComputedStyle&&(t.pixelPosition="1%"!==(e.getComputedStyle(i,null)||{}).top,t.boxSizingReliable="4px"===(e.getComputedStyle(i,null)||{width:"4px"}).width,r=i.appendChild(o.createElement("div")),r.style.cssText=i.style.cssText=s,r.style.marginRight=r.style.width="0",i.style.width="1px",t.reliableMarginRight=!parseFloat((e.getComputedStyle(r,null)||{}).marginRight)),a.removeChild(n))}),t):t}({});var L,q,H=/(?:\{[\s\S]*\}|\[[\s\S]*\])$/,O=/([A-Z])/g;function F(){Object.defineProperty(this.cache={},0,{get:function(){return{}}}),this.expando=x.expando+Math.random()}F.uid=1,F.accepts=function(e){return e.nodeType?1===e.nodeType||9===e.nodeType:!0},F.prototype={key:function(e){if(!F.accepts(e))return 0;var t={},n=e[this.expando];if(!n){n=F.uid++;try{t[this.expando]={value:n},Object.defineProperties(e,t)}catch(r){t[this.expando]=n,x.extend(e,t)}}return this.cache[n]||(this.cache[n]={}),n},set:function(e,t,n){var r,i=this.key(e),o=this.cache[i];if("string"==typeof t)o[t]=n;else if(x.isEmptyObject(o))x.extend(this.cache[i],t);else for(r in t)o[r]=t[r];return o},get:function(e,t){var n=this.cache[this.key(e)];return t===undefined?n:n[t]},access:function(e,t,n){var r;return t===undefined||t&&"string"==typeof t&&n===undefined?(r=this.get(e,t),r!==undefined?r:this.get(e,x.camelCase(t))):(this.set(e,t,n),n!==undefined?n:t)},remove:function(e,t){var n,r,i,o=this.key(e),s=this.cache[o];if(t===undefined)this.cache[o]={};else{x.isArray(t)?r=t.concat(t.map(x.camelCase)):(i=x.camelCase(t),t in s?r=[t,i]:(r=i,r=r in s?[r]:r.match(w)||[])),n=r.length;while(n--)delete s[r[n]]}},hasData:function(e){return!x.isEmptyObject(this.cache[e[this.expando]]||{})},discard:function(e){e[this.expando]&&delete this.cache[e[this.expando]]}},L=new F,q=new F,x.extend({acceptData:F.accepts,hasData:function(e){return L.hasData(e)||q.hasData(e)},data:function(e,t,n){return L.access(e,t,n)},removeData:function(e,t){L.remove(e,t)},_data:function(e,t,n){return q.access(e,t,n)},_removeData:function(e,t){q.remove(e,t)}}),x.fn.extend({data:function(e,t){var n,r,i=this[0],o=0,s=null;if(e===undefined){if(this.length&&(s=L.get(i),1===i.nodeType&&!q.get(i,"hasDataAttrs"))){for(n=i.attributes;n.length>o;o++)r=n[o].name,0===r.indexOf("data-")&&(r=x.camelCase(r.slice(5)),P(i,r,s[r]));q.set(i,"hasDataAttrs",!0)}return s}return"object"==typeof e?this.each(function(){L.set(this,e)}):x.access(this,function(t){var n,r=x.camelCase(e);if(i&&t===undefined){if(n=L.get(i,e),n!==undefined)return n;if(n=L.get(i,r),n!==undefined)return n;if(n=P(i,r,undefined),n!==undefined)return n}else this.each(function(){var n=L.get(this,r);L.set(this,r,t),-1!==e.indexOf("-")&&n!==undefined&&L.set(this,e,t)})},null,t,arguments.length>1,null,!0)},removeData:function(e){return this.each(function(){L.remove(this,e)})}});function P(e,t,n){var r;if(n===undefined&&1===e.nodeType)if(r="data-"+t.replace(O,"-$1").toLowerCase(),n=e.getAttribute(r),"string"==typeof n){try{n="true"===n?!0:"false"===n?!1:"null"===n?null:+n+""===n?+n:H.test(n)?JSON.parse(n):n}catch(i){}L.set(e,t,n)}else n=undefined;return n}x.extend({queue:function(e,t,n){var r;return e?(t=(t||"fx")+"queue",r=q.get(e,t),n&&(!r||x.isArray(n)?r=q.access(e,t,x.makeArray(n)):r.push(n)),r||[]):undefined},dequeue:function(e,t){t=t||"fx";var n=x.queue(e,t),r=n.length,i=n.shift(),o=x._queueHooks(e,t),s=function(){x.dequeue(e,t) +};"inprogress"===i&&(i=n.shift(),r--),i&&("fx"===t&&n.unshift("inprogress"),delete o.stop,i.call(e,s,o)),!r&&o&&o.empty.fire()},_queueHooks:function(e,t){var n=t+"queueHooks";return q.get(e,n)||q.access(e,n,{empty:x.Callbacks("once memory").add(function(){q.remove(e,[t+"queue",n])})})}}),x.fn.extend({queue:function(e,t){var n=2;return"string"!=typeof e&&(t=e,e="fx",n--),n>arguments.length?x.queue(this[0],e):t===undefined?this:this.each(function(){var n=x.queue(this,e,t);x._queueHooks(this,e),"fx"===e&&"inprogress"!==n[0]&&x.dequeue(this,e)})},dequeue:function(e){return this.each(function(){x.dequeue(this,e)})},delay:function(e,t){return e=x.fx?x.fx.speeds[e]||e:e,t=t||"fx",this.queue(t,function(t,n){var r=setTimeout(t,e);n.stop=function(){clearTimeout(r)}})},clearQueue:function(e){return this.queue(e||"fx",[])},promise:function(e,t){var n,r=1,i=x.Deferred(),o=this,s=this.length,a=function(){--r||i.resolveWith(o,[o])};"string"!=typeof e&&(t=e,e=undefined),e=e||"fx";while(s--)n=q.get(o[s],e+"queueHooks"),n&&n.empty&&(r++,n.empty.add(a));return a(),i.promise(t)}});var R,M,W=/[\t\r\n\f]/g,$=/\r/g,B=/^(?:input|select|textarea|button)$/i;x.fn.extend({attr:function(e,t){return x.access(this,x.attr,e,t,arguments.length>1)},removeAttr:function(e){return this.each(function(){x.removeAttr(this,e)})},prop:function(e,t){return x.access(this,x.prop,e,t,arguments.length>1)},removeProp:function(e){return this.each(function(){delete this[x.propFix[e]||e]})},addClass:function(e){var t,n,r,i,o,s=0,a=this.length,u="string"==typeof e&&e;if(x.isFunction(e))return this.each(function(t){x(this).addClass(e.call(this,t,this.className))});if(u)for(t=(e||"").match(w)||[];a>s;s++)if(n=this[s],r=1===n.nodeType&&(n.className?(" "+n.className+" ").replace(W," "):" ")){o=0;while(i=t[o++])0>r.indexOf(" "+i+" ")&&(r+=i+" ");n.className=x.trim(r)}return this},removeClass:function(e){var t,n,r,i,o,s=0,a=this.length,u=0===arguments.length||"string"==typeof e&&e;if(x.isFunction(e))return this.each(function(t){x(this).removeClass(e.call(this,t,this.className))});if(u)for(t=(e||"").match(w)||[];a>s;s++)if(n=this[s],r=1===n.nodeType&&(n.className?(" "+n.className+" ").replace(W," "):"")){o=0;while(i=t[o++])while(r.indexOf(" "+i+" ")>=0)r=r.replace(" "+i+" "," ");n.className=e?x.trim(r):""}return this},toggleClass:function(e,t){var n=typeof e;return"boolean"==typeof t&&"string"===n?t?this.addClass(e):this.removeClass(e):x.isFunction(e)?this.each(function(n){x(this).toggleClass(e.call(this,n,this.className,t),t)}):this.each(function(){if("string"===n){var t,i=0,o=x(this),s=e.match(w)||[];while(t=s[i++])o.hasClass(t)?o.removeClass(t):o.addClass(t)}else(n===r||"boolean"===n)&&(this.className&&q.set(this,"__className__",this.className),this.className=this.className||e===!1?"":q.get(this,"__className__")||"")})},hasClass:function(e){var t=" "+e+" ",n=0,r=this.length;for(;r>n;n++)if(1===this[n].nodeType&&(" "+this[n].className+" ").replace(W," ").indexOf(t)>=0)return!0;return!1},val:function(e){var t,n,r,i=this[0];{if(arguments.length)return r=x.isFunction(e),this.each(function(n){var i;1===this.nodeType&&(i=r?e.call(this,n,x(this).val()):e,null==i?i="":"number"==typeof i?i+="":x.isArray(i)&&(i=x.map(i,function(e){return null==e?"":e+""})),t=x.valHooks[this.type]||x.valHooks[this.nodeName.toLowerCase()],t&&"set"in t&&t.set(this,i,"value")!==undefined||(this.value=i))});if(i)return t=x.valHooks[i.type]||x.valHooks[i.nodeName.toLowerCase()],t&&"get"in t&&(n=t.get(i,"value"))!==undefined?n:(n=i.value,"string"==typeof n?n.replace($,""):null==n?"":n)}}}),x.extend({valHooks:{option:{get:function(e){var t=e.attributes.value;return!t||t.specified?e.value:e.text}},select:{get:function(e){var t,n,r=e.options,i=e.selectedIndex,o="select-one"===e.type||0>i,s=o?null:[],a=o?i+1:r.length,u=0>i?a:o?i:0;for(;a>u;u++)if(n=r[u],!(!n.selected&&u!==i||(x.support.optDisabled?n.disabled:null!==n.getAttribute("disabled"))||n.parentNode.disabled&&x.nodeName(n.parentNode,"optgroup"))){if(t=x(n).val(),o)return t;s.push(t)}return s},set:function(e,t){var n,r,i=e.options,o=x.makeArray(t),s=i.length;while(s--)r=i[s],(r.selected=x.inArray(x(r).val(),o)>=0)&&(n=!0);return n||(e.selectedIndex=-1),o}}},attr:function(e,t,n){var i,o,s=e.nodeType;if(e&&3!==s&&8!==s&&2!==s)return typeof e.getAttribute===r?x.prop(e,t,n):(1===s&&x.isXMLDoc(e)||(t=t.toLowerCase(),i=x.attrHooks[t]||(x.expr.match.bool.test(t)?M:R)),n===undefined?i&&"get"in i&&null!==(o=i.get(e,t))?o:(o=x.find.attr(e,t),null==o?undefined:o):null!==n?i&&"set"in i&&(o=i.set(e,n,t))!==undefined?o:(e.setAttribute(t,n+""),n):(x.removeAttr(e,t),undefined))},removeAttr:function(e,t){var n,r,i=0,o=t&&t.match(w);if(o&&1===e.nodeType)while(n=o[i++])r=x.propFix[n]||n,x.expr.match.bool.test(n)&&(e[r]=!1),e.removeAttribute(n)},attrHooks:{type:{set:function(e,t){if(!x.support.radioValue&&"radio"===t&&x.nodeName(e,"input")){var n=e.value;return e.setAttribute("type",t),n&&(e.value=n),t}}}},propFix:{"for":"htmlFor","class":"className"},prop:function(e,t,n){var r,i,o,s=e.nodeType;if(e&&3!==s&&8!==s&&2!==s)return o=1!==s||!x.isXMLDoc(e),o&&(t=x.propFix[t]||t,i=x.propHooks[t]),n!==undefined?i&&"set"in i&&(r=i.set(e,n,t))!==undefined?r:e[t]=n:i&&"get"in i&&null!==(r=i.get(e,t))?r:e[t]},propHooks:{tabIndex:{get:function(e){return e.hasAttribute("tabindex")||B.test(e.nodeName)||e.href?e.tabIndex:-1}}}}),M={set:function(e,t,n){return t===!1?x.removeAttr(e,n):e.setAttribute(n,n),n}},x.each(x.expr.match.bool.source.match(/\w+/g),function(e,t){var n=x.expr.attrHandle[t]||x.find.attr;x.expr.attrHandle[t]=function(e,t,r){var i=x.expr.attrHandle[t],o=r?undefined:(x.expr.attrHandle[t]=undefined)!=n(e,t,r)?t.toLowerCase():null;return x.expr.attrHandle[t]=i,o}}),x.support.optSelected||(x.propHooks.selected={get:function(e){var t=e.parentNode;return t&&t.parentNode&&t.parentNode.selectedIndex,null}}),x.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){x.propFix[this.toLowerCase()]=this}),x.each(["radio","checkbox"],function(){x.valHooks[this]={set:function(e,t){return x.isArray(t)?e.checked=x.inArray(x(e).val(),t)>=0:undefined}},x.support.checkOn||(x.valHooks[this].get=function(e){return null===e.getAttribute("value")?"on":e.value})});var I=/^key/,z=/^(?:mouse|contextmenu)|click/,_=/^(?:focusinfocus|focusoutblur)$/,X=/^([^.]*)(?:\.(.+)|)$/;function U(){return!0}function Y(){return!1}function V(){try{return o.activeElement}catch(e){}}x.event={global:{},add:function(e,t,n,i,o){var s,a,u,l,c,p,f,h,d,g,m,y=q.get(e);if(y){n.handler&&(s=n,n=s.handler,o=s.selector),n.guid||(n.guid=x.guid++),(l=y.events)||(l=y.events={}),(a=y.handle)||(a=y.handle=function(e){return typeof x===r||e&&x.event.triggered===e.type?undefined:x.event.dispatch.apply(a.elem,arguments)},a.elem=e),t=(t||"").match(w)||[""],c=t.length;while(c--)u=X.exec(t[c])||[],d=m=u[1],g=(u[2]||"").split(".").sort(),d&&(f=x.event.special[d]||{},d=(o?f.delegateType:f.bindType)||d,f=x.event.special[d]||{},p=x.extend({type:d,origType:m,data:i,handler:n,guid:n.guid,selector:o,needsContext:o&&x.expr.match.needsContext.test(o),namespace:g.join(".")},s),(h=l[d])||(h=l[d]=[],h.delegateCount=0,f.setup&&f.setup.call(e,i,g,a)!==!1||e.addEventListener&&e.addEventListener(d,a,!1)),f.add&&(f.add.call(e,p),p.handler.guid||(p.handler.guid=n.guid)),o?h.splice(h.delegateCount++,0,p):h.push(p),x.event.global[d]=!0);e=null}},remove:function(e,t,n,r,i){var o,s,a,u,l,c,p,f,h,d,g,m=q.hasData(e)&&q.get(e);if(m&&(u=m.events)){t=(t||"").match(w)||[""],l=t.length;while(l--)if(a=X.exec(t[l])||[],h=g=a[1],d=(a[2]||"").split(".").sort(),h){p=x.event.special[h]||{},h=(r?p.delegateType:p.bindType)||h,f=u[h]||[],a=a[2]&&RegExp("(^|\\.)"+d.join("\\.(?:.*\\.|)")+"(\\.|$)"),s=o=f.length;while(o--)c=f[o],!i&&g!==c.origType||n&&n.guid!==c.guid||a&&!a.test(c.namespace)||r&&r!==c.selector&&("**"!==r||!c.selector)||(f.splice(o,1),c.selector&&f.delegateCount--,p.remove&&p.remove.call(e,c));s&&!f.length&&(p.teardown&&p.teardown.call(e,d,m.handle)!==!1||x.removeEvent(e,h,m.handle),delete u[h])}else for(h in u)x.event.remove(e,h+t[l],n,r,!0);x.isEmptyObject(u)&&(delete m.handle,q.remove(e,"events"))}},trigger:function(t,n,r,i){var s,a,u,l,c,p,f,h=[r||o],d=y.call(t,"type")?t.type:t,g=y.call(t,"namespace")?t.namespace.split("."):[];if(a=u=r=r||o,3!==r.nodeType&&8!==r.nodeType&&!_.test(d+x.event.triggered)&&(d.indexOf(".")>=0&&(g=d.split("."),d=g.shift(),g.sort()),c=0>d.indexOf(":")&&"on"+d,t=t[x.expando]?t:new x.Event(d,"object"==typeof t&&t),t.isTrigger=i?2:3,t.namespace=g.join("."),t.namespace_re=t.namespace?RegExp("(^|\\.)"+g.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,t.result=undefined,t.target||(t.target=r),n=null==n?[t]:x.makeArray(n,[t]),f=x.event.special[d]||{},i||!f.trigger||f.trigger.apply(r,n)!==!1)){if(!i&&!f.noBubble&&!x.isWindow(r)){for(l=f.delegateType||d,_.test(l+d)||(a=a.parentNode);a;a=a.parentNode)h.push(a),u=a;u===(r.ownerDocument||o)&&h.push(u.defaultView||u.parentWindow||e)}s=0;while((a=h[s++])&&!t.isPropagationStopped())t.type=s>1?l:f.bindType||d,p=(q.get(a,"events")||{})[t.type]&&q.get(a,"handle"),p&&p.apply(a,n),p=c&&a[c],p&&x.acceptData(a)&&p.apply&&p.apply(a,n)===!1&&t.preventDefault();return t.type=d,i||t.isDefaultPrevented()||f._default&&f._default.apply(h.pop(),n)!==!1||!x.acceptData(r)||c&&x.isFunction(r[d])&&!x.isWindow(r)&&(u=r[c],u&&(r[c]=null),x.event.triggered=d,r[d](),x.event.triggered=undefined,u&&(r[c]=u)),t.result}},dispatch:function(e){e=x.event.fix(e);var t,n,r,i,o,s=[],a=d.call(arguments),u=(q.get(this,"events")||{})[e.type]||[],l=x.event.special[e.type]||{};if(a[0]=e,e.delegateTarget=this,!l.preDispatch||l.preDispatch.call(this,e)!==!1){s=x.event.handlers.call(this,e,u),t=0;while((i=s[t++])&&!e.isPropagationStopped()){e.currentTarget=i.elem,n=0;while((o=i.handlers[n++])&&!e.isImmediatePropagationStopped())(!e.namespace_re||e.namespace_re.test(o.namespace))&&(e.handleObj=o,e.data=o.data,r=((x.event.special[o.origType]||{}).handle||o.handler).apply(i.elem,a),r!==undefined&&(e.result=r)===!1&&(e.preventDefault(),e.stopPropagation()))}return l.postDispatch&&l.postDispatch.call(this,e),e.result}},handlers:function(e,t){var n,r,i,o,s=[],a=t.delegateCount,u=e.target;if(a&&u.nodeType&&(!e.button||"click"!==e.type))for(;u!==this;u=u.parentNode||this)if(u.disabled!==!0||"click"!==e.type){for(r=[],n=0;a>n;n++)o=t[n],i=o.selector+" ",r[i]===undefined&&(r[i]=o.needsContext?x(i,this).index(u)>=0:x.find(i,this,null,[u]).length),r[i]&&r.push(o);r.length&&s.push({elem:u,handlers:r})}return t.length>a&&s.push({elem:this,handlers:t.slice(a)}),s},props:"altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),fixHooks:{},keyHooks:{props:"char charCode key keyCode".split(" "),filter:function(e,t){return null==e.which&&(e.which=null!=t.charCode?t.charCode:t.keyCode),e}},mouseHooks:{props:"button buttons clientX clientY offsetX offsetY pageX pageY screenX screenY toElement".split(" "),filter:function(e,t){var n,r,i,s=t.button;return null==e.pageX&&null!=t.clientX&&(n=e.target.ownerDocument||o,r=n.documentElement,i=n.body,e.pageX=t.clientX+(r&&r.scrollLeft||i&&i.scrollLeft||0)-(r&&r.clientLeft||i&&i.clientLeft||0),e.pageY=t.clientY+(r&&r.scrollTop||i&&i.scrollTop||0)-(r&&r.clientTop||i&&i.clientTop||0)),e.which||s===undefined||(e.which=1&s?1:2&s?3:4&s?2:0),e}},fix:function(e){if(e[x.expando])return e;var t,n,r,i=e.type,s=e,a=this.fixHooks[i];a||(this.fixHooks[i]=a=z.test(i)?this.mouseHooks:I.test(i)?this.keyHooks:{}),r=a.props?this.props.concat(a.props):this.props,e=new x.Event(s),t=r.length;while(t--)n=r[t],e[n]=s[n];return e.target||(e.target=o),3===e.target.nodeType&&(e.target=e.target.parentNode),a.filter?a.filter(e,s):e},special:{load:{noBubble:!0},focus:{trigger:function(){return this!==V()&&this.focus?(this.focus(),!1):undefined},delegateType:"focusin"},blur:{trigger:function(){return this===V()&&this.blur?(this.blur(),!1):undefined},delegateType:"focusout"},click:{trigger:function(){return"checkbox"===this.type&&this.click&&x.nodeName(this,"input")?(this.click(),!1):undefined},_default:function(e){return x.nodeName(e.target,"a")}},beforeunload:{postDispatch:function(e){e.result!==undefined&&(e.originalEvent.returnValue=e.result)}}},simulate:function(e,t,n,r){var i=x.extend(new x.Event,n,{type:e,isSimulated:!0,originalEvent:{}});r?x.event.trigger(i,null,t):x.event.dispatch.call(t,i),i.isDefaultPrevented()&&n.preventDefault()}},x.removeEvent=function(e,t,n){e.removeEventListener&&e.removeEventListener(t,n,!1)},x.Event=function(e,t){return this instanceof x.Event?(e&&e.type?(this.originalEvent=e,this.type=e.type,this.isDefaultPrevented=e.defaultPrevented||e.getPreventDefault&&e.getPreventDefault()?U:Y):this.type=e,t&&x.extend(this,t),this.timeStamp=e&&e.timeStamp||x.now(),this[x.expando]=!0,undefined):new x.Event(e,t)},x.Event.prototype={isDefaultPrevented:Y,isPropagationStopped:Y,isImmediatePropagationStopped:Y,preventDefault:function(){var e=this.originalEvent;this.isDefaultPrevented=U,e&&e.preventDefault&&e.preventDefault()},stopPropagation:function(){var e=this.originalEvent;this.isPropagationStopped=U,e&&e.stopPropagation&&e.stopPropagation()},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=U,this.stopPropagation()}},x.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(e,t){x.event.special[e]={delegateType:t,bindType:t,handle:function(e){var n,r=this,i=e.relatedTarget,o=e.handleObj;return(!i||i!==r&&!x.contains(r,i))&&(e.type=o.origType,n=o.handler.apply(this,arguments),e.type=t),n}}}),x.support.focusinBubbles||x.each({focus:"focusin",blur:"focusout"},function(e,t){var n=0,r=function(e){x.event.simulate(t,e.target,x.event.fix(e),!0)};x.event.special[t]={setup:function(){0===n++&&o.addEventListener(e,r,!0)},teardown:function(){0===--n&&o.removeEventListener(e,r,!0)}}}),x.fn.extend({on:function(e,t,n,r,i){var o,s;if("object"==typeof e){"string"!=typeof t&&(n=n||t,t=undefined);for(s in e)this.on(s,t,n,e[s],i);return this}if(null==n&&null==r?(r=t,n=t=undefined):null==r&&("string"==typeof t?(r=n,n=undefined):(r=n,n=t,t=undefined)),r===!1)r=Y;else if(!r)return this;return 1===i&&(o=r,r=function(e){return x().off(e),o.apply(this,arguments)},r.guid=o.guid||(o.guid=x.guid++)),this.each(function(){x.event.add(this,e,r,n,t)})},one:function(e,t,n,r){return this.on(e,t,n,r,1)},off:function(e,t,n){var r,i;if(e&&e.preventDefault&&e.handleObj)return r=e.handleObj,x(e.delegateTarget).off(r.namespace?r.origType+"."+r.namespace:r.origType,r.selector,r.handler),this;if("object"==typeof e){for(i in e)this.off(i,t,e[i]);return this}return(t===!1||"function"==typeof t)&&(n=t,t=undefined),n===!1&&(n=Y),this.each(function(){x.event.remove(this,e,n,t)})},trigger:function(e,t){return this.each(function(){x.event.trigger(e,t,this)})},triggerHandler:function(e,t){var n=this[0];return n?x.event.trigger(e,t,n,!0):undefined}});var G=/^.[^:#\[\.,]*$/,J=/^(?:parents|prev(?:Until|All))/,Q=x.expr.match.needsContext,K={children:!0,contents:!0,next:!0,prev:!0};x.fn.extend({find:function(e){var t,n=[],r=this,i=r.length;if("string"!=typeof e)return this.pushStack(x(e).filter(function(){for(t=0;i>t;t++)if(x.contains(r[t],this))return!0}));for(t=0;i>t;t++)x.find(e,r[t],n);return n=this.pushStack(i>1?x.unique(n):n),n.selector=this.selector?this.selector+" "+e:e,n},has:function(e){var t=x(e,this),n=t.length;return this.filter(function(){var e=0;for(;n>e;e++)if(x.contains(this,t[e]))return!0})},not:function(e){return this.pushStack(et(this,e||[],!0))},filter:function(e){return this.pushStack(et(this,e||[],!1))},is:function(e){return!!et(this,"string"==typeof e&&Q.test(e)?x(e):e||[],!1).length},closest:function(e,t){var n,r=0,i=this.length,o=[],s=Q.test(e)||"string"!=typeof e?x(e,t||this.context):0;for(;i>r;r++)for(n=this[r];n&&n!==t;n=n.parentNode)if(11>n.nodeType&&(s?s.index(n)>-1:1===n.nodeType&&x.find.matchesSelector(n,e))){n=o.push(n);break}return this.pushStack(o.length>1?x.unique(o):o)},index:function(e){return e?"string"==typeof e?g.call(x(e),this[0]):g.call(this,e.jquery?e[0]:e):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(e,t){var n="string"==typeof e?x(e,t):x.makeArray(e&&e.nodeType?[e]:e),r=x.merge(this.get(),n);return this.pushStack(x.unique(r))},addBack:function(e){return this.add(null==e?this.prevObject:this.prevObject.filter(e))}});function Z(e,t){while((e=e[t])&&1!==e.nodeType);return e}x.each({parent:function(e){var t=e.parentNode;return t&&11!==t.nodeType?t:null},parents:function(e){return x.dir(e,"parentNode")},parentsUntil:function(e,t,n){return x.dir(e,"parentNode",n)},next:function(e){return Z(e,"nextSibling")},prev:function(e){return Z(e,"previousSibling")},nextAll:function(e){return x.dir(e,"nextSibling")},prevAll:function(e){return x.dir(e,"previousSibling")},nextUntil:function(e,t,n){return x.dir(e,"nextSibling",n)},prevUntil:function(e,t,n){return x.dir(e,"previousSibling",n)},siblings:function(e){return x.sibling((e.parentNode||{}).firstChild,e)},children:function(e){return x.sibling(e.firstChild)},contents:function(e){return e.contentDocument||x.merge([],e.childNodes)}},function(e,t){x.fn[e]=function(n,r){var i=x.map(this,t,n);return"Until"!==e.slice(-5)&&(r=n),r&&"string"==typeof r&&(i=x.filter(r,i)),this.length>1&&(K[e]||x.unique(i),J.test(e)&&i.reverse()),this.pushStack(i)}}),x.extend({filter:function(e,t,n){var r=t[0];return n&&(e=":not("+e+")"),1===t.length&&1===r.nodeType?x.find.matchesSelector(r,e)?[r]:[]:x.find.matches(e,x.grep(t,function(e){return 1===e.nodeType}))},dir:function(e,t,n){var r=[],i=n!==undefined;while((e=e[t])&&9!==e.nodeType)if(1===e.nodeType){if(i&&x(e).is(n))break;r.push(e)}return r},sibling:function(e,t){var n=[];for(;e;e=e.nextSibling)1===e.nodeType&&e!==t&&n.push(e);return n}});function et(e,t,n){if(x.isFunction(t))return x.grep(e,function(e,r){return!!t.call(e,r,e)!==n});if(t.nodeType)return x.grep(e,function(e){return e===t!==n});if("string"==typeof t){if(G.test(t))return x.filter(t,e,n);t=x.filter(t,e)}return x.grep(e,function(e){return g.call(t,e)>=0!==n})}var tt=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,nt=/<([\w:]+)/,rt=/<|&#?\w+;/,it=/<(?:script|style|link)/i,ot=/^(?:checkbox|radio)$/i,st=/checked\s*(?:[^=]|=\s*.checked.)/i,at=/^$|\/(?:java|ecma)script/i,ut=/^true\/(.*)/,lt=/^\s*\s*$/g,ct={option:[1,""],thead:[1,"","
    "],col:[2,"","
    "],tr:[2,"","
    "],td:[3,"","
    "],_default:[0,"",""]};ct.optgroup=ct.option,ct.tbody=ct.tfoot=ct.colgroup=ct.caption=ct.thead,ct.th=ct.td,x.fn.extend({text:function(e){return x.access(this,function(e){return e===undefined?x.text(this):this.empty().append((this[0]&&this[0].ownerDocument||o).createTextNode(e))},null,e,arguments.length)},append:function(){return this.domManip(arguments,function(e){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var t=pt(this,e);t.appendChild(e)}})},prepend:function(){return this.domManip(arguments,function(e){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var t=pt(this,e);t.insertBefore(e,t.firstChild)}})},before:function(){return this.domManip(arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this)})},after:function(){return this.domManip(arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this.nextSibling)})},remove:function(e,t){var n,r=e?x.filter(e,this):this,i=0;for(;null!=(n=r[i]);i++)t||1!==n.nodeType||x.cleanData(mt(n)),n.parentNode&&(t&&x.contains(n.ownerDocument,n)&&dt(mt(n,"script")),n.parentNode.removeChild(n));return this},empty:function(){var e,t=0;for(;null!=(e=this[t]);t++)1===e.nodeType&&(x.cleanData(mt(e,!1)),e.textContent="");return this},clone:function(e,t){return e=null==e?!1:e,t=null==t?e:t,this.map(function(){return x.clone(this,e,t)})},html:function(e){return x.access(this,function(e){var t=this[0]||{},n=0,r=this.length;if(e===undefined&&1===t.nodeType)return t.innerHTML;if("string"==typeof e&&!it.test(e)&&!ct[(nt.exec(e)||["",""])[1].toLowerCase()]){e=e.replace(tt,"<$1>");try{for(;r>n;n++)t=this[n]||{},1===t.nodeType&&(x.cleanData(mt(t,!1)),t.innerHTML=e);t=0}catch(i){}}t&&this.empty().append(e)},null,e,arguments.length)},replaceWith:function(){var e=x.map(this,function(e){return[e.nextSibling,e.parentNode]}),t=0;return this.domManip(arguments,function(n){var r=e[t++],i=e[t++];i&&(r&&r.parentNode!==i&&(r=this.nextSibling),x(this).remove(),i.insertBefore(n,r))},!0),t?this:this.remove()},detach:function(e){return this.remove(e,!0)},domManip:function(e,t,n){e=f.apply([],e);var r,i,o,s,a,u,l=0,c=this.length,p=this,h=c-1,d=e[0],g=x.isFunction(d);if(g||!(1>=c||"string"!=typeof d||x.support.checkClone)&&st.test(d))return this.each(function(r){var i=p.eq(r);g&&(e[0]=d.call(this,r,i.html())),i.domManip(e,t,n)});if(c&&(r=x.buildFragment(e,this[0].ownerDocument,!1,!n&&this),i=r.firstChild,1===r.childNodes.length&&(r=i),i)){for(o=x.map(mt(r,"script"),ft),s=o.length;c>l;l++)a=r,l!==h&&(a=x.clone(a,!0,!0),s&&x.merge(o,mt(a,"script"))),t.call(this[l],a,l);if(s)for(u=o[o.length-1].ownerDocument,x.map(o,ht),l=0;s>l;l++)a=o[l],at.test(a.type||"")&&!q.access(a,"globalEval")&&x.contains(u,a)&&(a.src?x._evalUrl(a.src):x.globalEval(a.textContent.replace(lt,"")))}return this}}),x.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(e,t){x.fn[e]=function(e){var n,r=[],i=x(e),o=i.length-1,s=0;for(;o>=s;s++)n=s===o?this:this.clone(!0),x(i[s])[t](n),h.apply(r,n.get());return this.pushStack(r)}}),x.extend({clone:function(e,t,n){var r,i,o,s,a=e.cloneNode(!0),u=x.contains(e.ownerDocument,e);if(!(x.support.noCloneChecked||1!==e.nodeType&&11!==e.nodeType||x.isXMLDoc(e)))for(s=mt(a),o=mt(e),r=0,i=o.length;i>r;r++)yt(o[r],s[r]);if(t)if(n)for(o=o||mt(e),s=s||mt(a),r=0,i=o.length;i>r;r++)gt(o[r],s[r]);else gt(e,a);return s=mt(a,"script"),s.length>0&&dt(s,!u&&mt(e,"script")),a},buildFragment:function(e,t,n,r){var i,o,s,a,u,l,c=0,p=e.length,f=t.createDocumentFragment(),h=[];for(;p>c;c++)if(i=e[c],i||0===i)if("object"===x.type(i))x.merge(h,i.nodeType?[i]:i);else if(rt.test(i)){o=o||f.appendChild(t.createElement("div")),s=(nt.exec(i)||["",""])[1].toLowerCase(),a=ct[s]||ct._default,o.innerHTML=a[1]+i.replace(tt,"<$1>")+a[2],l=a[0];while(l--)o=o.lastChild;x.merge(h,o.childNodes),o=f.firstChild,o.textContent=""}else h.push(t.createTextNode(i));f.textContent="",c=0;while(i=h[c++])if((!r||-1===x.inArray(i,r))&&(u=x.contains(i.ownerDocument,i),o=mt(f.appendChild(i),"script"),u&&dt(o),n)){l=0;while(i=o[l++])at.test(i.type||"")&&n.push(i)}return f},cleanData:function(e){var t,n,r,i,o,s,a=x.event.special,u=0;for(;(n=e[u])!==undefined;u++){if(F.accepts(n)&&(o=n[q.expando],o&&(t=q.cache[o]))){if(r=Object.keys(t.events||{}),r.length)for(s=0;(i=r[s])!==undefined;s++)a[i]?x.event.remove(n,i):x.removeEvent(n,i,t.handle);q.cache[o]&&delete q.cache[o]}delete L.cache[n[L.expando]]}},_evalUrl:function(e){return x.ajax({url:e,type:"GET",dataType:"script",async:!1,global:!1,"throws":!0})}});function pt(e,t){return x.nodeName(e,"table")&&x.nodeName(1===t.nodeType?t:t.firstChild,"tr")?e.getElementsByTagName("tbody")[0]||e.appendChild(e.ownerDocument.createElement("tbody")):e}function ft(e){return e.type=(null!==e.getAttribute("type"))+"/"+e.type,e}function ht(e){var t=ut.exec(e.type);return t?e.type=t[1]:e.removeAttribute("type"),e}function dt(e,t){var n=e.length,r=0;for(;n>r;r++)q.set(e[r],"globalEval",!t||q.get(t[r],"globalEval"))}function gt(e,t){var n,r,i,o,s,a,u,l;if(1===t.nodeType){if(q.hasData(e)&&(o=q.access(e),s=q.set(t,o),l=o.events)){delete s.handle,s.events={};for(i in l)for(n=0,r=l[i].length;r>n;n++)x.event.add(t,i,l[i][n])}L.hasData(e)&&(a=L.access(e),u=x.extend({},a),L.set(t,u))}}function mt(e,t){var n=e.getElementsByTagName?e.getElementsByTagName(t||"*"):e.querySelectorAll?e.querySelectorAll(t||"*"):[];return t===undefined||t&&x.nodeName(e,t)?x.merge([e],n):n}function yt(e,t){var n=t.nodeName.toLowerCase();"input"===n&&ot.test(e.type)?t.checked=e.checked:("input"===n||"textarea"===n)&&(t.defaultValue=e.defaultValue)}x.fn.extend({wrapAll:function(e){var t;return x.isFunction(e)?this.each(function(t){x(this).wrapAll(e.call(this,t))}):(this[0]&&(t=x(e,this[0].ownerDocument).eq(0).clone(!0),this[0].parentNode&&t.insertBefore(this[0]),t.map(function(){var e=this;while(e.firstElementChild)e=e.firstElementChild;return e}).append(this)),this)},wrapInner:function(e){return x.isFunction(e)?this.each(function(t){x(this).wrapInner(e.call(this,t))}):this.each(function(){var t=x(this),n=t.contents();n.length?n.wrapAll(e):t.append(e)})},wrap:function(e){var t=x.isFunction(e);return this.each(function(n){x(this).wrapAll(t?e.call(this,n):e)})},unwrap:function(){return this.parent().each(function(){x.nodeName(this,"body")||x(this).replaceWith(this.childNodes)}).end()}});var vt,xt,bt=/^(none|table(?!-c[ea]).+)/,wt=/^margin/,Tt=RegExp("^("+b+")(.*)$","i"),Ct=RegExp("^("+b+")(?!px)[a-z%]+$","i"),kt=RegExp("^([+-])=("+b+")","i"),Nt={BODY:"block"},Et={position:"absolute",visibility:"hidden",display:"block"},St={letterSpacing:0,fontWeight:400},jt=["Top","Right","Bottom","Left"],Dt=["Webkit","O","Moz","ms"];function At(e,t){if(t in e)return t;var n=t.charAt(0).toUpperCase()+t.slice(1),r=t,i=Dt.length;while(i--)if(t=Dt[i]+n,t in e)return t;return r}function Lt(e,t){return e=t||e,"none"===x.css(e,"display")||!x.contains(e.ownerDocument,e)}function qt(t){return e.getComputedStyle(t,null)}function Ht(e,t){var n,r,i,o=[],s=0,a=e.length;for(;a>s;s++)r=e[s],r.style&&(o[s]=q.get(r,"olddisplay"),n=r.style.display,t?(o[s]||"none"!==n||(r.style.display=""),""===r.style.display&&Lt(r)&&(o[s]=q.access(r,"olddisplay",Rt(r.nodeName)))):o[s]||(i=Lt(r),(n&&"none"!==n||!i)&&q.set(r,"olddisplay",i?n:x.css(r,"display"))));for(s=0;a>s;s++)r=e[s],r.style&&(t&&"none"!==r.style.display&&""!==r.style.display||(r.style.display=t?o[s]||"":"none"));return e}x.fn.extend({css:function(e,t){return x.access(this,function(e,t,n){var r,i,o={},s=0;if(x.isArray(t)){for(r=qt(e),i=t.length;i>s;s++)o[t[s]]=x.css(e,t[s],!1,r);return o}return n!==undefined?x.style(e,t,n):x.css(e,t)},e,t,arguments.length>1)},show:function(){return Ht(this,!0)},hide:function(){return Ht(this)},toggle:function(e){return"boolean"==typeof e?e?this.show():this.hide():this.each(function(){Lt(this)?x(this).show():x(this).hide()})}}),x.extend({cssHooks:{opacity:{get:function(e,t){if(t){var n=vt(e,"opacity");return""===n?"1":n}}}},cssNumber:{columnCount:!0,fillOpacity:!0,fontWeight:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":"cssFloat"},style:function(e,t,n,r){if(e&&3!==e.nodeType&&8!==e.nodeType&&e.style){var i,o,s,a=x.camelCase(t),u=e.style;return t=x.cssProps[a]||(x.cssProps[a]=At(u,a)),s=x.cssHooks[t]||x.cssHooks[a],n===undefined?s&&"get"in s&&(i=s.get(e,!1,r))!==undefined?i:u[t]:(o=typeof n,"string"===o&&(i=kt.exec(n))&&(n=(i[1]+1)*i[2]+parseFloat(x.css(e,t)),o="number"),null==n||"number"===o&&isNaN(n)||("number"!==o||x.cssNumber[a]||(n+="px"),x.support.clearCloneStyle||""!==n||0!==t.indexOf("background")||(u[t]="inherit"),s&&"set"in s&&(n=s.set(e,n,r))===undefined||(u[t]=n)),undefined)}},css:function(e,t,n,r){var i,o,s,a=x.camelCase(t);return t=x.cssProps[a]||(x.cssProps[a]=At(e.style,a)),s=x.cssHooks[t]||x.cssHooks[a],s&&"get"in s&&(i=s.get(e,!0,n)),i===undefined&&(i=vt(e,t,r)),"normal"===i&&t in St&&(i=St[t]),""===n||n?(o=parseFloat(i),n===!0||x.isNumeric(o)?o||0:i):i}}),vt=function(e,t,n){var r,i,o,s=n||qt(e),a=s?s.getPropertyValue(t)||s[t]:undefined,u=e.style;return s&&(""!==a||x.contains(e.ownerDocument,e)||(a=x.style(e,t)),Ct.test(a)&&wt.test(t)&&(r=u.width,i=u.minWidth,o=u.maxWidth,u.minWidth=u.maxWidth=u.width=a,a=s.width,u.width=r,u.minWidth=i,u.maxWidth=o)),a};function Ot(e,t,n){var r=Tt.exec(t);return r?Math.max(0,r[1]-(n||0))+(r[2]||"px"):t}function Ft(e,t,n,r,i){var o=n===(r?"border":"content")?4:"width"===t?1:0,s=0;for(;4>o;o+=2)"margin"===n&&(s+=x.css(e,n+jt[o],!0,i)),r?("content"===n&&(s-=x.css(e,"padding"+jt[o],!0,i)),"margin"!==n&&(s-=x.css(e,"border"+jt[o]+"Width",!0,i))):(s+=x.css(e,"padding"+jt[o],!0,i),"padding"!==n&&(s+=x.css(e,"border"+jt[o]+"Width",!0,i)));return s}function Pt(e,t,n){var r=!0,i="width"===t?e.offsetWidth:e.offsetHeight,o=qt(e),s=x.support.boxSizing&&"border-box"===x.css(e,"boxSizing",!1,o);if(0>=i||null==i){if(i=vt(e,t,o),(0>i||null==i)&&(i=e.style[t]),Ct.test(i))return i;r=s&&(x.support.boxSizingReliable||i===e.style[t]),i=parseFloat(i)||0}return i+Ft(e,t,n||(s?"border":"content"),r,o)+"px"}function Rt(e){var t=o,n=Nt[e];return n||(n=Mt(e,t),"none"!==n&&n||(xt=(xt||x("