summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGELOG189
-rw-r--r--README.md102
-rwxr-xr-xactualize_script.php29
-rw-r--r--app/.htaccess3
-rw-r--r--app/App_FrontController.php93
-rwxr-xr-xapp/Controllers/configureController.php356
-rwxr-xr-xapp/Controllers/entryController.php158
-rw-r--r--app/Controllers/errorController.php (renamed from app/controllers/errorController.php)8
-rwxr-xr-xapp/Controllers/feedController.php425
-rwxr-xr-xapp/Controllers/indexController.php357
-rwxr-xr-xapp/Controllers/javascriptController.php46
-rw-r--r--app/Controllers/usersController.php178
-rw-r--r--app/Exceptions/BadUrlException.php6
-rw-r--r--app/Exceptions/EntriesGetterException.php7
-rw-r--r--app/Exceptions/FeedException.php (renamed from app/models/Exception/EntriesGetterException.php)3
-rw-r--r--app/Exceptions/OpmlException.php6
-rw-r--r--app/FreshRSS.php150
-rw-r--r--app/Models/Category.php85
-rw-r--r--app/Models/CategoryDAO.php251
-rw-r--r--app/Models/Configuration.php247
-rw-r--r--app/Models/Days.php (renamed from app/models/Days.php)2
-rw-r--r--app/Models/Entry.php186
-rw-r--r--app/Models/EntryDAO.php472
-rw-r--r--app/Models/Feed.php274
-rw-r--r--app/Models/FeedDAO.php345
-rw-r--r--app/Models/Log.php26
-rw-r--r--app/Models/LogDAO.php25
-rw-r--r--app/Models/StatsDAO.php205
-rw-r--r--app/Models/Themes.php106
-rw-r--r--app/Models/UserDAO.php36
-rwxr-xr-xapp/actualize_script.php59
-rw-r--r--app/configuration/.gitignore1
-rwxr-xr-xapp/controllers/configureController.php375
-rwxr-xr-xapp/controllers/entryController.php117
-rwxr-xr-xapp/controllers/feedController.php363
-rwxr-xr-xapp/controllers/indexController.php257
-rwxr-xr-xapp/controllers/javascriptController.php13
-rw-r--r--app/i18n/en.php185
-rw-r--r--app/i18n/fr.php179
-rw-r--r--app/i18n/install.en.php67
-rw-r--r--app/i18n/install.fr.php66
-rw-r--r--app/index.html13
-rw-r--r--app/layout/aside_configure.phtml25
-rw-r--r--app/layout/aside_feed.phtml34
-rw-r--r--app/layout/aside_flux.phtml107
-rw-r--r--app/layout/header.phtml106
-rw-r--r--app/layout/layout.phtml27
-rw-r--r--app/layout/nav_entries.phtml6
-rw-r--r--app/layout/nav_menu.phtml178
-rwxr-xr-xapp/models/Category.php332
-rw-r--r--app/models/EntriesGetter.php156
-rwxr-xr-xapp/models/Entry.php590
-rw-r--r--app/models/Exception/FeedException.php19
-rw-r--r--app/models/Feed.php564
-rw-r--r--app/models/Log_Model.php47
-rwxr-xr-xapp/models/RSSConfiguration.php445
-rw-r--r--app/models/RSSPaginator.php33
-rw-r--r--app/models/RSSThemes.php47
-rw-r--r--app/sql.php59
-rw-r--r--app/views/configure/archiving.phtml58
-rw-r--r--app/views/configure/categorize.phtml22
-rw-r--r--app/views/configure/display.phtml198
-rw-r--r--app/views/configure/feed.phtml124
-rw-r--r--app/views/configure/importExport.phtml25
-rw-r--r--app/views/configure/sharing.phtml64
-rw-r--r--app/views/configure/shortcut.phtml49
-rw-r--r--app/views/configure/users.phtml162
-rwxr-xr-xapp/views/entry/bookmark.phtml17
-rwxr-xr-xapp/views/entry/read.phtml17
-rw-r--r--app/views/error/index.phtml4
-rw-r--r--app/views/feed/actualize.phtml2
-rw-r--r--app/views/helpers/javascript_vars.phtml81
-rwxr-xr-xapp/views/helpers/logs_pagination.phtml16
-rwxr-xr-xapp/views/helpers/pagination.phtml28
-rw-r--r--app/views/helpers/view/global_view.phtml25
-rw-r--r--app/views/helpers/view/normal_view.phtml272
-rw-r--r--app/views/helpers/view/reader_view.phtml21
-rwxr-xr-xapp/views/helpers/view/rss_view.phtml11
-rw-r--r--app/views/index/about.phtml29
-rw-r--r--app/views/index/formLogin.phtml34
-rw-r--r--app/views/index/index.phtml39
-rw-r--r--app/views/index/logs.phtml16
-rw-r--r--app/views/index/stats.phtml125
-rw-r--r--app/views/javascript/actualize.phtml34
-rw-r--r--app/views/javascript/nbUnreadsPerFeed.phtml8
-rw-r--r--app/views/javascript/nonce.phtml2
-rw-r--r--cache/.gitignore1
-rw-r--r--constants.php17
-rw-r--r--data/.gitignore8
-rw-r--r--data/.htaccess3
-rw-r--r--data/cache/.gitignore1
-rw-r--r--data/cache/index.html13
-rw-r--r--data/favicons/.gitignore2
-rw-r--r--data/favicons/index.html13
-rw-r--r--data/index.html13
-rw-r--r--data/log/.gitignore1
-rw-r--r--data/log/index.html13
-rw-r--r--data/persona/.gitignore1
-rw-r--r--data/persona/index.html13
-rw-r--r--index.html13
-rw-r--r--index.php3
-rw-r--r--lib/.htaccess3
-rw-r--r--lib/JSON.php933
-rw-r--r--[-rwxr-xr-x]lib/Minz/ActionController.php (renamed from lib/minz/ActionController.php)4
-rw-r--r--lib/Minz/ActionException.php9
-rw-r--r--lib/Minz/BadConfigurationException.php9
-rw-r--r--lib/Minz/Cache.php (renamed from lib/minz/Minz_Cache.php)6
-rw-r--r--lib/Minz/Configuration.php340
-rw-r--r--lib/Minz/ControllerNotActionControllerException.php9
-rw-r--r--lib/Minz/ControllerNotExistException.php9
-rw-r--r--lib/Minz/CurrentPagePaginationException.php8
-rw-r--r--lib/Minz/Dispatcher.php (renamed from lib/minz/Dispatcher.php)79
-rw-r--r--[-rwxr-xr-x]lib/Minz/Error.php (renamed from lib/minz/Error.php)40
-rw-r--r--lib/Minz/Exception.php16
-rw-r--r--lib/Minz/FileNotExistException.php8
-rw-r--r--[-rwxr-xr-x]lib/Minz/FrontController.php (renamed from lib/minz/FrontController.php)97
-rw-r--r--[-rwxr-xr-x]lib/Minz/Helper.php (renamed from lib/minz/Helper.php)2
-rw-r--r--lib/Minz/Log.php (renamed from lib/minz/Minz_Log.php)62
-rw-r--r--[-rwxr-xr-x]lib/Minz/Model.php (renamed from lib/minz/Model.php)2
-rw-r--r--lib/Minz/ModelArray.php81
-rw-r--r--[-rwxr-xr-x]lib/Minz/ModelPdo.php (renamed from lib/minz/dao/Model_pdo.php)49
-rw-r--r--lib/Minz/PDOConnectionException.php9
-rw-r--r--[-rwxr-xr-x]lib/Minz/Paginator.php (renamed from lib/minz/Paginator.php)2
-rw-r--r--lib/Minz/PermissionDeniedException.php8
-rw-r--r--lib/Minz/Request.php (renamed from lib/minz/Request.php)30
-rw-r--r--lib/Minz/Response.php (renamed from lib/minz/Response.php)2
-rw-r--r--lib/Minz/RouteNotFoundException.php16
-rw-r--r--[-rwxr-xr-x]lib/Minz/Router.php (renamed from lib/minz/Router.php)34
-rw-r--r--[-rwxr-xr-x]lib/Minz/Session.php (renamed from lib/minz/Session.php)49
-rw-r--r--lib/Minz/Translate.php (renamed from lib/minz/Translate.php)6
-rw-r--r--[-rwxr-xr-x]lib/Minz/Url.php (renamed from lib/minz/Url.php)33
-rw-r--r--[-rwxr-xr-x]lib/Minz/View.php (renamed from lib/minz/View.php)44
-rw-r--r--lib/SimplePie/SimplePie.php30
-rw-r--r--lib/SimplePie/SimplePie/File.php1
-rw-r--r--lib/SimplePie/SimplePie/Misc.php4
-rw-r--r--lib/SimplePie/SimplePie/Parser.php31
-rw-r--r--lib/SimplePie/SimplePie/Sanitize.php53
-rw-r--r--lib/SimplePie_autoloader.php86
-rw-r--r--lib/http-conditional.php4
-rw-r--r--lib/lib_opml.php121
-rw-r--r--lib/lib_rss.php350
-rwxr-xr-xlib/minz/Configuration.php250
-rwxr-xr-xlib/minz/dao/Model_array.php122
-rwxr-xr-xlib/minz/dao/Model_txt.php84
-rw-r--r--lib/minz/exceptions/MinzException.php94
-rw-r--r--lib/password_compat.php279
-rw-r--r--log/.gitignore1
-rw-r--r--p/.htaccess (renamed from public/.htaccess)16
-rw-r--r--p/Web.config36
-rw-r--r--p/f.php64
-rw-r--r--p/favicon.icobin0 -> 18102 bytes
-rwxr-xr-xp/i/index.php52
-rw-r--r--p/i/install.php1081
-rw-r--r--p/index.html35
-rw-r--r--p/robots.txt (renamed from public/robots.txt)0
-rw-r--r--p/scripts/bcrypt.min.js41
-rw-r--r--p/scripts/flotr2.min.js27
-rw-r--r--p/scripts/global_view.js (renamed from public/scripts/global_view.js)20
-rw-r--r--p/scripts/jquery.lazyload.min.js (renamed from public/scripts/jquery.lazyload.min.js)0
-rw-r--r--p/scripts/jquery.min.js4
-rw-r--r--p/scripts/main.js (renamed from public/scripts/main.js)430
-rw-r--r--p/scripts/shortcut.js (renamed from public/scripts/shortcut.js)0
-rw-r--r--p/themes/Dark/freshrss.css917
-rw-r--r--p/themes/Dark/global.css524
-rw-r--r--p/themes/Dark/loader.gifbin0 -> 404 bytes
-rw-r--r--p/themes/Dark/metadata.json7
-rw-r--r--p/themes/Flat/freshrss.css (renamed from public/themes/flat-design/freshrss.css)316
-rw-r--r--p/themes/Flat/global.css (renamed from public/themes/flat-design/global.css)147
-rw-r--r--p/themes/Flat/icons/add.svg (renamed from public/themes/flat-design/icons/add.svg)0
-rw-r--r--p/themes/Flat/icons/all.svg (renamed from public/themes/flat-design/icons/all.svg)0
-rw-r--r--p/themes/Flat/icons/category.svg (renamed from public/themes/icons/category-white.svg)0
-rw-r--r--p/themes/Flat/icons/close.svg (renamed from public/themes/flat-design/icons/close.svg)0
-rw-r--r--p/themes/Flat/icons/configure.svg (renamed from public/themes/flat-design/icons/configure.svg)0
-rw-r--r--p/themes/Flat/icons/down.svg (renamed from public/themes/flat-design/icons/down.svg)0
-rw-r--r--p/themes/Flat/icons/next.svg (renamed from public/themes/flat-design/icons/next.svg)0
-rw-r--r--p/themes/Flat/icons/prev.svg (renamed from public/themes/flat-design/icons/previous.svg)0
-rw-r--r--p/themes/Flat/icons/refresh.svg (renamed from public/themes/flat-design/icons/refresh.svg)0
-rw-r--r--p/themes/Flat/icons/search.svg (renamed from public/themes/flat-design/icons/search.svg)0
-rw-r--r--p/themes/Flat/icons/up.svg (renamed from public/themes/flat-design/icons/up.svg)0
-rw-r--r--p/themes/Flat/loader.gif (renamed from public/themes/flat-design/loader.gif)bin4251 -> 4251 bytes
-rw-r--r--p/themes/Flat/metadata.json (renamed from public/themes/flat-design/metadata.json)0
-rw-r--r--p/themes/Origine/freshrss.css (renamed from public/themes/default/freshrss.css)313
-rw-r--r--p/themes/Origine/global.css (renamed from public/themes/default/global.css)162
-rw-r--r--p/themes/Origine/loader.gif (renamed from public/themes/default/loader.gif)bin4167 -> 4167 bytes
-rw-r--r--p/themes/Origine/metadata.json (renamed from public/themes/default/metadata.json)2
-rw-r--r--p/themes/fonts/openSans.woff (renamed from public/themes/fonts/openSans.woff)bin21956 -> 21956 bytes
-rw-r--r--p/themes/icons/add.svg (renamed from public/themes/icons/add.svg)0
-rw-r--r--p/themes/icons/all.svg (renamed from public/themes/icons/all.svg)0
-rw-r--r--p/themes/icons/bookmark.svg (renamed from public/themes/icons/starred.svg)0
-rw-r--r--p/themes/icons/category-white.svg31
-rw-r--r--p/themes/icons/category.svg (renamed from public/themes/icons/category.svg)0
-rw-r--r--p/themes/icons/close.svg (renamed from public/themes/icons/close.svg)0
-rw-r--r--p/themes/icons/configure.svg (renamed from public/themes/icons/configure.svg)0
-rw-r--r--p/themes/icons/down.svg (renamed from public/themes/icons/down.svg)0
-rw-r--r--p/themes/icons/favicon-16-32-48-64.icobin0 -> 32038 bytes
-rw-r--r--p/themes/icons/favicon-256.pngbin0 -> 17174 bytes
-rw-r--r--p/themes/icons/favicon.svg17
-rw-r--r--p/themes/icons/grey.gif (renamed from public/data/grey.gif)bin56 -> 56 bytes
-rw-r--r--p/themes/icons/help.svg (renamed from public/themes/icons/help.svg)0
-rw-r--r--p/themes/icons/icon.svg15
-rw-r--r--p/themes/icons/link.svg (renamed from public/themes/icons/link.svg)0
-rw-r--r--p/themes/icons/login.svg (renamed from public/themes/icons/login.svg)0
-rw-r--r--p/themes/icons/logout.svg (renamed from public/themes/icons/logout.svg)0
-rw-r--r--p/themes/icons/next.svg (renamed from public/themes/icons/next.svg)0
-rw-r--r--p/themes/icons/non-starred.svg (renamed from public/themes/icons/non-starred.svg)0
-rw-r--r--p/themes/icons/prev.svg (renamed from public/themes/icons/previous.svg)0
-rw-r--r--p/themes/icons/read.svg (renamed from public/themes/icons/read.svg)0
-rw-r--r--p/themes/icons/refresh.svg (renamed from public/themes/icons/refresh.svg)0
-rw-r--r--p/themes/icons/rss.svg (renamed from public/themes/icons/rss.svg)0
-rw-r--r--p/themes/icons/search.svg (renamed from public/themes/icons/search.svg)0
-rw-r--r--p/themes/icons/share.svg (renamed from public/themes/icons/share.svg)0
-rw-r--r--p/themes/icons/starred.svg32
-rw-r--r--p/themes/icons/tag.svg (renamed from public/themes/icons/tag.svg)0
-rw-r--r--p/themes/icons/unread.svg (renamed from public/themes/icons/unread.svg)0
-rw-r--r--p/themes/icons/up.svg (renamed from public/themes/icons/up.svg)0
-rw-r--r--public/data/.gitignore4
-rw-r--r--public/favicon.icobin1150 -> 0 bytes
-rw-r--r--public/favicon.pngbin694 -> 0 bytes
-rwxr-xr-xpublic/index.php62
-rw-r--r--public/install.php701
-rw-r--r--public/scripts/jquery-2.0.3.min.map1
-rw-r--r--public/scripts/jquery.min.js6
-rw-r--r--public/themes/flat-design/icons/add.pngbin154 -> 0 bytes
-rw-r--r--public/themes/flat-design/icons/all.pngbin152 -> 0 bytes
-rw-r--r--public/themes/flat-design/icons/close.pngbin243 -> 0 bytes
-rw-r--r--public/themes/flat-design/icons/configure.pngbin358 -> 0 bytes
-rw-r--r--public/themes/flat-design/icons/down.pngbin271 -> 0 bytes
-rw-r--r--public/themes/flat-design/icons/next.pngbin265 -> 0 bytes
-rw-r--r--public/themes/flat-design/icons/previous.pngbin266 -> 0 bytes
-rw-r--r--public/themes/flat-design/icons/refresh.pngbin319 -> 0 bytes
-rw-r--r--public/themes/flat-design/icons/search.pngbin305 -> 0 bytes
-rw-r--r--public/themes/flat-design/icons/up.pngbin260 -> 0 bytes
-rw-r--r--public/themes/icons/add.pngbin246 -> 0 bytes
-rw-r--r--public/themes/icons/all.pngbin223 -> 0 bytes
-rw-r--r--public/themes/icons/category-white.pngbin203 -> 0 bytes
-rw-r--r--public/themes/icons/category.pngbin294 -> 0 bytes
-rw-r--r--public/themes/icons/close.pngbin405 -> 0 bytes
-rw-r--r--public/themes/icons/configure.pngbin526 -> 0 bytes
-rw-r--r--public/themes/icons/down.pngbin460 -> 0 bytes
-rw-r--r--public/themes/icons/help.pngbin687 -> 0 bytes
-rw-r--r--public/themes/icons/icon-128.pngbin5753 -> 0 bytes
-rw-r--r--public/themes/icons/icon-16.pngbin694 -> 0 bytes
-rw-r--r--public/themes/icons/icon-256.pngbin11906 -> 0 bytes
-rw-r--r--public/themes/icons/icon-32.pngbin1534 -> 0 bytes
-rw-r--r--public/themes/icons/icon-64.pngbin2962 -> 0 bytes
-rw-r--r--public/themes/icons/icon.svg213
-rw-r--r--public/themes/icons/link.pngbin719 -> 0 bytes
-rw-r--r--public/themes/icons/login.pngbin333 -> 0 bytes
-rw-r--r--public/themes/icons/logout.pngbin339 -> 0 bytes
-rw-r--r--public/themes/icons/next.pngbin373 -> 0 bytes
-rw-r--r--public/themes/icons/non-starred.pngbin600 -> 0 bytes
-rw-r--r--public/themes/icons/previous.pngbin395 -> 0 bytes
-rw-r--r--public/themes/icons/read.pngbin656 -> 0 bytes
-rw-r--r--public/themes/icons/refresh.pngbin577 -> 0 bytes
-rw-r--r--public/themes/icons/rss.pngbin483 -> 0 bytes
-rw-r--r--public/themes/icons/search.pngbin571 -> 0 bytes
-rw-r--r--public/themes/icons/share.pngbin541 -> 0 bytes
-rw-r--r--public/themes/icons/starred.pngbin429 -> 0 bytes
-rw-r--r--public/themes/icons/tag.pngbin196 -> 0 bytes
-rw-r--r--public/themes/icons/unread.pngbin386 -> 0 bytes
-rw-r--r--public/themes/icons/up.pngbin411 -> 0 bytes
-rw-r--r--public/themes/printer/style.css34
262 files changed, 12197 insertions, 7066 deletions
diff --git a/CHANGELOG b/CHANGELOG
index c8bf43237..4db9381d5 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,97 +1,195 @@
-# Changelog
-## 2013-11-21 changes with FreshRSS 0.6.1
+# Journal des modifications
+
+## 2014-01-29 FreshRSS 0.7
+
+* Nouveau mode multi-utilisateur
+ * L’utilisateur par défaut (administrateur) peut créer et supprimer d’autres utilisateurs
+ * Nécessite un contrôle d’accès, soit :
+ * par le nouveau mode de connexion par formulaire (nom d’utilisateur + mot de passe)
+ * relativement sûr même sans HTTPS (le mot de passe n’est pas transmis en clair)
+ * requiert JavaScript et PHP 5.3+
+ * par HTTP (par exemple sous Apache en créant un fichier ./p/i/.htaccess et .htpasswd)
+ * le nom d’utilisateur HTTP doit correspondre au nom d’utilisateur FreshRSS
+ * par Mozilla Persona, en renseignant l’adresse courriel des utilisateurs
+* Installateur supportant les mises à jour :
+ * Depuis une v0.6, placer application.ini et Configuration.array.php dans le nouveau répertoire “./data/”
+ (voir réorganisation ci-dessous)
+ * Pour les versions suivantes, juste garder le répertoire “./data/”
+* Rafraîchissement automatique du nombre d’articles non lus toutes les deux minutes (utilise le cache HTTP à bon escient)
+ * Permet aussi de conserver la session valide, surtout dans le cas de Persona
+* Nouvelle page de statistiques (nombres d’articles par jour / catégorie)
+* Importation OPML instantanée et plus tolérante
+* Nouvelle gestion des favicons avec téléchargement en parallèle
+* Nouvelles options
+ * Réorganisation des options
+ * Gestion des utilisateurs
+ * Améliorations partage vers Shaarli, Poche, Diaspora*, Facebook, Twitter, Google+, courriel
+ * Raccourci ‘s’ par défaut
+ * 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)
+ * Boutons pour effacer les logs et pour purger les vieux articles
+ * Nouveaux filtres d’affichage : seulement les articles favoris, et seulement les articles lus
+* 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
+ * Permet une pagination efficace
+ * Refactorisation
+ * Les tables sont préfixées avec le nom d’utilisateur afin de permettre le mode 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’installateur)
+ * 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
+ * Utilisation de 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 :
+ * Nouveau thème sombre
+ * Chargement plus robuste des thèmes
+ * 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
+* PHP :
+ * Encore plus tolérant pour les flux comportant des erreurs
+ * Mise à jour automatique de l’URL du flux (en base de données) lorsque SimplePie découvre qu’elle a changé
+ * Meilleure gestion des caractères spéciaux dans différents cas
+ * Compatibilité PHP 5.5+ avec OPcache
+ * 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 “./data/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”
+ * Meilleure sécurité et compatibilité
+ * Déplacement de “./public/data/Configuration.array.php” vers “./data/*_user.php”
+ * Déplacement de “./public/” vers “./p/”
+ * Déplacement de “./public/index.php” vers “./p/i/index.php” (voir cookie ci-dessous)
+ * Déplacement de “./actualize_script.php” vers “./app/actualize_script.php” (pour une meilleure sécurité)
+ * Pensez à mettre à jour votre Cron !
+* Divers :
+ * Nouvelle politique de cookie de session (témoin de connexion)
+ * Utilise un nom poli “FreshRSS” (évite des problèmes avec certains filtres)
+ * Se limite au répertoire “./FreshRSS/p/i/” pour de meilleures performances HTTP
+ * Les images, CSS, scripts sont servis sans cookie
+ * Utilise “HttpOnly” pour plus de sécurité
+ * Nouvel “agent utilisateur” exposé lors du téléchargement des flux, par exemple :
+ * “FreshRSS/0.7 (Linux; http://freshrss.org) SimplePie/1.3.1”
+ * Script d’actualisation avec plus de messages
+ * Sur la sortie standard, ainsi que dans le log système (syslog)
+ * Affichage du numéro de version dans "À propos"
+
+
+## 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 +204,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/README.md b/README.md
index 6984096cc..75346f98e 100644
--- a/README.md
+++ b/README.md
@@ -1,45 +1,91 @@
# 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/).
-* Site officiel : http://marienfressinaud.github.io/FreshRSS/
-* Démo : http://marienfressinaud.fr/projets/freshrss/
+Il se veut léger et facile à prendre en main tout en étant un outil puissant et paramétrable.
+
+Il permet de gérer plusieurs utilisateurs, et dispose d’un mode de lecture anonyme.
+
+* Site officiel : http://freshrss.org
+* Démo : http://demo.freshrss.org/
* Développeur : Marien Fressinaud <dev@marienfressinaud.fr>
-* Version actuelle : 0.6.1
-* Date de publication 2013-11-21
-* License AGPL3
+* Version actuelle : 0.7
+* Date de publication 2014-01-29
+* 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)
# 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.
+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)
# Pré-requis
-* Serveur Apache2 ou Nginx (non testé sur les autres)
-* PHP 5.2+ (PHP 5.3.3+ recommandé)
- * Requis : [libxml](http://php.net/xml), [cURL](http://php.net/curl), [PDO_MySQL](http://php.net/pdo-mysql)
- * Recommandés : [Zlib](http://php.net/zlib), [mbstring](http://php.net/mbstring), [iconv](http://php.net/iconv)
-* MySQL 5.0.3+ (SQLite à venir)
-* Un navigateur Web récent tel Firefox, Chrome, Opera, Safari, Internet Explorer 9+
- * Fonctionne aussi sur mobile
+* Serveur modeste, par exemple sous Linux ou Windows
+ * Fonctionne même sur un Raspberry Pi avec des temps de réponse < 1s (testé sur 150 flux, 22k articles, soit 32Mo de données partiellement compressées)
+* Serveur Web Apache2 ou Nginx (non testé sur les autres)
+* PHP 5.2+ (PHP 5.3.7+ recommandé)
+ * Requis : [PDO_MySQL](http://php.net/pdo-mysql), [cURL](http://php.net/curl), [LibXML](http://php.net/xml), [PCRE](http://php.net/pcre), [ctype](http://php.net/ctype)
+ * Recommandés : [JSON](http://php.net/json), [zlib](http://php.net/zlib), [mbstring](http://php.net/mbstring), [iconv](http://php.net/iconv)
+* MySQL 5.0.3+ (ou SQLite 3.7.4+ à venir)
+* Un navigateur Web récent tel Firefox 4+, 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.
-
-# 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 `./app/configuration/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 :
+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 `./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.
+
+# Contrôle d’accès
+Il est requis pour le mode multi-utilisateur, et recommandé dans tous les cas, de limiter l’accès à votre FreshRSS :
+* En utilisant l’identification par [Mozilla Persona](https://login.persona.org/about) incluse dans FreshRSS
+* En utilisant un contrôle d’accès HTTP 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)
+ * Créer dans ce cas un fichier `./p/i/.htaccess` avec un fichier `.htpasswd` correspondant.
+
+# Rafraîchissement automatique des flux
+* Vous pouvez ajouter une tâche Cron lançant régulièrement le script d’actualisation automatique des flux.
+Consultez la documentation de Cron de votre système d’exploitation ([Debian/Ubuntu](http://doc.ubuntu-fr.org/cron), [Red Hat/Fedora](http://doc.fedora-fr.org/wiki/CRON_:_Configuration_de_t%C3%A2ches_automatis%C3%A9es), [Slackware](http://docs.slackware.com/fr:slackbook:process_control?#cron), [Gentoo](http://wiki.gentoo.org/wiki/Cron/fr), [Arch Linux](http://wiki.archlinux.fr/Cron)…).
+C’est une bonne idée d’utiliser le même utilisateur que votre serveur Web (souvent “www-data”).
+Par exemple, pour exécuter le script toutes les heures :
+
```
-7 * * * * php /chemin/vers/freshrss/actualize_script.php >/dev/null 2>&1
+7 * * * * php /chemin/vers/FreshRSS/app/actualize_script.php > /tmp/FreshRSS.log 2>&1
```
+
+# Conseils
+* 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 `./p/`.
+ * En particulier, les données personnelles se trouvent dans le répertoire `./data/`.
+* 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`.
+
+# Sauvegarde
+* Il faut conserver vos fichiers `./data/config.php` ainsi que `./data/*_user.php` et éventuellement `./data/persona/`
+* Vous pouvez exporter votre liste de flux depuis FreshRSS au format OPML
+* Pour sauvegarder les articles eux-même, vous pouvez utiliser [phpMyAdmin](http://www.phpmyadmin.net) ou les outils de MySQL :
+
+```bash
+mysqldump -u utilisateur -p --databases freshrss > freshrss.sql
+```
+
+
+# Bibliothèques incluses
+* [SimplePie](http://simplepie.org/)
+* [MINZ](https://github.com/marienfressinaud/MINZ)
+* [php-http-304](http://alexandre.alapetite.fr/doc-alex/php-http-304/)
+* [jQuery](http://jquery.com/)
+* [keyboard_shortcuts](http://www.openjs.com/scripts/events/keyboard_shortcuts/)
+
+## Uniquement pour certaines options
+* [bcrypt.js](https://github.com/dcodeIO/bcrypt.js)
+* [phpQuery](http://code.google.com/p/phpquery/)
+* [Lazy Load](http://www.appelsiini.net/projects/lazyload)
+
+## Si les fonctions natives ne sont pas disponibles
+* [Services_JSON](http://pear.php.net/pepr/pepr-proposal-show.php?id=198)
+* [password_compat](https://github.com/ircmaxell/password_compat)
diff --git a/actualize_script.php b/actualize_script.php
deleted file mode 100755
index 45b2938cb..000000000
--- a/actualize_script.php
+++ /dev/null
@@ -1,29 +0,0 @@
-<?php
-
-// Constantes de chemins
-define ('PUBLIC_PATH', realpath (dirname (__FILE__) . '/public'));
-define ('LIB_PATH', realpath (PUBLIC_PATH . '/../lib'));
-define ('APP_PATH', realpath (PUBLIC_PATH . '/../app'));
-define ('LOG_PATH', realpath (PUBLIC_PATH . '/../log'));
-define ('CACHE_PATH', realpath (PUBLIC_PATH . '/../cache'));
-
-$_GET['c'] = 'feed';
-$_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 (APP_PATH . '/App_FrontController.php');
-
-$front_controller = new App_FrontController ();
-$front_controller->init ();
-Session::_param('mail', true); // permet de se passer de la phase de connexion
-$front_controller->run ();
-touch(PUBLIC_PATH . '/data/touch.txt');
diff --git a/app/.htaccess b/app/.htaccess
new file mode 100644
index 000000000..9e768397d
--- /dev/null
+++ b/app/.htaccess
@@ -0,0 +1,3 @@
+Order Allow,Deny
+Deny from all
+Satisfy all
diff --git a/app/App_FrontController.php b/app/App_FrontController.php
deleted file mode 100644
index 1fd1d8868..000000000
--- a/app/App_FrontController.php
+++ /dev/null
@@ -1,93 +0,0 @@
-<?php
-/**
- * MINZ - Copyright 2011 Marien Fressinaud
- * Sous licence AGPL3 <http://www.gnu.org/licenses/>
-*/
-require ('FrontController.php');
-
-class App_FrontController extends FrontController {
- public function init () {
- $this->loadLibs ();
- $this->loadModels ();
-
- Session::init ();
- RSSThemes::init ();
- Translate::init ();
-
- $this->loadParamsView ();
- $this->loadStylesAndScripts ();
- $this->loadNotifications ();
- }
-
- private function loadLibs () {
- require (LIB_PATH . '/lib_phpQuery.php');
- require (LIB_PATH . '/lib_rss.php');
- require (LIB_PATH . '/SimplePie_autoloader.php');
- }
-
- private function loadModels () {
- include (APP_PATH . '/models/Exception/FeedException.php');
- include (APP_PATH . '/models/Exception/EntriesGetterException.php');
- include (APP_PATH . '/models/RSSConfiguration.php');
- include (APP_PATH . '/models/RSSThemes.php');
- include (APP_PATH . '/models/Days.php');
- include (APP_PATH . '/models/Category.php');
- include (APP_PATH . '/models/Feed.php');
- include (APP_PATH . '/models/Entry.php');
- include (APP_PATH . '/models/EntriesGetter.php');
- include (APP_PATH . '/models/RSSPaginator.php');
- include (APP_PATH . '/models/Log_Model.php');
- }
-
- private function loadParamsView () {
- try {
- $this->conf = Session::param ('conf', new RSSConfiguration ());
- } catch(MinzException $e) {
- // Permission denied or conf file does not exist
- // it's critical!
- print $e->getMessage();
- exit();
- }
-
- View::_param ('conf', $this->conf);
-
- $entryDAO = new EntryDAO ();
- View::_param ('nb_not_read', $entryDAO->countNotRead ());
-
- Session::_param ('language', $this->conf->language ());
-
- $output = Request::param ('output');
- if(!$output) {
- $output = $this->conf->viewMode();
- Request::_param ('output', $output);
- }
- }
-
- private function loadStylesAndScripts () {
- $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/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');
- }
- $includeLazyLoad = $this->conf->lazyload () === 'yes' && ($this->conf->displayPosts () === 'yes' || Request::param ('output') === 'reader');
- View::appendScript (Url::display ('/scripts/jquery.min.js?' . @filemtime(PUBLIC_PATH . '/scripts/jquery.min.js')), false, !$includeLazyLoad, !$includeLazyLoad);
- if ($includeLazyLoad) {
- 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')));
- }
-
- private function loadNotifications () {
- $notif = Session::param ('notification');
- if ($notif) {
- View::_param ('notification', $notif);
- Session::_param ('notification');
- }
- }
-}
diff --git a/app/Controllers/configureController.php b/app/Controllers/configureController.php
new file mode 100755
index 000000000..645f9eabf
--- /dev/null
+++ b/app/Controllers/configureController.php
@@ -0,0 +1,356 @@
+<?php
+
+class FreshRSS_configure_Controller extends Minz_ActionController {
+ public function firstAction () {
+ if (!$this->view->loginOk) {
+ 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 ();
+ $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);
+ }
+ }
+ invalidateHttpCache();
+
+ $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) {
+ $user = Minz_Request::param ('http_user', '');
+ $pass = Minz_Request::param ('http_pass', '');
+
+ $httpAuth = '';
+ if ($user != '' || $pass != '') {
+ $httpAuth = $user . ':' . $pass;
+ }
+
+ $cat = intval(Minz_Request::param('category', 0));
+
+ $values = array (
+ 'name' => Minz_Request::param ('name', ''),
+ 'description' => sanitizeHTML(Minz_Request::param('description', '', true)),
+ 'website' => Minz_Request::param('website', ''),
+ 'url' => Minz_Request::param('url', ''),
+ 'category' => $cat,
+ 'pathEntries' => Minz_Request::param ('path_entries', ''),
+ 'priority' => intval(Minz_Request::param ('priority', 0)),
+ 'httpAuth' => $httpAuth,
+ 'keep_history' => intval(Minz_Request::param ('keep_history', -2)),
+ );
+
+ 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')
+ );
+ }
+ invalidateHttpCache();
+
+ 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()) {
+ $this->view->conf->_language(Minz_Request::param('language', 'en'));
+ $this->view->conf->_posts_per_page(Minz_Request::param('posts_per_page', 10));
+ $this->view->conf->_view_mode(Minz_Request::param('view_mode', 'normal'));
+ $this->view->conf->_default_view (Minz_Request::param('default_view', 'a'));
+ $this->view->conf->_auto_load_more(Minz_Request::param('auto_load_more', false));
+ $this->view->conf->_display_posts(Minz_Request::param('display_posts', false));
+ $this->view->conf->_onread_jump_next(Minz_Request::param('onread_jump_next', false));
+ $this->view->conf->_lazyload (Minz_Request::param('lazyload', false));
+ $this->view->conf->_sort_order(Minz_Request::param('sort_order', 'DESC'));
+ $this->view->conf->_mark_when (array(
+ 'article' => Minz_Request::param('mark_open_article', false),
+ 'site' => Minz_Request::param('mark_open_site', false),
+ 'scroll' => Minz_Request::param('mark_scroll', false),
+ 'reception' => Minz_Request::param('mark_upon_reception', false),
+ ));
+ $themeId = Minz_Request::param('theme', '');
+ if ($themeId == '') {
+ $themeId = FreshRSS_Themes::defaultTheme;
+ }
+ $this->view->conf->_theme($themeId);
+ $this->view->conf->_topline_read(Minz_Request::param('topline_read', false));
+ $this->view->conf->_topline_favorite(Minz_Request::param('topline_favorite', false));
+ $this->view->conf->_topline_date(Minz_Request::param('topline_date', false));
+ $this->view->conf->_topline_link(Minz_Request::param('topline_link', false));
+ $this->view->conf->_bottomline_read(Minz_Request::param('bottomline_read', false));
+ $this->view->conf->_bottomline_favorite(Minz_Request::param('bottomline_favorite', false));
+ $this->view->conf->_bottomline_sharing(Minz_Request::param('bottomline_sharing', false));
+ $this->view->conf->_bottomline_tags(Minz_Request::param('bottomline_tags', false));
+ $this->view->conf->_bottomline_date(Minz_Request::param('bottomline_date', false));
+ $this->view->conf->_bottomline_link(Minz_Request::param('bottomline_link', false));
+ $this->view->conf->save();
+
+ Minz_Session::_param ('language', $this->view->conf->language);
+ Minz_Translate::reset ();
+ invalidateHttpCache();
+
+ $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 ('reading_configuration') . ' · ');
+ }
+
+ public function sharingAction () {
+ if (Minz_Request::isPost ()) {
+ $this->view->conf->_sharing (array(
+ 'shaarli' => Minz_Request::param ('shaarli', false),
+ 'wallabag' => Minz_Request::param ('wallabag', false),
+ 'diaspora' => Minz_Request::param ('diaspora', false),
+ 'twitter' => Minz_Request::param ('twitter', false),
+ 'g+' => Minz_Request::param ('g+', false),
+ 'facebook' => Minz_Request::param ('facebook', false),
+ 'email' => Minz_Request::param ('email', false),
+ 'print' => Minz_Request::param ('print', false),
+ ));
+ $this->view->conf->save();
+ invalidateHttpCache();
+
+ $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') . ' · ');
+ }
+
+ public function importExportAction () {
+ require_once(LIB_PATH . '/lib_opml.php');
+ $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) {
+ invalidateHttpCache();
+ // 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 (Minz_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;
+
+ if (Minz_Request::isPost ()) {
+ $shortcuts = Minz_Request::param ('shortcuts');
+ $shortcuts_ok = array ();
+
+ foreach ($shortcuts as $key => $value) {
+ if (in_array($value, $list_keys)) {
+ $shortcuts_ok[$key] = $value;
+ }
+ }
+
+ $this->view->conf->_shortcuts ($shortcuts_ok);
+ $this->view->conf->save();
+ invalidateHttpCache();
+
+ $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') . ' · ');
+ }
+
+ public function usersAction() {
+ Minz_View::prependTitle(Minz_Translate::t ('users') . ' · ');
+ }
+
+ public function archivingAction () {
+ if (Minz_Request::isPost()) {
+ $old = Minz_Request::param('old_entries', 3);
+ $keepHistoryDefault = Minz_Request::param('keep_history_default', 0);
+
+ $this->view->conf->_old_entries($old);
+ $this->view->conf->_keep_history_default($keepHistoryDefault);
+ $this->view->conf->save();
+ invalidateHttpCache();
+
+ $notif = array(
+ 'type' => 'good',
+ 'content' => Minz_Translate::t('configuration_updated')
+ );
+ Minz_Session::_param('notification', $notif);
+
+ Minz_Request::forward(array('c' => 'configure', 'a' => 'archiving'), true);
+ }
+
+ Minz_View::prependTitle(Minz_Translate::t('archiving_configuration') . ' · ');
+
+ $entryDAO = new FreshRSS_EntryDAO();
+ $this->view->nb_total = $entryDAO->count();
+ $this->view->size_user = $entryDAO->size();
+
+ if (Minz_Configuration::isAdmin(Minz_Session::param('currentUser', '_'))) {
+ $this->view->size_total = $entryDAO->size(true);
+ }
+ }
+}
diff --git a/app/Controllers/entryController.php b/app/Controllers/entryController.php
new file mode 100755
index 000000000..1756c91e5
--- /dev/null
+++ b/app/Controllers/entryController.php
@@ -0,0 +1,158 @@
+<?php
+
+class FreshRSS_entry_Controller extends Minz_ActionController {
+ public function firstAction () {
+ if (!$this->view->loginOk) {
+ Minz_Error::error (
+ 403,
+ array ('error' => array (Minz_Translate::t ('access_denied')))
+ );
+ }
+
+ $this->params = array ();
+ $output = Minz_Request::param('output', '');
+ if (($output != '') && ($this->view->conf->view_mode !== $output)) {
+ $this->params['output'] = $output;
+ }
+
+ $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');
+ $get = Minz_Request::param ('get');
+ $nextGet = Minz_Request::param ('nextGet', $get);
+ $idMax = Minz_Request::param ('idMax', 0);
+
+ $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['get'] = $nextGet;
+ }
+ }
+
+ $notif = array (
+ 'type' => 'good',
+ 'content' => Minz_Translate::t ('feeds_marked_read')
+ );
+ Minz_Session::_param ('notification', $notif);
+ } else {
+ $is_read = (bool)(Minz_Request::param ('is_read', true));
+ $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, (bool)(Minz_Request::param ('is_favorite', true)));
+ }
+ }
+
+ public function optimizeAction() {
+ if (Minz_Request::isPost()) {
+ @set_time_limit(300);
+
+ // 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' => 'archiving'
+ ), true);
+ }
+
+ public function purgeAction() {
+ @set_time_limit(300);
+
+ $nb_month_old = max($this->view->conf->old_entries, 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->keep_history_default;
+ }
+ 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->url() . ']', 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' => 'archiving'
+ ), true);
+ }
+}
diff --git a/app/controllers/errorController.php b/app/Controllers/errorController.php
index 092609280..dc9a2ee25 100644
--- a/app/controllers/errorController.php
+++ b/app/Controllers/errorController.php
@@ -1,8 +1,8 @@
<?php
-class ErrorController extends ActionController {
+class FreshRSS_error_Controller extends Minz_ActionController {
public function indexAction () {
- switch (Request::param ('code')) {
+ switch (Minz_Request::param ('code')) {
case 403:
$this->view->code = 'Error 403 - Forbidden';
break;
@@ -19,8 +19,8 @@ class ErrorController extends ActionController {
$this->view->code = 'Error 404 - Not found';
}
- $this->view->logs = Request::param ('logs');
+ $this->view->logs = Minz_Request::param ('logs');
- View::prependTitle ($this->view->code . ' - ');
+ Minz_View::prependTitle ($this->view->code . ' · ');
}
}
diff --git a/app/Controllers/feedController.php b/app/Controllers/feedController.php
new file mode 100755
index 000000000..c40b3c400
--- /dev/null
+++ b/app/Controllers/feedController.php
@@ -0,0 +1,425 @@
+<?php
+
+class FreshRSS_feed_Controller extends Minz_ActionController {
+ public function firstAction () {
+ if (!$this->view->loginOk) {
+ $token = $this->view->conf->token; //TODO: check the token logic again, and if it is still needed
+ $token_param = Minz_Request::param ('token', '');
+ $token_is_ok = ($token != '' && $token == $token_param);
+ $action = Minz_Request::actionName ();
+ if (!($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 ();
+ }
+
+ 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 ('http_user');
+ $pass = Minz_Request::param ('http_pass');
+ $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(true);
+
+ $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->mark_when['reception'] ? 1 : 0;
+
+ $entryDAO = new FreshRSS_EntryDAO ();
+ $entries = array_reverse($feed->entries()); //We want chronological order and SimplePie uses reverse order
+
+ // on calcule la date des articles les plus anciens qu'on accepte
+ $nb_month_old = $this->view->conf->old_entries;
+ $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) {
+ $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 ();
+
+ Minz_Session::_param('actualize_feeds', false);
+ $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 = max($this->view->conf->old_entries, 1);
+ $date_min = time () - (3600 * 24 * 30 * $nb_month_old);
+
+ $i = 0;
+ $flux_update = 0;
+ $is_read = $this->view->conf->mark_when['reception'] ? 1 : 0;
+ foreach ($feeds as $feed) {
+ try {
+ $url = $feed->url();
+ $feed->load(false);
+ $entries = array_reverse($feed->entries()); //We want chronological order and SimplePie uses reverse order
+
+ //For this feed, check last n entry GUIDs already in database
+ $existingGuids = array_fill_keys ($entryDAO->listLastGuidsByFeed ($feed->id (), count($entries) + 10), 1);
+ $useDeclaredDate = empty($existingGuids);
+
+ $feedHistory = $feed->keepHistory();
+ if ($feedHistory == -2) { //default
+ $feedHistory = $this->view->conf->keep_history_default;
+ }
+
+ // 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) {
+ $eDate = $entry->date (true);
+ if ((!isset ($existingGuids[$entry->guid ()])) &&
+ (($feedHistory != 0) || ($eDate >= $date_min))) {
+ $values = $entry->toArray ();
+ //Use declared date at first import, otherwise use discovery date
+ $values['id'] = ($useDeclaredDate || $eDate < $date_min) ?
+ min(time(), $eDate) . uSecString() :
+ uTimeString();
+ $values['is_read'] = $is_read;
+ $entryDAO->addEntry ($values);
+ }
+ }
+
+ 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->url() . ']', Minz_Log::DEBUG);
+ }
+ }
+
+ // on indique que le flux vient d'être mis à jour en BDD
+ $feedDAO->updateLastUpdate ($feed->id ());
+ $feedDAO->commit ();
+ $flux_update++;
+ if ($feed->url() !== $url) { //URL has changed (auto-discovery)
+ $feedDAO->updateFeed($feed->id(), array('url' => $feed->url()));
+ }
+ $feed->faviconPrepare();
+ } 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->old_entries;
+ $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')
+ );
+ //TODO: Delete old favicon
+ } 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) {
+ foreach ($categories as $cat) {
+ if (!$this->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..986a322a1
--- /dev/null
+++ b/app/Controllers/indexController.php
@@ -0,0 +1,357 @@
+<?php
+
+class FreshRSS_index_Controller extends Minz_ActionController {
+ private $nb_not_read_cat = 0;
+
+ public function indexAction () {
+ $output = Minz_Request::param ('output');
+ $token = '';
+
+ // check if user is logged in
+ if (!$this->view->loginOk && !Minz_Configuration::allowAnonymous())
+ {
+ $token = $this->view->conf->token;
+ $token_param = Minz_Request::param ('token', '');
+ $token_is_ok = ($token != '' && $token === $token_param);
+ if (!($output === 'rss' && $token_is_ok)) {
+ return;
+ }
+ $params['token'] = $token;
+ }
+
+ // construction of RSS url of this feed
+ $params = Minz_Request::params ();
+ $params['output'] = 'rss';
+ if (isset ($params['search'])) {
+ $params['search'] = urlencode ($params['search']);
+ }
+ $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');
+ } elseif ($output === 'global') {
+ Minz_View::appendScript (Minz_Url::display ('/scripts/global_view.js?' . @filemtime(PUBLIC_PATH . '/scripts/global_view.js')));
+ }
+
+ $catDAO = new FreshRSS_CategoryDAO();
+ $entryDAO = new FreshRSS_EntryDAO();
+
+ $this->view->cat_aside = $catDAO->listCategories ();
+ $this->view->nb_favorites = $entryDAO->countUnreadReadFavorites ();
+ $this->view->nb_not_read = FreshRSS_CategoryDAO::CountUnreads($this->view->cat_aside, 1);
+ $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;
+ }
+
+ // mise à jour des titres
+ $this->view->rss_title = $this->view->currentName . ' | ' . Minz_View::title();
+ if ($this->view->nb_not_read > 0) {
+ Minz_View::appendTitle (' (' . formatNumber($this->view->nb_not_read) . ')');
+ }
+ Minz_View::prependTitle (
+ $this->view->currentName .
+ ($this->nb_not_read_cat > 0 ? ' (' . formatNumber($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->default_view);
+ $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->sort_order);
+ $nb = Minz_Request::param ('nb', $this->view->conf->posts_per_page);
+ $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 = FreshRSS_CategoryDAO::findFeed($this->view->cat_aside, $getId);
+ $hasUnread = ($myFeed === null) || ($myFeed->nbNotRead() > 0);
+ break;
+ default:
+ $hasUnread = true;
+ break;
+ }
+ if (!$hasUnread) {
+ $this->view->state = $state = 'all';
+ }
+ }
+
+ $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->old_entries;
+ $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->keep_history_default;
+
+ try {
+ $entries = $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)) {
+ Minz_Log::record ('Conflicting information about nbNotRead!', Minz_Log::DEBUG);
+ $this->view->state = 'all';
+ $entries = $entryDAO->listWhere($getType, $getId, 'all', $order, $nb, $first, $filter, $date_min, $keepHistoryDefault);
+ }
+
+ 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->nb_not_read_cat = $this->view->nb_not_read;
+ $this->view->get_c = $getType;
+ return true;
+ case 's':
+ $this->view->currentName = Minz_Translate::t ('your_favorites');
+ $this->nb_not_read_cat = $this->view->nb_favorites['unread'];
+ $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) {
+ $catDAO = new FreshRSS_CategoryDAO();
+ $cat = $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 = FreshRSS_CategoryDAO::findFeed($this->view->cat_aside, $getId);
+ if (empty($feed)) {
+ $feedDAO = new FreshRSS_FeedDAO();
+ $feed = $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 statsAction () {
+ if (!$this->view->loginOk) {
+ Minz_Error::error (
+ 403,
+ array ('error' => array (Minz_Translate::t ('access_denied')))
+ );
+ }
+
+ Minz_View::prependTitle (Minz_Translate::t ('stats') . ' · ');
+
+ $statsDAO = new FreshRSS_StatsDAO ();
+ Minz_View::appendScript (Minz_Url::display ('/scripts/flotr2.min.js?' . @filemtime(PUBLIC_PATH . '/scripts/flotr2.min.js')));
+ $this->view->repartition = $statsDAO->calculateEntryRepartition();
+ $this->view->count = ($statsDAO->calculateEntryCount());
+ $this->view->feedByCategory = $statsDAO->calculateFeedByCategory();
+ $this->view->entryByCategory = $statsDAO->calculateEntryByCategory();
+ $this->view->topFeed = $statsDAO->calculateTopFeed();
+ }
+
+ public function aboutAction () {
+ Minz_View::prependTitle (Minz_Translate::t ('about') . ' · ');
+ }
+
+ public function logsAction () {
+ if (!$this->view->loginOk) {
+ Minz_Error::error (
+ 403,
+ array ('error' => array (Minz_Translate::t ('access_denied')))
+ );
+ }
+
+ Minz_View::prependTitle (Minz_Translate::t ('logs') . ' · ');
+
+ if (Minz_Request::isPost ()) {
+ FreshRSS_LogDAO::truncate();
+ }
+
+ $logs = FreshRSS_LogDAO::lines(); //TODO: ask only the necessary lines
+
+ //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);
+
+ $loginOk = false;
+ $reason = '';
+ if ($res['status'] === 'okay') {
+ $email = filter_var($res['email'], FILTER_VALIDATE_EMAIL);
+ if ($email != '') {
+ $personaFile = DATA_PATH . '/persona/' . $email . '.txt';
+ if (($currentUser = @file_get_contents($personaFile)) !== false) {
+ $currentUser = trim($currentUser);
+ if (ctype_alnum($currentUser)) {
+ try {
+ $this->conf = new FreshRSS_Configuration($currentUser);
+ $loginOk = strcasecmp($email, $this->conf->mail_login) === 0;
+ } catch (Minz_Exception $e) {
+ $reason = 'Invalid configuration for user [' . $currentUser . ']! ' . $e->getMessage(); //Permission denied or conf file does not exist
+ }
+ } else {
+ $reason = 'Invalid username format [' . $currentUser . ']!';
+ }
+ }
+ } else {
+ $reason = 'Invalid email format [' . $res['email'] . ']!';
+ }
+ }
+ if ($loginOk) {
+ Minz_Session::_param('currentUser', $currentUser);
+ Minz_Session::_param ('mail', $email);
+ $this->view->loginOk = true;
+ invalidateHttpCache();
+ } else {
+ $res = array ();
+ $res['status'] = 'failure';
+ $res['reason'] = $reason == '' ? Minz_Translate::t ('invalid_login') : $reason;
+ Minz_Log::record ('Persona: ' . $res['reason'], Minz_Log::WARNING);
+ }
+
+ header('Content-Type: application/json; charset=UTF-8');
+ $this->view->res = json_encode ($res);
+ }
+
+ public function logoutAction () {
+ $this->view->_useLayout(false);
+ invalidateHttpCache();
+ Minz_Session::_param('currentUser');
+ Minz_Session::_param('mail');
+ Minz_Session::_param('passwordHash');
+ }
+
+ public function formLoginAction () {
+ if (Minz_Request::isPost()) {
+ $ok = false;
+ $nonce = Minz_Session::param('nonce');
+ $username = Minz_Request::param('username', '');
+ $c = Minz_Request::param('challenge', '');
+ if (ctype_alnum($username) && ctype_graph($c) && ctype_alnum($nonce)) {
+ if (!function_exists('password_verify')) {
+ include_once(LIB_PATH . '/password_compat.php');
+ }
+ try {
+ $conf = new FreshRSS_Configuration($username);
+ $s = $conf->passwordHash;
+ $ok = password_verify($nonce . $s, $c);
+ if ($ok) {
+ Minz_Session::_param('currentUser', $username);
+ Minz_Session::_param('passwordHash', $s);
+ } else {
+ Minz_Log::record('Password mismatch for user ' . $username . ', nonce=' . $nonce . ', c=' . $c, Minz_Log::WARNING);
+ }
+ } catch (Minz_Exception $me) {
+ Minz_Log::record('Login failure: ' . $me->getMessage(), Minz_Log::WARNING);
+ }
+ } else {
+ Minz_Log::record('Invalid credential parameters: user=' . $username . ' challenge=' . $c . ' nonce=' . $nonce, Minz_Log::DEBUG);
+ }
+ if (!$ok) {
+ $notif = array(
+ 'type' => 'bad',
+ 'content' => Minz_Translate::t('invalid_login')
+ );
+ Minz_Session::_param('notification', $notif);
+ }
+ $this->view->_useLayout(false);
+ Minz_Request::forward(array('c' => 'index', 'a' => 'index'), true);
+ }
+ invalidateHttpCache();
+ }
+
+ public function formLogoutAction () {
+ $this->view->_useLayout(false);
+ invalidateHttpCache();
+ Minz_Session::_param('currentUser');
+ Minz_Session::_param('mail');
+ Minz_Session::_param('passwordHash');
+ Minz_Request::forward(array('c' => 'index', 'a' => 'index'), true);
+ }
+}
diff --git a/app/Controllers/javascriptController.php b/app/Controllers/javascriptController.php
new file mode 100755
index 000000000..b879dcd6d
--- /dev/null
+++ b/app/Controllers/javascriptController.php
@@ -0,0 +1,46 @@
+<?php
+
+class FreshRSS_javascript_Controller extends Minz_ActionController {
+ public function firstAction () {
+ $this->view->_useLayout (false);
+ }
+
+ public function actualizeAction () {
+ header('Content-Type: text/javascript; charset=UTF-8');
+ $feedDAO = new FreshRSS_FeedDAO ();
+ $this->view->feeds = $feedDAO->listFeeds ();
+ }
+
+ public function nbUnreadsPerFeedAction() {
+ header('Content-Type: application/json; charset=UTF-8');
+ $catDAO = new FreshRSS_CategoryDAO();
+ $this->view->categories = $catDAO->listCategories(true, false);
+ }
+
+ //For Web-form login
+ public function nonceAction() {
+ header('Content-Type: application/json; charset=UTF-8');
+ header('Last-Modified: ' . gmdate('D, d M Y H:i:s \G\M\T'));
+ header('Expires: 0');
+ header('Cache-Control: private, no-cache, no-store, must-revalidate');
+ header('Pragma: no-cache');
+
+ $user = isset($_GET['user']) ? $_GET['user'] : '';
+ if (ctype_alnum($user)) {
+ try {
+ $conf = new FreshRSS_Configuration($user);
+ $s = $conf->passwordHash;
+ if (strlen($s) >= 60) {
+ $this->view->salt1 = substr($s, 0, 29); //CRYPT_BLOWFISH Salt: "$2a$", a two digit cost parameter, "$", and 22 characters from the alphabet "./0-9A-Za-z".
+ $this->view->nonce = sha1(Minz_Configuration::salt() . uniqid(mt_rand(), true));
+ Minz_Session::_param('nonce', $this->view->nonce);
+ return; //Success
+ }
+ } catch (Minz_Exception $me) {
+ Minz_Log::record('Nonce failure: ' . $me->getMessage(), Minz_Log::WARNING);
+ }
+ }
+ $this->view->nonce = ''; //Failure
+ $this->view->salt1 = '';
+ }
+}
diff --git a/app/Controllers/usersController.php b/app/Controllers/usersController.php
new file mode 100644
index 000000000..8314b75fc
--- /dev/null
+++ b/app/Controllers/usersController.php
@@ -0,0 +1,178 @@
+<?php
+
+class FreshRSS_users_Controller extends Minz_ActionController {
+
+ const BCRYPT_COST = 9; //Will also have to be computed client side on mobile devices, so do not use a too high cost
+
+ public function firstAction() {
+ if (!$this->view->loginOk) {
+ Minz_Error::error(
+ 403,
+ array('error' => array(Minz_Translate::t('access_denied')))
+ );
+ }
+ }
+
+ public function authAction() {
+ if (Minz_Request::isPost()) {
+ $ok = true;
+
+ $passwordPlain = Minz_Request::param('passwordPlain', false);
+ if ($passwordPlain != '') {
+ Minz_Request::_param('passwordPlain'); //Discard plain-text password ASAP
+ $_POST['passwordPlain'] = '';
+ if (!function_exists('password_hash')) {
+ include_once(LIB_PATH . '/password_compat.php');
+ }
+ $passwordHash = password_hash($passwordPlain, PASSWORD_BCRYPT, array('cost' => self::BCRYPT_COST));
+ $passwordPlain = '';
+ $passwordHash = preg_replace('/^\$2[xy]\$/', '\$2a\$', $passwordHash); //Compatibility with bcrypt.js
+ $ok &= ($passwordHash != '');
+ $this->view->conf->_passwordHash($passwordHash);
+ }
+ Minz_Session::_param('passwordHash', $this->view->conf->passwordHash);
+
+ if (Minz_Configuration::isAdmin(Minz_Session::param('currentUser', '_'))) {
+ $this->view->conf->_mail_login(Minz_Request::param('mail_login', false));
+ }
+ $email = $this->view->conf->mail_login;
+ Minz_Session::_param('mail', $email);
+
+ $ok &= $this->view->conf->save();
+
+ if ($email != '') {
+ $personaFile = DATA_PATH . '/persona/' . $email . '.txt';
+ @unlink($personaFile);
+ $ok &= (file_put_contents($personaFile, Minz_Session::param('currentUser', '_')) !== false);
+ }
+
+ if (Minz_Configuration::isAdmin(Minz_Session::param('currentUser', '_'))) {
+ $current_token = $this->view->conf->token;
+ $token = Minz_Request::param('token', $current_token);
+ $this->view->conf->_token($token);
+ $ok &= $this->view->conf->save();
+
+ $anon = Minz_Request::param('anon_access', false);
+ $anon = ((bool)$anon) && ($anon !== 'no');
+ $auth_type = Minz_Request::param('auth_type', 'none');
+ if ($anon != Minz_Configuration::allowAnonymous() ||
+ $auth_type != Minz_Configuration::authType()) {
+ Minz_Configuration::_authType($auth_type);
+ Minz_Configuration::_allowAnonymous($anon);
+ $ok &= Minz_Configuration::writeFile();
+ }
+ }
+
+ invalidateHttpCache();
+
+ $notif = array(
+ 'type' => $ok ? 'good' : 'bad',
+ 'content' => Minz_Translate::t($ok ? 'configuration_updated' : 'error_occurred')
+ );
+ Minz_Session::_param('notification', $notif);
+ }
+ Minz_Request::forward(array('c' => 'configure', 'a' => 'users'), true);
+ }
+
+ public function createAction() {
+ if (Minz_Request::isPost() && Minz_Configuration::isAdmin(Minz_Session::param('currentUser', '_'))) {
+ require_once(APP_PATH . '/sql.php');
+
+ $new_user_language = Minz_Request::param('new_user_language', $this->view->conf->language);
+ if (!in_array($new_user_language, $this->view->conf->availableLanguages())) {
+ $new_user_language = $this->view->conf->language;
+ }
+
+ $new_user_name = Minz_Request::param('new_user_name');
+ $ok = ($new_user_name != '') && ctype_alnum($new_user_name);
+
+ if ($ok) {
+ $ok &= (strcasecmp($new_user_name, Minz_Configuration::defaultUser()) !== 0); //It is forbidden to alter the default user
+
+ $ok &= !in_array(strtoupper($new_user_name), array_map('strtoupper', listUsers())); //Not an existing user, case-insensitive
+
+ $configPath = DATA_PATH . '/' . $new_user_name . '_user.php';
+ $ok &= !file_exists($configPath);
+ }
+ if ($ok) {
+
+ $passwordPlain = Minz_Request::param('new_user_passwordPlain', false);
+ $passwordHash = '';
+ if ($passwordPlain != '') {
+ Minz_Request::_param('new_user_passwordPlain'); //Discard plain-text password ASAP
+ $_POST['new_user_passwordPlain'] = '';
+ if (!function_exists('password_hash')) {
+ include_once(LIB_PATH . '/password_compat.php');
+ }
+ $passwordHash = password_hash($passwordPlain, PASSWORD_BCRYPT, array('cost' => self::BCRYPT_COST));
+ $passwordPlain = '';
+ $passwordHash = preg_replace('/^\$2[xy]\$/', '\$2a\$', $passwordHash); //Compatibility with bcrypt.js
+ $ok &= ($passwordHash != '');
+ }
+ if (empty($passwordHash)) {
+ $passwordHash = '';
+ }
+
+ $new_user_email = filter_var($_POST['new_user_email'], FILTER_VALIDATE_EMAIL);
+ if (empty($new_user_email)) {
+ $new_user_email = '';
+ } else {
+ $personaFile = DATA_PATH . '/persona/' . $new_user_email . '.txt';
+ @unlink($personaFile);
+ $ok &= (file_put_contents($personaFile, $new_user_name) !== false);
+ }
+ }
+ if ($ok) {
+ $config_array = array(
+ 'language' => $new_user_language,
+ 'passwordHash' => $passwordHash,
+ 'mail_login' => $new_user_email,
+ );
+ $ok &= (file_put_contents($configPath, "<?php\n return " . var_export($config_array, true) . ';') !== false);
+ }
+ if ($ok) {
+ $userDAO = new FreshRSS_UserDAO();
+ $ok &= $userDAO->createUser($new_user_name);
+ }
+ invalidateHttpCache();
+
+ $notif = array(
+ 'type' => $ok ? 'good' : 'bad',
+ 'content' => Minz_Translate::t($ok ? 'user_created' : 'error_occurred', $new_user_name)
+ );
+ Minz_Session::_param('notification', $notif);
+ }
+ Minz_Request::forward(array('c' => 'configure', 'a' => 'users'), true);
+ }
+
+ public function deleteAction() {
+ if (Minz_Request::isPost() && Minz_Configuration::isAdmin(Minz_Session::param('currentUser', '_'))) {
+ require_once(APP_PATH . '/sql.php');
+
+ $username = Minz_Request::param('username');
+ $ok = ctype_alnum($username);
+
+ if ($ok) {
+ $ok &= (strcasecmp($username, Minz_Configuration::defaultUser()) !== 0); //It is forbidden to delete the default user
+ }
+ if ($ok) {
+ $configPath = DATA_PATH . '/' . $username . '_user.php';
+ $ok &= file_exists($configPath);
+ }
+ if ($ok) {
+ $userDAO = new FreshRSS_UserDAO();
+ $ok &= $userDAO->deleteUser($username);
+ $ok &= unlink($configPath);
+ //TODO: delete Persona file
+ }
+ invalidateHttpCache();
+
+ $notif = array(
+ 'type' => $ok ? 'good' : 'bad',
+ 'content' => Minz_Translate::t($ok ? 'user_deleted' : 'error_occurred', $username)
+ );
+ Minz_Session::_param('notification', $notif);
+ }
+ Minz_Request::forward(array('c' => 'configure', 'a' => 'users'), true);
+ }
+}
diff --git a/app/Exceptions/BadUrlException.php b/app/Exceptions/BadUrlException.php
new file mode 100644
index 000000000..7d1fe110e
--- /dev/null
+++ b/app/Exceptions/BadUrlException.php
@@ -0,0 +1,6 @@
+<?php
+class FreshRSS_BadUrl_Exception extends FreshRSS_Feed_Exception {
+ public function __construct ($url) {
+ parent::__construct ('`' . $url . '` is not a valid URL');
+ }
+}
diff --git a/app/Exceptions/EntriesGetterException.php b/app/Exceptions/EntriesGetterException.php
new file mode 100644
index 000000000..eaa330979
--- /dev/null
+++ b/app/Exceptions/EntriesGetterException.php
@@ -0,0 +1,7 @@
+<?php
+
+class FreshRSS_EntriesGetter_Exception extends Exception {
+ public function __construct ($message) {
+ parent::__construct ($message);
+ }
+}
diff --git a/app/models/Exception/EntriesGetterException.php b/app/Exceptions/FeedException.php
index 3a51bff7c..50918ba95 100644
--- a/app/models/Exception/EntriesGetterException.php
+++ b/app/Exceptions/FeedException.php
@@ -1,6 +1,5 @@
<?php
-
-class EntriesGetterException extends Exception {
+class FreshRSS_Feed_Exception extends Exception {
public function __construct ($message) {
parent::__construct ($message);
}
diff --git a/app/Exceptions/OpmlException.php b/app/Exceptions/OpmlException.php
new file mode 100644
index 000000000..e0ea3e493
--- /dev/null
+++ b/app/Exceptions/OpmlException.php
@@ -0,0 +1,6 @@
+<?php
+class FreshRSS_Opml_Exception extends FreshRSS_Feed_Exception {
+ public function __construct ($name_file) {
+ parent::__construct ('OPML file is invalid');
+ }
+}
diff --git a/app/FreshRSS.php b/app/FreshRSS.php
new file mode 100644
index 000000000..c51f91dec
--- /dev/null
+++ b/app/FreshRSS.php
@@ -0,0 +1,150 @@
+<?php
+class FreshRSS extends Minz_FrontController {
+ public function init() {
+ if (!isset($_SESSION)) {
+ Minz_Session::init('FreshRSS');
+ }
+ $loginOk = $this->accessControl(Minz_Session::param('currentUser', ''));
+ $this->loadParamsView();
+ $this->loadStylesAndScripts($loginOk); //TODO: Do not load that when not needed, e.g. some Ajax requests
+ $this->loadNotifications();
+ }
+
+ private function accessControl($currentUser) {
+ if ($currentUser == '') {
+ switch (Minz_Configuration::authType()) {
+ case 'form':
+ $currentUser = Minz_Configuration::defaultUser();
+ Minz_Session::_param('passwordHash');
+ $loginOk = false;
+ break;
+ case 'http_auth':
+ $currentUser = httpAuthUser();
+ $loginOk = $currentUser != '';
+ break;
+ case 'persona':
+ $loginOk = false;
+ $email = filter_var(Minz_Session::param('mail'), FILTER_VALIDATE_EMAIL);
+ if ($email != '') { //TODO: Remove redundancy with indexController
+ $personaFile = DATA_PATH . '/persona/' . $email . '.txt';
+ if (($currentUser = @file_get_contents($personaFile)) !== false) {
+ $currentUser = trim($currentUser);
+ $loginOk = true;
+ }
+ }
+ if (!$loginOk) {
+ $currentUser = Minz_Configuration::defaultUser();
+ }
+ break;
+ case 'none':
+ $currentUser = Minz_Configuration::defaultUser();
+ $loginOk = true;
+ break;
+ default:
+ $currentUser = Minz_Configuration::defaultUser();
+ $loginOk = false;
+ break;
+ }
+ } else {
+ $loginOk = true;
+ }
+
+ if (!ctype_alnum($currentUser)) {
+ Minz_Session::_param('currentUser', '');
+ die('Invalid username [' . $currentUser . ']!');
+ }
+
+ try {
+ $this->conf = new FreshRSS_Configuration($currentUser);
+ Minz_View::_param ('conf', $this->conf);
+ Minz_Session::_param('currentUser', $currentUser);
+ } catch (Minz_Exception $me) {
+ $loginOk = false;
+ try {
+ $this->conf = new FreshRSS_Configuration(Minz_Configuration::defaultUser());
+ Minz_Session::_param('currentUser', Minz_Configuration::defaultUser());
+ Minz_View::_param('conf', $this->conf);
+ $notif = array(
+ 'type' => 'bad',
+ 'content' => 'Invalid configuration for user [' . $currentUser . ']!',
+ );
+ Minz_Session::_param ('notification', $notif);
+ Minz_Log::record ($notif['content'] . ' ' . $me->getMessage(), Minz_Log::WARNING);
+ Minz_Session::_param('currentUser', '');
+ } catch (Exception $e) {
+ die($e->getMessage());
+ }
+ }
+
+ if ($loginOk) {
+ switch (Minz_Configuration::authType()) {
+ case 'form':
+ $loginOk = Minz_Session::param('passwordHash') === $this->conf->passwordHash;
+ break;
+ case 'http_auth':
+ $loginOk = strcasecmp($currentUser, httpAuthUser()) === 0;
+ break;
+ case 'persona':
+ $loginOk = strcasecmp(Minz_Session::param('mail'), $this->conf->mail_login) === 0;
+ break;
+ case 'none':
+ $loginOk = true;
+ break;
+ default:
+ $loginOk = false;
+ break;
+ }
+ if ((!$loginOk) && (PHP_SAPI === 'cli') && (Minz_Request::actionName() === 'actualize')) { //Command line
+ Minz_Configuration::_authType('none');
+ $loginOk = true;
+ }
+ }
+ Minz_View::_param ('loginOk', $loginOk);
+ return $loginOk;
+ }
+
+ private function loadParamsView () {
+ Minz_Session::_param ('language', $this->conf->language);
+ Minz_Translate::init();
+ $output = Minz_Request::param ('output', '');
+ if (($output === '') || ($output !== 'normal' && $output !== 'rss' && $output !== 'reader' && $output !== 'global')) {
+ $output = $this->conf->view_mode;
+ Minz_Request::_param ('output', $output);
+ }
+ }
+
+ private function loadStylesAndScripts ($loginOk) {
+ $theme = FreshRSS_Themes::load($this->conf->theme);
+ if ($theme) {
+ foreach($theme['files'] as $file) {
+ Minz_View::appendStyle (Minz_Url::display ('/themes/' . $theme['id'] . '/' . $file . '?' . @filemtime(PUBLIC_PATH . '/themes/' . $theme['id'] . '/' . $file)));
+ }
+ }
+
+ switch (Minz_Configuration::authType()) {
+ case 'form':
+ if (!$loginOk) {
+ Minz_View::appendScript(Minz_Url::display ('/scripts/bcrypt.min.js?' . @filemtime(PUBLIC_PATH . '/scripts/bcrypt.min.js')));
+ }
+ break;
+ case 'persona':
+ Minz_View::appendScript('https://login.persona.org/include.js');
+ break;
+ }
+ $includeLazyLoad = $this->conf->lazyload && ($this->conf->display_posts || Minz_Request::param ('output') === 'reader');
+ Minz_View::appendScript (Minz_Url::display ('/scripts/jquery.min.js?' . @filemtime(PUBLIC_PATH . '/scripts/jquery.min.js')), false, !$includeLazyLoad, !$includeLazyLoad);
+ if ($includeLazyLoad) {
+ Minz_View::appendScript (Minz_Url::display ('/scripts/jquery.lazyload.min.js?' . @filemtime(PUBLIC_PATH . '/scripts/jquery.lazyload.min.js')));
+ }
+ Minz_View::appendScript (Minz_Url::display ('/scripts/shortcut.js?' . @filemtime(PUBLIC_PATH . '/scripts/shortcut.js')));
+ Minz_View::appendScript (Minz_Url::display ('/scripts/main.js?' . @filemtime(PUBLIC_PATH . '/scripts/main.js')));
+ }
+
+ private function loadNotifications () {
+ $notif = Minz_Session::param ('notification');
+ if ($notif) {
+ Minz_View::_param ('notification', $notif);
+ Minz_Session::_param ('notification');
+ }
+ }
+}
diff --git a/app/Models/Category.php b/app/Models/Category.php
new file mode 100644
index 000000000..8e1e44ef8
--- /dev/null
+++ b/app/Models/Category.php
@@ -0,0 +1,85 @@
+<?php
+
+class FreshRSS_Category extends Minz_Model {
+ private $id = 0;
+ private $name;
+ private $color;
+ private $nbFeed = -1;
+ private $nbNotRead = -1;
+ private $feeds = null;
+
+ public function __construct ($name = '', $color = '#0062BE', $feeds = null) {
+ $this->_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 ($this->feeds === null) {
+ $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/CategoryDAO.php b/app/Models/CategoryDAO.php
new file mode 100644
index 000000000..1cc616ac0
--- /dev/null
+++ b/app/Models/CategoryDAO.php
@@ -0,0 +1,251 @@
+<?php
+
+class FreshRSS_CategoryDAO extends Minz_ModelPdo {
+ public function addCategory ($valuesTmp) {
+ $sql = 'INSERT INTO `' . $this->prefix . 'category` (name, color) VALUES(?, ?)';
+ $stm = $this->bd->prepare ($sql);
+
+ $values = array (
+ substr($valuesTmp['name'], 0, 255),
+ substr($valuesTmp['color'], 0, 7),
+ );
+
+ if ($stm && $stm->execute ($values)) {
+ return $this->bd->lastInsertId();
+ } else {
+ $info = $stm->errorInfo();
+ Minz_Log::record ('SQL error : ' . $info[2], Minz_Log::ERROR);
+ return false;
+ }
+ }
+
+ public function updateCategory ($id, $valuesTmp) {
+ $sql = 'UPDATE `' . $this->prefix . 'category` SET name=?, color=? WHERE id=?';
+ $stm = $this->bd->prepare ($sql);
+
+ $values = array (
+ $valuesTmp['name'],
+ $valuesTmp['color'],
+ $id
+ );
+
+ if ($stm && $stm->execute ($values)) {
+ return $stm->rowCount();
+ } else {
+ $info = $stm->errorInfo();
+ Minz_Log::record ('SQL error : ' . $info[2], Minz_Log::ERROR);
+ return false;
+ }
+ }
+
+ public function deleteCategory ($id) {
+ $sql = 'DELETE FROM `' . $this->prefix . 'category` WHERE id=?';
+ $stm = $this->bd->prepare ($sql);
+
+ $values = array ($id);
+
+ if ($stm && $stm->execute ($values)) {
+ return $stm->rowCount();
+ } else {
+ $info = $stm->errorInfo();
+ Minz_Log::record ('SQL error : ' . $info[2], Minz_Log::ERROR);
+ return false;
+ }
+ }
+
+ public function searchById ($id) {
+ $sql = 'SELECT * FROM `' . $this->prefix . 'category` WHERE id=?';
+ $stm = $this->bd->prepare ($sql);
+
+ $values = array ($id);
+
+ $stm->execute ($values);
+ $res = $stm->fetchAll (PDO::FETCH_ASSOC);
+ $cat = self::daoToCategory ($res);
+
+ if (isset ($cat[0])) {
+ return $cat[0];
+ } else {
+ return false;
+ }
+ }
+ public function searchByName ($name) {
+ $sql = 'SELECT * FROM `' . $this->prefix . 'category` WHERE name=?';
+ $stm = $this->bd->prepare ($sql);
+
+ $values = array ($name);
+
+ $stm->execute ($values);
+ $res = $stm->fetchAll (PDO::FETCH_ASSOC);
+ $cat = self::daoToCategory ($res);
+
+ if (isset ($cat[0])) {
+ return $cat[0];
+ } else {
+ return false;
+ }
+ }
+
+ public function listCategories ($prePopulateFeeds = true, $details = false) {
+ if ($prePopulateFeeds) {
+ $sql = 'SELECT c.id AS c_id, c.name AS c_name, '
+ . ($details ? 'c.color AS c_color, ' : '')
+ . ($details ? 'f.* ' : 'f.id, f.name, f.url, f.website, f.priority, f.error, f.cache_nbEntries, f.cache_nbUnreads ')
+ . 'FROM `' . $this->prefix . 'category` c '
+ . 'LEFT OUTER JOIN `' . $this->prefix . 'feed` f ON f.category = c.id '
+ . 'GROUP BY f.id '
+ . 'ORDER BY c.name, f.name';
+ $stm = $this->bd->prepare ($sql);
+ $stm->execute ();
+ 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 self::daoToCategory ($stm->fetchAll (PDO::FETCH_ASSOC));
+ }
+ }
+
+ public function getDefault () {
+ $sql = 'SELECT * FROM `' . $this->prefix . 'category` WHERE id=1';
+ $stm = $this->bd->prepare ($sql);
+
+ $stm->execute ();
+ $res = $stm->fetchAll (PDO::FETCH_ASSOC);
+ $cat = self::daoToCategory ($res);
+
+ if (isset ($cat[0])) {
+ return $cat[0];
+ } else {
+ return false;
+ }
+ }
+ public function checkDefault () {
+ $def_cat = $this->searchById (1);
+
+ if ($def_cat === false) {
+ $cat = new FreshRSS_Category (Minz_Translate::t ('default_category'));
+ $cat->_id (1);
+
+ $values = array (
+ 'id' => $cat->id (),
+ 'name' => $cat->name (),
+ 'color' => $cat->color ()
+ );
+
+ $this->addCategory ($values);
+ }
+ }
+
+ public function count () {
+ $sql = 'SELECT COUNT(*) AS count FROM `' . $this->prefix . 'category`';
+ $stm = $this->bd->prepare ($sql);
+ $stm->execute ();
+ $res = $stm->fetchAll (PDO::FETCH_ASSOC);
+
+ return $res[0]['count'];
+ }
+
+ public function countFeed ($id) {
+ $sql = 'SELECT COUNT(*) AS count FROM `' . $this->prefix . 'feed` WHERE category=?';
+ $stm = $this->bd->prepare ($sql);
+ $values = array ($id);
+ $stm->execute ($values);
+ $res = $stm->fetchAll (PDO::FETCH_ASSOC);
+
+ return $res[0]['count'];
+ }
+
+ public function countNotRead ($id) {
+ $sql = 'SELECT COUNT(*) AS count FROM `' . $this->prefix . 'entry` e INNER JOIN `' . $this->prefix . 'feed` f ON e.id_feed = f.id WHERE category=? AND e.is_read=0';
+ $stm = $this->bd->prepare ($sql);
+ $values = array ($id);
+ $stm->execute ($values);
+ $res = $stm->fetchAll (PDO::FETCH_ASSOC);
+
+ return $res[0]['count'];
+ }
+
+ public static function findFeed($categories, $feed_id) {
+ foreach ($categories as $category) {
+ foreach ($category->feeds () as $feed) {
+ if ($feed->id () === $feed_id) {
+ return $feed;
+ }
+ }
+ }
+ return null;
+ }
+
+ public static function CountUnreads($categories, $minPriority = 0) {
+ $n = 0;
+ foreach ($categories as $category) {
+ foreach ($category->feeds () as $feed) {
+ if ($feed->priority () >= $minPriority) {
+ $n += $feed->nbNotRead();
+ }
+ }
+ }
+ return $n;
+ }
+
+ public static function daoToCategoryPrepopulated ($listDAO) {
+ $list = array ();
+
+ if (!is_array ($listDAO)) {
+ $listDAO = array ($listDAO);
+ }
+
+ $previousLine = null;
+ $feedsDao = array();
+ foreach ($listDAO as $line) {
+ if ($previousLine['c_id'] != null && $line['c_id'] !== $previousLine['c_id']) {
+ // End of the current category, we add it to the $list
+ $cat = new FreshRSS_Category (
+ $previousLine['c_name'],
+ isset($previousLine['c_color']) ? $previousLine['c_color'] : '',
+ FreshRSS_FeedDAO::daoToFeed ($feedsDao, $previousLine['c_id'])
+ );
+ $cat->_id ($previousLine['c_id']);
+ $list[$previousLine['c_id']] = $cat;
+
+ $feedsDao = array(); //Prepare for next category
+ }
+
+ $previousLine = $line;
+ $feedsDao[] = $line;
+ }
+
+ // add the last category
+ if ($previousLine != null) {
+ $cat = new FreshRSS_Category (
+ $previousLine['c_name'],
+ isset($previousLine['c_color']) ? $previousLine['c_color'] : '',
+ FreshRSS_FeedDAO::daoToFeed ($feedsDao, $previousLine['c_id'])
+ );
+ $cat->_id ($previousLine['c_id']);
+ $list[$previousLine['c_id']] = $cat;
+ }
+
+ return $list;
+ }
+
+ public static function daoToCategory ($listDAO) {
+ $list = array ();
+
+ if (!is_array ($listDAO)) {
+ $listDAO = array ($listDAO);
+ }
+
+ foreach ($listDAO as $key => $dao) {
+ $cat = new FreshRSS_Category (
+ $dao['name'],
+ $dao['color']
+ );
+ $cat->_id ($dao['id']);
+ $list[$key] = $cat;
+ }
+
+ return $list;
+ }
+}
diff --git a/app/Models/Configuration.php b/app/Models/Configuration.php
new file mode 100644
index 000000000..2a7fe95aa
--- /dev/null
+++ b/app/Models/Configuration.php
@@ -0,0 +1,247 @@
+<?php
+
+class FreshRSS_Configuration {
+ private $filename;
+
+ private $data = array(
+ 'language' => 'en',
+ 'old_entries' => 3,
+ 'keep_history_default' => 0,
+ 'mail_login' => '',
+ 'token' => '',
+ 'passwordHash' => '', //CRYPT_BLOWFISH
+ 'posts_per_page' => 20,
+ 'view_mode' => 'normal',
+ 'default_view' => 'not_read',
+ 'auto_load_more' => true,
+ 'display_posts' => false,
+ 'onread_jump_next' => true,
+ 'lazyload' => true,
+ 'sort_order' => 'DESC',
+ 'anon_access' => false,
+ 'mark_when' => array(
+ 'article' => true,
+ 'site' => true,
+ 'scroll' => false,
+ 'reception' => false,
+ ),
+ 'theme' => 'Origine',
+ 'shortcuts' => array(
+ 'mark_read' => 'r',
+ 'mark_favorite' => 'f',
+ 'go_website' => 'space',
+ 'next_entry' => 'j',
+ 'prev_entry' => 'k',
+ 'collapse_entry' => 'c',
+ 'load_more' => 'm',
+ 'auto_share' => 's',
+ ),
+ 'topline_read' => true,
+ 'topline_favorite' => true,
+ 'topline_date' => true,
+ 'topline_link' => true,
+ 'bottomline_read' => true,
+ 'bottomline_favorite' => true,
+ 'bottomline_sharing' => true,
+ 'bottomline_tags' => true,
+ 'bottomline_date' => true,
+ 'bottomline_link' => true,
+ 'sharing' => array(
+ 'shaarli' => '',
+ 'wallabag' => '',
+ 'diaspora' => '',
+ 'twitter' => true,
+ 'g+' => true,
+ 'facebook' => true,
+ 'email' => true,
+ 'print' => true,
+ ),
+ );
+
+ private $available_languages = array(
+ 'en' => 'English',
+ 'fr' => 'Français',
+ );
+
+ public function __construct ($user) {
+ $this->filename = DATA_PATH . '/' . $user . '_user.php';
+
+ $data = @include($this->filename);
+ if (!is_array($data)) {
+ throw new Minz_PermissionDeniedException($this->filename);
+ }
+
+ foreach ($data as $key => $value) {
+ if (isset($this->data[$key])) {
+ $function = '_' . $key;
+ $this->$function($value);
+ }
+ }
+ $this->data['user'] = $user;
+ }
+
+ public function save() {
+ @rename($this->filename, $this->filename . '.bak.php');
+ if (file_put_contents($this->filename, "<?php\n return " . var_export($this->data, true) . ';', LOCK_EX) === false) {
+ throw new Minz_PermissionDeniedException($this->filename);
+ }
+ if (function_exists('opcache_invalidate')) {
+ opcache_invalidate($this->filename); //Clear PHP 5.5+ cache for include
+ }
+ invalidateHttpCache();
+ return true;
+ }
+
+ public function __get($name) {
+ if (array_key_exists($name, $this->data)) {
+ return $this->data[$name];
+ } else {
+ $trace = debug_backtrace();
+ trigger_error('Undefined FreshRSS_Configuration->' . $name . 'in ' . $trace[0]['file'] . ' line ' . $trace[0]['line'], E_USER_NOTICE); //TODO: Use Minz exceptions
+ return null;
+ }
+ }
+
+ public function sharing($key = false) {
+ if ($key === false) {
+ return $this->data['sharing'];
+ }
+ if (isset($this->data['sharing'][$key])) {
+ return $this->data['sharing'][$key];
+ }
+ return false;
+ }
+
+ public function availableLanguages() {
+ return $this->available_languages;
+ }
+
+ public function _language($value) {
+ if (!isset($this->available_languages[$value])) {
+ $value = 'en';
+ }
+ $this->data['language'] = $value;
+ }
+ public function _posts_per_page ($value) {
+ $value = intval($value);
+ $this->data['posts_per_page'] = $value > 0 ? $value : 10;
+ }
+ public function _view_mode ($value) {
+ if ($value === 'global' || $value === 'reader') {
+ $this->data['view_mode'] = $value;
+ } else {
+ $this->data['view_mode'] = 'normal';
+ }
+ }
+ public function _default_view ($value) {
+ $this->data['default_view'] = $value === 'all' ? 'all' : 'not_read';
+ }
+ public function _display_posts ($value) {
+ $this->data['display_posts'] = ((bool)$value) && $value !== 'no';
+ }
+ public function _onread_jump_next ($value) {
+ $this->data['onread_jump_next'] = ((bool)$value) && $value !== 'no';
+ }
+ public function _lazyload ($value) {
+ $this->data['lazyload'] = ((bool)$value) && $value !== 'no';
+ }
+ public function _sort_order ($value) {
+ $this->data['sort_order'] = $value === 'ASC' ? 'ASC' : 'DESC';
+ }
+ public function _old_entries($value) {
+ $value = intval($value);
+ $this->data['old_entries'] = $value > 0 ? $value : 3;
+ }
+ public function _keep_history_default($value) {
+ $value = intval($value);
+ $this->data['keep_history_default'] = $value >= -1 ? $value : 0;
+ }
+ public function _shortcuts ($values) {
+ foreach ($values as $key => $value) {
+ if (isset($this->data['shortcuts'][$key])) {
+ $this->data['shortcuts'][$key] = $value;
+ }
+ }
+ }
+ public function _passwordHash ($value) {
+ $this->data['passwordHash'] = ctype_graph($value) && (strlen($value) >= 60) ? $value : '';
+ }
+ public function _mail_login ($value) {
+ $value = filter_var($value, FILTER_VALIDATE_EMAIL);
+ if ($value) {
+ $this->data['mail_login'] = $value;
+ } else {
+ $this->data['mail_login'] = '';
+ }
+ }
+ public function _anon_access ($value) {
+ $this->data['anon_access'] = ((bool)$value) && $value !== 'no';
+ }
+ public function _mark_when ($values) {
+ foreach ($values as $key => $value) {
+ if (isset($this->data['mark_when'][$key])) {
+ $this->data['mark_when'][$key] = ((bool)$value) && $value !== 'no';
+ }
+ }
+ }
+ public function _sharing ($values) {
+ $are_url = array ('shaarli', 'wallabag', 'diaspora');
+ foreach ($values as $key => $value) {
+ if (in_array($key, $are_url)) {
+ $is_url = (
+ filter_var ($value, FILTER_VALIDATE_URL) ||
+ (version_compare(PHP_VERSION, '5.3.3', '<') &&
+ (strpos($value, '-') > 0) &&
+ ($value === filter_var($value, FILTER_SANITIZE_URL)))
+ ); //PHP bug #51192
+
+ if (!$is_url) {
+ $value = '';
+ }
+ } elseif (!is_bool($value)) {
+ $value = true;
+ }
+
+ $this->data['sharing'][$key] = $value;
+ }
+ }
+ public function _theme($value) {
+ $this->data['theme'] = $value;
+ }
+ public function _token($value) {
+ $this->data['token'] = $value;
+ }
+ public function _auto_load_more($value) {
+ $this->data['auto_load_more'] = ((bool)$value) && $value !== 'no';
+ }
+ public function _topline_read($value) {
+ $this->data['topline_read'] = ((bool)$value) && $value !== 'no';
+ }
+ public function _topline_favorite($value) {
+ $this->data['topline_favorite'] = ((bool)$value) && $value !== 'no';
+ }
+ public function _topline_date($value) {
+ $this->data['topline_date'] = ((bool)$value) && $value !== 'no';
+ }
+ public function _topline_link($value) {
+ $this->data['topline_link'] = ((bool)$value) && $value !== 'no';
+ }
+ public function _bottomline_read($value) {
+ $this->data['bottomline_read'] = ((bool)$value) && $value !== 'no';
+ }
+ public function _bottomline_favorite($value) {
+ $this->data['bottomline_favorite'] = ((bool)$value) && $value !== 'no';
+ }
+ public function _bottomline_sharing($value) {
+ $this->data['bottomline_sharing'] = ((bool)$value) && $value !== 'no';
+ }
+ public function _bottomline_tags($value) {
+ $this->data['bottomline_tags'] = ((bool)$value) && $value !== 'no';
+ }
+ public function _bottomline_date($value) {
+ $this->data['bottomline_date'] = ((bool)$value) && $value !== 'no';
+ }
+ public function _bottomline_link($value) {
+ $this->data['bottomline_link'] = ((bool)$value) && $value !== 'no';
+ }
+}
diff --git a/app/models/Days.php b/app/Models/Days.php
index a859cbace..2d770c30b 100644
--- a/app/models/Days.php
+++ b/app/Models/Days.php
@@ -1,6 +1,6 @@
<?php
-class Days {
+class FreshRSS_Days {
const TODAY = 0;
const YESTERDAY = 1;
const BEFORE_YESTERDAY = 2;
diff --git a/app/Models/Entry.php b/app/Models/Entry.php
new file mode 100644
index 000000000..a6c67221b
--- /dev/null
+++ b/app/Models/Entry.php
@@ -0,0 +1,186 @@
+<?php
+
+class FreshRSS_Entry extends Minz_Model {
+
+ private $id = 0;
+ private $guid;
+ private $title;
+ private $author;
+ private $content;
+ private $link;
+ private $date;
+ private $is_read;
+ private $is_favorite;
+ private $feed;
+ private $tags;
+
+ public function __construct ($feed = '', $guid = '', $title = '', $author = '', $content = '',
+ $link = '', $pubdate = 0, $is_read = false, $is_favorite = false, $tags = '') {
+ $this->_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 () {
+ return $this->author === null ? '' : $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) {
+ $value = intval($value);
+ $this->date = $value > 1 ? $value : 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, $today) {
+ $date = $this->dateAdded(true);
+ 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;
+ }
+ }
+
+ 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(
+ htmlspecialchars_decode($this->link(), ENT_QUOTES), $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/EntryDAO.php b/app/Models/EntryDAO.php
new file mode 100644
index 000000000..aaf4dcf6a
--- /dev/null
+++ b/app/Models/EntryDAO.php
@@ -0,0 +1,472 @@
+<?php
+
+class FreshRSS_EntryDAO extends Minz_ModelPdo {
+ public function addEntry ($valuesTmp) {
+ $sql = 'INSERT INTO `' . $this->prefix . 'entry`(id, guid, title, author, content_bin, link, date, is_read, is_favorite, id_feed, tags) '
+ . 'VALUES(?, ?, ?, ?, COMPRESS(?), ?, ?, ?, ?, ?, ?)';
+ $stm = $this->bd->prepare ($sql);
+
+ $values = array (
+ $valuesTmp['id'],
+ substr($valuesTmp['guid'], 0, 760),
+ substr($valuesTmp['title'], 0, 255),
+ substr($valuesTmp['author'], 0, 255),
+ $valuesTmp['content'],
+ substr($valuesTmp['link'], 0, 1023),
+ $valuesTmp['date'],
+ $valuesTmp['is_read'] ? 1 : 0,
+ $valuesTmp['is_favorite'] ? 1 : 0,
+ $valuesTmp['id_feed'],
+ substr($valuesTmp['tags'], 0, 1023),
+ );
+
+ if ($stm && $stm->execute ($values)) {
+ return $this->bd->lastInsertId();
+ } else {
+ $info = $stm->errorInfo();
+ if ((int)($info[0] / 1000) !== 23) { //Filter out "SQLSTATE Class code 23: Constraint Violation" because of expected duplicate entries
+ Minz_Log::record ('SQL error ' . $info[0] . ': ' . $info[1] . ' ' . $info[2]
+ . ' while adding entry in feed ' . $valuesTmp['id_feed'] . ' with title: ' . $valuesTmp['title'], Minz_Log::ERROR);
+ } /*else {
+ Minz_Log::record ('SQL error ' . $info[0] . ': ' . $info[1] . ' ' . $info[2]
+ . ' while adding entry in feed ' . $valuesTmp['id_feed'] . ' with title: ' . $valuesTmp['title'], Minz_Log::DEBUG);
+ }*/
+ return false;
+ }
+ }
+
+ public function markFavorite ($id, $is_favorite = true) {
+ $sql = 'UPDATE `' . $this->prefix . 'entry` e '
+ . 'SET e.is_favorite = ? '
+ . 'WHERE e.id=?';
+ $values = array ($is_favorite ? 1 : 0, $id);
+ $stm = $this->bd->prepare ($sql);
+ if ($stm && $stm->execute ($values)) {
+ return $stm->rowCount();
+ } else {
+ $info = $stm->errorInfo();
+ Minz_Log::record ('SQL error : ' . $info[2], Minz_Log::ERROR);
+ return false;
+ }
+ }
+ public function markRead ($id, $is_read = true) {
+ $sql = 'UPDATE `' . $this->prefix . 'entry` e INNER JOIN `' . $this->prefix . 'feed` f ON e.id_feed = f.id '
+ . 'SET e.is_read = ?,'
+ . 'f.cache_nbUnreads=f.cache_nbUnreads' . ($is_read ? '-' : '+') . '1 '
+ . 'WHERE e.id=?';
+ $values = array ($is_read ? 1 : 0, $id);
+ $stm = $this->bd->prepare ($sql);
+ if ($stm && $stm->execute ($values)) {
+ return $stm->rowCount();
+ } else {
+ $info = $stm->errorInfo();
+ Minz_Log::record ('SQL error : ' . $info[2], Minz_Log::ERROR);
+ return false;
+ }
+ }
+ public function markReadEntries ($idMax = 0, $favorites = false) {
+ if ($idMax === 0) {
+ $sql = 'UPDATE `' . $this->prefix . 'entry` e INNER JOIN `' . $this->prefix . 'feed` f ON e.id_feed = f.id '
+ . 'SET e.is_read = 1, f.cache_nbUnreads=0 '
+ . 'WHERE e.is_read = 0 AND ';
+ if ($favorites) {
+ $sql .= 'e.is_favorite = 1';
+ } else {
+ $sql .= 'f.priority > 0';
+ }
+ $stm = $this->bd->prepare ($sql);
+ if ($stm && $stm->execute ()) {
+ return $stm->rowCount();
+ } else {
+ $info = $stm->errorInfo();
+ Minz_Log::record ('SQL error : ' . $info[2], Minz_Log::ERROR);
+ return false;
+ }
+ } else {
+ $this->bd->beginTransaction ();
+
+ $sql = 'UPDATE `' . $this->prefix . 'entry` e INNER JOIN `' . $this->prefix . 'feed` f ON e.id_feed = f.id '
+ . 'SET e.is_read = 1 '
+ . 'WHERE e.is_read = 0 AND e.id <= ? AND ';
+ if ($favorites) {
+ $sql .= 'e.is_favorite = 1';
+ } else {
+ $sql .= 'f.priority > 0';
+ }
+ $values = array ($idMax);
+ $stm = $this->bd->prepare ($sql);
+ if (!($stm && $stm->execute ($values))) {
+ $info = $stm->errorInfo();
+ Minz_Log::record ('SQL error : ' . $info[2], Minz_Log::ERROR);
+ $this->bd->rollBack ();
+ return false;
+ }
+ $affected = $stm->rowCount();
+
+ if ($affected > 0) {
+ $sql = 'UPDATE `' . $this->prefix . 'feed` f '
+ . 'LEFT OUTER JOIN ('
+ . 'SELECT e.id_feed, '
+ . 'COUNT(*) AS nbUnreads '
+ . 'FROM `' . $this->prefix . 'entry` e '
+ . 'WHERE e.is_read = 0 '
+ . 'GROUP BY e.id_feed'
+ . ') x ON x.id_feed=f.id '
+ . 'SET f.cache_nbUnreads=COALESCE(x.nbUnreads, 0)';
+ $stm = $this->bd->prepare ($sql);
+ if (!($stm && $stm->execute ())) {
+ $info = $stm->errorInfo();
+ Minz_Log::record ('SQL error : ' . $info[2], Minz_Log::ERROR);
+ $this->bd->rollBack ();
+ return false;
+ }
+ }
+
+ $this->bd->commit ();
+ return $affected;
+ }
+ }
+ public function markReadCat ($id, $idMax = 0) {
+ if ($idMax === 0) {
+ $sql = 'UPDATE `' . $this->prefix . 'entry` e INNER JOIN `' . $this->prefix . 'feed` f ON e.id_feed = f.id '
+ . 'SET e.is_read = 1, f.cache_nbUnreads=0 '
+ . 'WHERE f.category = ? AND e.is_read = 0';
+ $values = array ($id);
+ $stm = $this->bd->prepare ($sql);
+ if ($stm && $stm->execute ($values)) {
+ return $stm->rowCount();
+ } else {
+ $info = $stm->errorInfo();
+ Minz_Log::record ('SQL error : ' . $info[2], Minz_Log::ERROR);
+ return false;
+ }
+ } else {
+ $this->bd->beginTransaction ();
+
+ $sql = 'UPDATE `' . $this->prefix . 'entry` e INNER JOIN `' . $this->prefix . 'feed` f ON e.id_feed = f.id '
+ . 'SET e.is_read = 1 '
+ . 'WHERE f.category = ? AND e.is_read = 0 AND e.id <= ?';
+ $values = array ($id, $idMax);
+ $stm = $this->bd->prepare ($sql);
+ if (!($stm && $stm->execute ($values))) {
+ $info = $stm->errorInfo();
+ Minz_Log::record ('SQL error : ' . $info[2], Minz_Log::ERROR);
+ $this->bd->rollBack ();
+ return false;
+ }
+ $affected = $stm->rowCount();
+
+ if ($affected > 0) {
+ $sql = 'UPDATE `' . $this->prefix . 'feed` f '
+ . 'LEFT OUTER JOIN ('
+ . 'SELECT e.id_feed, '
+ . 'COUNT(*) AS nbUnreads '
+ . 'FROM `' . $this->prefix . 'entry` e '
+ . 'WHERE e.is_read = 0 '
+ . 'GROUP BY e.id_feed'
+ . ') x ON x.id_feed=f.id '
+ . 'SET f.cache_nbUnreads=COALESCE(x.nbUnreads, 0) '
+ . 'WHERE f.category = ?';
+ $values = array ($id);
+ $stm = $this->bd->prepare ($sql);
+ if (!($stm && $stm->execute ($values))) {
+ $info = $stm->errorInfo();
+ Minz_Log::record ('SQL error : ' . $info[2], Minz_Log::ERROR);
+ $this->bd->rollBack ();
+ return false;
+ }
+ }
+
+ $this->bd->commit ();
+ return $affected;
+ }
+ }
+ public function markReadFeed ($id, $idMax = 0) {
+ if ($idMax === 0) {
+ $sql = 'UPDATE `' . $this->prefix . 'entry` e INNER JOIN `' . $this->prefix . 'feed` f ON e.id_feed = f.id '
+ . 'SET e.is_read = 1, f.cache_nbUnreads=0 '
+ . 'WHERE f.id=? AND e.is_read = 0';
+ $values = array ($id);
+ $stm = $this->bd->prepare ($sql);
+ if ($stm && $stm->execute ($values)) {
+ return $stm->rowCount();
+ } else {
+ $info = $stm->errorInfo();
+ Minz_Log::record ('SQL error : ' . $info[2], Minz_Log::ERROR);
+ return false;
+ }
+ } else {
+ $this->bd->beginTransaction ();
+
+ $sql = 'UPDATE `' . $this->prefix . 'entry` e INNER JOIN `' . $this->prefix . 'feed` f ON e.id_feed = f.id '
+ . 'SET e.is_read = 1 '
+ . 'WHERE f.id=? AND e.is_read = 0 AND e.id <= ?';
+ $values = array ($id, $idMax);
+ $stm = $this->bd->prepare ($sql);
+ if (!($stm && $stm->execute ($values))) {
+ $info = $stm->errorInfo();
+ Minz_Log::record ('SQL error : ' . $info[2], Minz_Log::ERROR);
+ $this->bd->rollBack ();
+ return false;
+ }
+ $affected = $stm->rowCount();
+
+ if ($affected > 0) {
+ $sql = 'UPDATE `' . $this->prefix . 'feed` f '
+ . 'SET f.cache_nbUnreads=f.cache_nbUnreads-' . $affected
+ . ' WHERE f.id=?';
+ $values = array ($id);
+ $stm = $this->bd->prepare ($sql);
+ if (!($stm && $stm->execute ($values))) {
+ $info = $stm->errorInfo();
+ Minz_Log::record ('SQL error : ' . $info[2], Minz_Log::ERROR);
+ $this->bd->rollBack ();
+ return false;
+ }
+ }
+
+ $this->bd->commit ();
+ return $affected;
+ }
+ }
+
+ public function searchByGuid ($feed_id, $id) {
+ // un guid est unique pour un flux donné
+ $sql = 'SELECT id, guid, title, author, UNCOMPRESS(content_bin) AS content, link, date, is_read, is_favorite, id_feed, tags '
+ . 'FROM `' . $this->prefix . 'entry` WHERE id_feed=? AND guid=?';
+ $stm = $this->bd->prepare ($sql);
+
+ $values = array (
+ $feed_id,
+ $id
+ );
+
+ $stm->execute ($values);
+ $res = $stm->fetchAll (PDO::FETCH_ASSOC);
+ $entries = self::daoToEntry ($res);
+ return isset ($entries[0]) ? $entries[0] : false;
+ }
+
+ public function searchById ($id) {
+ $sql = 'SELECT id, guid, title, author, UNCOMPRESS(content_bin) AS content, link, date, is_read, is_favorite, id_feed, tags '
+ . 'FROM `' . $this->prefix . 'entry` WHERE id=?';
+ $stm = $this->bd->prepare ($sql);
+
+ $values = array ($id);
+
+ $stm->execute ($values);
+ $res = $stm->fetchAll (PDO::FETCH_ASSOC);
+ $entries = self::daoToEntry ($res);
+ return isset ($entries[0]) ? $entries[0] : false;
+ }
+
+ public function listWhere($type = 'a', $id = '', $state = 'all', $order = 'DESC', $limit = 1, $firstId = '', $filter = '', $date_min = 0, $keepHistoryDefault = 0) {
+ $where = '';
+ $joinFeed = false;
+ $values = array();
+ switch ($type) {
+ case 'a':
+ $where .= 'f.priority > 0 ';
+ $joinFeed = true;
+ break;
+ case 's':
+ $where .= 'e1.is_favorite = 1 ';
+ break;
+ case 'c':
+ $where .= 'f.category = ? ';
+ $values[] = intval($id);
+ $joinFeed = true;
+ break;
+ case 'f':
+ $where .= 'e1.id_feed = ? ';
+ $values[] = intval($id);
+ break;
+ default:
+ throw new FreshRSS_EntriesGetter_Exception ('Bad type in Entry->listByType: [' . $type . ']!');
+ }
+ switch ($state) {
+ case 'all':
+ break;
+ case 'not_read':
+ $where .= 'AND e1.is_read = 0 ';
+ break;
+ case 'read':
+ $where .= 'AND e1.is_read = 1 ';
+ break;
+ case 'favorite':
+ $where .= 'AND e1.is_favorite = 1 ';
+ break;
+ default:
+ throw new FreshRSS_EntriesGetter_Exception ('Bad state in Entry->listByType: [' . $state . ']!');
+ }
+ switch ($order) {
+ case 'DESC':
+ case 'ASC':
+ break;
+ default:
+ throw new FreshRSS_EntriesGetter_Exception ('Bad order in Entry->listByType: [' . $order . ']!');
+ }
+ if ($firstId !== '') {
+ $where .= 'AND e1.id ' . ($order === 'DESC' ? '<=' : '>=') . $firstId . ' ';
+ }
+ if (($date_min > 0) && ($type !== 's')) {
+ $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
+ }
+ $where .= ')) ';
+ $joinFeed = true;
+ }
+ $search = '';
+ 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 ($intitle) {
+ $search .= 'AND e1.title LIKE ? ';
+ $values[] = '%' . $word .'%';
+ } 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 .'%';
+ }
+ }
+ }
+ }
+ }
+
+ $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 (SELECT e1.id FROM `' . $this->prefix . 'entry` e1 '
+ . ($joinFeed ? 'INNER JOIN `' . $this->prefix . 'feed` f ON e1.id_feed = f.id ' : '')
+ . 'WHERE ' . $where
+ . $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 '
+ . 'ORDER BY e.id ' . $order;
+
+ $stm = $this->bd->prepare ($sql);
+ $stm->execute ($values);
+
+ return self::daoToEntry ($stm->fetchAll (PDO::FETCH_ASSOC));
+ }
+
+ public function listLastGuidsByFeed($id, $n) {
+ $sql = 'SELECT guid FROM `' . $this->prefix . 'entry` WHERE id_feed=? ORDER BY id DESC LIMIT ' . intval($n);
+ $stm = $this->bd->prepare ($sql);
+ $values = array ($id);
+ $stm->execute ($values);
+ return $stm->fetchAll (PDO::FETCH_COLUMN, 0);
+ }
+
+ public function countUnreadRead () {
+ $sql = 'SELECT COUNT(e.id) AS count FROM `' . $this->prefix . 'entry` e INNER JOIN `' . $this->prefix . 'feed` f ON e.id_feed = f.id WHERE priority > 0'
+ . ' UNION SELECT COUNT(e.id) AS count FROM `' . $this->prefix . 'entry` e INNER JOIN `' . $this->prefix . 'feed` f ON e.id_feed = f.id WHERE priority > 0 AND is_read = 0';
+ $stm = $this->bd->prepare ($sql);
+ $stm->execute ();
+ $res = $stm->fetchAll (PDO::FETCH_COLUMN, 0);
+ $all = empty($res[0]) ? 0 : $res[0];
+ $unread = empty($res[1]) ? 0 : $res[1];
+ return array('all' => $all, 'unread' => $unread, 'read' => $all - $unread);
+ }
+ public function count ($minPriority = null) {
+ $sql = 'SELECT COUNT(e.id) AS count FROM `' . $this->prefix . 'entry` e INNER JOIN `' . $this->prefix . 'feed` f ON e.id_feed = f.id';
+ if ($minPriority !== null) {
+ $sql = ' WHERE priority > ' . intval($minPriority);
+ }
+ $stm = $this->bd->prepare ($sql);
+ $stm->execute ();
+ $res = $stm->fetchAll (PDO::FETCH_COLUMN, 0);
+ return $res[0];
+ }
+ public function countNotRead ($minPriority = null) {
+ $sql = 'SELECT COUNT(e.id) AS count FROM `' . $this->prefix . 'entry` e INNER JOIN `' . $this->prefix . 'feed` f ON e.id_feed = f.id WHERE is_read = 0';
+ if ($minPriority !== null) {
+ $sql = ' AND priority > ' . intval($minPriority);
+ }
+ $stm = $this->bd->prepare ($sql);
+ $stm->execute ();
+ $res = $stm->fetchAll (PDO::FETCH_COLUMN, 0);
+ return $res[0];
+ }
+
+ public function countUnreadReadFavorites () {
+ $sql = 'SELECT COUNT(id) FROM `' . $this->prefix . 'entry` WHERE is_favorite=1'
+ . ' UNION SELECT COUNT(id) FROM `' . $this->prefix . 'entry` WHERE is_favorite=1 AND is_read = 0';
+ $stm = $this->bd->prepare ($sql);
+ $stm->execute ();
+ $res = $stm->fetchAll (PDO::FETCH_COLUMN, 0);
+ $all = empty($res[0]) ? 0 : $res[0];
+ $unread = empty($res[1]) ? 0 : $res[1];
+ return array('all' => $all, 'unread' => $unread, 'read' => $all - $unread);
+ }
+
+ public function optimizeTable() {
+ $sql = 'OPTIMIZE TABLE `' . $this->prefix . 'entry`';
+ $stm = $this->bd->prepare ($sql);
+ $stm->execute ();
+ }
+
+ public static function daoToEntry ($listDAO) {
+ $list = array ();
+
+ if (!is_array ($listDAO)) {
+ $listDAO = array ($listDAO);
+ }
+
+ foreach ($listDAO as $key => $dao) {
+ $entry = new FreshRSS_Entry (
+ $dao['id_feed'],
+ $dao['guid'],
+ $dao['title'],
+ $dao['author'],
+ $dao['content'],
+ $dao['link'],
+ $dao['date'],
+ $dao['is_read'],
+ $dao['is_favorite'],
+ $dao['tags']
+ );
+ if (isset ($dao['id'])) {
+ $entry->_id ($dao['id']);
+ }
+ $list[] = $entry;
+ }
+
+ unset ($listDAO);
+
+ return $list;
+ }
+}
diff --git a/app/Models/Feed.php b/app/Models/Feed.php
new file mode 100644
index 000000000..22c019080
--- /dev/null
+++ b/app/Models/Feed.php
@@ -0,0 +1,274 @@
+<?php
+
+class FreshRSS_Feed extends Minz_Model {
+ private $id = 0;
+ private $url;
+ private $category = 1;
+ private $nbEntries = -1;
+ private $nbNotRead = -1;
+ private $entries = null;
+ private $name = '';
+ private $website = '';
+ private $description = '';
+ private $lastUpdate = 0;
+ private $priority = 10;
+ private $pathEntries = '';
+ private $httpAuth = '';
+ private $error = false;
+ private $keep_history = -2;
+ private $hash = null;
+
+ public function __construct ($url, $validate=true) {
+ if ($validate) {
+ $this->_url ($url);
+ } else {
+ $this->url = $url;
+ }
+ }
+
+ public function id () {
+ return $this->id;
+ }
+
+ public function hash() {
+ if ($this->hash === null) {
+ $this->hash = hash('crc32b', Minz_Configuration::salt() . $this->url);
+ }
+ return $this->hash;
+ }
+
+ public function url () {
+ return $this->url;
+ }
+ public function category () {
+ return $this->category;
+ }
+ public function entries () {
+ return $this->entries === null ? array() : $this->entries;
+ }
+ 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->hash() . '.txt';
+ if (!file_exists ($file)) {
+ $t = $this->website;
+ if (empty($t)) {
+ $t = $this->url;
+ }
+ file_put_contents($file, $t);
+ }
+ }
+ public static function faviconDelete($hash) {
+ $path = DATA_PATH . '/favicons/' . $hash;
+ @unlink($path . '.ico');
+ @unlink($path . '.txt');
+ }
+ public function favicon () {
+ return Minz_Url::display ('/f.php?' . $this->hash());
+ }
+
+ 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) {
+ $value = intval($value);
+ $this->category = $value >= 0 ? $value : 0;
+ }
+ public function _name ($value) {
+ $this->name = $value === null ? '' : $value;
+ }
+ public function _website ($value, $validate=true) {
+ if ($validate) {
+ $value = checkUrl($value);
+ }
+ if (empty ($value)) {
+ $value = '';
+ }
+ $this->website = $value;
+ }
+ public function _description ($value) {
+ $this->description = $value === null ? '' : $value;
+ }
+ public function _lastUpdate ($value) {
+ $this->lastUpdate = $value;
+ }
+ public function _priority ($value) {
+ $value = intval($value);
+ $this->priority = $value >= 0 ? $value : 10;
+ }
+ public function _pathEntries ($value) {
+ $this->pathEntries = $value;
+ }
+ public function _httpAuth ($value) {
+ $this->httpAuth = $value;
+ }
+ public function _error ($value) {
+ $this->error = (bool)$value;
+ }
+ public function _keepHistory ($value) {
+ $value = intval($value);
+ $value = min($value, 1000000);
+ $value = max($value, -2);
+ $this->keep_history = $value;
+ }
+ public function _nbNotRead ($value) {
+ $this->nbNotRead = intval($value);
+ }
+ public function _nbEntries ($value) {
+ $this->nbEntries = intval($value);
+ }
+
+ public function load ($loadDetails = false) {
+ if ($this->url !== null) {
+ if (CACHE_PATH === false) {
+ throw new Minz_FileNotExistException (
+ 'CACHE_PATH',
+ Minz_Exception::ERROR
+ );
+ } else {
+ $url = htmlspecialchars_decode ($this->url, ENT_QUOTES);
+ if ($this->httpAuth != '') {
+ $url = preg_replace ('#((.+)://)(.+)#', '${1}' . $this->httpAuth . '@${3}', $url);
+ }
+ $feed = customSimplePie();
+ $feed->set_feed_url ($url);
+ $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 ($subscribe_url !== null && $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);
+ }
+
+ if ($loadDetails) {
+ $title = htmlspecialchars(html_only_entity_decode($feed->get_title()), ENT_COMPAT, 'UTF-8');
+ $this->_name ($title === null ? $this->url : $title);
+
+ $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);
+ }
+ }
+ }
+ 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 ($tags_tmp !== null) {
+ 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 .= '<br /><img src="' . $elink . '" alt="" />';
+ }
+ }
+
+ $entry = new FreshRSS_Entry (
+ $this->id (),
+ $item->get_id (),
+ $title === null ? '' : $title,
+ $author === null ? '' : html_only_entity_decode ($author->name),
+ $content === null ? '' : $content,
+ $link === null ? '' : $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/app/Models/FeedDAO.php b/app/Models/FeedDAO.php
new file mode 100644
index 000000000..e102da4ec
--- /dev/null
+++ b/app/Models/FeedDAO.php
@@ -0,0 +1,345 @@
+<?php
+
+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, -2)';
+ $stm = $this->bd->prepare ($sql);
+
+ $values = array (
+ substr($valuesTmp['url'], 0, 511),
+ $valuesTmp['category'],
+ substr($valuesTmp['name'], 0, 255),
+ substr($valuesTmp['website'], 0, 255),
+ substr($valuesTmp['description'], 0, 1023),
+ $valuesTmp['lastUpdate'],
+ base64_encode ($valuesTmp['httpAuth']),
+ );
+
+ if ($stm && $stm->execute ($values)) {
+ return $this->bd->lastInsertId();
+ } else {
+ $info = $stm->errorInfo();
+ Minz_Log::record ('SQL error : ' . $info[2], Minz_Log::ERROR);
+ return false;
+ }
+ }
+
+ public function updateFeed ($id, $valuesTmp) {
+ $set = '';
+ foreach ($valuesTmp as $key => $v) {
+ $set .= $key . '=?, ';
+
+ if ($key == 'httpAuth') {
+ $valuesTmp[$key] = base64_encode ($v);
+ }
+ }
+ $set = substr ($set, 0, -2);
+
+ $sql = 'UPDATE `' . $this->prefix . 'feed` SET ' . $set . ' WHERE id=?';
+ $stm = $this->bd->prepare ($sql);
+
+ foreach ($valuesTmp as $v) {
+ $values[] = $v;
+ }
+ $values[] = $id;
+
+ if ($stm && $stm->execute ($values)) {
+ return $stm->rowCount();
+ } else {
+ $info = $stm->errorInfo();
+ Minz_Log::record ('SQL error : ' . $info[2], Minz_Log::ERROR);
+ return false;
+ }
+ }
+
+ public function updateLastUpdate ($id, $inError = 0) {
+ $sql = 'UPDATE `' . $this->prefix . 'feed` f ' //2 sub-requests with FOREIGN KEY(e.id_feed), INDEX(e.is_read) faster than 1 request with GROUP BY or CASE
+ . 'SET f.cache_nbEntries=(SELECT COUNT(e1.id) FROM `' . $this->prefix . 'entry` e1 WHERE e1.id_feed=f.id),'
+ . 'f.cache_nbUnreads=(SELECT COUNT(e2.id) FROM `' . $this->prefix . 'entry` e2 WHERE e2.id_feed=f.id AND e2.is_read=0),'
+ . 'lastUpdate=?, error=? '
+ . 'WHERE f.id=?';
+
+ $stm = $this->bd->prepare ($sql);
+
+ $values = array (
+ time (),
+ $inError,
+ $id,
+ );
+
+ if ($stm && $stm->execute ($values)) {
+ return $stm->rowCount();
+ } else {
+ $info = $stm->errorInfo();
+ Minz_Log::record ('SQL error : ' . $info[2], Minz_Log::ERROR);
+ return false;
+ }
+ }
+
+ public function changeCategory ($idOldCat, $idNewCat) {
+ $catDAO = new FreshRSS_CategoryDAO ();
+ $newCat = $catDAO->searchById ($idNewCat);
+ if (!$newCat) {
+ $newCat = $catDAO->getDefault ();
+ }
+
+ $sql = 'UPDATE `' . $this->prefix . 'feed` SET category=? WHERE category=?';
+ $stm = $this->bd->prepare ($sql);
+
+ $values = array (
+ $newCat->id (),
+ $idOldCat
+ );
+
+ if ($stm && $stm->execute ($values)) {
+ return $stm->rowCount();
+ } else {
+ $info = $stm->errorInfo();
+ Minz_Log::record ('SQL error : ' . $info[2], Minz_Log::ERROR);
+ return false;
+ }
+ }
+
+ public function deleteFeed ($id) {
+ /*//For MYISAM (MySQL 5.5-) without FOREIGN KEY
+ $sql = 'DELETE FROM `' . $this->prefix . 'entry` WHERE id_feed=?';
+ $stm = $this->bd->prepare ($sql);
+ $values = array ($id);
+ if (!($stm && $stm->execute ($values))) {
+ $info = $stm->errorInfo();
+ Minz_Log::record ('SQL error : ' . $info[2], Minz_Log::ERROR);
+ return false;
+ }*/
+
+ $sql = 'DELETE FROM `' . $this->prefix . 'feed` WHERE id=?';
+ $stm = $this->bd->prepare ($sql);
+
+ $values = array ($id);
+
+ if ($stm && $stm->execute ($values)) {
+ return $stm->rowCount();
+ } else {
+ $info = $stm->errorInfo();
+ Minz_Log::record ('SQL error : ' . $info[2], Minz_Log::ERROR);
+ return false;
+ }
+ }
+ public function deleteFeedByCategory ($id) {
+ /*//For MYISAM (MySQL 5.5-) without FOREIGN KEY
+ $sql = 'DELETE FROM `' . $this->prefix . 'entry` e '
+ . 'INNER JOIN `' . $this->prefix . 'feed` f ON e.id_feed = f.id '
+ . 'WHERE f.category=?';
+ $stm = $this->bd->prepare ($sql);
+ $values = array ($id);
+ if (!($stm && $stm->execute ($values))) {
+ $info = $stm->errorInfo();
+ Minz_Log::record ('SQL error : ' . $info[2], Minz_Log::ERROR);
+ return false;
+ }*/
+
+ $sql = 'DELETE FROM `' . $this->prefix . 'feed` WHERE category=?';
+ $stm = $this->bd->prepare ($sql);
+
+ $values = array ($id);
+
+ if ($stm && $stm->execute ($values)) {
+ return $stm->rowCount();
+ } else {
+ $info = $stm->errorInfo();
+ Minz_Log::record ('SQL error : ' . $info[2], Minz_Log::ERROR);
+ return false;
+ }
+ }
+
+ public function searchById ($id) {
+ $sql = 'SELECT * FROM `' . $this->prefix . 'feed` WHERE id=?';
+ $stm = $this->bd->prepare ($sql);
+
+ $values = array ($id);
+
+ $stm->execute ($values);
+ $res = $stm->fetchAll (PDO::FETCH_ASSOC);
+ $feed = self::daoToFeed ($res);
+
+ if (isset ($feed[$id])) {
+ return $feed[$id];
+ } else {
+ return false;
+ }
+ }
+ public function searchByUrl ($url) {
+ $sql = 'SELECT * FROM `' . $this->prefix . 'feed` WHERE url=?';
+ $stm = $this->bd->prepare ($sql);
+
+ $values = array ($url);
+
+ $stm->execute ($values);
+ $res = $stm->fetchAll (PDO::FETCH_ASSOC);
+ $feed = current (self::daoToFeed ($res));
+
+ if (isset ($feed)) {
+ return $feed;
+ } else {
+ return false;
+ }
+ }
+
+ public function listFeeds () {
+ $sql = 'SELECT * FROM `' . $this->prefix . 'feed` ORDER BY name';
+ $stm = $this->bd->prepare ($sql);
+ $stm->execute ();
+
+ return self::daoToFeed ($stm->fetchAll (PDO::FETCH_ASSOC));
+ }
+
+ public function listFeedsOrderUpdate () {
+ $sql = 'SELECT id, name, url, pathEntries, httpAuth, keep_history FROM `' . $this->prefix . 'feed` ORDER BY lastUpdate';
+ $stm = $this->bd->prepare ($sql);
+ $stm->execute ();
+
+ return self::daoToFeed ($stm->fetchAll (PDO::FETCH_ASSOC));
+ }
+
+ public function listByCategory ($cat) {
+ $sql = 'SELECT * FROM `' . $this->prefix . 'feed` WHERE category=? ORDER BY name';
+ $stm = $this->bd->prepare ($sql);
+
+ $values = array ($cat);
+
+ $stm->execute ($values);
+
+ return self::daoToFeed ($stm->fetchAll (PDO::FETCH_ASSOC));
+ }
+
+ public function countEntries ($id) {
+ $sql = 'SELECT COUNT(*) AS count FROM `' . $this->prefix . 'entry` WHERE id_feed=?';
+ $stm = $this->bd->prepare ($sql);
+ $values = array ($id);
+ $stm->execute ($values);
+ $res = $stm->fetchAll (PDO::FETCH_ASSOC);
+
+ return $res[0]['count'];
+ }
+ public function countNotRead ($id) {
+ $sql = 'SELECT COUNT(*) AS count FROM `' . $this->prefix . 'entry` WHERE id_feed=? AND is_read=0';
+ $stm = $this->bd->prepare ($sql);
+ $values = array ($id);
+ $stm->execute ($values);
+ $res = $stm->fetchAll (PDO::FETCH_ASSOC);
+
+ return $res[0]['count'];
+ }
+ public function updateCachedValues () { //For one single feed, call updateLastUpdate($id)
+ $sql = 'UPDATE `' . $this->prefix . 'feed` 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 `' . $this->prefix . 'entry` e '
+ . 'GROUP BY e.id_feed'
+ . ') x ON x.id_feed=f.id '
+ . 'SET f.cache_nbEntries=x.nbEntries, f.cache_nbUnreads=x.nbUnreads';
+ $stm = $this->bd->prepare ($sql);
+
+ $values = array ($feed_id);
+
+ if ($stm && $stm->execute ($values)) {
+ return $stm->rowCount();
+ } else {
+ $info = $stm->errorInfo();
+ Minz_Log::record ('SQL error : ' . $info[2], Minz_Log::ERROR);
+ return false;
+ }
+ }
+
+ public function truncate ($id) {
+ $sql = 'DELETE e.* FROM `' . $this->prefix . 'entry` e WHERE e.id_feed=?';
+ $stm = $this->bd->prepare($sql);
+ $values = array($id);
+ $this->bd->beginTransaction ();
+ if (!($stm && $stm->execute ($values))) {
+ $info = $stm->errorInfo();
+ Minz_Log::record ('SQL error : ' . $info[2], Minz_Log::ERROR);
+ $this->bd->rollBack ();
+ return false;
+ }
+ $affected = $stm->rowCount();
+
+ $sql = 'UPDATE `' . $this->prefix . 'feed` f '
+ . 'SET f.cache_nbEntries=0, f.cache_nbUnreads=0 WHERE f.id=?';
+ $values = array ($id);
+ $stm = $this->bd->prepare ($sql);
+ if (!($stm && $stm->execute ($values))) {
+ $info = $stm->errorInfo();
+ Minz_Log::record ('SQL error : ' . $info[2], Minz_Log::ERROR);
+ $this->bd->rollBack ();
+ return false;
+ }
+
+ $this->bd->commit ();
+ return $affected;
+ }
+
+ public function cleanOldEntries ($id, $date_min, $keep = 15) { //Remember to call updateLastUpdate($id) just after
+ $sql = 'DELETE e.* FROM `' . $this->prefix . 'entry` e '
+ . 'WHERE e.id_feed = :id_feed AND e.id <= :id_max AND e.is_favorite = 0 AND e.id NOT IN '
+ . '(SELECT id FROM (SELECT e2.id FROM `' . $this->prefix . 'entry` e2 WHERE e2.id_feed = :id_feed ORDER BY id DESC LIMIT :keep) keep)'; //Double select because of: MySQL doesn't yet support 'LIMIT & IN/ALL/ANY/SOME subquery'
+ $stm = $this->bd->prepare ($sql);
+
+ $id_max = intval($date_min) . '000000';
+
+ $stm->bindParam(':id_feed', $id, PDO::PARAM_INT);
+ $stm->bindParam(':id_max', $id_max, PDO::PARAM_INT);
+ $stm->bindParam(':keep', $keep, PDO::PARAM_INT);
+
+ if ($stm && $stm->execute ()) {
+ return $stm->rowCount();
+ } else {
+ $info = $stm->errorInfo();
+ Minz_Log::record ('SQL error : ' . $info[2], Minz_Log::ERROR);
+ return false;
+ }
+ }
+
+ public static function daoToFeed ($listDAO, $catID = null) {
+ $list = array ();
+
+ if (!is_array ($listDAO)) {
+ $listDAO = array ($listDAO);
+ }
+
+ foreach ($listDAO as $key => $dao) {
+ if (!isset ($dao['name'])) {
+ continue;
+ }
+ if (isset ($dao['id'])) {
+ $key = $dao['id'];
+ }
+ if ($catID === null) {
+ $category = isset($dao['category']) ? $dao['category'] : 0;
+ } else {
+ $category = $catID ;
+ }
+
+ $myFeed = new FreshRSS_Feed(isset($dao['url']) ? $dao['url'] : '', false);
+ $myFeed->_category($category);
+ $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(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']);
+ }
+ $list[$key] = $myFeed;
+ }
+
+ return $list;
+ }
+}
diff --git a/app/Models/Log.php b/app/Models/Log.php
new file mode 100644
index 000000000..d2794458b
--- /dev/null
+++ b/app/Models/Log.php
@@ -0,0 +1,26 @@
+<?php
+
+class FreshRSS_Log extends Minz_Model {
+ private $date;
+ private $level;
+ private $information;
+
+ public function date () {
+ return $this->date;
+ }
+ public function level () {
+ return $this->level;
+ }
+ public function info () {
+ return $this->information;
+ }
+ public function _date ($date) {
+ $this->date = $date;
+ }
+ public function _level ($level) {
+ $this->level = $level;
+ }
+ public function _info ($information) {
+ $this->information = $information;
+ }
+}
diff --git a/app/Models/LogDAO.php b/app/Models/LogDAO.php
new file mode 100644
index 000000000..d1e515200
--- /dev/null
+++ b/app/Models/LogDAO.php
@@ -0,0 +1,25 @@
+<?php
+
+class FreshRSS_LogDAO {
+ public static function lines() {
+ $logs = array ();
+ $handle = @fopen(LOG_PATH . '/' . Minz_Session::param('currentUser', '_') . '.log', 'r');
+ if ($handle) {
+ while (($line = fgets($handle)) !== false) {
+ if (preg_match ('/^\[([^\[]+)\] \[([^\[]+)\] --- (.*)$/', $line, $matches)) {
+ $myLog = new FreshRSS_Log ();
+ $myLog->_date ($matches[1]);
+ $myLog->_level ($matches[2]);
+ $myLog->_info ($matches[3]);
+ $logs[] = $myLog;
+ }
+ }
+ fclose($handle);
+ }
+ return array_reverse($logs);
+ }
+
+ public static function truncate() {
+ file_put_contents(LOG_PATH . '/' . Minz_Session::param('currentUser', '_') . '.log', '');
+ }
+}
diff --git a/app/Models/StatsDAO.php b/app/Models/StatsDAO.php
new file mode 100644
index 000000000..60cec7847
--- /dev/null
+++ b/app/Models/StatsDAO.php
@@ -0,0 +1,205 @@
+<?php
+
+class FreshRSS_StatsDAO extends Minz_ModelPdo {
+
+ /**
+ * Calculates entry repartition for all feeds and for main stream.
+ * The repartition includes:
+ * - total entries
+ * - read entries
+ * - unread entries
+ * - favorite entries
+ *
+ * @return type
+ */
+ public function calculateEntryRepartition() {
+ $repartition = array();
+
+ // Generates the repartition for the main stream of entry
+ $sql = <<<SQL
+SELECT COUNT(1) AS `total`,
+COUNT(1) - SUM(e.is_read) AS `unread`,
+SUM(e.is_read) AS `read`,
+SUM(e.is_favorite) AS `favorite`
+FROM {$this->prefix}entry AS e
+, {$this->prefix}feed AS f
+WHERE e.id_feed = f.id
+AND f.priority = 10
+SQL;
+ $stm = $this->bd->prepare($sql);
+ $stm->execute();
+ $res = $stm->fetchAll(PDO::FETCH_ASSOC);
+ $repartition['main_stream'] = $res[0];
+
+ // Generates the repartition for all entries
+ $sql = <<<SQL
+SELECT COUNT(1) AS `total`,
+COUNT(1) - SUM(e.is_read) AS `unread`,
+SUM(e.is_read) AS `read`,
+SUM(e.is_favorite) AS `favorite`
+FROM {$this->prefix}entry AS e
+SQL;
+ $stm = $this->bd->prepare($sql);
+ $stm->execute();
+ $res = $stm->fetchAll(PDO::FETCH_ASSOC);
+ $repartition['all_feeds'] = $res[0];
+
+ return $repartition;
+ }
+
+ /**
+ * Calculates entry count per day on a 30 days period.
+ * Returns the result as a JSON string.
+ *
+ * @return string
+ */
+ public function calculateEntryCount() {
+ $count = array();
+
+ // Generates a list of 30 last day to be sure we always have 30 days.
+ // If we do not do that kind of thing, we'll end up with holes in the
+ // days if the user do not have a lot of feeds.
+ $sql = <<<SQL
+SELECT - (tens.val + units.val + 1) AS day
+FROM (
+ SELECT 0 AS val
+ UNION ALL SELECT 1
+ UNION ALL SELECT 2
+ UNION ALL SELECT 3
+ UNION ALL SELECT 4
+ UNION ALL SELECT 5
+ UNION ALL SELECT 6
+ UNION ALL SELECT 7
+ UNION ALL SELECT 8
+ UNION ALL SELECT 9
+) AS units
+CROSS JOIN (
+ SELECT 0 AS val
+ UNION ALL SELECT 10
+ UNION ALL SELECT 20
+) AS tens
+ORDER BY day ASC
+SQL;
+ $stm = $this->bd->prepare($sql);
+ $stm->execute();
+ $res = $stm->fetchAll(PDO::FETCH_ASSOC);
+ foreach ($res as $value) {
+ $count[$value['day']] = 0;
+ }
+
+ // Get stats per day for the last 30 days and applies the result on
+ // the array created with the last query.
+ $sql = <<<SQL
+SELECT DATEDIFF(FROM_UNIXTIME(e.date), NOW()) AS day,
+COUNT(1) AS count
+FROM {$this->prefix}entry AS e
+WHERE FROM_UNIXTIME(e.date, '%Y%m%d') BETWEEN DATE_FORMAT(DATE_ADD(NOW(), INTERVAL -30 DAY), '%Y%m%d') AND DATE_FORMAT(DATE_ADD(NOW(), INTERVAL -1 DAY), '%Y%m%d')
+GROUP BY day
+ORDER BY day ASC
+SQL;
+ $stm = $this->bd->prepare($sql);
+ $stm->execute();
+ $res = $stm->fetchAll(PDO::FETCH_ASSOC);
+
+ foreach ($res as $value) {
+ $count[$value['day']] = (int) $value['count'];
+ }
+
+ return $this->convertToSerie($count);
+ }
+
+ /**
+ * Calculates feed count per category.
+ * Returns the result as a JSON string.
+ *
+ * @return string
+ */
+ public function calculateFeedByCategory() {
+ $sql = <<<SQL
+SELECT c.name AS label
+, COUNT(f.id) AS data
+FROM {$this->prefix}category AS c,
+{$this->prefix}feed AS f
+WHERE c.id = f.category
+GROUP BY label
+ORDER BY data DESC
+SQL;
+ $stm = $this->bd->prepare($sql);
+ $stm->execute();
+ $res = $stm->fetchAll(PDO::FETCH_ASSOC);
+
+ return $this->convertToPieSerie($res);
+ }
+
+ /**
+ * Calculates entry count per category.
+ * Returns the result as a JSON string.
+ *
+ * @return string
+ */
+ public function calculateEntryByCategory() {
+ $sql = <<<SQL
+SELECT c.name AS label
+, COUNT(e.id) AS data
+FROM {$this->prefix}category AS c,
+{$this->prefix}feed AS f,
+{$this->prefix}entry AS e
+WHERE c.id = f.category
+AND f.id = e.id_feed
+GROUP BY label
+ORDER BY data DESC
+SQL;
+ $stm = $this->bd->prepare($sql);
+ $stm->execute();
+ $res = $stm->fetchAll(PDO::FETCH_ASSOC);
+
+ return $this->convertToPieSerie($res);
+ }
+
+ /**
+ * Calculates the 10 top feeds based on their number of entries
+ *
+ * @return array
+ */
+ public function calculateTopFeed() {
+ $sql = <<<SQL
+SELECT f.id AS id
+, MAX(f.name) AS name
+, MAX(c.name) AS category
+, COUNT(e.id) AS count
+FROM {$this->prefix}category AS c,
+{$this->prefix}feed AS f,
+{$this->prefix}entry AS e
+WHERE c.id = f.category
+AND f.id = e.id_feed
+GROUP BY id
+ORDER BY count DESC
+LIMIT 10
+SQL;
+ $stm = $this->bd->prepare($sql);
+ $stm->execute();
+ return $stm->fetchAll(PDO::FETCH_ASSOC);
+ }
+
+ private function convertToSerie($data) {
+ $serie = array();
+
+ foreach ($data as $key => $value) {
+ $serie[] = array($key, $value);
+ }
+
+ return json_encode($serie);
+ }
+
+ private function convertToPieSerie($data) {
+ $serie = array();
+
+ foreach ($data as $value) {
+ $value['data'] = array(array(0, (int) $value['data']));
+ $serie[] = $value;
+ }
+
+ return json_encode($serie);
+ }
+
+}
diff --git a/app/Models/Themes.php b/app/Models/Themes.php
new file mode 100644
index 000000000..c7099a1df
--- /dev/null
+++ b/app/Models/Themes.php
@@ -0,0 +1,106 @@
+<?php
+
+class FreshRSS_Themes extends Minz_Model {
+ private static $themesUrl = '/themes/';
+ private static $defaultIconsUrl = '/themes/icons/';
+ public static $defaultTheme = 'Origine';
+
+ public static function getList() {
+ return array_values(array_diff(
+ scandir(PUBLIC_PATH . self::$themesUrl),
+ array('..', '.')
+ ));
+ }
+
+ public static function get() {
+ $themes_list = self::getList();
+ $list = array();
+ foreach ($themes_list as $theme_dir) {
+ $theme = self::get_infos($theme_dir);
+ if ($theme) {
+ $list[$theme_dir] = $theme;
+ }
+ }
+ return $list;
+ }
+
+ public static function get_infos($theme_id) {
+ $theme_dir = PUBLIC_PATH . self::$themesUrl . $theme_id ;
+ if (is_dir($theme_dir)) {
+ $json_filename = $theme_dir . '/metadata.json';
+ if (file_exists($json_filename)) {
+ $content = file_get_contents($json_filename);
+ $res = json_decode($content, true);
+ if ($res && isset($res['files']) && is_array($res['files'])) {
+ $res['id'] = $theme_id;
+ return $res;
+ }
+ }
+ }
+ return false;
+ }
+
+ private static $themeIconsUrl;
+ private static $themeIcons;
+
+ public static function load($theme_id) {
+ $infos = self::get_infos($theme_id);
+ if (!$infos) {
+ if ($theme_id !== self::$defaultTheme) { //Fall-back to default theme
+ return self::load(self::$defaultTheme);
+ }
+ $themes_list = self::getList();
+ if (!empty($themes_list)) {
+ if ($theme_id !== $themes_list[0]) { //Fall-back to first theme
+ return self::load($themes_list[0]);
+ }
+ }
+ return false;
+ }
+ self::$themeIconsUrl = self::$themesUrl . $theme_id . '/icons/';
+ self::$themeIcons = is_dir(PUBLIC_PATH . self::$themeIconsUrl) ? array_fill_keys(array_diff(
+ scandir(PUBLIC_PATH . self::$themeIconsUrl),
+ array('..', '.')
+ ), 1) : array();
+ return $infos;
+ }
+
+ public static function icon($name, $urlOnly = false) {
+ static $alts = array(
+ 'add' => '✚',
+ 'all' => '☰',
+ 'bookmark' => '★',
+ 'category' => '☷',
+ 'category-white' => '☷',
+ 'close' => '❌',
+ 'configure' => '⚙',
+ 'down' => '▽',
+ 'favorite' => '★',
+ 'help' => 'ⓘ',
+ 'link' => '↗',
+ 'login' => '🔒',
+ 'logout' => '🔓',
+ 'next' => '⏩',
+ 'non-starred' => '☆',
+ 'prev' => '⏪',
+ 'read' => '☑',
+ 'unread' => '☐',
+ 'refresh' => '🔃', //↻
+ 'search' => '🔍',
+ 'share' => '♺',
+ 'starred' => '★',
+ 'tag' => '⚐',
+ 'up' => '△',
+ );
+ if (!isset($alts[$name])) {
+ return '';
+ }
+
+ $url = $name . '.svg';
+ $url = isset(self::$themeIcons[$url]) ? (self::$themeIconsUrl . $url) :
+ (self::$defaultIconsUrl . $url);
+
+ return $urlOnly ? Minz_Url::display($url) :
+ '<img class="icon" src="' . Minz_Url::display($url) . '" alt="' . $alts[$name] . '" />';
+ }
+}
diff --git a/app/Models/UserDAO.php b/app/Models/UserDAO.php
new file mode 100644
index 000000000..a25b57f89
--- /dev/null
+++ b/app/Models/UserDAO.php
@@ -0,0 +1,36 @@
+<?php
+
+class FreshRSS_UserDAO extends Minz_ModelPdo {
+ public function createUser($username) {
+ require_once(APP_PATH . '/sql.php');
+ $db = Minz_Configuration::dataBase();
+
+ $sql = sprintf(SQL_CREATE_TABLES, $db['prefix'] . $username . '_');
+ $stm = $this->bd->prepare($sql, array(PDO::ATTR_EMULATE_PREPARES => true));
+ $values = array(
+ 'catName' => Minz_Translate::t('default_category'),
+ );
+ if ($stm && $stm->execute($values)) {
+ return true;
+ } else {
+ $info = $stm->errorInfo();
+ Minz_Log::record ('SQL error : ' . $info[2], Minz_Log::ERROR);
+ return false;
+ }
+ }
+
+ public function deleteUser($username) {
+ require_once(APP_PATH . '/sql.php');
+ $db = Minz_Configuration::dataBase();
+
+ $sql = sprintf(SQL_DROP_TABLES, $db['prefix'] . $username . '_');
+ $stm = $this->bd->prepare($sql);
+ if ($stm && $stm->execute()) {
+ return true;
+ } else {
+ $info = $stm->errorInfo();
+ Minz_Log::record ('SQL error : ' . $info[2], Minz_Log::ERROR);
+ return false;
+ }
+ }
+}
diff --git a/app/actualize_script.php b/app/actualize_script.php
new file mode 100755
index 000000000..9ac80a852
--- /dev/null
+++ b/app/actualize_script.php
@@ -0,0 +1,59 @@
+<?php
+require(dirname(__FILE__) . '/../constants.php');
+
+//<Mutex>
+$lock = DATA_PATH . '/actualize.lock.txt';
+if (file_exists($lock) && ((time() - @filemtime($lock)) > 3600)) {
+ @unlink($lock);
+}
+if (($handle = @fopen($lock, 'x')) === false) {
+ syslog(LOG_NOTICE, 'FreshRSS actualize already running?');
+ fwrite(STDERR, 'FreshRSS actualize already running?' . "\n");
+ return;
+}
+register_shutdown_function('unlink', $lock);
+//Could use http://php.net/function.pcntl-signal.php to catch interruptions
+@fclose($handle);
+//</Mutex>
+
+require(LIB_PATH . '/lib_rss.php'); //Includes class autoloader
+
+session_cache_limiter('');
+ob_implicit_flush(false);
+ob_start();
+echo 'Results: ', "\n"; //Buffered
+
+Minz_Configuration::init();
+
+$users = listUsers();
+shuffle($users); //Process users in random order
+array_unshift($users, Minz_Configuration::defaultUser()); //But always start with admin
+$users = array_unique($users);
+
+foreach ($users as $myUser) {
+ syslog(LOG_INFO, 'FreshRSS actualize ' . $myUser);
+ fwrite(STDOUT, 'Actualize ' . $myUser . "...\n"); //Unbuffered
+ echo $myUser, ' '; //Buffered
+
+ $_GET['c'] = 'feed';
+ $_GET['a'] = 'actualize';
+ $_GET['ajax'] = 1;
+ $_GET['force'] = true;
+ $_SERVER['HTTP_HOST'] = '';
+
+ $freshRSS = new FreshRSS();
+ $freshRSS->_useOb(false);
+
+ Minz_Session::init('FreshRSS');
+ Minz_Session::_param('currentUser', $myUser);
+
+ $freshRSS->init();
+ $freshRSS->run();
+
+ invalidateHttpCache();
+ Minz_Session::unset_session(true);
+ Minz_ModelPdo::clean();
+}
+syslog(LOG_INFO, 'FreshRSS actualize done.');
+ob_end_flush();
+fwrite(STDOUT, 'Done.' . "\n");
diff --git a/app/configuration/.gitignore b/app/configuration/.gitignore
deleted file mode 100644
index 72e8ffc0d..000000000
--- a/app/configuration/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-*
diff --git a/app/controllers/configureController.php b/app/controllers/configureController.php
deleted file mode 100755
index 4c1930d31..000000000
--- a/app/controllers/configureController.php
+++ /dev/null
@@ -1,375 +0,0 @@
-<?php
-
-class configureController extends ActionController {
- public function firstAction () {
- if (login_is_conf ($this->view->conf) && !is_logged ()) {
- Error::error (
- 403,
- array ('error' => array (Translate::t ('access_denied')))
- );
- }
-
- $catDAO = new CategoryDAO ();
- $catDAO->checkDefault ();
- }
-
- public function categorizeAction () {
- $feedDAO = new FeedDAO ();
- $catDAO = new CategoryDAO ();
- $catDAO->checkDefault ();
- $defaultCategory = $catDAO->getDefault ();
- $defaultId = $defaultCategory->id ();
-
- if (Request::isPost ()) {
- $cats = Request::param ('categories', array ());
- $ids = Request::param ('ids', array ());
- $newCat = trim (Request::param ('new_category', ''));
-
- foreach ($cats as $key => $name) {
- if (strlen ($name) > 0) {
- $cat = new 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 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' => Translate::t ('categories_updated')
- );
- Session::_param ('notification', $notif);
-
- 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;
-
- View::prependTitle (Translate::t ('categories_management') . ' - ');
- }
-
- public function feedAction () {
- $catDAO = new CategoryDAO ();
- $this->view->categories = $catDAO->listCategories (false);
-
- $feedDAO = new FeedDAO ();
- $this->view->feeds = $feedDAO->listFeeds ();
-
- $id = 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 = $feedDAO->searchById ($id);
-
- if (!$this->view->flux) {
- Error::error (
- 404,
- array ('error' => array (Translate::t ('page_not_found')))
- );
- } else {
- $catDAO = new CategoryDAO ();
- $this->view->categories = $catDAO->listCategories (false);
-
- if (Request::isPost () && $this->view->flux) {
- $name = Request::param ('name', '');
- $hist = Request::param ('keep_history', 'no');
- $cat = Request::param ('category', 0);
- $path = Request::param ('path_entries', '');
- $priority = Request::param ('priority', 0);
- $user = Request::param ('http_user', '');
- $pass = Request::param ('http_pass', '');
-
- $keep_history = false;
- if ($hist == 'yes') {
- $keep_history = true;
- }
-
- $httpAuth = '';
- if ($user != '' || $pass != '') {
- $httpAuth = $user . ':' . $pass;
- }
-
- $values = array (
- 'name' => $name,
- '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' => Translate::t ('feed_updated')
- );
- } else {
- $notif = array (
- 'type' => 'bad',
- 'content' => Translate::t ('error_occurred_update')
- );
- }
-
- Session::_param ('notification', $notif);
- Request::forward (array ('c' => 'configure', 'a' => 'feed', 'params' => array ('id' => $id)), true);
- }
-
- View::prependTitle (Translate::t ('rss_feed_management') . ' - ' . $this->view->flux->name () . ' - ');
- }
- } else {
- View::prependTitle (Translate::t ('rss_feed_management') . ' - ');
- }
- }
-
- public function displayAction () {
- if (Request::isPost ()) {
- $current_token = $this->view->conf->token ();
-
- $language = Request::param ('language', 'en');
- $nb = Request::param ('posts_per_page', 10);
- $mode = Request::param ('view_mode', 'normal');
- $view = Request::param ('default_view', 'all');
- $auto_load_more = Request::param ('auto_load_more', 'no');
- $display = Request::param ('display_posts', 'no');
- $onread_jump_next = Request::param ('onread_jump_next', 'no');
- $lazyload = Request::param ('lazyload', 'no');
- $sort = Request::param ('sort_order', 'low_to_high');
- $old = Request::param ('old_entries', 3);
- $mail = Request::param ('mail_login', false);
- $anon = Request::param ('anon_access', 'no');
- $token = Request::param ('token', $current_token);
- $openArticle = Request::param ('mark_open_article', 'no');
- $openSite = Request::param ('mark_open_site', 'no');
- $scroll = Request::param ('mark_scroll', 'no');
- $urlShaarli = Request::param ('shaarli', '');
- $theme = Request::param ('theme', 'default');
- $topline_read = Request::param ('topline_read', 'no');
- $topline_favorite = Request::param ('topline_favorite', 'no');
- $topline_date = Request::param ('topline_date', 'no');
- $topline_link = Request::param ('topline_link', 'no');
- $bottomline_read = Request::param ('bottomline_read', 'no');
- $bottomline_favorite = Request::param ('bottomline_favorite', 'no');
- $bottomline_sharing = Request::param ('bottomline_sharing', 'no');
- $bottomline_tags = Request::param ('bottomline_tags', 'no');
- $bottomline_date = Request::param ('bottomline_date', 'no');
- $bottomline_link = 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,
- ));
- $this->view->conf->_urlShaarli ($urlShaarli);
- $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 (),
- 'url_shaarli' => $this->view->conf->urlShaarli (),
- '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 RSSConfigurationDAO ();
- $confDAO->update ($values);
- Session::_param ('conf', $this->view->conf);
- Session::_param ('mail', $this->view->conf->mailLogin ());
-
- Session::_param ('language', $this->view->conf->language ());
- Translate::reset ();
-
- // notif
- $notif = array (
- 'type' => 'good',
- 'content' => Translate::t ('configuration_updated')
- );
- Session::_param ('notification', $notif);
-
- Request::forward (array ('c' => 'configure', 'a' => 'display'), true);
- }
-
- $this->view->themes = RSSThemes::get();
-
- View::prependTitle (Translate::t ('general_and_reading_management') . ' - ');
- }
-
- public function importExportAction () {
- $catDAO = new CategoryDAO ();
- $this->view->categories = $catDAO->listCategories ();
-
- $this->view->req = Request::param ('q');
-
- if ($this->view->req == 'export') {
- 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 FeedDAO ();
- $catDAO = new 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' && 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
- Request::_param ('q', 'null');
- Request::_param ('categories', $categories);
- Request::_param ('feeds', $feeds);
- Request::forward (array ('c' => 'feed', 'a' => 'massiveImport'));
- } catch (OpmlException $e) {
- Minz_Log::record ($e->getMessage (), Minz_Log::ERROR);
-
- $notif = array (
- 'type' => 'bad',
- 'content' => Translate::t ('bad_opml_file')
- );
- Session::_param ('notification', $notif);
-
- Request::forward (array (
- 'c' => 'configure',
- 'a' => 'importExport'
- ), true);
- }
- }
- }
-
- $feedDAO = new 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;
-
- 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');
-
- if (Request::isPost ()) {
- $shortcuts = 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 RSSConfigurationDAO ();
- $confDAO->update ($values);
- Session::_param ('conf', $this->view->conf);
-
- // notif
- $notif = array (
- 'type' => 'good',
- 'content' => Translate::t ('shortcuts_updated')
- );
- Session::_param ('notification', $notif);
-
- Request::forward (array ('c' => 'configure', 'a' => 'shortcut'), true);
- }
-
- View::prependTitle (Translate::t ('shortcuts_management') . ' - ');
- }
-}
diff --git a/app/controllers/entryController.php b/app/controllers/entryController.php
deleted file mode 100755
index d4023c519..000000000
--- a/app/controllers/entryController.php
+++ /dev/null
@@ -1,117 +0,0 @@
-<?php
-
-class entryController extends ActionController {
- public function firstAction () {
- if (login_is_conf ($this->view->conf) && !is_logged ()) {
- Error::error (
- 403,
- array ('error' => array (Translate::t ('access_denied')))
- );
- }
-
- $this->params = array ();
- $this->redirect = false;
- $ajax = Request::param ('ajax');
- if ($ajax) {
- $this->view->_useLayout (false);
- }
- }
- public function lastAction () {
- $ajax = Request::param ('ajax');
- if (!$ajax && $this->redirect) {
- Request::forward (array (
- 'c' => 'index',
- 'a' => 'index',
- 'params' => $this->params
- ), true);
- } else {
- Request::_param ('ajax');
- }
- }
-
- public function readAction () {
- $this->redirect = true;
-
- $id = Request::param ('id');
- $is_read = Request::param ('is_read');
- $get = Request::param ('get');
- $nextGet = Request::param ('nextGet', $get);
- $dateMax = Request::param ('dateMax', 0);
-
- $is_read = !!$is_read;
-
- $entryDAO = new EntryDAO ();
- if ($id == false) {
- if (!$get) {
- $entryDAO->markReadEntries ($is_read, $dateMax);
- } else {
- $typeGet = $get[0];
- $get = substr ($get, 2);
-
- if ($typeGet == 'c') {
- $entryDAO->markReadCat ($get, $is_read, $dateMax);
- $this->params = array ('get' => $nextGet);
- } elseif ($typeGet == 'f') {
- $entryDAO->markReadFeed ($get, $is_read, $dateMax);
- $this->params = array ('get' => $nextGet);
- }
- }
-
- // notif
- $notif = array (
- 'type' => 'good',
- 'content' => Translate::t ('feeds_marked_read')
- );
- Session::_param ('notification', $notif);
- } else {
- $entryDAO->updateEntry ($id, array ('is_read' => $is_read));
- }
- }
-
- public function bookmarkAction () {
- $this->redirect = true;
-
- $id = Request::param ('id');
- $is_fav = Request::param ('is_favorite');
-
- if ($is_fav) {
- $is_fav = true;
- } else {
- $is_fav = false;
- }
-
- $entryDAO = new EntryDAO ();
- if ($id != false) {
- $entry = $entryDAO->searchById ($id);
-
- if ($entry != false) {
- $values = array (
- 'is_favorite' => $is_fav,
- );
-
- $entryDAO->updateEntry ($entry->id (), $values);
- }
- }
- }
-
- public function optimizeAction() {
- // 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 EntryDAO();
- $entryDAO->optimizeTable();
-
- touch(PUBLIC_PATH . '/data/touch.txt');
-
- $notif = array (
- 'type' => 'good',
- 'content' => Translate::t ('optimization_complete')
- );
- Session::_param ('notification', $notif);
-
- Request::forward(array(
- 'c' => 'configure',
- 'a' => 'display'
- ), true);
- }
-}
diff --git a/app/controllers/feedController.php b/app/controllers/feedController.php
deleted file mode 100755
index 76fca8828..000000000
--- a/app/controllers/feedController.php
+++ /dev/null
@@ -1,363 +0,0 @@
-<?php
-
-class feedController extends ActionController {
- public function firstAction () {
- $token = $this->view->conf->token();
- $token_param = Request::param ('token', '');
- $token_is_ok = ($token != '' && $token == $token_param);
- $action = Request::actionName ();
-
- if (login_is_conf ($this->view->conf) &&
- !is_logged () &&
- !($token_is_ok && $action == 'actualize')) {
- Error::error (
- 403,
- array ('error' => array (Translate::t ('access_denied')))
- );
- }
-
- $this->catDAO = new CategoryDAO ();
- $this->catDAO->checkDefault ();
- }
-
- public function addAction () {
- if (Request::isPost ()) {
- $url = Request::param ('url_rss');
- $cat = Request::param ('category', false);
- if ($cat === false) {
- $def_cat = $this->catDAO->getDefault ();
- $cat = $def_cat->id ();
- }
-
- $user = Request::param ('username');
- $pass = Request::param ('password');
- $params = array ();
-
- try {
- $feed = new Feed ($url);
- $feed->_category ($cat);
-
- $httpAuth = '';
- if ($user != '' || $pass != '') {
- $httpAuth = $user . ':' . $pass;
- }
- $feed->_httpAuth ($httpAuth);
-
- $feed->load ();
-
- $feedDAO = new FeedDAO ();
- $values = array (
- 'id' => $feed->id (),
- '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' => Translate::t ('already_subscribed', $feed->name ())
- );
- Session::_param ('notification', $notif);
- } elseif (!$feedDAO->addFeed ($values)) {
- // problème au niveau de la base de données
- $notif = array (
- 'type' => 'bad',
- 'content' => Translate::t ('feed_not_added', $feed->name ())
- );
- Session::_param ('notification', $notif);
- } else {
- $entryDAO = new EntryDAO ();
- $entries = $feed->entries ();
-
- // 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);
-
- // on ajoute les articles en masse sans vérification
- foreach ($entries as $entry) {
- if ($entry->date (true) >= $date_min ||
- $feed->keepHistory ()) {
- $values = $entry->toArray ();
- $entryDAO->addEntry ($values);
- }
- }
-
- // ok, ajout terminé
- $notif = array (
- 'type' => 'good',
- 'content' => Translate::t ('feed_added', $feed->name ())
- );
- Session::_param ('notification', $notif);
-
- // permet de rediriger vers la page de conf du flux
- $params['id'] = $feed->id ();
- }
- } catch (BadUrlException $e) {
- Minz_Log::record ($e->getMessage (), Minz_Log::ERROR);
- $notif = array (
- 'type' => 'bad',
- 'content' => Translate::t ('invalid_url', $url)
- );
- Session::_param ('notification', $notif);
- } catch (FeedException $e) {
- Minz_Log::record ($e->getMessage (), Minz_Log::ERROR);
- $notif = array (
- 'type' => 'bad',
- 'content' => Translate::t ('internal_problem_feed')
- );
- Session::_param ('notification', $notif);
- } catch (FileNotExistException $e) {
- // Répertoire de cache n'existe pas
- Minz_Log::record ($e->getMessage (), Minz_Log::ERROR);
- $notif = array (
- 'type' => 'bad',
- 'content' => Translate::t ('internal_problem_feed')
- );
- Session::_param ('notification', $notif);
- }
-
- Request::forward (array ('c' => 'configure', 'a' => 'feed', 'params' => $params), true);
- }
- }
-
- public function actualizeAction () {
- $feedDAO = new FeedDAO ();
- $entryDAO = new EntryDAO ();
-
- $id = Request::param ('id');
- $force = 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 () - (60 * 60 * 24 * 30 * $nb_month_old);
-
- $i = 0;
- $flux_update = 0;
- foreach ($feeds as $feed) {
- try {
- $feed->load ();
- $entries = $feed->entries ();
-
- //For this feed, check last n entry IDs already in database
- $existingIds = array_fill_keys ($entryDAO->listLastIdsByFeed ($feed->id (), count($entries) + 2), 1);
-
- // ajout des articles en masse sans se soucier des erreurs
- // On ne vérifie pas que l'article n'est pas déjà en BDD
- // car demanderait plus de ressources
- // La BDD refusera l'ajout de son côté car l'id doit être
- // unique
- foreach ($entries as $entry) {
- if ((!isset ($existingIds[$entry->id ()])) &&
- ($entry->date (true) >= $date_min ||
- $feed->keepHistory ())) {
- $values = $entry->toArray ();
- $entryDAO->addEntry ($values);
- }
- }
-
- // on indique que le flux vient d'être mis à jour en BDD
- $feedDAO->updateLastUpdate ($feed->id ());
- $flux_update++;
- } catch (FeedException $e) {
- Minz_Log::record ($e->getMessage (), Minz_Log::ERROR);
- $feedDAO->isInError ($feed->id ());
- }
-
- // 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;
- }
- }
-
- $entryDAO->cleanOldEntries ($nb_month_old);
-
- $url = array ();
- if ($flux_update === 1) {
- // on a mis un seul flux à jour
- $notif = array (
- 'type' => 'good',
- 'content' => Translate::t ('feed_actualized', $feed->name ())
- );
- } elseif ($flux_update > 1) {
- // plusieurs flux on été mis à jour
- $notif = array (
- 'type' => 'good',
- 'content' => Translate::t ('n_feeds_actualized', $flux_update)
- );
- } else {
- // aucun flux n'a été mis à jour, oups
- $notif = array (
- 'type' => 'bad',
- 'content' => 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 (Request::param ('ajax', 0) === 0) {
- Session::_param ('notification', $notif);
- 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' => Translate::t ('feeds_actualized')
- );
- Session::_param ('notification', $notif);
- // et on désactive le layout car ne sert à rien
- $this->view->_useLayout (false);
- }
- }
-
- public function massiveImportAction () {
- $entryDAO = new EntryDAO ();
- $feedDAO = new FeedDAO ();
-
- $categories = Request::param ('categories', array (), true);
- $feeds = 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 () - (60 * 60 * 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 {
- $feed->load ();
-
- $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'])) {
- if (!$feedDAO->addFeed ($values)) {
- $error = true;
- }
- }
- } catch (FeedException $e) {
- $error = true;
- Minz_Log::record ($e->getMessage (), Minz_Log::ERROR);
- }
- }
-
- if ($error) {
- $res = Translate::t ('feeds_imported_with_errors');
- } else {
- $res = Translate::t ('feeds_imported');
- }
-
- $notif = array (
- 'type' => 'good',
- 'content' => $res
- );
- Session::_param ('notification', $notif);
- Session::_param ('actualize_feeds', true);
-
- // et on redirige vers la page import/export
- Request::forward (array (
- 'c' => 'configure',
- 'a' => 'importExport'
- ), true);
- }
-
- public function deleteAction () {
- $type = Request::param ('type', 'feed');
- $id = Request::param ('id');
-
- $feedDAO = new FeedDAO ();
- if ($type == 'category') {
- if ($feedDAO->deleteFeedByCategory ($id)) {
- $notif = array (
- 'type' => 'good',
- 'content' => Translate::t ('category_emptied')
- );
- } else {
- $notif = array (
- 'type' => 'bad',
- 'content' => Translate::t ('error_occured')
- );
- }
- } else {
- if ($feedDAO->deleteFeed ($id)) {
- $notif = array (
- 'type' => 'good',
- 'content' => Translate::t ('feed_deleted')
- );
- } else {
- $notif = array (
- 'type' => 'bad',
- 'content' => Translate::t ('error_occured')
- );
- }
- }
-
- Session::_param ('notification', $notif);
-
- if ($type == 'category') {
- Request::forward (array ('c' => 'configure', 'a' => 'categorize'), true);
- } else {
- Request::forward (array ('c' => 'configure', 'a' => 'feed'), true);
- }
- }
-
- private function addCategories ($categories) {
- $catDAO = new 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 140bbfc72..000000000
--- a/app/controllers/indexController.php
+++ /dev/null
@@ -1,257 +0,0 @@
-<?php
-
-class indexController extends ActionController {
- private $get = false;
- private $nb_not_read = 0;
- private $nb_not_read_cat = 0;
-
- public function indexAction () {
- $output = Request::param ('output');
-
- $token = $this->view->conf->token();
- $token_param = 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 = 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
- );
-
- $this->view->rss_title = View::title();
-
- if ($output == 'rss') {
- // no layout for RSS output
- $this->view->_useLayout (false);
- header('Content-Type: application/rss+xml; charset=utf-8');
- } else {
- 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')));
- }
- }
-
- $nb_not_read = $this->view->nb_not_read;
- if($nb_not_read > 0) {
- View::appendTitle (' (' . $nb_not_read . ')');
- }
- View::prependTitle (' - ');
-
- $entryDAO = new EntryDAO ();
- $feedDAO = new FeedDAO ();
- $catDAO = new CategoryDAO ();
-
- $this->view->cat_aside = $catDAO->listCategories ();
- $this->view->nb_favorites = $entryDAO->countUnreadReadFavorites ();
- $this->view->nb_total = $entryDAO->count ();
- $this->view->currentName = '';
-
- $this->view->get_c = '';
- $this->view->get_f = '';
-
- $type = $this->getType ();
- $error = $this->checkAndProcessType ($type);
-
- // mise à jour des titres
- $this->view->rss_title = $this->view->currentName . ' - ' . $this->view->rss_title;
- View::prependTitle (
- $this->view->currentName .
- ($this->nb_not_read_cat > 0 ? ' (' . $this->nb_not_read_cat . ')' : '')
- );
-
- if (!$error) {
- // On récupère les différents éléments de filtrage
- $this->view->state = $state = Request::param ('state', $this->view->conf->defaultView ());
- $filter = Request::param ('search', '');
- $this->view->order = $order = Request::param ('order', $this->view->conf->sortOrder ());
- $nb = Request::param ('nb', $this->view->conf->postsPerPage ());
- $first = Request::param ('next', '');
-
- try {
- // EntriesGetter permet de déporter la complexité du filtrage
- $getter = new EntriesGetter ($type, $state, $filter, $order, $nb, $first);
- $getter->execute ();
- $entries = $getter->getPaginator ();
-
- // Si on a récupéré aucun article "non lus"
- // on essaye de récupérer tous les articles
- if ($state == 'not_read' && $entries->isEmpty ()) {
- $this->view->state = 'all';
- $getter->_state ('all');
- $getter->execute ();
- $entries = $getter->getPaginator ();
- }
-
- $this->view->entryPaginator = $entries;
- } catch(EntriesGetterException $e) {
- Minz_Log::record ($e->getMessage (), Minz_Log::NOTICE);
- Error::error (
- 404,
- array ('error' => array (Translate::t ('page_not_found')))
- );
- }
- } else {
- Error::error (
- 404,
- array ('error' => array (Translate::t ('page_not_found')))
- );
- }
- }
-
- /*
- * Détermine le type d'article à récupérer :
- * "tous", "favoris", "public", "catégorie" ou "flux"
- */
- private function getType () {
- $get = Request::param ('get', 'all');
- $typeGet = $get[0];
- $id = substr ($get, 2);
-
- $type = null;
- if ($get == 'all' || $get == 'favoris' || $get == 'public') {
- $type = array (
- 'type' => $get,
- 'id' => $get
- );
- } elseif ($typeGet == 'f' || $typeGet == 'c') {
- $type = array (
- 'type' => $typeGet,
- 'id' => $id
- );
- }
-
- return $type;
- }
- /*
- * 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 ($type) {
- if ($type['type'] == 'all') {
- $this->view->currentName = Translate::t ('your_rss_feeds');
- $this->view->get_c = $type['type'];
- return false;
- } elseif ($type['type'] == 'favoris') {
- $this->view->currentName = Translate::t ('your_favorites');
- $this->view->get_c = $type['type'];
- return false;
- } elseif ($type['type'] == 'public') {
- $this->view->currentName = Translate::t ('public');
- $this->view->get_c = $type['type'];
- return false;
- } elseif ($type['type'] == 'c') {
- $catDAO = new CategoryDAO ();
- $cat = $catDAO->searchById ($type['id']);
- if ($cat) {
- $this->view->currentName = $cat->name ();
- $this->nb_not_read_cat = $cat->nbNotRead ();
- $this->view->get_c = $type['id'];
- return false;
- } else {
- return true;
- }
- } elseif ($type['type'] == 'f') {
- $feedDAO = new FeedDAO ();
- $feed = $feedDAO->searchById ($type['id']);
- if ($feed) {
- $this->view->currentName = $feed->name ();
- $this->nb_not_read_cat = $feed->nbNotRead ();
- $this->view->get_f = $type['id'];
- $this->view->get_c = $feed->category ();
- return false;
- } else {
- return true;
- }
- } else {
- return true;
- }
- }
-
- public function aboutAction () {
- View::prependTitle (Translate::t ('about') . ' - ');
- }
-
- public function logsAction () {
- if (login_is_conf ($this->view->conf) && !is_logged ()) {
- Error::error (
- 403,
- array ('error' => array (Translate::t ('access_denied')))
- );
- }
-
- View::prependTitle (Translate::t ('logs') . ' - ');
-
- $logs = array();
- try {
- $logDAO = new LogDAO ();
- $logs = $logDAO->lister ();
- $logs = array_reverse ($logs);
- } catch(FileNotExistException $e) {
-
- }
-
- //gestion pagination
- $page = Request::param ('page', 1);
- $this->view->logsPaginator = new 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 = Request::param ('assertion');
- $params = 'assertion=' . $assert . '&audience=' .
- urlencode (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 ()) {
- Session::_param ('mail', $res['email']);
- touch(PUBLIC_PATH . '/data/touch.txt');
- } else {
- $res = array ();
- $res['status'] = 'failure';
- $res['reason'] = Translate::t ('invalid_login');
- }
-
- $this->view->res = json_encode ($res);
- }
-
- public function logoutAction () {
- $this->view->_useLayout (false);
- Session::_param ('mail');
- touch(PUBLIC_PATH . '/data/touch.txt');
- }
-}
diff --git a/app/controllers/javascriptController.php b/app/controllers/javascriptController.php
deleted file mode 100755
index 291474130..000000000
--- a/app/controllers/javascriptController.php
+++ /dev/null
@@ -1,13 +0,0 @@
-<?php
-
-class javascriptController extends ActionController {
- public function firstAction () {
- $this->view->_useLayout (false);
- header('Content-type: text/javascript');
- }
-
- public function actualizeAction () {
- $feedDAO = new FeedDAO ();
- $this->view->feeds = $feedDAO->listFeeds ();
- }
-}
diff --git a/app/i18n/en.php b/app/i18n/en.php
index 67dabedd7..a2cc461c5 100644
--- a/app/i18n/en.php
+++ b/app/i18n/en.php
@@ -5,13 +5,17 @@ return array (
'login' => 'Login',
'logout' => 'Logout',
'search' => 'Search words or #tags',
+ 'search_short' => 'Search',
'configuration' => 'Configuration',
- 'general_and_reading' => 'General and reading',
+ 'users' => 'Users',
'categories' => 'Categories',
'category' => 'Category',
+ 'feed' => 'Feed',
+ 'feeds' => 'Feeds',
'shortcuts' => 'Shortcuts',
'about' => 'About',
+ 'stats' => 'Statistics',
'your_rss_feeds' => 'Your RSS feeds',
'add_rss_feed' => 'Add a RSS feed',
@@ -19,7 +23,8 @@ return array (
'import_export_opml' => 'Import / export (OPML)',
'subscription_management' => 'Subscriptions management',
- 'all_feeds' => 'Main stream (%d)',
+ 'main_stream' => 'Main stream',
+ 'all_feeds' => 'All feeds',
'favorite_feeds' => 'Favourites (%d)',
'not_read' => '%d unread',
'not_reads' => '%d unread',
@@ -43,6 +48,8 @@ return array (
'rss_view' => 'RSS feed',
'show_all_articles' => 'Show all articles',
'show_not_reads' => 'Show only unread',
+ 'show_read' => 'Show only read',
+ 'show_favorite' => 'Show favorites',
'older_first' => 'Oldest first',
'newer_first' => 'Newer first',
@@ -59,7 +66,7 @@ return array (
'access_denied' => 'You don’t have permission to access this page',
'page_not_found' => 'You are looking for a page which doesn’t exist',
'error_occurred' => 'An error occurred',
- 'error_occurred_update' => 'An error occurred during update',
+ 'error_occurred_update' => 'Nothing was changed',
'default_category' => 'Uncategorized',
'categories_updated' => 'Categories have been updated',
@@ -67,7 +74,7 @@ return array (
'feed_updated' => 'Feed has been updated',
'rss_feed_management' => 'RSS feeds management',
'configuration_updated' => 'Configuration has been updated',
- 'general_and_reading_management'=> 'General and reading management',
+ 'sharing_management' => 'Sharing options management',
'bad_opml_file' => 'Your OPML file is invalid',
'shortcuts_updated' => 'Shortcuts have been updated',
'shortcuts_management' => 'Shortcuts management',
@@ -83,10 +90,12 @@ return array (
'n_feeds_actualized' => '%d feeds have been updated',
'feeds_actualized' => 'RSS feeds have been updated',
'no_feed_actualized' => 'No RSS feed has been updated',
- 'feeds_imported_with_errors' => 'Feeds have been imported but errors occurred',
- 'feeds_imported' => 'Feeds have been imported',
+ 'n_entries_deleted' => '%d articles have been deleted',
+ 'feeds_imported_with_errors' => 'Your feeds have been imported but some errors occurred',
+ 'feeds_imported' => 'Your feeds have been imported and will now be updated',
'category_emptied' => 'Category has been emptied',
'feed_deleted' => 'Feed has been deleted',
+ 'feed_validator' => 'Check the validity of the feed',
'optimization_complete' => 'Optimization complete',
@@ -119,6 +128,8 @@ return array (
'shift_for_first' => '+ <code>shift</code> to skip to the first article of page',
'next_page' => 'Skip to the next page',
'previous_page' => 'Skip to the previous page',
+ 'collapse_article' => 'Collapse current article',
+ 'auto_share' => 'Share current article',
'file_to_import' => 'File to import',
'import' => 'Import',
@@ -127,11 +138,16 @@ return array (
'informations' => 'Information',
'feed_in_error' => 'This feed has encountered a problem. Please verify that it is always reachable then actualize it.',
+ 'feed_description' => 'Description',
'website_url' => 'Website URL',
'feed_url' => 'Feed URL',
+ 'articles' => 'articles',
'number_articles' => 'Number of articles',
- 'keep_history' => 'Keep history?',
+ 'by_feed' => 'by feed',
+ 'by_default' => 'By default',
+ 'keep_history' => 'Minimum number of articles to keep',
'categorize' => 'Store in a category',
+ 'truncate' => 'Delete all articles',
'advanced' => 'Advanced',
'show_in_all_flux' => 'Show in main stream',
'yes' => 'Yes',
@@ -145,40 +161,73 @@ return array (
'not_yet_implemented' => 'Not yet implemented',
'access_protected_feeds' => 'Connection allows to access HTTP protected RSS feeds',
'no_selected_feed' => 'No feed selected.',
- 'think_to_add' => 'Think to add RSS feeds!',
+ 'think_to_add' => '<a href="./?c=configure&amp;a=feed">You may add some feeds</a>.',
+
+ 'current_user' => 'Current user',
+ 'default_user' => 'Username of the default user <small>(maximum 16 alphanumeric characters)</small>',
+ 'password_form' => 'Password<br /><small>(for the Web-form login method)</small>',
+ 'persona_connection_email' => 'Login mail address<br /><small>(for <a href="https://persona.org/" rel="external">Mozilla Persona</a>)</small>',
+ 'allow_anonymous' => 'Allow anonymous reading of the articles of the default user (%s)',
+ 'auth_token' => 'Authentication token',
+ 'explain_token' => 'Allows to access RSS output of the default user without authentication.<br /><kbd>%s?output=rss&token=%s</kbd>',
+ 'login_configuration' => 'Login',
+ 'is_admin' => 'is administrator',
+ 'auth_type' => 'Authentication method',
+ 'auth_none' => 'None (dangerous)',
+ 'auth_form' => 'Web form (traditional, requires JavaScript)',
+ 'http_auth' => 'HTTP (for advanced users with HTTPS)',
+ 'auth_persona' => 'Mozilla Persona (modern, requires JavaScript)',
+ 'users_list' => 'List of users',
+ 'create_user' => 'Create new user',
+ 'username' => 'Username',
+ 'password' => 'Password',
+ 'create' => 'Create',
+ 'user_created' => 'User %s has been created',
+ 'user_deleted' => 'User %s has been deleted',
- 'general_configuration' => 'General configuration',
'language' => 'Language',
- 'delete_articles_every' => 'Remove articles every',
'month' => 'months',
- 'persona_connection_email' => 'Login mail address (use <a href="https://persona.org/">Persona</a>)',
- 'allow_anonymous' => 'Allow anonymous reading',
- 'auth_token' => 'Authentication token',
- 'explain_token' => 'Allows to access RSS output without authentication.<br />%s?token=%s',
- 'reading_configuration' => 'Reading configuration',
+ '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',
'default_view' => 'Default view',
'sort_order' => 'Sort order',
'auto_load_more' => 'Load next articles at the page bottom',
'display_articles_unfolded' => 'Show articles unfolded by default',
- 'after_onread' => 'After marked as read,',
- 'jump_next' => 'jump to next unread sibling',
- 'reading_icons' => 'Reading icons',
- 'top_line' => 'Top line',
- 'bottom_line' => 'Bottom line',
+ 'after_onread' => 'After “mark all as read”,',
+ 'jump_next' => 'jump to next unread sibling (feed or category)',
+ 'reading_icons' => 'Reading icons',
+ 'top_line' => 'Top line',
+ 'bottom_line' => 'Bottom line',
'img_with_lazyload' => 'Use "lazy load" mode to load pictures',
- 'auto_read_when' => 'Mark as read when',
- 'article_selected' => 'article is selected',
- 'article_open_on_website' => 'article is opened on its original website',
- 'scroll' => 'page scrolls',
+ 'auto_read_when' => 'Mark article as read…',
+ 'article_selected' => 'when article is selected',
+ 'article_open_on_website' => 'when article is opened on its original website',
+ 'scroll' => 'during page scrolls',
+ 'upon_reception' => 'upon reception of the article',
'your_shaarli' => 'Your Shaarli',
+ 'your_wallabag' => 'Your wallabag',
+ 'your_diaspora_pod' => 'Your Diaspora* pod',
'sharing' => 'Sharing',
'share' => 'Share',
- 'by_email' => 'By mail',
- 'on_shaarli' => 'On your Shaarli',
+ 'by_email' => 'By email',
'optimize_bdd' => 'Optimize database',
- 'optimize_todo_sometimes' => 'To do occasionally to reduce size of database',
+ 'optimize_todo_sometimes' => 'To do occasionally to reduce the size of the database',
'theme' => 'Theme',
+ 'more_information' => 'More information',
+ 'activate_sharing' => 'Activate sharing',
+ 'shaarli' => 'Shaarli',
+ 'wallabag' => 'wallabag',
+ 'diaspora' => 'Diaspora*',
+ 'twitter' => 'Twitter',
+ 'g+' => 'Google+',
+ 'facebook' => 'Facebook',
+ 'email' => 'Email',
+ 'print' => 'Print',
'article' => 'Article',
'title' => 'Title',
@@ -187,7 +236,7 @@ return array (
'by' => 'by',
'load_more' => 'Load more articles',
- 'nothing_to_load' => 'There is no more articles',
+ 'nothing_to_load' => 'There are no more articles',
'rss_feeds_of' => 'RSS feed of %s',
@@ -196,9 +245,10 @@ return array (
'today' => 'Today',
'yesterday' => 'Yesterday',
'before_yesterday' => 'Before yesterday',
+ 'new_article' => 'There are new available articles, click to refresh the page.',
'by_author' => 'By <em>%s</em>',
'related_tags' => 'Related tags',
- 'no_feed_to_display' => 'No feed to show.',
+ 'no_feed_to_display' => 'There is no article to show.',
'about_freshrss' => 'About FreshRSS',
'project_website' => 'Project website',
@@ -211,12 +261,14 @@ return array (
'freshrss_description' => 'FreshRSS is a RSS feeds aggregator to self-host like <a href="http://tontof.net/kriss/feed/">Kriss Feed</a> or <a href="http://projet.idleman.fr/leed/">Leed</a>. It is light and easy to take in hand while being powerful and configurable tool.',
'credits' => 'Credits',
'credits_content' => 'Some design elements come from <a href="http://twitter.github.io/bootstrap/">Bootstrap</a> although FreshRSS doesn’t use this framework. <a href="https://git.gnome.org/browse/gnome-icon-theme-symbolic">Icons</a> come from <a href="https://www.gnome.org/">GNOME project</a>. <em>Open Sans</em> font police used has been created by <a href="https://www.google.com/webfonts/specimen/Open+Sans">Steve Matteson</a>. Favicons are collected with <a href="https://getfavicon.appspot.com/">getFavicon API</a>. FreshRSS is based on <a href="https://github.com/marienfressinaud/MINZ">Minz</a>, a PHP framework.',
+ 'version' => 'Version',
'logs' => 'Logs',
'logs_empty' => 'Log file is empty',
+ 'clear_logs' => 'Clear the logs',
- 'forbidden_access' => 'Forbidden access',
- 'forbidden_access_description' => 'Access is password protected, please <a class="signin" href="#">sign in</a> to read your feeds.',
+ 'forbidden_access' => 'Access forbidden! (%s)',
+ 'login_required' => 'Login required:',
'confirm_action' => 'Are you sure you want to perform this action? It cannot be cancelled!',
@@ -247,61 +299,18 @@ return array (
'Nov' => '\N\o\v\e\m\b\e\r',
'Dec' => '\D\e\c\e\m\b\e\r',
// 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',
- '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 <em>build.sh</em> script or <a href="https://github.com/marienfressinaud/MINZ">download it on Github</a> and install in <em>%s</em> directory the content of its <em>/lib</em> 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',
- 'conf_is_ok' => 'Permissions on configuration directory are good',
- 'data_is_ok' => 'Permissions on data directory are good',
- 'file_is_nok' => 'Check permissions on <em>%s</em> 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 <em>install.php</em> 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 <em>%s</em> manually.',
+ 'format_date' => '%s j\<\s\u\p\>S\<\/\s\u\p\> Y',
+ 'format_date_hour' => '%s j\<\s\u\p\>S\<\/\s\u\p\> Y \a\t H\:i',
+
+ 'status_favorites' => 'Favourites',
+ 'status_read' => 'Read',
+ 'status_unread' => 'Unread',
+ 'status_total' => 'Total',
+
+ 'stats_entry_repartition' => 'Entries repartition',
+ 'stats_entry_per_day' => 'Entries per day (last 30 days)',
+ 'stats_feed_per_category' => 'Feeds per category',
+ 'stats_entry_per_category' => 'Entries per category',
+ 'stats_top_feed' => 'Top ten feeds',
+ 'stats_entry_count' => 'Entry count',
);
diff --git a/app/i18n/fr.php b/app/i18n/fr.php
index cc0a93031..9ab06ba26 100644
--- a/app/i18n/fr.php
+++ b/app/i18n/fr.php
@@ -5,13 +5,17 @@ return array (
'login' => 'Connexion',
'logout' => 'Déconnexion',
'search' => 'Rechercher des mots ou des #tags',
+ 'search_short' => 'Rechercher',
'configuration' => 'Configuration',
- 'general_and_reading' => 'Général et lecture',
+ 'users' => 'Utilisateurs',
'categories' => 'Catégories',
'category' => 'Catégorie',
+ 'feed' => 'Flux',
+ 'feeds' => 'Flux',
'shortcuts' => 'Raccourcis',
'about' => 'À propos',
+ 'stats' => 'Statistiques',
'your_rss_feeds' => 'Vos flux RSS',
'add_rss_feed' => 'Ajouter un flux RSS',
@@ -19,7 +23,8 @@ return array (
'import_export_opml' => 'Importer / exporter (OPML)',
'subscription_management' => 'Gestion des abonnements',
- 'all_feeds' => 'Flux principal (%d)',
+ 'main_stream' => 'Flux principal',
+ 'all_feeds' => 'Tous les flux',
'favorite_feeds' => 'Favoris (%d)',
'not_read' => '%d non lu',
'not_reads' => '%d non lus',
@@ -43,6 +48,8 @@ return array (
'rss_view' => 'Flux RSS',
'show_all_articles' => 'Afficher tous les articles',
'show_not_reads' => 'Afficher les non lus',
+ 'show_read' => 'Afficher les lus',
+ 'show_favorite' => 'Afficher les favoris',
'older_first' => 'Plus anciens en premier',
'newer_first' => 'Plus récents en premier',
@@ -59,7 +66,7 @@ return array (
'access_denied' => 'Vous n’avez pas le droit d’accéder à cette page',
'page_not_found' => 'La page que vous cherchez n’existe pas',
'error_occurred' => 'Une erreur est survenue',
- 'error_occurred_update' => 'Une erreur est survenue lors de la mise à jour',
+ 'error_occurred_update' => 'Rien n’a été modifié',
'default_category' => 'Sans catégorie',
'categories_updated' => 'Les catégories ont été mises à jour',
@@ -67,7 +74,7 @@ return array (
'feed_updated' => 'Le flux a été mis à jour',
'rss_feed_management' => 'Gestion des flux RSS',
'configuration_updated' => 'La configuration a été mise à jour',
- 'general_and_reading_management'=> 'Gestion générale et affichage',
+ 'sharing_management' => 'Gestion des options de partage',
'bad_opml_file' => 'Votre fichier OPML n’est pas valide',
'shortcuts_updated' => 'Les raccourcis ont été mis à jour',
'shortcuts_management' => 'Gestion des raccourcis',
@@ -83,10 +90,12 @@ return array (
'n_feeds_actualized' => '%d flux ont été mis à jour',
'feeds_actualized' => 'Les flux ont été mis à jour',
'no_feed_actualized' => 'Aucun flux n’a pu être mis à jour',
- 'feeds_imported_with_errors' => 'Les flux ont été importés mais des erreurs sont survenues',
- 'feeds_imported' => 'Les flux ont été importés',
+ 'n_entries_deleted' => '%d articles ont été supprimés',
+ 'feeds_imported_with_errors' => 'Vos flux ont été importés mais des erreurs sont survenues',
+ 'feeds_imported' => 'Vos flux ont été importés et vont maintenant être actualisés',
'category_emptied' => 'La catégorie a été vidée',
'feed_deleted' => 'Le flux a été supprimé',
+ 'feed_validator' => 'Vérifier la valididé du flux',
'optimization_complete' => 'Optimisation terminée',
@@ -119,6 +128,8 @@ return array (
'shift_for_first' => '+ <code>shift</code> pour passer au premier article de la page',
'next_page' => 'Passer à la page suivante',
'previous_page' => 'Passer à la page précédente',
+ 'collapse_article' => 'Refermer l’article courant',
+ 'auto_share' => 'Partager l’article courant',
'file_to_import' => 'Fichier à importer',
'import' => 'Importer',
@@ -127,11 +138,16 @@ return array (
'informations' => 'Informations',
'feed_in_error' => 'Ce flux a rencontré un problème. Veuillez vérifier qu’il est toujours accessible puis actualisez-le.',
+ 'feed_description' => 'Description',
'website_url' => 'URL du site',
'feed_url' => 'URL du flux',
+ 'articles' => 'articles',
'number_articles' => 'Nombre d’articles',
- 'keep_history' => 'Garder l’historique ?',
+ 'by_feed' => 'par flux',
+ 'by_default' => 'Par défaut',
+ 'keep_history' => 'Nombre minimum d’articles à conserver',
'categorize' => 'Ranger dans une catégorie',
+ 'truncate' => 'Supprimer tous les articles',
'advanced' => 'Avancé',
'show_in_all_flux' => 'Afficher dans le flux principal',
'yes' => 'Oui',
@@ -145,40 +161,73 @@ return array (
'not_yet_implemented' => 'Pas encore implémenté',
'access_protected_feeds' => 'La connexion permet d’accéder aux flux protégés par une authentification HTTP',
'no_selected_feed' => 'Aucun flux sélectionné.',
- 'think_to_add' => 'Pensez à en ajouter !',
+ 'think_to_add' => '<a href="./?c=configure&amp;a=feed">Vous pouvez ajouter des flux</a>.',
+
+ 'current_user' => 'Utilisateur actuel',
+ 'password_form' => 'Mot de passe<br /><small>(pour connexion par formulaire)</small>',
+ 'default_user' => 'Nom de l’utilisateur par défaut <small>(16 caractères alphanumériques maximum)</small>',
+ 'persona_connection_email' => 'Adresse courriel de connexion<br /><small>(pour <a href="https://persona.org/" rel="external">Mozilla Persona</a>)</small>',
+ 'allow_anonymous' => 'Autoriser la lecture anonyme des articles de l’utilisateur par défaut (%s)',
+ 'auth_token' => 'Jeton d’identification',
+ 'explain_token' => 'Permet d’accéder à la sortie RSS de l’utilisateur par défaut sans besoin de s’authentifier.<br /><kbd>%s?output=rss&token=%s</kbd>',
+ 'login_configuration' => 'Identification',
+ 'is_admin' => 'est administrateur',
+ 'auth_type' => 'Méthode d’authentification',
+ 'auth_none' => 'Aucune (dangereux)',
+ 'auth_form' => 'Formulaire (traditionnel, requiert JavaScript)',
+ 'http_auth' => 'HTTP (pour utilisateurs avancés avec HTTPS)',
+ 'auth_persona' => 'Mozilla Persona (moderne, requiert JavaScript)',
+ 'users_list' => 'Liste des utilisateurs',
+ 'create_user' => 'Créer un nouvel utilisateur',
+ 'username' => 'Nom d’utilisateur',
+ 'password' => 'Mot de passe',
+ 'create' => 'Créer',
+ 'user_created' => 'L’utilisateur %s a été créé',
+ 'user_deleted' => 'L’utilisateur %s a été supprimé',
- 'general_configuration' => 'Configuration générale',
'language' => 'Langue',
- 'delete_articles_every' => 'Supprimer les articles tous les',
'month' => 'mois',
- 'persona_connection_email' => 'Adresse courriel de connexion (utilise <a href="https://persona.org/">Persona</a>)',
- '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.<br />%s?output=rss&token=%s',
- 'reading_configuration' => 'Configuration de lecture',
+ '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',
'default_view' => 'Vue par défaut',
'sort_order' => 'Ordre de tri',
'auto_load_more' => 'Charger les articles suivants en bas de page',
'display_articles_unfolded' => 'Afficher les articles dépliés par défaut',
- 'after_onread' => 'Après marqué comme lu,',
- 'jump_next' => 'sauter au prochain voisin non lu',
- 'reading_icons' => 'Icônes de lecture',
- 'top_line' => 'Ligne du haut',
- 'bottom_line' => 'Ligne du bas',
+ 'after_onread' => 'Après “marquer tout comme lu”,',
+ 'jump_next' => 'sauter au prochain voisin non lu (flux ou catégorie)',
+ 'reading_icons' => 'Icônes de lecture',
+ 'top_line' => 'Ligne du haut',
+ 'bottom_line' => 'Ligne du bas',
'img_with_lazyload' => 'Utiliser le mode “chargement différé” pour les images',
- 'auto_read_when' => 'Marquer comme lu lorsque',
- 'article_selected' => 'l’article est sélectionné',
- 'article_open_on_website' => 'l’article est ouvert sur le site d’origine',
+ 'auto_read_when' => 'Marquer un article comme lu…',
+ 'article_selected' => 'lorsque l’article est sélectionné',
+ 'article_open_on_website' => 'lorsque l’article est ouvert sur le site d’origine',
'scroll' => 'au défilement de la page',
+ 'upon_reception' => 'dès la réception du nouvel article',
'your_shaarli' => 'Votre Shaarli',
+ 'your_wallabag' => 'Votre wallabag',
+ 'your_diaspora_pod' => 'Votre pod Diaspora*',
'sharing' => 'Partage',
'share' => 'Partager',
- 'by_email' => 'Par mail',
- 'on_shaarli' => 'Sur votre Shaarli',
+ 'by_email' => 'Par courriel',
'optimize_bdd' => 'Optimiser la base de données',
'optimize_todo_sometimes' => 'À faire de temps en temps pour réduire la taille de la BDD',
'theme' => 'Thème',
+ 'more_information' => 'Plus d’informations',
+ 'activate_sharing' => 'Activer le partage',
+ 'shaarli' => 'Shaarli',
+ 'wallabag' => 'wallabag',
+ 'diaspora' => 'Diaspora*',
+ 'twitter' => 'Twitter',
+ 'g+' => 'Google+',
+ 'facebook' => 'Facebook',
+ 'email' => 'Courriel',
+ 'print' => 'Imprimer',
'article' => 'Article',
'title' => 'Titre',
@@ -196,9 +245,10 @@ return array (
'today' => 'Aujourd’hui',
'yesterday' => 'Hier',
'before_yesterday' => 'À partir d’avant-hier',
+ 'new_article' => 'Il y a de nouveaux articles disponibles, cliquez pour rafraîchir la page.',
'by_author' => 'Par <em>%s</em>',
'related_tags' => 'Tags associés',
- 'no_feed_to_display' => 'Il n’y a aucun flux à afficher.',
+ 'no_feed_to_display' => 'Il n’y a aucun article à afficher.',
'about_freshrss' => 'À propos de FreshRSS',
'project_website' => 'Site du projet',
@@ -211,12 +261,14 @@ return array (
'freshrss_description' => 'FreshRSS est un agrégateur de flux RSS à auto-héberger à l’image de <a href="http://tontof.net/kriss/feed/">Kriss Feed</a> ou <a href="http://projet.idleman.fr/leed/">Leed</a>. 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 <a href="http://twitter.github.io/bootstrap/">projet Bootstrap</a> bien que FreshRSS n’utilise pas ce framework. Les <a href="https://git.gnome.org/browse/gnome-icon-theme-symbolic">icônes</a> sont issues du <a href="https://www.gnome.org/">projet GNOME</a>. La police <em>Open Sans</em> utilisée a été créée par <a href="https://www.google.com/webfonts/specimen/Open+Sans">Steve Matteson</a>. Les favicons sont récupérés grâce au site <a href="https://getfavicon.appspot.com/">getFavicon</a>. FreshRSS repose sur <a href="https://github.com/marienfressinaud/MINZ">Minz</a>, un framework PHP.',
+ 'version' => 'Version',
'logs' => 'Logs',
'logs_empty' => 'Les logs sont vides',
+ 'clear_logs' => 'Effacer les logs',
- 'forbidden_access' => 'Accès interdit',
- 'forbidden_access_description' => 'L’accès est protégé par un mot de passe, veuillez <a class="signin" href="#">vous connecter</a> pour accéder aux flux.',
+ 'forbidden_access' => 'Accès interdit ! (%s)',
+ 'login_required' => 'Accès protégé par mot de passe :',
'confirm_action' => 'Êtes-vous sûr(e) de vouloir continuer ? Cette action ne peut être annulée !',
@@ -247,61 +299,18 @@ return array (
'Nov' => '\n\o\v\e\m\b\r\e',
'Dec' => '\d\é\c\e\m\b\r\e',
// 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',
- '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 <em>build.sh</em> ou bien <a href="https://github.com/marienfressinaud/MINZ">la télécharger sur Github</a> et installer dans le répertoire <em>%s</em> le contenu de son répertoire <em>/lib</em>.',
- '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',
- 'conf_is_ok' => 'Les droits sur le répertoire de configuration 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 <em>%s</em>. 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 <em>install.php</em> 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 <em>%s</em> à la main.',
+ 'format_date' => 'j %s Y',
+ 'format_date_hour' => 'j %s Y \à H\:i',
+
+ 'status_favorites' => 'favoris',
+ 'status_read' => 'lus',
+ 'status_unread' => 'non lus',
+ 'status_total' => 'total',
+
+ 'stats_entry_repartition' => 'Répartition des articles',
+ 'stats_entry_per_day' => 'Nombre d’articles par jour (30 derniers jours)',
+ 'stats_feed_per_category' => 'Flux par catégorie',
+ 'stats_entry_per_category' => 'Articles par catégorie',
+ 'stats_top_feed' => 'Les dix plus gros flux',
+ 'stats_entry_count' => 'Nombre d’articles',
);
diff --git a/app/i18n/install.en.php b/app/i18n/install.en.php
new file mode 100644
index 000000000..0311ee9a4
--- /dev/null
+++ b/app/i18n/install.en.php
@@ -0,0 +1,67 @@
+<?php
+return array (
+ 'freshrss_installation' => 'Installation · FreshRSS',
+ 'freshrss' => 'FreshRSS',
+ 'installation_step' => 'Installation — step %d · FreshRSS',
+ 'steps' => 'Steps',
+ 'checks' => 'Checks',
+ 'general_configuration' => 'General configuration',
+ '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 <em>build.sh</em> script or <a href="https://github.com/marienfressinaud/MINZ">download it on Github</a> and install in <em>%s</em> directory the content of its <em>/lib</em> 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)',
+ 'pcre_is_ok' => 'You have the required library for regular expressions (PCRE)',
+ 'pcre_is_nok' => 'You lack a required library for regular expressions (php-pcre)',
+ 'ctype_is_ok' => 'You have the required library for character type checking (ctype)',
+ 'ctype_is_nok' => 'You lack a required library for character type checking (php-ctype)',
+ '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',
+ 'persona_is_ok' => 'Permissions on Mozilla Persona directory are good',
+ 'file_is_nok' => 'Check permissions on <em>%s</em> 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',
+ '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.',
+ 'update_end' => 'Update process is completed, now you can go to the final step.',
+
+
+ 'installation_is_ok' => 'The installation process was successful.<br />The final step will now attempt to delete the <kbd>./p/i/install.php</kbd> file and any database backup created during the update process.<br />You may choose to skip this step and delete <kbd>./p/i/install.php</kbd> manually.',
+ 'finish_installation' => 'Complete installation',
+ 'install_not_deleted' => 'Something went wrong; you must delete the file <em>%s</em> manually.',
+);
diff --git a/app/i18n/install.fr.php b/app/i18n/install.fr.php
new file mode 100644
index 000000000..bb183642f
--- /dev/null
+++ b/app/i18n/install.fr.php
@@ -0,0 +1,66 @@
+<?php
+return array (
+ 'freshrss_installation' => 'Installation · FreshRSS',
+ 'freshrss' => 'FreshRSS',
+ 'installation_step' => 'Installation — étape %d · FreshRSS',
+ 'steps' => 'Étapes',
+ 'checks' => 'Vérifications',
+ 'general_configuration' => 'Configuration générale',
+ '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 <em>build.sh</em> ou bien <a href="https://github.com/marienfressinaud/MINZ">la télécharger sur Github</a> et installer dans le répertoire <em>%s</em> le contenu de son répertoire <em>/lib</em>.',
+ 'curl_is_ok' => 'Vous disposez de cURL dans sa version %s',
+ 'curl_is_nok' => 'Vous ne disposez pas de cURL (paquet php5-curl)',
+ 'pdomysql_is_ok' => 'Vous disposez de PDO et de son driver pour MySQL (paquet 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' => 'Il manque une librairie pour parcourir le DOM (paquet php-xml)',
+ 'pcre_is_ok' => 'Vous disposez du nécessaire pour les expressions régulières (PCRE)',
+ 'pcre_is_nok' => 'Il manque une librairie pour les expressions régulières (php-pcre)',
+ 'ctype_is_ok' => 'Vous disposez du nécessaire pour la vérification des types de caractères (ctype)',
+ 'ctype_is_nok' => 'Il manque une librairie pour la vérification des types de caractères (php-ctype)',
+ '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',
+ 'persona_is_ok' => 'Les droits sur le répertoire de Mozilla Persona sont bons',
+ 'file_is_nok' => 'Veuillez vérifier les droits sur le répertoire <em>%s</em>. 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',
+ '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.',
+ 'update_end' => 'La mise à jour est terminée, vous pouvez maintenant passer à l’étape finale.',
+
+ 'installation_is_ok' => 'L’installation s’est bien passée.<br />La dernière étape va maintenant tenter de supprimer le fichier <kbd>./p/i/install.php</kbd>, ainsi que d’éventuelles copies de base de données créées durant le processus de mise à jour.<br />Vous pouvez choisir de sauter cette étape et de supprimer <kbd>./p/i/install.php</kbd> manuellement.',
+ 'finish_installation' => 'Terminer l’installation',
+ 'install_not_deleted' => 'Quelque chose s’est mal passé, vous devez supprimer le fichier <em>%s</em> à la main.',
+);
diff --git a/app/index.html b/app/index.html
new file mode 100644
index 000000000..85faaa37e
--- /dev/null
+++ b/app/index.html
@@ -0,0 +1,13 @@
+<!DOCTYPE html>
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-GB" lang="en-GB">
+<head>
+<meta charset="UTF-8" />
+<meta http-equiv="Refresh" content="0; url=/" />
+<title>Redirection</title>
+<meta name="robots" content="noindex" />
+</head>
+
+<body>
+<p><a href="/">Redirection</a></p>
+</body>
+</html>
diff --git a/app/layout/aside_configure.phtml b/app/layout/aside_configure.phtml
index 0ca2ed099..27f11ab6d 100644
--- a/app/layout/aside_configure.phtml
+++ b/app/layout/aside_configure.phtml
@@ -1,10 +1,19 @@
-<div class="nav nav-list aside">
- <li class="nav-header"><?php echo Translate::t ('configuration'); ?></li>
-
- <li class="item<?php echo Request::actionName () == 'display' ? ' active' : ''; ?>">
- <a href="<?php echo Url::display (array ('c' => 'configure', 'a' => 'display')); ?>"><?php echo Translate::t ('general_and_reading'); ?></a>
+<ul class="nav nav-list aside">
+ <li class="nav-header"><?php echo Minz_Translate::t ('configuration'); ?></li>
+ <li class="item<?php echo Minz_Request::actionName () == 'display' ? ' active' : ''; ?>">
+ <a href="<?php echo _url ('configure', 'display'); ?>"><?php echo Minz_Translate::t ('reading_configuration'); ?></a>
</li>
- <li class="item<?php echo Request::actionName () == 'shortcut' ? ' active' : ''; ?>">
- <a href="<?php echo Url::display (array ('c' => 'configure', 'a' => 'shortcut')); ?>"><?php echo Translate::t ('shortcuts'); ?></a>
+ <li class="item<?php echo Minz_Request::actionName () == 'archiving' ? ' active' : ''; ?>">
+ <a href="<?php echo _url ('configure', 'archiving'); ?>"><?php echo Minz_Translate::t ('archiving_configuration'); ?></a>
</li>
-</div>
+ <li class="item<?php echo Minz_Request::actionName () == 'sharing' ? ' active' : ''; ?>">
+ <a href="<?php echo _url ('configure', 'sharing'); ?>"><?php echo Minz_Translate::t ('sharing'); ?></a>
+ </li>
+ <li class="item<?php echo Minz_Request::actionName () == 'shortcut' ? ' active' : ''; ?>">
+ <a href="<?php echo _url ('configure', 'shortcut'); ?>"><?php echo Minz_Translate::t ('shortcuts'); ?></a>
+ </li>
+ <li class="separator"></li>
+ <li class="item<?php echo Minz_Request::actionName () == 'users' ? ' active' : ''; ?>">
+ <a href="<?php echo _url ('configure', 'users'); ?>"><?php echo Minz_Translate::t ('users'); ?></a>
+ </li>
+</ul>
diff --git a/app/layout/aside_feed.phtml b/app/layout/aside_feed.phtml
index 1f60e3ada..e324b15bd 100644
--- a/app/layout/aside_feed.phtml
+++ b/app/layout/aside_feed.phtml
@@ -1,22 +1,22 @@
<ul class="nav nav-list aside aside_feed">
- <li class="nav-header"><?php echo Translate::t ('your_rss_feeds'); ?></li>
+ <li class="nav-header"><?php echo Minz_Translate::t ('your_rss_feeds'); ?></li>
- <li class="nav-form"><form id="add_rss" method="post" action="<?php echo Url::display (array ('c' => 'feed', 'a' => 'add')); ?>">
+ <li class="nav-form"><form id="add_rss" method="post" action="<?php echo Minz_Url::display (array ('c' => 'feed', 'a' => 'add')); ?>" autocomplete="off">
<div class="stick">
- <input type="url" name="url_rss" placeholder="<?php echo Translate::t ('add_rss_feed'); ?>" />
+ <input type="url" name="url_rss" placeholder="<?php echo Minz_Translate::t ('add_rss_feed'); ?>" />
<div class="dropdown">
<div id="dropdown-cat" class="dropdown-target"></div>
- <a class="dropdown-toggle btn" href="#dropdown-cat"><i class="icon i_down"></i></a>
+ <a class="dropdown-toggle btn" href="#dropdown-cat"><?php echo FreshRSS_Themes::icon('down'); ?></a>
<ul class="dropdown-menu">
- <li class="dropdown-close"><a href="#close">&nbsp;</a></li>
+ <li class="dropdown-close"><a href="#close">❌</a></li>
- <li class="dropdown-header"><?php echo Translate::t ('category'); ?></li>
+ <li class="dropdown-header"><?php echo Minz_Translate::t ('category'); ?></li>
<li class="input">
<select name="category" id="category">
<?php foreach ($this->categories as $cat) { ?>
- <option value="<?php echo $cat->id (); ?>"<?php echo $cat->id () == '000000' ? ' selected="selected"' : ''; ?>>
+ <option value="<?php echo $cat->id (); ?>"<?php echo $cat->id () == 1 ? ' selected="selected"' : ''; ?>>
<?php echo $cat->name (); ?>
</option>
<?php } ?>
@@ -25,25 +25,25 @@
<li class="separator"></li>
- <li class="dropdown-header"><?php echo Translate::t ('http_authentication'); ?></li>
+ <li class="dropdown-header"><?php echo Minz_Translate::t ('http_authentication'); ?></li>
<li class="input">
- <input type="text" name="username" id="username" placeholder="<?php echo Translate::t ('username'); ?>" />
+ <input type="text" name="http_user" id="http_user_add" autocomplete="off" placeholder="<?php echo Minz_Translate::t ('username'); ?>" />
</li>
<li class="input">
- <input type="password" name="password" id="password" placeholder="<?php echo Translate::t ('password'); ?>" />
+ <input type="password" name="http_pass" id="http_pass_add" autocomplete="off" placeholder="<?php echo Minz_Translate::t ('password'); ?>" />
</li>
</ul>
</div>
- <button class="btn" type="submit"><i class="icon i_add"></i></button>
+ <button class="btn" type="submit"><?php echo FreshRSS_Themes::icon('add'); ?></button>
</div>
</form></li>
- <li class="item<?php echo Request::actionName () == 'importExport' ? ' active' : ''; ?>">
- <a href="<?php echo _url ('configure', 'importExport'); ?>"><?php echo Translate::t ('import_export_opml'); ?></a>
+ <li class="item<?php echo Minz_Request::actionName () == 'importExport' ? ' active' : ''; ?>">
+ <a href="<?php echo _url ('configure', 'importExport'); ?>"><?php echo Minz_Translate::t ('import_export_opml'); ?></a>
</li>
- <li class="item<?php echo Request::actionName () == 'categorize' ? ' active' : ''; ?>">
- <a href="<?php echo _url ('configure', 'categorize'); ?>"><?php echo Translate::t ('categories_management'); ?></a>
+ <li class="item<?php echo Minz_Request::actionName () == 'categorize' ? ' active' : ''; ?>">
+ <a href="<?php echo _url ('configure', 'categorize'); ?>"><?php echo Minz_Translate::t ('categories_management'); ?></a>
</li>
<li class="separator"></li>
@@ -54,11 +54,11 @@
<li class="item<?php echo ($this->flux && $this->flux->id () == $feed->id ()) ? ' active' : ''; ?><?php echo $feed->inError () ? ' error' : ''; ?><?php echo $nbEntries == 0 ? ' empty' : ''; ?>">
<a href="<?php echo _url ('configure', 'feed', 'id', $feed->id ()); ?>">
<img class="favicon" src="<?php echo $feed->favicon (); ?>" alt="✇" />
- <?php echo htmlspecialchars($feed->name (), ENT_NOQUOTES, 'UTF-8'); ?>
+ <?php echo $feed->name (); ?>
</a>
</li>
<?php } ?>
<?php } else { ?>
- <li class="item disable"><?php echo Translate::t ('no_rss_feed'); ?></li>
+ <li class="item disable"><?php echo Minz_Translate::t ('no_rss_feed'); ?></li>
<?php } ?>
</ul>
diff --git a/app/layout/aside_flux.phtml b/app/layout/aside_flux.phtml
index ea2ea04ec..8454b4459 100644
--- a/app/layout/aside_flux.phtml
+++ b/app/layout/aside_flux.phtml
@@ -1,81 +1,88 @@
<div class="aside aside_flux" id="aside_flux">
- <a class="toggle_aside" href="#close"><i class="icon i_close"></i></a>
+ <a class="toggle_aside" href="#close"><?php echo FreshRSS_Themes::icon('close'); ?></a>
<ul class="categories">
- <?php if (!login_is_conf ($this->conf) || is_logged ()) { ?>
+ <?php if ($this->loginOk) { ?>
<li>
<div class="stick">
- <a class="btn btn-important" href="<?php echo _url ('configure', 'feed'); ?>"><?php echo Translate::t ('subscription_management'); ?></a>
- <a class="btn btn-important" href="<?php echo _url ('configure', 'categorize'); ?>"><i class="icon i_category"></i></a>
+ <a class="btn btn-important" href="<?php echo _url ('configure', 'feed'); ?>"><?php echo Minz_Translate::t ('subscription_management'); ?></a>
+ <a class="btn btn-important" href="<?php echo _url ('configure', 'categorize'); ?>" title="<?php echo Minz_Translate::t ('categories_management'); ?>"><?php echo FreshRSS_Themes::icon('category-white'); ?></a>
</div>
</li>
- <?php } elseif (login_is_conf ($this->conf)) { ?>
- <li><a href="<?php echo _url ('index', 'about'); ?>"><?php echo Translate::t ('about_freshrss'); ?></a></li>
+ <?php } elseif (Minz_Configuration::needsLogin()) { ?>
+ <li><a href="<?php echo _url ('index', 'about'); ?>"><?php echo Minz_Translate::t ('about_freshrss'); ?></a></li>
<?php } ?>
+ <?php
+ $arUrl = array('c' => 'index', 'a' => 'index', 'params' => array());
+ if ($this->conf->view_mode !== Minz_Request::param('output', 'normal')) {
+ $arUrl['params']['output'] = 'normal';
+ }
+ ?>
<li>
<div class="category all">
- <a data-unread="<?php echo $this->nb_not_read; ?>" class="btn<?php echo $this->get_c == 'all' ? ' active' : ''; ?>" href="<?php echo _url ('index', 'index'); ?>">
- <i class="icon i_all"></i>
- <?php echo Translate::t ('all_feeds', $this->nb_total); ?>
+ <a data-unread="<?php echo formatNumber($this->nb_not_read); ?>" class="btn<?php echo $this->get_c == 'a' ? ' active' : ''; ?>" href="<?php echo Minz_Url::display($arUrl); ?>">
+ <?php echo FreshRSS_Themes::icon('all'); ?>
+ <?php echo Minz_Translate::t ('main_stream'); ?>
</a>
</div>
</li>
<li>
<div class="category favorites">
- <a data-unread="<?php echo $this->nb_favorites['unread']; ?>" class="btn<?php echo $this->get_c == 'favoris' ? ' active' : ''; ?>" href="<?php echo _url ('index', 'index', 'get', 'favoris'); ?>">
- <i class="icon i_bookmark"></i>
- <?php echo Translate::t ('favorite_feeds', $this->nb_favorites['read'] + $this->nb_favorites['unread']); ?>
+ <a data-unread="<?php echo formatNumber($this->nb_favorites['unread']); ?>" class="btn<?php echo $this->get_c == 's' ? ' active' : ''; ?>" href="<?php $arUrl['params']['get'] = 's'; echo Minz_Url::display($arUrl); ?>">
+ <?php echo FreshRSS_Themes::icon('bookmark'); ?>
+ <?php echo Minz_Translate::t('favorite_feeds', formatNumber($this->nb_favorites['all'])); ?>
</a>
</div>
</li>
- <?php foreach ($this->cat_aside as $cat) { ?>
- <?php $feeds = $cat->feeds (); ?>
- <?php if (!empty ($feeds)) { ?>
- <li>
- <?php $c_active = false; if ($this->get_c == $cat->id ()) { $c_active = true; } ?>
- <div class="category stick<?php echo $c_active ? ' active' : ''; ?>">
- <a data-unread="<?php echo $cat->nbNotRead (); ?>" class="btn<?php echo $c_active ? ' active' : ''; ?>" href="<?php echo _url ('index', 'index', 'get', 'c_' . $cat->id ()); ?>">
- <?php echo htmlspecialchars($cat->name (), ENT_NOQUOTES, 'UTF-8'); ?>
- </a>
- <a class="btn dropdown-toggle" href="#"><i class="icon <?php echo $c_active ? 'i_up' : 'i_down'; ?>"></i></a>
- </div>
-
- <ul class="feeds<?php echo $c_active ? ' active' : ''; ?>">
- <?php foreach ($feeds as $feed) {
- $feed_id = $feed->id (); $nbEntries = $feed->nbEntries ();
- $f_active = ($this->get_f == $feed_id);
- ?>
- <li id="f_<?php echo $feed_id; ?>" class="item<?php echo $f_active ? ' active' : ''; ?><?php echo $feed->inError () ? ' error' : ''; ?><?php echo $nbEntries == 0 ? ' empty' : ''; ?>">
- <div class="dropdown">
- <div class="dropdown-target"></div>
- <a class="dropdown-toggle" data-fweb="<?php echo $feed->website (); ?>"><i class="icon i_configure"></i></a>
-<?php /* feed_config_template */ ?>
- </div>
- <img class="favicon" src="<?php echo $feed->favicon (); ?>" alt="✇" />
- <a class="feed" data-unread="<?php echo $feed->nbNotRead (); ?>" data-priority="<?php echo $feed->priority (); ?>" href="<?php echo _url ('index', 'index', 'get', 'f_' . $feed_id); ?>"><?php echo htmlspecialchars($feed->name(), ENT_NOQUOTES, 'UTF-8'); ?></a>
- </li>
- <?php } ?>
- </ul>
- </li>
- <?php } } ?>
+ <?php
+ foreach ($this->cat_aside as $cat) {
+ $feeds = $cat->feeds ();
+ if (!empty ($feeds)) {
+ ?><li><?php
+ $c_active = false;
+ if ($this->get_c == $cat->id ()) {
+ $c_active = true;
+ }
+ ?><div class="category stick<?php echo $c_active ? ' active' : ''; ?>"><?php
+ ?><a data-unread="<?php echo formatNumber($cat->nbNotRead()); ?>" class="btn<?php echo $c_active ? ' active' : ''; ?>" href="<?php $arUrl['params']['get'] = 'c_' . $cat->id(); echo Minz_Url::display($arUrl); ?>"><?php echo $cat->name (); ?></a><?php
+ ?><a class="btn dropdown-toggle" href="#"><?php echo FreshRSS_Themes::icon($c_active ? 'up' : 'down'); ?></a><?php
+ ?></div><?php
+ ?><ul class="feeds<?php echo $c_active ? ' active' : ''; ?>"><?php
+ foreach ($feeds as $feed) {
+ $feed_id = $feed->id ();
+ $nbEntries = $feed->nbEntries ();
+ $f_active = ($this->get_f == $feed_id);
+ ?><li id="f_<?php echo $feed_id; ?>" class="item<?php echo $f_active ? ' active' : ''; ?><?php echo $feed->inError () ? ' error' : ''; ?><?php echo $nbEntries == 0 ? ' empty' : ''; ?>"><?php
+ ?><div class="dropdown"><?php
+ ?><div class="dropdown-target"></div><?php
+ ?><a class="dropdown-toggle" data-fweb="<?php echo $feed->website (); ?>"><?php echo FreshRSS_Themes::icon('configure'); ?></a><?php
+ /* feed_config_template */
+ ?></div><?php
+ ?> <img class="favicon" src="<?php echo $feed->favicon (); ?>" alt="✇" /> <?php
+ ?><a class="feed" data-unread="<?php echo formatNumber($feed->nbNotRead()); ?>" data-priority="<?php echo $feed->priority (); ?>" href="<?php $arUrl['params']['get'] = 'f_' . $feed_id; echo Minz_Url::display($arUrl); ?>"><?php echo $feed->name(); ?></a><?php
+ ?></li><?php
+ }
+ ?></ul><?php
+ ?></li><?php
+ }
+ } ?>
</ul>
-
<span class="aside_flux_ender"><!-- For fixed menu --></span>
</div>
<script id="feed_config_template" type="text/html">
<ul class="dropdown-menu">
- <li class="dropdown-close"><a href="#close">&nbsp;</a></li>
- <li class="item"><a href="<?php echo _url ('index', 'index', 'get', 'f_!!!!!!'); ?>"><?php echo Translate::t ('filter'); ?></a></li>
- <li class="item"><a target="_blank" href="http://example.net/"><?php echo Translate::t ('see_website'); ?></a></li>
- <?php if (!login_is_conf ($this->conf) || is_logged ()) { ?>
+ <li class="dropdown-close"><a href="#close">❌</a></li>
+ <li class="item"><a href="<?php echo _url ('index', 'index', 'get', 'f_!!!!!!'); ?>"><?php echo Minz_Translate::t ('filter'); ?></a></li>
+ <li class="item"><a target="_blank" href="http://example.net/"><?php echo Minz_Translate::t ('see_website'); ?></a></li>
+ <?php if ($this->loginOk) { ?>
<li class="separator"></li>
- <li class="item"><a href="<?php echo _url ('configure', 'feed', 'id', '!!!!!!'); ?>"><?php echo Translate::t ('administration'); ?></a></li>
- <li class="item"><a href="<?php echo _url ('feed', 'actualize', 'id', '!!!!!!'); ?>"><?php echo Translate::t ('actualize'); ?></a></li>
- <li class="item"><a href="<?php echo _url ('entry', 'read', 'is_read', 1, 'get', 'f_!!!!!!'); ?>"><?php echo Translate::t ('mark_read'); ?></a></li>
+ <li class="item"><a href="<?php echo _url ('configure', 'feed', 'id', '!!!!!!'); ?>"><?php echo Minz_Translate::t ('administration'); ?></a></li>
+ <li class="item"><a href="<?php echo _url ('feed', 'actualize', 'id', '!!!!!!'); ?>"><?php echo Minz_Translate::t ('actualize'); ?></a></li>
+ <li class="item"><a href="<?php echo _url ('entry', 'read', 'get', 'f_!!!!!!'); ?>"><?php echo Minz_Translate::t ('mark_read'); ?></a></li>
<?php } ?>
</ul>
</script>
diff --git a/app/layout/header.phtml b/app/layout/header.phtml
index e67f92141..eef53a3fd 100644
--- a/app/layout/header.phtml
+++ b/app/layout/header.phtml
@@ -1,79 +1,107 @@
-<?php if (login_is_conf ($this->conf)) { ?>
-<ul class="nav nav-head nav-login">
- <?php if (!is_logged ()) { ?>
- <li class="item"><i class="icon i_login"></i> <a class="signin" href="#"><?php echo Translate::t ('login'); ?></a></li>
- <?php } else { ?>
- <li class="item"><i class="icon i_logout"></i> <a class="signout" href="#"><?php echo Translate::t ('logout'); ?></a></li>
- <?php } ?>
-</ul>
-<?php } ?>
+<?php
+if (Minz_Configuration::canLogIn()) {
+ ?><ul class="nav nav-head nav-login"><?php
+ switch (Minz_Configuration::authType()) {
+ case 'form':
+ if ($this->loginOk) {
+ ?><li class="item"><?php echo FreshRSS_Themes::icon('logout'); ?> <a class="signout" href="<?php echo _url ('index', 'formLogout'); ?>"><?php echo Minz_Translate::t ('logout'); ?></a></li><?php
+ } else {
+ ?><li class="item"><?php echo FreshRSS_Themes::icon('login'); ?> <a class="signin" href="<?php echo _url ('index', 'formLogin'); ?>"><?php echo Minz_Translate::t ('login'); ?></a></li><?php
+ }
+ break;
+ case 'persona':
+ if ($this->loginOk) {
+ ?><li class="item"><?php echo FreshRSS_Themes::icon('logout'); ?> <a class="signout" href="#"><?php echo Minz_Translate::t ('logout'); ?></a></li><?php
+ } else {
+ ?><li class="item"><?php echo FreshRSS_Themes::icon('login'); ?> <a class="signin" href="#"><?php echo Minz_Translate::t ('login'); ?></a></li><?php
+ }
+ break;
+ }
+ ?></ul><?php
+}
+?>
<div class="header">
<div class="item title">
<h1>
<a href="<?php echo _url ('index', 'index'); ?>">
- <img class="logo" width="32" height="32" src="<?php echo Url::display ('/themes/icons/icon-32.png'); ?>" alt="[logo]" />
- <?php echo Configuration::title (); ?>
+ <img class="logo" src="<?php echo Minz_Url::display ('/themes/icons/icon.svg'); ?>" alt="⊚" />
+ <?php echo Minz_Configuration::title (); ?>
</a>
</h1>
</div>
<div class="item search">
- <?php if(!login_is_conf ($this->conf) ||
- is_logged() ||
- $this->conf->anonAccess() == 'yes') { ?>
+ <?php if ($this->loginOk || Minz_Configuration::allowAnonymous()) { ?>
<form action="<?php echo _url ('index', 'index'); ?>" method="get">
<div class="stick">
- <?php $search = Request::param ('search', ''); ?>
- <input type="text" name="search" id="search" value="<?php echo $search; ?>" placeholder="<?php echo Translate::t ('search'); ?>" />
+ <?php $search = Minz_Request::param ('search', ''); ?>
+ <input type="search" name="search" id="search" class="extend" value="<?php echo $search; ?>" placeholder="<?php echo Minz_Translate::t ('search'); ?>" />
- <?php $get = Request::param ('get', ''); ?>
+ <?php $get = Minz_Request::param ('get', ''); ?>
<?php if($get != '') { ?>
<input type="hidden" name="get" value="<?php echo $get; ?>" />
<?php } ?>
- <?php $order = Request::param ('order', ''); ?>
+ <?php $order = Minz_Request::param ('order', ''); ?>
<?php if($order != '') { ?>
<input type="hidden" name="order" value="<?php echo $order; ?>" />
<?php } ?>
- <?php $state = Request::param ('state', ''); ?>
+ <?php $state = Minz_Request::param ('state', ''); ?>
<?php if($state != '') { ?>
<input type="hidden" name="state" value="<?php echo $state; ?>" />
<?php } ?>
- <button class="btn" type="submit"><i class="icon i_search"></i></button>
+ <button class="btn" type="submit"><?php echo FreshRSS_Themes::icon('search'); ?></button>
</div>
</form>
<?php } ?>
</div>
- <?php if (!login_is_conf ($this->conf) || is_logged ()) { ?>
+ <?php if ($this->loginOk) { ?>
<div class="item configure">
<div class="dropdown">
<div id="dropdown-configure" class="dropdown-target"></div>
-
- <a class="btn dropdown-toggle" href="#dropdown-configure"><i class="icon i_configure"></i></a>
+ <a class="btn dropdown-toggle" href="#dropdown-configure"><?php echo FreshRSS_Themes::icon('configure'); ?></a>
<ul class="dropdown-menu">
- <li class="dropdown-close"><a href="#close">&nbsp;</a></li>
- <li class="dropdown-header"><?php echo Translate::t ('configuration'); ?></li>
- <li class="item"><a href="<?php echo _url ('configure', 'display'); ?>"><?php echo Translate::t ('general_and_reading'); ?></a></li>
- <li class="item"><a href="<?php echo _url ('configure', 'shortcut'); ?>"><?php echo Translate::t ('shortcuts'); ?></a></li>
+ <li class="dropdown-close"><a href="#close">❌</a></li>
+ <li class="dropdown-header"><?php echo Minz_Translate::t ('configuration'); ?></li>
+ <li class="item"><a href="<?php echo _url ('configure', 'display'); ?>"><?php echo Minz_Translate::t ('reading_configuration'); ?></a></li>
+ <li class="item"><a href="<?php echo _url ('configure', 'archiving'); ?>"><?php echo Minz_Translate::t ('archiving_configuration'); ?></a></li>
+ <li class="item"><a href="<?php echo _url ('configure', 'sharing'); ?>"><?php echo Minz_Translate::t ('sharing'); ?></a></li>
+ <li class="item"><a href="<?php echo _url ('configure', 'shortcut'); ?>"><?php echo Minz_Translate::t ('shortcuts'); ?></a></li>
<li class="separator"></li>
- <li class="item"><a href="<?php echo _url ('index', 'about'); ?>"><?php echo Translate::t ('about'); ?></a></li>
- <li class="item"><a href="<?php echo _url ('index', 'logs'); ?>"><?php echo Translate::t ('logs'); ?></a></li>
- <?php if (login_is_conf ($this->conf) && is_logged ()) { ?>
+ <li class="item"><a href="<?php echo _url ('configure', 'users'); ?>"><?php echo Minz_Translate::t ('users'); ?></a></li>
<li class="separator"></li>
- <li class="item"><a class="signout" href="#"><i class="icon i_logout"></i> <?php echo Translate::t ('logout'); ?></a></li>
- <?php } ?>
+ <li class="item"><a href="<?php echo _url ('index', 'stats'); ?>"><?php echo Minz_Translate::t ('stats'); ?></a></li>
+ <li class="item"><a href="<?php echo _url ('index', 'about'); ?>"><?php echo Minz_Translate::t ('about'); ?></a></li>
+ <li class="item"><a href="<?php echo _url ('index', 'logs'); ?>"><?php echo Minz_Translate::t ('logs'); ?></a></li>
+ <?php
+ if (Minz_Configuration::canLogIn()) {
+ ?><li class="separator"></li><?php
+ switch (Minz_Configuration::authType()) {
+ case 'form':
+ ?><li class="item"><a class="signout" href="<?php echo _url ('index', 'formLogout'); ?>"><?php echo FreshRSS_Themes::icon('logout'), ' ', Minz_Translate::t ('logout'); ?></a></li><?php
+ break;
+ case 'persona':
+ ?><li class="item"><a class="signout" href="#"><?php echo FreshRSS_Themes::icon('logout'), ' ', Minz_Translate::t ('logout'); ?></a></li><?php
+ break;
+ }
+ } ?>
</ul>
</div>
</div>
- <?php }
-
- if (login_is_conf ($this->conf) && !is_logged ()) { ?>
- <div class="item configure">
- <i class="icon i_login"></i> <a class="signin" href="#"><?php echo Translate::t ('login'); ?></a>
- </div>
- <?php } ?>
+ <?php } elseif (Minz_Configuration::canLogIn()) {
+ ?><div class="item configure"><?php
+ switch (Minz_Configuration::authType()) {
+ case 'form':
+ echo FreshRSS_Themes::icon('login'); ?><a class="signin" href="<?php echo _url ('index', 'formLogin'); ?>"><?php echo Minz_Translate::t ('login'); ?></a></li><?php
+ break;
+ case 'persona':
+ echo FreshRSS_Themes::icon('login'); ?><a class="signin" href="#"><?php echo Minz_Translate::t ('login'); ?></a></li><?php
+ break;
+ }
+ ?></div><?php
+ } ?>
</div>
diff --git a/app/layout/layout.phtml b/app/layout/layout.phtml
index bb4a1f7eb..d6a1737ee 100644
--- a/app/layout/layout.phtml
+++ b/app/layout/layout.phtml
@@ -1,5 +1,5 @@
<!DOCTYPE html>
-<html lang="<?php echo $this->conf->language (); ?>" xml:lang="<?php echo $this->conf->language (); ?>">
+<html lang="<?php echo $this->conf->language; ?>" xml:lang="<?php echo $this->conf->language; ?>">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="initial-scale=1.0" />
@@ -10,20 +10,25 @@
<?php $this->renderHelper ('javascript_vars'); ?>
//]]></script>
<?php
- $next = isset($this->entryPaginator) ? $this->entryPaginator->next() : '';
- if (!empty($next)) {
- $params = Request::params ();
- $params['next'] = $next;
+ if (!empty($this->nextId)) {
+ $params = Minz_Request::params ();
+ $params['next'] = $this->nextId;
?>
- <link id="prefetch" rel="next prefetch" href="<?php echo Url::display (array ('c' => Request::controllerName (), 'a' => Request::actionName (), 'params' => $params)); ?>" />
+ <link id="prefetch" rel="next prefetch" href="<?php echo Minz_Url::display (array ('c' => Minz_Request::controllerName (), 'a' => Minz_Request::actionName (), 'params' => $params)); ?>" />
<?php } ?>
- <link rel="icon" href="<?php echo Url::display ('/favicon.ico'); ?>" />
+ <link rel="shortcut icon" type="image/x-icon" sizes="16x16 64x64" href="<?php echo Minz_Url::display('/favicon.ico'); ?>" />
+ <link rel="icon msapplication-TileImage apple-touch-icon" type="image/png" sizes="256x256" href="<?php echo Minz_Url::display('/themes/icons/favicon-256.png'); ?>" />
<?php if (isset ($this->rss_url)) { ?>
- <link rel="alternate" type="application/rss+xml" title="<?php echo htmlspecialchars($this->rss_title, ENT_COMPAT, 'UTF-8'); ?>" href="<?php echo Url::display ($this->rss_url); ?>" />
+ <link rel="alternate" type="application/rss+xml" title="<?php echo $this->rss_title; ?>" href="<?php echo Minz_Url::display ($this->rss_url); ?>" />
<?php } ?>
+ <link rel="prefetch" href="<?php echo FreshRSS_Themes::icon('starred', true); ?>">
+ <link rel="prefetch" href="<?php echo FreshRSS_Themes::icon('non-starred', true); ?>">
+ <link rel="prefetch" href="<?php echo FreshRSS_Themes::icon('read', true); ?>">
+ <link rel="prefetch" href="<?php echo FreshRSS_Themes::icon('unread', true); ?>">
+ <meta name="msapplication-TileColor" content="#FFF" />
<meta name="robots" content="noindex,nofollow" />
</head>
- <body>
+ <body class="<?php echo Minz_Request::param('output', 'normal'); ?>">
<?php $this->partial ('header'); ?>
<div id="global">
@@ -32,11 +37,11 @@
<?php
if (isset ($this->notification)) {
- touch(PUBLIC_PATH . '/data/touch.txt', time() + 1);
+ invalidateHttpCache();
?>
<div class="notification <?php echo $this->notification['type']; ?>">
<?php echo $this->notification['content']; ?>
- <a class="close" href=""><i class="icon i_close"></i></a>
+ <a class="close" href=""><?php echo FreshRSS_Themes::icon('close'); ?></a>
</div>
<?php } ?>
</body>
diff --git a/app/layout/nav_entries.phtml b/app/layout/nav_entries.phtml
index 3c3c3ae5e..3141e92a0 100644
--- a/app/layout/nav_entries.phtml
+++ b/app/layout/nav_entries.phtml
@@ -1,5 +1,5 @@
<ul id="nav_entries">
- <li class="item"><a class="previous_entry" href="#"><i class="icon i_prev"></i></a></li>
- <li class="item"><a class="up" href="#"><i class="icon i_up"></i></a></li>
- <li class="item"><a class="next_entry" href="#"><i class="icon i_next"></i></a></li>
+ <li class="item"><a class="previous_entry" href="#"><?php echo FreshRSS_Themes::icon('prev'); ?></a></li>
+ <li class="item"><a class="up" href="#"><?php echo FreshRSS_Themes::icon('up'); ?></a></li>
+ <li class="item"><a class="next_entry" href="#"><?php echo FreshRSS_Themes::icon('next'); ?></a></li>
</ul> \ No newline at end of file
diff --git a/app/layout/nav_menu.phtml b/app/layout/nav_menu.phtml
index 3565b21b5..c807e6dd5 100644
--- a/app/layout/nav_menu.phtml
+++ b/app/layout/nav_menu.phtml
@@ -1,30 +1,36 @@
+<?php
+ $actual_view = Minz_Request::param('output', 'normal');
+?>
<div class="nav_menu">
- <a class="btn toggle_aside" href="#aside_flux"><i class="icon i_category"></i></a>
+ <?php if ($actual_view === 'normal') { ?>
+ <a class="btn toggle_aside" href="#aside_flux"><?php echo FreshRSS_Themes::icon('category'); ?></a>
+ <?php } ?>
- <?php if (!login_is_conf ($this->conf) || is_logged ()) { ?>
- <a id="actualize" class="btn" href="<?php echo _url ('feed', 'actualize'); ?>"><i class="icon i_refresh"></i></a>
+ <?php if ($this->loginOk) { ?>
+ <a id="actualize" class="btn" href="<?php echo _url ('feed', 'actualize'); ?>"><?php echo FreshRSS_Themes::icon('refresh'); ?></a>
<?php
$get = false;
- $string_mark = Translate::t ('mark_all_read');
+ $string_mark = Minz_Translate::t ('mark_all_read');
if ($this->get_f) {
$get = 'f_' . $this->get_f;
- $string_mark = Translate::t ('mark_feed_read');
- } elseif ($this->get_c &&
- $this->get_c != 'all' &&
- $this->get_c != 'favoris' &&
- $this->get_c != 'public') {
- $get = 'c_' . $this->get_c;
- $string_mark = Translate::t ('mark_cat_read');
+ $string_mark = Minz_Translate::t ('mark_feed_read');
+ } elseif ($this->get_c && $this->get_c != 'a') {
+ if ($this->get_c === 's') {
+ $get = 's';
+ } else {
+ $get = 'c_' . $this->get_c;
+ }
+ $string_mark = Minz_Translate::t ('mark_cat_read');
}
$nextGet = $get;
- if (($this->conf->onread_jump_next () === 'yes') && (strlen ($get) > 2)) {
+ if ($this->conf->onread_jump_next && (strlen ($get) > 2)) {
$anotherUnreadId = '';
$foundCurrent = false;
switch ($get[0]) {
case 'c':
foreach ($this->cat_aside as $cat) {
- if ($cat->id () === $this->get_c) {
+ if ($cat->id () == $this->get_c) {
$foundCurrent = true;
continue;
}
@@ -32,13 +38,13 @@
$anotherUnreadId = $cat->id ();
if ($foundCurrent) break;
}
- $nextGet = strlen ($anotherUnreadId) > 1 ? 'c_' . $anotherUnreadId : 'all';
+ $nextGet = empty ($anotherUnreadId) ? 'a' : 'c_' . $anotherUnreadId;
break;
case 'f':
foreach ($this->cat_aside as $cat) {
- if ($cat->id () === $this->get_c) {
+ if ($cat->id () == $this->get_c) {
foreach ($cat->feeds () as $feed) {
- if ($feed->id () === $this->get_f) {
+ if ($feed->id () == $this->get_f) {
$foundCurrent = true;
continue;
}
@@ -49,37 +55,46 @@
break;
}
}
- $nextGet = strlen ($anotherUnreadId) > 1 ? 'f_' . $anotherUnreadId : 'c_' . $this->get_c;
+ $nextGet = empty ($anotherUnreadId) ? 'c_' . $this->get_c : 'f_' . $anotherUnreadId;
break;
}
}
+ $p = isset($this->entries[0]) ? $this->entries[0] : null;
+ $idMax = $p === null ? '0' : $p->id();
+
+ $arUrl = array('c' => 'entry', 'a' => 'read', 'params' => array('get' => $get, 'nextGet' => $nextGet, 'idMax' => $idMax));
+ $output = Minz_Request::param('output', '');
+ if (($output != '') && ($this->conf->view_mode !== $output)) {
+ $arUrl['params']['output'] = $output;
+ }
+ $markReadUrl = Minz_Url::display($arUrl);
+ Minz_Session::_param ('markReadUrl', $markReadUrl);
?>
<div class="stick" id="nav_menu_read_all">
- <a class="read_all btn" href="<?php echo _url ('entry', 'read', 'is_read', 1, 'get', $get, 'nextGet', $nextGet); ?>"><?php echo Translate::t ('mark_read'); ?></a>
+ <a class="read_all btn" href="<?php echo $markReadUrl; ?>"><?php echo Minz_Translate::t ('mark_read'); ?></a>
<div class="dropdown">
<div id="dropdown-read" class="dropdown-target"></div>
- <a class="dropdown-toggle btn" href="#dropdown-read"><i class="icon i_down"></i></a>
+ <a class="dropdown-toggle btn" href="#dropdown-read"><?php echo FreshRSS_Themes::icon('down'); ?></a>
<ul class="dropdown-menu">
- <li class="dropdown-close"><a href="#close">&nbsp;</a></li>
+ <li class="dropdown-close"><a href="#close">❌</a></li>
- <li class="item"><a href="<?php echo _url ('entry', 'read', 'is_read', 1, 'get', $get, 'nextGet', $nextGet); ?>"><?php echo $string_mark; ?></a></li>
+ <li class="item"><a href="<?php echo $markReadUrl; ?>"><?php echo $string_mark; ?></a></li>
<li class="separator"></li>
<?php
- $date = getdate ();
- $today = mktime (0, 0, 0, $date['mon'], $date['mday'], $date['year']);
+ $today = $this->today;
$one_week = $today - 604800;
?>
- <li class="item"><a href="<?php echo _url ('entry', 'read', 'is_read', 1, 'get', $get, 'dateMax', $today); ?>"><?php echo Translate::t ('before_one_day'); ?></a></li>
- <li class="item"><a href="<?php echo _url ('entry', 'read', 'is_read', 1, 'get', $get, 'dateMax', $one_week); ?>"><?php echo Translate::t ('before_one_week'); ?></a></li>
+ <li class="item"><a href="<?php echo _url ('entry', 'read', 'is_read', 1, 'get', $get, 'idMax', $today . '000000'); ?>"><?php echo Minz_Translate::t ('before_one_day'); ?></a></li>
+ <li class="item"><a href="<?php echo _url ('entry', 'read', 'is_read', 1, 'get', $get, 'idMax', $one_week . '000000'); ?>"><?php echo Minz_Translate::t ('before_one_week'); ?></a></li>
</ul>
</div>
</div>
<?php } ?>
<?php
- $params = Request::params ();
+ $params = Minz_Request::params ();
if (isset ($params['search'])) {
$params['search'] = urlencode ($params['search']);
}
@@ -91,73 +106,88 @@
?>
<div class="dropdown" id="nav_menu_views">
<div id="dropdown-views" class="dropdown-target"></div>
- <a class="dropdown-toggle btn" href="#dropdown-views"><?php echo Translate::t ('display'); ?> <i class="icon i_down"></i></a>
+ <a class="dropdown-toggle btn" href="#dropdown-views"><?php echo Minz_Translate::t ('display'); ?> <?php echo FreshRSS_Themes::icon('down'); ?></a>
<ul class="dropdown-menu">
- <li class="dropdown-close"><a href="#close">&nbsp;</a></li>
+ <li class="dropdown-close"><a href="#close">❌</a></li>
<?php
$url_output = $url;
- $actual_view = Request::param('output', 'normal');
- ?>
- <?php if($actual_view != 'normal') { ?>
+ if ($actual_view !== 'normal') { ?>
<li class="item">
<?php $url_output['params']['output'] = 'normal'; ?>
- <a class="view_normal" href="<?php echo Url::display ($url_output); ?>">
- <?php echo Translate::t ('normal_view'); ?>
+ <a class="view_normal" href="<?php echo Minz_Url::display ($url_output); ?>">
+ <?php echo Minz_Translate::t ('normal_view'); ?>
</a>
</li>
- <?php } if($actual_view != 'reader') { ?>
+ <?php } if($actual_view !== 'reader') { ?>
<li class="item">
<?php $url_output['params']['output'] = 'reader'; ?>
- <a class="view_normal" href="<?php echo Url::display ($url_output); ?>">
- <?php echo Translate::t ('reader_view'); ?>
+ <a class="view_normal" href="<?php echo Minz_Url::display ($url_output); ?>">
+ <?php echo Minz_Translate::t ('reader_view'); ?>
</a>
</li>
- <?php } if($actual_view != 'global') { ?>
+ <?php } if($actual_view !== 'global') { ?>
<li class="item">
<?php $url_output['params']['output'] = 'global'; ?>
- <a class="view_normal" href="<?php echo Url::display ($url_output); ?>">
- <?php echo Translate::t ('global_view'); ?>
+ <a class="view_normal" href="<?php echo Minz_Url::display ($url_output); ?>">
+ <?php echo Minz_Translate::t ('global_view'); ?>
</a>
</li>
<?php } ?>
<li class="separator"></li>
- <li class="item">
- <?php
- $url_state = $url;
- if ($this->state == 'not_read') {
- $url_state['params']['state'] = 'all';
- ?>
- <a class="print_all" href="<?php echo Url::display ($url_state); ?>">
- <?php echo Translate::t ('show_all_articles'); ?>
+ <?php
+ $url_state = $url;
+ $url_state['params']['state'] = 'all';
+ ?>
+ <li class="item" role="checkbox" aria-checked="<?php echo ($this->state === 'all') ? 'true' :'false'; ?>">
+ <a class="print_all" href="<?php echo Minz_Url::display ($url_state); ?>">
+ <?php echo Minz_Translate::t ('show_all_articles'); ?>
</a>
- <?php
- } else {
- $url_state['params']['state'] = 'not_read';
- ?>
- <a class="print_non_read" href="<?php echo Url::display ($url_state); ?>">
- <?php echo Translate::t ('show_not_reads'); ?>
+ </li>
+ <?php
+ $url_state['params']['state'] = 'not_read';
+ ?>
+ <li class="item" role="checkbox" aria-checked="<?php echo ($this->state === 'not_read') ? 'true' :'false'; ?>">
+ <a class="print_non_read" href="<?php echo Minz_Url::display ($url_state); ?>">
+ <?php echo Minz_Translate::t ('show_not_reads'); ?>
</a>
- <?php } ?>
</li>
+ <?php
+ $url_state['params']['state'] = 'read';
+ ?>
+ <li class="item" role="checkbox" aria-checked="<?php echo ($this->state === 'read') ? 'true' :'false'; ?>">
+ <a class="print_read" href="<?php echo Minz_Url::display ($url_state); ?>">
+ <?php echo Minz_Translate::t ('show_read'); ?>
+ </a>
+ </li>
+ <?php
+ $url_state['params']['state'] = 'favorite';
+ ?>
+ <li class="item" role="checkbox" aria-checked="<?php echo ($this->state === 'favorite') ? 'true' :'false'; ?>">
+ <a class="print_favorite" href="<?php echo Minz_Url::display ($url_state); ?>">
+ <?php echo Minz_Translate::t ('show_favorite'); ?>
+ </a>
+ </li>
+
+ <li class="separator"></li>
<li class="item">
<?php
$url_order = $url;
- if ($this->order == 'low_to_high') {
- $url_order['params']['order'] = 'high_to_low';
+ if ($this->order === 'DESC') {
+ $url_order['params']['order'] = 'ASC';
?>
- <a href="<?php echo Url::display ($url_order); ?>">
- <?php echo Translate::t ('older_first'); ?>
+ <a href="<?php echo Minz_Url::display ($url_order); ?>">
+ <?php echo Minz_Translate::t ('older_first'); ?>
</a>
<?php
} else {
- $url_order['params']['order'] = 'low_to_high';
+ $url_order['params']['order'] = 'DESC';
?>
- <a href="<?php echo Url::display ($url_order); ?>">
- <?php echo Translate::t ('newer_first'); ?>
+ <a href="<?php echo Minz_Url::display ($url_order); ?>">
+ <?php echo Minz_Translate::t ('newer_first'); ?>
</a>
<?php } ?>
</li>
@@ -165,10 +195,32 @@
<li class="separator"></li>
<li class="item">
- <a class="view_rss" target="_blank" href="<?php echo Url::display ($this->rss_url); ?>">
- <?php echo Translate::t ('rss_view'); ?>
+ <a class="view_rss" target="_blank" href="<?php echo Minz_Url::display ($this->rss_url); ?>">
+ <?php echo Minz_Translate::t ('rss_view'); ?>
</a>
</li>
</ul>
</div>
+
+ <div class="item search">
+ <form action="<?php echo _url ('index', 'index'); ?>" method="get">
+ <?php $search = Minz_Request::param ('search', ''); ?>
+ <input type="search" name="search" class="extend" value="<?php echo $search; ?>" placeholder="<?php echo Minz_Translate::t ('search_short'); ?>" />
+
+ <?php $get = Minz_Request::param ('get', ''); ?>
+ <?php if($get != '') { ?>
+ <input type="hidden" name="get" value="<?php echo $get; ?>" />
+ <?php } ?>
+
+ <?php $order = Minz_Request::param ('order', ''); ?>
+ <?php if($order != '') { ?>
+ <input type="hidden" name="order" value="<?php echo $order; ?>" />
+ <?php } ?>
+
+ <?php $state = Minz_Request::param ('state', ''); ?>
+ <?php if($state != '') { ?>
+ <input type="hidden" name="state" value="<?php echo $state; ?>" />
+ <?php } ?>
+ </form>
+ </div>
</div>
diff --git a/app/models/Category.php b/app/models/Category.php
deleted file mode 100755
index 7659e68f6..000000000
--- a/app/models/Category.php
+++ /dev/null
@@ -1,332 +0,0 @@
-<?php
-
-class Category extends Model {
- private $id = false;
- private $name;
- private $color;
- private $nbFeed = -1;
- private $nbNotRead = -1;
- private $feeds = null;
-
- public function __construct ($name = '', $color = '#0062BE', $feeds = null) {
- $this->_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 () {
- if (!$this->id) {
- return small_hash ($this->name . time () . Configuration::selApplication ());
- } else {
- return $this->id;
- }
- }
- public function name () {
- return $this->name;
- }
- public function color () {
- return $this->color;
- }
- public function nbFeed () {
- if ($this->nbFeed < 0) {
- $catDAO = new CategoryDAO ();
- $this->nbFeed = $catDAO->countFeed ($this->id ());
- }
-
- return $this->nbFeed;
- }
- public function nbNotRead () {
- if ($this->nbNotRead < 0) {
- $catDAO = new CategoryDAO ();
- $this->nbNotRead = $catDAO->countNotRead ($this->id ());
- }
-
- return $this->nbNotRead;
- }
- public function feeds () {
- if (is_null ($this->feeds)) {
- $feedDAO = new 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;
- }
-}
-
-class CategoryDAO extends Model_pdo {
- public function addCategory ($valuesTmp) {
- $sql = 'INSERT INTO ' . $this->prefix . 'category (id, name, color) VALUES(?, ?, ?)';
- $stm = $this->bd->prepare ($sql);
-
- $values = array (
- $valuesTmp['id'],
- $valuesTmp['name'],
- $valuesTmp['color'],
- );
-
- if ($stm && $stm->execute ($values)) {
- return true;
- } else {
- $info = $stm->errorInfo();
- Minz_Log::record ('SQL error : ' . $info[2], Minz_Log::ERROR);
- return false;
- }
- }
-
- public function updateCategory ($id, $valuesTmp) {
- $sql = 'UPDATE ' . $this->prefix . 'category SET name=?, color=? WHERE id=?';
- $stm = $this->bd->prepare ($sql);
-
- $values = array (
- $valuesTmp['name'],
- $valuesTmp['color'],
- $id
- );
-
- if ($stm && $stm->execute ($values)) {
- return true;
- } else {
- $info = $stm->errorInfo();
- Minz_Log::record ('SQL error : ' . $info[2], Minz_Log::ERROR);
- return false;
- }
- }
-
- public function deleteCategory ($id) {
- $sql = 'DELETE FROM ' . $this->prefix . 'category WHERE id=?';
- $stm = $this->bd->prepare ($sql);
-
- $values = array ($id);
-
- if ($stm && $stm->execute ($values)) {
- return true;
- } else {
- $info = $stm->errorInfo();
- Minz_Log::record ('SQL error : ' . $info[2], Minz_Log::ERROR);
- return false;
- }
- }
-
- public function searchById ($id) {
- $sql = 'SELECT * FROM ' . $this->prefix . 'category WHERE id=?';
- $stm = $this->bd->prepare ($sql);
-
- $values = array ($id);
-
- $stm->execute ($values);
- $res = $stm->fetchAll (PDO::FETCH_ASSOC);
- $cat = HelperCategory::daoToCategory ($res);
-
- if (isset ($cat[0])) {
- return $cat[0];
- } else {
- return false;
- }
- }
- public function searchByName ($name) {
- $sql = 'SELECT * FROM ' . $this->prefix . 'category WHERE name=?';
- $stm = $this->bd->prepare ($sql);
-
- $values = array ($name);
-
- $stm->execute ($values);
- $res = $stm->fetchAll (PDO::FETCH_ASSOC);
- $cat = HelperCategory::daoToCategory ($res);
-
- if (isset ($cat[0])) {
- return $cat[0];
- } else {
- return false;
- }
- }
-
- public function listCategories ($prePopulateFeeds = true) {
- if ($prePopulateFeeds) {
- $sql = 'SELECT c.id AS c_id, c.name AS c_name, c.color AS c_color, '
- . 'COUNT(CASE WHEN e.is_read = 0 THEN 1 END) AS nbNotRead, '
- . 'COUNT(e.id) AS nbEntries, '
- . 'f.* '
- . 'FROM ' . $this->prefix . 'category c '
- . 'LEFT OUTER JOIN ' . $this->prefix . 'feed f ON f.category = c.id '
- . 'LEFT OUTER JOIN ' . $this->prefix . 'entry e ON e.id_feed = f.id '
- . 'GROUP BY f.id '
- . 'ORDER BY c.name, f.name';
- $stm = $this->bd->prepare ($sql);
- $stm->execute ();
- return HelperCategory::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));
- }
- }
-
- public function getDefault () {
- $sql = 'SELECT * FROM ' . $this->prefix . 'category WHERE id="000000"';
- $stm = $this->bd->prepare ($sql);
-
- $stm->execute ();
- $res = $stm->fetchAll (PDO::FETCH_ASSOC);
- $cat = HelperCategory::daoToCategory ($res);
-
- if (isset ($cat[0])) {
- return $cat[0];
- } else {
- return false;
- }
- }
- public function checkDefault () {
- $def_cat = $this->searchById ('000000');
-
- if ($def_cat === false) {
- $cat = new Category (Translate::t ('default_category'));
- $cat->_id ('000000');
-
- $values = array (
- 'id' => $cat->id (),
- 'name' => $cat->name (),
- 'color' => $cat->color ()
- );
-
- $this->addCategory ($values);
- }
- }
-
- public function count () {
- $sql = 'SELECT COUNT(*) AS count FROM ' . $this->prefix . 'category';
- $stm = $this->bd->prepare ($sql);
- $stm->execute ();
- $res = $stm->fetchAll (PDO::FETCH_ASSOC);
-
- return $res[0]['count'];
- }
-
- public function countFeed ($id) {
- $sql = 'SELECT COUNT(*) AS count FROM ' . $this->prefix . 'feed WHERE category=?';
- $stm = $this->bd->prepare ($sql);
- $values = array ($id);
- $stm->execute ($values);
- $res = $stm->fetchAll (PDO::FETCH_ASSOC);
-
- return $res[0]['count'];
- }
-
- public function countNotRead ($id) {
- $sql = 'SELECT COUNT(*) AS count FROM ' . $this->prefix . 'entry e INNER JOIN ' . $this->prefix . 'feed f ON e.id_feed = f.id WHERE category=? AND e.is_read=0';
- $stm = $this->bd->prepare ($sql);
- $values = array ($id);
- $stm->execute ($values);
- $res = $stm->fetchAll (PDO::FETCH_ASSOC);
-
- return $res[0]['count'];
- }
-}
-
-class HelperCategory {
- public static function findFeed($categories, $feed_id) {
- foreach ($categories as $category) {
- foreach ($category->feeds () as $feed) {
- if ($feed->id () === $feed_id) {
- return $feed;
- }
- }
- }
- return null;
- }
-
- public static function daoToCategoryPrepopulated ($listDAO) {
- $list = array ();
-
- if (!is_array ($listDAO)) {
- $listDAO = array ($listDAO);
- }
-
- $previousLine = null;
- $feedsDao = array();
- foreach ($listDAO as $line) {
- if ($previousLine['c_id'] != null && $line['c_id'] !== $previousLine['c_id']) {
- // End of the current category, we add it to the $list
- $cat = new Category (
- $previousLine['c_name'],
- $previousLine['c_color'],
- HelperFeed::daoToFeed ($feedsDao)
- );
- $cat->_id ($previousLine['c_id']);
- $list[] = $cat;
-
- $feedsDao = array(); //Prepare for next category
- }
-
- $previousLine = $line;
- $feedsDao[] = $line;
- }
-
- // add the last category
- if ($previousLine != null) {
- $cat = new Category (
- $previousLine['c_name'],
- $previousLine['c_color'],
- HelperFeed::daoToFeed ($feedsDao)
- );
- $cat->_id ($previousLine['c_id']);
- $list[] = $cat;
- }
-
- return $list;
- }
-
- public static function daoToCategory ($listDAO) {
- $list = array ();
-
- if (!is_array ($listDAO)) {
- $listDAO = array ($listDAO);
- }
-
- foreach ($listDAO as $key => $dao) {
- $cat = new Category (
- $dao['name'],
- $dao['color']
- );
- $cat->_id ($dao['id']);
- $list[$key] = $cat;
- }
-
- return $list;
- }
-}
diff --git a/app/models/EntriesGetter.php b/app/models/EntriesGetter.php
deleted file mode 100644
index 803aad732..000000000
--- a/app/models/EntriesGetter.php
+++ /dev/null
@@ -1,156 +0,0 @@
-<?php
-
-class EntriesGetter {
- private $type = array (
- 'type' => 'all',
- 'id' => 'all'
- );
- private $state = 'all';
- private $filter = array (
- 'words' => array (),
- 'tags' => array (),
- );
- private $order = 'high_to_low';
- private $entries = array ();
-
- private $nb = 1;
- private $first = '';
- private $next = '';
-
- public function __construct ($type, $state, $filter, $order, $nb, $first = '') {
- $this->_type ($type);
- $this->_state ($state);
- $this->_filter ($filter);
- $this->_order ($order);
- $this->nb = $nb;
- $this->first = $first;
- }
-
- public function type () {
- return $this->type;
- }
- public function state () {
- return $this->state;
- }
- public function filter () {
- return $this->filter;
- }
- public function order () {
- return $this->order;
- }
- public function entries () {
- return $this->entries;
- }
-
- public function _type ($value) {
- if (!is_array ($value) ||
- !isset ($value['type']) ||
- !isset ($value['id'])) {
- throw new EntriesGetterException ('Bad type line ' . __LINE__ . ' in file ' . __FILE__);
- }
-
- $type = $value['type'];
- $id = $value['id'];
-
- if ($type != 'all' && $type != 'favoris' && $type != 'public' && $type != 'c' && $type != 'f') {
- throw new EntriesGetterException ('Bad type line ' . __LINE__ . ' in file ' . __FILE__);
- }
-
- if (($type == 'all' || $type == 'favoris' || $type == 'public') &&
- ($type != $id)) {
- throw new EntriesGetterException ('Bad type line ' . __LINE__ . ' in file ' . __FILE__);
- }
-
- $this->type = $value;
- }
- public function _state ($value) {
- if ($value != 'all' && $value != 'not_read' && $value != 'read') {
- throw new EntriesGetterException ('Bad state line ' . __LINE__ . ' in file ' . __FILE__);
- }
-
- $this->state = $value;
- }
- public function _filter ($value) {
- $value = trim ($value);
- $terms = explode (' ', $value);
-
- foreach ($terms as $word) {
- if (!empty ($word) && $word[0] == '#' && isset ($word[1])) {
- $tag = substr ($word, 1);
- $this->filter['tags'][$tag] = $tag;
- } elseif (!empty ($word)) {
- $this->filter['words'][$word] = $word;
- }
- }
- }
- public function _order ($value) {
- if ($value != 'high_to_low' && $value != 'low_to_high') {
- throw new EntriesGetterException ('Bad order line ' . __LINE__ . ' in file ' . __FILE__);
- }
-
- $this->order = $value;
- }
-
- public function execute () {
- $entryDAO = new EntryDAO ();
-
- HelperEntry::$nb = $this->nb; //TODO: Update: Now done in SQL
- HelperEntry::$first = $this->first; //TODO: Update: Now done in SQL
- HelperEntry::$filter = $this->filter;
-
- $sqlLimit = (empty ($this->filter['words']) && empty ($this->filter['tags'])) ? $this->nb : ''; //Disable SQL LIMIT optimisation during search //TODO: Do better!
-
- switch ($this->type['type']) {
- case 'all':
- list ($this->entries, $this->next) = $entryDAO->listEntries (
- $this->state,
- $this->order,
- $this->first,
- $sqlLimit
- );
- break;
- case 'favoris':
- list ($this->entries, $this->next) = $entryDAO->listFavorites (
- $this->state,
- $this->order,
- $this->first,
- $sqlLimit
- );
- break;
- case 'public':
- list ($this->entries, $this->next) = $entryDAO->listPublic (
- $this->state,
- $this->order,
- $this->first,
- $sqlLimit
- );
- break;
- case 'c':
- list ($this->entries, $this->next) = $entryDAO->listByCategory (
- $this->type['id'],
- $this->state,
- $this->order,
- $this->first,
- $sqlLimit
- );
- break;
- case 'f':
- list ($this->entries, $this->next) = $entryDAO->listByFeed (
- $this->type['id'],
- $this->state,
- $this->order,
- $this->first,
- $sqlLimit
- );
- break;
- default:
- throw new EntriesGetterException ('Bad type line ' . __LINE__ . ' in file ' . __FILE__);
- }
- }
-
- public function getPaginator () {
- $paginator = new RSSPaginator ($this->entries, $this->next);
-
- return $paginator;
- }
-}
diff --git a/app/models/Entry.php b/app/models/Entry.php
deleted file mode 100755
index 99edf94b4..000000000
--- a/app/models/Entry.php
+++ /dev/null
@@ -1,590 +0,0 @@
-<?php
-
-class Entry extends Model {
-
- private $id = null;
- private $guid;
- private $title;
- private $author;
- private $content;
- private $link;
- private $date;
- private $is_read;
- private $is_favorite;
- private $feed;
- private $tags;
-
- public function __construct ($feed = '', $guid = '', $title = '', $author = '', $content = '',
- $link = '', $pubdate = 0, $is_read = false, $is_favorite = false) {
- $this->_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 (array ());
- }
-
- public function id () {
- if(is_null($this->id)) {
- return small_hash ($this->guid . Configuration::selApplication ());
- } else {
- 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 isRead () {
- return $this->is_read;
- }
- public function isFavorite () {
- return $this->is_favorite;
- }
- public function feed ($object = false) {
- if ($object) {
- $feedDAO = new FeedDAO ();
- return $feedDAO->searchById ($this->feed);
- } else {
- return $this->feed;
- }
- }
- public function tags ($inString = false) {
- if ($inString) {
- if (!empty ($this->tags)) {
- return '#' . implode(' #', $this->tags);
- } else {
- return '';
- }
- } 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 (is_int (intval ($value))) {
- $this->date = $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 = getdate ();
- $today = mktime (0, 0, 0, $date['mon'], $date['mday'], $date['year']);
- $yesterday = $today - 86400;
-
- if ($day == Days::TODAY &&
- $this->date >= $today && $this->date < $today + 86400) {
- return true;
- } elseif ($day == Days::YESTERDAY &&
- $this->date >= $yesterday && $this->date < $yesterday + 86400) {
- return true;
- } elseif ($day == Days::BEFORE_YESTERDAY && $this->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 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)
- );
- }
-}
-
-class EntryDAO extends Model_pdo {
- public function addEntry ($valuesTmp) {
- $sql = 'INSERT INTO ' . $this->prefix . 'entry(id, guid, title, author, content, link, date, is_read, is_favorite, id_feed, tags) VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)';
- $stm = $this->bd->prepare ($sql);
-
- $values = array (
- $valuesTmp['id'],
- $valuesTmp['guid'],
- $valuesTmp['title'],
- $valuesTmp['author'],
- base64_encode (gzdeflate (serialize ($valuesTmp['content']))),
- $valuesTmp['link'],
- $valuesTmp['date'],
- $valuesTmp['is_read'],
- $valuesTmp['is_favorite'],
- $valuesTmp['id_feed'],
- $valuesTmp['tags'],
- );
-
- if ($stm && $stm->execute ($values)) {
- return true;
- } else {
- $info = $stm->errorInfo();
- if ((int)($info[0] / 1000) !== 23) { //Filter out "SQLSTATE Class code 23: Constraint Violation" because of expected duplicate entries
- Minz_Log::record ('SQL error ' . $info[0] . ': ' . $info[1] . ' ' . $info[2], Minz_Log::NOTICE); //TODO: Consider adding a Minz_Log::DEBUG level
- }
- return false;
- }
- }
-
- public function updateEntry ($id, $valuesTmp) {
- if (isset ($valuesTmp['content'])) {
- $valuesTmp['content'] = base64_encode (gzdeflate (serialize ($valuesTmp['content'])));
- }
-
- $set = '';
- foreach ($valuesTmp as $key => $v) {
- $set .= $key . '=?, ';
- }
- $set = substr ($set, 0, -2);
-
- $sql = 'UPDATE ' . $this->prefix . 'entry SET ' . $set . ' WHERE id=?';
- $stm = $this->bd->prepare ($sql);
-
- foreach ($valuesTmp as $v) {
- $values[] = $v;
- }
- $values[] = $id;
-
- if ($stm && $stm->execute ($values)) {
- return true;
- } else {
- $info = $stm->errorInfo();
- Minz_Log::record ('SQL error : ' . $info[2], Minz_Log::ERROR);
- return false;
- }
- }
-
- public function markReadEntries ($read, $dateMax = 0) {
- $sql = 'UPDATE ' . $this->prefix . 'entry e INNER JOIN ' . $this->prefix . 'feed f ON e.id_feed = f.id SET is_read = ? WHERE priority > 0';
-
- $values = array ($read);
- if ($dateMax > 0) {
- $sql .= ' AND date < ?';
- $values[] = $dateMax;
- }
-
- $stm = $this->bd->prepare ($sql);
-
- if ($stm && $stm->execute ($values)) {
- return true;
- } else {
- $info = $stm->errorInfo();
- Minz_Log::record ('SQL error : ' . $info[2], Minz_Log::ERROR);
- return false;
- }
- }
- public function markReadCat ($id, $read, $dateMax = 0) {
- $sql = 'UPDATE ' . $this->prefix . 'entry e INNER JOIN ' . $this->prefix . 'feed f ON e.id_feed = f.id SET is_read = ? WHERE category = ?';
-
- $values = array ($read, $id);
- if ($dateMax > 0) {
- $sql .= ' AND date < ?';
- $values[] = $dateMax;
- }
-
- $stm = $this->bd->prepare ($sql);
-
- if ($stm && $stm->execute ($values)) {
- return true;
- } else {
- $info = $stm->errorInfo();
- Minz_Log::record ('SQL error : ' . $info[2], Minz_Log::ERROR);
- return false;
- }
- }
- public function markReadFeed ($id, $read, $dateMax = 0) {
- $sql = 'UPDATE ' . $this->prefix . 'entry SET is_read = ? WHERE id_feed = ?';
-
- $values = array ($read, $id);
- if ($dateMax > 0) {
- $sql .= ' AND date < ?';
- $values[] = $dateMax;
- }
-
- $stm = $this->bd->prepare ($sql);
-
- if ($stm && $stm->execute ($values)) {
- return true;
- } else {
- $info = $stm->errorInfo();
- Minz_Log::record ('SQL error : ' . $info[2], Minz_Log::ERROR);
- return false;
- }
- }
-
- public function updateEntries ($valuesTmp) {
- if (isset ($valuesTmp['content'])) {
- $valuesTmp['content'] = base64_encode (gzdeflate (serialize ($valuesTmp['content'])));
- }
-
- $set = '';
- foreach ($valuesTmp as $key => $v) {
- $set .= $key . '=?, ';
- }
- $set = substr ($set, 0, -2);
-
- $sql = 'UPDATE ' . $this->prefix . 'entry SET ' . $set;
- $stm = $this->bd->prepare ($sql);
-
- foreach ($valuesTmp as $v) {
- $values[] = $v;
- }
-
- if ($stm && $stm->execute ($values)) {
- return true;
- } else {
- $info = $stm->errorInfo();
- Minz_Log::record ('SQL error : ' . $info[2], Minz_Log::ERROR);
- return false;
- }
- }
-
- public function cleanOldEntries ($nb_month) {
- $date = 60 * 60 * 24 * 30 * $nb_month;
- $sql = 'DELETE e.* FROM ' . $this->prefix . 'entry e INNER JOIN ' . $this->prefix . 'feed f ON e.id_feed = f.id WHERE e.date <= ? AND e.is_favorite = 0 AND f.keep_history = 0';
- $stm = $this->bd->prepare ($sql);
-
- $values = array (
- time () - $date
- );
-
- if ($stm && $stm->execute ($values)) {
- return true;
- } else {
- $info = $stm->errorInfo();
- Minz_Log::record ('SQL error : ' . $info[2], Minz_Log::ERROR);
- return false;
- }
- }
-
- public function searchByGuid ($feed_id, $id) {
- // un guid est unique pour un flux donné
- $sql = 'SELECT * FROM ' . $this->prefix . 'entry WHERE id_feed=? AND guid=?';
- $stm = $this->bd->prepare ($sql);
-
- $values = array (
- $feed_id,
- $id
- );
-
- $stm->execute ($values);
- $res = $stm->fetchAll (PDO::FETCH_ASSOC);
- list ($entry, $next) = HelperEntry::daoToEntry ($res);
-
- if (isset ($entry[0])) {
- return $entry[0];
- } else {
- return false;
- }
- }
-
- public function searchById ($id) {
- $sql = 'SELECT * FROM ' . $this->prefix . 'entry WHERE id=?';
- $stm = $this->bd->prepare ($sql);
-
- $values = array ($id);
-
- $stm->execute ($values);
- $res = $stm->fetchAll (PDO::FETCH_ASSOC);
- list ($entry, $next) = HelperEntry::daoToEntry ($res);
-
- if (isset ($entry[0])) {
- return $entry[0];
- } else {
- return false;
- }
- }
-
- private function listWhere ($where, $state, $order, $limitFromId = '', $limitCount = '', $values = array ()) {
- if ($state == 'not_read') {
- $where .= ' AND is_read = 0';
- } elseif ($state == 'read') {
- $where .= ' AND is_read = 1';
- }
- if (!empty($limitFromId)) { //TODO: Consider using LPAD(e.date, 11) //CONCAT is for cases when many entries have the same date
- $where .= ' AND CONCAT(e.date, e.id) ' . ($order === 'low_to_high' ? '<=' : '>=') . ' (SELECT CONCAT(s.date, s.id) FROM ' . $this->prefix . 'entry s WHERE s.id = "' . $limitFromId . '")';
- }
-
- if ($order == 'low_to_high') {
- $order = ' DESC';
- } else {
- $order = '';
- }
-
- $sql = 'SELECT e.* FROM ' . $this->prefix . 'entry e'
- . ' INNER JOIN ' . $this->prefix . 'feed f ON e.id_feed = f.id' . $where
- . ' ORDER BY e.date' . $order . ', e.id' . $order;
-
- if (empty($limitCount)) {
- $limitCount = 20000; //TODO: FIXME: Hack temporaire en attendant la recherche côté base-de-données
- }
- //if (!empty($limitCount)) {
- $sql .= ' LIMIT ' . ($limitCount + 2); //TODO: See http://explainextended.com/2009/10/23/mysql-order-by-limit-performance-late-row-lookups/
- //}
-
- $stm = $this->bd->prepare ($sql);
- $stm->execute ($values);
-
- return HelperEntry::daoToEntry ($stm->fetchAll (PDO::FETCH_ASSOC));
- }
- public function listEntries ($state, $order = 'high_to_low', $limitFromId = '', $limitCount = '') {
- return $this->listWhere (' WHERE priority > 0', $state, $order, $limitFromId, $limitCount);
- }
- public function listFavorites ($state, $order = 'high_to_low', $limitFromId = '', $limitCount = '') {
- return $this->listWhere (' WHERE is_favorite = 1', $state, $order, $limitFromId, $limitCount);
- }
- public function listPublic ($state, $order = 'high_to_low', $limitFromId = '', $limitCount = '') {
- return $this->listWhere (' WHERE is_public = 1', $state, $order, $limitFromId, $limitCount);
- }
- public function listByCategory ($cat, $state, $order = 'high_to_low', $limitFromId = '', $limitCount = '') {
- return $this->listWhere (' WHERE category = ?', $state, $order, $limitFromId, $limitCount, array ($cat));
- }
- public function listByFeed ($feed, $state, $order = 'high_to_low', $limitFromId = '', $limitCount = '') {
- return $this->listWhere (' WHERE id_feed = ?', $state, $order, $limitFromId, $limitCount, array ($feed));
- }
-
- public function listLastIdsByFeed($id, $n) {
- $sql = 'SELECT id FROM ' . $this->prefix . 'entry WHERE id_feed=? ORDER BY date DESC LIMIT ' . intval($n);
- $stm = $this->bd->prepare ($sql);
- $values = array ($id);
- $stm->execute ($values);
- return $stm->fetchAll (PDO::FETCH_COLUMN, 0);
- }
-
- public function countUnreadRead () {
- $sql = 'SELECT is_read, COUNT(*) AS count FROM ' . $this->prefix . 'entry e INNER JOIN ' . $this->prefix . 'feed f ON e.id_feed = f.id WHERE priority > 0 GROUP BY is_read';
- $stm = $this->bd->prepare ($sql);
- $stm->execute ();
- $res = $stm->fetchAll (PDO::FETCH_ASSOC);
-
- $readUnread = array('unread' => 0, 'read' => 0);
- foreach ($res as $line) {
- switch (intval($line['is_read'])) {
- case 0: $readUnread['unread'] = intval($line['count']); break;
- case 1: $readUnread['read'] = intval($line['count']); break;
- }
- }
- return $readUnread;
- }
- public function count () { //Deprecated: use countUnreadRead() instead
- $unreadRead = $this->countUnreadRead (); //This makes better use of caching
- return $unreadRead['unread'] + $unreadRead['read'];
- }
- public function countNotRead () { //Deprecated: use countUnreadRead() instead
- $unreadRead = $this->countUnreadRead (); //This makes better use of caching
- return $unreadRead['unread'];
- }
-
- public function countUnreadReadFavorites () {
- $sql = 'SELECT is_read, COUNT(*) AS count FROM ' . $this->prefix . 'entry WHERE is_favorite=1 GROUP BY is_read';
- $stm = $this->bd->prepare ($sql);
- $stm->execute ();
- $res = $stm->fetchAll (PDO::FETCH_ASSOC);
- $readUnread = array('unread' => 0, 'read' => 0);
- foreach ($res as $line) {
- switch (intval($line['is_read'])) {
- case 0: $readUnread['unread'] = intval($line['count']); break;
- case 1: $readUnread['read'] = intval($line['count']); break;
- }
- }
- return $readUnread;
- }
-
- public function optimizeTable() {
- $sql = 'OPTIMIZE TABLE ' . $this->prefix . 'entry';
- $stm = $this->bd->prepare ($sql);
- $stm->execute ();
- }
-}
-
-class HelperEntry {
- public static $nb = 1;
- public static $first = '';
-
- public static $filter = array (
- 'words' => array (),
- 'tags' => array (),
- );
-
- public static function daoToEntry ($listDAO) {
- $list = array ();
-
- if (!is_array ($listDAO)) {
- $listDAO = array ($listDAO);
- }
-
- $count = 0;
- $first_is_found = false;
- $break_after = false;
- $next = '';
- foreach ($listDAO as $key => $dao) {
- $dao['content'] = unserialize (gzinflate (base64_decode ($dao['content'])));
- $dao['tags'] = preg_split('/[\s#]/', $dao['tags']);
-
- if (self::tagsMatchEntry ($dao) &&
- self::searchMatchEntry ($dao)) {
- if ($break_after) {
- $next = $dao['id'];
- break;
- }
- if ($first_is_found || $dao['id'] == self::$first || self::$first == '') {
- $list[$key] = self::createEntry ($dao);
-
- $count++;
- $first_is_found = true; //TODO: Update: Now done in SQL
- }
- if ($count >= self::$nb) {
- $break_after = true;
- }
- }
- }
-
- unset ($listDAO);
-
- return array ($list, $next);
- }
-
- private static function createEntry ($dao) {
- $entry = new Entry (
- $dao['id_feed'],
- $dao['guid'],
- $dao['title'],
- $dao['author'],
- $dao['content'],
- $dao['link'],
- $dao['date'],
- $dao['is_read'],
- $dao['is_favorite']
- );
-
- $entry->_tags ($dao['tags']);
-
- if (isset ($dao['id'])) {
- $entry->_id ($dao['id']);
- }
-
- return $entry;
- }
-
- private static function tagsMatchEntry ($dao) {
- $tags = self::$filter['tags'];
- foreach ($tags as $tag) {
- if (!in_array ($tag, $dao['tags'])) {
- return false;
- }
- }
-
- return true;
- }
- private static function searchMatchEntry ($dao) {
- $words = self::$filter['words'];
-
- foreach ($words as $word) {
- $word = strtolower ($word);
- if (strpos (strtolower ($dao['title']), $word) === false &&
- strpos (strtolower ($dao['content']), $word) === false &&
- strpos (strtolower ($dao['link']), $word) === false) {
- return false;
- }
- }
-
- return true;
- }
-}
diff --git a/app/models/Exception/FeedException.php b/app/models/Exception/FeedException.php
deleted file mode 100644
index bff297eb9..000000000
--- a/app/models/Exception/FeedException.php
+++ /dev/null
@@ -1,19 +0,0 @@
-<?php
-
-class FeedException extends Exception {
- public function __construct ($message) {
- parent::__construct ($message);
- }
-}
-
-class BadUrlException extends FeedException {
- public function __construct ($url) {
- parent::__construct ('`' . $url . '` is not a valid URL');
- }
-}
-
-class OpmlException extends FeedException {
- public function __construct ($name_file) {
- parent::__construct ('OPML file is invalid');
- }
-}
diff --git a/app/models/Feed.php b/app/models/Feed.php
deleted file mode 100644
index 7f53d7be8..000000000
--- a/app/models/Feed.php
+++ /dev/null
@@ -1,564 +0,0 @@
-<?php
-
-class Feed extends Model {
- private $id = null;
- private $url;
- private $category = '000000';
- private $nbEntries = -1;
- private $nbNotRead = -1;
- private $entries = null;
- private $name = '';
- private $website = '';
- private $description = '';
- private $lastUpdate = 0;
- private $priority = 10;
- private $pathEntries = '';
- private $httpAuth = '';
- private $error = false;
- private $keep_history = false;
-
- public function __construct ($url, $validate=true) {
- if ($validate) {
- $this->_url ($url);
- } else {
- $this->url = $url;
- }
- }
-
- public function id () {
- if(is_null($this->id)) {
- return small_hash ($this->url . Configuration::selApplication ());
- } else {
- 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 FeedDAO ();
- $this->nbEntries = $feedDAO->countEntries ($this->id ());
- }
-
- return $this->nbEntries;
- }
- public function nbNotRead () {
- if ($this->nbNotRead < 0) {
- $feedDAO = new FeedDAO ();
- $this->nbNotRead = $feedDAO->countNotRead ($this->id ());
- }
-
- return $this->nbNotRead;
- }
- public function favicon () {
- $file = '/data/favicons/' . $this->id () . '.ico';
-
- $favicon_url = Url::display ($file);
- if (!file_exists (PUBLIC_PATH . $file)) {
- $favicon_url = dowload_favicon ($this->website (), $this->id ());
- }
-
- return $favicon_url;
- }
-
- public function _id ($value) {
- $this->id = $value;
- }
- public function _url ($value) {
- if (empty ($value)) {
- throw new BadUrlException ($value);
- }
- if (!preg_match ('#^https?://#i', $value)) {
- $value = 'http://' . $value;
- }
-
- if (filter_var ($value, FILTER_VALIDATE_URL)) {
- $this->url = $value;
- } elseif (version_compare(PHP_VERSION, '5.3.3', '<') && (strpos($value, '-') > 0) && ($value === filter_var($value, FILTER_SANITIZE_URL))) { //PHP bug #51192
- $this->url = $value;
- } else {
- throw new BadUrlException ($value);
- }
- }
- public function _category ($value) {
- $this->category = $value;
- }
- public function _name ($value) {
- if (is_null ($value)) {
- $value = '';
- }
- $this->name = $value;
- }
- public function _website ($value) {
- if (is_null ($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 = is_numeric ($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 = is_numeric ($value) ? intval ($value) : -1;
- }
- public function _nbEntries ($value) {
- $this->nbEntries = is_numeric ($value) ? intval ($value) : -1;
- }
-
- public function load () {
- if (!is_null ($this->url)) {
- if (CACHE_PATH === false) {
- throw new FileNotExistException (
- 'CACHE_PATH',
- MinzException::ERROR
- );
- } else {
- $feed = new SimplePie ();
- $url = str_replace ('&amp;', '&', $this->url);
- 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',
- 'font', 'form', 'frame', 'frameset', 'html',
- 'input', 'marquee', 'meta', 'noscript',
- 'param', 'script', 'style'
- ));
- $feed->strip_attributes(array_merge($feed->strip_attributes, array(
- 'onload', 'onunload', 'onclick', 'ondblclick', 'onmousedown', 'onmouseup',
- 'onmouseover', 'onmousemove', 'onmouseout', 'onfocus', 'onblur',
- 'onkeypress', 'onkeydown', 'onkeyup', 'onselect', 'onchange')));
- $feed->init ();
-
- if ($feed->error ()) {
- throw new FeedException ($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);
- }
-
- if (empty($this->name)) { // May come from OPML
- $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 = 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[] = $tag->get_label ();
- }
- }
-
- $content = $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 .= '<br /><img src="' . $elink . '" alt="" />';
- }
- }
-
- $entry = new Entry (
- $this->id (),
- $item->get_id (),
- !is_null ($title) ? $title : '',
- !is_null ($author) ? $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->id ()] = $entry;
- }
-
- $this->entries = $entries;
- }
-}
-
-class FeedDAO extends Model_pdo {
- public function addFeed ($valuesTmp) {
- $sql = 'INSERT INTO ' . $this->prefix . 'feed (id, url, category, name, website, description, lastUpdate, priority, httpAuth, error, keep_history) VALUES(?, ?, ?, ?, ?, ?, ?, 10, ?, 0, 0)';
- $stm = $this->bd->prepare ($sql);
-
- $values = array (
- $valuesTmp['id'],
- $valuesTmp['url'],
- $valuesTmp['category'],
- $valuesTmp['name'],
- $valuesTmp['website'],
- $valuesTmp['description'],
- $valuesTmp['lastUpdate'],
- base64_encode ($valuesTmp['httpAuth']),
- );
-
- if ($stm && $stm->execute ($values)) {
- return true;
- } else {
- $info = $stm->errorInfo();
- Minz_Log::record ('SQL error : ' . $info[2], Minz_Log::ERROR);
- return false;
- }
- }
-
- public function updateFeed ($id, $valuesTmp) {
- $set = '';
- foreach ($valuesTmp as $key => $v) {
- $set .= $key . '=?, ';
-
- if ($key == 'httpAuth') {
- $valuesTmp[$key] = base64_encode ($v);
- }
- }
- $set = substr ($set, 0, -2);
-
- $sql = 'UPDATE ' . $this->prefix . 'feed SET ' . $set . ' WHERE id=?';
- $stm = $this->bd->prepare ($sql);
-
- foreach ($valuesTmp as $v) {
- $values[] = $v;
- }
- $values[] = $id;
-
- if ($stm && $stm->execute ($values)) {
- return true;
- } else {
- $info = $stm->errorInfo();
- Minz_Log::record ('SQL error : ' . $info[2], Minz_Log::ERROR);
- return false;
- }
- }
-
- public function updateLastUpdate ($id) {
- $sql = 'UPDATE ' . $this->prefix . 'feed SET lastUpdate=?, error=0 WHERE id=?';
- $stm = $this->bd->prepare ($sql);
-
- $values = array (
- time (),
- $id
- );
-
- if ($stm && $stm->execute ($values)) {
- return true;
- } else {
- $info = $stm->errorInfo();
- Minz_Log::record ('SQL error : ' . $info[2], Minz_Log::ERROR);
- return false;
- }
- }
-
- public function isInError ($id) {
- $sql = 'UPDATE ' . $this->prefix . 'feed SET error=1 WHERE id=?';
- $stm = $this->bd->prepare ($sql);
-
- $values = array (
- $id
- );
-
- if ($stm && $stm->execute ($values)) {
- return true;
- } else {
- $info = $stm->errorInfo();
- Minz_Log::record ('SQL error : ' . $info[2], Minz_Log::ERROR);
- return false;
- }
- }
-
- public function changeCategory ($idOldCat, $idNewCat) {
- $catDAO = new CategoryDAO ();
- $newCat = $catDAO->searchById ($idNewCat);
- if (!$newCat) {
- $newCat = $catDAO->getDefault ();
- }
-
- $sql = 'UPDATE ' . $this->prefix . 'feed SET category=? WHERE category=?';
- $stm = $this->bd->prepare ($sql);
-
- $values = array (
- $newCat->id (),
- $idOldCat
- );
-
- if ($stm && $stm->execute ($values)) {
- return true;
- } else {
- $info = $stm->errorInfo();
- Minz_Log::record ('SQL error : ' . $info[2], Minz_Log::ERROR);
- return false;
- }
- }
-
- public function deleteFeed ($id) {
- $sql = 'DELETE FROM ' . $this->prefix . 'feed WHERE id=?';
- $stm = $this->bd->prepare ($sql);
-
- $values = array ($id);
-
- if ($stm && $stm->execute ($values)) {
- return true;
- } else {
- $info = $stm->errorInfo();
- Minz_Log::record ('SQL error : ' . $info[2], Minz_Log::ERROR);
- return false;
- }
- }
- public function deleteFeedByCategory ($id) {
- $sql = 'DELETE FROM ' . $this->prefix . 'feed WHERE category=?';
- $stm = $this->bd->prepare ($sql);
-
- $values = array ($id);
-
- if ($stm && $stm->execute ($values)) {
- return true;
- } else {
- $info = $stm->errorInfo();
- Minz_Log::record ('SQL error : ' . $info[2], Minz_Log::ERROR);
- return false;
- }
- }
-
- public function searchById ($id) {
- $sql = 'SELECT * FROM ' . $this->prefix . 'feed WHERE id=?';
- $stm = $this->bd->prepare ($sql);
-
- $values = array ($id);
-
- $stm->execute ($values);
- $res = $stm->fetchAll (PDO::FETCH_ASSOC);
- $feed = HelperFeed::daoToFeed ($res);
-
- if (isset ($feed[$id])) {
- return $feed[$id];
- } else {
- return false;
- }
- }
- public function searchByUrl ($url) {
- $sql = 'SELECT * FROM ' . $this->prefix . 'feed WHERE url=?';
- $stm = $this->bd->prepare ($sql);
-
- $values = array ($url);
-
- $stm->execute ($values);
- $res = $stm->fetchAll (PDO::FETCH_ASSOC);
- $feed = current (HelperFeed::daoToFeed ($res));
-
- if (isset ($feed)) {
- return $feed;
- } else {
- return false;
- }
- }
-
- public function listFeeds () {
- $sql = 'SELECT * FROM ' . $this->prefix . 'feed ORDER BY name';
- $stm = $this->bd->prepare ($sql);
- $stm->execute ();
-
- return HelperFeed::daoToFeed ($stm->fetchAll (PDO::FETCH_ASSOC));
- }
-
- public function listFeedsOrderUpdate () {
- $sql = 'SELECT * FROM ' . $this->prefix . 'feed ORDER BY lastUpdate';
- $stm = $this->bd->prepare ($sql);
- $stm->execute ();
-
- return HelperFeed::daoToFeed ($stm->fetchAll (PDO::FETCH_ASSOC));
- }
-
- public function listByCategory ($cat) {
- $sql = 'SELECT * FROM ' . $this->prefix . 'feed WHERE category=? ORDER BY name';
- $stm = $this->bd->prepare ($sql);
-
- $values = array ($cat);
-
- $stm->execute ($values);
-
- return HelperFeed::daoToFeed ($stm->fetchAll (PDO::FETCH_ASSOC));
- }
-
- public function count () { //Is this used?
- $sql = 'SELECT COUNT(*) AS count FROM ' . $this->prefix . 'feed';
- $stm = $this->bd->prepare ($sql);
- $stm->execute ();
- $res = $stm->fetchAll (PDO::FETCH_ASSOC);
-
- return $res[0]['count'];
- }
-
- public function countEntries ($id) {
- $sql = 'SELECT COUNT(*) AS count FROM ' . $this->prefix . 'entry WHERE id_feed=?';
- $stm = $this->bd->prepare ($sql);
- $values = array ($id);
- $stm->execute ($values);
- $res = $stm->fetchAll (PDO::FETCH_ASSOC);
-
- return $res[0]['count'];
- }
- public function countNotRead ($id) { //Is this used?
- $sql = 'SELECT COUNT(*) AS count FROM ' . $this->prefix . 'entry WHERE is_read=0 AND id_feed=?';
- $stm = $this->bd->prepare ($sql);
- $values = array ($id);
- $stm->execute ($values);
- $res = $stm->fetchAll (PDO::FETCH_ASSOC);
-
- return $res[0]['count'];
- }
-}
-
-class HelperFeed {
- public static function daoToFeed ($listDAO) {
- $list = array ();
-
- if (!is_array ($listDAO)) {
- $listDAO = array ($listDAO);
- }
-
- foreach ($listDAO as $key => $dao) {
- if (empty ($dao['url'])) {
- continue;
- }
- if (isset ($dao['id'])) {
- $key = $dao['id'];
- }
-
- $list[$key] = new Feed ($dao['url'], false);
- $list[$key]->_category ($dao['category']);
- $list[$key]->_name ($dao['name']);
- $list[$key]->_website ($dao['website']);
- $list[$key]->_description ($dao['description']);
- $list[$key]->_lastUpdate ($dao['lastUpdate']);
- $list[$key]->_priority ($dao['priority']);
- $list[$key]->_pathEntries ($dao['pathEntries']);
- $list[$key]->_httpAuth (base64_decode ($dao['httpAuth']));
- $list[$key]->_error ($dao['error']);
- $list[$key]->_keepHistory ($dao['keep_history']);
- if (isset ($dao['nbNotRead'])) {
- $list[$key]->_nbNotRead ($dao['nbNotRead']);
- }
- if (isset ($dao['nbEntries'])) {
- $list[$key]->_nbEntries ($dao['nbEntries']);
- }
- if (isset ($dao['id'])) {
- $list[$key]->_id ($dao['id']);
- }
- }
-
- return $list;
- }
-}
diff --git a/app/models/Log_Model.php b/app/models/Log_Model.php
deleted file mode 100644
index 5c280fa7a..000000000
--- a/app/models/Log_Model.php
+++ /dev/null
@@ -1,47 +0,0 @@
-<?php
-
-class Log_Model extends Model {
- private $date;
- private $level;
- private $information;
-
- public function date () {
- return $this->date;
- }
- public function level () {
- return $this->level;
- }
- public function info () {
- return $this->information;
- }
- public function _date ($date) {
- $this->date = $date;
- }
- public function _level ($level) {
- $this->level = $level;
- }
- public function _info ($information) {
- $this->information = $information;
- }
-}
-
-class LogDAO extends Model_txt {
- public function __construct () {
- parent::__construct (LOG_PATH . '/application.log', 'r+');
- }
-
- public function lister () {
- $logs = array ();
-
- $i = 0;
- while (($line = $this->readLine ()) !== false) {
- $logs[$i] = new Log_Model ();
- $logs[$i]->_date (preg_replace ("'\[(.*?)\] \[(.*?)\] --- (.*?)'U", "\\1", $line));
- $logs[$i]->_level (preg_replace ("'\[(.*?)\] \[(.*?)\] --- (.*?)'U", "\\2", $line));
- $logs[$i]->_info (preg_replace ("'\[(.*?)\] \[(.*?)\] --- (.*?)'U", "\\3", $line));
- $i++;
- }
-
- return $logs;
- }
-} \ No newline at end of file
diff --git a/app/models/RSSConfiguration.php b/app/models/RSSConfiguration.php
deleted file mode 100755
index e79fd933b..000000000
--- a/app/models/RSSConfiguration.php
+++ /dev/null
@@ -1,445 +0,0 @@
-<?php
-
-class RSSConfiguration extends Model {
- private $available_languages = array (
- 'en' => 'English',
- 'fr' => 'Français',
- );
- private $language;
- private $posts_per_page;
- private $view_mode;
- private $default_view;
- private $display_posts;
- private $onread_jump_next;
- private $lazyload;
- private $sort_order;
- private $old_entries;
- private $shortcuts = array ();
- private $mail_login = '';
- private $mark_when = array ();
- private $url_shaarli = '';
- private $theme;
- private $anon_access;
- private $token;
- private $auto_load_more;
- private $topline_read;
- private $topline_favorite;
- private $topline_date;
- private $topline_link;
- private $bottomline_read;
- private $bottomline_favorite;
- private $bottomline_sharing;
- private $bottomline_tags;
- private $bottomline_date;
- private $bottomline_link;
-
- public function __construct () {
- $confDAO = new RSSConfigurationDAO ();
- $this->_language ($confDAO->language);
- $this->_postsPerPage ($confDAO->posts_per_page);
- $this->_viewMode ($confDAO->view_mode);
- $this->_defaultView ($confDAO->default_view);
- $this->_displayPosts ($confDAO->display_posts);
- $this->_onread_jump_next ($confDAO->onread_jump_next);
- $this->_lazyload ($confDAO->lazyload);
- $this->_sortOrder ($confDAO->sort_order);
- $this->_oldEntries ($confDAO->old_entries);
- $this->_shortcuts ($confDAO->shortcuts);
- $this->_mailLogin ($confDAO->mail_login);
- $this->_markWhen ($confDAO->mark_when);
- $this->_urlShaarli ($confDAO->url_shaarli);
- $this->_theme ($confDAO->theme);
- $this->_anonAccess ($confDAO->anon_access);
- $this->_token ($confDAO->token);
- $this->_autoLoadMore ($confDAO->auto_load_more);
- $this->_topline_read ($confDAO->topline_read);
- $this->_topline_favorite ($confDAO->topline_favorite);
- $this->_topline_date ($confDAO->topline_date);
- $this->_topline_link ($confDAO->topline_link);
- $this->_bottomline_read ($confDAO->bottomline_read);
- $this->_bottomline_favorite ($confDAO->bottomline_favorite);
- $this->_bottomline_sharing ($confDAO->bottomline_sharing);
- $this->_bottomline_tags ($confDAO->bottomline_tags);
- $this->_bottomline_date ($confDAO->bottomline_date);
- $this->_bottomline_link ($confDAO->bottomline_link);
- }
-
- public function availableLanguages () {
- return $this->available_languages;
- }
- public function language () {
- return $this->language;
- }
- public function postsPerPage () {
- return $this->posts_per_page;
- }
- public function viewMode () {
- return $this->view_mode;
- }
- public function defaultView () {
- return $this->default_view;
- }
- public function displayPosts () {
- return $this->display_posts;
- }
- public function onread_jump_next () {
- return $this->onread_jump_next;
- }
- public function lazyload () {
- return $this->lazyload;
- }
- public function sortOrder () {
- return $this->sort_order;
- }
- public function oldEntries () {
- return $this->old_entries;
- }
- public function shortcuts () {
- return $this->shortcuts;
- }
- public function mailLogin () {
- return $this->mail_login;
- }
- public function markWhen () {
- return $this->mark_when;
- }
- public function markWhenArticle () {
- return $this->mark_when['article'];
- }
- public function markWhenSite () {
- return $this->mark_when['site'];
- }
- public function markWhenScroll () {
- return $this->mark_when['scroll'];
- }
- public function urlShaarli () {
- return $this->url_shaarli;
- }
- public function theme () {
- return $this->theme;
- }
- public function anonAccess () {
- return $this->anon_access;
- }
- public function token () {
- return $this->token;
- }
- public function autoLoadMore () {
- return $this->auto_load_more;
- }
- public function toplineRead () {
- return $this->topline_read;
- }
- public function toplineFavorite () {
- return $this->topline_favorite;
- }
- public function toplineDate () {
- return $this->topline_date;
- }
- public function toplineLink () {
- return $this->topline_link;
- }
- public function bottomlineRead () {
- return $this->bottomline_read;
- }
- public function bottomlineFavorite () {
- return $this->bottomline_favorite;
- }
- public function bottomlineSharing () {
- return $this->bottomline_sharing;
- }
- public function bottomlineTags () {
- return $this->bottomline_tags;
- }
- public function bottomlineDate () {
- return $this->bottomline_date;
- }
- public function bottomlineLink () {
- return $this->bottomline_link;
- }
-
- public function _language ($value) {
- if (!isset ($this->available_languages[$value])) {
- $value = 'en';
- }
- $this->language = $value;
- }
- public function _postsPerPage ($value) {
- if (is_int (intval ($value)) && $value > 0) {
- $this->posts_per_page = $value;
- } else {
- $this->posts_per_page = 10;
- }
- }
- public function _viewMode ($value) {
- if ($value == 'global' || $value == 'reader') {
- $this->view_mode = $value;
- } else {
- $this->view_mode = 'normal';
- }
- }
- public function _defaultView ($value) {
- if ($value == 'not_read') {
- $this->default_view = 'not_read';
- } else {
- $this->default_view = 'all';
- }
- }
- public function _displayPosts ($value) {
- if ($value == 'yes') {
- $this->display_posts = 'yes';
- } else {
- $this->display_posts = 'no';
- }
- }
- public function _onread_jump_next ($value) {
- if ($value == 'no') {
- $this->onread_jump_next = 'no';
- } else {
- $this->onread_jump_next = 'yes';
- }
- }
- public function _lazyload ($value) {
- if ($value == 'no') {
- $this->lazyload = 'no';
- } else {
- $this->lazyload = 'yes';
- }
- }
- public function _sortOrder ($value) {
- if ($value == 'high_to_low') {
- $this->sort_order = 'high_to_low';
- } else {
- $this->sort_order = 'low_to_high';
- }
- }
- public function _oldEntries ($value) {
- if (is_int (intval ($value)) && $value > 0) {
- $this->old_entries = $value;
- } else {
- $this->old_entries = 3;
- }
- }
- public function _shortcuts ($values) {
- foreach ($values as $key => $value) {
- $this->shortcuts[$key] = $value;
- }
- }
- public function _mailLogin ($value) {
- if (filter_var ($value, FILTER_VALIDATE_EMAIL)) {
- $this->mail_login = $value;
- } elseif ($value == false) {
- $this->mail_login = false;
- }
- }
- public function _markWhen ($values) {
- if(!isset($values['article'])) {
- $values['article'] = 'yes';
- }
- if(!isset($values['site'])) {
- $values['site'] = 'yes';
- }
- if(!isset($values['scroll'])) {
- $values['scroll'] = 'yes';
- }
-
- $this->mark_when['article'] = $values['article'];
- $this->mark_when['site'] = $values['site'];
- $this->mark_when['scroll'] = $values['scroll'];
- }
- public function _urlShaarli ($value) {
- if (filter_var ($value, FILTER_VALIDATE_URL)) {
- $this->url_shaarli = $value;
- } elseif (version_compare(PHP_VERSION, '5.3.3', '<') && (strpos($value, '-') > 0) && ($value === filter_var($value, FILTER_SANITIZE_URL))) { //PHP bug #51192
- $this->url_shaarli = $value;
- } else {
- $this->url_shaarli = '';
- }
- }
- public function _theme ($value) {
- $this->theme = $value;
- }
- public function _anonAccess ($value) {
- if ($value == 'yes') {
- $this->anon_access = 'yes';
- } else {
- $this->anon_access = 'no';
- }
- }
- public function _token ($value) {
- $this->token = $value;
- }
- public function _autoLoadMore ($value) {
- if ($value == 'yes') {
- $this->auto_load_more = 'yes';
- } else {
- $this->auto_load_more = 'no';
- }
- }
- public function _topline_read ($value) {
- $this->topline_read = $value === 'yes';
- }
- public function _topline_favorite ($value) {
- $this->topline_favorite = $value === 'yes';
- }
- public function _topline_date ($value) {
- $this->topline_date = $value === 'yes';
- }
- public function _topline_link ($value) {
- $this->topline_link = $value === 'yes';
- }
- public function _bottomline_read ($value) {
- $this->bottomline_read = $value === 'yes';
- }
- public function _bottomline_favorite ($value) {
- $this->bottomline_favorite = $value === 'yes';
- }
- public function _bottomline_sharing ($value) {
- $this->bottomline_sharing = $value === 'yes';
- }
- public function _bottomline_tags ($value) {
- $this->bottomline_tags = $value === 'yes';
- }
- public function _bottomline_date ($value) {
- $this->bottomline_date = $value === 'yes';
- }
- public function _bottomline_link ($value) {
- $this->bottomline_link = $value === 'yes';
- }
-}
-
-class RSSConfigurationDAO extends Model_array {
- public $language = 'en';
- public $posts_per_page = 20;
- public $view_mode = 'normal';
- public $default_view = 'not_read';
- public $display_posts = 'no';
- public $onread_jump_next = 'yes';
- public $lazyload = 'yes';
- public $sort_order = 'low_to_high';
- public $old_entries = 3;
- public $shortcuts = array (
- 'mark_read' => 'r',
- 'mark_favorite' => 'f',
- 'go_website' => 'space',
- 'next_entry' => 'j',
- 'prev_entry' => 'k'
- );
- public $mail_login = '';
- public $mark_when = array (
- 'article' => 'yes',
- 'site' => 'yes',
- 'scroll' => 'no'
- );
- public $url_shaarli = '';
- public $theme = 'default';
- public $anon_access = 'no';
- public $token = '';
- public $auto_load_more = 'no';
- public $topline_read = 'yes';
- public $topline_favorite = 'yes';
- public $topline_date = 'yes';
- public $topline_link = 'yes';
- public $bottomline_read = 'yes';
- public $bottomline_favorite = 'yes';
- public $bottomline_sharing = 'yes';
- public $bottomline_tags = 'yes';
- public $bottomline_date = 'yes';
- public $bottomline_link = 'yes';
-
- public function __construct () {
- parent::__construct (PUBLIC_PATH . '/data/Configuration.array.php');
-
- // TODO : simplifier ce code, une boucle for() devrait suffir !
- if (isset ($this->array['language'])) {
- $this->language = $this->array['language'];
- }
- if (isset ($this->array['posts_per_page'])) {
- $this->posts_per_page = $this->array['posts_per_page'];
- }
- if (isset ($this->array['view_mode'])) {
- $this->view_mode = $this->array['view_mode'];
- }
- if (isset ($this->array['default_view'])) {
- $this->default_view = $this->array['default_view'];
- }
- if (isset ($this->array['display_posts'])) {
- $this->display_posts = $this->array['display_posts'];
- }
- if (isset ($this->array['onread_jump_next'])) {
- $this->onread_jump_next = $this->array['onread_jump_next'];
- }
- if (isset ($this->array['lazyload'])) {
- $this->lazyload = $this->array['lazyload'];
- }
- if (isset ($this->array['sort_order'])) {
- $this->sort_order = $this->array['sort_order'];
- }
- if (isset ($this->array['old_entries'])) {
- $this->old_entries = $this->array['old_entries'];
- }
- if (isset ($this->array['shortcuts'])) {
- $this->shortcuts = $this->array['shortcuts'];
- }
- if (isset ($this->array['mail_login'])) {
- $this->mail_login = $this->array['mail_login'];
- }
- if (isset ($this->array['mark_when'])) {
- $this->mark_when = $this->array['mark_when'];
- }
- if (isset ($this->array['url_shaarli'])) {
- $this->url_shaarli = $this->array['url_shaarli'];
- }
- if (isset ($this->array['theme'])) {
- $this->theme = $this->array['theme'];
- }
- if (isset ($this->array['anon_access'])) {
- $this->anon_access = $this->array['anon_access'];
- }
- if (isset ($this->array['token'])) {
- $this->token = $this->array['token'];
- }
- if (isset ($this->array['auto_load_more'])) {
- $this->auto_load_more = $this->array['auto_load_more'];
- }
-
- if (isset ($this->array['topline_read'])) {
- $this->topline_read = $this->array['topline_read'];
- }
- if (isset ($this->array['topline_favorite'])) {
- $this->topline_favorite = $this->array['topline_favorite'];
- }
- if (isset ($this->array['topline_date'])) {
- $this->topline_date = $this->array['topline_date'];
- }
- if (isset ($this->array['topline_link'])) {
- $this->topline_link = $this->array['topline_link'];
- }
- if (isset ($this->array['bottomline_read'])) {
- $this->bottomline_read = $this->array['bottomline_read'];
- }
- if (isset ($this->array['bottomline_favorite'])) {
- $this->bottomline_favorite = $this->array['bottomline_favorite'];
- }
- if (isset ($this->array['bottomline_sharing'])) {
- $this->bottomline_sharing = $this->array['bottomline_sharing'];
- }
- if (isset ($this->array['bottomline_tags'])) {
- $this->bottomline_tags = $this->array['bottomline_tags'];
- }
- if (isset ($this->array['bottomline_date'])) {
- $this->bottomline_date = $this->array['bottomline_date'];
- }
- if (isset ($this->array['bottomline_link'])) {
- $this->bottomline_link = $this->array['bottomline_link'];
- }
- }
-
- public function update ($values) {
- foreach ($values as $key => $value) {
- $this->array[$key] = $value;
- }
-
- $this->writeFile($this->array);
- }
-}
diff --git a/app/models/RSSPaginator.php b/app/models/RSSPaginator.php
deleted file mode 100644
index 86b4b5cac..000000000
--- a/app/models/RSSPaginator.php
+++ /dev/null
@@ -1,33 +0,0 @@
-<?php
-
-// Un système de pagination beaucoup plus simple que Paginator
-// mais mieux adapté à nos besoins
-class RSSPaginator {
- private $items = array ();
- private $next = '';
-
- public function __construct ($items, $next) {
- $this->items = $items;
- $this->next = $next;
- }
-
- public function isEmpty () {
- return empty ($this->items);
- }
-
- public function items () {
- return $this->items;
- }
-
- public function next () {
- return $this->next;
- }
-
- public function render ($view, $getteur) {
- $view = APP_PATH . '/views/helpers/'.$view;
-
- if (file_exists ($view)) {
- include ($view);
- }
- }
-}
diff --git a/app/models/RSSThemes.php b/app/models/RSSThemes.php
deleted file mode 100644
index 83db85acf..000000000
--- a/app/models/RSSThemes.php
+++ /dev/null
@@ -1,47 +0,0 @@
-<?php
-
-class RSSThemes extends Model {
- private static $themes_dir = '/themes';
-
- private static $list = array();
-
- public static function init() {
- $basedir = PUBLIC_PATH . self::$themes_dir;
-
- $themes_list = array_diff(
- scandir($basedir),
- array('..', '.')
- );
-
- foreach ($themes_list as $theme_dir) {
- $json_filename = $basedir . '/' . $theme_dir . '/metadata.json';
- if(file_exists($json_filename)) {
- $content = file_get_contents($json_filename);
- $res = json_decode($content, true);
-
- if($res &&
- isset($res['name']) &&
- isset($res['author']) &&
- isset($res['description']) &&
- isset($res['version']) &&
- isset($res['files']) && is_array($res['files'])) {
- $theme = $res;
- $theme['path'] = $theme_dir;
- self::$list[$theme_dir] = $theme;
- }
- }
- }
- }
-
- public static function get() {
- return self::$list;
- }
-
- public static function get_infos($theme_id) {
- if (isset(self::$list[$theme_id])) {
- return self::$list[$theme_id];
- }
-
- return false;
- }
-} \ No newline at end of file
diff --git a/app/sql.php b/app/sql.php
new file mode 100644
index 000000000..1b43da30a
--- /dev/null
+++ b/app/sql.php
@@ -0,0 +1,59 @@
+<?php
+define('SQL_CREATE_TABLES', '
+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;
+
+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` MEDIUMINT NOT NULL DEFAULT -2, -- v0.7
+ `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;
+
+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;
+
+INSERT IGNORE INTO `%1$scategory` (id, name) VALUES(1, :catName);
+');
+
+define('SQL_DROP_TABLES', 'DROP TABLES %1$sentry, %1$sfeed, %1$scategory');
diff --git a/app/views/configure/archiving.phtml b/app/views/configure/archiving.phtml
new file mode 100644
index 000000000..e144d0f45
--- /dev/null
+++ b/app/views/configure/archiving.phtml
@@ -0,0 +1,58 @@
+<?php $this->partial('aside_configure'); ?>
+
+<div class="post">
+ <a href="<?php echo _url('index', 'index'); ?>"><?php echo Minz_Translate::t('back_to_rss_feeds'); ?></a>
+
+ <form method="post" action="<?php echo _url('configure', 'archiving'); ?>">
+ <legend><?php echo Minz_Translate::t('archiving_configuration'); ?></legend>
+ <p><?php echo FreshRSS_Themes::icon('help'); ?> <?php echo Minz_Translate::t('archiving_configuration_help'); ?></p>
+
+ <div class="form-group">
+ <label class="group-name" for="old_entries"><?php echo Minz_Translate::t('delete_articles_every'); ?></label>
+ <div class="group-controls">
+ <input type="number" id="old_entries" name="old_entries" min="1" max="1200" value="<?php echo $this->conf->old_entries; ?>" /> <?php echo Minz_Translate::t('month'); ?>
+   <a class="btn confirm" href="<?php echo _url('entry', 'purge'); ?>"><?php echo Minz_Translate::t('purge_now'); ?></a>
+ </div>
+ </div>
+ <div class="form-group">
+ <label class="group-name" for="keep_history_default"><?php echo Minz_Translate::t('keep_history'), ' ', Minz_Translate::t('by_feed'); ?></label>
+ <div class="group-controls">
+ <select class="number" name="keep_history_default" id="keep_history_default" required="required"><?php
+ foreach (array('' => '', 0 => '0', 10 => '10', 50 => '50', 100 => '100', 500 => '500', 1000 => '1 000', 5000 => '5 000', 10000 => '10 000', -1 => '∞') as $v => $t) {
+ echo '<option value="' . $v . ($this->conf->keep_history_default == $v ? '" selected="selected' : '') . '">' . $t . ' </option>';
+ }
+ ?></select> (<?php echo Minz_Translate::t('by_default'); ?>)
+ </div>
+ </div>
+
+ <div class="form-group form-actions">
+ <div class="group-controls">
+ <button type="submit" class="btn btn-important"><?php echo Minz_Translate::t('save'); ?></button>
+ <button type="reset" class="btn"><?php echo Minz_Translate::t('cancel'); ?></button>
+ </div>
+ </div>
+ </form>
+
+ <form method="post" action="<?php echo _url('entry', 'optimize'); ?>">
+ <legend><?php echo Minz_Translate::t ('advanced'); ?></legend>
+
+ <div class="form-group">
+ <p class="group-name"><?php echo Minz_Translate::t('current_user'); ?></p>
+ <div class="group-controls">
+ <p><?php echo formatNumber($this->nb_total), ' ', Minz_Translate::t('articles'), ', ', formatBytes($this->size_user); ?></p>
+ <input type="hidden" name="optimiseDatabase" value="1" />
+ <button type="submit" class="btn btn-important"><?php echo Minz_Translate::t('optimize_bdd'); ?></button>
+ <?php echo FreshRSS_Themes::icon('help'); ?> <?php echo Minz_Translate::t('optimize_todo_sometimes'); ?>
+ </div>
+ </div>
+
+ <?php if (Minz_Configuration::isAdmin(Minz_Session::param('currentUser', '_'))) { ?>
+ <div class="form-group">
+ <p class="group-name"><?php echo Minz_Translate::t('users'); ?></p>
+ <div class="group-controls">
+ <p><?php echo formatBytes($this->size_total); ?></p>
+ </div>
+ </div>
+ <?php } ?>
+ </form>
+</div>
diff --git a/app/views/configure/categorize.phtml b/app/views/configure/categorize.phtml
index 95951247e..a564e8cdd 100644
--- a/app/views/configure/categorize.phtml
+++ b/app/views/configure/categorize.phtml
@@ -1,28 +1,28 @@
<?php $this->partial ('aside_feed'); ?>
<div class="post">
- <a href="<?php echo _url ('index', 'index'); ?>"><?php echo Translate::t ('back_to_rss_feeds'); ?></a>
+ <a href="<?php echo _url ('index', 'index'); ?>"><?php echo Minz_Translate::t ('back_to_rss_feeds'); ?></a>
<form method="post" action="<?php echo _url ('configure', 'categorize'); ?>">
- <legend><?php echo Translate::t ('categories_management'); ?></legend>
+ <legend><?php echo Minz_Translate::t ('categories_management'); ?></legend>
- <p class="alert alert-warn"><?php echo Translate::t ('feeds_moved_category_deleted', $this->defaultCategory->name ()); ?></p>
+ <p class="alert alert-warn"><?php echo Minz_Translate::t ('feeds_moved_category_deleted', $this->defaultCategory->name ()); ?></p>
<?php $i = 0; foreach ($this->categories as $cat) { $i++; ?>
<div class="form-group">
<label class="group-name" for="cat_<?php echo $cat->id (); ?>">
- <?php echo Translate::t ('category_number', $i); ?>
+ <?php echo Minz_Translate::t ('category_number', $i); ?>
</label>
<div class="group-controls">
<input type="text" id="cat_<?php echo $cat->id (); ?>" name="categories[]" value="<?php echo $cat->name (); ?>" />
<?php if ($cat->nbFeed () > 0) { ?>
- <a class="confirm" href="<?php echo _url ('feed', 'delete', 'id', $cat->id (), 'type', 'category'); ?>"><?php echo Translate::t ('ask_empty'); ?></a>
+ <a class="confirm" href="<?php echo _url ('feed', 'delete', 'id', $cat->id (), 'type', 'category'); ?>"><?php echo Minz_Translate::t ('ask_empty'); ?></a>
<?php } ?>
- (<?php echo Translate::t ('number_feeds', $cat->nbFeed ()); ?>)
+ (<?php echo Minz_Translate::t ('number_feeds', $cat->nbFeed ()); ?>)
<?php if ($cat->id () == $this->defaultCategory->id ()) { ?>
- <i class="icon i_help"></i> <?php echo Translate::t ('can_not_be_deleted'); ?>
+ <?php echo FreshRSS_Themes::icon('help'); ?> <?php echo Minz_Translate::t ('can_not_be_deleted'); ?>
<?php } ?>
<input type="hidden" name="ids[]" value="<?php echo $cat->id (); ?>" />
@@ -31,16 +31,16 @@
<?php } ?>
<div class="form-group">
- <label class="group-name" for="new_category"><?php echo Translate::t ('add_category'); ?></label>
+ <label class="group-name" for="new_category"><?php echo Minz_Translate::t ('add_category'); ?></label>
<div class="group-controls">
- <input type="text" id="new_category" name="new_category" placeholder="<?php echo Translate::t ('new_category'); ?>" />
+ <input type="text" id="new_category" name="new_category" placeholder="<?php echo Minz_Translate::t ('new_category'); ?>" />
</div>
</div>
<div class="form-group form-actions">
<div class="group-controls">
- <button type="submit" class="btn btn-important"><?php echo Translate::t ('save'); ?></button>
- <button type="reset" class="btn"><?php echo Translate::t ('cancel'); ?></button>
+ <button type="submit" class="btn btn-important"><?php echo Minz_Translate::t ('save'); ?></button>
+ <button type="reset" class="btn"><?php echo Minz_Translate::t ('cancel'); ?></button>
</div>
</div>
</form>
diff --git a/app/views/configure/display.phtml b/app/views/configure/display.phtml
index 8ad626b86..9104e4ef1 100644
--- a/app/views/configure/display.phtml
+++ b/app/views/configure/display.phtml
@@ -1,99 +1,81 @@
<?php $this->partial ('aside_configure'); ?>
<div class="post">
- <a href="<?php echo _url ('index', 'index'); ?>"><?php echo Translate::t ('back_to_rss_feeds'); ?></a>
+ <a href="<?php echo _url ('index', 'index'); ?>"><?php echo Minz_Translate::t ('back_to_rss_feeds'); ?></a>
<form method="post" action="<?php echo _url ('configure', 'display'); ?>">
- <legend><?php echo Translate::t ('general_configuration'); ?></legend>
+ <legend><?php echo Minz_Translate::t ('theme'); ?></legend>
<div class="form-group">
- <label class="group-name" for="language"><?php echo Translate::t ('language'); ?></label>
+ <label class="group-name" for="language"><?php echo Minz_Translate::t ('language'); ?></label>
<div class="group-controls">
<select name="language" id="language">
<?php $languages = $this->conf->availableLanguages (); ?>
<?php foreach ($languages as $short => $lib) { ?>
- <option value="<?php echo $short; ?>"<?php echo $this->conf->language () == $short ? ' selected="selected"' : ''; ?>><?php echo $lib; ?></option>
+ <option value="<?php echo $short; ?>"<?php echo $this->conf->language === $short ? ' selected="selected"' : ''; ?>><?php echo $lib; ?></option>
<?php } ?>
</select>
</div>
</div>
<div class="form-group">
- <label class="group-name" for="theme"><?php echo Translate::t ('theme'); ?></label>
+ <label class="group-name" for="theme"><?php echo Minz_Translate::t ('theme'); ?></label>
<div class="group-controls">
- <select name="theme" id="theme">
- <?php foreach ($this->themes as $theme) { ?>
- <option value="<?php echo $theme['path']; ?>"<?php echo $this->conf->theme () == $theme['path'] ? ' selected="selected"' : ''; ?>>
- <?php echo $theme['name'] . ' ' . Translate::t ('by') . ' ' . $theme['author']; ?>
- </option>
- <?php } ?>
- </select>
- </div>
- </div>
-
- <div class="form-group">
- <label class="group-name" for="old_entries"><?php echo Translate::t ('delete_articles_every'); ?></label>
- <div class="group-controls">
- <input type="number" id="old_entries" name="old_entries" value="<?php echo $this->conf->oldEntries (); ?>" /> <?php echo Translate::t ('month'); ?>
+ <select name="theme" id="theme" required=""><?php
+ $found = false;
+ foreach ($this->themes as $theme) {
+ ?><option value="<?php echo $theme['id']; ?>"<?php if ($this->conf->theme === $theme['id']) { echo ' selected="selected"'; $found = true; } ?>><?php
+ echo $theme['name'] . ' — ' . Minz_Translate::t ('by') . ' ' . $theme['author'];
+ ?></option><?php
+ }
+ if (!$found) {
+ ?><option selected="selected"></option><?php
+ }
+ ?></select>
</div>
</div>
- <div class="form-group">
- <label class="group-name" for="mail_login"><?php echo Translate::t ('persona_connection_email'); ?></label>
- <?php $mail = $this->conf->mailLogin (); ?>
+ <div class="form-group form-actions">
<div class="group-controls">
- <input type="email" id="mail_login" name="mail_login" value="<?php echo $mail ? $mail : ''; ?>" placeholder="<?php echo Translate::t ('blank_to_disable'); ?>" />
- <noscript><b><?php echo Translate::t ('javascript_should_be_activated'); ?></b></noscript>
- <label class="checkbox" for="anon_access">
- <input type="checkbox" name="anon_access" id="anon_access" value="yes"<?php echo $this->conf->anonAccess () == 'yes' ? ' checked="checked"' : ''; ?> />
- <?php echo Translate::t ('allow_anonymous'); ?>
- </label>
+ <button type="submit" class="btn btn-important"><?php echo Minz_Translate::t ('save'); ?></button>
+ <button type="reset" class="btn"><?php echo Minz_Translate::t ('cancel'); ?></button>
</div>
</div>
- <div class="form-group">
- <label class="group-name" for="token"><?php echo Translate::t ('auth_token'); ?></label>
- <?php $token = $this->conf->token (); ?>
- <div class="group-controls">
- <input type="text" id="token" name="token" value="<?php echo $token; ?>" placeholder="<?php echo Translate::t ('blank_to_disable'); ?>"/>
- <i class="icon i_help"></i> <?php echo Translate::t('explain_token', Url::display(null, 'html', true), $token); ?>
- </div>
- </div>
-
- <legend><?php echo Translate::t ('reading_configuration'); ?></legend>
+ <legend><?php echo Minz_Translate::t ('reading_configuration'); ?></legend>
<div class="form-group">
- <label class="group-name" for="posts_per_page"><?php echo Translate::t ('articles_per_page'); ?></label>
+ <label class="group-name" for="posts_per_page"><?php echo Minz_Translate::t ('articles_per_page'); ?></label>
<div class="group-controls">
- <input type="number" id="posts_per_page" name="posts_per_page" value="<?php echo $this->conf->postsPerPage (); ?>" />
+ <input type="number" id="posts_per_page" name="posts_per_page" value="<?php echo $this->conf->posts_per_page; ?>" />
</div>
</div>
<div class="form-group">
- <label class="group-name" for="sort_order"><?php echo Translate::t ('sort_order'); ?></label>
+ <label class="group-name" for="sort_order"><?php echo Minz_Translate::t ('sort_order'); ?></label>
<div class="group-controls">
<select name="sort_order" id="sort_order">
- <option value="low_to_high"<?php echo $this->conf->sortOrder () == 'low_to_high' ? ' selected="selected"' : ''; ?>><?php echo Translate::t ('newer_first'); ?></option>
- <option value="high_to_low"<?php echo $this->conf->sortOrder () == 'high_to_low' ? ' selected="selected"' : ''; ?>><?php echo Translate::t ('older_first'); ?></option>
+ <option value="DESC"<?php echo $this->conf->sort_order === 'DESC' ? ' selected="selected"' : ''; ?>><?php echo Minz_Translate::t ('newer_first'); ?></option>
+ <option value="ASC"<?php echo $this->conf->sort_order === 'ASC' ? ' selected="selected"' : ''; ?>><?php echo Minz_Translate::t ('older_first'); ?></option>
</select>
</div>
</div>
<div class="form-group">
- <label class="group-name" for="view_mode"><?php echo Translate::t ('default_view'); ?></label>
+ <label class="group-name" for="view_mode"><?php echo Minz_Translate::t ('default_view'); ?></label>
<div class="group-controls">
<select name="view_mode" id="view_mode">
- <option value="normal"<?php echo $this->conf->viewMode () == 'normal' ? ' selected="selected"' : ''; ?>><?php echo Translate::t ('normal_view'); ?></option>
- <option value="reader"<?php echo $this->conf->viewMode () == 'reader' ? ' selected="selected"' : ''; ?>><?php echo Translate::t ('reader_view'); ?></option>
- <option value="global"<?php echo $this->conf->viewMode () == 'global' ? ' selected="selected"' : ''; ?>><?php echo Translate::t ('global_view'); ?></option>
+ <option value="normal"<?php echo $this->conf->view_mode === 'normal' ? ' selected="selected"' : ''; ?>><?php echo Minz_Translate::t ('normal_view'); ?></option>
+ <option value="reader"<?php echo $this->conf->view_mode === 'reader' ? ' selected="selected"' : ''; ?>><?php echo Minz_Translate::t ('reader_view'); ?></option>
+ <option value="global"<?php echo $this->conf->view_mode === 'global' ? ' selected="selected"' : ''; ?>><?php echo Minz_Translate::t ('global_view'); ?></option>
</select>
<label class="radio" for="radio_all">
- <input type="radio" name="default_view" id="radio_all" value="all"<?php echo $this->conf->defaultView () == 'all' ? ' checked="checked"' : ''; ?> />
- <?php echo Translate::t ('show_all_articles'); ?>
+ <input type="radio" name="default_view" id="radio_all" value="all"<?php echo $this->conf->default_view === 'all' ? ' checked="checked"' : ''; ?> />
+ <?php echo Minz_Translate::t ('show_all_articles'); ?>
</label>
<label class="radio" for="radio_not_read">
- <input type="radio" name="default_view" id="radio_not_read" value="not_read"<?php echo $this->conf->defaultView () == 'not_read' ? ' checked="checked"' : ''; ?> />
- <?php echo Translate::t ('show_not_reads'); ?>
+ <input type="radio" name="default_view" id="radio_not_read" value="not_read"<?php echo $this->conf->default_view === 'not_read' ? ' checked="checked"' : ''; ?> />
+ <?php echo Minz_Translate::t ('show_not_reads'); ?>
</label>
</div>
</div>
@@ -101,9 +83,9 @@
<div class="form-group">
<div class="group-controls">
<label class="checkbox" for="auto_load_more">
- <input type="checkbox" name="auto_load_more" id="auto_load_more" value="yes"<?php echo $this->conf->autoLoadMore () == 'yes' ? ' checked="checked"' : ''; ?> />
- <?php echo Translate::t ('auto_load_more'); ?>
- <?php echo $this->conf->displayPosts () == 'no' ? '<noscript> - <b>' . Translate::t ('javascript_should_be_activated') . '</b></noscript>' : ''; ?>
+ <input type="checkbox" name="auto_load_more" id="auto_load_more" value="1"<?php echo $this->conf->auto_load_more ? ' checked="checked"' : ''; ?> />
+ <?php echo Minz_Translate::t ('auto_load_more'); ?>
+ <noscript> — <strong><?php echo Minz_Translate::t ('javascript_should_be_activated'); ?></strong></noscript>
</label>
</div>
</div>
@@ -111,9 +93,9 @@
<div class="form-group">
<div class="group-controls">
<label class="checkbox" for="display_posts">
- <input type="checkbox" name="display_posts" id="display_posts" value="yes"<?php echo $this->conf->displayPosts () == 'yes' ? ' checked="checked"' : ''; ?> />
- <?php echo Translate::t ('display_articles_unfolded'); ?>
- <?php echo $this->conf->displayPosts () == 'no' ? '<noscript> - <b>' . Translate::t ('javascript_should_be_activated') . '</b></noscript>' : ''; ?>
+ <input type="checkbox" name="display_posts" id="display_posts" value="1"<?php echo $this->conf->display_posts ? ' checked="checked"' : ''; ?> />
+ <?php echo Minz_Translate::t ('display_articles_unfolded'); ?>
+ <noscript> — <strong><?php echo Minz_Translate::t ('javascript_should_be_activated'); ?></strong></noscript>
</label>
</div>
</div>
@@ -121,100 +103,92 @@
<div class="form-group">
<div class="group-controls">
<label class="checkbox" for="lazyload">
- <input type="checkbox" name="lazyload" id="lazyload" value="yes"<?php echo $this->conf->lazyload () == 'yes' ? ' checked="checked"' : ''; ?> />
- <?php echo Translate::t ('img_with_lazyload'); ?>
- <?php echo $this->conf->lazyload () == 'yes' ? '<noscript> - <b>' . Translate::t ('javascript_should_be_activated') . '</b></noscript>' : ''; ?>
+ <input type="checkbox" name="lazyload" id="lazyload" value="1"<?php echo $this->conf->lazyload ? ' checked="checked"' : ''; ?> />
+ <?php echo Minz_Translate::t ('img_with_lazyload'); ?>
+ <noscript> — <strong><?php echo Minz_Translate::t ('javascript_should_be_activated'); ?></strong></noscript>
</label>
</div>
</div>
<div class="form-group">
- <label class="group-name"><?php echo Translate::t ('auto_read_when'); ?></label>
+ <label class="group-name"><?php echo Minz_Translate::t ('auto_read_when'); ?></label>
<div class="group-controls">
<label class="checkbox" for="check_open_article">
- <input type="checkbox" name="mark_open_article" id="check_open_article" value="yes"<?php echo $this->conf->markWhenArticle () == 'yes' ? ' checked="checked"' : ''; ?> />
- <?php echo Translate::t ('article_selected'); ?>
+ <input type="checkbox" name="mark_open_article" id="check_open_article" value="1"<?php echo $this->conf->mark_when['article'] ? ' checked="checked"' : ''; ?> />
+ <?php echo Minz_Translate::t ('article_selected'); ?>
</label>
<label class="checkbox" for="check_open_site">
- <input type="checkbox" name="mark_open_site" id="check_open_site" value="yes"<?php echo $this->conf->markWhenSite () == 'yes' ? ' checked="checked"' : ''; ?> />
- <?php echo Translate::t ('article_open_on_website'); ?>
+ <input type="checkbox" name="mark_open_site" id="check_open_site" value="1"<?php echo $this->conf->mark_when['site'] ? ' checked="checked"' : ''; ?> />
+ <?php echo Minz_Translate::t ('article_open_on_website'); ?>
</label>
<label class="checkbox" for="check_scroll">
- <input type="checkbox" name="mark_scroll" id="check_scroll" value="yes"<?php echo $this->conf->markWhenScroll () == 'yes' ? ' checked="checked"' : ''; ?> />
- <?php echo Translate::t ('scroll'); ?>
+ <input type="checkbox" name="mark_scroll" id="check_scroll" value="1"<?php echo $this->conf->mark_when['scroll'] ? ' checked="checked"' : ''; ?> />
+ <?php echo Minz_Translate::t ('scroll'); ?>
+ </label>
+ <label class="checkbox" for="check_reception">
+ <input type="checkbox" name="mark_upon_reception" id="check_reception" value="1"<?php echo $this->conf->mark_when['reception'] ? ' checked="checked"' : ''; ?> />
+ <?php echo Minz_Translate::t ('upon_reception'); ?>
</label>
</div>
</div>
<div class="form-group">
- <label class="group-name"><?php echo Translate::t ('after_onread'); ?></label>
+ <label class="group-name"><?php echo Minz_Translate::t ('after_onread'); ?></label>
<div class="group-controls">
<label class="checkbox" for="onread_jump_next">
- <input type="checkbox" name="onread_jump_next" id="onread_jump_next" value="yes"<?php echo $this->conf->onread_jump_next () == 'yes' ? ' checked="checked"' : ''; ?> />
- <?php echo Translate::t ('jump_next'); ?>
+ <input type="checkbox" name="onread_jump_next" id="onread_jump_next" value="1"<?php echo $this->conf->onread_jump_next ? ' checked="checked"' : ''; ?> />
+ <?php echo Minz_Translate::t ('jump_next'); ?>
</label>
</div>
</div>
- <legend><?php echo Translate::t ('reading_icons'); ?></legend>
+ <div class="form-group form-actions">
+ <div class="group-controls">
+ <button type="submit" class="btn btn-important"><?php echo Minz_Translate::t ('save'); ?></button>
+ <button type="reset" class="btn"><?php echo Minz_Translate::t ('cancel'); ?></button>
+ </div>
+ </div>
+
+ <legend><?php echo Minz_Translate::t ('reading_icons'); ?></legend>
<div class="form-group">
<table>
<thead>
<tr>
- <th>&nbsp;</th>
- <th><a class="read" title="<?php echo Translate::t ('mark_read'); ?>">&nbsp;</span></th>
- <th><a class="bookmark" title="<?php echo Translate::t ('mark_favorite'); ?>">&nbsp;</span></th>
- <th><?php echo Translate::t ('sharing'); ?></th>
- <th><?php echo Translate::t ('related_tags'); ?></th>
- <th><?php echo Translate::t ('publication_date'); ?></th>
- <th class="item link"><a>&nbsp;</a></th>
+ <th> </th>
+ <th title="<?php echo Minz_Translate::t ('mark_read'); ?>"><?php echo FreshRSS_Themes::icon('read'); ?></th>
+ <th title="<?php echo Minz_Translate::t ('mark_favorite'); ?>"><?php echo FreshRSS_Themes::icon('bookmark'); ?></th>
+ <th><?php echo Minz_Translate::t ('sharing'); ?></th>
+ <th><?php echo Minz_Translate::t ('related_tags'); ?></th>
+ <th><?php echo Minz_Translate::t ('publication_date'); ?></th>
+ <th><?php echo FreshRSS_Themes::icon('link'); ?></th>
</tr>
</thead>
<tbody>
<tr>
- <th><?php echo Translate::t ('top_line'); ?></th>
- <td><input type="checkbox" name="topline_read" value="yes"<?php echo $this->conf->toplineRead () ? ' checked="checked"' : ''; ?> /></td>
- <td><input type="checkbox" name="topline_favorite" value="yes"<?php echo $this->conf->toplineFavorite () ? ' checked="checked"' : ''; ?> /></td>
+ <th><?php echo Minz_Translate::t ('top_line'); ?></th>
+ <td><input type="checkbox" name="topline_read" value="1"<?php echo $this->conf->topline_read ? ' checked="checked"' : ''; ?> /></td>
+ <td><input type="checkbox" name="topline_favorite" value="1"<?php echo $this->conf->topline_favorite ? ' checked="checked"' : ''; ?> /></td>
<td><input type="checkbox" disabled="disabled" /></td>
<td><input type="checkbox" disabled="disabled" /></td>
- <td><input type="checkbox" name="topline_date" value="yes"<?php echo $this->conf->toplineDate () ? ' checked="checked"' : ''; ?> /></td>
- <td><input type="checkbox" name="topline_link" value="yes"<?php echo $this->conf->toplineLink () ? ' checked="checked"' : ''; ?> /></td>
+ <td><input type="checkbox" name="topline_date" value="1"<?php echo $this->conf->topline_date ? ' checked="checked"' : ''; ?> /></td>
+ <td><input type="checkbox" name="topline_link" value="1"<?php echo $this->conf->topline_link ? ' checked="checked"' : ''; ?> /></td>
</tr><tr>
- <th><?php echo Translate::t ('bottom_line'); ?></th>
- <td><input type="checkbox" name="bottomline_read" value="yes"<?php echo $this->conf->bottomlineRead () ? ' checked="checked"' : ''; ?> /></td>
- <td><input type="checkbox" name="bottomline_favorite" value="yes"<?php echo $this->conf->bottomlineFavorite () ? ' checked="checked"' : ''; ?> /></td>
- <td><input type="checkbox" name="bottomline_sharing" value="yes"<?php echo $this->conf->bottomlineSharing () ? ' checked="checked"' : ''; ?> /></td>
- <td><input type="checkbox" name="bottomline_tags" value="yes"<?php echo $this->conf->bottomlineTags () ? ' checked="checked"' : ''; ?> /></td>
- <td><input type="checkbox" name="bottomline_date" value="yes"<?php echo $this->conf->bottomlineDate () ? ' checked="checked"' : ''; ?> /></td>
- <td><input type="checkbox" name="bottomline_link" value="yes"<?php echo $this->conf->bottomlineLink () ? ' checked="checked"' : ''; ?> /></td>
+ <th><?php echo Minz_Translate::t ('bottom_line'); ?></th>
+ <td><input type="checkbox" name="bottomline_read" value="1"<?php echo $this->conf->bottomline_read ? ' checked="checked"' : ''; ?> /></td>
+ <td><input type="checkbox" name="bottomline_favorite" value="1"<?php echo $this->conf->bottomline_favorite ? ' checked="checked"' : ''; ?> /></td>
+ <td><input type="checkbox" name="bottomline_sharing" value="1"<?php echo $this->conf->bottomline_sharing ? ' checked="checked"' : ''; ?> /></td>
+ <td><input type="checkbox" name="bottomline_tags" value="1"<?php echo $this->conf->bottomline_tags ? ' checked="checked"' : ''; ?> /></td>
+ <td><input type="checkbox" name="bottomline_date" value="1"<?php echo $this->conf->bottomline_date ? ' checked="checked"' : ''; ?> /></td>
+ <td><input type="checkbox" name="bottomline_link" value="1"<?php echo $this->conf->bottomline_link ? ' checked="checked"' : ''; ?> /></td>
</tr>
</tbody>
- </table>
- </div>
-
- <legend><?php echo Translate::t ('sharing'); ?></legend>
- <div class="form-group">
- <label class="group-name" for="shaarli"><?php echo Translate::t ('your_shaarli'); ?></label>
- <div class="group-controls">
- <input type="text" id="shaarli" name="shaarli" value="<?php echo $this->conf->urlShaarli (); ?>" placeholder="<?php echo Translate::t ('blank_to_disable'); ?>"/>
- </div>
- </div>
-
- <legend><?php echo Translate::t ('advanced'); ?></legend>
- <div class="form-group">
- <label class="group-name"></label>
- <div class="group-controls">
- <a class="btn" href="<?php echo _url('entry', 'optimize'); ?>">
- <?php echo Translate::t('optimize_bdd'); ?>
- </a>
- <i class="icon i_help"></i> <?php echo Translate::t('optimize_todo_sometimes'); ?>
- </div>
+ </table><br />
</div>
<div class="form-group form-actions">
<div class="group-controls">
- <button type="submit" class="btn btn-important"><?php echo Translate::t ('save'); ?></button>
- <button type="reset" class="btn"><?php echo Translate::t ('cancel'); ?></button>
+ <button type="submit" class="btn btn-important"><?php echo Minz_Translate::t ('save'); ?></button>
+ <button type="reset" class="btn"><?php echo Minz_Translate::t ('cancel'); ?></button>
</div>
</div>
</form>
diff --git a/app/views/configure/feed.phtml b/app/views/configure/feed.phtml
index b61de6dcb..138808a9f 100644
--- a/app/views/configure/feed.phtml
+++ b/app/views/configure/feed.phtml
@@ -2,62 +2,46 @@
<?php if ($this->flux) { ?>
<div class="post">
- <a href="<?php echo _url ('index', 'index'); ?>"><?php echo Translate::t ('back_to_rss_feeds'); ?></a> <?php echo Translate::t ('or'); ?> <a href="<?php echo _url ('index', 'index', 'get', 'f_' . $this->flux->id ()); ?>"><?php echo Translate::t ('filter'); ?></a>
+ <a href="<?php echo _url ('index', 'index'); ?>"><?php echo Minz_Translate::t ('back_to_rss_feeds'); ?></a> <?php echo Minz_Translate::t ('or'); ?> <a href="<?php echo _url ('index', 'index', 'get', 'f_' . $this->flux->id ()); ?>"><?php echo Minz_Translate::t ('filter'); ?></a>
<h1><?php echo $this->flux->name (); ?></h1>
<?php echo $this->flux->description (); ?>
<?php if ($this->flux->inError ()) { ?>
- <p class="alert alert-error"><span class="alert-head"><?php echo Translate::t ('damn'); ?></span> <?php echo Translate::t ('feed_in_error'); ?></p>
+ <p class="alert alert-error"><span class="alert-head"><?php echo Minz_Translate::t ('damn'); ?></span> <?php echo Minz_Translate::t ('feed_in_error'); ?></p>
<?php } ?>
- <form method="post" action="<?php echo _url ('configure', 'feed', 'id', $this->flux->id ()); ?>">
- <legend><?php echo Translate::t ('informations'); ?></legend>
+ <form method="post" action="<?php echo _url ('configure', 'feed', 'id', $this->flux->id ()); ?>" autocomplete="off">
+ <legend><?php echo Minz_Translate::t ('informations'); ?></legend>
<div class="form-group">
- <label class="group-name" for="name"><?php echo Translate::t ('title'); ?></label>
+ <label class="group-name" for="name"><?php echo Minz_Translate::t ('title'); ?></label>
<div class="group-controls">
- <input type="text" name="name" id="name" value="<?php echo $this->flux->name () ; ?>" />
+ <input type="text" name="name" id="name" class="extend" value="<?php echo $this->flux->name () ; ?>" />
</div>
</div>
<div class="form-group">
- <label class="group-name"><?php echo Translate::t ('website_url'); ?></label>
+ <label class="group-name" for="description"><?php echo Minz_Translate::t ('feed_description'); ?></label>
<div class="group-controls">
- <span class="control">
- <?php echo $this->flux->website (); ?>
- <a target="_blank" href="<?php echo $this->flux->website (); ?>"><i class="icon i_link"></i></a>
- </span>
+ <textarea name="description" id="description"><?php echo htmlspecialchars($this->flux->description(), ENT_NOQUOTES, 'UTF-8'); ?></textarea>
</div>
</div>
<div class="form-group">
- <label class="group-name"><?php echo Translate::t ('feed_url'); ?></label>
+ <label class="group-name" for="website"><?php echo Minz_Translate::t ('website_url'); ?></label>
<div class="group-controls">
- <span class="control">
- <?php echo $this->flux->url (); ?>
- <a target="_blank" href="<?php echo $this->flux->url (); ?>"><i class="icon i_link"></i></a>
- </span>
+ <input type="text" name="website" id="website" class="extend" value="<?php echo $this->flux->website (); ?>" />
+ <a target="_blank" href="<?php echo $this->flux->website (); ?>"><?php echo FreshRSS_Themes::icon('link'); ?></a>
</div>
</div>
<div class="form-group">
- <label class="group-name"></label>
+ <label class="group-name" for="url"><?php echo Minz_Translate::t ('feed_url'); ?></label>
<div class="group-controls">
- <a class="btn" href="<?php echo _url ('feed', 'actualize', 'id', $this->flux->id ()); ?>">
- <i class="icon i_refresh"></i> <?php echo Translate::t('actualize'); ?>
- </a>
+ <input type="text" name="url" id="url" class="extend" value="<?php echo $this->flux->url (); ?>" />
+ <a target="_blank" href="<?php echo $this->flux->url (); ?>"><?php echo FreshRSS_Themes::icon('link'); ?></a>
+   <a class="btn" target="_blank" href="http://validator.w3.org/feed/check.cgi?url=<?php echo $this->flux->url (); ?>"><?php echo Minz_Translate::t ('feed_validator'); ?></a>
</div>
</div>
<div class="form-group">
- <label class="group-name"><?php echo Translate::t ('number_articles'); ?></label>
- <div class="group-controls">
- <span class="control"><?php echo $this->flux->nbEntries (); ?></span>
- <label class="checkbox" for="keep_history">
- <input type="checkbox" name="keep_history" id="keep_history" value="yes"<?php echo $this->flux->keepHistory () == 'yes' ? ' checked="checked"' : ''; ?> />
- <?php echo Translate::t ('keep_history'); ?>
- </label>
- </div>
- </div>
-
- <div class="form-group">
- <label class="group-name" for="category"><?php echo Translate::t ('category'); ?></label>
+ <label class="group-name" for="category"><?php echo Minz_Translate::t ('category'); ?></label>
<div class="group-controls">
<select name="category" id="category">
<?php foreach ($this->categories as $cat) { ?>
@@ -68,49 +52,95 @@
</select>
</div>
</div>
-
- <legend><?php echo Translate::t ('advanced'); ?></legend>
<div class="form-group">
- <label class="group-name" for="priority"><?php echo Translate::t ('show_in_all_flux'); ?></label>
+ <label class="group-name" for="priority"><?php echo Minz_Translate::t ('show_in_all_flux'); ?></label>
<div class="group-controls">
<label class="checkbox" for="priority">
<input type="checkbox" name="priority" id="priority" value="10"<?php echo $this->flux->priority () > 0 ? ' checked="checked"' : ''; ?> />
- <?php echo Translate::t ('yes'); ?>
+ <?php echo Minz_Translate::t ('yes'); ?>
</label>
</div>
</div>
+ <div class="form-group form-actions">
+ <div class="group-controls">
+ <button class="btn btn-important"><?php echo Minz_Translate::t ('save'); ?></button>
+ <button class="btn btn-attention confirm" formmethod="post" formaction="<?php echo Minz_Url::display (array ('c' => 'feed', 'a' => 'delete', 'params' => array ('id' => $this->flux->id ()))); ?>"><?php echo Minz_Translate::t ('delete'); ?></button>
+ </div>
+ </div>
+
+ <legend><?php echo Minz_Translate::t ('archiving_configuration'); ?></legend>
+
+ <div class="form-group">
+ <label class="group-name"></label>
+ <div class="group-controls">
+ <a class="btn" href="<?php echo _url ('feed', 'actualize', 'id', $this->flux->id ()); ?>">
+ <?php echo FreshRSS_Themes::icon('refresh'); ?> <?php echo Minz_Translate::t('actualize'); ?>
+ </a>
+ </div>
+ </div>
<div class="form-group">
- <label class="group-name" for="path_entries"><?php echo Translate::t ('css_path_on_website'); ?></label>
+ <label class="group-name"><?php echo Minz_Translate::t ('number_articles'); ?></label>
<div class="group-controls">
- <input type="text" name="path_entries" id="path_entries" value="<?php echo $this->flux->pathEntries (); ?>" placeholder="<?php echo Translate::t ('blank_to_disable'); ?>" />
- <i class="icon i_help"></i> <?php echo Translate::t ('retrieve_truncated_feeds'); ?>
+ <span class="control"><?php echo $this->flux->nbEntries (); ?></span>
+ </div>
+ </div>
+ <div class="form-group">
+ <label class="group-name" for="keep_history"><?php echo Minz_Translate::t ('keep_history'); ?></label>
+ <div class="group-controls">
+ <select class="number" name="keep_history" id="keep_history" required="required"><?php
+ foreach (array('' => '', -2 => Minz_Translate::t('by_default'), 0 => '0', 10 => '10', 50 => '50', 100 => '100', 500 => '500', 1000 => '1 000', 5000 => '5 000', 10000 => '10 000', -1 => '∞') as $v => $t) {
+ echo '<option value="' . $v . ($this->flux->keepHistory() === $v ? '" selected="selected' : '') . '">' . $t . '</option>';
+ }
+ ?></select>
+ </div>
+ </div>
+ <div class="form-group form-actions">
+ <div class="group-controls">
+ <button class="btn btn-important"><?php echo Minz_Translate::t ('save'); ?></button>
+ <button class="btn btn-attention confirm" formmethod="post" formaction="<?php echo Minz_Url::display (array ('c' => 'feed', 'a' => 'truncate', 'params' => array ('id' => $this->flux->id ()))); ?>"><?php echo Minz_Translate::t ('truncate'); ?></button>
</div>
</div>
+ <legend><?php echo Minz_Translate::t ('login_configuration'); ?></legend>
<?php $auth = $this->flux->httpAuth (false); ?>
<div class="form-group">
- <label class="group-name" for="http_user"><?php echo Translate::t ('http_username'); ?></label>
+ <label class="group-name" for="http_user"><?php echo Minz_Translate::t ('http_username'); ?></label>
<div class="group-controls">
- <input type="text" name="http_user" id="http_user" value="<?php echo $auth['username']; ?>" autocomplete="off" />
- <i class="icon i_help"></i> <?php echo Translate::t ('access_protected_feeds'); ?>
+ <input type="text" name="http_user" id="http_user" class="extend" value="<?php echo $auth['username']; ?>" autocomplete="off" />
+ <?php echo FreshRSS_Themes::icon('help'); ?> <?php echo Minz_Translate::t ('access_protected_feeds'); ?>
</div>
- <label class="group-name" for="http_pass"><?php echo Translate::t ('http_password'); ?></label>
+ <label class="group-name" for="http_pass"><?php echo Minz_Translate::t ('http_password'); ?></label>
+ <div class="group-controls">
+ <input type="password" name="http_pass" id="http_pass" class="extend" value="<?php echo $auth['password']; ?>" autocomplete="off" />
+ </div>
+ </div>
+
+ <div class="form-group form-actions">
<div class="group-controls">
- <input type="password" name="http_pass" id="http_pass" value="<?php echo $auth['password']; ?>" autocomplete="off" />
+ <button type="submit" class="btn btn-important"><?php echo Minz_Translate::t ('save'); ?></button>
+ <button type="reset" class="btn"><?php echo Minz_Translate::t ('cancel'); ?></button>
</div>
</div>
+ <legend><?php echo Minz_Translate::t ('advanced'); ?></legend>
+ <div class="form-group">
+ <label class="group-name" for="path_entries"><?php echo Minz_Translate::t ('css_path_on_website'); ?></label>
+ <div class="group-controls">
+ <input type="text" name="path_entries" id="path_entries" class="extend" value="<?php echo $this->flux->pathEntries (); ?>" placeholder="<?php echo Minz_Translate::t ('blank_to_disable'); ?>" />
+ <?php echo FreshRSS_Themes::icon('help'); ?> <?php echo Minz_Translate::t ('retrieve_truncated_feeds'); ?>
+ </div>
+ </div>
<div class="form-group form-actions">
<div class="group-controls">
- <button class="btn btn-important"><?php echo Translate::t ('save'); ?></button>
- <button class="btn btn-attention confirm" formaction="<?php echo Url::display (array ('c' => 'feed', 'a' => 'delete', 'params' => array ('id' => $this->flux->id ()))); ?>"><?php echo Translate::t ('delete'); ?></button>
+ <button type="submit" class="btn btn-important"><?php echo Minz_Translate::t ('save'); ?></button>
+ <button type="reset" class="btn"><?php echo Minz_Translate::t ('cancel'); ?></button>
</div>
</div>
</form>
</div>
<?php } else { ?>
-<div class="alert alert-warn"><span class="alert-head"><?php echo Translate::t ('no_selected_feed'); ?></span> <?php echo Translate::t ('think_to_add'); ?></div>
+<div class="alert alert-warn"><span class="alert-head"><?php echo Minz_Translate::t ('no_selected_feed'); ?></span> <?php echo Minz_Translate::t ('think_to_add'); ?></div>
<?php } ?>
diff --git a/app/views/configure/importExport.phtml b/app/views/configure/importExport.phtml
index 4cc575356..e2217d9ed 100644
--- a/app/views/configure/importExport.phtml
+++ b/app/views/configure/importExport.phtml
@@ -1,9 +1,12 @@
-<?php if ($this->req == 'export') { ?>
-<?php echo '<?xml version="1.0" encoding="UTF-8" ?>'; // résout bug sur certain serveur ?>
-<!-- Generated by <?php echo Configuration::title (); ?> -->
+<?php
+require_once(LIB_PATH . '/lib_opml.php');
+if ($this->req == 'export') {
+ echo '<?xml version="1.0" encoding="UTF-8" ?>';
+?>
+<!-- Generated by <?php echo Minz_Configuration::title (); ?> -->
<opml version="2.0">
<head>
- <title><?php echo Configuration::title (); ?> OPML Feed</title>
+ <title><?php echo Minz_Configuration::title (); ?> OPML Feed</title>
<dateCreated><?php echo date('D, d M Y H:i:s'); ?></dateCreated>
</head>
<body>
@@ -14,12 +17,12 @@
<?php $this->partial ('aside_feed'); ?>
<div class="post ">
- <a href="<?php echo _url ('index', 'index'); ?>"><?php echo Translate::t ('back_to_rss_feeds'); ?></a>
+ <a href="<?php echo _url ('index', 'index'); ?>"><?php echo Minz_Translate::t ('back_to_rss_feeds'); ?></a>
- <form method="post" action="<?php echo Url::display (array ('c' => 'configure', 'a' => 'importExport', 'params' => array ('q' => 'import'))); ?>" enctype="multipart/form-data">
- <legend><?php echo Translate::t ('import_export_opml'); ?></legend>
+ <form method="post" action="<?php echo Minz_Url::display (array ('c' => 'configure', 'a' => 'importExport', 'params' => array ('q' => 'import'))); ?>" enctype="multipart/form-data">
+ <legend><?php echo Minz_Translate::t ('import_export_opml'); ?></legend>
<div class="form-group">
- <label class="group-name" for="file"><?php echo Translate::t ('file_to_import'); ?></label>
+ <label class="group-name" for="file"><?php echo Minz_Translate::t ('file_to_import'); ?></label>
<div class="group-controls">
<input type="file" name="file" id="file" />
</div>
@@ -27,9 +30,9 @@
<div class="form-group form-actions">
<div class="group-controls">
- <button type="submit" class="btn btn-important"><?php echo Translate::t ('import'); ?></button>
- <?php echo Translate::t ('or'); ?>
- <a target="_blank" class="btn btn-important" href="<?php echo _url ('configure', 'importExport', 'q', 'export'); ?>"><?php echo Translate::t ('export'); ?></a>
+ <button type="submit" class="btn btn-important"><?php echo Minz_Translate::t ('import'); ?></button>
+ <?php echo Minz_Translate::t ('or'); ?>
+ <a target="_blank" class="btn btn-important" href="<?php echo _url ('configure', 'importExport', 'q', 'export'); ?>"><?php echo Minz_Translate::t ('export'); ?></a>
</div>
</div>
</form>
diff --git a/app/views/configure/sharing.phtml b/app/views/configure/sharing.phtml
new file mode 100644
index 000000000..e3ea11665
--- /dev/null
+++ b/app/views/configure/sharing.phtml
@@ -0,0 +1,64 @@
+<?php $this->partial ('aside_configure'); ?>
+
+<div class="post">
+ <a href="<?php echo _url ('index', 'index'); ?>"><?php echo Minz_Translate::t ('back_to_rss_feeds'); ?></a>
+
+ <form method="post" action="<?php echo _url ('configure', 'sharing'); ?>">
+ <legend><?php echo Minz_Translate::t ('sharing'); ?></legend>
+ <div class="form-group">
+ <label class="group-name" for="shaarli">
+ <?php echo Minz_Translate::t ('your_shaarli'); ?>
+ </label>
+ <div class="group-controls">
+ <input type="url" id="shaarli" name="shaarli" class="extend" value="<?php echo $this->conf->sharing ('shaarli'); ?>" placeholder="<?php echo Minz_Translate::t ('blank_to_disable'); ?>" size="64" />
+
+ <?php echo FreshRSS_Themes::icon('help'); ?> <a target="_blank" href="http://sebsauvage.net/wiki/doku.php?id=php:shaarli"><?php echo Minz_Translate::t ('more_information'); ?></a>
+ </div>
+ </div>
+
+ <div class="form-group">
+ <label class="group-name" for="wallabag">
+ <?php echo Minz_Translate::t ('your_wallabag'); ?>
+ </label>
+ <div class="group-controls">
+ <input type="url" id="wallabag" name="wallabag" class="extend" value="<?php echo $this->conf->sharing ('wallabag'); ?>" placeholder="<?php echo Minz_Translate::t ('blank_to_disable'); ?>" size="64" />
+
+ <?php echo FreshRSS_Themes::icon('help'); ?> <a target="_blank" href="http://www.wallabag.org"><?php echo Minz_Translate::t ('more_information'); ?></a>
+ </div>
+ </div>
+
+ <div class="form-group">
+ <label class="group-name" for="diaspora">
+ <?php echo Minz_Translate::t ('your_diaspora_pod'); ?>
+ </label>
+ <div class="group-controls">
+ <input type="url" id="diaspora" name="diaspora" class="extend" value="<?php echo $this->conf->sharing ('diaspora'); ?>" placeholder="<?php echo Minz_Translate::t ('blank_to_disable'); ?>" size="64" />
+
+ <?php echo FreshRSS_Themes::icon('help'); ?> <a target="_blank" href="https://diasporafoundation.org/"><?php echo Minz_Translate::t ('more_information'); ?></a>
+ </div>
+ </div>
+
+ <div class="form-group">
+ <label class="group-name"><?php echo Minz_Translate::t ('activate_sharing'); ?></label>
+ <div class="group-controls">
+ <?php
+ $services = array ('twitter', 'g+', 'facebook', 'email', 'print');
+
+ foreach ($services as $service) {
+ ?>
+ <label class="checkbox" for="<?php echo $service; ?>">
+ <input type="checkbox" name="<?php echo $service; ?>" id="<?php echo $service; ?>" value="1"<?php echo $this->conf->sharing($service) ? ' checked="checked"' : ''; ?> />
+ <?php echo Minz_Translate::t ($service); ?>
+ </label>
+ <?php } ?>
+ </div>
+ </div>
+
+ <div class="form-group form-actions">
+ <div class="group-controls">
+ <button type="submit" class="btn btn-important"><?php echo Minz_Translate::t ('save'); ?></button>
+ <button type="reset" class="btn"><?php echo Minz_Translate::t ('cancel'); ?></button>
+ </div>
+ </div>
+ </form>
+</div>
diff --git a/app/views/configure/shortcut.phtml b/app/views/configure/shortcut.phtml
index 01e66adb4..b0867f711 100644
--- a/app/views/configure/shortcut.phtml
+++ b/app/views/configure/shortcut.phtml
@@ -1,7 +1,7 @@
<?php $this->partial ('aside_configure'); ?>
<div class="post">
- <a href="<?php echo _url ('index', 'index'); ?>"><?php echo Translate::t ('back_to_rss_feeds'); ?></a>
+ <a href="<?php echo _url ('index', 'index'); ?>"><?php echo Minz_Translate::t ('back_to_rss_feeds'); ?></a>
<datalist id="keys">
<?php foreach ($this->list_keys as $key) { ?>
@@ -9,55 +9,76 @@
<?php } ?>
</datalist>
- <?php $s = $this->conf->shortcuts (); ?>
+ <?php $s = $this->conf->shortcuts; ?>
<form method="post" action="<?php echo _url ('configure', 'shortcut'); ?>">
- <legend><?php echo Translate::t ('shortcuts_management'); ?></legend>
+ <legend><?php echo Minz_Translate::t ('shortcuts_management'); ?></legend>
- <noscript><p class="alert alert-error"><?php echo Translate::t ('javascript_for_shortcuts'); ?></p></noscript>
+ <noscript><p class="alert alert-error"><?php echo Minz_Translate::t ('javascript_for_shortcuts'); ?></p></noscript>
<div class="form-group">
- <label class="group-name" for="mark_read"><?php echo Translate::t ('mark_read'); ?></label>
+ <label class="group-name" for="mark_read"><?php echo Minz_Translate::t ('mark_read'); ?></label>
<div class="group-controls">
<input type="text" id="mark_read" name="shortcuts[mark_read]" list="keys" value="<?php echo $s['mark_read']; ?>" />
- <?php echo Translate::t ('shift_for_all_read'); ?>
+ <?php echo Minz_Translate::t ('shift_for_all_read'); ?>
</div>
</div>
<div class="form-group">
- <label class="group-name" for="mark_favorite"><?php echo Translate::t ('mark_favorite'); ?></label>
+ <label class="group-name" for="mark_favorite"><?php echo Minz_Translate::t ('mark_favorite'); ?></label>
<div class="group-controls">
<input type="text" id="mark_favorite" name="shortcuts[mark_favorite]" list="keys" value="<?php echo $s['mark_favorite']; ?>" />
</div>
</div>
<div class="form-group">
- <label class="group-name" for="go_website"><?php echo Translate::t ('see_on_website'); ?></label>
+ <label class="group-name" for="go_website"><?php echo Minz_Translate::t ('see_on_website'); ?></label>
<div class="group-controls">
<input type="text" id="go_website" name="shortcuts[go_website]" list="keys" value="<?php echo $s['go_website']; ?>" />
</div>
</div>
<div class="form-group">
- <label class="group-name" for="next_entry"><?php echo Translate::t ('next_article'); ?></label>
+ <label class="group-name" for="next_entry"><?php echo Minz_Translate::t ('next_article'); ?></label>
<div class="group-controls">
<input type="text" id="next_entry" name="shortcuts[next_entry]" list="keys" value="<?php echo $s['next_entry']; ?>" />
- <?php echo Translate::t ('shift_for_last'); ?>
+ <?php echo Minz_Translate::t ('shift_for_last'); ?>
</div>
</div>
<div class="form-group">
- <label class="group-name" for="prev_entry"><?php echo Translate::t ('previous_article'); ?></label>
+ <label class="group-name" for="prev_entry"><?php echo Minz_Translate::t ('previous_article'); ?></label>
<div class="group-controls">
<input type="text" id="prev_entry" name="shortcuts[prev_entry]" list="keys" value="<?php echo $s['prev_entry']; ?>" />
- <?php echo Translate::t ('shift_for_first'); ?>
+ <?php echo Minz_Translate::t ('shift_for_first'); ?>
+ </div>
+ </div>
+
+ <div class="form-group">
+ <label class="group-name" for="collapse_entry"><?php echo Minz_Translate::t ('collapse_article'); ?></label>
+ <div class="group-controls">
+ <input type="text" id="collapse_entry" name="shortcuts[collapse_entry]" list="keys" value="<?php echo $s['collapse_entry']; ?>" />
+ </div>
+ </div>
+
+ <div class="form-group">
+ <label class="group-name" for="load_more_shortcut"><?php echo Minz_Translate::t ('load_more'); ?></label>
+ <div class="group-controls">
+ <input type="text" id="load_more_shortcut" name="shortcuts[load_more]" list="keys" value="<?php echo $s['load_more']; ?>" />
+ </div>
+ </div>
+
+ <div class="form-group">
+ <label class="group-name" for="auto_share_shortcut"><?php echo Minz_Translate::t ('auto_share'); ?></label>
+ <div class="group-controls">
+ <input type="text" id="auto_share_shortcut" name="shortcuts[auto_share]" list="keys" value="<?php echo $s['auto_share']; ?>" />
</div>
</div>
<div class="form-group form-actions">
<div class="group-controls">
- <button type="submit" class="btn btn-important"><?php echo Translate::t ('save'); ?></button>
- <button type="reset" class="btn"><?php echo Translate::t ('cancel'); ?></button>
+ <button type="submit" class="btn btn-important"><?php echo Minz_Translate::t ('save'); ?></button>
+ <button type="reset" class="btn"><?php echo Minz_Translate::t ('cancel'); ?></button>
</div>
</div>
</form>
diff --git a/app/views/configure/users.phtml b/app/views/configure/users.phtml
new file mode 100644
index 000000000..8ab4c04ba
--- /dev/null
+++ b/app/views/configure/users.phtml
@@ -0,0 +1,162 @@
+<?php $this->partial('aside_configure'); ?>
+
+<div class="post">
+ <a href="<?php echo _url('index', 'index'); ?>"><?php echo Minz_Translate::t('back_to_rss_feeds'); ?></a>
+
+ <form method="post" action="<?php echo _url('users', 'auth'); ?>">
+ <legend><?php echo Minz_Translate::t('login_configuration'); ?></legend>
+
+ <div class="form-group">
+ <label class="group-name" for="current_user"><?php echo Minz_Translate::t('current_user'); ?></label>
+ <div class="group-controls">
+ <input id="current_user" type="text" disabled="disabled" value="<?php echo Minz_Session::param('currentUser', '_'); ?>" />
+ <label class="checkbox" for="is_admin">
+ <input type="checkbox" id="is_admin" disabled="disabled" <?php echo Minz_Configuration::isAdmin(Minz_Session::param('currentUser', '_')) ? 'checked="checked" ' : ''; ?>/>
+ <?php echo Minz_Translate::t('is_admin'); ?>
+ </label>
+ </div>
+ </div>
+
+ <div class="form-group">
+ <label class="group-name" for="passwordPlain"><?php echo Minz_Translate::t('password_form'); ?></label>
+ <div class="group-controls">
+ <input type="password" id="passwordPlain" name="passwordPlain" pattern=".{7,}" />
+ <noscript><b><?php echo Minz_Translate::t('javascript_should_be_activated'); ?></b></noscript>
+ </div>
+ </div>
+
+ <div class="form-group">
+ <label class="group-name" for="mail_login"><?php echo Minz_Translate::t('persona_connection_email'); ?></label>
+ <?php $mail = $this->conf->mail_login; ?>
+ <div class="group-controls">
+ <input type="email" id="mail_login" name="mail_login" class="extend" value="<?php echo $mail; ?>" <?php echo Minz_Configuration::isAdmin(Minz_Session::param('currentUser', '_')) ? '' : 'disabled="disabled"'; ?> placeholder="alice@example.net" />
+ <noscript><b><?php echo Minz_Translate::t('javascript_should_be_activated'); ?></b></noscript>
+ </div>
+ </div>
+
+ <div class="form-group form-actions">
+ <div class="group-controls">
+ <button type="submit" class="btn btn-important"><?php echo Minz_Translate::t('save'); ?></button>
+ <button type="reset" class="btn"><?php echo Minz_Translate::t('cancel'); ?></button>
+ </div>
+ </div>
+
+ <?php if (Minz_Configuration::isAdmin(Minz_Session::param('currentUser', '_'))) { ?>
+
+ <legend><?php echo Minz_Translate::t('auth_type'); ?></legend>
+
+ <div class="form-group">
+ <label class="group-name" for="auth_type"><?php echo Minz_Translate::t('auth_type'); ?></label>
+ <div class="group-controls">
+ <select id="auth_type" name="auth_type" required="required">
+ <?php if (!in_array(Minz_Configuration::authType(), array('form', 'persona', 'http_auth', 'none'))) { ?>
+ <option selected="selected"></option>
+ <?php } ?>
+ <option value="form"<?php echo Minz_Configuration::authType() === 'form' ? ' selected="selected"' : '', version_compare(PHP_VERSION, '5.3', '<') ? ' disabled="disabled"' : ''; ?>><?php echo Minz_Translate::t('auth_form'); ?></option>
+ <option value="persona"<?php echo Minz_Configuration::authType() === 'persona' ? ' selected="selected"' : '', $this->conf->mail_login == '' ? ' disabled="disabled"' : ''; ?>><?php echo Minz_Translate::t('auth_persona'); ?></option>
+ <option value="http_auth"<?php echo Minz_Configuration::authType() === 'http_auth' ? ' selected="selected"' : '', httpAuthUser() == '' ? ' disabled="disabled"' : ''; ?>><?php echo Minz_Translate::t('http_auth'); ?> (REMOTE_USER = '<?php echo httpAuthUser(); ?>')</option>
+ <option value="none"<?php echo Minz_Configuration::authType() === 'none' ? ' selected="selected"' : ''; ?>><?php echo Minz_Translate::t('auth_none'); ?></option>
+ </select>
+ </div>
+ </div>
+
+ <div class="form-group">
+ <div class="group-controls">
+ <label class="checkbox" for="anon_access">
+ <input type="checkbox" name="anon_access" id="anon_access" value="1"<?php echo Minz_Configuration::allowAnonymous() ? ' checked="checked"' : '',
+ Minz_Configuration::canLogIn() ? '' : ' disabled="disabled"'; ?> />
+ <?php echo Minz_Translate::t('allow_anonymous', Minz_Configuration::defaultUser()); ?>
+ </label>
+ </div>
+ </div>
+
+ <?php if (Minz_Configuration::canLogIn()) { ?>
+ <div class="form-group">
+ <label class="group-name" for="token"><?php echo Minz_Translate::t('auth_token'); ?></label>
+ <?php $token = $this->conf->token; ?>
+ <div class="group-controls">
+ <input type="text" id="token" name="token" value="<?php echo $token; ?>" placeholder="<?php echo Minz_Translate::t('blank_to_disable'); ?>"<?php
+ echo Minz_Configuration::canLogIn() ? '' : ' disabled="disabled"'; ?> />
+ <?php echo FreshRSS_Themes::icon('help'); ?> <?php echo Minz_Translate::t('explain_token', Minz_Url::display(null, 'html', true), $token); ?>
+ </div>
+ </div>
+ <?php } ?>
+
+ <div class="form-group form-actions">
+ <div class="group-controls">
+ <button type="submit" class="btn btn-important"><?php echo Minz_Translate::t('save'); ?></button>
+ <button type="reset" class="btn"><?php echo Minz_Translate::t('cancel'); ?></button>
+ </div>
+ </div>
+ </form>
+
+ <form method="post" action="<?php echo _url('users', 'delete'); ?>">
+ <legend><?php echo Minz_Translate::t('users'); ?></legend>
+
+ <div class="form-group">
+ <label class="group-name" for="users_list"><?php echo Minz_Translate::t('users_list'); ?></label>
+ <div class="group-controls">
+ <select id="users_list" name="username"><?php
+ foreach (listUsers() as $user) {
+ echo '<option>', $user, '</option>';
+ }
+ ?></select>
+ </div>
+ </div>
+
+ <div class="form-group form-actions">
+ <div class="group-controls">
+ <button type="submit" class="btn btn-attention confirm"><?php echo Minz_Translate::t('delete'); ?></button>
+ </div>
+ </div>
+ </form>
+
+ <form method="post" action="<?php echo _url('users', 'create'); ?>">
+ <legend><?php echo Minz_Translate::t('create_user'); ?></legend>
+
+ <div class="form-group">
+ <label class="group-name" for="new_user_language"><?php echo Minz_Translate::t ('language'); ?></label>
+ <div class="group-controls">
+ <select name="new_user_language" id="new_user_language">
+ <?php $languages = $this->conf->availableLanguages (); ?>
+ <?php foreach ($languages as $short => $lib) { ?>
+ <option value="<?php echo $short; ?>"<?php echo $this->conf->language === $short ? ' selected="selected"' : ''; ?>><?php echo $lib; ?></option>
+ <?php } ?>
+ </select>
+ </div>
+ </div>
+
+ <div class="form-group">
+ <label class="group-name" for="new_user_name"><?php echo Minz_Translate::t('username'); ?></label>
+ <div class="group-controls">
+ <input id="new_user_name" name="new_user_name" type="text" size="16" required="required" maxlength="16" pattern="[0-9a-zA-Z]{1,16}" placeholder="demo" />
+ </div>
+ </div>
+
+ <div class="form-group">
+ <label class="group-name" for="new_user_passwordPlain"><?php echo Minz_Translate::t('password_form'); ?></label>
+ <div class="group-controls">
+ <input type="password" id="new_user_passwordPlain" name="new_user_passwordPlain" pattern=".{7,}" />
+ <noscript><b><?php echo Minz_Translate::t('javascript_should_be_activated'); ?></b></noscript>
+ </div>
+ </div>
+
+ <div class="form-group">
+ <label class="group-name" for="new_user_email"><?php echo Minz_Translate::t('persona_connection_email'); ?></label>
+ <?php $mail = $this->conf->mail_login; ?>
+ <div class="group-controls">
+ <input type="email" id="new_user_email" name="new_user_email" class="extend" placeholder="alice@example.net" />
+ </div>
+ </div>
+
+ <div class="form-group form-actions">
+ <div class="group-controls">
+ <button type="submit" class="btn btn-important"><?php echo Minz_Translate::t('create'); ?></button>
+ <button type="reset" class="btn"><?php echo Minz_Translate::t('cancel'); ?></button>
+ </div>
+ </div>
+
+ </form>
+
+ <?php } ?>
+</div>
diff --git a/app/views/entry/bookmark.phtml b/app/views/entry/bookmark.phtml
index 1ff1c220c..c1fc32b7f 100755
--- a/app/views/entry/bookmark.phtml
+++ b/app/views/entry/bookmark.phtml
@@ -1,15 +1,16 @@
<?php
+header('Content-Type: application/json; charset=UTF-8');
-if (Request::param ('is_favorite')) {
- Request::_param ('is_favorite', 0);
+if (Minz_Request::param ('is_favorite', true)) {
+ Minz_Request::_param ('is_favorite', 0);
} else {
- Request::_param ('is_favorite', 1);
+ Minz_Request::_param ('is_favorite', 1);
}
-$url = Url::display (array (
- 'c' => Request::controllerName (),
- 'a' => Request::actionName (),
- 'params' => Request::params (),
+$url = Minz_Url::display (array (
+ 'c' => Minz_Request::controllerName (),
+ 'a' => Minz_Request::actionName (),
+ 'params' => Minz_Request::params (),
));
-echo json_encode (array ('url' => str_ireplace ('&amp;', '&', $url)));
+echo json_encode (array ('url' => str_ireplace ('&amp;', '&', $url), 'icon' => FreshRSS_Themes::icon(Minz_Request::param ('is_favorite') ? 'non-starred' : 'starred')));
diff --git a/app/views/entry/read.phtml b/app/views/entry/read.phtml
index 6d3313a89..9e79d4c07 100755
--- a/app/views/entry/read.phtml
+++ b/app/views/entry/read.phtml
@@ -1,15 +1,16 @@
<?php
+header('Content-Type: application/json; charset=UTF-8');
-if (Request::param ('is_read')) {
- Request::_param ('is_read', 0);
+if (Minz_Request::param ('is_read', true)) {
+ Minz_Request::_param ('is_read', 0);
} else {
- Request::_param ('is_read', 1);
+ Minz_Request::_param ('is_read', 1);
}
-$url = Url::display (array (
- 'c' => Request::controllerName (),
- 'a' => Request::actionName (),
- 'params' => Request::params (),
+$url = Minz_Url::display (array (
+ 'c' => Minz_Request::controllerName (),
+ 'a' => Minz_Request::actionName (),
+ 'params' => Minz_Request::params (),
));
-echo json_encode (array ('url' => str_ireplace ('&amp;', '&', $url)));
+echo json_encode (array ('url' => str_ireplace ('&amp;', '&', $url), 'icon' => FreshRSS_Themes::icon(Minz_Request::param ('is_read') ? 'unread' : 'read')));
diff --git a/app/views/error/index.phtml b/app/views/error/index.phtml
index d5d090c72..36fcb56f9 100644
--- a/app/views/error/index.phtml
+++ b/app/views/error/index.phtml
@@ -3,8 +3,8 @@
<h1 class="alert-head"><?php echo $this->code; ?></h1>
<p>
- <?php echo Translate::t ('page_not_found'); ?><br />
- <a href="<?php echo _url ('index', 'index'); ?>"><?php echo Translate::t ('back_to_rss_feeds'); ?></a>
+ <?php echo Minz_Translate::t ('page_not_found'); ?><br />
+ <a href="<?php echo _url ('index', 'index'); ?>"><?php echo Minz_Translate::t ('back_to_rss_feeds'); ?></a>
</p>
</div>
</div>
diff --git a/app/views/feed/actualize.phtml b/app/views/feed/actualize.phtml
index a0aba9318..d86bac9de 100644
--- a/app/views/feed/actualize.phtml
+++ b/app/views/feed/actualize.phtml
@@ -1 +1 @@
-OK \ No newline at end of file
+OK
diff --git a/app/views/helpers/javascript_vars.phtml b/app/views/helpers/javascript_vars.phtml
index 58cb3c5ac..0ecdc1bca 100644
--- a/app/views/helpers/javascript_vars.phtml
+++ b/app/views/helpers/javascript_vars.phtml
@@ -1,39 +1,44 @@
<?php
- echo '"use strict";', "\n";
- $mark = $this->conf->markWhen ();
- echo 'var ',
- 'hide_posts=', ($this->conf->displayPosts () === 'yes' || Request::param ('output') === 'reader') ? 'false' : 'true',
- ',auto_mark_article=', $mark['article'] === 'yes' ? 'true' : 'false',
- ',auto_mark_site=', $mark['site'] === 'yes' ? 'true' : 'false',
- ',auto_mark_scroll=', $mark['scroll'] === 'yes' ? 'true' : 'false',
- ',auto_load_more=', $this->conf->autoLoadMore () === 'yes' ? 'true' : 'false',
- ',full_lazyload=', $this->conf->lazyload () === 'yes' && ($this->conf->displayPosts () === 'yes' || Request::param ('output') === 'reader') ? 'true' : 'false',
- ',does_lazyload=', $this->conf->lazyload() === 'yes' ? 'true' : 'false';
-
- $s = $this->conf->shortcuts ();
- echo ',shortcuts={',
- 'mark_read:"', $s['mark_read'], '",',
- 'mark_favorite:"', $s['mark_favorite'], '",',
- 'go_website:"', $s['go_website'], '",',
- 'prev_entry:"', $s['prev_entry'], '",',
- 'next_entry:"', $s['next_entry'], '"',
- "},\n";
-
- $mail = Session::param ('mail', 'null');
- if ($mail != 'null') {
- $mail = '"' . $mail . '"';
- }
- echo 'use_persona=', login_is_conf ($this->conf) ? 'true' : 'false',
- ',url_freshrss="', _url ('index', 'index'), '",',
- 'url_login="', _url ('index', 'login'), '",',
- 'url_logout="', _url ('index', 'logout'), '",',
- 'current_user_mail=', $mail, ",\n";
-
- echo 'load_shortcuts=', Request::controllerName () === 'index' && Request::actionName () === 'index' ? 'true' : 'false', ",\n";
-
- echo 'str_confirmation="', Translate::t('confirm_action'), '"', ",\n";
-
- echo 'auto_actualize_feeds=', Session::param('actualize_feeds', false) ? 'true' : 'false', ";\n";
- if (Session::param('actualize_feeds', false)) {
- Session::_param('actualize_feeds');
- }
+
+echo '"use strict";', "\n";
+
+$mark = $this->conf->mark_when;
+echo 'var ',
+ 'hide_posts=', ($this->conf->display_posts || Minz_Request::param('output') === 'reader') ? 'false' : 'true',
+ ',auto_mark_article=', $mark['article'] ? 'true' : 'false',
+ ',auto_mark_site=', $mark['site'] ? 'true' : 'false',
+ ',auto_mark_scroll=', $mark['scroll'] ? 'true' : 'false',
+ ',auto_load_more=', $this->conf->auto_load_more ? 'true' : 'false',
+ ',full_lazyload=', $this->conf->lazyload && ($this->conf->display_posts || Minz_Request::param('output') === 'reader') ? 'true' : 'false',
+ ',does_lazyload=', $this->conf->lazyload ? 'true' : 'false';
+
+$s = $this->conf->shortcuts;
+echo ',shortcuts={',
+ 'mark_read:"', $s['mark_read'], '",',
+ 'mark_favorite:"', $s['mark_favorite'], '",',
+ 'go_website:"', $s['go_website'], '",',
+ 'prev_entry:"', $s['prev_entry'], '",',
+ 'next_entry:"', $s['next_entry'], '",',
+ 'collapse_entry:"', $s['collapse_entry'], '",',
+ 'load_more:"', $s['load_more'], '",',
+ 'auto_share:"', $s['auto_share'], '"',
+"},\n";
+
+if (Minz_Request::param ('output') === 'global') {
+ echo "iconClose='", FreshRSS_Themes::icon('close'), "',\n";
+}
+
+$authType = Minz_Configuration::authType();
+if ($authType === 'persona') {
+ echo 'current_user_mail="' . Minz_Session::param ('mail', '') . '",';
+}
+
+echo 'authType="', $authType, '",',
+ 'url_freshrss="', _url ('index', 'index'), '",',
+ 'url_login="', _url ('index', 'login'), '",',
+ 'url_logout="', _url ('index', 'logout'), '",';
+
+echo 'str_confirmation="', Minz_Translate::t('confirm_action'), '"', ",\n";
+
+$autoActualise = Minz_Session::param('actualize_feeds', false);
+echo 'auto_actualize_feeds=', $autoActualise ? 'true' : 'false', ";\n";
diff --git a/app/views/helpers/logs_pagination.phtml b/app/views/helpers/logs_pagination.phtml
index 9f1d6cb23..e3d14810e 100755
--- a/app/views/helpers/logs_pagination.phtml
+++ b/app/views/helpers/logs_pagination.phtml
@@ -1,7 +1,7 @@
<?php
- $c = Request::controllerName ();
- $a = Request::actionName ();
- $params = Request::params ();
+ $c = Minz_Request::controllerName ();
+ $a = Minz_Request::actionName ();
+ $params = Minz_Request::params ();
?>
<?php if ($this->nbPage > 1) { ?>
@@ -9,14 +9,14 @@
<?php $params[$getteur] = 1; ?>
<li class="item pager-first">
<?php if ($this->currentPage > 1) { ?>
- <a href="<?php echo Url::display (array ('c' => $c, 'a' => $a, 'params' => $params)); ?>">« <?php echo Translate::t('first'); ?></a>
+ <a href="<?php echo Minz_Url::display (array ('c' => $c, 'a' => $a, 'params' => $params)); ?>">« <?php echo Minz_Translate::t('first'); ?></a>
<?php } ?>
</li>
<?php $params[$getteur] = $this->currentPage - 1; ?>
<li class="item pager-previous">
<?php if ($this->currentPage > 1) { ?>
- <a href="<?php echo Url::display (array ('c' => $c, 'a' => $a, 'params' => $params)); ?>">‹ <?php echo Translate::t('previous'); ?></a>
+ <a href="<?php echo Minz_Url::display (array ('c' => $c, 'a' => $a, 'params' => $params)); ?>">‹ <?php echo Minz_Translate::t('previous'); ?></a>
<?php } ?>
</li>
@@ -24,7 +24,7 @@
<?php if($i > 0 && $i <= $this->nbPage) { ?>
<?php if ($i != $this->currentPage) { ?>
<?php $params[$getteur] = $i; ?>
- <li class="item pager-item"><a href="<?php echo Url::display (array ('c' => $c, 'a' => $a, 'params' => $params)); ?>"><?php echo $i; ?></a></li>
+ <li class="item pager-item"><a href="<?php echo Minz_Url::display (array ('c' => $c, 'a' => $a, 'params' => $params)); ?>"><?php echo $i; ?></a></li>
<?php } else { ?>
<li class="item pager-current"><?php echo $i; ?></li>
<?php } ?>
@@ -34,13 +34,13 @@
<?php $params[$getteur] = $this->currentPage + 1; ?>
<li class="item pager-next">
<?php if ($this->currentPage < $this->nbPage) { ?>
- <a href="<?php echo Url::display (array ('c' => $c, 'a' => $a, 'params' => $params)); ?>"><?php echo Translate::t('next'); ?> ›</a>
+ <a href="<?php echo Minz_Url::display (array ('c' => $c, 'a' => $a, 'params' => $params)); ?>"><?php echo Minz_Translate::t('next'); ?> ›</a>
<?php } ?>
</li>
<?php $params[$getteur] = $this->nbPage; ?>
<li class="item pager-last">
<?php if ($this->currentPage < $this->nbPage) { ?>
- <a href="<?php echo Url::display (array ('c' => $c, 'a' => $a, 'params' => $params)); ?>"><?php echo Translate::t('last'); ?> »</a>
+ <a href="<?php echo Minz_Url::display (array ('c' => $c, 'a' => $a, 'params' => $params)); ?>"><?php echo Minz_Translate::t('last'); ?> »</a>
<?php } ?>
</li>
</ul>
diff --git a/app/views/helpers/pagination.phtml b/app/views/helpers/pagination.phtml
index 0018a951e..d4983a32e 100755
--- a/app/views/helpers/pagination.phtml
+++ b/app/views/helpers/pagination.phtml
@@ -1,20 +1,26 @@
<?php
- $c = Request::controllerName ();
- $a = Request::actionName ();
- $params = Request::params ();
+ $c = Minz_Request::controllerName ();
+ $a = Minz_Request::actionName ();
+ $params = Minz_Request::params ();
+ $markReadUrl = Minz_Session::param ('markReadUrl');
+ Minz_Session::_param ('markReadUrl', false);
?>
<ul class="pagination">
<li class="item pager-next">
- <?php if ($this->next != '') { ?>
- <?php $params[$getteur] = $this->next; ?>
- <a id="load_more" href="<?php echo Url::display (array ('c' => $c, 'a' => $a, 'params' => $params)); ?>"><?php echo Translate::t ('load_more'); ?></a>
+ <?php if (!empty($this->nextId)) { ?>
+ <?php $params['next'] = $this->nextId; ?>
+ <a id="load_more" href="<?php echo Minz_Url::display (array ('c' => $c, 'a' => $a, 'params' => $params)); ?>"><?php echo Minz_Translate::t ('load_more'); ?></a>
+ <?php } elseif ($markReadUrl) { ?>
+ <a id="bigMarkAsRead" href="<?php echo $markReadUrl; ?>">
+ <?php echo Minz_Translate::t ('nothing_to_load'); ?><br />
+ <span class="bigTick">✔</span><br />
+ <?php echo Minz_Translate::t ('mark_all_read'); ?>
+ </a>
<?php } else { ?>
- <div class="bigMarkAsRead">
- <p><?php echo Translate::t ('nothing_to_load'); ?></p>
- <p class="bigTick">✔</p>
- <p><?php echo Translate::t ('mark_all_read'); ?></p>
- </div>
+ <a id="bigMarkAsRead" href=".">
+ <?php echo Minz_Translate::t ('nothing_to_load'); ?><br />
+ </a>
<?php } ?>
</li>
</ul>
diff --git a/app/views/helpers/view/global_view.phtml b/app/views/helpers/view/global_view.phtml
index ae3bae9bc..db937eeae 100644
--- a/app/views/helpers/view/global_view.phtml
+++ b/app/views/helpers/view/global_view.phtml
@@ -2,25 +2,32 @@
<div id="stream" class="global categories">
<?php
+ $arUrl = array('c' => 'index', 'a' => 'index', 'params' => array());
+ if ($this->conf->view_mode !== 'normal') {
+ $arUrl['params']['output'] = 'normal';
+ }
+ $p = Minz_Request::param('state', '');
+ if (($p != '') && ($this->conf->default_view !== $p)) {
+ $arUrl['params']['state'] = $p;
+ }
+
foreach ($this->cat_aside as $cat) {
$feeds = $cat->feeds ();
if (!empty ($feeds)) {
?>
<div class="box-category">
<div class="category">
- <a data-unread="<?php echo $cat->nbNotRead (); ?>" class="btn" href="<?php echo _url ('index', 'index', 'get', 'c_' . $cat->id (), 'output', 'normal'); ?>">
- <?php echo htmlspecialchars($cat->name(), ENT_NOQUOTES, 'UTF-8'); ?>
+ <a data-unread="<?php echo formatNumber($cat->nbNotRead()); ?>" class="btn" href="<?php $arUrl['params']['get'] = 'c_' . $cat->id (); echo Minz_Url::display($arUrl); ?>">
+ <?php echo $cat->name(); ?>
</a>
</div>
-
<ul class="feeds">
<?php foreach ($feeds as $feed) { ?>
<?php $not_read = $feed->nbNotRead (); ?>
<li id="f_<?php echo $feed->id (); ?>" class="item<?php echo $feed->inError () ? ' error' : ''; ?><?php echo $feed->nbEntries () == 0 ? ' empty' : ''; ?>">
<img class="favicon" src="<?php echo $feed->favicon (); ?>" alt="✇" />
-
- <a class="feed" data-unread="<?php echo $feed->nbNotRead (); ?>" data-priority="<?php echo $feed->priority (); ?>" href="<?php echo _url ('index', 'index', 'get', 'f_' . $feed->id (), 'output', 'normal'); ?>">
- <?php echo htmlspecialchars($feed->name(), ENT_NOQUOTES, 'UTF-8'); ?>
+ <a class="feed" data-unread="<?php echo formatNumber($feed->nbNotRead()); ?>" data-priority="<?php echo $feed->priority (); ?>" href="<?php $arUrl['params']['get'] = 'f_' . $feed->id(); echo Minz_Url::display($arUrl); ?>">
+ <?php echo $feed->name(); ?>
</a>
</li>
<?php } ?>
@@ -33,6 +40,6 @@
</div>
<div id="overlay"></div>
-<div id="panel"<?php echo $this->conf->displayPosts () === 'no' ? ' class="hide_posts"' : ''; ?>>
- <a class="close" href="#"><i class="icon i_close"></i></a>
-</div> \ No newline at end of file
+<div id="panel"<?php echo $this->conf->display_posts ? '' : ' class="hide_posts"'; ?>>
+ <a class="close" href="#"><?php echo FreshRSS_Themes::icon('close'); ?></a>
+</div>
diff --git a/app/views/helpers/view/normal_view.phtml b/app/views/helpers/view/normal_view.phtml
index ad6154163..7b7faccee 100644
--- a/app/views/helpers/view/normal_view.phtml
+++ b/app/views/helpers/view/normal_view.phtml
@@ -3,53 +3,98 @@
$this->partial ('aside_flux');
$this->partial ('nav_menu');
-if (isset ($this->entryPaginator) && !$this->entryPaginator->isEmpty ()) {
- $items = $this->entryPaginator->items ();
+if (!empty($this->entries)) {
+ $display_today = true;
+ $display_yesterday = true;
+ $display_others = true;
+ if ($this->loginOk) {
+ $shaarli = $this->conf->sharing ('shaarli');
+ $wallabag = $this->conf->sharing ('wallabag');
+ $diaspora = $this->conf->sharing ('diaspora');
+ } else {
+ $shaarli = '';
+ $wallabag = '';
+ $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');
+ $hidePosts = !$this->conf->display_posts;
+ $lazyload = $this->conf->lazyload;
+ $topline_read = $this->conf->topline_read;
+ $topline_favorite = $this->conf->topline_favorite;
+ $topline_date = $this->conf->topline_date;
+ $topline_link = $this->conf->topline_link;
+ $bottomline_read = $this->conf->bottomline_read;
+ $bottomline_favorite = $this->conf->bottomline_favorite;
+ $bottomline_sharing = $this->conf->bottomline_sharing && (
+ $shaarli || $wallabag || $diaspora || $twitter ||
+ $google_plus || $facebook || $email || $print);
+ $bottomline_tags = $this->conf->bottomline_tags;
+ $bottomline_date = $this->conf->bottomline_date;
+ $bottomline_link = $this->conf->bottomline_link;
?>
-<div id="stream" class="normal<?php echo $this->conf->displayPosts () === 'no' ? ' hide_posts' : ''; ?>">
- <?php
- $display_today = true;
- $display_yesterday = true;
- $display_others = true;
- ?>
- <?php foreach ($items as $item) { ?>
-
- <?php if ($display_today && $item->isDay (Days::TODAY)) { ?>
- <div class="day" id="day_today">
- <?php echo Translate::t ('today'); ?>
- <span class="date"> - <?php echo timestamptodate (time (), false); ?></span>
- <span class="name"><?php echo $this->currentName; ?></span>
- </div>
- <?php $display_today = false; } ?>
- <?php if ($display_yesterday && $item->isDay (Days::YESTERDAY)) { ?>
- <div class="day" id="day_yesterday">
- <?php echo Translate::t ('yesterday'); ?>
- <span class="date"> - <?php echo timestamptodate (time () - 86400, false); ?></span>
- <span class="name"><?php echo $this->currentName; ?></span>
- </div>
- <?php $display_yesterday = false; } ?>
- <?php if ($display_others && $item->isDay (Days::BEFORE_YESTERDAY)) { ?>
- <div class="day" id="day_before_yesterday">
- <?php echo Translate::t ('before_yesterday'); ?>
- <span class="name"><?php echo $this->currentName; ?></span>
- </div>
- <?php $display_others = false; } ?>
-
- <div class="flux<?php echo !$item->isRead () ? ' not_read' : ''; ?><?php echo $item->isFavorite () ? ' favorite' : ''; ?>" id="flux_<?php echo $item->id (); ?>">
- <ul class="horizontal-list flux_header">
- <?php if (!login_is_conf ($this->conf) || is_logged ()) { ?>
- <?php if ($this->conf->toplineRead ()) { ?><li class="item manage"><a class="read" href="<?php echo _url ('entry', 'read', 'id', $item->id (), 'is_read', $item->isRead () ? 0 : 1); ?>">&nbsp;</a></li><?php } ?>
- <?php if ($this->conf->toplineFavorite ()) { ?><li class="item manage"><a class="bookmark" href="<?php echo _url ('entry', 'bookmark', 'id', $item->id (), 'is_favorite', $item->isFavorite () ? 0 : 1); ?>">&nbsp;</a></li><?php } ?>
- <?php
+<div id="stream" class="normal<?php echo $hidePosts ? ' hide_posts' : ''; ?>"><?php
+ ?><div id="new-article">
+ <a href="<?php echo _url('index', 'index'); ?>"><?php echo Minz_Translate::t ('new_article'); ?></a>
+ </div><?php
+ foreach ($this->entries as $item) {
+ if ($display_today && $item->isDay (FreshRSS_Days::TODAY, $this->today)) {
+ ?><div class="day" id="day_today"><?php
+ echo Minz_Translate::t ('today');
+ ?><span class="date"> — <?php echo timestamptodate (time (), false); ?></span><?php
+ ?><span class="name"><?php echo $this->currentName; ?></span><?php
+ ?></div><?php
+ $display_today = false;
+ }
+ if ($display_yesterday && $item->isDay (FreshRSS_Days::YESTERDAY, $this->today)) {
+ ?><div class="day" id="day_yesterday"><?php
+ echo Minz_Translate::t ('yesterday');
+ ?><span class="date"> — <?php echo timestamptodate (time () - 86400, false); ?></span><?php
+ ?><span class="name"><?php echo $this->currentName; ?></span><?php
+ ?></div><?php
+ $display_yesterday = false;
+ }
+ if ($display_others && $item->isDay (FreshRSS_Days::BEFORE_YESTERDAY, $this->today)) {
+ ?><div class="day" id="day_before_yesterday"><?php
+ echo Minz_Translate::t ('before_yesterday');
+ ?><span class="name"><?php echo $this->currentName; ?></span><?php
+ ?></div><?php
+ $display_others = false;
+ }
+ ?><div class="flux<?php echo !$item->isRead () ? ' not_read' : ''; ?><?php echo $item->isFavorite () ? ' favorite' : ''; ?>" id="flux_<?php echo $item->id (); ?>">
+ <ul class="horizontal-list flux_header"><?php
+ if ($this->loginOk) {
+ if ($topline_read) {
+ ?><li class="item manage"><?php
+ $arUrl = array('c' => 'entry', 'a' => 'read', 'params' => array('id' => $item->id ()));
+ if ($item->isRead()) {
+ $arUrl['params']['is_read'] = 0;
+ }
+ ?><a class="read" href="<?php echo Minz_Url::display($arUrl); ?>"><?php
+ echo FreshRSS_Themes::icon($item->isRead () ? 'read' : 'unread'); ?></a><?php
+ ?></li><?php
+ }
+ if ($topline_favorite) {
+ ?><li class="item manage"><?php
+ $arUrl = array('c' => 'entry', 'a' => 'bookmark', 'params' => array('id' => $item->id ()));
+ if ($item->isFavorite()) {
+ $arUrl['params']['is_favorite'] = 0;
+ }
+ ?><a class="bookmark" href="<?php echo Minz_Url::display($arUrl); ?>"><?php
+ echo FreshRSS_Themes::icon($item->isFavorite () ? 'starred' : 'non-starred'); ?></a><?php
+ ?></li><?php
}
- $feed = HelperCategory::findFeed($this->cat_aside, $item->feed ()); //We most likely already have the feed object in cache
- if (empty($feed)) $feed = $item->feed (true);
- ?>
- <li class="item website"><a href="<?php echo _url ('index', 'index', 'get', 'f_' . $feed->id ()); ?>"><img class="favicon" src="<?php echo $feed->favicon (); ?>" alt="✇" /> <span><?php echo htmlspecialchars($feed->name(), ENT_NOQUOTES, 'UTF-8'); ?></span></a></li>
+ }
+ $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);
+ ?><li class="item website"><a href="<?php echo _url ('index', 'index', 'get', 'f_' . $feed->id ()); ?>"><img class="favicon" src="<?php echo $feed->favicon (); ?>" alt="✇" /> <span><?php echo $feed->name(); ?></span></a></li>
<li class="item title"><a target="_blank" href="<?php echo $item->link (); ?>"><?php echo $item->title (); ?></a></li>
- <?php if ($this->conf->toplineDate ()) { ?><li class="item date"><?php echo $item->date (); ?>&nbsp;</li><?php } ?>
- <?php if ($this->conf->toplineLink ()) { ?><li class="item link"><a target="_blank" href="<?php echo $item->link (); ?>">&nbsp;</a></li><?php } ?>
+ <?php if ($topline_date) { ?><li class="item date"><?php echo $item->date (); ?> </li><?php } ?>
+ <?php if ($topline_link) { ?><li class="item link"><a target="_blank" href="<?php echo $item->link (); ?>"><?php echo FreshRSS_Themes::icon('link'); ?></a></li><?php } ?>
</ul>
<div class="flux_content">
@@ -57,96 +102,139 @@ if (isset ($this->entryPaginator) && !$this->entryPaginator->isEmpty ()) {
<h1 class="title"><?php echo $item->title (); ?></h1>
<?php
$author = $item->author ();
- echo $author != '' ? '<div class="author">' . Translate::t ('by_author', $author) . '</div>' : '';
- if($this->conf->lazyload() == 'yes') {
- echo lazyimg($item->content ());
+ echo $author != '' ? '<div class="author">' . Minz_Translate::t ('by_author', $author) . '</div>' : '';
+ if ($lazyload) {
+ echo $hidePosts ? lazyIframe(lazyimg($item->content())) : lazyimg($item->content());
} else {
echo $item->content();
}
?>
</div>
-
- <ul class="horizontal-list bottom">
- <?php if (!login_is_conf ($this->conf) || is_logged ()) { ?>
- <?php if ($this->conf->bottomlineRead ()) { ?><li class="item manage"><a class="read" href="<?php echo _url ('entry', 'read', 'id', $item->id (), 'is_read', $item->isRead () ? 0 : 1); ?>">&nbsp;</a></li><?php } ?>
- <?php if ($this->conf->bottomlineFavorite ()) { ?><li class="item manage"><a class="bookmark" href="<?php echo _url ('entry', 'bookmark', 'id', $item->id (), 'is_favorite', $item->isFavorite () ? 0 : 1); ?>">&nbsp;</a></li><?php } ?>
- <?php } ?>
- <li class="item">
- <?php
- if ($this->conf->bottomlineSharing ()) {
+ <ul class="horizontal-list bottom"><?php
+ if ($this->loginOk) {
+ if ($bottomline_read) {
+ ?><li class="item manage"><?php
+ $arUrl = array('c' => 'entry', 'a' => 'read', 'params' => array('id' => $item->id ()));
+ if ($item->isRead()) {
+ $arUrl['params']['is_read'] = 0;
+ }
+ ?><a class="read" href="<?php echo Minz_Url::display($arUrl); ?>"><?php
+ echo FreshRSS_Themes::icon($item->isRead () ? 'read' : 'unread'); ?></a><?php
+ ?></li><?php
+ }
+ if ($bottomline_favorite) {
+ ?><li class="item manage"><?php
+ $arUrl = array('c' => 'entry', 'a' => 'bookmark', 'params' => array('id' => $item->id ()));
+ if ($item->isFavorite()) {
+ $arUrl['params']['is_favorite'] = 0;
+ }
+ ?><a class="bookmark" href="<?php echo Minz_Url::display($arUrl); ?>"><?php
+ echo FreshRSS_Themes::icon($item->isFavorite () ? 'starred' : 'non-starred'); ?></a><?php
+ ?></li><?php
+ }
+ } ?>
+ <li class="item"><?php
+ if ($bottomline_sharing) {
$link = urlencode ($item->link ());
- $title = urlencode ($item->title () . ' - ' . $feed->name ());
- ?>
- <div class="dropdown">
+ $title = urlencode ($item->title () . ' · ' . $feed->name ());
+ ?><div class="dropdown">
<div id="dropdown-share-<?php echo $item->id ();?>" class="dropdown-target"></div>
- <i class="icon i_share"></i> <a class="dropdown-toggle" href="#dropdown-share-<?php echo $item->id ();?>"><?php echo Translate::t ('share'); ?></a>
+ <a class="dropdown-toggle" href="#dropdown-share-<?php echo $item->id ();?>">
+ <?php echo FreshRSS_Themes::icon('share'); ?>
+ <?php echo Minz_Translate::t ('share'); ?>
+ </a>
<ul class="dropdown-menu">
- <li class="dropdown-close"><a href="#close">&nbsp;</a></li>
- <?php
- $shaarli = $this->conf->urlShaarli ();
- if ((!login_is_conf ($this->conf) || is_logged ()) && $shaarli) {
- ?>
+ <li class="dropdown-close"><a href="#close">❌</a></li>
+ <?php if ($shaarli) { ?>
<li class="item">
- <a target="_blank" href="<?php echo $shaarli . '?post=' . $link . '&amp;title=' . $title . '&amp;source=bookmarklet'; ?>">
- Shaarli
+ <a target="_blank" href="<?php echo $shaarli . '?post=' . $link . '&amp;title=' . $title . '&amp;source=FreshRSS'; ?>">
+ <?php echo Minz_Translate::t ('shaarli'); ?>
</a>
</li>
- <?php } ?>
+ <?php } if ($wallabag) { ?>
<li class="item">
- <a href="mailto:?subject=<?php echo urldecode($title); ?>&amp;body=<?php echo $link; ?>">
- <?php echo Translate::t ('by_email'); ?>
+ <a target="_blank" href="<?php echo $wallabag . '?action=add&amp;url=' . base64_encode (urldecode($link)); ?>">
+ <?php echo Minz_Translate::t ('wallabag'); ?>
</a>
</li>
+ <?php } if ($diaspora) { ?>
+ <li class="item">
+ <a target="_blank" href="<?php echo $diaspora . '/bookmarklet?url=' . $link . '&amp;title=' . $title; ?>">
+ <?php echo Minz_Translate::t ('diaspora'); ?>
+ </a>
+ </li>
+ <?php } if ($twitter) { ?>
<li class="item">
<a target="_blank" href="https://twitter.com/share?url=<?php echo $link; ?>&amp;text=<?php echo $title; ?>">
- Twitter
+ <?php echo Minz_Translate::t ('twitter'); ?>
+ </a>
+ </li>
+ <?php } if ($google_plus) { ?>
+ <li class="item">
+ <a target="_blank" href="https://plus.google.com/share?url=<?php echo $link; ?>">
+ <?php echo Minz_Translate::t ('g+'); ?>
</a>
</li>
+ <?php } if ($facebook) { ?>
<li class="item">
<a target="_blank" href="https://www.facebook.com/sharer.php?u=<?php echo $link; ?>&amp;t=<?php echo $title; ?>">
- Facebook
+ <?php echo Minz_Translate::t ('facebook'); ?>
</a>
</li>
+ <?php } if ($email) { ?>
<li class="item">
- <a target="_blank" href="https://plus.google.com/share?url=<?php echo $link; ?>">
- Google+
+ <a href="mailto:?subject=<?php echo urldecode($title); ?>&amp;body=<?php echo $link; ?>">
+ <?php echo Minz_Translate::t ('by_email'); ?>
+ </a>
+ </li>
+ <?php } if ($print) { ?>
+ <li class="item">
+ <a href="#" class="print-article">
+ <?php echo Minz_Translate::t ('print'); ?>
</a>
</li>
+ <?php } ?>
</ul>
- </div><?php } ?>
- </li>
- <?php
- $tags = $this->conf->bottomlineTags () ? $item->tags() : null;
- if (!empty($tags)) {
- ?>
- <li class="item">
+ </div>
+ <?php } ?>
+ </li><?php
+ $tags = $bottomline_tags ? $item->tags() : null;
+ if (!empty($tags)) {
+ ?><li class="item">
<div class="dropdown">
<div id="dropdown-tags-<?php echo $item->id ();?>" class="dropdown-target"></div>
- <i class="icon i_tag"></i> <a class="dropdown-toggle" href="#dropdown-tags-<?php echo $item->id ();?>"><?php echo Translate::t ('related_tags'); ?></a>
+ <a class="dropdown-toggle" href="#dropdown-tags-<?php echo $item->id ();?>"><?php
+ echo FreshRSS_Themes::icon('tag'), Minz_Translate::t ('related_tags');
+ ?></a>
<ul class="dropdown-menu">
- <li class="dropdown-close"><a href="#close">&nbsp;</a></li>
- <?php foreach($tags as $tag) { ?>
- <li class="item"><a href="<?php echo _url ('index', 'index', 'search', urlencode ('#' . $tag)); ?>"><?php echo $tag; ?></a></li>
- <?php } ?>
+ <li class="dropdown-close"><a href="#close">❌</a></li><?php
+ foreach($tags as $tag) {
+ ?><li class="item"><a href="<?php echo _url ('index', 'index', 'search', urlencode ('#' . $tag)); ?>"><?php echo $tag; ?></a></li><?php
+ } ?>
</ul>
</div>
- </li>
- <?php } ?>
- <?php if ($this->conf->bottomlineDate ()) { ?><li class="item date"><?php echo $item->date (); ?>&nbsp;</li><?php } ?>
- <?php if ($this->conf->bottomlineLink ()) { ?><li class="item link"><a target="_blank" href="<?php echo $item->link (); ?>">&nbsp;</a></li><?php } ?>
+ </li><?php
+ }
+ if ($bottomline_date) {
+ ?><li class="item date"><?php echo $item->date (); ?></li><?php
+ }
+ if ($bottomline_link) {
+ ?><li class="item link"><a target="_blank" href="<?php echo $item->link (); ?>"><?php echo FreshRSS_Themes::icon('link'); ?></a></li><?php
+ } ?>
</ul>
</div>
</div>
<?php } ?>
- <?php $this->entryPaginator->render ('pagination.phtml', 'next'); ?>
+ <?php $this->renderHelper('pagination'); ?>
</div>
<?php $this->partial ('nav_entries'); ?>
<?php } else { ?>
<div id="stream" class="alert alert-warn normal">
- <span class="alert-head"><?php echo Translate::t ('no_feed_to_display'); ?></span>
+ <span class="alert-head"><?php echo Minz_Translate::t ('no_feed_to_display'); ?></span>
+ <?php echo Minz_Translate::t ('think_to_add'); ?>
</div>
-<?php } ?> \ No newline at end of file
+<?php } ?>
diff --git a/app/views/helpers/view/reader_view.phtml b/app/views/helpers/view/reader_view.phtml
index f808990f7..bda96e86d 100644
--- a/app/views/helpers/view/reader_view.phtml
+++ b/app/views/helpers/view/reader_view.phtml
@@ -1,33 +1,33 @@
<?php
$this->partial ('nav_menu');
-if (isset ($this->entryPaginator) && !$this->entryPaginator->isEmpty ()) {
- $items = $this->entryPaginator->items ();
+if (!empty($this->entries)) {
+ $lazyload = $this->conf->lazyload;
?>
<div id="stream" class="reader">
- <?php foreach ($items as $item) { ?>
+ <?php foreach ($this->entries as $item) { ?>
<div class="flux<?php echo !$item->isRead () ? ' not_read' : ''; ?><?php echo $item->isFavorite () ? ' favorite' : ''; ?>" id="flux_<?php echo $item->id (); ?>">
<div class="flux_content">
<div class="content">
<?php
- $feed = HelperCategory::findFeed($this->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);
?>
<a href="<?php echo $item->link (); ?>">
- <img class="favicon" src="<?php echo $feed->favicon (); ?>" alt="✇" /> <span><?php echo htmlspecialchars($feed->name(), ENT_NOQUOTES, 'UTF-8'); ?></span>
+ <img class="favicon" src="<?php echo $feed->favicon (); ?>" alt="✇" /> <span><?php echo $feed->name(); ?></span>
</a>
<h1 class="title"><?php echo $item->title (); ?></h1>
<div class="author">
<?php $author = $item->author (); ?>
- <?php echo $author != '' ? Translate::t ('by_author', $author) . ' - ' : ''; ?>
+ <?php echo $author != '' ? Minz_Translate::t ('by_author', $author) . ' — ' : ''; ?>
<?php echo $item->date (); ?>
</div>
<?php
- if($this->conf->lazyload() == 'yes') {
+ if ($lazyload) {
echo lazyimg($item->content ());
} else {
echo $item->content();
@@ -38,11 +38,12 @@ if (isset ($this->entryPaginator) && !$this->entryPaginator->isEmpty ()) {
</div>
<?php } ?>
- <?php $this->entryPaginator->render ('pagination.phtml', 'next'); ?>
+ <?php $this->renderHelper('pagination'); ?>
</div>
<?php } else { ?>
<div id="stream" class="alert alert-warn reader">
- <span class="alert-head"><?php echo Translate::t ('no_feed_to_display'); ?></span>
+ <span class="alert-head"><?php echo Minz_Translate::t ('no_feed_to_display'); ?></span>
+ <?php echo Minz_Translate::t ('think_to_add'); ?>
</div>
-<?php } ?> \ No newline at end of file
+<?php } ?>
diff --git a/app/views/helpers/view/rss_view.phtml b/app/views/helpers/view/rss_view.phtml
index 9358ef2a5..620bf1388 100755
--- a/app/views/helpers/view/rss_view.phtml
+++ b/app/views/helpers/view/rss_view.phtml
@@ -2,17 +2,16 @@
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
<channel>
<title><?php echo $this->rss_title; ?></title>
- <link><?php echo Url::display(null, 'html', true); ?></link>
- <description><?php echo Translate::t ('rss_feeds_of', $this->rss_title); ?></description>
+ <link><?php echo Minz_Url::display(null, 'html', true); ?></link>
+ <description><?php echo Minz_Translate::t ('rss_feeds_of', $this->rss_title); ?></description>
<pubDate><?php echo date('D, d M Y H:i:s O'); ?></pubDate>
<lastBuildDate><?php echo gmdate('D, d M Y H:i:s'); ?> GMT</lastBuildDate>
- <atom:link href="<?php echo Url::display ($this->rss_url, 'html', true); ?>" rel="self" type="application/rss+xml" />
+ <atom:link href="<?php echo Minz_Url::display ($this->rss_url, 'html', true); ?>" rel="self" type="application/rss+xml" />
<?php
-$items = $this->entryPaginator->items ();
-foreach ($items as $item) {
+foreach ($this->entries as $item) {
?>
<item>
- <title><?php echo htmlspecialchars(html_entity_decode($item->title (), ENT_NOQUOTES, 'UTF-8'), ENT_NOQUOTES, 'UTF-8'); ?></title>
+ <title><?php echo $item->title (); ?></title>
<link><?php echo $item->link (); ?></link>
<?php $author = $item->author (); ?>
<?php if ($author != '') { ?>
diff --git a/app/views/index/about.phtml b/app/views/index/about.phtml
index ca1254053..76ff804d8 100644
--- a/app/views/index/about.phtml
+++ b/app/views/index/about.phtml
@@ -1,24 +1,27 @@
<div class="post content">
- <a href="<?php echo _url ('index', 'index'); ?>"><?php echo Translate::t ('back_to_rss_feeds'); ?></a>
+ <a href="<?php echo _url ('index', 'index'); ?>"><?php echo Minz_Translate::t ('back_to_rss_feeds'); ?></a>
- <h1><?php echo Translate::t ('about_freshrss'); ?></h1>
+ <h1><?php echo Minz_Translate::t ('about_freshrss'); ?></h1>
<dl class="infos">
- <dt><?php echo Translate::t ('project_website'); ?></dt>
- <dd><a href="http://marienfressinaud.github.io/FreshRSS/">http://marienfressinaud.github.io/FreshRSS/</a></dd>
+ <dt><?php echo Minz_Translate::t ('project_website'); ?></dt>
+ <dd><a href="<?php echo FRESHRSS_WEBSITE; ?>"><?php echo FRESHRSS_WEBSITE; ?></a></dd>
- <dt><?php echo Translate::t ('lead_developer'); ?></dt>
- <dd><a href="mailto:contact@marienfressinaud.fr">Marien Fressinaud</a> - <a href="http://marienfressinaud.fr"><?php echo Translate::t ('website'); ?></a></dd>
+ <dt><?php echo Minz_Translate::t ('lead_developer'); ?></dt>
+ <dd><a href="mailto:contact@marienfressinaud.fr">Marien Fressinaud</a> — <a href="http://marienfressinaud.fr"><?php echo Minz_Translate::t ('website'); ?></a></dd>
- <dt><?php echo Translate::t ('bugs_reports'); ?></dt>
- <dd><?php echo Translate::t ('github_or_email'); ?></dd>
+ <dt><?php echo Minz_Translate::t ('bugs_reports'); ?></dt>
+ <dd><?php echo Minz_Translate::t ('github_or_email'); ?></dd>
- <dt><?php echo Translate::t ('license'); ?></dt>
- <dd><?php echo Translate::t ('agpl3'); ?></dd>
+ <dt><?php echo Minz_Translate::t ('license'); ?></dt>
+ <dd><?php echo Minz_Translate::t ('agpl3'); ?></dd>
+
+ <dt><?php echo Minz_Translate::t ('version'); ?></dt>
+ <dd><?php echo FRESHRSS_VERSION; ?></dd>
</dl>
- <p><?php echo Translate::t ('freshrss_description'); ?></p>
+ <p><?php echo Minz_Translate::t ('freshrss_description'); ?></p>
- <h1><?php echo Translate::t ('credits'); ?></h1>
- <p><?php echo Translate::t ('credits_content'); ?></p>
+ <h1><?php echo Minz_Translate::t ('credits'); ?></h1>
+ <p><?php echo Minz_Translate::t ('credits_content'); ?></p>
</div>
diff --git a/app/views/index/formLogin.phtml b/app/views/index/formLogin.phtml
new file mode 100644
index 000000000..e4560c1a0
--- /dev/null
+++ b/app/views/index/formLogin.phtml
@@ -0,0 +1,34 @@
+<div class="prompt">
+<?php
+if (Minz_Configuration::canLogIn()) {
+ ?><h1><?php echo Minz_Translate::t('login'); ?></h1><?php
+ switch (Minz_Configuration::authType()) {
+
+ case 'form':
+ ?><form id="loginForm" method="post" action="<?php echo _url('index', 'formLogin'); ?>">
+ <p>
+ <label for="username"><?php echo Minz_Translate::t('username'); ?></label>
+ <input type="text" id="username" name="username" size="16" required="required" maxlength="16" pattern="[0-9a-zA-Z]{1,16}" autofocus="autofocus" />
+ </p><p>
+ <label for="passwordPlain"><?php echo Minz_Translate::t('password'); ?></label>
+ <input type="password" id="passwordPlain" required="required" />
+ <input type="hidden" id="challenge" name="challenge" /><br />
+ <noscript><strong><?php echo Minz_Translate::t('javascript_should_be_activated'); ?></strong></noscript>
+ </p><p>
+ <button id="loginButton" type="submit" class="btn btn-important"><?php echo Minz_Translate::t('login'); ?></button>
+ </p>
+ </form><?php
+ break;
+
+ case 'persona':
+ ?><p><?php echo FreshRSS_Themes::icon('login'); ?> <a class="signin" href="#"><?php echo Minz_Translate::t('login'); ?></a></p><?php
+ break;
+ }
+} else {
+ ?><h1>FreshRSS</h1>
+ <p><?php echo Minz_Translate::t('forbidden_access', Minz_Configuration::authType()); ?></p><?php
+}
+?>
+
+<p><a href="<?php echo _url('index', 'about'); ?>"><?php echo Minz_Translate::t('about_freshrss'); ?></a></p>
+</div>
diff --git a/app/views/index/index.phtml b/app/views/index/index.phtml
index bd18d2d77..4545a33e4 100644
--- a/app/views/index/index.phtml
+++ b/app/views/index/index.phtml
@@ -1,29 +1,30 @@
<?php
-$output = Request::param ('output', 'normal');
-$token = $this->conf->token();
-$token_param = Request::param ('token', '');
-$token_is_ok = ($token != '' && $token == $token_param);
+$output = Minz_Request::param ('output', 'normal');
-if(!login_is_conf ($this->conf) ||
- is_logged() ||
- $this->conf->anonAccess() == 'yes' ||
- ($output == 'rss' && $token_is_ok)) {
- if($output == 'rss') {
+if ($this->loginOk || Minz_Configuration::allowAnonymous()) {
+ if ($output === 'normal') {
+ $this->renderHelper ('view/normal_view');
+ } elseif ($output === 'rss') {
$this->renderHelper ('view/rss_view');
- } elseif($output == 'reader') {
+ } elseif ($output === 'reader') {
$this->renderHelper ('view/reader_view');
- } elseif($output == 'global') {
+ } elseif ($output === 'global') {
$this->renderHelper ('view/global_view');
} else {
+ Minz_Request::_param ('output', 'normal');
+ $output = 'normal';
$this->renderHelper ('view/normal_view');
}
+} elseif ($output === 'rss') {
+ $token = $this->conf->token;
+ $token_param = Minz_Request::param ('token', '');
+ $token_is_ok = ($token != '' && $token == $token_param);
+ if ($token_is_ok) {
+ $this->renderHelper ('view/rss_view');
+ } else {
+ Minz_Request::forward(array('c' => 'index', 'a' => 'formLogin'), true);
+ }
} else {
-?>
-<div class="post content">
- <h1><?php echo Translate::t ('forbidden_access'); ?></h1>
- <p><?php echo Translate::t ('forbidden_access_description'); ?></p>
- <p><a href="<?php echo _url ('index', 'about'); ?>"><?php echo Translate::t ('about_freshrss'); ?></a></p>
-</div>
-<?php
-} \ No newline at end of file
+ Minz_Request::forward(array('c' => 'index', 'a' => 'formLogin'), true);
+}
diff --git a/app/views/index/logs.phtml b/app/views/index/logs.phtml
index 09f0c4ecd..1b77b39af 100644
--- a/app/views/index/logs.phtml
+++ b/app/views/index/logs.phtml
@@ -1,21 +1,25 @@
<div class="post content">
- <a href="<?php echo _url ('index', 'index'); ?>"><?php echo Translate::t ('back_to_rss_feeds'); ?></a>
+ <a href="<?php echo _url ('index', 'index'); ?>"><?php echo Minz_Translate::t ('back_to_rss_feeds'); ?></a>
- <h1><?php echo Translate::t ('logs'); ?></h1>
+ <h1><?php echo Minz_Translate::t ('logs'); ?></h1>
+ <form method="post" action="<?php echo _url ('index', 'logs'); ?>"><p>
+ <input type="hidden" name="clearLogs" />
+ <button type="submit" class="btn"><?php echo Minz_Translate::t ('clear_logs'); ?></button>
+ </p></form>
<?php $items = $this->logsPaginator->items (); ?>
<?php if (!empty ($items)) { ?>
<div class="logs">
<?php $this->logsPaginator->render ('logs_pagination.phtml', 'page'); ?>
-
+
<?php foreach ($items as $log) { ?>
- <div class="log <?php echo $log->level (); ?>"><span class="date"><?php echo date ('d/m/Y - H:i:s', strtotime ($log->date ())); ?></span><?php echo htmlspecialchars ($log->info (), ENT_NOQUOTES, 'UTF-8'); ?></div>
+ <div class="log <?php echo $log->level (); ?>"><span class="date"><?php echo @date ('Y-m-d H:i:s', @strtotime ($log->date ())); ?></span><?php echo htmlspecialchars ($log->info (), ENT_NOQUOTES, 'UTF-8'); ?></div>
<?php } ?>
-
+
<?php $this->logsPaginator->render ('logs_pagination.phtml','page'); ?>
</div>
<?php } else { ?>
- <p class="alert alert-warn"><?php echo Translate::t ('logs_empty'); ?></p>
+ <p class="alert alert-warn"><?php echo Minz_Translate::t ('logs_empty'); ?></p>
<?php } ?>
</div>
diff --git a/app/views/index/stats.phtml b/app/views/index/stats.phtml
new file mode 100644
index 000000000..b5c18813d
--- /dev/null
+++ b/app/views/index/stats.phtml
@@ -0,0 +1,125 @@
+<div class="post content">
+ <a href="<?php echo _url ('index', 'index'); ?>"><?php echo Minz_Translate::t ('back_to_rss_feeds'); ?></a>
+
+ <h1><?php echo Minz_Translate::t ('stats'); ?></h1>
+
+ <div class="stat">
+ <h2><?php echo Minz_Translate::t ('stats_entry_repartition'); ?></h2>
+ <table>
+ <thead>
+ <tr>
+ <th> </th>
+ <th><?php echo Minz_Translate::t ('main_stream'); ?></th>
+ <th><?php echo Minz_Translate::t ('all_feeds'); ?></th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <th><?php echo Minz_Translate::t ('status_total'); ?></th>
+ <td class="numeric"><?php echo formatNumber($this->repartition['main_stream']['total']); ?></td>
+ <td class="numeric"><?php echo formatNumber($this->repartition['all_feeds']['total']); ?></td>
+ </tr>
+ <tr>
+ <th><?php echo Minz_Translate::t ('status_read'); ?></th>
+ <td class="numeric"><?php echo formatNumber($this->repartition['main_stream']['read']); ?></td>
+ <td class="numeric"><?php echo formatNumber($this->repartition['all_feeds']['read']); ?></td>
+ </tr>
+ <tr>
+ <th><?php echo Minz_Translate::t ('status_unread'); ?></th>
+ <td class="numeric"><?php echo formatNumber($this->repartition['main_stream']['unread']); ?></td>
+ <td class="numeric"><?php echo formatNumber($this->repartition['all_feeds']['unread']); ?></td>
+ </tr>
+ <tr>
+ <th><?php echo Minz_Translate::t ('status_favorites'); ?></th>
+ <td class="numeric"><?php echo formatNumber($this->repartition['main_stream']['favorite']); ?></td>
+ <td class="numeric"><?php echo formatNumber($this->repartition['all_feeds']['favorite']); ?></td>
+ </tr>
+ </tbody>
+ </table>
+ </div>
+
+ <div class="stat">
+ <h2><?php echo Minz_Translate::t ('stats_entry_per_day'); ?></h2>
+ <div id="statsEntryPerDay" style="height: 300px"></div>
+ </div>
+
+ <div class="stat">
+ <h2><?php echo Minz_Translate::t ('stats_feed_per_category'); ?></h2>
+ <div id="statsFeedPerCategory" style="height: 300px"></div>
+ <div id="statsFeedPerCategoryLegend"></div>
+ </div>
+
+ <div class="stat">
+ <h2><?php echo Minz_Translate::t ('stats_entry_per_category'); ?></h2>
+ <div id="statsEntryPerCategory" style="height: 300px"></div>
+ <div id="statsEntryPerCategoryLegend"></div>
+ </div>
+
+ <div class="stat">
+ <h2><?php echo Minz_Translate::t ('stats_top_feed'); ?></h2>
+ <table>
+ <thead>
+ <tr>
+ <th><?php echo Minz_Translate::t ('feed'); ?></th>
+ <th><?php echo Minz_Translate::t ('category'); ?></th>
+ <th><?php echo Minz_Translate::t ('stats_entry_count'); ?></th>
+ </tr>
+ </thead>
+ <tbody>
+ <?php foreach ($this->topFeed as $feed): ?>
+ <tr>
+ <td><?php echo $feed['name']; ?></td>
+ <td><?php echo $feed['category']; ?></td>
+ <td class="numeric"><?php echo formatNumber($feed['count']); ?></td>
+ </tr>
+ <?php endforeach;?>
+ </tbody>
+ </table>
+ </div>
+</div>
+
+<script>
+"use strict";
+function initStats() {
+ if (!window.Flotr) {
+ if (window.console) {
+ console.log('FreshRSS waiting for Flotr…');
+ }
+ window.setTimeout(initStats, 50);
+ return;
+ }
+ // Entry per day
+ Flotr.draw(document.getElementById('statsEntryPerDay'),
+ [<?php echo $this->count ?>],
+ {
+ grid: {verticalLines: false},
+ bars: {horizontal: false, show: true},
+ xaxis: {noTicks: 6, showLabels: false, tickDecimals: 0},
+ yaxis: {min: 0},
+ mouse: {relative: true, track: true, trackDecimals: 0, trackFormatter: function(obj) {return numberFormat(obj.y);}}
+ });
+ // Feed per category
+ Flotr.draw(document.getElementById('statsFeedPerCategory'),
+ <?php echo $this->feedByCategory ?>,
+ {
+ grid: {verticalLines: false, horizontalLines: false},
+ pie: {explode: 10, show: true, labelFormatter: function(){return '';}},
+ xaxis: {showLabels: false},
+ yaxis: {showLabels: false},
+ mouse: {relative: true, track: true, trackDecimals: 0, trackFormatter: function(obj) {return obj.series.label + ' - '+ numberFormat(obj.y) + ' ('+ (obj.fraction * 100).toFixed(1) + '%)';}},
+ legend: {container: document.getElementById('statsFeedPerCategoryLegend'), noColumns: 3}
+ });
+ // Entry per category
+ Flotr.draw(document.getElementById('statsEntryPerCategory'),
+ <?php echo $this->entryByCategory ?>,
+ {
+ grid: {verticalLines: false, horizontalLines: false},
+ pie: {explode: 10, show: true, labelFormatter: function(){return '';}},
+ xaxis: {showLabels: false},
+ yaxis: {showLabels: false},
+ mouse: {relative: true, track: true, trackDecimals: 0, trackFormatter: function(obj) {return obj.series.label + ' - '+ numberFormat(obj.y) + ' ('+ (obj.fraction * 100).toFixed(1) + '%)';}},
+ legend: {container: document.getElementById('statsEntryPerCategoryLegend'), noColumns: 3}
+ });
+}
+initStats();
+</script>
diff --git a/app/views/javascript/actualize.phtml b/app/views/javascript/actualize.phtml
index f39540a9a..1f6072c29 100644
--- a/app/views/javascript/actualize.phtml
+++ b/app/views/javascript/actualize.phtml
@@ -1,37 +1,41 @@
-var feeds = new Array ();
+"use strict";
+var feeds = [];
<?php foreach ($this->feeds as $feed) { ?>
-feeds.push ("<?php echo Url::display (array ('c' => 'feed', 'a' => 'actualize', 'params' => array ('id' => $feed->id (), 'ajax' => '1')), 'php'); ?>");
+feeds.push("<?php echo Minz_Url::display (array ('c' => 'feed', 'a' => 'actualize', 'params' => array ('id' => $feed->id (), 'ajax' => '1')), 'php'); ?>");
<?php } ?>
-function initProgressBar (init) {
+function initProgressBar(init) {
if (init) {
- $("body").after ("\<div id=\"actualizeProgress\" class=\"actualizeProgress\">\
- <?php echo Translate::t ('refresh'); ?> <span class=\"progress\">0 / " + feeds.length + "</span><br />\
+ $("body").after("\<div id=\"actualizeProgress\" class=\"actualizeProgress\">\
+ <?php echo Minz_Translate::t ('refresh'); ?> <span class=\"progress\">0 / " + feeds.length + "</span><br />\
<progress id=\"actualizeProgressBar\" value=\"0\" max=\"" + feeds.length + "\"></progress>\
</div>");
} else {
- window.location.reload ();
+ window.location.reload();
}
}
-function updateProgressBar (i) {
+function updateProgressBar(i) {
$("#actualizeProgressBar").val(i);
- $("#actualizeProgress .progress").html (i + " / " + feeds.length);
+ $("#actualizeProgress .progress").html(i + " / " + feeds.length);
}
-function updateFeeds () {
- initProgressBar (true);
+function updateFeeds() {
+ if (feeds.length === 0) {
+ return;
+ }
+ initProgressBar(true);
var i = 0;
for (var f in feeds) {
- $.ajax ({
+ $.ajax({
type: 'POST',
url: feeds[f],
- }).done (function (data) {
+ }).done(function (data) {
i++;
- updateProgressBar (i);
+ updateProgressBar(i);
- if (i == feeds.length) {
- initProgressBar (false);
+ if (i === feeds.length) {
+ initProgressBar(false);
}
});
}
diff --git a/app/views/javascript/nbUnreadsPerFeed.phtml b/app/views/javascript/nbUnreadsPerFeed.phtml
new file mode 100644
index 000000000..68f98ce9e
--- /dev/null
+++ b/app/views/javascript/nbUnreadsPerFeed.phtml
@@ -0,0 +1,8 @@
+<?php
+$result = array();
+foreach ($this->categories as $cat) {
+ foreach ($cat->feeds() as $feed) {
+ $result[$feed->id()] = $feed->nbNotRead();
+ }
+}
+echo json_encode($result);
diff --git a/app/views/javascript/nonce.phtml b/app/views/javascript/nonce.phtml
new file mode 100644
index 000000000..4ac46c8fc
--- /dev/null
+++ b/app/views/javascript/nonce.phtml
@@ -0,0 +1,2 @@
+<?php
+echo json_encode(array('salt1' => $this->salt1, 'nonce' => $this->nonce));
diff --git a/cache/.gitignore b/cache/.gitignore
deleted file mode 100644
index 72e8ffc0d..000000000
--- a/cache/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-*
diff --git a/constants.php b/constants.php
new file mode 100644
index 000000000..2eba868b2
--- /dev/null
+++ b/constants.php
@@ -0,0 +1,17 @@
+<?php
+define('FRESHRSS_VERSION', '0.7');
+define('FRESHRSS_WEBSITE', 'http://freshrss.org');
+
+// Constantes de chemins
+define('FRESHRSS_PATH', dirname(__FILE__));
+
+ define('PUBLIC_PATH', FRESHRSS_PATH . '/p');
+ define('INDEX_PATH', PUBLIC_PATH . '/i');
+ define('PUBLIC_RELATIVE', '..');
+
+ 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/data/.gitignore b/data/.gitignore
new file mode 100644
index 000000000..afb16d9aa
--- /dev/null
+++ b/data/.gitignore
@@ -0,0 +1,8 @@
+application.ini
+config.php
+*_user.php
+*.sqlite
+touch.txt
+no-cache.txt
+*.bak.php
+*.lock.txt
diff --git a/data/.htaccess b/data/.htaccess
new file mode 100644
index 000000000..9e768397d
--- /dev/null
+++ b/data/.htaccess
@@ -0,0 +1,3 @@
+Order Allow,Deny
+Deny from all
+Satisfy all
diff --git a/data/cache/.gitignore b/data/cache/.gitignore
new file mode 100644
index 000000000..0307e6493
--- /dev/null
+++ b/data/cache/.gitignore
@@ -0,0 +1 @@
+*.spc \ No newline at end of file
diff --git a/data/cache/index.html b/data/cache/index.html
new file mode 100644
index 000000000..85faaa37e
--- /dev/null
+++ b/data/cache/index.html
@@ -0,0 +1,13 @@
+<!DOCTYPE html>
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-GB" lang="en-GB">
+<head>
+<meta charset="UTF-8" />
+<meta http-equiv="Refresh" content="0; url=/" />
+<title>Redirection</title>
+<meta name="robots" content="noindex" />
+</head>
+
+<body>
+<p><a href="/">Redirection</a></p>
+</body>
+</html>
diff --git a/data/favicons/.gitignore b/data/favicons/.gitignore
new file mode 100644
index 000000000..5ec725522
--- /dev/null
+++ b/data/favicons/.gitignore
@@ -0,0 +1,2 @@
+*.ico
+*.txt \ No newline at end of file
diff --git a/data/favicons/index.html b/data/favicons/index.html
new file mode 100644
index 000000000..85faaa37e
--- /dev/null
+++ b/data/favicons/index.html
@@ -0,0 +1,13 @@
+<!DOCTYPE html>
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-GB" lang="en-GB">
+<head>
+<meta charset="UTF-8" />
+<meta http-equiv="Refresh" content="0; url=/" />
+<title>Redirection</title>
+<meta name="robots" content="noindex" />
+</head>
+
+<body>
+<p><a href="/">Redirection</a></p>
+</body>
+</html>
diff --git a/data/index.html b/data/index.html
new file mode 100644
index 000000000..85faaa37e
--- /dev/null
+++ b/data/index.html
@@ -0,0 +1,13 @@
+<!DOCTYPE html>
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-GB" lang="en-GB">
+<head>
+<meta charset="UTF-8" />
+<meta http-equiv="Refresh" content="0; url=/" />
+<title>Redirection</title>
+<meta name="robots" content="noindex" />
+</head>
+
+<body>
+<p><a href="/">Redirection</a></p>
+</body>
+</html>
diff --git a/data/log/.gitignore b/data/log/.gitignore
new file mode 100644
index 000000000..bf0824e59
--- /dev/null
+++ b/data/log/.gitignore
@@ -0,0 +1 @@
+*.log \ No newline at end of file
diff --git a/data/log/index.html b/data/log/index.html
new file mode 100644
index 000000000..85faaa37e
--- /dev/null
+++ b/data/log/index.html
@@ -0,0 +1,13 @@
+<!DOCTYPE html>
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-GB" lang="en-GB">
+<head>
+<meta charset="UTF-8" />
+<meta http-equiv="Refresh" content="0; url=/" />
+<title>Redirection</title>
+<meta name="robots" content="noindex" />
+</head>
+
+<body>
+<p><a href="/">Redirection</a></p>
+</body>
+</html>
diff --git a/data/persona/.gitignore b/data/persona/.gitignore
new file mode 100644
index 000000000..314f02b1b
--- /dev/null
+++ b/data/persona/.gitignore
@@ -0,0 +1 @@
+*.txt \ No newline at end of file
diff --git a/data/persona/index.html b/data/persona/index.html
new file mode 100644
index 000000000..85faaa37e
--- /dev/null
+++ b/data/persona/index.html
@@ -0,0 +1,13 @@
+<!DOCTYPE html>
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-GB" lang="en-GB">
+<head>
+<meta charset="UTF-8" />
+<meta http-equiv="Refresh" content="0; url=/" />
+<title>Redirection</title>
+<meta name="robots" content="noindex" />
+</head>
+
+<body>
+<p><a href="/">Redirection</a></p>
+</body>
+</html>
diff --git a/index.html b/index.html
new file mode 100644
index 000000000..6ac025960
--- /dev/null
+++ b/index.html
@@ -0,0 +1,13 @@
+<!DOCTYPE html>
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-GB" lang="en-GB">
+<head>
+<meta charset="UTF-8" />
+<meta http-equiv="Refresh" content="0; url=p/" />
+<title>Redirection</title>
+<meta name="robots" content="noindex,nofollow" />
+</head>
+
+<body>
+<p><a href="p/">FreshRSS</a></p>
+</body>
+</html>
diff --git a/index.php b/index.php
index cac0fa9c6..828cca39a 100644
--- a/index.php
+++ b/index.php
@@ -1,2 +1,3 @@
<?php
-header('Location: public/'); \ No newline at end of file
+header('Location: p/', true, 301);
+include('index.html');
diff --git a/lib/.htaccess b/lib/.htaccess
new file mode 100644
index 000000000..9e768397d
--- /dev/null
+++ b/lib/.htaccess
@@ -0,0 +1,3 @@
+Order Allow,Deny
+Deny from all
+Satisfy all
diff --git a/lib/JSON.php b/lib/JSON.php
new file mode 100644
index 000000000..8dc8a6f01
--- /dev/null
+++ b/lib/JSON.php
@@ -0,0 +1,933 @@
+<?php
+/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
+/**
+ * Converts to and from JSON format.
+ *
+ * JSON (JavaScript Object Notation) is a lightweight data-interchange
+ * format. It is easy for humans to read and write. It is easy for machines
+ * to parse and generate. It is based on a subset of the JavaScript
+ * Programming Language, Standard ECMA-262 3rd Edition - December 1999.
+ * This feature can also be found in Python. JSON is a text format that is
+ * completely language independent but uses conventions that are familiar
+ * to programmers of the C-family of languages, including C, C++, C#, Java,
+ * JavaScript, Perl, TCL, and many others. These properties make JSON an
+ * ideal data-interchange language.
+ *
+ * This package provides a simple encoder and decoder for JSON notation. It
+ * is intended for use with client-side Javascript applications that make
+ * use of HTTPRequest to perform server communication functions - data can
+ * be encoded into JSON notation for use in a client-side javascript, or
+ * decoded from incoming Javascript requests. JSON format is native to
+ * Javascript, and can be directly eval()'ed with no further parsing
+ * overhead
+ *
+ * All strings should be in ASCII or UTF-8 format!
+ *
+ * LICENSE: Redistribution and use in source and binary forms, with or
+ * without modification, are permitted provided that the following
+ * conditions are met: Redistributions of source code must retain the
+ * above copyright notice, this list of conditions and the following
+ * disclaimer. Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
+ * NO EVENT SHALL CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
+ * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
+ * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
+ * DAMAGE.
+ *
+ * @category
+ * @package Services_JSON
+ * @author Michal Migurski <mike-json@teczno.com>
+ * @author Matt Knapp <mdknapp[at]gmail[dot]com>
+ * @author Brett Stimmerman <brettstimmerman[at]gmail[dot]com>
+ * @copyright 2005 Michal Migurski
+ * @version CVS: $Id: JSON.php 305040 2010-11-02 23:19:03Z alan_k $
+ * @license http://www.opensource.org/licenses/bsd-license.php
+ * @link http://pear.php.net/pepr/pepr-proposal-show.php?id=198
+ */
+
+/**
+ * Marker constant for Services_JSON::decode(), used to flag stack state
+ */
+define('SERVICES_JSON_SLICE', 1);
+
+/**
+ * Marker constant for Services_JSON::decode(), used to flag stack state
+ */
+define('SERVICES_JSON_IN_STR', 2);
+
+/**
+ * Marker constant for Services_JSON::decode(), used to flag stack state
+ */
+define('SERVICES_JSON_IN_ARR', 3);
+
+/**
+ * Marker constant for Services_JSON::decode(), used to flag stack state
+ */
+define('SERVICES_JSON_IN_OBJ', 4);
+
+/**
+ * Marker constant for Services_JSON::decode(), used to flag stack state
+ */
+define('SERVICES_JSON_IN_CMT', 5);
+
+/**
+ * Behavior switch for Services_JSON::decode()
+ */
+define('SERVICES_JSON_LOOSE_TYPE', 16);
+
+/**
+ * Behavior switch for Services_JSON::decode()
+ */
+define('SERVICES_JSON_SUPPRESS_ERRORS', 32);
+
+/**
+ * Behavior switch for Services_JSON::decode()
+ */
+define('SERVICES_JSON_USE_TO_JSON', 64);
+
+/**
+ * Converts to and from JSON format.
+ *
+ * Brief example of use:
+ *
+ * <code>
+ * // create a new instance of Services_JSON
+ * $json = new Services_JSON();
+ *
+ * // convert a complexe value to JSON notation, and send it to the browser
+ * $value = array('foo', 'bar', array(1, 2, 'baz'), array(3, array(4)));
+ * $output = $json->encode($value);
+ *
+ * print($output);
+ * // prints: ["foo","bar",[1,2,"baz"],[3,[4]]]
+ *
+ * // accept incoming POST data, assumed to be in JSON notation
+ * $input = file_get_contents('php://input', 1000000);
+ * $value = $json->decode($input);
+ * </code>
+ */
+class Services_JSON
+{
+ /**
+ * constructs a new JSON instance
+ *
+ * @param int $use object behavior flags; combine with boolean-OR
+ *
+ * possible values:
+ * - SERVICES_JSON_LOOSE_TYPE: loose typing.
+ * "{...}" syntax creates associative arrays
+ * instead of objects in decode().
+ * - SERVICES_JSON_SUPPRESS_ERRORS: error suppression.
+ * Values which can't be encoded (e.g. resources)
+ * appear as NULL instead of throwing errors.
+ * By default, a deeply-nested resource will
+ * bubble up with an error, so all return values
+ * from encode() should be checked with isError()
+ * - SERVICES_JSON_USE_TO_JSON: call toJSON when serializing objects
+ * It serializes the return value from the toJSON call rather
+ * than the object it'self, toJSON can return associative arrays,
+ * strings or numbers, if you return an object, make sure it does
+ * not have a toJSON method, otherwise an error will occur.
+ */
+ function Services_JSON($use = 0)
+ {
+ $this->use = $use;
+ $this->_mb_strlen = function_exists('mb_strlen');
+ $this->_mb_convert_encoding = function_exists('mb_convert_encoding');
+ $this->_mb_substr = function_exists('mb_substr');
+ }
+ // private - cache the mbstring lookup results..
+ var $_mb_strlen = false;
+ var $_mb_substr = false;
+ var $_mb_convert_encoding = false;
+
+ /**
+ * convert a string from one UTF-16 char to one UTF-8 char
+ *
+ * Normally should be handled by mb_convert_encoding, but
+ * provides a slower PHP-only method for installations
+ * that lack the multibye string extension.
+ *
+ * @param string $utf16 UTF-16 character
+ * @return string UTF-8 character
+ * @access private
+ */
+ function utf162utf8($utf16)
+ {
+ // oh please oh please oh please oh please oh please
+ if($this->_mb_convert_encoding) {
+ return mb_convert_encoding($utf16, 'UTF-8', 'UTF-16');
+ }
+
+ $bytes = (ord($utf16{0}) << 8) | ord($utf16{1});
+
+ switch(true) {
+ case ((0x7F & $bytes) == $bytes):
+ // this case should never be reached, because we are in ASCII range
+ // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
+ return chr(0x7F & $bytes);
+
+ case (0x07FF & $bytes) == $bytes:
+ // return a 2-byte UTF-8 character
+ // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
+ return chr(0xC0 | (($bytes >> 6) & 0x1F))
+ . chr(0x80 | ($bytes & 0x3F));
+
+ case (0xFFFF & $bytes) == $bytes:
+ // return a 3-byte UTF-8 character
+ // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
+ return chr(0xE0 | (($bytes >> 12) & 0x0F))
+ . chr(0x80 | (($bytes >> 6) & 0x3F))
+ . chr(0x80 | ($bytes & 0x3F));
+ }
+
+ // ignoring UTF-32 for now, sorry
+ return '';
+ }
+
+ /**
+ * convert a string from one UTF-8 char to one UTF-16 char
+ *
+ * Normally should be handled by mb_convert_encoding, but
+ * provides a slower PHP-only method for installations
+ * that lack the multibye string extension.
+ *
+ * @param string $utf8 UTF-8 character
+ * @return string UTF-16 character
+ * @access private
+ */
+ function utf82utf16($utf8)
+ {
+ // oh please oh please oh please oh please oh please
+ if($this->_mb_convert_encoding) {
+ return mb_convert_encoding($utf8, 'UTF-16', 'UTF-8');
+ }
+
+ switch($this->strlen8($utf8)) {
+ case 1:
+ // this case should never be reached, because we are in ASCII range
+ // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
+ return $utf8;
+
+ case 2:
+ // return a UTF-16 character from a 2-byte UTF-8 char
+ // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
+ return chr(0x07 & (ord($utf8{0}) >> 2))
+ . chr((0xC0 & (ord($utf8{0}) << 6))
+ | (0x3F & ord($utf8{1})));
+
+ case 3:
+ // return a UTF-16 character from a 3-byte UTF-8 char
+ // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
+ return chr((0xF0 & (ord($utf8{0}) << 4))
+ | (0x0F & (ord($utf8{1}) >> 2)))
+ . chr((0xC0 & (ord($utf8{1}) << 6))
+ | (0x7F & ord($utf8{2})));
+ }
+
+ // ignoring UTF-32 for now, sorry
+ return '';
+ }
+
+ /**
+ * encodes an arbitrary variable into JSON format (and sends JSON Header)
+ *
+ * @param mixed $var any number, boolean, string, array, or object to be encoded.
+ * see argument 1 to Services_JSON() above for array-parsing behavior.
+ * if var is a strng, note that encode() always expects it
+ * to be in ASCII or UTF-8 format!
+ *
+ * @return mixed JSON string representation of input var or an error if a problem occurs
+ * @access public
+ */
+ function encode($var)
+ {
+ header('Content-type: application/json');
+ return $this->encodeUnsafe($var);
+ }
+ /**
+ * encodes an arbitrary variable into JSON format without JSON Header - warning - may allow XSS!!!!)
+ *
+ * @param mixed $var any number, boolean, string, array, or object to be encoded.
+ * see argument 1 to Services_JSON() above for array-parsing behavior.
+ * if var is a strng, note that encode() always expects it
+ * to be in ASCII or UTF-8 format!
+ *
+ * @return mixed JSON string representation of input var or an error if a problem occurs
+ * @access public
+ */
+ function encodeUnsafe($var)
+ {
+ // see bug #16908 - regarding numeric locale printing
+ $lc = setlocale(LC_NUMERIC, 0);
+ setlocale(LC_NUMERIC, 'C');
+ $ret = $this->_encode($var);
+ setlocale(LC_NUMERIC, $lc);
+ return $ret;
+
+ }
+ /**
+ * PRIVATE CODE that does the work of encodes an arbitrary variable into JSON format
+ *
+ * @param mixed $var any number, boolean, string, array, or object to be encoded.
+ * see argument 1 to Services_JSON() above for array-parsing behavior.
+ * if var is a strng, note that encode() always expects it
+ * to be in ASCII or UTF-8 format!
+ *
+ * @return mixed JSON string representation of input var or an error if a problem occurs
+ * @access public
+ */
+ function _encode($var)
+ {
+
+ switch (gettype($var)) {
+ case 'boolean':
+ return $var ? 'true' : 'false';
+
+ case 'NULL':
+ return 'null';
+
+ case 'integer':
+ return (int) $var;
+
+ case 'double':
+ case 'float':
+ return (float) $var;
+
+ case 'string':
+ // STRINGS ARE EXPECTED TO BE IN ASCII OR UTF-8 FORMAT
+ $ascii = '';
+ $strlen_var = $this->strlen8($var);
+
+ /*
+ * Iterate over every character in the string,
+ * escaping with a slash or encoding to UTF-8 where necessary
+ */
+ for ($c = 0; $c < $strlen_var; ++$c) {
+
+ $ord_var_c = ord($var{$c});
+
+ switch (true) {
+ case $ord_var_c == 0x08:
+ $ascii .= '\b';
+ break;
+ case $ord_var_c == 0x09:
+ $ascii .= '\t';
+ break;
+ case $ord_var_c == 0x0A:
+ $ascii .= '\n';
+ break;
+ case $ord_var_c == 0x0C:
+ $ascii .= '\f';
+ break;
+ case $ord_var_c == 0x0D:
+ $ascii .= '\r';
+ break;
+
+ case $ord_var_c == 0x22:
+ case $ord_var_c == 0x2F:
+ case $ord_var_c == 0x5C:
+ // double quote, slash, slosh
+ $ascii .= '\\'.$var{$c};
+ break;
+
+ case (($ord_var_c >= 0x20) && ($ord_var_c <= 0x7F)):
+ // characters U-00000000 - U-0000007F (same as ASCII)
+ $ascii .= $var{$c};
+ break;
+
+ case (($ord_var_c & 0xE0) == 0xC0):
+ // characters U-00000080 - U-000007FF, mask 110XXXXX
+ // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
+ if ($c+1 >= $strlen_var) {
+ $c += 1;
+ $ascii .= '?';
+ break;
+ }
+
+ $char = pack('C*', $ord_var_c, ord($var{$c + 1}));
+ $c += 1;
+ $utf16 = $this->utf82utf16($char);
+ $ascii .= sprintf('\u%04s', bin2hex($utf16));
+ break;
+
+ case (($ord_var_c & 0xF0) == 0xE0):
+ if ($c+2 >= $strlen_var) {
+ $c += 2;
+ $ascii .= '?';
+ break;
+ }
+ // characters U-00000800 - U-0000FFFF, mask 1110XXXX
+ // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
+ $char = pack('C*', $ord_var_c,
+ @ord($var{$c + 1}),
+ @ord($var{$c + 2}));
+ $c += 2;
+ $utf16 = $this->utf82utf16($char);
+ $ascii .= sprintf('\u%04s', bin2hex($utf16));
+ break;
+
+ case (($ord_var_c & 0xF8) == 0xF0):
+ if ($c+3 >= $strlen_var) {
+ $c += 3;
+ $ascii .= '?';
+ break;
+ }
+ // characters U-00010000 - U-001FFFFF, mask 11110XXX
+ // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
+ $char = pack('C*', $ord_var_c,
+ ord($var{$c + 1}),
+ ord($var{$c + 2}),
+ ord($var{$c + 3}));
+ $c += 3;
+ $utf16 = $this->utf82utf16($char);
+ $ascii .= sprintf('\u%04s', bin2hex($utf16));
+ break;
+
+ case (($ord_var_c & 0xFC) == 0xF8):
+ // characters U-00200000 - U-03FFFFFF, mask 111110XX
+ // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
+ if ($c+4 >= $strlen_var) {
+ $c += 4;
+ $ascii .= '?';
+ break;
+ }
+ $char = pack('C*', $ord_var_c,
+ ord($var{$c + 1}),
+ ord($var{$c + 2}),
+ ord($var{$c + 3}),
+ ord($var{$c + 4}));
+ $c += 4;
+ $utf16 = $this->utf82utf16($char);
+ $ascii .= sprintf('\u%04s', bin2hex($utf16));
+ break;
+
+ case (($ord_var_c & 0xFE) == 0xFC):
+ if ($c+5 >= $strlen_var) {
+ $c += 5;
+ $ascii .= '?';
+ break;
+ }
+ // characters U-04000000 - U-7FFFFFFF, mask 1111110X
+ // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
+ $char = pack('C*', $ord_var_c,
+ ord($var{$c + 1}),
+ ord($var{$c + 2}),
+ ord($var{$c + 3}),
+ ord($var{$c + 4}),
+ ord($var{$c + 5}));
+ $c += 5;
+ $utf16 = $this->utf82utf16($char);
+ $ascii .= sprintf('\u%04s', bin2hex($utf16));
+ break;
+ }
+ }
+ return '"'.$ascii.'"';
+
+ case 'array':
+ /*
+ * As per JSON spec if any array key is not an integer
+ * we must treat the the whole array as an object. We
+ * also try to catch a sparsely populated associative
+ * array with numeric keys here because some JS engines
+ * will create an array with empty indexes up to
+ * max_index which can cause memory issues and because
+ * the keys, which may be relevant, will be remapped
+ * otherwise.
+ *
+ * As per the ECMA and JSON specification an object may
+ * have any string as a property. Unfortunately due to
+ * a hole in the ECMA specification if the key is a
+ * ECMA reserved word or starts with a digit the
+ * parameter is only accessible using ECMAScript's
+ * bracket notation.
+ */
+
+ // treat as a JSON object
+ if (is_array($var) && count($var) && (array_keys($var) !== range(0, sizeof($var) - 1))) {
+ $properties = array_map(array($this, 'name_value'),
+ array_keys($var),
+ array_values($var));
+
+ foreach($properties as $property) {
+ if(Services_JSON::isError($property)) {
+ return $property;
+ }
+ }
+
+ return '{' . join(',', $properties) . '}';
+ }
+
+ // treat it like a regular array
+ $elements = array_map(array($this, '_encode'), $var);
+
+ foreach($elements as $element) {
+ if(Services_JSON::isError($element)) {
+ return $element;
+ }
+ }
+
+ return '[' . join(',', $elements) . ']';
+
+ case 'object':
+
+ // support toJSON methods.
+ if (($this->use & SERVICES_JSON_USE_TO_JSON) && method_exists($var, 'toJSON')) {
+ // this may end up allowing unlimited recursion
+ // so we check the return value to make sure it's not got the same method.
+ $recode = $var->toJSON();
+
+ if (method_exists($recode, 'toJSON')) {
+
+ return ($this->use & SERVICES_JSON_SUPPRESS_ERRORS)
+ ? 'null'
+ : new Services_JSON_Error(class_name($var).
+ " toJSON returned an object with a toJSON method.");
+
+ }
+
+ return $this->_encode( $recode );
+ }
+
+ $vars = get_object_vars($var);
+
+ $properties = array_map(array($this, 'name_value'),
+ array_keys($vars),
+ array_values($vars));
+
+ foreach($properties as $property) {
+ if(Services_JSON::isError($property)) {
+ return $property;
+ }
+ }
+
+ return '{' . join(',', $properties) . '}';
+
+ default:
+ return ($this->use & SERVICES_JSON_SUPPRESS_ERRORS)
+ ? 'null'
+ : new Services_JSON_Error(gettype($var)." can not be encoded as JSON string");
+ }
+ }
+
+ /**
+ * array-walking function for use in generating JSON-formatted name-value pairs
+ *
+ * @param string $name name of key to use
+ * @param mixed $value reference to an array element to be encoded
+ *
+ * @return string JSON-formatted name-value pair, like '"name":value'
+ * @access private
+ */
+ function name_value($name, $value)
+ {
+ $encoded_value = $this->_encode($value);
+
+ if(Services_JSON::isError($encoded_value)) {
+ return $encoded_value;
+ }
+
+ return $this->_encode(strval($name)) . ':' . $encoded_value;
+ }
+
+ /**
+ * reduce a string by removing leading and trailing comments and whitespace
+ *
+ * @param $str string string value to strip of comments and whitespace
+ *
+ * @return string string value stripped of comments and whitespace
+ * @access private
+ */
+ function reduce_string($str)
+ {
+ $str = preg_replace(array(
+
+ // eliminate single line comments in '// ...' form
+ '#^\s*//(.+)$#m',
+
+ // eliminate multi-line comments in '/* ... */' form, at start of string
+ '#^\s*/\*(.+)\*/#Us',
+
+ // eliminate multi-line comments in '/* ... */' form, at end of string
+ '#/\*(.+)\*/\s*$#Us'
+
+ ), '', $str);
+
+ // eliminate extraneous space
+ return trim($str);
+ }
+
+ /**
+ * decodes a JSON string into appropriate variable
+ *
+ * @param string $str JSON-formatted string
+ *
+ * @return mixed number, boolean, string, array, or object
+ * corresponding to given JSON input string.
+ * See argument 1 to Services_JSON() above for object-output behavior.
+ * Note that decode() always returns strings
+ * in ASCII or UTF-8 format!
+ * @access public
+ */
+ function decode($str)
+ {
+ $str = $this->reduce_string($str);
+
+ switch (strtolower($str)) {
+ case 'true':
+ return true;
+
+ case 'false':
+ return false;
+
+ case 'null':
+ return null;
+
+ default:
+ $m = array();
+
+ if (is_numeric($str)) {
+ // Lookie-loo, it's a number
+
+ // This would work on its own, but I'm trying to be
+ // good about returning integers where appropriate:
+ // return (float)$str;
+
+ // Return float or int, as appropriate
+ return ((float)$str == (integer)$str)
+ ? (integer)$str
+ : (float)$str;
+
+ } elseif (preg_match('/^("|\').*(\1)$/s', $str, $m) && $m[1] == $m[2]) {
+ // STRINGS RETURNED IN UTF-8 FORMAT
+ $delim = $this->substr8($str, 0, 1);
+ $chrs = $this->substr8($str, 1, -1);
+ $utf8 = '';
+ $strlen_chrs = $this->strlen8($chrs);
+
+ for ($c = 0; $c < $strlen_chrs; ++$c) {
+
+ $substr_chrs_c_2 = $this->substr8($chrs, $c, 2);
+ $ord_chrs_c = ord($chrs{$c});
+
+ switch (true) {
+ case $substr_chrs_c_2 == '\b':
+ $utf8 .= chr(0x08);
+ ++$c;
+ break;
+ case $substr_chrs_c_2 == '\t':
+ $utf8 .= chr(0x09);
+ ++$c;
+ break;
+ case $substr_chrs_c_2 == '\n':
+ $utf8 .= chr(0x0A);
+ ++$c;
+ break;
+ case $substr_chrs_c_2 == '\f':
+ $utf8 .= chr(0x0C);
+ ++$c;
+ break;
+ case $substr_chrs_c_2 == '\r':
+ $utf8 .= chr(0x0D);
+ ++$c;
+ break;
+
+ case $substr_chrs_c_2 == '\\"':
+ case $substr_chrs_c_2 == '\\\'':
+ case $substr_chrs_c_2 == '\\\\':
+ case $substr_chrs_c_2 == '\\/':
+ if (($delim == '"' && $substr_chrs_c_2 != '\\\'') ||
+ ($delim == "'" && $substr_chrs_c_2 != '\\"')) {
+ $utf8 .= $chrs{++$c};
+ }
+ break;
+
+ case preg_match('/\\\u[0-9A-F]{4}/i', $this->substr8($chrs, $c, 6)):
+ // single, escaped unicode character
+ $utf16 = chr(hexdec($this->substr8($chrs, ($c + 2), 2)))
+ . chr(hexdec($this->substr8($chrs, ($c + 4), 2)));
+ $utf8 .= $this->utf162utf8($utf16);
+ $c += 5;
+ break;
+
+ case ($ord_chrs_c >= 0x20) && ($ord_chrs_c <= 0x7F):
+ $utf8 .= $chrs{$c};
+ break;
+
+ case ($ord_chrs_c & 0xE0) == 0xC0:
+ // characters U-00000080 - U-000007FF, mask 110XXXXX
+ //see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
+ $utf8 .= $this->substr8($chrs, $c, 2);
+ ++$c;
+ break;
+
+ case ($ord_chrs_c & 0xF0) == 0xE0:
+ // characters U-00000800 - U-0000FFFF, mask 1110XXXX
+ // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
+ $utf8 .= $this->substr8($chrs, $c, 3);
+ $c += 2;
+ break;
+
+ case ($ord_chrs_c & 0xF8) == 0xF0:
+ // characters U-00010000 - U-001FFFFF, mask 11110XXX
+ // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
+ $utf8 .= $this->substr8($chrs, $c, 4);
+ $c += 3;
+ break;
+
+ case ($ord_chrs_c & 0xFC) == 0xF8:
+ // characters U-00200000 - U-03FFFFFF, mask 111110XX
+ // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
+ $utf8 .= $this->substr8($chrs, $c, 5);
+ $c += 4;
+ break;
+
+ case ($ord_chrs_c & 0xFE) == 0xFC:
+ // characters U-04000000 - U-7FFFFFFF, mask 1111110X
+ // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
+ $utf8 .= $this->substr8($chrs, $c, 6);
+ $c += 5;
+ break;
+
+ }
+
+ }
+
+ return $utf8;
+
+ } elseif (preg_match('/^\[.*\]$/s', $str) || preg_match('/^\{.*\}$/s', $str)) {
+ // array, or object notation
+
+ if ($str{0} == '[') {
+ $stk = array(SERVICES_JSON_IN_ARR);
+ $arr = array();
+ } else {
+ if ($this->use & SERVICES_JSON_LOOSE_TYPE) {
+ $stk = array(SERVICES_JSON_IN_OBJ);
+ $obj = array();
+ } else {
+ $stk = array(SERVICES_JSON_IN_OBJ);
+ $obj = new stdClass();
+ }
+ }
+
+ array_push($stk, array('what' => SERVICES_JSON_SLICE,
+ 'where' => 0,
+ 'delim' => false));
+
+ $chrs = $this->substr8($str, 1, -1);
+ $chrs = $this->reduce_string($chrs);
+
+ if ($chrs == '') {
+ if (reset($stk) == SERVICES_JSON_IN_ARR) {
+ return $arr;
+
+ } else {
+ return $obj;
+
+ }
+ }
+
+ //print("\nparsing {$chrs}\n");
+
+ $strlen_chrs = $this->strlen8($chrs);
+
+ for ($c = 0; $c <= $strlen_chrs; ++$c) {
+
+ $top = end($stk);
+ $substr_chrs_c_2 = $this->substr8($chrs, $c, 2);
+
+ if (($c == $strlen_chrs) || (($chrs{$c} == ',') && ($top['what'] == SERVICES_JSON_SLICE))) {
+ // found a comma that is not inside a string, array, etc.,
+ // OR we've reached the end of the character list
+ $slice = $this->substr8($chrs, $top['where'], ($c - $top['where']));
+ array_push($stk, array('what' => SERVICES_JSON_SLICE, 'where' => ($c + 1), 'delim' => false));
+ //print("Found split at {$c}: ".$this->substr8($chrs, $top['where'], (1 + $c - $top['where']))."\n");
+
+ if (reset($stk) == SERVICES_JSON_IN_ARR) {
+ // we are in an array, so just push an element onto the stack
+ array_push($arr, $this->decode($slice));
+
+ } elseif (reset($stk) == SERVICES_JSON_IN_OBJ) {
+ // we are in an object, so figure
+ // out the property name and set an
+ // element in an associative array,
+ // for now
+ $parts = array();
+
+ if (preg_match('/^\s*(["\'].*[^\\\]["\'])\s*:/Uis', $slice, $parts)) {
+ // "name":value pair
+ $key = $this->decode($parts[1]);
+ $val = $this->decode(trim(substr($slice, strlen($parts[0])), ", \t\n\r\0\x0B"));
+ if ($this->use & SERVICES_JSON_LOOSE_TYPE) {
+ $obj[$key] = $val;
+ } else {
+ $obj->$key = $val;
+ }
+ } elseif (preg_match('/^\s*(\w+)\s*:/Uis', $slice, $parts)) {
+ // name:value pair, where name is unquoted
+ $key = $parts[1];
+ $val = $this->decode(trim(substr($slice, strlen($parts[0])), ", \t\n\r\0\x0B"));
+
+ if ($this->use & SERVICES_JSON_LOOSE_TYPE) {
+ $obj[$key] = $val;
+ } else {
+ $obj->$key = $val;
+ }
+ }
+
+ }
+
+ } elseif ((($chrs{$c} == '"') || ($chrs{$c} == "'")) && ($top['what'] != SERVICES_JSON_IN_STR)) {
+ // found a quote, and we are not inside a string
+ array_push($stk, array('what' => SERVICES_JSON_IN_STR, 'where' => $c, 'delim' => $chrs{$c}));
+ //print("Found start of string at {$c}\n");
+
+ } elseif (($chrs{$c} == $top['delim']) &&
+ ($top['what'] == SERVICES_JSON_IN_STR) &&
+ (($this->strlen8($this->substr8($chrs, 0, $c)) - $this->strlen8(rtrim($this->substr8($chrs, 0, $c), '\\'))) % 2 != 1)) {
+ // found a quote, we're in a string, and it's not escaped
+ // we know that it's not escaped becase there is _not_ an
+ // odd number of backslashes at the end of the string so far
+ array_pop($stk);
+ //print("Found end of string at {$c}: ".$this->substr8($chrs, $top['where'], (1 + 1 + $c - $top['where']))."\n");
+
+ } elseif (($chrs{$c} == '[') &&
+ in_array($top['what'], array(SERVICES_JSON_SLICE, SERVICES_JSON_IN_ARR, SERVICES_JSON_IN_OBJ))) {
+ // found a left-bracket, and we are in an array, object, or slice
+ array_push($stk, array('what' => SERVICES_JSON_IN_ARR, 'where' => $c, 'delim' => false));
+ //print("Found start of array at {$c}\n");
+
+ } elseif (($chrs{$c} == ']') && ($top['what'] == SERVICES_JSON_IN_ARR)) {
+ // found a right-bracket, and we're in an array
+ array_pop($stk);
+ //print("Found end of array at {$c}: ".$this->substr8($chrs, $top['where'], (1 + $c - $top['where']))."\n");
+
+ } elseif (($chrs{$c} == '{') &&
+ in_array($top['what'], array(SERVICES_JSON_SLICE, SERVICES_JSON_IN_ARR, SERVICES_JSON_IN_OBJ))) {
+ // found a left-brace, and we are in an array, object, or slice
+ array_push($stk, array('what' => SERVICES_JSON_IN_OBJ, 'where' => $c, 'delim' => false));
+ //print("Found start of object at {$c}\n");
+
+ } elseif (($chrs{$c} == '}') && ($top['what'] == SERVICES_JSON_IN_OBJ)) {
+ // found a right-brace, and we're in an object
+ array_pop($stk);
+ //print("Found end of object at {$c}: ".$this->substr8($chrs, $top['where'], (1 + $c - $top['where']))."\n");
+
+ } elseif (($substr_chrs_c_2 == '/*') &&
+ in_array($top['what'], array(SERVICES_JSON_SLICE, SERVICES_JSON_IN_ARR, SERVICES_JSON_IN_OBJ))) {
+ // found a comment start, and we are in an array, object, or slice
+ array_push($stk, array('what' => SERVICES_JSON_IN_CMT, 'where' => $c, 'delim' => false));
+ $c++;
+ //print("Found start of comment at {$c}\n");
+
+ } elseif (($substr_chrs_c_2 == '*/') && ($top['what'] == SERVICES_JSON_IN_CMT)) {
+ // found a comment end, and we're in one now
+ array_pop($stk);
+ $c++;
+
+ for ($i = $top['where']; $i <= $c; ++$i)
+ $chrs = substr_replace($chrs, ' ', $i, 1);
+
+ //print("Found end of comment at {$c}: ".$this->substr8($chrs, $top['where'], (1 + $c - $top['where']))."\n");
+
+ }
+
+ }
+
+ if (reset($stk) == SERVICES_JSON_IN_ARR) {
+ return $arr;
+
+ } elseif (reset($stk) == SERVICES_JSON_IN_OBJ) {
+ return $obj;
+
+ }
+
+ }
+ }
+ }
+
+ /**
+ * @todo Ultimately, this should just call PEAR::isError()
+ */
+ function isError($data, $code = null)
+ {
+ if (class_exists('pear')) {
+ return PEAR::isError($data, $code);
+ } elseif (is_object($data) && (get_class($data) == 'services_json_error' ||
+ is_subclass_of($data, 'services_json_error'))) {
+ return true;
+ }
+
+ return false;
+ }
+
+ /**
+ * Calculates length of string in bytes
+ * @param string
+ * @return integer length
+ */
+ function strlen8( $str )
+ {
+ if ( $this->_mb_strlen ) {
+ return mb_strlen( $str, "8bit" );
+ }
+ return strlen( $str );
+ }
+
+ /**
+ * Returns part of a string, interpreting $start and $length as number of bytes.
+ * @param string
+ * @param integer start
+ * @param integer length
+ * @return integer length
+ */
+ function substr8( $string, $start, $length=false )
+ {
+ if ( $length === false ) {
+ $length = $this->strlen8( $string ) - $start;
+ }
+ if ( $this->_mb_substr ) {
+ return mb_substr( $string, $start, $length, "8bit" );
+ }
+ return substr( $string, $start, $length );
+ }
+
+}
+
+if (class_exists('PEAR_Error')) {
+
+ class Services_JSON_Error extends PEAR_Error
+ {
+ function Services_JSON_Error($message = 'unknown error', $code = null,
+ $mode = null, $options = null, $userinfo = null)
+ {
+ parent::PEAR_Error($message, $code, $mode, $options, $userinfo);
+ }
+ }
+
+} else {
+
+ /**
+ * @todo Ultimately, this class shall be descended from PEAR_Error
+ */
+ class Services_JSON_Error
+ {
+ function Services_JSON_Error($message = 'unknown error', $code = null,
+ $mode = null, $options = null, $userinfo = null)
+ {
+
+ }
+ }
+
+}
diff --git a/lib/minz/ActionController.php b/lib/Minz/ActionController.php
index ab9389dbd..409d9611f 100755..100644
--- 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/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 @@
+<?php
+class Minz_ActionException extends Minz_Exception {
+ public function __construct ($controller_name, $action_name, $code = self::ERROR) {
+ $message = '`' . $action_name . '` cannot be invoked on `'
+ . $controller_name . '`';
+
+ parent::__construct ($message, $code);
+ }
+}
diff --git a/lib/Minz/BadConfigurationException.php b/lib/Minz/BadConfigurationException.php
new file mode 100644
index 000000000..a7b77d687
--- /dev/null
+++ b/lib/Minz/BadConfigurationException.php
@@ -0,0 +1,9 @@
+<?php
+class Minz_BadConfigurationException extends Minz_Exception {
+ public function __construct ($part_missing, $code = self::ERROR) {
+ $message = '`' . $part_missing
+ . '` in the configuration file is missing or is misconfigured';
+
+ parent::__construct ($message, $code);
+ }
+}
diff --git a/lib/minz/Minz_Cache.php b/lib/Minz/Cache.php
index 6848e3350..fcb627eb2 100644
--- a/lib/minz/Minz_Cache.php
+++ b/lib/Minz/Cache.php
@@ -35,7 +35,7 @@ class Minz_Cache {
* Setteurs
*/
public function _fileName () {
- $file = md5 (Request::getURI ());
+ $file = md5 (Minz_Request::getURI ());
$this->file = CACHE_PATH . '/'.$file;
}
@@ -43,7 +43,7 @@ class Minz_Cache {
public function _expire () {
if ($this->exist ()) {
$this->expire = filemtime ($this->file)
- + Configuration::delayCache ();
+ + Minz_Configuration::delayCache ();
}
}
@@ -52,7 +52,7 @@ class Minz_Cache {
* @return true si activé, false sinon
*/
public static function isEnabled () {
- return Configuration::cacheEnabled () && self::$enabled;
+ return Minz_Configuration::cacheEnabled () && self::$enabled;
}
/**
diff --git a/lib/Minz/Configuration.php b/lib/Minz/Configuration.php
new file mode 100644
index 000000000..572b9984d
--- /dev/null
+++ b/lib/Minz/Configuration.php
@@ -0,0 +1,340 @@
+<?php
+/**
+ * MINZ - Copyright 2011 Marien Fressinaud
+ * Sous licence AGPL3 <http://www.gnu.org/licenses/>
+*/
+
+/**
+ * La classe Configuration permet de gérer la configuration de l'application
+ */
+class Minz_Configuration {
+ const CONF_PATH_NAME = '/config.php';
+
+ /**
+ * 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
+ * $salt 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 $salt = '';
+ 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 $allow_anonymous = false;
+ private static $auth_type = 'none';
+
+ private static $db = array (
+ 'type' => 'mysql',
+ 'host' => '',
+ 'user' => '',
+ 'password' => '',
+ 'base' => '',
+ 'prefix' => '',
+ );
+
+ /*
+ * Getteurs
+ */
+ public static function salt () {
+ return self::$salt;
+ }
+ public static function environment ($str = false) {
+ $env = self::$environment;
+
+ if ($str) {
+ switch (self::$environment) {
+ case self::SILENT:
+ $env = 'silent';
+ break;
+ case self::DEVELOPMENT:
+ $env = 'development';
+ break;
+ case self::PRODUCTION:
+ default:
+ $env = 'production';
+ }
+ }
+
+ return $env;
+ }
+ public static function baseUrl () {
+ return self::$base_url;
+ }
+ public static function useUrlRewriting () {
+ return self::$use_url_rewriting;
+ }
+ public static function title () {
+ return 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 isAdmin($currentUser) {
+ return $currentUser === self::$default_user;
+ }
+ public static function allowAnonymous() {
+ return self::$allow_anonymous;
+ }
+ public static function authType() {
+ return self::$auth_type;
+ }
+ public static function needsLogin() {
+ return self::$auth_type !== 'none';
+ }
+ public static function canLogIn() {
+ return self::$auth_type === 'form' || self::$auth_type === 'persona';
+ }
+
+ public static function _allowAnonymous($allow = false) {
+ self::$allow_anonymous = ((bool)$allow) && self::canLogIn();
+ }
+ public static function _authType($value) {
+ $value = strtolower($value);
+ switch ($value) {
+ case 'form':
+ case 'http_auth':
+ case 'persona':
+ case 'none':
+ self::$auth_type = $value;
+ break;
+ }
+ self::_allowAnonymous(self::$allow_anonymous);
+ }
+
+ /**
+ * 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;
+ }
+ }
+
+ public static function writeFile() {
+ $ini_array = array(
+ 'general' => array(
+ 'environment' => self::environment(true),
+ 'use_url_rewriting' => self::$use_url_rewriting,
+ 'salt' => self::$salt,
+ 'base_url' => self::$base_url,
+ 'title' => self::$title,
+ 'default_user' => self::$default_user,
+ 'allow_anonymous' => self::$allow_anonymous,
+ 'auth_type' => self::$auth_type,
+ ),
+ 'db' => self::$db,
+ );
+ @rename(DATA_PATH . self::CONF_PATH_NAME, DATA_PATH . self::CONF_PATH_NAME . '.bak.php');
+ $result = file_put_contents(DATA_PATH . self::CONF_PATH_NAME, "<?php\n return " . var_export($ini_array, true) . ';');
+ if (function_exists('opcache_invalidate')) {
+ opcache_invalidate(DATA_PATH . self::CONF_PATH_NAME); //Clear PHP 5.5+ cache for include
+ }
+ return (bool)$result;
+ }
+
+ /**
+ * Parse un fichier de configuration
+ * @exception Minz_PermissionDeniedException si le CONF_PATH_NAME n'est pas accessible
+ * @exception Minz_BadConfigurationException si CONF_PATH_NAME mal formaté
+ */
+ private static function parseFile () {
+ $ini_array = include(DATA_PATH . self::CONF_PATH_NAME);
+
+ if (!is_array($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'];
+
+ // salt est obligatoire
+ if (!isset ($general['salt'])) {
+ if (isset($general['sel_application'])) { //v0.6
+ $general['salt'] = $general['sel_application'];
+ } else {
+ throw new Minz_BadConfigurationException (
+ 'salt',
+ Minz_Exception::ERROR
+ );
+ }
+ }
+ self::$salt = $general['salt'];
+
+ 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:
+ if ($general['environment'] >= 0 &&
+ $general['environment'] <= 2) {
+ // fallback 0.7-beta
+ self::$environment = $general['environment'];
+ } else {
+ 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 = inval($general['delay_cache']);
+ }
+ if (isset ($general['default_user'])) {
+ self::$default_user = $general['default_user'];
+ }
+ if (isset ($general['auth_type'])) {
+ self::_authType($general['auth_type']);
+ }
+ if (isset ($general['allow_anonymous'])) {
+ self::$allow_anonymous = ((bool)($general['allow_anonymous'])) && ($general['allow_anonymous'] !== 'no');
+ }
+
+ // Base de données
+ if (isset ($ini_array['db'])) {
+ $db = $ini_array['db'];
+ if (empty($db['host'])) {
+ throw new Minz_BadConfigurationException (
+ 'host',
+ Minz_Exception::ERROR
+ );
+ }
+ if (empty($db['user'])) {
+ throw new Minz_BadConfigurationException (
+ 'user',
+ Minz_Exception::ERROR
+ );
+ }
+ if (!isset ($db['password'])) {
+ throw new Minz_BadConfigurationException (
+ 'password',
+ Minz_Exception::ERROR
+ );
+ }
+ if (empty($db['base'])) {
+ throw new Minz_BadConfigurationException (
+ 'base',
+ Minz_Exception::ERROR
+ );
+ }
+
+ if (!empty($db['type'])) {
+ self::$db['type'] = $db['type'];
+ }
+ self::$db['host'] = $db['host'];
+ self::$db['user'] = $db['user'];
+ self::$db['password'] = $db['password'];
+ self::$db['base'] = $db['base'];
+ if (isset($db['prefix'])) {
+ self::$db['prefix'] = $db['prefix'];
+ }
+ }
+ }
+
+ private static function setReporting() {
+ switch (self::$environment) {
+ case self::PRODUCTION:
+ error_reporting(E_ALL);
+ ini_set('display_errors','Off');
+ ini_set('log_errors', 'On');
+ break;
+ case self::DEVELOPMENT:
+ error_reporting(E_ALL);
+ ini_set('display_errors','On');
+ ini_set('log_errors', 'On');
+ break;
+ case self::SILENT:
+ error_reporting(0);
+ break;
+ }
+ }
+}
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 @@
+<?php
+class Minz_ControllerNotActionControllerException extends Minz_Exception {
+ public function __construct ($controller_name, $code = self::ERROR) {
+ $message = 'Controller `' . $controller_name
+ . '` isn\'t instance of ActionController';
+
+ parent::__construct ($message, $code);
+ }
+}
diff --git a/lib/Minz/ControllerNotExistException.php b/lib/Minz/ControllerNotExistException.php
new file mode 100644
index 000000000..523867d11
--- /dev/null
+++ b/lib/Minz/ControllerNotExistException.php
@@ -0,0 +1,9 @@
+<?php
+class Minz_ControllerNotExistException extends Minz_Exception {
+ public function __construct ($controller_name, $code = self::ERROR) {
+ $message = 'Controller `' . $controller_name
+ . '` doesn\'t exist';
+
+ parent::__construct ($message, $code);
+ }
+}
diff --git a/lib/Minz/CurrentPagePaginationException.php b/lib/Minz/CurrentPagePaginationException.php
new file mode 100644
index 000000000..74214d879
--- /dev/null
+++ b/lib/Minz/CurrentPagePaginationException.php
@@ -0,0 +1,8 @@
+<?php
+class Minz_CurrentPagePaginationException extends Minz_Exception {
+ public function __construct ($page) {
+ $message = 'Page number `' . $page . '` doesn\'t exist';
+
+ parent::__construct ($message, self::ERROR);
+ }
+}
diff --git a/lib/minz/Dispatcher.php b/lib/Minz/Dispatcher.php
index 0cfdd8e75..71dfe8ac6 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;
@@ -22,8 +22,8 @@ class Dispatcher {
* Récupère l'instance du Dispatcher
*/
public static function getInstance ($router) {
- if (is_null (self::$instance)) {
- self::$instance = new Dispatcher ($router);
+ if (self::$instance === null) {
+ self::$instance = new Minz_Dispatcher ($router);
}
return self::$instance;
}
@@ -38,44 +38,51 @@ 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 () {
+ public function run ($ob = true) {
$cache = new Minz_Cache();
// Le ob_start est dupliqué : sans ça il y a un bug sous Firefox
// ici on l'appelle avec 'ob_gzhandler', après sans.
// Vraisemblablement la compression fonctionne mais c'est sale
// J'ignore les effets de bord :(
- ob_start ('ob_gzhandler');
+ if ($ob) {
+ ob_start ('ob_gzhandler');
+ }
if (Minz_Cache::isEnabled () && !$cache->expired ()) {
- ob_start ();
+ if ($ob) {
+ ob_start ();
+ }
$cache->render ();
- $text = ob_get_clean();
+ if ($ob) {
+ $text = ob_get_clean();
+ }
} else {
- while (Request::$reseted) {
- Request::$reseted = false;
+ $text = ''; //TODO: Clean this code
+ 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) {
- ob_start ();
+ if (!Minz_Request::$reseted) {
+ if ($ob) {
+ ob_start ();
+ }
$this->controller->view ()->build ();
- $text = ob_get_clean();
+ if ($ob) {
+ $text = ob_get_clean();
+ }
}
- } catch (MinzException $e) {
+ } catch (Minz_Exception $e) {
throw $e;
}
}
@@ -85,14 +92,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 +106,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 +126,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..337ab6c0a 100755..100644
--- a/lib/minz/Error.php
+++ b/lib/Minz/Error.php
@@ -1,5 +1,5 @@
<?php
-/**
+/**
* MINZ - Copyright 2011 Marien Fressinaud
* Sous licence AGPL3 <http://www.gnu.org/licenses/>
*/
@@ -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 = '<h1>An error occured</h1>'."\n";
-
+
if (!empty ($logs)) {
$text .= '<ul>'."\n";
foreach ($logs as $log) {
@@ -50,14 +50,14 @@ class Error {
}
$text .= '</ul>'."\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/Exception.php b/lib/Minz/Exception.php
new file mode 100644
index 000000000..b5e71e0d8
--- /dev/null
+++ b/lib/Minz/Exception.php
@@ -0,0 +1,16 @@
+<?php
+class Minz_Exception extends Exception {
+ const ERROR = 0;
+ const WARNING = 10;
+ const NOTICE = 20;
+
+ public function __construct ($message, $code = self::ERROR) {
+ if ($code != Minz_Exception::ERROR
+ && $code != Minz_Exception::WARNING
+ && $code != Minz_Exception::NOTICE) {
+ $code = Minz_Exception::ERROR;
+ }
+
+ parent::__construct ($message, $code);
+ }
+}
diff --git a/lib/Minz/FileNotExistException.php b/lib/Minz/FileNotExistException.php
new file mode 100644
index 000000000..f8dfbdf66
--- /dev/null
+++ b/lib/Minz/FileNotExistException.php
@@ -0,0 +1,8 @@
+<?php
+class Minz_FileNotExistException extends Minz_Exception {
+ public function __construct ($file_name, $code = self::ERROR) {
+ $message = 'File not found: `' . $file_name.'`';
+
+ parent::__construct ($message, $code);
+ }
+}
diff --git a/lib/minz/FrontController.php b/lib/Minz/FrontController.php
index d48d43d04..80eda8877 100755..100644
--- a/lib/minz/FrontController.php
+++ b/lib/Minz/FrontController.php
@@ -2,109 +2,81 @@
# ***** 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 <http://www.gnu.org/licenses/>.
#
# ***** 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;
-
+
+ private $useOb = true;
+
/**
* Constructeur
* Initialise le router et le dispatcher
*/
public function __construct () {
- $this->loadLib ();
-
if (LOG_PATH === false) {
- $this->killApp ('Path doesn\'t exist : LOG_PATH');
+ $this->killApp ('Path not found: 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) {
+ $this->dispatcher->run ($this->useOb);
+ 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 +86,7 @@ class FrontController {
}
}
}
-
+
/**
* Permet d'arrêter le programme en urgence
*/
@@ -124,4 +96,15 @@ class FrontController {
}
exit ('### Application problem ###<br />'."\n".$txt);
}
+
+ public function useOb() {
+ return $this->useOb;
+ }
+
+ /**
+ * Use ob_start('ob_gzhandler') or not.
+ */
+ public function _useOb($ob) {
+ return $this->useOb = (bool)$ob;
+ }
}
diff --git a/lib/minz/Helper.php b/lib/Minz/Helper.php
index 4f64ba218..b058211d3 100755..100644
--- 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_Log.php b/lib/Minz/Log.php
index 153870435..e710aad4a 100644
--- a/lib/minz/Minz_Log.php
+++ b/lib/Minz/Log.php
@@ -1,5 +1,5 @@
<?php
-/**
+/**
* MINZ - Copyright 2011 Marien Fressinaud
* Sous licence AGPL3 <http://www.gnu.org/licenses/>
*/
@@ -12,12 +12,14 @@ 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 messages d'informations, affichés pour le déboggage
+ * NOTICE erreurs mineures ou messages d'informations
+ * DEBUG Informations affichées pour le déboggage
*/
- const ERROR = 0;
- const WARNING = 10;
- const NOTICE = 20;
-
+ 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
@@ -29,15 +31,15 @@ class Minz_Log {
* @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::WARNING || $level == Minz_Log::NOTICE)))) {
- if (is_null ($file_name)) {
- $file_name = LOG_PATH . '/application.log';
+ $env = Minz_Configuration::environment ();
+
+ if (! ($env === Minz_Configuration::SILENT
+ || ($env === Minz_Configuration::PRODUCTION
+ && ($level >= Minz_Log::NOTICE)))) {
+ if ($file_name === null) {
+ $file_name = LOG_PATH . '/' . Minz_Session::param('currentUser', '_') . '.log';
}
-
+
switch ($level) {
case Minz_Log::ERROR :
$level_label = 'error';
@@ -48,27 +50,19 @@ class Minz_Log {
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
- );
+
+ $log = '[' . date('r') . ']'
+ . ' [' . $level_label . ']'
+ . ' --- ' . $information . "\n";
+
+ if (file_put_contents($file_name, $log, FILE_APPEND | LOCK_EX) === false) {
+ throw new Minz_PermissionDeniedException($file_name, Minz_Exception::ERROR);
}
}
}
@@ -83,7 +77,7 @@ class Minz_Log {
$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::NOTICE, $file_name);
- self::record($msg_post, Minz_Log::NOTICE, $file_name);
+ 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..100644
--- 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/ModelArray.php b/lib/Minz/ModelArray.php
new file mode 100644
index 000000000..ff23dbc83
--- /dev/null
+++ b/lib/Minz/ModelArray.php
@@ -0,0 +1,81 @@
+<?php
+/**
+ * MINZ - Copyright 2011 Marien Fressinaud
+ * Sous licence AGPL3 <http://www.gnu.org/licenses/>
+*/
+
+/**
+ * La classe Model_array représente le modèle interragissant avec les fichiers de type texte gérant des tableaux php
+ */
+class Minz_ModelArray {
+ /**
+ * $filename est le nom du fichier
+ */
+ protected $filename;
+
+ /**
+ * Ouvre le fichier indiqué, charge le tableau dans $array et le $filename
+ * @param $filename le nom du fichier à ouvrir contenant un tableau
+ * Remarque : $array sera obligatoirement un tableau
+ */
+ public function __construct ($filename) {
+ $this->filename = $filename;
+ }
+
+ protected function loadArray() {
+ if (!file_exists($this->filename)) {
+ throw new Minz_FileNotExistException($this->filename, Minz_Exception::WARNING);
+ }
+ elseif (($handle = $this->getLock()) === false) {
+ throw new Minz_PermissionDeniedException($this->filename);
+ } else {
+ $data = include($this->filename);
+ $this->releaseLock($handle);
+
+ if ($data === false) {
+ throw new Minz_PermissionDeniedException($this->filename);
+ } elseif (!is_array($data)) {
+ $data = array();
+ }
+ return $data;
+ }
+ }
+
+ /**
+ * Sauve le tableau $array dans le fichier $filename
+ **/
+ protected function writeArray($array) {
+ if (file_put_contents($this->filename, "<?php\n return " . var_export($array, true) . ';', LOCK_EX) === false) {
+ throw new Minz_PermissionDeniedException($this->filename);
+ }
+ if (function_exists('opcache_invalidate')) {
+ opcache_invalidate($this->filename); //Clear PHP 5.5+ cache for include
+ }
+ return true;
+ }
+
+ private function getLock() {
+ $handle = fopen($this->filename, 'r');
+ if ($handle === false) {
+ return false;
+ }
+
+ $count = 50;
+ while (!flock($handle, LOCK_SH) && $count > 0) {
+ $count--;
+ usleep(1000);
+ }
+
+ if ($count > 0) {
+ return $handle;
+ } else {
+ fclose($handle);
+ return false;
+ }
+ }
+
+ private function releaseLock($handle) {
+ flock($handle, LOCK_UN);
+ fclose($handle);
+ }
+}
diff --git a/lib/minz/dao/Model_pdo.php b/lib/Minz/ModelPdo.php
index a91a4fa00..831df13a2 100755..100644
--- a/lib/minz/dao/Model_pdo.php
+++ b/lib/Minz/ModelPdo.php
@@ -1,5 +1,5 @@
<?php
-/**
+/**
* MINZ - Copyright 2011 Marien Fressinaud
* Sous licence AGPL3 <http://www.gnu.org/licenses/>
*/
@@ -8,7 +8,7 @@
* 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 {
+class Minz_ModelPdo {
/**
* Partage la connexion à la base de données entre toutes les instances.
@@ -23,7 +23,7 @@ class Model_pdo {
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
@@ -35,7 +35,7 @@ class Model_pdo {
return;
}
- $db = Configuration::dataBase ();
+ $db = Minz_Configuration::dataBase ();
$driver_options = null;
try {
@@ -49,9 +49,7 @@ class Model_pdo {
PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8'
);
} elseif($type == 'sqlite') {
- $string = $type
- . ':/' . PUBLIC_PATH
- . '/data/' . $db['base'] . '.sqlite'; //TODO: DEBUG UTF-8 http://www.siteduzero.com/forum/sujet/sqlite-connexion-utf-8-18797
+ $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 (
@@ -62,21 +60,50 @@ class Model_pdo {
);
self::$sharedBd = $this->bd;
- $this->prefix = $db['prefix'];
+ $this->prefix = $db['prefix'] . Minz_Session::param('currentUser', '_') . '_';
self::$sharedPrefix = $this->prefix;
} catch (Exception $e) {
- throw new PDOConnectionException (
+ throw new Minz_PDOConnectionException (
$string,
- $db['user'], MinzException::WARNING
+ $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($all = false) {
+ $db = Minz_Configuration::dataBase ();
+ $sql = 'SELECT SUM(data_length + index_length) FROM information_schema.TABLES WHERE table_schema = ?';
+ $values = array ($db['base']);
+ if (!$all) {
+ $sql .= ' AND table_name LIKE ?';
+ $values[] = $this->prefix . '%';
+ }
+ $stm = $this->bd->prepare ($sql);
+ $stm->execute ($values);
+ $res = $stm->fetchAll(PDO::FETCH_COLUMN, 0);
+ return $res[0];
+ }
+
+ public static function clean() {
+ self::$sharedBd = null;
+ self::$sharedPrefix = '';
+ }
}
class FreshPDO extends PDO {
private static function check($statement) {
if (preg_match('/^(?:UPDATE|INSERT|DELETE)/i', $statement)) {
- touch(PUBLIC_PATH . '/data/touch.txt');
+ invalidateHttpCache();
}
}
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 @@
+<?php
+class Minz_PDOConnectionException extends Minz_Exception {
+ public function __construct ($string_connection, $user, $code = self::ERROR) {
+ $message = 'Access to database is denied for `' . $user . '`'
+ . ' (`' . $string_connection . '`)';
+
+ parent::__construct ($message, $code);
+ }
+}
diff --git a/lib/minz/Paginator.php b/lib/Minz/Paginator.php
index 1a8376e75..5858e76a5 100755..100644
--- 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/PermissionDeniedException.php b/lib/Minz/PermissionDeniedException.php
new file mode 100644
index 000000000..61be530d3
--- /dev/null
+++ b/lib/Minz/PermissionDeniedException.php
@@ -0,0 +1,8 @@
+<?php
+class Minz_PermissionDeniedException extends Minz_Exception {
+ public function __construct ($file_name, $code = self::ERROR) {
+ $message = 'Permission is denied for `' . $file_name.'`';
+
+ parent::__construct ($message, $code);
+ }
+}
diff --git a/lib/minz/Request.php b/lib/Minz/Request.php
index ffddbe6ad..d4e1355d7 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 ();
@@ -29,15 +29,18 @@ class Request {
public static function params () {
return self::$params;
}
+ static function htmlspecialchars_utf8 ($p) {
+ return htmlspecialchars($p, ENT_COMPAT, '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('htmlspecialchars', $p); //TODO: Should use explicit UTF-8
+ return array_map('self::htmlspecialchars_utf8', $p);
} else {
- return htmlspecialchars($p, ENT_NOQUOTES, 'UTF-8');
+ return self::htmlspecialchars_utf8($p);
}
} else {
return $default;
@@ -93,7 +96,14 @@ class Request {
* @return la base de l'url
*/
public static function getBaseUrl () {
- return Configuration::baseUrl ();
+ $defaultBaseUrl = Minz_Configuration::baseUrl();
+ if (!empty($defaultBaseUrl)) {
+ return $defaultBaseUrl;
+ } elseif (isset($_SERVER['REQUEST_URI'])) {
+ return dirname($_SERVER['REQUEST_URI']) . '/';
+ } else {
+ return '/';
+ }
}
/**
@@ -121,10 +131,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;
@@ -182,9 +192,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);
}
}
@@ -192,5 +202,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/RouteNotFoundException.php b/lib/Minz/RouteNotFoundException.php
new file mode 100644
index 000000000..dc4f6fbad
--- /dev/null
+++ b/lib/Minz/RouteNotFoundException.php
@@ -0,0 +1,16 @@
+<?php
+class Minz_RouteNotFoundException extends Minz_Exception {
+ private $route;
+
+ public function __construct ($route, $code = self::ERROR) {
+ $this->route = $route;
+
+ $message = 'Route `' . $route . '` not found';
+
+ parent::__construct ($message, $code);
+ }
+
+ public function route () {
+ return $this->route;
+ }
+}
diff --git a/lib/minz/Router.php b/lib/Minz/Router.php
index c5d6f5baa..1ccd72597 100755..100644
--- 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..ddabc4658 100755..100644
--- a/lib/minz/Session.php
+++ b/lib/Minz/Session.php
@@ -4,42 +4,39 @@
* La classe Session gère la session utilisateur
* C'est un singleton
*/
-class Session {
+class Minz_Session {
/**
* $session stocke les variables de session
*/
- private static $session = array ();
-
+ private static $session = array (); //TODO: Try to avoid having another local copy
+
/**
- * Initialise la session
+ * Initialise la session, avec un nom
+ * Le nom de session est utilisé comme nom pour les cookies et les URLs (i.e. PHPSESSID).
+ * Il ne doit contenir que des caractères alphanumériques ; il doit être court et descriptif
*/
- public static function init () {
+ public static function init ($name) {
// démarre la session
- session_name (md5 (Configuration::selApplication ()));
+ session_name ($name);
+ session_set_cookie_params (0, dirname(empty($_SERVER['REQUEST_URI']) ? '/' : dirname($_SERVER['REQUEST_URI'])), null, false, true);
session_start ();
-
+
if (isset ($_SESSION)) {
self::$session = $_SESSION;
}
}
-
-
+
+
/**
* Permet de récupérer une variable de session
* @param $p le paramètre à récupérer
* @return la valeur de la variable de session, false si n'existe pas
*/
public static function param ($p, $default = false) {
- if (isset (self::$session[$p])) {
- $return = self::$session[$p];
- } else {
- $return = $default;
- }
-
- return $return;
+ return isset(self::$session[$p]) ? self::$session[$p] : $default;
}
-
-
+
+
/**
* Permet de créer ou mettre à jour une variable de session
* @param $p le paramètre à créer ou modifier
@@ -52,27 +49,23 @@ class Session {
} else {
$_SESSION[$p] = $v;
self::$session[$p] = $v;
-
- if($p == 'language') {
- // reset pour remettre à jour le fichier de langue à utiliser
- Translate::reset ();
- }
}
}
-
-
+
+
/**
* Permet d'effacer une session
* @param $force si à false, n'efface pas le paramètre de langue
*/
public static function unset_session ($force = false) {
$language = self::param ('language');
-
- session_unset ();
+
+ session_destroy();
self::$session = array ();
-
+
if (!$force) {
self::_param ('language', $language);
+ 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..17f1ddece 100755..100644
--- 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
@@ -17,28 +17,31 @@ class Url {
* @return l'url formatée
*/
public static function display ($url = array (), $encodage = 'html', $absolute = false) {
- $url = self::checkUrl ($url);
+ $isArray = is_array($url);
+
+ if ($isArray) {
+ $url = self::checkUrl ($url);
+ }
$url_string = '';
if ($absolute) {
- if (is_array ($url) && isset ($url['protocol'])) {
+ if ($isArray && isset ($url['protocol'])) {
$protocol = $url['protocol'];
} elseif (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') {
$protocol = 'https:';
} else {
$protocol = 'http:';
}
- $url_string = $protocol . '//' . Request::getDomainName () . Request::getBaseUrl ();
- }
- else {
- $url_string = '.';
+ $url_string = $protocol . '//' . Minz_Request::getDomainName () . Minz_Request::getBaseUrl ();
+ } else {
+ $url_string = $isArray ? '.' : PUBLIC_RELATIVE;
}
- if (is_array ($url)) {
- $router = new Router ();
+ if ($isArray) {
+ $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 +70,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 +101,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 +128,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 fd92762b3..e170bd406 100755..100644
--- a/lib/minz/View.php
+++ b/lib/Minz/View.php
@@ -7,13 +7,13 @@
/**
* 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';
private $view_filename = '';
- private $use_layout = false;
+ private $use_layout = null;
private static $title = '';
private static $styles = array ();
@@ -28,22 +28,19 @@ 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
- . self::LAYOUT_FILENAME)) {
- $this->use_layout = true;
- }
-
- self::$title = Configuration::title ();
+ self::$title = Minz_Configuration::title ();
}
/**
* Construit la vue
*/
public function build () {
+ if ($this->use_layout === null) { //TODO: avoid file_exists and require views to be explicit
+ $this->use_layout = file_exists (APP_PATH . self::LAYOUT_PATH_NAME . self::LAYOUT_FILENAME);
+ }
if ($this->use_layout) {
$this->buildLayout ();
} else {
@@ -66,10 +63,8 @@ class View {
* 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 : `'
+ if ((include($this->view_filename)) === false) {
+ Minz_Log::record ('File not found: `'
. $this->view_filename . '`',
Minz_Log::NOTICE);
}
@@ -84,10 +79,8 @@ class View {
. self::LAYOUT_PATH_NAME . '/'
. $part . '.phtml';
- if (file_exists ($fic_partial)) {
- include ($fic_partial);
- } else {
- Minz_Log::record ('File doesn\'t exist : `'
+ if ((include($fic_partial)) === false) {
+ Minz_Log::record ('File not found: `'
. $fic_partial . '`',
Minz_Log::WARNING);
}
@@ -102,10 +95,8 @@ class View {
. '/views/helpers/'
. $helper . '.phtml';
- if (file_exists ($fic_helper)) {
- include ($fic_helper);
- } else {
- Minz_Log::record ('File doesn\'t exist : `'
+ if ((include($fic_helper)) === false) {;
+ Minz_Log::record ('File not found: `'
. $fic_helper . '`',
Minz_Log::WARNING);
}
@@ -150,8 +141,9 @@ class View {
$styles .= '<!--[if ' . $cond . ']>';
}
- $styles .= '<link rel="stylesheet" media="' . $style['media']
- . '" href="' . $style['url'] . '" />';
+ $styles .= '<link rel="stylesheet" ' .
+ ($style['media'] === 'all' ? '' : 'media="' . $style['media'] . '" ') .
+ 'href="' . $style['url'] . '" />';
if ($cond) {
$styles .= '<![endif]-->';
@@ -231,7 +223,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/SimplePie/SimplePie.php b/lib/SimplePie/SimplePie.php
index 9e532023a..f02037c10 100644
--- a/lib/SimplePie/SimplePie.php
+++ b/lib/SimplePie/SimplePie.php
@@ -602,6 +602,13 @@ class SimplePie
public $strip_attributes = array('bgsound', 'class', 'expr', 'id', 'style', 'onclick', 'onerror', 'onfinish', 'onmouseover', 'onmouseout', 'onfocus', 'onblur', 'lowsrc', 'dynsrc');
/**
+ * @var array Stores the default attributes to add to differet tags by add_attributes().
+ * @see SimplePie::add_attributes()
+ * @access private
+ */
+ public $add_attributes = array('audio' => array('preload' => 'none'), 'iframe' => array('sandbox' => 'allow-scripts allow-same-origin'), 'video' => array('preload' => 'none')); //FreshRSS
+
+ /**
* @var array Stores the default tags to be stripped by strip_htmltags().
* @see SimplePie::strip_htmltags()
* @access private
@@ -1073,6 +1080,7 @@ class SimplePie
$this->strip_comments(false);
$this->strip_htmltags(false);
$this->strip_attributes(false);
+ $this->add_attributes(false);
$this->set_image_handler(false);
}
}
@@ -1119,6 +1127,15 @@ class SimplePie
$this->sanitize->strip_attributes($attribs);
}
+ public function add_attributes($attribs = '')
+ {
+ if ($attribs === '')
+ {
+ $attribs = $this->add_attributes;
+ }
+ $this->sanitize->add_attributes($attribs);
+ }
+
/**
* Set the output encoding
*
@@ -1296,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');
@@ -1313,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';
}
@@ -1347,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/File.php b/lib/SimplePie/SimplePie/File.php
index 063ad955e..cf926cf5a 100644
--- a/lib/SimplePie/SimplePie/File.php
+++ b/lib/SimplePie/SimplePie/File.php
@@ -77,6 +77,7 @@ class SimplePie_File
$this->useragent = $useragent;
if (preg_match('/^http(s)?:\/\//i', $url))
{
+ syslog(LOG_INFO, 'SimplePie GET ' . $url); //FreshRSS
if ($useragent === null)
{
$useragent = ini_get('user_agent');
diff --git a/lib/SimplePie/SimplePie/Misc.php b/lib/SimplePie/SimplePie/Misc.php
index 621f2c062..347520303 100644
--- a/lib/SimplePie/SimplePie/Misc.php
+++ b/lib/SimplePie/SimplePie/Misc.php
@@ -79,6 +79,10 @@ class SimplePie_Misc
public static function absolutize_url($relative, $base)
{
+ if (substr($relative, 0, 2) === '//') //FreshRSS: disable absolutize_url for "//www.example.net" which will pick HTTP or HTTPS automatically
+ {
+ return $relative;
+ }
$iri = SimplePie_IRI::absolutize(new SimplePie_IRI($base), $relative);
if ($iri === false)
{
diff --git a/lib/SimplePie/SimplePie/Parser.php b/lib/SimplePie/SimplePie/Parser.php
index 72878c25a..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 = '<?xml version="' . $declaration->version . '" encoding="' . $encoding . '" standalone="' . (($declaration->standalone) ? 'yes' : 'no') . '"?>' . $data;
}
@@ -132,18 +135,24 @@ class SimplePie_Parser
}
}
- try
- {
- $dom = new DOMDocument();
- $dom->recover = true;
- $dom->strictErrorChecking = false;
- $dom->loadXML($data);
- $this->encoding = $encoding = $dom->encoding = 'UTF-8';
- $data = $dom->saveXML();
- //file_put_contents('/home/alex/public_html/alexandre.alapetite.fr/prive/FreshRSS/log/parser.log', date('c') . ' ' . 'OK' . "\n", FILE_APPEND);
- }
- 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;
diff --git a/lib/SimplePie/SimplePie/Sanitize.php b/lib/SimplePie/SimplePie/Sanitize.php
index 83a274ced..0974c150d 100644
--- a/lib/SimplePie/SimplePie/Sanitize.php
+++ b/lib/SimplePie/SimplePie/Sanitize.php
@@ -62,6 +62,7 @@ class SimplePie_Sanitize
var $strip_htmltags = array('base', 'blink', 'body', 'doctype', 'embed', 'font', 'form', 'frame', 'frameset', 'html', 'iframe', 'input', 'marquee', 'meta', 'noscript', 'object', 'param', 'script', 'style');
var $encode_instead_of_strip = false;
var $strip_attributes = array('bgsound', 'class', 'expr', 'id', 'style', 'onclick', 'onerror', 'onfinish', 'onmouseover', 'onmouseout', 'onfocus', 'onblur', 'lowsrc', 'dynsrc');
+ var $add_attributes = array('audio' => array('preload' => 'none'), 'iframe' => array('sandbox' => 'allow-scripts allow-same-origin'), 'video' => array('preload' => 'none')); //FreshRSS
var $strip_comments = false;
var $output_encoding = 'UTF-8';
var $enable_cache = true;
@@ -179,6 +180,25 @@ class SimplePie_Sanitize
}
}
+ public function add_attributes($attribs = array('audio' => array('preload' => 'none'), 'iframe' => array('sandbox' => 'allow-scripts allow-same-origin'), 'video' => array('preload' => 'none')))
+ {
+ if ($attribs)
+ {
+ if (is_array($attribs))
+ {
+ $this->add_attributes = $attribs;
+ }
+ else
+ {
+ $this->add_attributes = explode(',', $attribs);
+ }
+ }
+ else
+ {
+ $this->add_attributes = false;
+ }
+ }
+
public function strip_comments($strip = false)
{
$this->strip_comments = (bool) $strip;
@@ -255,10 +275,11 @@ class SimplePie_Sanitize
$document->loadHTML($data);
restore_error_handler();
+ $xpath = new DOMXPath($document); //FreshRSS
+
// Strip comments
if ($this->strip_comments)
{
- $xpath = new DOMXPath($document);
$comments = $xpath->query('//comment()');
foreach ($comments as $comment)
@@ -274,7 +295,7 @@ class SimplePie_Sanitize
{
foreach ($this->strip_htmltags as $tag)
{
- $this->strip_tag($tag, $document, $type);
+ $this->strip_tag($tag, $document, $xpath, $type);
}
}
@@ -282,7 +303,15 @@ class SimplePie_Sanitize
{
foreach ($this->strip_attributes as $attrib)
{
- $this->strip_attr($attrib, $document);
+ $this->strip_attr($attrib, $xpath);
+ }
+ }
+
+ if ($this->add_attributes)
+ {
+ foreach ($this->add_attributes as $tag => $valuePairs)
+ {
+ $this->add_attr($tag, $valuePairs, $document);
}
}
@@ -452,9 +481,8 @@ class SimplePie_Sanitize
}
}
- protected function strip_tag($tag, $document, $type)
+ protected function strip_tag($tag, $document, $xpath, $type)
{
- $xpath = new DOMXPath($document);
$elements = $xpath->query('body//' . $tag);
if ($this->encode_instead_of_strip)
{
@@ -537,9 +565,8 @@ class SimplePie_Sanitize
}
}
- protected function strip_attr($attrib, $document)
+ protected function strip_attr($attrib, $xpath)
{
- $xpath = new DOMXPath($document);
$elements = $xpath->query('//*[@' . $attrib . ']');
foreach ($elements as $element)
@@ -547,4 +574,16 @@ class SimplePie_Sanitize
$element->removeAttribute($attrib);
}
}
+
+ protected function add_attr($tag, $valuePairs, $document)
+ {
+ $elements = $document->getElementsByTagName($tag);
+ foreach ($elements as $element)
+ {
+ foreach ($valuePairs as $attrib => $value)
+ {
+ $element->setAttribute($attrib, $value);
+ }
+ }
+ }
}
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 @@
-<?php
-/**
- * SimplePie
- *
- * A PHP-Based RSS and Atom Feed Framework.
- * Takes the hard work out of managing a complete RSS/Atom solution.
- *
- * Copyright (c) 2004-2009, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification, are
- * permitted provided that the following conditions are met:
- *
- * * Redistributions of source code must retain the above copyright notice, this list of
- * conditions and the following disclaimer.
- *
- * * Redistributions in binary form must reproduce the above copyright notice, this list
- * of conditions and the following disclaimer in the documentation and/or other materials
- * provided with the distribution.
- *
- * * Neither the name of the SimplePie Team nor the names of its contributors may be used
- * to endorse or promote products derived from this software without specific prior
- * written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS
- * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS
- * AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- * @package SimplePie
- * @version 1.3.1
- * @copyright 2004-2012 Ryan Parman, Geoffrey Sneddon, Ryan McCue
- * @author Ryan Parman
- * @author Geoffrey Sneddon
- * @author Ryan McCue
- * @link http://simplepie.org/ SimplePie
- * @license http://www.opensource.org/licenses/bsd-license.php BSD License
- */
-
-
-// autoloader
-spl_autoload_register(array(new SimplePie_Autoloader(), 'autoload'));
-
-if (!class_exists('SimplePie'))
-{
- trigger_error('Autoloader not registered properly', E_USER_ERROR);
-}
-
-/**
- * Autoloader class
- *
- * @package SimplePie
- * @subpackage API
- */
-class SimplePie_Autoloader
-{
- /**
- * Constructor
- */
- public function __construct()
- {
- $this->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/http-conditional.php b/lib/http-conditional.php
index 6684fd6ac..59fbef41f 100644
--- a/lib/http-conditional.php
+++ b/lib/http-conditional.php
@@ -35,7 +35,7 @@
... //Rest of the script, just as you would do normally.
?>
- Version 1.7 beta, 2013-11-03, http://alexandre.alapetite.fr/doc-alex/php-http-304/
+ Version 1.7 beta, 2013-12-02, http://alexandre.alapetite.fr/doc-alex/php-http-304/
------------------------------------------------------------------
Written by Alexandre Alapetite, http://alexandre.alapetite.fr/cv/
@@ -124,7 +124,7 @@ function httpConditional($UnixTimeStamp,$cacheSeconds=0,$cachePrivacy=0,$feedMod
if ($feedMode)
{//Special RSS/ATOM
global $clientCacheDate;
- $clientCacheDate=strtotime($dateCacheClient);
+ $clientCacheDate=@strtotime($dateCacheClient);
$cachePrivacy=0;
}
diff --git a/lib/lib_opml.php b/lib/lib_opml.php
new file mode 100644
index 000000000..1b5517d7f
--- /dev/null
+++ b/lib/lib_opml.php
@@ -0,0 +1,121 @@
+<?php
+function opml_export ($cats) {
+ $txt = '';
+
+ foreach ($cats as $cat) {
+ $txt .= '<outline text="' . $cat['name'] . '">' . "\n";
+
+ foreach ($cat['feeds'] as $feed) {
+ $txt .= "\t" . '<outline text="' . $feed->name () . '" type="rss" xmlUrl="' . $feed->url () . '" htmlUrl="' . $feed->website () . '" description="' . htmlspecialchars($feed->description(), ENT_COMPAT, 'UTF-8') . '" />' . "\n";
+ }
+
+ $txt .= '</outline>' . "\n";
+ }
+
+ return $txt;
+}
+
+function opml_import ($xml) {
+ $xml = html_only_entity_decode($xml); //!\ Assume UTF-8
+
+ $dom = new DOMDocument();
+ $dom->recover = true;
+ $dom->strictErrorChecking = false;
+ $dom->loadXML($xml);
+ $dom->encoding = 'UTF-8';
+
+ $opml = simplexml_import_dom($dom);
+
+ if (!$opml) {
+ throw new FreshRSS_Opml_Exception ();
+ }
+
+ $catDAO = new FreshRSS_CategoryDAO();
+ $catDAO->checkDefault();
+ $defCat = $catDAO->getDefault();
+
+ $categories = array ();
+ $feeds = array ();
+
+ foreach ($opml->body->outline as $outline) {
+ if (!isset ($outline['xmlUrl'])) {
+ // Catégorie
+ $title = '';
+
+ if (isset ($outline['text'])) {
+ $title = (string) $outline['text'];
+ } elseif (isset ($outline['title'])) {
+ $title = (string) $outline['title'];
+ }
+
+ if ($title) {
+ // Permet d'éviter les soucis au niveau des id :
+ // ceux-ci sont générés en fonction de la date,
+ // un flux pourrait être dans une catégorie X avec l'id Y
+ // 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_COMPAT, 'UTF-8');
+ $catDAO = new FreshRSS_CategoryDAO ();
+ $cat = $catDAO->searchByName ($title);
+ if ($cat === false) {
+ $cat = new FreshRSS_Category ($title);
+ $values = array (
+ 'name' => $cat->name (),
+ 'color' => $cat->color ()
+ );
+ $cat->_id ($catDAO->addCategory ($values));
+ }
+
+ $feeds = array_merge ($feeds, getFeedsOutline ($outline, $cat->id ()));
+ }
+ } else {
+ // Flux rss sans catégorie, on récupère l'ajoute dans la catégorie par défaut
+ $feeds[] = getFeed ($outline, $defCat->id());
+ }
+ }
+
+ return array ($categories, $feeds);
+}
+
+/**
+ * import all feeds of a given outline tag
+ */
+function getFeedsOutline ($outline, $cat_id) {
+ $feeds = array ();
+
+ foreach ($outline->children () as $child) {
+ if (isset ($child['xmlUrl'])) {
+ $feeds[] = getFeed ($child, $cat_id);
+ } else {
+ $feeds = array_merge(
+ $feeds,
+ getFeedsOutline ($child, $cat_id)
+ );
+ }
+ }
+
+ return $feeds;
+}
+
+function getFeed ($outline, $cat_id) {
+ $url = (string) $outline['xmlUrl'];
+ $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_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_COMPAT, 'UTF-8'));
+ }
+ if (isset($outline['description'])) {
+ $feed->_description(sanitizeHTML((string)$outline['description']));
+ }
+ return $feed;
+}
diff --git a/lib/lib_rss.php b/lib/lib_rss.php
index a27994e94..1bb117ab6 100644
--- a/lib/lib_rss.php
+++ b/lib/lib_rss.php
@@ -1,212 +1,187 @@
<?php
-// vérifie qu'on est connecté
-function is_logged () {
- return Session::param ('mail') != false;
+if (!function_exists('json_decode')) {
+ require_once('JSON.php');
+ function json_decode($var) {
+ $JSON = new Services_JSON;
+ return (array)($JSON->decode($var));
+ }
}
-// vérifie que le système d'authentification est configuré
-function login_is_conf ($conf) {
- return $conf->mailLogin () != false;
+if (!function_exists('json_encode')) {
+ require_once('JSON.php');
+ function json_encode($var) {
+ $JSON = new Services_JSON;
+ return $JSON->encodeUnsafe($var);
+ }
}
-// tiré de Shaarli de Seb Sauvage
-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;
+//<Auto-loading>
+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');
+ }
}
-function timestamptodate ($t, $hour = true) {
- $month = Translate::t (date('M', $t));
- if ($hour) {
- $date = Translate::t ('format_date_hour', $month);
+spl_autoload_register('classAutoloader');
+//</Auto-loading>
+
+function checkUrl($url) {
+ if (empty ($url)) {
+ return '';
+ }
+ if (!preg_match ('#^https?://#i', $url)) {
+ $url = 'http://' . $url;
+ }
+ if (filter_var($url, FILTER_VALIDATE_URL) ||
+ (version_compare(PHP_VERSION, '5.3.3', '<') && (strpos($url, '-') > 0) && //PHP bug #51192
+ ($url === filter_var($url, FILTER_SANITIZE_URL)))) {
+ return $url;
} else {
- $date = Translate::t ('format_date', $month);
+ return false;
}
-
- return date ($date, $t);
}
-function sortEntriesByDate ($entry1, $entry2) {
- return $entry2->date (true) - $entry1->date (true);
-}
-function sortReverseEntriesByDate ($entry1, $entry2) {
- return $entry1->date (true) - $entry2->date (true);
+// tiré de Shaarli de Seb Sauvage //Format RFC 4648 base64url
+function small_hash ($txt) {
+ $t = rtrim (base64_encode (hash ('crc32', $txt, true)), '=');
+ return strtr ($t, '+/', '-_');
}
-function get_domain ($url) {
- return parse_url($url, PHP_URL_HOST);
+function formatNumber($n, $precision = 0) {
+ return str_replace(' ', ' ', //Espace insécable //TODO: remplacer par une espace _fine_ insécable
+ number_format($n, $precision, '.', ' ')); //number_format does not seem to be Unicode-compatible
}
-function opml_export ($cats) {
- $txt = '';
-
- foreach ($cats as $cat) {
- $txt .= '<outline text="' . $cat['name'] . '">' . "\n";
-
- foreach ($cat['feeds'] as $feed) {
- $txt .= "\t" . '<outline text="' . cleanText ($feed->name ()) . '" type="rss" xmlUrl="' . htmlentities ($feed->url (), ENT_COMPAT, 'UTF-8') . '" htmlUrl="' . htmlentities ($feed->website (), ENT_COMPAT, 'UTF-8') . '" />' . "\n";
- }
-
- $txt .= '</outline>' . "\n";
+function formatBytes($bytes, $precision = 2, $system = 'IEC') {
+ if ($system === 'IEC') {
+ $base = 1024;
+ $units = array('B', 'KiB', 'MiB', 'GiB', 'TiB');
+ } elseif ($system === 'SI') {
+ $base = 1000;
+ $units = array('B', 'KB', 'MB', 'GB', 'TB');
}
-
- return $txt;
+ $bytes = max(intval($bytes), 0);
+ $pow = $bytes === 0 ? 0 : floor(log($bytes) / log($base));
+ $pow = min($pow, count($units) - 1);
+ $bytes /= pow($base, $pow);
+ return formatNumber($bytes, $precision) . ' ' . $units[$pow];
}
-function cleanText ($text) {
- return preg_replace ('/&[\w]+;/', '', $text);
-}
-
-function opml_import ($xml) {
- $opml = @simplexml_load_string ($xml);
-
- if (!$opml) {
- throw new OpmlException ();
- }
-
- $catDAO = new CategoryDAO();
- $catDAO->checkDefault();
- $defCat = $catDAO->getDefault();
-
- $categories = array ();
- $feeds = array ();
-
- foreach ($opml->body->outline as $outline) {
- if (!isset ($outline['xmlUrl'])) {
- // Catégorie
- $title = '';
-
- if (isset ($outline['text'])) {
- $title = (string) $outline['text'];
- } elseif (isset ($outline['title'])) {
- $title = (string) $outline['title'];
- }
-
- if ($title) {
- // Permet d'éviter les soucis au niveau des id :
- // ceux-ci sont générés en fonction de la date,
- // un flux pourrait être dans une catégorie X avec l'id Y
- // 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
- $catDAO = new CategoryDAO ();
- $cat = $catDAO->searchByName ($title);
- if ($cat === false) {
- $cat = new Category ($title);
- }
- $categories[] = $cat;
-
- $feeds = array_merge ($feeds, getFeedsOutline ($outline, $cat->id ()));
- }
- } else {
- // Flux rss sans catégorie, on récupère l'ajoute dans la catégorie par défaut
- $feeds[] = getFeed ($outline, $defCat->id());
- }
+function timestamptodate ($t, $hour = true) {
+ $month = Minz_Translate::t (date('M', $t));
+ if ($hour) {
+ $date = Minz_Translate::t ('format_date_hour', $month);
+ } else {
+ $date = Minz_Translate::t ('format_date', $month);
}
- return array ($categories, $feeds);
+ return @date ($date, $t);
}
-/**
- * import all feeds of a given outline tag
- */
-function getFeedsOutline ($outline, $cat_id) {
- $feeds = array ();
-
- foreach ($outline->children () as $child) {
- if (isset ($child['xmlUrl'])) {
- $feeds[] = getFeed ($child, $cat_id);
+function html_only_entity_decode($text) {
+ static $htmlEntitiesOnly = null;
+ if ($htmlEntitiesOnly === null) {
+ if (version_compare(PHP_VERSION, '5.3.4') >= 0) {
+ $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
+ ));
} else {
- $feeds = array_merge(
- $feeds,
- getFeedsOutline ($child, $cat_id)
- );
+ $htmlEntitiesOnly = array_map('utf8_encode', array_flip(array_diff(
+ get_html_translation_table(HTML_ENTITIES, ENT_NOQUOTES), //Decode HTML entities
+ get_html_translation_table(HTML_SPECIALCHARS, ENT_NOQUOTES) //Preserve XML entities
+ )));
}
}
+ return strtr($text, $htmlEntitiesOnly);
+}
- return $feeds;
+function customSimplePie() {
+ $simplePie = new SimplePie();
+ $simplePie->set_useragent(Minz_Translate::t('freshrss') . '/' . FRESHRSS_VERSION . ' (' . PHP_OS . '; ' . FRESHRSS_WEBSITE . ') ' . SIMPLEPIE_NAME . '/' . SIMPLEPIE_VERSION);
+ $simplePie->set_cache_location(CACHE_PATH);
+ $simplePie->set_cache_duration(1500);
+ $simplePie->strip_htmltags(array(
+ 'base', 'blink', 'body', 'doctype', 'embed',
+ 'font', 'form', 'frame', 'frameset', 'html',
+ 'link', 'input', 'marquee', 'meta', 'noscript',
+ 'object', 'param', 'plaintext', 'script', 'style',
+ ));
+ $simplePie->strip_attributes(array_merge($simplePie->strip_attributes, array(
+ 'autoplay', 'onload', 'onunload', 'onclick', 'ondblclick', 'onmousedown', 'onmouseup',
+ 'onmouseover', 'onmousemove', 'onmouseout', 'onfocus', 'onblur',
+ 'onkeypress', 'onkeydown', 'onkeyup', 'onselect', 'onchange', 'seamless')));
+ $simplePie->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'),
+ ));
+ $simplePie->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',
+ ),
+ ));
+ return $simplePie;
}
-function getFeed ($outline, $cat_id) {
- $url = (string) $outline['xmlUrl'];
- $title = '';
- if (isset ($outline['text'])) {
- $title = (string) $outline['text'];
- } elseif (isset ($outline['title'])) {
- $title = (string) $outline['title'];
+function sanitizeHTML($data, $base = '') {
+ static $simplePie = null;
+ if ($simplePie == null) {
+ $simplePie = customSimplePie();
+ $simplePie->init();
}
- $feed = new Feed ($url);
- $feed->_category ($cat_id);
- $feed->_name ($title);
- return $feed;
+ return html_only_entity_decode($simplePie->sanitize->sanitize($data, SIMPLEPIE_CONSTRUCT_HTML, $base));
}
-
/* permet de récupérer le contenu d'un article pour un flux qui n'est pas complet */
function get_content_by_parsing ($url, $path) {
+ require_once (LIB_PATH . '/lib_phpQuery.php');
+
+ syslog(LOG_INFO, 'FreshRSS GET ' . $url);
$html = file_get_contents ($url);
if ($html) {
$doc = phpQuery::newDocument ($html);
$content = $doc->find ($path);
- $content->find ('*')->removeAttr ('style')
- ->removeAttr ('id')
- ->removeAttr ('class')
- ->removeAttr ('onload')
- ->removeAttr ('target');
- $content->removeAttr ('style')
- ->removeAttr ('id')
- ->removeAttr ('class')
- ->removeAttr ('onload')
- ->removeAttr ('target');
- return $content->__toString ();
+ return sanitizeHTML($content->__toString(), $url);
} else {
throw new Exception ();
}
}
-/* Télécharge le favicon d'un site, le place sur le serveur et retourne l'URL */
-function dowload_favicon ($website, $id) {
- $url = 'http://g.etfv.co/' . $website;
- $favicons_dir = PUBLIC_PATH . '/data/favicons';
- $dest = $favicons_dir . '/' . $id . '.ico';
- $favicon_url = '/data/favicons/' . $id . '.ico';
-
- if (!is_dir ($favicons_dir)) {
- if (!mkdir ($favicons_dir, 0755, true)) {
- return $url;
- }
- }
-
- if (!file_exists ($dest)) {
- $c = curl_init ($url);
- curl_setopt ($c, CURLOPT_HEADER, false);
- curl_setopt ($c, CURLOPT_RETURNTRANSFER, true);
- curl_setopt ($c, CURLOPT_BINARYTRANSFER, true);
- $imgRaw = curl_exec ($c);
-
- if (curl_getinfo ($c, CURLINFO_HTTP_CODE) == 200) {
- $file = fopen ($dest, 'w');
- if ($file === false) {
- return $url;
- }
-
- fwrite ($file, $imgRaw);
- fclose ($file);
- } else {
- return $url;
- }
-
- curl_close ($c);
- }
-
- return $favicon_url;
-}
-
/**
* Add support of image lazy loading
* Move content from src attribute to data-original
@@ -214,8 +189,47 @@ function dowload_favicon ($website, $id) {
*/
function lazyimg($content) {
return preg_replace(
- '/<img([^<]+)src=([\'"])([^"\']*)([\'"])([^<]*)>/i',
- '<img$1src="' . Url::display('/data/grey.gif') . '" data-original="$3"$5>',
+ '/<img([^>]+?)src=[\'"]([^"\']+)[\'"]([^>]*)>/i',
+ '<img$1src="' . Minz_Url::display('/themes/icons/grey.gif') . '" data-original="$2"$3>',
$content
);
}
+
+function lazyIframe($content) {
+ return preg_replace(
+ '/<iframe([^>]+?)src=[\'"]([^"\']+)[\'"]([^>]*)>/i',
+ '<iframe$1src="about:blank" data-original="$2"$3>',
+ $content
+ );
+}
+
+function uTimeString() {
+ $t = @gettimeofday();
+ return $t['sec'] . str_pad($t['usec'], 6, '0');
+}
+
+function uSecString() {
+ $t = @gettimeofday();
+ return str_pad($t['usec'], 6, '0');
+}
+
+function invalidateHttpCache() {
+ touch(LOG_PATH . '/' . Minz_Session::param('currentUser', '_') . '.log');
+ Minz_Session::_param('touch', uTimeString());
+}
+
+function usernameFromPath($userPath) {
+ if (preg_match('%/([a-z0-9]{1,16})_user\.php$%', $userPath, $matches)) {
+ return $matches[1];
+ } else {
+ return '';
+ }
+}
+
+function listUsers() {
+ return array_map('usernameFromPath', glob(DATA_PATH . '/*_user.php'));
+}
+
+function httpAuthUser() {
+ return isset($_SERVER['REMOTE_USER']) ? $_SERVER['REMOTE_USER'] : '';
+}
diff --git a/lib/minz/Configuration.php b/lib/minz/Configuration.php
deleted file mode 100755
index b296ec378..000000000
--- a/lib/minz/Configuration.php
+++ /dev/null
@@ -1,250 +0,0 @@
-<?php
-/**
- * MINZ - Copyright 2011 Marien Fressinaud
- * Sous licence AGPL3 <http://www.gnu.org/licenses/>
-*/
-
-/**
- * La classe Configuration permet de gérer la configuration de l'application
- */
-class Configuration {
- const CONF_PATH_NAME = '/configuration/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 = 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 $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 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;
- }
-
- /**
- * Initialise les variables de configuration
- * @exception FileNotExistException si le CONF_PATH_NAME n'existe pas
- * @exception BadConfigurationException si CONF_PATH_NAME mal formaté
- */
- public static function init () {
- try {
- self::parseFile ();
- self::setReporting ();
- } catch (FileNotExistException $e) {
- throw $e;
- } catch (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é
- */
- private static function parseFile () {
- if (!file_exists (APP_PATH . self::CONF_PATH_NAME)) {
- throw new FileNotExistException (
- APP_PATH . self::CONF_PATH_NAME,
- MinzException::ERROR
- );
- }
-
- $ini_array = parse_ini_file (
- APP_PATH . self::CONF_PATH_NAME,
- true
- );
-
- if (!$ini_array) {
- throw new PermissionDeniedException (
- APP_PATH . self::CONF_PATH_NAME,
- MinzException::ERROR
- );
- }
-
- // [general] est obligatoire
- if (!isset ($ini_array['general'])) {
- throw new BadConfigurationException (
- '[general]',
- MinzException::ERROR
- );
- }
- $general = $ini_array['general'];
-
-
- // sel_application est obligatoire
- if (!isset ($general['sel_application'])) {
- throw new BadConfigurationException (
- 'sel_application',
- MinzException::ERROR
- );
- }
- self::$sel_application = $general['sel_application'];
-
- if (isset ($general['environment'])) {
- switch ($general['environment']) {
- case 'silent':
- self::$environment = Configuration::SILENT;
- break;
- case 'development':
- self::$environment = Configuration::DEVELOPMENT;
- break;
- case 'production':
- self::$environment = Configuration::PRODUCTION;
- break;
- default:
- throw new BadConfigurationException (
- 'environment',
- MinzException::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',
- MinzException::ERROR
- );
- }
- }
- if (isset ($general['delay_cache'])) {
- self::$delay_cache = $general['delay_cache'];
- }
-
- // Base de données
- $db = false;
- if (isset ($ini_array['db'])) {
- $db = $ini_array['db'];
- }
- if ($db) {
- if (!isset ($db['host'])) {
- throw new BadConfigurationException (
- 'host',
- MinzException::ERROR
- );
- }
- if (!isset ($db['user'])) {
- throw new BadConfigurationException (
- 'user',
- MinzException::ERROR
- );
- }
- if (!isset ($db['password'])) {
- throw new BadConfigurationException (
- 'password',
- MinzException::ERROR
- );
- }
- if (!isset ($db['base'])) {
- throw new BadConfigurationException (
- 'base',
- MinzException::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/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 @@
-<?php
-/**
- * MINZ - Copyright 2011 Marien Fressinaud
- * Sous licence AGPL3 <http://www.gnu.org/licenses/>
-*/
-
-/**
- * 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 ('<?php');
- $this->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_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 @@
-<?php
-/**
- * MINZ - Copyright 2011 Marien Fressinaud
- * Sous licence AGPL3 <http://www.gnu.org/licenses/>
-*/
-
-/**
- * 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 @@
-<?php
-
-class MinzException extends Exception {
- const ERROR = 0;
- const WARNING = 10;
- const NOTICE = 20;
-
- public function __construct ($message, $code = self::ERROR) {
- if ($code != MinzException::ERROR
- && $code != MinzException::WARNING
- && $code != MinzException::NOTICE) {
- $code = MinzException::ERROR;
- }
-
- parent::__construct ($message, $code);
- }
-}
-
-class PermissionDeniedException extends MinzException {
- public function __construct ($file_name, $code = self::ERROR) {
- $message = 'Permission is denied for `' . $file_name.'`';
-
- parent::__construct ($message, $code);
- }
-}
-class FileNotExistException extends MinzException {
- public function __construct ($file_name, $code = self::ERROR) {
- $message = 'File doesn\'t exist : `' . $file_name.'`';
-
- parent::__construct ($message, $code);
- }
-}
-class BadConfigurationException extends MinzException {
- public function __construct ($part_missing, $code = self::ERROR) {
- $message = '`' . $part_missing
- . '` in the configuration file is missing or is misconfigured';
-
- parent::__construct ($message, $code);
- }
-}
-class ControllerNotExistException extends MinzException {
- public function __construct ($controller_name, $code = self::ERROR) {
- $message = 'Controller `' . $controller_name
- . '` doesn\'t exist';
-
- parent::__construct ($message, $code);
- }
-}
-class ControllerNotActionControllerException extends MinzException {
- public function __construct ($controller_name, $code = self::ERROR) {
- $message = 'Controller `' . $controller_name
- . '` isn\'t instance of ActionController';
-
- parent::__construct ($message, $code);
- }
-}
-class ActionException extends MinzException {
- public function __construct ($controller_name, $action_name, $code = self::ERROR) {
- $message = '`' . $action_name . '` cannot be invoked on `'
- . $controller_name . '`';
-
- parent::__construct ($message, $code);
- }
-}
-class RouteNotFoundException extends MinzException {
- private $route;
-
- public function __construct ($route, $code = self::ERROR) {
- $this->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/lib/password_compat.php b/lib/password_compat.php
new file mode 100644
index 000000000..e8ec02885
--- /dev/null
+++ b/lib/password_compat.php
@@ -0,0 +1,279 @@
+<?php
+/**
+ * A Compatibility library with PHP 5.5's simplified password hashing API.
+ *
+ * @author Anthony Ferrara <ircmaxell@php.net>
+ * @license http://www.opensource.org/licenses/mit-license.html MIT License
+ * @copyright 2012 The Authors
+ */
+
+namespace {
+
+if (!defined('PASSWORD_DEFAULT')) {
+
+ define('PASSWORD_BCRYPT', 1);
+ define('PASSWORD_DEFAULT', PASSWORD_BCRYPT);
+
+ /**
+ * Hash the password using the specified algorithm
+ *
+ * @param string $password The password to hash
+ * @param int $algo The algorithm to use (Defined by PASSWORD_* constants)
+ * @param array $options The options for the algorithm to use
+ *
+ * @return string|false The hashed password, or false on error.
+ */
+ function password_hash($password, $algo, array $options = array()) {
+ if (!function_exists('crypt')) {
+ trigger_error("Crypt must be loaded for password_hash to function", E_USER_WARNING);
+ return null;
+ }
+ if (!is_string($password)) {
+ trigger_error("password_hash(): Password must be a string", E_USER_WARNING);
+ return null;
+ }
+ if (!is_int($algo)) {
+ trigger_error("password_hash() expects parameter 2 to be long, " . gettype($algo) . " given", E_USER_WARNING);
+ return null;
+ }
+ $resultLength = 0;
+ switch ($algo) {
+ case PASSWORD_BCRYPT:
+ // Note that this is a C constant, but not exposed to PHP, so we don't define it here.
+ $cost = 10;
+ if (isset($options['cost'])) {
+ $cost = $options['cost'];
+ if ($cost < 4 || $cost > 31) {
+ trigger_error(sprintf("password_hash(): Invalid bcrypt cost parameter specified: %d", $cost), E_USER_WARNING);
+ return null;
+ }
+ }
+ // The length of salt to generate
+ $raw_salt_len = 16;
+ // The length required in the final serialization
+ $required_salt_len = 22;
+ $hash_format = sprintf("$2y$%02d$", $cost);
+ // The expected length of the final crypt() output
+ $resultLength = 60;
+ break;
+ default:
+ trigger_error(sprintf("password_hash(): Unknown password hashing algorithm: %s", $algo), E_USER_WARNING);
+ return null;
+ }
+ $salt_requires_encoding = false;
+ if (isset($options['salt'])) {
+ switch (gettype($options['salt'])) {
+ case 'NULL':
+ case 'boolean':
+ case 'integer':
+ case 'double':
+ case 'string':
+ $salt = (string) $options['salt'];
+ break;
+ case 'object':
+ if (method_exists($options['salt'], '__tostring')) {
+ $salt = (string) $options['salt'];
+ break;
+ }
+ case 'array':
+ case 'resource':
+ default:
+ trigger_error('password_hash(): Non-string salt parameter supplied', E_USER_WARNING);
+ return null;
+ }
+ if (PasswordCompat\binary\_strlen($salt) < $required_salt_len) {
+ trigger_error(sprintf("password_hash(): Provided salt is too short: %d expecting %d", PasswordCompat\binary\_strlen($salt), $required_salt_len), E_USER_WARNING);
+ return null;
+ } elseif (0 == preg_match('#^[a-zA-Z0-9./]+$#D', $salt)) {
+ $salt_requires_encoding = true;
+ }
+ } else {
+ $buffer = '';
+ $buffer_valid = false;
+ if (function_exists('mcrypt_create_iv') && !defined('PHALANGER')) {
+ $buffer = mcrypt_create_iv($raw_salt_len, MCRYPT_DEV_URANDOM);
+ if ($buffer) {
+ $buffer_valid = true;
+ }
+ }
+ if (!$buffer_valid && function_exists('openssl_random_pseudo_bytes')) {
+ $buffer = openssl_random_pseudo_bytes($raw_salt_len);
+ if ($buffer) {
+ $buffer_valid = true;
+ }
+ }
+ if (!$buffer_valid && @is_readable('/dev/urandom')) {
+ $f = fopen('/dev/urandom', 'r');
+ $read = PasswordCompat\binary\_strlen($buffer);
+ while ($read < $raw_salt_len) {
+ $buffer .= fread($f, $raw_salt_len - $read);
+ $read = PasswordCompat\binary\_strlen($buffer);
+ }
+ fclose($f);
+ if ($read >= $raw_salt_len) {
+ $buffer_valid = true;
+ }
+ }
+ if (!$buffer_valid || PasswordCompat\binary\_strlen($buffer) < $raw_salt_len) {
+ $bl = PasswordCompat\binary\_strlen($buffer);
+ for ($i = 0; $i < $raw_salt_len; $i++) {
+ if ($i < $bl) {
+ $buffer[$i] = $buffer[$i] ^ chr(mt_rand(0, 255));
+ } else {
+ $buffer .= chr(mt_rand(0, 255));
+ }
+ }
+ }
+ $salt = $buffer;
+ $salt_requires_encoding = true;
+ }
+ if ($salt_requires_encoding) {
+ // encode string with the Base64 variant used by crypt
+ $base64_digits =
+ 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
+ $bcrypt64_digits =
+ './ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
+
+ $base64_string = base64_encode($salt);
+ $salt = strtr(rtrim($base64_string, '='), $base64_digits, $bcrypt64_digits);
+ }
+ $salt = PasswordCompat\binary\_substr($salt, 0, $required_salt_len);
+
+ $hash = $hash_format . $salt;
+
+ $ret = crypt($password, $hash);
+
+ if (!is_string($ret) || PasswordCompat\binary\_strlen($ret) != $resultLength) {
+ return false;
+ }
+
+ return $ret;
+ }
+
+ /**
+ * Get information about the password hash. Returns an array of the information
+ * that was used to generate the password hash.
+ *
+ * array(
+ * 'algo' => 1,
+ * 'algoName' => 'bcrypt',
+ * 'options' => array(
+ * 'cost' => 10,
+ * ),
+ * )
+ *
+ * @param string $hash The password hash to extract info from
+ *
+ * @return array The array of information about the hash.
+ */
+ function password_get_info($hash) {
+ $return = array(
+ 'algo' => 0,
+ 'algoName' => 'unknown',
+ 'options' => array(),
+ );
+ if (PasswordCompat\binary\_substr($hash, 0, 4) == '$2y$' && PasswordCompat\binary\_strlen($hash) == 60) {
+ $return['algo'] = PASSWORD_BCRYPT;
+ $return['algoName'] = 'bcrypt';
+ list($cost) = sscanf($hash, "$2y$%d$");
+ $return['options']['cost'] = $cost;
+ }
+ return $return;
+ }
+
+ /**
+ * Determine if the password hash needs to be rehashed according to the options provided
+ *
+ * If the answer is true, after validating the password using password_verify, rehash it.
+ *
+ * @param string $hash The hash to test
+ * @param int $algo The algorithm used for new password hashes
+ * @param array $options The options array passed to password_hash
+ *
+ * @return boolean True if the password needs to be rehashed.
+ */
+ function password_needs_rehash($hash, $algo, array $options = array()) {
+ $info = password_get_info($hash);
+ if ($info['algo'] != $algo) {
+ return true;
+ }
+ switch ($algo) {
+ case PASSWORD_BCRYPT:
+ $cost = isset($options['cost']) ? $options['cost'] : 10;
+ if ($cost != $info['options']['cost']) {
+ return true;
+ }
+ break;
+ }
+ return false;
+ }
+
+ /**
+ * Verify a password against a hash using a timing attack resistant approach
+ *
+ * @param string $password The password to verify
+ * @param string $hash The hash to verify against
+ *
+ * @return boolean If the password matches the hash
+ */
+ function password_verify($password, $hash) {
+ if (!function_exists('crypt')) {
+ trigger_error("Crypt must be loaded for password_verify to function", E_USER_WARNING);
+ return false;
+ }
+ $ret = crypt($password, $hash);
+ if (!is_string($ret) || PasswordCompat\binary\_strlen($ret) != PasswordCompat\binary\_strlen($hash) || PasswordCompat\binary\_strlen($ret) <= 13) {
+ return false;
+ }
+
+ $status = 0;
+ for ($i = 0; $i < PasswordCompat\binary\_strlen($ret); $i++) {
+ $status |= (ord($ret[$i]) ^ ord($hash[$i]));
+ }
+
+ return $status === 0;
+ }
+}
+
+}
+
+namespace PasswordCompat\binary {
+ /**
+ * Count the number of bytes in a string
+ *
+ * We cannot simply use strlen() for this, because it might be overwritten by the mbstring extension.
+ * In this case, strlen() will count the number of *characters* based on the internal encoding. A
+ * sequence of bytes might be regarded as a single multibyte character.
+ *
+ * @param string $binary_string The input string
+ *
+ * @internal
+ * @return int The number of bytes
+ */
+ function _strlen($binary_string) {
+ if (function_exists('mb_strlen')) {
+ return mb_strlen($binary_string, '8bit');
+ }
+ return strlen($binary_string);
+ }
+
+ /**
+ * Get a substring based on byte limits
+ *
+ * @see _strlen()
+ *
+ * @param string $binary_string The input string
+ * @param int $start
+ * @param int $length
+ *
+ * @internal
+ * @return string The substring
+ */
+ function _substr($binary_string, $start, $length) {
+ if (function_exists('mb_substr')) {
+ return mb_substr($binary_string, $start, $length, '8bit');
+ }
+ return substr($binary_string, $start, $length);
+ }
+
+}
diff --git a/log/.gitignore b/log/.gitignore
deleted file mode 100644
index 72e8ffc0d..000000000
--- a/log/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-*
diff --git a/public/.htaccess b/p/.htaccess
index 8653826f8..2b1e27a88 100644
--- a/public/.htaccess
+++ b/p/.htaccess
@@ -10,13 +10,13 @@ AddDefaultCharset UTF-8
AddType application/font-woff .woff
AddCharset UTF-8 .css
+ AddCharset UTF-8 .html
AddCharset UTF-8 .js
- AddCharset UTF-8 .map
AddCharset UTF-8 .svg
</IfModule>
<IfModule mod_deflate.c>
- AddOutputFilterByType DEFLATE application/javascript application/json image/svg+xml text/css text/javascript
+ AddOutputFilterByType DEFLATE application/javascript application/json application/xhtml+xml image/svg+xml text/css text/html text/javascript
</IfModule>
<IfModule mod_expires.c>
@@ -24,11 +24,13 @@ AddDefaultCharset UTF-8
ExpiresByType application/font-woff "access plus 1 month"
ExpiresByType application/javascript "access plus 1 month"
ExpiresByType application/json "access plus 1 month"
+ ExpiresByType application/xhtml+xml "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 year"
+ ExpiresByType image/x-icon "access plus 1 month"
ExpiresByType text/css "access plus 1 month"
+ ExpiresByType text/html "access plus 1 month"
ExpiresByType text/javascript "access plus 1 month"
<FilesMatch "\.php$">
ExpiresActive Off
@@ -36,13 +38,7 @@ AddDefaultCharset UTF-8
</IfModule>
<IfModule mod_headers.c>
- <FilesMatch "\.(css|js|ico|gif|png|woff)$">
+ <FilesMatch "\.(css|html|js|ico|gif|png|woff)$">
Header merge Cache-Control "public"
</FilesMatch>
</IfModule>
-
-<Files "favicon.ico">
- Order Deny,Allow
- Allow from all
- Satisfy Any
-</Files>
diff --git a/p/Web.config b/p/Web.config
new file mode 100644
index 000000000..2321c7613
--- /dev/null
+++ b/p/Web.config
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<configuration>
+ <system.web>
+ <httpRuntime executionTimeout="300" maxRequestLength="8192"/>
+ </system.web>
+ <system.webServer>
+ <defaultDocument>
+ <files>
+ <clear />
+ <add value="index.php" />
+ <add value="index.html" />
+ </files>
+ </defaultDocument>
+ <urlCompression doStaticCompression="true" doDynamicCompression="true"/>
+ <staticContent>
+ <clientCache cacheControlMode="UseMaxAge" cacheControlMaxAge="31.00:00:00" />
+ </staticContent>
+ <caching>
+ <profiles>
+ <add extension=".css" policy="CacheForTimePeriod" duration="31.00:00:00" location="Any" kernelCachePolicy="DontCache" />
+ <add extension=".gif" policy="CacheForTimePeriod" duration="31.00:00:00" location="Any" kernelCachePolicy="DontCache" />
+ <add extension=".html" policy="CacheForTimePeriod" duration="31.00:00:00" location="Any" kernelCachePolicy="DontCache" />
+ <add extension=".jpg" policy="CacheForTimePeriod" duration="31.00:00:00" location="Any" kernelCachePolicy="DontCache" />
+ <add extension=".js" policy="CacheForTimePeriod" duration="31.00:00:00" location="Any" kernelCachePolicy="DontCache" />
+ <add extension=".png" policy="CacheForTimePeriod" duration="31.00:00:00" location="Any" kernelCachePolicy="DontCache" />
+ <add extension=".svg" policy="CacheForTimePeriod" duration="31.00:00:00" location="Any" kernelCachePolicy="DontCache" />
+ <add extension=".woff" policy="CacheForTimePeriod" duration="31.00:00:00" location="Any" kernelCachePolicy="DontCache" />
+ </profiles>
+ </caching>
+ <!--<httpProtocol>
+ <customHeaders>
+ <add name="Cache-Control" value="public" />
+ </customHeaders>
+ </httpProtocol>-->
+ </system.webServer>
+</configuration>
diff --git a/p/f.php b/p/f.php
new file mode 100644
index 000000000..5db9ab213
--- /dev/null
+++ b/p/f.php
@@ -0,0 +1,64 @@
+<?php
+require('../constants.php');
+$favicons_dir = DATA_PATH . '/favicons/';
+
+/* Télécharge le favicon d'un site et le place sur le serveur */
+function download_favicon ($website, $dest) {
+ $ok = false;
+ $url = 'http://g.etfv.co/' . $website;
+
+ $c = curl_init ($url);
+ curl_setopt ($c, CURLOPT_HEADER, false);
+ curl_setopt ($c, CURLOPT_RETURNTRANSFER, true);
+ curl_setopt ($c, CURLOPT_BINARYTRANSFER, true);
+ $imgRaw = curl_exec ($c);
+
+ if (curl_getinfo ($c, CURLINFO_HTTP_CODE) == 200) {
+ $file = fopen ($dest, 'w');
+ if ($file !== false) {
+ fwrite ($file, $imgRaw);
+ fclose ($file);
+ $ok = true;
+ }
+ }
+ curl_close ($c);
+ if (!$ok) {
+ header('Location: ' . $url);
+ return false;
+ }
+ return true;
+}
+
+$id = isset($_SERVER['QUERY_STRING']) ? $_SERVER['QUERY_STRING'] : '0';
+
+if (!ctype_xdigit($id)) {
+ $id = '0';
+}
+
+$txt = $favicons_dir . $id . '.txt';
+$ico = $favicons_dir . $id . '.ico';
+
+$icoMTime = @filemtime($ico);
+$txtMTime = @filemtime($txt);
+
+if (($icoMTime == false) || ($txtMTime > $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..5d571cc82
--- /dev/null
+++ b/p/favicon.ico
Binary files differ
diff --git a/p/i/index.php b/p/i/index.php
new file mode 100755
index 000000000..187bbabe8
--- /dev/null
+++ b/p/i/index.php
@@ -0,0 +1,52 @@
+<?php
+# ***** BEGIN LICENSE BLOCK *****
+# MINZ - A free PHP 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 <http://www.gnu.org/licenses/>.
+#
+# ***** END LICENSE BLOCK *****
+
+if (file_exists ('install.php')) {
+ require('install.php');
+} else {
+ require('../../constants.php');
+ require(LIB_PATH . '/lib_rss.php'); //Includes class autoloader
+
+ session_cache_limiter('');
+ Minz_Session::init('FreshRSS');
+ Minz_Session::_param('keepAlive', 1); //For Persona
+
+ if (!file_exists(DATA_PATH . '/no-cache.txt')) {
+ require(LIB_PATH . '/http-conditional.php');
+ $currentUser = Minz_Session::param('currentUser', '');
+ $dateLastModification = $currentUser === '' ? time() : max(
+ @filemtime(LOG_PATH . '/' . $currentUser . '.log'),
+ @filemtime(DATA_PATH . '/config.php')
+ );
+ if (httpConditional($dateLastModification, 0, 0, false, false, true)) {
+ exit(); //No need to send anything
+ }
+ }
+
+ try {
+ $front_controller = new FreshRSS();
+ $front_controller->init ();
+ $front_controller->run ();
+ } catch (Exception $e) {
+ echo '### Fatal error! ###<br />', "\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..8002a45da
--- /dev/null
+++ b/p/i/install.php
@@ -0,0 +1,1081 @@
+<?php
+if (function_exists('opcache_reset')) {
+ opcache_reset();
+}
+
+require('../../constants.php');
+define('BCRYPT_COST', 9);
+
+include(LIB_PATH . '/lib_rss.php');
+
+session_name('FreshRSS');
+session_set_cookie_params(0, dirname(empty($_SERVER['REQUEST_URI']) ? '/' : dirname($_SERVER['REQUEST_URI'])), null, false, true);
+session_start();
+
+if (isset ($_GET['step'])) {
+ define ('STEP', $_GET['step']);
+} else {
+ define ('STEP', 1);
+}
+
+define('SQL_CREATE_DB', 'CREATE DATABASE IF NOT EXISTS %1$s DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;');
+
+include(APP_PATH . '/sql.php');
+
+//<updates>
+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_DROP_BACKUPv006', 'DROP TABLE IF EXISTS `%1$sentry006`, `%1$sfeed006`, `%1$scategory006`;');
+
+define('SQL_UPDATE_CACHED_VALUES', '
+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_UPDATE_HISTORYv007b', 'UPDATE `%1$sfeed` SET keep_history = CASE WHEN keep_history = 0 THEN -2 WHEN keep_history = 1 THEN -1 ELSE keep_history END;');
+
+define('SQL_GET_FEEDS', 'SELECT id, url, website FROM `%1$sfeed`;');
+//</updates>
+
+// 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['auth_type']) ||
+ empty ($_POST['default_user'])) {
+ return false;
+ }
+
+ $_SESSION['salt'] = sha1(uniqid(mt_rand(), true).implode('', stat(__FILE__)));
+ $_SESSION['title'] = 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'] = filter_var($_POST['mail_login'], FILTER_VALIDATE_EMAIL);
+ $_SESSION['default_user'] = substr(preg_replace('/[^a-zA-Z0-9]/', '', $_POST['default_user']), 0, 16);
+ $_SESSION['auth_type'] = $_POST['auth_type'];
+ if (!empty($_POST['passwordPlain'])) {
+ if (!function_exists('password_hash')) {
+ include_once(LIB_PATH . '/password_compat.php');
+ }
+ $passwordHash = password_hash($_POST['passwordPlain'], PASSWORD_BCRYPT, array('cost' => BCRYPT_COST));
+ $passwordHash = preg_replace('/^\$2[xy]\$/', '\$2a\$', $passwordHash); //Compatibility with bcrypt.js
+ $_SESSION['passwordHash'] = $passwordHash;
+ }
+
+ $token = '';
+ if ($_SESSION['mail_login']) {
+ $token = sha1($_SESSION['salt'] . $_SESSION['mail_login']);
+ }
+
+ $config_array = array (
+ 'language' => $_SESSION['language'],
+ 'theme' => $_SESSION['theme'],
+ 'old_entries' => $_SESSION['old_entries'],
+ 'mail_login' => $_SESSION['mail_login'],
+ 'passwordHash' => $_SESSION['passwordHash'],
+ 'token' => $token,
+ );
+
+ $configPath = DATA_PATH . '/' . $_SESSION['default_user'] . '_user.php';
+ @unlink($configPath); //To avoid access-rights problems
+ file_put_contents($configPath, "<?php\n return " . var_export($config_array, true) . ';');
+
+ if ($_SESSION['mail_login'] != '') {
+ $personaFile = DATA_PATH . '/persona/' . $_SESSION['mail_login'] . '.txt';
+ @unlink($personaFile);
+ file_put_contents($personaFile, $_SESSION['default_user']);
+ }
+
+ 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'] = 'Missing parameters!';
+ }
+
+ $_SESSION['bd_type'] = isset ($_POST['type']) ? $_POST['type'] : 'mysql';
+ $_SESSION['bd_host'] = $_POST['host'];
+ $_SESSION['bd_user'] = $_POST['user'];
+ $_SESSION['bd_password'] = $_POST['pass'];
+ $_SESSION['bd_base'] = substr($_POST['base'], 0, 64);
+ $_SESSION['bd_prefix'] = substr($_POST['prefix'], 0, 16);
+ $_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,
+ 'salt' => $_SESSION['salt'],
+ 'base_url' => '',
+ 'title' => $_SESSION['title'],
+ 'default_user' => $_SESSION['default_user'],
+ 'auth_type' => $_SESSION['auth_type'],
+ 'allow_anonymous' => isset($_SESSION['allow_anonymous']) ? $_SESSION['allow_anonymous'] : false,
+ ),
+ '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'],
+ ),
+ );
+
+ @unlink(DATA_PATH . '/config.php'); //To avoid access-rights problems
+ file_put_contents(DATA_PATH . '/config.php', "<?php\n return " . var_export($ini_array, true) . ';');
+
+ if (file_exists(DATA_PATH . '/config.php') && file_exists(DATA_PATH . '/application.ini')) {
+ @unlink(DATA_PATH . '/application.ini'); //v0.6
+ }
+
+ $res = checkBD ();
+
+ if ($res) {
+ $_SESSION['bd_error'] = '';
+ header ('Location: index.php?step=4');
+ } elseif (empty($_SESSION['bd_error'])) {
+ $_SESSION['bd_error'] = 'Unknown error!';
+ }
+ }
+ 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_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 newPdo() {
+ 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;
+ }
+ return new PDO($str, $_SESSION['bd_user'], $_SESSION['bd_password'], $driver_options);
+}
+
+function postUpdate() {
+ $c = newPdo();
+
+ $sql = sprintf(SQL_UPDATE_HISTORYv007b, $_SESSION['bd_prefix_user']);
+ $stm = $c->prepare($sql);
+ $stm->execute();
+
+ $sql = sprintf(SQL_UPDATE_CACHED_VALUES, $_SESSION['bd_prefix_user']);
+ $stm = $c->prepare($sql);
+ $stm->execute();
+
+ //<favicons>
+ $sql = sprintf(SQL_GET_FEEDS, $_SESSION['bd_prefix_user']);
+ $stm = $c->prepare($sql);
+ $stm->execute();
+ $res = $stm->fetchAll(PDO::FETCH_ASSOC);
+ foreach ($res as $feed) {
+ if (empty($feed['url'])) {
+ continue;
+ }
+ $hash = hash('crc32b', $_SESSION['salt'] . $feed['url']);
+ @file_put_contents(DATA_PATH . '/favicons/' . $hash . '.txt',
+ empty($feed['website']) ? $feed['url'] : $feed['website']);
+ }
+ //</favicons>
+}
+
+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 {
+ $c = newPdo();
+ $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')) { //v0.6
+ $ini_array = parse_ini_file(DATA_PATH . '/application.ini', true);
+ $ini_array['general']['title'] = empty($ini_array['general']['title']) ? '' : stripslashes($ini_array['general']['title']);
+ } else {
+ $ini_array = null;
+ }
+
+ if ($ini_array) {
+ $ini_general = isset($ini_array['general']) ? $ini_array['general'] : null;
+ if ($ini_general) {
+ $keys = array('environment', 'salt', 'title', 'default_user', 'allow_anonymous', 'auth_type');
+ 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
+ if (empty($_SESSION['auth_type'])) {
+ $_SESSION['auth_type'] = empty($userConfig['mail_login']) ? 'none' : 'persona';
+ }
+ if (!isset($_SESSION['allow_anonymous'])) {
+ $_SESSION['allow_anonymous'] = empty($userConfig['anon_access']) ? false : ($userConfig['anon_access'] === 'yes');
+ }
+ } else {
+ $userConfig = array();
+ }
+ if (empty($_SESSION['auth_type'])) { //v0.7b
+ $_SESSION['auth_type'] = '';
+ }
+
+ $keys = array('language', 'theme', 'old_entries', 'mail_login', 'passwordHash');
+ 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']]);
+
+ if (empty($_SESSION['passwordHash'])) { //v0.7b
+ $_SESSION['passwordHash'] = '';
+ }
+ if (empty($_SESSION['theme'])) {
+ $_SESSION['theme'] = 'Origine';
+ } else {
+ switch (strtolower($_SESSION['theme'])) {
+ case 'default': //v0.7b
+ $_SESSION['theme'] = 'Origine';
+ break;
+ case 'flat-design': //v0.7b
+ $_SESSION['theme'] = 'Flat';
+ break;
+ case 'default_dark': //v0.7b
+ $_SESSION['theme'] = 'Dark';
+ break;
+ }
+ }
+
+ 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');
+ $pcre = extension_loaded ('pcre');
+ $ctype = extension_loaded ('ctype');
+ $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');
+ $persona = is_writable (DATA_PATH . '/persona');
+
+ return array (
+ 'php' => $php ? 'ok' : 'ko',
+ 'minz' => $minz ? 'ok' : 'ko',
+ 'curl' => $curl ? 'ok' : 'ko',
+ 'pdo-mysql' => $pdo ? 'ok' : 'ko',
+ 'pcre' => $pcre ? 'ok' : 'ko',
+ 'ctype' => $ctype ? 'ok' : 'ko',
+ 'dom' => $dom ? 'ok' : 'ko',
+ 'data' => $data ? 'ok' : 'ko',
+ 'cache' => $cache ? 'ok' : 'ko',
+ 'log' => $log ? 'ok' : 'ko',
+ 'favicons' => $favicons ? 'ok' : 'ko',
+ 'persona' => $persona ? 'ok' : 'ko',
+ 'all' => $php && $minz && $curl && $pdo && $pcre && $ctype && $dom && $data && $cache && $log && $favicons && $persona ? 'ok' : 'ko'
+ );
+}
+
+function checkStep2 () {
+ $conf = !empty($_SESSION['salt']) &&
+ !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 = is_writable(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 = is_writable(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 = empty($_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 () {
+ $ok = false;
+
+ try {
+ $str = '';
+ $driver_options = null;
+ switch ($_SESSION['bd_type']) {
+ case 'mysql':
+ $driver_options = array(
+ PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8'
+ );
+
+ try { // 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);
+ } catch (PDOException $e) {
+ }
+
+ // 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_CREATE_TABLES, $_SESSION['bd_prefix_user']);
+ $stm = $c->prepare($sql, array(PDO::ATTR_EMULATE_PREPARES => true));
+ $values = array(
+ 'catName' => _t('default_category'),
+ );
+ $ok = $stm->execute($values);
+ } catch (PDOException $e) {
+ $ok = false;
+ $_SESSION['bd_error'] = $e->getMessage();
+ }
+
+ if (!$ok) {
+ @unlink(DATA_PATH . '/config.php');
+ }
+
+ return $ok;
+}
+
+/*** AFFICHAGE ***/
+function printStep0 () {
+ global $actual;
+?>
+ <?php $s0 = checkStep0 (); if ($s0['all'] == 'ok') { ?>
+ <p class="alert alert-success"><span class="alert-head"><?php echo _t ('ok'); ?></span> <?php echo _t ('language_defined'); ?></p>
+ <?php } ?>
+
+ <form action="index.php?step=0" method="post">
+ <legend><?php echo _t ('choose_language'); ?></legend>
+ <div class="form-group">
+ <label class="group-name" for="language"><?php echo _t ('language'); ?></label>
+ <div class="group-controls">
+ <select name="language" id="language">
+ <?php $languages = availableLanguages (); ?>
+ <?php foreach ($languages as $short => $lib) { ?>
+ <option value="<?php echo $short; ?>"<?php echo $actual == $short ? ' selected="selected"' : ''; ?>><?php echo $lib; ?></option>
+ <?php } ?>
+ </select>
+ </div>
+ </div>
+
+ <div class="form-group form-actions">
+ <div class="group-controls">
+ <button type="submit" class="btn btn-important"><?php echo _t ('save'); ?></button>
+ <button type="reset" class="btn"><?php echo _t ('cancel'); ?></button>
+ <?php if ($s0['all'] == 'ok') { ?>
+ <a class="btn btn-important next-step" href="?step=1"><?php echo _t ('next_step'); ?></a>
+ <?php } ?>
+ </div>
+ </div>
+ </form>
+<?php
+}
+
+function printStep1 () {
+ $res = checkStep1 ();
+?>
+ <noscript><p class="alert alert-warn"><span class="alert-head"><?php echo _t ('attention'); ?></span> <?php echo _t ('javascript_is_better'); ?></p></noscript>
+
+ <?php if ($res['php'] == 'ok') { ?>
+ <p class="alert alert-success"><span class="alert-head"><?php echo _t ('ok'); ?></span> <?php echo _t ('php_is_ok', PHP_VERSION); ?></p>
+ <?php } else { ?>
+ <p class="alert alert-error"><span class="alert-head"><?php echo _t ('damn'); ?></span> <?php echo _t ('php_is_nok', PHP_VERSION, '5.1.0'); ?></p>
+ <?php } ?>
+
+ <?php if ($res['minz'] == 'ok') { ?>
+ <p class="alert alert-success"><span class="alert-head"><?php echo _t ('ok'); ?></span> <?php echo _t ('minz_is_ok'); ?></p>
+ <?php } else { ?>
+ <p class="alert alert-error"><span class="alert-head"><?php echo _t ('damn'); ?></span> <?php echo _t ('minz_is_nok', LIB_PATH . '/Minz'); ?></p>
+ <?php } ?>
+
+ <?php if ($res['pdo-mysql'] == 'ok') { ?>
+ <p class="alert alert-success"><span class="alert-head"><?php echo _t ('ok'); ?></span> <?php echo _t ('pdomysql_is_ok'); ?></p>
+ <?php } else { ?>
+ <p class="alert alert-error"><span class="alert-head"><?php echo _t ('damn'); ?></span> <?php echo _t ('pdomysql_is_nok'); ?></p>
+ <?php } ?>
+
+ <?php if ($res['curl'] == 'ok') { ?>
+ <?php $version = curl_version(); ?>
+ <p class="alert alert-success"><span class="alert-head"><?php echo _t ('ok'); ?></span> <?php echo _t ('curl_is_ok', $version['version']); ?></p>
+ <?php } else { ?>
+ <p class="alert alert-error"><span class="alert-head"><?php echo _t ('damn'); ?></span> <?php echo _t ('curl_is_nok'); ?></p>
+ <?php } ?>
+
+ <?php if ($res['pcre'] == 'ok') { ?>
+ <p class="alert alert-success"><span class="alert-head"><?php echo _t ('ok'); ?></span> <?php echo _t ('pcre_is_ok'); ?></p>
+ <?php } else { ?>
+ <p class="alert alert-error"><span class="alert-head"><?php echo _t ('damn'); ?></span> <?php echo _t ('pcre_is_nok'); ?></p>
+ <?php } ?>
+
+ <?php if ($res['ctype'] == 'ok') { ?>
+ <p class="alert alert-success"><span class="alert-head"><?php echo _t ('ok'); ?></span> <?php echo _t ('ctype_is_ok'); ?></p>
+ <?php } else { ?>
+ <p class="alert alert-error"><span class="alert-head"><?php echo _t ('damn'); ?></span> <?php echo _t ('ctype_is_nok'); ?></p>
+ <?php } ?>
+
+ <?php if ($res['dom'] == 'ok') { ?>
+ <p class="alert alert-success"><span class="alert-head"><?php echo _t ('ok'); ?></span> <?php echo _t ('dom_is_ok'); ?></p>
+ <?php } else { ?>
+ <p class="alert alert-error"><span class="alert-head"><?php echo _t ('damn'); ?></span> <?php echo _t ('dom_is_nok'); ?></p>
+ <?php } ?>
+
+ <?php if ($res['data'] == 'ok') { ?>
+ <p class="alert alert-success"><span class="alert-head"><?php echo _t ('ok'); ?></span> <?php echo _t ('data_is_ok'); ?></p>
+ <?php } else { ?>
+ <p class="alert alert-error"><span class="alert-head"><?php echo _t ('damn'); ?></span> <?php echo _t ('file_is_nok', DATA_PATH); ?></p>
+ <?php } ?>
+
+ <?php if ($res['cache'] == 'ok') { ?>
+ <p class="alert alert-success"><span class="alert-head"><?php echo _t ('ok'); ?></span> <?php echo _t ('cache_is_ok'); ?></p>
+ <?php } else { ?>
+ <p class="alert alert-error"><span class="alert-head"><?php echo _t ('damn'); ?></span> <?php echo _t ('file_is_nok', CACHE_PATH); ?></p>
+ <?php } ?>
+
+ <?php if ($res['log'] == 'ok') { ?>
+ <p class="alert alert-success"><span class="alert-head"><?php echo _t ('ok'); ?></span> <?php echo _t ('log_is_ok'); ?></p>
+ <?php } else { ?>
+ <p class="alert alert-error"><span class="alert-head"><?php echo _t ('damn'); ?></span> <?php echo _t ('file_is_nok', LOG_PATH); ?></p>
+ <?php } ?>
+
+ <?php if ($res['favicons'] == 'ok') { ?>
+ <p class="alert alert-success"><span class="alert-head"><?php echo _t ('ok'); ?></span> <?php echo _t ('favicons_is_ok'); ?></p>
+ <?php } else { ?>
+ <p class="alert alert-error"><span class="alert-head"><?php echo _t ('damn'); ?></span> <?php echo _t ('file_is_nok', DATA_PATH . '/favicons'); ?></p>
+ <?php } ?>
+
+ <?php if ($res['persona'] == 'ok') { ?>
+ <p class="alert alert-success"><span class="alert-head"><?php echo _t ('ok'); ?></span> <?php echo _t ('persona_is_ok'); ?></p>
+ <?php } else { ?>
+ <p class="alert alert-error"><span class="alert-head"><?php echo _t ('damn'); ?></span> <?php echo _t ('file_is_nok', DATA_PATH . '/persona'); ?></p>
+ <?php } ?>
+
+ <?php if ($res['all'] == 'ok') { ?>
+ <a class="btn btn-important next-step" href="?step=2"><?php echo _t ('next_step'); ?></a>
+ <?php } else { ?>
+ <p class="alert alert-error"><?php echo _t ('fix_errors_before'); ?></p>
+ <?php } ?>
+<?php
+}
+
+function printStep2 () {
+?>
+ <?php $s2 = checkStep2 (); if ($s2['all'] == 'ok') { ?>
+ <p class="alert alert-success"><span class="alert-head"><?php echo _t ('ok'); ?></span> <?php echo _t ('general_conf_is_ok'); ?></p>
+ <?php } ?>
+
+ <form action="index.php?step=2" method="post">
+ <legend><?php echo _t ('general_configuration'); ?></legend>
+
+ <div class="form-group">
+ <label class="group-name" for="title"><?php echo _t ('title'); ?></label>
+ <div class="group-controls">
+ <input type="text" id="title" name="title" value="<?php echo isset ($_SESSION['title']) ? $_SESSION['title'] : _t ('freshrss'); ?>" />
+ </div>
+ </div>
+
+ <div class="form-group">
+ <label class="group-name" for="old_entries"><?php echo _t ('delete_articles_every'); ?></label>
+ <div class="group-controls">
+ <input type="number" id="old_entries" name="old_entries" required="required" min="1" max="1200" value="<?php echo isset ($_SESSION['old_entries']) ? $_SESSION['old_entries'] : '3'; ?>" /> <?php echo _t ('month'); ?>
+ </div>
+ </div>
+
+ <div class="form-group">
+ <label class="group-name" for="default_user"><?php echo _t ('default_user'); ?></label>
+ <div class="group-controls">
+ <input type="text" id="default_user" name="default_user" required="required" size="16" maxlength="16" pattern="[0-9a-zA-Z]{1,16}" value="<?php echo isset ($_SESSION['default_user']) ? $_SESSION['default_user'] : ''; ?>" placeholder="<?php echo httpAuthUser() == '' ? 'user1' : httpAuthUser(); ?>" />
+ </div>
+ </div>
+
+ <div class="form-group">
+ <label class="group-name" for="auth_type"><?php echo _t('auth_type'); ?></label>
+ <div class="group-controls">
+ <select id="auth_type" name="auth_type" required="required">
+ <?php if (!in_array($_SESSION['auth_type'], array('form', 'persona', 'http_auth', 'none'))) { ?>
+ <option selected="selected"></option>
+ <?php } ?>
+ <option value="form"<?php echo $_SESSION['auth_type'] === 'form' ? ' selected="selected"' : '', version_compare(PHP_VERSION, '5.3', '<') ? ' disabled="disabled"' : ''; ?>><?php echo _t('auth_form'); ?></option>
+ <option value="persona"<?php echo $_SESSION['auth_type'] === 'persona' ? ' selected="selected"' : ''; ?>><?php echo _t('auth_persona'); ?></option>
+ <option value="http_auth"<?php echo $_SESSION['auth_type'] === 'http_auth' ? ' selected="selected"' : '', httpAuthUser() == '' ? ' disabled="disabled"' : ''; ?>><?php echo _t('http_auth'); ?> (REMOTE_USER = '<?php echo httpAuthUser(); ?>')</option>
+ <option value="none"<?php echo $_SESSION['auth_type'] === 'none' ? ' selected="selected"' : ''; ?>><?php echo _t('auth_none'); ?></option>
+ </select>
+ </div>
+ </div>
+
+ <div class="form-group">
+ <label class="group-name" for="passwordPlain"><?php echo _t('password_form'); ?></label>
+ <div class="group-controls">
+ <input type="password" id="passwordPlain" name="passwordPlain" pattern=".{7,}" autocomplete="off" />
+ <noscript><b><?php echo _t('javascript_should_be_activated'); ?></b></noscript>
+ </div>
+ </div>
+
+ <div class="form-group">
+ <label class="group-name" for="mail_login"><?php echo _t ('persona_connection_email'); ?></label>
+ <div class="group-controls">
+ <input type="email" id="mail_login" name="mail_login" value="<?php echo isset ($_SESSION['mail_login']) ? $_SESSION['mail_login'] : ''; ?>" placeholder="alice@example.net" />
+ <noscript><b><?php echo _t ('javascript_should_be_activated'); ?></b></noscript>
+ </div>
+ </div>
+
+ <div class="form-group form-actions">
+ <div class="group-controls">
+ <button type="submit" class="btn btn-important"><?php echo _t ('save'); ?></button>
+ <button type="reset" class="btn"><?php echo _t ('cancel'); ?></button>
+ <?php if ($s2['all'] == 'ok') { ?>
+ <a class="btn btn-important next-step" href="?step=3"><?php echo _t ('next_step'); ?></a>
+ <?php } ?>
+ </div>
+ </div>
+ </form>
+<?php
+}
+
+function printStep3 () {
+?>
+ <?php $s3 = checkStep3 (); if ($s3['all'] == 'ok') { ?>
+ <p class="alert alert-success"><span class="alert-head"><?php echo _t ('ok'); ?></span> <?php echo _t ('bdd_conf_is_ok'); ?></p>
+ <?php } elseif ($s3['conn'] == 'ko') { ?>
+ <p class="alert alert-error"><span class="alert-head"><?php echo _t ('damn'); ?></span> <?php echo _t ('bdd_conf_is_ko'), (empty($_SESSION['bd_error']) ? '' : ' : ' . $_SESSION['bd_error']); ?></p>
+ <?php } ?>
+
+ <form action="index.php?step=3" method="post">
+ <legend><?php echo _t ('bdd_configuration'); ?></legend>
+ <div class="form-group">
+ <label class="group-name" for="type"><?php echo _t ('bdd_type'); ?></label>
+ <div class="group-controls">
+ <select name="type" id="type">
+ <option value="mysql"
+ <?php echo (isset($_SESSION['bd_type']) && $_SESSION['bd_type'] === 'mysql') ? 'selected="selected"' : ''; ?>>
+ MySQL
+ </option>
+ <!-- TODO : l'utilisation de SQLite n'est pas encore possible. Pour tester tout de même, décommentez ce bloc
+ <option value="sqlite"
+ <?php echo (isset($_SESSION['bd_type']) && $_SESSION['bd_type'] === 'sqlite') ? 'selected="selected"' : ''; ?>>
+ SQLite
+ </option>-->
+ </select>
+ </div>
+ </div>
+
+ <div class="form-group">
+ <label class="group-name" for="host"><?php echo _t ('host'); ?></label>
+ <div class="group-controls">
+ <input type="text" id="host" name="host" pattern="[0-9A-Za-z_.-]{1,64}" value="<?php echo isset ($_SESSION['bd_host']) ? $_SESSION['bd_host'] : 'localhost'; ?>" />
+ </div>
+ </div>
+
+ <div class="form-group">
+ <label class="group-name" for="user"><?php echo _t ('username'); ?></label>
+ <div class="group-controls">
+ <input type="text" id="user" name="user" maxlength="16" pattern="[0-9A-Za-z_]{1,16}" value="<?php echo isset ($_SESSION['bd_user']) ? $_SESSION['bd_user'] : ''; ?>" />
+ </div>
+ </div>
+
+ <div class="form-group">
+ <label class="group-name" for="pass"><?php echo _t ('password'); ?></label>
+ <div class="group-controls">
+ <input type="password" id="pass" name="pass" value="<?php echo isset ($_SESSION['bd_password']) ? $_SESSION['bd_password'] : ''; ?>" />
+ </div>
+ </div>
+
+ <div class="form-group">
+ <label class="group-name" for="base"><?php echo _t ('bdd'); ?></label>
+ <div class="group-controls">
+ <input type="text" id="base" name="base" maxlength="64" pattern="[0-9A-Za-z_]{1,64}" value="<?php echo isset ($_SESSION['bd_base']) ? $_SESSION['bd_base'] : ''; ?>" placeholder="freshrss" />
+ </div>
+ </div>
+
+ <div class="form-group">
+ <label class="group-name" for="prefix"><?php echo _t ('prefix'); ?></label>
+ <div class="group-controls">
+ <input type="text" id="prefix" name="prefix" maxlength="16" pattern="[0-9A-Za-z_]{1,16}" value="<?php echo isset ($_SESSION['bd_prefix']) ? $_SESSION['bd_prefix'] : 'freshrss_'; ?>" />
+ </div>
+ </div>
+
+ <div class="form-group form-actions">
+ <div class="group-controls">
+ <button type="submit" class="btn btn-important"><?php echo _t ('save'); ?></button>
+ <button type="reset" class="btn"><?php echo _t ('cancel'); ?></button>
+ <?php if ($s3['all'] == 'ok') { ?>
+ <a class="btn btn-important next-step" href="?step=4"><?php echo _t ('next_step'); ?></a>
+ <?php } ?>
+ </div>
+ </div>
+ </form>
+<?php
+}
+
+function printStep4 () {
+?>
+ <form action="index.php?step=4" method="post">
+ <legend><?php echo _t ('version_update'); ?></legend>
+
+ <?php if (updateDatabase(false)) { ?>
+ <p class="alert"><?php echo _t ('update_long'); ?></p>
+
+ <div class="form-group form-actions">
+ <div class="group-controls">
+ <input type="hidden" name="updateDatabase" value="1" />
+ <button type="submit" class="btn btn-important"><?php echo _t ('update_start'); ?></button>
+ </div>
+ </div>
+
+ <?php } else { ?>
+ <p class="alert"><?php echo _t ('update_end'); ?></p>
+
+ <div class="form-group form-actions">
+ <div class="group-controls">
+ <a class="btn btn-important next-step" href="?step=5"><?php echo _t ('next_step'); ?></a>
+ </div>
+ </div>
+ <?php } ?>
+ </form>
+<?php
+}
+
+function printStep5 () {
+?>
+ <p class="alert alert-success"><span class="alert-head"><?php echo _t ('congratulations'); ?></span> <?php echo _t ('installation_is_ok'); ?></p>
+ <a class="btn btn-important next-step" href="?step=6"><?php echo _t ('finish_installation'); ?></a>
+<?php
+}
+
+function printStep6 () {
+?>
+ <p class="alert alert-error"><span class="alert-head"><?php echo _t ('oops'); ?></span> <?php echo _t ('install_not_deleted', INDEX_PATH . '/install.php'); ?></p>
+<?php
+}
+
+checkStep ();
+
+initTranslate ();
+
+switch (STEP) {
+case 0:
+default:
+ saveLanguage ();
+ break;
+case 1:
+ break;
+case 2:
+ saveStep2 ();
+ break;
+case 3:
+ saveStep3 ();
+ break;
+case 4:
+ if (!empty($_POST['updateDatabase'])) {
+ updateDatabase(true);
+ }
+ break;
+case 5:
+ postUpdate();
+ break;
+case 6:
+ deleteInstall ();
+ break;
+}
+?>
+<!DOCTYPE html>
+<html lang="fr">
+ <head>
+ <meta charset="utf-8">
+ <meta name="viewport" content="initial-scale=1.0">
+ <title><?php echo _t ('freshrss_installation'); ?></title>
+ <link rel="stylesheet" type="text/css" media="all" href="../themes/Origine/global.css" />
+ <link rel="stylesheet" type="text/css" media="all" href="../themes/Origine/freshrss.css" />
+ </head>
+ <body>
+
+<div class="header">
+ <div class="item title">
+ <h1><a href="index.php"><?php echo _t ('freshrss'); ?></a></h1>
+ <h2><?php echo _t ('installation_step', STEP); ?></h2>
+ </div>
+</div>
+
+<div id="global">
+ <ul class="nav nav-list aside">
+ <li class="nav-header"><?php echo _t ('steps'); ?></li>
+ <li class="item<?php echo STEP == 0 ? ' active' : ''; ?>"><a href="?step=0"><?php echo _t ('language'); ?></a></li>
+ <li class="item<?php echo STEP == 1 ? ' active' : ''; ?>"><a href="?step=1"><?php echo _t ('checks'); ?></a></li>
+ <li class="item<?php echo STEP == 2 ? ' active' : ''; ?>"><a href="?step=2"><?php echo _t ('general_configuration'); ?></a></li>
+ <li class="item<?php echo STEP == 3 ? ' active' : ''; ?>"><a href="?step=3"><?php echo _t ('bdd_configuration'); ?></a></li>
+ <li class="item<?php echo STEP == 4 ? ' active' : ''; ?>"><a href="?step=4"><?php echo _t ('version_update'); ?></a></li>
+ <li class="item<?php echo STEP == 5 ? ' active' : ''; ?>"><a href="?step=5"><?php echo _t ('this_is_the_end'); ?></a></li>
+ </ul>
+
+ <div class="post">
+ <?php
+ switch (STEP) {
+ case 0:
+ default:
+ printStep0 ();
+ break;
+ case 1:
+ printStep1 ();
+ break;
+ case 2:
+ printStep2 ();
+ break;
+ case 3:
+ printStep3 ();
+ break;
+ case 4:
+ printStep4 ();
+ break;
+ case 5:
+ printStep5 ();
+ break;
+ case 6:
+ printStep6 ();
+ break;
+ }
+ ?>
+ </div>
+</div>
+ </body>
+</html>
diff --git a/p/index.html b/p/index.html
new file mode 100644
index 000000000..260f437bd
--- /dev/null
+++ b/p/index.html
@@ -0,0 +1,35 @@
+<!DOCTYPE html>
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-GB" lang="en-GB">
+<head>
+<meta charset="UTF-8" />
+<meta name="viewport" content="initial-scale=1.0" />
+<meta http-equiv="Refresh" content="0; url=i/" />
+<title>FreshRSS</title>
+<link rel="shortcut icon" type="image/x-icon" sizes="16x16 64x64" href="favicon.ico" />
+<link rel="icon msapplication-TileImage apple-touch-icon" type="image/png" sizes="256x256" href="themes/icons/favicon-256.png" />
+<meta name="msapplication-TileColor" content="#FFF" />
+<meta name="robots" content="noindex,nofollow" />
+<style>
+body {
+ font-family: sans-serif;
+ text-align: center;
+}
+h1 {
+ font-size: xx-large;
+ text-shadow: 1px -1px 0 #CCCCCC;
+}
+h1 a {
+ color: #0062BE;
+ text-decoration: none;
+}
+img {
+ border: 0;
+}
+</style>
+</head>
+
+<body>
+<h1><a href="i/">FreshRSS</a></h1>
+<p><a href="i/"><img class="logo" width="25%" src="themes/icons/icon.svg" alt="⊚" /></a></p>
+</body>
+</html>
diff --git a/public/robots.txt b/p/robots.txt
index 1f53798bb..1f53798bb 100644
--- a/public/robots.txt
+++ b/p/robots.txt
diff --git a/p/scripts/bcrypt.min.js b/p/scripts/bcrypt.min.js
new file mode 100644
index 000000000..6892caddc
--- /dev/null
+++ b/p/scripts/bcrypt.min.js
@@ -0,0 +1,41 @@
+/*
+ bcrypt.js (c) 2013 Daniel Wirtz <dcode@dcode.io>
+ Released under the Apache License, Version 2.0
+ see: https://github.com/dcodeIO/bcrypt.js for details
+*/
+function p(n){throw n;}var q=null;
+(function(n){function u(c,a,b,f){for(var d,e=c[a],l=c[a+1],e=e^b[0],h=0;14>=h;)d=f[e>>24&255],d+=f[256|e>>16&255],d^=f[512|e>>8&255],d+=f[768|e&255],l^=d^b[++h],d=f[l>>24&255],d+=f[256|l>>16&255],d^=f[512|l>>8&255],d+=f[768|l&255],e^=d^b[++h];c[a]=l^b[17];c[a+1]=e;return c}function s(c,a){var b,f=0;for(b=0;4>b;b++)f=f<<8|c[a]&255,a=(a+1)%c.length;return{key:f,a:a}}function y(c,a,b){for(var f=0,d=[0,0],e=a.length,l=b.length,h=0;h<e;h++){var g=s(c,f),f=g.a;a[h]^=g.key}for(h=0;h<e;h+=2)d=u(d,0,a,b),
+a[h]=d[0],a[h+1]=d[1];for(h=0;h<l;h+=2)d=u(d,0,a,b),b[h]=d[0],b[h+1]=d[1]}function C(c,a,b,f){for(var d=0,e=[0,0],l=b.length,h=f.length,g,k=0;k<l;k++)g=s(a,d),d=g.a,b[k]^=g.key;for(k=d=0;k<l;k+=2)g=s(c,d),d=g.a,e[0]^=g.key,g=s(c,d),d=g.a,e[1]^=g.key,e=u(e,0,b,f),b[k]=e[0],b[k+1]=e[1];for(k=0;k<h;k+=2)g=s(c,d),d=g.a,e[0]^=g.key,g=s(c,d),d=g.a,e[1]^=g.key,e=u(e,0,b,f),f[k]=e[0],f[k+1]=e[1]}function z(c){"undefined"!==typeof process&&"function"===typeof process.nextTick?process.nextTick(c):setTimeout(c,
+0)}function A(c,a,b,f){function d(){if(k<b)for(var n=new Date;k<b&&!(k+=1,y(c,h,g),y(a,h,g),100<Date.now()-n););else{for(k=0;64>k;k++)for(m=0;m<l>>1;m++)u(e,m<<1,h,g);n=[];for(k=0;k<l;k++)n.push((e[k]>>24&255)>>>0),n.push((e[k]>>16&255)>>>0),n.push((e[k]>>8&255)>>>0),n.push((e[k]&255)>>>0);return f?(f(q,n),q):n}f&&z(d);return q}var e=B.slice(),l=e.length;(4>b||31<b)&&p(Error("Illegal number of rounds: "+b));16!=a.length&&p(Error("Illegal salt length: "+a.length+" != 16"));b=1<<b;var h=D.slice(),g=
+E.slice();C(a,c,h,g);var k=0,m;if("undefined"!==typeof f)return d(),q;for(var n;;)if((n=d())!==q)return n}function F(c){for(var a,b,f=[],d=0;d<c.length;d++){a=c.charCodeAt(d);b=[];do b.push(a&255),a>>=8;while(a);f=f.concat(b.reverse())}return f}function w(c,a,b){function f(a){var b=[];b.push("$2");"a"<=d&&b.push(d);b.push("$");10>l&&b.push("0");b.push(l.toString());b.push("$");b.push(v.b(h,h.length));b.push(v.b(a,4*B.length-1));return b.join("")}var d,e;("$"!=a.charAt(0)||"2"!=a.charAt(1))&&p(Error("Invalid salt version: "+
+a.substring(0,2)));"$"==a.charAt(2)?(d=String.fromCharCode(0),e=3):(d=a.charAt(2),("a"!=d||"$"!=a.charAt(3))&&p(Error("Invalid salt revision: "+a.substring(2,4))),e=4);"$"<a.charAt(e+2)&&p(Error("Missing salt rounds"));var l=10*parseInt(a.substring(e,e+1),10)+parseInt(a.substring(e+1,e+2),10);a=a.substring(e+3,e+25);c=F(c+("a"<=d?"\x00":""));var h=[],h=v.c(a,16);if("undefined"==typeof b)return f(A(c,h,l));A(c,h,l,function(a,c){a?b(a,q):b(q,f(c))});return q}function G(){if("undefined"!==typeof module&&
+module.exports)return require("crypto").randomBytes(16);var c=new Uint32Array(16);n.crypto&&"function"===typeof n.crypto.getRandomValues?n.crypto.getRandomValues(c):"function"===typeof x?x(c):p(Error("Failed to generate random values: Web Crypto API not available / no polyfill set"));return Array.prototype.slice.call(c)}var t="./ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789".split(""),r=[-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
+-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,1,54,55,56,57,58,59,60,61,62,63,-1,-1,-1,-1,-1,-1,-1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,-1,-1,-1,-1,-1,-1,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,-1,-1,-1,-1,-1],v={b:function(c,a){var b=0,f=[],d,e;for((0>=a||a>c.length)&&p(Error("Invalid 'len': "+a));b<a;){d=c[b++]&255;f.push(t[d>>2&63]);d=(d&3)<<4;if(b>=a){f.push(t[d&63]);break}e=c[b++]&255;d|=e>>4&15;f.push(t[d&63]);d=(e&15)<<
+2;if(b>=a){f.push(t[d&63]);break}e=c[b++]&255;d|=e>>6&3;f.push(t[d&63]);f.push(t[e&63])}return f.join("")},c:function(c,a){var b=0,f=c.length,d=0,e=[],l,h,g;for(0>=a&&p(Error("Illegal 'len': "+a));b<f-1&&d<a;){g=c.charCodeAt(b++);l=g<r.length?r[g]:-1;g=c.charCodeAt(b++);h=g<r.length?r[g]:-1;if(-1==l||-1==h)break;g=l<<2>>>0;g|=(h&48)>>4;e.push(String.fromCharCode(g));if(++d>=a||b>=f)break;g=c.charCodeAt(b++);l=g<r.length?r[g]:-1;if(-1==l)break;g=(h&15)<<4>>>0;g|=(l&60)>>2;e.push(String.fromCharCode(g));
+if(++d>=a||b>=f)break;g=c.charCodeAt(b++);h=g<r.length?r[g]:-1;g=(l&3)<<6>>>0;g|=h;e.push(String.fromCharCode(g));++d}f=[];for(b=0;b<d;b++)f.push(e[b].charCodeAt(0));return f}},m={},D=[608135816,2242054355,320440878,57701188,2752067618,698298832,137296536,3964562569,1160258022,953160567,3193202383,887688300,3232508343,3380367581,1065670069,3041331479,2450970073,2306472731],E=[3509652390,2564797868,805139163,3491422135,3101798381,1780907670,3128725573,4046225305,614570311,3012652279,134345442,2240740374,
+1667834072,1901547113,2757295779,4103290238,227898511,1921955416,1904987480,2182433518,2069144605,3260701109,2620446009,720527379,3318853667,677414384,3393288472,3101374703,2390351024,1614419982,1822297739,2954791486,3608508353,3174124327,2024746970,1432378464,3864339955,2857741204,1464375394,1676153920,1439316330,715854006,3033291828,289532110,2706671279,2087905683,3018724369,1668267050,732546397,1947742710,3462151702,2609353502,2950085171,1814351708,2050118529,680887927,999245976,1800124847,3300911131,
+1713906067,1641548236,4213287313,1216130144,1575780402,4018429277,3917837745,3693486850,3949271944,596196993,3549867205,258830323,2213823033,772490370,2760122372,1774776394,2652871518,566650946,4142492826,1728879713,2882767088,1783734482,3629395816,2517608232,2874225571,1861159788,326777828,3124490320,2130389656,2716951837,967770486,1724537150,2185432712,2364442137,1164943284,2105845187,998989502,3765401048,2244026483,1075463327,1455516326,1322494562,910128902,469688178,1117454909,936433444,3490320968,
+3675253459,1240580251,122909385,2157517691,634681816,4142456567,3825094682,3061402683,2540495037,79693498,3249098678,1084186820,1583128258,426386531,1761308591,1047286709,322548459,995290223,1845252383,2603652396,3431023940,2942221577,3202600964,3727903485,1712269319,422464435,3234572375,1170764815,3523960633,3117677531,1434042557,442511882,3600875718,1076654713,1738483198,4213154764,2393238008,3677496056,1014306527,4251020053,793779912,2902807211,842905082,4246964064,1395751752,1040244610,2656851899,
+3396308128,445077038,3742853595,3577915638,679411651,2892444358,2354009459,1767581616,3150600392,3791627101,3102740896,284835224,4246832056,1258075500,768725851,2589189241,3069724005,3532540348,1274779536,3789419226,2764799539,1660621633,3471099624,4011903706,913787905,3497959166,737222580,2514213453,2928710040,3937242737,1804850592,3499020752,2949064160,2386320175,2390070455,2415321851,4061277028,2290661394,2416832540,1336762016,1754252060,3520065937,3014181293,791618072,3188594551,3933548030,2332172193,
+3852520463,3043980520,413987798,3465142937,3030929376,4245938359,2093235073,3534596313,375366246,2157278981,2479649556,555357303,3870105701,2008414854,3344188149,4221384143,3956125452,2067696032,3594591187,2921233993,2428461,544322398,577241275,1471733935,610547355,4027169054,1432588573,1507829418,2025931657,3646575487,545086370,48609733,2200306550,1653985193,298326376,1316178497,3007786442,2064951626,458293330,2589141269,3591329599,3164325604,727753846,2179363840,146436021,1461446943,4069977195,
+705550613,3059967265,3887724982,4281599278,3313849956,1404054877,2845806497,146425753,1854211946,1266315497,3048417604,3681880366,3289982499,290971E4,1235738493,2632868024,2414719590,3970600049,1771706367,1449415276,3266420449,422970021,1963543593,2690192192,3826793022,1062508698,1531092325,1804592342,2583117782,2714934279,4024971509,1294809318,4028980673,1289560198,2221992742,1669523910,35572830,157838143,1052438473,1016535060,1802137761,1753167236,1386275462,3080475397,2857371447,1040679964,2145300060,
+2390574316,1461121720,2956646967,4031777805,4028374788,33600511,2920084762,1018524850,629373528,3691585981,3515945977,2091462646,2486323059,586499841,988145025,935516892,3367335476,2599673255,2839830854,265290510,3972581182,2759138881,3795373465,1005194799,847297441,406762289,1314163512,1332590856,1866599683,4127851711,750260880,613907577,1450815602,3165620655,3734664991,3650291728,3012275730,3704569646,1427272223,778793252,1343938022,2676280711,2052605720,1946737175,3164576444,3914038668,3967478842,
+3682934266,1661551462,3294938066,4011595847,840292616,3712170807,616741398,312560963,711312465,1351876610,322626781,1910503582,271666773,2175563734,1594956187,70604529,3617834859,1007753275,1495573769,4069517037,2549218298,2663038764,504708206,2263041392,3941167025,2249088522,1514023603,1998579484,1312622330,694541497,2582060303,2151582166,1382467621,776784248,2618340202,3323268794,2497899128,2784771155,503983604,4076293799,907881277,423175695,432175456,1378068232,4145222326,3954048622,3938656102,
+3820766613,2793130115,2977904593,26017576,3274890735,3194772133,1700274565,1756076034,4006520079,3677328699,720338349,1533947780,354530856,688349552,3973924725,1637815568,332179504,3949051286,53804574,2852348879,3044236432,1282449977,3583942155,3416972820,4006381244,1617046695,2628476075,3002303598,1686838959,431878346,2686675385,1700445008,1080580658,1009431731,832498133,3223435511,2605976345,2271191193,2516031870,1648197032,4164389018,2548247927,300782431,375919233,238389289,3353747414,2531188641,
+2019080857,1475708069,455242339,2609103871,448939670,3451063019,1395535956,2413381860,1841049896,1491858159,885456874,4264095073,4001119347,1565136089,3898914787,1108368660,540939232,1173283510,2745871338,3681308437,4207628240,3343053890,4016749493,1699691293,1103962373,3625875870,2256883143,3830138730,1031889488,3479347698,1535977030,4236805024,3251091107,2132092099,1774941330,1199868427,1452454533,157007616,2904115357,342012276,595725824,1480756522,206960106,497939518,591360097,863170706,2375253569,
+3596610801,1814182875,2094937945,3421402208,1082520231,3463918190,2785509508,435703966,3908032597,1641649973,2842273706,3305899714,1510255612,2148256476,2655287854,3276092548,4258621189,236887753,3681803219,274041037,1734335097,3815195456,3317970021,1899903192,1026095262,4050517792,356393447,2410691914,3873677099,3682840055,3913112168,2491498743,4132185628,2489919796,1091903735,1979897079,3170134830,3567386728,3557303409,857797738,1136121015,1342202287,507115054,2535736646,337727348,3213592640,1301675037,
+2528481711,1895095763,1721773893,3216771564,62756741,2142006736,835421444,2531993523,1442658625,3659876326,2882144922,676362277,1392781812,170690266,3921047035,1759253602,3611846912,1745797284,664899054,1329594018,3901205900,3045908486,2062866102,2865634940,3543621612,3464012697,1080764994,553557557,3656615353,3996768171,991055499,499776247,1265440854,648242737,3940784050,980351604,3713745714,1749149687,3396870395,4211799374,3640570775,1161844396,3125318951,1431517754,545492359,4268468663,3499529547,
+1437099964,2702547544,3433638243,2581715763,2787789398,1060185593,1593081372,2418618748,4260947970,69676912,2159744348,86519011,2512459080,3838209314,1220612927,3339683548,133810670,1090789135,1078426020,1569222167,845107691,3583754449,4072456591,1091646820,628848692,1613405280,3757631651,526609435,236106946,48312990,2942717905,3402727701,1797494240,859738849,992217954,4005476642,2243076622,3870952857,3732016268,765654824,3490871365,2511836413,1685915746,3888969200,1414112111,2273134842,3281911079,
+4080962846,172450625,2569994100,980381355,4109958455,2819808352,2716589560,2568741196,3681446669,3329971472,1835478071,660984891,3704678404,4045999559,3422617507,3040415634,1762651403,1719377915,3470491036,2693910283,3642056355,3138596744,1364962596,2073328063,1983633131,926494387,3423689081,2150032023,4096667949,1749200295,3328846651,309677260,2016342300,1779581495,3079819751,111262694,1274766160,443224088,298511866,1025883608,3806446537,1145181785,168956806,3641502830,3584813610,1689216846,3666258015,
+3200248200,1692713982,2646376535,4042768518,1618508792,1610833997,3523052358,4130873264,2001055236,3610705100,2202168115,4028541809,2961195399,1006657119,2006996926,3186142756,1430667929,3210227297,1314452623,4074634658,4101304120,2273951170,1399257539,3367210612,3027628629,1190975929,2062231137,2333990788,2221543033,2438960610,1181637006,548689776,2362791313,3372408396,3104550113,3145860560,296247880,1970579870,3078560182,3769228297,1714227617,3291629107,3898220290,166772364,1251581989,493813264,
+448347421,195405023,2709975567,677966185,3703036547,1463355134,2715995803,1338867538,1343315457,2802222074,2684532164,233230375,2599980071,2000651841,3277868038,1638401717,4028070440,3237316320,6314154,819756386,300326615,590932579,1405279636,3267499572,3150704214,2428286686,3959192993,3461946742,1862657033,1266418056,963775037,2089974820,2263052895,1917689273,448879540,3550394620,3981727096,150775221,3627908307,1303187396,508620638,2975983352,2726630617,1817252668,1876281319,1457606340,908771278,
+3720792119,3617206836,2455994898,1729034894,1080033504,976866871,3556439503,2881648439,1522871579,1555064734,1336096578,3548522304,2579274686,3574697629,3205460757,3593280638,3338716283,3079412587,564236357,2993598910,1781952180,1464380207,3163844217,3332601554,1699332808,1393555694,1183702653,3581086237,1288719814,691649499,2847557200,2895455976,3193889540,2717570544,1781354906,1676643554,2592534050,3230253752,1126444790,2770207658,2633158820,2210423226,2615765581,2414155088,3127139286,673620729,
+2805611233,1269405062,4015350505,3341807571,4149409754,1057255273,2012875353,2162469141,2276492801,2601117357,993977747,3918593370,2654263191,753973209,36408145,2530585658,25011837,3520020182,2088578344,530523599,2918365339,1524020338,1518925132,3760827505,3759777254,1202760957,3985898139,3906192525,674977740,4174734889,2031300136,2019492241,3983892565,4153806404,3822280332,352677332,2297720250,60907813,90501309,3286998549,1016092578,2535922412,2839152426,457141659,509813237,4120667899,652014361,
+1966332200,2975202805,55981186,2327461051,676427537,3255491064,2882294119,3433927263,1307055953,942726286,933058658,2468411793,3933900994,4215176142,1361170020,2001714738,2830558078,3274259782,1222529897,1679025792,2729314320,3714953764,1770335741,151462246,3013232138,1682292957,1483529935,471910574,1539241949,458788160,3436315007,1807016891,3718408830,978976581,1043663428,3165965781,1927990952,4200891579,2372276910,3208408903,3533431907,1412390302,2931980059,4132332400,1947078029,3881505623,4168226417,
+2941484381,1077988104,1320477388,886195818,18198404,3786409E3,2509781533,112762804,3463356488,1866414978,891333506,18488651,661792760,1628790961,3885187036,3141171499,876946877,2693282273,1372485963,791857591,2686433993,3759982718,3167212022,3472953795,2716379847,445679433,3561995674,3504004811,3574258232,54117162,3331405415,2381918588,3769707343,4154350007,1140177722,4074052095,668550556,3214352940,367459370,261225585,2610173221,4209349473,3468074219,3265815641,314222801,3066103646,3808782860,282218597,
+3406013506,3773591054,379116347,1285071038,846784868,2669647154,3771962079,3550491691,2305946142,453669953,1268987020,3317592352,3279303384,3744833421,2610507566,3859509063,266596637,3847019092,517658769,3462560207,3443424879,370717030,4247526661,2224018117,4143653529,4112773975,2788324899,2477274417,1456262402,2901442914,1517677493,1846949527,2295493580,3734397586,2176403920,1280348187,1908823572,3871786941,846861322,1172426758,3287448474,3383383037,1655181056,3139813346,901632758,1897031941,2986607138,
+3066810236,3447102507,1393639104,373351379,950779232,625454576,3124240540,4148612726,2007998917,544563296,2244738638,2330496472,2058025392,1291430526,424198748,50039436,29584100,3605783033,2429876329,2791104160,1057563949,3255363231,3075367218,3463963227,1469046755,985887462],B=[1332899944,1700884034,1701343084,1684370003,1668446532,1869963892],x=q;m.setRandomPolyfill=function(c){x=c};m.genSaltSync=function(c){c||(c=10);var a;c=c||10;(4>c||31<c)&&p(Error("Illegal number of rounds: "+c));var b=[];
+b.push("$2a$");10>c&&b.push("0");b.push(c.toString());b.push("$");try{b.push(v.b(G(),16)),a=b.join("")}catch(f){p(f)}return a};m.genSalt=function(c,a,b){"function"==typeof a&&(b=a,a=-1);var f;"function"==typeof c?(b=c,f=10):f=parseInt(c,10);"function"!=typeof b&&p(Error("Illegal or missing 'callback': "+b));z(function(){try{var a=m.genSaltSync(f);b(q,a)}catch(c){b(c,q)}})};m.hashSync=function(c,a){a||(a=10);"number"==typeof a&&(a=m.genSaltSync(a));return w(c,a)};m.hash=function(c,a,b){"function"!=
+typeof b&&p(Error("Illegal 'callback': "+b));"number"==typeof a?m.genSalt(a,function(a,d){w(c,d,b)}):w(c,a,b)};m.compareSync=function(c,a){("string"!=typeof c||"string"!=typeof a)&&p(Error("Illegal argument types: "+typeof c+", "+typeof a));60!=a.length&&p(Error("Illegal hash length: "+a.length+" != 60"));for(var b=m.hashSync(c,a.substr(0,a.length-31)),f=b.length==a.length,d=b.length<a.length?b.length:a.length,e=0;e<d;++e)b.length>=e&&(a.length>=e&&b[e]!=a[e])&&(f=!1);return f};m.compare=function(c,
+a,b){"function"!=typeof b&&p(Error("Illegal 'callback': "+b));m.hash(c,a.substr(0,29),function(c,d){b(c,a===d)})};m.getRounds=function(c){"string"!=typeof c&&p(Error("Illegal type of 'hash': "+typeof c));return parseInt(c.split("$")[2],10)};m.getSalt=function(c){"string"!=typeof c&&p(Error("Illegal type of 'hash': "+typeof c));60!=c.length&&p(Error("Illegal hash length: "+c.length+" != 60"));return c.substring(0,29)};"undefined"!=typeof module&&module.exports?module.exports=m:"undefined"!=typeof define&&
+define.amd?define("bcrypt",function(){return m}):(n.dcodeIO||(n.dcodeIO={}),n.dcodeIO.bcrypt=m)})(this);
diff --git a/p/scripts/flotr2.min.js b/p/scripts/flotr2.min.js
new file mode 100644
index 000000000..c3601e827
--- /dev/null
+++ b/p/scripts/flotr2.min.js
@@ -0,0 +1,27 @@
+/*!
+ * bean.js - copyright Jacob Thornton 2011
+ * https://github.com/fat/bean
+ * MIT License
+ * special thanks to:
+ * dean edwards: http://dean.edwards.name/
+ * dperini: https://github.com/dperini/nwevents
+ * the entire mootools team: github.com/mootools/mootools-core
+ *//*global module:true, define:true*/
+!function(e,t,n){typeof module!="undefined"?module.exports=n(e,t):typeof define=="function"&&typeof define.amd=="object"?define(n):t[e]=n(e,t)}("bean",this,function(e,t){var n=window,r=t[e],i=/over|out/,s=/[^\.]*(?=\..*)\.|.*/,o=/\..*/,u="addEventListener",a="attachEvent",f="removeEventListener",l="detachEvent",c=document||{},h=c.documentElement||{},p=h[u],d=p?u:a,v=Array.prototype.slice,m=/click|mouse|menu|drag|drop/i,g=/^touch|^gesture/i,y={one:1},b=function(e,t,n){for(n=0;n<t.length;n++)e[t[n]]=1;return e}({},("click dblclick mouseup mousedown contextmenu mousewheel DOMMouseScroll mouseover mouseout mousemove selectstart selectend keydown keypress keyup orientationchange focus blur change reset select submit load unload beforeunload resize move DOMContentLoaded readystatechange error abort scroll "+(p?"show input invalid touchstart touchmove touchend touchcancel gesturestart gesturechange gestureend message readystatechange pageshow pagehide popstate hashchange offline online afterprint beforeprint dragstart dragenter dragover dragleave drag drop dragend loadstart progress suspend emptied stalled loadmetadata loadeddata canplay canplaythrough playing waiting seeking seeked ended durationchange timeupdate play pause ratechange volumechange cuechange checking noupdate downloading cached updateready obsolete ":"")).split(" ")),w=function(){function e(e,t){while((t=t.parentNode)!==null)if(t===e)return!0;return!1}function t(t){var n=t.relatedTarget;return n?n!==this&&n.prefix!=="xul"&&!/document/.test(this.toString())&&!e(this,n):n===null}return{mouseenter:{base:"mouseover",condition:t},mouseleave:{base:"mouseout",condition:t},mousewheel:{base:/Firefox/.test(navigator.userAgent)?"DOMMouseScroll":"mousewheel"}}}(),E=function(){var e="altKey attrChange attrName bubbles cancelable ctrlKey currentTarget detail eventPhase getModifierState isTrusted metaKey relatedNode relatedTarget shiftKey srcElement target timeStamp type view which".split(" "),t=e.concat("button buttons clientX clientY dataTransfer fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" ")),n=e.concat("char charCode key keyCode".split(" ")),r=e.concat("touches targetTouches changedTouches scale rotation".split(" ")),s="preventDefault",o=function(e){return function(){e[s]?e[s]():e.returnValue=!1}},u="stopPropagation",a=function(e){return function(){e[u]?e[u]():e.cancelBubble=!0}},f=function(e){return function(){e[s](),e[u](),e.stopped=!0}},l=function(e,t,n){var r,i;for(r=n.length;r--;)i=n[r],!(i in t)&&i in e&&(t[i]=e[i])};return function(p,d){var v={originalEvent:p,isNative:d};if(!p)return v;var y,b=p.type,w=p.target||p.srcElement;v[s]=o(p),v[u]=a(p),v.stop=f(v),v.target=w&&w.nodeType===3?w.parentNode:w;if(d){if(b.indexOf("key")!==-1)y=n,v.keyCode=p.which||p.keyCode;else if(m.test(b)){y=t,v.rightClick=p.which===3||p.button===2,v.pos={x:0,y:0};if(p.pageX||p.pageY)v.clientX=p.pageX,v.clientY=p.pageY;else if(p.clientX||p.clientY)v.clientX=p.clientX+c.body.scrollLeft+h.scrollLeft,v.clientY=p.clientY+c.body.scrollTop+h.scrollTop;i.test(b)&&(v.relatedTarget=p.relatedTarget||p[(b==="mouseover"?"from":"to")+"Element"])}else g.test(b)&&(y=r);l(p,v,y||e)}return v}}(),S=function(e,t){return!p&&!t&&(e===c||e===n)?h:e},x=function(){function e(e,t,n,r,i){this.element=e,this.type=t,this.handler=n,this.original=r,this.namespaces=i,this.custom=w[t],this.isNative=b[t]&&e[d],this.eventType=p||this.isNative?t:"propertychange",this.customType=!p&&!this.isNative&&t,this.target=S(e,this.isNative),this.eventSupport=this.target[d]}return e.prototype={inNamespaces:function(e){var t,n;if(!e)return!0;if(!this.namespaces)return!1;for(t=e.length;t--;)for(n=this.namespaces.length;n--;)if(e[t]===this.namespaces[n])return!0;return!1},matches:function(e,t,n){return this.element===e&&(!t||this.original===t)&&(!n||this.handler===n)}},e}(),T=function(){var e={},t=function(n,r,i,s,o){if(!r||r==="*")for(var u in e)u.charAt(0)==="$"&&t(n,u.substr(1),i,s,o);else{var a=0,f,l=e["$"+r],c=n==="*";if(!l)return;for(f=l.length;a<f;a++)if(c||l[a].matches(n,i,s))if(!o(l[a],l,a,r))return}},n=function(t,n,r){var i,s=e["$"+n];if(s)for(i=s.length;i--;)if(s[i].matches(t,r,null))return!0;return!1},r=function(e,n,r){var i=[];return t(e,n,r,null,function(e){return i.push(e)}),i},i=function(t){return(e["$"+t.type]||(e["$"+t.type]=[])).push(t),t},s=function(n){t(n.element,n.type,null,n.handler,function(t,n,r){return n.splice(r,1),n.length===0&&delete e["$"+t.type],!1})},o=function(){var t,n=[];for(t in e)t.charAt(0)==="$"&&(n=n.concat(e[t]));return n};return{has:n,get:r,put:i,del:s,entries:o}}(),N=p?function(e,t,n,r){e[r?u:f](t,n,!1)}:function(e,t,n,r,i){i&&r&&e["_on"+i]===null&&(e["_on"+i]=0),e[r?a:l]("on"+t,n)},C=function(e,t,r){return function(i){return i=E(i||((this.ownerDocument||this.document||this).parentWindow||n).event,!0),t.apply(e,[i].concat(r))}},k=function(e,t,r,i,s,o){return function(u){if(i?i.apply(this,arguments):p?!0:u&&u.propertyName==="_on"+r||!u)u&&(u=E(u||((this.ownerDocument||this.document||this).parentWindow||n).event,o)),t.apply(e,u&&(!s||s.length===0)?arguments:v.call(arguments,u?0:1).concat(s))}},L=function(e,t,n,r,i){return function(){e(t,n,i),r.apply(this,arguments)}},A=function(e,t,n,r){var i,s,u,a=t&&t.replace(o,""),f=T.get(e,a,n);for(i=0,s=f.length;i<s;i++)f[i].inNamespaces(r)&&((u=f[i]).eventSupport&&N(u.target,u.eventType,u.handler,!1,u.type),T.del(u))},O=function(e,t,n,r,i){var u,a=t.replace(o,""),f=t.replace(s,"").split(".");if(T.has(e,a,n))return e;a==="unload"&&(n=L(A,e,a,n,r)),w[a]&&(w[a].condition&&(n=k(e,n,a,w[a].condition,!0)),a=w[a].base||a),u=T.put(new x(e,a,n,r,f[0]&&f)),u.handler=u.isNative?C(e,u.handler,i):k(e,u.handler,a,!1,i,!1),u.eventSupport&&N(u.target,u.eventType,u.handler,!0,u.customType)},M=function(e,t,n){return function(r){var i,s,o=typeof e=="string"?n(e,this):e;for(i=r.target;i&&i!==this;i=i.parentNode)for(s=o.length;s--;)if(o[s]===i)return t.apply(i,arguments)}},_=function(e,t,n){var r,i,u,a,f,l=A,c=t&&typeof t=="string";if(c&&t.indexOf(" ")>0){t=t.split(" ");for(f=t.length;f--;)_(e,t[f],n);return e}u=c&&t.replace(o,""),u&&w[u]&&(u=w[u].type);if(!t||c){if(a=c&&t.replace(s,""))a=a.split(".");l(e,u,n,a)}else if(typeof t=="function")l(e,null,t);else for(r in t)t.hasOwnProperty(r)&&_(e,r,t[r]);return e},D=function(e,t,n,r,i){var s,o,u,a,f=n,l=n&&typeof n=="string";if(t&&!n&&typeof t=="object")for(s in t)t.hasOwnProperty(s)&&D.apply(this,[e,s,t[s]]);else{a=arguments.length>3?v.call(arguments,3):[],o=(l?n:t).split(" "),l&&(n=M(t,f=r,i))&&(a=v.call(a,1)),this===y&&(n=L(_,e,t,n,f));for(u=o.length;u--;)O(e,o[u],n,f,a)}return e},P=function(){return D.apply(y,arguments)},H=p?function(e,t,r){var i=c.createEvent(e?"HTMLEvents":"UIEvents");i[e?"initEvent":"initUIEvent"](t,!0,!0,n,1),r.dispatchEvent(i)}:function(e,t,n){n=S(n,e),e?n.fireEvent("on"+t,c.createEventObject()):n["_on"+t]++},B=function(e,t,n){var r,i,u,a,f,l=t.split(" ");for(r=l.length;r--;){t=l[r].replace(o,"");if(a=l[r].replace(s,""))a=a.split(".");if(!a&&!n&&e[d])H(b[t],t,e);else{f=T.get(e,t),n=[!1].concat(n);for(i=0,u=f.length;i<u;i++)f[i].inNamespaces(a)&&f[i].handler.apply(e,n)}}return e},j=function(e,t,n){var r=0,i=T.get(t,n),s=i.length;for(;r<s;r++)i[r].original&&D(e,i[r].type,i[r].original);return e},F={add:D,one:P,remove:_,clone:j,fire:B,noConflict:function(){return t[e]=r,this}};if(n[a]){var I=function(){var e,t=T.entries();for(e in t)t[e].type&&t[e].type!=="unload"&&_(t[e].element,t[e].type);n[l]("onunload",I),n.CollectGarbage&&n.CollectGarbage()};n[a]("onunload",I)}return F});
+// Underscore.js 1.1.7
+// (c) 2011 Jeremy Ashkenas, DocumentCloud Inc.
+// Underscore is freely distributable under the MIT license.
+// Portions of Underscore are inspired or borrowed from Prototype,
+// Oliver Steele's Functional, and John Resig's Micro-Templating.
+// For all details and documentation:
+// http://documentcloud.github.com/underscore
+
+(function(){var e=this,t=e._,n={},r=Array.prototype,i=Object.prototype,s=Function.prototype,o=r.slice,u=r.unshift,a=i.toString,f=i.hasOwnProperty,l=r.forEach,c=r.map,h=r.reduce,p=r.reduceRight,d=r.filter,v=r.every,m=r.some,g=r.indexOf,y=r.lastIndexOf,b=Array.isArray,w=Object.keys,E=s.bind,S=function(e){return new k(e)};typeof module!="undefined"&&module.exports?(module.exports=S,S._=S):e._=S,S.VERSION="1.1.7";var x=S.each=S.forEach=function(e,t,r){if(e==null)return;if(l&&e.forEach===l)e.forEach(t,r);else if(e.length===+e.length){for(var i=0,s=e.length;i<s;i++)if(i in e&&t.call(r,e[i],i,e)===n)return}else for(var o in e)if(f.call(e,o)&&t.call(r,e[o],o,e)===n)return};S.map=function(e,t,n){var r=[];return e==null?r:c&&e.map===c?e.map(t,n):(x(e,function(e,i,s){r[r.length]=t.call(n,e,i,s)}),r)},S.reduce=S.foldl=S.inject=function(e,t,n,r){var i=n!==void 0;e==null&&(e=[]);if(h&&e.reduce===h)return r&&(t=S.bind(t,r)),i?e.reduce(t,n):e.reduce(t);x(e,function(e,s,o){i?n=t.call(r,n,e,s,o):(n=e,i=!0)});if(!i)throw new TypeError("Reduce of empty array with no initial value");return n},S.reduceRight=S.foldr=function(e,t,n,r){e==null&&(e=[]);if(p&&e.reduceRight===p)return r&&(t=S.bind(t,r)),n!==void 0?e.reduceRight(t,n):e.reduceRight(t);var i=(S.isArray(e)?e.slice():S.toArray(e)).reverse();return S.reduce(i,t,n,r)},S.find=S.detect=function(e,t,n){var r;return T(e,function(e,i,s){if(t.call(n,e,i,s))return r=e,!0}),r},S.filter=S.select=function(e,t,n){var r=[];return e==null?r:d&&e.filter===d?e.filter(t,n):(x(e,function(e,i,s){t.call(n,e,i,s)&&(r[r.length]=e)}),r)},S.reject=function(e,t,n){var r=[];return e==null?r:(x(e,function(e,i,s){t.call(n,e,i,s)||(r[r.length]=e)}),r)},S.every=S.all=function(e,t,r){var i=!0;return e==null?i:v&&e.every===v?e.every(t,r):(x(e,function(e,s,o){if(!(i=i&&t.call(r,e,s,o)))return n}),i)};var T=S.some=S.any=function(e,t,r){t=t||S.identity;var i=!1;return e==null?i:m&&e.some===m?e.some(t,r):(x(e,function(e,s,o){if(i|=t.call(r,e,s,o))return n}),!!i)};S.include=S.contains=function(e,t){var n=!1;return e==null?n:g&&e.indexOf===g?e.indexOf(t)!=-1:(T(e,function(e){if(n=e===t)return!0}),n)},S.invoke=function(e,t){var n=o.call(arguments,2);return S.map(e,function(e){return(t.call?t||e:e[t]).apply(e,n)})},S.pluck=function(e,t){return S.map(e,function(e){return e[t]})},S.max=function(e,t,n){if(!t&&S.isArray(e))return Math.max.apply(Math,e);var r={computed:-Infinity};return x(e,function(e,i,s){var o=t?t.call(n,e,i,s):e;o>=r.computed&&(r={value:e,computed:o})}),r.value},S.min=function(e,t,n){if(!t&&S.isArray(e))return Math.min.apply(Math,e);var r={computed:Infinity};return x(e,function(e,i,s){var o=t?t.call(n,e,i,s):e;o<r.computed&&(r={value:e,computed:o})}),r.value},S.sortBy=function(e,t,n){return S.pluck(S.map(e,function(e,r,i){return{value:e,criteria:t.call(n,e,r,i)}}).sort(function(e,t){var n=e.criteria,r=t.criteria;return n<r?-1:n>r?1:0}),"value")},S.groupBy=function(e,t){var n={};return x(e,function(e,r){var i=t(e,r);(n[i]||(n[i]=[])).push(e)}),n},S.sortedIndex=function(e,t,n){n||(n=S.identity);var r=0,i=e.length;while(r<i){var s=r+i>>1;n(e[s])<n(t)?r=s+1:i=s}return r},S.toArray=function(e){return e?e.toArray?e.toArray():S.isArray(e)?o.call(e):S.isArguments(e)?o.call(e):S.values(e):[]},S.size=function(e){return S.toArray(e).length},S.first=S.head=function(e,t,n){return t!=null&&!n?o.call(e,0,t):e[0]},S.rest=S.tail=function(e,t,n){return o.call(e,t==null||n?1:t)},S.last=function(e){return e[e.length-1]},S.compact=function(e){return S.filter(e,function(e){return!!e})},S.flatten=function(e){return S.reduce(e,function(e,t){return S.isArray(t)?e.concat(S.flatten(t)):(e[e.length]=t,e)},[])},S.without=function(e){return S.difference(e,o.call(arguments,1))},S.uniq=S.unique=function(e,t){return S.reduce(e,function(e,n,r){if(0==r||(t===!0?S.last(e)!=n:!S.include(e,n)))e[e.length]=n;return e},[])},S.union=function(){return S.uniq(S.flatten(arguments))},S.intersection=S.intersect=function(e){var t=o.call(arguments,1);return S.filter(S.uniq(e),function(e){return S.every(t,function(t){return S.indexOf(t,e)>=0})})},S.difference=function(e,t){return S.filter(e,function(e){return!S.include(t,e)})},S.zip=function(){var e=o.call(arguments),t=S.max(S.pluck(e,"length")),n=new Array(t);for(var r=0;r<t;r++)n[r]=S.pluck(e,""+r);return n},S.indexOf=function(e,t,n){if(e==null)return-1;var r,i;if(n)return r=S.sortedIndex(e,t),e[r]===t?r:-1;if(g&&e.indexOf===g)return e.indexOf(t);for(r=0,i=e.length;r<i;r++)if(e[r]===t)return r;return-1},S.lastIndexOf=function(e,t){if(e==null)return-1;if(y&&e.lastIndexOf===y)return e.lastIndexOf(t);var n=e.length;while(n--)if(e[n]===t)return n;return-1},S.range=function(e,t,n){arguments.length<=1&&(t=e||0,e=0),n=arguments[2]||1;var r=Math.max(Math.ceil((t-e)/n),0),i=0,s=new Array(r);while(i<r)s[i++]=e,e+=n;return s},S.bind=function(e,t){if(e.bind===E&&E)return E.apply(e,o.call(arguments,1));var n=o.call(arguments,2);return function(){return e.apply(t,n.concat(o.call(arguments)))}},S.bindAll=function(e){var t=o.call(arguments,1);return t.length==0&&(t=S.functions(e)),x(t,function(t){e[t]=S.bind(e[t],e)}),e},S.memoize=function(e,t){var n={};return t||(t=S.identity),function(){var r=t.apply(this,arguments);return f.call(n,r)?n[r]:n[r]=e.apply(this,arguments)}},S.delay=function(e,t){var n=o.call(arguments,2);return setTimeout(function(){return e.apply(e,n)},t)},S.defer=function(e){return S.delay.apply(S,[e,1].concat(o.call(arguments,1)))};var N=function(e,t,n){var r;return function(){var i=this,s=arguments,o=function(){r=null,e.apply(i,s)};n&&clearTimeout(r);if(n||!r)r=setTimeout(o,t)}};S.throttle=function(e,t){return N(e,t,!1)},S.debounce=function(e,t){return N(e,t,!0)},S.once=function(e){var t=!1,n;return function(){return t?n:(t=!0,n=e.apply(this,arguments))}},S.wrap=function(e,t){return function(){var n=[e].concat(o.call(arguments));return t.apply(this,n)}},S.compose=function(){var e=o.call(arguments);return function(){var t=o.call(arguments);for(var n=e.length-1;n>=0;n--)t=[e[n].apply(this,t)];return t[0]}},S.after=function(e,t){return function(){if(--e<1)return t.apply(this,arguments)}},S.keys=w||function(e){if(e!==Object(e))throw new TypeError("Invalid object");var t=[];for(var n in e)f.call(e,n)&&(t[t.length]=n);return t},S.values=function(e){return S.map(e,S.identity)},S.functions=S.methods=function(e){var t=[];for(var n in e)S.isFunction(e[n])&&t.push(n);return t.sort()},S.extend=function(e){return x(o.call(arguments,1),function(t){for(var n in t)t[n]!==void 0&&(e[n]=t[n])}),e},S.defaults=function(e){return x(o.call(arguments,1),function(t){for(var n in t)e[n]==null&&(e[n]=t[n])}),e},S.clone=function(e){return S.isArray(e)?e.slice():S.extend({},e)},S.tap=function(e,t){return t(e),e},S.isEqual=function(e,t){if(e===t)return!0;var n=typeof e,r=typeof t;if(n!=r)return!1;if(e==t)return!0;if(!e&&t||e&&!t)return!1;e._chain&&(e=e._wrapped),t._chain&&(t=t._wrapped);if(e.isEqual)return e.isEqual(t);if(t.isEqual)return t.isEqual(e);if(S.isDate(e)&&S.isDate(t))return e.getTime()===t.getTime();if(S.isNaN(e)&&S.isNaN(t))return!1;if(S.isRegExp(e)&&S.isRegExp(t))return e.source===t.source&&e.global===t.global&&e.ignoreCase===t.ignoreCase&&e.multiline===t.multiline;if(n!=="object")return!1;if(e.length&&e.length!==t.length)return!1;var i=S.keys(e),s=S.keys(t);if(i.length!=s.length)return!1;for(var o in e)if(!(o in t)||!S.isEqual(e[o],t[o]))return!1;return!0},S.isEmpty=function(e){if(S.isArray(e)||S.isString(e))return e.length===0;for(var t in e)if(f.call(e,t))return!1;return!0},S.isElement=function(e){return!!e&&e.nodeType==1},S.isArray=b||function(e){return a.call(e)==="[object Array]"},S.isObject=function(e){return e===Object(e)},S.isArguments=function(e){return!!e&&!!f.call(e,"callee")},S.isFunction=function(e){return!!(e&&e.constructor&&e.call&&e.apply)},S.isString=function(e){return!!(e===""||e&&e.charCodeAt&&e.substr)},S.isNumber=function(e){return!!(e===0||e&&e.toExponential&&e.toFixed)},S.isNaN=function(e){return e!==e},S.isBoolean=function(e){return e===!0||e===!1},S.isDate=function(e){return!!(e&&e.getTimezoneOffset&&e.setUTCFullYear)},S.isRegExp=function(e){return!(!(e&&e.test&&e.exec)||!e.ignoreCase&&e.ignoreCase!==!1)},S.isNull=function(e){return e===null},S.isUndefined=function(e){return e===void 0},S.noConflict=function(){return e._=t,this},S.identity=function(e){return e},S.times=function(e,t,n){for(var r=0;r<e;r++)t.call(n,r)},S.mixin=function(e){x(S.functions(e),function(t){A(t,S[t]=e[t])})};var C=0;S.uniqueId=function(e){var t=C++;return e?e+t:t},S.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g},S.template=function(e,t){var n=S.templateSettings,r="var __p=[],print=function(){__p.push.apply(__p,arguments);};with(obj||{}){__p.push('"+e.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(n.interpolate,function(e,t){return"',"+t.replace(/\\'/g,"'")+",'"}).replace(n.evaluate||null,function(e,t){return"');"+t.replace(/\\'/g,"'").replace(/[\r\n\t]/g," ")+"__p.push('"}).replace(/\r/g,"\\r").replace(/\n/g,"\\n").replace(/\t/g,"\\t")+"');}return __p.join('');",i=new Function("obj",r);return t?i(t):i};var k=function(e){this._wrapped=e};S.prototype=k.prototype;var L=function(e,t){return t?S(e).chain():e},A=function(e,t){k.prototype[e]=function(){var e=o.call(arguments);return u.call(e,this._wrapped),L(t.apply(S,e),this._chain)}};S.mixin(S),x(["pop","push","reverse","shift","sort","splice","unshift"],function(e){var t=r[e];k.prototype[e]=function(){return t.apply(this._wrapped,arguments),L(this._wrapped,this._chain)}}),x(["concat","join","slice"],function(e){var t=r[e];k.prototype[e]=function(){return L(t.apply(this._wrapped,arguments),this._chain)}}),k.prototype.chain=function(){return this._chain=!0,this},k.prototype.value=function(){return this._wrapped}})();
+/**
+ * Flotr2 (c) 2012 Carl Sutherland
+ * MIT License
+ * Special thanks to:
+ * Flotr: http://code.google.com/p/flotr/ (fork)
+ * Flot: https://github.com/flot/flot (original fork)
+ */
+(function(){var e=this,t=this.Flotr,n;n={_:_,bean:bean,isIphone:/iphone/i.test(navigator.userAgent),isIE:navigator.appVersion.indexOf("MSIE")!=-1?parseFloat(navigator.appVersion.split("MSIE")[1]):!1,graphTypes:{},plugins:{},addType:function(e,t){n.graphTypes[e]=t,n.defaultOptions[e]=t.options||{},n.defaultOptions.defaultType=n.defaultOptions.defaultType||e},addPlugin:function(e,t){n.plugins[e]=t,n.defaultOptions[e]=t.options||{}},draw:function(e,t,r,i){return i=i||n.Graph,new i(e,t,r)},merge:function(e,t){var r,i,s=t||{};for(r in e)i=e[r],i&&typeof i=="object"?i.constructor===Array?s[r]=this._.clone(i):i.constructor!==RegExp&&!this._.isElement(i)&&!i.jquery?s[r]=n.merge(i,t?t[r]:undefined):s[r]=i:s[r]=i;return s},clone:function(e){return n.merge(e,{})},getTickSize:function(e,t,r,i){var s=(r-t)/e,o=n.getMagnitude(s),u=10,a=s/o;return a<1.5?u=1:a<2.25?u=2:a<3?u=i===0?2:2.5:a<7.5&&(u=5),u*o},defaultTickFormatter:function(e,t){return e+""},defaultTrackFormatter:function(e){return"("+e.x+", "+e.y+")"},engineeringNotation:function(e,t,n){var r=["Y","Z","E","P","T","G","M","k",""],i=["y","z","a","f","p","n","µ","m",""],s=r.length;n=n||1e3,t=Math.pow(10,t||2);if(e===0)return 0;if(e>1)while(s--&&e>=n)e/=n;else{r=i,s=r.length;while(s--&&e<1)e*=n}return Math.round(e*t)/t+r[s]},getMagnitude:function(e){return Math.pow(10,Math.floor(Math.log(e)/Math.LN10))},toPixel:function(e){return Math.floor(e)+.5},toRad:function(e){return-e*(Math.PI/180)},floorInBase:function(e,t){return t*Math.floor(e/t)},drawText:function(e,t,r,i,s){if(!e.fillText){e.drawText(t,r,i,s);return}s=this._.extend({size:n.defaultOptions.fontSize,color:"#000000",textAlign:"left",textBaseline:"bottom",weight:1,angle:0},s),e.save(),e.translate(r,i),e.rotate(s.angle),e.fillStyle=s.color,e.font=(s.weight>1?"bold ":"")+s.size*1.3+"px sans-serif",e.textAlign=s.textAlign,e.textBaseline=s.textBaseline,e.fillText(t,0,0),e.restore()},getBestTextAlign:function(e,t){return t=t||{textAlign:"center",textBaseline:"middle"},e+=n.getTextAngleFromAlign(t),Math.abs(Math.cos(e))>.01&&(t.textAlign=Math.cos(e)>0?"right":"left"),Math.abs(Math.sin(e))>.01&&(t.textBaseline=Math.sin(e)>0?"top":"bottom"),t},alignTable:{"right middle":0,"right top":Math.PI/4,"center top":Math.PI/2,"left top":3*(Math.PI/4),"left middle":Math.PI,"left bottom":-3*(Math.PI/4),"center bottom":-Math.PI/2,"right bottom":-Math.PI/4,"center middle":0},getTextAngleFromAlign:function(e){return n.alignTable[e.textAlign+" "+e.textBaseline]||0},noConflict:function(){return e.Flotr=t,this}},e.Flotr=n})(),Flotr.defaultOptions={colors:["#00A8F0","#C0D800","#CB4B4B","#4DA74D","#9440ED"],ieBackgroundColor:"#FFFFFF",title:null,subtitle:null,shadowSize:4,defaultType:null,HtmlText:!0,fontColor:"#545454",fontSize:7.5,resolution:1,parseFloat:!0,preventDefault:!0,xaxis:{ticks:null,minorTicks:null,showLabels:!0,showMinorLabels:!1,labelsAngle:0,title:null,titleAngle:0,noTicks:5,minorTickFreq:null,tickFormatter:Flotr.defaultTickFormatter,tickDecimals:null,min:null,max:null,autoscale:!1,autoscaleMargin:0,color:null,mode:"normal",timeFormat:null,timeMode:"UTC",timeUnit:"millisecond",scaling:"linear",base:Math.E,titleAlign:"center",margin:!0},x2axis:{},yaxis:{ticks:null,minorTicks:null,showLabels:!0,showMinorLabels:!1,labelsAngle:0,title:null,titleAngle:90,noTicks:5,minorTickFreq:null,tickFormatter:Flotr.defaultTickFormatter,tickDecimals:null,min:null,max:null,autoscale:!1,autoscaleMargin:0,color:null,scaling:"linear",base:Math.E,titleAlign:"center",margin:!0},y2axis:{titleAngle:270},grid:{color:"#545454",backgroundColor:null,backgroundImage:null,watermarkAlpha:.4,tickColor:"#DDDDDD",labelMargin:3,verticalLines:!0,minorVerticalLines:null,horizontalLines:!0,minorHorizontalLines:null,outlineWidth:1,outline:"nsew",circular:!1},mouse:{track:!1,trackAll:!1,position:"se",relative:!1,trackFormatter:Flotr.defaultTrackFormatter,margin:5,lineColor:"#FF3F19",trackDecimals:1,sensibility:2,trackY:!0,radius:3,fillColor:null,fillOpacity:.4}},function(){function t(e,t,n,r){this.rgba=["r","g","b","a"];var i=4;while(-1<--i)this[this.rgba[i]]=arguments[i]||(i==3?1:0);this.normalize()}var e=Flotr._,n={aqua:[0,255,255],azure:[240,255,255],beige:[245,245,220],black:[0,0,0],blue:[0,0,255],brown:[165,42,42],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgrey:[169,169,169],darkgreen:[0,100,0],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkviolet:[148,0,211],fuchsia:[255,0,255],gold:[255,215,0],green:[0,128,0],indigo:[75,0,130],khaki:[240,230,140],lightblue:[173,216,230],lightcyan:[224,255,255],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightyellow:[255,255,224],lime:[0,255,0],magenta:[255,0,255],maroon:[128,0,0],navy:[0,0,128],olive:[128,128,0],orange:[255,165,0],pink:[255,192,203],purple:[128,0,128],violet:[128,0,128],red:[255,0,0],silver:[192,192,192],white:[255,255,255],yellow:[255,255,0]};t.prototype={scale:function(t,n,r,i){var s=4;while(-1<--s)e.isUndefined(arguments[s])||(this[this.rgba[s]]*=arguments[s]);return this.normalize()},alpha:function(t){return!e.isUndefined(t)&&!e.isNull(t)&&(this.a=t),this.normalize()},clone:function(){return new t(this.r,this.b,this.g,this.a)},limit:function(e,t,n){return Math.max(Math.min(e,n),t)},normalize:function(){var e=this.limit;return this.r=e(parseInt(this.r,10),0,255),this.g=e(parseInt(this.g,10),0,255),this.b=e(parseInt(this.b,10),0,255),this.a=e(this.a,0,1),this},distance:function(e){if(!e)return;e=new t.parse(e);var n=0,r=3;while(-1<--r)n+=Math.abs(this[this.rgba[r]]-e[this.rgba[r]]);return n},toString:function(){return this.a>=1?"rgb("+[this.r,this.g,this.b].join(",")+")":"rgba("+[this.r,this.g,this.b,this.a].join(",")+")"},contrast:function(){var e=1-(.299*this.r+.587*this.g+.114*this.b)/255;return e<.5?"#000000":"#ffffff"}},e.extend(t,{parse:function(e){if(e instanceof t)return e;var r;if(r=/#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(e))return new t(parseInt(r[1],16),parseInt(r[2],16),parseInt(r[3],16));if(r=/rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(e))return new t(parseInt(r[1],10),parseInt(r[2],10),parseInt(r[3],10));if(r=/#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(e))return new t(parseInt(r[1]+r[1],16),parseInt(r[2]+r[2],16),parseInt(r[3]+r[3],16));if(r=/rgba\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]+(?:\.[0-9]+)?)\s*\)/.exec(e))return new t(parseInt(r[1],10),parseInt(r[2],10),parseInt(r[3],10),parseFloat(r[4]));if(r=/rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(e))return new t(parseFloat(r[1])*2.55,parseFloat(r[2])*2.55,parseFloat(r[3])*2.55);if(r=/rgba\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\s*\)/.exec(e))return new t(parseFloat(r[1])*2.55,parseFloat(r[2])*2.55,parseFloat(r[3])*2.55,parseFloat(r[4]));var i=(e+"").replace(/^\s*([\S\s]*?)\s*$/,"$1").toLowerCase();return i=="transparent"?new t(255,255,255,0):(r=n[i])?new t(r[0],r[1],r[2]):new t(0,0,0,0)},processColor:function(n,r){var i=r.opacity;if(!n)return"rgba(0, 0, 0, 0)";if(n instanceof t)return n.alpha(i).toString();if(e.isString(n))return t.parse(n).alpha(i).toString();var s=n.colors?n:{colors:n};if(!r.ctx)return e.isArray(s.colors)?t.parse(e.isArray(s.colors[0])?s.colors[0][1]:s.colors[0]).alpha(i).toString():"rgba(0, 0, 0, 0)";s=e.extend({start:"top",end:"bottom"},s),/top/i.test(s.start)&&(r.x1=0),/left/i.test(s.start)&&(r.y1=0),/bottom/i.test(s.end)&&(r.x2=0),/right/i.test(s.end)&&(r.y2=0);var o,u,a,f=r.ctx.createLinearGradient(r.x1,r.y1,r.x2,r.y2);for(o=0;o<s.colors.length;o++)u=s.colors[o],e.isArray(u)?(a=u[0],u=u[1]):a=o/(s.colors.length-1),f.addColorStop(a,t.parse(u).alpha(i));return f}}),Flotr.Color=t}(),Flotr.Date={set:function(e,t,n,r){n=n||"UTC",t="set"+(n==="UTC"?"UTC":"")+t,e[t](r)},get:function(e,t,n){return n=n||"UTC",t="get"+(n==="UTC"?"UTC":"")+t,e[t]()},format:function(e,t,n){function s(e){return e+="",e.length==1?"0"+e:e}if(!e)return;var r=this.get,i={h:r(e,"Hours",n).toString(),H:s(r(e,"Hours",n)),M:s(r(e,"Minutes",n)),S:s(r(e,"Seconds",n)),s:r(e,"Milliseconds",n),d:r(e,"Date",n).toString(),m:(r(e,"Month",n)+1).toString(),y:r(e,"FullYear",n).toString(),b:Flotr.Date.monthNames[r(e,"Month",n)]},o=[],u,a=!1;for(var f=0;f<t.length;++f)u=t.charAt(f),a?(o.push(i[u]||u),a=!1):u=="%"?a=!0:o.push(u);return o.join("")},getFormat:function(e,t){var n=Flotr.Date.timeUnits;return e<n.second?"%h:%M:%S.%s":e<n.minute?"%h:%M:%S":e<n.day?t<2*n.day?"%h:%M":"%b %d %h:%M":e<n.month?"%b %d":e<n.year?t<n.year?"%b":"%b %y":"%y"},formatter:function(e,t){var n=t.options,r=Flotr.Date.timeUnits[n.timeUnit],i=new Date(e*r);if(t.options.timeFormat)return Flotr.Date.format(i,n.timeFormat,n.timeMode);var s=(t.max-t.min)*r,o=t.tickSize*Flotr.Date.timeUnits[t.tickUnit];return Flotr.Date.format(i,Flotr.Date.getFormat(o,s),n.timeMode)},generator:function(e){function y(e){t(m,e,o,Flotr.floorInBase(n(m,e,o),h))}var t=this.set,n=this.get,r=this.timeUnits,i=this.spec,s=e.options,o=s.timeMode,u=r[s.timeUnit],a=e.min*u,f=e.max*u,l=(f-a)/s.noTicks,c=[],h=e.tickSize,p,d,v;d=s.tickFormatter===Flotr.defaultTickFormatter?this.formatter:s.tickFormatter;for(v=0;v<i.length-1;++v){var m=i[v][0]*r[i[v][1]];if(l<(m+i[v+1][0]*r[i[v+1][1]])/2&&m>=h)break}h=i[v][0],p=i[v][1],p=="year"&&(h=Flotr.getTickSize(s.noTicks*r.year,a,f,0),h==.5&&(p="month",h=6)),e.tickUnit=p,e.tickSize=h;var g=h*r[p];m=new Date(a);switch(p){case"millisecond":y("Milliseconds");break;case"second":y("Seconds");break;case"minute":y("Minutes");break;case"hour":y("Hours");break;case"month":y("Month");break;case"year":y("FullYear")}g>=r.second&&t(m,"Milliseconds",o,0),g>=r.minute&&t(m,"Seconds",o,0),g>=r.hour&&t(m,"Minutes",o,0),g>=r.day&&t(m,"Hours",o,0),g>=r.day*4&&t(m,"Date",o,1),g>=r.year&&t(m,"Month",o,0);var b=0,w=NaN,E;do{E=w,w=m.getTime(),c.push({v:w/u,label:d(w/u,e)});if(p=="month")if(h<1){t(m,"Date",o,1);var S=m.getTime();t(m,"Month",o,n(m,"Month",o)+1);var x=m.getTime();m.setTime(w+b*r.hour+(x-S)*h),b=n(m,"Hours",o),t(m,"Hours",o,0)}else t(m,"Month",o,n(m,"Month",o)+h);else p=="year"?t(m,"FullYear",o,n(m,"FullYear",o)+h):m.setTime(w+g)}while(w<f&&w!=E);return c},timeUnits:{millisecond:1,second:1e3,minute:6e4,hour:36e5,day:864e5,month:2592e6,year:31556952e3},spec:[[1,"millisecond"],[20,"millisecond"],[50,"millisecond"],[100,"millisecond"],[200,"millisecond"],[500,"millisecond"],[1,"second"],[2,"second"],[5,"second"],[10,"second"],[30,"second"],[1,"minute"],[2,"minute"],[5,"minute"],[10,"minute"],[30,"minute"],[1,"hour"],[2,"hour"],[4,"hour"],[8,"hour"],[12,"hour"],[1,"day"],[2,"day"],[3,"day"],[.25,"month"],[.5,"month"],[1,"month"],[2,"month"],[3,"month"],[6,"month"],[1,"year"]],monthNames:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]},function(){function t(e){return e&&e.jquery?e[0]:e}var e=Flotr._;Flotr.DOM={addClass:function(n,r){n=t(n);var i=n.className?n.className:"";if(e.include(i.split(/\s+/g),r))return;n.className=(i?i+" ":"")+r},create:function(e){return document.createElement(e)},node:function(e){var t=Flotr.DOM.create("div"),n;return t.innerHTML=e,n=t.children[0],t.innerHTML="",n},empty:function(e){e=t(e),e.innerHTML=""},remove:function(e){e=t(e),e.parentNode.removeChild(e)},hide:function(e){e=t(e),Flotr.DOM.setStyles(e,{display:"none"})},insert:function(n,r){n=t(n),e.isString(r)?n.innerHTML+=r:e.isElement(r)&&n.appendChild(r)},opacity:function(e,n){e=t(e),e.style.opacity=n},position:function(e,n){return e=t(e),e.offsetParent?(n=this.position(e.offsetParent),n.left+=e.offsetLeft,n.top+=e.offsetTop,n):{left:e.offsetLeft||0,top:e.offsetTop||0}},removeClass:function(n,r){var i=n.className?n.className:"";n=t(n),n.className=e.filter(i.split(/\s+/g),function(e){if(e!=r)return!0}).join(" ")},setStyles:function(n,r){n=t(n),e.each(r,function(e,t){n.style[t]=e})},show:function(e){e=t(e),Flotr.DOM.setStyles(e,{display:""})},size:function(e){return e=t(e),{height:e.offsetHeight,width:e.offsetWidth}}}}(),function(){var e=Flotr,t=e.bean;e.EventAdapter={observe:function(e,n,r){return t.add(e,n,r),this},fire:function(e,n,r){return t.fire(e,n,r),typeof Prototype!="undefined"&&Event.fire(e,n,r),this},stopObserving:function(e,n,r){return t.remove(e,n,r),this},eventPointer:function(t){if(!e._.isUndefined(t.touches)&&t.touches.length>0)return{x:t.touches[0].pageX,y:t.touches[0].pageY};if(!e._.isUndefined(t.changedTouches)&&t.changedTouches.length>0)return{x:t.changedTouches[0].pageX,y:t.changedTouches[0].pageY};if(t.pageX||t.pageY)return{x:t.pageX,y:t.pageY};if(t.clientX||t.clientY){var n=document,r=n.body,i=n.documentElement;return{x:t.clientX+r.scrollLeft+i.scrollLeft,y:t.clientY+r.scrollTop+i.scrollTop}}}}}(),function(){var e=Flotr,t=e.DOM,n=e._,r=function(e){this.o=e};r.prototype={dimensions:function(e,t,n,r){return e?this.o.html?this.html(e,this.o.element,n,r):this.canvas(e,t):{width:0,height:0}},canvas:function(t,n){if(!this.o.textEnabled)return;n=n||{};var r=this.measureText(t,n),i=r.width,s=n.size||e.defaultOptions.fontSize,o=n.angle||0,u=Math.cos(o),a=Math.sin(o),f=2,l=6,c;return c={width:Math.abs(u*i)+Math.abs(a*s)+f,height:Math.abs(a*i)+Math.abs(u*s)+l},c},html:function(e,n,r,i){var s=t.create("div");return t.setStyles(s,{position:"absolute",top:"-10000px"}),t.insert(s,'<div style="'+r+'" class="'+i+' flotr-dummy-div">'+e+"</div>"),t.insert(this.o.element,s),t.size(s)},measureText:function(t,r){var i=this.o.ctx,s;return!i.fillText||e.isIphone&&i.measure?{width:i.measure(t,r)}:(r=n.extend({size:e.defaultOptions.fontSize,weight:1,angle:0},r),i.save(),i.font=(r.weight>1?"bold ":"")+r.size*1.3+"px sans-serif",s=i.measureText(t),i.restore(),s)}},Flotr.Text=r}(),function(){function i(e,n,r){return t.observe.apply(this,arguments),this._handles.push(arguments),this}var e=Flotr.DOM,t=Flotr.EventAdapter,n=Flotr._,r=Flotr;Graph=function(e,i,s){this._setEl(e),this._initMembers(),this._initPlugins(),t.fire(this.el,"flotr:beforeinit",[this]),this.data=i,this.series=r.Series.getSeries(i),this._initOptions(s),this._initGraphTypes(),this._initCanvas(),this._text=new r.Text({element:this.el,ctx:this.ctx,html:this.options.HtmlText,textEnabled:this.textEnabled}),t.fire(this.el,"flotr:afterconstruct",[this]),this._initEvents(),this.findDataRanges(),this.calculateSpacing(),this.draw(n.bind(function(){t.fire(this.el,"flotr:afterinit",[this])},this))},Graph.prototype={destroy:function(){t.fire(this.el,"flotr:destroy"),n.each(this._handles,function(e){t.stopObserving.apply(this,e)}),this._handles=[],this.el.graph=null},observe:i,_observe:i,processColor:function(e,t){var i={x1:0,y1:0,x2:this.plotWidth,y2:this.plotHeight,opacity:1,ctx:this.ctx};return n.extend(i,t),r.Color.processColor(e,i)},findDataRanges:function(){var e=this.axes,t,i,s;n.each(this.series,function(e){s=e.getRange(),s&&(t=e.xaxis,i=e.yaxis,t.datamin=Math.min(s.xmin,t.datamin),t.datamax=Math.max(s.xmax,t.datamax),i.datamin=Math.min(s.ymin,i.datamin),i.datamax=Math.max(s.ymax,i.datamax),t.used=t.used||s.xused,i.used=i.used||s.yused)},this),!e.x.used&&!e.x2.used&&(e.x.used=!0),!e.y.used&&!e.y2.used&&(e.y.used=!0),n.each(e,function(e){e.calculateRange()});var o=n.keys(r.graphTypes),u=!1;n.each(this.series,function(e){if(e.hide)return;n.each(o,function(t){e[t]&&e[t].show&&(this.extendRange(t,e),u=!0)},this),u||this.extendRange(this.options.defaultType,e)},this)},extendRange:function(e,t){this[e].extendRange&&this[e].extendRange(t,t.data,t[e],this[e]),this[e].extendYRange&&this[e].extendYRange(t.yaxis,t.data,t[e],this[e]),this[e].extendXRange&&this[e].extendXRange(t.xaxis,t.data,t[e],this[e])},calculateSpacing:function(){var e=this.axes,t=this.options,r=this.series,i=t.grid.labelMargin,s=this._text,o=e.x,u=e.x2,a=e.y,f=e.y2,l=t.grid.outlineWidth,c,h,p,d;n.each(e,function(e){e.calculateTicks(),e.calculateTextDimensions(s,t)}),d=s.dimensions(t.title,{size:t.fontSize*1.5},"font-size:1em;font-weight:bold;","flotr-title"),this.titleHeight=d.height,d=s.dimensions(t.subtitle,{size:t.fontSize},"font-size:smaller;","flotr-subtitle"),this.subtitleHeight=d.height;for(h=0;h<t.length;++h)r[h].points.show&&(l=Math.max(l,r[h].points.radius+r[h].points.lineWidth/2));var v=this.plotOffset;o.options.margin===!1?(v.bottom=0,v.top=0):o.options.margin===!0?(v.bottom+=(t.grid.circular?0:o.used&&o.options.showLabels?o.maxLabel.height+i:0)+(o.used&&o.options.title?o.titleSize.height+i:0)+l,v.top+=(t.grid.circular?0:u.used&&u.options.showLabels?u.maxLabel.height+i:0)+(u.used&&u.options.title?u.titleSize.height+i:0)+this.subtitleHeight+this.titleHeight+l):(v.bottom=o.options.margin,v.top=o.options.margin),a.options.margin===!1?(v.left=0,v.right=0):a.options.margin===!0?(v.left+=(t.grid.circular?0:a.used&&a.options.showLabels?a.maxLabel.width+i:0)+(a.used&&a.options.title?a.titleSize.width+i:0)+l,v.right+=(t.grid.circular?0:f.used&&f.options.showLabels?f.maxLabel.width+i:0)+(f.used&&f.options.title?f.titleSize.width+i:0)+l):(v.left=a.options.margin,v.right=a.options.margin),v.top=Math.floor(v.top),this.plotWidth=this.canvasWidth-v.left-v.right,this.plotHeight=this.canvasHeight-v.bottom-v.top,o.length=u.length=this.plotWidth,a.length=f.length=this.plotHeight,a.offset=f.offset=this.plotHeight,o.setScale(),u.setScale(),a.setScale(),f.setScale()},draw:function(e){var n=this.ctx,r;t.fire(this.el,"flotr:beforedraw",[this.series,this]);if(this.series.length){n.save(),n.translate(this.plotOffset.left,this.plotOffset.top);for(r=0;r<this.series.length;r++)this.series[r].hide||this.drawSeries(this.series[r]);n.restore(),this.clip()}t.fire(this.el,"flotr:afterdraw",[this.series,this]),e&&e()},drawSeries:function(e){function t(e,t){var n=this.getOptions(e,t);this[t].draw(n)}var i=!1;e=e||this.series,n.each(r.graphTypes,function(n,r){e[r]&&e[r].show&&this[r]&&(i=!0,t.call(this,e,r))},this),i||t.call(this,e,this.options.defaultType)},getOptions:function(e,t){var n=e[t],i=this[t],s=e.xaxis,o=e.yaxis,u={context:this.ctx,width:this.plotWidth,height:this.plotHeight,fontSize:this.options.fontSize,fontColor:this.options.fontColor,textEnabled:this.textEnabled,htmlText:this.options.HtmlText,text:this._text,element:this.el,data:e.data,color:e.color,shadowSize:e.shadowSize,xScale:s.d2p,yScale:o.d2p,xInverse:s.p2d,yInverse:o.p2d};return u=r.merge(n,u),u.fillStyle=this.processColor(n.fillColor||e.color,{opacity:n.fillOpacity}),u},getEventPosition:function(n){var r=document,i=r.body,s=r.documentElement,o=this.axes,u=this.plotOffset,a=this.lastMousePos,f=t.eventPointer(n),l=f.x-a.pageX,c=f.y-a.pageY,h,p,d;return"ontouchstart"in this.el?(h=e.position(this.overlay),p=f.x-h.left-u.left,d=f.y-h.top-u.top):(h=this.overlay.getBoundingClientRect(),p=n.clientX-h.left-u.left-i.scrollLeft-s.scrollLeft,d=n.clientY-h.top-u.top-i.scrollTop-s.scrollTop),{x:o.x.p2d(p),x2:o.x2.p2d(p),y:o.y.p2d(d),y2:o.y2.p2d(d),relX:p,relY:d,dX:l,dY:c,absX:f.x,absY:f.y,pageX:f.x,pageY:f.y}},clickHandler:function(e){if(this.ignoreClick)return this.ignoreClick=!1,this.ignoreClick;t.fire(this.el,"flotr:click",[this.getEventPosition(e),this])},mouseMoveHandler:function(e){if(this.mouseDownMoveHandler)return;var n=this.getEventPosition(e);t.fire(this.el,"flotr:mousemove",[e,n,this]),this.lastMousePos=n},mouseDownHandler:function(e){if(this.mouseUpHandler)return;this.mouseUpHandler=n.bind(function(e){t.stopObserving(document,"mouseup",this.mouseUpHandler),t.stopObserving(document,"mousemove",this.mouseDownMoveHandler),this.mouseDownMoveHandler=null,this.mouseUpHandler=null,t.fire(this.el,"flotr:mouseup",[e,this])},this),this.mouseDownMoveHandler=n.bind(function(n){var r=this.getEventPosition(n);t.fire(this.el,"flotr:mousemove",[e,r,this]),this.lastMousePos=r},this),t.observe(document,"mouseup",this.mouseUpHandler),t.observe(document,"mousemove",this.mouseDownMoveHandler),t.fire(this.el,"flotr:mousedown",[e,this]),this.ignoreClick=!1},drawTooltip:function(t,n,r,i){var s=this.getMouseTrack(),o="opacity:0.7;background-color:#000;color:#fff;display:none;position:absolute;padding:2px 8px;-moz-border-radius:4px;border-radius:4px;white-space:nowrap;",u=i.position,a=i.margin,f=this.plotOffset;n!==null&&r!==null?(i.relative?(u.charAt(0)=="n"?o+="bottom:"+(a-f.top-r+this.canvasHeight)+"px;top:auto;":u.charAt(0)=="s"&&(o+="top:"+(a+f.top+r)+"px;bottom:auto;"),u.charAt(1)=="e"?o+="left:"+(a+f.left+n)+"px;right:auto;":u.charAt(1)=="w"&&(o+="right:"+(a-f.left-n+this.canvasWidth)+"px;left:auto;")):(u.charAt(0)=="n"?o+="top:"+(a+f.top)+"px;bottom:auto;":u.charAt(0)=="s"&&(o+="bottom:"+(a+f.bottom)+"px;top:auto;"),u.charAt(1)=="e"?o+="right:"+(a+f.right)+"px;left:auto;":u.charAt(1)=="w"&&(o+="left:"+(a+f.left)+"px;right:auto;")),s.style.cssText=o,e.empty(s),e.insert(s,t),e.show(s)):e.hide(s)},clip:function(e){var t=this.plotOffset,n=this.canvasWidth,i=this.canvasHeight;e=e||this.ctx;if(r.isIE&&r.isIE<9&&!r.isFlashCanvas){if(e===this.octx)return;e.save(),e.fillStyle=this.processColor(this.options.ieBackgroundColor),e.fillRect(0,0,n,t.top),e.fillRect(0,0,t.left,i),e.fillRect(0,i-t.bottom,n,t.bottom),e.fillRect(n-t.right,0,t.right,i),e.restore()}else e.clearRect(0,0,n,t.top),e.clearRect(0,0,t.left,i),e.clearRect(0,i-t.bottom,n,t.bottom),e.clearRect(n-t.right,0,t.right,i)},_initMembers:function(){this._handles=[],this.lastMousePos={pageX:null,pageY:null},this.plotOffset={left:0,right:0,top:0,bottom:0},this.ignoreClick=!0,this.prevHit=null},_initGraphTypes:function(){n.each(r.graphTypes,function(e,t){this[t]=r.clone(e)},this)},_initEvents:function(){var e=this.el,r,i,s;"ontouchstart"in e?(r=n.bind(function(n){s=!0,t.stopObserving(document,"touchend",r),t.fire(e,"flotr:mouseup",[event,this]),this.multitouches=null,i||this.clickHandler(n)},this),this.observe(this.overlay,"touchstart",n.bind(function(n){i=!1,s=!1,this.ignoreClick=!1,n.touches&&n.touches.length>1&&(this.multitouches=n.touches),t.fire(e,"flotr:mousedown",[event,this]),this.observe(document,"touchend",r)},this)),this.observe(this.overlay,"touchmove",n.bind(function(n){var r=this.getEventPosition(n);this.options.preventDefault&&n.preventDefault(),i=!0,this.multitouches||n.touches&&n.touches.length>1?this.multitouches=n.touches:s||t.fire(e,"flotr:mousemove",[event,r,this]),this.lastMousePos=r},this))):this.observe(this.overlay,"mousedown",n.bind(this.mouseDownHandler,this)).observe(e,"mousemove",n.bind(this.mouseMoveHandler,this)).observe(this.overlay,"click",n.bind(this.clickHandler,this)).observe(e,"mouseout",function(n){t.fire(e,"flotr:mouseout",n)})},_initCanvas:function(){function l(i,s){return i||(i=e.create("canvas"),typeof FlashCanvas!="undefined"&&typeof i.getContext=="function"&&(FlashCanvas.initElement(i),this.isFlashCanvas=!0),i.className="flotr-"+s,i.style.cssText="position:absolute;left:0px;top:0px;",e.insert(t,i)),n.each(a,function(t,n){e.show(i);if(s=="canvas"&&i.getAttribute(n)===t)return;i.setAttribute(n,t*r.resolution),i.style[n]=t+"px"}),i.context_=null,i}function c(e){window.G_vmlCanvasManager&&window.G_vmlCanvasManager.initElement(e);var t=e.getContext("2d");return window.G_vmlCanvasManager||t.scale(r.resolution,r.resolution),t}var t=this.el,r=this.options,i=t.children,s=[],o,u,a,f;for(u=i.length;u--;)o=i[u],!this.canvas&&o.className==="flotr-canvas"?this.canvas=o:!this.overlay&&o.className==="flotr-overlay"?this.overlay=o:s.push(o);for(u=s.length;u--;)t.removeChild(s[u]);e.setStyles(t,{position:"relative"}),a={},a.width=t.clientWidth,a.height=t.clientHeight;if(a.width<=0||a.height<=0||r.resolution<=0)throw"Invalid dimensions for plot, width = "+a.width+", height = "+a.height+", resolution = "+r.resolution;this.canvas=l(this.canvas,"canvas"),this.overlay=l(this.overlay,"overlay"),this.ctx=c(this.canvas),this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height),this.octx=c(this.overlay),this.octx.clearRect(0,0,this.overlay.width,this.overlay.height),this.canvasHeight=a.height,this.canvasWidth=a.width,this.textEnabled=!!this.ctx.drawText||!!this.ctx.fillText},_initPlugins:function(){n.each(r.plugins,function(e,t){n.each(e.callbacks,function(e,t){this.observe(this.el,t,n.bind(e,this))},this),this[t]=r.clone(e),n.each(this[t],function(e,r){n.isFunction(e)&&(this[t][r]=n.bind(e,this))},this)},this)},_initOptions:function(e){var i=r.clone(r.defaultOptions);i.x2axis=n.extend(n.clone(i.xaxis),i.x2axis),i.y2axis=n.extend(n.clone(i.yaxis),i.y2axis),this.options=r.merge(e||{},i),this.options.grid.minorVerticalLines===null&&this.options.xaxis.scaling==="logarithmic"&&(this.options.grid.minorVerticalLines=!0),this.options.grid.minorHorizontalLines===null&&this.options.yaxis.scaling==="logarithmic"&&(this.options.grid.minorHorizontalLines=!0),t.fire(this.el,"flotr:afterinitoptions",[this]),this.axes=r.Axis.getAxes(this.options);var s=[],o=[],u=this.series.length,a=this.series.length,f=this.options.colors,l=[],c=0,h,p,d,v;for(p=a-1;p>-1;--p)h=this.series[p].color,h&&(--a,n.isNumber(h)?s.push(h):l.push(r.Color.parse(h)));for(p=s.length-1;p>-1;--p)a=Math.max(a,s[p]+1);for(p=0;o.length<a;){h=f.length==p?new r.Color(100,100,100):r.Color.parse(f[p]);var m=c%2==1?-1:1,g=1+m*Math.ceil(c/2)*.2;h.scale(g,g,g),o.push(h),++p>=f.length&&(p=0,++c)}for(p=0,d=0;p<u;++p){v=this.series[p],v.color?n.isNumber(v.color)&&(v.color=o[v.color].toString()):v.color=o[d++].toString(),v.xaxis||(v.xaxis=this.axes.x),v.xaxis==1?v.xaxis=this.axes.x:v.xaxis==2&&(v.xaxis=this.axes.x2),v.yaxis||(v.yaxis=this.axes.y),v.yaxis==1?v.yaxis=this.axes.y:v.yaxis==2&&(v.yaxis=this.axes.y2);for(var y in r.graphTypes)v[y]=n.extend(n.clone(this.options[y]),v[y]);v.mouse=n.extend(n.clone(this.options.mouse),v.mouse),n.isUndefined(v.shadowSize)&&(v.shadowSize=this.options.shadowSize)}},_setEl:function(e){if(!e)throw"The target container doesn't exist";if(e.graph instanceof Graph)e.graph.destroy();else if(!e.clientWidth)throw"The target container must be visible";e.graph=this,this.el=e}},Flotr.Graph=Graph}(),function(){function n(t){this.orientation=1,this.offset=0,this.datamin=Number.MAX_VALUE,this.datamax=-Number.MAX_VALUE,e.extend(this,t)}function r(e,t){return e=Math.log(Math.max(e,Number.MIN_VALUE)),t!==Math.E&&(e/=Math.log(t)),e}function s(e,t){return t===Math.E?Math.exp(e):Math.pow(t,e)}var e=Flotr._,t="logarithmic";n.prototype={setScale:function(){var e=this.length,n=this.max,i=this.min,o=this.offset,u=this.orientation,a=this.options,f=a.scaling===t,l;f?l=e/(r(n,a.base)-r(i,a.base)):l=e/(n-i),this.scale=l,f?(this.d2p=function(e){return o+u*(r(e,a.base)-r(i,a.base))*l},this.p2d=function(e){return s((o+u*e)/l+r(i,a.base),a.base)}):(this.d2p=function(e){return o+u*(e-i)*l},this.p2d=function(e){return(o+u*e)/l+i})},calculateTicks:function(){var t=this.options;this.ticks=[],this.minorTicks=[],t.ticks?(this._cleanUserTicks(t.ticks,this.ticks),this._cleanUserTicks(t.minorTicks||[],this.minorTicks)):t.mode=="time"?this._calculateTimeTicks():t.scaling==="logarithmic"?this._calculateLogTicks():this._calculateTicks(),e.each(this.ticks,function(e){e.label+=""}),e.each(this.minorTicks,function(e){e.label+=""})},calculateRange:function(){if(!this.used)return;var e=this,t=e.options,n=t.min!==null?t.min:e.datamin,r=t.max!==null?t.max:e.datamax,i=t.autoscaleMargin;t.scaling=="logarithmic"&&(n<=0&&(n=e.datamin),r<=0&&(r=n));if(r==n){var s=r?.01:1;t.min===null&&(n-=s),t.max===null&&(r+=s)}if(t.scaling==="logarithmic"){n<0&&(n=r/t.base);var o=Math.log(r);t.base!=Math.E&&(o/=Math.log(t.base)),o=Math.ceil(o);var u=Math.log(n);t.base!=Math.E&&(u/=Math.log(t.base)),u=Math.ceil(u),e.tickSize=Flotr.getTickSize(t.noTicks,u,o,t.tickDecimals===null?0:t.tickDecimals),t.minorTickFreq===null&&(o-u>10?t.minorTickFreq=0:o-u>5?t.minorTickFreq=2:t.minorTickFreq=5)}else e.tickSize=Flotr.getTickSize(t.noTicks,n,r,t.tickDecimals);e.min=n,e.max=r,t.min===null&&t.autoscale&&(e.min-=e.tickSize*i,e.min<0&&e.datamin>=0&&(e.min=0),e.min=e.tickSize*Math.floor(e.min/e.tickSize)),t.max===null&&t.autoscale&&(e.max+=e.tickSize*i,e.max>0&&e.datamax<=0&&e.datamax!=e.datamin&&(e.max=0),e.max=e.tickSize*Math.ceil(e.max/e.tickSize)),e.min==e.max&&(e.max=e.min+1)},calculateTextDimensions:function(e,t){var n="",r,i;if(this.options.showLabels)for(i=0;i<this.ticks.length;++i)r=this.ticks[i].label.length,r>n.length&&(n=this.ticks[i].label);this.maxLabel=e.dimensions(n,{size:t.fontSize,angle:Flotr.toRad(this.options.labelsAngle)},"font-size:smaller;","flotr-grid-label"),this.titleSize=e.dimensions(this.options.title,{size:t.fontSize*1.2,angle:Flotr.toRad(this.options.titleAngle)},"font-weight:bold;","flotr-axis-title")},_cleanUserTicks:function(t,n){var r=this,i=this.options,s,o,u,a;e.isFunction(t)&&(t=t({min:r.min,max:r.max}));for(o=0;o<t.length;++o)a=t[o],typeof a=="object"?(s=a[0],u=a.length>1?a[1]:i.tickFormatter(s,{min:r.min,max:r.max})):(s=a,u=i.tickFormatter(s,{min:this.min,max:this.max})),n[o]={v:s,label:u}},_calculateTimeTicks:function(){this.ticks=Flotr.Date.generator(this)},_calculateLogTicks:function(){var e=this,t=e.options,n,r,s=Math.log(e.max);t.base!=Math.E&&(s/=Math.log(t.base)),s=Math.ceil(s);var o=Math.log(e.min);t.base!=Math.E&&(o/=Math.log(t.base)),o=Math.ceil(o);for(i=o;i<s;i+=e.tickSize){r=t.base==Math.E?Math.exp(i):Math.pow(t.base,i);var u=r*(t.base==Math.E?Math.exp(e.tickSize):Math.pow(t.base,e.tickSize)),a=(u-r)/t.minorTickFreq;e.ticks.push({v:r,label:t.tickFormatter(r,{min:e.min,max:e.max})});for(n=r+a;n<u;n+=a)e.minorTicks.push({v:n,label:t.tickFormatter(n,{min:e.min,max:e.max})})}r=t.base==Math.E?Math.exp(i):Math.pow(t.base,i),e.ticks.push({v:r,label:t.tickFormatter(r,{min:e.min,max:e.max})})},_calculateTicks:function(){var e=this,t=e.options,n=e.tickSize,r=e.min,i=e.max,s=n*Math.ceil(r/n),o,u,a,f,l,c;t.minorTickFreq&&(u=n/t.minorTickFreq);for(l=0;(a=f=s+l*n)<=i;++l){o=t.tickDecimals,o===null&&(o=1-Math.floor(Math.log(n)/Math.LN10)),o<0&&(o=0),a=a.toFixed(o),e.ticks.push({v:a,label:t.tickFormatter(a,{min:e.min,max:e.max})});if(t.minorTickFreq)for(c=0;c<t.minorTickFreq&&l*n+c*u<i;++c)a=f+c*u,e.minorTicks.push({v:a,label:t.tickFormatter(a,{min:e.min,max:e.max})})}}},e.extend(n,{getAxes:function(e){return{x:new n({options:e.xaxis,n:1,length:this.plotWidth}),x2:new n({options:e.x2axis,n:2,length:this.plotWidth}),y:new n({options:e.yaxis,n:1,length:this.plotHeight,offset:this.plotHeight,orientation:-1}),y2:new n({options:e.y2axis,n:2,length:this.plotHeight,offset:this.plotHeight,orientation:-1})}}}),Flotr.Axis=n}(),function(){function t(t){e.extend(this,t)}var e=Flotr._;t.prototype={getRange:function(){var e=this.data,t=e.length,n=Number.MAX_VALUE,r=Number.MAX_VALUE,i=-Number.MAX_VALUE,s=-Number.MAX_VALUE,o=!1,u=!1,a,f,l;if(t<0||this.hide)return!1;for(l=0;l<t;l++)a=e[l][0],f=e[l][1],a!==null&&(a<n&&(n=a,o=!0),a>i&&(i=a,o=!0)),f!==null&&(f<r&&(r=f,u=!0),f>s&&(s=f,u=!0));return{xmin:n,xmax:i,ymin:r,ymax:s,xused:o,yused:u}}},e.extend(t,{getSeries:function(n){return e.map(n,function(n){var r;return n.data?(r=new t,e.extend(r,n)):r=new t({data:n}),r})}}),Flotr.Series=t}(),Flotr.addType("lines",{options:{show:!1,lineWidth:2,fill:!1,fillBorder:!1,fillColor:null,fillOpacity:.4,steps:!1,stacked:!1},stack:{values:[]},draw:function(e){var t=e.context,n=e.lineWidth,r=e.shadowSize,i;t.save(),t.lineJoin="round",r&&(t.lineWidth=r/2,i=n/2+t.lineWidth/2,t.strokeStyle="rgba(0,0,0,0.1)",this.plot(e,i+r/2,!1),t.strokeStyle="rgba(0,0,0,0.2)",this.plot(e,i,!1)),t.lineWidth=n,t.strokeStyle=e.color,this.plot(e,0,!0),t.restore()},plot:function(e,t,n){function S(){!t&&e.fill&&d&&(v=o(d[0]),r.fillStyle=e.fillStyle,r.lineTo(m,p),r.lineTo(v,p),r.lineTo(v,u(d[1])),r.fill(),e.fillBorder&&r.stroke())}var r=e.context,i=e.width,s=e.height,o=e.xScale,u=e.yScale,a=e.data,f=e.stacked?this.stack:!1,l=a.length-1,c=null,h=null,p=u(0),d=null,v,m,g,y,b,w,E;if(l<1)return;r.beginPath();for(E=0;E<l;++E){if(a[E][1]===null||a[E+1][1]===null){e.fill&&E>0&&a[E][1]!==null&&(r.stroke(),S(),d=null,r.closePath(),r.beginPath());continue}v=o(a[E][0]),m=o(a[E+1][0]),d===null&&(d=a[E]),f?(b=f.values[a[E][0]]||0,w=f.values[a[E+1][0]]||f.values[a[E][0]]||0,g=u(a[E][1]+b),y=u(a[E+1][1]+w),n&&(a[E].y0=b,f.values[a[E][0]]=a[E][1]+b,E==l-1&&(a[E+1].y0=w,f.values[a[E+1][0]]=a[E+1][1]+w))):(g=u(a[E][1]),y=u(a[E+1][1]));if(g>s&&y>s||g<0&&y<0||v<0&&m<0||v>i&&m>i)continue;(c!=v||h!=g+t)&&r.moveTo(v,g+t),c=m,h=y+t,e.steps?(r.lineTo(c+t/2,g+t),r.lineTo(c+t/2,h)):r.lineTo(c,h)}(!e.fill||e.fill&&!e.fillBorder)&&r.stroke(),S(),r.closePath()},extendYRange:function(e,t,n,r){var i=e.options;if(n.stacked&&(!i.max&&i.max!==0||!i.min&&i.min!==0)){var s=e.max,o=e.min,u=r.positiveSums||{},a=r.negativeSums||{},f,l;for(l=0;l<t.length;l++)f=t[l][0]+"",t[l][1]>0?(u[f]=(u[f]||0)+t[l][1],s=Math.max(s,u[f])):(a[f]=(a[f]||0)+t[l][1],o=Math.min(o,a[f]));r.negativeSums=a,r.positiveSums=u,e.max=s,e.min=o}n.steps&&(this.hit=function(e){var t=e.data,n=e.args,r=e.yScale,i=n[0],s=t.length,o=n[1],u=e.xInverse(i.relX),a=i.relY,f;for(f=0;f<s-1;f++)if(u>=t[f][0]&&u<=t[f+1][0]){Math.abs(r(t[f][1])-a)<8&&(o.x=t[f][0],o.y=t[f][1],o.index=f,o.seriesIndex=e.index);break}},this.drawHit=function(e){var t=e.context,n=e.args,r=e.data,i=e.xScale,s=n.index,o=i(n.x),u=e.yScale(n.y),a;r.length-1>s&&(a=e.xScale(r[s+1][0]),t.save(),t.strokeStyle=e.color,t.lineWidth=e.lineWidth,t.beginPath(),t.moveTo(o,u),t.lineTo(a,u),t.stroke(),t.closePath(),t.restore())},this.clearHit=function(e){var t=e.context,n=e.args,r=e.data,i=e.xScale,s=e.lineWidth,o=n.index,u=i(n.x),a=e.yScale(n.y),f;r.length-1>o&&(f=e.xScale(r[o+1][0]),t.clearRect(u-s,a-s,f-u+2*s,2*s))})}}),Flotr.addType("bars",{options:{show:!1,lineWidth:2,barWidth:1,fill:!0,fillColor:null,fillOpacity:.4,horizontal:!1,stacked:!1,centered:!0,topPadding:.1,grouped:!1},stack:{positive:[],negative:[],_positive:[],_negative:[]},draw:function(e){var t=e.context;this.current+=1,t.save(),t.lineJoin="miter",t.lineWidth=e.lineWidth,t.strokeStyle=e.color,e.fill&&(t.fillStyle=e.fillStyle),this.plot(e),t.restore()},plot:function(e){var t=e.data,n=e.context,r=e.shadowSize,i,s,o,u,a,f;if(t.length<1)return;this.translate(n,e.horizontal);for(i=0;i<t.length;i++){s=this.getBarGeometry(t[i][0],t[i][1],e);if(s===null)continue;o=s.left,u=s.top,a=s.width,f=s.height,e.fill&&n.fillRect(o,u,a,f),r&&(n.save(),n.fillStyle="rgba(0,0,0,0.05)",n.fillRect(o+r,u+r,a,f),n.restore()),e.lineWidth&&n.strokeRect(o,u,a,f)}},translate:function(e,t){t&&(e.rotate(-Math.PI/2),e.scale(-1,1))},getBarGeometry:function(e,t,n){var r=n.horizontal,i=n.barWidth,s=n.centered,o=n.stacked?this.stack:!1,u=n.lineWidth,a=s?i/2:0,f=r?n.yScale:n.xScale,l=r?n.xScale:n.yScale,c=r?t:e,h=r?e:t,p=0,d,v,m,g,y;return n.grouped&&(this.current/this.groups,c-=a,i/=this.groups,a=i/2,c=c+i*this.current-a),o&&(d=h>0?o.positive:o.negative,p=d[c]||p,d[c]=p+h),v=f(c-a),m=f(c+i-a),g=l(h+p),y=l(p),y<0&&(y=0),e===null||t===null?null:{x:c,y:h,xScale:f,yScale:l,top:g,left:Math.min(v,m)-u/2,width:Math.abs(m-v)-u,height:y-g}},hit:function(e){var t=e.data,n=e.args,r=n[0],i=n[1],s=e.xInverse(r.relX),o=e.yInverse(r.relY),u=this.getBarGeometry(s,o,e),a=u.width/2,f=u.left,l=u.y,c,h;for(h=t.length;h--;)c=this.getBarGeometry(t[h][0],t[h][1],e),(l>0&&l<c.y||l<0&&l>c.y)&&Math.abs(f-c.left)<a&&(i.x=t[h][0],i.y=t[h][1],i.index=h,i.seriesIndex=e.index)},drawHit:function(e){var t=e.context,n=e.args,r=this.getBarGeometry(n.x,n.y,e),i=r.left,s=r.top,o=r.width,u=r.height;t.save(),t.strokeStyle=e.color,t.lineWidth=e.lineWidth,this.translate(t,e.horizontal),t.beginPath(),t.moveTo(i,s+u),t.lineTo(i,s),t.lineTo(i+o,s),t.lineTo(i+o,s+u),e.fill&&(t.fillStyle=e.fillStyle,t.fill()),t.stroke(),t.closePath(),t.restore()},clearHit:function(e){var t=e.context,n=e.args,r=this.getBarGeometry(n.x,n.y,e),i=r.left,s=r.width,o=r.top,u=r.height,a=2*e.lineWidth;t.save(),this.translate(t,e.horizontal),t.clearRect(i-a,Math.min(o,o+u)-a,s+2*a,Math.abs(u)+2*a),t.restore()},extendXRange:function(e,t,n,r){this._extendRange(e,t,n,r),this.groups=this.groups+1||1,this.current=0},extendYRange:function(e,t,n,r){this._extendRange(e,t,n,r)},_extendRange:function(e,t,n,r){var i=e.options.max;if(_.isNumber(i)||_.isString(i))return;var s=e.min,o=e.max,u=n.horizontal,a=e.orientation,f=this.positiveSums||{},l=this.negativeSums||{},c,h,p,d;(a==1&&!u||a==-1&&u)&&n.centered&&(o=Math.max(e.datamax+n.barWidth,o),s=Math.min(e.datamin-n.barWidth,s));if(n.stacked&&(a==1&&u||a==-1&&!u))for(d=t.length;d--;)c=t[d][a==1?1:0]+"",h=t[d][a==1?0:1],h>0?(f[c]=(f[c]||0)+h,o=Math.max(o,f[c])):(l[c]=(l[c]||0)+h,s=Math.min(s,l[c]));(a==1&&u||a==-1&&!u)&&n.topPadding&&(e.max===e.datamax||n.stacked&&this.stackMax!==o)&&(o+=n.topPadding*(o-s)),this.stackMin=s,this.stackMax=o,this.negativeSums=l,this.positiveSums=f,e.max=o,e.min=s}}),Flotr.addType("bubbles",{options:{show:!1,lineWidth:2,fill:!0,fillOpacity:.4,baseRadius:2},draw:function(e){var t=e.context,n=e.shadowSize;t.save(),t.lineWidth=e.lineWidth,t.fillStyle="rgba(0,0,0,0.05)",t.strokeStyle="rgba(0,0,0,0.05)",this.plot(e,n/2),t.strokeStyle="rgba(0,0,0,0.1)",this.plot(e,n/4),t.strokeStyle=e.color,t.fillStyle=e.fillStyle,this.plot(e),t.restore()},plot:function(e,t){var n=e.data,r=e.context,i,s,o,u,a;t=t||0;for(s=0;s<n.length;++s)i=this.getGeometry(n[s],e),r.beginPath(),r.arc(i.x+t,i.y+t,i.z,0,2*Math.PI,!0),r.stroke(),e.fill&&r.fill(),r.closePath()},getGeometry:function(e,t){return{x:t.xScale(e[0]),y:t.yScale(e[1]),z:e[2]*t.baseRadius}},hit:function(e){var t=e.data,n=e.args,r=n[0],s=n[1],o=r.relX,u=r.relY,a,f,l,c;s.best=s.best||Number.MAX_VALUE;for(i=t.length;i--;)f=this.getGeometry(t[i],e),l=f.x-o,c=f.y-u,a=Math.sqrt(l*l+c*c),a<f.z&&f.z<s.best&&(s.x=t[i][0],s.y=t[i][1],s.index=i,s.seriesIndex=e.index,s.best=f.z)},drawHit:function(e){var t=e.context,n=this.getGeometry(e.data[e.args.index],e);t.save(),t.lineWidth=e.lineWidth,t.fillStyle=e.fillStyle,t.strokeStyle=e.color,t.beginPath(),t.arc(n.x,n.y,n.z,0,2*Math.PI,!0),t.fill(),t.stroke(),t.closePath(),t.restore()},clearHit:function(e){var t=e.context,n=this.getGeometry(e.data[e.args.index],e),r=n.z+e.lineWidth;t.save(),t.clearRect(n.x-r,n.y-r,2*r,2*r),t.restore()}}),Flotr.addType("candles",{options:{show:!1,lineWidth:1,wickLineWidth:1,candleWidth:.6,fill:!0,upFillColor:"#00A8F0",downFillColor:"#CB4B4B",fillOpacity:.5,barcharts:!1},draw:function(e){var t=e.context;t.save(),t.lineJoin="miter",t.lineCap="butt",t.lineWidth=e.wickLineWidth||e.lineWidth,this.plot(e),t.restore()},plot:function(e){var t=e.data,n=e.context,r=e.xScale,i=e.yScale,s=e.candleWidth/2,o=e.shadowSize,u=e.lineWidth,a=e.wickLineWidth,f=a%2/2,l,c,h,p,d,v,m,g,y,b,w,E,S,x,T,N;if(t.length<1)return;for(N=0;N<t.length;N++){c=t[N],h=c[0],d=c[1],v=c[2],m=c[3],g=c[4],y=r(h-s),b=r(h+s),w=i(m),E=i(v),S=i(Math.min(d,g)),x=i(Math.max(d,g)),l=e[d>g?"downFillColor":"upFillColor"],e.fill&&!e.barcharts&&(n.fillStyle="rgba(0,0,0,0.05)",n.fillRect(y+o,x+o,b-y,S-x),n.save(),n.globalAlpha=e.fillOpacity,n.fillStyle=l,n.fillRect(y,x+u,b-y,S-x),n.restore());if(u||a)h=Math.floor((y+b)/2)+f,n.strokeStyle=l,n.beginPath(),e.barcharts?(n.moveTo(h,Math.floor(E+u)),n.lineTo(h,Math.floor(w+u)),T=d<g,n.moveTo(T?b:y,Math.floor(x+u)),n.lineTo(h,Math.floor(x+u)),n.moveTo(h,Math.floor(S+u)),n.lineTo(T?y:b,Math.floor(S+u))):(n.strokeRect(y,x+u,b-y,S-x),n.moveTo(h,Math.floor(x+u)),n.lineTo(h,Math.floor(E+u)),n.moveTo(h,Math.floor(S+u)),n.lineTo(h,Math.floor(w+u))),n.closePath(),n.stroke()}},hit:function(e){var t=e.xScale,n=e.yScale,r=e.data,i=e.args,s=i[0],o=e.candleWidth/2,u=i[1],a=s.relX,f=s.relY,l=r.length,c,h,p,d,v,m,g,y;for(c=0;c<l;c++){h=r[c],p=h[2],d=h[3],v=t(h[0]-o),m=t(h[0]+o),y=n(d),g=n(p);if(a>v&&a<m&&f>g&&f<y){u.x=h[0],u.index=c,u.seriesIndex=e.index;return}}},drawHit:function(e){var t=e.context;t.save(),this.plot(_.defaults({fill:!!e.fillColor,upFillColor:e.color,downFillColor:e.color,data:[e.data[e.args.index]]},e)),t.restore()},clearHit:function(e){var t=e.args,n=e.context,r=e.xScale,i=e.yScale,s=e.lineWidth,o=e.candleWidth/2,u=e.data[t.index],a=r(u[0]-o)-s,f=r(u[0]+o)+s,l=i(u[2]),c=i(u[3])+s;n.clearRect(a,l,f-a,c-l)},extendXRange:function(e,t,n){e.options.max===null&&(e.max=Math.max(e.datamax+.5,e.max),e.min=Math.min(e.datamin-.5,e.min))}}),Flotr.addType("gantt",{options:{show:!1,lineWidth:2,barWidth:1,fill:!0,fillColor:null,fillOpacity:.4,centered:!0},draw:function(e){var t=this.ctx,n=e.gantt.barWidth,r=Math.min(e.gantt.lineWidth,n);t.save(),t.translate(this.plotOffset.left,this.plotOffset.top),t.lineJoin="miter",t.lineWidth=r,t.strokeStyle=e.color,t.save(),this.gantt.plotShadows(e,n,0,e.gantt.fill),t.restore();if(e.gantt.fill){var i=e.gantt.fillColor||e.color;t.fillStyle=this.processColor(i,{opacity:e.gantt.fillOpacity})}this.gantt.plot(e,n,0,e.gantt.fill),t.restore()},plot:function(e,t,n,r){var i=e.data;if(i.length<1)return;var s=e.xaxis,o=e.yaxis,u=this.ctx,a;for(a=0;a<i.length;a++){var f=i[a][0],l=i[a][1],c=i[a][2],h=!0,p=!0,d=!0;if(l===null||c===null)continue;var v=l,m=l+c,g=f-(e.gantt.centered?t/2:0),y=f+t-(e.gantt.centered?t/2:0);if(m<s.min||v>s.max||y<o.min||g>o.max)continue;v<s.min&&(v=s.min,h=!1),m>s.max&&(m=s.max,s.lastSerie!=e&&(p=!1)),g<o.min&&(g=o.min),y>o.max&&(y=o.max,o.lastSerie!=e&&(p=!1)),r&&(u.beginPath(),u.moveTo(s.d2p(v),o.d2p(g)+n),u.lineTo(s.d2p(v),o.d2p(y)+n),u.lineTo(s.d2p(m),o.d2p(y)+n),u.lineTo(s.d2p(m),o.d2p(g)+n),u.fill(),u.closePath()),e.gantt.lineWidth&&(h||d||p)&&(u.beginPath(),u.moveTo(s.d2p(v),o.d2p(g)+n),u[h?"lineTo":"moveTo"](s.d2p(v),o.d2p(y)+n),u[p?"lineTo":"moveTo"](s.d2p(m),o.d2p(y)+n),u[d?"lineTo":"moveTo"](s.d2p(m),o.d2p(g)+n),u.stroke(),u.closePath())}},plotShadows:function(e,t,n){var r=e.data;if(r.length<1)return;var i,s,o,u,a=e.xaxis,f=e.yaxis,l=this.ctx,c=this.options.shadowSize;for(i=0;i<r.length;i++){s=r[i][0],o=r[i][1],u=r[i][2];if(o===null||u===null)continue;var h=o,p=o+u,d=s-(e.gantt.centered?t/2:0),v=s+t-(e.gantt.centered?t/2:0);if(p<a.min||h>a.max||v<f.min||d>f.max)continue;h<a.min&&(h=a.min),p>a.max&&(p=a.max),d<f.min&&(d=f.min),v>f.max&&(v=f.max);var m=a.d2p(p)-a.d2p(h)-(a.d2p(p)+c<=this.plotWidth?0:c),g=f.d2p(d)-f.d2p(v)-(f.d2p(d)+c<=this.plotHeight?0:c);l.fillStyle="rgba(0,0,0,0.05)",l.fillRect(Math.min(a.d2p(h)+c,this.plotWidth),Math.min(f.d2p(v)+c,this.plotHeight),m,g)}},extendXRange:function(e){if(e.options.max===null){var t=e.min,n=e.max,r,i,s,o,u,a={},f={},l=null;for(r=0;r<this.series.length;++r){o=this.series[r],u=o.gantt;if(u.show&&o.xaxis==e){for(i=0;i<o.data.length;i++)u.show&&(y=o.data[i][0]+"",a[y]=Math.max(a[y]||0,o.data[i][1]+o.data[i][2]),l=o);for(i in a)n=Math.max(a[i],n)}}e.lastSerie=l,e.max=n,e.min=t}},extendYRange:function(e){if(e.options.max===null){var t=Number.MIN_VALUE,n=Number.MAX_VALUE,r,i,s,o,u={},a={},f=null;for(r=0;r<this.series.length;++r){s=this.series[r],o=s.gantt;if(o.show&&!s.hide&&s.yaxis==e){var l=Number.MIN_VALUE,c=Number.MAX_VALUE;for(i=0;i<s.data.length;i++)l=Math.max(l,s.data[i][0]),c=Math.min(c,s.data[i][0]);o.centered?(t=Math.max(l+.5,t),n=Math.min(c-.5,n)):(t=Math.max(l+1,t),n=Math.min(c,n)),o.barWidth+l>t&&(t=e.max+o.barWidth)}}e.lastSerie=f,e.max=t,e.min=n,e.tickSize=Flotr.getTickSize(e.options.noTicks,n,t,e.options.tickDecimals)}}}),function(){function e(e){return typeof e=="object"&&e.constructor&&(Image?!0:e.constructor===Image)}Flotr.defaultMarkerFormatter=function(e){return Math.round(e.y*100)/100+""},Flotr.addType("markers",{options:{show:!1,lineWidth:1,color:"#000000",fill:!1,fillColor:"#FFFFFF",fillOpacity:.4,stroke:!1,position:"ct",verticalMargin:0,labelFormatter:Flotr.defaultMarkerFormatter,fontSize:Flotr.defaultOptions.fontSize,stacked:!1,stackingType:"b",horizontal:!1},stack:{positive:[],negative:[],values:[]},draw:function(e){function h(e,t){return o=r.negative[e]||0,s=r.positive[e]||0,t>0?(r.positive[e]=o+t,o+t):(r.negative[e]=s+t,s+t)}var t=e.data,n=e.context,r=e.stacked?e.stack:!1,i=e.stackingType,s,o,u,a,f,l,c;n.save(),n.lineJoin="round",n.lineWidth=e.lineWidth,n.strokeStyle="rgba(0,0,0,0.5)",n.fillStyle=e.fillStyle;for(a=0;a<t.length;++a)f=t[a][0],l=t[a][1],r&&(i=="b"?e.horizontal?l=h(l,f):f=h(f,l):i=="a"&&(u=r.values[f]||0,r.values[f]=u+l,l=u+l)),c=e.labelFormatter({x:f,y:l,index:a,data:t}),this.plot(e.xScale(f),e.yScale(l),c,e);n.restore()},plot:function(t,n,r,i){var s=i.context;if(e(r)&&!r.complete)throw"Marker image not loaded.";this._plot(t,n,r,i)},_plot:function(t,n,r,i){var s=i.context,o=2,u=t,a=n,f;e(r)?f={height:r.height,width:r.width}:f=i.text.canvas(r),f.width=Math.floor(f.width+o*2),f.height=Math.floor(f.height+o*2),i.position.indexOf("c")!=-1?u-=f.width/2+o:i.position.indexOf("l")!=-1&&(u-=f.width),i.position.indexOf("m")!=-1?a-=f.height/2+o:i.position.indexOf("t")!=-1?a-=f.height+i.verticalMargin:a+=i.verticalMargin,u=Math.floor(u)+.5,a=Math.floor(a)+.5,i.fill&&s.fillRect(u,a,f.width,f.height),i.stroke&&s.strokeRect(u,a,f.width,f.height),e(r)?s.drawImage(r,parseInt(u+o,10),parseInt(a+o,10)):Flotr.drawText(s,r,u+o,a+o,{textBaseline:"top",textAlign:"left",size:i.fontSize,color:i.color})}})}(),function(){var e=Flotr._;Flotr.defaultPieLabelFormatter=function(e,t){return(100*t/e).toFixed(2)+"%"},Flotr.addType("pie",{options:{show:!1,lineWidth:1,fill:!0,fillColor:null,fillOpacity:.6,explode:6,sizeRatio:.6,startAngle:Math.PI/4,labelFormatter:Flotr.defaultPieLabelFormatter,pie3D:!1,pie3DviewAngle:Math.PI/2*.8,pie3DspliceThickness:20,epsilon:.1},draw:function(e){var t=e.data,n=e.context,r=e.lineWidth,i=e.shadowSize,s=e.sizeRatio,o=e.height,u=e.width,a=e.explode,f=e.color,l=e.fill,c=e.fillStyle,h=Math.min(u,o)*s/2,p=t[0][1],d=[],v=1,m=Math.PI*2*p/this.total,g=this.startAngle||2*Math.PI*e.startAngle,y=g+m,b=g+m/2,w=e.labelFormatter(this.total,p),E=a+h+4,S=Math.cos(b)*E,x=Math.sin(b)*E,T=S<0?"right":"left",N=x>0?"top":"bottom",C,k,L;n.save(),n.translate(u/2,o/2),n.scale(1,v),k=Math.cos(b)*a,L=Math.sin(b)*a,i>0&&(this.plotSlice(k+i,L+i,h,g,y,n),l&&(n.fillStyle="rgba(0,0,0,0.1)",n.fill())),this.plotSlice(k,L,h,g,y,n),l&&(n.fillStyle=c,n.fill()),n.lineWidth=r,n.strokeStyle=f,n.stroke(),C={size:e.fontSize*1.2,color:e.fontColor,weight:1.5},w&&(e.htmlText||!e.textEnabled?(divStyle="position:absolute;"+N+":"+(o/2+(N==="top"?x:-x))+"px;",divStyle+=T+":"+(u/2+(T==="right"?-S:S))+"px;",d.push('<div style="',divStyle,'" class="flotr-grid-label">',w,"</div>")):(C.textAlign=T,C.textBaseline=N,Flotr.drawText(n,w,S,x,C)));if(e.htmlText||!e.textEnabled){var A=Flotr.DOM.node('<div style="color:'+e.fontColor+'" class="flotr-labels"></div>');Flotr.DOM.insert(A,d.join("")),Flotr.DOM.insert(e.element,A)}n.restore(),this.startAngle=y,this.slices=this.slices||[],this.slices.push({radius:h,x:k,y:L,explode:a,start:g,end:y})},plotSlice:function(e,t,n,r,i,s){s.beginPath(),s.moveTo(e,t),s.arc(e,t,n,r,i,!1),s.lineTo(e,t),s.closePath()},hit:function(e){var t=e.data[0],n=e.args,r=e.index,i=n[0],s=n[1],o=this.slices[r],u=i.relX-e.width/2,a=i.relY-e.height/2,f=Math.sqrt(u*u+a*a),l=Math.atan(a/u),c=Math.PI*2,h=o.explode||e.explode,p=o.start%c,d=o.end%c,v=e.epsilon;u<0?l+=Math.PI:u>0&&a<0&&(l+=c),f<o.radius+h&&f>h&&(l>p&&l<d||p>d&&(l<d||l>p)||p===d&&(o.start===o.end&&Math.abs(l-p)<v||o.start!==o.end&&Math.abs(l-p)>v))&&(s.x=t[0],s.y=t[1],s.sAngle=p,s.eAngle=d,s.index=0,s.seriesIndex=r,s.fraction=t[1]/this.total)},drawHit:function(e){var t=e.context,n=this.slices[e.args.seriesIndex];t.save(),t.translate(e.width/2,e.height/2),this.plotSlice(n.x,n.y,n.radius,n.start,n.end,t),t.stroke(),t.restore()},clearHit:function(e){var t=e.context,n=this.slices[e.args.seriesIndex],r=2*e.lineWidth,i=n.radius+r;t.save(),t.translate(e.width/2,e.height/2),t.clearRect(n.x-i,n.y-i,2*i+r,2*i+r),t.restore()},extendYRange:function(e,t){this.total=(this.total||0)+t[0][1]}})}(),Flotr.addType("points",{options:{show:!1,radius:3,lineWidth:2,fill:!0,fillColor:"#FFFFFF",fillOpacity:1,hitRadius:null},draw:function(e){var t=e.context,n=e.lineWidth,r=e.shadowSize;t.save(),r>0&&(t.lineWidth=r/2,t.strokeStyle="rgba(0,0,0,0.1)",this.plot(e,r/2+t.lineWidth/2),t.strokeStyle="rgba(0,0,0,0.2)",this.plot(e,t.lineWidth/2)),t.lineWidth=e.lineWidth,t.strokeStyle=e.color,e.fill&&(t.fillStyle=e.fillStyle),this.plot(e),t.restore()},plot:function(e,t){var n=e.data,r=e.context,i=e.xScale,s=e.yScale,o,u,a;for(o=n.length-1;o>-1;--o){a=n[o][1];if(a===null)continue;u=i(n[o][0]),a=s(a);if(u<0||u>e.width||a<0||a>e.height)continue;r.beginPath(),t?r.arc(u,a+t,e.radius,0,Math.PI,!1):(r.arc(u,a,e.radius,0,2*Math.PI,!0),e.fill&&r.fill()),r.stroke(),r.closePath()}}}),Flotr.addType("radar",{options:{show:!1,lineWidth:2,fill:!0,fillOpacity:.4,radiusRatio:.9,sensibility:2},draw:function(e){var t=e.context,n=e.shadowSize;t.save(),t.translate(e.width/2,e.height/2),t.lineWidth=e.lineWidth,t.fillStyle="rgba(0,0,0,0.05)",t.strokeStyle="rgba(0,0,0,0.05)",this.plot(e,n/2),t.strokeStyle="rgba(0,0,0,0.1)",this.plot(e,n/4),t.strokeStyle=e.color,t.fillStyle=e.fillStyle,this.plot(e),t.restore()},plot:function(e,t){var n=e.data,r=e.context,i=Math.min(e.height,e.width)*e.radiusRatio/2,s=2*Math.PI/n.length,o=-Math.PI/2,u,a;t=t||0,r.beginPath();for(u=0;u<n.length;++u)a=n[u][1]/this.max,r[u===0?"moveTo":"lineTo"](Math.cos(u*s+o)*i*a+t,Math.sin(u*s+o)*i*a+t);r.closePath(),e.fill&&r.fill(),r.stroke()},getGeometry:function(e,t){var n=Math.min(t.height,t.width)*t.radiusRatio/2,r=2*Math.PI/t.data.length,i=-Math.PI/2,s=e[1]/this.max;return{x:Math.cos(e[0]*r+i)*n*s+t.width/2,y:Math.sin(e[0]*r+i)*n*s+t.height/2}},hit:function(e){var t=e.args,n=t[0],r=t[1],i=n.relX,s=n.relY,o,u,a,f;for(var l=0;l<r.series.length;l++){var c=r.series[l],h=c.data;for(var p=h.length;p--;){u=this.getGeometry(h[p],e),a=u.x-i,f=u.y-s,o=Math.sqrt(a*a+f*f);if(o<e.sensibility*2)return r.x=h[p][0],r.y=h[p][1],r.index=p,r.seriesIndex=l,r}}},drawHit:function(e){var t=2*Math.PI/e.data.length,n=-Math.PI/2,r=Math.min(e.height,e.width)*e.radiusRatio/2,i=e.args.series,s=i.points.hitRadius||i.points.radius||i.mouse.radius,o=e.context;o.translate(e.width/2,e.height/2);var u=e.args.index,a=e.data[u][1]/this.max,f=Math.cos(u*t+n)*r*a,l=Math.sin(u*t+n)*r*a;o.beginPath(),o.arc(f,l,s,0,2*Math.PI,!0),o.closePath(),o.stroke()},clearHit:function(e){var t=2*Math.PI/e.data.length,n=-Math.PI/2,r=Math.min(e.height,e.width)*e.radiusRatio/2,i=e.context,s=e.args.series,o=s.points?s.points.lineWidth:1;offset=(s.points.hitRadius||s.points.radius||s.mouse.radius)+o,i.translate(e.width/2,e.height/2);var u=e.args.index,a=e.data[u][1]/this.max,f=Math.cos(u*t+n)*r*a,l=Math.sin(u*t+n)*r*a;i.clearRect(f-offset,l-offset,offset*2,offset*2)},extendYRange:function(e,t){this.max=Math.max(e.max,this.max||-Number.MAX_VALUE)}}),Flotr.addType("timeline",{options:{show:!1,lineWidth:1,barWidth:.2,fill:!0,fillColor:null,fillOpacity:.4,centered:!0},draw:function(e){var t=e.context;t.save(),t.lineJoin="miter",t.lineWidth=e.lineWidth,t.strokeStyle=e.color,t.fillStyle=e.fillStyle,this.plot(e),t.restore()},plot:function(e){var t=e.data,n=e.context,r=e.xScale,i=e.yScale,s=e.barWidth,o=e.lineWidth,u;Flotr._.each(t,function(e){var t=e[0],u=e[1],a=e[2],f=s,l=Math.ceil(r(t)),c=Math.ceil(r(t+a))-l,h=Math.round(i(u)),p=Math.round(i(u-f))-h,d=l-o/2,v=Math.round(h-p/2)-o/2;n.strokeRect(d,v,c,p),n.fillRect(d,v,c,p)})},extendRange:function(e){var t=e.data,n=e.xaxis,r=e.yaxis,i=e.timeline.barWidth;n.options.min===null&&(n.min=n.datamin-i/2);if(n.options.max===null){var s=n.max;Flotr._.each(t,function(e){s=Math.max(s,e[0]+e[2])},this),n.max=s+i/2}r.options.min===null&&(r.min=r.datamin-i),r.options.min===null&&(r.max=r.datamax+i)}}),function(){var e=Flotr.DOM;Flotr.addPlugin("crosshair",{options:{mode:null,color:"#FF0000",hideCursor:!0},callbacks:{"flotr:mousemove":function(e,t){this.options.crosshair.mode&&(this.crosshair.clearCrosshair(),this.crosshair.drawCrosshair(t))}},drawCrosshair:function(t){var n=this.octx,r=this.options.crosshair,i=this.plotOffset,s=i.left+Math.round(t.relX)+.5,o=i.top+Math.round(t.relY)+.5;if(t.relX<0||t.relY<0||t.relX>this.plotWidth||t.relY>this.plotHeight){this.el.style.cursor=null,e.removeClass(this.el,"flotr-crosshair");return}r.hideCursor&&(this.el.style.cursor="none",e.addClass(this.el,"flotr-crosshair")),n.save(),n.strokeStyle=r.color,n.lineWidth=1,n.beginPath(),r.mode.indexOf("x")!=-1&&(n.moveTo(s,i.top),n.lineTo(s,i.top+this.plotHeight)),r.mode.indexOf("y")!=-1&&(n.moveTo(i.left,o),n.lineTo(i.left+this.plotWidth,o)),n.stroke(),n.restore()},clearCrosshair:function(){var e=this.plotOffset,t=this.lastMousePos,n=this.octx;t&&(n.clearRect(Math.round(t.relX)+e.left,e.top,1,this.plotHeight+1),n.clearRect(e.left,Math.round(t.relY)+e.top,this.plotWidth+1,1))}})}(),function(){function n(e,t,n,r,i,s){var o="image/"+e,u=n.getImageData(0,0,r,i),a=new Image;return n.save(),n.globalCompositeOperation="destination-over",n.fillStyle=s,n.fillRect(0,0,r,i),a.src=t.toDataURL(o),n.restore(),n.clearRect(0,0,r,i),n.putImageData(u,0,0),a}var e=Flotr.DOM,t=Flotr._;Flotr.addPlugin("download",{saveImage:function(r,i,s,o){var u=this.options.grid,a;if(Flotr.isIE&&Flotr.isIE<9)return a="<html><body>"+this.canvas.firstChild.innerHTML+"</body></html>",window.open().document.write(a);if(r!=="jpeg"&&r!=="png")return;a=n(r,this.canvas,this.ctx,this.canvasWidth,this.canvasHeight,u&&u.backgroundColor||"#ffffff");if(!t.isElement(a)||!o)return window.open(a.src);this.download.restoreCanvas(),e.hide(this.canvas),e.hide(this.overlay),e.setStyles({position:"absolute"}),e.insert(this.el,a),this.saveImageElement=a},restoreCanvas:function(){e.show(this.canvas),e.show(this.overlay),this.saveImageElement&&this.el.removeChild(this.saveImageElement),this.saveImageElement=null}})}(),function(){var e=Flotr.EventAdapter,t=Flotr._;Flotr.addPlugin("graphGrid",{callbacks:{"flotr:beforedraw":function(){this.graphGrid.drawGrid()},"flotr:afterdraw":function(){this.graphGrid.drawOutline()}},drawGrid:function(){function v(e){for(p=0;p<e.length;++p){var t=e[p].v/c.max;for(d=0;d<=w;++d)n[d===0?"moveTo":"lineTo"](Math.cos(d*S+x)*b*t,Math.sin(d*S+x)*b*t)}}function m(e,r){t.each(t.pluck(e,"v"),function(e){if(e<=c.min||e>=c.max||(e==c.min||e==c.max)&&i.outlineWidth)return;r(Math.floor(c.d2p(e))+n.lineWidth/2)})}function g(e){n.moveTo(e,0),n.lineTo(e,f)}function y(e){n.moveTo(0,e),n.lineTo(l,e)}var n=this.ctx,r=this.options,i=r.grid,s=i.verticalLines,o=i.horizontalLines,u=i.minorVerticalLines,a=i.minorHorizontalLines,f=this.plotHeight,l=this.plotWidth,c,h,p,d;(s||u||o||a)&&e.fire(this.el,"flotr:beforegrid",[this.axes.x,this.axes.y,r,this]),n.save(),n.lineWidth=1,n.strokeStyle=i.tickColor;if(i.circular){n.translate(this.plotOffset.left+l/2,this.plotOffset.top+f/2);var b=Math.min(f,l)*r.radar.radiusRatio/2,w=this.axes.x.ticks.length,S=2*(Math.PI/w),x=-Math.PI/2;n.beginPath(),c=this.axes.y,o&&v(c.ticks),a&&v(c.minorTicks),s&&t.times(w,function(e){n.moveTo(0,0),n.lineTo(Math.cos(e*S+x)*b,Math.sin(e*S+x)*b)}),n.stroke()}else n.translate(this.plotOffset.left,this.plotOffset.top),i.backgroundColor&&(n.fillStyle=this.processColor(i.backgroundColor,{x1:0,y1:0,x2:l,y2:f}),n.fillRect(0,0,l,f)),n.beginPath(),c=this.axes.x,s&&m(c.ticks,g),u&&m(c.minorTicks,g),c=this.axes.y,o&&m(c.ticks,y),a&&m(c.minorTicks,y),n.stroke();n.restore(),(s||u||o||a)&&e.fire(this.el,"flotr:aftergrid",[this.axes.x,this.axes.y,r,this])},drawOutline:function(){var e=this,t=e.options,n=t.grid,r=n.outline,s=e.ctx,o=n.backgroundImage,u=e.plotOffset,a=u.left,f=u.top,l=e.plotWidth,c=e.plotHeight,h,p,d,v,m,g;if(!n.outlineWidth)return;s.save();if(n.circular){s.translate(a+l/2,f+c/2);var y=Math.min(c,l)*t.radar.radiusRatio/2,b=this.axes.x.ticks.length,w=2*(Math.PI/b),E=-Math.PI/2;s.beginPath(),s.lineWidth=n.outlineWidth,s.strokeStyle=n.color,s.lineJoin="round";for(i=0;i<=b;++i)s[i===0?"moveTo":"lineTo"](Math.cos(i*w+E)*y,Math.sin(i*w+E)*y);s.stroke()}else{s.translate(a,f);var S=n.outlineWidth,x=.5-S+(S+1)%2/2,T="lineTo",N="moveTo";s.lineWidth=S,s.strokeStyle=n.color,s.lineJoin="miter",s.beginPath(),s.moveTo(x,x),l-=S/2%1,c+=S/2,s[r.indexOf("n")!==-1?T:N](l,x),s[r.indexOf("e")!==-1?T:N](l,c),s[r.indexOf("s")!==-1?T:N](x,c),s[r.indexOf("w")!==-1?T:N](x,x),s.stroke(),s.closePath()}s.restore(),o&&(d=o.src||o,v=(parseInt(o.left,10)||0)+u.left,m=(parseInt(o.top,10)||0)+u.top,p=new Image,p.onload=function(){s.save(),o.alpha&&(s.globalAlpha=o.alpha),s.globalCompositeOperation="destination-over",s.drawImage(p,0,0,p.width,p.height,v,m,l,c),s.restore()},p.src=d)}})}(),function(){var e=Flotr.DOM,t=Flotr._,n=Flotr,r="opacity:0.7;background-color:#000;color:#fff;position:absolute;padding:2px 8px;-moz-border-radius:4px;border-radius:4px;white-space:nowrap;";Flotr.addPlugin("hit",{callbacks:{"flotr:mousemove":function(e,t){this.hit.track(t)},"flotr:click":function(e){var n=this.hit.track(e);n&&!t.isUndefined(n.index)&&(e.hit=n)},"flotr:mouseout":function(e){e.relatedTarget!==this.mouseTrack&&this.hit.clearHit()},"flotr:destroy":function(){this.options.mouse.container&&e.remove(this.mouseTrack),this.mouseTrack=null}},track:function(e){if(this.options.mouse.track||t.any(this.series,function(e){return e.mouse&&e.mouse.track}))return this.hit.hit(e)},executeOnType:function(e,r,i){function u(e,u){t.each(t.keys(n.graphTypes),function(t){e[t]&&e[t].show&&!e.hide&&this[t][r]&&(o=this.getOptions(e,t),o.fill=!!e.mouse.fillColor,o.fillStyle=this.processColor(e.mouse.fillColor||"#ffffff",{opacity:e.mouse.fillOpacity}),o.color=e.mouse.lineColor,o.context=this.octx,o.index=u,i&&(o.args=i),this[t][r].call(this[t],o),s=!0)},this)}var s=!1,o;return t.isArray(e)||(e=[e]),t.each(e,u,this),s},drawHit:function(e){var t=this.octx,n=e.series;if(n.mouse.lineColor){t.save(),t.lineWidth=n.points?n.points.lineWidth:1,t.strokeStyle=n.mouse.lineColor,t.fillStyle=this.processColor(n.mouse.fillColor||"#ffffff",{opacity:n.mouse.fillOpacity}),t.translate(this.plotOffset.left,this.plotOffset.top);if(!this.hit.executeOnType(n,"drawHit",e)){var r=e.xaxis,i=e.yaxis;t.beginPath(),t.arc(r.d2p(e.x),i.d2p(e.y),n.points.hitRadius||n.points.radius||n.mouse.radius,0,2*Math.PI,!0),t.fill(),t.stroke(),t.closePath()}t.restore(),this.clip(t)}this.prevHit=e},clearHit:function(){var t=this.prevHit,n=this.octx,r=this.plotOffset;n.save(),n.translate(r.left,r.top);if(t){if(!this.hit.executeOnType(t.series,"clearHit",this.prevHit)){var i=t.series,s=i.points?i.points.lineWidth:1;offset=(i.points.hitRadius||i.points.radius||i.mouse.radius)+s,n.clearRect(t.xaxis.d2p(t.x)-offset,t.yaxis.d2p(t.y)-offset,offset*2,offset*2)}e.hide(this.mouseTrack),this.prevHit=null}n.restore()},hit:function(e){var n=this.options,r=this.prevHit,i,s,o,u,a,f,l,c,h;if(this.series.length===0)return;h={relX:e.relX,relY:e.relY,absX:e.absX,absY:e.absY,series:this.series};if(n.mouse.trackY&&!n.mouse.trackAll&&this.hit.executeOnType(this.series,"hit",[e,h])&&!t.isUndefined(h.seriesIndex))a=this.series[h.seriesIndex],h.series=a,h.mouse=a.mouse,h.xaxis=a.xaxis,h.yaxis=a.yaxis;else{i=this.hit.closest(e);if(i){i=n.mouse.trackY?i.point:i.x,u=i.seriesIndex,a=this.series[u],l=a.xaxis,c=a.yaxis,s=2*a.mouse.sensibility;if(n.mouse.trackAll||i.distanceX<s/l.scale&&(!n.mouse.trackY||i.distanceY<s/c.scale))h.series=a,h.xaxis=a.xaxis,h.yaxis=a.yaxis,h.mouse=a.mouse,h.x=i.x,h.y=i.y,h.dist=i.distance,h.index=i.dataIndex,h.seriesIndex=u}}if(!r||r.index!==h.index||r.seriesIndex!==h.seriesIndex)this.hit.clearHit(),h.series&&h.mouse&&h.mouse.track&&(this.hit.drawMouseTrack(h),this.hit.drawHit(h),Flotr.EventAdapter.fire(this.el,"flotr:hit",[h,this]));return h},closest:function(e){function E(e){e.distance=h,e.distanceX=p,e.distanceY=d,e.seriesIndex=b,e.dataIndex=w,e.x=g,e.y=y,f=!0}var t=this.series,n=this.options,r=e.relX,i=e.relY,s=Number.MAX_VALUE,o=Number.MAX_VALUE,u={},a={},f=!1,l,c,h,p,d,v,m,g,y,b,w;for(b=0;b<t.length;b++){l=t[b],c=l.data,v=l.xaxis.p2d(r),m=l.yaxis.p2d(i);if(l.hide)continue;for(w=c.length;w--;){g=c[w][0],y=c[w][1],c[w].y0&&(y+=c[w].y0);if(g===null||y===null)continue;if(g<l.xaxis.min||g>l.xaxis.max)continue;p=Math.abs(g-v),d=Math.abs(y-m),h=p*p+d*d,h<s&&(s=h,E(u)),p<o&&(o=p,E(a))}}return f?{point:u,x:a}:!1},drawMouseTrack:function(n){var i="",s=n.series,o=n.mouse.position,u=n.mouse.margin,a=n.x,f=n.y,l=r,c=this.mouseTrack,h=this.plotOffset,p=h.left,d=h.right,v=h.bottom,m=h.top,g=n.mouse.trackDecimals,y=this.options,b=y.mouse.container,w=0,E=0,S,x,T;c||(c=e.node('<div class="flotr-mouse-value" style="'+l+'"></div>'),this.mouseTrack=c,e.insert(b||this.el,c));if(!g||g<0)g=0;a&&a.toFixed&&(a=a.toFixed(g)),f&&f.toFixed&&(f=f.toFixed(g)),T=n.mouse.trackFormatter({x:a,y:f,series:n.series,index:n.index,nearest:n,fraction:n.fraction});if(t.isNull(T)||t.isUndefined(T)){e.hide(c);return}c.innerHTML=T,e.show(c);if(!o)return;x=e.size(c),b&&(S=e.position(this.el),w=S.top,E=S.left);if(!n.mouse.relative)i+="top:",o.charAt(0)=="n"?i+=w+u+m:o.charAt(0)=="s"&&(i+=w-u+m+this.plotHeight-x.height),i+="px;bottom:auto;left:",o.charAt(1)=="e"?i+=E-u+p+this.plotWidth-x.width:o.charAt(1)=="w"&&(i+=E+u+p),i+="px;right:auto;";else if(s.pie&&s.pie.show){var N={x:this.plotWidth/2,y:this.plotHeight/2},C=Math.min(this.canvasWidth,this.canvasHeight)*s.pie.sizeRatio/2,k=n.sAngle<n.eAngle?(n.sAngle+n.eAngle)/2:(n.sAngle+n.eAngle+2*Math.PI)/2;i+="bottom:"+(u-m-N.y-Math.sin(k)*C/2+this.canvasHeight)+"px;top:auto;",i+="left:"+(u+p+N.x+Math.cos(k)*C/2)+"px;right:auto;"}else i+="top:",/n/.test(o)?i+=w-u+m+n.yaxis.d2p(n.y)-x.height:i+=w+u+m+n.yaxis.d2p(n.y),i+="px;bottom:auto;left:",/w/.test(o)?i+=E-u+p+n.xaxis.d2p(n.x)-x.width:i+=E+u+p+n.xaxis.d2p(n.x),i+="px;right:auto;";c.style.cssText=l+i,n.mouse.relative&&(/[ew]/.test(o)?/[ns]/.test(o)||(c.style.top=w+m+n.yaxis.d2p(n.y)-e.size(c).height/2+"px"):c.style.left=E+p+n.xaxis.d2p(n.x)-e.size(c).width/2+"px")}})}(),function(){function e(e,t){return e.which?e.which===1:e.button===0||e.button===1}function t(e,t){return Math.min(Math.max(0,e),t.plotWidth-1)}function n(e,t){return Math.min(Math.max(0,e),t.plotHeight)}var r=Flotr.DOM,i=Flotr.EventAdapter,s=Flotr._;Flotr.addPlugin("selection",{options:{pinchOnly:null,mode:null,color:"#B6D9FF",fps:20},callbacks:{"flotr:mouseup":function(e){var t=this.options.selection,n=this.selection,r=this.getEventPosition(e);if(!t||!t.mode)return;n.interval&&clearInterval(n.interval),this.multitouches?n.updateSelection():t.pinchOnly||n.setSelectionPos(n.selection.second,r),n.clearSelection(),n.selecting&&n.selectionIsSane()&&(n.drawSelection(),n.fireSelectEvent(),this.ignoreClick=!0)},"flotr:mousedown":function(t){var n=this.options.selection,r=this.selection,i=this.getEventPosition(t);if(!n||!n.mode)return;if(!n.mode||!e(t)&&s.isUndefined(t.touches))return;n.pinchOnly||r.setSelectionPos(r.selection.first,i),r.interval&&clearInterval(r.interval),this.lastMousePos.pageX=null,r.selecting=!1,r.interval=setInterval(s.bind(r.updateSelection,this),1e3/n.fps)},"flotr:destroy":function(e){clearInterval(this.selection.interval)}},getArea:function(){var e=this.selection.selection,t=this.axes,n=e.first,r=e.second,i,s,o,u;return i=t.x.p2d(e.first.x),s=t.x.p2d(e.second.x),o=t.y.p2d(e.first.y),u=t.y.p2d(e.second.y),{x1:Math.min(i,s),y1:Math.min(o,u),x2:Math.max(i,s),y2:Math.max(o,u),xfirst:i,xsecond:s,yfirst:o,ysecond:u}},selection:{first:{x:-1,y:-1},second:{x:-1,y:-1}},prevSelection:null,interval:null,fireSelectEvent:function(e){var t=this.selection.getArea();e=e||"select",t.selection=this.selection.selection,i.fire(this.el,"flotr:"+e,[t,this])},setSelection:function(e,r){var i=this.options,s=this.axes.x,o=this.axes.y,u=o.scale,a=s.scale,f=i.selection.mode.indexOf("x")!=-1,l=i.selection.mode.indexOf("y")!=-1,c=this.selection.selection;this.selection.clearSelection(),c.first.y=n(f&&!l?0:(o.max-e.y1)*u,this),c.second.y=n(f&&!l?this.plotHeight-1:(o.max-e.y2)*u,this),c.first.x=t(l&&!f?0:(e.x1-s.min)*a,this),c.second.x=t(l&&!f?this.plotWidth:(e.x2-s.min)*a,this),this.selection.drawSelection(),r||this.selection.fireSelectEvent()},setSelectionPos:function(e,r){var i=this.options.selection.mode,s=this.selection.selection;i.indexOf("x")==-1?e.x=e==s.first?0:this.plotWidth:e.x=t(r.relX,this),i.indexOf("y")==-1?e.y=e==s.first?0:this.plotHeight-1:e.y=n(r.relY,this)},drawSelection:function(){this.selection.fireSelectEvent("selecting");var e=this.selection.selection,t=this.octx,n=this.options,r=this.plotOffset,i=this.selection.prevSelection;if(i&&e.first.x==i.first.x&&e.first.y==i.first.y&&e.second.x==i.second.x&&e.second.y==i.second.y)return;t.save(),t.strokeStyle=this.processColor(n.selection.color,{opacity:.8}),t.lineWidth=1,t.lineJoin="miter",t.fillStyle=this.processColor(n.selection.color,{opacity:.4}),this.selection.prevSelection={first:{x:e.first.x,y:e.first.y},second:{x:e.second.x,y:e.second.y}};var s=Math.min(e.first.x,e.second.x),o=Math.min(e.first.y,e.second.y),u=Math.abs(e.second.x-e.first.x),a=Math.abs(e.second.y-e.first.y);t.fillRect(s+r.left+.5,o+r.top+.5,u,a),t.strokeRect(s+r.left+.5,o+r.top+.5,u,a),t.restore()},updateSelection:function(){if(!this.lastMousePos.pageX)return;this.selection.selecting=!0;if(this.multitouches)this.selection.setSelectionPos(this.selection.selection.first,this.getEventPosition(this.multitouches[0])),this.selection.setSelectionPos(this.selection.selection.second,this.getEventPosition(this.multitouches[1]));else{if(this.options.selection.pinchOnly)return;this.selection.setSelectionPos(this.selection.selection.second,this.lastMousePos)}this.selection.clearSelection(),this.selection.selectionIsSane()&&this.selection.drawSelection()},clearSelection:function(){if(!this.selection.prevSelection)return;var e=this.selection.prevSelection,t=1,n=this.plotOffset,r=Math.min(e.first.x,e.second.x),i=Math.min(e.first.y,e.second.y),s=Math.abs(e.second.x-e.first.x),o=Math.abs(e.second.y-e.first.y);this.octx.clearRect(r+n.left-t+.5,i+n.top-t,s+2*t+.5,o+2*t+.5),this.selection.prevSelection=null},selectionIsSane:function(){var e=this.selection.selection;return Math.abs(e.second.x-e.first.x)>=5||Math.abs(e.second.y-e.first.y)>=5}})}(),function(){var e=Flotr.DOM;Flotr.addPlugin("labels",{callbacks:{"flotr:afterdraw":function(){this.labels.draw()}},draw:function(){function b(e,t,r){var i=r?t.minorTicks:t.ticks,s=t.orientation===1,u=t.n===1,l,h;l={color:t.options.color||d.grid.color,angle:Flotr.toRad(t.options.labelsAngle),textBaseline:"middle"};for(c=0;c<i.length&&(r?t.options.showMinorLabels:t.options.showLabels);++c){n=i[c],n.label+="";if(!n.label||!n.label.length)continue;x=Math.cos(c*a+f)*o,y=Math.sin(c*a+f)*o,l.textAlign=s?Math.abs(x)<.1?"center":x<0?"right":"left":"left",Flotr.drawText(v,n.label,s?x:3,s?y:-(t.ticks[c].v/t.max)*(o-d.fontSize),l)}}function w(e,t,r,i){function f(e){return e.options.showLabels&&e.used}function l(e,t,n,r){return e.plotOffset.left+(t?r:n?-d.grid.labelMargin:d.grid.labelMargin+e.plotWidth)}function h(e,t,n,r){return e.plotOffset.top+(t?d.grid.labelMargin:r)+(t&&n?e.plotHeight:0)}var s=t.orientation===1,o=t.n===1,u,a;u={color:t.options.color||d.grid.color,textAlign:r,textBaseline:i,angle:Flotr.toRad(t.options.labelsAngle)},u=Flotr.getBestTextAlign(u.angle,u);for(c=0;c<t.ticks.length&&f(t);++c){n=t.ticks[c];if(!n.label||!n.label.length)continue;a=t.d2p(n.v);if(a<0||a>(s?e.plotWidth:e.plotHeight))continue;Flotr.drawText(v,n.label,l(e,s,o,a),h(e,s,o,a),u),!s&&!o&&(v.save(),v.strokeStyle=u.color,v.beginPath(),v.moveTo(e.plotOffset.left+e.plotWidth-8,e.plotOffset.top+t.d2p(n.v)),v.lineTo(e.plotOffset.left+e.plotWidth,e.plotOffset.top+t.d2p(n.v)),v.stroke(),v.restore())}}function E(e,t){var r=t.orientation===1,i=t.n===1,o="",u,a,f,l=e.plotOffset;!r&&!i&&(v.save(),v.strokeStyle=t.options.color||d.grid.color,v.beginPath());if(t.options.showLabels&&(i?!0:t.used))for(c=0;c<t.ticks.length;++c){n=t.ticks[c];if(!n.label||!n.label.length||(r?l.left:l.top)+t.d2p(n.v)<0||(r?l.left:l.top)+t.d2p(n.v)>(r?e.canvasWidth:e.canvasHeight))continue;f=l.top+(r?(i?1:-1)*(e.plotHeight+d.grid.labelMargin):t.d2p(n.v)-t.maxLabel.height/2),u=r?l.left+t.d2p(n.v)-s/2:0,o="",c===0?o=" first":c===t.ticks.length-1&&(o=" last"),o+=r?" flotr-grid-label-x":" flotr-grid-label-y",h+=['<div style="position:absolute; text-align:'+(r?"center":"right")+"; ","top:"+f+"px; ",(!r&&!i?"right:":"left:")+u+"px; ","width:"+(r?s:(i?l.left:l.right)-d.grid.labelMargin)+"px; ",t.options.color?"color:"+t.options.color+"; ":" ",'" class="flotr-grid-label'+o+'">'+n.label+"</div>"].join(" "),!r&&!i&&(v.moveTo(l.left+e.plotWidth-8,l.top+t.d2p(n.v)),v.lineTo(l.left+e.plotWidth,l.top+t.d2p(n.v)))}}var t,n,r,i,s,o,u,a,f,l,c,h="",p=0,d=this.options,v=this.ctx,m=this.axes,g={size:d.fontSize};for(c=0;c<m.x.ticks.length;++c)m.x.ticks[c].label&&++p;s=this.plotWidth/p,d.grid.circular&&(v.save(),v.translate(this.plotOffset.left+this.plotWidth/2,this.plotOffset.top+this.plotHeight/2),o=this.plotHeight*d.radar.radiusRatio/2+d.fontSize,u=this.axes.x.ticks.length,a=2*(Math.PI/u),f=-Math.PI/2,b(this,m.x,!1),b(this,m.x,!0),b(this,m.y,!1),b(this,m.y,!0),v.restore()),!d.HtmlText&&this.textEnabled?(w(this,m.x,"center","top"),w(this,m.x2,"center","bottom"),w(this,m.y,"right","middle"),w(this,m.y2,"left","middle")):(m.x.options.showLabels||m.x2.options.showLabels||m.y.options.showLabels||m.y2.options.showLabels)&&!d.grid.circular&&(h="",E(this,m.x),E(this,m.x2),E(this,m.y),E(this,m.y2),v.stroke(),v.restore(),l=e.create("div"),e.setStyles(l,{fontSize:"smaller",color:d.grid.color}),l.className="flotr-labels",e.insert(this.el,l),e.insert(l,h))}})}(),function(){var e=Flotr.DOM,t=Flotr._;Flotr.addPlugin("legend",{options:{show:!0,noColumns:1,labelFormatter:function(e){return e},labelBoxBorderColor:"#CCCCCC",labelBoxWidth:14,labelBoxHeight:10,labelBoxMargin:5,container:null,position:"nw",margin:5,backgroundColor:"#F0F0F0",backgroundOpacity:.85},callbacks:{"flotr:afterinit":function(){this.legend.insertLegend()},"flotr:destroy":function(){var t=this.legend.markup;t&&(this.legend.markup=null,e.remove(t))}},insertLegend:function(){if(!this.options.legend.show)return;var n=this.series,r=this.plotOffset,i=this.options,s=i.legend,o=[],u=!1,a=this.ctx,f=t.filter(n,function(e){return e.label&&!e.hide}).length,l=s.position,c=s.margin,h=s.backgroundOpacity,p,d,v;if(f){var m=s.labelBoxWidth,g=s.labelBoxHeight,y=s.labelBoxMargin,b=r.left+c,w=r.top+c,E=0,S={size:i.fontSize*1.1,color:i.grid.color};for(p=n.length-1;p>-1;--p){if(!n[p].label||n[p].hide)continue;d=s.labelFormatter(n[p].label),E=Math.max(E,this._text.measureText(d,S).width)}var x=Math.round(m+y*3+E),T=Math.round(f*(y+g)+y);!h&&h!==0&&(h=.1);if(!i.HtmlText&&this.textEnabled&&!s.container){l.charAt(0)=="s"&&(w=r.top+this.plotHeight-(c+T)),l.charAt(0)=="c"&&(w=r.top+this.plotHeight/2-(c+T/2)),l.charAt(1)=="e"&&(b=r.left+this.plotWidth-(c+x)),v=this.processColor(s.backgroundColor,{opacity:h}),a.fillStyle=v,a.fillRect(b,w,x,T),a.strokeStyle=s.labelBoxBorderColor,a.strokeRect(Flotr.toPixel(b),Flotr.toPixel(w),x,T);var N=b+y,C=w+y;for(p=0;p<n.length;p++){if(!n[p].label||n[p].hide)continue;d=s.labelFormatter(n[p].label),a.fillStyle=n[p].color,a.fillRect(N,C,m-1,g-1),a.strokeStyle=s.labelBoxBorderColor,a.lineWidth=1,a.strokeRect(Math.ceil(N)-1.5,Math.ceil(C)-1.5,m+2,g+2),Flotr.drawText(a,d,N+m+y,C+g,S),C+=g+y}}else{for(p=0;p<n.length;++p){if(!n[p].label||n[p].hide)continue;p%s.noColumns===0&&(o.push(u?"</tr><tr>":"<tr>"),u=!0);var k=n[p],L=s.labelBoxWidth,A=s.labelBoxHeight;d=s.labelFormatter(k.label),v="background-color:"+(k.bars&&k.bars.show&&k.bars.fillColor&&k.bars.fill?k.bars.fillColor:k.color)+";",o.push('<td class="flotr-legend-color-box">','<div style="border:1px solid ',s.labelBoxBorderColor,';padding:1px">','<div style="width:',L-1,"px;height:",A-1,"px;border:1px solid ",n[p].color,'">','<div style="width:',L,"px;height:",A,"px;",v,'"></div>',"</div>","</div>","</td>",'<td class="flotr-legend-label">',d,"</td>")}u&&o.push("</tr>");if(o.length>0){var O='<table style="font-size:smaller;color:'+i.grid.color+'">'+o.join("")+"</table>";if(s.container)O=e.node(O),this.legend.markup=O,e.insert(s.container,O);else{var M={position:"absolute",zIndex:"2",border:"1px solid "+s.labelBoxBorderColor};l.charAt(0)=="n"?(M.top=c+r.top+"px",M.bottom="auto"):l.charAt(0)=="c"?(M.top=c+(this.plotHeight-T)/2+"px",M.bottom="auto"):l.charAt(0)=="s"&&(M.bottom=c+r.bottom+"px",M.top="auto"),l.charAt(1)=="e"?(M.right=c+r.right+"px",M.left="auto"):l.charAt(1)=="w"&&(M.left=c+r.left+"px",M.right="auto");var P=e.create("div"),H;P.className="flotr-legend",e.setStyles(P,M),e.insert(P,O),e.insert(this.el,P);if(!h)return;var B=s.backgroundColor||i.grid.backgroundColor||"#ffffff";t.extend(M,e.size(P),{backgroundColor:B,zIndex:"",border:""}),M.width+="px",M.height+="px",P=e.create("div"),P.className="flotr-legend-bg",e.setStyles(P,M),e.opacity(P,h),e.insert(P," "),e.insert(this.el,P)}}}}}})}(),function(){function e(e){if(this.options.spreadsheet.tickFormatter)return this.options.spreadsheet.tickFormatter(e);var t=n.find(this.axes.x.ticks,function(t){return t.v==e});return t?t.label:e}var t=Flotr.DOM,n=Flotr._;Flotr.addPlugin("spreadsheet",{options:{show:!1,tabGraphLabel:"Graph",tabDataLabel:"Data",toolbarDownload:"Download CSV",toolbarSelectAll:"Select all",csvFileSeparator:",",decimalSeparator:".",tickFormatter:null,initialTab:"graph"},callbacks:{"flotr:afterconstruct":function(){if(!this.options.spreadsheet.show)return;var e=this.spreadsheet,n=t.node('<div class="flotr-tabs-group" style="position:absolute;left:0px;width:'+this.canvasWidth+'px"></div>'),r=t.node('<div style="float:left" class="flotr-tab selected">'+this.options.spreadsheet.tabGraphLabel+"</div>"),i=t.node('<div style="float:left" class="flotr-tab">'+this.options.spreadsheet.tabDataLabel+"</div>"),s;e.tabsContainer=n,e.tabs={graph:r,data:i},t.insert(n,r),t.insert(n,i),t.insert(this.el,n),s=t.size(i).height+2,this.plotOffset.bottom+=s,t.setStyles(n,{top:this.canvasHeight-s+"px"}),this.observe(r,"click",function(){e.showTab("graph")}).observe(i,"click",function(){e.showTab("data")}),this.options.spreadsheet.initialTab!=="graph"&&e.showTab(this.options.spreadsheet.initialTab)}},loadDataGrid:function(){if(this.seriesData)return this.seriesData;var e=this.series,t={};return n.each(e,function(e,r){n.each(e.data,function(e){var n=e[0],s=e[1],o=t[n];if(o)o[r+1]=s;else{var u=[];u[0]=n,u[r+1]=s,t[n]=u}})}),this.seriesData=n.sortBy(t,function(e,t){return parseInt(t,10)}),this.seriesData},constructDataGrid:function(){if(this.spreadsheet.datagrid)return this.spreadsheet.datagrid;var r=this.series,i=this.spreadsheet.loadDataGrid(),s=["<colgroup><col />"],o,u,a,f=['<table class="flotr-datagrid"><tr class="first-row">'];f.push("<th>&nbsp;</th>"),n.each(r,function(e,t){f.push('<th scope="col">'+(e.label||String.fromCharCode(65+t))+"</th>"),s.push("<col />")}),f.push("</tr>"),n.each(i,function(t){f.push("<tr>"),n.times(r.length+1,function(r){var i="td",s=t[r],o=n.isUndefined(s)?"":Math.round(s*1e5)/1e5;if(r===0){i="th";var u=e.call(this,o);u&&(o=u)}f.push("<"+i+(i=="th"?' scope="row"':"")+">"+o+"</"+i+">")},this),f.push("</tr>")},this),s.push("</colgroup>"),a=t.node(f.join("")),o=t.node('<button type="button" class="flotr-datagrid-toolbar-button">'+this.options.spreadsheet.toolbarDownload+"</button>"),u=t.node('<button type="button" class="flotr-datagrid-toolbar-button">'+this.options.spreadsheet.toolbarSelectAll+"</button>"),this.observe(o,"click",n.bind(this.spreadsheet.downloadCSV,this)).observe(u,"click",n.bind(this.spreadsheet.selectAllData,this));var l=t.node('<div class="flotr-datagrid-toolbar"></div>');t.insert(l,o),t.insert(l,u);var c=this.canvasHeight-t.size(this.spreadsheet.tabsContainer).height-2,h=t.node('<div class="flotr-datagrid-container" style="position:absolute;left:0px;top:0px;width:'+this.canvasWidth+"px;height:"+c+'px;overflow:auto;z-index:10"></div>');return t.insert(h,l),t.insert(h,a),t.insert(this.el,h),this.spreadsheet.datagrid=a,this.spreadsheet.container=h,a},showTab:function(e){if(this.spreadsheet.activeTab===e)return;switch(e){case"graph":t.hide(this.spreadsheet.container),t.removeClass(this.spreadsheet.tabs.data,"selected"),t.addClass(this.spreadsheet.tabs.graph,"selected");break;case"data":this.spreadsheet.datagrid||this.spreadsheet.constructDataGrid(),t.show(this.spreadsheet.container),t.addClass(this.spreadsheet.tabs.data,"selected"),t.removeClass(this.spreadsheet.tabs.graph,"selected");break;default:throw"Illegal tab name: "+e}this.spreadsheet.activeTab=e},selectAllData:function(){if(this.spreadsheet.tabs){var e,t,n,r,i=this.spreadsheet.constructDataGrid();return this.spreadsheet.showTab("data"),setTimeout(function(){(n=i.ownerDocument)&&(r=n.defaultView)&&r.getSelection&&n.createRange&&(e=window.getSelection())&&e.removeAllRanges?(t=n.createRange(),t.selectNode(i),e.removeAllRanges(),e.addRange(t)):document.body&&document.body.createTextRange&&(t=document.body.createTextRange())&&(t.moveToElementText(i),t.select())},0),!0}return!1},downloadCSV:function(){var t="",r=this.series,i=this.options,s=this.spreadsheet.loadDataGrid(),o=encodeURIComponent(i.spreadsheet.csvFileSeparator);if(i.spreadsheet.decimalSeparator===i.spreadsheet.csvFileSeparator)throw"The decimal separator is the same as the column separator ("+i.spreadsheet.decimalSeparator+")";n.each(r,function(e,n){t+=o+'"'+(e.label||String.fromCharCode(65+n)).replace(/\"/g,'\\"')+'"'}),t+="%0D%0A",t+=n.reduce(s,function(t,n){var r=e.call(this,n[0])||"";r='"'+(r+"").replace(/\"/g,'\\"')+'"';var s=n.slice(1).join(o);return i.spreadsheet.decimalSeparator!=="."&&(s=s.replace(/\./g,i.spreadsheet.decimalSeparator)),t+r+o+s+"%0D%0A"},"",this),Flotr.isIE&&Flotr.isIE<9?(t=t.replace(new RegExp(o,"g"),decodeURIComponent(o)).replace(/%0A/g,"\n").replace(/%0D/g,"\r"),window.open().document.write(t)):window.open("data:text/csv,"+t)}})}(),function(){var e=Flotr.DOM;Flotr.addPlugin("titles",{callbacks:{"flotr:afterdraw":function(){this.titles.drawTitles()}},drawTitles:function(){var t,n=this.options,r=n.grid.labelMargin,i=this.ctx,s=this.axes;if(!n.HtmlText&&this.textEnabled){var o={size:n.fontSize,color:n.grid.color,textAlign:"center"};n.subtitle&&Flotr.drawText(i,n.subtitle,this.plotOffset.left+this.plotWidth/2,this.titleHeight+this.subtitleHeight-2,o),o.weight=1.5,o.size*=1.5,n.title&&Flotr.drawText(i,n.title,this.plotOffset.left+this.plotWidth/2,this.titleHeight-2,o),o.weight=1.8,o.size*=.8,s.x.options.title&&s.x.used&&(o.textAlign=s.x.options.titleAlign||"center",o.textBaseline="top",o.angle=Flotr.toRad(s.x.options.titleAngle),o=Flotr.getBestTextAlign(o.angle,o),Flotr.drawText(i,s.x.options.title,this.plotOffset.left+this.plotWidth/2,this.plotOffset.top+s.x.maxLabel.height+this.plotHeight+2*r,o)),s.x2.options.title&&s.x2.used&&(o.textAlign=s.x2.options.titleAlign||"center",o.textBaseline="bottom",o.angle=Flotr.toRad(s.x2.options.titleAngle),o=Flotr.getBestTextAlign(o.angle,o),Flotr.drawText(i,s.x2.options.title,this.plotOffset.left+this.plotWidth/2,this.plotOffset.top-s.x2.maxLabel.height-2*r,o)),s.y.options.title&&s.y.used&&(o.textAlign=s.y.options.titleAlign||"right",o.textBaseline="middle",o.angle=Flotr.toRad(s.y.options.titleAngle),o=Flotr.getBestTextAlign(o.angle,o),Flotr.drawText(i,s.y.options.title,this.plotOffset.left-s.y.maxLabel.width-2*r,this.plotOffset.top+this.plotHeight/2,o)),s.y2.options.title&&s.y2.used&&(o.textAlign=s.y2.options.titleAlign||"left",o.textBaseline="middle",o.angle=Flotr.toRad(s.y2.options.titleAngle),o=Flotr.getBestTextAlign(o.angle,o),Flotr.drawText(i,s.y2.options.title,this.plotOffset.left+this.plotWidth+s.y2.maxLabel.width+2*r,this.plotOffset.top+this.plotHeight/2,o))}else{t=[],n.title&&t.push('<div style="position:absolute;top:0;left:',this.plotOffset.left,"px;font-size:1em;font-weight:bold;text-align:center;width:",this.plotWidth,'px;" class="flotr-title">',n.title,"</div>"),n.subtitle&&t.push('<div style="position:absolute;top:',this.titleHeight,"px;left:",this.plotOffset.left,"px;font-size:smaller;text-align:center;width:",this.plotWidth,'px;" class="flotr-subtitle">',n.subtitle,"</div>"),t.push("</div>"),t.push('<div class="flotr-axis-title" style="font-weight:bold;">'),s.x.options.title&&s.x.used&&t.push('<div style="position:absolute;top:',this.plotOffset.top+this.plotHeight+n.grid.labelMargin+s.x.titleSize.height,"px;left:",this.plotOffset.left,"px;width:",this.plotWidth,"px;text-align:",s.x.options.titleAlign,';" class="flotr-axis-title flotr-axis-title-x1">',s.x.options.title,"</div>"),s.x2.options.title&&s.x2.used&&t.push('<div style="position:absolute;top:0;left:',this.plotOffset.left,"px;width:",this.plotWidth,"px;text-align:",s.x2.options.titleAlign,';" class="flotr-axis-title flotr-axis-title-x2">',s.x2.options.title,"</div>"),s.y.options.title&&s.y.used&&t.push('<div style="position:absolute;top:',this.plotOffset.top+this.plotHeight/2-s.y.titleSize.height/2,"px;left:0;text-align:",s.y.options.titleAlign,';" class="flotr-axis-title flotr-axis-title-y1">',s.y.options.title,"</div>"),s.y2.options.title&&s.y2.used&&t.push('<div style="position:absolute;top:',this.plotOffset.top+this.plotHeight/2-s.y.titleSize.height/2,"px;right:0;text-align:",s.y2.options.titleAlign,';" class="flotr-axis-title flotr-axis-title-y2">',s.y2.options.title,"</div>"),t=t.join("");var u=e.create("div");e.setStyles({color:n.grid.color}),u.className="flotr-titles",e.insert(this.el,u),e.insert(u,t)}}})}();
diff --git a/public/scripts/global_view.js b/p/scripts/global_view.js
index 94580dc0d..7105520a6 100644
--- a/public/scripts/global_view.js
+++ b/p/scripts/global_view.js
@@ -24,14 +24,23 @@ function load_panel(link) {
// en en ouvrant une autre ensuite, on se retrouve au même point de scroll
$("#panel").scrollTop(0);
+ $('#panel').on('click', '#nav_menu_read_all > a, #nav_menu_read_all .item > a, #bigMarkAsRead', function () {
+ $.ajax({
+ url: $(this).attr("href"),
+ async: false
+ });
+ //$("#panel .close").first().click();
+ window.location.reload(false);
+ return false;
+ });
+
panel_loading = false;
});
}
function init_close_panel() {
$("#panel .close").click(function () {
- $("#panel").html('<a class="close" href="#"><i class="icon i_close"></i></a>');
-
+ $("#panel").html('<a class="close" href="#">' + window.iconClose + '</a>');
init_close_panel();
$("#panel").slideToggle();
$("#overlay").fadeOut();
@@ -51,11 +60,14 @@ function init_global_view() {
$(".nav_menu #nav_menu_read_all, .nav_menu .toggle_aside").remove();
- init_stream_delegates($("#panel"));
+ init_stream($("#panel"));
}
function init_all_global_view() {
- if (!(window.$ && window.init_stream_delegates)) {
+ if (!(window.$ && window.init_stream)) {
+ if (window.console) {
+ console.log('FreshRSS Global view waiting for JS…');
+ }
window.setTimeout(init_all_global_view, 50); //Wait for all js to be loaded
return;
}
diff --git a/public/scripts/jquery.lazyload.min.js b/p/scripts/jquery.lazyload.min.js
index 8dd097dc3..8dd097dc3 100644
--- a/public/scripts/jquery.lazyload.min.js
+++ b/p/scripts/jquery.lazyload.min.js
diff --git a/p/scripts/jquery.min.js b/p/scripts/jquery.min.js
new file mode 100644
index 000000000..cbe6abe59
--- /dev/null
+++ b/p/scripts/jquery.min.js
@@ -0,0 +1,4 @@
+/*! jQuery v2.1.0 | (c) 2005, 2014 jQuery Foundation, Inc. | jquery.org/license */
+!function(a,b){"object"==typeof module&&"object"==typeof module.exports?module.exports=a.document?b(a,!0):function(a){if(!a.document)throw new Error("jQuery requires a window with a document");return b(a)}:b(a)}("undefined"!=typeof window?window:this,function(a,b){var c=[],d=c.slice,e=c.concat,f=c.push,g=c.indexOf,h={},i=h.toString,j=h.hasOwnProperty,k="".trim,l={},m=a.document,n="2.1.0",o=function(a,b){return new o.fn.init(a,b)},p=/^-ms-/,q=/-([\da-z])/gi,r=function(a,b){return b.toUpperCase()};o.fn=o.prototype={jquery:n,constructor:o,selector:"",length:0,toArray:function(){return d.call(this)},get:function(a){return null!=a?0>a?this[a+this.length]:this[a]:d.call(this)},pushStack:function(a){var b=o.merge(this.constructor(),a);return b.prevObject=this,b.context=this.context,b},each:function(a,b){return o.each(this,a,b)},map:function(a){return this.pushStack(o.map(this,function(b,c){return a.call(b,c,b)}))},slice:function(){return this.pushStack(d.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(a){var b=this.length,c=+a+(0>a?b:0);return this.pushStack(c>=0&&b>c?[this[c]]:[])},end:function(){return this.prevObject||this.constructor(null)},push:f,sort:c.sort,splice:c.splice},o.extend=o.fn.extend=function(){var a,b,c,d,e,f,g=arguments[0]||{},h=1,i=arguments.length,j=!1;for("boolean"==typeof g&&(j=g,g=arguments[h]||{},h++),"object"==typeof g||o.isFunction(g)||(g={}),h===i&&(g=this,h--);i>h;h++)if(null!=(a=arguments[h]))for(b in a)c=g[b],d=a[b],g!==d&&(j&&d&&(o.isPlainObject(d)||(e=o.isArray(d)))?(e?(e=!1,f=c&&o.isArray(c)?c:[]):f=c&&o.isPlainObject(c)?c:{},g[b]=o.extend(j,f,d)):void 0!==d&&(g[b]=d));return g},o.extend({expando:"jQuery"+(n+Math.random()).replace(/\D/g,""),isReady:!0,error:function(a){throw new Error(a)},noop:function(){},isFunction:function(a){return"function"===o.type(a)},isArray:Array.isArray,isWindow:function(a){return null!=a&&a===a.window},isNumeric:function(a){return a-parseFloat(a)>=0},isPlainObject:function(a){if("object"!==o.type(a)||a.nodeType||o.isWindow(a))return!1;try{if(a.constructor&&!j.call(a.constructor.prototype,"isPrototypeOf"))return!1}catch(b){return!1}return!0},isEmptyObject:function(a){var b;for(b in a)return!1;return!0},type:function(a){return null==a?a+"":"object"==typeof a||"function"==typeof a?h[i.call(a)]||"object":typeof a},globalEval:function(a){var b,c=eval;a=o.trim(a),a&&(1===a.indexOf("use strict")?(b=m.createElement("script"),b.text=a,m.head.appendChild(b).parentNode.removeChild(b)):c(a))},camelCase:function(a){return a.replace(p,"ms-").replace(q,r)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toLowerCase()===b.toLowerCase()},each:function(a,b,c){var d,e=0,f=a.length,g=s(a);if(c){if(g){for(;f>e;e++)if(d=b.apply(a[e],c),d===!1)break}else for(e in a)if(d=b.apply(a[e],c),d===!1)break}else if(g){for(;f>e;e++)if(d=b.call(a[e],e,a[e]),d===!1)break}else for(e in a)if(d=b.call(a[e],e,a[e]),d===!1)break;return a},trim:function(a){return null==a?"":k.call(a)},makeArray:function(a,b){var c=b||[];return null!=a&&(s(Object(a))?o.merge(c,"string"==typeof a?[a]:a):f.call(c,a)),c},inArray:function(a,b,c){return null==b?-1:g.call(b,a,c)},merge:function(a,b){for(var c=+b.length,d=0,e=a.length;c>d;d++)a[e++]=b[d];return a.length=e,a},grep:function(a,b,c){for(var d,e=[],f=0,g=a.length,h=!c;g>f;f++)d=!b(a[f],f),d!==h&&e.push(a[f]);return e},map:function(a,b,c){var d,f=0,g=a.length,h=s(a),i=[];if(h)for(;g>f;f++)d=b(a[f],f,c),null!=d&&i.push(d);else for(f in a)d=b(a[f],f,c),null!=d&&i.push(d);return e.apply([],i)},guid:1,proxy:function(a,b){var c,e,f;return"string"==typeof b&&(c=a[b],b=a,a=c),o.isFunction(a)?(e=d.call(arguments,2),f=function(){return a.apply(b||this,e.concat(d.call(arguments)))},f.guid=a.guid=a.guid||o.guid++,f):void 0},now:Date.now,support:l}),o.each("Boolean Number String Function Array Date RegExp Object Error".split(" "),function(a,b){h["[object "+b+"]"]=b.toLowerCase()});function s(a){var b=a.length,c=o.type(a);return"function"===c||o.isWindow(a)?!1:1===a.nodeType&&b?!0:"array"===c||0===b||"number"==typeof b&&b>0&&b-1 in a}var t=function(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s="sizzle"+-new Date,t=a.document,u=0,v=0,w=eb(),x=eb(),y=eb(),z=function(a,b){return a===b&&(j=!0),0},A="undefined",B=1<<31,C={}.hasOwnProperty,D=[],E=D.pop,F=D.push,G=D.push,H=D.slice,I=D.indexOf||function(a){for(var b=0,c=this.length;c>b;b++)if(this[b]===a)return b;return-1},J="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",K="[\\x20\\t\\r\\n\\f]",L="(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",M=L.replace("w","w#"),N="\\["+K+"*("+L+")"+K+"*(?:([*^$|!~]?=)"+K+"*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|("+M+")|)|)"+K+"*\\]",O=":("+L+")(?:\\(((['\"])((?:\\\\.|[^\\\\])*?)\\3|((?:\\\\.|[^\\\\()[\\]]|"+N.replace(3,8)+")*)|.*)\\)|)",P=new RegExp("^"+K+"+|((?:^|[^\\\\])(?:\\\\.)*)"+K+"+$","g"),Q=new RegExp("^"+K+"*,"+K+"*"),R=new RegExp("^"+K+"*([>+~]|"+K+")"+K+"*"),S=new RegExp("="+K+"*([^\\]'\"]*?)"+K+"*\\]","g"),T=new RegExp(O),U=new RegExp("^"+M+"$"),V={ID:new RegExp("^#("+L+")"),CLASS:new RegExp("^\\.("+L+")"),TAG:new RegExp("^("+L.replace("w","w*")+")"),ATTR:new RegExp("^"+N),PSEUDO:new RegExp("^"+O),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+K+"*(even|odd|(([+-]|)(\\d*)n|)"+K+"*(?:([+-]|)"+K+"*(\\d+)|))"+K+"*\\)|)","i"),bool:new RegExp("^(?:"+J+")$","i"),needsContext:new RegExp("^"+K+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+K+"*((?:-\\d)?\\d*)"+K+"*\\)|)(?=[^-]|$)","i")},W=/^(?:input|select|textarea|button)$/i,X=/^h\d$/i,Y=/^[^{]+\{\s*\[native \w/,Z=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,$=/[+~]/,_=/'|\\/g,ab=new RegExp("\\\\([\\da-f]{1,6}"+K+"?|("+K+")|.)","ig"),bb=function(a,b,c){var d="0x"+b-65536;return d!==d||c?b:0>d?String.fromCharCode(d+65536):String.fromCharCode(d>>10|55296,1023&d|56320)};try{G.apply(D=H.call(t.childNodes),t.childNodes),D[t.childNodes.length].nodeType}catch(cb){G={apply:D.length?function(a,b){F.apply(a,H.call(b))}:function(a,b){var c=a.length,d=0;while(a[c++]=b[d++]);a.length=c-1}}}function db(a,b,d,e){var f,g,h,i,j,m,p,q,u,v;if((b?b.ownerDocument||b:t)!==l&&k(b),b=b||l,d=d||[],!a||"string"!=typeof a)return d;if(1!==(i=b.nodeType)&&9!==i)return[];if(n&&!e){if(f=Z.exec(a))if(h=f[1]){if(9===i){if(g=b.getElementById(h),!g||!g.parentNode)return d;if(g.id===h)return d.push(g),d}else if(b.ownerDocument&&(g=b.ownerDocument.getElementById(h))&&r(b,g)&&g.id===h)return d.push(g),d}else{if(f[2])return G.apply(d,b.getElementsByTagName(a)),d;if((h=f[3])&&c.getElementsByClassName&&b.getElementsByClassName)return G.apply(d,b.getElementsByClassName(h)),d}if(c.qsa&&(!o||!o.test(a))){if(q=p=s,u=b,v=9===i&&a,1===i&&"object"!==b.nodeName.toLowerCase()){m=ob(a),(p=b.getAttribute("id"))?q=p.replace(_,"\\$&"):b.setAttribute("id",q),q="[id='"+q+"'] ",j=m.length;while(j--)m[j]=q+pb(m[j]);u=$.test(a)&&mb(b.parentNode)||b,v=m.join(",")}if(v)try{return G.apply(d,u.querySelectorAll(v)),d}catch(w){}finally{p||b.removeAttribute("id")}}}return xb(a.replace(P,"$1"),b,d,e)}function eb(){var a=[];function b(c,e){return a.push(c+" ")>d.cacheLength&&delete b[a.shift()],b[c+" "]=e}return b}function fb(a){return a[s]=!0,a}function gb(a){var b=l.createElement("div");try{return!!a(b)}catch(c){return!1}finally{b.parentNode&&b.parentNode.removeChild(b),b=null}}function hb(a,b){var c=a.split("|"),e=a.length;while(e--)d.attrHandle[c[e]]=b}function ib(a,b){var c=b&&a,d=c&&1===a.nodeType&&1===b.nodeType&&(~b.sourceIndex||B)-(~a.sourceIndex||B);if(d)return d;if(c)while(c=c.nextSibling)if(c===b)return-1;return a?1:-1}function jb(a){return function(b){var c=b.nodeName.toLowerCase();return"input"===c&&b.type===a}}function kb(a){return function(b){var c=b.nodeName.toLowerCase();return("input"===c||"button"===c)&&b.type===a}}function lb(a){return fb(function(b){return b=+b,fb(function(c,d){var e,f=a([],c.length,b),g=f.length;while(g--)c[e=f[g]]&&(c[e]=!(d[e]=c[e]))})})}function mb(a){return a&&typeof a.getElementsByTagName!==A&&a}c=db.support={},f=db.isXML=function(a){var b=a&&(a.ownerDocument||a).documentElement;return b?"HTML"!==b.nodeName:!1},k=db.setDocument=function(a){var b,e=a?a.ownerDocument||a:t,g=e.defaultView;return e!==l&&9===e.nodeType&&e.documentElement?(l=e,m=e.documentElement,n=!f(e),g&&g!==g.top&&(g.addEventListener?g.addEventListener("unload",function(){k()},!1):g.attachEvent&&g.attachEvent("onunload",function(){k()})),c.attributes=gb(function(a){return a.className="i",!a.getAttribute("className")}),c.getElementsByTagName=gb(function(a){return a.appendChild(e.createComment("")),!a.getElementsByTagName("*").length}),c.getElementsByClassName=Y.test(e.getElementsByClassName)&&gb(function(a){return a.innerHTML="<div class='a'></div><div class='a i'></div>",a.firstChild.className="i",2===a.getElementsByClassName("i").length}),c.getById=gb(function(a){return m.appendChild(a).id=s,!e.getElementsByName||!e.getElementsByName(s).length}),c.getById?(d.find.ID=function(a,b){if(typeof b.getElementById!==A&&n){var c=b.getElementById(a);return c&&c.parentNode?[c]:[]}},d.filter.ID=function(a){var b=a.replace(ab,bb);return function(a){return a.getAttribute("id")===b}}):(delete d.find.ID,d.filter.ID=function(a){var b=a.replace(ab,bb);return function(a){var c=typeof a.getAttributeNode!==A&&a.getAttributeNode("id");return c&&c.value===b}}),d.find.TAG=c.getElementsByTagName?function(a,b){return typeof b.getElementsByTagName!==A?b.getElementsByTagName(a):void 0}:function(a,b){var c,d=[],e=0,f=b.getElementsByTagName(a);if("*"===a){while(c=f[e++])1===c.nodeType&&d.push(c);return d}return f},d.find.CLASS=c.getElementsByClassName&&function(a,b){return typeof b.getElementsByClassName!==A&&n?b.getElementsByClassName(a):void 0},p=[],o=[],(c.qsa=Y.test(e.querySelectorAll))&&(gb(function(a){a.innerHTML="<select t=''><option selected=''></option></select>",a.querySelectorAll("[t^='']").length&&o.push("[*^$]="+K+"*(?:''|\"\")"),a.querySelectorAll("[selected]").length||o.push("\\["+K+"*(?:value|"+J+")"),a.querySelectorAll(":checked").length||o.push(":checked")}),gb(function(a){var b=e.createElement("input");b.setAttribute("type","hidden"),a.appendChild(b).setAttribute("name","D"),a.querySelectorAll("[name=d]").length&&o.push("name"+K+"*[*^$|!~]?="),a.querySelectorAll(":enabled").length||o.push(":enabled",":disabled"),a.querySelectorAll("*,:x"),o.push(",.*:")})),(c.matchesSelector=Y.test(q=m.webkitMatchesSelector||m.mozMatchesSelector||m.oMatchesSelector||m.msMatchesSelector))&&gb(function(a){c.disconnectedMatch=q.call(a,"div"),q.call(a,"[s!='']:x"),p.push("!=",O)}),o=o.length&&new RegExp(o.join("|")),p=p.length&&new RegExp(p.join("|")),b=Y.test(m.compareDocumentPosition),r=b||Y.test(m.contains)?function(a,b){var c=9===a.nodeType?a.documentElement:a,d=b&&b.parentNode;return a===d||!(!d||1!==d.nodeType||!(c.contains?c.contains(d):a.compareDocumentPosition&&16&a.compareDocumentPosition(d)))}:function(a,b){if(b)while(b=b.parentNode)if(b===a)return!0;return!1},z=b?function(a,b){if(a===b)return j=!0,0;var d=!a.compareDocumentPosition-!b.compareDocumentPosition;return d?d:(d=(a.ownerDocument||a)===(b.ownerDocument||b)?a.compareDocumentPosition(b):1,1&d||!c.sortDetached&&b.compareDocumentPosition(a)===d?a===e||a.ownerDocument===t&&r(t,a)?-1:b===e||b.ownerDocument===t&&r(t,b)?1:i?I.call(i,a)-I.call(i,b):0:4&d?-1:1)}:function(a,b){if(a===b)return j=!0,0;var c,d=0,f=a.parentNode,g=b.parentNode,h=[a],k=[b];if(!f||!g)return a===e?-1:b===e?1:f?-1:g?1:i?I.call(i,a)-I.call(i,b):0;if(f===g)return ib(a,b);c=a;while(c=c.parentNode)h.unshift(c);c=b;while(c=c.parentNode)k.unshift(c);while(h[d]===k[d])d++;return d?ib(h[d],k[d]):h[d]===t?-1:k[d]===t?1:0},e):l},db.matches=function(a,b){return db(a,null,null,b)},db.matchesSelector=function(a,b){if((a.ownerDocument||a)!==l&&k(a),b=b.replace(S,"='$1']"),!(!c.matchesSelector||!n||p&&p.test(b)||o&&o.test(b)))try{var d=q.call(a,b);if(d||c.disconnectedMatch||a.document&&11!==a.document.nodeType)return d}catch(e){}return db(b,l,null,[a]).length>0},db.contains=function(a,b){return(a.ownerDocument||a)!==l&&k(a),r(a,b)},db.attr=function(a,b){(a.ownerDocument||a)!==l&&k(a);var e=d.attrHandle[b.toLowerCase()],f=e&&C.call(d.attrHandle,b.toLowerCase())?e(a,b,!n):void 0;return void 0!==f?f:c.attributes||!n?a.getAttribute(b):(f=a.getAttributeNode(b))&&f.specified?f.value:null},db.error=function(a){throw new Error("Syntax error, unrecognized expression: "+a)},db.uniqueSort=function(a){var b,d=[],e=0,f=0;if(j=!c.detectDuplicates,i=!c.sortStable&&a.slice(0),a.sort(z),j){while(b=a[f++])b===a[f]&&(e=d.push(f));while(e--)a.splice(d[e],1)}return i=null,a},e=db.getText=function(a){var b,c="",d=0,f=a.nodeType;if(f){if(1===f||9===f||11===f){if("string"==typeof a.textContent)return a.textContent;for(a=a.firstChild;a;a=a.nextSibling)c+=e(a)}else if(3===f||4===f)return a.nodeValue}else while(b=a[d++])c+=e(b);return c},d=db.selectors={cacheLength:50,createPseudo:fb,match:V,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(a){return a[1]=a[1].replace(ab,bb),a[3]=(a[4]||a[5]||"").replace(ab,bb),"~="===a[2]&&(a[3]=" "+a[3]+" "),a.slice(0,4)},CHILD:function(a){return a[1]=a[1].toLowerCase(),"nth"===a[1].slice(0,3)?(a[3]||db.error(a[0]),a[4]=+(a[4]?a[5]+(a[6]||1):2*("even"===a[3]||"odd"===a[3])),a[5]=+(a[7]+a[8]||"odd"===a[3])):a[3]&&db.error(a[0]),a},PSEUDO:function(a){var b,c=!a[5]&&a[2];return V.CHILD.test(a[0])?null:(a[3]&&void 0!==a[4]?a[2]=a[4]:c&&T.test(c)&&(b=ob(c,!0))&&(b=c.indexOf(")",c.length-b)-c.length)&&(a[0]=a[0].slice(0,b),a[2]=c.slice(0,b)),a.slice(0,3))}},filter:{TAG:function(a){var b=a.replace(ab,bb).toLowerCase();return"*"===a?function(){return!0}:function(a){return a.nodeName&&a.nodeName.toLowerCase()===b}},CLASS:function(a){var b=w[a+" "];return b||(b=new RegExp("(^|"+K+")"+a+"("+K+"|$)"))&&w(a,function(a){return b.test("string"==typeof a.className&&a.className||typeof a.getAttribute!==A&&a.getAttribute("class")||"")})},ATTR:function(a,b,c){return function(d){var e=db.attr(d,a);return null==e?"!="===b:b?(e+="","="===b?e===c:"!="===b?e!==c:"^="===b?c&&0===e.indexOf(c):"*="===b?c&&e.indexOf(c)>-1:"$="===b?c&&e.slice(-c.length)===c:"~="===b?(" "+e+" ").indexOf(c)>-1:"|="===b?e===c||e.slice(0,c.length+1)===c+"-":!1):!0}},CHILD:function(a,b,c,d,e){var f="nth"!==a.slice(0,3),g="last"!==a.slice(-4),h="of-type"===b;return 1===d&&0===e?function(a){return!!a.parentNode}:function(b,c,i){var j,k,l,m,n,o,p=f!==g?"nextSibling":"previousSibling",q=b.parentNode,r=h&&b.nodeName.toLowerCase(),t=!i&&!h;if(q){if(f){while(p){l=b;while(l=l[p])if(h?l.nodeName.toLowerCase()===r:1===l.nodeType)return!1;o=p="only"===a&&!o&&"nextSibling"}return!0}if(o=[g?q.firstChild:q.lastChild],g&&t){k=q[s]||(q[s]={}),j=k[a]||[],n=j[0]===u&&j[1],m=j[0]===u&&j[2],l=n&&q.childNodes[n];while(l=++n&&l&&l[p]||(m=n=0)||o.pop())if(1===l.nodeType&&++m&&l===b){k[a]=[u,n,m];break}}else if(t&&(j=(b[s]||(b[s]={}))[a])&&j[0]===u)m=j[1];else while(l=++n&&l&&l[p]||(m=n=0)||o.pop())if((h?l.nodeName.toLowerCase()===r:1===l.nodeType)&&++m&&(t&&((l[s]||(l[s]={}))[a]=[u,m]),l===b))break;return m-=e,m===d||m%d===0&&m/d>=0}}},PSEUDO:function(a,b){var c,e=d.pseudos[a]||d.setFilters[a.toLowerCase()]||db.error("unsupported pseudo: "+a);return e[s]?e(b):e.length>1?(c=[a,a,"",b],d.setFilters.hasOwnProperty(a.toLowerCase())?fb(function(a,c){var d,f=e(a,b),g=f.length;while(g--)d=I.call(a,f[g]),a[d]=!(c[d]=f[g])}):function(a){return e(a,0,c)}):e}},pseudos:{not:fb(function(a){var b=[],c=[],d=g(a.replace(P,"$1"));return d[s]?fb(function(a,b,c,e){var f,g=d(a,null,e,[]),h=a.length;while(h--)(f=g[h])&&(a[h]=!(b[h]=f))}):function(a,e,f){return b[0]=a,d(b,null,f,c),!c.pop()}}),has:fb(function(a){return function(b){return db(a,b).length>0}}),contains:fb(function(a){return function(b){return(b.textContent||b.innerText||e(b)).indexOf(a)>-1}}),lang:fb(function(a){return U.test(a||"")||db.error("unsupported lang: "+a),a=a.replace(ab,bb).toLowerCase(),function(b){var c;do if(c=n?b.lang:b.getAttribute("xml:lang")||b.getAttribute("lang"))return c=c.toLowerCase(),c===a||0===c.indexOf(a+"-");while((b=b.parentNode)&&1===b.nodeType);return!1}}),target:function(b){var c=a.location&&a.location.hash;return c&&c.slice(1)===b.id},root:function(a){return a===m},focus:function(a){return a===l.activeElement&&(!l.hasFocus||l.hasFocus())&&!!(a.type||a.href||~a.tabIndex)},enabled:function(a){return a.disabled===!1},disabled:function(a){return a.disabled===!0},checked:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&!!a.checked||"option"===b&&!!a.selected},selected:function(a){return a.parentNode&&a.parentNode.selectedIndex,a.selected===!0},empty:function(a){for(a=a.firstChild;a;a=a.nextSibling)if(a.nodeType<6)return!1;return!0},parent:function(a){return!d.pseudos.empty(a)},header:function(a){return X.test(a.nodeName)},input:function(a){return W.test(a.nodeName)},button:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&"button"===a.type||"button"===b},text:function(a){var b;return"input"===a.nodeName.toLowerCase()&&"text"===a.type&&(null==(b=a.getAttribute("type"))||"text"===b.toLowerCase())},first:lb(function(){return[0]}),last:lb(function(a,b){return[b-1]}),eq:lb(function(a,b,c){return[0>c?c+b:c]}),even:lb(function(a,b){for(var c=0;b>c;c+=2)a.push(c);return a}),odd:lb(function(a,b){for(var c=1;b>c;c+=2)a.push(c);return a}),lt:lb(function(a,b,c){for(var d=0>c?c+b:c;--d>=0;)a.push(d);return a}),gt:lb(function(a,b,c){for(var d=0>c?c+b:c;++d<b;)a.push(d);return a})}},d.pseudos.nth=d.pseudos.eq;for(b in{radio:!0,checkbox:!0,file:!0,password:!0,image:!0})d.pseudos[b]=jb(b);for(b in{submit:!0,reset:!0})d.pseudos[b]=kb(b);function nb(){}nb.prototype=d.filters=d.pseudos,d.setFilters=new nb;function ob(a,b){var c,e,f,g,h,i,j,k=x[a+" "];if(k)return b?0:k.slice(0);h=a,i=[],j=d.preFilter;while(h){(!c||(e=Q.exec(h)))&&(e&&(h=h.slice(e[0].length)||h),i.push(f=[])),c=!1,(e=R.exec(h))&&(c=e.shift(),f.push({value:c,type:e[0].replace(P," ")}),h=h.slice(c.length));for(g in d.filter)!(e=V[g].exec(h))||j[g]&&!(e=j[g](e))||(c=e.shift(),f.push({value:c,type:g,matches:e}),h=h.slice(c.length));if(!c)break}return b?h.length:h?db.error(a):x(a,i).slice(0)}function pb(a){for(var b=0,c=a.length,d="";c>b;b++)d+=a[b].value;return d}function qb(a,b,c){var d=b.dir,e=c&&"parentNode"===d,f=v++;return b.first?function(b,c,f){while(b=b[d])if(1===b.nodeType||e)return a(b,c,f)}:function(b,c,g){var h,i,j=[u,f];if(g){while(b=b[d])if((1===b.nodeType||e)&&a(b,c,g))return!0}else while(b=b[d])if(1===b.nodeType||e){if(i=b[s]||(b[s]={}),(h=i[d])&&h[0]===u&&h[1]===f)return j[2]=h[2];if(i[d]=j,j[2]=a(b,c,g))return!0}}}function rb(a){return a.length>1?function(b,c,d){var e=a.length;while(e--)if(!a[e](b,c,d))return!1;return!0}:a[0]}function sb(a,b,c,d,e){for(var f,g=[],h=0,i=a.length,j=null!=b;i>h;h++)(f=a[h])&&(!c||c(f,d,e))&&(g.push(f),j&&b.push(h));return g}function tb(a,b,c,d,e,f){return d&&!d[s]&&(d=tb(d)),e&&!e[s]&&(e=tb(e,f)),fb(function(f,g,h,i){var j,k,l,m=[],n=[],o=g.length,p=f||wb(b||"*",h.nodeType?[h]:h,[]),q=!a||!f&&b?p:sb(p,m,a,h,i),r=c?e||(f?a:o||d)?[]:g:q;if(c&&c(q,r,h,i),d){j=sb(r,n),d(j,[],h,i),k=j.length;while(k--)(l=j[k])&&(r[n[k]]=!(q[n[k]]=l))}if(f){if(e||a){if(e){j=[],k=r.length;while(k--)(l=r[k])&&j.push(q[k]=l);e(null,r=[],j,i)}k=r.length;while(k--)(l=r[k])&&(j=e?I.call(f,l):m[k])>-1&&(f[j]=!(g[j]=l))}}else r=sb(r===g?r.splice(o,r.length):r),e?e(null,g,r,i):G.apply(g,r)})}function ub(a){for(var b,c,e,f=a.length,g=d.relative[a[0].type],i=g||d.relative[" "],j=g?1:0,k=qb(function(a){return a===b},i,!0),l=qb(function(a){return I.call(b,a)>-1},i,!0),m=[function(a,c,d){return!g&&(d||c!==h)||((b=c).nodeType?k(a,c,d):l(a,c,d))}];f>j;j++)if(c=d.relative[a[j].type])m=[qb(rb(m),c)];else{if(c=d.filter[a[j].type].apply(null,a[j].matches),c[s]){for(e=++j;f>e;e++)if(d.relative[a[e].type])break;return tb(j>1&&rb(m),j>1&&pb(a.slice(0,j-1).concat({value:" "===a[j-2].type?"*":""})).replace(P,"$1"),c,e>j&&ub(a.slice(j,e)),f>e&&ub(a=a.slice(e)),f>e&&pb(a))}m.push(c)}return rb(m)}function vb(a,b){var c=b.length>0,e=a.length>0,f=function(f,g,i,j,k){var m,n,o,p=0,q="0",r=f&&[],s=[],t=h,v=f||e&&d.find.TAG("*",k),w=u+=null==t?1:Math.random()||.1,x=v.length;for(k&&(h=g!==l&&g);q!==x&&null!=(m=v[q]);q++){if(e&&m){n=0;while(o=a[n++])if(o(m,g,i)){j.push(m);break}k&&(u=w)}c&&((m=!o&&m)&&p--,f&&r.push(m))}if(p+=q,c&&q!==p){n=0;while(o=b[n++])o(r,s,g,i);if(f){if(p>0)while(q--)r[q]||s[q]||(s[q]=E.call(j));s=sb(s)}G.apply(j,s),k&&!f&&s.length>0&&p+b.length>1&&db.uniqueSort(j)}return k&&(u=w,h=t),r};return c?fb(f):f}g=db.compile=function(a,b){var c,d=[],e=[],f=y[a+" "];if(!f){b||(b=ob(a)),c=b.length;while(c--)f=ub(b[c]),f[s]?d.push(f):e.push(f);f=y(a,vb(e,d))}return f};function wb(a,b,c){for(var d=0,e=b.length;e>d;d++)db(a,b[d],c);return c}function xb(a,b,e,f){var h,i,j,k,l,m=ob(a);if(!f&&1===m.length){if(i=m[0]=m[0].slice(0),i.length>2&&"ID"===(j=i[0]).type&&c.getById&&9===b.nodeType&&n&&d.relative[i[1].type]){if(b=(d.find.ID(j.matches[0].replace(ab,bb),b)||[])[0],!b)return e;a=a.slice(i.shift().value.length)}h=V.needsContext.test(a)?0:i.length;while(h--){if(j=i[h],d.relative[k=j.type])break;if((l=d.find[k])&&(f=l(j.matches[0].replace(ab,bb),$.test(i[0].type)&&mb(b.parentNode)||b))){if(i.splice(h,1),a=f.length&&pb(i),!a)return G.apply(e,f),e;break}}}return g(a,m)(f,b,!n,e,$.test(a)&&mb(b.parentNode)||b),e}return c.sortStable=s.split("").sort(z).join("")===s,c.detectDuplicates=!!j,k(),c.sortDetached=gb(function(a){return 1&a.compareDocumentPosition(l.createElement("div"))}),gb(function(a){return a.innerHTML="<a href='#'></a>","#"===a.firstChild.getAttribute("href")})||hb("type|href|height|width",function(a,b,c){return c?void 0:a.getAttribute(b,"type"===b.toLowerCase()?1:2)}),c.attributes&&gb(function(a){return a.innerHTML="<input/>",a.firstChild.setAttribute("value",""),""===a.firstChild.getAttribute("value")})||hb("value",function(a,b,c){return c||"input"!==a.nodeName.toLowerCase()?void 0:a.defaultValue}),gb(function(a){return null==a.getAttribute("disabled")})||hb(J,function(a,b,c){var d;return c?void 0:a[b]===!0?b.toLowerCase():(d=a.getAttributeNode(b))&&d.specified?d.value:null}),db}(a);o.find=t,o.expr=t.selectors,o.expr[":"]=o.expr.pseudos,o.unique=t.uniqueSort,o.text=t.getText,o.isXMLDoc=t.isXML,o.contains=t.contains;var u=o.expr.match.needsContext,v=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,w=/^.[^:#\[\.,]*$/;function x(a,b,c){if(o.isFunction(b))return o.grep(a,function(a,d){return!!b.call(a,d,a)!==c});if(b.nodeType)return o.grep(a,function(a){return a===b!==c});if("string"==typeof b){if(w.test(b))return o.filter(b,a,c);b=o.filter(b,a)}return o.grep(a,function(a){return g.call(b,a)>=0!==c})}o.filter=function(a,b,c){var d=b[0];return c&&(a=":not("+a+")"),1===b.length&&1===d.nodeType?o.find.matchesSelector(d,a)?[d]:[]:o.find.matches(a,o.grep(b,function(a){return 1===a.nodeType}))},o.fn.extend({find:function(a){var b,c=this.length,d=[],e=this;if("string"!=typeof a)return this.pushStack(o(a).filter(function(){for(b=0;c>b;b++)if(o.contains(e[b],this))return!0}));for(b=0;c>b;b++)o.find(a,e[b],d);return d=this.pushStack(c>1?o.unique(d):d),d.selector=this.selector?this.selector+" "+a:a,d},filter:function(a){return this.pushStack(x(this,a||[],!1))},not:function(a){return this.pushStack(x(this,a||[],!0))},is:function(a){return!!x(this,"string"==typeof a&&u.test(a)?o(a):a||[],!1).length}});var y,z=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,A=o.fn.init=function(a,b){var c,d;if(!a)return this;if("string"==typeof a){if(c="<"===a[0]&&">"===a[a.length-1]&&a.length>=3?[null,a,null]:z.exec(a),!c||!c[1]&&b)return!b||b.jquery?(b||y).find(a):this.constructor(b).find(a);if(c[1]){if(b=b instanceof o?b[0]:b,o.merge(this,o.parseHTML(c[1],b&&b.nodeType?b.ownerDocument||b:m,!0)),v.test(c[1])&&o.isPlainObject(b))for(c in b)o.isFunction(this[c])?this[c](b[c]):this.attr(c,b[c]);return this}return d=m.getElementById(c[2]),d&&d.parentNode&&(this.length=1,this[0]=d),this.context=m,this.selector=a,this}return a.nodeType?(this.context=this[0]=a,this.length=1,this):o.isFunction(a)?"undefined"!=typeof y.ready?y.ready(a):a(o):(void 0!==a.selector&&(this.selector=a.selector,this.context=a.context),o.makeArray(a,this))};A.prototype=o.fn,y=o(m);var B=/^(?:parents|prev(?:Until|All))/,C={children:!0,contents:!0,next:!0,prev:!0};o.extend({dir:function(a,b,c){var d=[],e=void 0!==c;while((a=a[b])&&9!==a.nodeType)if(1===a.nodeType){if(e&&o(a).is(c))break;d.push(a)}return d},sibling:function(a,b){for(var c=[];a;a=a.nextSibling)1===a.nodeType&&a!==b&&c.push(a);return c}}),o.fn.extend({has:function(a){var b=o(a,this),c=b.length;return this.filter(function(){for(var a=0;c>a;a++)if(o.contains(this,b[a]))return!0})},closest:function(a,b){for(var c,d=0,e=this.length,f=[],g=u.test(a)||"string"!=typeof a?o(a,b||this.context):0;e>d;d++)for(c=this[d];c&&c!==b;c=c.parentNode)if(c.nodeType<11&&(g?g.index(c)>-1:1===c.nodeType&&o.find.matchesSelector(c,a))){f.push(c);break}return this.pushStack(f.length>1?o.unique(f):f)},index:function(a){return a?"string"==typeof a?g.call(o(a),this[0]):g.call(this,a.jquery?a[0]:a):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(a,b){return this.pushStack(o.unique(o.merge(this.get(),o(a,b))))},addBack:function(a){return this.add(null==a?this.prevObject:this.prevObject.filter(a))}});function D(a,b){while((a=a[b])&&1!==a.nodeType);return a}o.each({parent:function(a){var b=a.parentNode;return b&&11!==b.nodeType?b:null},parents:function(a){return o.dir(a,"parentNode")},parentsUntil:function(a,b,c){return o.dir(a,"parentNode",c)},next:function(a){return D(a,"nextSibling")},prev:function(a){return D(a,"previousSibling")},nextAll:function(a){return o.dir(a,"nextSibling")},prevAll:function(a){return o.dir(a,"previousSibling")},nextUntil:function(a,b,c){return o.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return o.dir(a,"previousSibling",c)},siblings:function(a){return o.sibling((a.parentNode||{}).firstChild,a)},children:function(a){return o.sibling(a.firstChild)},contents:function(a){return a.contentDocument||o.merge([],a.childNodes)}},function(a,b){o.fn[a]=function(c,d){var e=o.map(this,b,c);return"Until"!==a.slice(-5)&&(d=c),d&&"string"==typeof d&&(e=o.filter(d,e)),this.length>1&&(C[a]||o.unique(e),B.test(a)&&e.reverse()),this.pushStack(e)}});var E=/\S+/g,F={};function G(a){var b=F[a]={};return o.each(a.match(E)||[],function(a,c){b[c]=!0}),b}o.Callbacks=function(a){a="string"==typeof a?F[a]||G(a):o.extend({},a);var b,c,d,e,f,g,h=[],i=!a.once&&[],j=function(l){for(b=a.memory&&l,c=!0,g=e||0,e=0,f=h.length,d=!0;h&&f>g;g++)if(h[g].apply(l[0],l[1])===!1&&a.stopOnFalse){b=!1;break}d=!1,h&&(i?i.length&&j(i.shift()):b?h=[]:k.disable())},k={add:function(){if(h){var c=h.length;!function g(b){o.each(b,function(b,c){var d=o.type(c);"function"===d?a.unique&&k.has(c)||h.push(c):c&&c.length&&"string"!==d&&g(c)})}(arguments),d?f=h.length:b&&(e=c,j(b))}return this},remove:function(){return h&&o.each(arguments,function(a,b){var c;while((c=o.inArray(b,h,c))>-1)h.splice(c,1),d&&(f>=c&&f--,g>=c&&g--)}),this},has:function(a){return a?o.inArray(a,h)>-1:!(!h||!h.length)},empty:function(){return h=[],f=0,this},disable:function(){return h=i=b=void 0,this},disabled:function(){return!h},lock:function(){return i=void 0,b||k.disable(),this},locked:function(){return!i},fireWith:function(a,b){return!h||c&&!i||(b=b||[],b=[a,b.slice?b.slice():b],d?i.push(b):j(b)),this},fire:function(){return k.fireWith(this,arguments),this},fired:function(){return!!c}};return k},o.extend({Deferred:function(a){var b=[["resolve","done",o.Callbacks("once memory"),"resolved"],["reject","fail",o.Callbacks("once memory"),"rejected"],["notify","progress",o.Callbacks("memory")]],c="pending",d={state:function(){return c},always:function(){return e.done(arguments).fail(arguments),this},then:function(){var a=arguments;return o.Deferred(function(c){o.each(b,function(b,f){var g=o.isFunction(a[b])&&a[b];e[f[1]](function(){var a=g&&g.apply(this,arguments);a&&o.isFunction(a.promise)?a.promise().done(c.resolve).fail(c.reject).progress(c.notify):c[f[0]+"With"](this===d?c.promise():this,g?[a]:arguments)})}),a=null}).promise()},promise:function(a){return null!=a?o.extend(a,d):d}},e={};return d.pipe=d.then,o.each(b,function(a,f){var g=f[2],h=f[3];d[f[1]]=g.add,h&&g.add(function(){c=h},b[1^a][2].disable,b[2][2].lock),e[f[0]]=function(){return e[f[0]+"With"](this===e?d:this,arguments),this},e[f[0]+"With"]=g.fireWith}),d.promise(e),a&&a.call(e,e),e},when:function(a){var b=0,c=d.call(arguments),e=c.length,f=1!==e||a&&o.isFunction(a.promise)?e:0,g=1===f?a:o.Deferred(),h=function(a,b,c){return function(e){b[a]=this,c[a]=arguments.length>1?d.call(arguments):e,c===i?g.notifyWith(b,c):--f||g.resolveWith(b,c)}},i,j,k;if(e>1)for(i=new Array(e),j=new Array(e),k=new Array(e);e>b;b++)c[b]&&o.isFunction(c[b].promise)?c[b].promise().done(h(b,k,c)).fail(g.reject).progress(h(b,j,i)):--f;return f||g.resolveWith(k,c),g.promise()}});var H;o.fn.ready=function(a){return o.ready.promise().done(a),this},o.extend({isReady:!1,readyWait:1,holdReady:function(a){a?o.readyWait++:o.ready(!0)},ready:function(a){(a===!0?--o.readyWait:o.isReady)||(o.isReady=!0,a!==!0&&--o.readyWait>0||(H.resolveWith(m,[o]),o.fn.trigger&&o(m).trigger("ready").off("ready")))}});function I(){m.removeEventListener("DOMContentLoaded",I,!1),a.removeEventListener("load",I,!1),o.ready()}o.ready.promise=function(b){return H||(H=o.Deferred(),"complete"===m.readyState?setTimeout(o.ready):(m.addEventListener("DOMContentLoaded",I,!1),a.addEventListener("load",I,!1))),H.promise(b)},o.ready.promise();var J=o.access=function(a,b,c,d,e,f,g){var h=0,i=a.length,j=null==c;if("object"===o.type(c)){e=!0;for(h in c)o.access(a,b,h,c[h],!0,f,g)}else if(void 0!==d&&(e=!0,o.isFunction(d)||(g=!0),j&&(g?(b.call(a,d),b=null):(j=b,b=function(a,b,c){return j.call(o(a),c)})),b))for(;i>h;h++)b(a[h],c,g?d:d.call(a[h],h,b(a[h],c)));return e?a:j?b.call(a):i?b(a[0],c):f};o.acceptData=function(a){return 1===a.nodeType||9===a.nodeType||!+a.nodeType};function K(){Object.defineProperty(this.cache={},0,{get:function(){return{}}}),this.expando=o.expando+Math.random()}K.uid=1,K.accepts=o.acceptData,K.prototype={key:function(a){if(!K.accepts(a))return 0;var b={},c=a[this.expando];if(!c){c=K.uid++;try{b[this.expando]={value:c},Object.defineProperties(a,b)}catch(d){b[this.expando]=c,o.extend(a,b)}}return this.cache[c]||(this.cache[c]={}),c},set:function(a,b,c){var d,e=this.key(a),f=this.cache[e];if("string"==typeof b)f[b]=c;else if(o.isEmptyObject(f))o.extend(this.cache[e],b);else for(d in b)f[d]=b[d];return f},get:function(a,b){var c=this.cache[this.key(a)];return void 0===b?c:c[b]},access:function(a,b,c){var d;return void 0===b||b&&"string"==typeof b&&void 0===c?(d=this.get(a,b),void 0!==d?d:this.get(a,o.camelCase(b))):(this.set(a,b,c),void 0!==c?c:b)},remove:function(a,b){var c,d,e,f=this.key(a),g=this.cache[f];if(void 0===b)this.cache[f]={};else{o.isArray(b)?d=b.concat(b.map(o.camelCase)):(e=o.camelCase(b),b in g?d=[b,e]:(d=e,d=d in g?[d]:d.match(E)||[])),c=d.length;while(c--)delete g[d[c]]}},hasData:function(a){return!o.isEmptyObject(this.cache[a[this.expando]]||{})},discard:function(a){a[this.expando]&&delete this.cache[a[this.expando]]}};var L=new K,M=new K,N=/^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,O=/([A-Z])/g;function P(a,b,c){var d;if(void 0===c&&1===a.nodeType)if(d="data-"+b.replace(O,"-$1").toLowerCase(),c=a.getAttribute(d),"string"==typeof c){try{c="true"===c?!0:"false"===c?!1:"null"===c?null:+c+""===c?+c:N.test(c)?o.parseJSON(c):c}catch(e){}M.set(a,b,c)}else c=void 0;return c}o.extend({hasData:function(a){return M.hasData(a)||L.hasData(a)},data:function(a,b,c){return M.access(a,b,c)},removeData:function(a,b){M.remove(a,b)},_data:function(a,b,c){return L.access(a,b,c)},_removeData:function(a,b){L.remove(a,b)}}),o.fn.extend({data:function(a,b){var c,d,e,f=this[0],g=f&&f.attributes;if(void 0===a){if(this.length&&(e=M.get(f),1===f.nodeType&&!L.get(f,"hasDataAttrs"))){c=g.length;
+while(c--)d=g[c].name,0===d.indexOf("data-")&&(d=o.camelCase(d.slice(5)),P(f,d,e[d]));L.set(f,"hasDataAttrs",!0)}return e}return"object"==typeof a?this.each(function(){M.set(this,a)}):J(this,function(b){var c,d=o.camelCase(a);if(f&&void 0===b){if(c=M.get(f,a),void 0!==c)return c;if(c=M.get(f,d),void 0!==c)return c;if(c=P(f,d,void 0),void 0!==c)return c}else this.each(function(){var c=M.get(this,d);M.set(this,d,b),-1!==a.indexOf("-")&&void 0!==c&&M.set(this,a,b)})},null,b,arguments.length>1,null,!0)},removeData:function(a){return this.each(function(){M.remove(this,a)})}}),o.extend({queue:function(a,b,c){var d;return a?(b=(b||"fx")+"queue",d=L.get(a,b),c&&(!d||o.isArray(c)?d=L.access(a,b,o.makeArray(c)):d.push(c)),d||[]):void 0},dequeue:function(a,b){b=b||"fx";var c=o.queue(a,b),d=c.length,e=c.shift(),f=o._queueHooks(a,b),g=function(){o.dequeue(a,b)};"inprogress"===e&&(e=c.shift(),d--),e&&("fx"===b&&c.unshift("inprogress"),delete f.stop,e.call(a,g,f)),!d&&f&&f.empty.fire()},_queueHooks:function(a,b){var c=b+"queueHooks";return L.get(a,c)||L.access(a,c,{empty:o.Callbacks("once memory").add(function(){L.remove(a,[b+"queue",c])})})}}),o.fn.extend({queue:function(a,b){var c=2;return"string"!=typeof a&&(b=a,a="fx",c--),arguments.length<c?o.queue(this[0],a):void 0===b?this:this.each(function(){var c=o.queue(this,a,b);o._queueHooks(this,a),"fx"===a&&"inprogress"!==c[0]&&o.dequeue(this,a)})},dequeue:function(a){return this.each(function(){o.dequeue(this,a)})},clearQueue:function(a){return this.queue(a||"fx",[])},promise:function(a,b){var c,d=1,e=o.Deferred(),f=this,g=this.length,h=function(){--d||e.resolveWith(f,[f])};"string"!=typeof a&&(b=a,a=void 0),a=a||"fx";while(g--)c=L.get(f[g],a+"queueHooks"),c&&c.empty&&(d++,c.empty.add(h));return h(),e.promise(b)}});var Q=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,R=["Top","Right","Bottom","Left"],S=function(a,b){return a=b||a,"none"===o.css(a,"display")||!o.contains(a.ownerDocument,a)},T=/^(?:checkbox|radio)$/i;!function(){var a=m.createDocumentFragment(),b=a.appendChild(m.createElement("div"));b.innerHTML="<input type='radio' checked='checked' name='t'/>",l.checkClone=b.cloneNode(!0).cloneNode(!0).lastChild.checked,b.innerHTML="<textarea>x</textarea>",l.noCloneChecked=!!b.cloneNode(!0).lastChild.defaultValue}();var U="undefined";l.focusinBubbles="onfocusin"in a;var V=/^key/,W=/^(?:mouse|contextmenu)|click/,X=/^(?:focusinfocus|focusoutblur)$/,Y=/^([^.]*)(?:\.(.+)|)$/;function Z(){return!0}function $(){return!1}function _(){try{return m.activeElement}catch(a){}}o.event={global:{},add:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,n,p,q,r=L.get(a);if(r){c.handler&&(f=c,c=f.handler,e=f.selector),c.guid||(c.guid=o.guid++),(i=r.events)||(i=r.events={}),(g=r.handle)||(g=r.handle=function(b){return typeof o!==U&&o.event.triggered!==b.type?o.event.dispatch.apply(a,arguments):void 0}),b=(b||"").match(E)||[""],j=b.length;while(j--)h=Y.exec(b[j])||[],n=q=h[1],p=(h[2]||"").split(".").sort(),n&&(l=o.event.special[n]||{},n=(e?l.delegateType:l.bindType)||n,l=o.event.special[n]||{},k=o.extend({type:n,origType:q,data:d,handler:c,guid:c.guid,selector:e,needsContext:e&&o.expr.match.needsContext.test(e),namespace:p.join(".")},f),(m=i[n])||(m=i[n]=[],m.delegateCount=0,l.setup&&l.setup.call(a,d,p,g)!==!1||a.addEventListener&&a.addEventListener(n,g,!1)),l.add&&(l.add.call(a,k),k.handler.guid||(k.handler.guid=c.guid)),e?m.splice(m.delegateCount++,0,k):m.push(k),o.event.global[n]=!0)}},remove:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,n,p,q,r=L.hasData(a)&&L.get(a);if(r&&(i=r.events)){b=(b||"").match(E)||[""],j=b.length;while(j--)if(h=Y.exec(b[j])||[],n=q=h[1],p=(h[2]||"").split(".").sort(),n){l=o.event.special[n]||{},n=(d?l.delegateType:l.bindType)||n,m=i[n]||[],h=h[2]&&new RegExp("(^|\\.)"+p.join("\\.(?:.*\\.|)")+"(\\.|$)"),g=f=m.length;while(f--)k=m[f],!e&&q!==k.origType||c&&c.guid!==k.guid||h&&!h.test(k.namespace)||d&&d!==k.selector&&("**"!==d||!k.selector)||(m.splice(f,1),k.selector&&m.delegateCount--,l.remove&&l.remove.call(a,k));g&&!m.length&&(l.teardown&&l.teardown.call(a,p,r.handle)!==!1||o.removeEvent(a,n,r.handle),delete i[n])}else for(n in i)o.event.remove(a,n+b[j],c,d,!0);o.isEmptyObject(i)&&(delete r.handle,L.remove(a,"events"))}},trigger:function(b,c,d,e){var f,g,h,i,k,l,n,p=[d||m],q=j.call(b,"type")?b.type:b,r=j.call(b,"namespace")?b.namespace.split("."):[];if(g=h=d=d||m,3!==d.nodeType&&8!==d.nodeType&&!X.test(q+o.event.triggered)&&(q.indexOf(".")>=0&&(r=q.split("."),q=r.shift(),r.sort()),k=q.indexOf(":")<0&&"on"+q,b=b[o.expando]?b:new o.Event(q,"object"==typeof b&&b),b.isTrigger=e?2:3,b.namespace=r.join("."),b.namespace_re=b.namespace?new RegExp("(^|\\.)"+r.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,b.result=void 0,b.target||(b.target=d),c=null==c?[b]:o.makeArray(c,[b]),n=o.event.special[q]||{},e||!n.trigger||n.trigger.apply(d,c)!==!1)){if(!e&&!n.noBubble&&!o.isWindow(d)){for(i=n.delegateType||q,X.test(i+q)||(g=g.parentNode);g;g=g.parentNode)p.push(g),h=g;h===(d.ownerDocument||m)&&p.push(h.defaultView||h.parentWindow||a)}f=0;while((g=p[f++])&&!b.isPropagationStopped())b.type=f>1?i:n.bindType||q,l=(L.get(g,"events")||{})[b.type]&&L.get(g,"handle"),l&&l.apply(g,c),l=k&&g[k],l&&l.apply&&o.acceptData(g)&&(b.result=l.apply(g,c),b.result===!1&&b.preventDefault());return b.type=q,e||b.isDefaultPrevented()||n._default&&n._default.apply(p.pop(),c)!==!1||!o.acceptData(d)||k&&o.isFunction(d[q])&&!o.isWindow(d)&&(h=d[k],h&&(d[k]=null),o.event.triggered=q,d[q](),o.event.triggered=void 0,h&&(d[k]=h)),b.result}},dispatch:function(a){a=o.event.fix(a);var b,c,e,f,g,h=[],i=d.call(arguments),j=(L.get(this,"events")||{})[a.type]||[],k=o.event.special[a.type]||{};if(i[0]=a,a.delegateTarget=this,!k.preDispatch||k.preDispatch.call(this,a)!==!1){h=o.event.handlers.call(this,a,j),b=0;while((f=h[b++])&&!a.isPropagationStopped()){a.currentTarget=f.elem,c=0;while((g=f.handlers[c++])&&!a.isImmediatePropagationStopped())(!a.namespace_re||a.namespace_re.test(g.namespace))&&(a.handleObj=g,a.data=g.data,e=((o.event.special[g.origType]||{}).handle||g.handler).apply(f.elem,i),void 0!==e&&(a.result=e)===!1&&(a.preventDefault(),a.stopPropagation()))}return k.postDispatch&&k.postDispatch.call(this,a),a.result}},handlers:function(a,b){var c,d,e,f,g=[],h=b.delegateCount,i=a.target;if(h&&i.nodeType&&(!a.button||"click"!==a.type))for(;i!==this;i=i.parentNode||this)if(i.disabled!==!0||"click"!==a.type){for(d=[],c=0;h>c;c++)f=b[c],e=f.selector+" ",void 0===d[e]&&(d[e]=f.needsContext?o(e,this).index(i)>=0:o.find(e,this,null,[i]).length),d[e]&&d.push(f);d.length&&g.push({elem:i,handlers:d})}return h<b.length&&g.push({elem:this,handlers:b.slice(h)}),g},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(a,b){return null==a.which&&(a.which=null!=b.charCode?b.charCode:b.keyCode),a}},mouseHooks:{props:"button buttons clientX clientY offsetX offsetY pageX pageY screenX screenY toElement".split(" "),filter:function(a,b){var c,d,e,f=b.button;return null==a.pageX&&null!=b.clientX&&(c=a.target.ownerDocument||m,d=c.documentElement,e=c.body,a.pageX=b.clientX+(d&&d.scrollLeft||e&&e.scrollLeft||0)-(d&&d.clientLeft||e&&e.clientLeft||0),a.pageY=b.clientY+(d&&d.scrollTop||e&&e.scrollTop||0)-(d&&d.clientTop||e&&e.clientTop||0)),a.which||void 0===f||(a.which=1&f?1:2&f?3:4&f?2:0),a}},fix:function(a){if(a[o.expando])return a;var b,c,d,e=a.type,f=a,g=this.fixHooks[e];g||(this.fixHooks[e]=g=W.test(e)?this.mouseHooks:V.test(e)?this.keyHooks:{}),d=g.props?this.props.concat(g.props):this.props,a=new o.Event(f),b=d.length;while(b--)c=d[b],a[c]=f[c];return a.target||(a.target=m),3===a.target.nodeType&&(a.target=a.target.parentNode),g.filter?g.filter(a,f):a},special:{load:{noBubble:!0},focus:{trigger:function(){return this!==_()&&this.focus?(this.focus(),!1):void 0},delegateType:"focusin"},blur:{trigger:function(){return this===_()&&this.blur?(this.blur(),!1):void 0},delegateType:"focusout"},click:{trigger:function(){return"checkbox"===this.type&&this.click&&o.nodeName(this,"input")?(this.click(),!1):void 0},_default:function(a){return o.nodeName(a.target,"a")}},beforeunload:{postDispatch:function(a){void 0!==a.result&&(a.originalEvent.returnValue=a.result)}}},simulate:function(a,b,c,d){var e=o.extend(new o.Event,c,{type:a,isSimulated:!0,originalEvent:{}});d?o.event.trigger(e,null,b):o.event.dispatch.call(b,e),e.isDefaultPrevented()&&c.preventDefault()}},o.removeEvent=function(a,b,c){a.removeEventListener&&a.removeEventListener(b,c,!1)},o.Event=function(a,b){return this instanceof o.Event?(a&&a.type?(this.originalEvent=a,this.type=a.type,this.isDefaultPrevented=a.defaultPrevented||void 0===a.defaultPrevented&&a.getPreventDefault&&a.getPreventDefault()?Z:$):this.type=a,b&&o.extend(this,b),this.timeStamp=a&&a.timeStamp||o.now(),void(this[o.expando]=!0)):new o.Event(a,b)},o.Event.prototype={isDefaultPrevented:$,isPropagationStopped:$,isImmediatePropagationStopped:$,preventDefault:function(){var a=this.originalEvent;this.isDefaultPrevented=Z,a&&a.preventDefault&&a.preventDefault()},stopPropagation:function(){var a=this.originalEvent;this.isPropagationStopped=Z,a&&a.stopPropagation&&a.stopPropagation()},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=Z,this.stopPropagation()}},o.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(a,b){o.event.special[a]={delegateType:b,bindType:b,handle:function(a){var c,d=this,e=a.relatedTarget,f=a.handleObj;return(!e||e!==d&&!o.contains(d,e))&&(a.type=f.origType,c=f.handler.apply(this,arguments),a.type=b),c}}}),l.focusinBubbles||o.each({focus:"focusin",blur:"focusout"},function(a,b){var c=function(a){o.event.simulate(b,a.target,o.event.fix(a),!0)};o.event.special[b]={setup:function(){var d=this.ownerDocument||this,e=L.access(d,b);e||d.addEventListener(a,c,!0),L.access(d,b,(e||0)+1)},teardown:function(){var d=this.ownerDocument||this,e=L.access(d,b)-1;e?L.access(d,b,e):(d.removeEventListener(a,c,!0),L.remove(d,b))}}}),o.fn.extend({on:function(a,b,c,d,e){var f,g;if("object"==typeof a){"string"!=typeof b&&(c=c||b,b=void 0);for(g in a)this.on(g,b,c,a[g],e);return this}if(null==c&&null==d?(d=b,c=b=void 0):null==d&&("string"==typeof b?(d=c,c=void 0):(d=c,c=b,b=void 0)),d===!1)d=$;else if(!d)return this;return 1===e&&(f=d,d=function(a){return o().off(a),f.apply(this,arguments)},d.guid=f.guid||(f.guid=o.guid++)),this.each(function(){o.event.add(this,a,d,c,b)})},one:function(a,b,c,d){return this.on(a,b,c,d,1)},off:function(a,b,c){var d,e;if(a&&a.preventDefault&&a.handleObj)return d=a.handleObj,o(a.delegateTarget).off(d.namespace?d.origType+"."+d.namespace:d.origType,d.selector,d.handler),this;if("object"==typeof a){for(e in a)this.off(e,b,a[e]);return this}return(b===!1||"function"==typeof b)&&(c=b,b=void 0),c===!1&&(c=$),this.each(function(){o.event.remove(this,a,c,b)})},trigger:function(a,b){return this.each(function(){o.event.trigger(a,b,this)})},triggerHandler:function(a,b){var c=this[0];return c?o.event.trigger(a,b,c,!0):void 0}});var ab=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,bb=/<([\w:]+)/,cb=/<|&#?\w+;/,db=/<(?:script|style|link)/i,eb=/checked\s*(?:[^=]|=\s*.checked.)/i,fb=/^$|\/(?:java|ecma)script/i,gb=/^true\/(.*)/,hb=/^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g,ib={option:[1,"<select multiple='multiple'>","</select>"],thead:[1,"<table>","</table>"],col:[2,"<table><colgroup>","</colgroup></table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],_default:[0,"",""]};ib.optgroup=ib.option,ib.tbody=ib.tfoot=ib.colgroup=ib.caption=ib.thead,ib.th=ib.td;function jb(a,b){return o.nodeName(a,"table")&&o.nodeName(11!==b.nodeType?b:b.firstChild,"tr")?a.getElementsByTagName("tbody")[0]||a.appendChild(a.ownerDocument.createElement("tbody")):a}function kb(a){return a.type=(null!==a.getAttribute("type"))+"/"+a.type,a}function lb(a){var b=gb.exec(a.type);return b?a.type=b[1]:a.removeAttribute("type"),a}function mb(a,b){for(var c=0,d=a.length;d>c;c++)L.set(a[c],"globalEval",!b||L.get(b[c],"globalEval"))}function nb(a,b){var c,d,e,f,g,h,i,j;if(1===b.nodeType){if(L.hasData(a)&&(f=L.access(a),g=L.set(b,f),j=f.events)){delete g.handle,g.events={};for(e in j)for(c=0,d=j[e].length;d>c;c++)o.event.add(b,e,j[e][c])}M.hasData(a)&&(h=M.access(a),i=o.extend({},h),M.set(b,i))}}function ob(a,b){var c=a.getElementsByTagName?a.getElementsByTagName(b||"*"):a.querySelectorAll?a.querySelectorAll(b||"*"):[];return void 0===b||b&&o.nodeName(a,b)?o.merge([a],c):c}function pb(a,b){var c=b.nodeName.toLowerCase();"input"===c&&T.test(a.type)?b.checked=a.checked:("input"===c||"textarea"===c)&&(b.defaultValue=a.defaultValue)}o.extend({clone:function(a,b,c){var d,e,f,g,h=a.cloneNode(!0),i=o.contains(a.ownerDocument,a);if(!(l.noCloneChecked||1!==a.nodeType&&11!==a.nodeType||o.isXMLDoc(a)))for(g=ob(h),f=ob(a),d=0,e=f.length;e>d;d++)pb(f[d],g[d]);if(b)if(c)for(f=f||ob(a),g=g||ob(h),d=0,e=f.length;e>d;d++)nb(f[d],g[d]);else nb(a,h);return g=ob(h,"script"),g.length>0&&mb(g,!i&&ob(a,"script")),h},buildFragment:function(a,b,c,d){for(var e,f,g,h,i,j,k=b.createDocumentFragment(),l=[],m=0,n=a.length;n>m;m++)if(e=a[m],e||0===e)if("object"===o.type(e))o.merge(l,e.nodeType?[e]:e);else if(cb.test(e)){f=f||k.appendChild(b.createElement("div")),g=(bb.exec(e)||["",""])[1].toLowerCase(),h=ib[g]||ib._default,f.innerHTML=h[1]+e.replace(ab,"<$1></$2>")+h[2],j=h[0];while(j--)f=f.lastChild;o.merge(l,f.childNodes),f=k.firstChild,f.textContent=""}else l.push(b.createTextNode(e));k.textContent="",m=0;while(e=l[m++])if((!d||-1===o.inArray(e,d))&&(i=o.contains(e.ownerDocument,e),f=ob(k.appendChild(e),"script"),i&&mb(f),c)){j=0;while(e=f[j++])fb.test(e.type||"")&&c.push(e)}return k},cleanData:function(a){for(var b,c,d,e,f,g,h=o.event.special,i=0;void 0!==(c=a[i]);i++){if(o.acceptData(c)&&(f=c[L.expando],f&&(b=L.cache[f]))){if(d=Object.keys(b.events||{}),d.length)for(g=0;void 0!==(e=d[g]);g++)h[e]?o.event.remove(c,e):o.removeEvent(c,e,b.handle);L.cache[f]&&delete L.cache[f]}delete M.cache[c[M.expando]]}}}),o.fn.extend({text:function(a){return J(this,function(a){return void 0===a?o.text(this):this.empty().each(function(){(1===this.nodeType||11===this.nodeType||9===this.nodeType)&&(this.textContent=a)})},null,a,arguments.length)},append:function(){return this.domManip(arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=jb(this,a);b.appendChild(a)}})},prepend:function(){return this.domManip(arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=jb(this,a);b.insertBefore(a,b.firstChild)}})},before:function(){return this.domManip(arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this)})},after:function(){return this.domManip(arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this.nextSibling)})},remove:function(a,b){for(var c,d=a?o.filter(a,this):this,e=0;null!=(c=d[e]);e++)b||1!==c.nodeType||o.cleanData(ob(c)),c.parentNode&&(b&&o.contains(c.ownerDocument,c)&&mb(ob(c,"script")),c.parentNode.removeChild(c));return this},empty:function(){for(var a,b=0;null!=(a=this[b]);b++)1===a.nodeType&&(o.cleanData(ob(a,!1)),a.textContent="");return this},clone:function(a,b){return a=null==a?!1:a,b=null==b?a:b,this.map(function(){return o.clone(this,a,b)})},html:function(a){return J(this,function(a){var b=this[0]||{},c=0,d=this.length;if(void 0===a&&1===b.nodeType)return b.innerHTML;if("string"==typeof a&&!db.test(a)&&!ib[(bb.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(ab,"<$1></$2>");try{for(;d>c;c++)b=this[c]||{},1===b.nodeType&&(o.cleanData(ob(b,!1)),b.innerHTML=a);b=0}catch(e){}}b&&this.empty().append(a)},null,a,arguments.length)},replaceWith:function(){var a=arguments[0];return this.domManip(arguments,function(b){a=this.parentNode,o.cleanData(ob(this)),a&&a.replaceChild(b,this)}),a&&(a.length||a.nodeType)?this:this.remove()},detach:function(a){return this.remove(a,!0)},domManip:function(a,b){a=e.apply([],a);var c,d,f,g,h,i,j=0,k=this.length,m=this,n=k-1,p=a[0],q=o.isFunction(p);if(q||k>1&&"string"==typeof p&&!l.checkClone&&eb.test(p))return this.each(function(c){var d=m.eq(c);q&&(a[0]=p.call(this,c,d.html())),d.domManip(a,b)});if(k&&(c=o.buildFragment(a,this[0].ownerDocument,!1,this),d=c.firstChild,1===c.childNodes.length&&(c=d),d)){for(f=o.map(ob(c,"script"),kb),g=f.length;k>j;j++)h=c,j!==n&&(h=o.clone(h,!0,!0),g&&o.merge(f,ob(h,"script"))),b.call(this[j],h,j);if(g)for(i=f[f.length-1].ownerDocument,o.map(f,lb),j=0;g>j;j++)h=f[j],fb.test(h.type||"")&&!L.access(h,"globalEval")&&o.contains(i,h)&&(h.src?o._evalUrl&&o._evalUrl(h.src):o.globalEval(h.textContent.replace(hb,"")))}return this}}),o.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){o.fn[a]=function(a){for(var c,d=[],e=o(a),g=e.length-1,h=0;g>=h;h++)c=h===g?this:this.clone(!0),o(e[h])[b](c),f.apply(d,c.get());return this.pushStack(d)}});var qb,rb={};function sb(b,c){var d=o(c.createElement(b)).appendTo(c.body),e=a.getDefaultComputedStyle?a.getDefaultComputedStyle(d[0]).display:o.css(d[0],"display");return d.detach(),e}function tb(a){var b=m,c=rb[a];return c||(c=sb(a,b),"none"!==c&&c||(qb=(qb||o("<iframe frameborder='0' width='0' height='0'/>")).appendTo(b.documentElement),b=qb[0].contentDocument,b.write(),b.close(),c=sb(a,b),qb.detach()),rb[a]=c),c}var ub=/^margin/,vb=new RegExp("^("+Q+")(?!px)[a-z%]+$","i"),wb=function(a){return a.ownerDocument.defaultView.getComputedStyle(a,null)};function xb(a,b,c){var d,e,f,g,h=a.style;return c=c||wb(a),c&&(g=c.getPropertyValue(b)||c[b]),c&&(""!==g||o.contains(a.ownerDocument,a)||(g=o.style(a,b)),vb.test(g)&&ub.test(b)&&(d=h.width,e=h.minWidth,f=h.maxWidth,h.minWidth=h.maxWidth=h.width=g,g=c.width,h.width=d,h.minWidth=e,h.maxWidth=f)),void 0!==g?g+"":g}function yb(a,b){return{get:function(){return a()?void delete this.get:(this.get=b).apply(this,arguments)}}}!function(){var b,c,d="padding:0;margin:0;border:0;display:block;-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box",e=m.documentElement,f=m.createElement("div"),g=m.createElement("div");g.style.backgroundClip="content-box",g.cloneNode(!0).style.backgroundClip="",l.clearCloneStyle="content-box"===g.style.backgroundClip,f.style.cssText="border:0;width:0;height:0;position:absolute;top:0;left:-9999px;margin-top:1px",f.appendChild(g);function h(){g.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%",e.appendChild(f);var d=a.getComputedStyle(g,null);b="1%"!==d.top,c="4px"===d.width,e.removeChild(f)}a.getComputedStyle&&o.extend(l,{pixelPosition:function(){return h(),b},boxSizingReliable:function(){return null==c&&h(),c},reliableMarginRight:function(){var b,c=g.appendChild(m.createElement("div"));return c.style.cssText=g.style.cssText=d,c.style.marginRight=c.style.width="0",g.style.width="1px",e.appendChild(f),b=!parseFloat(a.getComputedStyle(c,null).marginRight),e.removeChild(f),g.innerHTML="",b}})}(),o.swap=function(a,b,c,d){var e,f,g={};for(f in b)g[f]=a.style[f],a.style[f]=b[f];e=c.apply(a,d||[]);for(f in b)a.style[f]=g[f];return e};var zb=/^(none|table(?!-c[ea]).+)/,Ab=new RegExp("^("+Q+")(.*)$","i"),Bb=new RegExp("^([+-])=("+Q+")","i"),Cb={position:"absolute",visibility:"hidden",display:"block"},Db={letterSpacing:0,fontWeight:400},Eb=["Webkit","O","Moz","ms"];function Fb(a,b){if(b in a)return b;var c=b[0].toUpperCase()+b.slice(1),d=b,e=Eb.length;while(e--)if(b=Eb[e]+c,b in a)return b;return d}function Gb(a,b,c){var d=Ab.exec(b);return d?Math.max(0,d[1]-(c||0))+(d[2]||"px"):b}function Hb(a,b,c,d,e){for(var f=c===(d?"border":"content")?4:"width"===b?1:0,g=0;4>f;f+=2)"margin"===c&&(g+=o.css(a,c+R[f],!0,e)),d?("content"===c&&(g-=o.css(a,"padding"+R[f],!0,e)),"margin"!==c&&(g-=o.css(a,"border"+R[f]+"Width",!0,e))):(g+=o.css(a,"padding"+R[f],!0,e),"padding"!==c&&(g+=o.css(a,"border"+R[f]+"Width",!0,e)));return g}function Ib(a,b,c){var d=!0,e="width"===b?a.offsetWidth:a.offsetHeight,f=wb(a),g="border-box"===o.css(a,"boxSizing",!1,f);if(0>=e||null==e){if(e=xb(a,b,f),(0>e||null==e)&&(e=a.style[b]),vb.test(e))return e;d=g&&(l.boxSizingReliable()||e===a.style[b]),e=parseFloat(e)||0}return e+Hb(a,b,c||(g?"border":"content"),d,f)+"px"}function Jb(a,b){for(var c,d,e,f=[],g=0,h=a.length;h>g;g++)d=a[g],d.style&&(f[g]=L.get(d,"olddisplay"),c=d.style.display,b?(f[g]||"none"!==c||(d.style.display=""),""===d.style.display&&S(d)&&(f[g]=L.access(d,"olddisplay",tb(d.nodeName)))):f[g]||(e=S(d),(c&&"none"!==c||!e)&&L.set(d,"olddisplay",e?c:o.css(d,"display"))));for(g=0;h>g;g++)d=a[g],d.style&&(b&&"none"!==d.style.display&&""!==d.style.display||(d.style.display=b?f[g]||"":"none"));return a}o.extend({cssHooks:{opacity:{get:function(a,b){if(b){var c=xb(a,"opacity");return""===c?"1":c}}}},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(a,b,c,d){if(a&&3!==a.nodeType&&8!==a.nodeType&&a.style){var e,f,g,h=o.camelCase(b),i=a.style;return b=o.cssProps[h]||(o.cssProps[h]=Fb(i,h)),g=o.cssHooks[b]||o.cssHooks[h],void 0===c?g&&"get"in g&&void 0!==(e=g.get(a,!1,d))?e:i[b]:(f=typeof c,"string"===f&&(e=Bb.exec(c))&&(c=(e[1]+1)*e[2]+parseFloat(o.css(a,b)),f="number"),null!=c&&c===c&&("number"!==f||o.cssNumber[h]||(c+="px"),l.clearCloneStyle||""!==c||0!==b.indexOf("background")||(i[b]="inherit"),g&&"set"in g&&void 0===(c=g.set(a,c,d))||(i[b]="",i[b]=c)),void 0)}},css:function(a,b,c,d){var e,f,g,h=o.camelCase(b);return b=o.cssProps[h]||(o.cssProps[h]=Fb(a.style,h)),g=o.cssHooks[b]||o.cssHooks[h],g&&"get"in g&&(e=g.get(a,!0,c)),void 0===e&&(e=xb(a,b,d)),"normal"===e&&b in Db&&(e=Db[b]),""===c||c?(f=parseFloat(e),c===!0||o.isNumeric(f)?f||0:e):e}}),o.each(["height","width"],function(a,b){o.cssHooks[b]={get:function(a,c,d){return c?0===a.offsetWidth&&zb.test(o.css(a,"display"))?o.swap(a,Cb,function(){return Ib(a,b,d)}):Ib(a,b,d):void 0},set:function(a,c,d){var e=d&&wb(a);return Gb(a,c,d?Hb(a,b,d,"border-box"===o.css(a,"boxSizing",!1,e),e):0)}}}),o.cssHooks.marginRight=yb(l.reliableMarginRight,function(a,b){return b?o.swap(a,{display:"inline-block"},xb,[a,"marginRight"]):void 0}),o.each({margin:"",padding:"",border:"Width"},function(a,b){o.cssHooks[a+b]={expand:function(c){for(var d=0,e={},f="string"==typeof c?c.split(" "):[c];4>d;d++)e[a+R[d]+b]=f[d]||f[d-2]||f[0];return e}},ub.test(a)||(o.cssHooks[a+b].set=Gb)}),o.fn.extend({css:function(a,b){return J(this,function(a,b,c){var d,e,f={},g=0;if(o.isArray(b)){for(d=wb(a),e=b.length;e>g;g++)f[b[g]]=o.css(a,b[g],!1,d);return f}return void 0!==c?o.style(a,b,c):o.css(a,b)},a,b,arguments.length>1)},show:function(){return Jb(this,!0)},hide:function(){return Jb(this)},toggle:function(a){return"boolean"==typeof a?a?this.show():this.hide():this.each(function(){S(this)?o(this).show():o(this).hide()})}});function Kb(a,b,c,d,e){return new Kb.prototype.init(a,b,c,d,e)}o.Tween=Kb,Kb.prototype={constructor:Kb,init:function(a,b,c,d,e,f){this.elem=a,this.prop=c,this.easing=e||"swing",this.options=b,this.start=this.now=this.cur(),this.end=d,this.unit=f||(o.cssNumber[c]?"":"px")},cur:function(){var a=Kb.propHooks[this.prop];return a&&a.get?a.get(this):Kb.propHooks._default.get(this)},run:function(a){var b,c=Kb.propHooks[this.prop];return this.pos=b=this.options.duration?o.easing[this.easing](a,this.options.duration*a,0,1,this.options.duration):a,this.now=(this.end-this.start)*b+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),c&&c.set?c.set(this):Kb.propHooks._default.set(this),this}},Kb.prototype.init.prototype=Kb.prototype,Kb.propHooks={_default:{get:function(a){var b;return null==a.elem[a.prop]||a.elem.style&&null!=a.elem.style[a.prop]?(b=o.css(a.elem,a.prop,""),b&&"auto"!==b?b:0):a.elem[a.prop]},set:function(a){o.fx.step[a.prop]?o.fx.step[a.prop](a):a.elem.style&&(null!=a.elem.style[o.cssProps[a.prop]]||o.cssHooks[a.prop])?o.style(a.elem,a.prop,a.now+a.unit):a.elem[a.prop]=a.now}}},Kb.propHooks.scrollTop=Kb.propHooks.scrollLeft={set:function(a){a.elem.nodeType&&a.elem.parentNode&&(a.elem[a.prop]=a.now)}},o.easing={linear:function(a){return a},swing:function(a){return.5-Math.cos(a*Math.PI)/2}},o.fx=Kb.prototype.init,o.fx.step={};var Lb,Mb,Nb=/^(?:toggle|show|hide)$/,Ob=new RegExp("^(?:([+-])=|)("+Q+")([a-z%]*)$","i"),Pb=/queueHooks$/,Qb=[Vb],Rb={"*":[function(a,b){var c=this.createTween(a,b),d=c.cur(),e=Ob.exec(b),f=e&&e[3]||(o.cssNumber[a]?"":"px"),g=(o.cssNumber[a]||"px"!==f&&+d)&&Ob.exec(o.css(c.elem,a)),h=1,i=20;if(g&&g[3]!==f){f=f||g[3],e=e||[],g=+d||1;do h=h||".5",g/=h,o.style(c.elem,a,g+f);while(h!==(h=c.cur()/d)&&1!==h&&--i)}return e&&(g=c.start=+g||+d||0,c.unit=f,c.end=e[1]?g+(e[1]+1)*e[2]:+e[2]),c}]};function Sb(){return setTimeout(function(){Lb=void 0}),Lb=o.now()}function Tb(a,b){var c,d=0,e={height:a};for(b=b?1:0;4>d;d+=2-b)c=R[d],e["margin"+c]=e["padding"+c]=a;return b&&(e.opacity=e.width=a),e}function Ub(a,b,c){for(var d,e=(Rb[b]||[]).concat(Rb["*"]),f=0,g=e.length;g>f;f++)if(d=e[f].call(c,b,a))return d}function Vb(a,b,c){var d,e,f,g,h,i,j,k=this,l={},m=a.style,n=a.nodeType&&S(a),p=L.get(a,"fxshow");c.queue||(h=o._queueHooks(a,"fx"),null==h.unqueued&&(h.unqueued=0,i=h.empty.fire,h.empty.fire=function(){h.unqueued||i()}),h.unqueued++,k.always(function(){k.always(function(){h.unqueued--,o.queue(a,"fx").length||h.empty.fire()})})),1===a.nodeType&&("height"in b||"width"in b)&&(c.overflow=[m.overflow,m.overflowX,m.overflowY],j=o.css(a,"display"),"none"===j&&(j=tb(a.nodeName)),"inline"===j&&"none"===o.css(a,"float")&&(m.display="inline-block")),c.overflow&&(m.overflow="hidden",k.always(function(){m.overflow=c.overflow[0],m.overflowX=c.overflow[1],m.overflowY=c.overflow[2]}));for(d in b)if(e=b[d],Nb.exec(e)){if(delete b[d],f=f||"toggle"===e,e===(n?"hide":"show")){if("show"!==e||!p||void 0===p[d])continue;n=!0}l[d]=p&&p[d]||o.style(a,d)}if(!o.isEmptyObject(l)){p?"hidden"in p&&(n=p.hidden):p=L.access(a,"fxshow",{}),f&&(p.hidden=!n),n?o(a).show():k.done(function(){o(a).hide()}),k.done(function(){var b;L.remove(a,"fxshow");for(b in l)o.style(a,b,l[b])});for(d in l)g=Ub(n?p[d]:0,d,k),d in p||(p[d]=g.start,n&&(g.end=g.start,g.start="width"===d||"height"===d?1:0))}}function Wb(a,b){var c,d,e,f,g;for(c in a)if(d=o.camelCase(c),e=b[d],f=a[c],o.isArray(f)&&(e=f[1],f=a[c]=f[0]),c!==d&&(a[d]=f,delete a[c]),g=o.cssHooks[d],g&&"expand"in g){f=g.expand(f),delete a[d];for(c in f)c in a||(a[c]=f[c],b[c]=e)}else b[d]=e}function Xb(a,b,c){var d,e,f=0,g=Qb.length,h=o.Deferred().always(function(){delete i.elem}),i=function(){if(e)return!1;for(var b=Lb||Sb(),c=Math.max(0,j.startTime+j.duration-b),d=c/j.duration||0,f=1-d,g=0,i=j.tweens.length;i>g;g++)j.tweens[g].run(f);return h.notifyWith(a,[j,f,c]),1>f&&i?c:(h.resolveWith(a,[j]),!1)},j=h.promise({elem:a,props:o.extend({},b),opts:o.extend(!0,{specialEasing:{}},c),originalProperties:b,originalOptions:c,startTime:Lb||Sb(),duration:c.duration,tweens:[],createTween:function(b,c){var d=o.Tween(a,j.opts,b,c,j.opts.specialEasing[b]||j.opts.easing);return j.tweens.push(d),d},stop:function(b){var c=0,d=b?j.tweens.length:0;if(e)return this;for(e=!0;d>c;c++)j.tweens[c].run(1);return b?h.resolveWith(a,[j,b]):h.rejectWith(a,[j,b]),this}}),k=j.props;for(Wb(k,j.opts.specialEasing);g>f;f++)if(d=Qb[f].call(j,a,k,j.opts))return d;return o.map(k,Ub,j),o.isFunction(j.opts.start)&&j.opts.start.call(a,j),o.fx.timer(o.extend(i,{elem:a,anim:j,queue:j.opts.queue})),j.progress(j.opts.progress).done(j.opts.done,j.opts.complete).fail(j.opts.fail).always(j.opts.always)}o.Animation=o.extend(Xb,{tweener:function(a,b){o.isFunction(a)?(b=a,a=["*"]):a=a.split(" ");for(var c,d=0,e=a.length;e>d;d++)c=a[d],Rb[c]=Rb[c]||[],Rb[c].unshift(b)},prefilter:function(a,b){b?Qb.unshift(a):Qb.push(a)}}),o.speed=function(a,b,c){var d=a&&"object"==typeof a?o.extend({},a):{complete:c||!c&&b||o.isFunction(a)&&a,duration:a,easing:c&&b||b&&!o.isFunction(b)&&b};return d.duration=o.fx.off?0:"number"==typeof d.duration?d.duration:d.duration in o.fx.speeds?o.fx.speeds[d.duration]:o.fx.speeds._default,(null==d.queue||d.queue===!0)&&(d.queue="fx"),d.old=d.complete,d.complete=function(){o.isFunction(d.old)&&d.old.call(this),d.queue&&o.dequeue(this,d.queue)},d},o.fn.extend({fadeTo:function(a,b,c,d){return this.filter(S).css("opacity",0).show().end().animate({opacity:b},a,c,d)},animate:function(a,b,c,d){var e=o.isEmptyObject(a),f=o.speed(b,c,d),g=function(){var b=Xb(this,o.extend({},a),f);(e||L.get(this,"finish"))&&b.stop(!0)};return g.finish=g,e||f.queue===!1?this.each(g):this.queue(f.queue,g)},stop:function(a,b,c){var d=function(a){var b=a.stop;delete a.stop,b(c)};return"string"!=typeof a&&(c=b,b=a,a=void 0),b&&a!==!1&&this.queue(a||"fx",[]),this.each(function(){var b=!0,e=null!=a&&a+"queueHooks",f=o.timers,g=L.get(this);if(e)g[e]&&g[e].stop&&d(g[e]);else for(e in g)g[e]&&g[e].stop&&Pb.test(e)&&d(g[e]);for(e=f.length;e--;)f[e].elem!==this||null!=a&&f[e].queue!==a||(f[e].anim.stop(c),b=!1,f.splice(e,1));(b||!c)&&o.dequeue(this,a)})},finish:function(a){return a!==!1&&(a=a||"fx"),this.each(function(){var b,c=L.get(this),d=c[a+"queue"],e=c[a+"queueHooks"],f=o.timers,g=d?d.length:0;for(c.finish=!0,o.queue(this,a,[]),e&&e.stop&&e.stop.call(this,!0),b=f.length;b--;)f[b].elem===this&&f[b].queue===a&&(f[b].anim.stop(!0),f.splice(b,1));for(b=0;g>b;b++)d[b]&&d[b].finish&&d[b].finish.call(this);delete c.finish})}}),o.each(["toggle","show","hide"],function(a,b){var c=o.fn[b];o.fn[b]=function(a,d,e){return null==a||"boolean"==typeof a?c.apply(this,arguments):this.animate(Tb(b,!0),a,d,e)}}),o.each({slideDown:Tb("show"),slideUp:Tb("hide"),slideToggle:Tb("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(a,b){o.fn[a]=function(a,c,d){return this.animate(b,a,c,d)}}),o.timers=[],o.fx.tick=function(){var a,b=0,c=o.timers;for(Lb=o.now();b<c.length;b++)a=c[b],a()||c[b]!==a||c.splice(b--,1);c.length||o.fx.stop(),Lb=void 0},o.fx.timer=function(a){o.timers.push(a),a()?o.fx.start():o.timers.pop()},o.fx.interval=13,o.fx.start=function(){Mb||(Mb=setInterval(o.fx.tick,o.fx.interval))},o.fx.stop=function(){clearInterval(Mb),Mb=null},o.fx.speeds={slow:600,fast:200,_default:400},o.fn.delay=function(a,b){return a=o.fx?o.fx.speeds[a]||a:a,b=b||"fx",this.queue(b,function(b,c){var d=setTimeout(b,a);c.stop=function(){clearTimeout(d)}})},function(){var a=m.createElement("input"),b=m.createElement("select"),c=b.appendChild(m.createElement("option"));a.type="checkbox",l.checkOn=""!==a.value,l.optSelected=c.selected,b.disabled=!0,l.optDisabled=!c.disabled,a=m.createElement("input"),a.value="t",a.type="radio",l.radioValue="t"===a.value}();var Yb,Zb,$b=o.expr.attrHandle;o.fn.extend({attr:function(a,b){return J(this,o.attr,a,b,arguments.length>1)},removeAttr:function(a){return this.each(function(){o.removeAttr(this,a)})}}),o.extend({attr:function(a,b,c){var d,e,f=a.nodeType;if(a&&3!==f&&8!==f&&2!==f)return typeof a.getAttribute===U?o.prop(a,b,c):(1===f&&o.isXMLDoc(a)||(b=b.toLowerCase(),d=o.attrHooks[b]||(o.expr.match.bool.test(b)?Zb:Yb)),void 0===c?d&&"get"in d&&null!==(e=d.get(a,b))?e:(e=o.find.attr(a,b),null==e?void 0:e):null!==c?d&&"set"in d&&void 0!==(e=d.set(a,c,b))?e:(a.setAttribute(b,c+""),c):void o.removeAttr(a,b))},removeAttr:function(a,b){var c,d,e=0,f=b&&b.match(E);if(f&&1===a.nodeType)while(c=f[e++])d=o.propFix[c]||c,o.expr.match.bool.test(c)&&(a[d]=!1),a.removeAttribute(c)},attrHooks:{type:{set:function(a,b){if(!l.radioValue&&"radio"===b&&o.nodeName(a,"input")){var c=a.value;return a.setAttribute("type",b),c&&(a.value=c),b}}}}}),Zb={set:function(a,b,c){return b===!1?o.removeAttr(a,c):a.setAttribute(c,c),c}},o.each(o.expr.match.bool.source.match(/\w+/g),function(a,b){var c=$b[b]||o.find.attr;$b[b]=function(a,b,d){var e,f;
+return d||(f=$b[b],$b[b]=e,e=null!=c(a,b,d)?b.toLowerCase():null,$b[b]=f),e}});var _b=/^(?:input|select|textarea|button)$/i;o.fn.extend({prop:function(a,b){return J(this,o.prop,a,b,arguments.length>1)},removeProp:function(a){return this.each(function(){delete this[o.propFix[a]||a]})}}),o.extend({propFix:{"for":"htmlFor","class":"className"},prop:function(a,b,c){var d,e,f,g=a.nodeType;if(a&&3!==g&&8!==g&&2!==g)return f=1!==g||!o.isXMLDoc(a),f&&(b=o.propFix[b]||b,e=o.propHooks[b]),void 0!==c?e&&"set"in e&&void 0!==(d=e.set(a,c,b))?d:a[b]=c:e&&"get"in e&&null!==(d=e.get(a,b))?d:a[b]},propHooks:{tabIndex:{get:function(a){return a.hasAttribute("tabindex")||_b.test(a.nodeName)||a.href?a.tabIndex:-1}}}}),l.optSelected||(o.propHooks.selected={get:function(a){var b=a.parentNode;return b&&b.parentNode&&b.parentNode.selectedIndex,null}}),o.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){o.propFix[this.toLowerCase()]=this});var ac=/[\t\r\n\f]/g;o.fn.extend({addClass:function(a){var b,c,d,e,f,g,h="string"==typeof a&&a,i=0,j=this.length;if(o.isFunction(a))return this.each(function(b){o(this).addClass(a.call(this,b,this.className))});if(h)for(b=(a||"").match(E)||[];j>i;i++)if(c=this[i],d=1===c.nodeType&&(c.className?(" "+c.className+" ").replace(ac," "):" ")){f=0;while(e=b[f++])d.indexOf(" "+e+" ")<0&&(d+=e+" ");g=o.trim(d),c.className!==g&&(c.className=g)}return this},removeClass:function(a){var b,c,d,e,f,g,h=0===arguments.length||"string"==typeof a&&a,i=0,j=this.length;if(o.isFunction(a))return this.each(function(b){o(this).removeClass(a.call(this,b,this.className))});if(h)for(b=(a||"").match(E)||[];j>i;i++)if(c=this[i],d=1===c.nodeType&&(c.className?(" "+c.className+" ").replace(ac," "):"")){f=0;while(e=b[f++])while(d.indexOf(" "+e+" ")>=0)d=d.replace(" "+e+" "," ");g=a?o.trim(d):"",c.className!==g&&(c.className=g)}return this},toggleClass:function(a,b){var c=typeof a;return"boolean"==typeof b&&"string"===c?b?this.addClass(a):this.removeClass(a):this.each(o.isFunction(a)?function(c){o(this).toggleClass(a.call(this,c,this.className,b),b)}:function(){if("string"===c){var b,d=0,e=o(this),f=a.match(E)||[];while(b=f[d++])e.hasClass(b)?e.removeClass(b):e.addClass(b)}else(c===U||"boolean"===c)&&(this.className&&L.set(this,"__className__",this.className),this.className=this.className||a===!1?"":L.get(this,"__className__")||"")})},hasClass:function(a){for(var b=" "+a+" ",c=0,d=this.length;d>c;c++)if(1===this[c].nodeType&&(" "+this[c].className+" ").replace(ac," ").indexOf(b)>=0)return!0;return!1}});var bc=/\r/g;o.fn.extend({val:function(a){var b,c,d,e=this[0];{if(arguments.length)return d=o.isFunction(a),this.each(function(c){var e;1===this.nodeType&&(e=d?a.call(this,c,o(this).val()):a,null==e?e="":"number"==typeof e?e+="":o.isArray(e)&&(e=o.map(e,function(a){return null==a?"":a+""})),b=o.valHooks[this.type]||o.valHooks[this.nodeName.toLowerCase()],b&&"set"in b&&void 0!==b.set(this,e,"value")||(this.value=e))});if(e)return b=o.valHooks[e.type]||o.valHooks[e.nodeName.toLowerCase()],b&&"get"in b&&void 0!==(c=b.get(e,"value"))?c:(c=e.value,"string"==typeof c?c.replace(bc,""):null==c?"":c)}}}),o.extend({valHooks:{select:{get:function(a){for(var b,c,d=a.options,e=a.selectedIndex,f="select-one"===a.type||0>e,g=f?null:[],h=f?e+1:d.length,i=0>e?h:f?e:0;h>i;i++)if(c=d[i],!(!c.selected&&i!==e||(l.optDisabled?c.disabled:null!==c.getAttribute("disabled"))||c.parentNode.disabled&&o.nodeName(c.parentNode,"optgroup"))){if(b=o(c).val(),f)return b;g.push(b)}return g},set:function(a,b){var c,d,e=a.options,f=o.makeArray(b),g=e.length;while(g--)d=e[g],(d.selected=o.inArray(o(d).val(),f)>=0)&&(c=!0);return c||(a.selectedIndex=-1),f}}}}),o.each(["radio","checkbox"],function(){o.valHooks[this]={set:function(a,b){return o.isArray(b)?a.checked=o.inArray(o(a).val(),b)>=0:void 0}},l.checkOn||(o.valHooks[this].get=function(a){return null===a.getAttribute("value")?"on":a.value})}),o.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error contextmenu".split(" "),function(a,b){o.fn[b]=function(a,c){return arguments.length>0?this.on(b,null,a,c):this.trigger(b)}}),o.fn.extend({hover:function(a,b){return this.mouseenter(a).mouseleave(b||a)},bind:function(a,b,c){return this.on(a,null,b,c)},unbind:function(a,b){return this.off(a,null,b)},delegate:function(a,b,c,d){return this.on(b,a,c,d)},undelegate:function(a,b,c){return 1===arguments.length?this.off(a,"**"):this.off(b,a||"**",c)}});var cc=o.now(),dc=/\?/;o.parseJSON=function(a){return JSON.parse(a+"")},o.parseXML=function(a){var b,c;if(!a||"string"!=typeof a)return null;try{c=new DOMParser,b=c.parseFromString(a,"text/xml")}catch(d){b=void 0}return(!b||b.getElementsByTagName("parsererror").length)&&o.error("Invalid XML: "+a),b};var ec,fc,gc=/#.*$/,hc=/([?&])_=[^&]*/,ic=/^(.*?):[ \t]*([^\r\n]*)$/gm,jc=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,kc=/^(?:GET|HEAD)$/,lc=/^\/\//,mc=/^([\w.+-]+:)(?:\/\/(?:[^\/?#]*@|)([^\/?#:]*)(?::(\d+)|)|)/,nc={},oc={},pc="*/".concat("*");try{fc=location.href}catch(qc){fc=m.createElement("a"),fc.href="",fc=fc.href}ec=mc.exec(fc.toLowerCase())||[];function rc(a){return function(b,c){"string"!=typeof b&&(c=b,b="*");var d,e=0,f=b.toLowerCase().match(E)||[];if(o.isFunction(c))while(d=f[e++])"+"===d[0]?(d=d.slice(1)||"*",(a[d]=a[d]||[]).unshift(c)):(a[d]=a[d]||[]).push(c)}}function sc(a,b,c,d){var e={},f=a===oc;function g(h){var i;return e[h]=!0,o.each(a[h]||[],function(a,h){var j=h(b,c,d);return"string"!=typeof j||f||e[j]?f?!(i=j):void 0:(b.dataTypes.unshift(j),g(j),!1)}),i}return g(b.dataTypes[0])||!e["*"]&&g("*")}function tc(a,b){var c,d,e=o.ajaxSettings.flatOptions||{};for(c in b)void 0!==b[c]&&((e[c]?a:d||(d={}))[c]=b[c]);return d&&o.extend(!0,a,d),a}function uc(a,b,c){var d,e,f,g,h=a.contents,i=a.dataTypes;while("*"===i[0])i.shift(),void 0===d&&(d=a.mimeType||b.getResponseHeader("Content-Type"));if(d)for(e in h)if(h[e]&&h[e].test(d)){i.unshift(e);break}if(i[0]in c)f=i[0];else{for(e in c){if(!i[0]||a.converters[e+" "+i[0]]){f=e;break}g||(g=e)}f=f||g}return f?(f!==i[0]&&i.unshift(f),c[f]):void 0}function vc(a,b,c,d){var e,f,g,h,i,j={},k=a.dataTypes.slice();if(k[1])for(g in a.converters)j[g.toLowerCase()]=a.converters[g];f=k.shift();while(f)if(a.responseFields[f]&&(c[a.responseFields[f]]=b),!i&&d&&a.dataFilter&&(b=a.dataFilter(b,a.dataType)),i=f,f=k.shift())if("*"===f)f=i;else if("*"!==i&&i!==f){if(g=j[i+" "+f]||j["* "+f],!g)for(e in j)if(h=e.split(" "),h[1]===f&&(g=j[i+" "+h[0]]||j["* "+h[0]])){g===!0?g=j[e]:j[e]!==!0&&(f=h[0],k.unshift(h[1]));break}if(g!==!0)if(g&&a["throws"])b=g(b);else try{b=g(b)}catch(l){return{state:"parsererror",error:g?l:"No conversion from "+i+" to "+f}}}return{state:"success",data:b}}o.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:fc,type:"GET",isLocal:jc.test(ec[1]),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":pc,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":o.parseJSON,"text xml":o.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(a,b){return b?tc(tc(a,o.ajaxSettings),b):tc(o.ajaxSettings,a)},ajaxPrefilter:rc(nc),ajaxTransport:rc(oc),ajax:function(a,b){"object"==typeof a&&(b=a,a=void 0),b=b||{};var c,d,e,f,g,h,i,j,k=o.ajaxSetup({},b),l=k.context||k,m=k.context&&(l.nodeType||l.jquery)?o(l):o.event,n=o.Deferred(),p=o.Callbacks("once memory"),q=k.statusCode||{},r={},s={},t=0,u="canceled",v={readyState:0,getResponseHeader:function(a){var b;if(2===t){if(!f){f={};while(b=ic.exec(e))f[b[1].toLowerCase()]=b[2]}b=f[a.toLowerCase()]}return null==b?null:b},getAllResponseHeaders:function(){return 2===t?e:null},setRequestHeader:function(a,b){var c=a.toLowerCase();return t||(a=s[c]=s[c]||a,r[a]=b),this},overrideMimeType:function(a){return t||(k.mimeType=a),this},statusCode:function(a){var b;if(a)if(2>t)for(b in a)q[b]=[q[b],a[b]];else v.always(a[v.status]);return this},abort:function(a){var b=a||u;return c&&c.abort(b),x(0,b),this}};if(n.promise(v).complete=p.add,v.success=v.done,v.error=v.fail,k.url=((a||k.url||fc)+"").replace(gc,"").replace(lc,ec[1]+"//"),k.type=b.method||b.type||k.method||k.type,k.dataTypes=o.trim(k.dataType||"*").toLowerCase().match(E)||[""],null==k.crossDomain&&(h=mc.exec(k.url.toLowerCase()),k.crossDomain=!(!h||h[1]===ec[1]&&h[2]===ec[2]&&(h[3]||("http:"===h[1]?"80":"443"))===(ec[3]||("http:"===ec[1]?"80":"443")))),k.data&&k.processData&&"string"!=typeof k.data&&(k.data=o.param(k.data,k.traditional)),sc(nc,k,b,v),2===t)return v;i=k.global,i&&0===o.active++&&o.event.trigger("ajaxStart"),k.type=k.type.toUpperCase(),k.hasContent=!kc.test(k.type),d=k.url,k.hasContent||(k.data&&(d=k.url+=(dc.test(d)?"&":"?")+k.data,delete k.data),k.cache===!1&&(k.url=hc.test(d)?d.replace(hc,"$1_="+cc++):d+(dc.test(d)?"&":"?")+"_="+cc++)),k.ifModified&&(o.lastModified[d]&&v.setRequestHeader("If-Modified-Since",o.lastModified[d]),o.etag[d]&&v.setRequestHeader("If-None-Match",o.etag[d])),(k.data&&k.hasContent&&k.contentType!==!1||b.contentType)&&v.setRequestHeader("Content-Type",k.contentType),v.setRequestHeader("Accept",k.dataTypes[0]&&k.accepts[k.dataTypes[0]]?k.accepts[k.dataTypes[0]]+("*"!==k.dataTypes[0]?", "+pc+"; q=0.01":""):k.accepts["*"]);for(j in k.headers)v.setRequestHeader(j,k.headers[j]);if(k.beforeSend&&(k.beforeSend.call(l,v,k)===!1||2===t))return v.abort();u="abort";for(j in{success:1,error:1,complete:1})v[j](k[j]);if(c=sc(oc,k,b,v)){v.readyState=1,i&&m.trigger("ajaxSend",[v,k]),k.async&&k.timeout>0&&(g=setTimeout(function(){v.abort("timeout")},k.timeout));try{t=1,c.send(r,x)}catch(w){if(!(2>t))throw w;x(-1,w)}}else x(-1,"No Transport");function x(a,b,f,h){var j,r,s,u,w,x=b;2!==t&&(t=2,g&&clearTimeout(g),c=void 0,e=h||"",v.readyState=a>0?4:0,j=a>=200&&300>a||304===a,f&&(u=uc(k,v,f)),u=vc(k,u,v,j),j?(k.ifModified&&(w=v.getResponseHeader("Last-Modified"),w&&(o.lastModified[d]=w),w=v.getResponseHeader("etag"),w&&(o.etag[d]=w)),204===a||"HEAD"===k.type?x="nocontent":304===a?x="notmodified":(x=u.state,r=u.data,s=u.error,j=!s)):(s=x,(a||!x)&&(x="error",0>a&&(a=0))),v.status=a,v.statusText=(b||x)+"",j?n.resolveWith(l,[r,x,v]):n.rejectWith(l,[v,x,s]),v.statusCode(q),q=void 0,i&&m.trigger(j?"ajaxSuccess":"ajaxError",[v,k,j?r:s]),p.fireWith(l,[v,x]),i&&(m.trigger("ajaxComplete",[v,k]),--o.active||o.event.trigger("ajaxStop")))}return v},getJSON:function(a,b,c){return o.get(a,b,c,"json")},getScript:function(a,b){return o.get(a,void 0,b,"script")}}),o.each(["get","post"],function(a,b){o[b]=function(a,c,d,e){return o.isFunction(c)&&(e=e||d,d=c,c=void 0),o.ajax({url:a,type:b,dataType:e,data:c,success:d})}}),o.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(a,b){o.fn[b]=function(a){return this.on(b,a)}}),o._evalUrl=function(a){return o.ajax({url:a,type:"GET",dataType:"script",async:!1,global:!1,"throws":!0})},o.fn.extend({wrapAll:function(a){var b;return o.isFunction(a)?this.each(function(b){o(this).wrapAll(a.call(this,b))}):(this[0]&&(b=o(a,this[0].ownerDocument).eq(0).clone(!0),this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstElementChild)a=a.firstElementChild;return a}).append(this)),this)},wrapInner:function(a){return this.each(o.isFunction(a)?function(b){o(this).wrapInner(a.call(this,b))}:function(){var b=o(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){var b=o.isFunction(a);return this.each(function(c){o(this).wrapAll(b?a.call(this,c):a)})},unwrap:function(){return this.parent().each(function(){o.nodeName(this,"body")||o(this).replaceWith(this.childNodes)}).end()}}),o.expr.filters.hidden=function(a){return a.offsetWidth<=0&&a.offsetHeight<=0},o.expr.filters.visible=function(a){return!o.expr.filters.hidden(a)};var wc=/%20/g,xc=/\[\]$/,yc=/\r?\n/g,zc=/^(?:submit|button|image|reset|file)$/i,Ac=/^(?:input|select|textarea|keygen)/i;function Bc(a,b,c,d){var e;if(o.isArray(b))o.each(b,function(b,e){c||xc.test(a)?d(a,e):Bc(a+"["+("object"==typeof e?b:"")+"]",e,c,d)});else if(c||"object"!==o.type(b))d(a,b);else for(e in b)Bc(a+"["+e+"]",b[e],c,d)}o.param=function(a,b){var c,d=[],e=function(a,b){b=o.isFunction(b)?b():null==b?"":b,d[d.length]=encodeURIComponent(a)+"="+encodeURIComponent(b)};if(void 0===b&&(b=o.ajaxSettings&&o.ajaxSettings.traditional),o.isArray(a)||a.jquery&&!o.isPlainObject(a))o.each(a,function(){e(this.name,this.value)});else for(c in a)Bc(c,a[c],b,e);return d.join("&").replace(wc,"+")},o.fn.extend({serialize:function(){return o.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var a=o.prop(this,"elements");return a?o.makeArray(a):this}).filter(function(){var a=this.type;return this.name&&!o(this).is(":disabled")&&Ac.test(this.nodeName)&&!zc.test(a)&&(this.checked||!T.test(a))}).map(function(a,b){var c=o(this).val();return null==c?null:o.isArray(c)?o.map(c,function(a){return{name:b.name,value:a.replace(yc,"\r\n")}}):{name:b.name,value:c.replace(yc,"\r\n")}}).get()}}),o.ajaxSettings.xhr=function(){try{return new XMLHttpRequest}catch(a){}};var Cc=0,Dc={},Ec={0:200,1223:204},Fc=o.ajaxSettings.xhr();a.ActiveXObject&&o(a).on("unload",function(){for(var a in Dc)Dc[a]()}),l.cors=!!Fc&&"withCredentials"in Fc,l.ajax=Fc=!!Fc,o.ajaxTransport(function(a){var b;return l.cors||Fc&&!a.crossDomain?{send:function(c,d){var e,f=a.xhr(),g=++Cc;if(f.open(a.type,a.url,a.async,a.username,a.password),a.xhrFields)for(e in a.xhrFields)f[e]=a.xhrFields[e];a.mimeType&&f.overrideMimeType&&f.overrideMimeType(a.mimeType),a.crossDomain||c["X-Requested-With"]||(c["X-Requested-With"]="XMLHttpRequest");for(e in c)f.setRequestHeader(e,c[e]);b=function(a){return function(){b&&(delete Dc[g],b=f.onload=f.onerror=null,"abort"===a?f.abort():"error"===a?d(f.status,f.statusText):d(Ec[f.status]||f.status,f.statusText,"string"==typeof f.responseText?{text:f.responseText}:void 0,f.getAllResponseHeaders()))}},f.onload=b(),f.onerror=b("error"),b=Dc[g]=b("abort"),f.send(a.hasContent&&a.data||null)},abort:function(){b&&b()}}:void 0}),o.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/(?:java|ecma)script/},converters:{"text script":function(a){return o.globalEval(a),a}}}),o.ajaxPrefilter("script",function(a){void 0===a.cache&&(a.cache=!1),a.crossDomain&&(a.type="GET")}),o.ajaxTransport("script",function(a){if(a.crossDomain){var b,c;return{send:function(d,e){b=o("<script>").prop({async:!0,charset:a.scriptCharset,src:a.url}).on("load error",c=function(a){b.remove(),c=null,a&&e("error"===a.type?404:200,a.type)}),m.head.appendChild(b[0])},abort:function(){c&&c()}}}});var Gc=[],Hc=/(=)\?(?=&|$)|\?\?/;o.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var a=Gc.pop()||o.expando+"_"+cc++;return this[a]=!0,a}}),o.ajaxPrefilter("json jsonp",function(b,c,d){var e,f,g,h=b.jsonp!==!1&&(Hc.test(b.url)?"url":"string"==typeof b.data&&!(b.contentType||"").indexOf("application/x-www-form-urlencoded")&&Hc.test(b.data)&&"data");return h||"jsonp"===b.dataTypes[0]?(e=b.jsonpCallback=o.isFunction(b.jsonpCallback)?b.jsonpCallback():b.jsonpCallback,h?b[h]=b[h].replace(Hc,"$1"+e):b.jsonp!==!1&&(b.url+=(dc.test(b.url)?"&":"?")+b.jsonp+"="+e),b.converters["script json"]=function(){return g||o.error(e+" was not called"),g[0]},b.dataTypes[0]="json",f=a[e],a[e]=function(){g=arguments},d.always(function(){a[e]=f,b[e]&&(b.jsonpCallback=c.jsonpCallback,Gc.push(e)),g&&o.isFunction(f)&&f(g[0]),g=f=void 0}),"script"):void 0}),o.parseHTML=function(a,b,c){if(!a||"string"!=typeof a)return null;"boolean"==typeof b&&(c=b,b=!1),b=b||m;var d=v.exec(a),e=!c&&[];return d?[b.createElement(d[1])]:(d=o.buildFragment([a],b,e),e&&e.length&&o(e).remove(),o.merge([],d.childNodes))};var Ic=o.fn.load;o.fn.load=function(a,b,c){if("string"!=typeof a&&Ic)return Ic.apply(this,arguments);var d,e,f,g=this,h=a.indexOf(" ");return h>=0&&(d=a.slice(h),a=a.slice(0,h)),o.isFunction(b)?(c=b,b=void 0):b&&"object"==typeof b&&(e="POST"),g.length>0&&o.ajax({url:a,type:e,dataType:"html",data:b}).done(function(a){f=arguments,g.html(d?o("<div>").append(o.parseHTML(a)).find(d):a)}).complete(c&&function(a,b){g.each(c,f||[a.responseText,b,a])}),this},o.expr.filters.animated=function(a){return o.grep(o.timers,function(b){return a===b.elem}).length};var Jc=a.document.documentElement;function Kc(a){return o.isWindow(a)?a:9===a.nodeType&&a.defaultView}o.offset={setOffset:function(a,b,c){var d,e,f,g,h,i,j,k=o.css(a,"position"),l=o(a),m={};"static"===k&&(a.style.position="relative"),h=l.offset(),f=o.css(a,"top"),i=o.css(a,"left"),j=("absolute"===k||"fixed"===k)&&(f+i).indexOf("auto")>-1,j?(d=l.position(),g=d.top,e=d.left):(g=parseFloat(f)||0,e=parseFloat(i)||0),o.isFunction(b)&&(b=b.call(a,c,h)),null!=b.top&&(m.top=b.top-h.top+g),null!=b.left&&(m.left=b.left-h.left+e),"using"in b?b.using.call(a,m):l.css(m)}},o.fn.extend({offset:function(a){if(arguments.length)return void 0===a?this:this.each(function(b){o.offset.setOffset(this,a,b)});var b,c,d=this[0],e={top:0,left:0},f=d&&d.ownerDocument;if(f)return b=f.documentElement,o.contains(b,d)?(typeof d.getBoundingClientRect!==U&&(e=d.getBoundingClientRect()),c=Kc(f),{top:e.top+c.pageYOffset-b.clientTop,left:e.left+c.pageXOffset-b.clientLeft}):e},position:function(){if(this[0]){var a,b,c=this[0],d={top:0,left:0};return"fixed"===o.css(c,"position")?b=c.getBoundingClientRect():(a=this.offsetParent(),b=this.offset(),o.nodeName(a[0],"html")||(d=a.offset()),d.top+=o.css(a[0],"borderTopWidth",!0),d.left+=o.css(a[0],"borderLeftWidth",!0)),{top:b.top-d.top-o.css(c,"marginTop",!0),left:b.left-d.left-o.css(c,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){var a=this.offsetParent||Jc;while(a&&!o.nodeName(a,"html")&&"static"===o.css(a,"position"))a=a.offsetParent;return a||Jc})}}),o.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(b,c){var d="pageYOffset"===c;o.fn[b]=function(e){return J(this,function(b,e,f){var g=Kc(b);return void 0===f?g?g[c]:b[e]:void(g?g.scrollTo(d?a.pageXOffset:f,d?f:a.pageYOffset):b[e]=f)},b,e,arguments.length,null)}}),o.each(["top","left"],function(a,b){o.cssHooks[b]=yb(l.pixelPosition,function(a,c){return c?(c=xb(a,b),vb.test(c)?o(a).position()[b]+"px":c):void 0})}),o.each({Height:"height",Width:"width"},function(a,b){o.each({padding:"inner"+a,content:b,"":"outer"+a},function(c,d){o.fn[d]=function(d,e){var f=arguments.length&&(c||"boolean"!=typeof d),g=c||(d===!0||e===!0?"margin":"border");return J(this,function(b,c,d){var e;return o.isWindow(b)?b.document.documentElement["client"+a]:9===b.nodeType?(e=b.documentElement,Math.max(b.body["scroll"+a],e["scroll"+a],b.body["offset"+a],e["offset"+a],e["client"+a])):void 0===d?o.css(b,c,g):o.style(b,c,d,g)},b,f?d:void 0,f,null)}})}),o.fn.size=function(){return this.length},o.fn.andSelf=o.fn.addBack,"function"==typeof define&&define.amd&&define("jquery",[],function(){return o});var Lc=a.jQuery,Mc=a.$;return o.noConflict=function(b){return a.$===o&&(a.$=Mc),b&&a.jQuery===o&&(a.jQuery=Lc),o},typeof b===U&&(a.jQuery=a.$=o),o});
diff --git a/public/scripts/main.js b/p/scripts/main.js
index 88d46b2f9..f0d2bbf7b 100644
--- a/public/scripts/main.js
+++ b/p/scripts/main.js
@@ -1,5 +1,6 @@
"use strict";
-var $stream = null;
+var $stream = null,
+ isCollapsed = true;
function is_normal_mode() {
return $stream.hasClass('normal');
@@ -19,13 +20,84 @@ function redirect(url, new_tab) {
}
}
+function str2int(str) {
+ if (str == '') {
+ return 0;
+ }
+ return parseInt(str.replace(/\D/g, ''), 10) || 0;
+}
+
+function numberFormat(nStr) {
+ if (nStr < 0) {
+ return 0;
+ }
+ // http://www.mredkj.com/javascript/numberFormat.html
+ nStr += '';
+ var x = nStr.split('.'),
+ x1 = x[0],
+ x2 = x.length > 1 ? '.' + x[1] : '',
+ rgx = /(\d+)(\d{3})/;
+ while (rgx.test(x1)) {
+ x1 = x1.replace(rgx, '$1' + ' ' + '$2');
+ }
+ return x1 + x2;
+}
+
function incLabel(p, inc) {
- var i = (parseInt(p.replace(/\D/g, ''), 10) || 0) + inc;
- return i > 0 ? ' (' + i + ')' : '';
+ var i = str2int(p) + inc;
+ return i > 0 ? ' (' + numberFormat(i) + ')' : '';
+}
+
+function incUnreadsFeed(article, feed_id, nb) {
+ //Update unread: feed
+ var elem = $('#' + feed_id + '>.feed').get(0),
+ feed_unreads = elem ? str2int(elem.getAttribute('data-unread')) : 0,
+ feed_priority = elem ? str2int(elem.getAttribute('data-priority')) : 0;
+ if (elem) {
+ elem.setAttribute('data-unread', numberFormat(feed_unreads + nb));
+ }
+
+ //Update unread: category
+ elem = $('#' + feed_id).parent().prevAll('.category').children(':first').get(0);
+ feed_unreads = elem ? str2int(elem.getAttribute('data-unread')) : 0;
+ if (elem) {
+ elem.setAttribute('data-unread', numberFormat(feed_unreads + nb));
+ }
+
+ //Update unread: all
+ if (feed_priority > 0) {
+ elem = $('#aside_flux .all').children(':first').get(0);
+ if (elem) {
+ feed_unreads = elem ? str2int(elem.getAttribute('data-unread')) : 0;
+ elem.setAttribute('data-unread', numberFormat(feed_unreads + nb));
+ }
+ }
+
+ //Update unread: favourites
+ if (article && article.closest('div').hasClass('favorite')) {
+ elem = $('#aside_flux .favorites').children(':first').get(0);
+ if (elem) {
+ feed_unreads = elem ? str2int(elem.getAttribute('data-unread')) : 0;
+ elem.setAttribute('data-unread', numberFormat(feed_unreads + nb));
+ }
+ }
+
+ var isCurrentView = false;
+ //Update unread: title
+ document.title = document.title.replace(/((?: \([ 0-9]+\))?)( · .*?)((?: \([ 0-9]+\))?)$/, function (m, p1, p2, p3) {
+ var $feed = $('#' + feed_id);
+ if (article || ($feed.closest('.active').length > 0 && $feed.siblings('.active').length === 0)) {
+ isCurrentView = true;
+ return incLabel(p1, nb) + p2 + incLabel(p3, feed_priority > 0 ? nb : 0);
+ } else {
+ return p1 + p2 + incLabel(p3, feed_priority > 0 ? nb : 0);
+ }
+ });
+ return isCurrentView;
}
function mark_read(active, only_not_read) {
- if (active[0] === undefined || (only_not_read === true && !active.hasClass("not_read"))) {
+ if (active.length === 0 || (only_not_read === true && !active.hasClass("not_read"))) {
return false;
}
@@ -39,11 +111,8 @@ function mark_read(active, only_not_read) {
url: url,
data : { ajax: true }
}).done(function (data) {
- var res = $.parseJSON(data);
-
- active.find("a.read").attr("href", res.url);
-
- var inc = 0;
+ var $r = active.find("a.read").attr("href", data.url),
+ inc = 0;
if (active.hasClass("not_read")) {
active.removeClass("not_read");
inc--;
@@ -51,47 +120,16 @@ function mark_read(active, only_not_read) {
active.addClass("not_read");
inc++;
}
+ $r.find('.icon').replaceWith(data.icon);
- //Update unread: feed
var feed_url = active.find(".website>a").attr("href"),
- feed_id = feed_url.substr(feed_url.lastIndexOf('f_')),
- elem = $('#' + feed_id + ' .feed').get(0),
- feed_unread = elem ? (parseInt(elem.getAttribute('data-unread'), 10) || 0) : 0,
- feed_priority = elem ? (parseInt(elem.getAttribute('data-priority'), 10) || 0) : 0;
- elem.setAttribute('data-unread', Math.max(0, feed_unread + inc));
-
- //Update unread: category
- elem = $('#' + feed_id).parent().prevAll('.category').children(':first').get(0);
- feed_unread = elem ? (parseInt(elem.getAttribute('data-unread'), 10) || 0) : 0;
- elem.setAttribute('data-unread', Math.max(0, feed_unread + inc));
-
- //Update unread: all
- if (feed_priority > 0) {
- elem = $('#aside_flux .all').children(':first').get(0);
- if (elem) {
- feed_unread = elem ? (parseInt(elem.getAttribute('data-unread'), 10) || 0) : 0;
- elem.setAttribute('data-unread', Math.max(0, feed_unread + inc));
- }
- }
-
- //Update unread: favourites
- if (active.closest('div').hasClass('favorite')) {
- elem = $('#aside_flux .favorites').children(':first').get(0);
- if (elem) {
- feed_unread = elem ? (parseInt(elem.getAttribute('data-unread'), 10) || 0) : 0;
- elem.setAttribute('data-unread', Math.max(0, feed_unread + inc));
- }
- }
-
- //Update unread: title
- document.title = document.title.replace(/((?: \(\d+\))?)( - .*?)((?: \(\d+\))?)$/, function (m, p1, p2, p3) {
- return incLabel(p1, inc) + p2 + incLabel(p3, feed_priority > 0 ? inc : 0);
- });
+ feed_id = feed_url.substr(feed_url.lastIndexOf('f_'));
+ incUnreadsFeed(active, feed_id, inc);
});
}
function mark_favorite(active) {
- if (active[0] === undefined) {
+ if (active.length === 0) {
return false;
}
@@ -105,44 +143,53 @@ function mark_favorite(active) {
url: url,
data : { ajax: true }
}).done(function (data) {
- var res = $.parseJSON(data);
-
- active.find("a.bookmark").attr("href", res.url);
- var inc = 0;
+ var $b = active.find("a.bookmark").attr("href", data.url),
+ inc = 0;
if (active.hasClass("favorite")) {
active.removeClass("favorite");
inc--;
} else {
- active.addClass("favorite");
+ active.addClass("favorite").find('.bookmark');
inc++;
}
+ $b.find('.icon').replaceWith(data.icon);
var favourites = $('.favorites>a').contents().last().get(0);
if (favourites && favourites.textContent) {
- favourites.textContent = favourites.textContent.replace(/((?: \(\d+\))?\s*)$/, function (m, p1) {
+ favourites.textContent = favourites.textContent.replace(/((?: \([ 0-9]+\))?\s*)$/, function (m, p1) {
return incLabel(p1, inc);
});
}
if (active.closest('div').hasClass('not_read')) {
var elem = $('#aside_flux .favorites').children(':first').get(0),
- feed_unread = elem ? (parseInt(elem.getAttribute('data-unread'), 10) || 0) : 0;
- elem.setAttribute('data-unread', Math.max(0, feed_unread + inc));
+ feed_unreads = elem ? str2int(elem.getAttribute('data-unread')) : 0;
+ if (elem) {
+ elem.setAttribute('data-unread', numberFormat(feed_unreads + inc));
+ }
}
});
}
function toggleContent(new_active, old_active) {
+ old_active.removeClass("active").removeClass("current");
+
+ if (new_active.length === 0) {
+ return;
+ }
+
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');
});
}
- old_active.removeClass("active");
if (old_active[0] !== new_active[0]) {
- new_active.addClass("active");
+ if (isCollapsed) {
+ new_active.addClass("active");
+ }
+ new_active.addClass("current");
}
var box_to_move = "html,body",
@@ -182,31 +229,33 @@ function toggleContent(new_active, old_active) {
}
function prev_entry() {
- var old_active = $(".flux.active"),
- last_active = $(".flux:last"),
- new_active = old_active.prevAll(".flux:first");
-
- if (new_active.hasClass("flux")) {
- toggleContent(new_active, old_active);
- } else if (old_active[0] === undefined && new_active[0] === undefined) {
- toggleContent(last_active, old_active);
- }
+ var old_active = $(".flux.current"),
+ new_active = old_active.length === 0 ? $(".flux:last") : old_active.prevAll(".flux:first");
+ toggleContent(new_active, old_active);
}
function next_entry() {
- var old_active = $(".flux.active"),
- first_active = $(".flux:first"),
- last_active = $(".flux:last"),
- new_active = old_active.nextAll(".flux:first");
-
- if (new_active.hasClass("flux")) {
- toggleContent(new_active, old_active);
- } else if (old_active[0] === undefined && new_active[0] === undefined) {
- toggleContent(first_active, old_active);
+ var old_active = $(".flux.current"),
+ new_active = old_active.length === 0 ? $(".flux:first") : old_active.nextAll(".flux:first");
+ toggleContent(new_active, old_active);
+
+ if (!auto_load_more) {
+ var last_active = $(".flux:last");
+ if (last_active.attr("id") === new_active.attr("id")) {
+ load_more_posts();
+ }
}
+}
- if ((!auto_load_more) && (last_active.attr("id") === new_active.attr("id"))) {
- load_more_posts();
+function collapse_entry() {
+ isCollapsed = !isCollapsed;
+ $(".flux.current").toggleClass("active");
+}
+
+function auto_share() {
+ var share = $(".flux.current.active").find('.dropdown-target[id^="dropdown-share"]');
+ if (share.length) {
+ window.location.hash = share.attr('id');
}
}
@@ -279,10 +328,26 @@ function init_column_categories() {
return;
}
$('#aside_flux').on('click', '.category>a.dropdown-toggle', function () {
- $(this).children().toggleClass("i_down").toggleClass("i_up");
+ $(this).children().each(function() {
+ if (this.alt === '▽') {
+ this.src = this.src.replace('/icons/down.', '/icons/up.');
+ this.alt = '△';
+ } else {
+ this.src = this.src.replace('/icons/up.', '/icons/down.');
+ this.alt = '▽';
+ }
+ });
$(this).parent().next(".feeds").slideToggle();
return false;
});
+ $('#aside_flux').on('click', '.feeds .dropdown-toggle', function () {
+ if ($(this).nextAll('.dropdown-menu').length === 0) {
+ var feed_id = $(this).closest('li').attr('id').substr(2),
+ feed_web = $(this).data('fweb'),
+ template = $('#feed_config_template').html().replace(/!!!!!!/g, feed_id).replace('http://example.net/', feed_web);
+ $(this).attr('href', '#dropdown-' + feed_id).prev('.dropdown-target').attr('id', 'dropdown-' + feed_id).parent().append(template);
+ }
+ });
}
function init_shortcuts() {
@@ -296,7 +361,7 @@ function init_shortcuts() {
// Touches de manipulation
shortcut.add(shortcuts.mark_read, function () {
// on marque comme lu ou non lu
- var active = $(".flux.active");
+ var active = $(".flux.current");
mark_read(active, false);
}, {
'disable_in_input': true
@@ -310,18 +375,28 @@ function init_shortcuts() {
});
shortcut.add(shortcuts.mark_favorite, function () {
// on marque comme favori ou non favori
- var active = $(".flux.active");
+ var active = $(".flux.current");
mark_favorite(active);
}, {
'disable_in_input': true
});
+ shortcut.add(shortcuts.collapse_entry, function () {
+ collapse_entry();
+ }, {
+ 'disable_in_input': true
+ });
+ shortcut.add(shortcuts.auto_share, function () {
+ auto_share();
+ }, {
+ 'disable_in_input': true
+ });
// Touches de navigation
shortcut.add(shortcuts.prev_entry, prev_entry, {
'disable_in_input': true
});
shortcut.add("shift+" + shortcuts.prev_entry, function () {
- var old_active = $(".flux.active"),
+ var old_active = $(".flux.current"),
first = $(".flux:first");
if (first.hasClass("flux")) {
@@ -334,7 +409,7 @@ function init_shortcuts() {
'disable_in_input': true
});
shortcut.add("shift+" + shortcuts.next_entry, function () {
- var old_active = $(".flux.active"),
+ var old_active = $(".flux.current"),
last = $(".flux:last");
if (last.hasClass("flux")) {
@@ -347,7 +422,7 @@ function init_shortcuts() {
var url_website = $(".flux.active .link a").attr("href");
if (auto_mark_site) {
- $(".flux.active").each(function () {
+ $(".flux.current").each(function () {
mark_read($(this), true);
});
}
@@ -356,12 +431,22 @@ function init_shortcuts() {
}, {
'disable_in_input': true
});
+
+ shortcut.add(shortcuts.load_more, function () {
+ load_more_posts();
+ }, {
+ 'disable_in_input': true
+ });
}
-function init_stream_delegates(divStream) {
- divStream.on('click', '.flux_header>.item.title, .flux_header>.item.date', function (e) { //flux_header_toggle
- var old_active = $(".flux.active"),
- new_active = $(this).parent().parent();
+function init_stream(divStream) {
+ divStream.on('click', '.flux_header', function (e) { //flux_header_toggle
+ if ($(e.target).closest('.item.website > a').length > 0) {
+ return;
+ }
+ var old_active = $(".flux.current"),
+ new_active = $(this).parent();
+ isCollapsed = true;
if (e.target.tagName.toUpperCase() === 'A') { //Leave real links alone
if (auto_mark_article) {
mark_read(new_active, true);
@@ -374,21 +459,15 @@ function init_stream_delegates(divStream) {
divStream.on('click', '.flux a.read', function () {
var active = $(this).parents(".flux");
mark_read(active, false);
-
return false;
});
divStream.on('click', '.flux a.bookmark', function () {
var active = $(this).parents(".flux");
mark_favorite(active);
-
return false;
});
- divStream.on('click', '.flux .content a', function () {
- $(this).attr('target', '_blank');
- });
-
divStream.on('click', '.item.title>a', function (e) {
if (e.ctrlKey) {
return true; //Allow default control-click behaviour such as open in backround-tab
@@ -397,10 +476,8 @@ function init_stream_delegates(divStream) {
return false;
});
- divStream.on('click', '.bigMarkAsRead', function () {
- var url = $(".nav_menu .read_all").attr("href");
- redirect(url, false);
- return false;
+ divStream.on('click', '.flux .content a', function () {
+ $(this).attr('target', '_blank');
});
if (auto_mark_site) {
@@ -421,7 +498,7 @@ function init_nav_entries() {
return false;
});
$nav_entries.find('.up').click(function () {
- var active_item = $(".flux.active"),
+ var active_item = $(".flux.current"),
windowTop = $(window).scrollTop(),
item_top = active_item.position().top;
@@ -434,17 +511,6 @@ function init_nav_entries() {
});
}
-function init_templates() {
- $('#aside_flux').on('click', '.feeds .dropdown-toggle', function () {
- if ($(this).nextAll('.dropdown-menu').length === 0) {
- var feed_id = $(this).closest('li').attr('id').substr(2),
- feed_web = $(this).data('fweb'),
- template = $('#feed_config_template').html().replace(/!!!!!!/g, feed_id).replace('http://example.net/', feed_web);
- $(this).attr('href', '#dropdown-' + feed_id).prev('.dropdown-target').attr('id', 'dropdown-' + feed_id).parent().append(template);
- }
- });
-}
-
function init_actualize() {
$("#actualize").click(function () {
$.getScript('./?c=javascript&a=actualize').done(function () {
@@ -468,7 +534,7 @@ function closeNotification() {
function init_notifications() {
var notif = $(".notification");
- if (notif[0] !== undefined) {
+ if (notif.length > 0) {
window.setInterval(closeNotification, 4000);
notif.find("a.close").click(function () {
@@ -478,6 +544,21 @@ function init_notifications() {
}
}
+function refreshUnreads() {
+ $.getJSON('./?c=javascript&a=nbUnreadsPerFeed').done(function (data) {
+ var isAll = $('.category.all > .active').length > 0;
+ $.each(data, function(feed_id, nbUnreads) {
+ feed_id = 'f_' + feed_id;
+ var elem = $('#' + feed_id + '>.feed').get(0),
+ feed_unreads = elem ? str2int(elem.getAttribute('data-unread')) : 0;
+ if ((incUnreadsFeed(null, feed_id, nbUnreads - feed_unreads) || isAll) && //Update of current view?
+ (nbUnreads - feed_unreads > 0)) {
+ $('#new-article').show();
+ };
+ });
+ });
+}
+
//<endless_mode>
var url_load_more = "",
load_more = false,
@@ -493,10 +574,13 @@ function load_more_posts() {
$.get(url_load_more, function (data) {
box_load_more.children('.flux:last').after($('#stream', data).children('.flux, .day'));
$('.pagination').replaceWith($('.pagination', data));
+ $('#bigMarkAsRead').attr('href', $('#nav_menu_read_all>a').attr('href'));
$('[id^=day_]').each(function (i) {
var ids = $('[id="' + this.id + '"]');
- if (ids.length > 1) $('[id="' + this.id + '"]:gt(0)').remove();
+ if (ids.length > 1) {
+ $('[id="' + this.id + '"]:gt(0)').remove();
+ }
});
init_load_more(box_load_more);
@@ -508,6 +592,8 @@ function load_more_posts() {
}
function init_load_more(box) {
+ box_load_more = box;
+
var $next_link = $("#load_more");
if (!$next_link.length) {
// no more article to load
@@ -515,8 +601,6 @@ function init_load_more(box) {
return;
}
- box_load_more = box;
-
url_load_more = $next_link.attr("href");
var $prefetch = $('#prefetch');
if ($prefetch.attr('href') !== url_load_more) {
@@ -532,6 +616,62 @@ function init_load_more(box) {
}
//</endless_mode>
+//<Web login form>
+function poormanSalt() { //If crypto.getRandomValues is not available
+ var text = '$2a$04$',
+ base = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ.0123456789/abcdefghijklmnopqrstuvwxyz';
+ for (var i = 22; i > 0; i--) {
+ text += base.charAt(Math.floor(Math.random() * 64));
+ }
+ return text;
+}
+
+function init_loginForm() {
+ var $loginForm = $('#loginForm');
+ if ($loginForm.length === 0) {
+ return;
+ }
+ if (!(window.dcodeIO)) {
+ if (window.console) {
+ console.log('FreshRSS waiting for bcrypt.js…');
+ }
+ window.setTimeout(init_loginForm, 100);
+ return;
+ }
+ $loginForm.on('submit', function() {
+ $('#loginButton').attr('disabled', '');
+ var success = false;
+ $.ajax({
+ url: './?c=javascript&a=nonce&user=' + $('#username').val(),
+ dataType: 'json',
+ async: false
+ }).done(function (data) {
+ if (data.salt1 == '' || data.nonce == '') {
+ alert('Invalid user!');
+ } else {
+ try {
+ var strong = window.Uint32Array && window.crypto && (typeof window.crypto.getRandomValues === 'function'),
+ s = dcodeIO.bcrypt.hashSync($('#passwordPlain').val(), data.salt1),
+ c = dcodeIO.bcrypt.hashSync(data.nonce + s, strong ? 4 : poormanSalt());
+ $('#challenge').val(c);
+ if (s == '' || c == '') {
+ alert('Crypto error!');
+ } else {
+ success = true;
+ }
+ } catch (e) {
+ alert('Crypto exception! ' + e);
+ }
+ }
+ }).fail(function() {
+ alert('Communication error!');
+ });
+ $('#loginButton').removeAttr('disabled');
+ return success;
+ });
+}
+//</Web login form>
+
//<persona>
function init_persona() {
if (!(navigator.id)) {
@@ -563,16 +703,14 @@ function init_persona() {
url: url_login,
data: {assertion: assertion},
success: function(res, status, xhr) {
- var res_obj = jQuery.parseJSON(res);
-
- if (res_obj.status == 'failure') {
- //alert (res_obj.reason);
- } else if (res_obj.status == 'okay') {
+ /*if (res.status === 'failure') {
+ alert (res_obj.reason);
+ } else*/ if (res.status === 'okay') {
location.href = url_freshrss;
}
},
error: function(res, status, xhr) {
- alert("login failure : " + res);
+ alert("Login failure: " + res);
}
});
},
@@ -598,8 +736,29 @@ function init_persona() {
function init_confirm_action() {
$('.confirm').click(function () {
- return confirm(str_confirmation);
- });
+ return confirm(str_confirmation);
+ });
+}
+
+function init_print_action() {
+ $('.print-article').click(function () {
+ var content = "<html><head><style>"
+ + "body { font-family: Serif; text-align: justify; }"
+ + "a { color: #000; text-decoration: none; }"
+ + "a:after { content: ' [' attr(href) ']'}"
+ + "</style></head><body>"
+ + $(".flux.current .content").html()
+ + "</body></html>";
+
+ var tmp_window = window.open();
+ tmp_window.document.writeln(content);
+ tmp_window.document.close();
+ tmp_window.focus();
+ tmp_window.print();
+ tmp_window.close();
+
+ return false;
+ });
}
function init_all() {
@@ -610,22 +769,29 @@ function init_all() {
window.setTimeout(init_all, 50);
return;
}
- $stream = $('#stream');
- init_posts();
- init_column_categories();
- if (load_shortcuts) {
- init_shortcuts();
- }
- init_stream_delegates($stream);
- init_nav_entries();
- init_templates();
init_notifications();
- init_actualize();
- init_load_more($stream);
- if (use_persona) {
- init_persona();
+ switch (authType) {
+ case 'form':
+ init_loginForm();
+ break;
+ case 'persona':
+ init_persona();
+ break;
}
init_confirm_action();
+ $stream = $('#stream');
+ if ($stream.length > 0) {
+ init_actualize();
+ init_column_categories();
+ init_load_more($stream);
+ init_posts();
+ init_stream($stream);
+ init_nav_entries();
+ init_shortcuts();
+ init_print_action();
+ window.setInterval(refreshUnreads, 120000);
+ }
+
if (window.console) {
console.log('FreshRSS init done.');
}
diff --git a/public/scripts/shortcut.js b/p/scripts/shortcut.js
index debaffbaa..debaffbaa 100644
--- a/public/scripts/shortcut.js
+++ b/p/scripts/shortcut.js
diff --git a/p/themes/Dark/freshrss.css b/p/themes/Dark/freshrss.css
new file mode 100644
index 000000000..e54a0eadd
--- /dev/null
+++ b/p/themes/Dark/freshrss.css
@@ -0,0 +1,917 @@
+@charset "UTF-8";
+
+/* STRUCTURE */
+.header {
+ display: table;
+ width: 100%;
+ background: #1c1c1c;
+ table-layout: fixed;
+}
+ .header > .item {
+ display: table-cell;
+ padding: 10px 0;
+ border-bottom: 1px solid #2f2f2f;
+ vertical-align: middle;
+ text-align: center;
+ }
+ .header > .item.title {
+ width: 250px;
+ white-space: nowrap;
+ }
+ .logo {
+ display: inline-block;
+ font-size: 48px;
+ height: 32px;
+ width: 32px;
+ padding: 10px;
+ }
+ .header > .item.title h1 {
+ display: inline-block;
+ margin: 0;
+ }
+ .header > .item.search input {
+ width: 230px;
+ }
+ .header .item.search input:focus {
+ width: 330px;
+ }
+ .header > .item.configure {
+ width: 100px;
+ }
+
+.item a:hover {
+ text-decoration: none;
+}
+
+#global {
+ display: table;
+ width: 100%;
+ height: 100%;
+ background: #1c1c1c;
+ table-layout: fixed;
+}
+ .aside {
+ display: table-cell;
+ height: 100%;
+ width: 250px;
+ vertical-align: top;
+ border-right: 1px solid #2f2f2f;
+ background: #1c1c1c;
+ }
+ .aside .nav-form input {
+ width: 180px;
+ }
+ .aside.aside_flux {
+ padding: 10px 0 40px;
+ }
+ .aside.aside_feed .nav-form input {
+ width: 140px;
+ }
+ .aside.aside_feed .nav-form .dropdown .dropdown-menu {
+ right: -20px;
+ }
+ .aside.aside_feed .nav-form .dropdown .dropdown-menu:after {
+ right: 33px;
+ }
+
+ .nav-login {
+ display: none;
+ }
+
+ .nav_menu {
+ width: 100%;
+ background: #1c1c1c;
+ border-bottom: 1px solid #2f2f2f;
+ text-align: center;
+ padding: 5px 0;
+ }
+ .nav_menu .search {
+ display:none;
+ }
+
+.favicon {
+ height: 16px;
+ width: 16px;
+}
+
+.categories {
+ margin: 0;
+ padding: 0;
+ text-align: center;
+ list-style: none;
+}
+ .category {
+ display: block;
+ width: 220px;
+ margin: 10px auto;
+ text-align: left;
+ overflow: hidden;
+ white-space: nowrap;
+ text-overflow: ellipsis;
+ }
+ .category .btn:first-child {
+ width: 195px;
+ position: relative;
+ }
+ .category.stick .btn:first-child {
+ width:160px;
+ }
+ .category .btn:first-child:not([data-unread="0"]):after {
+ content: attr(data-unread);
+ position: absolute;
+ top: 3px; right: 3px;
+ padding: 1px 5px;
+ background: #1a1a1a;
+ color: #888;
+ font-size: 90%;
+ border: 1px solid #000;
+ border-radius: 5px;
+ }
+ .category + .feeds:not(.active) {
+ display:none;
+ }
+ .categories .feeds {
+ width: 100%;
+ margin: 0;
+ list-style: none;
+ }
+ .categories .feeds .item.active {
+ background: #26303F;
+ }
+ .categories .feeds .item.active .feed {
+ color: #888;
+ }
+ .categories .feeds .item.empty .feed {
+ color: #e67e22;
+ }
+ .categories .feeds .item.empty.active {
+ background: #e67e22;
+ }
+ .categories .feeds .item.empty.active .feed {
+ color: #fff;
+ }
+ .categories .feeds .item.error .feed {
+ color: #BD362F;
+ }
+ .categories .feeds .item .feed {
+ display: inline-block;
+ margin: 0;
+ width: 165px;
+ line-height: 35px;
+ font-size: 90%;
+ vertical-align: middle;
+ text-align: left;
+ overflow: hidden;
+ white-space: nowrap;
+ text-overflow: ellipsis;
+ }
+ .feed:not([data-unread="0"]):before {
+ content: "(" attr(data-unread) ") ";
+ }
+ .categories .feeds .dropdown-menu {
+ left: 0;
+ }
+ .categories .feeds .dropdown-menu:after {
+ left: 2px;
+ }
+ .categories .feeds .item .dropdown-toggle > .icon {
+ visibility: hidden;
+ cursor: pointer;
+ }
+ .categories .feeds .item .dropdown-target:target ~ .dropdown-toggle > .icon,
+ .categories .feeds .item:hover .dropdown-toggle > .icon,
+ .categories .feeds .item.active .dropdown-toggle > .icon {
+ background-color: #1c1c1c;
+ border-radius: 3px;
+ visibility: visible;
+ }
+
+.post {
+ padding: 10px 50px;
+}
+ .post form {
+ margin: 10px 0;
+ }
+
+.day {
+ min-height: 50px;
+ padding: 0 10px;
+ font-size: 130%;
+ font-weight: bold;
+ line-height: 50px;
+ background: #1c1c1c;
+ border-top: 1px solid #2f2f2f;
+}
+ #new-article + .day {
+ border-top: none;
+ }
+ .day .name {
+ position: absolute;
+ right: 0;
+ width: 50%;
+ height: 1.5em;
+ padding: 0 10px 0 0;
+ overflow: hidden;
+ color: #aab;
+ font-size: 1.8em;
+ opacity: .3;
+ text-shadow: 0px -1px 0px #333;
+ font-style: italic;
+ white-space: nowrap;
+ text-overflow: ellipsis;
+ text-align: right;
+ }
+
+#new-article {
+ display: none;
+ min-height: 40px;
+ background: #26303F;
+ text-align: center;
+}
+ #new-article:hover {
+ background: #4A5D7A;
+ }
+ #new-article > a {
+ display: block;
+ line-height: 40px;
+ color: #fff;
+ font-weight: bold;
+ }
+ #new-article > a:hover {
+ text-decoration: none;
+ }
+
+.flux {
+ border-left: 3px solid #2f2f2f;
+ background: #1c1c1c;
+}
+ .flux.not_read {
+ border-left: 3px solid #FF5300;
+ background: #1c1c1c;
+ }
+ .flux.favorite {
+ border-left: 3px solid #FFC300;
+ background: #1c1c1c;
+ }
+ .flux.current {
+ border-left: 3px solid #0062BE;
+ background: #1a1a1a;
+ }
+
+ .horizontal-list > .item:not(.title):not(.website) > a {
+ display: block;
+ }
+
+ .flux_header {
+ background: inherit;
+ height: 25px;
+ font-size: 12px;
+ border-top: 1px solid #2f2f2f;
+ cursor: pointer;
+ }
+ .flux .item {
+ line-height: 40px;
+ white-space: nowrap;
+ }
+ .flux_header > .item {
+ overflow: hidden;
+ text-overflow: ellipsis;
+ }
+ .flux .item.manage {
+ width: 40px;
+ text-align: center;
+ }
+ .flux .item.website {
+ width: 200px;
+ }
+ .website .favicon {
+ padding: 5px;
+ }
+ .flux .item.title {
+ background: inherit;
+ }
+ .flux .item.title a {
+ color: #888;
+ outline: none;
+ }
+ .flux.not_read .item.title,
+ .flux.current .item.title {
+ font-weight: bold;
+ }
+ .flux .item.date {
+ width: 145px;
+ padding:0 5px 0 0;
+ text-align: right;
+ font-size: 10px;
+ color: #666;
+ }
+ .link {
+ width: 40px;
+ text-align: center;
+ }
+
+#stream.reader .flux {
+ padding: 0 0 30px;
+ border: none;
+ background: #1c1c1c;
+ color: #888;
+}
+ #stream.reader .flux .author {
+ margin: 0 0 10px;
+ font-size: 90%;
+ color: #666;
+ }
+
+#stream.global {
+ text-align: center;
+}
+ #stream.global .box-category {
+ display: inline-block;
+ width: 280px;
+ margin: 20px 10px;
+ vertical-align: top;
+ background: #1a1a1a;
+ border: 1px solid #000;
+ border-radius: 5px;
+ text-align: left;
+ box-shadow: 0 0 5px #2f2f2f;
+ }
+ #stream.global .category {
+ width: 100%;
+ margin: 0;
+ }
+ #stream.global .btn {
+ display: block;
+ width: auto;
+ height: 35px;
+ margin: 0;
+ padding: 0 10px;
+ background: #26303F;
+ border: none;
+ border-bottom: 1px solid #2f2f2f;
+ border-radius: 5px 5px 0 0;
+ line-height: 35px;
+ font-size: 120%;
+ }
+ #stream.global .btn:not([data-unread="0"]) {
+ font-weight:bold;
+ }
+ #stream.global .btn:first-child:not([data-unread="0"]):after {
+ top: 0; right: 5px;
+ border: 0;
+ background: none;
+ color: #666;
+ font-weight: bold;
+ box-shadow: none;
+ }
+ #stream.global .box-category .feeds {
+ display: block;
+ max-height: 250px;
+ margin: 0;
+ list-style: none;
+ overflow: auto;
+ }
+ #stream.global .box-category .feeds .item {
+ padding: 2px 10px;
+ font-size: 90%;
+ }
+ #stream.global .box-category .feed {
+ width: 220px;
+ }
+
+.content {
+ min-height: 150px;
+ max-width: 550px;
+ margin: 0 auto;
+ padding: 20px 10px;
+ line-height: 170%;
+ word-wrap: break-word;
+}
+ .content h1, .content h2, .content h3 {
+ margin: 20px 0 5px;
+ }
+ .content > .title {
+ font-size: x-large;
+ margin: 0;
+ }
+
+ .content p {
+ margin: 0 0 20px;
+ }
+ img.big {
+ display: block;
+ margin: 10px auto;
+ }
+ figure img.big {
+ margin: 0;
+ }
+ .content hr {
+ margin: 30px 0;
+ height: 1px;
+ background: #ddd;
+ border: 0;
+ }
+ .content pre {
+ margin: 10px auto;
+ padding: 10px;
+ overflow: auto;
+ background: #000;
+ color: #fff;
+ font-size: 110%;
+ }
+ .content q, .content blockquote {
+ display: block;
+ margin: 5px 0;
+ padding: 5px 20px;
+ font-style: italic;
+ border-left: 4px solid #ccc;
+ color: #666;
+ }
+ .content blockquote p {
+ margin: 0;
+ }
+
+#panel {
+ display: none;
+ position: fixed;
+ top: 10px; bottom: 10px;
+ left: 100px; right: 100px;
+ overflow: auto;
+ background: #1c1c1c;
+ border: 1px solid #95a5a6;
+ border-radius: 5px;
+}
+ #panel .close {
+ position: fixed;
+ top: 10px; right: 0;
+ display: inline-block;
+ width: 26px;
+ height: 26px;
+ margin: 0 10px 0 0;
+ border: 1px solid #ccc;
+ border-radius: 20px;
+ text-align: center;
+ line-height: 26px;
+ background: #fff;
+ }
+
+#overlay {
+ display: none;
+ position: fixed;
+ top: 0; bottom: 0;
+ left: 0; right: 0;
+ background: rgba(0, 0, 0, 0.9);
+}
+
+.flux_content .bottom {
+ font-size: 90%;
+ text-align: center;
+}
+
+.hide_posts > :not(.active) > .flux_content {
+ display:none;
+}
+
+/*** PAGINATION ***/
+.pagination {
+ display: table;
+ width: 100%;
+ margin: 0;
+ background: #1a1a1a;
+ text-align: center;
+ color: #888;
+ font-size: 80%;
+ line-height: 200%;
+ table-layout: fixed;
+}
+ .pagination .item {
+ display: table-cell;
+ line-height: 40px;
+ }
+ .pagination .item.pager-current {
+ font-weight: bold;
+ font-size: 140%;
+ }
+ .pagination .pager-first,
+ .pagination .pager-previous,
+ .pagination .pager-next,
+ .pagination .pager-last {
+ width: 100px;
+ }
+ .pagination .item a {
+ display: block;
+ color: #333;
+ font-style: italic;
+ }
+ .pagination:first-child .item {
+ border-bottom: 1px solid #aaa;
+ }
+ .pagination:last-child .item {
+ border-top: 1px solid #aaa;
+ }
+
+#nav_entries {
+ display: table;
+ width: 250px;
+ height: 40px;
+ position: fixed;
+ bottom: 0;
+ left: 0;
+ margin: 0;
+ background: #1c1c1c;
+ border-top: 1px solid #2f2f2f;
+ text-align: center;
+ line-height: 40px;
+ table-layout: fixed;
+}
+ #nav_entries .item {
+ display: table-cell;
+ width: 30%;
+ }
+ #nav_entries a {
+ display: block;
+ }
+ #nav_entries .i_up {
+ margin: 5px 0 0;
+ vertical-align: top;
+ }
+
+.loading {
+ background: url("loader.gif") center center no-repeat;
+ font-size: 0;
+}
+
+#bigMarkAsRead {
+ display: block;
+ font-style: normal;
+ padding: 32px 0 64px 0;
+ text-align: center;
+ text-decoration: none;
+}
+ #bigMarkAsRead:hover {
+ background: #1c1c1c;
+ color: #888;
+ }
+ .bigTick {
+ font-size: 72pt;
+ line-height: 1.6em;
+ }
+
+/*** NOTIFICATION ***/
+.notification {
+ position: absolute;
+ top: 10px;
+ left: 25%; right: 25%;
+ min-height: 30px;
+ padding: 10px;
+ line-height: 30px;
+ text-align: center;
+ border-radius: 5px;
+ box-shadow: 0 0 5px #666;
+ background: #1a1a1a;
+ color: #888;
+ font-weight: bold;
+ z-index: 10;
+}
+ .notification.good {
+ border:1px solid #f4f899;
+ }
+ .notification.bad {
+ border:1px solid #f4a899;
+ }
+ .notification a.close {
+ display: inline-block;
+ width: 16px;
+ height: 16px;
+ float: right;
+ margin: -20px -20px 0 0;
+ padding: 5px;
+ background: #1a1a1a;
+ border-radius: 50px;
+ line-height: 16px;
+ }
+ .notification.good a.close{
+ border:1px solid #f4f899;
+ }
+ .notification.bad a.close{
+ border:1px solid #f4a899;
+ }
+
+.toggle_aside, .btn.toggle_aside {
+ display: none;
+}
+
+.actualizeProgress {
+ position: fixed;
+ top: 10px;
+ left: 25%; right: 25%;
+ padding: 5px;
+ background: #1a1a1a;
+ text-align: center;
+ border: 1px solid #2f2f2f;
+ border-radius: 5px;
+}
+ .actualizeProgress progress {
+ max-width: 100%;
+ vertical-align: middle;
+ }
+ .actualizeProgress .progress {
+ color: #888;
+ font-size: 90%;
+ vertical-align: middle;
+ }
+
+.logs {
+ border: 1px solid #aaa;
+}
+ .log {
+ padding: 5px 2%;
+ overflow: auto;
+ background: #fafafa;
+ border-bottom: 1px solid #999;
+ color: #333;
+ font-size: 90%;
+ }
+ .log .date {
+ display: block;
+ }
+ .log.error {
+ background: #fdd;
+ color: #844;
+ }
+ .log.warning {
+ background: #ffe;
+ color: #c95;
+ }
+ .log.notice {
+ background: #f4f4f4;
+ color: #aaa;
+ }
+ .log.debug {
+ background: #111;
+ color: #eee;
+ }
+
+.form-group table {
+ border-collapse:collapse;
+ margin:10px 0 0 220px;
+ text-align:center;
+}
+
+.form-group tr, .form-group th, .form-group td {
+ border:1px solid #2f2f2f;
+ font-weight:normal;
+ padding:.5em;
+}
+
+select.number option {
+ text-align:right;
+}
+
+@media(min-width: 841px) {
+ .flux:not(.current):hover .item.title {
+ max-width: calc(100% - 580px);
+ padding-right: 1.5em;
+ position: absolute;
+ }
+}
+
+@media(max-width: 840px) {
+ .header,
+ .aside .btn-important,
+ .aside .feeds .dropdown,
+ .flux_header .item.website span,
+ .item.date {
+ display: none;
+ }
+ .flux_header .item.website {
+ width: 40px;
+ text-align: center;
+ }
+ .flux_header .item.website .favicon {
+ padding: 12px;
+ }
+
+ .nav-login {
+ display: block;
+ }
+
+ .pagination {
+ margin: 0 0 40px;
+ }
+ .pagination .pager-previous, .pagination .pager-next {
+ width: 100px;
+ }
+
+ .toggle_aside, .btn.toggle_aside {
+ display: inline-block;
+ }
+ .aside {
+ position: fixed;
+ top: 0; left: 0;
+ width: 0;
+ overflow: hidden;
+ border-right: none;
+ z-index: 10;
+ transition: width 200ms linear;
+ }
+ .aside.aside_flux {
+ padding: 10px 0 0;
+ }
+ .aside:target {
+ width: 80%;
+ border-right: 1px solid #aaa;
+ overflow: auto;
+ }
+ .aside .toggle_aside {
+ position: absolute;
+ right: 0;
+ display: inline-block;
+ width: 26px;
+ height: 26px;
+ margin: 0 10px 0 0;
+ border: 1px solid #ccc;
+ border-radius: 20px;
+ text-align: center;
+ line-height: 26px;
+ }
+ .aside .categories {
+ margin: 30px 0;
+ }
+
+ #nav_entries {
+ width: 100%;
+ }
+
+ .nav_menu .btn {
+ margin: 5px 10px;
+ }
+ .nav_menu .stick {
+ margin: 0 10px;
+ }
+ .nav_menu .stick .btn {
+ margin: 5px 0;
+ }
+ .nav_menu .search {
+ display: inline-block;
+ max-width: 97%;
+ }
+ .nav_menu .search input {
+ max-width: 97%;
+ width: 90px;
+ }
+ .nav_menu .search input:focus {
+ width: 400px;
+ }
+
+ #panel {
+ left: 5px; right: 5px;
+ }
+
+ .day .date {
+ display: none;
+ }
+ .day .name {
+ height: 2.6em;
+ font-size: 1em;
+ text-shadow: none;
+ }
+
+ .notification,
+ .actualizeProgress {
+ left: 10px;
+ right: 10px;
+ }
+}
+
+/*** FALLBACK ***/
+.btn {
+ background: #1c1c1c;
+}
+ .btn:hover {
+ background: -moz-linear-gradient(top, #4A5D7A 0%, #26303F 100%);
+ background: -webkit-linear-gradient(top, #4A5D7A 0%, #26303F 100%);
+ background: -o-linear-gradient(top, #4A5D7A 0%, #26303F 100%);
+ background: -ms-linear-gradient(top, #4A5D7A 0%, #26303F 100%);
+ }
+ .btn-important {
+ background: #26303F;
+ }
+ .btn-important:hover {
+ background: -moz-linear-gradient(top, #4A5D7A 0%, #26303F 100%);
+ background: -webkit-linear-gradient(top, #4A5D7A 0%, #26303F 100%);
+ background: -o-linear-gradient(top, #4A5D7A 0%, #26303F 100%);
+ background: -ms-linear-gradient(top, #4A5D7A 0%, #26303F 100%);
+ }
+ .btn-attention {
+ background: #880011;
+ }
+ .btn-attention:hover {
+ background: -moz-linear-gradient(top, #cc0044 0%, #880011 100%);
+ background: -webkit-linear-gradient(top, #cc0044 0%, #880011 100%);
+ background: -o-linear-gradient(top, #cc0044 0%, #880011 100%);
+ background: -ms-linear-gradient(top, #cc0044 0%, #880011 100%);
+ }
+
+.dropdown-menu:after {
+ -moz-transform: rotate(45deg);
+ -webkit-transform: rotate(45deg);
+ -ms-transform: rotate(45deg);
+}
+
+.nav-head {
+ background: #1c1c1c;
+}
+
+input.extend {
+ -moz-transition: width 200ms linear;
+ -webkit-transition: width 200ms linear;
+ -o-transition: width 200ms linear;
+ -ms-transition: width 200ms linear;
+}
+
+@media(max-width: 840px) {
+ .aside {
+ -moz-transition: width 200ms linear;
+ -webkit-transition: width 200ms linear;
+ -o-transition: width 200ms linear;
+ -ms-transition: width 200ms linear;
+ }
+}
+
+@media print {
+ .header,
+ .aside,
+ .nav_menu,
+ .day,
+ .flux_header,
+ .flux_content .bottom,
+ .pagination {
+ display: none;
+ }
+
+ html, body {
+ background: #fff;
+ color: #000;
+ font-family: Serif;
+ font-size: 12pt;
+ }
+
+ #global,
+ .flux_content {
+ display: block !important;
+ }
+
+ .flux_content .content {
+ width: 100% !important;
+ text-align: justify;
+ }
+
+ .flux_content .content a {
+ color: #000;
+ }
+ .flux_content .content a:after {
+ content: " (" attr(href) ") ";
+ text-decoration: underline;
+ }
+}
+
+.stat {
+ border:1px solid #2f2f2f;
+ border-radius:10px;
+ margin:10px 0;
+ padding:0 5px;
+}
+.stat > h2 {
+ border-bottom:1px solid #2f2f2f;
+ margin:0 -5px;
+ padding-left:5px;
+}
+.stat > div {
+ margin:5px 0;
+}
+.stat > table {
+ border-collapse:collapse;
+ margin:5px 0;
+ width:100%;
+}
+.stat > table > thead > tr {
+ border-bottom:2px solid #2f2f2f;
+}
+.stat > table > tbody > tr {
+ border-bottom:1px solid #2f2f2f;
+}
+.stat > table > tbody > tr:last-child {
+ border-bottom:0;
+}
+.stat > table th, .stat > table td {
+ border-left:2px solid #2f2f2f;
+ padding:5px;
+}
+.stat > table th:first-child, .stat > table td:first-child {
+ border-left:0;
+}
+.stat > table td.numeric{
+ margin:5px 0;
+ text-align:center;
+}
diff --git a/p/themes/Dark/global.css b/p/themes/Dark/global.css
new file mode 100644
index 000000000..f96f83fc8
--- /dev/null
+++ b/p/themes/Dark/global.css
@@ -0,0 +1,524 @@
+@charset "UTF-8";
+
+/* FONTS */
+@font-face {
+ font-family: "OpenSans";
+ src: url("../fonts/openSans.woff") format("woff");
+}
+
+
+* {
+ margin: 0;
+ padding: 0;
+}
+html, body {
+ height: 100%;
+ font-size: 95%;
+ font-family: "OpenSans", "Cantarell", "Helvetica", "Arial", sans-serif;
+ color: #888;
+}
+
+/* LIENS */
+a {
+ color: #6986B2;
+ text-decoration: none;
+}
+ a:hover {
+ text-decoration: underline;
+ }
+
+/* LISTES */
+ul, ol, dl {
+ margin: 10px 0 10px 30px;
+ line-height: 190%;
+}
+ dd {
+ margin: 0 0 10px 30px;
+ }
+
+/* TITRES */
+h1, h2, h3 {
+ min-height: 40px;
+ margin: 15px 0 5px;
+ line-height: 40px;
+}
+
+/* IMG */
+figure {
+ margin: 5px 0 10px;
+ text-align: center;
+}
+ figcaption {
+ display: inline-block;
+ padding: 3px 20px;
+ color: #999;
+ font-style: italic;
+ border-bottom: 1px solid #ccc;
+ }
+img {
+ height: auto;
+ max-width: 100%;
+ vertical-align: middle;
+}
+ a img {
+ border: none;
+ }
+
+/* VIDEOS */
+iframe, embed, object, video {
+ max-width: 100%;
+}
+
+/* FORMULAIRES */
+legend {
+ display: block;
+ width: 100%;
+ margin: 20px 0 5px;
+ padding: 5px 0;
+ border-bottom: 1px solid #2f2f2f;
+ font-size: 150%;
+ clear: both;
+}
+label {
+ display: block;
+ min-height: 25px;
+ padding: 5px 0;
+ font-size: 14px;
+ line-height: 25px;
+ cursor: pointer;
+}
+input {
+ width: 180px;
+}
+textarea {
+ width: 360px;
+ height: 100px;
+}
+input, select, textarea {
+ display: inline-block;
+ max-width: 100%;
+ min-height: 25px;
+ padding: 5px;
+ background: #333;
+ border: 1px solid #000;
+ border-radius: 3px;
+ color: #999;
+ line-height: 25px;
+ vertical-align: middle;
+ box-shadow: 0 2px 2px #1d1d1d inset;
+}
+ option {
+ padding:0 .5em 0 .5em;
+ }
+ input[type="radio"],
+ input[type="checkbox"] {
+ width: 15px !important;
+ min-height: 15px !important;
+ }
+ input:focus, select:focus, textarea:focus {
+ color: #6986b2;
+ border-color: #2f2f2f;
+ }
+ input:invalid, select:invalid {
+ border-color: red;
+ box-shadow: 0 0 2px 1px red;
+ }
+ input:focus.extend {
+ width: 300px;
+ transition: width 200ms linear;
+ }
+
+.form-group {
+ margin: 0;
+}
+ .form-group:after {
+ content: "";
+ display: block;
+ clear: both;
+ }
+ .form-group.form-actions {
+ min-width: 250px;
+ padding: 5px 0;
+ background: #1a1a1a;
+ border-top: 1px solid #2f2f2f;
+ }
+ .form-group.form-actions .btn {
+ margin: 0 10px;
+ }
+ .form-group .group-name {
+ display: block;
+ float: left;
+ width: 200px;
+ padding: 10px 0;
+ text-align: right;
+ }
+ .form-group .group-controls {
+ min-width: 250px;
+ min-height: 25px;
+ margin: 0 0 0 220px;
+ padding: 5px 0;
+ }
+ .form-group .group-controls .control {
+ display: block;
+ min-height: 30px;
+ padding: 5px 0;
+ line-height: 25px;
+ font-size: 14px;
+ }
+
+.stick {
+ display: inline-block;
+ white-space: nowrap;
+ font-size: 0px;
+ vertical-align: middle;
+}
+ .stick input,
+ .stick .btn {
+ border-radius: 0;
+ font-size: 14px;
+ }
+ .stick .btn:first-child,
+ .stick input:first-child {
+ border-radius: 3px 0 0 3px;
+ }
+ .stick .btn-important:first-child {
+ border-right: 1px solid #000;
+ }
+ .stick .btn:last-child,
+ .stick input:last-child {
+ border-radius: 0 3px 3px 0;
+ }
+ .stick .btn + .btn,
+ .stick .btn + input,
+ .stick .btn + .dropdown > .btn,
+ .stick input + .btn,
+ .stick input + input,
+ .stick input + .dropdown > .btn,
+ .stick .dropdown + .btn,
+ .stick .dropdown + input,
+ .stick .dropdown + .dropdown > .btn {
+ border-left: none;
+ }
+ .stick .btn + .dropdown > .btn {
+ border-left: none;
+ border-radius: 0 3px 3px 0;
+ }
+ .stick .btn + .dropdown a {
+ font-size: 12px;
+ }
+
+.btn {
+ display: inline-block;
+ min-height: 37px;
+ min-width: 15px;
+ padding: 5px 10px;
+ background: linear-gradient(to bottom, #fff 0%, #eee 100%);
+ border-radius: 3px;
+ border: 1px solid #000;
+ color: #888;
+ line-height: 20px;
+ vertical-align: middle;
+ cursor: pointer;
+ overflow: hidden;
+}
+ a.btn {
+ min-height: 25px;
+ line-height: 25px;
+ }
+ .btn:hover {
+ background: linear-gradient(to bottom, #4A5D7A, #26303F);
+ text-decoration: none;
+ }
+ .btn.active,
+ .btn:active,
+ .dropdown-target:target ~ .btn.dropdown-toggle {
+ background: #26303F;
+ }
+
+ .btn-important {
+ background: linear-gradient(to bottom, #0084CC, #0045CC);
+ color: #888888;
+ border: 1px solid #000000;
+ }
+ .btn-important:hover {
+ background: linear-gradient(to bottom, #0066CC, #0045CC);
+ }
+ .btn-important:active {
+ background: #0044CB;
+ box-shadow: none;
+ }
+
+ .btn-attention {
+ background: linear-gradient(to bottom, #E95B57, #BD362F);
+ color: #888888;
+ border: 1px solid #000000;
+ }
+ .btn-attention:hover {
+ background: linear-gradient(to bottom, #D14641, #BD362F);
+ }
+ .btn-attention:active {
+ background: #BD362F;
+ box-shadow: none;
+ }
+
+/* NAVIGATION */
+.nav-list .nav-header,
+.nav-list .item {
+ display: block;
+ height: 35px;
+ line-height: 35px;
+}
+ .nav-list .item:hover {
+ background: #1a1a1a;
+ }
+ .nav-list .item:hover a {
+ color: #26303F;
+ }
+ .nav-list .item.active {
+ background: #26303F;
+ color: #1a1a1a;
+ }
+ .nav-list .item.active a {
+ color: #888;
+ }
+ .nav-list .disable {
+ color: #aaa;
+ background: #fafafa;
+ text-align: center;
+ }
+ .nav-list .item > * {
+ display: block;
+ padding: 0 10px;
+ overflow: hidden;
+ white-space: nowrap;
+ text-overflow: ellipsis;
+ }
+ .nav-list a:hover {
+ text-decoration: none;
+ }
+ .nav-list .item.error a {
+ color: #BD362F;
+ }
+ .nav-list .item.active.error a {
+ color: #fff;
+ background: #BD362F;
+ }
+ .nav-list .item.empty a {
+ color: #f39c12;
+ }
+ .nav-list .item.active.empty a {
+ color: #fff;
+ background: #f39c12;
+ }
+
+ .nav-list .nav-header {
+ padding: 0 10px;
+ background: #1a1a1a;
+ border-bottom: 1px solid #2f2f2f;
+ font-weight: bold;
+ }
+ .nav-list .separator {
+ display: block;
+ height: 0;
+ margin: 5px 0;
+ border-bottom: 1px solid #2f2f2f;
+ }
+
+ .nav-list .nav-form {
+ padding: 3px;
+ text-align: center;
+ }
+
+.nav-head {
+ display: block;
+ margin: 0;
+ background: linear-gradient(to bottom, #fff, #f0f0f0);
+ border-bottom: 1px solid #2f2f2f;
+ text-align: right;
+}
+ .nav-head .item {
+ display: inline-block;
+ padding: 5px 10px;
+ }
+
+/* HORIZONTAL-LIST */
+.horizontal-list {
+ display: table;
+ table-layout: fixed;
+ margin: 0;
+ padding: 0;
+ width: 100%;
+}
+ .horizontal-list .item {
+ display: table-cell;
+ vertical-align: middle;
+ }
+
+/* DROPDOWN */
+.dropdown {
+ position: relative;
+ display: inline-block;
+}
+ .dropdown-target {
+ display: none;
+ }
+
+ .dropdown-menu {
+ display: none;
+ min-width: 200px;
+ margin: 5px 0 0;
+ padding: 5px 0;
+ position: absolute;
+ right: 0px;
+ background: #1a1a1a;
+ border: 1px solid #888;
+ border-radius: 5px;
+ text-align: left;
+ }
+ .dropdown-menu:after {
+ content: "";
+ position: absolute;
+ top: -6px;
+ right: 13px;
+ width: 10px;
+ height: 10px;
+ background: #1a1a1a;
+ border-top: 1px solid #888;
+ border-left: 1px solid #888;
+ z-index: -10;
+ transform: rotate(45deg);
+ }
+ .dropdown-header {
+ display: block;
+ padding: 0 5px;
+ color: #888;
+ font-weight: bold;
+ font-size: 14px;
+ line-height: 30px;
+ }
+ .dropdown-menu .item {
+ display: block;
+ height: 30px;
+ font-size: 90%;
+ line-height: 30px;
+ }
+ .dropdown-menu > .item > a {
+ display: block;
+ padding: 0 25px;
+ line-height: 30px;
+ }
+ .dropdown-menu > .item:hover {
+ background: #26303F;
+ color: #888;
+ }
+ .dropdown-menu > .item[aria-checked="true"] > a:before {
+ content: '✓ ';
+ font-weight: bold;
+ margin: 0 0 0 -1.2em;
+ padding: 0 0.2em 0 0;
+ }
+ .dropdown-menu > .item:hover > a {
+ color: #888;
+ text-decoration: none;
+ }
+ .dropdown-menu .input {
+ display: block;
+ height: 40px;
+ font-size: 90%;
+ line-height: 30px;
+ }
+ .dropdown-menu .input select,
+ .dropdown-menu .input input {
+ display: block;
+ height: 20px;
+ width: 95%;
+ margin: auto;
+ padding: 2px 5px;
+ border-radius: 3px;
+ }
+ .dropdown-menu .input select {
+ width: 70%;
+ height: auto;
+ }
+ .dropdown-menu .separator {
+ display: block;
+ height: 0;
+ margin: 5px 0;
+ border-bottom: 1px solid #888;
+ }
+ .dropdown-target:target ~ .dropdown-menu {
+ display: block;
+ z-index: 10;
+ }
+ .dropdown-close {
+ display: inline;
+ }
+ .dropdown-close a {
+ font-size: 0;
+ position: fixed;
+ top: 0; bottom: 0;
+ left: 0; right: 0;
+ display: block;
+ z-index: -10;
+ }
+
+/* ALERTS */
+.alert {
+ display: block;
+ width: 90%;
+ margin: 15px auto;
+ padding: 10px 15px;
+ background: #1a1a1a;
+ border: 1px solid #ccc;
+ border-right: 1px solid #aaa;
+ border-bottom: 1px solid #aaa;
+ border-radius: 5px;
+ color: #aaa;
+}
+ .alert-head {
+ margin: 0;
+ font-weight: bold;
+ font-size: 110%;
+ }
+ .alert > a {
+ color: inherit;
+ text-decoration: underline;
+ }
+ .alert-warn {
+ border: 1px solid #c95;
+ color: #c95;
+ }
+ .alert-success {
+ border: 1px solid #484;
+ color: #484;
+ }
+ .alert-error {
+ border: 1px solid #844;
+ color: #844;
+ }
+
+/* ICÔNES */
+.icon {
+ display: inline-block;
+ width: 16px;
+ height: 16px;
+ vertical-align: middle;
+ line-height: 16px;
+}
+
+/* Prompt (centré) */
+.prompt > h1, .prompt > p {
+ text-align:center;
+}
+.prompt > form {
+ margin:1em auto 2.5em auto;
+ width:10em;
+}
+.prompt .btn {
+ display:block;
+ margin:.5em auto;
+}
+.prompt input {
+ margin:.4em auto 1.1em auto;
+ width:99%;
+}
diff --git a/p/themes/Dark/loader.gif b/p/themes/Dark/loader.gif
new file mode 100644
index 000000000..86022be71
--- /dev/null
+++ b/p/themes/Dark/loader.gif
Binary files differ
diff --git a/p/themes/Dark/metadata.json b/p/themes/Dark/metadata.json
new file mode 100644
index 000000000..27cae27df
--- /dev/null
+++ b/p/themes/Dark/metadata.json
@@ -0,0 +1,7 @@
+{
+ "name": "Dark",
+ "author": "AD",
+ "description": "Le coté obscur du thème “Origine”",
+ "version": 0.1,
+ "files": ["global.css", "freshrss.css"]
+}
diff --git a/public/themes/flat-design/freshrss.css b/p/themes/Flat/freshrss.css
index 2b3cfd948..19f5967ea 100644
--- a/public/themes/flat-design/freshrss.css
+++ b/p/themes/Flat/freshrss.css
@@ -1,3 +1,5 @@
+@charset "UTF-8";
+
/* STRUCTURE */
body {
background: #fafafa;
@@ -19,8 +21,10 @@ body {
width: 250px;
white-space: nowrap;
}
- .header > .item.title .logo {
+ .logo {
display: inline-block;
+ font-size: 48px;
+ height: 32px;
width: 32px;
padding: 10px;
}
@@ -28,12 +32,8 @@ body {
display: inline-block;
margin: 0;
}
- .header > .item.title a:hover {
- text-decoration: none;
- }
.header > .item.search input {
width: 230px;
- transition: width 200ms linear;
}
.header .item.search input:focus {
width: 330px;
@@ -42,6 +42,10 @@ body {
width: 100px;
}
+.item a:hover {
+ text-decoration: none;
+}
+
#global {
display: table;
width: 100%;
@@ -80,6 +84,9 @@ body {
text-align: center;
padding: 5px 0;
}
+ .nav_menu .search {
+ display:none;
+ }
.favicon {
height: 16px;
@@ -161,17 +168,16 @@ body {
.categories .feeds .dropdown-menu:after {
left: 2px;
}
- .categories .feeds .item .dropdown-toggle i {
- background-image: none;
+ .categories .feeds .item .dropdown-toggle > .icon {
+ visibility: hidden;
cursor: pointer;
}
- .categories .feeds .item .dropdown-target:target ~ .dropdown-toggle i,
- .categories .feeds .item:hover .dropdown-toggle i,
- .categories .feeds .item.active .dropdown-toggle i {
- background-image: url("icons/configure.png");
- background-image: url("icons/configure.svg");
+ .categories .feeds .item .dropdown-target:target ~ .dropdown-toggle > .icon,
+ .categories .feeds .item:hover .dropdown-toggle > .icon,
+ .categories .feeds .item.active .dropdown-toggle > .icon {
background-color: #95a5a6;
border-radius: 3px;
+ visibility: visible;
}
.categories .btn:hover .notRead,
.categories .btn.active .notRead {
@@ -210,11 +216,29 @@ body {
z-index: -10;
}
+#new-article {
+ display: none;
+ min-height: 40px;
+ background: #3498db;
+ text-align: center;
+}
+ #new-article:hover {
+ background: #2980b9;
+ }
+ #new-article > a {
+ display: block;
+ line-height: 40px;
+ color: #fff;
+ font-weight: bold;
+ }
+ #new-article > a:hover {
+ text-decoration: none;
+ }
+
.flux {
border-left: 3px solid #ecf0f1;
}
- .flux.active {
- border-left-color: #3498db;
+ .flux:hover {
background: #fff;
}
.flux.not_read {
@@ -225,105 +249,62 @@ body {
border-left-color: #FFC300;
background: #FFF6DA;
}
+ .flux.current {
+ border-left-color: #3498db;
+ background: #fff;
+ }
+
+ .horizontal-list > .item:not(.title):not(.website) > a {
+ display: block;
+ }
.flux_header {
+ background: inherit;
height: 25px;
font-size: 12px;
- line-height: 25px;
border-top: 1px solid #ecf0f1;
+ cursor: pointer;
}
- .item.manage {
- width: 40px;
+ .flux .item {
+ line-height: 40px;
white-space: nowrap;
- font-size: 0px;
- text-align: center;
}
- .read {
- display: inline-block;
- width: 40px;
- height: 40px;
- background: url("../icons/read.png") center center no-repeat;
- background: url("../icons/read.svg") center center no-repeat;
- vertical-align: middle;
- }
- .read:hover {
- text-decoration: none;
- }
- .flux.not_read .read {
- background: url("../icons/unread.png") center center no-repeat;
- background: url("../icons/unread.svg") center center no-repeat;
- }
- .bookmark {
- display: inline-block;
- width: 40px;
- height: 40px;
- background: url("../icons/non-starred.png") center center no-repeat;
- background: url("../icons/non-starred.svg") center center no-repeat;
- vertical-align: middle;
- }
- .bookmark:hover {
- text-decoration: none;
- }
- .flux.favorite .bookmark {
- background: url("../icons/starred.png") center center no-repeat;
- background: url("../icons/starred.svg") center center no-repeat;
- }
- .flux_header .item.website {
- width: 200px;
+ .flux_header > .item {
overflow: hidden;
- white-space: nowrap;
text-overflow: ellipsis;
- line-height: 40px;
}
- .flux_header .item.website .favicon {
+ .flux .item.manage {
+ width: 40px;
+ text-align: center;
+ }
+ .flux .item.website {
+ width: 200px;
+ }
+ .website .favicon {
padding: 5px;
}
- .flux_header .item.website a {
- display: block;
- height: 40px;
- }
- .flux_header .item.title {
- overflow: hidden;
- white-space: nowrap;
- text-overflow: ellipsis;
- cursor: pointer;
+ .flux .item.title {
+ background: inherit;
}
- .flux_header .item.title a {
+ .flux .item.title a {
color: #333;
outline: none;
}
- .flux_header .item.title a:hover {
- text-decoration: none
- }
- .flux.not_read .flux_header .item.title {
+ .flux.current .item.title,
+ .flux.not_read .item.title {
font-weight: bold;
}
- .item.date {
- width: 200px;
- overflow: hidden;
+ .flux .item.date {
+ width: 145px;
padding:0 5px 0 0;
- white-space: nowrap;
- text-overflow: ellipsis;
text-align: right;
font-size: 10px;
color: #666;
- cursor: pointer;
}
- .item.link {
+ .link {
width: 40px;
text-align: center;
}
- .item.link a {
- display: inline-block;
- width: 40px;
- height: 40px;
- background: url("../icons/link.png") center center no-repeat;
- background: url("../icons/link.svg") center center no-repeat;
- vertical-align: middle;
- }
- .item.link a:hover {
- text-decoration: none;
- }
#stream.reader .flux {
position: relative;
@@ -333,8 +314,6 @@ body {
color: #34495e;
font-size: 120%;
}
- #stream.reader .flux a {
- }
#stream.reader .flux .author {
margin: 0 0 10px;
font-size: 90%;
@@ -397,19 +376,20 @@ body {
}
.content {
- min-height: 300px;
+ min-height: 150px;
max-width: 550px;
margin: 0 auto;
padding: 20px 10px;
line-height: 170%;
word-wrap: break-word;
}
- .content .title {
- margin: 0 0 5px;
- }
.content h1, .content h2, .content h3 {
margin: 20px 0 5px;
}
+ .content > .title {
+ font-size: x-large;
+ margin: 0;
+ }
.content p {
margin: 0 0 20px;
@@ -529,7 +509,6 @@ body {
.pagination .item a:hover {
color: #ecf0f1;
background: #34495e;
- text-decoration: none;
}
#nav_entries {
@@ -563,24 +542,27 @@ body {
font-size: 0;
}
-.bigMarkAsRead {
+#bigMarkAsRead {
background: #ecf0f1;
- cursor: pointer;
- height: 300px;
+ display: block;
+ font-style: normal;
+ padding: 32px 0 64px 0;
+ text-align: center;
+ text-decoration: none;
text-shadow: 0 -1px 0 #aaa;
}
-.bigMarkAsRead:hover {
- background: #34495e;
- color: #fff;
-}
-.bigTick {
- font-size: 72pt;
- margin: 75px 0 10px 0;
-}
+ #bigMarkAsRead:hover {
+ background: #34495e;
+ color: #fff;
+ }
+ .bigTick {
+ font-size: 72pt;
+ line-height: 1.6em;
+ }
/*** NOTIFICATION ***/
.notification {
- position: fixed;
+ position: absolute;
top: 10px;
left: 25%; right: 25%;
min-height: 30px;
@@ -656,21 +638,25 @@ body {
color: #666;
font-size: 90%;
}
- .log .date {
+ .log>.date {
margin: 0 10px 0 0;
padding: 5px 10px;
border-radius: 20px;
}
- .log.error .date {
+ .log.error>.date {
background: #e74c3c;
color: #fff;
}
- .log.warning .date {
+ .log.warning>.date {
background: #f39c12;
}
- .log.notice .date {
+ .log.notice>.date {
background: #ecf0f1;
}
+ .log.debug>.date {
+ background: #111;
+ color: #eee;
+ }
.form-group table {
border-collapse:collapse;
@@ -683,6 +669,18 @@ body {
padding:.5em;
}
+select.number option {
+ text-align:right;
+}
+
+@media(min-width: 841px) {
+ .flux:not(.current):hover .item.title {
+ max-width: calc(100% - 580px);
+ padding-right: 1.5em;
+ position: absolute;
+ }
+}
+
@media(max-width: 840px) {
.header,
.aside .btn-important,
@@ -703,10 +701,6 @@ body {
display: block;
}
- .content {
- font-size: 120%;
- }
-
.pagination {
margin: 0 0 40px;
}
@@ -766,6 +760,17 @@ body {
.nav_menu .stick .btn {
margin: 5px 0;
}
+ .nav_menu .search {
+ display: inline-block;
+ max-width: 97%;
+ }
+ .nav_menu .search input {
+ max-width: 97%;
+ width: 90px;
+ }
+ .nav_menu .search input:focus {
+ width: 400px;
+ }
#panel {
left: 5px; right: 5px;
@@ -793,3 +798,88 @@ body {
-webkit-transform: rotate(45deg);
-ms-transform: rotate(45deg);
}
+
+input.extend {
+ -moz-transition: width 200ms linear;
+ -webkit-transition: width 200ms linear;
+ -o-transition: width 200ms linear;
+ -ms-transition: width 200ms linear;
+}
+
+@media print {
+ .header,
+ .aside,
+ .nav_menu,
+ .day,
+ .flux_header,
+ .flux_content .bottom,
+ .pagination {
+ display: none;
+ }
+
+ html, body {
+ background: #fff;
+ color: #000;
+ font-family: Serif;
+ font-size: 12pt;
+ }
+
+ #global,
+ .flux_content {
+ display: block !important;
+ }
+
+ .flux_content .content {
+ width: 100% !important;
+ text-align: justify;
+ }
+
+ .flux_content .content a {
+ color: #000;
+ }
+ .flux_content .content a:after {
+ content: " (" attr(href) ") ";
+ text-decoration: underline;
+ }
+}
+
+.stat {
+ border:1px solid #aaa;
+ border-radius:10px;
+ box-shadow:2px 2px 5px #aaa;
+ margin:10px 0;
+ padding:0 5px;
+}
+.stat > h2 {
+ border-bottom:1px solid #aaa;
+ margin:0 -5px;
+ padding-left:5px;
+}
+.stat > div {
+ margin:5px 0;
+}
+.stat > table {
+ border-collapse:collapse;
+ margin:5px 0;
+ width:100%;
+}
+.stat > table > thead > tr {
+ border-bottom:2px solid #aaa;
+}
+.stat > table > tbody > tr {
+ border-bottom:1px solid #aaa;
+}
+.stat > table > tbody > tr:last-child {
+ border-bottom:0;
+}
+.stat > table th, .stat > table td {
+ border-left:2px solid #aaa;
+ padding:5px;
+}
+.stat > table th:first-child, .stat > table td:first-child {
+ border-left:0;
+}
+.stat > table td.numeric{
+ margin:5px 0;
+ text-align:center;
+} \ No newline at end of file
diff --git a/public/themes/flat-design/global.css b/p/themes/Flat/global.css
index 1952cc097..e3baa26ab 100644
--- a/public/themes/flat-design/global.css
+++ b/p/themes/Flat/global.css
@@ -1,3 +1,5 @@
+@charset "UTF-8";
+
/* FONTS */
@font-face {
font-family: "OpenSans";
@@ -86,6 +88,13 @@ label {
font-weight: bold;
color: #444;
}
+input {
+ width: 180px;
+}
+textarea {
+ width: 360px;
+ height: 100px;
+}
input, select, textarea {
display: inline-block;
max-width: 100%;
@@ -99,6 +108,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;
@@ -108,6 +120,14 @@ input, select, textarea {
color: #333;
border-color: #2980b9;
}
+ input:invalid, select:invalid {
+ border-color: red;
+ box-shadow: 0 0 2px 1px red;
+ }
+ input:focus.extend {
+ width: 300px;
+ transition: width 200ms linear;
+ }
.form-group {
margin: 5px 0;
@@ -372,22 +392,28 @@ input, select, textarea {
font-size: 14px;
line-height: 30px;
}
- .dropdown-menu .item {
+ .dropdown-menu > .item {
display: block;
height: 30px;
font-size: 90%;
line-height: 30px;
}
- .dropdown-menu .item > * {
+ .dropdown-menu > .item > a {
display: block;
padding: 0 25px;
line-height: 30px;
}
- .dropdown-menu .item:hover {
+ .dropdown-menu > .item:hover > a {
background: #2980b9;
color: #fff;
}
- .dropdown-menu .item:hover > * {
+ .dropdown-menu > .item[aria-checked="true"] > a:before {
+ content: '✓ ';
+ font-weight: bold;
+ margin: 0 0 0 -1.2em;
+ padding: 0 0.2em 0 0;
+ }
+ .dropdown-menu > .item:hover > a {
color: #fff;
text-decoration: none;
}
@@ -427,6 +453,7 @@ input, select, textarea {
display: inline;
}
.dropdown-close a {
+ font-size: 0;
position: fixed;
top: 0; bottom: 0;
left: 0; right: 0;
@@ -453,6 +480,10 @@ input, select, textarea {
font-weight: bold;
font-size: 110%;
}
+ .alert > a {
+ color: inherit;
+ text-decoration: underline;
+ }
.alert-warn {
background: #ffe;
border: 1px solid #eeb;
@@ -469,100 +500,28 @@ input, select, textarea {
color: #844;
}
-/* ICONES */
+/* ICÔNES */
.icon {
display: inline-block;
width: 16px;
height: 16px;
vertical-align: middle;
line-height: 16px;
- background: center center no-repeat;
}
- .i_refresh {
- background-image: url("icons/refresh.png");
- background-image: url("icons/refresh.svg");
- }
- .i_bookmark {
- background-image: url("../icons/starred.png");
- background-image: url("../icons/starred.svg");
- }
- .i_not_bookmark {
- background-image: url("../icons/unstarred.png");
- background-image: url("../icons/unstarred.svg");
- }
- .i_read {
- background-image: url("../icons/read.png");
- background-image: url("../icons/read.svg");
- }
- .i_unread {
- background-image: url("../icons/unread.png");
- background-image: url("../icons/unread.svg");
- }
- .i_all {
- background-image: url("icons/all.png");
- background-image: url("icons/all.svg");
- }
- .i_close {
- background-image: url("icons/close.png");
- background-image: url("icons/close.svg");
- }
- .i_search {
- background-image: url("icons/search.png");
- background-image: url("icons/search.svg");
- }
- .i_configure {
- background-image: url("icons/configure.png");
- background-image: url("icons/configure.svg");
- }
- .i_login {
- background-image: url("../icons/login.png");
- background-image: url("../icons/login.svg");
- }
- .i_logout {
- background-image: url("../icons/logout.png");
- background-image: url("../icons/logout.svg");
- }
- .i_add {
- background-image: url("icons/add.png");
- background-image: url("icons/add.svg");
- }
- .i_link {
- background-image: url("../icons/link.png");
- background-image: url("../icons/link.svg");
- }
- .i_down {
- background-image: url("icons/down.png");
- background-image: url("icons/down.svg");
- }
- .i_up {
- background-image: url("icons/up.png");
- background-image: url("icons/up.svg");
- }
- .i_next {
- background-image: url("icons/next.png");
- background-image: url("icons/next.svg");
- }
- .i_prev {
- background-image: url("icons/previous.png");
- background-image: url("icons/previous.svg");
- }
- .i_help {
- background-image: url("../icons/help.png");
- background-image: url("../icons/help.svg");
- }
- .i_category {
- background-image: url("../icons/category-white.png");
- background-image: url("../icons/category-white.svg");
- }
- .i_rss {
- background-image: url("../icons/rss.png");
- background-image: url("../icons/rss.svg");
- }
- .i_share {
- background-image: url("../icons/share.png");
- background-image: url("../icons/share.svg");
- }
- .i_tag {
- background-image: url("../icons/tag.png");
- background-image: url("../icons/tag.svg");
- }
+
+/* Prompt (centré) */
+.prompt > h1, .prompt > p {
+ text-align:center;
+}
+.prompt > form {
+ margin:1em auto 2.5em auto;
+ width:10em;
+}
+.prompt .btn {
+ display:block;
+ margin:.5em auto;
+}
+.prompt input {
+ margin:.4em auto 1.1em auto;
+ width:99%;
+}
diff --git a/public/themes/flat-design/icons/add.svg b/p/themes/Flat/icons/add.svg
index 15767a3ad..15767a3ad 100644
--- a/public/themes/flat-design/icons/add.svg
+++ b/p/themes/Flat/icons/add.svg
diff --git a/public/themes/flat-design/icons/all.svg b/p/themes/Flat/icons/all.svg
index d20e0f5bf..d20e0f5bf 100644
--- a/public/themes/flat-design/icons/all.svg
+++ b/p/themes/Flat/icons/all.svg
diff --git a/public/themes/icons/category-white.svg b/p/themes/Flat/icons/category.svg
index 5e61aeea5..5e61aeea5 100644
--- a/public/themes/icons/category-white.svg
+++ b/p/themes/Flat/icons/category.svg
diff --git a/public/themes/flat-design/icons/close.svg b/p/themes/Flat/icons/close.svg
index 629fda7ff..629fda7ff 100644
--- a/public/themes/flat-design/icons/close.svg
+++ b/p/themes/Flat/icons/close.svg
diff --git a/public/themes/flat-design/icons/configure.svg b/p/themes/Flat/icons/configure.svg
index 969c5719f..969c5719f 100644
--- a/public/themes/flat-design/icons/configure.svg
+++ b/p/themes/Flat/icons/configure.svg
diff --git a/public/themes/flat-design/icons/down.svg b/p/themes/Flat/icons/down.svg
index 31730626f..31730626f 100644
--- a/public/themes/flat-design/icons/down.svg
+++ b/p/themes/Flat/icons/down.svg
diff --git a/public/themes/flat-design/icons/next.svg b/p/themes/Flat/icons/next.svg
index d75cc40f5..d75cc40f5 100644
--- a/public/themes/flat-design/icons/next.svg
+++ b/p/themes/Flat/icons/next.svg
diff --git a/public/themes/flat-design/icons/previous.svg b/p/themes/Flat/icons/prev.svg
index 9ba03ceb2..9ba03ceb2 100644
--- a/public/themes/flat-design/icons/previous.svg
+++ b/p/themes/Flat/icons/prev.svg
diff --git a/public/themes/flat-design/icons/refresh.svg b/p/themes/Flat/icons/refresh.svg
index 8f95bf443..8f95bf443 100644
--- a/public/themes/flat-design/icons/refresh.svg
+++ b/p/themes/Flat/icons/refresh.svg
diff --git a/public/themes/flat-design/icons/search.svg b/p/themes/Flat/icons/search.svg
index bca7571b4..bca7571b4 100644
--- a/public/themes/flat-design/icons/search.svg
+++ b/p/themes/Flat/icons/search.svg
diff --git a/public/themes/flat-design/icons/up.svg b/p/themes/Flat/icons/up.svg
index 3ab11b168..3ab11b168 100644
--- a/public/themes/flat-design/icons/up.svg
+++ b/p/themes/Flat/icons/up.svg
diff --git a/public/themes/flat-design/loader.gif b/p/themes/Flat/loader.gif
index ce36565b3..ce36565b3 100644
--- a/public/themes/flat-design/loader.gif
+++ b/p/themes/Flat/loader.gif
Binary files differ
diff --git a/public/themes/flat-design/metadata.json b/p/themes/Flat/metadata.json
index 6b94d11c2..6b94d11c2 100644
--- a/public/themes/flat-design/metadata.json
+++ b/p/themes/Flat/metadata.json
diff --git a/public/themes/default/freshrss.css b/p/themes/Origine/freshrss.css
index ef7f098af..85a23140c 100644
--- a/public/themes/default/freshrss.css
+++ b/p/themes/Origine/freshrss.css
@@ -1,3 +1,5 @@
+@charset "UTF-8";
+
/* STRUCTURE */
.header {
display: table;
@@ -16,8 +18,11 @@
width: 250px;
white-space: nowrap;
}
- .header > .item.title .logo {
+ .logo {
display: inline-block;
+ font-size: 48px;
+ height: 32px;
+ width: 32px;
padding: 10px;
}
.header > .item.title h1 {
@@ -25,12 +30,8 @@
margin: 0;
text-shadow: 1px -1px 0 #ccc;
}
- .header > .item.title a:hover {
- text-decoration: none;
- }
.header > .item.search input {
width: 230px;
- transition: width 200ms linear;
}
.header .item.search input:focus {
width: 330px;
@@ -39,6 +40,10 @@
width: 100px;
}
+.item a:hover {
+ text-decoration: none;
+}
+
#global {
display: table;
width: 100%;
@@ -70,11 +75,6 @@
right: 33px;
}
- .aside.aside_flux .i_category {
- background-image: url("../icons/category-white.png");
- background-image: url("../icons/category-white.svg");
- }
-
.nav-login {
display: none;
}
@@ -86,6 +86,9 @@
text-align: center;
padding: 5px 0;
}
+ .nav_menu .search {
+ display:none;
+ }
.favicon {
height: 16px;
@@ -177,17 +180,16 @@
.categories .feeds .dropdown-menu:after {
left: 2px;
}
- .categories .feeds .item .dropdown-toggle i {
- background-image: none;
+ .categories .feeds .item .dropdown-toggle > .icon {
+ visibility: hidden;
cursor: pointer;
}
- .categories .feeds .item .dropdown-target:target ~ .dropdown-toggle i,
- .categories .feeds .item:hover .dropdown-toggle i,
- .categories .feeds .item.active .dropdown-toggle i {
- background-image: url("../icons/configure.png");
- background-image: url("../icons/configure.svg");
+ .categories .feeds .item .dropdown-target:target ~ .dropdown-toggle > .icon,
+ .categories .feeds .item:hover .dropdown-toggle > .icon,
+ .categories .feeds .item.active .dropdown-toggle > .icon {
background-color: #fff;
border-radius: 3px;
+ visibility: visible;
}
.post {
@@ -207,7 +209,7 @@
border-top: 1px solid #aaa;
border-bottom: 1px solid #aaa;
}
- .day:first-child {
+ #new-article + .day {
border-top: none;
}
.day .name {
@@ -227,6 +229,25 @@
text-align: right;
}
+#new-article {
+ display: none;
+ min-height: 40px;
+ background: #0084CC;
+ text-align: center;
+}
+ #new-article:hover {
+ background: #0066CC;
+ }
+ #new-article > a {
+ display: block;
+ line-height: 40px;
+ color: #fff;
+ font-weight: bold;
+ }
+ #new-article > a:hover {
+ text-decoration: none;
+ }
+
.flux {
border-left: 3px solid #aaa;
background: #fafafa;
@@ -234,10 +255,6 @@
.flux:hover {
background: #fff;
}
- .flux.active {
- border-left: 3px solid #0062BE;
- background: #fff;
- }
.flux.not_read {
border-left: 3px solid #FF5300;
background: #FFF3ED;
@@ -246,105 +263,62 @@
border-left: 3px solid #FFC300;
background: #FFF6DA;
}
+ .flux.current {
+ border-left: 3px solid #0062BE;
+ background: #fff;
+ }
+
+ .horizontal-list > .item:not(.title):not(.website) > a {
+ display: block;
+ }
.flux_header {
+ background: inherit;
height: 25px;
font-size: 12px;
- line-height: 25px;
border-top: 1px solid #ddd;
+ cursor: pointer;
}
- .item.manage {
- width: 40px;
+ .flux .item {
+ line-height: 40px;
white-space: nowrap;
- font-size: 0px;
- text-align: center;
}
- .read {
- display: inline-block;
- width: 40px;
- height: 40px;
- background: url("../icons/read.png") center center no-repeat;
- background: url("../icons/read.svg") center center no-repeat;
- vertical-align: middle;
- }
- .read:hover {
- text-decoration: none;
- }
- .flux.not_read .read {
- background: url("../icons/unread.png") center center no-repeat;
- background: url("../icons/unread.svg") center center no-repeat;
- }
- .bookmark {
- display: inline-block;
- width: 40px;
- height: 40px;
- background: url("../icons/non-starred.png") center center no-repeat;
- background: url("../icons/non-starred.svg") center center no-repeat;
- vertical-align: middle;
- }
- .bookmark:hover {
- text-decoration: none;
- }
- .flux.favorite .bookmark {
- background: url("../icons/starred.png") center center no-repeat;
- background: url("../icons/starred.svg") center center no-repeat;
- }
- .flux_header .item.website {
- width: 200px;
+ .flux_header > .item {
overflow: hidden;
- white-space: nowrap;
text-overflow: ellipsis;
- line-height: 40px;
}
- .flux_header .item.website .favicon {
+ .flux .item.manage {
+ width: 40px;
+ text-align: center;
+ }
+ .flux .item.website {
+ width: 200px;
+ }
+ .website .favicon {
padding: 5px;
}
- .flux_header .item.website a {
- display: block;
- height: 40px;
- }
- .flux_header .item.title {
- overflow: hidden;
- white-space: nowrap;
- text-overflow: ellipsis;
- cursor: pointer;
+ .flux .item.title {
+ background: inherit;
}
- .flux_header .item.title a {
+ .flux .item.title a {
color: #000;
outline: none;
}
- .flux_header .item.title a:hover {
- text-decoration: none
- }
- .flux.not_read .flux_header .item.title {
+ .flux.not_read .item.title,
+ .flux.current .item.title {
font-weight: bold;
}
- .item.date {
- width: 200px;
- overflow: hidden;
+ .flux .item.date {
+ width: 145px;
padding:0 5px 0 0;
- white-space: nowrap;
- text-overflow: ellipsis;
text-align: right;
font-size: 10px;
color: #666;
- cursor: pointer;
}
- .item.link {
+ .link {
width: 40px;
text-align: center;
}
- .item.link a {
- display: inline-block;
- width: 40px;
- height: 40px;
- background: url("../icons/link.png") center center no-repeat;
- background: url("../icons/link.svg") center center no-repeat;
- vertical-align: middle;
- }
- .item.link a:hover {
- text-decoration: none;
- }
#stream.reader .flux {
padding: 0 0 30px;
@@ -416,19 +390,20 @@
}
.content {
- min-height: 300px;
+ min-height: 150px;
max-width: 550px;
margin: 0 auto;
padding: 20px 10px;
line-height: 170%;
word-wrap: break-word;
}
- .content .title {
- margin: 0 0 5px;
- }
.content h1, .content h2, .content h3 {
margin: 20px 0 5px;
}
+ .content > .title {
+ font-size: x-large;
+ margin: 0;
+ }
.content p {
margin: 0 0 20px;
@@ -576,23 +551,26 @@
font-size: 0;
}
-.bigMarkAsRead {
- cursor: pointer;
- height: 300px;
+#bigMarkAsRead {
+ display: block;
+ font-style: normal;
+ padding: 32px 0 64px 0;
+ text-align: center;
+ text-decoration: none;
text-shadow: 0 -1px 0 #aaa;
}
-.bigMarkAsRead:hover {
- background: #333;
- color: #fff;
-}
-.bigTick {
- font-size: 72pt;
- margin: 75px 0 10px 0;
-}
+ #bigMarkAsRead:hover {
+ background: #333;
+ color: #fff;
+ }
+ .bigTick {
+ font-size: 72pt;
+ line-height: 1.6em;
+ }
/*** NOTIFICATION ***/
.notification {
- position: fixed;
+ position: absolute;
top: 10px;
left: 25%; right: 25%;
min-height: 30px;
@@ -675,6 +653,10 @@
background: #f4f4f4;
color: #aaa;
}
+ .log.debug {
+ background: #111;
+ color: #eee;
+ }
.form-group table {
border-collapse:collapse;
@@ -688,6 +670,18 @@
padding:.5em;
}
+select.number option {
+ text-align:right;
+}
+
+@media(min-width: 841px) {
+ .flux:not(.current):hover .item.title {
+ max-width: calc(100% - 580px);
+ padding-right: 1.5em;
+ position: absolute;
+ }
+}
+
@media(max-width: 840px) {
.header,
.aside .btn-important,
@@ -708,10 +702,6 @@
display: block;
}
- .content {
- font-size: 120%;
- }
-
.pagination {
margin: 0 0 40px;
}
@@ -768,6 +758,17 @@
.nav_menu .stick .btn {
margin: 5px 0;
}
+ .nav_menu .search {
+ display: inline-block;
+ max-width: 97%;
+ }
+ .nav_menu .search input {
+ max-width: 97%;
+ width: 90px;
+ }
+ .nav_menu .search input:focus {
+ width: 400px;
+ }
#panel {
left: 5px; right: 5px;
@@ -845,9 +846,9 @@
background: -ms-linear-gradient(top, #fff 0%, #f0f0f0 100%);
}
-.header > .item.search input {
+input.extend {
-moz-transition: width 200ms linear;
- -webkit-transition: width 200ms linear;
+ -webkit-transition: width 200ms linear;
-o-transition: width 200ms linear;
-ms-transition: width 200ms linear;
}
@@ -855,8 +856,86 @@
@media(max-width: 840px) {
.aside {
-moz-transition: width 200ms linear;
- -webkit-transition: width 200ms linear;
+ -webkit-transition: width 200ms linear;
-o-transition: width 200ms linear;
-ms-transition: width 200ms linear;
}
}
+
+@media print {
+ .header,
+ .aside,
+ .nav_menu,
+ .day,
+ .flux_header,
+ .flux_content .bottom,
+ .pagination {
+ display: none;
+ }
+
+ html, body {
+ background: #fff;
+ color: #000;
+ font-family: Serif;
+ font-size: 12pt;
+ }
+
+ #global,
+ .flux_content {
+ display: block !important;
+ }
+
+ .flux_content .content {
+ width: 100% !important;
+ text-align: justify;
+ }
+
+ .flux_content .content a {
+ color: #000;
+ }
+ .flux_content .content a:after {
+ content: " (" attr(href) ") ";
+ text-decoration: underline;
+ }
+}
+
+.stat {
+ border:1px solid #aaa;
+ border-radius:10px;
+ box-shadow:2px 2px 5px #aaa;
+ margin:10px 0;
+ padding:0 5px;
+}
+.stat > h2 {
+ border-bottom:1px solid #aaa;
+ margin:0 -5px;
+ padding-left:5px;
+}
+.stat > div {
+ margin:5px 0;
+}
+.stat > table {
+ border-collapse:collapse;
+ margin:5px 0;
+ width:100%;
+}
+.stat > table > thead > tr {
+ border-bottom:2px solid #aaa;
+}
+.stat > table > tbody > tr {
+ border-bottom:1px solid #aaa;
+}
+.stat > table > tbody > tr:last-child {
+ border-bottom:0;
+}
+.stat > table th, .stat > table td {
+ border-left:2px solid #aaa;
+ padding:5px;
+}
+.stat > table th:first-child, .stat > table td:first-child {
+ border-left:0;
+}
+.stat > table td.numeric{
+ margin:5px 0;
+ text-align:center;
+} \ No newline at end of file
diff --git a/public/themes/default/global.css b/p/themes/Origine/global.css
index 94c11b957..58a3a52b1 100644
--- a/public/themes/default/global.css
+++ b/p/themes/Origine/global.css
@@ -1,3 +1,5 @@
+@charset "UTF-8";
+
/* FONTS */
@font-face {
font-family: "OpenSans";
@@ -84,6 +86,13 @@ label {
line-height: 25px;
cursor: pointer;
}
+input {
+ width: 180px;
+}
+textarea {
+ width: 360px;
+ height: 100px;
+}
input, select, textarea {
display: inline-block;
max-width: 100%;
@@ -97,6 +106,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;
@@ -107,6 +119,14 @@ input, select, textarea {
border-color: #33BBFF;
box-shadow: 0 2px 2px #DDDDFF inset;
}
+ input:invalid, select:invalid {
+ border-color: red;
+ box-shadow: 0 0 2px 1px red;
+ }
+ input:focus.extend {
+ width: 300px;
+ transition: width 200ms linear;
+ }
.form-group {
margin: 0;
@@ -170,8 +190,13 @@ input, select, textarea {
}
.stick .btn + .btn,
.stick .btn + input,
+ .stick .btn + .dropdown > .btn,
.stick input + .btn,
- .stick input + input {
+ .stick input + input,
+ .stick input + .dropdown > .btn,
+ .stick .dropdown + .btn,
+ .stick .dropdown + input,
+ .stick .dropdown + .dropdown > .btn {
border-left: none;
}
.stick input + .btn {
@@ -383,22 +408,28 @@ input, select, textarea {
font-size: 14px;
line-height: 30px;
}
- .dropdown-menu .item {
+ .dropdown-menu > .item {
display: block;
height: 30px;
font-size: 90%;
line-height: 30px;
}
- .dropdown-menu .item > * {
+ .dropdown-menu > .item > a {
display: block;
padding: 0 25px;
line-height: 30px;
}
- .dropdown-menu .item:hover {
+ .dropdown-menu > .item:hover {
background: #0062BE;
color: #fff;
}
- .dropdown-menu .item:hover > * {
+ .dropdown-menu > .item[aria-checked="true"] > a:before {
+ content: '✓ ';
+ font-weight: bold;
+ margin: 0 0 0 -1.2em;
+ padding: 0 0.2em 0 0;
+ }
+ .dropdown-menu > .item:hover > a {
color: #fff;
text-decoration: none;
}
@@ -435,6 +466,7 @@ input, select, textarea {
display: inline;
}
.dropdown-close a {
+ font-size: 0;
position: fixed;
top: 0; bottom: 0;
left: 0; right: 0;
@@ -461,6 +493,10 @@ input, select, textarea {
font-weight: bold;
font-size: 110%;
}
+ .alert > a {
+ color: inherit;
+ text-decoration: underline;
+ }
.alert-warn {
background: #ffe;
border: 1px solid #eeb;
@@ -477,108 +513,28 @@ input, select, textarea {
color: #844;
}
-/* ICONES */
+/* ICÔNES */
.icon {
display: inline-block;
width: 16px;
height: 16px;
vertical-align: middle;
line-height: 16px;
- background: center center no-repeat;
}
- .i_refresh {
- background-image: url("../icons/refresh.png");
- background-image: url("../icons/refresh.svg");
- }
- .i_bookmark {
- background-image: url("../icons/starred.png");
- background-image: url("../icons/starred.svg");
- }
- .i_not_bookmark {
- background-image: url("../icons/unstarred.png");
- background-image: url("../icons/unstarred.svg");
- }
- .i_read {
- background-image: url("../icons/read.png");
- background-image: url("../icons/read.svg");
- }
- .i_unread {
- background-image: url("../icons/unread.png");
- background-image: url("../icons/unread.svg");
- }
- .i_all {
- background-image: url("../icons/all.png");
- background-image: url("../icons/all.svg");
- }
- .i_close {
- background-image: url("../icons/close.png");
- background-image: url("../icons/close.svg");
- }
- .i_search {
- background-image: url("../icons/search.png");
- background-image: url("../icons/search.svg");
- }
- .i_configure {
- background-image: url("../icons/configure.png");
- background-image: url("../icons/configure.svg");
- }
- .i_login {
- background-image: url("../icons/login.png");
- background-image: url("../icons/login.svg");
- }
- .i_logout {
- background-image: url("../icons/logout.png");
- background-image: url("../icons/logout.svg");
- }
- .i_add {
- background-image: url("../icons/add.png");
- background-image: url("../icons/add.svg");
- }
- .i_link {
- background-image: url("../icons/link.png");
- background-image: url("../icons/link.svg");
- }
- .i_down {
- background-image: url("../icons/down.png");
- background-image: url("../icons/down.svg");
- }
- .i_up {
- background-image: url("../icons/up.png");
- background-image: url("../icons/up.svg");
- }
- .i_next {
- background-image: url("../icons/next.png");
- background-image: url("../icons/next.svg");
- }
- .i_prev {
- background-image: url("../icons/previous.png");
- background-image: url("../icons/previous.svg");
- }
- .i_help {
- background-image: url("../icons/help.png");
- background-image: url("../icons/help.svg");
- }
- .i_note {
- background-image: url("../icons/note.png");
- background-image: url("../icons/note.svg");
- }
- .i_note_empty {
- background-image: url("../icons/note_empty.png");
- background-image: url("../icons/note_empty.svg");
- }
- .i_category {
- background-image: url("../icons/category.png");
- background-image: url("../icons/category.svg");
- }
- .i_rss {
- background-image: url("../icons/rss.png");
- background-image: url("../icons/rss.svg");
- }
- .i_share {
- background-image: url("../icons/share.png");
- background-image: url("../icons/share.svg");
- }
- .i_tag {
- background-image: url("../icons/tag.png");
- background-image: url("../icons/tag.svg");
- }
+
+/* Prompt (centré) */
+.prompt > h1, .prompt > p {
+ text-align:center;
+}
+.prompt > form {
+ margin:1em auto 2.5em auto;
+ width:10em;
+}
+.prompt .btn {
+ display:block;
+ margin:.5em auto;
+}
+.prompt input {
+ margin:.4em auto 1.1em auto;
+ width:99%;
+}
diff --git a/public/themes/default/loader.gif b/p/themes/Origine/loader.gif
index 5ff26f0e3..5ff26f0e3 100644
--- a/public/themes/default/loader.gif
+++ b/p/themes/Origine/loader.gif
Binary files differ
diff --git a/public/themes/default/metadata.json b/p/themes/Origine/metadata.json
index d316ec517..f93dcbc3f 100644
--- a/public/themes/default/metadata.json
+++ b/p/themes/Origine/metadata.json
@@ -1,5 +1,5 @@
{
- "name": "Default",
+ "name": "Origine",
"author": "Marien Fressinaud",
"description": "Le thème par défaut pour FreshRSS",
"version": 0.1,
diff --git a/public/themes/fonts/openSans.woff b/p/themes/fonts/openSans.woff
index 55b25f867..55b25f867 100644
--- a/public/themes/fonts/openSans.woff
+++ b/p/themes/fonts/openSans.woff
Binary files differ
diff --git a/public/themes/icons/add.svg b/p/themes/icons/add.svg
index 425c9b4aa..425c9b4aa 100644
--- a/public/themes/icons/add.svg
+++ b/p/themes/icons/add.svg
diff --git a/public/themes/icons/all.svg b/p/themes/icons/all.svg
index 2180f7a4b..2180f7a4b 100644
--- a/public/themes/icons/all.svg
+++ b/p/themes/icons/all.svg
diff --git a/public/themes/icons/starred.svg b/p/themes/icons/bookmark.svg
index d6e2cebb5..d6e2cebb5 100644
--- a/public/themes/icons/starred.svg
+++ b/p/themes/icons/bookmark.svg
diff --git a/p/themes/icons/category-white.svg b/p/themes/icons/category-white.svg
new file mode 100644
index 000000000..5e61aeea5
--- /dev/null
+++ b/p/themes/icons/category-white.svg
@@ -0,0 +1,31 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+
+<svg xmlns:cc='http://creativecommons.org/ns#' xmlns:inkscape='http://www.inkscape.org/namespaces/inkscape' xmlns:svg='http://www.w3.org/2000/svg' id='svg7384' xmlns:sodipodi='http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd' sodipodi:docname='folder-symbolic.svg' version='1.1' inkscape:version='0.48.0 r9654' height='16' xmlns:dc='http://purl.org/dc/elements/1.1/' xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns#' xmlns='http://www.w3.org/2000/svg' width='16'>
+ <metadata id='metadata90'>
+ <rdf:RDF>
+ <cc:Work rdf:about=''>
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type rdf:resource='http://purl.org/dc/dcmitype/StillImage'/>
+ <dc:title>Gnome Symbolic Icon Theme</dc:title>
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <sodipodi:namedview inkscape:cy='-173.07332' pagecolor='#555753' borderopacity='1' showborder='false' inkscape:bbox-paths='false' guidetolerance='10' inkscape:window-width='1310' showguides='true' inkscape:object-nodes='true' inkscape:snap-bbox='true' inkscape:pageshadow='2' inkscape:guide-bbox='true' inkscape:snap-nodes='true' bordercolor='#FFFFFF' objecttolerance='10' id='namedview88' showgrid='false' inkscape:window-maximized='0' inkscape:window-x='52' inkscape:snap-global='true' inkscape:window-y='24' gridtolerance='10' inkscape:window-height='690' inkscape:snap-to-guides='true' inkscape:current-layer='layer13' inkscape:zoom='1' inkscape:cx='-157.67647' inkscape:snap-grids='true' inkscape:pageopacity='1'>
+ <inkscape:grid spacingx='1px' spacingy='1px' id='grid4866' empspacing='2' enabled='true' type='xygrid' snapvisiblegridlinesonly='true' visible='true'/>
+ </sodipodi:namedview>
+ <title id='title9167'>Gnome Symbolic Icon Theme</title>
+ <defs id='defs7386'/>
+ <g inkscape:label='status' transform='translate(-442,-176)' inkscape:groupmode='layer' id='layer9' style='display:inline'/>
+ <g inkscape:label='devices' transform='translate(-442,-176)' inkscape:groupmode='layer' id='layer10'/>
+ <g inkscape:label='apps' transform='translate(-442,-176)' inkscape:groupmode='layer' id='layer11'/>
+ <g inkscape:label='actions' transform='translate(-442,-176)' inkscape:groupmode='layer' id='layer12'/>
+ <g inkscape:label='places' transform='translate(-442,-176)' inkscape:groupmode='layer' id='layer13'>
+ <g transform='translate(234.0002,-820)' id='g14154'>
+ <path inkscape:connector-curvature='0' d='m 208.53105,997 c -0.28913,0 -0.53125,0.24212 -0.53125,0.53125 l 0,13.93755 c 0,0.2985 0.23264,0.5312 0.53125,0.5312 l 14.9375,0 c 0.2986,0 0.53125,-0.2326 0.53125,-0.5312 l 0,-8.9376 c 0,-0.2891 -0.24212,-0.5312 -0.53125,-0.5312 l -12.46875,0 0,7.5 c 0,0.277 -0.223,0.5 -0.5,0.5 -0.277,0 -0.5,-0.223 -0.5,-0.5 l 0,-8 c 0,-0.277 0.223,-0.5 0.5,-0.5 l 2.96875,0 8.53125,0 0,-1.4062 c 0,-0.3272 -0.26666,-0.5938 -0.59375,-0.5938 l -7.40625,0 0,-1.46875 C 213.9998,997.2421 213.75768,997 213.46855,997 z' id='rect3845' sodipodi:nodetypes='ccccccccccsccccccccccc' style='fill:#FFFFFF;fill-opacity:1;stroke:none;display:inline'/>
+
+ </g>
+ </g>
+ <g inkscape:label='mimetypes' transform='translate(-442,-176)' inkscape:groupmode='layer' id='layer14'/>
+ <g inkscape:label='emblems' transform='translate(-442,-176)' inkscape:groupmode='layer' id='layer15' style='display:inline'/>
+</svg>
diff --git a/public/themes/icons/category.svg b/p/themes/icons/category.svg
index 71f95490e..71f95490e 100644
--- a/public/themes/icons/category.svg
+++ b/p/themes/icons/category.svg
diff --git a/public/themes/icons/close.svg b/p/themes/icons/close.svg
index c0c786fd6..c0c786fd6 100644
--- a/public/themes/icons/close.svg
+++ b/p/themes/icons/close.svg
diff --git a/public/themes/icons/configure.svg b/p/themes/icons/configure.svg
index 52df8bca7..52df8bca7 100644
--- a/public/themes/icons/configure.svg
+++ b/p/themes/icons/configure.svg
diff --git a/public/themes/icons/down.svg b/p/themes/icons/down.svg
index 06d031fae..06d031fae 100644
--- a/public/themes/icons/down.svg
+++ b/p/themes/icons/down.svg
diff --git a/p/themes/icons/favicon-16-32-48-64.ico b/p/themes/icons/favicon-16-32-48-64.ico
new file mode 100644
index 000000000..90f7d5118
--- /dev/null
+++ b/p/themes/icons/favicon-16-32-48-64.ico
Binary files differ
diff --git a/p/themes/icons/favicon-256.png b/p/themes/icons/favicon-256.png
new file mode 100644
index 000000000..8b1021e1a
--- /dev/null
+++ b/p/themes/icons/favicon-256.png
Binary files differ
diff --git a/p/themes/icons/favicon.svg b/p/themes/icons/favicon.svg
new file mode 100644
index 000000000..a44f0a1c0
--- /dev/null
+++ b/p/themes/icons/favicon.svg
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256">
+ <title>Logo FreshRSS</title>
+
+ <circle fill="#FFF" cx="128" cy="128" r="128"/>
+
+ <circle fill="#0062BE" cx="128" cy="128" r="33"/>
+
+ <g fill="none" stroke="#0062BE" stroke-width="24">
+ <g stroke-opacity="0.3">
+ <path d="M12,128 A116,116 0 1,1 128,244"/>
+ <path d="M54,128 A74,74 0 1,1 128,202"/>
+ </g>
+ <path d="M128,12 A116,116 0 0,1 244,128"/>
+ <path d="M128,54 A74,74 0 0,1 202,128"/>
+ </g>
+</svg>
diff --git a/public/data/grey.gif b/p/themes/icons/grey.gif
index c7212bc1f..c7212bc1f 100644
--- a/public/data/grey.gif
+++ b/p/themes/icons/grey.gif
Binary files differ
diff --git a/public/themes/icons/help.svg b/p/themes/icons/help.svg
index b103ec46d..b103ec46d 100644
--- a/public/themes/icons/help.svg
+++ b/p/themes/icons/help.svg
diff --git a/p/themes/icons/icon.svg b/p/themes/icons/icon.svg
new file mode 100644
index 000000000..742c04b6e
--- /dev/null
+++ b/p/themes/icons/icon.svg
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256">
+ <title>Logo FreshRSS</title>
+
+ <circle fill="#0062BE" cx="128" cy="128" r="33"/>
+
+ <g fill="none" stroke="#0062BE" stroke-width="24">
+ <g stroke-opacity="0.3">
+ <path d="M12,128 A116,116 0 1,1 128,244"/>
+ <path d="M54,128 A74,74 0 1,1 128,202"/>
+ </g>
+ <path d="M128,12 A116,116 0 0,1 244,128"/>
+ <path d="M128,54 A74,74 0 0,1 202,128"/>
+ </g>
+</svg>
diff --git a/public/themes/icons/link.svg b/p/themes/icons/link.svg
index ddc8e0706..ddc8e0706 100644
--- a/public/themes/icons/link.svg
+++ b/p/themes/icons/link.svg
diff --git a/public/themes/icons/login.svg b/p/themes/icons/login.svg
index 0a8af162f..0a8af162f 100644
--- a/public/themes/icons/login.svg
+++ b/p/themes/icons/login.svg
diff --git a/public/themes/icons/logout.svg b/p/themes/icons/logout.svg
index 284a67578..284a67578 100644
--- a/public/themes/icons/logout.svg
+++ b/p/themes/icons/logout.svg
diff --git a/public/themes/icons/next.svg b/p/themes/icons/next.svg
index 72637b4e6..72637b4e6 100644
--- a/public/themes/icons/next.svg
+++ b/p/themes/icons/next.svg
diff --git a/public/themes/icons/non-starred.svg b/p/themes/icons/non-starred.svg
index 346717f78..346717f78 100644
--- a/public/themes/icons/non-starred.svg
+++ b/p/themes/icons/non-starred.svg
diff --git a/public/themes/icons/previous.svg b/p/themes/icons/prev.svg
index 67685c50c..67685c50c 100644
--- a/public/themes/icons/previous.svg
+++ b/p/themes/icons/prev.svg
diff --git a/public/themes/icons/read.svg b/p/themes/icons/read.svg
index 932bfd860..932bfd860 100644
--- a/public/themes/icons/read.svg
+++ b/p/themes/icons/read.svg
diff --git a/public/themes/icons/refresh.svg b/p/themes/icons/refresh.svg
index 11728fc5d..11728fc5d 100644
--- a/public/themes/icons/refresh.svg
+++ b/p/themes/icons/refresh.svg
diff --git a/public/themes/icons/rss.svg b/p/themes/icons/rss.svg
index ceaddceee..ceaddceee 100644
--- a/public/themes/icons/rss.svg
+++ b/p/themes/icons/rss.svg
diff --git a/public/themes/icons/search.svg b/p/themes/icons/search.svg
index acfb364cc..acfb364cc 100644
--- a/public/themes/icons/search.svg
+++ b/p/themes/icons/search.svg
diff --git a/public/themes/icons/share.svg b/p/themes/icons/share.svg
index 443321882..443321882 100644
--- a/public/themes/icons/share.svg
+++ b/p/themes/icons/share.svg
diff --git a/p/themes/icons/starred.svg b/p/themes/icons/starred.svg
new file mode 100644
index 000000000..d6e2cebb5
--- /dev/null
+++ b/p/themes/icons/starred.svg
@@ -0,0 +1,32 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+
+<svg xmlns:cc='http://creativecommons.org/ns#' xmlns:inkscape='http://www.inkscape.org/namespaces/inkscape' xmlns:svg='http://www.w3.org/2000/svg' id='svg7384' xmlns:sodipodi='http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd' sodipodi:docname='starred-symbolic.svg' version='1.1' inkscape:version='0.48.1 r9760' height='16' xmlns:dc='http://purl.org/dc/elements/1.1/' xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns#' xmlns='http://www.w3.org/2000/svg' width='16'>
+ <metadata id='metadata90'>
+ <rdf:RDF>
+ <cc:Work rdf:about=''>
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type rdf:resource='http://purl.org/dc/dcmitype/StillImage'/>
+ <dc:title>Gnome Symbolic Icon Theme</dc:title>
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <sodipodi:namedview inkscape:cy='0.50817' pagecolor='#555753' borderopacity='1' showborder='false' inkscape:bbox-paths='false' guidetolerance='10' inkscape:object-paths='true' inkscape:window-width='1457' showguides='true' inkscape:object-nodes='true' inkscape:snap-bbox='true' inkscape:pageshadow='2' inkscape:guide-bbox='true' inkscape:snap-nodes='false' bordercolor='#666666' objecttolerance='10' id='namedview88' showgrid='false' inkscape:window-maximized='0' inkscape:window-x='86' inkscape:snap-global='true' inkscape:window-y='51' gridtolerance='10' inkscape:window-height='1093' inkscape:snap-to-guides='true' inkscape:current-layer='layer9' inkscape:snap-bbox-midpoints='false' inkscape:zoom='1' inkscape:cx='19.029058' inkscape:snap-grids='true' inkscape:pageopacity='1'>
+ <inkscape:grid spacingx='1px' spacingy='1px' id='grid4866' empspacing='2' enabled='true' type='xygrid' snapvisiblegridlinesonly='true' visible='true'/>
+ </sodipodi:namedview>
+ <title id='title9167'>Gnome Symbolic Icon Theme</title>
+ <defs id='defs7386'/>
+ <g inkscape:label='status' transform='translate(-41.000202,-397)' inkscape:groupmode='layer' id='layer9' style='display:inline'>
+ <g inkscape:label='folder-remote' transform='translate(-186.9996,-599)' id='g11910-1'>
+
+ </g>
+ <path sodipodi:cy='180.96373' sodipodi:r2='3.8276224' transform='matrix(1.0472113,-0.00871584,0.00871584,1.0472113,-504.35434,220.15425)' inkscape:rounded='0.2104596' inkscape:flatsided='false' inkscape:transform-center-x='-0.0094346789' inkscape:transform-center-y='-0.69491065' d='m 530.9488,186.70897 c -0.77941,0.55189 -3.15759,-1.90601 -4.11253,-1.9179 -0.95532,-0.0119 -3.39494,2.38585 -4.16096,1.8149 -0.76573,-0.57072 0.83698,-3.59203 0.55319,-4.50391 -0.2839,-0.91223 -3.31818,-2.49151 -3.01189,-3.39647 0.30617,-0.90461 3.67487,-0.31399 4.45442,-0.86567 0.77986,-0.5519 1.3442,-3.92569 2.29952,-3.91404 0.95494,0.0116 1.43421,3.39798 2.19979,3.9689 0.76588,0.57114 4.14893,0.0653 4.43307,0.97746 0.28402,0.9118 -2.78848,2.41405 -3.09488,3.31858 -0.30652,0.90489 1.21999,3.96605 0.44027,4.51815 z' id='path11922-0' sodipodi:type='star' sodipodi:arg1='0.95492637' sodipodi:r1='7.0383992' style='color:#000000;fill:#f1c40f;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:2;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate' sodipodi:arg2='1.5829876' inkscape:randomized='0' sodipodi:cx='526.88293' sodipodi:sides='5'/>
+ </g>
+ <g inkscape:label='devices' transform='translate(-41.000202,-397)' inkscape:groupmode='layer' id='layer10'/>
+ <g inkscape:label='apps' transform='translate(-41.000202,-397)' inkscape:groupmode='layer' id='layer11'/>
+ <g inkscape:label='actions' transform='translate(-41.000202,-397)' inkscape:groupmode='layer' id='layer12'/>
+ <g inkscape:label='places' transform='translate(-41.000202,-397)' inkscape:groupmode='layer' id='layer13'/>
+ <g inkscape:label='mimetypes' transform='translate(-41.000202,-397)' inkscape:groupmode='layer' id='layer14'/>
+ <g inkscape:label='emblems' transform='translate(-41.000202,-397)' inkscape:groupmode='layer' id='layer15' style='display:inline'/>
+ <g inkscape:label='categories' transform='translate(-41.000202,-397)' inkscape:groupmode='layer' id='g4953' style='display:inline'/>
+</svg>
diff --git a/public/themes/icons/tag.svg b/p/themes/icons/tag.svg
index 688aca7a4..688aca7a4 100644
--- a/public/themes/icons/tag.svg
+++ b/p/themes/icons/tag.svg
diff --git a/public/themes/icons/unread.svg b/p/themes/icons/unread.svg
index f541fb25b..f541fb25b 100644
--- a/public/themes/icons/unread.svg
+++ b/p/themes/icons/unread.svg
diff --git a/public/themes/icons/up.svg b/p/themes/icons/up.svg
index dab31a20d..dab31a20d 100644
--- a/public/themes/icons/up.svg
+++ b/p/themes/icons/up.svg
diff --git a/public/data/.gitignore b/public/data/.gitignore
deleted file mode 100644
index 8498bc17e..000000000
--- a/public/data/.gitignore
+++ /dev/null
@@ -1,4 +0,0 @@
-favicons
-Configuration.array.php
-*.sqlite
-touch.txt \ No newline at end of file
diff --git a/public/favicon.ico b/public/favicon.ico
deleted file mode 100644
index f7ae0a5b9..000000000
--- a/public/favicon.ico
+++ /dev/null
Binary files differ
diff --git a/public/favicon.png b/public/favicon.png
deleted file mode 100644
index 3038dc3d1..000000000
--- a/public/favicon.png
+++ /dev/null
Binary files differ
diff --git a/public/index.php b/public/index.php
deleted file mode 100755
index d3b752905..000000000
--- a/public/index.php
+++ /dev/null
@@ -1,62 +0,0 @@
-<?php
-# ***** BEGIN LICENSE BLOCK *****
-# MINZ - A free PHP 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 <http://www.gnu.org/licenses/>.
-#
-# ***** END LICENSE BLOCK *****
-
-// Constantes de chemins
-define ('PUBLIC_PATH', realpath (dirname (__FILE__)));
-define ('LIB_PATH', realpath (PUBLIC_PATH . '/../lib'));
-define ('APP_PATH', realpath (PUBLIC_PATH . '/../app'));
-define ('LOG_PATH', realpath (PUBLIC_PATH . '/../log'));
-define ('CACHE_PATH', realpath (PUBLIC_PATH . '/../cache'));
-
-if (file_exists (PUBLIC_PATH . '/install.php')) {
- include ('install.php');
-} else {
- session_cache_limiter('');
- require (LIB_PATH . '/http-conditional.php');
- $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
- );
- if (httpConditional($dateLastModification, 0, 0, false, false, true)) {
- exit(); //No need to send anything
- }
-
- 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');
-
- try {
- $front_controller = new App_FrontController ();
- $front_controller->init ();
- $front_controller->run ();
- } catch (PDOConnectionException $e) {
- Minz_Log::record ($e->getMessage (), Minz_Log::ERROR);
- print '### Application problem ###<br />'."\n".'See logs files';
- }
-}
diff --git a/public/install.php b/public/install.php
deleted file mode 100644
index fa4d59f20..000000000
--- a/public/install.php
+++ /dev/null
@@ -1,701 +0,0 @@
-<?php
-
-session_start ();
-
-if (isset ($_GET['step'])) {
- define ('STEP', $_GET['step']);
-} else {
- 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` varchar(6) NOT NULL,
- `name` varchar(255) NOT NULL,
- `color` varchar(7) NOT NULL,
- PRIMARY KEY (`id`)
-);');
-
-define ('SQL_REQ_FEED', 'CREATE TABLE IF NOT EXISTS `%sfeed` (
- `id` varchar(6) NOT NULL,
- `url` text NOT NULL,
- `category` varchar(6) DEFAULT \'000000\',
- `name` varchar(255) NOT NULL,
- `website` text NOT NULL,
- `description` text NOT NULL,
- `lastUpdate` int(11) NOT NULL,
- `priority` int(2) NOT NULL DEFAULT \'10\',
- `pathEntries` varchar(500) DEFAULT NULL,
- `httpAuth` varchar(500) DEFAULT NULL,
- `error` int(1) NOT NULL DEFAULT \'0\',
- `keep_history` int(1) NOT NULL DEFAULT \'0\',
- PRIMARY KEY (`id`),
- FOREIGN KEY (`category`) REFERENCES %scategory(id) ON DELETE SET NULL ON UPDATE CASCADE
-);');
-
-define ('SQL_REQ_ENTRY', 'CREATE TABLE IF NOT EXISTS `%sentry` (
- `id` varchar(6) NOT NULL,
- `guid` text NOT NULL,
- `title` varchar(255) NOT NULL,
- `author` varchar(255) NOT NULL,
- `content` text NOT NULL,
- `link` text NOT NULL,
- `date` int(11) NOT NULL,
- `is_read` int(11) NOT NULL DEFAULT \'0\',
- `is_favorite` int(11) NOT NULL DEFAULT \'0\',
- `id_feed` varchar(6) NOT NULL,
- `tags` text NOT NULL,
- PRIMARY KEY (`id`),
- FOREIGN KEY (`id_feed`) REFERENCES %sfeed(id) ON DELETE CASCADE ON UPDATE CASCADE
-);');
-
-
-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 . '\',');
- }
- }
-}
-
-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;
-}
-
-// gestion internationalisation
-$translates = array ();
-$actual = 'en';
-function initTranslate () {
- global $translates;
- global $actual;
-
- $l = getBetterLanguage ('en');
- if (isset ($_SESSION['language'])) {
- $l = $_SESSION['language'];
- }
- $actual = $l;
-
- $file = APP_PATH . '/i18n/' . $actual . '.php';
- if (file_exists ($file)) {
- $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'])) {
- return false;
- }
-
- $_SESSION['sel'] = md5 (
- uniqid (mt_rand (), true).implode ('', stat (__FILE__))
- );
- $_SESSION['base_url'] = addslashes ($_POST['base_url']);
- $_SESSION['title'] = addslashes ($_POST['title']);
- $_SESSION['old_entries'] = $_POST['old_entries'];
- if (!is_int (intval ($_SESSION['old_entries'])) ||
- $_SESSION['old_entries'] < 1) {
- $_SESSION['old_entries'] = 3;
- }
- $_SESSION['mail_login'] = addslashes ($_POST['mail_login']);
-
- $token = '';
- if ($_SESSION['mail_login']) {
- $token = small_hash (time () . $_SESSION['sel'])
- . small_hash ($_SESSION['base_url'] . $_SESSION['sel']);
- }
-
- $file_data = PUBLIC_PATH . '/data/Configuration.array.php';
-
- $f = fopen ($file_data, 'w');
- writeLine ($f, '<?php');
- writeLine ($f, 'return array (');
- writeArray ($f, array (
- 'language' => $_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_pass'] = addslashes ($_POST['pass']);
- $_SESSION['bd_name'] = addslashes ($_POST['base']);
- $_SESSION['bd_prefix'] = addslashes ($_POST['prefix']);
-
- $file_conf = APP_PATH . '/configuration/application.ini';
- $f = fopen ($file_conf, 'w');
- writeLine ($f, '[general]');
- writeLine ($f, 'environment = "production"');
- writeLine ($f, 'use_url_rewriting = false');
- writeLine ($f, 'sel_application = "' . $_SESSION['sel'] . '"');
- writeLine ($f, 'base_url = "' . $_SESSION['base_url'] . '"');
- writeLine ($f, 'title = "' . $_SESSION['title'] . '"');
- 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, 'prefix = "' . $_SESSION['bd_prefix'] . '"');
- fclose ($f);
-
- $res = checkBD ();
-
- if ($res) {
- $_SESSION['bd_error'] = false;
- header ('Location: index.php?step=4');
- } else {
- $_SESSION['bd_error'] = true;
- }
- }
-}
-function deleteInstall () {
- $res = unlink (PUBLIC_PATH . '/install.php');
- if ($res) {
- header ('Location: index.php');
- }
-}
-
-/*** 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');
- }
-}
-function checkStep0 () {
- $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.1.0') >= 0;
- $minz = file_exists (LIB_PATH . '/minz');
- $curl = extension_loaded ('curl');
- $pdo = extension_loaded ('pdo_mysql');
- $dom = class_exists('DOMDocument');
- $cache = CACHE_PATH && is_writable (CACHE_PATH);
- $log = LOG_PATH && is_writable (LOG_PATH);
- $conf = APP_PATH && is_writable (APP_PATH . '/configuration');
- $data = is_writable (PUBLIC_PATH . '/data');
-
- return array (
- 'php' => $php ? 'ok' : 'ko',
- 'minz' => $minz ? 'ok' : 'ko',
- 'curl' => $curl ? 'ok' : 'ko',
- 'pdo-mysql' => $pdo ? 'ok' : 'ko',
- 'dom' => $dom ? 'ok' : 'ko',
- 'cache' => $cache ? 'ok' : 'ko',
- 'log' => $log ? 'ok' : 'ko',
- 'configuration' => $conf ? 'ok' : 'ko',
- 'data' => $data ? 'ok' : 'ko',
- 'all' => $php && $minz && $curl && $pdo && $dom && $cache && $log && $conf && $data ? 'ok' : 'ko'
- );
-}
-function checkStep2 () {
- $conf = isset ($_SESSION['sel']) &&
- isset ($_SESSION['base_url']) &&
- isset ($_SESSION['title']) &&
- isset ($_SESSION['old_entries']) &&
- isset ($_SESSION['mail_login']);
- $data = file_exists (PUBLIC_PATH . '/data/Configuration.array.php');
-
- return array (
- 'conf' => $conf ? 'ok' : 'ko',
- 'data' => $data ? 'ok' : 'ko',
- 'all' => $conf && $data ? 'ok' : 'ko'
- );
-}
-function checkStep3 () {
- $conf = file_exists (APP_PATH . '/configuration/application.ini');
- $bd = isset ($_SESSION['bd_type']) &&
- isset ($_SESSION['bd_host']) &&
- isset ($_SESSION['bd_user']) &&
- isset ($_SESSION['bd_pass']) &&
- isset ($_SESSION['bd_name']);
- $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;
- 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_pass'],
- $driver_options);
-
- $sql = sprintf (SQL_REQ_CREATE_DB, $_SESSION['bd_name']);
- $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'];
- } elseif($_SESSION['bd_type'] == 'sqlite') {
- $str = 'sqlite:' . PUBLIC_PATH
- . '/data/' . $_SESSION['bd_name'] . '.sqlite';
- }
-
- $c = new PDO ($str,
- $_SESSION['bd_user'],
- $_SESSION['bd_pass'],
- $driver_options);
-
- $sql = sprintf (SQL_REQ_CAT, $_SESSION['bd_prefix']);
- $res = $c->query ($sql);
-
- if (!$res) {
- $error = true;
- }
-
- $sql = sprintf (SQL_REQ_FEED, $_SESSION['bd_prefix'], $_SESSION['bd_prefix']);
- $res = $c->query ($sql);
-
- if (!$res) {
- $error = true;
- }
-
- $sql = sprintf (SQL_REQ_ENTRY, $_SESSION['bd_prefix'], $_SESSION['bd_prefix']);
- $res = $c->query ($sql);
-
- if (!$res) {
- $error = true;
- }
- } catch (PDOException $e) {
- $error = true;
- }
-
- if ($error && file_exists (APP_PATH . '/configuration/application.ini')) {
- unlink (APP_PATH . '/configuration/application.ini');
- }
-
- return !$error;
-}
-
-/*** AFFICHAGE ***/
-function printStep0 () {
- global $actual;
-?>
- <?php $s0 = checkStep0 (); if ($s0['all'] == 'ok') { ?>
- <p class="alert alert-success"><span class="alert-head"><?php echo _t ('ok'); ?></span> <?php echo _t ('language_defined'); ?></p>
- <?php } ?>
-
- <form action="index.php?step=0" method="post">
- <legend><?php echo _t ('choose_language'); ?></legend>
- <div class="form-group">
- <label class="group-name" for="language"><?php echo _t ('language'); ?></label>
- <div class="group-controls">
- <select name="language" id="language">
- <?php $languages = availableLanguages (); ?>
- <?php foreach ($languages as $short => $lib) { ?>
- <option value="<?php echo $short; ?>"<?php echo $actual == $short ? ' selected="selected"' : ''; ?>><?php echo $lib; ?></option>
- <?php } ?>
- </select>
- </div>
- </div>
-
- <div class="form-group form-actions">
- <div class="group-controls">
- <button type="submit" class="btn btn-important"><?php echo _t ('save'); ?></button>
- <button type="reset" class="btn"><?php echo _t ('cancel'); ?></button>
- <?php if ($s0['all'] == 'ok') { ?>
- <a class="btn btn-important next-step" href="?step=1"><?php echo _t ('next_step'); ?></a>
- <?php } ?>
- </div>
- </div>
- </form>
-<?php
-}
-
-function printStep1 () {
- $res = checkStep1 ();
-?>
- <noscript><p class="alert alert-warn"><span class="alert-head"><?php echo _t ('attention'); ?></span> <?php echo _t ('javascript_is_better'); ?></p></noscript>
-
- <?php if ($res['php'] == 'ok') { ?>
- <p class="alert alert-success"><span class="alert-head"><?php echo _t ('ok'); ?></span> <?php echo _t ('php_is_ok', PHP_VERSION); ?></p>
- <?php } else { ?>
- <p class="alert alert-error"><span class="alert-head"><?php echo _t ('damn'); ?></span> <?php echo _t ('php_is_nok', PHP_VERSION, '5.1.0'); ?></p>
- <?php } ?>
-
- <?php if ($res['minz'] == 'ok') { ?>
- <p class="alert alert-success"><span class="alert-head"><?php echo _t ('ok'); ?></span> <?php echo _t ('minz_is_ok'); ?></p>
- <?php } else { ?>
- <p class="alert alert-error"><span class="alert-head"><?php echo _t ('damn'); ?></span> <?php echo _t ('minz_is_nok', LIB_PATH . '/minz'); ?></p>
- <?php } ?>
-
- <?php if ($res['curl'] == 'ok') { ?>
- <?php $version = curl_version(); ?>
- <p class="alert alert-success"><span class="alert-head"><?php echo _t ('ok'); ?></span> <?php echo _t ('curl_is_ok', $version['version']); ?></p>
- <?php } else { ?>
- <p class="alert alert-error"><span class="alert-head"><?php echo _t ('damn'); ?></span> <?php echo _t ('curl_is_nok'); ?></p>
- <?php } ?>
-
- <?php if ($res['pdo-mysql'] == 'ok') { ?>
- <p class="alert alert-success"><span class="alert-head"><?php echo _t ('ok'); ?></span> <?php echo _t ('pdomysql_is_ok'); ?></p>
- <?php } else { ?>
- <p class="alert alert-error"><span class="alert-head"><?php echo _t ('damn'); ?></span> <?php echo _t ('pdomysql_is_nok'); ?></p>
- <?php } ?>
-
- <?php if ($res['dom'] == 'ok') { ?>
- <p class="alert alert-success"><span class="alert-head"><?php echo _t ('ok'); ?></span> <?php echo _t ('dom_is_ok'); ?></p>
- <?php } else { ?>
- <p class="alert alert-error"><span class="alert-head"><?php echo _t ('damn'); ?></span> <?php echo _t ('dom_is_nok'); ?></p>
- <?php } ?>
-
- <?php if ($res['cache'] == 'ok') { ?>
- <p class="alert alert-success"><span class="alert-head"><?php echo _t ('ok'); ?></span> <?php echo _t ('cache_is_ok'); ?></p>
- <?php } else { ?>
- <p class="alert alert-error"><span class="alert-head"><?php echo _t ('damn'); ?></span> <?php echo _t ('file_is_nok', PUBLIC_PATH . '/../cache'); ?></p>
- <?php } ?>
-
- <?php if ($res['log'] == 'ok') { ?>
- <p class="alert alert-success"><span class="alert-head"><?php echo _t ('ok'); ?></span> <?php echo _t ('log_is_ok'); ?></p>
- <?php } else { ?>
- <p class="alert alert-error"><span class="alert-head"><?php echo _t ('damn'); ?></span> <?php echo _t ('file_is_nok', PUBLIC_PATH . '/../log'); ?></p>
- <?php } ?>
-
- <?php if ($res['configuration'] == 'ok') { ?>
- <p class="alert alert-success"><span class="alert-head"><?php echo _t ('ok'); ?></span> <?php echo _t ('conf_is_ok'); ?></p>
- <?php } else { ?>
- <p class="alert alert-error"><span class="alert-head"><?php echo _t ('damn'); ?></span> <?php echo _t ('file_is_nok', APP_PATH . '/configuration'); ?></p>
- <?php } ?>
-
- <?php if ($res['data'] == 'ok') { ?>
- <p class="alert alert-success"><span class="alert-head"><?php echo _t ('ok'); ?></span> <?php echo _t ('data_is_ok'); ?></p>
- <?php } else { ?>
- <p class="alert alert-error"><span class="alert-head"><?php echo _t ('damn'); ?></span> <?php echo _t ('file_is_nok', PUBLIC_PATH . '/data'); ?></p>
- <?php } ?>
-
- <?php if ($res['all'] == 'ok') { ?>
- <a class="btn btn-important next-step" href="?step=2"><?php echo _t ('next_step'); ?></a>
- <?php } else { ?>
- <p class="alert alert-error"><?php echo _t ('fix_errors_before'); ?></p>
- <?php } ?>
-<?php
-}
-
-function printStep2 () {
-?>
- <?php $s2 = checkStep2 (); if ($s2['all'] == 'ok') { ?>
- <p class="alert alert-success"><span class="alert-head"><?php echo _t ('ok'); ?></span> <?php echo _t ('general_conf_is_ok'); ?></p>
- <?php } ?>
-
- <form action="index.php?step=2" method="post">
- <legend><?php echo _t ('general_configuration'); ?></legend>
- <?php
- $url = substr ($_SERVER['PHP_SELF'], 0, -10);
- ?>
- <div class="form-group" style="display:none">
- <!-- TODO: if no problem during version 0.6, remove for version 0.7 -->
- <label class="group-name" for="base_url"><?php echo _t ('base_url'); ?></label>
- <div class="group-controls">
- <input type="text" id="base_url" name="base_url" value="<?php echo isset ($_SESSION['base_url']) ? $_SESSION['base_url'] : $url; ?>" /> <i class="icon i_help"></i> <?php echo _t ('do_not_change_if_doubt'); ?>
- </div>
- </div>
-
- <div class="form-group">
- <label class="group-name" for="title"><?php echo _t ('title'); ?></label>
- <div class="group-controls">
- <input type="text" id="title" name="title" value="<?php echo isset ($_SESSION['title']) ? $_SESSION['title'] : _t ('freshrss'); ?>" />
- </div>
- </div>
-
- <div class="form-group">
- <label class="group-name" for="old_entries"><?php echo _t ('delete_articles_every'); ?></label>
- <div class="group-controls">
- <input type="number" id="old_entries" name="old_entries" value="<?php echo isset ($_SESSION['old_entries']) ? $_SESSION['old_entries'] : '3'; ?>" /> <?php echo _t ('month'); ?>
- </div>
- </div>
-
- <div class="form-group">
- <label class="group-name" for="mail_login"><?php echo _t ('persona_connection_email'); ?></label>
- <div class="group-controls">
- <input type="email" id="mail_login" name="mail_login" value="<?php echo isset ($_SESSION['mail_login']) ? $_SESSION['mail_login'] : ''; ?>" placeholder="<?php echo _t ('blank_to_disable'); ?>" />
- <noscript><b><?php echo _t ('javascript_should_be_activated'); ?></b></noscript>
- </div>
- </div>
-
- <div class="form-group form-actions">
- <div class="group-controls">
- <button type="submit" class="btn btn-important"><?php echo _t ('save'); ?></button>
- <button type="reset" class="btn"><?php echo _t ('cancel'); ?></button>
- <?php if ($s2['all'] == 'ok') { ?>
- <a class="btn btn-important next-step" href="?step=3"><?php echo _t ('next_step'); ?></a>
- <?php } ?>
- </div>
- </div>
- </form>
-<?php
-}
-
-function printStep3 () {
-?>
- <?php $s3 = checkStep3 (); if ($s3['all'] == 'ok') { ?>
- <p class="alert alert-success"><span class="alert-head"><?php echo _t ('ok'); ?></span> <?php echo _t ('bdd_conf_is_ok'); ?></p>
- <?php } elseif ($s3['conn'] == 'ko') { ?>
- <p class="alert alert-error"><span class="alert-head"><?php echo _t ('damn'); ?></span> <?php echo _t ('bdd_conf_is_ko'); ?></p>
- <?php } ?>
-
- <form action="index.php?step=3" method="post">
- <legend><?php echo _t ('bdd_configuration'); ?></legend>
- <!--
- TODO : l'utilisation de SQLite n'est pas encore possible. Pour tester tout de même, décommentez ce bloc
- <div class="form-group">
- <label class="group-name" for="type"><?php echo _t ('bdd_type'); ?></label>
- <div class="group-controls">
- <select name="type" id="type">
- <option value="mysql"
- <?php echo $_SESSION['bd_type'] && $_SESSION['bd_type'] == 'mysql' ? 'selected="selected"' : ''; ?>>
- MySQL
- </option>
- <option value="sqlite"
- <?php echo $_SESSION['bd_type'] && $_SESSION['bd_type'] == 'sqlite' ? 'selected="selected"' : ''; ?>>
- SQLite
- </option>
- </select>
- </div>
- </div>
- -->
-
- <div class="form-group">
- <label class="group-name" for="host"><?php echo _t ('host'); ?></label>
- <div class="group-controls">
- <input type="text" id="host" name="host" value="<?php echo isset ($_SESSION['bd_host']) ? $_SESSION['bd_host'] : 'localhost'; ?>" />
- </div>
- </div>
-
- <div class="form-group">
- <label class="group-name" for="user"><?php echo _t ('username'); ?></label>
- <div class="group-controls">
- <input type="text" id="user" name="user" value="<?php echo isset ($_SESSION['bd_user']) ? $_SESSION['bd_user'] : ''; ?>" />
- </div>
- </div>
-
- <div class="form-group">
- <label class="group-name" for="pass"><?php echo _t ('password'); ?></label>
- <div class="group-controls">
- <input type="password" id="pass" name="pass" value="<?php echo isset ($_SESSION['bd_pass']) ? $_SESSION['bd_pass'] : ''; ?>" />
- </div>
- </div>
-
- <div class="form-group">
- <label class="group-name" for="base"><?php echo _t ('bdd'); ?></label>
- <div class="group-controls">
- <input type="text" id="base" name="base" value="<?php echo isset ($_SESSION['bd_name']) ? $_SESSION['bd_name'] : ''; ?>" />
- </div>
- </div>
-
- <div class="form-group">
- <label class="group-name" for="prefix"><?php echo _t ('prefix'); ?></label>
- <div class="group-controls">
- <input type="text" id="prefix" name="prefix" value="<?php echo isset ($_SESSION['bd_prefix']) ? $_SESSION['bd_prefix'] : 'freshrss_'; ?>" />
- </div>
- </div>
-
- <div class="form-group form-actions">
- <div class="group-controls">
- <button type="submit" class="btn btn-important"><?php echo _t ('save'); ?></button>
- <button type="reset" class="btn"><?php echo _t ('cancel'); ?></button>
- <?php if ($s3['all'] == 'ok') { ?>
- <a class="btn btn-important next-step" href="?step=4"><?php echo _t ('next_step'); ?></a>
- <?php } ?>
- </div>
- </div>
- </form>
-<?php
-}
-
-function printStep4 () {
-?>
- <p class="alert alert-success"><span class="alert-head"><?php echo _t ('congratulations'); ?></span> <?php echo _t ('installation_is_ok'); ?></p>
- <a class="btn btn-important next-step" href="?step=5"><?php echo _t ('finish_installation'); ?></a>
-<?php
-}
-
-function printStep5 () {
-?>
- <p class="alert alert-error"><span class="alert-head"><?php echo _t ('oops'); ?></span> <?php echo _t ('install_not_deleted', PUBLIC_PATH . '/install.php'); ?></p>
-<?php
-}
-
-initTranslate ();
-
-checkStep ();
-
-switch (STEP) {
-case 0:
-default:
- saveLanguage ();
- break;
-case 1:
- break;
-case 2:
- saveStep2 ();
- break;
-case 3:
- saveStep3 ();
- break;
-case 4:
- break;
-case 5:
- deleteInstall ();
- break;
-}
-?>
-<!DOCTYPE html>
-<html lang="fr">
- <head>
- <meta charset="utf-8">
- <meta name="viewport" content="initial-scale=1.0">
- <title><?php echo _t ('freshrss_installation'); ?></title>
- <link rel="stylesheet" type="text/css" media="all" href="themes/default/global.css" />
- <link rel="stylesheet" type="text/css" media="all" href="themes/default/freshrss.css" />
- </head>
- <body>
-
-<div class="header">
- <div class="item title">
- <h1><a href="index.php"><?php echo _t ('freshrss'); ?></a></h1>
- <h2><?php echo _t ('installation_step', STEP); ?></h2>
- </div>
-</div>
-
-<div id="global">
- <ul class="nav nav-list aside">
- <li class="nav-header"><?php echo _t ('steps'); ?></li>
- <li class="item<?php echo STEP == 0 ? ' active' : ''; ?>"><a href="?step=0"><?php echo _t ('language'); ?></a></li>
- <li class="item<?php echo STEP == 1 ? ' active' : ''; ?>"><a href="?step=1"><?php echo _t ('checks'); ?></a></li>
- <li class="item<?php echo STEP == 2 ? ' active' : ''; ?>"><a href="?step=2"><?php echo _t ('general_configuration'); ?></a></li>
- <li class="item<?php echo STEP == 3 ? ' active' : ''; ?>"><a href="?step=3"><?php echo _t ('bdd_configuration'); ?></a></li>
- <li class="item<?php echo STEP == 4 ? ' active' : ''; ?>"><a href="?step=4"><?php echo _t ('this_is_the_end'); ?></a></li>
- </ul>
-
- <div class="post">
- <?php
- switch (STEP) {
- case 0:
- default:
- printStep0 ();
- break;
- case 1:
- printStep1 ();
- break;
- case 2:
- printStep2 ();
- break;
- case 3:
- printStep3 ();
- break;
- case 4:
- printStep4 ();
- break;
- case 5:
- printStep5 ();
- break;
- }
- ?>
- </div>
-</div>
- </body>
-</html>
-
diff --git a/public/scripts/jquery-2.0.3.min.map b/public/scripts/jquery-2.0.3.min.map
deleted file mode 100644
index 472d71bb0..000000000
--- a/public/scripts/jquery-2.0.3.min.map
+++ /dev/null
@@ -1 +0,0 @@
-{"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,S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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/public/scripts/jquery.min.js b/public/scripts/jquery.min.js
deleted file mode 100644
index 2be209dd2..000000000
--- a/public/scripts/jquery.min.js
+++ /dev/null
@@ -1,6 +0,0 @@
-/*! 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="<div class='a'></div><div class='a i'></div>",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="<select><option selected=''></option></select>",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="<a href='#'></a>","#"===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="<input/>",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*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g,ct={option:[1,"<select multiple='multiple'>","</select>"],thead:[1,"<table>","</table>"],col:[2,"<table><colgroup>","</colgroup></table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],_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></$2>");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></$2>")+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("<iframe frameborder='0' width='0' height='0'/>").css("cssText","display:block !important")).appendTo(t.documentElement),t=(xt[0].contentWindow||xt[0].contentDocument).document,t.write("<!doctype html><html><body>"),t.close(),n=Mt(e,t),xt.detach()),Nt[e]=n),n}function Mt(e,t){var n=x(t.createElement(e)).appendTo(t.body),r=x.css(n[0],"display");return n.remove(),r}x.each(["height","width"],function(e,t){x.cssHooks[t]={get:function(e,n,r){return n?0===e.offsetWidth&&bt.test(x.css(e,"display"))?x.swap(e,Et,function(){return Pt(e,t,r)}):Pt(e,t,r):undefined},set:function(e,n,r){var i=r&&qt(e);return Ot(e,n,r?Ft(e,t,r,x.support.boxSizing&&"border-box"===x.css(e,"boxSizing",!1,i),i):0)}}}),x(function(){x.support.reliableMarginRight||(x.cssHooks.marginRight={get:function(e,t){return t?x.swap(e,{display:"inline-block"},vt,[e,"marginRight"]):undefined}}),!x.support.pixelPosition&&x.fn.position&&x.each(["top","left"],function(e,t){x.cssHooks[t]={get:function(e,n){return n?(n=vt(e,t),Ct.test(n)?x(e).position()[t]+"px":n):undefined}}})}),x.expr&&x.expr.filters&&(x.expr.filters.hidden=function(e){return 0>=e.offsetWidth&&0>=e.offsetHeight},x.expr.filters.visible=function(e){return!x.expr.filters.hidden(e)}),x.each({margin:"",padding:"",border:"Width"},function(e,t){x.cssHooks[e+t]={expand:function(n){var r=0,i={},o="string"==typeof n?n.split(" "):[n];for(;4>r;r++)i[e+jt[r]+t]=o[r]||o[r-2]||o[0];return i}},wt.test(e)||(x.cssHooks[e+t].set=Ot)});var Wt=/%20/g,$t=/\[\]$/,Bt=/\r?\n/g,It=/^(?:submit|button|image|reset|file)$/i,zt=/^(?:input|select|textarea|keygen)/i;x.fn.extend({serialize:function(){return x.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var e=x.prop(this,"elements");return e?x.makeArray(e):this}).filter(function(){var e=this.type;return this.name&&!x(this).is(":disabled")&&zt.test(this.nodeName)&&!It.test(e)&&(this.checked||!ot.test(e))}).map(function(e,t){var n=x(this).val();return null==n?null:x.isArray(n)?x.map(n,function(e){return{name:t.name,value:e.replace(Bt,"\r\n")}}):{name:t.name,value:n.replace(Bt,"\r\n")}}).get()}}),x.param=function(e,t){var n,r=[],i=function(e,t){t=x.isFunction(t)?t():null==t?"":t,r[r.length]=encodeURIComponent(e)+"="+encodeURIComponent(t)};if(t===undefined&&(t=x.ajaxSettings&&x.ajaxSettings.traditional),x.isArray(e)||e.jquery&&!x.isPlainObject(e))x.each(e,function(){i(this.name,this.value)});else for(n in e)_t(n,e[n],t,i);return r.join("&").replace(Wt,"+")};function _t(e,t,n,r){var i;if(x.isArray(t))x.each(t,function(t,i){n||$t.test(e)?r(e,i):_t(e+"["+("object"==typeof i?t:"")+"]",i,n,r)});else if(n||"object"!==x.type(t))r(e,t);else for(i in t)_t(e+"["+i+"]",t[i],n,r)}x.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error contextmenu".split(" "),function(e,t){x.fn[t]=function(e,n){return arguments.length>0?this.on(t,null,e,n):this.trigger(t)}}),x.fn.extend({hover:function(e,t){return this.mouseenter(e).mouseleave(t||e)},bind:function(e,t,n){return this.on(e,null,t,n)},unbind:function(e,t){return this.off(e,null,t)
-},delegate:function(e,t,n,r){return this.on(t,e,n,r)},undelegate:function(e,t,n){return 1===arguments.length?this.off(e,"**"):this.off(t,e||"**",n)}});var Xt,Ut,Yt=x.now(),Vt=/\?/,Gt=/#.*$/,Jt=/([?&])_=[^&]*/,Qt=/^(.*?):[ \t]*([^\r\n]*)$/gm,Kt=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,Zt=/^(?:GET|HEAD)$/,en=/^\/\//,tn=/^([\w.+-]+:)(?:\/\/([^\/?#:]*)(?::(\d+)|)|)/,nn=x.fn.load,rn={},on={},sn="*/".concat("*");try{Ut=i.href}catch(an){Ut=o.createElement("a"),Ut.href="",Ut=Ut.href}Xt=tn.exec(Ut.toLowerCase())||[];function un(e){return function(t,n){"string"!=typeof t&&(n=t,t="*");var r,i=0,o=t.toLowerCase().match(w)||[];if(x.isFunction(n))while(r=o[i++])"+"===r[0]?(r=r.slice(1)||"*",(e[r]=e[r]||[]).unshift(n)):(e[r]=e[r]||[]).push(n)}}function ln(e,t,n,r){var i={},o=e===on;function s(a){var u;return i[a]=!0,x.each(e[a]||[],function(e,a){var l=a(t,n,r);return"string"!=typeof l||o||i[l]?o?!(u=l):undefined:(t.dataTypes.unshift(l),s(l),!1)}),u}return s(t.dataTypes[0])||!i["*"]&&s("*")}function cn(e,t){var n,r,i=x.ajaxSettings.flatOptions||{};for(n in t)t[n]!==undefined&&((i[n]?e:r||(r={}))[n]=t[n]);return r&&x.extend(!0,e,r),e}x.fn.load=function(e,t,n){if("string"!=typeof e&&nn)return nn.apply(this,arguments);var r,i,o,s=this,a=e.indexOf(" ");return a>=0&&(r=e.slice(a),e=e.slice(0,a)),x.isFunction(t)?(n=t,t=undefined):t&&"object"==typeof t&&(i="POST"),s.length>0&&x.ajax({url:e,type:i,dataType:"html",data:t}).done(function(e){o=arguments,s.html(r?x("<div>").append(x.parseHTML(e)).find(r):e)}).complete(n&&function(e,t){s.each(n,o||[e.responseText,t,e])}),this},x.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(e,t){x.fn[t]=function(e){return this.on(t,e)}}),x.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:Ut,type:"GET",isLocal:Kt.test(Xt[1]),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":sn,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":x.parseJSON,"text xml":x.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(e,t){return t?cn(cn(e,x.ajaxSettings),t):cn(x.ajaxSettings,e)},ajaxPrefilter:un(rn),ajaxTransport:un(on),ajax:function(e,t){"object"==typeof e&&(t=e,e=undefined),t=t||{};var n,r,i,o,s,a,u,l,c=x.ajaxSetup({},t),p=c.context||c,f=c.context&&(p.nodeType||p.jquery)?x(p):x.event,h=x.Deferred(),d=x.Callbacks("once memory"),g=c.statusCode||{},m={},y={},v=0,b="canceled",T={readyState:0,getResponseHeader:function(e){var t;if(2===v){if(!o){o={};while(t=Qt.exec(i))o[t[1].toLowerCase()]=t[2]}t=o[e.toLowerCase()]}return null==t?null:t},getAllResponseHeaders:function(){return 2===v?i:null},setRequestHeader:function(e,t){var n=e.toLowerCase();return v||(e=y[n]=y[n]||e,m[e]=t),this},overrideMimeType:function(e){return v||(c.mimeType=e),this},statusCode:function(e){var t;if(e)if(2>v)for(t in e)g[t]=[g[t],e[t]];else T.always(e[T.status]);return this},abort:function(e){var t=e||b;return n&&n.abort(t),k(0,t),this}};if(h.promise(T).complete=d.add,T.success=T.done,T.error=T.fail,c.url=((e||c.url||Ut)+"").replace(Gt,"").replace(en,Xt[1]+"//"),c.type=t.method||t.type||c.method||c.type,c.dataTypes=x.trim(c.dataType||"*").toLowerCase().match(w)||[""],null==c.crossDomain&&(a=tn.exec(c.url.toLowerCase()),c.crossDomain=!(!a||a[1]===Xt[1]&&a[2]===Xt[2]&&(a[3]||("http:"===a[1]?"80":"443"))===(Xt[3]||("http:"===Xt[1]?"80":"443")))),c.data&&c.processData&&"string"!=typeof c.data&&(c.data=x.param(c.data,c.traditional)),ln(rn,c,t,T),2===v)return T;u=c.global,u&&0===x.active++&&x.event.trigger("ajaxStart"),c.type=c.type.toUpperCase(),c.hasContent=!Zt.test(c.type),r=c.url,c.hasContent||(c.data&&(r=c.url+=(Vt.test(r)?"&":"?")+c.data,delete c.data),c.cache===!1&&(c.url=Jt.test(r)?r.replace(Jt,"$1_="+Yt++):r+(Vt.test(r)?"&":"?")+"_="+Yt++)),c.ifModified&&(x.lastModified[r]&&T.setRequestHeader("If-Modified-Since",x.lastModified[r]),x.etag[r]&&T.setRequestHeader("If-None-Match",x.etag[r])),(c.data&&c.hasContent&&c.contentType!==!1||t.contentType)&&T.setRequestHeader("Content-Type",c.contentType),T.setRequestHeader("Accept",c.dataTypes[0]&&c.accepts[c.dataTypes[0]]?c.accepts[c.dataTypes[0]]+("*"!==c.dataTypes[0]?", "+sn+"; q=0.01":""):c.accepts["*"]);for(l in c.headers)T.setRequestHeader(l,c.headers[l]);if(c.beforeSend&&(c.beforeSend.call(p,T,c)===!1||2===v))return T.abort();b="abort";for(l in{success:1,error:1,complete:1})T[l](c[l]);if(n=ln(on,c,t,T)){T.readyState=1,u&&f.trigger("ajaxSend",[T,c]),c.async&&c.timeout>0&&(s=setTimeout(function(){T.abort("timeout")},c.timeout));try{v=1,n.send(m,k)}catch(C){if(!(2>v))throw C;k(-1,C)}}else k(-1,"No Transport");function k(e,t,o,a){var l,m,y,b,w,C=t;2!==v&&(v=2,s&&clearTimeout(s),n=undefined,i=a||"",T.readyState=e>0?4:0,l=e>=200&&300>e||304===e,o&&(b=pn(c,T,o)),b=fn(c,b,T,l),l?(c.ifModified&&(w=T.getResponseHeader("Last-Modified"),w&&(x.lastModified[r]=w),w=T.getResponseHeader("etag"),w&&(x.etag[r]=w)),204===e||"HEAD"===c.type?C="nocontent":304===e?C="notmodified":(C=b.state,m=b.data,y=b.error,l=!y)):(y=C,(e||!C)&&(C="error",0>e&&(e=0))),T.status=e,T.statusText=(t||C)+"",l?h.resolveWith(p,[m,C,T]):h.rejectWith(p,[T,C,y]),T.statusCode(g),g=undefined,u&&f.trigger(l?"ajaxSuccess":"ajaxError",[T,c,l?m:y]),d.fireWith(p,[T,C]),u&&(f.trigger("ajaxComplete",[T,c]),--x.active||x.event.trigger("ajaxStop")))}return T},getJSON:function(e,t,n){return x.get(e,t,n,"json")},getScript:function(e,t){return x.get(e,undefined,t,"script")}}),x.each(["get","post"],function(e,t){x[t]=function(e,n,r,i){return x.isFunction(n)&&(i=i||r,r=n,n=undefined),x.ajax({url:e,type:t,dataType:i,data:n,success:r})}});function pn(e,t,n){var r,i,o,s,a=e.contents,u=e.dataTypes;while("*"===u[0])u.shift(),r===undefined&&(r=e.mimeType||t.getResponseHeader("Content-Type"));if(r)for(i in a)if(a[i]&&a[i].test(r)){u.unshift(i);break}if(u[0]in n)o=u[0];else{for(i in n){if(!u[0]||e.converters[i+" "+u[0]]){o=i;break}s||(s=i)}o=o||s}return o?(o!==u[0]&&u.unshift(o),n[o]):undefined}function fn(e,t,n,r){var i,o,s,a,u,l={},c=e.dataTypes.slice();if(c[1])for(s in e.converters)l[s.toLowerCase()]=e.converters[s];o=c.shift();while(o)if(e.responseFields[o]&&(n[e.responseFields[o]]=t),!u&&r&&e.dataFilter&&(t=e.dataFilter(t,e.dataType)),u=o,o=c.shift())if("*"===o)o=u;else if("*"!==u&&u!==o){if(s=l[u+" "+o]||l["* "+o],!s)for(i in l)if(a=i.split(" "),a[1]===o&&(s=l[u+" "+a[0]]||l["* "+a[0]])){s===!0?s=l[i]:l[i]!==!0&&(o=a[0],c.unshift(a[1]));break}if(s!==!0)if(s&&e["throws"])t=s(t);else try{t=s(t)}catch(p){return{state:"parsererror",error:s?p:"No conversion from "+u+" to "+o}}}return{state:"success",data:t}}x.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/(?:java|ecma)script/},converters:{"text script":function(e){return x.globalEval(e),e}}}),x.ajaxPrefilter("script",function(e){e.cache===undefined&&(e.cache=!1),e.crossDomain&&(e.type="GET")}),x.ajaxTransport("script",function(e){if(e.crossDomain){var t,n;return{send:function(r,i){t=x("<script>").prop({async:!0,charset:e.scriptCharset,src:e.url}).on("load error",n=function(e){t.remove(),n=null,e&&i("error"===e.type?404:200,e.type)}),o.head.appendChild(t[0])},abort:function(){n&&n()}}}});var hn=[],dn=/(=)\?(?=&|$)|\?\?/;x.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var e=hn.pop()||x.expando+"_"+Yt++;return this[e]=!0,e}}),x.ajaxPrefilter("json jsonp",function(t,n,r){var i,o,s,a=t.jsonp!==!1&&(dn.test(t.url)?"url":"string"==typeof t.data&&!(t.contentType||"").indexOf("application/x-www-form-urlencoded")&&dn.test(t.data)&&"data");return a||"jsonp"===t.dataTypes[0]?(i=t.jsonpCallback=x.isFunction(t.jsonpCallback)?t.jsonpCallback():t.jsonpCallback,a?t[a]=t[a].replace(dn,"$1"+i):t.jsonp!==!1&&(t.url+=(Vt.test(t.url)?"&":"?")+t.jsonp+"="+i),t.converters["script json"]=function(){return s||x.error(i+" was not called"),s[0]},t.dataTypes[0]="json",o=e[i],e[i]=function(){s=arguments},r.always(function(){e[i]=o,t[i]&&(t.jsonpCallback=n.jsonpCallback,hn.push(i)),s&&x.isFunction(o)&&o(s[0]),s=o=undefined}),"script"):undefined}),x.ajaxSettings.xhr=function(){try{return new XMLHttpRequest}catch(e){}};var gn=x.ajaxSettings.xhr(),mn={0:200,1223:204},yn=0,vn={};e.ActiveXObject&&x(e).on("unload",function(){for(var e in vn)vn[e]();vn=undefined}),x.support.cors=!!gn&&"withCredentials"in gn,x.support.ajax=gn=!!gn,x.ajaxTransport(function(e){var t;return x.support.cors||gn&&!e.crossDomain?{send:function(n,r){var i,o,s=e.xhr();if(s.open(e.type,e.url,e.async,e.username,e.password),e.xhrFields)for(i in e.xhrFields)s[i]=e.xhrFields[i];e.mimeType&&s.overrideMimeType&&s.overrideMimeType(e.mimeType),e.crossDomain||n["X-Requested-With"]||(n["X-Requested-With"]="XMLHttpRequest");for(i in n)s.setRequestHeader(i,n[i]);t=function(e){return function(){t&&(delete vn[o],t=s.onload=s.onerror=null,"abort"===e?s.abort():"error"===e?r(s.status||404,s.statusText):r(mn[s.status]||s.status,s.statusText,"string"==typeof s.responseText?{text:s.responseText}:undefined,s.getAllResponseHeaders()))}},s.onload=t(),s.onerror=t("error"),t=vn[o=yn++]=t("abort"),s.send(e.hasContent&&e.data||null)},abort:function(){t&&t()}}:undefined});var xn,bn,wn=/^(?:toggle|show|hide)$/,Tn=RegExp("^(?:([+-])=|)("+b+")([a-z%]*)$","i"),Cn=/queueHooks$/,kn=[An],Nn={"*":[function(e,t){var n=this.createTween(e,t),r=n.cur(),i=Tn.exec(t),o=i&&i[3]||(x.cssNumber[e]?"":"px"),s=(x.cssNumber[e]||"px"!==o&&+r)&&Tn.exec(x.css(n.elem,e)),a=1,u=20;if(s&&s[3]!==o){o=o||s[3],i=i||[],s=+r||1;do a=a||".5",s/=a,x.style(n.elem,e,s+o);while(a!==(a=n.cur()/r)&&1!==a&&--u)}return i&&(s=n.start=+s||+r||0,n.unit=o,n.end=i[1]?s+(i[1]+1)*i[2]:+i[2]),n}]};function En(){return setTimeout(function(){xn=undefined}),xn=x.now()}function Sn(e,t,n){var r,i=(Nn[t]||[]).concat(Nn["*"]),o=0,s=i.length;for(;s>o;o++)if(r=i[o].call(n,t,e))return r}function jn(e,t,n){var r,i,o=0,s=kn.length,a=x.Deferred().always(function(){delete u.elem}),u=function(){if(i)return!1;var t=xn||En(),n=Math.max(0,l.startTime+l.duration-t),r=n/l.duration||0,o=1-r,s=0,u=l.tweens.length;for(;u>s;s++)l.tweens[s].run(o);return a.notifyWith(e,[l,o,n]),1>o&&u?n:(a.resolveWith(e,[l]),!1)},l=a.promise({elem:e,props:x.extend({},t),opts:x.extend(!0,{specialEasing:{}},n),originalProperties:t,originalOptions:n,startTime:xn||En(),duration:n.duration,tweens:[],createTween:function(t,n){var r=x.Tween(e,l.opts,t,n,l.opts.specialEasing[t]||l.opts.easing);return l.tweens.push(r),r},stop:function(t){var n=0,r=t?l.tweens.length:0;if(i)return this;for(i=!0;r>n;n++)l.tweens[n].run(1);return t?a.resolveWith(e,[l,t]):a.rejectWith(e,[l,t]),this}}),c=l.props;for(Dn(c,l.opts.specialEasing);s>o;o++)if(r=kn[o].call(l,e,c,l.opts))return r;return x.map(c,Sn,l),x.isFunction(l.opts.start)&&l.opts.start.call(e,l),x.fx.timer(x.extend(u,{elem:e,anim:l,queue:l.opts.queue})),l.progress(l.opts.progress).done(l.opts.done,l.opts.complete).fail(l.opts.fail).always(l.opts.always)}function Dn(e,t){var n,r,i,o,s;for(n in e)if(r=x.camelCase(n),i=t[r],o=e[n],x.isArray(o)&&(i=o[1],o=e[n]=o[0]),n!==r&&(e[r]=o,delete e[n]),s=x.cssHooks[r],s&&"expand"in s){o=s.expand(o),delete e[r];for(n in o)n in e||(e[n]=o[n],t[n]=i)}else t[r]=i}x.Animation=x.extend(jn,{tweener:function(e,t){x.isFunction(e)?(t=e,e=["*"]):e=e.split(" ");var n,r=0,i=e.length;for(;i>r;r++)n=e[r],Nn[n]=Nn[n]||[],Nn[n].unshift(t)},prefilter:function(e,t){t?kn.unshift(e):kn.push(e)}});function An(e,t,n){var r,i,o,s,a,u,l=this,c={},p=e.style,f=e.nodeType&&Lt(e),h=q.get(e,"fxshow");n.queue||(a=x._queueHooks(e,"fx"),null==a.unqueued&&(a.unqueued=0,u=a.empty.fire,a.empty.fire=function(){a.unqueued||u()}),a.unqueued++,l.always(function(){l.always(function(){a.unqueued--,x.queue(e,"fx").length||a.empty.fire()})})),1===e.nodeType&&("height"in t||"width"in t)&&(n.overflow=[p.overflow,p.overflowX,p.overflowY],"inline"===x.css(e,"display")&&"none"===x.css(e,"float")&&(p.display="inline-block")),n.overflow&&(p.overflow="hidden",l.always(function(){p.overflow=n.overflow[0],p.overflowX=n.overflow[1],p.overflowY=n.overflow[2]}));for(r in t)if(i=t[r],wn.exec(i)){if(delete t[r],o=o||"toggle"===i,i===(f?"hide":"show")){if("show"!==i||!h||h[r]===undefined)continue;f=!0}c[r]=h&&h[r]||x.style(e,r)}if(!x.isEmptyObject(c)){h?"hidden"in h&&(f=h.hidden):h=q.access(e,"fxshow",{}),o&&(h.hidden=!f),f?x(e).show():l.done(function(){x(e).hide()}),l.done(function(){var t;q.remove(e,"fxshow");for(t in c)x.style(e,t,c[t])});for(r in c)s=Sn(f?h[r]:0,r,l),r in h||(h[r]=s.start,f&&(s.end=s.start,s.start="width"===r||"height"===r?1:0))}}function Ln(e,t,n,r,i){return new Ln.prototype.init(e,t,n,r,i)}x.Tween=Ln,Ln.prototype={constructor:Ln,init:function(e,t,n,r,i,o){this.elem=e,this.prop=n,this.easing=i||"swing",this.options=t,this.start=this.now=this.cur(),this.end=r,this.unit=o||(x.cssNumber[n]?"":"px")},cur:function(){var e=Ln.propHooks[this.prop];return e&&e.get?e.get(this):Ln.propHooks._default.get(this)},run:function(e){var t,n=Ln.propHooks[this.prop];return this.pos=t=this.options.duration?x.easing[this.easing](e,this.options.duration*e,0,1,this.options.duration):e,this.now=(this.end-this.start)*t+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),n&&n.set?n.set(this):Ln.propHooks._default.set(this),this}},Ln.prototype.init.prototype=Ln.prototype,Ln.propHooks={_default:{get:function(e){var t;return null==e.elem[e.prop]||e.elem.style&&null!=e.elem.style[e.prop]?(t=x.css(e.elem,e.prop,""),t&&"auto"!==t?t:0):e.elem[e.prop]},set:function(e){x.fx.step[e.prop]?x.fx.step[e.prop](e):e.elem.style&&(null!=e.elem.style[x.cssProps[e.prop]]||x.cssHooks[e.prop])?x.style(e.elem,e.prop,e.now+e.unit):e.elem[e.prop]=e.now}}},Ln.propHooks.scrollTop=Ln.propHooks.scrollLeft={set:function(e){e.elem.nodeType&&e.elem.parentNode&&(e.elem[e.prop]=e.now)}},x.each(["toggle","show","hide"],function(e,t){var n=x.fn[t];x.fn[t]=function(e,r,i){return null==e||"boolean"==typeof e?n.apply(this,arguments):this.animate(qn(t,!0),e,r,i)}}),x.fn.extend({fadeTo:function(e,t,n,r){return this.filter(Lt).css("opacity",0).show().end().animate({opacity:t},e,n,r)},animate:function(e,t,n,r){var i=x.isEmptyObject(e),o=x.speed(t,n,r),s=function(){var t=jn(this,x.extend({},e),o);(i||q.get(this,"finish"))&&t.stop(!0)};return s.finish=s,i||o.queue===!1?this.each(s):this.queue(o.queue,s)},stop:function(e,t,n){var r=function(e){var t=e.stop;delete e.stop,t(n)};return"string"!=typeof e&&(n=t,t=e,e=undefined),t&&e!==!1&&this.queue(e||"fx",[]),this.each(function(){var t=!0,i=null!=e&&e+"queueHooks",o=x.timers,s=q.get(this);if(i)s[i]&&s[i].stop&&r(s[i]);else for(i in s)s[i]&&s[i].stop&&Cn.test(i)&&r(s[i]);for(i=o.length;i--;)o[i].elem!==this||null!=e&&o[i].queue!==e||(o[i].anim.stop(n),t=!1,o.splice(i,1));(t||!n)&&x.dequeue(this,e)})},finish:function(e){return e!==!1&&(e=e||"fx"),this.each(function(){var t,n=q.get(this),r=n[e+"queue"],i=n[e+"queueHooks"],o=x.timers,s=r?r.length:0;for(n.finish=!0,x.queue(this,e,[]),i&&i.stop&&i.stop.call(this,!0),t=o.length;t--;)o[t].elem===this&&o[t].queue===e&&(o[t].anim.stop(!0),o.splice(t,1));for(t=0;s>t;t++)r[t]&&r[t].finish&&r[t].finish.call(this);delete n.finish})}});function qn(e,t){var n,r={height:e},i=0;for(t=t?1:0;4>i;i+=2-t)n=jt[i],r["margin"+n]=r["padding"+n]=e;return t&&(r.opacity=r.width=e),r}x.each({slideDown:qn("show"),slideUp:qn("hide"),slideToggle:qn("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(e,t){x.fn[e]=function(e,n,r){return this.animate(t,e,n,r)}}),x.speed=function(e,t,n){var r=e&&"object"==typeof e?x.extend({},e):{complete:n||!n&&t||x.isFunction(e)&&e,duration:e,easing:n&&t||t&&!x.isFunction(t)&&t};return r.duration=x.fx.off?0:"number"==typeof r.duration?r.duration:r.duration in x.fx.speeds?x.fx.speeds[r.duration]:x.fx.speeds._default,(null==r.queue||r.queue===!0)&&(r.queue="fx"),r.old=r.complete,r.complete=function(){x.isFunction(r.old)&&r.old.call(this),r.queue&&x.dequeue(this,r.queue)},r},x.easing={linear:function(e){return e},swing:function(e){return.5-Math.cos(e*Math.PI)/2}},x.timers=[],x.fx=Ln.prototype.init,x.fx.tick=function(){var e,t=x.timers,n=0;for(xn=x.now();t.length>n;n++)e=t[n],e()||t[n]!==e||t.splice(n--,1);t.length||x.fx.stop(),xn=undefined},x.fx.timer=function(e){e()&&x.timers.push(e)&&x.fx.start()},x.fx.interval=13,x.fx.start=function(){bn||(bn=setInterval(x.fx.tick,x.fx.interval))},x.fx.stop=function(){clearInterval(bn),bn=null},x.fx.speeds={slow:600,fast:200,_default:400},x.fx.step={},x.expr&&x.expr.filters&&(x.expr.filters.animated=function(e){return x.grep(x.timers,function(t){return e===t.elem}).length}),x.fn.offset=function(e){if(arguments.length)return e===undefined?this:this.each(function(t){x.offset.setOffset(this,e,t)});var t,n,i=this[0],o={top:0,left:0},s=i&&i.ownerDocument;if(s)return t=s.documentElement,x.contains(t,i)?(typeof i.getBoundingClientRect!==r&&(o=i.getBoundingClientRect()),n=Hn(s),{top:o.top+n.pageYOffset-t.clientTop,left:o.left+n.pageXOffset-t.clientLeft}):o},x.offset={setOffset:function(e,t,n){var r,i,o,s,a,u,l,c=x.css(e,"position"),p=x(e),f={};"static"===c&&(e.style.position="relative"),a=p.offset(),o=x.css(e,"top"),u=x.css(e,"left"),l=("absolute"===c||"fixed"===c)&&(o+u).indexOf("auto")>-1,l?(r=p.position(),s=r.top,i=r.left):(s=parseFloat(o)||0,i=parseFloat(u)||0),x.isFunction(t)&&(t=t.call(e,n,a)),null!=t.top&&(f.top=t.top-a.top+s),null!=t.left&&(f.left=t.left-a.left+i),"using"in t?t.using.call(e,f):p.css(f)}},x.fn.extend({position:function(){if(this[0]){var e,t,n=this[0],r={top:0,left:0};return"fixed"===x.css(n,"position")?t=n.getBoundingClientRect():(e=this.offsetParent(),t=this.offset(),x.nodeName(e[0],"html")||(r=e.offset()),r.top+=x.css(e[0],"borderTopWidth",!0),r.left+=x.css(e[0],"borderLeftWidth",!0)),{top:t.top-r.top-x.css(n,"marginTop",!0),left:t.left-r.left-x.css(n,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){var e=this.offsetParent||s;while(e&&!x.nodeName(e,"html")&&"static"===x.css(e,"position"))e=e.offsetParent;return e||s})}}),x.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(t,n){var r="pageYOffset"===n;x.fn[t]=function(i){return x.access(this,function(t,i,o){var s=Hn(t);return o===undefined?s?s[n]:t[i]:(s?s.scrollTo(r?e.pageXOffset:o,r?o:e.pageYOffset):t[i]=o,undefined)},t,i,arguments.length,null)}});function Hn(e){return x.isWindow(e)?e:9===e.nodeType&&e.defaultView}x.each({Height:"height",Width:"width"},function(e,t){x.each({padding:"inner"+e,content:t,"":"outer"+e},function(n,r){x.fn[r]=function(r,i){var o=arguments.length&&(n||"boolean"!=typeof r),s=n||(r===!0||i===!0?"margin":"border");return x.access(this,function(t,n,r){var i;return x.isWindow(t)?t.document.documentElement["client"+e]:9===t.nodeType?(i=t.documentElement,Math.max(t.body["scroll"+e],i["scroll"+e],t.body["offset"+e],i["offset"+e],i["client"+e])):r===undefined?x.css(t,n,s):x.style(t,n,r,s)},t,o?r:undefined,o,null)}})}),x.fn.size=function(){return this.length},x.fn.andSelf=x.fn.addBack,"object"==typeof module&&module&&"object"==typeof module.exports?module.exports=x:"function"==typeof define&&define.amd&&define("jquery",[],function(){return x}),"object"==typeof e&&"object"==typeof e.document&&(e.jQuery=e.$=x)})(window);
diff --git a/public/themes/flat-design/icons/add.png b/public/themes/flat-design/icons/add.png
deleted file mode 100644
index 237de3e15..000000000
--- a/public/themes/flat-design/icons/add.png
+++ /dev/null
Binary files differ
diff --git a/public/themes/flat-design/icons/all.png b/public/themes/flat-design/icons/all.png
deleted file mode 100644
index 6d8338ac7..000000000
--- a/public/themes/flat-design/icons/all.png
+++ /dev/null
Binary files differ
diff --git a/public/themes/flat-design/icons/close.png b/public/themes/flat-design/icons/close.png
deleted file mode 100644
index 1f91a4f4e..000000000
--- a/public/themes/flat-design/icons/close.png
+++ /dev/null
Binary files differ
diff --git a/public/themes/flat-design/icons/configure.png b/public/themes/flat-design/icons/configure.png
deleted file mode 100644
index 982c24619..000000000
--- a/public/themes/flat-design/icons/configure.png
+++ /dev/null
Binary files differ
diff --git a/public/themes/flat-design/icons/down.png b/public/themes/flat-design/icons/down.png
deleted file mode 100644
index 4603976ac..000000000
--- a/public/themes/flat-design/icons/down.png
+++ /dev/null
Binary files differ
diff --git a/public/themes/flat-design/icons/next.png b/public/themes/flat-design/icons/next.png
deleted file mode 100644
index d240ac6eb..000000000
--- a/public/themes/flat-design/icons/next.png
+++ /dev/null
Binary files differ
diff --git a/public/themes/flat-design/icons/previous.png b/public/themes/flat-design/icons/previous.png
deleted file mode 100644
index b541f6c0c..000000000
--- a/public/themes/flat-design/icons/previous.png
+++ /dev/null
Binary files differ
diff --git a/public/themes/flat-design/icons/refresh.png b/public/themes/flat-design/icons/refresh.png
deleted file mode 100644
index 2fdd1b0a5..000000000
--- a/public/themes/flat-design/icons/refresh.png
+++ /dev/null
Binary files differ
diff --git a/public/themes/flat-design/icons/search.png b/public/themes/flat-design/icons/search.png
deleted file mode 100644
index 60e25d121..000000000
--- a/public/themes/flat-design/icons/search.png
+++ /dev/null
Binary files differ
diff --git a/public/themes/flat-design/icons/up.png b/public/themes/flat-design/icons/up.png
deleted file mode 100644
index 3a6fcd898..000000000
--- a/public/themes/flat-design/icons/up.png
+++ /dev/null
Binary files differ
diff --git a/public/themes/icons/add.png b/public/themes/icons/add.png
deleted file mode 100644
index 90cdf4830..000000000
--- a/public/themes/icons/add.png
+++ /dev/null
Binary files differ
diff --git a/public/themes/icons/all.png b/public/themes/icons/all.png
deleted file mode 100644
index b0dbe5483..000000000
--- a/public/themes/icons/all.png
+++ /dev/null
Binary files differ
diff --git a/public/themes/icons/category-white.png b/public/themes/icons/category-white.png
deleted file mode 100644
index 9243650da..000000000
--- a/public/themes/icons/category-white.png
+++ /dev/null
Binary files differ
diff --git a/public/themes/icons/category.png b/public/themes/icons/category.png
deleted file mode 100644
index e3a9bf34b..000000000
--- a/public/themes/icons/category.png
+++ /dev/null
Binary files differ
diff --git a/public/themes/icons/close.png b/public/themes/icons/close.png
deleted file mode 100644
index 452f1d1cf..000000000
--- a/public/themes/icons/close.png
+++ /dev/null
Binary files differ
diff --git a/public/themes/icons/configure.png b/public/themes/icons/configure.png
deleted file mode 100644
index 8c6fb531c..000000000
--- a/public/themes/icons/configure.png
+++ /dev/null
Binary files differ
diff --git a/public/themes/icons/down.png b/public/themes/icons/down.png
deleted file mode 100644
index 5a647245f..000000000
--- a/public/themes/icons/down.png
+++ /dev/null
Binary files differ
diff --git a/public/themes/icons/help.png b/public/themes/icons/help.png
deleted file mode 100644
index aa63c5411..000000000
--- a/public/themes/icons/help.png
+++ /dev/null
Binary files differ
diff --git a/public/themes/icons/icon-128.png b/public/themes/icons/icon-128.png
deleted file mode 100644
index 41f8eaa0f..000000000
--- a/public/themes/icons/icon-128.png
+++ /dev/null
Binary files differ
diff --git a/public/themes/icons/icon-16.png b/public/themes/icons/icon-16.png
deleted file mode 100644
index cc6efb54b..000000000
--- a/public/themes/icons/icon-16.png
+++ /dev/null
Binary files differ
diff --git a/public/themes/icons/icon-256.png b/public/themes/icons/icon-256.png
deleted file mode 100644
index 979581a75..000000000
--- a/public/themes/icons/icon-256.png
+++ /dev/null
Binary files differ
diff --git a/public/themes/icons/icon-32.png b/public/themes/icons/icon-32.png
deleted file mode 100644
index 00c4ce2a9..000000000
--- a/public/themes/icons/icon-32.png
+++ /dev/null
Binary files differ
diff --git a/public/themes/icons/icon-64.png b/public/themes/icons/icon-64.png
deleted file mode 100644
index e2dad000d..000000000
--- a/public/themes/icons/icon-64.png
+++ /dev/null
Binary files differ
diff --git a/public/themes/icons/icon.svg b/public/themes/icons/icon.svg
deleted file mode 100644
index 8aefed2ad..000000000
--- a/public/themes/icons/icon.svg
+++ /dev/null
@@ -1,213 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<!-- Created with Inkscape (http://www.inkscape.org/) -->
-
-<svg
- xmlns:dc="http://purl.org/dc/elements/1.1/"
- xmlns:cc="http://creativecommons.org/ns#"
- xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
- xmlns:svg="http://www.w3.org/2000/svg"
- xmlns="http://www.w3.org/2000/svg"
- xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
- xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
- width="256"
- height="256"
- id="svg2"
- version="1.1"
- inkscape:version="0.48.4 r9939"
- sodipodi:docname="icon.svg"
- inkscape:export-filename="/home/cyp/Bureau/FreshRSS.png"
- inkscape:export-xdpi="197"
- inkscape:export-ydpi="197">
- <title
- id="title2991">Logo FreshRSS</title>
- <defs
- id="defs4" />
- <sodipodi:namedview
- id="base"
- pagecolor="#ffffff"
- bordercolor="#666666"
- borderopacity="1.0"
- inkscape:pageopacity="0"
- inkscape:pageshadow="2"
- inkscape:zoom="1.0000001"
- inkscape:cx="211.05579"
- inkscape:cy="58.65406"
- inkscape:document-units="px"
- inkscape:current-layer="layer1"
- showgrid="false"
- inkscape:window-width="1366"
- inkscape:window-height="711"
- inkscape:window-x="0"
- inkscape:window-y="25"
- inkscape:window-maximized="1"
- inkscape:snap-global="true"
- fit-margin-top="0"
- fit-margin-left="0"
- fit-margin-right="0"
- fit-margin-bottom="0"
- inkscape:showpageshadow="false" />
- <metadata
- id="metadata7">
- <rdf:RDF>
- <cc:Work
- rdf:about="">
- <dc:format>image/svg+xml</dc:format>
- <dc:type
- rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
- <dc:title>Logo FreshRSS</dc:title>
- <dc:date>2013-08-20</dc:date>
- <dc:creator>
- <cc:Agent>
- <dc:title>Cyprien POUZENC</dc:title>
- </cc:Agent>
- </dc:creator>
- <dc:rights>
- <cc:Agent>
- <dc:title />
- </cc:Agent>
- </dc:rights>
- <cc:license
- rdf:resource="http://creativecommons.org/licenses/by-sa/3.0/" />
- </cc:Work>
- <cc:License
- rdf:about="http://creativecommons.org/licenses/by-sa/3.0/">
- <cc:permits
- rdf:resource="http://creativecommons.org/ns#Reproduction" />
- <cc:permits
- rdf:resource="http://creativecommons.org/ns#Distribution" />
- <cc:requires
- rdf:resource="http://creativecommons.org/ns#Notice" />
- <cc:requires
- rdf:resource="http://creativecommons.org/ns#Attribution" />
- <cc:permits
- rdf:resource="http://creativecommons.org/ns#DerivativeWorks" />
- <cc:requires
- rdf:resource="http://creativecommons.org/ns#ShareAlike" />
- </cc:License>
- </rdf:RDF>
- </metadata>
- <g
- inkscape:label="Calque 1"
- inkscape:groupmode="layer"
- id="layer1"
- transform="translate(27,-823.3622)">
- <path
- style="color:#000000;fill:#0062be;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:4;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
- d="m 101,823.3622 0,23.704 c 57.60125,0 104.2963,46.6944 104.2963,104.296 l 23.7037,0 c 0,-70.6912 -57.30755,-128 -128,-128 z"
- id="path2990-22"
- inkscape:connector-curvature="0"
- inkscape:transform-center-x="-64"
- inkscape:transform-center-y="-63.999956"
- inkscape:export-xdpi="197"
- inkscape:export-ydpi="197" />
- <path
- style="color:#000000;fill:#0062be;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:4;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
- d="m 101,866.0294 0,23.704 c 34.0371,0 61.62963,27.592 61.62963,61.6288 l 23.7037,0 c 0,-47.128 -38.20503,-85.3328 -85.33333,-85.3328 z"
- id="path2990-3"
- inkscape:connector-curvature="0"
- inkscape:transform-center-x="-42.666665"
- inkscape:transform-center-y="-42.666356"
- inkscape:export-xdpi="197"
- inkscape:export-ydpi="197" />
- <path
- sodipodi:type="arc"
- style="color:#000000;fill:#0062be;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:4;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
- id="path2990"
- sodipodi:cx="-0.088388346"
- sodipodi:cy="50"
- sodipodi:rx="3.9774756"
- sodipodi:ry="3.9774756"
- d="M -0.08838827,46.022524 A 3.9774756,3.9774756 0 0 1 3.8890873,50 l -3.97747565,0 z"
- transform="matrix(8.3432784,0,0,8.3432808,101.73744,534.199)"
- sodipodi:start="4.712389"
- sodipodi:end="6.2831853"
- inkscape:export-xdpi="197"
- inkscape:export-ydpi="197"
- inkscape:transform-center-x="-16.592584"
- inkscape:transform-center-y="-16.591714" />
- <path
- style="color:#000000;fill:#0062be;fill-opacity:0.29591836;fill-rule:nonzero;stroke:none;stroke-width:4;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
- d="m 229,951.3622 -23.7037,0 c 0,57.6016 -46.69488,104.296 -104.2963,104.296 l 0,23.704 c 70.6925,0 128,-57.3072 128,-128 z"
- id="path2990-22-9"
- inkscape:connector-curvature="0"
- inkscape:transform-center-x="-64"
- inkscape:transform-center-y="64.000044"
- inkscape:export-xdpi="197"
- inkscape:export-ydpi="197" />
- <path
- style="color:#000000;fill:#0062be;fill-opacity:0.29591836;fill-rule:nonzero;stroke:none;stroke-width:4;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
- d="m 186.33333,951.3622 -23.7037,0 c 0,34.0368 -27.59253,61.6304 -61.62963,61.6304 l 0,23.704 c 47.12818,0 85.33333,-38.2064 85.33333,-85.3344 z"
- id="path2990-3-6"
- inkscape:connector-curvature="0"
- inkscape:transform-center-x="-42.666665"
- inkscape:transform-center-y="42.667244"
- inkscape:export-xdpi="197"
- inkscape:export-ydpi="197" />
- <path
- style="color:#000000;fill:#0062be;fill-opacity:0.29591836;fill-rule:nonzero;stroke:none;stroke-width:4;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
- d="m -27,951.3622 23.703712,0 c 0,-57.6016 46.694864,-104.296 104.296288,-104.296 l 0,-23.704 c -70.692496,0 -128,57.3088 -128,128 z"
- id="path2990-22-93"
- inkscape:connector-curvature="0"
- inkscape:transform-center-x="64"
- inkscape:transform-center-y="-63.999956"
- inkscape:export-xdpi="197"
- inkscape:export-ydpi="197" />
- <path
- style="color:#000000;fill:#0062be;fill-opacity:0.29591836;fill-rule:nonzero;stroke:none;stroke-width:4;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
- d="m 15.666656,951.3622 23.703712,0 c 0,-34.0368 27.592544,-61.6288 61.629632,-61.6288 l 0,-23.704 c -47.128176,0 -85.333344,38.2048 -85.333344,85.3328 z"
- id="path2990-3-9"
- inkscape:connector-curvature="0"
- inkscape:transform-center-x="42.666672"
- inkscape:transform-center-y="-42.666356"
- inkscape:export-xdpi="197"
- inkscape:export-ydpi="197" />
- <path
- sodipodi:type="arc"
- style="color:#000000;fill:#0062be;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:4;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
- id="path2990-1"
- sodipodi:cx="-0.088388346"
- sodipodi:cy="50"
- sodipodi:rx="3.9774756"
- sodipodi:ry="3.9774756"
- d="M -0.08838827,46.022524 A 3.9774756,3.9774756 0 0 1 3.8890873,50 l -3.97747565,0 z"
- transform="matrix(0,-8.3432784,8.3432808,0,-315.97884,950.62475)"
- sodipodi:start="4.712389"
- sodipodi:end="6.2831853"
- inkscape:export-xdpi="197"
- inkscape:export-ydpi="197"
- inkscape:transform-center-x="16.591713"
- inkscape:transform-center-y="-16.592581" />
- <path
- sodipodi:type="arc"
- style="color:#000000;fill:#0062be;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:4;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
- id="path2990-6"
- sodipodi:cx="-0.088388346"
- sodipodi:cy="50"
- sodipodi:rx="3.9774756"
- sodipodi:ry="3.9774756"
- d="M -0.08838827,46.022524 A 3.9774756,3.9774756 0 0 1 3.8890873,50 l -3.97747565,0 z"
- transform="matrix(-8.3432784,0,0,-8.3432808,100.44774,1368.3403)"
- sodipodi:start="4.712389"
- sodipodi:end="6.2831853"
- inkscape:export-xdpi="197"
- inkscape:export-ydpi="197"
- inkscape:transform-center-x="16.592584"
- inkscape:transform-center-y="16.591761" />
- <path
- sodipodi:type="arc"
- style="color:#000000;fill:#0062be;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:4;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
- id="path2990-1-6"
- sodipodi:cx="-0.088388346"
- sodipodi:cy="50"
- sodipodi:rx="3.9774756"
- sodipodi:ry="3.9774756"
- d="M -0.08838827,46.022524 A 3.9774756,3.9774756 0 0 1 3.8890873,50 l -3.97747565,0 z"
- transform="matrix(0,8.3432784,-8.3432808,0,518.16402,951.91446)"
- sodipodi:start="4.712389"
- sodipodi:end="6.2831853"
- inkscape:export-xdpi="197"
- inkscape:export-ydpi="197"
- inkscape:transform-center-x="-16.591713"
- inkscape:transform-center-y="16.592578" />
- </g>
-</svg>
diff --git a/public/themes/icons/link.png b/public/themes/icons/link.png
deleted file mode 100644
index de2b187d7..000000000
--- a/public/themes/icons/link.png
+++ /dev/null
Binary files differ
diff --git a/public/themes/icons/login.png b/public/themes/icons/login.png
deleted file mode 100644
index cebe0cf7d..000000000
--- a/public/themes/icons/login.png
+++ /dev/null
Binary files differ
diff --git a/public/themes/icons/logout.png b/public/themes/icons/logout.png
deleted file mode 100644
index 49255fccd..000000000
--- a/public/themes/icons/logout.png
+++ /dev/null
Binary files differ
diff --git a/public/themes/icons/next.png b/public/themes/icons/next.png
deleted file mode 100644
index ab3490c3b..000000000
--- a/public/themes/icons/next.png
+++ /dev/null
Binary files differ
diff --git a/public/themes/icons/non-starred.png b/public/themes/icons/non-starred.png
deleted file mode 100644
index 4aafb6d8a..000000000
--- a/public/themes/icons/non-starred.png
+++ /dev/null
Binary files differ
diff --git a/public/themes/icons/previous.png b/public/themes/icons/previous.png
deleted file mode 100644
index 10e40669e..000000000
--- a/public/themes/icons/previous.png
+++ /dev/null
Binary files differ
diff --git a/public/themes/icons/read.png b/public/themes/icons/read.png
deleted file mode 100644
index a402689c7..000000000
--- a/public/themes/icons/read.png
+++ /dev/null
Binary files differ
diff --git a/public/themes/icons/refresh.png b/public/themes/icons/refresh.png
deleted file mode 100644
index dba399981..000000000
--- a/public/themes/icons/refresh.png
+++ /dev/null
Binary files differ
diff --git a/public/themes/icons/rss.png b/public/themes/icons/rss.png
deleted file mode 100644
index c20455af0..000000000
--- a/public/themes/icons/rss.png
+++ /dev/null
Binary files differ
diff --git a/public/themes/icons/search.png b/public/themes/icons/search.png
deleted file mode 100644
index 48e7373c4..000000000
--- a/public/themes/icons/search.png
+++ /dev/null
Binary files differ
diff --git a/public/themes/icons/share.png b/public/themes/icons/share.png
deleted file mode 100644
index 74c4c5dda..000000000
--- a/public/themes/icons/share.png
+++ /dev/null
Binary files differ
diff --git a/public/themes/icons/starred.png b/public/themes/icons/starred.png
deleted file mode 100644
index ff2cf31a7..000000000
--- a/public/themes/icons/starred.png
+++ /dev/null
Binary files differ
diff --git a/public/themes/icons/tag.png b/public/themes/icons/tag.png
deleted file mode 100644
index cb1a13833..000000000
--- a/public/themes/icons/tag.png
+++ /dev/null
Binary files differ
diff --git a/public/themes/icons/unread.png b/public/themes/icons/unread.png
deleted file mode 100644
index ffcd323b1..000000000
--- a/public/themes/icons/unread.png
+++ /dev/null
Binary files differ
diff --git a/public/themes/icons/up.png b/public/themes/icons/up.png
deleted file mode 100644
index 8bfc2fb13..000000000
--- a/public/themes/icons/up.png
+++ /dev/null
Binary files differ
diff --git a/public/themes/printer/style.css b/public/themes/printer/style.css
deleted file mode 100644
index 87d019c58..000000000
--- a/public/themes/printer/style.css
+++ /dev/null
@@ -1,34 +0,0 @@
-.header,
-.aside,
-.nav_menu,
-.day,
-.flux_header,
-.flux_content .bottom,
-.pagination {
- display: none;
-}
-
-html, body {
- background: #fff;
- color: #000;
- font-family: Serif;
- font-size: 12pt;
-}
-
-#global,
-.flux_content {
- display: block !important;
-}
-
-.flux_content .content {
- width: 100% !important;
- text-align: justify;
-}
-
-.flux_content .content a {
- color: #000;
-}
-.flux_content .content a:after {
- content: " (" attr(href) ") ";
- text-decoration: underline;
-} \ No newline at end of file